@progress/kendo-angular-inputs 18.1.0-develop.2 → 18.1.0-develop.21
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/colorpicker/adaptiveness/adaptive-close-button.component.d.ts +20 -0
- package/colorpicker/adaptiveness/adaptive-renderer.component.d.ts +38 -0
- package/colorpicker/color-gradient-text-label.directive.d.ts +19 -0
- package/colorpicker/color-gradient.component.d.ts +19 -1
- package/colorpicker/color-input.component.d.ts +15 -3
- package/colorpicker/color-palette.component.d.ts +16 -6
- package/colorpicker/colorpicker.component.d.ts +55 -8
- package/colorpicker/flatcolorpicker-actions.component.d.ts +3 -1
- package/colorpicker/flatcolorpicker-header.component.d.ts +3 -1
- package/colorpicker/flatcolorpicker.component.d.ts +19 -1
- package/colorpicker/localization/messages.d.ts +9 -1
- package/colorpicker/models/adaptive-mode.d.ts +23 -0
- package/common/utils.d.ts +4 -0
- package/directives.d.ts +7 -1
- package/esm2022/colorpicker/adaptiveness/adaptive-close-button.component.mjs +62 -0
- package/esm2022/colorpicker/adaptiveness/adaptive-renderer.component.mjs +205 -0
- package/esm2022/colorpicker/color-gradient-text-label.directive.mjs +34 -0
- package/esm2022/colorpicker/color-gradient.component.mjs +75 -17
- package/esm2022/colorpicker/color-input.component.mjs +56 -23
- package/esm2022/colorpicker/color-palette.component.mjs +45 -15
- package/esm2022/colorpicker/colorpicker.component.mjs +182 -41
- package/esm2022/colorpicker/flatcolorpicker-actions.component.mjs +22 -7
- package/esm2022/colorpicker/flatcolorpicker-header.component.mjs +8 -3
- package/esm2022/colorpicker/flatcolorpicker.component.mjs +72 -17
- package/esm2022/colorpicker/localization/messages.mjs +13 -1
- package/esm2022/colorpicker/models/adaptive-mode.mjs +27 -0
- package/esm2022/colorpicker/services/flatcolorpicker.service.mjs +3 -3
- package/esm2022/colorpicker.module.mjs +3 -2
- package/esm2022/common/utils.mjs +4 -0
- package/esm2022/directives.mjs +10 -0
- package/esm2022/index.mjs +3 -0
- package/esm2022/inputs.module.mjs +6 -3
- package/esm2022/otpinput/localization/custom-messages.component.mjs +43 -0
- package/esm2022/otpinput/localization/localized-textbox-messages.directive.mjs +39 -0
- package/esm2022/otpinput/localization/messages.mjs +34 -0
- package/esm2022/otpinput/models/otpinput-type.mjs +5 -0
- package/esm2022/otpinput/models/separator-icon.mjs +5 -0
- package/esm2022/otpinput/otpinput-separator.component.mjs +83 -0
- package/esm2022/otpinput/otpinput.component.mjs +930 -0
- package/esm2022/package-metadata.mjs +2 -2
- package/fesm2022/progress-kendo-angular-inputs.mjs +2694 -956
- package/index.d.ts +4 -0
- package/inputs.module.d.ts +3 -1
- package/otpinput/localization/custom-messages.component.d.ts +17 -0
- package/otpinput/localization/localized-textbox-messages.directive.d.ts +16 -0
- package/otpinput/localization/messages.d.ts +24 -0
- package/otpinput/models/otpinput-type.d.ts +10 -0
- package/otpinput/models/separator-icon.d.ts +12 -0
- package/otpinput/otpinput-separator.component.d.ts +25 -0
- package/otpinput/otpinput.component.d.ts +284 -0
- package/package.json +12 -10
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
6
|
-
import { Component, Input, Output, EventEmitter, ElementRef, HostBinding, ViewChild, Renderer2 } from '@angular/core';
|
|
6
|
+
import { Component, Input, Output, EventEmitter, ElementRef, HostBinding, ViewChild, Renderer2, ChangeDetectorRef } from '@angular/core';
|
|
7
7
|
import { getRGBA, parseColor, getColorFromRGBA } from './utils';
|
|
8
8
|
import { isPresent } from '../common/utils';
|
|
9
9
|
import { guid, isDocumentAvailable } from '@progress/kendo-angular-common';
|
|
@@ -14,14 +14,18 @@ import { caretAltExpandIcon } from '@progress/kendo-svg-icons';
|
|
|
14
14
|
import { NumericLabelDirective } from './color-gradient-numeric-label.directive';
|
|
15
15
|
import { NgIf } from '@angular/common';
|
|
16
16
|
import { ButtonComponent } from '@progress/kendo-angular-buttons';
|
|
17
|
+
import { TextBoxComponent } from '../textbox/textbox.component';
|
|
18
|
+
import { TextLabelDirective } from './color-gradient-text-label.directive';
|
|
17
19
|
import * as i0 from "@angular/core";
|
|
18
20
|
import * as i1 from "@progress/kendo-angular-l10n";
|
|
21
|
+
const DEFAULT_SIZE = 'medium';
|
|
19
22
|
/**
|
|
20
23
|
* @hidden
|
|
21
24
|
*/
|
|
22
25
|
export class ColorInputComponent {
|
|
23
26
|
host;
|
|
24
27
|
renderer;
|
|
28
|
+
cdr;
|
|
25
29
|
localizationService;
|
|
26
30
|
/**
|
|
27
31
|
* The id of the hex input.
|
|
@@ -31,6 +35,16 @@ export class ColorInputComponent {
|
|
|
31
35
|
* The color format view.
|
|
32
36
|
*/
|
|
33
37
|
formatView;
|
|
38
|
+
/**
|
|
39
|
+
* The size property specifies the padding of the ColorInput.
|
|
40
|
+
*
|
|
41
|
+
* The possible values are:
|
|
42
|
+
* * `small`
|
|
43
|
+
* * `medium` (default)
|
|
44
|
+
* * `large`
|
|
45
|
+
* * `none`
|
|
46
|
+
*/
|
|
47
|
+
size = DEFAULT_SIZE;
|
|
34
48
|
/**
|
|
35
49
|
* The inputs tabindex.
|
|
36
50
|
*/
|
|
@@ -96,9 +110,10 @@ export class ColorInputComponent {
|
|
|
96
110
|
*/
|
|
97
111
|
caretAltExpandIcon = caretAltExpandIcon;
|
|
98
112
|
subscriptions = new Subscription();
|
|
99
|
-
constructor(host, renderer, localizationService) {
|
|
113
|
+
constructor(host, renderer, cdr, localizationService) {
|
|
100
114
|
this.host = host;
|
|
101
115
|
this.renderer = renderer;
|
|
116
|
+
this.cdr = cdr;
|
|
102
117
|
this.localizationService = localizationService;
|
|
103
118
|
}
|
|
104
119
|
ngAfterViewInit() {
|
|
@@ -162,6 +177,8 @@ export class ColorInputComponent {
|
|
|
162
177
|
}
|
|
163
178
|
toggleFormatView() {
|
|
164
179
|
this.formatView = this.formatView === 'hex' ? 'rgba' : 'hex';
|
|
180
|
+
// needed to update the view when ChangeDetectionStrategy.OnPush
|
|
181
|
+
this.cdr.markForCheck();
|
|
165
182
|
}
|
|
166
183
|
initDomEvents() {
|
|
167
184
|
if (!this.host) {
|
|
@@ -172,8 +189,8 @@ export class ColorInputComponent {
|
|
|
172
189
|
lastInput() {
|
|
173
190
|
return this.hexInput?.nativeElement || this.opacityInput || this.blueInput;
|
|
174
191
|
}
|
|
175
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ColorInputComponent, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
|
|
176
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ColorInputComponent, isStandalone: true, selector: "kendo-colorinput", inputs: { focusableId: "focusableId", formatView: "formatView", tabindex: "tabindex", value: "value", opacity: "opacity", disabled: "disabled", readonly: "readonly" }, outputs: { valueChange: "valueChange", tabOut: "tabOut" }, host: { properties: { "class.k-colorgradient-inputs": "this.colorInputClass", "class.k-hstack": "this.colorInputClass" } }, viewQueries: [{ propertyName: "opacityInput", first: true, predicate: ["opacityInput"], descendants: true }, { propertyName: "hexInput", first: true, predicate: ["hexInput"], descendants: true }, { propertyName: "blueInput", first: true, predicate: ["blue"], descendants: true }, { propertyName: "toggleFormatButton", first: true, predicate: ["toggleFormatButton"], descendants: true, read: ElementRef }], usesOnChanges: true, ngImport: i0, template: `
|
|
192
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ColorInputComponent, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
|
|
193
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ColorInputComponent, isStandalone: true, selector: "kendo-colorinput", inputs: { focusableId: "focusableId", formatView: "formatView", size: "size", tabindex: "tabindex", value: "value", opacity: "opacity", disabled: "disabled", readonly: "readonly" }, outputs: { valueChange: "valueChange", tabOut: "tabOut" }, host: { properties: { "class.k-colorgradient-inputs": "this.colorInputClass", "class.k-hstack": "this.colorInputClass" } }, viewQueries: [{ propertyName: "opacityInput", first: true, predicate: ["opacityInput"], descendants: true }, { propertyName: "hexInput", first: true, predicate: ["hexInput"], descendants: true }, { propertyName: "blueInput", first: true, predicate: ["blue"], descendants: true }, { propertyName: "toggleFormatButton", first: true, predicate: ["toggleFormatButton"], descendants: true, read: ElementRef }], usesOnChanges: true, ngImport: i0, template: `
|
|
177
194
|
<div class="k-vstack">
|
|
178
195
|
<button
|
|
179
196
|
kendoButton
|
|
@@ -182,6 +199,7 @@ export class ColorInputComponent {
|
|
|
182
199
|
#toggleFormatButton
|
|
183
200
|
icon="caret-alt-expand"
|
|
184
201
|
[svgIcon]="caretAltExpandIcon"
|
|
202
|
+
[size]="size"
|
|
185
203
|
class="k-colorgradient-toggle-mode"
|
|
186
204
|
[attr.aria-label]="formatButtonTitle"
|
|
187
205
|
[attr.title]="formatButtonTitle"
|
|
@@ -190,20 +208,22 @@ export class ColorInputComponent {
|
|
|
190
208
|
>
|
|
191
209
|
</button>
|
|
192
210
|
</div>
|
|
193
|
-
<div *ngIf="formatView === 'hex'" class="k-vstack">
|
|
194
|
-
<
|
|
211
|
+
<div *ngIf="formatView === 'hex'" class="k-vstack k-flex-1">
|
|
212
|
+
<kendo-textbox
|
|
195
213
|
#hexInput
|
|
196
|
-
|
|
197
|
-
|
|
214
|
+
kendoTextLabel
|
|
215
|
+
[focusableId]="focusableId"
|
|
216
|
+
class="k-hex-value"
|
|
217
|
+
[size]="size"
|
|
198
218
|
[class.k-readonly]="readonly"
|
|
199
219
|
[disabled]="disabled"
|
|
200
220
|
[readonly]="readonly"
|
|
201
221
|
[value]="hex || ''"
|
|
202
222
|
(blur)="handleHexInputBlur()"
|
|
203
223
|
(input)="handleHexValueChange(hexInput.value)"
|
|
204
|
-
[tabindex]="tabindex
|
|
205
|
-
(keydown.tab)="focusDragHandle($event)"
|
|
206
|
-
|
|
224
|
+
[tabindex]="tabindex"
|
|
225
|
+
(keydown.tab)="focusDragHandle($event)">
|
|
226
|
+
</kendo-textbox>
|
|
207
227
|
<label [for]="focusableId" class="k-colorgradient-input-label">HEX</label>
|
|
208
228
|
</div>
|
|
209
229
|
<ng-container *ngIf="formatView === 'rgba'">
|
|
@@ -213,6 +233,7 @@ export class ColorInputComponent {
|
|
|
213
233
|
kendoAdditionalNumericLabel="red"
|
|
214
234
|
[localizationService]="localizationService"
|
|
215
235
|
[disabled]="disabled"
|
|
236
|
+
[size]="size"
|
|
216
237
|
[readonly]="readonly"
|
|
217
238
|
[tabindex]="tabindex"
|
|
218
239
|
[min]="0"
|
|
@@ -235,6 +256,7 @@ export class ColorInputComponent {
|
|
|
235
256
|
[disabled]="disabled"
|
|
236
257
|
[readonly]="readonly"
|
|
237
258
|
[tabindex]="tabindex"
|
|
259
|
+
[size]="size"
|
|
238
260
|
[min]="0"
|
|
239
261
|
[max]="255"
|
|
240
262
|
[(value)]="rgba.g"
|
|
@@ -255,6 +277,7 @@ export class ColorInputComponent {
|
|
|
255
277
|
[disabled]="disabled"
|
|
256
278
|
[readonly]="readonly"
|
|
257
279
|
[tabindex]="tabindex"
|
|
280
|
+
[size]="size"
|
|
258
281
|
[min]="0"
|
|
259
282
|
[max]="255"
|
|
260
283
|
[(value)]="rgba.b"
|
|
@@ -269,13 +292,14 @@ export class ColorInputComponent {
|
|
|
269
292
|
<label [for]="blue.focusableId" class="k-colorgradient-input-label">B</label>
|
|
270
293
|
</div>
|
|
271
294
|
<div class="k-vstack" *ngIf="opacity">
|
|
272
|
-
<kendo-numerictextbox
|
|
295
|
+
<kendo-numerictextbox #opacityInput
|
|
273
296
|
#alpha
|
|
274
297
|
kendoAdditionalNumericLabel="alpha"
|
|
275
298
|
[localizationService]="localizationService"
|
|
276
299
|
[disabled]="disabled"
|
|
277
300
|
[readonly]="readonly"
|
|
278
301
|
[tabindex]="tabindex"
|
|
302
|
+
[size]="size"
|
|
279
303
|
[min]="0"
|
|
280
304
|
[max]="1"
|
|
281
305
|
[(value)]="rgba.a"
|
|
@@ -291,7 +315,7 @@ export class ColorInputComponent {
|
|
|
291
315
|
<label [for]="alpha.focusableId" class="k-colorgradient-input-label">A</label>
|
|
292
316
|
</div>
|
|
293
317
|
</ng-container>
|
|
294
|
-
`, isInline: true, dependencies: [{ kind: "component", type: ButtonComponent, selector: "button[kendoButton]", inputs: ["arrowIcon", "toggleable", "togglable", "selected", "tabIndex", "imageUrl", "iconClass", "icon", "disabled", "size", "rounded", "fillMode", "themeColor", "svgIcon", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: NumericTextBoxComponent, selector: "kendo-numerictextbox", inputs: ["focusableId", "disabled", "readonly", "title", "autoCorrect", "format", "max", "min", "decimals", "placeholder", "step", "spinners", "rangeValidation", "tabindex", "tabIndex", "changeValueOnScroll", "selectOnFocus", "value", "maxlength", "size", "rounded", "fillMode", "inputAttributes"], outputs: ["valueChange", "focus", "blur", "inputFocus", "inputBlur"], exportAs: ["kendoNumericTextBox"] }, { kind: "directive", type: NumericLabelDirective, selector: "[kendoAdditionalNumericLabel]", inputs: ["kendoAdditionalNumericLabel", "localizationService"] }] });
|
|
318
|
+
`, isInline: true, dependencies: [{ kind: "component", type: ButtonComponent, selector: "button[kendoButton]", inputs: ["arrowIcon", "toggleable", "togglable", "selected", "tabIndex", "imageUrl", "iconClass", "icon", "disabled", "size", "rounded", "fillMode", "themeColor", "svgIcon", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: NumericTextBoxComponent, selector: "kendo-numerictextbox", inputs: ["focusableId", "disabled", "readonly", "title", "autoCorrect", "format", "max", "min", "decimals", "placeholder", "step", "spinners", "rangeValidation", "tabindex", "tabIndex", "changeValueOnScroll", "selectOnFocus", "value", "maxlength", "size", "rounded", "fillMode", "inputAttributes"], outputs: ["valueChange", "focus", "blur", "inputFocus", "inputBlur"], exportAs: ["kendoNumericTextBox"] }, { kind: "directive", type: NumericLabelDirective, selector: "[kendoAdditionalNumericLabel]", inputs: ["kendoAdditionalNumericLabel", "localizationService"] }, { kind: "component", type: TextBoxComponent, selector: "kendo-textbox", inputs: ["focusableId", "title", "type", "disabled", "readonly", "tabindex", "value", "selectOnFocus", "showSuccessIcon", "showErrorIcon", "clearButton", "successIcon", "successSvgIcon", "errorIcon", "errorSvgIcon", "clearButtonIcon", "clearButtonSvgIcon", "size", "rounded", "fillMode", "tabIndex", "placeholder", "maxlength", "inputAttributes"], outputs: ["valueChange", "inputFocus", "inputBlur", "focus", "blur"], exportAs: ["kendoTextBox"] }, { kind: "directive", type: TextLabelDirective, selector: "[kendoTextLabel]", inputs: ["focusableId"] }] });
|
|
295
319
|
}
|
|
296
320
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ColorInputComponent, decorators: [{
|
|
297
321
|
type: Component,
|
|
@@ -306,6 +330,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
306
330
|
#toggleFormatButton
|
|
307
331
|
icon="caret-alt-expand"
|
|
308
332
|
[svgIcon]="caretAltExpandIcon"
|
|
333
|
+
[size]="size"
|
|
309
334
|
class="k-colorgradient-toggle-mode"
|
|
310
335
|
[attr.aria-label]="formatButtonTitle"
|
|
311
336
|
[attr.title]="formatButtonTitle"
|
|
@@ -314,20 +339,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
314
339
|
>
|
|
315
340
|
</button>
|
|
316
341
|
</div>
|
|
317
|
-
<div *ngIf="formatView === 'hex'" class="k-vstack">
|
|
318
|
-
<
|
|
342
|
+
<div *ngIf="formatView === 'hex'" class="k-vstack k-flex-1">
|
|
343
|
+
<kendo-textbox
|
|
319
344
|
#hexInput
|
|
320
|
-
|
|
321
|
-
|
|
345
|
+
kendoTextLabel
|
|
346
|
+
[focusableId]="focusableId"
|
|
347
|
+
class="k-hex-value"
|
|
348
|
+
[size]="size"
|
|
322
349
|
[class.k-readonly]="readonly"
|
|
323
350
|
[disabled]="disabled"
|
|
324
351
|
[readonly]="readonly"
|
|
325
352
|
[value]="hex || ''"
|
|
326
353
|
(blur)="handleHexInputBlur()"
|
|
327
354
|
(input)="handleHexValueChange(hexInput.value)"
|
|
328
|
-
[tabindex]="tabindex
|
|
329
|
-
(keydown.tab)="focusDragHandle($event)"
|
|
330
|
-
|
|
355
|
+
[tabindex]="tabindex"
|
|
356
|
+
(keydown.tab)="focusDragHandle($event)">
|
|
357
|
+
</kendo-textbox>
|
|
331
358
|
<label [for]="focusableId" class="k-colorgradient-input-label">HEX</label>
|
|
332
359
|
</div>
|
|
333
360
|
<ng-container *ngIf="formatView === 'rgba'">
|
|
@@ -337,6 +364,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
337
364
|
kendoAdditionalNumericLabel="red"
|
|
338
365
|
[localizationService]="localizationService"
|
|
339
366
|
[disabled]="disabled"
|
|
367
|
+
[size]="size"
|
|
340
368
|
[readonly]="readonly"
|
|
341
369
|
[tabindex]="tabindex"
|
|
342
370
|
[min]="0"
|
|
@@ -359,6 +387,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
359
387
|
[disabled]="disabled"
|
|
360
388
|
[readonly]="readonly"
|
|
361
389
|
[tabindex]="tabindex"
|
|
390
|
+
[size]="size"
|
|
362
391
|
[min]="0"
|
|
363
392
|
[max]="255"
|
|
364
393
|
[(value)]="rgba.g"
|
|
@@ -379,6 +408,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
379
408
|
[disabled]="disabled"
|
|
380
409
|
[readonly]="readonly"
|
|
381
410
|
[tabindex]="tabindex"
|
|
411
|
+
[size]="size"
|
|
382
412
|
[min]="0"
|
|
383
413
|
[max]="255"
|
|
384
414
|
[(value)]="rgba.b"
|
|
@@ -393,13 +423,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
393
423
|
<label [for]="blue.focusableId" class="k-colorgradient-input-label">B</label>
|
|
394
424
|
</div>
|
|
395
425
|
<div class="k-vstack" *ngIf="opacity">
|
|
396
|
-
<kendo-numerictextbox
|
|
426
|
+
<kendo-numerictextbox #opacityInput
|
|
397
427
|
#alpha
|
|
398
428
|
kendoAdditionalNumericLabel="alpha"
|
|
399
429
|
[localizationService]="localizationService"
|
|
400
430
|
[disabled]="disabled"
|
|
401
431
|
[readonly]="readonly"
|
|
402
432
|
[tabindex]="tabindex"
|
|
433
|
+
[size]="size"
|
|
403
434
|
[min]="0"
|
|
404
435
|
[max]="1"
|
|
405
436
|
[(value)]="rgba.a"
|
|
@@ -417,12 +448,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
417
448
|
</ng-container>
|
|
418
449
|
`,
|
|
419
450
|
standalone: true,
|
|
420
|
-
imports: [ButtonComponent, NgIf, NumericTextBoxComponent, NumericLabelDirective]
|
|
451
|
+
imports: [ButtonComponent, NgIf, NumericTextBoxComponent, NumericLabelDirective, TextBoxComponent, TextLabelDirective]
|
|
421
452
|
}]
|
|
422
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i1.LocalizationService }]; }, propDecorators: { focusableId: [{
|
|
453
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }, { type: i1.LocalizationService }]; }, propDecorators: { focusableId: [{
|
|
423
454
|
type: Input
|
|
424
455
|
}], formatView: [{
|
|
425
456
|
type: Input
|
|
457
|
+
}], size: [{
|
|
458
|
+
type: Input
|
|
426
459
|
}], tabindex: [{
|
|
427
460
|
type: Input
|
|
428
461
|
}], value: [{
|
|
@@ -14,17 +14,17 @@ import { ColorPaletteLocalizationService } from './localization/colorpalette-loc
|
|
|
14
14
|
import { packageMetadata } from '../package-metadata';
|
|
15
15
|
import { PALETTEPRESETS } from './models';
|
|
16
16
|
import { parseColor } from './utils';
|
|
17
|
-
import { isPresent } from '../common/utils';
|
|
17
|
+
import { getStylingClasses, isPresent } from '../common/utils';
|
|
18
18
|
import { ColorPaletteService } from './services/color-palette.service';
|
|
19
19
|
import { NgFor, NgStyle } from '@angular/common';
|
|
20
20
|
import { LocalizedColorPickerMessagesDirective } from './localization/localized-colorpicker-messages.directive';
|
|
21
21
|
import * as i0 from "@angular/core";
|
|
22
22
|
import * as i1 from "./services/color-palette.service";
|
|
23
23
|
import * as i2 from "@progress/kendo-angular-l10n";
|
|
24
|
-
const DEFAULT_TILE_SIZE = 24;
|
|
25
24
|
const DEFAULT_COLUMNS_COUNT = 10;
|
|
26
25
|
const DEFAULT_PRESET = 'office';
|
|
27
26
|
const DEFAULT_ACCESSIBLE_PRESET = 'accessible';
|
|
27
|
+
const DEFAULT_SIZE = 'medium';
|
|
28
28
|
let serial = 0;
|
|
29
29
|
/**
|
|
30
30
|
* The ColorPalette component provides a set of predefined palette presets and enables you to implement a custom color palette.
|
|
@@ -114,6 +114,23 @@ export class ColorPaletteComponent {
|
|
|
114
114
|
get palette() {
|
|
115
115
|
return this._palette;
|
|
116
116
|
}
|
|
117
|
+
/**
|
|
118
|
+
* The size property specifies the padding of the ColorPalette internal elements.
|
|
119
|
+
*
|
|
120
|
+
* The possible values are:
|
|
121
|
+
* * `small`
|
|
122
|
+
* * `medium` (default)
|
|
123
|
+
* * `large`
|
|
124
|
+
* * `none`
|
|
125
|
+
*/
|
|
126
|
+
set size(size) {
|
|
127
|
+
const newSize = size || DEFAULT_SIZE;
|
|
128
|
+
this.handleClasses(newSize, 'size');
|
|
129
|
+
this._size = newSize;
|
|
130
|
+
}
|
|
131
|
+
get size() {
|
|
132
|
+
return this._size;
|
|
133
|
+
}
|
|
117
134
|
/**
|
|
118
135
|
* Specifies the [tabindex](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the component.
|
|
119
136
|
*/
|
|
@@ -136,13 +153,9 @@ export class ColorPaletteComponent {
|
|
|
136
153
|
*/
|
|
137
154
|
readonly = false;
|
|
138
155
|
/**
|
|
139
|
-
* Specifies the size of a color cell.
|
|
140
|
-
*
|
|
141
|
-
* The possible values are:
|
|
142
|
-
* * (Default) `tileSize = 24`
|
|
143
|
-
* * `{ width: number, height: number }`
|
|
156
|
+
* Specifies the size of a color cell. The default tile size depends on the `size` of the component.
|
|
144
157
|
*/
|
|
145
|
-
tileSize
|
|
158
|
+
tileSize;
|
|
146
159
|
/**
|
|
147
160
|
* @hidden
|
|
148
161
|
*/
|
|
@@ -209,6 +222,7 @@ export class ColorPaletteComponent {
|
|
|
209
222
|
*/
|
|
210
223
|
uniqueId = guid();
|
|
211
224
|
selection;
|
|
225
|
+
_size = 'medium';
|
|
212
226
|
_value;
|
|
213
227
|
_columns;
|
|
214
228
|
_palette;
|
|
@@ -239,6 +253,10 @@ export class ColorPaletteComponent {
|
|
|
239
253
|
this.subs.add(this.renderer.listen(elem, 'blur', () => this.handleHostBlur()));
|
|
240
254
|
}
|
|
241
255
|
ngAfterViewInit() {
|
|
256
|
+
const stylingInputs = ['size'];
|
|
257
|
+
stylingInputs.forEach(input => {
|
|
258
|
+
this.handleClasses(this[input], input);
|
|
259
|
+
});
|
|
242
260
|
this.setHostElementAriaLabel();
|
|
243
261
|
if (this.value) {
|
|
244
262
|
this.ngZone.onStable.pipe(take(1)).subscribe(() => {
|
|
@@ -424,10 +442,20 @@ export class ColorPaletteComponent {
|
|
|
424
442
|
const selectedColor = this.service.getColorAt(this.focusedCell);
|
|
425
443
|
this.handleCellSelection(selectedColor, this.focusedCell);
|
|
426
444
|
}
|
|
445
|
+
handleClasses(value, input) {
|
|
446
|
+
const elem = this.host.nativeElement;
|
|
447
|
+
const classes = getStylingClasses('colorpalette', input, this[input], value);
|
|
448
|
+
if (classes.toRemove) {
|
|
449
|
+
this.renderer.removeClass(elem, classes.toRemove);
|
|
450
|
+
}
|
|
451
|
+
if (classes.toAdd) {
|
|
452
|
+
this.renderer.addClass(elem, classes.toAdd);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
427
455
|
notifyNgTouched = () => { };
|
|
428
456
|
notifyNgChanged = () => { };
|
|
429
457
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ColorPaletteComponent, deps: [{ token: i0.ElementRef }, { token: i1.ColorPaletteService }, { token: i0.ChangeDetectorRef }, { token: i0.Renderer2 }, { token: i2.LocalizationService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
|
|
430
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ColorPaletteComponent, isStandalone: true, selector: "kendo-colorpalette", inputs: { id: "id", format: "format", value: "value", columns: "columns", palette: "palette", tabindex: "tabindex", disabled: "disabled", readonly: "readonly", tileSize: "tileSize" }, outputs: { selectionChange: "selectionChange", valueChange: "valueChange", cellSelection: "cellSelection" }, host: { properties: { "attr.dir": "this.direction", "attr.role": "this.role", "attr.aria-activedescendant": "this.activeDescendant", "attr.id": "this.paletteId", "class.k-readonly": "this.readonly", "attr.tabindex": "this.hostTabindex", "class.k-colorpalette": "this.hostClasses", "attr.aria-disabled": "this.disabledClass", "class.k-disabled": "this.disabledClass", "attr.aria-readonly": "this.readonlyAttribute" } }, providers: [
|
|
458
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ColorPaletteComponent, isStandalone: true, selector: "kendo-colorpalette", inputs: { id: "id", format: "format", value: "value", columns: "columns", palette: "palette", size: "size", tabindex: "tabindex", disabled: "disabled", readonly: "readonly", tileSize: "tileSize" }, outputs: { selectionChange: "selectionChange", valueChange: "valueChange", cellSelection: "cellSelection" }, host: { properties: { "attr.dir": "this.direction", "attr.role": "this.role", "attr.aria-activedescendant": "this.activeDescendant", "attr.id": "this.paletteId", "class.k-readonly": "this.readonly", "attr.tabindex": "this.hostTabindex", "class.k-colorpalette": "this.hostClasses", "attr.aria-disabled": "this.disabledClass", "class.k-disabled": "this.disabledClass", "attr.aria-readonly": "this.readonlyAttribute" } }, providers: [
|
|
431
459
|
{
|
|
432
460
|
multi: true,
|
|
433
461
|
provide: NG_VALUE_ACCESSOR,
|
|
@@ -466,9 +494,9 @@ export class ColorPaletteComponent {
|
|
|
466
494
|
(click)="handleCellSelection(color, { row: rowIndex, col: colIndex })"
|
|
467
495
|
[ngStyle]="{
|
|
468
496
|
backgroundColor: color,
|
|
469
|
-
width: tileLayout
|
|
470
|
-
height: tileLayout
|
|
471
|
-
minWidth: tileLayout
|
|
497
|
+
width: tileLayout?.width + 'px',
|
|
498
|
+
height: tileLayout?.height + 'px',
|
|
499
|
+
minWidth: tileLayout?.width + 'px'
|
|
472
500
|
}">
|
|
473
501
|
</td>
|
|
474
502
|
</tr>
|
|
@@ -521,9 +549,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
521
549
|
(click)="handleCellSelection(color, { row: rowIndex, col: colIndex })"
|
|
522
550
|
[ngStyle]="{
|
|
523
551
|
backgroundColor: color,
|
|
524
|
-
width: tileLayout
|
|
525
|
-
height: tileLayout
|
|
526
|
-
minWidth: tileLayout
|
|
552
|
+
width: tileLayout?.width + 'px',
|
|
553
|
+
height: tileLayout?.height + 'px',
|
|
554
|
+
minWidth: tileLayout?.width + 'px'
|
|
527
555
|
}">
|
|
528
556
|
</td>
|
|
529
557
|
</tr>
|
|
@@ -555,6 +583,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
555
583
|
type: Input
|
|
556
584
|
}], palette: [{
|
|
557
585
|
type: Input
|
|
586
|
+
}], size: [{
|
|
587
|
+
type: Input
|
|
558
588
|
}], tabindex: [{
|
|
559
589
|
type: Input
|
|
560
590
|
}], disabled: [{
|