@progress/kendo-angular-inputs 7.5.2 → 8.0.0-dev.202112161434

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. package/dist/cdn/js/kendo-angular-inputs.js +2 -2
  2. package/dist/cdn/main.js +1 -1
  3. package/dist/es/colorpicker/color-contrast-svg.component.js +95 -0
  4. package/dist/es/colorpicker/color-gradient.component.js +109 -81
  5. package/dist/es/colorpicker/color-input.component.js +39 -18
  6. package/dist/es/colorpicker/color-palette.component.js +28 -18
  7. package/dist/es/colorpicker/colorpicker.component.js +170 -76
  8. package/dist/es/colorpicker/constants.js +12 -0
  9. package/dist/es/colorpicker/contrast-validation.component.js +8 -6
  10. package/dist/es/colorpicker/contrast.component.js +6 -8
  11. package/dist/es/colorpicker/{models → events}/active-color-click-event.js +0 -0
  12. package/dist/es/colorpicker/events/cancel-event.js +19 -0
  13. package/dist/es/colorpicker/events/close-event.js +17 -0
  14. package/dist/es/colorpicker/{models → events}/kendo-drag-event.js +0 -0
  15. package/dist/es/colorpicker/events/open-event.js +17 -0
  16. package/dist/es/colorpicker/events.js +8 -0
  17. package/dist/es/colorpicker/flatcolorpicker-actions.component.js +50 -0
  18. package/dist/es/colorpicker/flatcolorpicker-header.component.js +94 -0
  19. package/dist/es/colorpicker/flatcolorpicker.component.js +553 -0
  20. package/dist/es/colorpicker/localization/colorgradient-localization.service.js +7 -7
  21. package/dist/es/colorpicker/localization/colorpalette-localization.service.js +7 -7
  22. package/dist/es/colorpicker/localization/custom-messages.component.js +1 -1
  23. package/dist/es/colorpicker/localization/flatcolorpicker-localization.service.js +34 -0
  24. package/dist/es/colorpicker/localization/localized-colorpicker-messages.directive.js +1 -1
  25. package/dist/es/colorpicker/localization/messages.js +36 -0
  26. package/dist/es/colorpicker/models/{color-picker-view.js → actions-layout.js} +0 -0
  27. package/dist/{es2015/colorpicker/models/color-picker-view.js → es/colorpicker/models/colorpicker-view.js} +0 -0
  28. package/dist/es/colorpicker/{utils → models}/palette-presets.js +0 -0
  29. package/dist/es/colorpicker/models.js +1 -2
  30. package/dist/es/colorpicker/services/flatcolorpicker.service.js +41 -0
  31. package/dist/es/colorpicker/utils/color-parser.js +18 -5
  32. package/dist/es/colorpicker/utils/contrast-curve.js +91 -0
  33. package/dist/es/colorpicker/utils.js +1 -1
  34. package/dist/es/colorpicker.module.js +9 -1
  35. package/dist/es/index.js +5 -0
  36. package/dist/es/main.js +4 -1
  37. package/dist/es/package-metadata.js +1 -1
  38. package/dist/es2015/colorpicker/color-contrast-svg.component.d.ts +26 -0
  39. package/dist/es2015/colorpicker/color-contrast-svg.component.js +97 -0
  40. package/dist/es2015/colorpicker/color-gradient.component.d.ts +32 -43
  41. package/dist/es2015/colorpicker/color-gradient.component.js +125 -92
  42. package/dist/es2015/colorpicker/color-input.component.d.ts +11 -4
  43. package/dist/es2015/colorpicker/color-input.component.js +52 -32
  44. package/dist/es2015/colorpicker/color-palette.component.d.ts +8 -3
  45. package/dist/es2015/colorpicker/color-palette.component.js +28 -18
  46. package/dist/es2015/colorpicker/colorpicker.component.d.ts +84 -24
  47. package/dist/es2015/colorpicker/colorpicker.component.js +195 -112
  48. package/dist/es2015/colorpicker/constants.d.ts +12 -0
  49. package/dist/es2015/colorpicker/constants.js +12 -0
  50. package/dist/es2015/colorpicker/contrast-validation.component.d.ts +1 -1
  51. package/dist/es2015/colorpicker/contrast-validation.component.js +16 -12
  52. package/dist/es2015/colorpicker/contrast.component.d.ts +1 -3
  53. package/dist/es2015/colorpicker/contrast.component.js +17 -17
  54. package/dist/es2015/colorpicker/{models → events}/active-color-click-event.d.ts +0 -0
  55. package/dist/es2015/colorpicker/{models → events}/active-color-click-event.js +0 -0
  56. package/dist/es2015/colorpicker/events/cancel-event.d.ts +15 -0
  57. package/dist/es2015/colorpicker/events/cancel-event.js +14 -0
  58. package/dist/es2015/colorpicker/events/close-event.d.ts +10 -0
  59. package/dist/es2015/colorpicker/events/close-event.js +10 -0
  60. package/dist/es2015/colorpicker/{models → events}/kendo-drag-event.d.ts +0 -0
  61. package/dist/es2015/colorpicker/{models → events}/kendo-drag-event.js +0 -0
  62. package/dist/es2015/colorpicker/events/open-event.d.ts +10 -0
  63. package/dist/es2015/colorpicker/events/open-event.js +10 -0
  64. package/dist/es2015/colorpicker/events.d.ts +8 -0
  65. package/dist/es2015/colorpicker/events.js +8 -0
  66. package/dist/es2015/colorpicker/flatcolorpicker-actions.component.d.ts +18 -0
  67. package/dist/es2015/colorpicker/flatcolorpicker-actions.component.js +60 -0
  68. package/dist/es2015/colorpicker/flatcolorpicker-header.component.d.ts +30 -0
  69. package/dist/es2015/colorpicker/flatcolorpicker-header.component.js +131 -0
  70. package/dist/es2015/colorpicker/flatcolorpicker.component.d.ts +214 -0
  71. package/dist/es2015/colorpicker/flatcolorpicker.component.js +593 -0
  72. package/dist/es2015/colorpicker/localization/colorgradient-localization.service.d.ts +3 -3
  73. package/dist/es2015/colorpicker/localization/colorgradient-localization.service.js +7 -7
  74. package/dist/es2015/colorpicker/localization/colorpalette-localization.service.d.ts +3 -3
  75. package/dist/es2015/colorpicker/localization/colorpalette-localization.service.js +7 -7
  76. package/dist/es2015/colorpicker/localization/custom-messages.component.js +1 -1
  77. package/dist/es2015/colorpicker/localization/flatcolorpicker-localization.service.d.ts +14 -0
  78. package/dist/es2015/colorpicker/localization/flatcolorpicker-localization.service.js +31 -0
  79. package/dist/es2015/colorpicker/localization/localized-colorpicker-messages.directive.js +1 -1
  80. package/dist/es2015/colorpicker/localization/messages.d.ts +36 -0
  81. package/dist/es2015/colorpicker/localization/messages.js +36 -0
  82. package/dist/es2015/colorpicker/models/actions-layout.d.ts +8 -0
  83. package/dist/es2015/colorpicker/models/actions-layout.js +4 -0
  84. package/dist/es2015/colorpicker/models/colorpicker-view.d.ts +8 -0
  85. package/dist/es2015/colorpicker/models/colorpicker-view.js +4 -0
  86. package/dist/es2015/colorpicker/models/gradient-settings.d.ts +4 -3
  87. package/dist/es2015/colorpicker/models/output-format.d.ts +0 -5
  88. package/dist/es2015/colorpicker/{utils → models}/palette-presets.d.ts +0 -0
  89. package/dist/es2015/colorpicker/{utils → models}/palette-presets.js +0 -0
  90. package/dist/es2015/colorpicker/models/palette-settings.d.ts +2 -3
  91. package/dist/es2015/colorpicker/models/tile-size.d.ts +1 -5
  92. package/dist/es2015/colorpicker/models.d.ts +10 -10
  93. package/dist/es2015/colorpicker/models.js +1 -2
  94. package/dist/es2015/colorpicker/{models/color-picker-view.d.ts → services/flatcolorpicker.service.d.ts} +6 -7
  95. package/dist/es2015/colorpicker/services/flatcolorpicker.service.js +38 -0
  96. package/dist/es2015/colorpicker/utils/color-parser.d.ts +8 -2
  97. package/dist/es2015/colorpicker/utils/color-parser.js +15 -5
  98. package/dist/es2015/colorpicker/utils/contrast-curve.d.ts +37 -0
  99. package/dist/es2015/colorpicker/utils/contrast-curve.js +85 -0
  100. package/dist/es2015/colorpicker/utils.d.ts +1 -1
  101. package/dist/es2015/colorpicker/utils.js +1 -1
  102. package/dist/es2015/colorpicker.module.js +9 -1
  103. package/dist/es2015/index.d.ts +5 -0
  104. package/dist/es2015/index.js +5 -0
  105. package/dist/es2015/index.metadata.json +1 -1
  106. package/dist/es2015/main.d.ts +4 -1
  107. package/dist/es2015/main.js +4 -1
  108. package/dist/es2015/package-metadata.js +1 -1
  109. package/dist/fesm2015/index.js +2207 -1043
  110. package/dist/fesm5/index.js +2010 -907
  111. package/dist/npm/colorpicker/color-contrast-svg.component.js +97 -0
  112. package/dist/npm/colorpicker/color-gradient.component.js +109 -81
  113. package/dist/npm/colorpicker/color-input.component.js +38 -17
  114. package/dist/npm/colorpicker/color-palette.component.js +29 -19
  115. package/dist/npm/colorpicker/colorpicker.component.js +177 -83
  116. package/dist/npm/colorpicker/constants.js +12 -0
  117. package/dist/npm/colorpicker/contrast-validation.component.js +8 -6
  118. package/dist/npm/colorpicker/contrast.component.js +6 -8
  119. package/dist/npm/colorpicker/{models → events}/active-color-click-event.js +0 -0
  120. package/dist/npm/colorpicker/events/cancel-event.js +21 -0
  121. package/dist/npm/colorpicker/events/close-event.js +19 -0
  122. package/dist/npm/colorpicker/{models → events}/kendo-drag-event.js +0 -0
  123. package/dist/npm/colorpicker/events/open-event.js +19 -0
  124. package/dist/npm/colorpicker/events.js +11 -0
  125. package/dist/npm/colorpicker/flatcolorpicker-actions.component.js +52 -0
  126. package/dist/npm/colorpicker/flatcolorpicker-header.component.js +96 -0
  127. package/dist/npm/colorpicker/flatcolorpicker.component.js +555 -0
  128. package/dist/npm/colorpicker/localization/colorgradient-localization.service.js +7 -7
  129. package/dist/npm/colorpicker/localization/colorpalette-localization.service.js +7 -7
  130. package/dist/npm/colorpicker/localization/custom-messages.component.js +1 -1
  131. package/dist/npm/colorpicker/localization/flatcolorpicker-localization.service.js +36 -0
  132. package/dist/npm/colorpicker/localization/localized-colorpicker-messages.directive.js +1 -1
  133. package/dist/npm/colorpicker/localization/messages.js +36 -0
  134. package/dist/npm/colorpicker/models/{color-picker-view.js → actions-layout.js} +0 -0
  135. package/dist/npm/colorpicker/models/colorpicker-view.js +6 -0
  136. package/dist/npm/colorpicker/{utils → models}/palette-presets.js +0 -0
  137. package/dist/npm/colorpicker/models.js +1 -2
  138. package/dist/npm/colorpicker/services/flatcolorpicker.service.js +43 -0
  139. package/dist/npm/colorpicker/utils/color-parser.js +18 -5
  140. package/dist/npm/colorpicker/utils/contrast-curve.js +93 -0
  141. package/dist/npm/colorpicker/utils.js +1 -1
  142. package/dist/npm/colorpicker.module.js +9 -1
  143. package/dist/npm/index.js +10 -0
  144. package/dist/npm/main.js +7 -2
  145. package/dist/npm/package-metadata.js +1 -1
  146. package/dist/systemjs/kendo-angular-inputs.js +1 -1
  147. package/package.json +3 -2
  148. package/dist/es/colorpicker/models/preventable-event.js +0 -29
  149. package/dist/es2015/colorpicker/models/preventable-event.d.ts +0 -21
  150. package/dist/es2015/colorpicker/models/preventable-event.js +0 -27
  151. package/dist/npm/colorpicker/models/preventable-event.js +0 -31
