@progress/kendo-angular-inputs 8.0.0-dev.202112251033 → 8.0.0-dev.202201190602
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/LICENSE.md +1 -1
- package/NOTICE.txt +119 -79
- package/README.md +1 -1
- package/dist/cdn/js/kendo-angular-inputs.js +1 -1
- package/dist/cdn/main.js +1 -1
- package/dist/es/colorpicker/color-gradient.component.js +3 -0
- 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 +189 -49
- package/dist/es/colorpicker/flatcolorpicker.component.js +7 -4
- package/dist/es/maskedtextbox/maskedtextbox.component.js +1 -1
- package/dist/es/numerictextbox/numerictextbox.component.js +1 -1
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/radiobutton/radiobutton.directive.js +3 -0
- package/dist/es/rangeslider/rangeslider-model.js +4 -7
- package/dist/es/rangeslider/rangeslider.component.js +1 -1
- package/dist/es/slider/slider-model.js +3 -5
- package/dist/es/slider/slider.component.js +2 -2
- package/dist/es/sliders-common/slider-model.base.js +7 -10
- package/dist/es/sliders-common/slider-ticks.component.js +3 -10
- package/dist/es/sliders-common/sliders-util.js +2 -3
- package/dist/es/switch/switch.component.js +1 -1
- package/dist/es/textarea/textarea.component.js +3 -2
- package/dist/es/textbox/textbox.component.js +2 -2
- package/dist/es2015/colorpicker/color-gradient.component.js +3 -0
- package/dist/es2015/colorpicker/color-input.component.js +1 -1
- 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 +19 -7
- package/dist/es2015/colorpicker/colorpicker.component.js +168 -70
- package/dist/es2015/colorpicker/flatcolorpicker.component.d.ts +2 -2
- package/dist/es2015/colorpicker/flatcolorpicker.component.js +7 -4
- package/dist/es2015/index.metadata.json +1 -1
- package/dist/es2015/maskedtextbox/maskedtextbox.component.d.ts +1 -1
- package/dist/es2015/maskedtextbox/maskedtextbox.component.js +1 -1
- package/dist/es2015/numerictextbox/numerictextbox.component.d.ts +1 -1
- package/dist/es2015/numerictextbox/numerictextbox.component.js +1 -1
- package/dist/es2015/package-metadata.js +1 -1
- package/dist/es2015/radiobutton/radiobutton.directive.js +3 -0
- package/dist/es2015/rangeslider/rangeslider-model.js +4 -7
- package/dist/es2015/rangeslider/rangeslider.component.js +55 -54
- package/dist/es2015/slider/slider-model.d.ts +1 -1
- package/dist/es2015/slider/slider-model.js +3 -5
- package/dist/es2015/slider/slider.component.js +56 -59
- package/dist/es2015/sliders-common/slider-model.base.js +7 -10
- package/dist/es2015/sliders-common/slider-ticks.component.d.ts +0 -2
- package/dist/es2015/sliders-common/slider-ticks.component.js +6 -10
- package/dist/es2015/sliders-common/sliders-util.d.ts +2 -2
- package/dist/es2015/sliders-common/sliders-util.js +2 -3
- package/dist/es2015/switch/switch.component.d.ts +1 -1
- package/dist/es2015/switch/switch.component.js +1 -1
- package/dist/es2015/textarea/textarea.component.d.ts +1 -1
- package/dist/es2015/textarea/textarea.component.js +10 -2
- package/dist/es2015/textbox/textbox.component.d.ts +1 -1
- package/dist/es2015/textbox/textbox.component.js +19 -20
- package/dist/fesm2015/index.js +369 -285
- package/dist/fesm5/index.js +258 -140
- package/dist/npm/colorpicker/color-gradient.component.js +3 -0
- 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 +188 -48
- package/dist/npm/colorpicker/flatcolorpicker.component.js +7 -4
- package/dist/npm/maskedtextbox/maskedtextbox.component.js +1 -1
- package/dist/npm/numerictextbox/numerictextbox.component.js +1 -1
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/radiobutton/radiobutton.directive.js +3 -0
- package/dist/npm/rangeslider/rangeslider-model.js +4 -7
- package/dist/npm/rangeslider/rangeslider.component.js +1 -1
- package/dist/npm/slider/slider-model.js +3 -5
- package/dist/npm/slider/slider.component.js +2 -2
- package/dist/npm/sliders-common/slider-model.base.js +6 -9
- package/dist/npm/sliders-common/slider-ticks.component.js +2 -9
- package/dist/npm/sliders-common/sliders-util.js +2 -3
- package/dist/npm/switch/switch.component.js +1 -1
- package/dist/npm/textarea/textarea.component.js +3 -2
- package/dist/npm/textbox/textbox.component.js +2 -2
- package/dist/systemjs/kendo-angular-inputs.js +1 -1
- package/package.json +6 -6
|
@@ -4,12 +4,14 @@
|
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import * as tslib_1 from "tslib";
|
|
6
6
|
var ColorPickerComponent_1;
|
|
7
|
+
import { take } from 'rxjs/operators';
|
|
7
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';
|
|
@@ -18,7 +20,7 @@ import { parseColor } from './utils';
|
|
|
18
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
|
*
|
|
@@ -34,10 +36,7 @@ let ColorPickerComponent = ColorPickerComponent_1 = class ColorPickerComponent {
|
|
|
34
36
|
this.ngZone = ngZone;
|
|
35
37
|
this.renderer = renderer;
|
|
36
38
|
this.hostClasses = true;
|
|
37
|
-
|
|
38
|
-
* @hidden
|
|
39
|
-
*/
|
|
40
|
-
this.focusableId = `k-colorpicker-${serial++}`;
|
|
39
|
+
this.role = 'listbox';
|
|
41
40
|
/**
|
|
42
41
|
* Specifies the views that will be rendered in the popup.
|
|
43
42
|
* By default both the gradient and palette views will be rendered.
|
|
@@ -133,6 +132,10 @@ let ColorPickerComponent = ColorPickerComponent_1 = class ColorPickerComponent {
|
|
|
133
132
|
* Used to provide a two-way binding for the `activeView` property.
|
|
134
133
|
*/
|
|
135
134
|
this.activeViewChange = new EventEmitter();
|
|
135
|
+
/**
|
|
136
|
+
* Indicates whether the ColorPicker wrapper is focused.
|
|
137
|
+
*/
|
|
138
|
+
this.isFocused = false;
|
|
136
139
|
this._tabindex = 0;
|
|
137
140
|
this._popupSettings = { animate: true };
|
|
138
141
|
this._paletteSettings = {};
|
|
@@ -140,13 +143,30 @@ let ColorPickerComponent = ColorPickerComponent_1 = class ColorPickerComponent {
|
|
|
140
143
|
this._size = 'medium';
|
|
141
144
|
this._rounded = 'medium';
|
|
142
145
|
this._fillMode = 'solid';
|
|
146
|
+
this.subscriptions = new Subscription();
|
|
143
147
|
this.notifyNgTouched = () => { };
|
|
144
148
|
this.notifyNgChanged = () => { };
|
|
149
|
+
this.domFocusListener = (event) => event.stopImmediatePropagation();
|
|
145
150
|
validatePackage(packageMetadata);
|
|
146
151
|
this.dynamicRTLSubscription = this.localizationService.changes.subscribe(({ rtl }) => {
|
|
147
152
|
this.direction = rtl ? 'rtl' : 'ltr';
|
|
148
153
|
});
|
|
149
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
|
+
}
|
|
150
170
|
/**
|
|
151
171
|
* @hidden
|
|
152
172
|
*/
|
|
@@ -206,7 +226,7 @@ let ColorPickerComponent = ColorPickerComponent_1 = class ColorPickerComponent {
|
|
|
206
226
|
return !this.disabled ? this._tabindex : undefined;
|
|
207
227
|
}
|
|
208
228
|
/**
|
|
209
|
-
* The size property specifies the
|
|
229
|
+
* The size property specifies the padding of the ColorPicker internal elements
|
|
210
230
|
* ([see example]({% slug appearance_colorpicker %}#toc-size)).
|
|
211
231
|
*
|
|
212
232
|
* The possible values are:
|
|
@@ -291,6 +311,9 @@ let ColorPickerComponent = ColorPickerComponent_1 = class ColorPickerComponent {
|
|
|
291
311
|
stylingInputs.forEach(input => {
|
|
292
312
|
this.handleClasses(this[input], input);
|
|
293
313
|
});
|
|
314
|
+
this.setHostElementAriaLabel();
|
|
315
|
+
this.handleHostId();
|
|
316
|
+
this.initDomEvents();
|
|
294
317
|
}
|
|
295
318
|
ngOnChanges(changes) {
|
|
296
319
|
if (changes.format && changes.format.currentValue === 'name') {
|
|
@@ -300,18 +323,17 @@ let ColorPickerComponent = ColorPickerComponent_1 = class ColorPickerComponent {
|
|
|
300
323
|
this.format = 'rgba';
|
|
301
324
|
this.value = parseColor(this.value, this.format, this.gradientSettings.opacity);
|
|
302
325
|
}
|
|
326
|
+
if (isChanged('value', changes)) {
|
|
327
|
+
this.setHostElementAriaLabel();
|
|
328
|
+
}
|
|
303
329
|
}
|
|
304
330
|
ngOnDestroy() {
|
|
305
331
|
this.closePopup();
|
|
306
332
|
if (this.dynamicRTLSubscription) {
|
|
307
333
|
this.dynamicRTLSubscription.unsubscribe();
|
|
308
334
|
}
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
* @hidden
|
|
312
|
-
*/
|
|
313
|
-
get colorPickerAriaLabel() {
|
|
314
|
-
return this.value ? this.value : this.localizationService.get('colorPickerNoColor');
|
|
335
|
+
this.subscriptions.unsubscribe();
|
|
336
|
+
this.handleDomEvents('remove', DOM_FOCUS_EVENTS);
|
|
315
337
|
}
|
|
316
338
|
/**
|
|
317
339
|
* @hidden
|
|
@@ -323,28 +345,33 @@ let ColorPickerComponent = ColorPickerComponent_1 = class ColorPickerComponent {
|
|
|
323
345
|
* @hidden
|
|
324
346
|
*/
|
|
325
347
|
togglePopup() {
|
|
326
|
-
this.toggleWithEvents(!this.isOpen);
|
|
327
348
|
this.focus();
|
|
349
|
+
this.toggleWithEvents(!this.isOpen);
|
|
328
350
|
}
|
|
329
351
|
/**
|
|
330
352
|
* @hidden
|
|
331
353
|
*/
|
|
332
|
-
|
|
354
|
+
handleWrapperClick(event) {
|
|
355
|
+
if (this.disabled) {
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
333
358
|
this.focus();
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
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;
|
|
338
366
|
}
|
|
367
|
+
this.toggleWithEvents(!this.isOpen);
|
|
339
368
|
}
|
|
340
369
|
/**
|
|
341
370
|
* Focuses the wrapper of the ColorPicker.
|
|
342
371
|
*/
|
|
343
372
|
focus() {
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
}
|
|
347
|
-
this.wrapper.nativeElement.focus();
|
|
373
|
+
this.isFocused = true;
|
|
374
|
+
this.host.nativeElement.focus();
|
|
348
375
|
}
|
|
349
376
|
/**
|
|
350
377
|
* @hidden
|
|
@@ -353,14 +380,18 @@ let ColorPickerComponent = ColorPickerComponent_1 = class ColorPickerComponent {
|
|
|
353
380
|
if (this.isFocused) {
|
|
354
381
|
return;
|
|
355
382
|
}
|
|
356
|
-
this.
|
|
357
|
-
|
|
383
|
+
this.ngZone.run(() => {
|
|
384
|
+
this.focus();
|
|
385
|
+
this.onFocus.emit();
|
|
386
|
+
});
|
|
358
387
|
}
|
|
359
388
|
/**
|
|
360
389
|
* Blurs the ColorPicker.
|
|
361
390
|
*/
|
|
362
391
|
blur() {
|
|
363
|
-
this.
|
|
392
|
+
this.isFocused = false;
|
|
393
|
+
this.host.nativeElement.blur();
|
|
394
|
+
this.notifyNgTouched();
|
|
364
395
|
}
|
|
365
396
|
/**
|
|
366
397
|
* @hidden
|
|
@@ -369,9 +400,16 @@ let ColorPickerComponent = ColorPickerComponent_1 = class ColorPickerComponent {
|
|
|
369
400
|
if (this.isOpen) {
|
|
370
401
|
return;
|
|
371
402
|
}
|
|
372
|
-
this.
|
|
373
|
-
|
|
374
|
-
|
|
403
|
+
this.ngZone.run(() => {
|
|
404
|
+
this.onBlur.emit();
|
|
405
|
+
this.isFocused = false;
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* @hidden
|
|
410
|
+
*/
|
|
411
|
+
arrowButtonMouseDown(ev) {
|
|
412
|
+
ev.preventDefault();
|
|
375
413
|
}
|
|
376
414
|
/**
|
|
377
415
|
* Clears the value of the ColorPicker.
|
|
@@ -381,6 +419,7 @@ let ColorPickerComponent = ColorPickerComponent_1 = class ColorPickerComponent {
|
|
|
381
419
|
return;
|
|
382
420
|
}
|
|
383
421
|
this._value = undefined;
|
|
422
|
+
this.setHostElementAriaLabel();
|
|
384
423
|
this.notifyNgChanged(undefined);
|
|
385
424
|
}
|
|
386
425
|
/**
|
|
@@ -408,6 +447,7 @@ let ColorPickerComponent = ColorPickerComponent_1 = class ColorPickerComponent {
|
|
|
408
447
|
if (valueChange) {
|
|
409
448
|
this.value = parsedColor;
|
|
410
449
|
this.valueChange.emit(parsedColor);
|
|
450
|
+
this.setHostElementAriaLabel();
|
|
411
451
|
this.notifyNgChanged(parsedColor);
|
|
412
452
|
}
|
|
413
453
|
}
|
|
@@ -454,7 +494,9 @@ let ColorPickerComponent = ColorPickerComponent_1 = class ColorPickerComponent {
|
|
|
454
494
|
handleWrapperKeyDown(event) {
|
|
455
495
|
if (event.keyCode === Keys.ArrowDown || event.keyCode === Keys.Enter) {
|
|
456
496
|
event.preventDefault();
|
|
457
|
-
this.
|
|
497
|
+
this.ngZone.run(() => {
|
|
498
|
+
this.toggleWithEvents(true);
|
|
499
|
+
});
|
|
458
500
|
}
|
|
459
501
|
}
|
|
460
502
|
/**
|
|
@@ -463,14 +505,14 @@ let ColorPickerComponent = ColorPickerComponent_1 = class ColorPickerComponent {
|
|
|
463
505
|
handlePopupKeyDown(event) {
|
|
464
506
|
if (event.keyCode === Keys.Escape) {
|
|
465
507
|
this.toggleWithEvents(false);
|
|
466
|
-
this.
|
|
508
|
+
this.host.nativeElement.focus();
|
|
467
509
|
}
|
|
468
510
|
if (event.keyCode === Keys.Tab) {
|
|
469
511
|
const currentElement = event.shiftKey ? this.firstFocusableElement.nativeElement : this.lastFocusableElement.nativeElement;
|
|
470
512
|
const nextElement = event.shiftKey ? this.lastFocusableElement.nativeElement : this.firstFocusableElement.nativeElement;
|
|
471
513
|
if (event.target === currentElement) {
|
|
472
514
|
event.preventDefault();
|
|
473
|
-
nextElement.
|
|
515
|
+
nextElement.focus();
|
|
474
516
|
}
|
|
475
517
|
}
|
|
476
518
|
}
|
|
@@ -481,6 +523,10 @@ let ColorPickerComponent = ColorPickerComponent_1 = class ColorPickerComponent {
|
|
|
481
523
|
isEmpty() {
|
|
482
524
|
return false;
|
|
483
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
|
+
}
|
|
484
530
|
handleClasses(value, input) {
|
|
485
531
|
const elem = this.host.nativeElement;
|
|
486
532
|
const classes = getStylingClasses('picker', input, this[input], value);
|
|
@@ -492,9 +538,9 @@ let ColorPickerComponent = ColorPickerComponent_1 = class ColorPickerComponent {
|
|
|
492
538
|
}
|
|
493
539
|
}
|
|
494
540
|
popupBlurInvalid(ev) {
|
|
495
|
-
const
|
|
496
|
-
const
|
|
497
|
-
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;
|
|
498
544
|
}
|
|
499
545
|
toggleWithEvents(open) {
|
|
500
546
|
const sameState = this.isOpen === open;
|
|
@@ -518,12 +564,12 @@ let ColorPickerComponent = ColorPickerComponent_1 = class ColorPickerComponent {
|
|
|
518
564
|
}
|
|
519
565
|
}
|
|
520
566
|
focusFirstElement() {
|
|
521
|
-
this.ngZone.
|
|
522
|
-
|
|
567
|
+
this.ngZone.onStable.pipe(take(1)).subscribe(() => {
|
|
568
|
+
if (this.flatColorPicker) {
|
|
523
569
|
const elementToFocus = this.flatColorPicker.gradient ? this.flatColorPicker.gradient.gradientDragHandle :
|
|
524
570
|
this.flatColorPicker.palette.host;
|
|
525
571
|
elementToFocus.nativeElement.focus();
|
|
526
|
-
}
|
|
572
|
+
}
|
|
527
573
|
});
|
|
528
574
|
}
|
|
529
575
|
openPopup() {
|
|
@@ -531,7 +577,7 @@ let ColorPickerComponent = ColorPickerComponent_1 = class ColorPickerComponent {
|
|
|
531
577
|
const anchorPosition = { horizontal: horizontalAlign, vertical: "bottom" };
|
|
532
578
|
const popupPosition = { horizontal: horizontalAlign, vertical: "top" };
|
|
533
579
|
this.popupRef = this.popupService.open({
|
|
534
|
-
anchor: this.
|
|
580
|
+
anchor: this.activeColor,
|
|
535
581
|
animate: this.popupSettings.animate,
|
|
536
582
|
appendTo: this.popupSettings.appendTo,
|
|
537
583
|
popupAlign: popupPosition,
|
|
@@ -543,7 +589,7 @@ let ColorPickerComponent = ColorPickerComponent_1 = class ColorPickerComponent {
|
|
|
543
589
|
this.popupRef.popupAnchorViewportLeave.subscribe(() => {
|
|
544
590
|
this.toggleWithEvents(false);
|
|
545
591
|
if (!this.isOpen) {
|
|
546
|
-
this.
|
|
592
|
+
this.host.nativeElement.focus({
|
|
547
593
|
preventScroll: true
|
|
548
594
|
});
|
|
549
595
|
}
|
|
@@ -571,6 +617,51 @@ let ColorPickerComponent = ColorPickerComponent_1 = class ColorPickerComponent {
|
|
|
571
617
|
}
|
|
572
618
|
return this.gradientSettings.opacity ? this.flatColorPicker.gradient.inputs.opacityInput.numericInput : this.flatColorPicker.gradient.inputs.blueInput;
|
|
573
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
|
+
}
|
|
574
665
|
};
|
|
575
666
|
tslib_1.__decorate([
|
|
576
667
|
HostBinding('class.k-colorpicker'),
|
|
@@ -578,14 +669,40 @@ tslib_1.__decorate([
|
|
|
578
669
|
HostBinding('class.k-picker'),
|
|
579
670
|
tslib_1.__metadata("design:type", Boolean)
|
|
580
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);
|
|
581
698
|
tslib_1.__decorate([
|
|
582
699
|
HostBinding('attr.dir'),
|
|
583
700
|
tslib_1.__metadata("design:type", String)
|
|
584
701
|
], ColorPickerComponent.prototype, "direction", void 0);
|
|
585
702
|
tslib_1.__decorate([
|
|
586
|
-
|
|
703
|
+
HostBinding('attr.role'),
|
|
587
704
|
tslib_1.__metadata("design:type", String)
|
|
588
|
-
], ColorPickerComponent.prototype, "
|
|
705
|
+
], ColorPickerComponent.prototype, "role", void 0);
|
|
589
706
|
tslib_1.__decorate([
|
|
590
707
|
Input(),
|
|
591
708
|
tslib_1.__metadata("design:type", Array)
|
|
@@ -708,9 +825,9 @@ tslib_1.__decorate([
|
|
|
708
825
|
tslib_1.__metadata("design:type", ViewContainerRef)
|
|
709
826
|
], ColorPickerComponent.prototype, "container", void 0);
|
|
710
827
|
tslib_1.__decorate([
|
|
711
|
-
ViewChild('
|
|
828
|
+
ViewChild('activeColor', { static: true }),
|
|
712
829
|
tslib_1.__metadata("design:type", ElementRef)
|
|
713
|
-
], ColorPickerComponent.prototype, "
|
|
830
|
+
], ColorPickerComponent.prototype, "activeColor", void 0);
|
|
714
831
|
tslib_1.__decorate([
|
|
715
832
|
ViewChild('popupTemplate', { static: true }),
|
|
716
833
|
tslib_1.__metadata("design:type", TemplateRef)
|
|
@@ -776,38 +893,19 @@ ColorPickerComponent = ColorPickerComponent_1 = tslib_1.__decorate([
|
|
|
776
893
|
i18n-cancelButton="kendo.colorpicker.cancelButton|The message for the Cancel action button."
|
|
777
894
|
cancelButton="Cancel">
|
|
778
895
|
</ng-container>
|
|
779
|
-
<span
|
|
780
|
-
#wrapper
|
|
781
|
-
[ngClass]="{
|
|
782
|
-
'k-input-inner': true,
|
|
783
|
-
'k-disabled': this.disabled,
|
|
784
|
-
'k-focus': this.isFocused
|
|
785
|
-
}"
|
|
786
|
-
role="listbox"
|
|
787
|
-
[attr.aria-expanded]="isOpen"
|
|
788
|
-
[attr.aria-readonly]="readonly"
|
|
789
|
-
[attr.aria-disabled]="disabled"
|
|
790
|
-
[attr.aria-label]="colorPickerAriaLabel"
|
|
791
|
-
[id]="focusableId"
|
|
792
|
-
[attr.tabindex]="tabindex"
|
|
793
|
-
(focus)="handleWrapperFocus()"
|
|
794
|
-
(blur)="handleWrapperBlur()"
|
|
795
|
-
(mousedown)="$event.preventDefault()"
|
|
796
|
-
(keydown)="handleWrapperKeyDown($event)"
|
|
797
|
-
>
|
|
896
|
+
<span #activeColor class="k-input-inner">
|
|
798
897
|
<span
|
|
799
898
|
class="k-value-icon k-color-preview"
|
|
800
|
-
[ngClass]="{'k-icon-color-preview': iconStyles, 'k-no-color': !value}"
|
|
801
|
-
(click)="handleActiveColorClick()">
|
|
899
|
+
[ngClass]="{'k-icon-color-preview': iconStyles, 'k-no-color': !value}">
|
|
802
900
|
<span *ngIf="iconClass || icon" class="k-color-preview-icon k-icon" [ngClass]="iconStyles"></span>
|
|
803
901
|
<span class="k-color-preview-mask" [style.background-color]="value"></span>
|
|
804
902
|
</span>
|
|
805
903
|
</span>
|
|
806
904
|
<button
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
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">
|
|
811
909
|
<span class="k-button-icon k-icon k-i-arrow-s"></span>
|
|
812
910
|
</button>
|
|
813
911
|
<ng-template #popupTemplate>
|
|
@@ -822,8 +920,8 @@ ColorPickerComponent = ColorPickerComponent_1 = tslib_1.__decorate([
|
|
|
822
920
|
[gradientSettings]="gradientSettings"
|
|
823
921
|
[paletteSettings]="paletteSettings"
|
|
824
922
|
[clearButton]="clearButton"
|
|
825
|
-
(focusout)="handlePopupBlur($event)"
|
|
826
923
|
(cancel)="handleCancelEvent($event)"
|
|
924
|
+
(focusout)="handlePopupBlur($event)"
|
|
827
925
|
(valueChange)="handleValueChange($event)"
|
|
828
926
|
(keydown)="handlePopupKeyDown($event)"
|
|
829
927
|
(activeViewChange)="activeViewChange.emit($event)"
|
|
@@ -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;
|
|
@@ -9,8 +9,10 @@ import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
|
9
9
|
import { Subscription } from 'rxjs';
|
|
10
10
|
import { L10N_PREFIX, LocalizationService } from '@progress/kendo-angular-l10n';
|
|
11
11
|
import { isChanged, KendoInput } from '@progress/kendo-angular-common';
|
|
12
|
+
import { validatePackage } from "@progress/kendo-licensing";
|
|
12
13
|
import { FlatColorPickerLocalizationService } from './localization/flatcolorpicker-localization.service';
|
|
13
14
|
import { FlatColorPickerService } from './services/flatcolorpicker.service';
|
|
15
|
+
import { packageMetadata } from "../package-metadata";
|
|
14
16
|
import { ColorPickerCancelEvent } from './events';
|
|
15
17
|
import { parseColor } from './utils';
|
|
16
18
|
import { isPresent } from '../common/utils';
|
|
@@ -25,9 +27,9 @@ import { FlatColorPickerActionButtonsComponent } from './flatcolorpicker-actions
|
|
|
25
27
|
* 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
28
|
*/
|
|
27
29
|
let FlatColorPickerComponent = FlatColorPickerComponent_1 = class FlatColorPickerComponent {
|
|
28
|
-
constructor(
|
|
29
|
-
this.service = service;
|
|
30
|
+
constructor(host, service, localizationService, cdr, renderer, ngZone) {
|
|
30
31
|
this.host = host;
|
|
32
|
+
this.service = service;
|
|
31
33
|
this.localizationService = localizationService;
|
|
32
34
|
this.cdr = cdr;
|
|
33
35
|
this.renderer = renderer;
|
|
@@ -110,6 +112,7 @@ let FlatColorPickerComponent = FlatColorPickerComponent_1 = class FlatColorPicke
|
|
|
110
112
|
this.subscriptions = new Subscription();
|
|
111
113
|
this.notifyNgChanged = () => { };
|
|
112
114
|
this.notifyNgTouched = () => { };
|
|
115
|
+
validatePackage(packageMetadata);
|
|
113
116
|
this.dynamicRTLSubscription = this.localizationService.changes.subscribe(({ rtl }) => {
|
|
114
117
|
this.direction = rtl ? 'rtl' : 'ltr';
|
|
115
118
|
});
|
|
@@ -583,8 +586,8 @@ FlatColorPickerComponent = FlatColorPickerComponent_1 = tslib_1.__decorate([
|
|
|
583
586
|
</div>
|
|
584
587
|
`
|
|
585
588
|
}),
|
|
586
|
-
tslib_1.__metadata("design:paramtypes", [
|
|
587
|
-
|
|
589
|
+
tslib_1.__metadata("design:paramtypes", [ElementRef,
|
|
590
|
+
FlatColorPickerService,
|
|
588
591
|
LocalizationService,
|
|
589
592
|
ChangeDetectorRef,
|
|
590
593
|
Renderer2,
|