@colijnit/sharedcomponents 1.0.7 → 1.0.10

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 (77) hide show
  1. package/bundles/colijnit-sharedcomponents.umd.js +746 -0
  2. package/bundles/colijnit-sharedcomponents.umd.js.map +1 -0
  3. package/colijnit-sharedcomponents.d.ts +6 -0
  4. package/colijnit-sharedcomponents.metadata.json +1 -0
  5. package/esm2015/colijnit-sharedcomponents.js +7 -0
  6. package/esm2015/lib/components/docsign/component/signature/signature.component.js +75 -0
  7. package/esm2015/lib/components/docsign/component/signatures/signatures.component.js +44 -0
  8. package/esm2015/lib/components/docsign/docsign.component.js +225 -0
  9. package/esm2015/lib/components/docsign/docsign.module.js +23 -0
  10. package/esm2015/public-api.js +6 -0
  11. package/fesm2015/colijnit-sharedcomponents.js +372 -0
  12. package/fesm2015/colijnit-sharedcomponents.js.map +1 -0
  13. package/lib/components/docsign/component/signature/signature.component.d.ts +16 -0
  14. package/{src/lib → lib}/components/docsign/component/signature/style/_layout.scss +0 -0
  15. package/{src/lib → lib}/components/docsign/component/signature/style/_material-definition.scss +0 -0
  16. package/{src/lib → lib}/components/docsign/component/signature/style/_theme.scss +0 -0
  17. package/{src/lib → lib}/components/docsign/component/signature/style/material.scss +0 -0
  18. package/lib/components/docsign/component/signatures/signatures.component.d.ts +12 -0
  19. package/{src/lib → lib}/components/docsign/component/signatures/style/_layout.scss +0 -0
  20. package/{src/lib → lib}/components/docsign/component/signatures/style/_material-definition.scss +0 -0
  21. package/{src/lib → lib}/components/docsign/component/signatures/style/_theme.scss +0 -0
  22. package/{src/lib → lib}/components/docsign/component/signatures/style/material.scss +0 -0
  23. package/lib/components/docsign/docsign.component.d.ts +92 -0
  24. package/lib/components/docsign/docsign.module.d.ts +2 -0
  25. package/{src/lib → lib}/components/docsign/style/_layout.scss +0 -0
  26. package/{src/lib → lib}/components/docsign/style/_material-definition.scss +0 -0
  27. package/{src/lib → lib}/components/docsign/style/_theme.scss +0 -0
  28. package/{src/lib → lib}/components/docsign/style/material.scss +0 -0
  29. package/{src/lib → lib}/style/_mixin.scss +0 -0
  30. package/{src/lib → lib}/style/_variables.scss +0 -0
  31. package/package.json +25 -15
  32. package/public-api.d.ts +2 -0
  33. package/.browserslistrc +0 -16
  34. package/colijnit-sharedcomponents-1.0.7.tgz +0 -0
  35. package/karma.conf.js +0 -44
  36. package/ng-package.json +0 -17
  37. package/src/lib/components/docsign/component/signature/signature.component.ts +0 -82
  38. package/src/lib/components/docsign/component/signatures/signatures.component.ts +0 -50
  39. package/src/lib/components/docsign/docsign.component.ts +0 -252
  40. package/src/lib/components/docsign/docsign.module.ts +0 -22
  41. package/src/lib/components/send-method-dialog/enums/send-option.ts +0 -6
  42. package/src/lib/components/send-method-dialog/send-method-dialog.component.ts +0 -215
  43. package/src/lib/components/send-method-dialog/send-method-dialog.module.ts +0 -27
  44. package/src/lib/components/send-method-dialog/style/_layout.scss +0 -186
  45. package/src/lib/components/send-method-dialog/style/_material-definition.scss +0 -1
  46. package/src/lib/components/send-method-dialog/style/_theme.scss +0 -7
  47. package/src/lib/components/send-method-dialog/style/material.scss +0 -4
  48. package/src/lib/components/stock/stock-information/stock-information.component.ts +0 -59
  49. package/src/lib/components/stock/stock-information-grid/stock-information-grid.component.ts +0 -278
  50. package/src/lib/components/stock/stock-location/stock-location.component.ts +0 -82
  51. package/src/lib/components/stock/stock-transfer/co-drop-down-list-fields.interface.ts +0 -4
  52. package/src/lib/components/stock/stock-transfer/stock-transfer.component.ts +0 -111
  53. package/src/lib/components/stock/stock.component.ts +0 -78
  54. package/src/lib/components/stock/stock.module.ts +0 -47
  55. package/src/lib/components/stock/style/_layout.scss +0 -206
  56. package/src/lib/components/stock/style/_material-definition.scss +0 -20
  57. package/src/lib/components/stock/style/_theme.scss +0 -8
  58. package/src/lib/components/stock/style/material.scss +0 -4
  59. package/src/lib/enum/icon.enum.ts +0 -22
  60. package/src/lib/factory/business-object-factory.ts +0 -120
  61. package/src/lib/factory/decorators/boolean.decorator.ts +0 -113
  62. package/src/lib/factory/decorators/complex-array.decorator.ts +0 -61
  63. package/src/lib/factory/decorators/complex-field.decorator.ts +0 -63
  64. package/src/lib/factory/decorators/date-field.decorator.ts +0 -41
  65. package/src/lib/factory/decorators/string-number.decorator.ts +0 -48
  66. package/src/lib/model/business-object.ts +0 -85
  67. package/src/lib/model/icon-svg.ts +0 -22
  68. package/src/lib/service/icon-cache.service.ts +0 -51
  69. package/src/lib/service/ione-connector-adapter.service.ts +0 -113
  70. package/src/lib/service/stock.service.ts +0 -35
  71. package/src/lib/utils/array-utils.ts +0 -202
  72. package/src/lib/utils/is-nill.function.ts +0 -4
  73. package/src/public-api.ts +0 -10
  74. package/src/test.ts +0 -27
  75. package/tsconfig.lib.json +0 -18
  76. package/tsconfig.lib.prod.json +0 -10
  77. package/tsconfig.spec.json +0 -17