@@ -0,0 +1,593 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ import * as tslib_1 from "tslib";
6
+ var FlatColorPickerComponent_1;
7
+ import { Component, ElementRef, EventEmitter, forwardRef, HostBinding, Input, isDevMode, NgZone, ChangeDetectorRef, Output, Renderer2, ViewChild } from "@angular/core";
8
+ import { NG_VALUE_ACCESSOR } from '@angular/forms';
9
+ import { Subscription } from 'rxjs';
10
+ import { L10N_PREFIX, LocalizationService } from '@progress/kendo-angular-l10n';
11
+ import { isChanged, KendoInput } from '@progress/kendo-angular-common';
12
+ import { FlatColorPickerLocalizationService } from './localization/flatcolorpicker-localization.service';
13
+ import { FlatColorPickerService } from './services/flatcolorpicker.service';
14
+ import { ColorPickerCancelEvent } from './events';
15
+ import { parseColor } from './utils';
16
+ import { isPresent } from '../common/utils';
17
+ import { ColorGradientComponent } from './color-gradient.component';
18
+ import { ColorPaletteComponent } from './color-palette.component';
19
+ import { FlatColorPickerHeaderComponent } from './flatcolorpicker-header.component';
20
+ import { FlatColorPickerActionButtonsComponent } from './flatcolorpicker-actions.component';
21
+ /**
22
+ * Represents the [Kendo UI FlatColorPicker component for Angular]({% slug overview_flatcolorpicker %}).
23
+ *
24
+ * The FlatColorPicker is a powerful tool which allows the user to choose colors through palettes with predefined sets of colors and
25
+ * through a gradient that renders an hsv canvas. It supports previewing the selected color, reverting it to its previous state or clearing it completely.
26
+ */
27
+ let FlatColorPickerComponent = FlatColorPickerComponent_1 = class FlatColorPickerComponent {
28
+ constructor(service, host, localizationService, cdr, renderer, ngZone) {
29
+ this.service = service;
30
+ this.host = host;
31
+ this.localizationService = localizationService;
32
+ this.cdr = cdr;
33
+ this.renderer = renderer;
34
+ this.ngZone = ngZone;
35
+ this.hostClasses = true;
36
+ /**
37
+ * Sets the read-only state of the FlatColorPicker.
38
+ *
39
+ * @default false
40
+ */
41
+ this.readonly = false;
42
+ /**
43
+ * Sets the disabled state of the FlatColorPicker.
44
+ *
45
+ * @default false
46
+ */
47
+ this.disabled = false;
48
+ /**
49
+ * Specifies the output format of the FlatColorPicker.
50
+ *
51
+ * If the input value is in a different format, it will be parsed into the specified output `format`.
52
+ *
53
+ * The supported values are:
54
+ * * `rgba` (default)
55
+ * * `hex`
56
+ */
57
+ this.format = 'rgba';
58
+ /**
59
+ * Specifies whether the FlatColorPicker should display a 'Clear color' button.
60
+ *
61
+ * @default true
62
+ */
63
+ this.clearButton = true;
64
+ /**
65
+ * Displays `Apply` and `Cancel` action buttons and a color preview pane.
66
+ *
67
+ * When enabled, the component value will not change immediately upon
68
+ * color selection, but only after the `Apply` button is clicked.
69
+ *
70
+ * The `Cancel` button reverts the current selection to its
71
+ * initial state i.e. to the current value.
72
+ *
73
+ * @default true
74
+ */
75
+ this.preview = true;
76
+ /**
77
+ * Configures the layout of the `Apply` and `Cancel` action buttons.
78
+ * * `start`
79
+ * * `center`
80
+ * * `end` (default)
81
+ * * `stretch`
82
+ */
83
+ this.actionsLayout = 'end';
84
+ /**
85
+ * Specifies the views that will be rendered. Default value is gradient and palette.
86
+ */
87
+ this.views = ['gradient', 'palette'];
88
+ /**
89
+ * Fires each time the component value is changed.
90
+ */
91
+ this.valueChange = new EventEmitter();
92
+ /**
93
+ * Fires when the user cancels the current color selection.
94
+ *
95
+ * The event is emitted on preview pane or on 'Cancel' button click.
96
+ */
97
+ this.cancel = new EventEmitter();
98
+ /**
99
+ * Fires each time the view is about to change.
100
+ * Used to provide a two-way binding for the `activeView` property.
101
+ */
102
+ this.activeViewChange = new EventEmitter();
103
+ /**
104
+ * @hidden
105
+ */
106
+ this.actionButtonClick = new EventEmitter();
107
+ this._tabindex = 0;
108
+ this._gradientSettings = { opacity: true, delay: 0 };
109
+ this._paletteSettings = {};
110
+ this.subscriptions = new Subscription();
111
+ this.notifyNgChanged = () => { };
112
+ this.notifyNgTouched = () => { };
113
+ this.dynamicRTLSubscription = this.localizationService.changes.subscribe(({ rtl }) => {
114
+ this.direction = rtl ? 'rtl' : 'ltr';
115
+ });
116
+ }
117
+ get disabledClass() {
118
+ return this.disabled;
119
+ }
120
+ get ariaReadonly() {
121
+ return this.readonly;
122
+ }
123
+ get hostTabindex() {
124
+ return this.tabindex;
125
+ }
126
+ /**
127
+ * Specifies the initially selected color.
128
+ */
129
+ set value(value) {
130
+ this._value = parseColor(value, this.format, this.gradientSettings.opacity);
131
+ }
132
+ get value() {
133
+ return this._value;
134
+ }
135
+ /**
136
+ * Specifies the [tabindex](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the component.
137
+ *
138
+ * @default 0
139
+ */
140
+ set tabindex(value) {
141
+ const tabindex = Number(value);
142
+ const defaultValue = 0;
143
+ this._tabindex = !isNaN(tabindex) ? tabindex : defaultValue;
144
+ }
145
+ get tabindex() {
146
+ return !this.disabled ? this._tabindex : undefined;
147
+ }
148
+ /**
149
+ * Configures the gradient view.
150
+ */
151
+ set gradientSettings(value) {
152
+ Object.assign(this._gradientSettings, value);
153
+ }
154
+ get gradientSettings() {
155
+ return this._gradientSettings;
156
+ }
157
+ /**
158
+ * Configures the palette view.
159
+ */
160
+ set paletteSettings(value) {
161
+ Object.assign(this._paletteSettings, value);
162
+ }
163
+ get paletteSettings() {
164
+ return this._paletteSettings;
165
+ }
166
+ ngOnInit() {
167
+ this.selection = this.value;
168
+ this._paletteSettings = this.service.getPaletteSettings(this._paletteSettings, this.format);
169
+ this.setActiveView();
170
+ }
171
+ ngAfterViewInit() {
172
+ this.setHostElementAriaLabel();
173
+ this.initDomEvents();
174
+ this.setSizingVariables();
175
+ }
176
+ ngOnChanges(changes) {
177
+ if (isChanged('value', changes)) {
178
+ this.setHostElementAriaLabel();
179
+ }
180
+ if (isChanged('paletteSettings', changes)) {
181
+ this.setSizingVariables();
182
+ }
183
+ }
184
+ ngOnDestroy() {
185
+ if (this.dynamicRTLSubscription) {
186
+ this.dynamicRTLSubscription.unsubscribe();
187
+ }
188
+ this.subscriptions.unsubscribe();
189
+ }
190
+ /**
191
+ * @hidden
192
+ */
193
+ get headerHasContent() {
194
+ return this.preview || this.views.length > 1 || this.clearButton;
195
+ }
196
+ /**
197
+ * @hidden
198
+ * Used by the FloatingLabel to determine if the component is empty.
199
+ */
200
+ isEmpty() {
201
+ return false;
202
+ }
203
+ /**
204
+ * Focuses the wrapper of the FlatColorPicker.
205
+ */
206
+ focus() {
207
+ if (this.disabled && this.focused) {
208
+ return;
209
+ }
210
+ this.host.nativeElement.focus();
211
+ this.focused = true;
212
+ }
213
+ /**
214
+ * Blurs the wrapper of the FlatColorPicker.
215
+ */
216
+ blur() {
217
+ if (!this.focused) {
218
+ return;
219
+ }
220
+ this.notifyNgTouched();
221
+ this.host.nativeElement.blur();
222
+ this.focused = false;
223
+ }
224
+ /**
225
+ * Clears the value of the FlatColorPicker.
226
+ */
227
+ reset() {
228
+ if (!isPresent(this.value)) {
229
+ return;
230
+ }
231
+ this.value = undefined;
232
+ this.notifyNgChanged(undefined);
233
+ this.setHostElementAriaLabel();
234
+ }
235
+ /**
236
+ * @hidden
237
+ */
238
+ onViewChange(view) {
239
+ if (this.activeView === view) {
240
+ return;
241
+ }
242
+ this.activeView = view;
243
+ this.activeViewChange.emit(view);
244
+ if (this.activeView === 'gradient') {
245
+ this.ngZone.runOutsideAngular(() => {
246
+ setTimeout(() => {
247
+ this.gradient.gradientDragHandle.nativeElement.focus();
248
+ });
249
+ });
250
+ }
251
+ }
252
+ /**
253
+ * @hidden
254
+ */
255
+ onClearButtonClick() {
256
+ this.resetInnerComponentValue();
257
+ this.host.nativeElement.focus();
258
+ }
259
+ /**
260
+ * @hidden
261
+ */
262
+ handleValueChange(color) {
263
+ if (this.value === color) {
264
+ return;
265
+ }
266
+ if (this.preview) {
267
+ this.changeCurrentValue(color);
268
+ }
269
+ else {
270
+ this.setFlatColorPickerValue(color);
271
+ }
272
+ }
273
+ /**
274
+ * @hidden
275
+ */
276
+ onAction(ev) {
277
+ ev.target === 'apply' ? this.setFlatColorPickerValue(this.selection) : this.resetSelection(ev.originalEvent);
278
+ this.actionButtonClick.emit();
279
+ }
280
+ /**
281
+ * @hidden
282
+ */
283
+ writeValue(value) {
284
+ this.value = value;
285
+ }
286
+ /**
287
+ * @hidden
288
+ */
289
+ registerOnChange(fn) {
290
+ this.notifyNgChanged = fn;
291
+ }
292
+ /**
293
+ * @hidden
294
+ */
295
+ registerOnTouched(fn) {
296
+ this.notifyNgTouched = fn;
297
+ }
298
+ /**
299
+ * @hidden
300
+ */
301
+ setDisabledState(isDisabled) {
302
+ this.cdr.markForCheck();
303
+ this.disabled = isDisabled;
304
+ }
305
+ /**
306
+ * @hidden
307
+ */
308
+ resetSelection(ev) {
309
+ const eventArgs = new ColorPickerCancelEvent(ev);
310
+ this.cancel.emit(eventArgs);
311
+ if (!eventArgs.isDefaultPrevented()) {
312
+ this.selection = this.value;
313
+ }
314
+ this.notifyNgTouched();
315
+ }
316
+ setHostElementAriaLabel() {
317
+ const parsed = parseColor(this.value, this.format, this.gradientSettings.opacity);
318
+ const ariaLabelValue = `${this.value ? parsed : this.localizationService.get('flatColorPickerNoColor')}`;
319
+ this.renderer.setAttribute(this.host.nativeElement, 'aria-label', ariaLabelValue);
320
+ }
321
+ setSizingVariables() {
322
+ const paletteTileSize = this.service.paletteTileLayout(this.paletteSettings.tileSize);
323
+ const value = `--kendo-color-preview-columns: ${this.paletteSettings.columns};
324
+ --kendo-color-preview-width: ${paletteTileSize.width}px;
325
+ --kendo-color-preview-height: ${paletteTileSize.height}px;`;
326
+ this.host.nativeElement.querySelector('.k-coloreditor-views.k-vstack').setAttribute('style', value);
327
+ }
328
+ changeCurrentValue(color) {
329
+ this.selection = color;
330
+ this.notifyNgTouched();
331
+ }
332
+ resetInnerComponentValue() {
333
+ this.selection = null;
334
+ if (this.gradient) {
335
+ this.gradient.reset();
336
+ return;
337
+ }
338
+ this.palette.reset();
339
+ }
340
+ setFlatColorPickerValue(color) {
341
+ if (this.value === color) {
342
+ return;
343
+ }
344
+ this.value = color;
345
+ this.valueChange.emit(color);
346
+ this.notifyNgChanged(color);
347
+ this.setHostElementAriaLabel();
348
+ }
349
+ setActiveView() {
350
+ if (!isPresent(this.activeView)) {
351
+ this.activeView = this.views[0];
352
+ return;
353
+ }
354
+ if (isDevMode() && this.views.indexOf(this.activeView) === -1) {
355
+ throw new Error("Invalid configuration: The current activeView is not present in the views collection");
356
+ }
357
+ }
358
+ initDomEvents() {
359
+ if (!this.host) {
360
+ return;
361
+ }
362
+ let hostElement = this.host.nativeElement;
363
+ this.ngZone.runOutsideAngular(() => {
364
+ this.subscriptions.add(this.renderer.listen(hostElement, 'focus', () => {
365
+ this.focused = true;
366
+ }));
367
+ this.subscriptions.add(this.renderer.listen(hostElement, 'blur', () => {
368
+ this.focused = false;
369
+ this.notifyNgTouched();
370
+ }));
371
+ });
372
+ }
373
+ };
374
+ tslib_1.__decorate([
375
+ HostBinding('class.k-flatcolorpicker'),
376
+ HostBinding('class.k-coloreditor'),
377
+ tslib_1.__metadata("design:type", Boolean)
378
+ ], FlatColorPickerComponent.prototype, "hostClasses", void 0);
379
+ tslib_1.__decorate([
380
+ HostBinding('class.k-state-disabled'),
381
+ HostBinding('attr.aria-disabled'),
382
+ tslib_1.__metadata("design:type", Boolean),
383
+ tslib_1.__metadata("design:paramtypes", [])
384
+ ], FlatColorPickerComponent.prototype, "disabledClass", null);
385
+ tslib_1.__decorate([
386
+ HostBinding('attr.aria-readonly'),
387
+ tslib_1.__metadata("design:type", Boolean),
388
+ tslib_1.__metadata("design:paramtypes", [])
389
+ ], FlatColorPickerComponent.prototype, "ariaReadonly", null);
390
+ tslib_1.__decorate([
391
+ HostBinding('attr.dir'),
392
+ tslib_1.__metadata("design:type", String)
393
+ ], FlatColorPickerComponent.prototype, "direction", void 0);
394
+ tslib_1.__decorate([
395
+ HostBinding('attr.tabindex'),
396
+ tslib_1.__metadata("design:type", Number),
397
+ tslib_1.__metadata("design:paramtypes", [])
398
+ ], FlatColorPickerComponent.prototype, "hostTabindex", null);
399
+ tslib_1.__decorate([
400
+ Input(),
401
+ tslib_1.__metadata("design:type", Boolean)
402
+ ], FlatColorPickerComponent.prototype, "readonly", void 0);
403
+ tslib_1.__decorate([
404
+ Input(),
405
+ tslib_1.__metadata("design:type", Boolean)
406
+ ], FlatColorPickerComponent.prototype, "disabled", void 0);
407
+ tslib_1.__decorate([
408
+ Input(),
409
+ tslib_1.__metadata("design:type", String)
410
+ ], FlatColorPickerComponent.prototype, "format", void 0);
411
+ tslib_1.__decorate([
412
+ Input(),
413
+ tslib_1.__metadata("design:type", String),
414
+ tslib_1.__metadata("design:paramtypes", [String])
415
+ ], FlatColorPickerComponent.prototype, "value", null);
416
+ tslib_1.__decorate([
417
+ Input(),
418
+ tslib_1.__metadata("design:type", Number),
419
+ tslib_1.__metadata("design:paramtypes", [Number])
420
+ ], FlatColorPickerComponent.prototype, "tabindex", null);
421
+ tslib_1.__decorate([
422
+ Input(),
423
+ tslib_1.__metadata("design:type", Boolean)
424
+ ], FlatColorPickerComponent.prototype, "clearButton", void 0);
425
+ tslib_1.__decorate([
426
+ Input(),
427
+ tslib_1.__metadata("design:type", Boolean)
428
+ ], FlatColorPickerComponent.prototype, "preview", void 0);
429
+ tslib_1.__decorate([
430
+ Input(),
431
+ tslib_1.__metadata("design:type", String)
432
+ ], FlatColorPickerComponent.prototype, "actionsLayout", void 0);
433
+ tslib_1.__decorate([
434
+ Input(),
435
+ tslib_1.__metadata("design:type", String)
436
+ ], FlatColorPickerComponent.prototype, "activeView", void 0);
437
+ tslib_1.__decorate([
438
+ Input(),
439
+ tslib_1.__metadata("design:type", Array)
440
+ ], FlatColorPickerComponent.prototype, "views", void 0);
441
+ tslib_1.__decorate([
442
+ Input(),
443
+ tslib_1.__metadata("design:type", Object),
444
+ tslib_1.__metadata("design:paramtypes", [Object])
445
+ ], FlatColorPickerComponent.prototype, "gradientSettings", null);
446
+ tslib_1.__decorate([
447
+ Input(),
448
+ tslib_1.__metadata("design:type", Object),
449
+ tslib_1.__metadata("design:paramtypes", [Object])
450
+ ], FlatColorPickerComponent.prototype, "paletteSettings", null);
451
+ tslib_1.__decorate([
452
+ Output(),
453
+ tslib_1.__metadata("design:type", EventEmitter)
454
+ ], FlatColorPickerComponent.prototype, "valueChange", void 0);
455
+ tslib_1.__decorate([
456
+ Output(),
457
+ tslib_1.__metadata("design:type", EventEmitter)
458
+ ], FlatColorPickerComponent.prototype, "cancel", void 0);
459
+ tslib_1.__decorate([
460
+ Output(),
461
+ tslib_1.__metadata("design:type", EventEmitter)
462
+ ], FlatColorPickerComponent.prototype, "activeViewChange", void 0);
463
+ tslib_1.__decorate([
464
+ Output(),
465
+ tslib_1.__metadata("design:type", EventEmitter)
466
+ ], FlatColorPickerComponent.prototype, "actionButtonClick", void 0);
467
+ tslib_1.__decorate([
468
+ ViewChild('header', { static: false }),
469
+ tslib_1.__metadata("design:type", FlatColorPickerHeaderComponent)
470
+ ], FlatColorPickerComponent.prototype, "header", void 0);
471
+ tslib_1.__decorate([
472
+ ViewChild('gradient', { static: false }),
473
+ tslib_1.__metadata("design:type", ColorGradientComponent)
474
+ ], FlatColorPickerComponent.prototype, "gradient", void 0);
475
+ tslib_1.__decorate([
476
+ ViewChild('palette', { static: false }),
477
+ tslib_1.__metadata("design:type", ColorPaletteComponent)
478
+ ], FlatColorPickerComponent.prototype, "palette", void 0);
479
+ tslib_1.__decorate([
480
+ ViewChild('footer', { static: false }),
481
+ tslib_1.__metadata("design:type", FlatColorPickerActionButtonsComponent)
482
+ ], FlatColorPickerComponent.prototype, "footer", void 0);
483
+ FlatColorPickerComponent = FlatColorPickerComponent_1 = tslib_1.__decorate([
484
+ Component({
485
+ exportAs: 'kendoFlatColorPicker',
486
+ selector: 'kendo-flatcolorpicker',
487
+ providers: [
488
+ {
489
+ multi: true,
490
+ provide: NG_VALUE_ACCESSOR,
491
+ useExisting: forwardRef(() => FlatColorPickerComponent_1)
492
+ },
493
+ {
494
+ provide: KendoInput,
495
+ useExisting: forwardRef(() => FlatColorPickerComponent_1)
496
+ },
497
+ FlatColorPickerService,
498
+ FlatColorPickerLocalizationService,
499
+ {
500
+ provide: LocalizationService,
501
+ useExisting: FlatColorPickerLocalizationService
502
+ },
503
+ {
504
+ provide: L10N_PREFIX,
505
+ useValue: 'kendo.flatcolorpicker'
506
+ }
507
+ ],
508
+ template: `
509
+ <ng-container kendoFlatColorPickerLocalizedMessages
510
+ i18n-flatColorPickerNoColor="kendo.flatcolorpicker.flatColorPickerNoColor|The aria-label applied to the FlatColorPicker component when the value is empty."
511
+ flatColorPickerNoColor="Flatcolorpicker no color chosen"
512
+ i18n-colorGradientNoColor="kendo.flatcolorpicker.colorGradientNoColor|The aria-label applied to the ColorGradient component when the value is empty."
513
+ colorGradientNoColor="Colorgradient no color chosen"
514
+ i18n-colorPaletteNoColor="kendo.flatcolorpicker.colorPaletteNoColor|The aria-label applied to the ColorPalette component when the value is empty."
515
+ colorPaletteNoColor="Colorpalette no color chosen"
516
+ i18n-colorGradientHandle="kendo.flatcolorpicker.colorGradientHandle|The title for the gradient color drag handle chooser."
517
+ colorGradientHandle="Choose color"
518
+ i18n-clearButton="kendo.flatcolorpicker.clearButton|The title for the clear button."
519
+ clearButton="Clear value"
520
+ i18n-hueSliderHandle="kendo.flatcolorpicker.hueSliderHandle|The title for the hue slider handle."
521
+ hueSliderHandle="Set hue"
522
+ i18n-opacitySliderHandle="kendo.flatcolorpicker.opacitySliderHandle|The title for the opacity slider handle."
523
+ opacitySliderHandle="Set opacity"
524
+ i18n-contrastRatio="kendo.flatcolorpicker.contrastRatio|The contrast ratio message for the contrast tool."
525
+ contrastRatio="Contrast ratio"
526
+ i18n-previewColor="kendo.flatcolorpicker.previewColor|The message for the color preview pane."
527
+ previewColor="Color preview"
528
+ i18n-revertSelection="kendo.flatcolorpicker.revertSelection|The message for the selected color pane."
529
+ revertSelection="Revert selection"
530
+ i18n-gradientView="kendo.flatcolorpicker.gradientView|The message for the gradient view button."
531
+ gradientView="Gradient view"
532
+ i18n-paletteView="kendo.flatcolorpicker.paletteView|The message for the palette view button."
533
+ paletteView="Palette view"
534
+ i18n-formatButton="kendo.flatcolorpicker.formatButton|The message for the input format toggle button."
535
+ formatButton="Change color format"
536
+ i18n-applyButton="kendo.flatcolorpicker.applyButton|The message for the Apply action button."
537
+ applyButton="Apply"
538
+ i18n-cancelButton="kendo.flatcolorpicker.cancelButton|The message for the Cancel action button."
539
+ cancelButton="Cancel">
540
+ </ng-container>
541
+ <div kendoFlatColorPickerHeader
542
+ *ngIf="headerHasContent"
543
+ #header
544
+ [clearButton]="clearButton"
545
+ [activeView]="activeView"
546
+ [views]="views"
547
+ [value]="value"
548
+ [selection]="selection"
549
+ [preview]="preview"
550
+ (clearButtonClick)="onClearButtonClick()"
551
+ (viewChange)="onViewChange($event)"
552
+ (valuePaneClick)="resetSelection($event)">
553
+ </div>
554
+ <div class="k-coloreditor-views k-vstack">
555
+ <kendo-colorgradient #gradient
556
+ *ngIf="activeView === 'gradient'"
557
+ [tabindex]="null"
558
+ [value]="selection"
559
+ [format]="format"
560
+ [opacity]="gradientSettings.opacity"
561
+ [delay]="gradientSettings.delay"
562
+ [contrastTool]="gradientSettings.contrastTool"
563
+ [readonly]="readonly"
564
+ (valueChange)="handleValueChange($event)"
565
+ >
566
+ </kendo-colorgradient>
567
+ <kendo-colorpalette #palette
568
+ *ngIf="activeView === 'palette'"
569
+ kendoFocusOnDomReady
570
+ [palette]="paletteSettings.palette"
571
+ [columns]="paletteSettings.columns"
572
+ [tileSize]="paletteSettings.tileSize"
573
+ [format]="format"
574
+ [value]="selection"
575
+ (valueChange)="handleValueChange($event)"
576
+ >
577
+ </kendo-colorpalette>
578
+ </div>
579
+ <div kendoFlatColorPickerActionButtons *ngIf="preview"
580
+ #footer
581
+ [ngClass]="'k-justify-content-' + actionsLayout"
582
+ (actionButtonClick)="onAction($event)">
583
+ </div>
584
+ `
585
+ }),
586
+ tslib_1.__metadata("design:paramtypes", [FlatColorPickerService,
587
+ ElementRef,
588
+ LocalizationService,
589
+ ChangeDetectorRef,
590
+ Renderer2,
591
+ NgZone])
592
+ ], FlatColorPickerComponent);
593
+ export { FlatColorPickerComponent };
@@ -3,12 +3,12 @@
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  import { LocalizationService, MessageService } from '@progress/kendo-angular-l10n';
6
- import { ColorPickerLocalizationService } from './colorpicker-localization.service';
6
+ import { FlatColorPickerLocalizationService } from './flatcolorpicker-localization.service';
7
7
  /**
8
8
  * @hidden
9
9
  */
