@progress/kendo-angular-inputs 9.0.5-dev.202208101035 → 9.1.0-sig.202208231615
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.
- package/bundles/kendo-angular-inputs.umd.js +1 -1
- package/common/utils.d.ts +21 -0
- package/esm2015/common/utils.js +16 -6
- package/esm2015/inputs.module.js +7 -3
- package/esm2015/main.js +4 -0
- package/esm2015/package-metadata.js +1 -1
- package/esm2015/signature/events/close-event.js +10 -0
- package/esm2015/signature/events/index.js +6 -0
- package/esm2015/signature/events/open-event.js +10 -0
- package/esm2015/signature/localization/custom-messages.component.js +40 -0
- package/esm2015/signature/localization/index.js +7 -0
- package/esm2015/signature/localization/localized-signature-messages.directive.js +36 -0
- package/esm2015/signature/localization/messages.js +27 -0
- package/esm2015/signature/signature.component.js +711 -0
- package/esm2015/signature.module.js +64 -0
- package/fesm2015/kendo-angular-inputs.js +917 -57
- package/inputs.module.d.ts +2 -1
- package/main.d.ts +4 -0
- package/package.json +6 -4
- package/signature/events/close-event.d.ts +10 -0
- package/signature/events/index.d.ts +6 -0
- package/signature/events/open-event.d.ts +10 -0
- package/signature/localization/custom-messages.component.d.ts +17 -0
- package/signature/localization/index.d.ts +7 -0
- package/signature/localization/localized-signature-messages.directive.d.ts +16 -0
- package/signature/localization/messages.d.ts +25 -0
- package/signature/signature.component.d.ts +307 -0
- package/signature.module.d.ts +46 -0
|
@@ -0,0 +1,711 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { __awaiter } from "tslib";
|
|
6
|
+
import { Component, EventEmitter, forwardRef, HostBinding, Input, Output, ViewChild } from '@angular/core';
|
|
7
|
+
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
8
|
+
import { anyChanged, closest } from '@progress/kendo-angular-common';
|
|
9
|
+
import { L10N_PREFIX, LocalizationService } from '@progress/kendo-angular-l10n';
|
|
10
|
+
import { SignaturePad } from '@progress/kendo-inputs-common';
|
|
11
|
+
import { validatePackage } from '@progress/kendo-licensing';
|
|
12
|
+
import { isNone, isPresent, ROUNDED_MAP, SIZE_MAP } from '../common/utils';
|
|
13
|
+
import { packageMetadata } from '../package-metadata';
|
|
14
|
+
import { SignatureCloseEvent, SignatureOpenEvent } from './events';
|
|
15
|
+
import * as i0 from "@angular/core";
|
|
16
|
+
import * as i1 from "@progress/kendo-angular-l10n";
|
|
17
|
+
import * as i2 from "@progress/kendo-angular-dialog";
|
|
18
|
+
import * as i3 from "./localization/localized-signature-messages.directive";
|
|
19
|
+
import * as i4 from "@angular/common";
|
|
20
|
+
const noop = () => { };
|
|
21
|
+
const DEFAULT_SIZE = 'medium';
|
|
22
|
+
const DEFAULT_ROUNDED = 'medium';
|
|
23
|
+
const DEFAULT_FILL_MODE = 'solid';
|
|
24
|
+
const DEFAULT_POPUP_SCALE = 3;
|
|
25
|
+
/**
|
|
26
|
+
* Represents the [Kendo UI Signature component for Angular]({% slug overview_signature %}).
|
|
27
|
+
*
|
|
28
|
+
* The Signature allows users to add a hand-drawn signature to forms.
|
|
29
|
+
*/
|
|
30
|
+
export class SignatureComponent {
|
|
31
|
+
constructor(element, renderer, ngZone, localization) {
|
|
32
|
+
this.element = element;
|
|
33
|
+
this.renderer = renderer;
|
|
34
|
+
this.ngZone = ngZone;
|
|
35
|
+
this.localization = localization;
|
|
36
|
+
this.staticHostClasses = true;
|
|
37
|
+
/**
|
|
38
|
+
* Sets the read-only state of the Signature.
|
|
39
|
+
*
|
|
40
|
+
* @default false
|
|
41
|
+
*/
|
|
42
|
+
this.readonly = false;
|
|
43
|
+
/**
|
|
44
|
+
* Sets the disabled state of the Signature.
|
|
45
|
+
*
|
|
46
|
+
* @default false
|
|
47
|
+
*/
|
|
48
|
+
this.disabled = false;
|
|
49
|
+
/**
|
|
50
|
+
* The size property specifies the padding of the Signature internal controls
|
|
51
|
+
* ([see example]({% slug appearance_signature %}#toc-size)).
|
|
52
|
+
*
|
|
53
|
+
* The possible values are:
|
|
54
|
+
* * `small`
|
|
55
|
+
* * `medium` (default)
|
|
56
|
+
* * `large`
|
|
57
|
+
* * `none`
|
|
58
|
+
*/
|
|
59
|
+
this.size = DEFAULT_SIZE;
|
|
60
|
+
/**
|
|
61
|
+
* The rounded property specifies the border radius of the signature
|
|
62
|
+
* ([see example]({% slug appearance_signature %}#toc-rounded)).
|
|
63
|
+
*
|
|
64
|
+
* The possible values are:
|
|
65
|
+
* * `small`
|
|
66
|
+
* * `medium` (default)
|
|
67
|
+
* * `large`
|
|
68
|
+
* * `full`
|
|
69
|
+
* * `none`
|
|
70
|
+
*/
|
|
71
|
+
this.rounded = DEFAULT_ROUNDED;
|
|
72
|
+
/**
|
|
73
|
+
* The fillMode property specifies the background and border styles of the signature
|
|
74
|
+
* ([see example]({% slug appearance_signature %}#toc-fillMode)).
|
|
75
|
+
*
|
|
76
|
+
* The possible values are:
|
|
77
|
+
* * `flat`
|
|
78
|
+
* * `solid` (default)
|
|
79
|
+
* * `outline`
|
|
80
|
+
* * `none`
|
|
81
|
+
*/
|
|
82
|
+
this.fillMode = DEFAULT_FILL_MODE;
|
|
83
|
+
/**
|
|
84
|
+
* The stroke color of the signature.
|
|
85
|
+
*
|
|
86
|
+
* Accepts CSS color names and hex values.
|
|
87
|
+
*
|
|
88
|
+
* @default '#000000'
|
|
89
|
+
*/
|
|
90
|
+
this.color = '#000000';
|
|
91
|
+
/**
|
|
92
|
+
* The stroke width of the signature.
|
|
93
|
+
*
|
|
94
|
+
* @default 1
|
|
95
|
+
*/
|
|
96
|
+
this.strokeWidth = 1;
|
|
97
|
+
/**
|
|
98
|
+
* A flag indicating whether to smooth out signature lines.
|
|
99
|
+
*
|
|
100
|
+
* @default false
|
|
101
|
+
*/
|
|
102
|
+
this.smooth = false;
|
|
103
|
+
/**
|
|
104
|
+
* A flag indicating if the signature can be maximized.
|
|
105
|
+
*
|
|
106
|
+
* @default true
|
|
107
|
+
*/
|
|
108
|
+
this.maximizable = true;
|
|
109
|
+
/**
|
|
110
|
+
* @hidden
|
|
111
|
+
*/
|
|
112
|
+
this.maximized = false;
|
|
113
|
+
/**
|
|
114
|
+
* The scale factor for the popup.
|
|
115
|
+
*
|
|
116
|
+
* The Signature width and height will be multiplied by the scale when showing the popup.
|
|
117
|
+
*
|
|
118
|
+
* @default 3
|
|
119
|
+
*/
|
|
120
|
+
this.popupScale = DEFAULT_POPUP_SCALE;
|
|
121
|
+
/**
|
|
122
|
+
* A flag indicating whether the dotted line should be displayed in the background.
|
|
123
|
+
*
|
|
124
|
+
* @default false
|
|
125
|
+
*/
|
|
126
|
+
this.hideLine = false;
|
|
127
|
+
/**
|
|
128
|
+
* Fires each time the signature value is changed.
|
|
129
|
+
*/
|
|
130
|
+
this.valueChange = new EventEmitter();
|
|
131
|
+
/**
|
|
132
|
+
* Fires each time the popup is about to open.
|
|
133
|
+
* This event is preventable. If you cancel it, the popup will remain closed.
|
|
134
|
+
*/
|
|
135
|
+
this.open = new EventEmitter();
|
|
136
|
+
/**
|
|
137
|
+
* Fires each time the popup is about to close.
|
|
138
|
+
* This event is preventable. If you cancel it, the popup will remain open.
|
|
139
|
+
*/
|
|
140
|
+
this.close = new EventEmitter();
|
|
141
|
+
/**
|
|
142
|
+
* Fires each time Signature is focused.
|
|
143
|
+
*/
|
|
144
|
+
this.onFocus = new EventEmitter();
|
|
145
|
+
/**
|
|
146
|
+
* Fires each time the Signature is blurred.
|
|
147
|
+
*/
|
|
148
|
+
this.onBlur = new EventEmitter();
|
|
149
|
+
/**
|
|
150
|
+
* @hidden
|
|
151
|
+
*/
|
|
152
|
+
this.minimize = new EventEmitter();
|
|
153
|
+
/**
|
|
154
|
+
* Indicates whether the Signature wrapper is focused.
|
|
155
|
+
*/
|
|
156
|
+
this.isFocused = false;
|
|
157
|
+
/**
|
|
158
|
+
* @hidden
|
|
159
|
+
*/
|
|
160
|
+
this.isDrawing = false;
|
|
161
|
+
this.notifyNgTouched = noop;
|
|
162
|
+
this.notifyNgChanged = noop;
|
|
163
|
+
this._tabindex = 0;
|
|
164
|
+
this.hostClasses = [];
|
|
165
|
+
validatePackage(packageMetadata);
|
|
166
|
+
this.direction = localization.rtl ? 'rtl' : 'ltr';
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Gets or sets the value of the signature.
|
|
170
|
+
*
|
|
171
|
+
* The value is a Base64-encoded PNG image.
|
|
172
|
+
*/
|
|
173
|
+
set value(value) {
|
|
174
|
+
if (value !== this._value) {
|
|
175
|
+
this._value = value;
|
|
176
|
+
if (this.instance) {
|
|
177
|
+
this.instance.loadImage(value);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
get value() {
|
|
182
|
+
return this._value;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Specifies the [tabindex](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the component.
|
|
186
|
+
*
|
|
187
|
+
* @default 0
|
|
188
|
+
*/
|
|
189
|
+
set tabindex(value) {
|
|
190
|
+
const tabindex = Number(value);
|
|
191
|
+
const defaultValue = 0;
|
|
192
|
+
this._tabindex = !isNaN(tabindex) ? tabindex : defaultValue;
|
|
193
|
+
}
|
|
194
|
+
get tabindex() {
|
|
195
|
+
return !this.disabled ? this._tabindex : undefined;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* @hidden
|
|
199
|
+
*/
|
|
200
|
+
get popupWidth() {
|
|
201
|
+
const baseWidth = this.width || this.element.nativeElement.offsetWidth;
|
|
202
|
+
return baseWidth * this.popupScale;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* @hidden
|
|
206
|
+
*/
|
|
207
|
+
get popupHeight() {
|
|
208
|
+
const baseHeight = this.height || this.element.nativeElement.offsetHeight;
|
|
209
|
+
return baseHeight * this.popupScale;
|
|
210
|
+
}
|
|
211
|
+
get focusedClass() {
|
|
212
|
+
return this.isFocused && !this.maximized;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* @hidden
|
|
216
|
+
*/
|
|
217
|
+
get isEmpty() {
|
|
218
|
+
return !this.value;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* @hidden
|
|
222
|
+
*/
|
|
223
|
+
get clearTitle() {
|
|
224
|
+
return this.getMessage('clear');
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* @hidden
|
|
228
|
+
*/
|
|
229
|
+
get minimizeTitle() {
|
|
230
|
+
return this.getMessage('minimize');
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* @hidden
|
|
234
|
+
*/
|
|
235
|
+
get maximizeTitle() {
|
|
236
|
+
return this.getMessage('maximize');
|
|
237
|
+
}
|
|
238
|
+
get options() {
|
|
239
|
+
return {
|
|
240
|
+
scale: this.maximized ? this.popupScale : 1,
|
|
241
|
+
color: this.color,
|
|
242
|
+
strokeWidth: this.strokeWidth,
|
|
243
|
+
smooth: this.smooth,
|
|
244
|
+
readonly: this.readonly
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* @hidden
|
|
249
|
+
*/
|
|
250
|
+
get showMaximize() {
|
|
251
|
+
return !(this.maximized || this.isDrawing || !this.maximizable);
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* @hidden
|
|
255
|
+
*/
|
|
256
|
+
get showMinimize() {
|
|
257
|
+
return this.maximized && !this.isDrawing;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* @hidden
|
|
261
|
+
*/
|
|
262
|
+
get showClear() {
|
|
263
|
+
return !(this.isEmpty || this.isDrawing || this.readonly);
|
|
264
|
+
}
|
|
265
|
+
ngOnInit() {
|
|
266
|
+
this.subscriptions = this.localization
|
|
267
|
+
.changes
|
|
268
|
+
.subscribe(({ rtl }) => {
|
|
269
|
+
this.direction = rtl ? 'rtl' : 'ltr';
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
ngAfterViewInit() {
|
|
273
|
+
this.applyHostClasses();
|
|
274
|
+
this.ngZone.runOutsideAngular(() => {
|
|
275
|
+
const element = this.canvas.nativeElement;
|
|
276
|
+
this.instance = new SignaturePad(element, Object.assign(Object.assign({}, this.options), { onChange: () => this.onValueChange(), onDraw: () => this.onDraw(), onDrawEnd: () => this.onDrawEnd() }));
|
|
277
|
+
if (this._value) {
|
|
278
|
+
this.instance.loadImage(this._value);
|
|
279
|
+
}
|
|
280
|
+
this.addEventListeners();
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
ngOnChanges(changes) {
|
|
284
|
+
if (anyChanged(['readonly', 'color', 'strokeWidth', 'smooth'], changes, true)) {
|
|
285
|
+
this.instance.setOptions(this.options);
|
|
286
|
+
}
|
|
287
|
+
this.applyHostClasses();
|
|
288
|
+
}
|
|
289
|
+
ngOnDestroy() {
|
|
290
|
+
if (this.instance) {
|
|
291
|
+
this.instance.destroy();
|
|
292
|
+
this.instance = null;
|
|
293
|
+
}
|
|
294
|
+
if (this.subscriptions) {
|
|
295
|
+
this.subscriptions.unsubscribe();
|
|
296
|
+
this.subscriptions = null;
|
|
297
|
+
}
|
|
298
|
+
if (this.unsubscribe) {
|
|
299
|
+
this.unsubscribe();
|
|
300
|
+
this.unsubscribe = null;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* @hidden
|
|
305
|
+
*/
|
|
306
|
+
onClear() {
|
|
307
|
+
this.reset();
|
|
308
|
+
this.valueChange.emit(undefined);
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* @hidden
|
|
312
|
+
*/
|
|
313
|
+
onValueChange() {
|
|
314
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
315
|
+
const value = yield this.instance.exportImage();
|
|
316
|
+
this.ngZone.run(() => {
|
|
317
|
+
this._value = value;
|
|
318
|
+
this.valueChange.emit(value);
|
|
319
|
+
this.notifyNgChanged(value);
|
|
320
|
+
});
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* @hidden
|
|
325
|
+
*/
|
|
326
|
+
onDialogValueChange(value) {
|
|
327
|
+
this.value = value;
|
|
328
|
+
this.valueChange.emit(value);
|
|
329
|
+
this.notifyNgChanged(value);
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* @hidden
|
|
333
|
+
*/
|
|
334
|
+
onDialogClose() {
|
|
335
|
+
const args = new SignatureCloseEvent();
|
|
336
|
+
this.close.next(args);
|
|
337
|
+
if (!args.isDefaultPrevented()) {
|
|
338
|
+
this.isOpen = false;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* Clears the value of the Signature.
|
|
343
|
+
*/
|
|
344
|
+
reset() {
|
|
345
|
+
var _a;
|
|
346
|
+
if (!isPresent(this.value)) {
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
(_a = this.instance) === null || _a === void 0 ? void 0 : _a.clear();
|
|
350
|
+
this.value = undefined;
|
|
351
|
+
this.notifyNgChanged(undefined);
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* Toggles the popup of the Signature.
|
|
355
|
+
* Does not trigger the `open` and `close` events of the component.
|
|
356
|
+
*
|
|
357
|
+
* @param open An optional parameter. Specifies whether the popup will be opened or closed.
|
|
358
|
+
*/
|
|
359
|
+
toggle(open) {
|
|
360
|
+
if (this.disabled || this.readonly) {
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
363
|
+
open = isPresent(open) ? open : !this.isOpen;
|
|
364
|
+
this.isOpen = open;
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* @hidden
|
|
368
|
+
*/
|
|
369
|
+
onMaximize() {
|
|
370
|
+
const args = new SignatureOpenEvent();
|
|
371
|
+
this.open.next(args);
|
|
372
|
+
if (!args.isDefaultPrevented()) {
|
|
373
|
+
this.isOpen = true;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* @hidden
|
|
378
|
+
*/
|
|
379
|
+
onMinimize() {
|
|
380
|
+
this.minimize.next();
|
|
381
|
+
}
|
|
382
|
+
applyHostClasses() {
|
|
383
|
+
const classList = this.element.nativeElement.classList;
|
|
384
|
+
this.hostClasses.forEach(([name]) => classList.remove(name));
|
|
385
|
+
this.hostClasses = [
|
|
386
|
+
[`k-signature-${SIZE_MAP[this.size || DEFAULT_SIZE]}`, !isNone(this.size)],
|
|
387
|
+
[`k-signature-${this.fillMode || DEFAULT_FILL_MODE}`, !isNone(this.fillMode)],
|
|
388
|
+
[`k-rounded-${ROUNDED_MAP[this.rounded || DEFAULT_ROUNDED]}`, !isNone(this.rounded)]
|
|
389
|
+
];
|
|
390
|
+
this.hostClasses.forEach(([name, enabled]) => classList.toggle(name, enabled));
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* Focuses the wrapper of the Signature.
|
|
394
|
+
*/
|
|
395
|
+
focus() {
|
|
396
|
+
this.isFocused = true;
|
|
397
|
+
this.element.nativeElement.focus();
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* @hidden
|
|
401
|
+
*/
|
|
402
|
+
onWrapperFocus() {
|
|
403
|
+
if (this.isFocused) {
|
|
404
|
+
return;
|
|
405
|
+
}
|
|
406
|
+
this.ngZone.run(() => {
|
|
407
|
+
this.focus();
|
|
408
|
+
this.onFocus.emit();
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* Blurs the Signature.
|
|
413
|
+
*/
|
|
414
|
+
blur() {
|
|
415
|
+
this.isFocused = false;
|
|
416
|
+
this.element.nativeElement.blur();
|
|
417
|
+
this.notifyNgTouched();
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* @hidden
|
|
421
|
+
*/
|
|
422
|
+
onWrapperBlur() {
|
|
423
|
+
if (this.isOpen) {
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
426
|
+
this.ngZone.run(() => {
|
|
427
|
+
this.onBlur.emit();
|
|
428
|
+
this.isFocused = false;
|
|
429
|
+
this.notifyNgTouched();
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* @hidden
|
|
434
|
+
*/
|
|
435
|
+
onWrapperClick(_event) {
|
|
436
|
+
if (this.disabled) {
|
|
437
|
+
return;
|
|
438
|
+
}
|
|
439
|
+
this.focus();
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* @hidden
|
|
443
|
+
*/
|
|
444
|
+
writeValue(value) {
|
|
445
|
+
this.value = value;
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* @hidden
|
|
449
|
+
*/
|
|
450
|
+
registerOnChange(fn) {
|
|
451
|
+
this.notifyNgChanged = fn;
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* @hidden
|
|
455
|
+
*/
|
|
456
|
+
registerOnTouched(fn) {
|
|
457
|
+
this.notifyNgTouched = fn;
|
|
458
|
+
}
|
|
459
|
+
onDraw() {
|
|
460
|
+
this.ngZone.run(() => this.isDrawing = true);
|
|
461
|
+
}
|
|
462
|
+
onDrawEnd() {
|
|
463
|
+
this.ngZone.run(() => this.isDrawing = false);
|
|
464
|
+
}
|
|
465
|
+
addEventListeners() {
|
|
466
|
+
const element = this.element.nativeElement;
|
|
467
|
+
const focusIn = this.renderer.listen(element, 'focusin', () => this.onWrapperFocus());
|
|
468
|
+
const focusOut = this.renderer.listen(element, 'focusout', (e) => {
|
|
469
|
+
const insideWrapper = closest(e.relatedTarget, element => element === this.element.nativeElement);
|
|
470
|
+
if (!insideWrapper) {
|
|
471
|
+
this.onWrapperBlur();
|
|
472
|
+
}
|
|
473
|
+
});
|
|
474
|
+
const click = this.renderer.listen(element, 'click', () => {
|
|
475
|
+
this.ngZone.run((e) => {
|
|
476
|
+
this.onWrapperClick(e);
|
|
477
|
+
});
|
|
478
|
+
});
|
|
479
|
+
this.unsubscribe = () => {
|
|
480
|
+
focusIn();
|
|
481
|
+
focusOut();
|
|
482
|
+
click();
|
|
483
|
+
};
|
|
484
|
+
}
|
|
485
|
+
getMessage(key) {
|
|
486
|
+
if (this.maximized && this.parentLocalization) {
|
|
487
|
+
return this.parentLocalization.get(key);
|
|
488
|
+
}
|
|
489
|
+
return this.localization.get(key);
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
SignatureComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SignatureComponent, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.NgZone }, { token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
|
|
493
|
+
SignatureComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SignatureComponent, selector: "kendo-signature", inputs: { readonly: "readonly", disabled: "disabled", value: "value", tabindex: "tabindex", size: "size", rounded: "rounded", fillMode: "fillMode", color: "color", strokeWidth: "strokeWidth", smooth: "smooth", maximizable: "maximizable", maximized: "maximized", popupScale: "popupScale", parentLocalization: "parentLocalization", hideLine: "hideLine", width: "width", height: "height" }, outputs: { valueChange: "valueChange", open: "open", close: "close", onFocus: "focus", onBlur: "blur", minimize: "minimize" }, host: { properties: { "class.k-signature": "this.staticHostClasses", "class.k-input": "this.staticHostClasses", "class.k-readonly": "this.readonly", "class.k-disabled": "this.disabled", "style.width.px": "this.width", "style.height.px": "this.height", "attr.dir": "this.direction", "class.k-focus": "this.focusedClass" } }, providers: [
|
|
494
|
+
LocalizationService,
|
|
495
|
+
{ provide: L10N_PREFIX, useValue: 'kendo.signature' },
|
|
496
|
+
{ multi: true, provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => SignatureComponent) }
|
|
497
|
+
], viewQueries: [{ propertyName: "canvas", first: true, predicate: ["canvas"], descendants: true }], exportAs: ["kendoSignature"], usesOnChanges: true, ngImport: i0, template: `
|
|
498
|
+
<ng-container kendoSignatureLocalizedMessages
|
|
499
|
+
i18n-clear="kendo.signature.clear|The message for the Clear button."
|
|
500
|
+
clear="Clear"
|
|
501
|
+
i18n-maximize="kendo.signature.maximize|The message for the Maximize button."
|
|
502
|
+
maximize="Maximize"
|
|
503
|
+
i18n-minimize="kendo.signature.minimize|The message for the Minimize button."
|
|
504
|
+
minimize="Minimize">
|
|
505
|
+
</ng-container>
|
|
506
|
+
|
|
507
|
+
<div class="k-signature-actions k-signature-actions-top">
|
|
508
|
+
<button
|
|
509
|
+
[class.k-hidden]="!showMaximize"
|
|
510
|
+
(click)="onMaximize()"
|
|
511
|
+
[attr.aria-label]="maximizeTitle"
|
|
512
|
+
[title]="maximizeTitle"
|
|
513
|
+
class="k-signature-action k-signature-maximize k-button k-button-md k-button-flat k-button-flat-base k-rounded-md k-icon-button">
|
|
514
|
+
<span class="k-button-icon k-icon k-i-window-maximize"></span>
|
|
515
|
+
</button>
|
|
516
|
+
<button
|
|
517
|
+
[class.k-hidden]="!showMinimize"
|
|
518
|
+
(click)="onMinimize()"
|
|
519
|
+
[attr.aria-label]="minimizeTitle"
|
|
520
|
+
[title]="minimizeTitle"
|
|
521
|
+
class="k-signature-action k-signature-minimize k-button k-button-md k-button-flat k-button-flat-base k-rounded-md k-icon-button">
|
|
522
|
+
<span class="k-button-icon k-icon k-i-window-minimize"></span>
|
|
523
|
+
</button>
|
|
524
|
+
</div>
|
|
525
|
+
<div #canvas class="k-signature-canvas" [attr.tabindex]="tabindex"></div>
|
|
526
|
+
<div class="k-signature-line" *ngIf="!hideLine"></div>
|
|
527
|
+
<div class="k-signature-actions k-signature-actions-bottom">
|
|
528
|
+
<button
|
|
529
|
+
class="k-signature-action k-signature-clear k-button k-button-md k-button-flat k-button-flat-base k-rounded-md k-icon-button"
|
|
530
|
+
[class.k-hidden]="!showClear"
|
|
531
|
+
[attr.aria-label]="clearTitle"
|
|
532
|
+
[title]="clearTitle"
|
|
533
|
+
(click)="onClear()" >
|
|
534
|
+
<span class="k-button-icon k-icon k-i-close"></span>
|
|
535
|
+
</button>
|
|
536
|
+
</div>
|
|
537
|
+
|
|
538
|
+
<kendo-dialog *ngIf="isOpen">
|
|
539
|
+
<kendo-signature
|
|
540
|
+
[readonly]="readonly"
|
|
541
|
+
[disabled]="disabled"
|
|
542
|
+
[size]="size"
|
|
543
|
+
[rounded]="rounded"
|
|
544
|
+
[fillMode]="fillMode"
|
|
545
|
+
[color]="color"
|
|
546
|
+
[strokeWidth]="strokeWidth"
|
|
547
|
+
[smooth]="smooth"
|
|
548
|
+
[value]="value"
|
|
549
|
+
(valueChange)="onDialogValueChange($event)"
|
|
550
|
+
[hideLine]="hideLine"
|
|
551
|
+
[class.k-signature-maximized]="true"
|
|
552
|
+
[maximized]="true"
|
|
553
|
+
(minimize)="onDialogClose()"
|
|
554
|
+
[width]="popupWidth"
|
|
555
|
+
[height]="popupHeight"
|
|
556
|
+
[popupScale]="popupScale"
|
|
557
|
+
[parentLocalization]="localization">
|
|
558
|
+
</kendo-signature>
|
|
559
|
+
</kendo-dialog>
|
|
560
|
+
`, isInline: true, components: [{ type: i2.DialogComponent, selector: "kendo-dialog", inputs: ["actions", "actionsLayout", "autoFocusedElement", "title", "width", "minWidth", "maxWidth", "height", "minHeight", "maxHeight", "animation"], outputs: ["action", "close"], exportAs: ["kendoDialog"] }, { type: SignatureComponent, selector: "kendo-signature", inputs: ["readonly", "disabled", "value", "tabindex", "size", "rounded", "fillMode", "color", "strokeWidth", "smooth", "maximizable", "maximized", "popupScale", "parentLocalization", "hideLine", "width", "height"], outputs: ["valueChange", "open", "close", "focus", "blur", "minimize"], exportAs: ["kendoSignature"] }], directives: [{ type: i3.LocalizedSignatureMessagesDirective, selector: "[kendoSignatureLocalizedMessages]" }, { type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
561
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SignatureComponent, decorators: [{
|
|
562
|
+
type: Component,
|
|
563
|
+
args: [{
|
|
564
|
+
exportAs: 'kendoSignature',
|
|
565
|
+
selector: 'kendo-signature',
|
|
566
|
+
providers: [
|
|
567
|
+
LocalizationService,
|
|
568
|
+
{ provide: L10N_PREFIX, useValue: 'kendo.signature' },
|
|
569
|
+
{ multi: true, provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => SignatureComponent) }
|
|
570
|
+
],
|
|
571
|
+
template: `
|
|
572
|
+
<ng-container kendoSignatureLocalizedMessages
|
|
573
|
+
i18n-clear="kendo.signature.clear|The message for the Clear button."
|
|
574
|
+
clear="Clear"
|
|
575
|
+
i18n-maximize="kendo.signature.maximize|The message for the Maximize button."
|
|
576
|
+
maximize="Maximize"
|
|
577
|
+
i18n-minimize="kendo.signature.minimize|The message for the Minimize button."
|
|
578
|
+
minimize="Minimize">
|
|
579
|
+
</ng-container>
|
|
580
|
+
|
|
581
|
+
<div class="k-signature-actions k-signature-actions-top">
|
|
582
|
+
<button
|
|
583
|
+
[class.k-hidden]="!showMaximize"
|
|
584
|
+
(click)="onMaximize()"
|
|
585
|
+
[attr.aria-label]="maximizeTitle"
|
|
586
|
+
[title]="maximizeTitle"
|
|
587
|
+
class="k-signature-action k-signature-maximize k-button k-button-md k-button-flat k-button-flat-base k-rounded-md k-icon-button">
|
|
588
|
+
<span class="k-button-icon k-icon k-i-window-maximize"></span>
|
|
589
|
+
</button>
|
|
590
|
+
<button
|
|
591
|
+
[class.k-hidden]="!showMinimize"
|
|
592
|
+
(click)="onMinimize()"
|
|
593
|
+
[attr.aria-label]="minimizeTitle"
|
|
594
|
+
[title]="minimizeTitle"
|
|
595
|
+
class="k-signature-action k-signature-minimize k-button k-button-md k-button-flat k-button-flat-base k-rounded-md k-icon-button">
|
|
596
|
+
<span class="k-button-icon k-icon k-i-window-minimize"></span>
|
|
597
|
+
</button>
|
|
598
|
+
</div>
|
|
599
|
+
<div #canvas class="k-signature-canvas" [attr.tabindex]="tabindex"></div>
|
|
600
|
+
<div class="k-signature-line" *ngIf="!hideLine"></div>
|
|
601
|
+
<div class="k-signature-actions k-signature-actions-bottom">
|
|
602
|
+
<button
|
|
603
|
+
class="k-signature-action k-signature-clear k-button k-button-md k-button-flat k-button-flat-base k-rounded-md k-icon-button"
|
|
604
|
+
[class.k-hidden]="!showClear"
|
|
605
|
+
[attr.aria-label]="clearTitle"
|
|
606
|
+
[title]="clearTitle"
|
|
607
|
+
(click)="onClear()" >
|
|
608
|
+
<span class="k-button-icon k-icon k-i-close"></span>
|
|
609
|
+
</button>
|
|
610
|
+
</div>
|
|
611
|
+
|
|
612
|
+
<kendo-dialog *ngIf="isOpen">
|
|
613
|
+
<kendo-signature
|
|
614
|
+
[readonly]="readonly"
|
|
615
|
+
[disabled]="disabled"
|
|
616
|
+
[size]="size"
|
|
617
|
+
[rounded]="rounded"
|
|
618
|
+
[fillMode]="fillMode"
|
|
619
|
+
[color]="color"
|
|
620
|
+
[strokeWidth]="strokeWidth"
|
|
621
|
+
[smooth]="smooth"
|
|
622
|
+
[value]="value"
|
|
623
|
+
(valueChange)="onDialogValueChange($event)"
|
|
624
|
+
[hideLine]="hideLine"
|
|
625
|
+
[class.k-signature-maximized]="true"
|
|
626
|
+
[maximized]="true"
|
|
627
|
+
(minimize)="onDialogClose()"
|
|
628
|
+
[width]="popupWidth"
|
|
629
|
+
[height]="popupHeight"
|
|
630
|
+
[popupScale]="popupScale"
|
|
631
|
+
[parentLocalization]="localization">
|
|
632
|
+
</kendo-signature>
|
|
633
|
+
</kendo-dialog>
|
|
634
|
+
`
|
|
635
|
+
}]
|
|
636
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.NgZone }, { type: i1.LocalizationService }]; }, propDecorators: { staticHostClasses: [{
|
|
637
|
+
type: HostBinding,
|
|
638
|
+
args: ['class.k-signature']
|
|
639
|
+
}, {
|
|
640
|
+
type: HostBinding,
|
|
641
|
+
args: ['class.k-input']
|
|
642
|
+
}], readonly: [{
|
|
643
|
+
type: HostBinding,
|
|
644
|
+
args: ['class.k-readonly']
|
|
645
|
+
}, {
|
|
646
|
+
type: Input
|
|
647
|
+
}], disabled: [{
|
|
648
|
+
type: HostBinding,
|
|
649
|
+
args: ['class.k-disabled']
|
|
650
|
+
}, {
|
|
651
|
+
type: Input
|
|
652
|
+
}], value: [{
|
|
653
|
+
type: Input
|
|
654
|
+
}], tabindex: [{
|
|
655
|
+
type: Input
|
|
656
|
+
}], size: [{
|
|
657
|
+
type: Input
|
|
658
|
+
}], rounded: [{
|
|
659
|
+
type: Input
|
|
660
|
+
}], fillMode: [{
|
|
661
|
+
type: Input
|
|
662
|
+
}], color: [{
|
|
663
|
+
type: Input
|
|
664
|
+
}], strokeWidth: [{
|
|
665
|
+
type: Input
|
|
666
|
+
}], smooth: [{
|
|
667
|
+
type: Input
|
|
668
|
+
}], maximizable: [{
|
|
669
|
+
type: Input
|
|
670
|
+
}], maximized: [{
|
|
671
|
+
type: Input
|
|
672
|
+
}], popupScale: [{
|
|
673
|
+
type: Input
|
|
674
|
+
}], parentLocalization: [{
|
|
675
|
+
type: Input
|
|
676
|
+
}], hideLine: [{
|
|
677
|
+
type: Input
|
|
678
|
+
}], width: [{
|
|
679
|
+
type: Input
|
|
680
|
+
}, {
|
|
681
|
+
type: HostBinding,
|
|
682
|
+
args: ['style.width.px']
|
|
683
|
+
}], height: [{
|
|
684
|
+
type: Input
|
|
685
|
+
}, {
|
|
686
|
+
type: HostBinding,
|
|
687
|
+
args: ['style.height.px']
|
|
688
|
+
}], direction: [{
|
|
689
|
+
type: HostBinding,
|
|
690
|
+
args: ['attr.dir']
|
|
691
|
+
}], valueChange: [{
|
|
692
|
+
type: Output
|
|
693
|
+
}], open: [{
|
|
694
|
+
type: Output
|
|
695
|
+
}], close: [{
|
|
696
|
+
type: Output
|
|
697
|
+
}], onFocus: [{
|
|
698
|
+
type: Output,
|
|
699
|
+
args: ['focus']
|
|
700
|
+
}], onBlur: [{
|
|
701
|
+
type: Output,
|
|
702
|
+
args: ['blur']
|
|
703
|
+
}], minimize: [{
|
|
704
|
+
type: Output
|
|
705
|
+
}], canvas: [{
|
|
706
|
+
type: ViewChild,
|
|
707
|
+
args: ['canvas']
|
|
708
|
+
}], focusedClass: [{
|
|
709
|
+
type: HostBinding,
|
|
710
|
+
args: ['class.k-focus']
|
|
711
|
+
}] } });
|