@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,1315 +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 { take } from 'rxjs/operators';
|
|
7
|
-
import { Component, HostBinding, Input, Output, EventEmitter, ViewChild, ElementRef, TemplateRef, ViewContainerRef, forwardRef, ChangeDetectorRef, NgZone, Renderer2, Injector, isDevMode } from '@angular/core';
|
|
8
|
-
import { NG_VALUE_ACCESSOR, NgControl } from '@angular/forms';
|
|
9
|
-
import { Subscription } from 'rxjs';
|
|
10
|
-
import { FlatColorPickerComponent } from './flatcolorpicker.component';
|
|
11
|
-
import { PopupService } from '@progress/kendo-angular-popup';
|
|
12
|
-
import { ButtonComponent } from '@progress/kendo-angular-buttons';
|
|
13
|
-
import { AdaptiveService } from '@progress/kendo-angular-utils';
|
|
14
|
-
import { validatePackage } from '@progress/kendo-licensing';
|
|
15
|
-
import { Keys, KendoInput, isChanged, closest, guid, ResizeSensorComponent, isDocumentAvailable, normalizeKeys } from '@progress/kendo-angular-common';
|
|
16
|
-
import { LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
|
|
17
|
-
import { packageMetadata } from '../package-metadata';
|
|
18
|
-
import { PALETTEPRESETS } from './models';
|
|
19
|
-
import { ActiveColorClickEvent, ColorPickerCloseEvent, ColorPickerOpenEvent } from './events';
|
|
20
|
-
import { parseColor } from './utils';
|
|
21
|
-
import { getStylingClasses, isPresent } from '../common/utils';
|
|
22
|
-
import { ColorPickerLocalizationService } from './localization/colorpicker-localization.service';
|
|
23
|
-
import { DEFAULT_ACCESSIBLE_PRESET, DEFAULT_PRESET } from './constants';
|
|
24
|
-
import { IconWrapperComponent } from '@progress/kendo-angular-icons';
|
|
25
|
-
import { parseCSSClassNames } from '@progress/kendo-angular-common';
|
|
26
|
-
import { caretAltDownIcon } from '@progress/kendo-svg-icons';
|
|
27
|
-
import { NgClass } from '@angular/common';
|
|
28
|
-
import { LocalizedColorPickerMessagesDirective } from './localization/localized-colorpicker-messages.directive';
|
|
29
|
-
import { AdaptiveRendererComponent } from './adaptiveness/adaptive-renderer.component';
|
|
30
|
-
import * as i0 from "@angular/core";
|
|
31
|
-
import * as i1 from "@progress/kendo-angular-popup";
|
|
32
|
-
import * as i2 from "@progress/kendo-angular-l10n";
|
|
33
|
-
import * as i3 from "@progress/kendo-angular-utils";
|
|
34
|
-
const DOM_FOCUS_EVENTS = ['focus', 'blur'];
|
|
35
|
-
const DEFAULT_SIZE = 'medium';
|
|
36
|
-
const DEFAULT_ROUNDED = 'medium';
|
|
37
|
-
const DEFAULT_FILL_MODE = 'solid';
|
|
38
|
-
/**
|
|
39
|
-
* @hidden
|
|
40
|
-
*/
|
|
41
|
-
let nextColorPickerId = 0;
|
|
42
|
-
/**
|
|
43
|
-
* Represents the Kendo UI ColorPicker component for Angular.
|
|
44
|
-
*
|
|
45
|
-
* The `ColorPickerComponent` is a tool for choosing colors from Gradient and Palette views
|
|
46
|
-
* rendered in its popup. You can preview the selected color, revert it to its previous state, or clear it.
|
|
47
|
-
*
|
|
48
|
-
* @example
|
|
49
|
-
* ```html
|
|
50
|
-
* <kendo-colorpicker [(value)]="selectedColor"></kendo-colorpicker>
|
|
51
|
-
* ```
|
|
52
|
-
*
|
|
53
|
-
* @remarks
|
|
54
|
-
* Supported children components are: {@link ColorPickerMessages}.
|
|
55
|
-
*/
|
|
56
|
-
export class ColorPickerComponent {
|
|
57
|
-
host;
|
|
58
|
-
popupService;
|
|
59
|
-
cdr;
|
|
60
|
-
localizationService;
|
|
61
|
-
ngZone;
|
|
62
|
-
renderer;
|
|
63
|
-
injector;
|
|
64
|
-
adaptiveService;
|
|
65
|
-
hostClasses = true;
|
|
66
|
-
get focusedClass() {
|
|
67
|
-
return this.isFocused;
|
|
68
|
-
}
|
|
69
|
-
get disabledClass() {
|
|
70
|
-
return this.disabled;
|
|
71
|
-
}
|
|
72
|
-
get ariaReadonly() {
|
|
73
|
-
return this.readonly;
|
|
74
|
-
}
|
|
75
|
-
get ariaExpanded() {
|
|
76
|
-
return this.isOpen;
|
|
77
|
-
}
|
|
78
|
-
get hostTabindex() {
|
|
79
|
-
return this.tabindex;
|
|
80
|
-
}
|
|
81
|
-
direction;
|
|
82
|
-
role = 'combobox';
|
|
83
|
-
hasPopup = 'dialog';
|
|
84
|
-
get isControlInvalid() {
|
|
85
|
-
return (this.control?.invalid)?.toString();
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* @hidden
|
|
89
|
-
*/
|
|
90
|
-
focusableId;
|
|
91
|
-
/**
|
|
92
|
-
* Specifies the views rendered in the popup.
|
|
93
|
-
* By default, both the gradient and palette views are rendered.
|
|
94
|
-
*/
|
|
95
|
-
views = ['gradient', 'palette'];
|
|
96
|
-
/**
|
|
97
|
-
* @hidden
|
|
98
|
-
*/
|
|
99
|
-
set view(view) {
|
|
100
|
-
this.views = [view];
|
|
101
|
-
}
|
|
102
|
-
get view() {
|
|
103
|
-
return (this.views && this.views.length > 0) ? this.views[0] : null;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Enables or disables the adaptive mode.
|
|
107
|
-
* By default, adaptive rendering is disabled.
|
|
108
|
-
*/
|
|
109
|
-
adaptiveMode = 'none';
|
|
110
|
-
/**
|
|
111
|
-
* Sets the initially active view in the popup. Supports two-way binding.
|
|
112
|
-
*/
|
|
113
|
-
activeView;
|
|
114
|
-
/**
|
|
115
|
-
* Sets the read-only state of the ColorPicker.
|
|
116
|
-
*
|
|
117
|
-
* @default false
|
|
118
|
-
*/
|
|
119
|
-
readonly = false;
|
|
120
|
-
/**
|
|
121
|
-
* Sets the disabled state of the ColorPicker. To disable it in reactive forms, see [Forms Support](slug:formssupport_colorpicker#toc-managing-the-colorpicker-disabled-state-in-reactive-forms).
|
|
122
|
-
*
|
|
123
|
-
* @default false
|
|
124
|
-
*/
|
|
125
|
-
disabled = false;
|
|
126
|
-
/**
|
|
127
|
-
* Specifies the output format of the ColorPicker.
|
|
128
|
-
*
|
|
129
|
-
* If the input value is in a different format, the component parses it into the specified output `format`.
|
|
130
|
-
*
|
|
131
|
-
* @default 'rgba'
|
|
132
|
-
*/
|
|
133
|
-
format = 'rgba';
|
|
134
|
-
/**
|
|
135
|
-
* Sets the value of the selected color.
|
|
136
|
-
*/
|
|
137
|
-
set value(value) {
|
|
138
|
-
this._value = parseColor(value, this.format, this.gradientSettings.opacity);
|
|
139
|
-
}
|
|
140
|
-
get value() {
|
|
141
|
-
return this._value;
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Configures the popup of the ColorPicker.
|
|
145
|
-
*/
|
|
146
|
-
set popupSettings(value) {
|
|
147
|
-
this._popupSettings = Object.assign(this._popupSettings, value);
|
|
148
|
-
}
|
|
149
|
-
get popupSettings() {
|
|
150
|
-
return this._popupSettings;
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Configures the palette displayed in the ColorPicker popup.
|
|
154
|
-
*/
|
|
155
|
-
set paletteSettings(value) {
|
|
156
|
-
this._paletteSettings = Object.assign(this._paletteSettings, value);
|
|
157
|
-
}
|
|
158
|
-
get paletteSettings() {
|
|
159
|
-
return this._paletteSettings;
|
|
160
|
-
}
|
|
161
|
-
/**
|
|
162
|
-
* Configures the gradient displayed in the ColorPicker popup.
|
|
163
|
-
*/
|
|
164
|
-
set gradientSettings(value) {
|
|
165
|
-
this._gradientSettings = Object.assign(this._gradientSettings, value);
|
|
166
|
-
}
|
|
167
|
-
get gradientSettings() {
|
|
168
|
-
return this._gradientSettings;
|
|
169
|
-
}
|
|
170
|
-
/**
|
|
171
|
-
* Defines the name of an existing icon in the Kendo UI theme.
|
|
172
|
-
* Provide only the name of the icon without the `k-icon` or `k-i-` prefixes.
|
|
173
|
-
*/
|
|
174
|
-
icon;
|
|
175
|
-
/**
|
|
176
|
-
* A CSS class name which displays an icon in the ColorPicker button.
|
|
177
|
-
* `iconClass` is compatible with the `ngClass` syntax.
|
|
178
|
-
*
|
|
179
|
-
* Takes precedence over `icon` if both are defined.
|
|
180
|
-
*/
|
|
181
|
-
iconClass;
|
|
182
|
-
/**
|
|
183
|
-
* Defines an SVGIcon to render within the button.
|
|
184
|
-
* The input can take either an existing Kendo SVG icon or a custom one.
|
|
185
|
-
*/
|
|
186
|
-
set svgIcon(icon) {
|
|
187
|
-
if (isDevMode() && icon && this.icon && this.iconClass) {
|
|
188
|
-
throw new Error('Setting both icon/svgIcon and iconClass options at the same time is not supported.');
|
|
189
|
-
}
|
|
190
|
-
this._svgIcon = icon;
|
|
191
|
-
}
|
|
192
|
-
get svgIcon() {
|
|
193
|
-
return this._svgIcon;
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* Sets the title of the ActionSheet rendered instead of the Popup on small screens.
|
|
197
|
-
*/
|
|
198
|
-
adaptiveTitle = '';
|
|
199
|
-
/**
|
|
200
|
-
* Sets the subtitle of the ActionSheet rendered instead of the Popup on small screens.
|
|
201
|
-
* By default, the ActionSheet does not render a subtitle.
|
|
202
|
-
*/
|
|
203
|
-
adaptiveSubtitle;
|
|
204
|
-
/**
|
|
205
|
-
* Specifies whether the ColorPicker displays a **Clear color** button.
|
|
206
|
-
*
|
|
207
|
-
* @default true
|
|
208
|
-
*/
|
|
209
|
-
clearButton = true;
|
|
210
|
-
/**
|
|
211
|
-
* Sets the [`tabindex`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the component.
|
|
212
|
-
*
|
|
213
|
-
* @default 0
|
|
214
|
-
*/
|
|
215
|
-
set tabindex(value) {
|
|
216
|
-
const tabindex = Number(value);
|
|
217
|
-
const defaultValue = 0;
|
|
218
|
-
this._tabindex = !isNaN(tabindex) ? tabindex : defaultValue;
|
|
219
|
-
}
|
|
220
|
-
get tabindex() {
|
|
221
|
-
return !this.disabled ? this._tabindex : undefined;
|
|
222
|
-
}
|
|
223
|
-
/**
|
|
224
|
-
* Displays **Apply** and **Cancel** action buttons and color preview panes.
|
|
225
|
-
*
|
|
226
|
-
* When enabled, the component value does not change immediately upon
|
|
227
|
-
* color selection, but only after the **Apply** button is clicked.
|
|
228
|
-
*
|
|
229
|
-
* The **Cancel** button reverts the current selection to its
|
|
230
|
-
* previous state, i.e., to the current value.
|
|
231
|
-
*
|
|
232
|
-
* @default false
|
|
233
|
-
*/
|
|
234
|
-
preview = false;
|
|
235
|
-
/**
|
|
236
|
-
* Configures the layout of the **Apply** and **Cancel** action buttons.
|
|
237
|
-
*
|
|
238
|
-
* @default 'end'
|
|
239
|
-
*/
|
|
240
|
-
actionsLayout = 'end';
|
|
241
|
-
/**
|
|
242
|
-
* The size property specifies the padding of the ColorPicker internal elements
|
|
243
|
-
* ([see example]({% slug appearance_colorpicker %}#toc-size)).
|
|
244
|
-
*
|
|
245
|
-
* @default 'medium'
|
|
246
|
-
*/
|
|
247
|
-
set size(size) {
|
|
248
|
-
const newSize = size || DEFAULT_SIZE;
|
|
249
|
-
this.handleClasses(newSize, 'size');
|
|
250
|
-
this._size = newSize;
|
|
251
|
-
}
|
|
252
|
-
get size() {
|
|
253
|
-
return this._size;
|
|
254
|
-
}
|
|
255
|
-
/**
|
|
256
|
-
* The rounded property specifies the border radius of the ColorPicker
|
|
257
|
-
* ([see example](slug:appearance_colorpicker#toc-roundness)).
|
|
258
|
-
*
|
|
259
|
-
* @default 'medium'
|
|
260
|
-
*/
|
|
261
|
-
set rounded(rounded) {
|
|
262
|
-
const newRounded = rounded || DEFAULT_ROUNDED;
|
|
263
|
-
this.handleClasses(newRounded, 'rounded');
|
|
264
|
-
this._rounded = newRounded;
|
|
265
|
-
}
|
|
266
|
-
get rounded() {
|
|
267
|
-
return this._rounded;
|
|
268
|
-
}
|
|
269
|
-
/**
|
|
270
|
-
* The fillMode property specifies the background and border styles of the ColorPicker
|
|
271
|
-
* ([see example]({% slug appearance_colorpicker %}#toc-fill-mode)).
|
|
272
|
-
*
|
|
273
|
-
* @default 'solid'
|
|
274
|
-
*/
|
|
275
|
-
set fillMode(fillMode) {
|
|
276
|
-
const newFillMode = fillMode || DEFAULT_FILL_MODE;
|
|
277
|
-
this.handleClasses(newFillMode, 'fillMode');
|
|
278
|
-
this._fillMode = newFillMode;
|
|
279
|
-
}
|
|
280
|
-
get fillMode() {
|
|
281
|
-
return this._fillMode;
|
|
282
|
-
}
|
|
283
|
-
/**
|
|
284
|
-
* Fires when the value changes.
|
|
285
|
-
*/
|
|
286
|
-
valueChange = new EventEmitter();
|
|
287
|
-
/**
|
|
288
|
-
* Fires when the Popup (or ActionSheet in adaptive mode) is about to open.
|
|
289
|
-
* This event is preventable. If you cancel it, the Popup (or the ActionSheet) remains closed.
|
|
290
|
-
*/
|
|
291
|
-
open = new EventEmitter();
|
|
292
|
-
/**
|
|
293
|
-
* Fires when the Popup (or ActionSheet in adaptive mode) is about to close.
|
|
294
|
-
* This event is preventable. If you cancel it, the Popup (or the ActionSheet) remains open.
|
|
295
|
-
*/
|
|
296
|
-
close = new EventEmitter();
|
|
297
|
-
/**
|
|
298
|
-
* Fires when the ColorPicker is focused.
|
|
299
|
-
*/
|
|
300
|
-
onFocus = new EventEmitter();
|
|
301
|
-
/**
|
|
302
|
-
* Fires when the ColorPicker is blurred.
|
|
303
|
-
*/
|
|
304
|
-
onBlur = new EventEmitter();
|
|
305
|
-
/**
|
|
306
|
-
* Fires when the user cancels the current color selection.
|
|
307
|
-
*
|
|
308
|
-
* Fires on preview pane or 'Cancel' button click.
|
|
309
|
-
*/
|
|
310
|
-
cancel = new EventEmitter();
|
|
311
|
-
/**
|
|
312
|
-
* Fires when the left side of the ColorPicker wrapper is clicked.
|
|
313
|
-
* The event is triggered regardless of whether a ColorPicker icon is set or not.
|
|
314
|
-
*
|
|
315
|
-
* The [`ActiveColorClickEvent`]({% slug api_inputs_activecolorclickevent %}) event provides the option to prevent the popup opening.
|
|
316
|
-
*/
|
|
317
|
-
activeColorClick = new EventEmitter();
|
|
318
|
-
/**
|
|
319
|
-
* @hidden
|
|
320
|
-
* Fires when the clear button is clicked.
|
|
321
|
-
*/
|
|
322
|
-
clearButtonClick = new EventEmitter();
|
|
323
|
-
/**
|
|
324
|
-
* Fires when the view is about to change.
|
|
325
|
-
* Used to provide a two-way binding for the `activeView` property.
|
|
326
|
-
*/
|
|
327
|
-
activeViewChange = new EventEmitter();
|
|
328
|
-
/**
|
|
329
|
-
* Indicates whether the ColorPicker wrapper is focused.
|
|
330
|
-
*/
|
|
331
|
-
isFocused = false;
|
|
332
|
-
/**
|
|
333
|
-
* @hidden
|
|
334
|
-
*/
|
|
335
|
-
windowSize = 'large';
|
|
336
|
-
/**
|
|
337
|
-
* Returns the current open state. Returns `true` if the Popup (or ActionSheet in adaptive mode) is currently open.
|
|
338
|
-
*/
|
|
339
|
-
get isOpen() {
|
|
340
|
-
return isPresent(this.popupRef) || this.isActionSheetExpanded;
|
|
341
|
-
}
|
|
342
|
-
/**
|
|
343
|
-
* @hidden
|
|
344
|
-
*/
|
|
345
|
-
get customIconStyles() {
|
|
346
|
-
if (this.iconClass) {
|
|
347
|
-
let parsedIconClass = '';
|
|
348
|
-
parseCSSClassNames(this.iconClass).forEach(iconClass => {
|
|
349
|
-
parsedIconClass += iconClass + ' ';
|
|
350
|
-
});
|
|
351
|
-
return parsedIconClass.slice(0, -1);
|
|
352
|
-
}
|
|
353
|
-
return '';
|
|
354
|
-
}
|
|
355
|
-
/**
|
|
356
|
-
* @hidden
|
|
357
|
-
*/
|
|
358
|
-
get isAdaptiveModeEnabled() {
|
|
359
|
-
return this.adaptiveMode === 'auto';
|
|
360
|
-
}
|
|
361
|
-
/**
|
|
362
|
-
* @hidden
|
|
363
|
-
*/
|
|
364
|
-
get isAdaptive() {
|
|
365
|
-
return this.isAdaptiveModeEnabled && this.windowSize !== 'large';
|
|
366
|
-
}
|
|
367
|
-
/**
|
|
368
|
-
* @hidden
|
|
369
|
-
*/
|
|
370
|
-
get actionSheet() {
|
|
371
|
-
return this.adaptiveRenderer?.actionSheet;
|
|
372
|
-
}
|
|
373
|
-
/**
|
|
374
|
-
* @hidden
|
|
375
|
-
*/
|
|
376
|
-
get isActionSheetExpanded() {
|
|
377
|
-
return Boolean(this.actionSheet?.expanded);
|
|
378
|
-
}
|
|
379
|
-
/**
|
|
380
|
-
* @hidden
|
|
381
|
-
*/
|
|
382
|
-
get iconStyles() {
|
|
383
|
-
if (this.icon && !this.iconClass) {
|
|
384
|
-
return `${this.icon}`;
|
|
385
|
-
}
|
|
386
|
-
return '';
|
|
387
|
-
}
|
|
388
|
-
/**
|
|
389
|
-
* Provides a reference to a container element inside the component markup.
|
|
390
|
-
* The container element references the location of the appended popup—
|
|
391
|
-
* for example, inside the component markup.
|
|
392
|
-
*/
|
|
393
|
-
container;
|
|
394
|
-
activeColor;
|
|
395
|
-
popupTemplate;
|
|
396
|
-
flatColorPicker;
|
|
397
|
-
/**
|
|
398
|
-
* @hidden
|
|
399
|
-
*/
|
|
400
|
-
adaptiveRenderer;
|
|
401
|
-
/**
|
|
402
|
-
* @hidden
|
|
403
|
-
*/
|
|
404
|
-
arrowDownIcon = caretAltDownIcon;
|
|
405
|
-
popupRef;
|
|
406
|
-
_svgIcon;
|
|
407
|
-
_value;
|
|
408
|
-
_tabindex = 0;
|
|
409
|
-
_popupSettings = { animate: true };
|
|
410
|
-
_paletteSettings = {};
|
|
411
|
-
_gradientSettings = { opacity: true, delay: 0 };
|
|
412
|
-
_size = 'medium';
|
|
413
|
-
_rounded = 'medium';
|
|
414
|
-
_fillMode = 'solid';
|
|
415
|
-
dynamicRTLSubscription;
|
|
416
|
-
subscriptions = new Subscription();
|
|
417
|
-
popupSubs = new Subscription();
|
|
418
|
-
colorPickerId;
|
|
419
|
-
control;
|
|
420
|
-
constructor(host, popupService, cdr, localizationService, ngZone, renderer, injector, adaptiveService) {
|
|
421
|
-
this.host = host;
|
|
422
|
-
this.popupService = popupService;
|
|
423
|
-
this.cdr = cdr;
|
|
424
|
-
this.localizationService = localizationService;
|
|
425
|
-
this.ngZone = ngZone;
|
|
426
|
-
this.renderer = renderer;
|
|
427
|
-
this.injector = injector;
|
|
428
|
-
this.adaptiveService = adaptiveService;
|
|
429
|
-
validatePackage(packageMetadata);
|
|
430
|
-
this.dynamicRTLSubscription = this.localizationService.changes.subscribe(({ rtl }) => {
|
|
431
|
-
this.direction = rtl ? 'rtl' : 'ltr';
|
|
432
|
-
});
|
|
433
|
-
this.colorPickerId = nextColorPickerId++;
|
|
434
|
-
}
|
|
435
|
-
ngOnInit() {
|
|
436
|
-
const defaultPreset = (this.format !== 'name') ? DEFAULT_PRESET : DEFAULT_ACCESSIBLE_PRESET;
|
|
437
|
-
const settingsPalette = this._paletteSettings.palette;
|
|
438
|
-
const presetColumns = typeof settingsPalette === 'string' && PALETTEPRESETS[settingsPalette] ?
|
|
439
|
-
PALETTEPRESETS[settingsPalette].columns :
|
|
440
|
-
undefined;
|
|
441
|
-
this._paletteSettings = {
|
|
442
|
-
palette: settingsPalette || defaultPreset,
|
|
443
|
-
tileSize: this._paletteSettings.tileSize,
|
|
444
|
-
columns: this._paletteSettings.columns || presetColumns || 10
|
|
445
|
-
};
|
|
446
|
-
this.handleHostId();
|
|
447
|
-
this.renderer.setAttribute(this.host.nativeElement, 'aria-controls', `k-colorpicker-popup-${this.colorPickerId}`);
|
|
448
|
-
this.control = this.injector.get(NgControl, null);
|
|
449
|
-
}
|
|
450
|
-
ngAfterViewInit() {
|
|
451
|
-
const stylingInputs = ['size', 'rounded', 'fillMode'];
|
|
452
|
-
stylingInputs.forEach(input => {
|
|
453
|
-
this.handleClasses(this[input], input);
|
|
454
|
-
});
|
|
455
|
-
this.setHostElementAriaLabel();
|
|
456
|
-
this.initDomEvents();
|
|
457
|
-
this.windowSize = this.adaptiveService.size;
|
|
458
|
-
if (this.actionSheet && isDocumentAvailable()) {
|
|
459
|
-
// The following syntax is used as it does not violate CSP compliance
|
|
460
|
-
this.actionSheet.element.nativeElement.style.setProperty('--kendo-actionsheet-height', '60vh');
|
|
461
|
-
this.actionSheet.element.nativeElement.style.setProperty('--kendo-actionsheet-max-height', 'none');
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
ngOnChanges(changes) {
|
|
465
|
-
if (changes.format && changes.format.currentValue === 'name') {
|
|
466
|
-
this.activeView = 'palette';
|
|
467
|
-
}
|
|
468
|
-
if (this.activeView === 'gradient' && this.gradientSettings.opacity) {
|
|
469
|
-
this.format = 'rgba';
|
|
470
|
-
this.value = parseColor(this.value, this.format, this.gradientSettings.opacity);
|
|
471
|
-
}
|
|
472
|
-
if (isChanged('value', changes)) {
|
|
473
|
-
this.setHostElementAriaLabel();
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
ngOnDestroy() {
|
|
477
|
-
this.closePopup();
|
|
478
|
-
if (this.dynamicRTLSubscription) {
|
|
479
|
-
this.dynamicRTLSubscription.unsubscribe();
|
|
480
|
-
}
|
|
481
|
-
this.subscriptions.unsubscribe();
|
|
482
|
-
this.handleDomEvents('remove', DOM_FOCUS_EVENTS);
|
|
483
|
-
}
|
|
484
|
-
/**
|
|
485
|
-
* @hidden
|
|
486
|
-
*/
|
|
487
|
-
onResize() {
|
|
488
|
-
const currentWindowSize = this.adaptiveService.size;
|
|
489
|
-
if (this.isAdaptiveModeEnabled && this.windowSize !== currentWindowSize) {
|
|
490
|
-
if (this.isOpen) {
|
|
491
|
-
this.toggleWithEvents(false);
|
|
492
|
-
}
|
|
493
|
-
this.windowSize = currentWindowSize;
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
/**
|
|
497
|
-
* @hidden
|
|
498
|
-
*/
|
|
499
|
-
handleCancelEvent(ev) {
|
|
500
|
-
this.cancel.emit(ev);
|
|
501
|
-
}
|
|
502
|
-
/**
|
|
503
|
-
* @hidden
|
|
504
|
-
*/
|
|
505
|
-
togglePopup() {
|
|
506
|
-
if (!this.isActionSheetExpanded) {
|
|
507
|
-
this.focus();
|
|
508
|
-
this.toggleWithEvents(!this.isOpen);
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
/**
|
|
512
|
-
* @hidden
|
|
513
|
-
*/
|
|
514
|
-
handleWrapperClick(event) {
|
|
515
|
-
if (this.disabled) {
|
|
516
|
-
return;
|
|
517
|
-
}
|
|
518
|
-
this.focus();
|
|
519
|
-
if (closest(event.target, (element) => element === this.activeColor.nativeElement)) {
|
|
520
|
-
const event = new ActiveColorClickEvent(this.value);
|
|
521
|
-
this.activeColorClick.emit(event);
|
|
522
|
-
if (!event.isOpenPrevented() || this.isOpen) {
|
|
523
|
-
this.toggleWithEvents(!this.isOpen);
|
|
524
|
-
}
|
|
525
|
-
return;
|
|
526
|
-
}
|
|
527
|
-
if (!this.isActionSheetExpanded) {
|
|
528
|
-
this.toggleWithEvents(!this.isOpen);
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
/**
|
|
532
|
-
* Focuses the wrapper of the ColorPicker.
|
|
533
|
-
*/
|
|
534
|
-
focus() {
|
|
535
|
-
this.isFocused = true;
|
|
536
|
-
this.host.nativeElement.focus();
|
|
537
|
-
}
|
|
538
|
-
/**
|
|
539
|
-
* @hidden
|
|
540
|
-
*/
|
|
541
|
-
handleWrapperFocus() {
|
|
542
|
-
if (this.isFocused) {
|
|
543
|
-
return;
|
|
544
|
-
}
|
|
545
|
-
this.ngZone.run(() => {
|
|
546
|
-
this.focus();
|
|
547
|
-
this.onFocus.emit();
|
|
548
|
-
});
|
|
549
|
-
}
|
|
550
|
-
/**
|
|
551
|
-
* Blurs the ColorPicker.
|
|
552
|
-
*/
|
|
553
|
-
blur() {
|
|
554
|
-
this.isFocused = false;
|
|
555
|
-
this.host.nativeElement.blur();
|
|
556
|
-
this.notifyNgTouched();
|
|
557
|
-
}
|
|
558
|
-
/**
|
|
559
|
-
* @hidden
|
|
560
|
-
*/
|
|
561
|
-
handleWrapperBlur() {
|
|
562
|
-
if (!this.isActionSheetExpanded) {
|
|
563
|
-
if (this.isOpen) {
|
|
564
|
-
return;
|
|
565
|
-
}
|
|
566
|
-
this.ngZone.run(() => {
|
|
567
|
-
this.onBlur.emit();
|
|
568
|
-
this.isFocused = false;
|
|
569
|
-
});
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
/**
|
|
573
|
-
* Clears the value of the ColorPicker.
|
|
574
|
-
*/
|
|
575
|
-
reset() {
|
|
576
|
-
if (!isPresent(this.value)) {
|
|
577
|
-
return;
|
|
578
|
-
}
|
|
579
|
-
this._value = undefined;
|
|
580
|
-
this.setHostElementAriaLabel();
|
|
581
|
-
this.notifyNgChanged(undefined);
|
|
582
|
-
}
|
|
583
|
-
/**
|
|
584
|
-
* Toggles the Popup (or ActionSheet in adaptive mode) of the ColorPicker.
|
|
585
|
-
* Does not trigger the `open` and `close` events of the component.
|
|
586
|
-
*
|
|
587
|
-
* @param open An optional parameter. Specifies whether the popup will be opened or closed.
|
|
588
|
-
*/
|
|
589
|
-
toggle(open) {
|
|
590
|
-
this.windowSize = this.adaptiveService.size;
|
|
591
|
-
if (this.disabled || this.readonly) {
|
|
592
|
-
return;
|
|
593
|
-
}
|
|
594
|
-
this.cdr.markForCheck();
|
|
595
|
-
if (this.isActionSheetExpanded) {
|
|
596
|
-
this.closeActionSheet();
|
|
597
|
-
}
|
|
598
|
-
else {
|
|
599
|
-
this.closePopup();
|
|
600
|
-
}
|
|
601
|
-
open = isPresent(open) ? open : !this.isOpen;
|
|
602
|
-
if (open) {
|
|
603
|
-
if (this.isAdaptive && !this.isActionSheetExpanded) {
|
|
604
|
-
this.openActionSheet();
|
|
605
|
-
}
|
|
606
|
-
else {
|
|
607
|
-
this.openPopup();
|
|
608
|
-
}
|
|
609
|
-
this.focusFirstElement();
|
|
610
|
-
}
|
|
611
|
-
}
|
|
612
|
-
/**
|
|
613
|
-
* @hidden
|
|
614
|
-
*/
|
|
615
|
-
handleValueChange(color) {
|
|
616
|
-
const parsedColor = parseColor(color, this.format, this.gradientSettings.opacity);
|
|
617
|
-
const valueChange = parsedColor !== this.value;
|
|
618
|
-
if (valueChange) {
|
|
619
|
-
this.value = parsedColor;
|
|
620
|
-
this.valueChange.emit(parsedColor);
|
|
621
|
-
this.setHostElementAriaLabel();
|
|
622
|
-
this.notifyNgChanged(parsedColor);
|
|
623
|
-
}
|
|
624
|
-
}
|
|
625
|
-
/**
|
|
626
|
-
* @hidden
|
|
627
|
-
*/
|
|
628
|
-
handlePopupBlur(event) {
|
|
629
|
-
if (!this.isActionSheetExpanded) {
|
|
630
|
-
if (this.popupBlurInvalid(event)) {
|
|
631
|
-
return;
|
|
632
|
-
}
|
|
633
|
-
this.isFocused = false;
|
|
634
|
-
this.onBlur.emit();
|
|
635
|
-
this.notifyNgTouched();
|
|
636
|
-
this.toggleWithEvents(false);
|
|
637
|
-
}
|
|
638
|
-
}
|
|
639
|
-
/**
|
|
640
|
-
* @hidden
|
|
641
|
-
*/
|
|
642
|
-
writeValue(value) {
|
|
643
|
-
this.value = value;
|
|
644
|
-
this.cdr.markForCheck();
|
|
645
|
-
}
|
|
646
|
-
/**
|
|
647
|
-
* @hidden
|
|
648
|
-
*/
|
|
649
|
-
registerOnChange(fn) {
|
|
650
|
-
this.notifyNgChanged = fn;
|
|
651
|
-
}
|
|
652
|
-
/**
|
|
653
|
-
* @hidden
|
|
654
|
-
*/
|
|
655
|
-
registerOnTouched(fn) {
|
|
656
|
-
this.notifyNgTouched = fn;
|
|
657
|
-
}
|
|
658
|
-
/**
|
|
659
|
-
* @hidden
|
|
660
|
-
*/
|
|
661
|
-
setDisabledState(isDisabled) {
|
|
662
|
-
this.cdr.markForCheck();
|
|
663
|
-
this.disabled = isDisabled;
|
|
664
|
-
}
|
|
665
|
-
/**
|
|
666
|
-
* @hidden
|
|
667
|
-
*/
|
|
668
|
-
handleWrapperKeyDown(event) {
|
|
669
|
-
const code = normalizeKeys(event);
|
|
670
|
-
if (code === Keys.ArrowDown || code === Keys.Enter) {
|
|
671
|
-
event.preventDefault();
|
|
672
|
-
this.ngZone.run(() => {
|
|
673
|
-
this.toggleWithEvents(true);
|
|
674
|
-
});
|
|
675
|
-
}
|
|
676
|
-
}
|
|
677
|
-
/**
|
|
678
|
-
* @hidden
|
|
679
|
-
*/
|
|
680
|
-
applyValue() {
|
|
681
|
-
this.handleValueChange(this.flatColorPicker.selection);
|
|
682
|
-
this.toggleWithEvents(false);
|
|
683
|
-
}
|
|
684
|
-
/**
|
|
685
|
-
* @hidden
|
|
686
|
-
*/
|
|
687
|
-
cancelValue(e) {
|
|
688
|
-
this.flatColorPicker.resetSelection(e);
|
|
689
|
-
this.toggleWithEvents(false);
|
|
690
|
-
}
|
|
691
|
-
/**
|
|
692
|
-
* @hidden
|
|
693
|
-
*/
|
|
694
|
-
onActionSheetClose(e) {
|
|
695
|
-
if (this.preview) {
|
|
696
|
-
this.cancelValue(e);
|
|
697
|
-
}
|
|
698
|
-
else {
|
|
699
|
-
this.applyValue();
|
|
700
|
-
}
|
|
701
|
-
}
|
|
702
|
-
/**
|
|
703
|
-
* @hidden
|
|
704
|
-
*/
|
|
705
|
-
handlePopupKeyDown(event) {
|
|
706
|
-
if (event.code === Keys.Escape) {
|
|
707
|
-
this.toggleWithEvents(false);
|
|
708
|
-
this.host.nativeElement.focus();
|
|
709
|
-
}
|
|
710
|
-
if (event.code === Keys.Tab) {
|
|
711
|
-
const currentElement = event.shiftKey ? this.firstFocusableElement.nativeElement : this.lastFocusableElement.nativeElement;
|
|
712
|
-
const nextElement = event.shiftKey ? this.lastFocusableElement.nativeElement : this.firstFocusableElement.nativeElement;
|
|
713
|
-
if (event.target === currentElement) {
|
|
714
|
-
event.preventDefault();
|
|
715
|
-
nextElement.focus();
|
|
716
|
-
}
|
|
717
|
-
}
|
|
718
|
-
}
|
|
719
|
-
/**
|
|
720
|
-
* @hidden
|
|
721
|
-
*/
|
|
722
|
-
messageFor(key) {
|
|
723
|
-
return this.localizationService.get(key);
|
|
724
|
-
}
|
|
725
|
-
/**
|
|
726
|
-
* @hidden
|
|
727
|
-
* Used by the FloatingLabel to determine if the component is empty.
|
|
728
|
-
*/
|
|
729
|
-
isEmpty() {
|
|
730
|
-
return false;
|
|
731
|
-
}
|
|
732
|
-
setHostElementAriaLabel() {
|
|
733
|
-
const ariaLabelValue = `${this.value ? this.value : this.localizationService.get('colorPickerNoColor')}`;
|
|
734
|
-
this.renderer.setAttribute(this.host.nativeElement, 'aria-label', ariaLabelValue);
|
|
735
|
-
}
|
|
736
|
-
handleClasses(value, input) {
|
|
737
|
-
const elem = this.host.nativeElement;
|
|
738
|
-
const classes = getStylingClasses('picker', input, this[input], value);
|
|
739
|
-
if (classes.toRemove) {
|
|
740
|
-
this.renderer.removeClass(elem, classes.toRemove);
|
|
741
|
-
}
|
|
742
|
-
if (classes.toAdd) {
|
|
743
|
-
this.renderer.addClass(elem, classes.toAdd);
|
|
744
|
-
}
|
|
745
|
-
}
|
|
746
|
-
popupBlurInvalid(ev) {
|
|
747
|
-
const focusInFlatColorPickerElement = this.popupRef?.popupElement?.contains(ev.relatedTarget);
|
|
748
|
-
const hostClicked = closest(ev.relatedTarget, (element) => element === this.host.nativeElement);
|
|
749
|
-
return Boolean(hostClicked || focusInFlatColorPickerElement);
|
|
750
|
-
}
|
|
751
|
-
toggleWithEvents(open) {
|
|
752
|
-
const sameState = this.isOpen === open;
|
|
753
|
-
if (this.disabled || this.readonly || sameState) {
|
|
754
|
-
return;
|
|
755
|
-
}
|
|
756
|
-
let eventArgs;
|
|
757
|
-
if (open) {
|
|
758
|
-
eventArgs = new ColorPickerOpenEvent();
|
|
759
|
-
this.open.emit(eventArgs);
|
|
760
|
-
}
|
|
761
|
-
else {
|
|
762
|
-
eventArgs = new ColorPickerCloseEvent();
|
|
763
|
-
this.close.emit(eventArgs);
|
|
764
|
-
}
|
|
765
|
-
if (!eventArgs.isDefaultPrevented()) {
|
|
766
|
-
this.toggle(open);
|
|
767
|
-
}
|
|
768
|
-
if (open) {
|
|
769
|
-
this.focusFirstElement();
|
|
770
|
-
}
|
|
771
|
-
}
|
|
772
|
-
focusFirstElement() {
|
|
773
|
-
this.ngZone.onStable.pipe(take(1)).subscribe(() => {
|
|
774
|
-
if (this.flatColorPicker) {
|
|
775
|
-
const gradientDragHandle = this.flatColorPicker.gradient?.gradientDragHandle;
|
|
776
|
-
const palette = this.flatColorPicker.palette?.host;
|
|
777
|
-
const elementToFocus = gradientDragHandle ? gradientDragHandle : palette;
|
|
778
|
-
elementToFocus.nativeElement.focus();
|
|
779
|
-
}
|
|
780
|
-
});
|
|
781
|
-
}
|
|
782
|
-
openActionSheet() {
|
|
783
|
-
this.actionSheet.toggle(true);
|
|
784
|
-
}
|
|
785
|
-
closeActionSheet() {
|
|
786
|
-
this.actionSheet.toggle(false);
|
|
787
|
-
this.focus();
|
|
788
|
-
}
|
|
789
|
-
openPopup() {
|
|
790
|
-
const horizontalAlign = this.direction === "rtl" ? "right" : "left";
|
|
791
|
-
const anchorPosition = { horizontal: horizontalAlign, vertical: "bottom" };
|
|
792
|
-
const popupPosition = { horizontal: horizontalAlign, vertical: "top" };
|
|
793
|
-
this.popupRef = this.popupService.open({
|
|
794
|
-
anchor: this.activeColor,
|
|
795
|
-
animate: this.popupSettings.animate,
|
|
796
|
-
appendTo: this.popupSettings.appendTo,
|
|
797
|
-
popupAlign: popupPosition,
|
|
798
|
-
anchorAlign: anchorPosition,
|
|
799
|
-
popupClass: 'k-colorpicker-popup',
|
|
800
|
-
content: this.popupTemplate,
|
|
801
|
-
positionMode: 'absolute'
|
|
802
|
-
});
|
|
803
|
-
this.renderer.setAttribute(this.popupRef.popupElement.querySelector('.k-colorpicker-popup'), 'id', `k-colorpicker-popup-${this.colorPickerId}`);
|
|
804
|
-
this.popupSubs.add(this.popupRef.popupAnchorViewportLeave.subscribe(() => {
|
|
805
|
-
this.toggleWithEvents(false);
|
|
806
|
-
if (!this.isOpen) {
|
|
807
|
-
this.host.nativeElement.focus({
|
|
808
|
-
preventScroll: true
|
|
809
|
-
});
|
|
810
|
-
}
|
|
811
|
-
}));
|
|
812
|
-
}
|
|
813
|
-
closePopup() {
|
|
814
|
-
if (!this.isOpen) {
|
|
815
|
-
return;
|
|
816
|
-
}
|
|
817
|
-
this.popupSubs.unsubscribe();
|
|
818
|
-
this.popupRef.close();
|
|
819
|
-
this.popupRef = null;
|
|
820
|
-
}
|
|
821
|
-
get firstFocusableElement() {
|
|
822
|
-
if (!this.flatColorPicker.header || (this.views.length <= 1 && !this.flatColorPicker.clearButton)) {
|
|
823
|
-
const gradient = this.flatColorPicker.gradient;
|
|
824
|
-
return gradient ? gradient.gradientDragHandle : this.flatColorPicker.palette.host;
|
|
825
|
-
}
|
|
826
|
-
return this.views.length > 1 ? this.flatColorPicker.header.viewButtonsCollection.toArray()[0] : this.flatColorPicker.header.clearButtonElement;
|
|
827
|
-
}
|
|
828
|
-
get lastFocusableElement() {
|
|
829
|
-
if (this.preview) {
|
|
830
|
-
return this.flatColorPicker.footer?.lastButton || this.adaptiveRenderer.applyButton.nativeElement;
|
|
831
|
-
}
|
|
832
|
-
if (this.flatColorPicker.palette) {
|
|
833
|
-
return this.flatColorPicker.palette.host;
|
|
834
|
-
}
|
|
835
|
-
const gradient = this.flatColorPicker.gradient;
|
|
836
|
-
const inputs = gradient && gradient.inputs;
|
|
837
|
-
if (gradient && inputs && inputs.formatView === 'hex') {
|
|
838
|
-
return inputs.hexInput;
|
|
839
|
-
}
|
|
840
|
-
return this.gradientSettings.opacity ? inputs.opacityInput.numericInput : inputs.blueInput.numericInput;
|
|
841
|
-
}
|
|
842
|
-
notifyNgTouched = () => { };
|
|
843
|
-
notifyNgChanged = () => { };
|
|
844
|
-
handleDomEvents(action, events) {
|
|
845
|
-
const hostElement = this.host.nativeElement;
|
|
846
|
-
events.forEach(ev => hostElement[`${action}EventListener`](ev, this.domFocusListener, true));
|
|
847
|
-
}
|
|
848
|
-
initDomEvents() {
|
|
849
|
-
if (!this.host) {
|
|
850
|
-
return;
|
|
851
|
-
}
|
|
852
|
-
const hostElement = this.host.nativeElement;
|
|
853
|
-
this.ngZone.runOutsideAngular(() => {
|
|
854
|
-
this.subscriptions.add(this.renderer.listen(hostElement, 'focusin', () => {
|
|
855
|
-
this.handleWrapperFocus();
|
|
856
|
-
}));
|
|
857
|
-
this.subscriptions.add(this.renderer.listen(hostElement, 'focusout', (event) => {
|
|
858
|
-
const closestPopup = this.popupRef ?
|
|
859
|
-
closest(event.relatedTarget, (element) => element === this.flatColorPicker.host.nativeElement) :
|
|
860
|
-
false;
|
|
861
|
-
const closestWrapper = closest(event.relatedTarget, (element) => element === this.host.nativeElement);
|
|
862
|
-
const closestActionSheet = this.isActionSheetExpanded ? closest(event.relatedTarget, (element) => element === this.actionSheet.element.nativeElement) :
|
|
863
|
-
false;
|
|
864
|
-
if (!closestPopup && !closestWrapper && !closestActionSheet) {
|
|
865
|
-
this.handleWrapperBlur();
|
|
866
|
-
}
|
|
867
|
-
}));
|
|
868
|
-
this.handleDomEvents('add', DOM_FOCUS_EVENTS);
|
|
869
|
-
this.subscriptions.add(this.renderer.listen(hostElement, 'keydown', (event) => {
|
|
870
|
-
this.handleWrapperKeyDown(event);
|
|
871
|
-
}));
|
|
872
|
-
this.subscriptions.add(this.renderer.listen(hostElement, 'click', (event) => {
|
|
873
|
-
this.ngZone.run(() => {
|
|
874
|
-
if (!this.isActionSheetExpanded) {
|
|
875
|
-
this.handleWrapperClick(event);
|
|
876
|
-
}
|
|
877
|
-
});
|
|
878
|
-
}));
|
|
879
|
-
});
|
|
880
|
-
}
|
|
881
|
-
domFocusListener = (event) => event.stopImmediatePropagation();
|
|
882
|
-
handleHostId() {
|
|
883
|
-
const hostElement = this.host.nativeElement;
|
|
884
|
-
const existingId = hostElement.getAttribute('id');
|
|
885
|
-
if (existingId) {
|
|
886
|
-
this.focusableId = existingId;
|
|
887
|
-
}
|
|
888
|
-
else {
|
|
889
|
-
const id = `k-${guid()}`;
|
|
890
|
-
hostElement.setAttribute('id', id);
|
|
891
|
-
this.focusableId = id;
|
|
892
|
-
}
|
|
893
|
-
}
|
|
894
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ColorPickerComponent, deps: [{ token: i0.ElementRef }, { token: i1.PopupService }, { token: i0.ChangeDetectorRef }, { token: i2.LocalizationService }, { token: i0.NgZone }, { token: i0.Renderer2 }, { token: i0.Injector }, { token: i3.AdaptiveService }], target: i0.ɵɵFactoryTarget.Component });
|
|
895
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: ColorPickerComponent, isStandalone: true, selector: "kendo-colorpicker", inputs: { views: "views", view: "view", adaptiveMode: "adaptiveMode", activeView: "activeView", readonly: "readonly", disabled: "disabled", format: "format", value: "value", popupSettings: "popupSettings", paletteSettings: "paletteSettings", gradientSettings: "gradientSettings", icon: "icon", iconClass: "iconClass", svgIcon: "svgIcon", adaptiveTitle: "adaptiveTitle", adaptiveSubtitle: "adaptiveSubtitle", clearButton: "clearButton", tabindex: "tabindex", preview: "preview", actionsLayout: "actionsLayout", size: "size", rounded: "rounded", fillMode: "fillMode" }, outputs: { valueChange: "valueChange", open: "open", close: "close", onFocus: "focus", onBlur: "blur", cancel: "cancel", activeColorClick: "activeColorClick", clearButtonClick: "clearButtonClick", activeViewChange: "activeViewChange" }, host: { properties: { "class.k-colorpicker": "this.hostClasses", "class.k-icon-picker": "this.hostClasses", "class.k-picker": "this.hostClasses", "class.k-focus": "this.focusedClass", "attr.aria-disabled": "this.disabledClass", "class.k-disabled": "this.disabledClass", "attr.aria-readonly": "this.ariaReadonly", "attr.aria-expanded": "this.ariaExpanded", "attr.tabindex": "this.hostTabindex", "attr.dir": "this.direction", "attr.role": "this.role", "attr.aria-haspopup": "this.hasPopup", "attr.aria-invalid": "this.isControlInvalid", "class.k-readonly": "this.readonly" } }, providers: [{
|
|
896
|
-
multi: true,
|
|
897
|
-
provide: NG_VALUE_ACCESSOR,
|
|
898
|
-
useExisting: forwardRef(() => ColorPickerComponent)
|
|
899
|
-
}, {
|
|
900
|
-
provide: KendoInput,
|
|
901
|
-
useExisting: forwardRef(() => ColorPickerComponent)
|
|
902
|
-
},
|
|
903
|
-
ColorPickerLocalizationService,
|
|
904
|
-
{
|
|
905
|
-
provide: LocalizationService,
|
|
906
|
-
useExisting: ColorPickerLocalizationService
|
|
907
|
-
},
|
|
908
|
-
{
|
|
909
|
-
provide: L10N_PREFIX,
|
|
910
|
-
useValue: 'kendo.colorpicker'
|
|
911
|
-
}
|
|
912
|
-
], viewQueries: [{ propertyName: "container", first: true, predicate: ["container"], descendants: true, read: ViewContainerRef, static: true }, { propertyName: "activeColor", first: true, predicate: ["activeColor"], descendants: true, static: true }, { propertyName: "popupTemplate", first: true, predicate: ["popupTemplate"], descendants: true, static: true }, { propertyName: "flatColorPicker", first: true, predicate: ["flatColorPicker"], descendants: true }, { propertyName: "adaptiveRenderer", first: true, predicate: AdaptiveRendererComponent, descendants: true }], exportAs: ["kendoColorPicker"], usesOnChanges: true, ngImport: i0, template: `
|
|
913
|
-
<ng-container kendoColorPickerLocalizedMessages
|
|
914
|
-
i18n-colorPickerNoColor="kendo.colorpicker.colorPickerNoColor|The aria-label applied to the ColorPicker component when the value is empty."
|
|
915
|
-
colorPickerNoColor="Colorpicker no color chosen"
|
|
916
|
-
i18n-flatColorPickerNoColor="kendo.colorpicker.flatColorPickerNoColor|The aria-label applied to the FlatColorPicker component when the value is empty."
|
|
917
|
-
flatColorPickerNoColor="Flatcolorpicker no color chosen"
|
|
918
|
-
i18n-colorGradientNoColor="kendo.colorpicker.colorGradientNoColor|The aria-label applied to the ColorGradient component when the value is empty."
|
|
919
|
-
colorGradientNoColor="Colorgradient no color chosen"
|
|
920
|
-
i18n-colorPaletteNoColor="kendo.colorpicker.colorPaletteNoColor|The aria-label applied to the ColorPalette component when the value is empty."
|
|
921
|
-
colorPaletteNoColor="Colorpalette no color chosen"
|
|
922
|
-
i18n-colorGradientHandle="kendo.colorpicker.colorGradientHandle|The title for the gradient color drag handle chooser."
|
|
923
|
-
colorGradientHandle="Choose color"
|
|
924
|
-
i18n-clearButton="kendo.colorpicker.clearButton|The title for the clear button."
|
|
925
|
-
clearButton="Clear value"
|
|
926
|
-
i18n-hueSliderHandle="kendo.colorpicker.hueSliderHandle|The title for the hue slider handle."
|
|
927
|
-
hueSliderHandle="Set hue"
|
|
928
|
-
i18n-opacitySliderHandle="kendo.colorpicker.opacitySliderHandle|The title for the opacity slider handle."
|
|
929
|
-
opacitySliderHandle="Set opacity"
|
|
930
|
-
i18n-contrastRatio="kendo.colorpicker.contrastRatio|The contrast ratio message for the contrast tool."
|
|
931
|
-
contrastRatio="Contrast ratio"
|
|
932
|
-
i18n-previewColor="kendo.colorpicker.previewColor|The message for the color preview pane."
|
|
933
|
-
previewColor="Color preview"
|
|
934
|
-
i18n-revertSelection="kendo.colorpicker.revertSelection|The message for the selected color pane."
|
|
935
|
-
revertSelection="Revert selection"
|
|
936
|
-
i18n-gradientView="kendo.colorpicker.gradientView|The message for the gradient view button."
|
|
937
|
-
gradientView="Gradient view"
|
|
938
|
-
i18n-paletteView="kendo.colorpicker.paletteView|The message for the palette view button."
|
|
939
|
-
paletteView="Palette view"
|
|
940
|
-
i18n-formatButton="kendo.colorpicker.formatButton|The message for the input format toggle button."
|
|
941
|
-
formatButton="Change color format"
|
|
942
|
-
i18n-applyButton="kendo.colorpicker.applyButton|The message for the Apply action button."
|
|
943
|
-
applyButton="Apply"
|
|
944
|
-
i18n-cancelButton="kendo.colorpicker.cancelButton|The message for the Cancel action button."
|
|
945
|
-
cancelButton="Cancel"
|
|
946
|
-
i18n-adaptiveCloseButtonTitle="kendo.colorpicker.adaptiveCloseButtonTitle|The title of the Close button of the ActionSheet that is rendered instead of the Popup when using small screen devices in adaptive mode."
|
|
947
|
-
adaptiveCloseButtonTitle="Close"
|
|
948
|
-
i18n-adaptiveTitle="kendo.colorpicker.adaptiveTitle|The title for the ActionSheet when in adaptive mode."
|
|
949
|
-
adaptiveTitle="Choose Color"
|
|
950
|
-
i18n-redChannelLabel="kendo.colorpicker.redChannelLabel|The label of the NumericTextBox representing the red color channel."
|
|
951
|
-
redChannelLabel="Red channel"
|
|
952
|
-
i18n-greenChannelLabel="kendo.colorpicker.greenChannelLabel|The label of the NumericTextBox representing the green color channel."
|
|
953
|
-
greenChannelLabel="Green channel"
|
|
954
|
-
i18n-blueChannelLabel="kendo.colorpicker.blueChannelLabel|The label of the NumericTextBox representing the blue color channel."
|
|
955
|
-
blueChannelLabel="Blue channel"
|
|
956
|
-
i18n-alphaChannelLabel="kendo.colorpicker.alphaChannelLabel|The label of the NumericTextBox representing the alpha color channel."
|
|
957
|
-
alphaChannelLabel="Alpha channel"
|
|
958
|
-
i18n-redInputPlaceholder="kendo.colorpicker.redInputPlaceholder|The placeholder for the red color input."
|
|
959
|
-
redChannelLabel="R"
|
|
960
|
-
i18n-greenInputPlaceholder="kendo.colorpicker.greenInputPlaceholder|The placeholder for the green color input."
|
|
961
|
-
greenInputPlaceholder="G"
|
|
962
|
-
i18n-blueInputPlaceholder="kendo.colorpicker.blueInputPlaceholder|The placeholder for the blue color input."
|
|
963
|
-
blueInputPlaceholder="B"
|
|
964
|
-
i18n-hexInputPlaceholder="kendo.colorpicker.hexInputPlaceholder|The placeholder for the HEX color input."
|
|
965
|
-
hexInputPlaceholder="HEX"
|
|
966
|
-
i18n-toggleButtonLabel="kendo.colorpicker.toggleButtonLabel|The text set as aria-label on the toggle button."
|
|
967
|
-
toggleButtonLabel="Select color">
|
|
968
|
-
</ng-container>
|
|
969
|
-
<span #activeColor class="k-input-inner">
|
|
970
|
-
<span
|
|
971
|
-
class="k-value-icon k-color-preview"
|
|
972
|
-
[ngClass]="{'k-icon-color-preview': customIconStyles || iconStyles || svgIcon, 'k-no-color': !value}"
|
|
973
|
-
>
|
|
974
|
-
@if (iconClass || icon || svgIcon) {
|
|
975
|
-
<kendo-icon-wrapper
|
|
976
|
-
[name]="iconStyles"
|
|
977
|
-
innerCssClass="k-color-preview-icon"
|
|
978
|
-
[customFontClass]="customIconStyles"
|
|
979
|
-
[svgIcon]="svgIcon"
|
|
980
|
-
>
|
|
981
|
-
</kendo-icon-wrapper>
|
|
982
|
-
}
|
|
983
|
-
<span class="k-color-preview-mask" [style.background-color]="value"></span>
|
|
984
|
-
</span>
|
|
985
|
-
</span>
|
|
986
|
-
<button
|
|
987
|
-
kendoButton
|
|
988
|
-
tabindex="-1"
|
|
989
|
-
type="button"
|
|
990
|
-
icon="caret-alt-down"
|
|
991
|
-
[size]="size"
|
|
992
|
-
[svgIcon]="arrowDownIcon"
|
|
993
|
-
[fillMode]="fillMode"
|
|
994
|
-
[disabled]="disabled"
|
|
995
|
-
rounded="none"
|
|
996
|
-
class="k-input-button"
|
|
997
|
-
[attr.aria-label]="messageFor('toggleButtonLabel')"
|
|
998
|
-
>
|
|
999
|
-
</button>
|
|
1000
|
-
<ng-template #popupTemplate>
|
|
1001
|
-
<kendo-flatcolorpicker
|
|
1002
|
-
#flatColorPicker
|
|
1003
|
-
[value]="value"
|
|
1004
|
-
[format]="format"
|
|
1005
|
-
[size]="isAdaptive ? 'large' : size"
|
|
1006
|
-
[views]="views"
|
|
1007
|
-
[activeView]="activeView"
|
|
1008
|
-
[actionsLayout]="actionsLayout"
|
|
1009
|
-
[adaptiveMode]="isActionSheetExpanded"
|
|
1010
|
-
[preview]="preview"
|
|
1011
|
-
[gradientSettings]="gradientSettings"
|
|
1012
|
-
[paletteSettings]="paletteSettings"
|
|
1013
|
-
[clearButton]="clearButton"
|
|
1014
|
-
(cancel)="handleCancelEvent($event)"
|
|
1015
|
-
(focusout)="handlePopupBlur($event)"
|
|
1016
|
-
(valueChange)="handleValueChange($event)"
|
|
1017
|
-
(keydown)="handlePopupKeyDown($event)"
|
|
1018
|
-
(activeViewChange)="activeViewChange.emit($event)"
|
|
1019
|
-
(clearButtonClick)="clearButtonClick.emit()"
|
|
1020
|
-
(actionButtonClick)="togglePopup()">
|
|
1021
|
-
</kendo-flatcolorpicker>
|
|
1022
|
-
</ng-template>
|
|
1023
|
-
<ng-container #container></ng-container>
|
|
1024
|
-
<kendo-adaptive-renderer
|
|
1025
|
-
[actionSheetTemplate]="popupTemplate"
|
|
1026
|
-
[isActionSheetExpanded]="isActionSheetExpanded"
|
|
1027
|
-
[title]="adaptiveTitle"
|
|
1028
|
-
[subtitle]="adaptiveSubtitle"
|
|
1029
|
-
[preview]="preview"
|
|
1030
|
-
(actionSheetClose)="onActionSheetClose($event)"
|
|
1031
|
-
(onApply)="applyValue()"
|
|
1032
|
-
(onCancel)="cancelValue($event)"
|
|
1033
|
-
>
|
|
1034
|
-
</kendo-adaptive-renderer>
|
|
1035
|
-
@if (isOpen || isAdaptiveModeEnabled) {
|
|
1036
|
-
<kendo-resize-sensor (resize)="onResize()"></kendo-resize-sensor>
|
|
1037
|
-
}
|
|
1038
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: LocalizedColorPickerMessagesDirective, selector: "[kendoColorPickerLocalizedMessages], [kendoFlatColorPickerLocalizedMessages], [kendoColorGradientLocalizedMessages], [kendoColorPaletteLocalizedMessages]" }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: IconWrapperComponent, selector: "kendo-icon-wrapper", inputs: ["name", "svgIcon", "innerCssClass", "customFontClass", "size"], exportAs: ["kendoIconWrapper"] }, { 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: "component", type: FlatColorPickerComponent, selector: "kendo-flatcolorpicker", inputs: ["readonly", "disabled", "format", "value", "tabindex", "clearButton", "preview", "actionsLayout", "activeView", "views", "gradientSettings", "adaptiveMode", "paletteSettings", "size"], outputs: ["valueChange", "cancel", "activeViewChange", "clearButtonClick", "actionButtonClick"], exportAs: ["kendoFlatColorPicker"] }, { kind: "component", type: ResizeSensorComponent, selector: "kendo-resize-sensor", inputs: ["rateLimit"], outputs: ["resize"] }, { kind: "component", type: AdaptiveRendererComponent, selector: "kendo-adaptive-renderer", inputs: ["title", "subtitle", "actionSheetTemplate", "isActionSheetExpanded", "preview"], outputs: ["actionSheetClose", "onExpand", "onCollapse", "onApply", "onCancel"] }] });
|
|
1039
|
-
}
|
|
1040
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ColorPickerComponent, decorators: [{
|
|
1041
|
-
type: Component,
|
|
1042
|
-
args: [{
|
|
1043
|
-
exportAs: 'kendoColorPicker',
|
|
1044
|
-
selector: 'kendo-colorpicker',
|
|
1045
|
-
providers: [{
|
|
1046
|
-
multi: true,
|
|
1047
|
-
provide: NG_VALUE_ACCESSOR,
|
|
1048
|
-
useExisting: forwardRef(() => ColorPickerComponent)
|
|
1049
|
-
}, {
|
|
1050
|
-
provide: KendoInput,
|
|
1051
|
-
useExisting: forwardRef(() => ColorPickerComponent)
|
|
1052
|
-
},
|
|
1053
|
-
ColorPickerLocalizationService,
|
|
1054
|
-
{
|
|
1055
|
-
provide: LocalizationService,
|
|
1056
|
-
useExisting: ColorPickerLocalizationService
|
|
1057
|
-
},
|
|
1058
|
-
{
|
|
1059
|
-
provide: L10N_PREFIX,
|
|
1060
|
-
useValue: 'kendo.colorpicker'
|
|
1061
|
-
}],
|
|
1062
|
-
template: `
|
|
1063
|
-
<ng-container kendoColorPickerLocalizedMessages
|
|
1064
|
-
i18n-colorPickerNoColor="kendo.colorpicker.colorPickerNoColor|The aria-label applied to the ColorPicker component when the value is empty."
|
|
1065
|
-
colorPickerNoColor="Colorpicker no color chosen"
|
|
1066
|
-
i18n-flatColorPickerNoColor="kendo.colorpicker.flatColorPickerNoColor|The aria-label applied to the FlatColorPicker component when the value is empty."
|
|
1067
|
-
flatColorPickerNoColor="Flatcolorpicker no color chosen"
|
|
1068
|
-
i18n-colorGradientNoColor="kendo.colorpicker.colorGradientNoColor|The aria-label applied to the ColorGradient component when the value is empty."
|
|
1069
|
-
colorGradientNoColor="Colorgradient no color chosen"
|
|
1070
|
-
i18n-colorPaletteNoColor="kendo.colorpicker.colorPaletteNoColor|The aria-label applied to the ColorPalette component when the value is empty."
|
|
1071
|
-
colorPaletteNoColor="Colorpalette no color chosen"
|
|
1072
|
-
i18n-colorGradientHandle="kendo.colorpicker.colorGradientHandle|The title for the gradient color drag handle chooser."
|
|
1073
|
-
colorGradientHandle="Choose color"
|
|
1074
|
-
i18n-clearButton="kendo.colorpicker.clearButton|The title for the clear button."
|
|
1075
|
-
clearButton="Clear value"
|
|
1076
|
-
i18n-hueSliderHandle="kendo.colorpicker.hueSliderHandle|The title for the hue slider handle."
|
|
1077
|
-
hueSliderHandle="Set hue"
|
|
1078
|
-
i18n-opacitySliderHandle="kendo.colorpicker.opacitySliderHandle|The title for the opacity slider handle."
|
|
1079
|
-
opacitySliderHandle="Set opacity"
|
|
1080
|
-
i18n-contrastRatio="kendo.colorpicker.contrastRatio|The contrast ratio message for the contrast tool."
|
|
1081
|
-
contrastRatio="Contrast ratio"
|
|
1082
|
-
i18n-previewColor="kendo.colorpicker.previewColor|The message for the color preview pane."
|
|
1083
|
-
previewColor="Color preview"
|
|
1084
|
-
i18n-revertSelection="kendo.colorpicker.revertSelection|The message for the selected color pane."
|
|
1085
|
-
revertSelection="Revert selection"
|
|
1086
|
-
i18n-gradientView="kendo.colorpicker.gradientView|The message for the gradient view button."
|
|
1087
|
-
gradientView="Gradient view"
|
|
1088
|
-
i18n-paletteView="kendo.colorpicker.paletteView|The message for the palette view button."
|
|
1089
|
-
paletteView="Palette view"
|
|
1090
|
-
i18n-formatButton="kendo.colorpicker.formatButton|The message for the input format toggle button."
|
|
1091
|
-
formatButton="Change color format"
|
|
1092
|
-
i18n-applyButton="kendo.colorpicker.applyButton|The message for the Apply action button."
|
|
1093
|
-
applyButton="Apply"
|
|
1094
|
-
i18n-cancelButton="kendo.colorpicker.cancelButton|The message for the Cancel action button."
|
|
1095
|
-
cancelButton="Cancel"
|
|
1096
|
-
i18n-adaptiveCloseButtonTitle="kendo.colorpicker.adaptiveCloseButtonTitle|The title of the Close button of the ActionSheet that is rendered instead of the Popup when using small screen devices in adaptive mode."
|
|
1097
|
-
adaptiveCloseButtonTitle="Close"
|
|
1098
|
-
i18n-adaptiveTitle="kendo.colorpicker.adaptiveTitle|The title for the ActionSheet when in adaptive mode."
|
|
1099
|
-
adaptiveTitle="Choose Color"
|
|
1100
|
-
i18n-redChannelLabel="kendo.colorpicker.redChannelLabel|The label of the NumericTextBox representing the red color channel."
|
|
1101
|
-
redChannelLabel="Red channel"
|
|
1102
|
-
i18n-greenChannelLabel="kendo.colorpicker.greenChannelLabel|The label of the NumericTextBox representing the green color channel."
|
|
1103
|
-
greenChannelLabel="Green channel"
|
|
1104
|
-
i18n-blueChannelLabel="kendo.colorpicker.blueChannelLabel|The label of the NumericTextBox representing the blue color channel."
|
|
1105
|
-
blueChannelLabel="Blue channel"
|
|
1106
|
-
i18n-alphaChannelLabel="kendo.colorpicker.alphaChannelLabel|The label of the NumericTextBox representing the alpha color channel."
|
|
1107
|
-
alphaChannelLabel="Alpha channel"
|
|
1108
|
-
i18n-redInputPlaceholder="kendo.colorpicker.redInputPlaceholder|The placeholder for the red color input."
|
|
1109
|
-
redChannelLabel="R"
|
|
1110
|
-
i18n-greenInputPlaceholder="kendo.colorpicker.greenInputPlaceholder|The placeholder for the green color input."
|
|
1111
|
-
greenInputPlaceholder="G"
|
|
1112
|
-
i18n-blueInputPlaceholder="kendo.colorpicker.blueInputPlaceholder|The placeholder for the blue color input."
|
|
1113
|
-
blueInputPlaceholder="B"
|
|
1114
|
-
i18n-hexInputPlaceholder="kendo.colorpicker.hexInputPlaceholder|The placeholder for the HEX color input."
|
|
1115
|
-
hexInputPlaceholder="HEX"
|
|
1116
|
-
i18n-toggleButtonLabel="kendo.colorpicker.toggleButtonLabel|The text set as aria-label on the toggle button."
|
|
1117
|
-
toggleButtonLabel="Select color">
|
|
1118
|
-
</ng-container>
|
|
1119
|
-
<span #activeColor class="k-input-inner">
|
|
1120
|
-
<span
|
|
1121
|
-
class="k-value-icon k-color-preview"
|
|
1122
|
-
[ngClass]="{'k-icon-color-preview': customIconStyles || iconStyles || svgIcon, 'k-no-color': !value}"
|
|
1123
|
-
>
|
|
1124
|
-
@if (iconClass || icon || svgIcon) {
|
|
1125
|
-
<kendo-icon-wrapper
|
|
1126
|
-
[name]="iconStyles"
|
|
1127
|
-
innerCssClass="k-color-preview-icon"
|
|
1128
|
-
[customFontClass]="customIconStyles"
|
|
1129
|
-
[svgIcon]="svgIcon"
|
|
1130
|
-
>
|
|
1131
|
-
</kendo-icon-wrapper>
|
|
1132
|
-
}
|
|
1133
|
-
<span class="k-color-preview-mask" [style.background-color]="value"></span>
|
|
1134
|
-
</span>
|
|
1135
|
-
</span>
|
|
1136
|
-
<button
|
|
1137
|
-
kendoButton
|
|
1138
|
-
tabindex="-1"
|
|
1139
|
-
type="button"
|
|
1140
|
-
icon="caret-alt-down"
|
|
1141
|
-
[size]="size"
|
|
1142
|
-
[svgIcon]="arrowDownIcon"
|
|
1143
|
-
[fillMode]="fillMode"
|
|
1144
|
-
[disabled]="disabled"
|
|
1145
|
-
rounded="none"
|
|
1146
|
-
class="k-input-button"
|
|
1147
|
-
[attr.aria-label]="messageFor('toggleButtonLabel')"
|
|
1148
|
-
>
|
|
1149
|
-
</button>
|
|
1150
|
-
<ng-template #popupTemplate>
|
|
1151
|
-
<kendo-flatcolorpicker
|
|
1152
|
-
#flatColorPicker
|
|
1153
|
-
[value]="value"
|
|
1154
|
-
[format]="format"
|
|
1155
|
-
[size]="isAdaptive ? 'large' : size"
|
|
1156
|
-
[views]="views"
|
|
1157
|
-
[activeView]="activeView"
|
|
1158
|
-
[actionsLayout]="actionsLayout"
|
|
1159
|
-
[adaptiveMode]="isActionSheetExpanded"
|
|
1160
|
-
[preview]="preview"
|
|
1161
|
-
[gradientSettings]="gradientSettings"
|
|
1162
|
-
[paletteSettings]="paletteSettings"
|
|
1163
|
-
[clearButton]="clearButton"
|
|
1164
|
-
(cancel)="handleCancelEvent($event)"
|
|
1165
|
-
(focusout)="handlePopupBlur($event)"
|
|
1166
|
-
(valueChange)="handleValueChange($event)"
|
|
1167
|
-
(keydown)="handlePopupKeyDown($event)"
|
|
1168
|
-
(activeViewChange)="activeViewChange.emit($event)"
|
|
1169
|
-
(clearButtonClick)="clearButtonClick.emit()"
|
|
1170
|
-
(actionButtonClick)="togglePopup()">
|
|
1171
|
-
</kendo-flatcolorpicker>
|
|
1172
|
-
</ng-template>
|
|
1173
|
-
<ng-container #container></ng-container>
|
|
1174
|
-
<kendo-adaptive-renderer
|
|
1175
|
-
[actionSheetTemplate]="popupTemplate"
|
|
1176
|
-
[isActionSheetExpanded]="isActionSheetExpanded"
|
|
1177
|
-
[title]="adaptiveTitle"
|
|
1178
|
-
[subtitle]="adaptiveSubtitle"
|
|
1179
|
-
[preview]="preview"
|
|
1180
|
-
(actionSheetClose)="onActionSheetClose($event)"
|
|
1181
|
-
(onApply)="applyValue()"
|
|
1182
|
-
(onCancel)="cancelValue($event)"
|
|
1183
|
-
>
|
|
1184
|
-
</kendo-adaptive-renderer>
|
|
1185
|
-
@if (isOpen || isAdaptiveModeEnabled) {
|
|
1186
|
-
<kendo-resize-sensor (resize)="onResize()"></kendo-resize-sensor>
|
|
1187
|
-
}
|
|
1188
|
-
`,
|
|
1189
|
-
standalone: true,
|
|
1190
|
-
imports: [LocalizedColorPickerMessagesDirective, NgClass, IconWrapperComponent, ButtonComponent, FlatColorPickerComponent, ResizeSensorComponent, AdaptiveRendererComponent]
|
|
1191
|
-
}]
|
|
1192
|
-
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1.PopupService }, { type: i0.ChangeDetectorRef }, { type: i2.LocalizationService }, { type: i0.NgZone }, { type: i0.Renderer2 }, { type: i0.Injector }, { type: i3.AdaptiveService }], propDecorators: { hostClasses: [{
|
|
1193
|
-
type: HostBinding,
|
|
1194
|
-
args: ['class.k-colorpicker']
|
|
1195
|
-
}, {
|
|
1196
|
-
type: HostBinding,
|
|
1197
|
-
args: ['class.k-icon-picker']
|
|
1198
|
-
}, {
|
|
1199
|
-
type: HostBinding,
|
|
1200
|
-
args: ['class.k-picker']
|
|
1201
|
-
}], focusedClass: [{
|
|
1202
|
-
type: HostBinding,
|
|
1203
|
-
args: ['class.k-focus']
|
|
1204
|
-
}], disabledClass: [{
|
|
1205
|
-
type: HostBinding,
|
|
1206
|
-
args: ['attr.aria-disabled']
|
|
1207
|
-
}, {
|
|
1208
|
-
type: HostBinding,
|
|
1209
|
-
args: ['class.k-disabled']
|
|
1210
|
-
}], ariaReadonly: [{
|
|
1211
|
-
type: HostBinding,
|
|
1212
|
-
args: ['attr.aria-readonly']
|
|
1213
|
-
}], ariaExpanded: [{
|
|
1214
|
-
type: HostBinding,
|
|
1215
|
-
args: ['attr.aria-expanded']
|
|
1216
|
-
}], hostTabindex: [{
|
|
1217
|
-
type: HostBinding,
|
|
1218
|
-
args: ['attr.tabindex']
|
|
1219
|
-
}], direction: [{
|
|
1220
|
-
type: HostBinding,
|
|
1221
|
-
args: ['attr.dir']
|
|
1222
|
-
}], role: [{
|
|
1223
|
-
type: HostBinding,
|
|
1224
|
-
args: ['attr.role']
|
|
1225
|
-
}], hasPopup: [{
|
|
1226
|
-
type: HostBinding,
|
|
1227
|
-
args: ['attr.aria-haspopup']
|
|
1228
|
-
}], isControlInvalid: [{
|
|
1229
|
-
type: HostBinding,
|
|
1230
|
-
args: ['attr.aria-invalid']
|
|
1231
|
-
}], views: [{
|
|
1232
|
-
type: Input
|
|
1233
|
-
}], view: [{
|
|
1234
|
-
type: Input
|
|
1235
|
-
}], adaptiveMode: [{
|
|
1236
|
-
type: Input
|
|
1237
|
-
}], activeView: [{
|
|
1238
|
-
type: Input
|
|
1239
|
-
}], readonly: [{
|
|
1240
|
-
type: Input
|
|
1241
|
-
}, {
|
|
1242
|
-
type: HostBinding,
|
|
1243
|
-
args: ['class.k-readonly']
|
|
1244
|
-
}], disabled: [{
|
|
1245
|
-
type: Input
|
|
1246
|
-
}], format: [{
|
|
1247
|
-
type: Input
|
|
1248
|
-
}], value: [{
|
|
1249
|
-
type: Input
|
|
1250
|
-
}], popupSettings: [{
|
|
1251
|
-
type: Input
|
|
1252
|
-
}], paletteSettings: [{
|
|
1253
|
-
type: Input
|
|
1254
|
-
}], gradientSettings: [{
|
|
1255
|
-
type: Input
|
|
1256
|
-
}], icon: [{
|
|
1257
|
-
type: Input
|
|
1258
|
-
}], iconClass: [{
|
|
1259
|
-
type: Input
|
|
1260
|
-
}], svgIcon: [{
|
|
1261
|
-
type: Input
|
|
1262
|
-
}], adaptiveTitle: [{
|
|
1263
|
-
type: Input
|
|
1264
|
-
}], adaptiveSubtitle: [{
|
|
1265
|
-
type: Input
|
|
1266
|
-
}], clearButton: [{
|
|
1267
|
-
type: Input
|
|
1268
|
-
}], tabindex: [{
|
|
1269
|
-
type: Input
|
|
1270
|
-
}], preview: [{
|
|
1271
|
-
type: Input
|
|
1272
|
-
}], actionsLayout: [{
|
|
1273
|
-
type: Input
|
|
1274
|
-
}], size: [{
|
|
1275
|
-
type: Input
|
|
1276
|
-
}], rounded: [{
|
|
1277
|
-
type: Input
|
|
1278
|
-
}], fillMode: [{
|
|
1279
|
-
type: Input
|
|
1280
|
-
}], valueChange: [{
|
|
1281
|
-
type: Output
|
|
1282
|
-
}], open: [{
|
|
1283
|
-
type: Output
|
|
1284
|
-
}], close: [{
|
|
1285
|
-
type: Output
|
|
1286
|
-
}], onFocus: [{
|
|
1287
|
-
type: Output,
|
|
1288
|
-
args: ['focus']
|
|
1289
|
-
}], onBlur: [{
|
|
1290
|
-
type: Output,
|
|
1291
|
-
args: ['blur']
|
|
1292
|
-
}], cancel: [{
|
|
1293
|
-
type: Output
|
|
1294
|
-
}], activeColorClick: [{
|
|
1295
|
-
type: Output
|
|
1296
|
-
}], clearButtonClick: [{
|
|
1297
|
-
type: Output
|
|
1298
|
-
}], activeViewChange: [{
|
|
1299
|
-
type: Output
|
|
1300
|
-
}], container: [{
|
|
1301
|
-
type: ViewChild,
|
|
1302
|
-
args: ['container', { read: ViewContainerRef, static: true }]
|
|
1303
|
-
}], activeColor: [{
|
|
1304
|
-
type: ViewChild,
|
|
1305
|
-
args: ['activeColor', { static: true }]
|
|
1306
|
-
}], popupTemplate: [{
|
|
1307
|
-
type: ViewChild,
|
|
1308
|
-
args: ['popupTemplate', { static: true }]
|
|
1309
|
-
}], flatColorPicker: [{
|
|
1310
|
-
type: ViewChild,
|
|
1311
|
-
args: ['flatColorPicker', { static: false }]
|
|
1312
|
-
}], adaptiveRenderer: [{
|
|
1313
|
-
type: ViewChild,
|
|
1314
|
-
args: [AdaptiveRendererComponent]
|
|
1315
|
-
}] } });
|