@progress/kendo-angular-inputs 7.4.0-dev.202109021544 → 7.5.0-dev.202110261427
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/colorpicker/color-gradient.component.js +19 -7
- package/dist/es/colorpicker/color-input.component.js +36 -8
- package/dist/es/colorpicker/color-palette.component.js +13 -11
- package/dist/es/colorpicker/constants.js +24 -0
- package/dist/es/colorpicker/contrast-validation.component.js +57 -0
- package/dist/es/colorpicker/contrast.component.js +72 -0
- package/dist/es/colorpicker/localization/messages.js +12 -0
- package/dist/es/colorpicker/models/rgb.js +4 -0
- package/dist/es/colorpicker/utils/color-parser.js +52 -0
- package/dist/es/colorpicker.module.js +5 -1
- package/dist/es/index.js +2 -0
- package/dist/es/numerictextbox/numerictextbox.component.js +2 -2
- package/dist/es/numerictextbox/utils.js +8 -0
- package/dist/es/package-metadata.js +1 -1
- package/dist/es2015/colorpicker/color-gradient.component.d.ts +9 -0
- package/dist/es2015/colorpicker/color-gradient.component.js +46 -15
- package/dist/es2015/colorpicker/color-input.component.d.ts +14 -6
- package/dist/es2015/colorpicker/color-input.component.js +123 -87
- package/dist/es2015/colorpicker/color-palette.component.d.ts +14 -5
- package/dist/es2015/colorpicker/color-palette.component.js +19 -16
- package/dist/es2015/colorpicker/constants.d.ts +25 -0
- package/dist/es2015/colorpicker/constants.js +24 -0
- package/dist/es2015/colorpicker/contrast-validation.component.d.ts +18 -0
- package/dist/es2015/colorpicker/contrast-validation.component.js +54 -0
- package/dist/es2015/colorpicker/contrast.component.d.ts +21 -0
- package/dist/es2015/colorpicker/contrast.component.js +72 -0
- package/dist/es2015/colorpicker/localization/messages.d.ts +12 -0
- package/dist/es2015/colorpicker/localization/messages.js +12 -0
- package/dist/es2015/colorpicker/models/rgb.d.ts +12 -0
- package/dist/es2015/colorpicker/models/rgb.js +4 -0
- package/dist/es2015/colorpicker/utils/color-parser.d.ts +25 -0
- package/dist/es2015/colorpicker/utils/color-parser.js +52 -0
- package/dist/es2015/colorpicker.module.js +5 -1
- package/dist/es2015/index.d.ts +2 -0
- package/dist/es2015/index.js +2 -0
- package/dist/es2015/index.metadata.json +1 -1
- package/dist/es2015/numerictextbox/numerictextbox.component.js +2 -2
- package/dist/es2015/numerictextbox/utils.d.ts +4 -0
- package/dist/es2015/numerictextbox/utils.js +8 -0
- package/dist/es2015/package-metadata.js +1 -1
- package/dist/fesm2015/index.js +394 -121
- package/dist/fesm5/index.js +276 -28
- package/dist/npm/colorpicker/color-gradient.component.js +24 -12
- package/dist/npm/colorpicker/color-input.component.js +35 -7
- package/dist/npm/colorpicker/color-palette.component.js +13 -11
- package/dist/npm/colorpicker/constants.js +26 -0
- package/dist/npm/colorpicker/contrast-validation.component.js +59 -0
- package/dist/npm/colorpicker/contrast.component.js +74 -0
- package/dist/npm/colorpicker/localization/messages.js +12 -0
- package/dist/npm/colorpicker/models/rgb.js +6 -0
- package/dist/npm/colorpicker/utils/color-parser.js +52 -0
- package/dist/npm/colorpicker.module.js +5 -1
- package/dist/npm/index.js +4 -0
- package/dist/npm/numerictextbox/numerictextbox.component.js +1 -1
- package/dist/npm/numerictextbox/utils.js +8 -0
- package/dist/npm/package-metadata.js +1 -1
- package/dist/systemjs/kendo-angular-inputs.js +1 -1
- package/package.json +4 -4
|
@@ -11,15 +11,13 @@ import { isPresent, fitIntoBounds } from '../common/utils';
|
|
|
11
11
|
import { isChanged, isDocumentAvailable, KendoInput } from '@progress/kendo-angular-common';
|
|
12
12
|
import { containsFocus, isUntouched } from '../common/dom-utils';
|
|
13
13
|
import { SliderComponent } from '../slider/slider.component';
|
|
14
|
-
const DEFAULT_OUTPUT_FORMAT = 'rgba';
|
|
15
|
-
const DEFAULT_BACKGROUND_COLOR = 'rgba(255, 0, 0, 1)';
|
|
16
14
|
import { LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
|
|
17
15
|
import { Subject } from 'rxjs';
|
|
18
16
|
import { ColorGradientLocalizationService } from './localization/colorgradient-localization.service';
|
|
19
17
|
import { ColorInputComponent } from './color-input.component';
|
|
20
18
|
import { throttleTime } from 'rxjs/operators';
|
|
19
|
+
import { DEFAULT_GRADIENT_BACKGROUND_COLOR, DEFAULT_OUTPUT_FORMAT, DRAGHANDLE_MOVE_SPEED } from './constants';
|
|
21
20
|
let serial = 0;
|
|
22
|
-
const DRAGHANDLE_MOVE_SPEED = 5;
|
|
23
21
|
/**
|
|
24
22
|
* The ColorGradient component enables smooth color transitions and provides options for selecting specific colors over the drag handle.
|
|
25
23
|
* The ColorGradient is independently used by `kendo-colorpicker` and can be directly added to the page.
|
|
@@ -68,7 +66,7 @@ let ColorGradientComponent = ColorGradientComponent_1 = class ColorGradientCompo
|
|
|
68
66
|
/**
|
|
69
67
|
* @hidden
|
|
70
68
|
*/
|
|
71
|
-
this.backgroundColor =
|
|
69
|
+
this.backgroundColor = DEFAULT_GRADIENT_BACKGROUND_COLOR;
|
|
72
70
|
/**
|
|
73
71
|
* @hidden
|
|
74
72
|
*
|
|
@@ -162,6 +160,12 @@ let ColorGradientComponent = ColorGradientComponent_1 = class ColorGradientCompo
|
|
|
162
160
|
get gradientRect() {
|
|
163
161
|
return this.gradientWrapper.nativeElement.getBoundingClientRect();
|
|
164
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* @hidden
|
|
165
|
+
*/
|
|
166
|
+
get contrastToolVisible() {
|
|
167
|
+
return typeof this.contrastTool === 'string' && this.contrastTool !== '';
|
|
168
|
+
}
|
|
165
169
|
ngAfterViewInit() {
|
|
166
170
|
this.updateUI();
|
|
167
171
|
this.cdr.detectChanges();
|
|
@@ -452,8 +456,7 @@ let ColorGradientComponent = ColorGradientComponent_1 = class ColorGradientCompo
|
|
|
452
456
|
}
|
|
453
457
|
};
|
|
454
458
|
tslib_1.__decorate([
|
|
455
|
-
HostBinding('class.k-
|
|
456
|
-
HostBinding('class.k-flatcolorpicker'),
|
|
459
|
+
HostBinding('class.k-colorgradient'),
|
|
457
460
|
tslib_1.__metadata("design:type", Boolean)
|
|
458
461
|
], ColorGradientComponent.prototype, "hostClasses", void 0);
|
|
459
462
|
tslib_1.__decorate([
|
|
@@ -509,6 +512,10 @@ tslib_1.__decorate([
|
|
|
509
512
|
tslib_1.__metadata("design:type", String),
|
|
510
513
|
tslib_1.__metadata("design:paramtypes", [String])
|
|
511
514
|
], ColorGradientComponent.prototype, "value", null);
|
|
515
|
+
tslib_1.__decorate([
|
|
516
|
+
Input(),
|
|
517
|
+
tslib_1.__metadata("design:type", String)
|
|
518
|
+
], ColorGradientComponent.prototype, "contrastTool", void 0);
|
|
512
519
|
tslib_1.__decorate([
|
|
513
520
|
Input(),
|
|
514
521
|
tslib_1.__metadata("design:type", Number),
|
|
@@ -582,10 +589,16 @@ ColorGradientComponent = ColorGradientComponent_1 = tslib_1.__decorate([
|
|
|
582
589
|
i18n-blueInputPlaceholder="kendo.colorgradient.blueInputPlaceholder|The placeholder for the blue color input."
|
|
583
590
|
blueInputPlaceholder="Blue"
|
|
584
591
|
i18n-alphaInputPlaceholder="kendo.colorgradient.alphaInputPlaceholder|The placeholder for the alpha input."
|
|
585
|
-
alphaInputPlaceholder="Alpha"
|
|
592
|
+
alphaInputPlaceholder="Alpha"
|
|
593
|
+
i18n-passContrast="kendo.colorgradient.passContrast|The pass message for the contrast tool."
|
|
594
|
+
passContrast="Pass"
|
|
595
|
+
i18n-failContrast="kendo.colorgradient.failContrast|The fail message for the contrast tool."
|
|
596
|
+
failContrast="Fail"
|
|
597
|
+
i18n-contrastRatio="kendo.colorgradient.contrastRatio|The contrast ratio message for the contrast tool."
|
|
598
|
+
contrastRatio="Contrast ratio">
|
|
586
599
|
</ng-container>
|
|
587
|
-
<div class="k-
|
|
588
|
-
<div class="k-hsv-rectangle" [style.background
|
|
600
|
+
<div class="k-colorgradient-canvas k-hstack">
|
|
601
|
+
<div class="k-hsv-rectangle" [style.background]="backgroundColor">
|
|
589
602
|
<div
|
|
590
603
|
#gradientWrapper
|
|
591
604
|
kendoDraggable
|
|
@@ -596,7 +609,7 @@ ColorGradientComponent = ColorGradientComponent_1 = tslib_1.__decorate([
|
|
|
596
609
|
(kendoRelease)="onHandleRelease()">
|
|
597
610
|
<div
|
|
598
611
|
#gradientDragHandle
|
|
599
|
-
class="k-draghandle"
|
|
612
|
+
class="k-hsv-draghandle k-draghandle"
|
|
600
613
|
tabindex="0"
|
|
601
614
|
[attr.title]="colorGradientHandleTitle"
|
|
602
615
|
[attr.aria-label]="colorGradientHandleAriaLabel"
|
|
@@ -604,8 +617,8 @@ ColorGradientComponent = ColorGradientComponent_1 = tslib_1.__decorate([
|
|
|
604
617
|
</div>
|
|
605
618
|
</div>
|
|
606
619
|
</div>
|
|
607
|
-
<div class="k-
|
|
608
|
-
<span class="k-clear-color k-button k-
|
|
620
|
+
<div class="k-hsv-controls k-hstack {{ clearButton ? 'k-sliders-wrap-clearable' : '' }}">
|
|
621
|
+
<span class="k-clear-color k-button k-flat k-button-icon"
|
|
609
622
|
*ngIf="clearButton"
|
|
610
623
|
(click)="reset()"
|
|
611
624
|
(keydown.enter)="reset()"
|
|
@@ -616,7 +629,8 @@ ColorGradientComponent = ColorGradientComponent_1 = tslib_1.__decorate([
|
|
|
616
629
|
<span class="k-icon k-i-reset-color"></span>
|
|
617
630
|
</span>
|
|
618
631
|
<kendo-slider
|
|
619
|
-
|
|
632
|
+
[ngClass]="{'k-align-self-end': clearButton}"
|
|
633
|
+
class="k-hue-slider k-colorgradient-slider"
|
|
620
634
|
[dragHandleTitle]="hueSliderTitle"
|
|
621
635
|
[disabled]="disabled"
|
|
622
636
|
[readonly]="readonly"
|
|
@@ -634,7 +648,8 @@ ColorGradientComponent = ColorGradientComponent_1 = tslib_1.__decorate([
|
|
|
634
648
|
<kendo-slider
|
|
635
649
|
*ngIf="opacity && format === 'rgba'"
|
|
636
650
|
#alphaSlider
|
|
637
|
-
|
|
651
|
+
[ngClass]="{'k-align-self-end': clearButton}"
|
|
652
|
+
class="k-alpha-slider k-colorgradient-slider"
|
|
638
653
|
[dragHandleTitle]="opacitySliderTitle"
|
|
639
654
|
[disabled]="disabled"
|
|
640
655
|
[readonly]="readonly"
|
|
@@ -653,13 +668,29 @@ ColorGradientComponent = ColorGradientComponent_1 = tslib_1.__decorate([
|
|
|
653
668
|
</div>
|
|
654
669
|
<kendo-colorinput #inputs
|
|
655
670
|
[opacity]="opacity"
|
|
671
|
+
[formatView]="format"
|
|
656
672
|
[value]="value"
|
|
657
673
|
[disabled]="disabled"
|
|
658
674
|
[readonly]="readonly"
|
|
659
675
|
(valueChange)="handleInputsValueChange($event)"
|
|
660
676
|
>
|
|
661
677
|
</kendo-colorinput>
|
|
662
|
-
|
|
678
|
+
<div class="k-colorgradient-color-contrast k-vbox" *ngIf="contrastToolVisible"
|
|
679
|
+
kendoContrastTool
|
|
680
|
+
[value]="value"
|
|
681
|
+
[ratio]="contrastTool">
|
|
682
|
+
</div>
|
|
683
|
+
`,
|
|
684
|
+
styles: [`
|
|
685
|
+
.k-clear-color {
|
|
686
|
+
position: absolute;
|
|
687
|
+
left: 50%;
|
|
688
|
+
transform: translateX(-50%);
|
|
689
|
+
}
|
|
690
|
+
.k-align-self-end {
|
|
691
|
+
height: 140px;
|
|
692
|
+
}
|
|
693
|
+
`]
|
|
663
694
|
}),
|
|
664
695
|
tslib_1.__metadata("design:paramtypes", [ElementRef,
|
|
665
696
|
NgZone,
|
|
@@ -2,15 +2,20 @@
|
|
|
2
2
|
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { OnChanges, SimpleChanges, EventEmitter, ElementRef } from '@angular/core';
|
|
5
|
+
import { OnChanges, SimpleChanges, EventEmitter, ElementRef, AfterViewInit, Renderer2 } from '@angular/core';
|
|
6
6
|
import { RGBA } from './models';
|
|
7
7
|
import { LocalizationService } from '@progress/kendo-angular-l10n';
|
|
8
8
|
/**
|
|
9
9
|
* @hidden
|
|
10
10
|
*/
|
|
11
|
-
export declare class ColorInputComponent implements OnChanges {
|
|
11
|
+
export declare class ColorInputComponent implements AfterViewInit, OnChanges {
|
|
12
12
|
private localization;
|
|
13
13
|
private host;
|
|
14
|
+
private renderer;
|
|
15
|
+
/**
|
|
16
|
+
* The color format view.
|
|
17
|
+
*/
|
|
18
|
+
formatView: string;
|
|
14
19
|
/**
|
|
15
20
|
* The color value that will be parsed and populate the hex & rgba inputs.
|
|
16
21
|
* Required input property.
|
|
@@ -34,6 +39,7 @@ export declare class ColorInputComponent implements OnChanges {
|
|
|
34
39
|
valueChange: EventEmitter<string>;
|
|
35
40
|
colorInputClass: boolean;
|
|
36
41
|
opacityInput: ElementRef;
|
|
42
|
+
toggleFormatButton: ElementRef;
|
|
37
43
|
/**
|
|
38
44
|
* The rgba inputs values.
|
|
39
45
|
*/
|
|
@@ -47,14 +53,16 @@ export declare class ColorInputComponent implements OnChanges {
|
|
|
47
53
|
* Indicates whether any of the rgba inputs have value.
|
|
48
54
|
*/
|
|
49
55
|
private readonly rgbaInputValid;
|
|
50
|
-
|
|
56
|
+
private subscriptions;
|
|
57
|
+
constructor(localization: LocalizationService, host: ElementRef, renderer: Renderer2);
|
|
58
|
+
ngAfterViewInit(): void;
|
|
59
|
+
ngOnDestroy(): void;
|
|
51
60
|
ngOnChanges(changes: SimpleChanges): void;
|
|
52
61
|
handleRgbaValueChange(): void;
|
|
53
62
|
handleHexValueChange(hex: string): void;
|
|
54
63
|
handleRgbaInputBlur(): void;
|
|
55
64
|
handleHexInputBlur(): void;
|
|
56
|
-
/**
|
|
57
|
-
* @hidden
|
|
58
|
-
*/
|
|
59
65
|
textFor(key: string): string;
|
|
66
|
+
private toggleFormatView;
|
|
67
|
+
private initDomEvents;
|
|
60
68
|
}
|
|
@@ -3,18 +3,20 @@
|
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import * as tslib_1 from "tslib";
|
|
6
|
-
import { Component, Input, Output, EventEmitter, ElementRef, HostBinding, ViewChild } from '@angular/core';
|
|
6
|
+
import { Component, Input, Output, EventEmitter, ElementRef, HostBinding, ViewChild, Renderer2 } from '@angular/core';
|
|
7
7
|
import { getRGBA, parseColor, getColorFromRGBA } from './utils';
|
|
8
8
|
import { isPresent } from '../common/utils';
|
|
9
9
|
import { isDocumentAvailable } from '@progress/kendo-angular-common';
|
|
10
10
|
import { LocalizationService } from '@progress/kendo-angular-l10n';
|
|
11
|
+
import { Subscription } from 'rxjs';
|
|
11
12
|
/**
|
|
12
13
|
* @hidden
|
|
13
14
|
*/
|
|
14
15
|
let ColorInputComponent = class ColorInputComponent {
|
|
15
|
-
constructor(localization, host) {
|
|
16
|
+
constructor(localization, host, renderer) {
|
|
16
17
|
this.localization = localization;
|
|
17
18
|
this.host = host;
|
|
19
|
+
this.renderer = renderer;
|
|
18
20
|
/**
|
|
19
21
|
* Sets whether the alpha slider will be shown.
|
|
20
22
|
*/
|
|
@@ -36,6 +38,7 @@ let ColorInputComponent = class ColorInputComponent {
|
|
|
36
38
|
* The rgba inputs values.
|
|
37
39
|
*/
|
|
38
40
|
this.rgba = {};
|
|
41
|
+
this.subscriptions = new Subscription();
|
|
39
42
|
}
|
|
40
43
|
/**
|
|
41
44
|
* Indicates whether any of the inputs are focused.
|
|
@@ -53,6 +56,14 @@ let ColorInputComponent = class ColorInputComponent {
|
|
|
53
56
|
get rgbaInputValid() {
|
|
54
57
|
return Object.keys(this.rgba).every(key => isPresent(this.rgba[key]));
|
|
55
58
|
}
|
|
59
|
+
ngAfterViewInit() {
|
|
60
|
+
this.initDomEvents();
|
|
61
|
+
}
|
|
62
|
+
ngOnDestroy() {
|
|
63
|
+
if (this.subscriptions) {
|
|
64
|
+
this.subscriptions.unsubscribe();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
56
67
|
ngOnChanges(changes) {
|
|
57
68
|
if (isPresent(changes.value) && !this.isFocused) {
|
|
58
69
|
this.hex = parseColor(this.value, 'hex');
|
|
@@ -88,13 +99,23 @@ let ColorInputComponent = class ColorInputComponent {
|
|
|
88
99
|
handleHexInputBlur() {
|
|
89
100
|
this.hex = parseColor(this.value, 'hex');
|
|
90
101
|
}
|
|
91
|
-
/**
|
|
92
|
-
* @hidden
|
|
93
|
-
*/
|
|
94
102
|
textFor(key) {
|
|
95
103
|
return this.localization.get(key);
|
|
96
104
|
}
|
|
105
|
+
toggleFormatView() {
|
|
106
|
+
this.formatView = this.formatView === 'hex' ? 'rgba' : 'hex';
|
|
107
|
+
}
|
|
108
|
+
initDomEvents() {
|
|
109
|
+
if (!this.host) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
this.subscriptions.add(this.renderer.listen(this.toggleFormatButton.nativeElement, 'click', () => this.toggleFormatView()));
|
|
113
|
+
}
|
|
97
114
|
};
|
|
115
|
+
tslib_1.__decorate([
|
|
116
|
+
Input(),
|
|
117
|
+
tslib_1.__metadata("design:type", String)
|
|
118
|
+
], ColorInputComponent.prototype, "formatView", void 0);
|
|
98
119
|
tslib_1.__decorate([
|
|
99
120
|
Input(),
|
|
100
121
|
tslib_1.__metadata("design:type", String)
|
|
@@ -116,101 +137,116 @@ tslib_1.__decorate([
|
|
|
116
137
|
tslib_1.__metadata("design:type", EventEmitter)
|
|
117
138
|
], ColorInputComponent.prototype, "valueChange", void 0);
|
|
118
139
|
tslib_1.__decorate([
|
|
119
|
-
HostBinding('class.k-
|
|
140
|
+
HostBinding('class.k-colorgradient-inputs'),
|
|
141
|
+
HostBinding('class.k-hstack'),
|
|
120
142
|
tslib_1.__metadata("design:type", Boolean)
|
|
121
143
|
], ColorInputComponent.prototype, "colorInputClass", void 0);
|
|
122
144
|
tslib_1.__decorate([
|
|
123
145
|
ViewChild('opacityInput', { read: ElementRef, static: false }),
|
|
124
146
|
tslib_1.__metadata("design:type", ElementRef)
|
|
125
147
|
], ColorInputComponent.prototype, "opacityInput", void 0);
|
|
148
|
+
tslib_1.__decorate([
|
|
149
|
+
ViewChild('toggleFormatButton', { static: false }),
|
|
150
|
+
tslib_1.__metadata("design:type", ElementRef)
|
|
151
|
+
], ColorInputComponent.prototype, "toggleFormatButton", void 0);
|
|
126
152
|
ColorInputComponent = tslib_1.__decorate([
|
|
127
153
|
Component({
|
|
128
154
|
selector: 'kendo-colorinput',
|
|
129
155
|
template: `
|
|
130
|
-
<div class="k-
|
|
131
|
-
<
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
[disabled]="disabled"
|
|
135
|
-
[readonly]="readonly"
|
|
136
|
-
[value]="hex || ''"
|
|
137
|
-
[placeholder]="textFor('hexInputPlaceholder')"
|
|
138
|
-
(blur)="handleHexInputBlur()"
|
|
139
|
-
(input)="handleHexValueChange(hexInput.value)"
|
|
140
|
-
/>
|
|
141
|
-
<kendo-numerictextbox
|
|
142
|
-
[disabled]="disabled"
|
|
143
|
-
[readonly]="readonly"
|
|
144
|
-
[min]="0"
|
|
145
|
-
[max]="255"
|
|
146
|
-
[placeholder]="textFor('redInputPlaceholder')"
|
|
147
|
-
[(value)]="rgba.r"
|
|
148
|
-
[autoCorrect]="true"
|
|
149
|
-
[spinners]="false"
|
|
150
|
-
[format]="'n'"
|
|
151
|
-
[decimals]="0"
|
|
152
|
-
(blur)="handleRgbaInputBlur()"
|
|
153
|
-
(valueChange)="handleRgbaValueChange()"
|
|
154
|
-
>
|
|
155
|
-
</kendo-numerictextbox>
|
|
156
|
-
<kendo-numerictextbox
|
|
157
|
-
[disabled]="disabled"
|
|
158
|
-
[readonly]="readonly"
|
|
159
|
-
[min]="0"
|
|
160
|
-
[max]="255"
|
|
161
|
-
[placeholder]="textFor('greenInputPlaceholder')"
|
|
162
|
-
[(value)]="rgba.g"
|
|
163
|
-
[autoCorrect]="true"
|
|
164
|
-
[spinners]="false"
|
|
165
|
-
[format]="'n'"
|
|
166
|
-
[decimals]="0"
|
|
167
|
-
(blur)="handleRgbaInputBlur()"
|
|
168
|
-
(valueChange)="handleRgbaValueChange()"
|
|
169
|
-
>
|
|
170
|
-
</kendo-numerictextbox>
|
|
171
|
-
<kendo-numerictextbox
|
|
172
|
-
[disabled]="disabled"
|
|
173
|
-
[readonly]="readonly"
|
|
174
|
-
[min]="0"
|
|
175
|
-
[max]="255"
|
|
176
|
-
[placeholder]="textFor('blueInputPlaceholder')"
|
|
177
|
-
[(value)]="rgba.b"
|
|
178
|
-
[autoCorrect]="true"
|
|
179
|
-
[spinners]="false"
|
|
180
|
-
[format]="'n'"
|
|
181
|
-
[decimals]="0"
|
|
182
|
-
(blur)="handleRgbaInputBlur()"
|
|
183
|
-
(valueChange)="handleRgbaValueChange()"
|
|
184
|
-
>
|
|
185
|
-
</kendo-numerictextbox>
|
|
186
|
-
<kendo-numerictextbox #opacityInput
|
|
187
|
-
*ngIf="opacity"
|
|
188
|
-
[disabled]="disabled"
|
|
189
|
-
[readonly]="readonly"
|
|
190
|
-
[min]="0"
|
|
191
|
-
[max]="1"
|
|
192
|
-
[placeholder]="textFor('alphaInputPlaceholder')"
|
|
193
|
-
[(value)]="rgba.a"
|
|
194
|
-
[autoCorrect]="true"
|
|
195
|
-
[spinners]="false"
|
|
196
|
-
[step]="0.01"
|
|
197
|
-
[format]="'n2'"
|
|
198
|
-
[decimals]="2"
|
|
199
|
-
(blur)="handleRgbaInputBlur()"
|
|
200
|
-
(valueChange)="handleRgbaValueChange()"
|
|
201
|
-
>
|
|
202
|
-
</kendo-numerictextbox>
|
|
203
|
-
</div>
|
|
204
|
-
<div class="k-hbox k-gradient-values">
|
|
205
|
-
<div class="k-hex-value">hex</div>
|
|
206
|
-
<div>r</div>
|
|
207
|
-
<div>g</div>
|
|
208
|
-
<div>b</div>
|
|
209
|
-
<div *ngIf="opacity">a</div>
|
|
156
|
+
<div class="k-vstack">
|
|
157
|
+
<button class="k-colorgradient-toggle-mode k-button k-icon-button k-flat" #toggleFormatButton>
|
|
158
|
+
<span class="k-button-icon k-icon k-i-arrows-kpi"></span>
|
|
159
|
+
</button>
|
|
210
160
|
</div>
|
|
161
|
+
<input *ngIf="formatView === 'hex'"
|
|
162
|
+
#hexInput
|
|
163
|
+
class="k-textbox k-hex-value"
|
|
164
|
+
[disabled]="disabled"
|
|
165
|
+
[readonly]="readonly"
|
|
166
|
+
[value]="hex || ''"
|
|
167
|
+
[placeholder]="textFor('hexInputPlaceholder')"
|
|
168
|
+
(blur)="handleHexInputBlur()"
|
|
169
|
+
(input)="handleHexValueChange(hexInput.value)"
|
|
170
|
+
/>
|
|
171
|
+
<ng-container *ngIf="formatView === 'rgba'">
|
|
172
|
+
<div class="k-vstack">
|
|
173
|
+
<kendo-numerictextbox
|
|
174
|
+
#red
|
|
175
|
+
[disabled]="disabled"
|
|
176
|
+
[readonly]="readonly"
|
|
177
|
+
[min]="0"
|
|
178
|
+
[max]="255"
|
|
179
|
+
[placeholder]="textFor('redInputPlaceholder')"
|
|
180
|
+
[(value)]="rgba.r"
|
|
181
|
+
[autoCorrect]="true"
|
|
182
|
+
[spinners]="false"
|
|
183
|
+
[format]="'n'"
|
|
184
|
+
[decimals]="0"
|
|
185
|
+
(blur)="handleRgbaInputBlur()"
|
|
186
|
+
(valueChange)="handleRgbaValueChange()">
|
|
187
|
+
</kendo-numerictextbox>
|
|
188
|
+
<label [for]="red.focusableId" class="k-colorgradient-input-label">R</label>
|
|
189
|
+
</div>
|
|
190
|
+
<div class="k-vstack">
|
|
191
|
+
<kendo-numerictextbox
|
|
192
|
+
#green
|
|
193
|
+
[disabled]="disabled"
|
|
194
|
+
[readonly]="readonly"
|
|
195
|
+
[min]="0"
|
|
196
|
+
[max]="255"
|
|
197
|
+
[placeholder]="textFor('greenInputPlaceholder')"
|
|
198
|
+
[(value)]="rgba.g"
|
|
199
|
+
[autoCorrect]="true"
|
|
200
|
+
[spinners]="false"
|
|
201
|
+
[format]="'n'"
|
|
202
|
+
[decimals]="0"
|
|
203
|
+
(blur)="handleRgbaInputBlur()"
|
|
204
|
+
(valueChange)="handleRgbaValueChange()">
|
|
205
|
+
</kendo-numerictextbox>
|
|
206
|
+
<label [for]="green.focusableId" class="k-colorgradient-input-label">G</label>
|
|
207
|
+
</div>
|
|
208
|
+
<div class="k-vstack">
|
|
209
|
+
<kendo-numerictextbox
|
|
210
|
+
#blue
|
|
211
|
+
[disabled]="disabled"
|
|
212
|
+
[readonly]="readonly"
|
|
213
|
+
[min]="0"
|
|
214
|
+
[max]="255"
|
|
215
|
+
[placeholder]="textFor('blueInputPlaceholder')"
|
|
216
|
+
[(value)]="rgba.b"
|
|
217
|
+
[autoCorrect]="true"
|
|
218
|
+
[spinners]="false"
|
|
219
|
+
[format]="'n'"
|
|
220
|
+
[decimals]="0"
|
|
221
|
+
(blur)="handleRgbaInputBlur()"
|
|
222
|
+
(valueChange)="handleRgbaValueChange()">
|
|
223
|
+
</kendo-numerictextbox>
|
|
224
|
+
<label [for]="blue.focusableId" class="k-colorgradient-input-label">B</label>
|
|
225
|
+
</div>
|
|
226
|
+
<div class="k-vstack" *ngIf="opacity">
|
|
227
|
+
<kendo-numerictextbox #opacityInput
|
|
228
|
+
#alpha
|
|
229
|
+
[disabled]="disabled"
|
|
230
|
+
[readonly]="readonly"
|
|
231
|
+
[min]="0"
|
|
232
|
+
[max]="1"
|
|
233
|
+
[placeholder]="textFor('alphaInputPlaceholder')"
|
|
234
|
+
[(value)]="rgba.a"
|
|
235
|
+
[autoCorrect]="true"
|
|
236
|
+
[spinners]="false"
|
|
237
|
+
[step]="0.01"
|
|
238
|
+
[format]="'n2'"
|
|
239
|
+
[decimals]="2"
|
|
240
|
+
(blur)="handleRgbaInputBlur()"
|
|
241
|
+
(valueChange)="handleRgbaValueChange()">
|
|
242
|
+
</kendo-numerictextbox>
|
|
243
|
+
<label [for]="alpha.focusableId" class="k-colorgradient-input-label">A</label>
|
|
244
|
+
</div>
|
|
245
|
+
</ng-container>
|
|
211
246
|
`
|
|
212
247
|
}),
|
|
213
248
|
tslib_1.__metadata("design:paramtypes", [LocalizationService,
|
|
214
|
-
ElementRef
|
|
249
|
+
ElementRef,
|
|
250
|
+
Renderer2])
|
|
215
251
|
], ColorInputComponent);
|
|
216
252
|
export { ColorInputComponent };
|
|
@@ -100,10 +100,6 @@ export declare class ColorPaletteComponent implements OnInit, AfterViewInit, OnD
|
|
|
100
100
|
* @hidden
|
|
101
101
|
*/
|
|
102
102
|
readonly colorRows: string[][];
|
|
103
|
-
/**
|
|
104
|
-
* @hidden
|
|
105
|
-
*/
|
|
106
|
-
focusedCell: TableCell;
|
|
107
103
|
/**
|
|
108
104
|
* @hidden
|
|
109
105
|
*/
|
|
@@ -124,6 +120,18 @@ export declare class ColorPaletteComponent implements OnInit, AfterViewInit, OnD
|
|
|
124
120
|
* @hidden
|
|
125
121
|
*/
|
|
126
122
|
activeCellId: string;
|
|
123
|
+
/**
|
|
124
|
+
* @hidden
|
|
125
|
+
*/
|
|
126
|
+
focusedCell: TableCell;
|
|
127
|
+
/**
|
|
128
|
+
* @hidden
|
|
129
|
+
*/
|
|
130
|
+
selectedCell: TableCell;
|
|
131
|
+
/**
|
|
132
|
+
* @hidden
|
|
133
|
+
*/
|
|
134
|
+
focusInComponent: boolean;
|
|
127
135
|
private selection;
|
|
128
136
|
private _value;
|
|
129
137
|
private _columns;
|
|
@@ -146,7 +154,7 @@ export declare class ColorPaletteComponent implements OnInit, AfterViewInit, OnD
|
|
|
146
154
|
/**
|
|
147
155
|
* @hidden
|
|
148
156
|
*/
|
|
149
|
-
handleCellSelection(value: string,
|
|
157
|
+
handleCellSelection(value: string, cell?: TableCell): void;
|
|
150
158
|
/**
|
|
151
159
|
* @hidden
|
|
152
160
|
*/
|
|
@@ -172,6 +180,7 @@ export declare class ColorPaletteComponent implements OnInit, AfterViewInit, OnD
|
|
|
172
180
|
* Clears the color value of the ColorPalette.
|
|
173
181
|
*/
|
|
174
182
|
reset(): void;
|
|
183
|
+
private handleCellFocusOnBlur;
|
|
175
184
|
private setRows;
|
|
176
185
|
private handleCellNavigation;
|
|
177
186
|
private setHostElementAriaLabel;
|
|
@@ -225,15 +225,18 @@ let ColorPaletteComponent = ColorPaletteComponent_1 = class ColorPaletteComponen
|
|
|
225
225
|
*/
|
|
226
226
|
handleHostBlur() {
|
|
227
227
|
this.notifyNgTouched();
|
|
228
|
+
this.handleCellFocusOnBlur();
|
|
228
229
|
}
|
|
229
230
|
/**
|
|
230
231
|
* @hidden
|
|
231
232
|
*/
|
|
232
|
-
handleCellSelection(value,
|
|
233
|
+
handleCellSelection(value, cell) {
|
|
233
234
|
if (this.readonly) {
|
|
234
235
|
return;
|
|
235
236
|
}
|
|
236
|
-
this.
|
|
237
|
+
this.selectedCell = cell;
|
|
238
|
+
this.focusedCell = this.selectedCell;
|
|
239
|
+
this.focusInComponent = true;
|
|
237
240
|
const parsedColor = parseColor(value, this.format, false);
|
|
238
241
|
this.cellSelection.emit(parsedColor);
|
|
239
242
|
if (this.value !== parsedColor) {
|
|
@@ -246,8 +249,8 @@ let ColorPaletteComponent = ColorPaletteComponent_1 = class ColorPaletteComponen
|
|
|
246
249
|
this.selection = parsedColor;
|
|
247
250
|
this.selectionChange.emit(parsedColor);
|
|
248
251
|
}
|
|
249
|
-
if (
|
|
250
|
-
this.activeCellId = `${this.
|
|
252
|
+
if (cell) {
|
|
253
|
+
this.activeCellId = `${this.selectedCell.row}-${this.selectedCell.col}`;
|
|
251
254
|
}
|
|
252
255
|
}
|
|
253
256
|
/**
|
|
@@ -293,6 +296,10 @@ let ColorPaletteComponent = ColorPaletteComponent_1 = class ColorPaletteComponen
|
|
|
293
296
|
this.notifyNgChanged(undefined);
|
|
294
297
|
}
|
|
295
298
|
}
|
|
299
|
+
handleCellFocusOnBlur() {
|
|
300
|
+
this.focusInComponent = false;
|
|
301
|
+
this.focusedCell = this.selectedCell;
|
|
302
|
+
}
|
|
296
303
|
setRows() {
|
|
297
304
|
if (!isPresent(this.palette)) {
|
|
298
305
|
return;
|
|
@@ -305,11 +312,7 @@ let ColorPaletteComponent = ColorPaletteComponent_1 = class ColorPaletteComponen
|
|
|
305
312
|
return;
|
|
306
313
|
}
|
|
307
314
|
this.focusedCell = this.service.getNextCell(this.focusedCell, horizontalStep, verticalStep);
|
|
308
|
-
|
|
309
|
-
if (this.selection !== selection) {
|
|
310
|
-
this.selection = selection;
|
|
311
|
-
this.selectionChange.emit(selection);
|
|
312
|
-
}
|
|
315
|
+
this.focusInComponent = true;
|
|
313
316
|
}
|
|
314
317
|
setHostElementAriaLabel() {
|
|
315
318
|
const parsed = parseColor(this.value, this.format);
|
|
@@ -390,7 +393,6 @@ tslib_1.__decorate([
|
|
|
390
393
|
tslib_1.__metadata("design:paramtypes", [])
|
|
391
394
|
], ColorPaletteComponent.prototype, "hostTabindex", null);
|
|
392
395
|
tslib_1.__decorate([
|
|
393
|
-
HostBinding('class.k-widget'),
|
|
394
396
|
HostBinding('class.k-colorpalette'),
|
|
395
397
|
tslib_1.__metadata("design:type", Boolean)
|
|
396
398
|
], ColorPaletteComponent.prototype, "hostClasses", void 0);
|
|
@@ -445,18 +447,19 @@ ColorPaletteComponent = ColorPaletteComponent_1 = tslib_1.__decorate([
|
|
|
445
447
|
i18n-colorPaletteNoColor="kendo.colorpalette.colorPaletteNoColor|The aria-label applied to the ColorPalette component when the value is empty."
|
|
446
448
|
colorPaletteNoColor="Colorpalette no color chosen">
|
|
447
449
|
</ng-container>
|
|
448
|
-
<div role="listbox"
|
|
450
|
+
<div role="listbox" class="k-colorpalette-table-wrap"
|
|
449
451
|
[attr.aria-activedescendant]="activeCellId">
|
|
450
|
-
<table class="k-
|
|
452
|
+
<table class="k-colorpalette-table k-palette">
|
|
451
453
|
<tbody>
|
|
452
454
|
<tr *ngFor="let row of colorRows; let rowIndex = index">
|
|
453
455
|
<td *ngFor="let color of row; let colIndex = index"
|
|
454
456
|
role="option"
|
|
455
|
-
[class.k-state-selected]="
|
|
456
|
-
[
|
|
457
|
+
[class.k-state-selected]="selectedCell?.row === rowIndex && selectedCell?.col === colIndex"
|
|
458
|
+
[class.k-state-focus]="focusInComponent && focusedCell?.row === rowIndex && focusedCell?.col === colIndex"
|
|
459
|
+
[attr.aria-selected]="selectedCell?.row === rowIndex && selectedCell?.col === colIndex"
|
|
457
460
|
[attr.aria-label]="color"
|
|
458
|
-
class="k-
|
|
459
|
-
[id]="rowIndex + '' + colIndex"
|
|
461
|
+
class="k-colorpalette-tile"
|
|
462
|
+
[id]="rowIndex + '-' + colIndex"
|
|
460
463
|
[attr.value]="color"
|
|
461
464
|
(click)="handleCellSelection(color, { row: rowIndex, col: colIndex })"
|
|
462
465
|
[ngStyle]="{
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { OutputFormat } from "./models";
|
|
6
|
+
/**
|
|
7
|
+
* @hidden
|
|
8
|
+
*/
|
|
9
|
+
export declare const DEFAULT_OUTPUT_FORMAT: OutputFormat;
|
|
10
|
+
/**
|
|
11
|
+
* @hidden
|
|
12
|
+
*/
|
|
13
|
+
export declare const DEFAULT_GRADIENT_BACKGROUND_COLOR: string;
|
|
14
|
+
/**
|
|
15
|
+
* @hidden
|
|
16
|
+
*/
|
|
17
|
+
export declare const DRAGHANDLE_MOVE_SPEED = 5;
|
|
18
|
+
/**
|
|
19
|
+
* @hidden
|
|
20
|
+
*/
|
|
21
|
+
export declare const AAA_RATIO = 7;
|
|
22
|
+
/**
|
|
23
|
+
* @hidden
|
|
24
|
+
*/
|
|
25
|
+
export declare const AA_RATIO = 4.5;
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
/**
|
|
6
|
+
* @hidden
|
|
7
|
+
*/
|
|
8
|
+
export const DEFAULT_OUTPUT_FORMAT = 'rgba';
|
|
9
|
+
/**
|
|
10
|
+
* @hidden
|
|
11
|
+
*/
|
|
12
|
+
export const DEFAULT_GRADIENT_BACKGROUND_COLOR = 'rgba(255, 0, 0, 1)';
|
|
13
|
+
/**
|
|
14
|
+
* @hidden
|
|
15
|
+
*/
|
|
16
|
+
export const DRAGHANDLE_MOVE_SPEED = 5;
|
|
17
|
+
/**
|
|
18
|
+
* @hidden
|
|
19
|
+
*/
|
|
20
|
+
export const AAA_RATIO = 7.0;
|
|
21
|
+
/**
|
|
22
|
+
* @hidden
|
|
23
|
+
*/
|
|
24
|
+
export const AA_RATIO = 4.5;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { LocalizationService } from '@progress/kendo-angular-l10n';
|
|
6
|
+
/**
|
|
7
|
+
* @hidden
|
|
8
|
+
*/
|
|
9
|
+
export declare class ContrastValidationComponent {
|
|
10
|
+
private localization;
|
|
11
|
+
type: string;
|
|
12
|
+
ratio: number;
|
|
13
|
+
pass: boolean;
|
|
14
|
+
constructor(localization: LocalizationService);
|
|
15
|
+
readonly passMessage: string;
|
|
16
|
+
readonly failMessage: string;
|
|
17
|
+
readonly contrastText: string;
|
|
18
|
+
}
|