@progress/kendo-angular-inputs 21.4.1 → 22.0.0
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/localization/messages.d.ts +1 -1
- package/common/radio-checkbox.base.d.ts +1 -1
- package/fesm2022/progress-kendo-angular-inputs.mjs +321 -321
- package/numerictextbox/localization/messages.d.ts +1 -1
- package/otpinput/localization/messages.d.ts +1 -1
- package/package.json +17 -25
- package/rangeslider/localization/messages.d.ts +1 -1
- package/signature/localization/messages.d.ts +1 -1
- package/slider/localization/messages.d.ts +1 -1
- package/sliders-common/slider-base.d.ts +1 -1
- package/switch/localization/messages.d.ts +1 -1
- package/text-fields-common/text-fields-base.d.ts +1 -1
- package/textbox/localization/messages.d.ts +1 -1
- package/esm2022/checkbox/checkbox.component.mjs +0 -227
- package/esm2022/checkbox/checkbox.directive.mjs +0 -96
- package/esm2022/checkbox/checked-state.mjs +0 -5
- package/esm2022/checkbox.module.mjs +0 -42
- package/esm2022/colorpicker/adaptiveness/adaptive-close-button.component.mjs +0 -62
- package/esm2022/colorpicker/adaptiveness/adaptive-renderer.component.mjs +0 -219
- package/esm2022/colorpicker/color-contrast-svg.component.mjs +0 -108
- package/esm2022/colorpicker/color-gradient-numeric-label.directive.mjs +0 -37
- package/esm2022/colorpicker/color-gradient-text-label.directive.mjs +0 -34
- package/esm2022/colorpicker/color-gradient.component.mjs +0 -1110
- package/esm2022/colorpicker/color-input.component.mjs +0 -498
- package/esm2022/colorpicker/color-palette.component.mjs +0 -629
- package/esm2022/colorpicker/colorpicker.component.mjs +0 -1315
- package/esm2022/colorpicker/constants.mjs +0 -40
- package/esm2022/colorpicker/contrast-validation.component.mjs +0 -83
- package/esm2022/colorpicker/contrast.component.mjs +0 -114
- package/esm2022/colorpicker/events/active-color-click-event.mjs +0 -55
- package/esm2022/colorpicker/events/cancel-event.mjs +0 -18
- package/esm2022/colorpicker/events/close-event.mjs +0 -10
- package/esm2022/colorpicker/events/kendo-drag-event.mjs +0 -5
- package/esm2022/colorpicker/events/open-event.mjs +0 -10
- package/esm2022/colorpicker/events.mjs +0 -8
- package/esm2022/colorpicker/flatcolorpicker-actions.component.mjs +0 -112
- package/esm2022/colorpicker/flatcolorpicker-header.component.mjs +0 -244
- package/esm2022/colorpicker/flatcolorpicker.component.mjs +0 -942
- package/esm2022/colorpicker/localization/colorgradient-localization.service.mjs +0 -46
- package/esm2022/colorpicker/localization/colorpalette-localization.service.mjs +0 -46
- package/esm2022/colorpicker/localization/colorpicker-localization.service.mjs +0 -31
- package/esm2022/colorpicker/localization/custom-messages.component.mjs +0 -51
- package/esm2022/colorpicker/localization/flatcolorpicker-localization.service.mjs +0 -46
- package/esm2022/colorpicker/localization/localized-colorpicker-messages.directive.mjs +0 -39
- package/esm2022/colorpicker/localization/messages.mjs +0 -201
- package/esm2022/colorpicker/models/actions-layout.mjs +0 -5
- package/esm2022/colorpicker/models/adaptive-mode.mjs +0 -8
- package/esm2022/colorpicker/models/colorpicker-view.mjs +0 -5
- package/esm2022/colorpicker/models/gradient-settings.mjs +0 -5
- package/esm2022/colorpicker/models/hsva.mjs +0 -5
- package/esm2022/colorpicker/models/output-format.mjs +0 -5
- package/esm2022/colorpicker/models/palette-presets.mjs +0 -62
- package/esm2022/colorpicker/models/palette-settings.mjs +0 -5
- package/esm2022/colorpicker/models/popup-settings.mjs +0 -5
- package/esm2022/colorpicker/models/rgb.mjs +0 -5
- package/esm2022/colorpicker/models/rgba.mjs +0 -5
- package/esm2022/colorpicker/models/table-cell.mjs +0 -5
- package/esm2022/colorpicker/models/tile-size.mjs +0 -5
- package/esm2022/colorpicker/models.mjs +0 -16
- package/esm2022/colorpicker/services/color-palette.service.mjs +0 -65
- package/esm2022/colorpicker/services/flatcolorpicker.service.mjs +0 -39
- package/esm2022/colorpicker/utils/color-parser.mjs +0 -164
- package/esm2022/colorpicker/utils/contrast-curve.mjs +0 -85
- package/esm2022/colorpicker/utils.mjs +0 -6
- package/esm2022/colorpicker.module.mjs +0 -50
- package/esm2022/common/dom-utils.mjs +0 -36
- package/esm2022/common/formservice.service.mjs +0 -21
- package/esm2022/common/math.mjs +0 -65
- package/esm2022/common/models/fillmode.mjs +0 -5
- package/esm2022/common/models/gutters.mjs +0 -5
- package/esm2022/common/models/responsive-breakpoints.mjs +0 -5
- package/esm2022/common/models/rounded.mjs +0 -5
- package/esm2022/common/models/size.mjs +0 -5
- package/esm2022/common/models/styling-classes.mjs +0 -5
- package/esm2022/common/models/type.mjs +0 -5
- package/esm2022/common/models.mjs +0 -9
- package/esm2022/common/radio-checkbox.base.mjs +0 -295
- package/esm2022/common/utils.mjs +0 -88
- package/esm2022/directives.mjs +0 -430
- package/esm2022/form/form.component.mjs +0 -163
- package/esm2022/form/formseparator.component.mjs +0 -80
- package/esm2022/form/utils.mjs +0 -147
- package/esm2022/form.module.mjs +0 -46
- package/esm2022/formfield/error.component.mjs +0 -70
- package/esm2022/formfield/formfield.component.mjs +0 -353
- package/esm2022/formfield/hint.component.mjs +0 -65
- package/esm2022/formfield/models/message-align.mjs +0 -5
- package/esm2022/formfield/models/orientation.mjs +0 -5
- package/esm2022/formfield/models/show-options.mjs +0 -5
- package/esm2022/formfield.module.mjs +0 -43
- package/esm2022/formfieldset/formfieldset.component.mjs +0 -174
- package/esm2022/index.mjs +0 -91
- package/esm2022/inputs.module.mjs +0 -91
- package/esm2022/maskedtextbox/maskedtextbox.component.mjs +0 -876
- package/esm2022/maskedtextbox/masking.service.mjs +0 -189
- package/esm2022/maskedtextbox/parsing/combinators.mjs +0 -28
- package/esm2022/maskedtextbox/parsing/parsers.mjs +0 -148
- package/esm2022/maskedtextbox/parsing/result.mjs +0 -44
- package/esm2022/maskedtextbox/parsing/stream.mjs +0 -43
- package/esm2022/maskedtextbox.module.mjs +0 -43
- package/esm2022/numerictextbox/arrow-direction.mjs +0 -13
- package/esm2022/numerictextbox/constants.mjs +0 -28
- package/esm2022/numerictextbox/localization/custom-messages.component.mjs +0 -55
- package/esm2022/numerictextbox/localization/localized-numerictextbox-messages.directive.mjs +0 -39
- package/esm2022/numerictextbox/localization/messages.mjs +0 -33
- package/esm2022/numerictextbox/numerictextbox.component.mjs +0 -1314
- package/esm2022/numerictextbox/utils.mjs +0 -92
- package/esm2022/numerictextbox.module.mjs +0 -46
- package/esm2022/otp.module.mjs +0 -44
- package/esm2022/otpinput/localization/custom-messages.component.mjs +0 -45
- package/esm2022/otpinput/localization/localized-textbox-messages.directive.mjs +0 -39
- package/esm2022/otpinput/localization/messages.mjs +0 -34
- package/esm2022/otpinput/models/otpinput-type.mjs +0 -5
- package/esm2022/otpinput/models/separator-icon.mjs +0 -5
- package/esm2022/otpinput/otpinput-separator.component.mjs +0 -93
- package/esm2022/otpinput/otpinput.component.mjs +0 -936
- package/esm2022/package-metadata.mjs +0 -16
- package/esm2022/progress-kendo-angular-inputs.mjs +0 -8
- package/esm2022/radiobutton/radiobutton.component.mjs +0 -212
- package/esm2022/radiobutton/radiobutton.directive.mjs +0 -81
- package/esm2022/radiobutton.module.mjs +0 -43
- package/esm2022/rangeslider/localization/custom-messages.component.mjs +0 -53
- package/esm2022/rangeslider/localization/localized-rangeslider-messages.directive.mjs +0 -39
- package/esm2022/rangeslider/localization/messages.mjs +0 -33
- package/esm2022/rangeslider/rangeslider-model.mjs +0 -53
- package/esm2022/rangeslider/rangeslider-value.type.mjs +0 -5
- package/esm2022/rangeslider/rangeslider.component.mjs +0 -625
- package/esm2022/rangeslider.module.mjs +0 -46
- package/esm2022/rating/directives/rating-hovered-item.directive.mjs +0 -35
- package/esm2022/rating/directives/rating-item.directive.mjs +0 -34
- package/esm2022/rating/directives/rating-selected-item.directive.mjs +0 -36
- package/esm2022/rating/models/precision.mjs +0 -5
- package/esm2022/rating/models/rating-item.interface.mjs +0 -5
- package/esm2022/rating/models/selection.mjs +0 -5
- package/esm2022/rating/rating.component.mjs +0 -754
- package/esm2022/rating.module.mjs +0 -46
- package/esm2022/shared/input-separator.component.mjs +0 -55
- package/esm2022/shared/input-spacer.component.mjs +0 -56
- package/esm2022/shared/shared-events.directive.mjs +0 -102
- package/esm2022/shared/utils.mjs +0 -13
- package/esm2022/signature/events/close-event.mjs +0 -10
- package/esm2022/signature/events/index.mjs +0 -6
- package/esm2022/signature/events/open-event.mjs +0 -10
- package/esm2022/signature/localization/custom-messages.component.mjs +0 -43
- package/esm2022/signature/localization/index.mjs +0 -7
- package/esm2022/signature/localization/localized-signature-messages.directive.mjs +0 -39
- package/esm2022/signature/localization/messages.mjs +0 -45
- package/esm2022/signature/signature.component.mjs +0 -981
- package/esm2022/signature.module.mjs +0 -47
- package/esm2022/slider/localization/custom-messages.component.mjs +0 -43
- package/esm2022/slider/localization/localized-slider-messages.directive.mjs +0 -39
- package/esm2022/slider/localization/messages.mjs +0 -39
- package/esm2022/slider/slider-model.mjs +0 -32
- package/esm2022/slider/slider.component.mjs +0 -671
- package/esm2022/slider.module.mjs +0 -48
- package/esm2022/sliders-common/label-template.directive.mjs +0 -37
- package/esm2022/sliders-common/slider-base.mjs +0 -300
- package/esm2022/sliders-common/slider-model.base.mjs +0 -118
- package/esm2022/sliders-common/slider-ticks.component.mjs +0 -147
- package/esm2022/sliders-common/sliders-util.mjs +0 -206
- package/esm2022/sliders-common/title-callback.mjs +0 -5
- package/esm2022/switch/events/blur-event.mjs +0 -13
- package/esm2022/switch/events/focus-event.mjs +0 -13
- package/esm2022/switch/localization/custom-messages.component.mjs +0 -43
- package/esm2022/switch/localization/localized-switch-messages.directive.mjs +0 -39
- package/esm2022/switch/localization/messages.mjs +0 -33
- package/esm2022/switch/switch.component.mjs +0 -585
- package/esm2022/switch.module.mjs +0 -44
- package/esm2022/text-fields-common/text-fields-base.mjs +0 -150
- package/esm2022/textarea/models/adornments-orientation.mjs +0 -5
- package/esm2022/textarea/models/flow.mjs +0 -5
- package/esm2022/textarea/models/resize.mjs +0 -5
- package/esm2022/textarea/models/textarea-settings.mjs +0 -5
- package/esm2022/textarea/textarea-prefix.component.mjs +0 -67
- package/esm2022/textarea/textarea-suffix.component.mjs +0 -67
- package/esm2022/textarea/textarea.component.mjs +0 -740
- package/esm2022/textarea/textarea.directive.mjs +0 -288
- package/esm2022/textarea.module.mjs +0 -46
- package/esm2022/textbox/localization/custom-messages.component.mjs +0 -43
- package/esm2022/textbox/localization/localized-textbox-messages.directive.mjs +0 -39
- package/esm2022/textbox/localization/messages.mjs +0 -27
- package/esm2022/textbox/models/icon-show-options.mjs +0 -5
- package/esm2022/textbox/textbox-prefix.directive.mjs +0 -50
- package/esm2022/textbox/textbox-suffix.directive.mjs +0 -49
- package/esm2022/textbox/textbox.component.mjs +0 -933
- package/esm2022/textbox/textbox.directive.mjs +0 -125
- package/esm2022/textbox.module.mjs +0 -51
- package/esm2022/validators/max.validator.mjs +0 -21
- package/esm2022/validators/min.validator.mjs +0 -21
|
@@ -1,629 +0,0 @@
|
|
|
1
|
-
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
3
|
-
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
-
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
6
|
-
import { Component, Input, EventEmitter, Output, HostBinding, forwardRef, ChangeDetectorRef, Renderer2, ElementRef, NgZone } from '@angular/core';
|
|
7
|
-
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
8
|
-
import { Keys, KendoInput, guid, normalizeKeys } from '@progress/kendo-angular-common';
|
|
9
|
-
import { LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
|
|
10
|
-
import { validatePackage } from '@progress/kendo-licensing';
|
|
11
|
-
import { Subscription } from 'rxjs';
|
|
12
|
-
import { take } from 'rxjs/operators';
|
|
13
|
-
import { ColorPaletteLocalizationService } from './localization/colorpalette-localization.service';
|
|
14
|
-
import { packageMetadata } from '../package-metadata';
|
|
15
|
-
import { PALETTEPRESETS } from './models';
|
|
16
|
-
import { parseColor } from './utils';
|
|
17
|
-
import { getStylingClasses, isPresent } from '../common/utils';
|
|
18
|
-
import { ColorPaletteService } from './services/color-palette.service';
|
|
19
|
-
import { NgStyle } from '@angular/common';
|
|
20
|
-
import { LocalizedColorPickerMessagesDirective } from './localization/localized-colorpicker-messages.directive';
|
|
21
|
-
import * as i0 from "@angular/core";
|
|
22
|
-
import * as i1 from "./services/color-palette.service";
|
|
23
|
-
import * as i2 from "@progress/kendo-angular-l10n";
|
|
24
|
-
const DEFAULT_COLUMNS_COUNT = 10;
|
|
25
|
-
const DEFAULT_PRESET = 'office';
|
|
26
|
-
const DEFAULT_ACCESSIBLE_PRESET = 'accessible';
|
|
27
|
-
const DEFAULT_SIZE = 'medium';
|
|
28
|
-
let serial = 0;
|
|
29
|
-
/**
|
|
30
|
-
* Represents the Kendo UI ColorPalette component.
|
|
31
|
-
*
|
|
32
|
-
* The `ColorPaletteComponent` provides a set of predefined palette presets and lets you implement a custom color palette. You can use it directly or as part of the `kendo-colorpicker`.
|
|
33
|
-
*
|
|
34
|
-
* @example
|
|
35
|
-
* ```html
|
|
36
|
-
* <kendo-colorpalette [palette]="['#fff', '#000']" [(value)]="selectedColor"></kendo-colorpalette>
|
|
37
|
-
* ```
|
|
38
|
-
*
|
|
39
|
-
* @remarks
|
|
40
|
-
* Supported children components are: {@link ColorPickerMessages}.
|
|
41
|
-
*/
|
|
42
|
-
export class ColorPaletteComponent {
|
|
43
|
-
host;
|
|
44
|
-
service;
|
|
45
|
-
cdr;
|
|
46
|
-
renderer;
|
|
47
|
-
localizationService;
|
|
48
|
-
ngZone;
|
|
49
|
-
/**
|
|
50
|
-
* @hidden
|
|
51
|
-
*/
|
|
52
|
-
direction;
|
|
53
|
-
/**
|
|
54
|
-
* @hidden
|
|
55
|
-
*/
|
|
56
|
-
role = 'grid';
|
|
57
|
-
/**
|
|
58
|
-
* @hidden
|
|
59
|
-
*/
|
|
60
|
-
get activeDescendant() {
|
|
61
|
-
return this.activeCellId;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* @hidden
|
|
65
|
-
*/
|
|
66
|
-
get paletteId() {
|
|
67
|
-
return this.id;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* @hidden
|
|
71
|
-
*/
|
|
72
|
-
id = `k-colorpalette-${serial++}`;
|
|
73
|
-
/**
|
|
74
|
-
* Specifies the output format of the `ColorPaletteComponent`.
|
|
75
|
-
* The input value may be in a different format. The component parses it into the output `format`.
|
|
76
|
-
*
|
|
77
|
-
* @default 'hex'
|
|
78
|
-
*/
|
|
79
|
-
format = 'hex';
|
|
80
|
-
/**
|
|
81
|
-
* Sets the value of the selected color.
|
|
82
|
-
*/
|
|
83
|
-
set value(value) {
|
|
84
|
-
this._value = parseColor(value, this.format);
|
|
85
|
-
}
|
|
86
|
-
get value() {
|
|
87
|
-
return this._value;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Sets the number of columns to display.
|
|
91
|
-
*
|
|
92
|
-
* @default 10
|
|
93
|
-
*/
|
|
94
|
-
set columns(value) {
|
|
95
|
-
const minColumnsCount = 1;
|
|
96
|
-
this._columns = value > minColumnsCount ? value : minColumnsCount;
|
|
97
|
-
}
|
|
98
|
-
get columns() {
|
|
99
|
-
return this._columns;
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Sets the color palette to display. You can use a predefined palette preset (such as `office`, `basic`, or `apex`), string with comma-separated colors, or an array of string colors.
|
|
103
|
-
*/
|
|
104
|
-
set palette(value) {
|
|
105
|
-
if (!isPresent(value)) {
|
|
106
|
-
value = DEFAULT_PRESET;
|
|
107
|
-
}
|
|
108
|
-
if (typeof value === 'string' && isPresent(PALETTEPRESETS[value])) {
|
|
109
|
-
this.columns = this.columns || PALETTEPRESETS[value].columns;
|
|
110
|
-
value = PALETTEPRESETS[value].colors;
|
|
111
|
-
}
|
|
112
|
-
const colors = (typeof value === 'string') ? value.split(',') : value;
|
|
113
|
-
this._palette = colors.map(color => parseColor(color, this.format, false, false));
|
|
114
|
-
}
|
|
115
|
-
get palette() {
|
|
116
|
-
return this._palette;
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Sets the size of the ColorPalette internal elements.
|
|
120
|
-
*
|
|
121
|
-
* @default 'medium'
|
|
122
|
-
*/
|
|
123
|
-
set size(size) {
|
|
124
|
-
const newSize = size || DEFAULT_SIZE;
|
|
125
|
-
this.handleClasses(newSize, 'size');
|
|
126
|
-
this._size = newSize;
|
|
127
|
-
}
|
|
128
|
-
get size() {
|
|
129
|
-
return this._size;
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Sets the [`tabindex`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the component.
|
|
133
|
-
*
|
|
134
|
-
* @default 0
|
|
135
|
-
*/
|
|
136
|
-
set tabindex(value) {
|
|
137
|
-
const tabindex = Number(value);
|
|
138
|
-
const defaultValue = 0;
|
|
139
|
-
this._tabindex = !isNaN(tabindex) ? tabindex : defaultValue;
|
|
140
|
-
}
|
|
141
|
-
get tabindex() {
|
|
142
|
-
return !this.disabled ? this._tabindex : undefined;
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* Disables the ColorPalette. To disable it in reactive forms, see [Forms Support](slug:formssupport_colorpalette#toc-managing-the-colorpalette-disabled-state-in-reactive-forms).
|
|
146
|
-
*/
|
|
147
|
-
disabled = false;
|
|
148
|
-
/**
|
|
149
|
-
* Sets the read-only state of the ColorPalette.
|
|
150
|
-
*
|
|
151
|
-
* @default false
|
|
152
|
-
*/
|
|
153
|
-
readonly = false;
|
|
154
|
-
/**
|
|
155
|
-
* Sets the size of a color cell. The default tile size depends on the `size` of the component.
|
|
156
|
-
*/
|
|
157
|
-
tileSize;
|
|
158
|
-
/**
|
|
159
|
-
* @hidden
|
|
160
|
-
*/
|
|
161
|
-
get tileLayout() {
|
|
162
|
-
if (typeof this.tileSize !== 'number') {
|
|
163
|
-
return this.tileSize;
|
|
164
|
-
}
|
|
165
|
-
return { width: this.tileSize, height: this.tileSize };
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* Fires when the color selection changes.
|
|
169
|
-
*/
|
|
170
|
-
selectionChange = new EventEmitter();
|
|
171
|
-
/**
|
|
172
|
-
* Fires when the value changes.
|
|
173
|
-
*/
|
|
174
|
-
valueChange = new EventEmitter();
|
|
175
|
-
/**
|
|
176
|
-
* Fires each time the user selects a cell with the mouse or presses `Enter`.
|
|
177
|
-
*
|
|
178
|
-
* @hidden
|
|
179
|
-
*/
|
|
180
|
-
cellSelection = new EventEmitter();
|
|
181
|
-
/**
|
|
182
|
-
* @hidden
|
|
183
|
-
*/
|
|
184
|
-
get colorRows() {
|
|
185
|
-
return this.service.colorRows;
|
|
186
|
-
}
|
|
187
|
-
/**
|
|
188
|
-
* @hidden
|
|
189
|
-
*/
|
|
190
|
-
get hostTabindex() { return this.tabindex; }
|
|
191
|
-
/**
|
|
192
|
-
* @hidden
|
|
193
|
-
*/
|
|
194
|
-
hostClasses = true;
|
|
195
|
-
/**
|
|
196
|
-
* @hidden
|
|
197
|
-
*/
|
|
198
|
-
get disabledClass() { return this.disabled; }
|
|
199
|
-
/**
|
|
200
|
-
* @hidden
|
|
201
|
-
*/
|
|
202
|
-
get readonlyAttribute() { return this.readonly; }
|
|
203
|
-
/**
|
|
204
|
-
* @hidden
|
|
205
|
-
*/
|
|
206
|
-
activeCellId;
|
|
207
|
-
/**
|
|
208
|
-
* @hidden
|
|
209
|
-
*/
|
|
210
|
-
focusedCell;
|
|
211
|
-
/**
|
|
212
|
-
* @hidden
|
|
213
|
-
*/
|
|
214
|
-
selectedCell;
|
|
215
|
-
/**
|
|
216
|
-
* @hidden
|
|
217
|
-
*/
|
|
218
|
-
focusInComponent;
|
|
219
|
-
/**
|
|
220
|
-
* @hidden
|
|
221
|
-
*/
|
|
222
|
-
uniqueId = guid();
|
|
223
|
-
selection;
|
|
224
|
-
_size = 'medium';
|
|
225
|
-
_value;
|
|
226
|
-
_columns;
|
|
227
|
-
_palette;
|
|
228
|
-
_tabindex = 0;
|
|
229
|
-
subs = new Subscription();
|
|
230
|
-
dynamicRTLSubscription;
|
|
231
|
-
constructor(host, service, cdr, renderer, localizationService, ngZone) {
|
|
232
|
-
this.host = host;
|
|
233
|
-
this.service = service;
|
|
234
|
-
this.cdr = cdr;
|
|
235
|
-
this.renderer = renderer;
|
|
236
|
-
this.localizationService = localizationService;
|
|
237
|
-
this.ngZone = ngZone;
|
|
238
|
-
validatePackage(packageMetadata);
|
|
239
|
-
this.dynamicRTLSubscription = localizationService.changes.subscribe(({ rtl }) => {
|
|
240
|
-
this.direction = rtl ? 'rtl' : 'ltr';
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
ngOnInit() {
|
|
244
|
-
if (this.colorRows.length === 0) {
|
|
245
|
-
const defaultPreset = (this.format !== 'name') ? DEFAULT_PRESET : DEFAULT_ACCESSIBLE_PRESET;
|
|
246
|
-
this.palette = this.palette || defaultPreset;
|
|
247
|
-
this.setRows();
|
|
248
|
-
}
|
|
249
|
-
const elem = this.host.nativeElement;
|
|
250
|
-
this.subs.add(this.renderer.listen(elem, 'keydown', event => this.handleKeydown(event)));
|
|
251
|
-
this.subs.add(this.renderer.listen(elem, 'focus', () => this.handleFocus()));
|
|
252
|
-
this.subs.add(this.renderer.listen(elem, 'blur', () => this.handleHostBlur()));
|
|
253
|
-
}
|
|
254
|
-
ngAfterViewInit() {
|
|
255
|
-
const stylingInputs = ['size'];
|
|
256
|
-
stylingInputs.forEach(input => {
|
|
257
|
-
this.handleClasses(this[input], input);
|
|
258
|
-
});
|
|
259
|
-
this.setHostElementAriaLabel();
|
|
260
|
-
if (this.value) {
|
|
261
|
-
this.ngZone.onStable.pipe(take(1)).subscribe(() => {
|
|
262
|
-
this.selectCell(this.value);
|
|
263
|
-
});
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
ngOnDestroy() {
|
|
267
|
-
this.subs.unsubscribe();
|
|
268
|
-
if (this.dynamicRTLSubscription) {
|
|
269
|
-
this.dynamicRTLSubscription.unsubscribe();
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
ngOnChanges(changes) {
|
|
273
|
-
if (changes['palette'] || changes['columns']) {
|
|
274
|
-
this.setRows();
|
|
275
|
-
}
|
|
276
|
-
if (changes['palette'] || changes['value'] || changes['columns']) {
|
|
277
|
-
this.selectCell(this.value);
|
|
278
|
-
this.setHostElementAriaLabel();
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
/**
|
|
282
|
-
* @hidden
|
|
283
|
-
*/
|
|
284
|
-
handleKeydown(event) {
|
|
285
|
-
const code = normalizeKeys(event);
|
|
286
|
-
const isRTL = this.direction === 'rtl';
|
|
287
|
-
switch (code) {
|
|
288
|
-
case Keys.ArrowDown:
|
|
289
|
-
this.handleCellNavigation(0, 1);
|
|
290
|
-
break;
|
|
291
|
-
case Keys.ArrowUp:
|
|
292
|
-
this.handleCellNavigation(0, -1);
|
|
293
|
-
break;
|
|
294
|
-
case Keys.ArrowRight:
|
|
295
|
-
this.handleCellNavigation(isRTL ? -1 : 1, 0);
|
|
296
|
-
break;
|
|
297
|
-
case Keys.ArrowLeft:
|
|
298
|
-
this.handleCellNavigation(isRTL ? 1 : -1, 0);
|
|
299
|
-
break;
|
|
300
|
-
case Keys.Enter:
|
|
301
|
-
this.handleEnter();
|
|
302
|
-
break;
|
|
303
|
-
default: return;
|
|
304
|
-
}
|
|
305
|
-
event.preventDefault();
|
|
306
|
-
}
|
|
307
|
-
/**
|
|
308
|
-
* @hidden
|
|
309
|
-
*/
|
|
310
|
-
handleFocus() {
|
|
311
|
-
if (!this.focusInComponent) {
|
|
312
|
-
this.focus();
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
/**
|
|
316
|
-
* @hidden
|
|
317
|
-
*/
|
|
318
|
-
handleHostBlur() {
|
|
319
|
-
this.notifyNgTouched();
|
|
320
|
-
this.handleCellFocusOnBlur();
|
|
321
|
-
}
|
|
322
|
-
/**
|
|
323
|
-
* @hidden
|
|
324
|
-
*/
|
|
325
|
-
handleCellSelection(value, focusedCell) {
|
|
326
|
-
if (this.readonly) {
|
|
327
|
-
return;
|
|
328
|
-
}
|
|
329
|
-
this.selectedCell = focusedCell;
|
|
330
|
-
this.focusedCell = this.selectedCell;
|
|
331
|
-
this.focusInComponent = true;
|
|
332
|
-
const parsedColor = parseColor(value, this.format, false, false);
|
|
333
|
-
this.cellSelection.emit(parsedColor);
|
|
334
|
-
this.handleValueChange(parsedColor);
|
|
335
|
-
if (this.selection !== parsedColor) {
|
|
336
|
-
this.selection = parsedColor;
|
|
337
|
-
this.selectionChange.emit(parsedColor);
|
|
338
|
-
}
|
|
339
|
-
if (focusedCell) {
|
|
340
|
-
this.activeCellId = `k-${this.selectedCell.row}-${this.selectedCell.col}-${this.uniqueId}`;
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
/**
|
|
344
|
-
* @hidden
|
|
345
|
-
*/
|
|
346
|
-
writeValue(value) {
|
|
347
|
-
this.value = value;
|
|
348
|
-
this.selectCell(value);
|
|
349
|
-
this.cdr.markForCheck();
|
|
350
|
-
}
|
|
351
|
-
/**
|
|
352
|
-
* @hidden
|
|
353
|
-
*/
|
|
354
|
-
registerOnChange(fn) {
|
|
355
|
-
this.notifyNgChanged = fn;
|
|
356
|
-
}
|
|
357
|
-
/**
|
|
358
|
-
* @hidden
|
|
359
|
-
*/
|
|
360
|
-
registerOnTouched(fn) {
|
|
361
|
-
this.notifyNgTouched = fn;
|
|
362
|
-
}
|
|
363
|
-
/**
|
|
364
|
-
* @hidden
|
|
365
|
-
*/
|
|
366
|
-
setDisabledState(isDisabled) {
|
|
367
|
-
this.cdr.markForCheck();
|
|
368
|
-
this.disabled = isDisabled;
|
|
369
|
-
}
|
|
370
|
-
/**
|
|
371
|
-
* @hidden
|
|
372
|
-
*/
|
|
373
|
-
focus() {
|
|
374
|
-
this.host.nativeElement.focus();
|
|
375
|
-
if (!this.focusedCell && !this.readonly && !this.disabled) {
|
|
376
|
-
this.focusedCell = {
|
|
377
|
-
row: 0,
|
|
378
|
-
col: 0
|
|
379
|
-
};
|
|
380
|
-
this.activeCellId = `k-${this.focusedCell.row}-${this.focusedCell.col}-${this.uniqueId}`;
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
/**
|
|
384
|
-
* @hidden
|
|
385
|
-
* Used by the FloatingLabel to determine if the component is empty.
|
|
386
|
-
*/
|
|
387
|
-
isEmpty() {
|
|
388
|
-
return false;
|
|
389
|
-
}
|
|
390
|
-
/**
|
|
391
|
-
* Clears the color value of the ColorPalette.
|
|
392
|
-
*/
|
|
393
|
-
reset() {
|
|
394
|
-
this.focusedCell = null;
|
|
395
|
-
if (isPresent(this.value)) {
|
|
396
|
-
this.handleValueChange(undefined);
|
|
397
|
-
}
|
|
398
|
-
this.selectedCell = undefined;
|
|
399
|
-
}
|
|
400
|
-
handleValueChange(color) {
|
|
401
|
-
if (this.value === color) {
|
|
402
|
-
return;
|
|
403
|
-
}
|
|
404
|
-
this.value = color;
|
|
405
|
-
this.valueChange.emit(color);
|
|
406
|
-
this.notifyNgChanged(color);
|
|
407
|
-
this.setHostElementAriaLabel();
|
|
408
|
-
}
|
|
409
|
-
handleCellFocusOnBlur() {
|
|
410
|
-
this.focusInComponent = false;
|
|
411
|
-
this.focusedCell = this.selectedCell;
|
|
412
|
-
}
|
|
413
|
-
selectCell(value) {
|
|
414
|
-
const parsedColor = parseColor(value, 'hex');
|
|
415
|
-
this.selectedCell = this.service.getCellCoordsFor(parsedColor);
|
|
416
|
-
this.focusedCell = this.selectedCell;
|
|
417
|
-
}
|
|
418
|
-
setRows() {
|
|
419
|
-
if (!isPresent(this.palette)) {
|
|
420
|
-
return;
|
|
421
|
-
}
|
|
422
|
-
this.columns = this.columns || DEFAULT_COLUMNS_COUNT;
|
|
423
|
-
this.service.setColorMatrix(this.palette, this.columns);
|
|
424
|
-
}
|
|
425
|
-
handleCellNavigation(horizontalStep, verticalStep) {
|
|
426
|
-
if (this.readonly) {
|
|
427
|
-
return;
|
|
428
|
-
}
|
|
429
|
-
this.focusedCell = this.service.getNextCell(this.focusedCell, horizontalStep, verticalStep);
|
|
430
|
-
this.focusInComponent = true;
|
|
431
|
-
if (this.focusedCell) {
|
|
432
|
-
this.activeCellId = `k-${this.focusedCell.row}-${this.focusedCell.col}-${this.uniqueId}`;
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
setHostElementAriaLabel() {
|
|
436
|
-
const parsed = parseColor(this.value, this.format);
|
|
437
|
-
this.renderer.setAttribute(this.host.nativeElement, 'aria-label', `${this.value ? parsed : this.localizationService.get('colorPaletteNoColor')}`);
|
|
438
|
-
}
|
|
439
|
-
handleEnter() {
|
|
440
|
-
if (!isPresent(this.focusedCell)) {
|
|
441
|
-
return;
|
|
442
|
-
}
|
|
443
|
-
const selectedColor = this.service.getColorAt(this.focusedCell);
|
|
444
|
-
this.handleCellSelection(selectedColor, this.focusedCell);
|
|
445
|
-
}
|
|
446
|
-
handleClasses(value, input) {
|
|
447
|
-
const elem = this.host.nativeElement;
|
|
448
|
-
const classes = getStylingClasses('colorpalette', input, this[input], value);
|
|
449
|
-
if (classes.toRemove) {
|
|
450
|
-
this.renderer.removeClass(elem, classes.toRemove);
|
|
451
|
-
}
|
|
452
|
-
if (classes.toAdd) {
|
|
453
|
-
this.renderer.addClass(elem, classes.toAdd);
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
notifyNgTouched = () => { };
|
|
457
|
-
notifyNgChanged = () => { };
|
|
458
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", 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 });
|
|
459
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", 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: [
|
|
460
|
-
{
|
|
461
|
-
multi: true,
|
|
462
|
-
provide: NG_VALUE_ACCESSOR,
|
|
463
|
-
useExisting: forwardRef(() => ColorPaletteComponent)
|
|
464
|
-
}, {
|
|
465
|
-
provide: KendoInput,
|
|
466
|
-
useExisting: forwardRef(() => ColorPaletteComponent)
|
|
467
|
-
},
|
|
468
|
-
ColorPaletteService,
|
|
469
|
-
ColorPaletteLocalizationService,
|
|
470
|
-
{
|
|
471
|
-
provide: LocalizationService,
|
|
472
|
-
useExisting: ColorPaletteLocalizationService
|
|
473
|
-
},
|
|
474
|
-
{
|
|
475
|
-
provide: L10N_PREFIX,
|
|
476
|
-
useValue: 'kendo.colorpalette'
|
|
477
|
-
}
|
|
478
|
-
], exportAs: ["kendoColorPalette"], usesOnChanges: true, ngImport: i0, template: `
|
|
479
|
-
<ng-container kendoColorPaletteLocalizedMessages
|
|
480
|
-
i18n-colorPaletteNoColor="kendo.colorpalette.colorPaletteNoColor|The aria-label applied to the ColorPalette component when the value is empty."
|
|
481
|
-
colorPaletteNoColor="Colorpalette no color chosen">
|
|
482
|
-
</ng-container>
|
|
483
|
-
<table role="presentation" class="k-colorpalette-table">
|
|
484
|
-
<tbody>
|
|
485
|
-
@for (row of colorRows; track row; let rowIndex = $index) {
|
|
486
|
-
<tr role="row">
|
|
487
|
-
@for (color of row; track color; let colIndex = $index) {
|
|
488
|
-
<td
|
|
489
|
-
role="gridcell"
|
|
490
|
-
[class.k-selected]="selectedCell?.row === rowIndex && selectedCell?.col === colIndex"
|
|
491
|
-
[class.k-focus]="focusInComponent && focusedCell?.row === rowIndex && focusedCell?.col === colIndex"
|
|
492
|
-
[attr.aria-selected]="selectedCell?.row === rowIndex && selectedCell?.col === colIndex ? 'true' : undefined"
|
|
493
|
-
[attr.aria-label]="color"
|
|
494
|
-
class="k-colorpalette-tile"
|
|
495
|
-
[id]="'k-' + rowIndex + '-' + colIndex + '-' + uniqueId"
|
|
496
|
-
[attr.value]="color"
|
|
497
|
-
(click)="handleCellSelection(color, { row: rowIndex, col: colIndex })"
|
|
498
|
-
[ngStyle]="{
|
|
499
|
-
backgroundColor: color,
|
|
500
|
-
width: tileLayout?.width + 'px',
|
|
501
|
-
height: tileLayout?.height + 'px',
|
|
502
|
-
minWidth: tileLayout?.width + 'px'
|
|
503
|
-
}">
|
|
504
|
-
</td>
|
|
505
|
-
}
|
|
506
|
-
</tr>
|
|
507
|
-
}
|
|
508
|
-
</tbody>
|
|
509
|
-
</table>
|
|
510
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: LocalizedColorPickerMessagesDirective, selector: "[kendoColorPickerLocalizedMessages], [kendoFlatColorPickerLocalizedMessages], [kendoColorGradientLocalizedMessages], [kendoColorPaletteLocalizedMessages]" }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
|
|
511
|
-
}
|
|
512
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ColorPaletteComponent, decorators: [{
|
|
513
|
-
type: Component,
|
|
514
|
-
args: [{
|
|
515
|
-
exportAs: 'kendoColorPalette',
|
|
516
|
-
selector: 'kendo-colorpalette',
|
|
517
|
-
providers: [
|
|
518
|
-
{
|
|
519
|
-
multi: true,
|
|
520
|
-
provide: NG_VALUE_ACCESSOR,
|
|
521
|
-
useExisting: forwardRef(() => ColorPaletteComponent)
|
|
522
|
-
}, {
|
|
523
|
-
provide: KendoInput,
|
|
524
|
-
useExisting: forwardRef(() => ColorPaletteComponent)
|
|
525
|
-
},
|
|
526
|
-
ColorPaletteService,
|
|
527
|
-
ColorPaletteLocalizationService,
|
|
528
|
-
{
|
|
529
|
-
provide: LocalizationService,
|
|
530
|
-
useExisting: ColorPaletteLocalizationService
|
|
531
|
-
},
|
|
532
|
-
{
|
|
533
|
-
provide: L10N_PREFIX,
|
|
534
|
-
useValue: 'kendo.colorpalette'
|
|
535
|
-
}
|
|
536
|
-
],
|
|
537
|
-
template: `
|
|
538
|
-
<ng-container kendoColorPaletteLocalizedMessages
|
|
539
|
-
i18n-colorPaletteNoColor="kendo.colorpalette.colorPaletteNoColor|The aria-label applied to the ColorPalette component when the value is empty."
|
|
540
|
-
colorPaletteNoColor="Colorpalette no color chosen">
|
|
541
|
-
</ng-container>
|
|
542
|
-
<table role="presentation" class="k-colorpalette-table">
|
|
543
|
-
<tbody>
|
|
544
|
-
@for (row of colorRows; track row; let rowIndex = $index) {
|
|
545
|
-
<tr role="row">
|
|
546
|
-
@for (color of row; track color; let colIndex = $index) {
|
|
547
|
-
<td
|
|
548
|
-
role="gridcell"
|
|
549
|
-
[class.k-selected]="selectedCell?.row === rowIndex && selectedCell?.col === colIndex"
|
|
550
|
-
[class.k-focus]="focusInComponent && focusedCell?.row === rowIndex && focusedCell?.col === colIndex"
|
|
551
|
-
[attr.aria-selected]="selectedCell?.row === rowIndex && selectedCell?.col === colIndex ? 'true' : undefined"
|
|
552
|
-
[attr.aria-label]="color"
|
|
553
|
-
class="k-colorpalette-tile"
|
|
554
|
-
[id]="'k-' + rowIndex + '-' + colIndex + '-' + uniqueId"
|
|
555
|
-
[attr.value]="color"
|
|
556
|
-
(click)="handleCellSelection(color, { row: rowIndex, col: colIndex })"
|
|
557
|
-
[ngStyle]="{
|
|
558
|
-
backgroundColor: color,
|
|
559
|
-
width: tileLayout?.width + 'px',
|
|
560
|
-
height: tileLayout?.height + 'px',
|
|
561
|
-
minWidth: tileLayout?.width + 'px'
|
|
562
|
-
}">
|
|
563
|
-
</td>
|
|
564
|
-
}
|
|
565
|
-
</tr>
|
|
566
|
-
}
|
|
567
|
-
</tbody>
|
|
568
|
-
</table>
|
|
569
|
-
`,
|
|
570
|
-
standalone: true,
|
|
571
|
-
imports: [LocalizedColorPickerMessagesDirective, NgStyle]
|
|
572
|
-
}]
|
|
573
|
-
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1.ColorPaletteService }, { type: i0.ChangeDetectorRef }, { type: i0.Renderer2 }, { type: i2.LocalizationService }, { type: i0.NgZone }], propDecorators: { direction: [{
|
|
574
|
-
type: HostBinding,
|
|
575
|
-
args: ['attr.dir']
|
|
576
|
-
}], role: [{
|
|
577
|
-
type: HostBinding,
|
|
578
|
-
args: ['attr.role']
|
|
579
|
-
}], activeDescendant: [{
|
|
580
|
-
type: HostBinding,
|
|
581
|
-
args: ['attr.aria-activedescendant']
|
|
582
|
-
}], paletteId: [{
|
|
583
|
-
type: HostBinding,
|
|
584
|
-
args: ['attr.id']
|
|
585
|
-
}], id: [{
|
|
586
|
-
type: Input
|
|
587
|
-
}], format: [{
|
|
588
|
-
type: Input
|
|
589
|
-
}], value: [{
|
|
590
|
-
type: Input
|
|
591
|
-
}], columns: [{
|
|
592
|
-
type: Input
|
|
593
|
-
}], palette: [{
|
|
594
|
-
type: Input
|
|
595
|
-
}], size: [{
|
|
596
|
-
type: Input
|
|
597
|
-
}], tabindex: [{
|
|
598
|
-
type: Input
|
|
599
|
-
}], disabled: [{
|
|
600
|
-
type: Input
|
|
601
|
-
}], readonly: [{
|
|
602
|
-
type: Input
|
|
603
|
-
}, {
|
|
604
|
-
type: HostBinding,
|
|
605
|
-
args: ['class.k-readonly']
|
|
606
|
-
}], tileSize: [{
|
|
607
|
-
type: Input
|
|
608
|
-
}], selectionChange: [{
|
|
609
|
-
type: Output
|
|
610
|
-
}], valueChange: [{
|
|
611
|
-
type: Output
|
|
612
|
-
}], cellSelection: [{
|
|
613
|
-
type: Output
|
|
614
|
-
}], hostTabindex: [{
|
|
615
|
-
type: HostBinding,
|
|
616
|
-
args: ['attr.tabindex']
|
|
617
|
-
}], hostClasses: [{
|
|
618
|
-
type: HostBinding,
|
|
619
|
-
args: ['class.k-colorpalette']
|
|
620
|
-
}], disabledClass: [{
|
|
621
|
-
type: HostBinding,
|
|
622
|
-
args: ['attr.aria-disabled']
|
|
623
|
-
}, {
|
|
624
|
-
type: HostBinding,
|
|
625
|
-
args: ['class.k-disabled']
|
|
626
|
-
}], readonlyAttribute: [{
|
|
627
|
-
type: HostBinding,
|
|
628
|
-
args: ['attr.aria-readonly']
|
|
629
|
-
}] } });
|