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