@colijnit/sharedcomponents 1.0.2 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/README.md +8 -11
  2. package/bundles/colijnit-sharedcomponents.umd.js +1901 -0
  3. package/bundles/colijnit-sharedcomponents.umd.js.map +1 -0
  4. package/colijnit-sharedcomponents-1.0.5.tgz +0 -0
  5. package/colijnit-sharedcomponents.d.ts +12 -0
  6. package/colijnit-sharedcomponents.metadata.json +1 -0
  7. package/esm2015/colijnit-sharedcomponents.js +13 -0
  8. package/esm2015/lib/components/docsign/component/signature/signature.component.js +75 -0
  9. package/esm2015/lib/components/docsign/component/signatures/signatures.component.js +44 -0
  10. package/esm2015/lib/components/docsign/docsign.component.js +225 -0
  11. package/esm2015/lib/components/docsign/docsign.module.js +23 -0
  12. package/esm2015/lib/components/stock/stock-information/stock-information.component.js +60 -0
  13. package/esm2015/lib/components/stock/stock-information-grid/stock-information-grid.component.js +255 -0
  14. package/esm2015/lib/components/stock/stock-location/stock-location.component.js +62 -0
  15. package/esm2015/lib/components/stock/stock-transfer/co-drop-down-list-fields.interface.js +2 -0
  16. package/esm2015/lib/components/stock/stock-transfer/stock-transfer.component.js +98 -0
  17. package/esm2015/lib/components/stock/stock.component.js +74 -0
  18. package/esm2015/lib/components/stock/stock.module.js +42 -0
  19. package/esm2015/lib/factory/business-object-factory.js +120 -0
  20. package/esm2015/lib/factory/decorators/boolean.decorator.js +102 -0
  21. package/esm2015/lib/factory/decorators/complex-array.decorator.js +55 -0
  22. package/esm2015/lib/factory/decorators/complex-field.decorator.js +57 -0
  23. package/esm2015/lib/factory/decorators/date-field.decorator.js +36 -0
  24. package/esm2015/lib/factory/decorators/string-number.decorator.js +43 -0
  25. package/esm2015/lib/model/business-object.js +81 -0
  26. package/esm2015/lib/service/ione-connector-adapter.service.js +98 -0
  27. package/esm2015/lib/service/stock.service.js +28 -0
  28. package/esm2015/lib/utils/array-utils.js +183 -0
  29. package/esm2015/lib/utils/is-nill.function.js +5 -0
  30. package/esm2015/public-api.js +8 -0
  31. package/fesm2015/colijnit-sharedcomponents.js +1731 -0
  32. package/fesm2015/colijnit-sharedcomponents.js.map +1 -0
  33. package/lib/components/docsign/component/signature/signature.component.d.ts +16 -0
  34. package/{projects/sharedcomponents/src/lib → lib}/components/docsign/component/signature/style/_layout.scss +0 -0
  35. package/{projects/sharedcomponents/src/lib → lib}/components/docsign/component/signature/style/_material-definition.scss +0 -0
  36. package/{projects/sharedcomponents/src/lib → lib}/components/docsign/component/signature/style/_theme.scss +0 -0
  37. package/{projects/sharedcomponents/src/lib → lib}/components/docsign/component/signature/style/material.scss +0 -0
  38. package/lib/components/docsign/component/signatures/signatures.component.d.ts +12 -0
  39. package/{projects/sharedcomponents/src/lib → lib}/components/docsign/component/signatures/style/_layout.scss +0 -0
  40. package/{projects/sharedcomponents/src/lib → lib}/components/docsign/component/signatures/style/_material-definition.scss +0 -0
  41. package/{projects/sharedcomponents/src/lib → lib}/components/docsign/component/signatures/style/_theme.scss +0 -0
  42. package/{projects/sharedcomponents/src/lib → lib}/components/docsign/component/signatures/style/material.scss +0 -0
  43. package/lib/components/docsign/docsign.component.d.ts +92 -0
  44. package/lib/components/docsign/docsign.module.d.ts +2 -0
  45. package/{projects/sharedcomponents/src/lib → lib}/components/docsign/style/_layout.scss +0 -0
  46. package/{projects/sharedcomponents/src/lib → lib}/components/docsign/style/_material-definition.scss +0 -0
  47. package/{projects/sharedcomponents/src/lib → lib}/components/docsign/style/_theme.scss +0 -0
  48. package/{projects/sharedcomponents/src/lib → lib}/components/docsign/style/material.scss +0 -0
  49. package/lib/components/stock/stock-information/stock-information.component.d.ts +10 -0
  50. package/lib/components/stock/stock-information-grid/stock-information-grid.component.d.ts +43 -0
  51. package/lib/components/stock/stock-location/stock-location.component.d.ts +12 -0
  52. package/lib/components/stock/stock-transfer/co-drop-down-list-fields.interface.d.ts +4 -0
  53. package/lib/components/stock/stock-transfer/stock-transfer.component.d.ts +19 -0
  54. package/lib/components/stock/stock.component.d.ts +20 -0
  55. package/lib/components/stock/stock.module.d.ts +2 -0
  56. package/lib/components/stock/style/_layout.scss +206 -0
  57. package/lib/components/stock/style/_material-definition.scss +20 -0
  58. package/{projects/sharedcomponents/src/lib → lib}/components/stock/style/_theme.scss +0 -0
  59. package/{projects/sharedcomponents/src/lib → lib}/components/stock/style/material.scss +0 -0
  60. package/lib/factory/business-object-factory.d.ts +23 -0
  61. package/lib/factory/decorators/boolean.decorator.d.ts +43 -0
  62. package/lib/factory/decorators/complex-array.decorator.d.ts +25 -0
  63. package/lib/factory/decorators/complex-field.decorator.d.ts +25 -0
  64. package/lib/factory/decorators/date-field.decorator.d.ts +17 -0
  65. package/lib/factory/decorators/string-number.decorator.d.ts +22 -0
  66. package/lib/model/business-object.d.ts +7 -0
  67. package/lib/service/ione-connector-adapter.service.d.ts +17 -0
  68. package/lib/service/stock.service.d.ts +11 -0
  69. package/{projects/sharedcomponents/src/lib → lib}/style/_mixin.scss +0 -0
  70. package/{projects/sharedcomponents/src/lib → lib}/style/_variables.scss +0 -0
  71. package/lib/utils/array-utils.d.ts +57 -0
  72. package/lib/utils/is-nill.function.d.ts +1 -0
  73. package/package.json +25 -66
  74. package/{projects/sharedcomponents/src/public-api.ts → public-api.d.ts} +2 -4
  75. package/.browserslistrc +0 -16
  76. package/.editorconfig +0 -16
  77. package/.vscode/extensions.json +0 -4
  78. package/.vscode/launch.json +0 -20
  79. package/.vscode/tasks.json +0 -42
  80. package/Sharedcomponents.iml +0 -11
  81. package/angular.json +0 -133
  82. package/colijnit-sharedcomponents-1.0.2.tgz +0 -0
  83. package/karma.conf.js +0 -44
  84. package/move-assets.js +0 -14
  85. package/projects/sharedcomponents/.browserslistrc +0 -16
  86. package/projects/sharedcomponents/README.md +0 -24
  87. package/projects/sharedcomponents/karma.conf.js +0 -44
  88. package/projects/sharedcomponents/ng-package.json +0 -17
  89. package/projects/sharedcomponents/package.json +0 -15
  90. package/projects/sharedcomponents/src/lib/components/docsign/component/signature/signature.component.ts +0 -82
  91. package/projects/sharedcomponents/src/lib/components/docsign/component/signatures/signatures.component.ts +0 -50
  92. package/projects/sharedcomponents/src/lib/components/docsign/docsign.component.ts +0 -252
  93. package/projects/sharedcomponents/src/lib/components/docsign/docsign.module.ts +0 -22
  94. package/projects/sharedcomponents/src/lib/components/stock/stock-information/stock-information.component.ts +0 -56
  95. package/projects/sharedcomponents/src/lib/components/stock/stock-information-grid/stock-information-grid.component.ts +0 -279
  96. package/projects/sharedcomponents/src/lib/components/stock/stock-location/stock-location.component.ts +0 -82
  97. package/projects/sharedcomponents/src/lib/components/stock/stock-location/style/_layout.scss +0 -11
  98. package/projects/sharedcomponents/src/lib/components/stock/stock-location/style/_material-definition.scss +0 -1
  99. package/projects/sharedcomponents/src/lib/components/stock/stock-location/style/_theme.scss +0 -18
  100. package/projects/sharedcomponents/src/lib/components/stock/stock-location/style/material.scss +0 -4
  101. package/projects/sharedcomponents/src/lib/components/stock/stock-transfer/stock-transfer.component.ts +0 -52
  102. package/projects/sharedcomponents/src/lib/components/stock/stock-transfer/style/_layout.scss +0 -18
  103. package/projects/sharedcomponents/src/lib/components/stock/stock-transfer/style/_material-definition.scss +0 -1
  104. package/projects/sharedcomponents/src/lib/components/stock/stock-transfer/style/_theme.scss +0 -6
  105. package/projects/sharedcomponents/src/lib/components/stock/stock-transfer/style/material.scss +0 -4
  106. package/projects/sharedcomponents/src/lib/components/stock/stock.component.ts +0 -56
  107. package/projects/sharedcomponents/src/lib/components/stock/stock.module.ts +0 -45
  108. package/projects/sharedcomponents/src/lib/components/stock/style/_layout.scss +0 -146
  109. package/projects/sharedcomponents/src/lib/components/stock/style/_material-definition.scss +0 -1
  110. package/projects/sharedcomponents/src/lib/factory/business-object-factory.ts +0 -120
  111. package/projects/sharedcomponents/src/lib/factory/decorators/boolean.decorator.ts +0 -113
  112. package/projects/sharedcomponents/src/lib/factory/decorators/complex-array.decorator.ts +0 -61
  113. package/projects/sharedcomponents/src/lib/factory/decorators/complex-field.decorator.ts +0 -63
  114. package/projects/sharedcomponents/src/lib/factory/decorators/date-field.decorator.ts +0 -41
  115. package/projects/sharedcomponents/src/lib/factory/decorators/string-number.decorator.ts +0 -48
  116. package/projects/sharedcomponents/src/lib/model/business-object.ts +0 -85
  117. package/projects/sharedcomponents/src/lib/service/ione-connector-adapter.service.ts +0 -49
  118. package/projects/sharedcomponents/src/lib/service/stock.service.ts +0 -40
  119. package/projects/sharedcomponents/src/lib/utils/array-utils.ts +0 -202
  120. package/projects/sharedcomponents/src/lib/utils/is-nill.function.ts +0 -4
  121. package/projects/sharedcomponents/src/test.ts +0 -27
  122. package/projects/sharedcomponents/tsconfig.lib.json +0 -18
  123. package/projects/sharedcomponents/tsconfig.lib.prod.json +0 -10
  124. package/projects/sharedcomponents/tsconfig.spec.json +0 -17
  125. package/src/app/app.component.scss +0 -8
  126. package/src/app/app.component.spec.ts +0 -31
  127. package/src/app/app.component.ts +0 -75
  128. package/src/app/app.module.ts +0 -22
  129. package/src/assets/.gitkeep +0 -0
  130. package/src/environments/environment.prod.ts +0 -3
  131. package/src/environments/environment.ts +0 -16
  132. package/src/favicon.ico +0 -0
  133. package/src/index.html +0 -13
  134. package/src/main.ts +0 -12
  135. package/src/polyfills.ts +0 -53
  136. package/src/styles.scss +0 -24
  137. package/src/test.ts +0 -26
  138. package/tsconfig.app.json +0 -15
  139. package/tsconfig.json +0 -65
  140. package/tsconfig.spec.json +0 -18