10
10
  export declare class ColorGradientLocalizationService extends LocalizationService {
11
- private colorPickerLocalization?;
12
- constructor(prefix: string, messageService: MessageService, _rtl: boolean, colorPickerLocalization?: ColorPickerLocalizationService);
11
+ private flatColorPickerLocalization?;
12
+ constructor(prefix: string, messageService: MessageService, _rtl: boolean, flatColorPickerLocalization?: FlatColorPickerLocalizationService);
13
13
  get(shortKey: string): string;
14
14
  }
@@ -5,18 +5,18 @@
5
5
  import * as tslib_1 from "tslib";
6
6
  import { Inject, Optional } from '@angular/core';
7
7
  import { LocalizationService, L10N_PREFIX, MessageService, RTL } from '@progress/kendo-angular-l10n';
8
- import { ColorPickerLocalizationService } from './colorpicker-localization.service';
8
+ import { FlatColorPickerLocalizationService } from './flatcolorpicker-localization.service';
9
9
  /**
10
10
  * @hidden
11
11
  */
12
12
  let ColorGradientLocalizationService = class ColorGradientLocalizationService extends LocalizationService {
13
- constructor(prefix, messageService, _rtl, colorPickerLocalization) {
13
+ constructor(prefix, messageService, _rtl, flatColorPickerLocalization) {
14
14
  super(prefix, messageService, _rtl);
15
- this.colorPickerLocalization = colorPickerLocalization;
15
+ this.flatColorPickerLocalization = flatColorPickerLocalization;
16
16
  }
17
17
  get(shortKey) {
18
- if (this.colorPickerLocalization) {
19
- return this.colorPickerLocalization.get(shortKey);
18
+ if (this.flatColorPickerLocalization) {
19
+ return this.flatColorPickerLocalization.get(shortKey);
20
20
  }
21
21
  return super.get(shortKey);
22
22
  }
@@ -25,7 +25,7 @@ ColorGradientLocalizationService = tslib_1.__decorate([
25
25
  tslib_1.__param(0, Inject(L10N_PREFIX)),
26
26
  tslib_1.__param(1, Optional()),
27
27
  tslib_1.__param(2, Optional()), tslib_1.__param(2, Inject(RTL)),
28
- tslib_1.__param(3, Optional()), tslib_1.__param(3, Inject(ColorPickerLocalizationService)),
29
- tslib_1.__metadata("design:paramtypes", [String, MessageService, Boolean, ColorPickerLocalizationService])
28
+ tslib_1.__param(3, Optional()), tslib_1.__param(3, Inject(FlatColorPickerLocalizationService)),
29
+ tslib_1.__metadata("design:paramtypes", [String, MessageService, Boolean, FlatColorPickerLocalizationService])
30
30
  ], ColorGradientLocalizationService);
31
31
  export { ColorGradientLocalizationService };
@@ -3,12 +3,12 @@
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  import { LocalizationService, MessageService } from '@progress/kendo-angular-l10n';
6
- import { ColorPickerLocalizationService } from './colorpicker-localization.service';
6
+ import { FlatColorPickerLocalizationService } from './flatcolorpicker-localization.service';
7
7
  /**
8
8
  * @hidden
9
9
  */
10
10
  export declare class ColorPaletteLocalizationService extends LocalizationService {
11
- private colorPickerLocalization?;
12
- constructor(prefix: string, messageService: MessageService, _rtl: boolean, colorPickerLocalization?: ColorPickerLocalizationService);
11
+ private flatColorPickerLocalization?;
12
+ constructor(prefix: string, messageService: MessageService, _rtl: boolean, flatColorPickerLocalization?: FlatColorPickerLocalizationService);
13
13
  get(shortKey: string): string;
14
14
  }