diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7338c6e --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +/node_modules +/dist +/tmp +package-lock\.json +src/etc/develop\.js +/css \ No newline at end of file diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 0000000..dd429f7 --- /dev/null +++ b/.jshintrc @@ -0,0 +1,64 @@ +{ + /* + * ENVIRONMENTS + * ================= + */ + + // Define globals exposed by modern browsers. + "browser": true, + + // Define globals exposed by jQuery. + "jquery": true, + + // Define globals exposed by Node.js. + "node": true, + + // Allow ES6. + "esversion": 6, + + /* + * ENFORCING OPTIONS + * ================= + */ + + // Force all variable names to use either camelCase style or UPPER_CASE + // with underscores. + "camelcase": true, + + // Prohibit use of == and != in favor of === and !==. + "eqeqeq": true, + + // Enforce tab width of 2 spaces. + "indent": 4, + + // Prohibit use of a variable before it is defined. + "latedef": true, + + // Enforce line length to 100 characters + "maxlen": 100, + + // Require capitalized names for constructor functions. + "newcap": true, + + // Enforce use of single quotation marks for strings. + "quotmark": "single", + + // Enforce placing 'use strict' at the top function scope + "strict": false, + + // Prohibit use of explicitly undeclared variables. + "undef": true, + + // Warn when variables are defined but never used. + "unused": true, + + // Para que funcione en angular + "predef": ["angular", "alert", "spyOn", "expect", "it", "inject", "beforeEach", "describe"], + /* + * RELAXING OPTIONS + * ================= + */ + + // Suppress warnings about == null comparisons. + "eqnull": true +} diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000..6cfb6c6 --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,90 @@ +const clean = require('gulp-clean'); +const concat = require('gulp-concat'); +const connect = require('gulp-connect'); +const gulp = require('gulp'); +const htmlmin = require('gulp-htmlmin'); +const jshint = require('gulp-jshint'); +const pump = require('pump'); +const rename = require('gulp-rename'); +const replace = require('gulp-replace'); +const templateCache = require('gulp-angular-templatecache'); +const uglify = require('gulp-uglify-es').default; +const sass = require('gulp-sass'); + +var paths = { + dist: 'dist/', + srcJS: 'src/js/*.js', + srcViews: 'src/views/*.html', + tmp: 'tmp' +}; + +gulp.task('templates', function() { + return pump( + [ + gulp.src(paths.srcViews), + htmlmin(), + templateCache('views.js', { + module: 'focaTeclado', + root: '' + }), + gulp.dest(paths.tmp) + ] + ); +}); + +gulp.task('sass', function() { + return gulp.src('src/sass/*.scss') + .pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError)) + .pipe(gulp.dest('css')); +}); + +gulp.task('uglify', ['templates'], function() { + return pump( + [ + gulp.src([ + paths.srcJS, + 'tmp/views.js' + ]), + concat('foca-teclado.js'), + replace('src/views/', ''), + gulp.dest(paths.tmp), + rename('foca-teclado.min.js'), + uglify(), + gulp.dest(paths.dist) + ] + ); +}); + +gulp.task('clean', function() { + return gulp.src(['tmp', 'dist'], {read: false}) + .pipe(clean()); +}); + +gulp.task('pre-commit', function() { + pump( + [ + gulp.src(paths.srcJS), + jshint('.jshintrc'), + jshint.reporter('default'), + jshint.reporter('fail') + ] + ); +}); + +gulp.task('webserver', function() { + pump [ + connect.server( + { + port: 3000 + } + ) + ] +}); + +gulp.task('clean-post-install', function() { + return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', + 'index.html'], {read: false}) + .pipe(clean()); +}); + +gulp.task('default', ['webserver']); diff --git a/index.html b/index.html new file mode 100644 index 0000000..99a53b6 --- /dev/null +++ b/index.html @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/package.json b/package.json new file mode 100644 index 0000000..6ec09ce --- /dev/null +++ b/package.json @@ -0,0 +1,62 @@ +{ + "name": "foca-info-ticket", + "version": "0.0.1", + "description": "Información Ticket", + "main": "dist/foca-info-ticket.min.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "compile": "gulp uglify", + "gulp-pre-commit": "gulp pre-commit", + "postinstall": "npm run compile && gulp clean-post-install", + "install-dev": "npm install -D angular bootstrap font-awesome gulp gulp-angular-templatecache gulp-clean gulp-concat gulp-connect gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-uglify-es jasmine-core jquery jshint pre-commit pump && npm install angular-sanitize git+https://github.com/ericf97/angular-on-screen-keyboard.git" + }, + "pre-commit": [ + "gulp-pre-commit" + ], + "repository": { + "type": "git", + "url": "https://debo.suite.repo/modulos-npm/foca-info-ticket.git" + }, + "author": "Foca Software", + "license": "ISC", + "peerDependencies": { + "angular": "^1.7.x", + "bootstrap": "^4.1.x", + "jquery": "^3.3.x", + "font-awesome": "^4.7.x", + "gulp": "^3.9.x", + "gulp-concat": "2.6.x", + "gulp-jshint": "^2.1.x", + "gulp-rename": "^1.4.x", + "gulp-replace": "^1.0.x", + "gulp-uglify-es": "^1.0.x", + "jshint": "^2.9.x", + "pump": "^3.0.x" + }, + "devDependencies": { + "angular": "^1.7.5", + "angular-route": "^1.7.5", + "bootstrap": "^4.1.3", + "font-awesome": "^4.7.0", + "gulp": "^3.9.1", + "gulp-angular-templatecache": "^2.2.2", + "gulp-clean": "^0.4.0", + "gulp-concat": "^2.6.1", + "gulp-connect": "^5.6.1", + "gulp-htmlmin": "^5.0.1", + "gulp-jshint": "^2.1.0", + "gulp-rename": "^1.4.0", + "gulp-replace": "^1.0.0", + "gulp-sass": "^4.0.2", + "gulp-uglify-es": "^1.0.4", + "jasmine-core": "^3.2.1", + "jquery": "^3.3.1", + "jshint": "^2.9.6", + "pre-commit": "^1.2.2", + "pump": "^3.0.0" + }, + "dependencies": { + "angular-on-screen-keyboard": "git+https://github.com/ericf97/angular-on-screen-keyboard.git", + "angular-sanitize": "^1.7.5" + } +} diff --git a/src/etc/develop.js.ejemplo b/src/etc/develop.js.ejemplo new file mode 100644 index 0000000..38ef4e3 --- /dev/null +++ b/src/etc/develop.js.ejemplo @@ -0,0 +1,4 @@ +angular.module('focaBotoneraHorizontal') + .constant("API_ENDPOINT", { + 'URL': '//127.0.0.1:9000' + }); diff --git a/src/js/app.js b/src/js/app.js new file mode 100644 index 0000000..2530ce7 --- /dev/null +++ b/src/js/app.js @@ -0,0 +1,9 @@ +angular.module('focaTeclado', ['ngSanitize', 'onScreenKeyboard']) + .component('focaTeclado', { + templateUrl: 'src/views/teclado.html', + controller: 'focaTecladoController', + bindings: { + alfanumeric : '=?', + numeric : '=?' + } + }); diff --git a/src/js/controller.js b/src/js/controller.js new file mode 100644 index 0000000..c580e2b --- /dev/null +++ b/src/js/controller.js @@ -0,0 +1,44 @@ +angular.module('focaTeclado') + .controller('focaTecladoController', [ + '$scope', + function($scope) { + $scope.rows = {}; + $scope.rows.alfa = [ + ['q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p'], + ['a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'ñ'], + ['z', 'x', 'c', 'v', 'b', 'n', 'm', + {type: 'erase', colspan: 3, text: 'spr'} + ], + [ + {type: 'margin', colspan: 2}, + {type: 'button', colspan: 4, text: ' '} + ] + ]; + + $scope.rows.numeric = [ + [ + {type: 'number', text: '7'}, + {type: 'number', text: '8'}, + {type: 'number', text: '9'} + ], + [ + {type: 'number', text: '4'}, + {type: 'number', text: '5'}, + {type: 'number', text: '6'} + ], + [ + {type: 'number', text: '1'}, + {type: 'number', text: '2'}, + {type: 'number', text: '3'} + ], + [ + {type: 'number', text: '0', colspan: 2}, + {type: 'number', text: '/'} + ], + [ + {type: 'number', text: ','}, + {type: 'number', text: '*'}, + {type: 'number', text: '+'} + ] + ]; + }]); diff --git a/src/sass/_teclado.scss b/src/sass/_teclado.scss new file mode 100644 index 0000000..bebcaf6 --- /dev/null +++ b/src/sass/_teclado.scss @@ -0,0 +1,63 @@ + +.keyboard { + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + + table { + border-spacing: 10px; + border-collapse: separate; + background-color: #F1F1F1; + + td{ + touch-action: none; + } + } + + .letter { + background-color: #bdbdbd; + box-shadow: 2px 2px 3px #555555; + width: 47px; + height: 50px; + text-align: center; + font-family: "arial"; + cursor: pointer; + color: #000; + font-size: 22px; + + &:hover{ + background-color: #fafafa; + } + &:active { + background-color: #999; + color: #fff; + } + } + .number { + background-color: #bdbdbd; + box-shadow: 2px 2px 3px #555555; + width: 47px; + height: 35px; + text-align: center; + font-family: "arial"; + cursor: pointer; + color: #000; + font-size: 22px; + + &:hover{ + background-color: #fafafa; + } + &:active { + background-color: #999; + color: #fff; + } + } + + .margin { + width: 40px; + height: 50px; + } +} \ No newline at end of file diff --git a/src/sass/general.scss b/src/sass/general.scss new file mode 100644 index 0000000..5bea190 --- /dev/null +++ b/src/sass/general.scss @@ -0,0 +1 @@ +@import 'teclado'; \ No newline at end of file diff --git a/src/views/teclado.html b/src/views/teclado.html new file mode 100644 index 0000000..3aae5ce --- /dev/null +++ b/src/views/teclado.html @@ -0,0 +1,2 @@ + +