@progress/kendo-angular-inputs 8.0.0-dev.202112161434 → 8.0.0-dev.202201121416
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/dist/cdn/js/kendo-angular-inputs.js +2 -2
- package/dist/cdn/main.js +1 -1
- package/dist/es/checkbox/checkbox.directive.js +79 -3
- package/dist/es/colorpicker/color-gradient.component.js +4 -1
- package/dist/es/colorpicker/color-input.component.js +1 -1
- package/dist/es/colorpicker/color-palette.component.js +6 -3
- package/dist/es/colorpicker/colorpicker.component.js +316 -53
- package/dist/es/colorpicker/flatcolorpicker-actions.component.js +1 -1
- package/dist/es/colorpicker/flatcolorpicker-header.component.js +1 -1
- package/dist/es/colorpicker/flatcolorpicker.component.js +7 -4
- package/dist/es/common/models/fillmode.js +4 -0
- package/dist/es/common/models/rounded.js +4 -0
- package/dist/es/common/models/size.js +4 -0
- package/dist/es/common/models/styling-classes.js +4 -0
- package/dist/es/common/models.js +4 -0
- package/dist/es/common/utils.js +37 -0
- package/dist/es/main.js +0 -1
- package/dist/es/maskedtextbox/maskedtextbox.component.js +101 -6
- package/dist/es/numerictextbox/numerictextbox.component.js +116 -20
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/radiobutton/radiobutton.directive.js +55 -3
- package/dist/es/shared/textarea.directive.js +3 -2
- package/dist/es/slider/slider.component.js +1 -1
- package/dist/es/switch/switch.component.js +167 -21
- package/dist/es/text-fields-common/text-fields-base.js +1 -1
- package/dist/es/textarea/textarea.component.js +101 -5
- package/dist/es/textbox/textbox.component.js +108 -11
- package/dist/es/textbox/textbox.directive.js +3 -2
- package/dist/es/textbox.module.js +0 -3
- package/dist/es2015/checkbox/checkbox.directive.d.ts +31 -0
- package/dist/es2015/checkbox/checkbox.directive.js +68 -10
- package/dist/es2015/colorpicker/color-gradient.component.js +4 -1
- package/dist/es2015/colorpicker/color-input.component.js +2 -2
- package/dist/es2015/colorpicker/color-palette.component.d.ts +1 -1
- package/dist/es2015/colorpicker/color-palette.component.js +6 -3
- package/dist/es2015/colorpicker/colorpicker.component.d.ts +67 -9
- package/dist/es2015/colorpicker/colorpicker.component.js +285 -76
- package/dist/es2015/colorpicker/flatcolorpicker-actions.component.js +2 -2
- package/dist/es2015/colorpicker/flatcolorpicker-header.component.js +2 -2
- package/dist/es2015/colorpicker/flatcolorpicker.component.d.ts +2 -2
- package/dist/es2015/colorpicker/flatcolorpicker.component.js +7 -4
- package/dist/es2015/common/models/fillmode.d.ts +13 -0
- package/dist/es2015/common/models/fillmode.js +4 -0
- package/dist/es2015/common/models/rounded.d.ts +23 -0
- package/dist/es2015/common/models/rounded.js +4 -0
- package/dist/es2015/common/models/size.d.ts +14 -0
- package/dist/es2015/common/models/size.js +4 -0
- package/dist/es2015/common/models/styling-classes.d.ts +11 -0
- package/dist/es2015/common/models/styling-classes.js +4 -0
- package/dist/es2015/common/models.d.ts +8 -0
- package/dist/es2015/common/models.js +4 -0
- package/dist/es2015/common/utils.d.ts +7 -0
- package/dist/es2015/common/utils.js +37 -0
- package/dist/es2015/index.metadata.json +1 -1
- package/dist/es2015/main.d.ts +1 -1
- package/dist/es2015/main.js +0 -1
- package/dist/es2015/maskedtextbox/maskedtextbox.component.d.ts +39 -1
- package/dist/es2015/maskedtextbox/maskedtextbox.component.js +88 -6
- package/dist/es2015/numerictextbox/numerictextbox.component.d.ts +39 -2
- package/dist/es2015/numerictextbox/numerictextbox.component.js +124 -40
- package/dist/es2015/package-metadata.js +1 -1
- package/dist/es2015/radiobutton/radiobutton.directive.d.ts +18 -0
- package/dist/es2015/radiobutton/radiobutton.directive.js +49 -11
- package/dist/es2015/shared/textarea.directive.d.ts +1 -1
- package/dist/es2015/shared/textarea.directive.js +3 -2
- package/dist/es2015/slider/slider.component.js +18 -23
- package/dist/es2015/switch/switch.component.d.ts +48 -5
- package/dist/es2015/switch/switch.component.js +166 -24
- package/dist/es2015/text-fields-common/text-fields-base.js +1 -1
- package/dist/es2015/textarea/textarea.component.d.ts +39 -1
- package/dist/es2015/textarea/textarea.component.js +89 -5
- package/dist/es2015/textbox/textbox.component.d.ts +40 -1
- package/dist/es2015/textbox/textbox.component.js +114 -30
- package/dist/es2015/textbox/textbox.directive.d.ts +1 -1
- package/dist/es2015/textbox/textbox.directive.js +3 -2
- package/dist/es2015/textbox.module.js +0 -3
- package/dist/fesm2015/index.js +1220 -654
- package/dist/fesm5/index.js +1276 -585
- package/dist/npm/checkbox/checkbox.directive.js +78 -2
- package/dist/npm/colorpicker/color-gradient.component.js +4 -1
- package/dist/npm/colorpicker/color-input.component.js +1 -1
- package/dist/npm/colorpicker/color-palette.component.js +6 -3
- package/dist/npm/colorpicker/colorpicker.component.js +313 -50
- package/dist/npm/colorpicker/flatcolorpicker-actions.component.js +1 -1
- package/dist/npm/colorpicker/flatcolorpicker-header.component.js +1 -1
- package/dist/npm/colorpicker/flatcolorpicker.component.js +7 -4
- package/dist/npm/common/models/fillmode.js +6 -0
- package/dist/npm/common/models/rounded.js +6 -0
- package/dist/npm/common/models/size.js +6 -0
- package/dist/npm/common/models/styling-classes.js +6 -0
- package/dist/npm/common/models.js +6 -0
- package/dist/npm/common/utils.js +37 -0
- package/dist/npm/main.js +0 -2
- package/dist/npm/maskedtextbox/maskedtextbox.component.js +100 -5
- package/dist/npm/numerictextbox/numerictextbox.component.js +115 -19
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/radiobutton/radiobutton.directive.js +54 -2
- package/dist/npm/shared/textarea.directive.js +3 -2
- package/dist/npm/slider/slider.component.js +1 -1
- package/dist/npm/switch/switch.component.js +166 -20
- package/dist/npm/text-fields-common/text-fields-base.js +1 -1
- package/dist/npm/textarea/textarea.component.js +100 -4
- package/dist/npm/textbox/textbox.component.js +107 -10
- package/dist/npm/textbox/textbox.directive.js +3 -2
- package/dist/npm/textbox.module.js +0 -3
- package/dist/systemjs/kendo-angular-inputs.js +1 -1
- package/package.json +12 -12
- package/dist/es/textbox/floating-label-input-adapter.js +0 -58
- package/dist/es/textbox/textbox-container.component.js +0 -224
- package/dist/es2015/textbox/floating-label-input-adapter.d.ts +0 -20
- package/dist/es2015/textbox/floating-label-input-adapter.js +0 -52
- package/dist/es2015/textbox/textbox-container.component.d.ts +0 -59
- package/dist/es2015/textbox/textbox-container.component.js +0 -209
- package/dist/npm/textbox/floating-label-input-adapter.js +0 -60
- package/dist/npm/textbox/textbox-container.component.js +0 -226
|
@@ -4,21 +4,23 @@
|
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import * as tslib_1 from "tslib";
|
|
6
6
|
var ColorPickerComponent_1;
|
|
7
|
-
import {
|
|
7
|
+
import { take } from 'rxjs/operators';
|
|
8
|
+
import { Component, HostBinding, Input, Output, EventEmitter, ViewChild, ElementRef, TemplateRef, ViewContainerRef, forwardRef, ChangeDetectorRef, NgZone, Renderer2 } from '@angular/core';
|
|
8
9
|
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
10
|
+
import { Subscription } from 'rxjs';
|
|
9
11
|
import { FlatColorPickerComponent } from './flatcolorpicker.component';
|
|
10
12
|
import { PopupService } from '@progress/kendo-angular-popup';
|
|
11
13
|
import { validatePackage } from '@progress/kendo-licensing';
|
|
12
|
-
import { Keys, KendoInput } from '@progress/kendo-angular-common';
|
|
14
|
+
import { Keys, KendoInput, isChanged, closest, guid } from '@progress/kendo-angular-common';
|
|
13
15
|
import { LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
|
|
14
16
|
import { packageMetadata } from '../package-metadata';
|
|
15
17
|
import { PALETTEPRESETS } from './models';
|
|
16
18
|
import { ActiveColorClickEvent, ColorPickerCloseEvent, ColorPickerOpenEvent } from './events';
|
|
17
19
|
import { parseColor } from './utils';
|
|
18
|
-
import { isPresent } from '../common/utils';
|
|
20
|
+
import { getStylingClasses, isPresent } from '../common/utils';
|
|
19
21
|
import { ColorPickerLocalizationService } from './localization/colorpicker-localization.service';
|
|
20
22
|
import { DEFAULT_ACCESSIBLE_PRESET, DEFAULT_PRESET } from './constants';
|
|
21
|
-
|
|
23
|
+
const DOM_FOCUS_EVENTS = ['focus', 'blur'];
|
|
22
24
|
/**
|
|
23
25
|
* Represents the [Kendo UI ColorPicker component for Angular]({% slug overview_colorpicker %}).
|
|
24
26
|
*
|
|
@@ -26,16 +28,15 @@ let serial = 0;
|
|
|
26
28
|
* which are rendered in its popup. It supports previewing the selected color, reverting it to its previous state or clearing it completely.
|
|
27
29
|
*/
|
|
28
30
|
let ColorPickerComponent = ColorPickerComponent_1 = class ColorPickerComponent {
|
|
29
|
-
constructor(popupService, cdr, localizationService, ngZone) {
|
|
31
|
+
constructor(host, popupService, cdr, localizationService, ngZone, renderer) {
|
|
32
|
+
this.host = host;
|
|
30
33
|
this.popupService = popupService;
|
|
31
34
|
this.cdr = cdr;
|
|
32
35
|
this.localizationService = localizationService;
|
|
33
36
|
this.ngZone = ngZone;
|
|
37
|
+
this.renderer = renderer;
|
|
34
38
|
this.hostClasses = true;
|
|
35
|
-
|
|
36
|
-
* @hidden
|
|
37
|
-
*/
|
|
38
|
-
this.focusableId = `k-colorpicker-${serial++}`;
|
|
39
|
+
this.role = 'listbox';
|
|
39
40
|
/**
|
|
40
41
|
* Specifies the views that will be rendered in the popup.
|
|
41
42
|
* By default both the gradient and palette views will be rendered.
|
|
@@ -131,17 +132,50 @@ let ColorPickerComponent = ColorPickerComponent_1 = class ColorPickerComponent {
|
|
|
131
132
|
* Used to provide a two-way binding for the `activeView` property.
|
|
132
133
|
*/
|
|
133
134
|
this.activeViewChange = new EventEmitter();
|
|
135
|
+
/**
|
|
136
|
+
* Indicates whether the ColorPicker wrapper is focused.
|
|
137
|
+
*/
|
|
138
|
+
this.isFocused = false;
|
|
134
139
|
this._tabindex = 0;
|
|
135
140
|
this._popupSettings = { animate: true };
|
|
136
141
|
this._paletteSettings = {};
|
|
137
142
|
this._gradientSettings = { opacity: true, delay: 0 };
|
|
143
|
+
this._size = 'medium';
|
|
144
|
+
this._rounded = 'medium';
|
|
145
|
+
this._fillMode = 'solid';
|
|
146
|
+
this.subscriptions = new Subscription();
|
|
138
147
|
this.notifyNgTouched = () => { };
|
|
139
148
|
this.notifyNgChanged = () => { };
|
|
149
|
+
this.domFocusListener = (event) => event.stopImmediatePropagation();
|
|
140
150
|
validatePackage(packageMetadata);
|
|
141
151
|
this.dynamicRTLSubscription = this.localizationService.changes.subscribe(({ rtl }) => {
|
|
142
152
|
this.direction = rtl ? 'rtl' : 'ltr';
|
|
143
153
|
});
|
|
144
154
|
}
|
|
155
|
+
get focusedClass() {
|
|
156
|
+
return this.isFocused;
|
|
157
|
+
}
|
|
158
|
+
get disabledClass() {
|
|
159
|
+
return this.disabled;
|
|
160
|
+
}
|
|
161
|
+
get ariaReadonly() {
|
|
162
|
+
return this.readonly;
|
|
163
|
+
}
|
|
164
|
+
get ariaExpanded() {
|
|
165
|
+
return this.isOpen;
|
|
166
|
+
}
|
|
167
|
+
get hostTabindex() {
|
|
168
|
+
return this.tabindex;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* @hidden
|
|
172
|
+
*/
|
|
173
|
+
set view(view) {
|
|
174
|
+
this.views = [view];
|
|
175
|
+
}
|
|
176
|
+
get view() {
|
|
177
|
+
return (this.views && this.views.length > 0) ? this.views[0] : null;
|
|
178
|
+
}
|
|
145
179
|
/**
|
|
146
180
|
* Specifies the value of the initially selected color.
|
|
147
181
|
*/
|
|
@@ -191,6 +225,58 @@ let ColorPickerComponent = ColorPickerComponent_1 = class ColorPickerComponent {
|
|
|
191
225
|
get tabindex() {
|
|
192
226
|
return !this.disabled ? this._tabindex : undefined;
|
|
193
227
|
}
|
|
228
|
+
/**
|
|
229
|
+
* The size property specifies the font size and line height of the ColorPicker
|
|
230
|
+
* ([see example]({% slug appearance_colorpicker %}#toc-size)).
|
|
231
|
+
*
|
|
232
|
+
* The possible values are:
|
|
233
|
+
* * `'small'`
|
|
234
|
+
* * `'medium'` (default)
|
|
235
|
+
* * `'large'`
|
|
236
|
+
* * `null`
|
|
237
|
+
*/
|
|
238
|
+
set size(size) {
|
|
239
|
+
this.handleClasses(size, 'size');
|
|
240
|
+
this._size = size;
|
|
241
|
+
}
|
|
242
|
+
get size() {
|
|
243
|
+
return this._size;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* The rounded property specifies the border radius of the ColorPicker
|
|
247
|
+
* ([see example]({% slug appearance_colorpicker %}#toc-rounded)).
|
|
248
|
+
*
|
|
249
|
+
* The possible values are:
|
|
250
|
+
* * `'small'`
|
|
251
|
+
* * `'medium'` (default)
|
|
252
|
+
* * `'large'`
|
|
253
|
+
* * `'full'`
|
|
254
|
+
* * `null`
|
|
255
|
+
*/
|
|
256
|
+
set rounded(rounded) {
|
|
257
|
+
this.handleClasses(rounded, 'rounded');
|
|
258
|
+
this._rounded = rounded;
|
|
259
|
+
}
|
|
260
|
+
get rounded() {
|
|
261
|
+
return this._rounded;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* The fillMode property specifies the background and border styles of the ColorPicker
|
|
265
|
+
* ([see example]({% slug appearance_colorpicker %}#toc-fillMode)).
|
|
266
|
+
*
|
|
267
|
+
* The possible values are:
|
|
268
|
+
* * `'flat'`
|
|
269
|
+
* * `'solid'` (default)
|
|
270
|
+
* * `'outline'`
|
|
271
|
+
* * `null`
|
|
272
|
+
*/
|
|
273
|
+
set fillMode(fillMode) {
|
|
274
|
+
this.handleClasses(fillMode, 'fillMode');
|
|
275
|
+
this._fillMode = fillMode;
|
|
276
|
+
}
|
|
277
|
+
get fillMode() {
|
|
278
|
+
return this._fillMode;
|
|
279
|
+
}
|
|
194
280
|
/**
|
|
195
281
|
* Indicates whether the ColorPicker popup is open.
|
|
196
282
|
*/
|
|
@@ -220,6 +306,15 @@ let ColorPickerComponent = ColorPickerComponent_1 = class ColorPickerComponent {
|
|
|
220
306
|
columns: this._paletteSettings.columns || presetColumns || 10
|
|
221
307
|
};
|
|
222
308
|
}
|
|
309
|
+
ngAfterViewInit() {
|
|
310
|
+
const stylingInputs = ['size', 'rounded', 'fillMode'];
|
|
311
|
+
stylingInputs.forEach(input => {
|
|
312
|
+
this.handleClasses(this[input], input);
|
|
313
|
+
});
|
|
314
|
+
this.setHostElementAriaLabel();
|
|
315
|
+
this.handleHostId();
|
|
316
|
+
this.initDomEvents();
|
|
317
|
+
}
|
|
223
318
|
ngOnChanges(changes) {
|
|
224
319
|
if (changes.format && changes.format.currentValue === 'name') {
|
|
225
320
|
this.activeView = 'palette';
|
|
@@ -228,18 +323,17 @@ let ColorPickerComponent = ColorPickerComponent_1 = class ColorPickerComponent {
|
|
|
228
323
|
this.format = 'rgba';
|
|
229
324
|
this.value = parseColor(this.value, this.format, this.gradientSettings.opacity);
|
|
230
325
|
}
|
|
326
|
+
if (isChanged('value', changes)) {
|
|
327
|
+
this.setHostElementAriaLabel();
|
|
328
|
+
}
|
|
231
329
|
}
|
|
232
330
|
ngOnDestroy() {
|
|
233
331
|
this.closePopup();
|
|
234
332
|
if (this.dynamicRTLSubscription) {
|
|
235
333
|
this.dynamicRTLSubscription.unsubscribe();
|
|
236
334
|
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
* @hidden
|
|
240
|
-
*/
|
|
241
|
-
get colorPickerAriaLabel() {
|
|
242
|
-
return this.value ? this.value : this.localizationService.get('colorPickerNoColor');
|
|
335
|
+
this.subscriptions.unsubscribe();
|
|
336
|
+
this.handleDomEvents('remove', DOM_FOCUS_EVENTS);
|
|
243
337
|
}
|
|
244
338
|
/**
|
|
245
339
|
* @hidden
|
|
@@ -251,28 +345,33 @@ let ColorPickerComponent = ColorPickerComponent_1 = class ColorPickerComponent {
|
|
|
251
345
|
* @hidden
|
|
252
346
|
*/
|
|
253
347
|
togglePopup() {
|
|
254
|
-
this.toggleWithEvents(!this.isOpen);
|
|
255
348
|
this.focus();
|
|
349
|
+
this.toggleWithEvents(!this.isOpen);
|
|
256
350
|
}
|
|
257
351
|
/**
|
|
258
352
|
* @hidden
|
|
259
353
|
*/
|
|
260
|
-
|
|
354
|
+
handleWrapperClick(event) {
|
|
355
|
+
if (this.disabled) {
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
261
358
|
this.focus();
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
359
|
+
if (closest(event.target, (element) => element === this.activeColor.nativeElement)) {
|
|
360
|
+
const event = new ActiveColorClickEvent(this.value);
|
|
361
|
+
this.activeColorClick.emit(event);
|
|
362
|
+
if (!event.isOpenPrevented() || this.isOpen) {
|
|
363
|
+
this.toggleWithEvents(!this.isOpen);
|
|
364
|
+
}
|
|
365
|
+
return;
|
|
266
366
|
}
|
|
367
|
+
this.toggleWithEvents(!this.isOpen);
|
|
267
368
|
}
|
|
268
369
|
/**
|
|
269
370
|
* Focuses the wrapper of the ColorPicker.
|
|
270
371
|
*/
|
|
271
372
|
focus() {
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
}
|
|
275
|
-
this.wrapper.nativeElement.focus();
|
|
373
|
+
this.isFocused = true;
|
|
374
|
+
this.host.nativeElement.focus();
|
|
276
375
|
}
|
|
277
376
|
/**
|
|
278
377
|
* @hidden
|
|
@@ -281,14 +380,18 @@ let ColorPickerComponent = ColorPickerComponent_1 = class ColorPickerComponent {
|
|
|
281
380
|
if (this.isFocused) {
|
|
282
381
|
return;
|
|
283
382
|
}
|
|
284
|
-
this.
|
|
285
|
-
|
|
383
|
+
this.ngZone.run(() => {
|
|
384
|
+
this.focus();
|
|
385
|
+
this.onFocus.emit();
|
|
386
|
+
});
|
|
286
387
|
}
|
|
287
388
|
/**
|
|
288
389
|
* Blurs the ColorPicker.
|
|
289
390
|
*/
|
|
290
391
|
blur() {
|
|
291
|
-
this.
|
|
392
|
+
this.isFocused = false;
|
|
393
|
+
this.host.nativeElement.blur();
|
|
394
|
+
this.notifyNgTouched();
|
|
292
395
|
}
|
|
293
396
|
/**
|
|
294
397
|
* @hidden
|
|
@@ -297,9 +400,16 @@ let ColorPickerComponent = ColorPickerComponent_1 = class ColorPickerComponent {
|
|
|
297
400
|
if (this.isOpen) {
|
|
298
401
|
return;
|
|
299
402
|
}
|
|
300
|
-
this.
|
|
301
|
-
|
|
302
|
-
|
|
403
|
+
this.ngZone.run(() => {
|
|
404
|
+
this.onBlur.emit();
|
|
405
|
+
this.isFocused = false;
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* @hidden
|
|
410
|
+
*/
|
|
411
|
+
arrowButtonMouseDown(ev) {
|
|
412
|
+
ev.preventDefault();
|
|
303
413
|
}
|
|
304
414
|
/**
|
|
305
415
|
* Clears the value of the ColorPicker.
|
|
@@ -309,6 +419,7 @@ let ColorPickerComponent = ColorPickerComponent_1 = class ColorPickerComponent {
|
|
|
309
419
|
return;
|
|
310
420
|
}
|
|
311
421
|
this._value = undefined;
|
|
422
|
+
this.setHostElementAriaLabel();
|
|
312
423
|
this.notifyNgChanged(undefined);
|
|
313
424
|
}
|
|
314
425
|
/**
|
|
@@ -336,6 +447,7 @@ let ColorPickerComponent = ColorPickerComponent_1 = class ColorPickerComponent {
|
|
|
336
447
|
if (valueChange) {
|
|
337
448
|
this.value = parsedColor;
|
|
338
449
|
this.valueChange.emit(parsedColor);
|
|
450
|
+
this.setHostElementAriaLabel();
|
|
339
451
|
this.notifyNgChanged(parsedColor);
|
|
340
452
|
}
|
|
341
453
|
}
|
|
@@ -382,7 +494,9 @@ let ColorPickerComponent = ColorPickerComponent_1 = class ColorPickerComponent {
|
|
|
382
494
|
handleWrapperKeyDown(event) {
|
|
383
495
|
if (event.keyCode === Keys.ArrowDown || event.keyCode === Keys.Enter) {
|
|
384
496
|
event.preventDefault();
|
|
385
|
-
this.
|
|
497
|
+
this.ngZone.run(() => {
|
|
498
|
+
this.toggleWithEvents(true);
|
|
499
|
+
});
|
|
386
500
|
}
|
|
387
501
|
}
|
|
388
502
|
/**
|
|
@@ -391,14 +505,14 @@ let ColorPickerComponent = ColorPickerComponent_1 = class ColorPickerComponent {
|
|
|
391
505
|
handlePopupKeyDown(event) {
|
|
392
506
|
if (event.keyCode === Keys.Escape) {
|
|
393
507
|
this.toggleWithEvents(false);
|
|
394
|
-
this.
|
|
508
|
+
this.host.nativeElement.focus();
|
|
395
509
|
}
|
|
396
510
|
if (event.keyCode === Keys.Tab) {
|
|
397
511
|
const currentElement = event.shiftKey ? this.firstFocusableElement.nativeElement : this.lastFocusableElement.nativeElement;
|
|
398
512
|
const nextElement = event.shiftKey ? this.lastFocusableElement.nativeElement : this.firstFocusableElement.nativeElement;
|
|
399
513
|
if (event.target === currentElement) {
|
|
400
514
|
event.preventDefault();
|
|
401
|
-
nextElement.
|
|
515
|
+
nextElement.focus();
|
|
402
516
|
}
|
|
403
517
|
}
|
|
404
518
|
}
|
|
@@ -409,10 +523,24 @@ let ColorPickerComponent = ColorPickerComponent_1 = class ColorPickerComponent {
|
|
|
409
523
|
isEmpty() {
|
|
410
524
|
return false;
|
|
411
525
|
}
|
|
526
|
+
setHostElementAriaLabel() {
|
|
527
|
+
const ariaLabelValue = `${this.value ? this.value : this.localizationService.get('colorPickerNoColor')}`;
|
|
528
|
+
this.renderer.setAttribute(this.host.nativeElement, 'aria-label', ariaLabelValue);
|
|
529
|
+
}
|
|
530
|
+
handleClasses(value, input) {
|
|
531
|
+
const elem = this.host.nativeElement;
|
|
532
|
+
const classes = getStylingClasses('picker', input, this[input], value);
|
|
533
|
+
if (classes.toRemove) {
|
|
534
|
+
this.renderer.removeClass(elem, classes.toRemove);
|
|
535
|
+
}
|
|
536
|
+
if (classes.toAdd) {
|
|
537
|
+
this.renderer.addClass(elem, classes.toAdd);
|
|
538
|
+
}
|
|
539
|
+
}
|
|
412
540
|
popupBlurInvalid(ev) {
|
|
413
|
-
const
|
|
414
|
-
const
|
|
415
|
-
return
|
|
541
|
+
const focusInFlatColorPickerElement = this.popupRef.popupElement.contains(ev.relatedTarget);
|
|
542
|
+
const hostClicked = closest(ev.relatedTarget, (element) => element === this.host.nativeElement);
|
|
543
|
+
return hostClicked || focusInFlatColorPickerElement;
|
|
416
544
|
}
|
|
417
545
|
toggleWithEvents(open) {
|
|
418
546
|
const sameState = this.isOpen === open;
|
|
@@ -436,12 +564,12 @@ let ColorPickerComponent = ColorPickerComponent_1 = class ColorPickerComponent {
|
|
|
436
564
|
}
|
|
437
565
|
}
|
|
438
566
|
focusFirstElement() {
|
|
439
|
-
this.ngZone.
|
|
440
|
-
|
|
567
|
+
this.ngZone.onStable.pipe(take(1)).subscribe(() => {
|
|
568
|
+
if (this.flatColorPicker) {
|
|
441
569
|
const elementToFocus = this.flatColorPicker.gradient ? this.flatColorPicker.gradient.gradientDragHandle :
|
|
442
570
|
this.flatColorPicker.palette.host;
|
|
443
571
|
elementToFocus.nativeElement.focus();
|
|
444
|
-
}
|
|
572
|
+
}
|
|
445
573
|
});
|
|
446
574
|
}
|
|
447
575
|
openPopup() {
|
|
@@ -449,7 +577,7 @@ let ColorPickerComponent = ColorPickerComponent_1 = class ColorPickerComponent {
|
|
|
449
577
|
const anchorPosition = { horizontal: horizontalAlign, vertical: "bottom" };
|
|
450
578
|
const popupPosition = { horizontal: horizontalAlign, vertical: "top" };
|
|
451
579
|
this.popupRef = this.popupService.open({
|
|
452
|
-
anchor: this.
|
|
580
|
+
anchor: this.activeColor,
|
|
453
581
|
animate: this.popupSettings.animate,
|
|
454
582
|
appendTo: this.popupSettings.appendTo,
|
|
455
583
|
popupAlign: popupPosition,
|
|
@@ -461,7 +589,7 @@ let ColorPickerComponent = ColorPickerComponent_1 = class ColorPickerComponent {
|
|
|
461
589
|
this.popupRef.popupAnchorViewportLeave.subscribe(() => {
|
|
462
590
|
this.toggleWithEvents(false);
|
|
463
591
|
if (!this.isOpen) {
|
|
464
|
-
this.
|
|
592
|
+
this.host.nativeElement.focus({
|
|
465
593
|
preventScroll: true
|
|
466
594
|
});
|
|
467
595
|
}
|
|
@@ -489,23 +617,101 @@ let ColorPickerComponent = ColorPickerComponent_1 = class ColorPickerComponent {
|
|
|
489
617
|
}
|
|
490
618
|
return this.gradientSettings.opacity ? this.flatColorPicker.gradient.inputs.opacityInput.numericInput : this.flatColorPicker.gradient.inputs.blueInput;
|
|
491
619
|
}
|
|
620
|
+
handleDomEvents(action, events) {
|
|
621
|
+
const hostElement = this.host.nativeElement;
|
|
622
|
+
events.forEach(ev => hostElement[`${action}EventListener`](ev, this.domFocusListener, true));
|
|
623
|
+
}
|
|
624
|
+
initDomEvents() {
|
|
625
|
+
if (!this.host) {
|
|
626
|
+
return;
|
|
627
|
+
}
|
|
628
|
+
let hostElement = this.host.nativeElement;
|
|
629
|
+
this.ngZone.runOutsideAngular(() => {
|
|
630
|
+
this.subscriptions.add(this.renderer.listen(hostElement, 'focusin', () => {
|
|
631
|
+
this.handleWrapperFocus();
|
|
632
|
+
}));
|
|
633
|
+
this.subscriptions.add(this.renderer.listen(hostElement, 'focusout', (event) => {
|
|
634
|
+
const closestPopup = this.popupRef ?
|
|
635
|
+
closest(event.relatedTarget, (element) => element === this.flatColorPicker.host.nativeElement) :
|
|
636
|
+
false;
|
|
637
|
+
const closestWrapper = closest(event.relatedTarget, (element) => element === this.host.nativeElement);
|
|
638
|
+
if (!closestPopup && !closestWrapper) {
|
|
639
|
+
this.handleWrapperBlur();
|
|
640
|
+
}
|
|
641
|
+
}));
|
|
642
|
+
this.handleDomEvents('add', DOM_FOCUS_EVENTS);
|
|
643
|
+
this.subscriptions.add(this.renderer.listen(hostElement, 'keydown', (event) => {
|
|
644
|
+
this.handleWrapperKeyDown(event);
|
|
645
|
+
}));
|
|
646
|
+
this.subscriptions.add(this.renderer.listen(hostElement, 'click', (event) => {
|
|
647
|
+
this.ngZone.run(() => {
|
|
648
|
+
this.handleWrapperClick(event);
|
|
649
|
+
});
|
|
650
|
+
}));
|
|
651
|
+
});
|
|
652
|
+
}
|
|
653
|
+
handleHostId() {
|
|
654
|
+
const hostElement = this.host.nativeElement;
|
|
655
|
+
const existingId = hostElement.getAttribute('id');
|
|
656
|
+
if (existingId) {
|
|
657
|
+
this.focusableId = existingId;
|
|
658
|
+
}
|
|
659
|
+
else {
|
|
660
|
+
const id = `k-${guid()}`;
|
|
661
|
+
hostElement.setAttribute('id', id);
|
|
662
|
+
this.focusableId = id;
|
|
663
|
+
}
|
|
664
|
+
}
|
|
492
665
|
};
|
|
493
666
|
tslib_1.__decorate([
|
|
494
667
|
HostBinding('class.k-colorpicker'),
|
|
668
|
+
HostBinding('class.k-icon-picker'),
|
|
669
|
+
HostBinding('class.k-picker'),
|
|
495
670
|
tslib_1.__metadata("design:type", Boolean)
|
|
496
671
|
], ColorPickerComponent.prototype, "hostClasses", void 0);
|
|
672
|
+
tslib_1.__decorate([
|
|
673
|
+
HostBinding('class.k-focus'),
|
|
674
|
+
tslib_1.__metadata("design:type", Boolean),
|
|
675
|
+
tslib_1.__metadata("design:paramtypes", [])
|
|
676
|
+
], ColorPickerComponent.prototype, "focusedClass", null);
|
|
677
|
+
tslib_1.__decorate([
|
|
678
|
+
HostBinding('attr.aria-disabled'),
|
|
679
|
+
HostBinding('class.k-disabled'),
|
|
680
|
+
tslib_1.__metadata("design:type", Boolean),
|
|
681
|
+
tslib_1.__metadata("design:paramtypes", [])
|
|
682
|
+
], ColorPickerComponent.prototype, "disabledClass", null);
|
|
683
|
+
tslib_1.__decorate([
|
|
684
|
+
HostBinding('attr.aria-readonly'),
|
|
685
|
+
tslib_1.__metadata("design:type", Boolean),
|
|
686
|
+
tslib_1.__metadata("design:paramtypes", [])
|
|
687
|
+
], ColorPickerComponent.prototype, "ariaReadonly", null);
|
|
688
|
+
tslib_1.__decorate([
|
|
689
|
+
HostBinding('attr.aria-expanded'),
|
|
690
|
+
tslib_1.__metadata("design:type", Boolean),
|
|
691
|
+
tslib_1.__metadata("design:paramtypes", [])
|
|
692
|
+
], ColorPickerComponent.prototype, "ariaExpanded", null);
|
|
693
|
+
tslib_1.__decorate([
|
|
694
|
+
HostBinding('attr.tabindex'),
|
|
695
|
+
tslib_1.__metadata("design:type", Number),
|
|
696
|
+
tslib_1.__metadata("design:paramtypes", [])
|
|
697
|
+
], ColorPickerComponent.prototype, "hostTabindex", null);
|
|
497
698
|
tslib_1.__decorate([
|
|
498
699
|
HostBinding('attr.dir'),
|
|
499
700
|
tslib_1.__metadata("design:type", String)
|
|
500
701
|
], ColorPickerComponent.prototype, "direction", void 0);
|
|
501
702
|
tslib_1.__decorate([
|
|
502
|
-
|
|
703
|
+
HostBinding('attr.role'),
|
|
503
704
|
tslib_1.__metadata("design:type", String)
|
|
504
|
-
], ColorPickerComponent.prototype, "
|
|
705
|
+
], ColorPickerComponent.prototype, "role", void 0);
|
|
505
706
|
tslib_1.__decorate([
|
|
506
707
|
Input(),
|
|
507
708
|
tslib_1.__metadata("design:type", Array)
|
|
508
709
|
], ColorPickerComponent.prototype, "views", void 0);
|
|
710
|
+
tslib_1.__decorate([
|
|
711
|
+
Input(),
|
|
712
|
+
tslib_1.__metadata("design:type", String),
|
|
713
|
+
tslib_1.__metadata("design:paramtypes", [String])
|
|
714
|
+
], ColorPickerComponent.prototype, "view", null);
|
|
509
715
|
tslib_1.__decorate([
|
|
510
716
|
Input(),
|
|
511
717
|
tslib_1.__metadata("design:type", String)
|
|
@@ -567,6 +773,21 @@ tslib_1.__decorate([
|
|
|
567
773
|
Input(),
|
|
568
774
|
tslib_1.__metadata("design:type", String)
|
|
569
775
|
], ColorPickerComponent.prototype, "actionsLayout", void 0);
|
|
776
|
+
tslib_1.__decorate([
|
|
777
|
+
Input(),
|
|
778
|
+
tslib_1.__metadata("design:type", String),
|
|
779
|
+
tslib_1.__metadata("design:paramtypes", [String])
|
|
780
|
+
], ColorPickerComponent.prototype, "size", null);
|
|
781
|
+
tslib_1.__decorate([
|
|
782
|
+
Input(),
|
|
783
|
+
tslib_1.__metadata("design:type", String),
|
|
784
|
+
tslib_1.__metadata("design:paramtypes", [String])
|
|
785
|
+
], ColorPickerComponent.prototype, "rounded", null);
|
|
786
|
+
tslib_1.__decorate([
|
|
787
|
+
Input(),
|
|
788
|
+
tslib_1.__metadata("design:type", String),
|
|
789
|
+
tslib_1.__metadata("design:paramtypes", [String])
|
|
790
|
+
], ColorPickerComponent.prototype, "fillMode", null);
|
|
570
791
|
tslib_1.__decorate([
|
|
571
792
|
Output(),
|
|
572
793
|
tslib_1.__metadata("design:type", EventEmitter)
|
|
@@ -604,9 +825,9 @@ tslib_1.__decorate([
|
|
|
604
825
|
tslib_1.__metadata("design:type", ViewContainerRef)
|
|
605
826
|
], ColorPickerComponent.prototype, "container", void 0);
|
|
606
827
|
tslib_1.__decorate([
|
|
607
|
-
ViewChild('
|
|
828
|
+
ViewChild('activeColor', { static: true }),
|
|
608
829
|
tslib_1.__metadata("design:type", ElementRef)
|
|
609
|
-
], ColorPickerComponent.prototype, "
|
|
830
|
+
], ColorPickerComponent.prototype, "activeColor", void 0);
|
|
610
831
|
tslib_1.__decorate([
|
|
611
832
|
ViewChild('popupTemplate', { static: true }),
|
|
612
833
|
tslib_1.__metadata("design:type", TemplateRef)
|
|
@@ -672,35 +893,21 @@ ColorPickerComponent = ColorPickerComponent_1 = tslib_1.__decorate([
|
|
|
672
893
|
i18n-cancelButton="kendo.colorpicker.cancelButton|The message for the Cancel action button."
|
|
673
894
|
cancelButton="Cancel">
|
|
674
895
|
</ng-container>
|
|
675
|
-
<span
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
'k-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
}"
|
|
682
|
-
role="listbox"
|
|
683
|
-
[attr.aria-expanded]="isOpen"
|
|
684
|
-
[attr.aria-readonly]="readonly"
|
|
685
|
-
[attr.aria-disabled]="disabled"
|
|
686
|
-
[attr.aria-label]="colorPickerAriaLabel"
|
|
687
|
-
[id]="focusableId"
|
|
688
|
-
[attr.tabindex]="tabindex"
|
|
689
|
-
(focus)="handleWrapperFocus()"
|
|
690
|
-
(blur)="handleWrapperBlur()"
|
|
691
|
-
(mousedown)="$event.preventDefault()"
|
|
692
|
-
(keydown)="handleWrapperKeyDown($event)"
|
|
693
|
-
>
|
|
694
|
-
<span *ngIf="!iconStyles" class="k-selected-color" [style.background]="value" (click)="handleActiveColorClick()">
|
|
695
|
-
<span class="k-icon k-i-line" *ngIf="!value"></span>
|
|
696
|
-
</span>
|
|
697
|
-
<span *ngIf="iconStyles" class="k-tool-icon" [ngClass]="iconStyles" (click)="handleActiveColorClick()">
|
|
698
|
-
<span class="k-selected-color" [style.background-color]="value"></span>
|
|
699
|
-
</span>
|
|
700
|
-
<span class="k-select" (click)="togglePopup()">
|
|
701
|
-
<span class="k-icon k-i-arrow-s"></span>
|
|
896
|
+
<span #activeColor class="k-input-inner">
|
|
897
|
+
<span
|
|
898
|
+
class="k-value-icon k-color-preview"
|
|
899
|
+
[ngClass]="{'k-icon-color-preview': iconStyles, 'k-no-color': !value}">
|
|
900
|
+
<span *ngIf="iconClass || icon" class="k-color-preview-icon k-icon" [ngClass]="iconStyles"></span>
|
|
901
|
+
<span class="k-color-preview-mask" [style.background-color]="value"></span>
|
|
702
902
|
</span>
|
|
703
903
|
</span>
|
|
904
|
+
<button
|
|
905
|
+
#arrowButton
|
|
906
|
+
tabindex="-1"
|
|
907
|
+
role="button"
|
|
908
|
+
class="k-input-button k-button k-button-md k-button-solid k-button-solid-base k-icon-button">
|
|
909
|
+
<span class="k-button-icon k-icon k-i-arrow-s"></span>
|
|
910
|
+
</button>
|
|
704
911
|
<ng-template #popupTemplate>
|
|
705
912
|
<kendo-flatcolorpicker
|
|
706
913
|
#flatColorPicker
|
|
@@ -713,8 +920,8 @@ ColorPickerComponent = ColorPickerComponent_1 = tslib_1.__decorate([
|
|
|
713
920
|
[gradientSettings]="gradientSettings"
|
|
714
921
|
[paletteSettings]="paletteSettings"
|
|
715
922
|
[clearButton]="clearButton"
|
|
716
|
-
(focusout)="handlePopupBlur($event)"
|
|
717
923
|
(cancel)="handleCancelEvent($event)"
|
|
924
|
+
(focusout)="handlePopupBlur($event)"
|
|
718
925
|
(valueChange)="handleValueChange($event)"
|
|
719
926
|
(keydown)="handlePopupKeyDown($event)"
|
|
720
927
|
(activeViewChange)="activeViewChange.emit($event)"
|
|
@@ -724,9 +931,11 @@ ColorPickerComponent = ColorPickerComponent_1 = tslib_1.__decorate([
|
|
|
724
931
|
<ng-container #container></ng-container>
|
|
725
932
|
`
|
|
726
933
|
}),
|
|
727
|
-
tslib_1.__metadata("design:paramtypes", [
|
|
934
|
+
tslib_1.__metadata("design:paramtypes", [ElementRef,
|
|
935
|
+
PopupService,
|
|
728
936
|
ChangeDetectorRef,
|
|
729
937
|
LocalizationService,
|
|
730
|
-
NgZone
|
|
938
|
+
NgZone,
|
|
939
|
+
Renderer2])
|
|
731
940
|
], ColorPickerComponent);
|
|
732
941
|
export { ColorPickerComponent };
|
|
@@ -44,12 +44,12 @@ FlatColorPickerActionButtonsComponent = tslib_1.__decorate([
|
|
|
44
44
|
selector: '[kendoFlatColorPickerActionButtons]',
|
|
45
45
|
template: `
|
|
46
46
|
<button
|
|
47
|
-
class="k-coloreditor-cancel k-button"
|
|
47
|
+
class="k-coloreditor-cancel k-button k-button-md k-button-solid k-button-solid-base"
|
|
48
48
|
[attr.title]="getText('cancelButton')"
|
|
49
49
|
(click)="onActionButtonClick('cancel', $event)"
|
|
50
50
|
>{{getText('cancelButton')}}</button>
|
|
51
51
|
<button #last
|
|
52
|
-
class="k-coloreditor-apply k-button k-primary"
|
|
52
|
+
class="k-coloreditor-apply k-button k-button-md k-button-solid k-button-solid-primary"
|
|
53
53
|
[attr.title]="getText('applyButton')"
|
|
54
54
|
(click)="onActionButtonClick('apply', $event)"
|
|
55
55
|
>{{getText('applyButton')}}</button>
|
|
@@ -88,7 +88,7 @@ FlatColorPickerHeaderComponent = tslib_1.__decorate([
|
|
|
88
88
|
<button *ngFor="let view of views"
|
|
89
89
|
#viewButtons
|
|
90
90
|
(click)="onViewButtonClick(view)"
|
|
91
|
-
class="k-button k-
|
|
91
|
+
class="k-button k-button-md k-button-flat k-button-flat-base k-icon-button"
|
|
92
92
|
[attr.title]="getText(view === 'gradient' ? 'gradientView' : 'paletteView')"
|
|
93
93
|
[attr.aria-label]="getText(view === 'gradient' ? 'gradientView' : 'paletteView')"
|
|
94
94
|
[attr.aria-pressed]="activeView === view"
|
|
@@ -105,7 +105,7 @@ FlatColorPickerHeaderComponent = tslib_1.__decorate([
|
|
|
105
105
|
<div class="k-coloreditor-header-actions k-hstack">
|
|
106
106
|
<button *ngIf="clearButton"
|
|
107
107
|
#clearButton
|
|
108
|
-
class="k-button k-
|
|
108
|
+
class="k-button k-button-md k-button-flat k-button-flat-base k-icon-button k-coloreditor-reset"
|
|
109
109
|
[attr.aria-label]="getText('clearButton')"
|
|
110
110
|
[attr.title]="getText('clearButton')"
|
|
111
111
|
(click)="clearButtonClick.emit()">
|
|
@@ -19,8 +19,8 @@ import { FlatColorPickerActionButtonsComponent } from './flatcolorpicker-actions
|
|
|
19
19
|
* through a gradient that renders an hsv canvas. It supports previewing the selected color, reverting it to its previous state or clearing it completely.
|
|
20
20
|
*/
|
|
21
21
|
export declare class FlatColorPickerComponent implements OnInit, AfterViewInit, OnDestroy, ControlValueAccessor {
|
|
22
|
+
host: ElementRef;
|
|
22
23
|
private service;
|
|
23
|
-
private host;
|
|
24
24
|
private localizationService;
|
|
25
25
|
private cdr;
|
|
26
26
|
private renderer;
|
|
@@ -140,7 +140,7 @@ export declare class FlatColorPickerComponent implements OnInit, AfterViewInit,
|
|
|
140
140
|
private _paletteSettings;
|
|
141
141
|
private dynamicRTLSubscription;
|
|
142
142
|
private subscriptions;
|
|
143
|
-
constructor(
|
|
143
|
+
constructor(host: ElementRef, service: FlatColorPickerService, localizationService: LocalizationService, cdr: ChangeDetectorRef, renderer: Renderer2, ngZone: NgZone);
|
|
144
144
|
ngOnInit(): void;
|
|
145
145
|
ngAfterViewInit(): void;
|
|
146
146
|
ngOnChanges(changes: SimpleChanges): void;
|