Commit 8a94a5b436cf8d36125a1f5d9e547d8c76a19118

Authored by Eric Fernandez
Exists in master and in 1 other branch develop

Merge branch 'master' into 'master'

Master

See merge request modulos-npm/foca-teclado!1
... ... @@ -0,0 +1,6 @@
  1 +/node_modules
  2 +/dist
  3 +/tmp
  4 +package-lock\.json
  5 +src/etc/develop\.js
  6 +/css
... ... @@ -0,0 +1,64 @@
  1 +{
  2 + /*
  3 + * ENVIRONMENTS
  4 + * =================
  5 + */
  6 +
  7 + // Define globals exposed by modern browsers.
  8 + "browser": true,
  9 +
  10 + // Define globals exposed by jQuery.
  11 + "jquery": true,
  12 +
  13 + // Define globals exposed by Node.js.
  14 + "node": true,
  15 +
  16 + // Allow ES6.
  17 + "esversion": 6,
  18 +
  19 + /*
  20 + * ENFORCING OPTIONS
  21 + * =================
  22 + */
  23 +
  24 + // Force all variable names to use either camelCase style or UPPER_CASE
  25 + // with underscores.
  26 + "camelcase": true,
  27 +
  28 + // Prohibit use of == and != in favor of === and !==.
  29 + "eqeqeq": true,
  30 +
  31 + // Enforce tab width of 2 spaces.
  32 + "indent": 4,
  33 +
  34 + // Prohibit use of a variable before it is defined.
  35 + "latedef": true,
  36 +
  37 + // Enforce line length to 100 characters
  38 + "maxlen": 100,
  39 +
  40 + // Require capitalized names for constructor functions.
  41 + "newcap": true,
  42 +
  43 + // Enforce use of single quotation marks for strings.
  44 + "quotmark": "single",
  45 +
  46 + // Enforce placing 'use strict' at the top function scope
  47 + "strict": false,
  48 +
  49 + // Prohibit use of explicitly undeclared variables.
  50 + "undef": true,
  51 +
  52 + // Warn when variables are defined but never used.
  53 + "unused": true,
  54 +
  55 + // Para que funcione en angular
  56 + "predef": ["angular", "alert", "spyOn", "expect", "it", "inject", "beforeEach", "describe"],
  57 + /*
  58 + * RELAXING OPTIONS
  59 + * =================
  60 + */
  61 +
  62 + // Suppress warnings about == null comparisons.
  63 + "eqnull": true
  64 +}
1   -# foca-info-ticket
  1 +# foca-teclado
2 2  
3   -Componente que muestra informaciรณn de tickets
4 3 \ No newline at end of file
  4 +Componente de teclado
... ... @@ -0,0 +1,91 @@
  1 +const clean = require('gulp-clean');
  2 +const concat = require('gulp-concat');
  3 +const connect = require('gulp-connect');
  4 +const gulp = require('gulp');
  5 +const htmlmin = require('gulp-htmlmin');
  6 +const jshint = require('gulp-jshint');
  7 +const pump = require('pump');
  8 +const rename = require('gulp-rename');
  9 +const replace = require('gulp-replace');
  10 +const templateCache = require('gulp-angular-templatecache');
  11 +const uglify = require('gulp-uglify-es').default;
  12 +const sass = require('gulp-sass');
  13 +
  14 +var paths = {
  15 + dist: 'dist/',
  16 + srcJS: 'src/js/*.js',
  17 + srcViews: 'src/views/*.html',
  18 + tmp: 'tmp'
  19 +};
  20 +
  21 +gulp.task('templates', function() {
  22 + return pump(
  23 + [
  24 + gulp.src(paths.srcViews),
  25 + htmlmin(),
  26 + templateCache('views.js', {
  27 + module: 'focaTeclado',
  28 + root: ''
  29 + }),
  30 + gulp.dest(paths.tmp)
  31 + ]
  32 + );
  33 +});
  34 +
  35 +gulp.task('sass', function() {
  36 + return gulp.src('src/sass/*.scss')
  37 + .pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError))
  38 + .pipe(gulp.dest('css'));
  39 +});
  40 +
  41 +gulp.task('uglify', ['templates'], function() {
  42 + return pump(
  43 + [
  44 + gulp.src([
  45 + paths.srcJS,
  46 + 'tmp/views.js'
  47 + ]),
  48 + concat('foca-teclado.js'),
  49 + replace('src/views/', ''),
  50 + replace("'ngSanitize', 'onScreenKeyboard'", ''),
  51 + gulp.dest(paths.tmp),
  52 + rename('foca-teclado.min.js'),
  53 + uglify(),
  54 + gulp.dest(paths.dist)
  55 + ]
  56 + );
  57 +});
  58 +
  59 +gulp.task('clean', function() {
  60 + return gulp.src(['tmp', 'dist'], {read: false})
  61 + .pipe(clean());
  62 +});
  63 +
  64 +gulp.task('pre-commit', function() {
  65 + pump(
  66 + [
  67 + gulp.src(paths.srcJS),
  68 + jshint('.jshintrc'),
  69 + jshint.reporter('default'),
  70 + jshint.reporter('fail')
  71 + ]
  72 + );
  73 +});
  74 +
  75 +gulp.task('webserver', function() {
  76 + pump [
  77 + connect.server(
  78 + {
  79 + port: 3000
  80 + }
  81 + )
  82 + ]
  83 +});
  84 +
  85 +gulp.task('clean-post-install', function() {
  86 + return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js',
  87 + 'index.html'], {read: false})
  88 + .pipe(clean());
  89 +});
  90 +
  91 +gulp.task('default', ['webserver']);
