Commit a451a8119fc8a1eb11844bfb08a2b88101bbf29e
1 parent
93e2018f51
Exists in
master
and in
1 other branch
Primera versión estable
Showing
11 changed files
with
377 additions
and
0 deletions
Show diff stats
.gitignore
File was created | 1 | /node_modules | |
2 | /dist | ||
3 | /tmp | ||
4 | package-lock\.json | ||
5 | src/etc/develop\.js | ||
6 | /css |
.jshintrc
File was created | 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 | } | ||
65 |
gulpfile.js
File was created | 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 | gulp.dest(paths.tmp), | ||
51 | rename('foca-teclado.min.js'), | ||
52 | uglify(), | ||
53 | gulp.dest(paths.dist) | ||
54 | ] | ||
55 | ); | ||
56 | }); | ||
57 | |||
58 | gulp.task('clean', function() { | ||
59 | return gulp.src(['tmp', 'dist'], {read: false}) | ||
60 | .pipe(clean()); | ||
61 | }); | ||
62 | |||
63 | gulp.task('pre-commit', function() { | ||
64 | pump( | ||
65 | [ | ||
66 | gulp.src(paths.srcJS), | ||
67 | jshint('.jshintrc'), | ||
68 | jshint.reporter('default'), | ||
69 | jshint.reporter('fail') | ||
70 | ] | ||
71 | ); | ||
72 | }); | ||
73 | |||
74 | gulp.task('webserver', function() { | ||
75 | pump [ | ||
76 | connect.server( | ||
77 | { | ||
78 | port: 3000 | ||
79 | } | ||
80 | ) | ||
81 | ] | ||
82 | }); | ||
83 | |||
84 | gulp.task('clean-post-install', function() { | ||
85 | return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', | ||
86 | 'index.html'], {read: false}) | ||
87 | .pipe(clean()); | ||
88 | }); | ||
89 | |||
90 | gulp.task('default', ['webserver']); | ||
91 |
index.html
File was created | 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> | ||
33 |
package.json
File was created | 1 | { | |
2 | "name": "foca-info-ticket", | ||
3 | "version": "0.0.1", | ||
4 | "description": "Información Ticket", | ||
5 | "main": "dist/foca-info-ticket.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-info-ticket.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 | "gulp-angular-templatecache": "^2.2.2", | ||
43 | "gulp-clean": "^0.4.0", | ||
44 | "gulp-concat": "^2.6.1", | ||
45 | "gulp-connect": "^5.6.1", | ||
46 | "gulp-htmlmin": "^5.0.1", | ||
47 | "gulp-jshint": "^2.1.0", | ||
48 | "gulp-rename": "^1.4.0", | ||
49 | "gulp-replace": "^1.0.0", | ||
50 | "gulp-sass": "^4.0.2", | ||
51 | "gulp-uglify-es": "^1.0.4", | ||
52 | "jasmine-core": "^3.2.1", | ||
53 | "jquery": "^3.3.1", | ||
54 | "jshint": "^2.9.6", | ||
55 | "pre-commit": "^1.2.2", | ||
56 | "pump": "^3.0.0" | ||
57 | }, | ||
58 | "dependencies": { | ||
59 | "angular-on-screen-keyboard": "git+https://github.com/ericf97/angular-on-screen-keyboard.git", | ||
60 | "angular-sanitize": "^1.7.5" | ||
61 | } | ||
62 | } | ||
63 |
src/etc/develop.js.ejemplo
File was created | 1 | angular.module('focaBotoneraHorizontal') | |
2 | .constant("API_ENDPOINT", { | ||
3 | 'URL': '//127.0.0.1:9000' | ||
4 | }); | ||
5 |
src/js/app.js
File was created | 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 | }); | ||
10 |
src/js/controller.js
File was created | 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: 2}, | ||
14 | {type: 'button', colspan: 4, 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 | }]); | ||
45 |
src/sass/_teclado.scss
File was created | 1 | ||
2 | .keyboard { | ||
3 | -webkit-touch-callout: none; | ||
4 | -webkit-user-select: none; | ||
5 | -khtml-user-select: none; | ||
6 | -moz-user-select: none; | ||
7 | -ms-user-select: none; | ||
8 | user-select: none; | ||
9 | |||
10 | table { | ||
11 | border-spacing: 10px; | ||
12 | border-collapse: separate; | ||
13 | background-color: #F1F1F1; | ||
14 | |||
15 | td{ | ||
16 | touch-action: none; | ||
17 | } | ||
18 | } | ||
19 | |||
20 | .letter { | ||
21 | background-color: #bdbdbd; | ||
22 | box-shadow: 2px 2px 3px #555555; | ||
23 | width: 47px; | ||
24 | height: 50px; | ||
25 | text-align: center; | ||
26 | font-family: "arial"; | ||
27 | cursor: pointer; | ||
28 | color: #000; | ||
29 | font-size: 22px; | ||
30 | |||
31 | &:hover{ | ||
32 | background-color: #fafafa; | ||
33 | } | ||
34 | &:active { | ||
35 | background-color: #999; | ||
36 | color: #fff; | ||
37 | } | ||
38 | } | ||
39 | .number { | ||
40 | background-color: #bdbdbd; | ||
41 | box-shadow: 2px 2px 3px #555555; | ||
42 | width: 47px; | ||
43 | height: 35px; | ||
44 | text-align: center; | ||
45 | font-family: "arial"; | ||
46 | cursor: pointer; | ||
47 | color: #000; | ||
48 | font-size: 22px; | ||
49 | |||
50 | &:hover{ | ||
51 | background-color: #fafafa; | ||
52 | } | ||
53 | &:active { | ||
54 | background-color: #999; | ||
55 | color: #fff; | ||
56 | } | ||
57 | } | ||
58 | |||
59 | .margin { | ||
60 | width: 40px; | ||
61 | height: 50px; | ||
62 | } | ||
63 | } |
src/sass/general.scss
File was created | 1 | @import 'teclado'; |
src/views/teclado.html
File was created | 1 | ||
2 | <on-screen-keyboard rows="rows" alfanumeric="$ctrl.alfanumeric" numeric="$ctrl.numeric"></on-screen-keyboard> | ||
3 |