@@ -1,42 +0,0 @@
1
- {
2
- // For more information, visit: https://go.microsoft.com/fwlink/?LinkId=733558
3
- "version": "2.0.0",
4
- "tasks": [
5
- {
6
- "type": "npm",
7
- "script": "start",
8
- "isBackground": true,
9
- "problemMatcher": {
10
- "owner": "typescript",
11
- "pattern": "$tsc",
12
- "background": {
13
- "activeOnStart": true,
14
- "beginsPattern": {
15
- "regexp": "(.*?)"
16
- },
17
- "endsPattern": {
18
- "regexp": "bundle generation complete"
19
- }
20
- }
21
- }
22
- },
23
- {
24
- "type": "npm",
25
- "script": "test",
26
- "isBackground": true,
27
- "problemMatcher": {
28
- "owner": "typescript",
29
- "pattern": "$tsc",
30
- "background": {
31
- "activeOnStart": true,
32
- "beginsPattern": {
33
- "regexp": "(.*?)"
34
- },
35
- "endsPattern": {
36
- "regexp": "bundle generation complete"
37
- }
38
- }
39
- }
40
- }
41
- ]
42
- }
@@ -1,11 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="WEB_MODULE" version="4">
3
- <component name="NewModuleRootManager" inherit-compiler-output="true">
4
- <exclude-output />
5
- <content url="file://$MODULE_DIR$">
6
- <excludeFolder url="file://$MODULE_DIR$/dist" />
7
- <excludeFolder url="file://$MODULE_DIR$/tmp" />
8
- </content>
9
- <orderEntry type="sourceFolder" forTests="false" />
10
- </component>
11
- </module>
package/angular.json DELETED
@@ -1,133 +0,0 @@
1
- {
2
- "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3
- "version": 1,
4
- "newProjectRoot": "projects",
5
- "projects": {
6
- "Sharedcomponents": {
7
- "projectType": "application",
8
- "schematics": {
9
- "@schematics/angular:application": {
10
- "strict": true,
11
- "style": "scss"
12
- }
13
- },
14
- "root": "",
15
- "sourceRoot": "src",
16
- "prefix": "app",
17
- "architect": {
18
- "build": {
19
- "builder": "@angular-devkit/build-angular:browser",
20
- "options": {
21
- "outputPath": "dist/sharedcomponents",
22
- "index": "src/index.html",
23
- "main": "src/main.ts",
24
- "polyfills": "src/polyfills.ts",
25
- "tsConfig": "tsconfig.app.json",
26
- "assets": [
27
- "src/favicon.ico",
28
- "src/assets"
29
- ],
30
- "styles": [
31
- "src/styles.scss"
32
- ],
33
- "stylePreprocessorOptions": {
34
- "includePaths": [
35
- "node_modules/@syncfusion",
36
- "node_modules/@colijnit",
37
- "projects/sharedcomponents/src/lib"
38
- ]
39
- },
40
- "scripts": []
41
- },
42
- "configurations": {
43
- "production": {
44
- "fileReplacements": [
45
- {
46
- "replace": "src/environments/environment.ts",
47
- "with": "src/environments/environment.prod.ts"
48
- }
49
- ],
50
- "outputHashing": "all"
51
- },
52
- "development": {
53
- "buildOptimizer": false,
54
- "optimization": false,
55
- "vendorChunk": true,
56
- "extractLicenses": false,
57
- "sourceMap": true,
58
- "namedChunks": true
59
- }
60
- },
61
- "defaultConfiguration": "production"
62
- },
63
- "serve": {
64
- "builder": "@angular-devkit/build-angular:dev-server",
65
- "configurations": {
66
- "production": {
67
- "browserTarget": "Sharedcomponents:build:production"
68
- },
69
- "development": {
70
- "browserTarget": "Sharedcomponents:build:development"
71
- }
72
- },
73
- "defaultConfiguration": "development"
74
- },
75
- "extract-i18n": {
76
- "builder": "@angular-devkit/build-angular:extract-i18n",
77
- "options": {
78
- "browserTarget": "Sharedcomponents:build"
79
- }
80
- },
81
- "test": {
82
- "builder": "@angular-devkit/build-angular:karma",
83
- "options": {
84
- "main": "src/test.ts",
85
- "polyfills": "src/polyfills.ts",
86
- "tsConfig": "tsconfig.spec.json",
87
- "karmaConfig": "karma.conf.js",
88
- "assets": [
89
- "src/favicon.ico",
90
- "src/assets"
91
- ],
92
- "styles": [
93
- "src/styles.scss"
94
- ],
95
- "scripts": []
96
- }
97
- }
98
- }
99
- },
100
- "sharedcomponents": {
101
- "projectType": "library",
102
- "root": "projects/sharedcomponents",
103
- "sourceRoot": "projects/sharedcomponents/src",
104
- "prefix": "lib",
105
- "architect": {
106
- "build": {
107
- "builder": "@angular-devkit/build-angular:ng-packagr",
108
- "options": {
109
- "project": "projects/sharedcomponents/ng-package.json"
110
- },
111
- "configurations": {
112
- "production": {
113
- "tsConfig": "projects/sharedcomponents/tsconfig.lib.prod.json"
114
- },
115
- "development": {
116
- "tsConfig": "projects/sharedcomponents/tsconfig.lib.json"
117
- }
118
- },
119
- "defaultConfiguration": "production"
120
- },
121
- "test": {
122
- "builder": "@angular-devkit/build-angular:karma",
123
- "options": {
124
- "main": "projects/sharedcomponents/src/test.ts",
125
- "tsConfig": "projects/sharedcomponents/tsconfig.spec.json",
126
- "karmaConfig": "projects/sharedcomponents/karma.conf.js"
127
- }
128
- }
129
- }
130
- }
131
- },
132
- "defaultProject": "Sharedcomponents"
133
- }
Binary file
package/karma.conf.js DELETED
@@ -1,44 +0,0 @@
1
- // Karma configuration file, see link for more information
2
- // https://karma-runner.github.io/1.0/config/configuration-file.html
3
-
4
- module.exports = function (config) {
5
- config.set({
6
- basePath: '',
7
- frameworks: ['jasmine', '@angular-devkit/build-angular'],
8
- plugins: [
9
- require('karma-jasmine'),
10
- require('karma-chrome-launcher'),
11
- require('karma-jasmine-html-reporter'),
12
- require('karma-coverage'),
13
- require('@angular-devkit/build-angular/plugins/karma')
14
- ],
15
- client: {
16
- jasmine: {
17
- // you can add configuration options for Jasmine here
18
- // the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
19
- // for example, you can disable the random execution with `random: false`
20
- // or set a specific seed with `seed: 4321`
21
- },
22
- clearContext: false // leave Jasmine Spec Runner output visible in browser
23
- },
24
- jasmineHtmlReporter: {
25
- suppressAll: true // removes the duplicated traces
26
- },
27
- coverageReporter: {
28
- dir: require('path').join(__dirname, './coverage/sharedcomponents'),
29
- subdir: '.',
30
- reporters: [
31
- { type: 'html' },
32
- { type: 'text-summary' }
33
- ]
34
- },
35
- reporters: ['progress', 'kjhtml'],
36
- port: 9876,
37
- colors: true,
38
- logLevel: config.LOG_INFO,
39
- autoWatch: true,
40
- browsers: ['Chrome'],
41
- singleRun: false,
42
- restartOnFileChange: true
43
- });
44
- };
package/move-assets.js DELETED
@@ -1,14 +0,0 @@
1
- var fs = require('fs-extra')
2
-
3
- var oldSrcPath = 'dist/sharedcomponents/src';
4
- var oldPath = 'dist/sharedcomponents/src/lib';
5
- var newPath = 'dist/sharedcomponents/lib';
6
-
7
- const copyLibFolder = async () => {
8
- await fs.copy(oldPath, newPath, function (err) {
9
- if (err) throw err;
10
- fs.rmSync(oldSrcPath, { recursive: true, force: true });
11
- console.log('Successfully moved assets!')
12
- });
13
- }
14
- copyLibFolder();
@@ -1,16 +0,0 @@
1
- # This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
2
- # For additional information regarding the format and rule options, please see:
3
- # https://github.com/browserslist/browserslist#queries
4
-
5
- # For the full list of supported browsers by the Angular framework, please see:
6
- # https://angular.io/guide/browser-support
7
-
8
- # You can see what browsers were selected by your queries by running:
9
- # npx browserslist
10
-
11
- last 1 Chrome version
12
- last 1 Firefox version
13
- last 2 Edge major versions
14
- last 2 Safari major versions
15
- last 2 iOS major versions
16
- Firefox ESR
@@ -1,24 +0,0 @@
1
- # Sharedcomponents
2
-
3
- This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 13.1.0.
4
-
5
- ## Code scaffolding
6
-
7
- Run `ng generate component component-name --project sharedcomponents` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project sharedcomponents`.
8
- > Note: Don't forget to add `--project sharedcomponents` or else it will be added to the default project in your `angular.json` file.
9
-
10
- ## Build
11
-
12
- Run `ng build sharedcomponents` to build the project. The build artifacts will be stored in the `dist/` directory.
13
-
14
- ## Publishing
15
-
16
- After building your library with `ng build sharedcomponents`, go to the dist folder `cd dist/sharedcomponents` and run `npm publish`.
17
-
18
- ## Running unit tests
19
-
20
- Run `ng test sharedcomponents` to execute the unit tests via [Karma](https://karma-runner.github.io).
21
-
22
- ## Further help
23
-
24
- To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
@@ -1,44 +0,0 @@
1
- // Karma configuration file, see link for more information
2
- // https://karma-runner.github.io/1.0/config/configuration-file.html
3
-
4
- module.exports = function (config) {
5
- config.set({
6
- basePath: '',
7
- frameworks: ['jasmine', '@angular-devkit/build-angular'],
8
- plugins: [
9
- require('karma-jasmine'),
10
- require('karma-chrome-launcher'),
11
- require('karma-jasmine-html-reporter'),
12
- require('karma-coverage'),
13
- require('@angular-devkit/build-angular/plugins/karma')
14
- ],
15
- client: {
16
- jasmine: {
17
- // you can add configuration options for Jasmine here
18
- // the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
19
- // for example, you can disable the random execution with `random: false`
20
- // or set a specific seed with `seed: 4321`
21
- },
22
- clearContext: false // leave Jasmine Spec Runner output visible in browser
23
- },
24
- jasmineHtmlReporter: {
25
- suppressAll: true // removes the duplicated traces
26
- },
27
- coverageReporter: {
28
- dir: require('path').join(__dirname, '../../coverage/sharedcomponents'),
29
- subdir: '.',
30
- reporters: [
31
- { type: 'html' },
32
- { type: 'text-summary' }
33
- ]
34
- },
35
- reporters: ['progress', 'kjhtml'],
36
- port: 9876,
37
- colors: true,
38
- logLevel: config.LOG_INFO,
39
- autoWatch: true,
40
- browsers: ['Chrome'],
41
- singleRun: false,
42
- restartOnFileChange: true
43
- });
44
- };
@@ -1,17 +0,0 @@
1
- {
2
- "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3
- "dest": "../../dist/sharedcomponents",
4
- "allowedNonPeerDependencies": [
5
- "."
6
- ],
7
- "lib": {
8
- "entryFile": "src/public-api.ts",
9
- "styleIncludePaths": [
10
- "../../node_modules/@syncfusion",
11
- "../../node_modules/@colijnit"
12
- ]
13
- },
14
- "assets": [
15
- "**/*.scss"
16
- ]
17
- }
@@ -1,15 +0,0 @@
1
- {
2
- "name": "@colijnit/sharedcomponents",
3
- "version": "1.0.1",
4
- "private": false,
5
- "peerDependencies": {
6
- "@angular/common": "^12.2.0",
7
- "@angular/core": "^12.2.0",
8
- "pdf-lib": "^1.17.1",
9
- "pdfjs-dist": "^2.12.313",
10
- "rxjs": "~7.4.0",
11
- "signature_pad": "^4.0.2",
12
- "tslib": "^2.3.0",
13
- "zone.js": "~0.11.4"
14
- }
15
- }
@@ -1,82 +0,0 @@
1
- import {Component, ElementRef, EventEmitter, HostBinding, Input, OnInit, Output, ViewChild, ViewEncapsulation} from "@angular/core";
2
- import SignaturePad from "signature_pad";
3
-
4
- @Component({
5
- selector: "ione-signature",
6
- template: `
7
- <div class="signature-wrapper">
8
- <div class="signature-header">
9
- <span *ngIf="title" class="title" [textContent]="title"></span>
10
- <div class="button-wrapper">
11
- <input type="button" (click)="handleSave($event)" [value]="saveButtonLabel"/>
12
- <input type="button" (click)="handleClear($event)" [value]="clearButtonLabel">
13
- </div>
14
- </div>
15
- <div class="canvas">
16
- <canvas #signature></canvas>
17
- </div>
18
- </div>
19
- `,
20
- encapsulation: ViewEncapsulation.None
21
- })
22
- export class SignatureComponent {
23
- @ViewChild("signature", {read: ElementRef}) set content(content: ElementRef) {
24
- if (content) {
25
- this.signatureCanvas = content;
26
- this._initCanvas();
27
- }
28
- }
29
-
30
- @Input()
31
- public title: string;
32
-
33
- @Input()
34
- public saveButtonLabel: string = 'SAVE';
35
-
36
- @Input()
37
- public clearButtonLabel: string = 'CLEAR';
38
-
39
- @Output()
40
- public save: EventEmitter<string> = new EventEmitter<string>();
41
-
42
- @HostBinding("class.ione-signature")
43
- public showClass() {
44
- return true;
45
- }
46
-
47
- public signature: SignaturePad;
48
- public signatureCanvas: ElementRef;
49
-
50
- public handleSave(event: MouseEvent): void {
51
- // save canvas as svg
52
- // const sig: string = this.signature.toDataURL("image/svg+xml");
53
- const sig: string = this.signature.toDataURL("image/png");
54
- // emit signature string
55
- this.save.next(sig);
56
- }
57
-
58
- public handleClear(event: MouseEvent): void {
59
- if (this.signature) {
60
- this.signature.clear();
61
- }
62
- }
63
-
64
- private _initCanvas(): void {
65
- if (this.signatureCanvas && this.signatureCanvas.nativeElement) {
66
- this.signature = new SignaturePad(this.signatureCanvas.nativeElement);
67
- setTimeout(() => {
68
- this._resizeSignatureCanvas(this.signature, this.signatureCanvas);
69
- });
70
- }
71
- }
72
-
73
- private _resizeSignatureCanvas(signature: SignaturePad, signatureCanvas: ElementRef): void {
74
- const imageBeforeResize: string = signature.toDataURL();
75
- const ratio: number = Math.max(window.devicePixelRatio || 1, 1);
76
- signatureCanvas.nativeElement.width = signatureCanvas.nativeElement.offsetWidth * ratio;
77
- signatureCanvas.nativeElement.height = signatureCanvas.nativeElement.offsetHeight * ratio;
78
- signatureCanvas.nativeElement.getContext("2d").scale(ratio, ratio);
79
- signature.fromDataURL(imageBeforeResize);
80
- }
81
-
82
- }
@@ -1,50 +0,0 @@
1
- import {Component, EventEmitter, HostBinding, Input, Output, ViewEncapsulation} from "@angular/core";
2
-
3
- @Component({
4
- selector: "ione-signatures",
5
- template: `
6
- <ione-signature *ngIf="showFirstSignature"
7
- [title]="firstSignatureTitle"
8
- [saveButtonLabel]="saveButtonLabel"
9
- [clearButtonLabel]="clearButtonLabel"
10
- (save)="saveFirstSignature.emit($event)"></ione-signature>
11
- <ione-signature *ngIf="showSecondSignature"
12
- [title]="secondSignatureTitle"
13
- [saveButtonLabel]="saveButtonLabel"
14
- [clearButtonLabel]="clearButtonLabel"
15
- (save)="saveSecondSignature.emit($event)"></ione-signature>
16
- `,
17
- encapsulation: ViewEncapsulation.None
18
- })
19
- export class SignaturesComponent {
20
-
21
- @Input()
22
- public showFirstSignature: boolean = false;
23
-
24
- @Input()
25
- public firstSignatureTitle: string;
26
-
27
- @Input()
28
- public showSecondSignature: boolean = false;
29
-
30
- @Input()
31
- public secondSignatureTitle: string;
32
-
33
- @Input()
34
- public saveButtonLabel: string = 'SAVE';
35
-
36
- @Input()
37
- public clearButtonLabel: string = 'CLEAR';
38
-
39
- @Output()
40
- public saveFirstSignature: EventEmitter<string> = new EventEmitter<string>();
41
-
42
- @Output()
43
- public saveSecondSignature: EventEmitter<string> = new EventEmitter<string>();
44
-
45
- @HostBinding("class.ione-signatures")
46
- public showClass() {
47
- return true;
48
- }
49
-
50
- }