... ... @@ -0,0 +1,32 @@
  1 +<html ng-app="focaTeclado">
  2 + <head>
  3 + <meta charset="UTF-8"/>
  4 + <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  5 +
  6 + <!--CSS-->
  7 + <link href="node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet"/>
  8 + <link href="node_modules/font-awesome/css/font-awesome.min.css" rel="stylesheet"/>
  9 + <link href="css/general.css" rel="stylesheet"/>
  10 +
  11 + <!--VENDOR JS-->
  12 + <script src="node_modules/jquery/dist/jquery.min.js"></script>
  13 + <script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
  14 + <script src="node_modules/angular/angular.min.js"></script>
  15 + <script src="node_modules/angular-route/angular-route.min.js"></script>
  16 + <script src="node_modules/angular-sanitize/angular-sanitize.min.js"></script>
  17 + <script
  18 + src="node_modules/angular-on-screen-keyboard/dist/angular-on-screen-keyboard.min.js">
  19 + </script>
  20 +
  21 + <!-- BUILD -->
  22 + <script src="src/js/app.js"></script>
  23 + <script src="src/js/controller.js"></script>
  24 + <!-- /BUILD -->
  25 +
  26 + <!-- CONFIG PARA DEVELOP -->
  27 + <script src="src/etc/develop.js"></script>
  28 + </head>
  29 + <body>
  30 + <foca-teclado>
  31 + </body>
  32 +</html>
... ... @@ -0,0 +1,60 @@
  1 +{
  2 + "name": "foca-teclado",
  3 + "version": "0.0.1",
  4 + "description": "Componente teclado",
  5 + "main": "dist/foca-teclado.min.js",
  6 + "scripts": {
  7 + "test": "echo \"Error: no test specified\" && exit 1",
  8 + "compile": "gulp uglify",
  9 + "gulp-pre-commit": "gulp pre-commit",
  10 + "postinstall": "npm run compile && gulp clean-post-install",
  11 + "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"
  12 + },
  13 + "pre-commit": [
  14 + "gulp-pre-commit"
  15 + ],
  16 + "repository": {
  17 + "type": "git",
  18 + "url": "https://debo.suite.repo/modulos-npm/foca-teclado.git"
  19 + },
  20 + "author": "Foca Software",
  21 + "license": "ISC",
  22 + "peerDependencies": {
  23 + "angular": "^1.7.x",
  24 + "bootstrap": "^4.1.x",
  25 + "jquery": "^3.3.x",
  26 + "font-awesome": "^4.7.x",
  27 + "gulp": "^3.9.x",
  28 + "gulp-concat": "2.6.x",
  29 + "gulp-jshint": "^2.1.x",
  30 + "gulp-rename": "^1.4.x",
  31 + "gulp-replace": "^1.0.x",
  32 + "gulp-uglify-es": "^1.0.x",
  33 + "jshint": "^2.9.x",
  34 + "pump": "^3.0.x"
  35 + },
  36 + "devDependencies": {
  37 + "angular": "^1.7.5",
  38 + "angular-route": "^1.7.5",
  39 + "bootstrap": "^4.1.3",
  40 + "font-awesome": "^4.7.0",
  41 + "gulp": "^3.9.1",
  42 + "angular-on-screen-keyboard": "git+https://github.com/ericf97/angular-on-screen-keyboard.git",
  43 + "angular-sanitize": "^1.7.5",
  44 + "gulp-angular-templatecache": "^2.2.2",
  45 + "gulp-clean": "^0.4.0",
  46 + "gulp-concat": "^2.6.1",
  47 + "gulp-connect": "^5.6.1",
  48 + "gulp-htmlmin": "^5.0.1",
  49 + "gulp-jshint": "^2.1.0",
  50 + "gulp-rename": "^1.4.0",
  51 + "gulp-replace": "^1.0.0",
  52 + "gulp-sass": "^4.0.2",
  53 + "gulp-uglify-es": "^1.0.4",
  54 + "jasmine-core": "^3.2.1",
  55 + "jquery": "^3.3.1",
  56 + "jshint": "^2.9.6",
  57 + "pre-commit": "^1.2.2",
  58 + "pump": "^3.0.0"
  59 + }
  60 +}