@@ -0,0 +1,746 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/animations'), require('pdf-lib'), require('pdfjs-dist/legacy/build/pdf'), require('pdfjs-dist/build/pdf.worker.entry'), require('@angular/common'), require('signature_pad')) :
3
+ typeof define === 'function' && define.amd ? define('@colijnit/sharedcomponents', ['exports', '@angular/core', '@angular/animations', 'pdf-lib', 'pdfjs-dist/legacy/build/pdf', 'pdfjs-dist/build/pdf.worker.entry', '@angular/common', 'signature_pad'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.colijnit = global.colijnit || {}, global.colijnit.sharedcomponents = {}), global.ng.core, global.ng.animations, global.pdfLib, global.PDFJS, global.pdfjsWorker, global.ng.common, global.SignaturePad));
5
+ })(this, (function (exports, core, animations, pdfLib, PDFJS, pdfjsWorker, common, SignaturePad) { 'use strict';
6
+
7
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
+
9
+ function _interopNamespace(e) {
10
+ if (e && e.__esModule) return e;
11
+ var n = Object.create(null);
12
+ if (e) {
13
+ Object.keys(e).forEach(function (k) {
14
+ if (k !== 'default') {
15
+ var d = Object.getOwnPropertyDescriptor(e, k);
16
+ Object.defineProperty(n, k, d.get ? d : {
17
+ enumerable: true,
18
+ get: function () { return e[k]; }
19
+ });
20
+ }
21
+ });
22
+ }
23
+ n["default"] = e;
24
+ return Object.freeze(n);
25
+ }
26
+
27
+ var PDFJS__namespace = /*#__PURE__*/_interopNamespace(PDFJS);
28
+ var pdfjsWorker__default = /*#__PURE__*/_interopDefaultLegacy(pdfjsWorker);
29
+ var SignaturePad__default = /*#__PURE__*/_interopDefaultLegacy(SignaturePad);
30
+
31
+ /******************************************************************************
32
+ Copyright (c) Microsoft Corporation.
33
+
34
+ Permission to use, copy, modify, and/or distribute this software for any
35
+ purpose with or without fee is hereby granted.
36
+
37
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
38
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
39
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
40
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
41
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
42
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
43
+ PERFORMANCE OF THIS SOFTWARE.
44
+ ***************************************************************************** */
45
+ /* global Reflect, Promise */
46
+ var extendStatics = function (d, b) {
47
+ extendStatics = Object.setPrototypeOf ||
48
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
49
+ function (d, b) { for (var p in b)
50
+ if (Object.prototype.hasOwnProperty.call(b, p))
51
+ d[p] = b[p]; };
52
+ return extendStatics(d, b);
53
+ };
54
+ function __extends(d, b) {
55
+ if (typeof b !== "function" && b !== null)
56
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
57
+ extendStatics(d, b);
58
+ function __() { this.constructor = d; }
59
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
60
+ }
61
+ var __assign = function () {
62
+ __assign = Object.assign || function __assign(t) {
63
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
64
+ s = arguments[i];
65
+ for (var p in s)
66
+ if (Object.prototype.hasOwnProperty.call(s, p))
67
+ t[p] = s[p];
68
+ }
69
+ return t;
70
+ };
71
+ return __assign.apply(this, arguments);
72
+ };
73
+ function __rest(s, e) {
74
+ var t = {};
75
+ for (var p in s)
76
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
77
+ t[p] = s[p];
78
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
79
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
80
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
81
+ t[p[i]] = s[p[i]];
82
+ }
83
+ return t;
84
+ }
85
+ function __decorate(decorators, target, key, desc) {
86
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
87
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
88
+ r = Reflect.decorate(decorators, target, key, desc);
89
+ else
90
+ for (var i = decorators.length - 1; i >= 0; i--)
91
+ if (d = decorators[i])
92
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
93
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
94
+ }
95
+ function __param(paramIndex, decorator) {
96
+ return function (target, key) { decorator(target, key, paramIndex); };
97
+ }
98
+ function __metadata(metadataKey, metadataValue) {
99
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
100
+ return Reflect.metadata(metadataKey, metadataValue);
101
+ }
102
+ function __awaiter(thisArg, _arguments, P, generator) {
103
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
104
+ return new (P || (P = Promise))(function (resolve, reject) {
105
+ function fulfilled(value) { try {
106
+ step(generator.next(value));
107
+ }
108
+ catch (e) {
109
+ reject(e);
110
+ } }
111
+ function rejected(value) { try {
112
+ step(generator["throw"](value));
113
+ }
114
+ catch (e) {
115
+ reject(e);
116
+ } }
117
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
118
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
119
+ });
120
+ }
121
+ function __generator(thisArg, body) {
122
+ var _ = { label: 0, sent: function () { if (t[0] & 1)
123
+ throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
124
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
125
+ function verb(n) { return function (v) { return step([n, v]); }; }
126
+ function step(op) {
127
+ if (f)
128
+ throw new TypeError("Generator is already executing.");
129
+ while (_)
130
+ try {
131
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
132
+ return t;
133
+ if (y = 0, t)
134
+ op = [op[0] & 2, t.value];
135
+ switch (op[0]) {
136
+ case 0:
137
+ case 1:
138
+ t = op;
139
+ break;
140
+ case 4:
141
+ _.label++;
142
+ return { value: op[1], done: false };
143
+ case 5:
144
+ _.label++;
145
+ y = op[1];
146
+ op = [0];
147
+ continue;
148
+ case 7:
149
+ op = _.ops.pop();
150
+ _.trys.pop();
151
+ continue;
152
+ default:
153
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
154
+ _ = 0;
155
+ continue;
156
+ }
157
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
158
+ _.label = op[1];
159
+ break;
160
+ }
161
+ if (op[0] === 6 && _.label < t[1]) {
162
+ _.label = t[1];
163
+ t = op;
164
+ break;
165
+ }
166
+ if (t && _.label < t[2]) {
167
+ _.label = t[2];
168
+ _.ops.push(op);
169
+ break;
170
+ }
171
+ if (t[2])
172
+ _.ops.pop();
173
+ _.trys.pop();
174
+ continue;
175
+ }
176
+ op = body.call(thisArg, _);
177
+ }
178
+ catch (e) {
179
+ op = [6, e];
180
+ y = 0;
181
+ }
182
+ finally {
183
+ f = t = 0;
184
+ }
185
+ if (op[0] & 5)
186
+ throw op[1];
187
+ return { value: op[0] ? op[1] : void 0, done: true };
188
+ }
189
+ }
190
+ var __createBinding = Object.create ? (function (o, m, k, k2) {
191
+ if (k2 === undefined)
192
+ k2 = k;
193
+ var desc = Object.getOwnPropertyDescriptor(m, k);
194
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
195
+ desc = { enumerable: true, get: function () { return m[k]; } };
196
+ }
197
+ Object.defineProperty(o, k2, desc);
198
+ }) : (function (o, m, k, k2) {
199
+ if (k2 === undefined)
200
+ k2 = k;
201
+ o[k2] = m[k];
202
+ });
203
+ function __exportStar(m, o) {
204
+ for (var p in m)
205
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
206
+ __createBinding(o, m, p);
207
+ }
208
+ function __values(o) {
209
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
210
+ if (m)
211
+ return m.call(o);
212
+ if (o && typeof o.length === "number")
213
+ return {
214
+ next: function () {
215
+ if (o && i >= o.length)
216
+ o = void 0;
217
+ return { value: o && o[i++], done: !o };
218
+ }
219
+ };
220
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
221
+ }
222
+ function __read(o, n) {
223
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
224
+ if (!m)
225
+ return o;
226
+ var i = m.call(o), r, ar = [], e;
227
+ try {
228
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
229
+ ar.push(r.value);
230
+ }
231
+ catch (error) {
232
+ e = { error: error };
233
+ }
234
+ finally {
235
+ try {
236
+ if (r && !r.done && (m = i["return"]))
237
+ m.call(i);
238
+ }
239
+ finally {
240
+ if (e)
241
+ throw e.error;
242
+ }
243
+ }
244
+ return ar;
245
+ }
246
+ /** @deprecated */
247
+ function __spread() {
248
+ for (var ar = [], i = 0; i < arguments.length; i++)
249
+ ar = ar.concat(__read(arguments[i]));
250
+ return ar;
251
+ }
252
+ /** @deprecated */
253
+ function __spreadArrays() {
254
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++)
255
+ s += arguments[i].length;
256
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
257
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
258
+ r[k] = a[j];
259
+ return r;
260
+ }
261
+ function __spreadArray(to, from, pack) {
262
+ if (pack || arguments.length === 2)
263
+ for (var i = 0, l = from.length, ar; i < l; i++) {
264
+ if (ar || !(i in from)) {
265
+ if (!ar)
266
+ ar = Array.prototype.slice.call(from, 0, i);
267
+ ar[i] = from[i];
268
+ }
269
+ }
270
+ return to.concat(ar || Array.prototype.slice.call(from));
271
+ }
272
+ function __await(v) {
273
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
274
+ }
275
+ function __asyncGenerator(thisArg, _arguments, generator) {
276
+ if (!Symbol.asyncIterator)
277
+ throw new TypeError("Symbol.asyncIterator is not defined.");
278
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
279
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
280
+ function verb(n) { if (g[n])
281
+ i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
282
+ function resume(n, v) { try {
283
+ step(g[n](v));
284
+ }
285
+ catch (e) {
286
+ settle(q[0][3], e);
287
+ } }
288
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
289
+ function fulfill(value) { resume("next", value); }
290
+ function reject(value) { resume("throw", value); }
291
+ function settle(f, v) { if (f(v), q.shift(), q.length)
292
+ resume(q[0][0], q[0][1]); }
293
+ }
294
+ function __asyncDelegator(o) {
295
+ var i, p;
296
+ return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
297
+ function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
298
+ }
299
+ function __asyncValues(o) {
300
+ if (!Symbol.asyncIterator)
301
+ throw new TypeError("Symbol.asyncIterator is not defined.");
302
+ var m = o[Symbol.asyncIterator], i;
303
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
304
+ function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
305
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
306
+ }
307
+ function __makeTemplateObject(cooked, raw) {
308
+ if (Object.defineProperty) {
309
+ Object.defineProperty(cooked, "raw", { value: raw });
310
+ }
311
+ else {
312
+ cooked.raw = raw;
313
+ }
314
+ return cooked;
315
+ }
316
+ ;
317
+ var __setModuleDefault = Object.create ? (function (o, v) {
318
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
319
+ }) : function (o, v) {
320
+ o["default"] = v;
321
+ };
322
+ function __importStar(mod) {
323
+ if (mod && mod.__esModule)
324
+ return mod;
325
+ var result = {};
326
+ if (mod != null)
327
+ for (var k in mod)
328
+ if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
329
+ __createBinding(result, mod, k);
330
+ __setModuleDefault(result, mod);
331
+ return result;
332
+ }
333
+ function __importDefault(mod) {
334
+ return (mod && mod.__esModule) ? mod : { default: mod };
335
+ }
336
+ function __classPrivateFieldGet(receiver, state, kind, f) {
337
+ if (kind === "a" && !f)
338
+ throw new TypeError("Private accessor was defined without a getter");
339
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
340
+ throw new TypeError("Cannot read private member from an object whose class did not declare it");
341
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
342
+ }
343
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
344
+ if (kind === "m")
345
+ throw new TypeError("Private method is not writable");
346
+ if (kind === "a" && !f)
347
+ throw new TypeError("Private accessor was defined without a setter");
348
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
349
+ throw new TypeError("Cannot write private member to an object whose class did not declare it");
350
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
351
+ }
352
+ function __classPrivateFieldIn(state, receiver) {
353
+ if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function"))
354
+ throw new TypeError("Cannot use 'in' operator on non-object");
355
+ return typeof state === "function" ? receiver === state : state.has(receiver);
356
+ }
357
+
358
+ var DocsignComponent = /** @class */ (function () {
359
+ function DocsignComponent() {
360
+ this.saveButtonLabel = 'SAVE';
361
+ this.clearButtonLabel = 'CLEAR';
362
+ this.signDocumentButtonLabel = 'SIGN_DOCUMENT';
363
+ this.cancelButtonLabel = 'CANCEL';
364
+ this.pdfSaved = new core.EventEmitter();
365
+ this.cancelClick = new core.EventEmitter();
366
+ this.showSignaturePopup = false;
367
+ this.showSigBuyer = false;
368
+ this.showSigSeller = false;
369
+ this.showSignatures = false;
370
+ }
371
+ Object.defineProperty(DocsignComponent.prototype, "pdf", {
372
+ get: function () {
373
+ return this._pdf;
374
+ },
375
+ /**
376
+ * Load an existing [[PDFDocument]]. The input data can be provided in
377
+ * multiple formats:
378
+ *
379
+ * | Type | Contents |
380
+ * | ------------- | ------------------------------------------------------ |
381
+ * | `string` | A base64 encoded string (or data URI) containing a PDF |
382
+ * | `Uint8Array` | The raw bytes of a PDF |
383
+ * | `ArrayBuffer` | The raw bytes of a PDF |
384
+ *
385
+ * For example:
386
+ * ```js
387
+ * import { PDFDocument } from 'pdf-lib'
388
+ *
389
+ * // pdf=string
390
+ * const base64 =
391
+ * 'JVBERi0xLjcKJYGBgYEKCjUgMCBvYmoKPDwKL0ZpbHRlciAvRmxhdGVEZWNvZGUKL0xlbm' +
392
+ * 'd0aCAxMDQKPj4Kc3RyZWFtCniccwrhMlAAwaJ0Ln2P1Jyy1JLM5ERdc0MjCwUjE4WQNC4Q' +
393
+ * '6cNlCFZkqGCqYGSqEJLLZWNuYGZiZmbkYuZsZmlmZGRgZmluDCQNzc3NTM2NzdzMXMxMjQ' +
394
+ * 'ztFEKyuEK0uFxDuAAOERdVCmVuZHN0cmVhbQplbmRvYmoKCjYgMCBvYmoKPDwKL0ZpbHRl' +
395
+ * 'ciAvRmxhdGVEZWNvZGUKL1R5cGUgL09ialN0bQovTiA0Ci9GaXJzdCAyMAovTGVuZ3RoID' +
396
+ * 'IxNQo+PgpzdHJlYW0KeJxVj9GqwjAMhu/zFHkBzTo3nCCCiiKIHPEICuJF3cKoSCu2E8/b' +
397
+ * '20wPIr1p8v9/8kVhgilmGfawX2CGaVrgcAi0/bsy0lrX7IGWpvJ4iJYEN3gEmrrGBlQwGs' +
398
+ * 'HHO9VBX1wNrxAqMX87RBD5xpJuddqwd82tjAHxzV1U5LPgy52DKXWnr1Lheg+j/c/pzGVr' +
399
+ * 'iqV0VlwZPXGPCJjElw/ybkwUmeoWgxesDXGhHJC/D/iikp1Av80ptKU0FdBEe25pPihAM1' +
400
+ * 'u6ytgaaWfs2Hrz35CJT1+EWmAKZW5kc3RyZWFtCmVuZG9iagoKNyAwIG9iago8PAovU2l6' +
401
+ * 'ZSA4Ci9Sb290IDIgMCBSCi9GaWx0ZXIgL0ZsYXRlRGVjb2RlCi9UeXBlIC9YUmVmCi9MZW' +
402
+ * '5ndGggMzgKL1cgWyAxIDIgMiBdCi9JbmRleCBbIDAgOCBdCj4+CnN0cmVhbQp4nBXEwREA' +
403
+ * 'EBAEsCwz3vrvRmOOyyOoGhZdutHN2MT55fIAVocD+AplbmRzdHJlYW0KZW5kb2JqCgpzdG' +
404
+ * 'FydHhyZWYKNTEwCiUlRU9G'
405
+ *
406
+ * const dataUri = 'data:application/pdf;base64,' + base64
407
+ *
408
+ * const pdfDoc1 = await PDFDocument.load(base64)
409
+ * const pdfDoc2 = await PDFDocument.load(dataUri)
410
+ *
411
+ * // pdf=Uint8Array
412
+ * import fs from 'fs'
413
+ * const uint8Array = fs.readFileSync('with_update_sections.pdf')
414
+ * const pdfDoc3 = await PDFDocument.load(uint8Array)
415
+ *
416
+ * // pdf=ArrayBuffer
417
+ * const url = 'https://pdf-lib.js.org/assets/with_update_sections.pdf'
418
+ * const arrayBuffer = await fetch(url).then(res => res.arrayBuffer())
419
+ * const pdfDoc4 = await PDFDocument.load(arrayBuffer)
420
+ *
421
+ * ```
422
+ *
423
+ * @param pdf The input data containing a PDF document.
424
+ * @param options The options to be used when loading the document.
425
+ * @returns Resolves with a document loaded from the input.
426
+ */
427
+ set: function (value) {
428
+ if (value) {
429
+ this._pdf = value;
430
+ this._openPDF();
431
+ }
432
+ },
433
+ enumerable: false,
434
+ configurable: true
435
+ });
436
+ DocsignComponent.prototype.showClass = function () {
437
+ return true;
438
+ };
439
+ DocsignComponent.prototype.saveFirstSignature = function (sig) {
440
+ this._saveSignature(sig, this.sigBuyerPosition);
441
+ this.showSigBuyer = false;
442
+ this._savePdf();
443
+ };
444
+ DocsignComponent.prototype.saveSecondSignature = function (sig) {
445
+ this._saveSignature(sig, this.sigSellerPosition);
446
+ this.showSigSeller = false;
447
+ this._savePdf();
448
+ };
449
+ DocsignComponent.prototype._openPDF = function () {
450
+ return __awaiter(this, void 0, void 0, function () {
451
+ var _a, pdfDataUri;
452
+ return __generator(this, function (_b) {
453
+ switch (_b.label) {
454
+ case 0:
455
+ // first create reader to check signatures
456
+ this._checkSignatures();
457
+ _a = this;
458
+ return [4 /*yield*/, pdfLib.PDFDocument.load(this._pdf, {
459
+ updateMetadata: false
460
+ })];
461
+ case 1:
462
+ _a.pdfDoc = _b.sent();
463
+ return [4 /*yield*/, this.pdfDoc.saveAsBase64({ dataUri: true })];
464
+ case 2:
465
+ pdfDataUri = _b.sent();
466
+ this.iframe.nativeElement.src = pdfDataUri;
467
+ return [2 /*return*/];
468
+ }
469
+ });
470
+ });
471
+ };
472
+ DocsignComponent.prototype._savePdf = function () {
473
+ return __awaiter(this, void 0, void 0, function () {
474
+ var result;
475
+ return __generator(this, function (_a) {
476
+ switch (_a.label) {
477
+ case 0:
478
+ if (!(!this.showSigBuyer && !this.showSigSeller)) return [3 /*break*/, 2];
479
+ return [4 /*yield*/, this.pdfDoc.saveAsBase64()];
480
+ case 1:
481
+ result = _a.sent();
482
+ this.pdfSaved.next(result);
483
+ _a.label = 2;
484
+ case 2: return [2 /*return*/];
485
+ }
486
+ });
487
+ });
488
+ };
489
+ DocsignComponent.prototype._checkSignatures = function () {
490
+ return __awaiter(this, void 0, void 0, function () {
491
+ var pdfWorkerSrc, pdfReader, numPages, i, page, text;
492
+ return __generator(this, function (_a) {
493
+ switch (_a.label) {
494
+ case 0:
495
+ if (window.hasOwnProperty('pdfWorkerSrc') &&
496
+ typeof window.pdfWorkerSrc === 'string' &&
497
+ window.pdfWorkerSrc) {
498
+ pdfWorkerSrc = window.pdfWorkerSrc;
499
+ }
500
+ else {
501
+ pdfWorkerSrc = pdfjsWorker__default["default"];
502
+ }
503
+ PDFJS__namespace.GlobalWorkerOptions.workerSrc = pdfWorkerSrc;
504
+ return [4 /*yield*/, PDFJS__namespace.getDocument(this._pdf).promise];
505
+ case 1:
506
+ pdfReader = _a.sent();
507
+ numPages = pdfReader.numPages;
508
+ i = 0;
509
+ _a.label = 2;
510
+ case 2:
511
+ if (!(i < numPages)) return [3 /*break*/, 6];
512
+ return [4 /*yield*/, pdfReader.getPage(i + 1)];
513
+ case 3:
514
+ page = _a.sent();
515
+ return [4 /*yield*/, page.getTextContent()];
516
+ case 4:
517
+ text = _a.sent();
518
+ page.cleanup();
519
+ if (this.firstSignatureField) {
520
+ this.sigBuyerPosition = this._getPositionSignature(text, this.firstSignatureField);
521
+ if (this.sigBuyerPosition.width > 0 && this.sigBuyerPosition.height > 0) {
522
+ this.sigBuyerPosition.page = i;
523
+ this.showSigBuyer = true;
524
+ }
525
+ }
526
+ if (this.secondSignatureField) {
527
+ this.sigSellerPosition = this._getPositionSignature(text, this.secondSignatureField);
528
+ if (this.sigSellerPosition.width > 0 && this.sigSellerPosition.height > 0) {
529
+ this.sigSellerPosition.page = i;
530
+ this.showSigSeller = true;
531
+ }
532
+ }
533
+ _a.label = 5;
534
+ case 5:
535
+ i++;
536
+ return [3 /*break*/, 2];
537
+ case 6: return [2 /*return*/];
538
+ }
539
+ });
540
+ });
541
+ };
542
+ DocsignComponent.prototype._getPositionSignature = function (textItem, signatureField) {
543
+ var sigItem = textItem.items.find(function (i) { return i.str.toLowerCase() === signatureField.toLowerCase(); });
544
+ if (sigItem) {
545
+ textItem.items.slice(textItem.items.indexOf(sigItem), 1);
546
+ return {
547
+ x: sigItem.transform[4],
548
+ y: sigItem.transform[5],
549
+ width: sigItem.width,
550
+ height: sigItem.height,
551
+ page: 0
552
+ };
553
+ }
554
+ return { x: 0, y: 0, width: 0, height: 0, page: 0 };
555
+ };
556
+ DocsignComponent.prototype._saveSignature = function (sig, dimensions) {
557
+ return __awaiter(this, void 0, void 0, function () {
558
+ var jpgImage, page;
559
+ return __generator(this, function (_a) {
560
+ switch (_a.label) {
561
+ case 0: return [4 /*yield*/, this.pdfDoc.embedPng(sig)];
562
+ case 1:
563
+ jpgImage = _a.sent();
564
+ return [4 /*yield*/, this.pdfDoc.getPage(dimensions.page)];
565
+ case 2:
566
+ page = _a.sent();
567
+ page.drawImage(jpgImage, {
568
+ x: ((dimensions.x + (dimensions.width / 2)) - (200 / 2)),
569
+ y: ((dimensions.y + (dimensions.height / 2)) - (100 / 2)),
570
+ width: 200,
571
+ height: 100
572
+ });
573
+ return [2 /*return*/];
574
+ }
575
+ });
576
+ });
577
+ };
578
+ return DocsignComponent;
579
+ }());
580
+ DocsignComponent.decorators = [
581
+ { type: core.Component, args: [{
582
+ selector: "ione-docsign",
583
+ template: "\n <iframe #iframe></iframe>\n <ione-signatures *ngIf=\"showSignatures\" @showHideSignature\n [showFirstSignature]=\"showSigBuyer\"\n [firstSignatureTitle]=\"firstSignatureLabel\"\n [showSecondSignature]=\"showSigSeller\"\n [secondSignatureTitle]=\"secondSignatureLabel\"\n [saveButtonLabel]=\"saveButtonLabel\"\n [clearButtonLabel]=\"clearButtonLabel\"\n (saveFirstSignature)=\"saveFirstSignature($event)\"\n (saveSecondSignature)=\"saveSecondSignature($event)\"\n ></ione-signatures>\n <input type=\"button\" *ngIf=\"(showSigBuyer || showSigSeller) && !showSignatures\" class=\"button button-sign-document\"\n [value]=\"signDocumentButtonLabel\"\n (click)=\"showSignatures = true\"\n />\n <input type=\"button\" class=\"button button-cancel\"\n [value]=\"cancelButtonLabel\"\n (click)=\"cancelClick.emit($event)\"\n />\n ",
584
+ animations: [
585
+ animations.trigger("showHideSignature", [
586
+ animations.state("void", animations.style({ transform: "translate(-50%, -50%) scale(0)" })),
587
+ animations.state("*", animations.style({ transform: "translate(-50%, -50%) scale(1)" })),
588
+ animations.transition("void <=> *", animations.animate("200ms ease-in-out")),
589
+ ])
590
+ ],
591
+ encapsulation: core.ViewEncapsulation.None
592
+ },] }
593
+ ];
594
+ DocsignComponent.propDecorators = {
595
+ iframe: [{ type: core.ViewChild, args: ["iframe", { read: core.ElementRef },] }],
596
+ pdf: [{ type: core.Input }],
597
+ firstSignatureLabel: [{ type: core.Input }],
598
+ firstSignatureField: [{ type: core.Input }],
599
+ secondSignatureLabel: [{ type: core.Input }],
600
+ secondSignatureField: [{ type: core.Input }],
601
+ saveButtonLabel: [{ type: core.Input }],
602
+ clearButtonLabel: [{ type: core.Input }],
603
+ signDocumentButtonLabel: [{ type: core.Input }],
604
+ cancelButtonLabel: [{ type: core.Input }],
605
+ pdfSaved: [{ type: core.Output }],
606
+ cancelClick: [{ type: core.Output }],
607
+ showClass: [{ type: core.HostBinding, args: ['class.ione-docsign',] }]
608
+ };
609
+
610
+ var SignatureComponent = /** @class */ (function () {
611
+ function SignatureComponent() {
612
+ this.saveButtonLabel = 'SAVE';
613
+ this.clearButtonLabel = 'CLEAR';
614
+ this.save = new core.EventEmitter();
615
+ }
616
+ Object.defineProperty(SignatureComponent.prototype, "content", {
617
+ set: function (content) {
618
+ if (content) {
619
+ this.signatureCanvas = content;
620
+ this._initCanvas();
621
+ }
622
+ },
623
+ enumerable: false,
624
+ configurable: true
625
+ });
626
+ SignatureComponent.prototype.showClass = function () {
627
+ return true;
628
+ };
629
+ SignatureComponent.prototype.handleSave = function (event) {
630
+ // save canvas as svg
631
+ // const sig: string = this.signature.toDataURL("image/svg+xml");
632
+ var sig = this.signature.toDataURL("image/png");
633
+ // emit signature string
634
+ this.save.next(sig);
635
+ };
636
+ SignatureComponent.prototype.handleClear = function (event) {
637
+ if (this.signature) {
638
+ this.signature.clear();
639
+ }
640
+ };
641
+ SignatureComponent.prototype._initCanvas = function () {
642
+ var _this = this;
643
+ if (this.signatureCanvas && this.signatureCanvas.nativeElement) {
644
+ this.signature = new SignaturePad__default["default"](this.signatureCanvas.nativeElement);
645
+ setTimeout(function () {
646
+ _this._resizeSignatureCanvas(_this.signature, _this.signatureCanvas);
647
+ });
648
+ }
649
+ };
650
+ SignatureComponent.prototype._resizeSignatureCanvas = function (signature, signatureCanvas) {
651
+ var imageBeforeResize = signature.toDataURL();
652
+ var ratio = Math.max(window.devicePixelRatio || 1, 1);
653
+ signatureCanvas.nativeElement.width = signatureCanvas.nativeElement.offsetWidth * ratio;
654
+ signatureCanvas.nativeElement.height = signatureCanvas.nativeElement.offsetHeight * ratio;
655
+ signatureCanvas.nativeElement.getContext("2d").scale(ratio, ratio);
656
+ signature.fromDataURL(imageBeforeResize);
657
+ };
658
+ return SignatureComponent;
659
+ }());
660
+ SignatureComponent.decorators = [
661
+ { type: core.Component, args: [{
662
+ selector: "ione-signature",
663
+ template: "\n <div class=\"signature-wrapper\">\n <div class=\"signature-header\">\n <span *ngIf=\"title\" class=\"title\" [textContent]=\"title\"></span>\n <div class=\"button-wrapper\">\n <input type=\"button\" (click)=\"handleSave($event)\" [value]=\"saveButtonLabel\"/>\n <input type=\"button\" (click)=\"handleClear($event)\" [value]=\"clearButtonLabel\">\n </div>\n </div>\n <div class=\"canvas\">\n <canvas #signature></canvas>\n </div>\n </div>\n ",
664
+ encapsulation: core.ViewEncapsulation.None
665
+ },] }
666
+ ];
667
+ SignatureComponent.propDecorators = {
668
+ content: [{ type: core.ViewChild, args: ["signature", { read: core.ElementRef },] }],
669
+ title: [{ type: core.Input }],
670
+ saveButtonLabel: [{ type: core.Input }],
671
+ clearButtonLabel: [{ type: core.Input }],
672
+ save: [{ type: core.Output }],
673
+ showClass: [{ type: core.HostBinding, args: ["class.ione-signature",] }]
674
+ };
675
+
676
+ var SignaturesComponent = /** @class */ (function () {
677
+ function SignaturesComponent() {
678
+ this.showFirstSignature = false;
679
+ this.showSecondSignature = false;
680
+ this.saveButtonLabel = 'SAVE';
681
+ this.clearButtonLabel = 'CLEAR';
682
+ this.saveFirstSignature = new core.EventEmitter();
683
+ this.saveSecondSignature = new core.EventEmitter();
684
+ }
685
+ SignaturesComponent.prototype.showClass = function () {
686
+ return true;
687
+ };
688
+ return SignaturesComponent;
689
+ }());
690
+ SignaturesComponent.decorators = [
691
+ { type: core.Component, args: [{
692
+ selector: "ione-signatures",
693
+ template: "\n <ione-signature *ngIf=\"showFirstSignature\"\n [title]=\"firstSignatureTitle\"\n [saveButtonLabel]=\"saveButtonLabel\"\n [clearButtonLabel]=\"clearButtonLabel\"\n (save)=\"saveFirstSignature.emit($event)\"></ione-signature>\n <ione-signature *ngIf=\"showSecondSignature\"\n [title]=\"secondSignatureTitle\"\n [saveButtonLabel]=\"saveButtonLabel\"\n [clearButtonLabel]=\"clearButtonLabel\"\n (save)=\"saveSecondSignature.emit($event)\"></ione-signature>\n ",
694
+ encapsulation: core.ViewEncapsulation.None
695
+ },] }
696
+ ];
697
+ SignaturesComponent.propDecorators = {
698
+ showFirstSignature: [{ type: core.Input }],
699
+ firstSignatureTitle: [{ type: core.Input }],
700
+ showSecondSignature: [{ type: core.Input }],
701
+ secondSignatureTitle: [{ type: core.Input }],
702
+ saveButtonLabel: [{ type: core.Input }],
703
+ clearButtonLabel: [{ type: core.Input }],
704
+ saveFirstSignature: [{ type: core.Output }],
705
+ saveSecondSignature: [{ type: core.Output }],
706
+ showClass: [{ type: core.HostBinding, args: ["class.ione-signatures",] }]
707
+ };
708
+
709
+ var DocsignModule = /** @class */ (function () {
710
+ function DocsignModule() {
711
+ }
712
+ return DocsignModule;
713
+ }());
714
+ DocsignModule.decorators = [
715
+ { type: core.NgModule, args: [{
716
+ imports: [
717
+ common.CommonModule
718
+ ],
719
+ declarations: [
720
+ DocsignComponent,
721
+ SignatureComponent,
722
+ SignaturesComponent
723
+ ],
724
+ exports: [
725
+ DocsignComponent
726
+ ]
727
+ },] }
728
+ ];
729
+
730
+ /*
731
+ * Public API Surface of sharedcomponents
732
+ */
733
+
734
+ /**
735
+ * Generated bundle index. Do not edit.
736
+ */
737
+
738
+ exports.DocsignComponent = DocsignComponent;
739
+ exports.DocsignModule = DocsignModule;
740
+ exports["ɵa"] = SignatureComponent;
741
+ exports["ɵb"] = SignaturesComponent;
742
+
743
+ Object.defineProperty(exports, '__esModule', { value: true });
744
+
745
+ }));
746
+ //# sourceMappingURL=colijnit-sharedcomponents.umd.js.map