src/etc/develop.js.ejemplo
... ... @@ -0,0 +1,4 @@
  1 +angular.module('focaBotoneraHorizontal')
  2 + .constant("API_ENDPOINT", {
  3 + 'URL': '//127.0.0.1:9000'
  4 + });
... ... @@ -0,0 +1,9 @@
  1 +angular.module('focaTeclado', ['ngSanitize', 'onScreenKeyboard'])
  2 + .component('focaTeclado', {
  3 + templateUrl: 'src/views/teclado.html',
  4 + controller: 'focaTecladoController',
  5 + bindings: {
  6 + alfanumeric : '=?',
  7 + numeric : '=?'
  8 + }
  9 + });
src/js/controller.js
... ... @@ -0,0 +1,44 @@
  1 +angular.module('focaTeclado')
  2 + .controller('focaTecladoController', [
  3 + '$scope',
  4 + function($scope) {
  5 + $scope.rows = {};
  6 + $scope.rows.alfa = [
  7 + ['q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p'],
  8 + ['a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'รฑ'],
  9 + ['z', 'x', 'c', 'v', 'b', 'n', 'm',
  10 + {type: 'erase', colspan: 3, text: 'spr'}
  11 + ],
  12 + [
  13 + {type: 'margin', colspan: 1},
  14 + {type: 'button', colspan: 6, text: ' '}
  15 + ]
  16 + ];
  17 +
  18 + $scope.rows.numeric = [
  19 + [
  20 + {type: 'number', text: '7'},
  21 + {type: 'number', text: '8'},
  22 + {type: 'number', text: '9'}
  23 + ],
  24 + [
  25 + {type: 'number', text: '4'},
  26 + {type: 'number', text: '5'},
  27 + {type: 'number', text: '6'}
  28 + ],
  29 + [
  30 + {type: 'number', text: '1'},
  31 + {type: 'number', text: '2'},
  32 + {type: 'number', text: '3'}
  33 + ],
  34 + [
  35 + {type: 'number', text: '0', colspan: 2},
  36 + {type: 'number', text: '/'}
  37 + ],
  38 + [
  39 + {type: 'number', text: ','},
  40 + {type: 'number', text: '*'},
  41 + {type: 'number', text: '+'}
  42 + ]
  43 + ];
  44 + }]);
src/sass/_teclado.scss
... ... @@ -0,0 +1,62 @@
  1 +.keyboard {
  2 + -webkit-touch-callout: none;
  3 + -webkit-user-select: none;
  4 + -khtml-user-select: none;
  5 + -moz-user-select: none;
  6 + -ms-user-select: none;
  7 + user-select: none;
  8 +
  9 + table {
  10 + border-spacing: 10px;
  11 + border-collapse: separate;
  12 + background-color: #F1F1F1;
  13 +
  14 + td {
  15 + touch-action: none;
  16 + }
  17 + }
  18 +
  19 + .letter {
  20 + background-color: #bdbdbd;
  21 + box-shadow: 2px 2px 3px #555555;
  22 + width: 47px;
  23 + height: 50px;
  24 + text-align: center;
  25 + font-family: "arial";
  26 + cursor: pointer;
  27 + color: #000;
  28 + font-size: 22px;
  29 +
  30 + &:hover {
  31 + background-color: #fafafa;
  32 + }
  33 + &:active {
  34 + background-color: #999;
  35 + color: #fff;
  36 + }
  37 + }
  38 + .number {
  39 + background-color: #bdbdbd;
  40 + box-shadow: 2px 2px 3px #555555;
  41 + width: 47px;
  42 + height: 35px;
  43 + text-align: center;
  44 + font-family: "arial";
  45 + cursor: pointer;
  46 + color: #000;
  47 + font-size: 22px;
  48 +
  49 + &:hover {
  50 + background-color: #fafafa;
  51 + }
  52 + &:active {
  53 + background-color: #999;
  54 + color: #fff;
  55 + }
  56 + }
  57 +
  58 + .margin {
  59 + width: 40px;
  60 + height: 50px;
  61 + }
  62 +}
src/sass/general.scss
... ... @@ -0,0 +1 @@
  1 +@import 'teclado';
src/views/teclado.html
... ... @@ -0,0 +1,5 @@
  1 +<on-screen-keyboard
  2 + rows="rows"
  3 + alfanumeric="$ctrl.alfanumeric"
  4 + numeric="$ctrl.numeric"
  5 + ></on-screen-keyboard>