@progress/kendo-angular-inputs 7.4.0 → 7.5.0
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
|
@@ -10,15 +10,13 @@ import { isPresent, fitIntoBounds } from '../common/utils';
|
|
|
10
10
|
import { isChanged, isDocumentAvailable, KendoInput } from '@progress/kendo-angular-common';
|
|
11
11
|
import { containsFocus, isUntouched } from '../common/dom-utils';
|
|
12
12
|
import { SliderComponent } from '../slider/slider.component';
|
|
13
|
-
var DEFAULT_OUTPUT_FORMAT = 'rgba';
|
|
14
|
-
var DEFAULT_BACKGROUND_COLOR = 'rgba(255, 0, 0, 1)';
|
|
15
13
|
import { LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
|
|
16
14
|
import { Subject } from 'rxjs';
|
|
17
15
|
import { ColorGradientLocalizationService } from './localization/colorgradient-localization.service';
|
|
18
16
|
import { ColorInputComponent } from './color-input.component';
|
|
19
17
|
import { throttleTime } from 'rxjs/operators';
|
|
18
|
+
import { DEFAULT_GRADIENT_BACKGROUND_COLOR, DEFAULT_OUTPUT_FORMAT, DRAGHANDLE_MOVE_SPEED } from './constants';
|
|
20
19
|
var serial = 0;
|
|
21
|
-
var DRAGHANDLE_MOVE_SPEED = 5;
|
|
22
20
|
/**
|
|
23
21
|
* The ColorGradient component enables smooth color transitions and provides options for selecting specific colors over the drag handle.
|
|
24
22
|
* The ColorGradient is independently used by `kendo-colorpicker` and can be directly added to the page.
|
|
@@ -68,7 +66,7 @@ var ColorGradientComponent = /** @class */ (function () {
|
|
|
68
66
|
/**
|
|
69
67
|
* @hidden
|
|
70
68
|
*/
|
|
71
|
-
this.backgroundColor =
|
|
69
|
+
this.backgroundColor = DEFAULT_GRADIENT_BACKGROUND_COLOR;
|
|
72
70
|
/**
|
|
73
71
|
* @hidden
|
|
74
72
|
*
|
|
@@ -200,6 +198,16 @@ var ColorGradientComponent = /** @class */ (function () {
|
|
|
200
198
|
enumerable: true,
|
|
201
199
|
configurable: true
|
|
202
200
|
});
|
|
201
|
+
Object.defineProperty(ColorGradientComponent.prototype, "contrastToolVisible", {
|
|
202
|
+
/**
|
|
203
|
+
* @hidden
|
|
204
|
+
*/
|
|
205
|
+
get: function () {
|
|
206
|
+
return typeof this.contrastTool === 'string' && this.contrastTool !== '';
|
|
207
|
+
},
|
|
208
|
+
enumerable: true,
|
|
209
|
+
configurable: true
|
|
210
|
+
});
|
|
203
211
|
ColorGradientComponent.prototype.ngAfterViewInit = function () {
|
|
204
212
|
this.updateUI();
|
|
205
213
|
this.cdr.detectChanges();
|
|
@@ -514,8 +522,7 @@ var ColorGradientComponent = /** @class */ (function () {
|
|
|
514
522
|
};
|
|
515
523
|
var ColorGradientComponent_1;
|
|
516
524
|
tslib_1.__decorate([
|
|
517
|
-
HostBinding('class.k-
|
|
518
|
-
HostBinding('class.k-flatcolorpicker'),
|
|
525
|
+
HostBinding('class.k-colorgradient'),
|
|
519
526
|
tslib_1.__metadata("design:type", Boolean)
|
|
520
527
|
], ColorGradientComponent.prototype, "hostClasses", void 0);
|
|
521
528
|
tslib_1.__decorate([
|
|
@@ -571,6 +578,10 @@ var ColorGradientComponent = /** @class */ (function () {
|
|
|
571
578
|
tslib_1.__metadata("design:type", String),
|
|
572
579
|
tslib_1.__metadata("design:paramtypes", [String])
|
|
573
580
|
], ColorGradientComponent.prototype, "value", null);
|
|
581
|
+
tslib_1.__decorate([
|
|
582
|
+
Input(),
|
|
583
|
+
tslib_1.__metadata("design:type", String)
|
|
584
|
+
], ColorGradientComponent.prototype, "contrastTool", void 0);
|
|
574
585
|
tslib_1.__decorate([
|
|
575
586
|
Input(),
|
|
576
587
|
tslib_1.__metadata("design:type", Number),
|
|
@@ -623,7 +634,8 @@ var ColorGradientComponent = /** @class */ (function () {
|
|
|
623
634
|
useValue: 'kendo.colorgradient'
|
|
624
635
|
}
|
|
625
636
|
],
|
|
626
|
-
template: "\n <ng-container kendoColorGradientLocalizedMessages\n i18n-colorGradientNoColor=\"kendo.colorgradient.colorGradientNoColor|The aria-label applied to the ColorGradient component when the value is empty.\"\n colorGradientNoColor=\"Colorgradient no color chosen\"\n i18n-colorGradientHandle=\"kendo.colorgradient.colorGradientHandle|The title for the gradient color drag handle chooser.\"\n colorGradientHandle=\"Choose color\"\n i18n-clearButton=\"kendo.colorgradient.clearButton|The title for the clear button.\"\n clearButton=\"Clear value\"\n i18n-hueSliderHandle=\"kendo.colorgradient.hueSliderHandle|The title for the hue slider handle.\"\n hueSliderHandle=\"Set hue\"\n i18n-opacitySliderHandle=\"kendo.colorgradient.opacitySliderHandle|The title for the opacity slider handle.\"\n opacitySliderHandle=\"Set opacity\"\n i18n-hexInputPlaceholder=\"kendo.colorgradient.hexInputPlaceholder|The placeholder for the HEX color input.\"\n hexInputPlaceholder=\"HEX Color\"\n i18n-redInputPlaceholder=\"kendo.colorgradient.redInputPlaceholder|The placeholder for the red color input.\"\n redInputPlaceholder=\"Red\"\n i18n-greenInputPlaceholder=\"kendo.colorgradient.greenInputPlaceholder|The placeholder for the green color input.\"\n greenInputPlaceholder=\"Green\"\n i18n-blueInputPlaceholder=\"kendo.colorgradient.blueInputPlaceholder|The placeholder for the blue color input.\"\n blueInputPlaceholder=\"Blue\"\n i18n-alphaInputPlaceholder=\"kendo.colorgradient.alphaInputPlaceholder|The placeholder for the alpha input.\"\n alphaInputPlaceholder=\"Alpha\">\n </ng-container>\n <div class=\"k-
|
|
637
|
+
template: "\n <ng-container kendoColorGradientLocalizedMessages\n i18n-colorGradientNoColor=\"kendo.colorgradient.colorGradientNoColor|The aria-label applied to the ColorGradient component when the value is empty.\"\n colorGradientNoColor=\"Colorgradient no color chosen\"\n i18n-colorGradientHandle=\"kendo.colorgradient.colorGradientHandle|The title for the gradient color drag handle chooser.\"\n colorGradientHandle=\"Choose color\"\n i18n-clearButton=\"kendo.colorgradient.clearButton|The title for the clear button.\"\n clearButton=\"Clear value\"\n i18n-hueSliderHandle=\"kendo.colorgradient.hueSliderHandle|The title for the hue slider handle.\"\n hueSliderHandle=\"Set hue\"\n i18n-opacitySliderHandle=\"kendo.colorgradient.opacitySliderHandle|The title for the opacity slider handle.\"\n opacitySliderHandle=\"Set opacity\"\n i18n-hexInputPlaceholder=\"kendo.colorgradient.hexInputPlaceholder|The placeholder for the HEX color input.\"\n hexInputPlaceholder=\"HEX Color\"\n i18n-redInputPlaceholder=\"kendo.colorgradient.redInputPlaceholder|The placeholder for the red color input.\"\n redInputPlaceholder=\"Red\"\n i18n-greenInputPlaceholder=\"kendo.colorgradient.greenInputPlaceholder|The placeholder for the green color input.\"\n greenInputPlaceholder=\"Green\"\n i18n-blueInputPlaceholder=\"kendo.colorgradient.blueInputPlaceholder|The placeholder for the blue color input.\"\n blueInputPlaceholder=\"Blue\"\n i18n-alphaInputPlaceholder=\"kendo.colorgradient.alphaInputPlaceholder|The placeholder for the alpha input.\"\n alphaInputPlaceholder=\"Alpha\"\n i18n-passContrast=\"kendo.colorgradient.passContrast|The pass message for the contrast tool.\"\n passContrast=\"Pass\"\n i18n-failContrast=\"kendo.colorgradient.failContrast|The fail message for the contrast tool.\"\n failContrast=\"Fail\"\n i18n-contrastRatio=\"kendo.colorgradient.contrastRatio|The contrast ratio message for the contrast tool.\"\n contrastRatio=\"Contrast ratio\">\n </ng-container>\n <div class=\"k-colorgradient-canvas k-hstack\">\n <div class=\"k-hsv-rectangle\" [style.background]=\"backgroundColor\">\n <div\n #gradientWrapper\n kendoDraggable\n class=\"k-hsv-gradient\"\n (click)=\"changePosition($event)\"\n (kendoPress)=\"handleDragPress($event)\"\n (kendoDrag)=\"onHandleDrag($event)\"\n (kendoRelease)=\"onHandleRelease()\">\n <div\n #gradientDragHandle\n class=\"k-hsv-draghandle k-draghandle\"\n tabindex=\"0\"\n [attr.title]=\"colorGradientHandleTitle\"\n [attr.aria-label]=\"colorGradientHandleAriaLabel\"\n >\n </div>\n </div>\n </div>\n <div class=\"k-hsv-controls k-hstack {{ clearButton ? 'k-sliders-wrap-clearable' : '' }}\">\n <span class=\"k-clear-color k-button k-flat k-button-icon\"\n *ngIf=\"clearButton\"\n (click)=\"reset()\"\n (keydown.enter)=\"reset()\"\n (keydown.space)=\"reset()\"\n [attr.aria-label]=\"clearButtonTitle\"\n [attr.title]=\"clearButtonTitle\"\n tabindex=\"0\">\n <span class=\"k-icon k-i-reset-color\"></span>\n </span>\n <kendo-slider\n [ngClass]=\"{'k-align-self-end': clearButton}\"\n class=\"k-hue-slider k-colorgradient-slider\"\n [dragHandleTitle]=\"hueSliderTitle\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly\"\n [showButtons]=\"false\"\n [tickPlacement]=\"'none'\"\n [vertical]=\"true\"\n [min]=\"0\"\n [max]=\"360\"\n [smallStep]=\"5\"\n [largeStep]=\"10\"\n [(value)]=\"hsva.h\"\n (valueChange)=\"handleHueSliderChange($event)\"\n >\n </kendo-slider>\n <kendo-slider\n *ngIf=\"opacity && format === 'rgba'\"\n #alphaSlider\n [ngClass]=\"{'k-align-self-end': clearButton}\"\n class=\"k-alpha-slider k-colorgradient-slider\"\n [dragHandleTitle]=\"opacitySliderTitle\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly\"\n [showButtons]=\"false\"\n [tickPlacement]=\"'none'\"\n [vertical]=\"true\"\n [min]=\"0\"\n [max]=\"100\"\n [smallStep]=\"1\"\n [largeStep]=\"10\"\n [value]=\"alphaSliderValue\"\n (valueChange)=\"handleAlphaSliderChange($event)\"\n >\n </kendo-slider>\n </div>\n </div>\n <kendo-colorinput #inputs\n [opacity]=\"opacity\"\n [formatView]=\"format\"\n [value]=\"value\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly\"\n (valueChange)=\"handleInputsValueChange($event)\"\n >\n </kendo-colorinput>\n <div class=\"k-colorgradient-color-contrast k-vbox\" *ngIf=\"contrastToolVisible\"\n kendoContrastTool\n [value]=\"value\"\n [ratio]=\"contrastTool\">\n </div>\n ",
|
|
638
|
+
styles: ["\n .k-clear-color {\n position: absolute;\n left: 50%;\n transform: translateX(-50%);\n }\n .k-align-self-end {\n height: 140px;\n }\n "]
|
|
627
639
|
}),
|
|
628
640
|
tslib_1.__metadata("design:paramtypes", [ElementRef,
|
|
629
641
|
NgZone,
|
|
@@ -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
|
var ColorInputComponent = /** @class */ (function () {
|
|
15
|
-
function ColorInputComponent(localization, host) {
|
|
16
|
+
function ColorInputComponent(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 @@ var ColorInputComponent = /** @class */ (function () {
|
|
|
36
38
|
* The rgba inputs values.
|
|
37
39
|
*/
|
|
38
40
|
this.rgba = {};
|
|
41
|
+
this.subscriptions = new Subscription();
|
|
39
42
|
}
|
|
40
43
|
Object.defineProperty(ColorInputComponent.prototype, "isFocused", {
|
|
41
44
|
/**
|
|
@@ -62,6 +65,14 @@ var ColorInputComponent = /** @class */ (function () {
|
|
|
62
65
|
enumerable: true,
|
|
63
66
|
configurable: true
|
|
64
67
|
});
|
|
68
|
+
ColorInputComponent.prototype.ngAfterViewInit = function () {
|
|
69
|
+
this.initDomEvents();
|
|
70
|
+
};
|
|
71
|
+
ColorInputComponent.prototype.ngOnDestroy = function () {
|
|
72
|
+
if (this.subscriptions) {
|
|
73
|
+
this.subscriptions.unsubscribe();
|
|
74
|
+
}
|
|
75
|
+
};
|
|
65
76
|
ColorInputComponent.prototype.ngOnChanges = function (changes) {
|
|
66
77
|
if (isPresent(changes.value) && !this.isFocused) {
|
|
67
78
|
this.hex = parseColor(this.value, 'hex');
|
|
@@ -97,12 +108,23 @@ var ColorInputComponent = /** @class */ (function () {
|
|
|
97
108
|
ColorInputComponent.prototype.handleHexInputBlur = function () {
|
|
98
109
|
this.hex = parseColor(this.value, 'hex');
|
|
99
110
|
};
|
|
100
|
-
/**
|
|
101
|
-
* @hidden
|
|
102
|
-
*/
|
|
103
111
|
ColorInputComponent.prototype.textFor = function (key) {
|
|
104
112
|
return this.localization.get(key);
|
|
105
113
|
};
|
|
114
|
+
ColorInputComponent.prototype.toggleFormatView = function () {
|
|
115
|
+
this.formatView = this.formatView === 'hex' ? 'rgba' : 'hex';
|
|
116
|
+
};
|
|
117
|
+
ColorInputComponent.prototype.initDomEvents = function () {
|
|
118
|
+
var _this = this;
|
|
119
|
+
if (!this.host) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
this.subscriptions.add(this.renderer.listen(this.toggleFormatButton.nativeElement, 'click', function () { return _this.toggleFormatView(); }));
|
|
123
|
+
};
|
|
124
|
+
tslib_1.__decorate([
|
|
125
|
+
Input(),
|
|
126
|
+
tslib_1.__metadata("design:type", String)
|
|
127
|
+
], ColorInputComponent.prototype, "formatView", void 0);
|
|
106
128
|
tslib_1.__decorate([
|
|
107
129
|
Input(),
|
|
108
130
|
tslib_1.__metadata("design:type", String)
|
|
@@ -124,20 +146,26 @@ var ColorInputComponent = /** @class */ (function () {
|
|
|
124
146
|
tslib_1.__metadata("design:type", EventEmitter)
|
|
125
147
|
], ColorInputComponent.prototype, "valueChange", void 0);
|
|
126
148
|
tslib_1.__decorate([
|
|
127
|
-
HostBinding('class.k-
|
|
149
|
+
HostBinding('class.k-colorgradient-inputs'),
|
|
150
|
+
HostBinding('class.k-hstack'),
|
|
128
151
|
tslib_1.__metadata("design:type", Boolean)
|
|
129
152
|
], ColorInputComponent.prototype, "colorInputClass", void 0);
|
|
130
153
|
tslib_1.__decorate([
|
|
131
154
|
ViewChild('opacityInput', { read: ElementRef, static: false }),
|
|
132
155
|
tslib_1.__metadata("design:type", ElementRef)
|
|
133
156
|
], ColorInputComponent.prototype, "opacityInput", void 0);
|
|
157
|
+
tslib_1.__decorate([
|
|
158
|
+
ViewChild('toggleFormatButton', { static: false }),
|
|
159
|
+
tslib_1.__metadata("design:type", ElementRef)
|
|
160
|
+
], ColorInputComponent.prototype, "toggleFormatButton", void 0);
|
|
134
161
|
ColorInputComponent = tslib_1.__decorate([
|
|
135
162
|
Component({
|
|
136
163
|
selector: 'kendo-colorinput',
|
|
137
|
-
template: "\n <div class=\"k-
|
|
164
|
+
template: "\n <div class=\"k-vstack\">\n <button class=\"k-colorgradient-toggle-mode k-button k-icon-button k-flat\" #toggleFormatButton>\n <span class=\"k-button-icon k-icon k-i-arrows-kpi\"></span>\n </button>\n </div>\n <input *ngIf=\"formatView === 'hex'\"\n #hexInput\n class=\"k-textbox k-hex-value\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly\"\n [value]=\"hex || ''\"\n [placeholder]=\"textFor('hexInputPlaceholder')\"\n (blur)=\"handleHexInputBlur()\"\n (input)=\"handleHexValueChange(hexInput.value)\"\n />\n <ng-container *ngIf=\"formatView === 'rgba'\">\n <div class=\"k-vstack\">\n <kendo-numerictextbox\n #red\n [disabled]=\"disabled\"\n [readonly]=\"readonly\"\n [min]=\"0\"\n [max]=\"255\"\n [placeholder]=\"textFor('redInputPlaceholder')\"\n [(value)]=\"rgba.r\"\n [autoCorrect]=\"true\"\n [spinners]=\"false\"\n [format]=\"'n'\"\n [decimals]=\"0\"\n (blur)=\"handleRgbaInputBlur()\"\n (valueChange)=\"handleRgbaValueChange()\">\n </kendo-numerictextbox>\n <label [for]=\"red.focusableId\" class=\"k-colorgradient-input-label\">R</label>\n </div>\n <div class=\"k-vstack\">\n <kendo-numerictextbox\n #green\n [disabled]=\"disabled\"\n [readonly]=\"readonly\"\n [min]=\"0\"\n [max]=\"255\"\n [placeholder]=\"textFor('greenInputPlaceholder')\"\n [(value)]=\"rgba.g\"\n [autoCorrect]=\"true\"\n [spinners]=\"false\"\n [format]=\"'n'\"\n [decimals]=\"0\"\n (blur)=\"handleRgbaInputBlur()\"\n (valueChange)=\"handleRgbaValueChange()\">\n </kendo-numerictextbox>\n <label [for]=\"green.focusableId\" class=\"k-colorgradient-input-label\">G</label>\n </div>\n <div class=\"k-vstack\">\n <kendo-numerictextbox\n #blue\n [disabled]=\"disabled\"\n [readonly]=\"readonly\"\n [min]=\"0\"\n [max]=\"255\"\n [placeholder]=\"textFor('blueInputPlaceholder')\"\n [(value)]=\"rgba.b\"\n [autoCorrect]=\"true\"\n [spinners]=\"false\"\n [format]=\"'n'\"\n [decimals]=\"0\"\n (blur)=\"handleRgbaInputBlur()\"\n (valueChange)=\"handleRgbaValueChange()\">\n </kendo-numerictextbox>\n <label [for]=\"blue.focusableId\" class=\"k-colorgradient-input-label\">B</label>\n </div>\n <div class=\"k-vstack\" *ngIf=\"opacity\">\n <kendo-numerictextbox #opacityInput\n #alpha\n [disabled]=\"disabled\"\n [readonly]=\"readonly\"\n [min]=\"0\"\n [max]=\"1\"\n [placeholder]=\"textFor('alphaInputPlaceholder')\"\n [(value)]=\"rgba.a\"\n [autoCorrect]=\"true\"\n [spinners]=\"false\"\n [step]=\"0.01\"\n [format]=\"'n2'\"\n [decimals]=\"2\"\n (blur)=\"handleRgbaInputBlur()\"\n (valueChange)=\"handleRgbaValueChange()\">\n </kendo-numerictextbox>\n <label [for]=\"alpha.focusableId\" class=\"k-colorgradient-input-label\">A</label>\n </div>\n </ng-container>\n "
|
|
138
165
|
}),
|
|
139
166
|
tslib_1.__metadata("design:paramtypes", [LocalizationService,
|
|
140
|
-
ElementRef
|
|
167
|
+
ElementRef,
|
|
168
|
+
Renderer2])
|
|
141
169
|
], ColorInputComponent);
|
|
142
170
|
return ColorInputComponent;
|
|
143
171
|
}());
|
|
@@ -268,15 +268,18 @@ var ColorPaletteComponent = /** @class */ (function () {
|
|
|
268
268
|
*/
|
|
269
269
|
ColorPaletteComponent.prototype.handleHostBlur = function () {
|
|
270
270
|
this.notifyNgTouched();
|
|
271
|
+
this.handleCellFocusOnBlur();
|
|
271
272
|
};
|
|
272
273
|
/**
|
|
273
274
|
* @hidden
|
|
274
275
|
*/
|
|
275
|
-
ColorPaletteComponent.prototype.handleCellSelection = function (value,
|
|
276
|
+
ColorPaletteComponent.prototype.handleCellSelection = function (value, cell) {
|
|
276
277
|
if (this.readonly) {
|
|
277
278
|
return;
|
|
278
279
|
}
|
|
279
|
-
this.
|
|
280
|
+
this.selectedCell = cell;
|
|
281
|
+
this.focusedCell = this.selectedCell;
|
|
282
|
+
this.focusInComponent = true;
|
|
280
283
|
var parsedColor = parseColor(value, this.format, false);
|
|
281
284
|
this.cellSelection.emit(parsedColor);
|
|
282
285
|
if (this.value !== parsedColor) {
|
|
@@ -289,8 +292,8 @@ var ColorPaletteComponent = /** @class */ (function () {
|
|
|
289
292
|
this.selection = parsedColor;
|
|
290
293
|
this.selectionChange.emit(parsedColor);
|
|
291
294
|
}
|
|
292
|
-
if (
|
|
293
|
-
this.activeCellId =
|
|
295
|
+
if (cell) {
|
|
296
|
+
this.activeCellId = this.selectedCell.row + "-" + this.selectedCell.col;
|
|
294
297
|
}
|
|
295
298
|
};
|
|
296
299
|
/**
|
|
@@ -336,6 +339,10 @@ var ColorPaletteComponent = /** @class */ (function () {
|
|
|
336
339
|
this.notifyNgChanged(undefined);
|
|
337
340
|
}
|
|
338
341
|
};
|
|
342
|
+
ColorPaletteComponent.prototype.handleCellFocusOnBlur = function () {
|
|
343
|
+
this.focusInComponent = false;
|
|
344
|
+
this.focusedCell = this.selectedCell;
|
|
345
|
+
};
|
|
339
346
|
ColorPaletteComponent.prototype.setRows = function () {
|
|
340
347
|
if (!isPresent(this.palette)) {
|
|
341
348
|
return;
|
|
@@ -348,11 +355,7 @@ var ColorPaletteComponent = /** @class */ (function () {
|
|
|
348
355
|
return;
|
|
349
356
|
}
|
|
350
357
|
this.focusedCell = this.service.getNextCell(this.focusedCell, horizontalStep, verticalStep);
|
|
351
|
-
|
|
352
|
-
if (this.selection !== selection) {
|
|
353
|
-
this.selection = selection;
|
|
354
|
-
this.selectionChange.emit(selection);
|
|
355
|
-
}
|
|
358
|
+
this.focusInComponent = true;
|
|
356
359
|
};
|
|
357
360
|
ColorPaletteComponent.prototype.setHostElementAriaLabel = function () {
|
|
358
361
|
var parsed = parseColor(this.value, this.format);
|
|
@@ -433,7 +436,6 @@ var ColorPaletteComponent = /** @class */ (function () {
|
|
|
433
436
|
tslib_1.__metadata("design:paramtypes", [])
|
|
434
437
|
], ColorPaletteComponent.prototype, "hostTabindex", null);
|
|
435
438
|
tslib_1.__decorate([
|
|
436
|
-
HostBinding('class.k-widget'),
|
|
437
439
|
HostBinding('class.k-colorpalette'),
|
|
438
440
|
tslib_1.__metadata("design:type", Boolean)
|
|
439
441
|
], ColorPaletteComponent.prototype, "hostClasses", void 0);
|
|
@@ -483,7 +485,7 @@ var ColorPaletteComponent = /** @class */ (function () {
|
|
|
483
485
|
useValue: 'kendo.colorpalette'
|
|
484
486
|
}
|
|
485
487
|
],
|
|
486
|
-
template: "\n <ng-container kendoColorPaletteLocalizedMessages\n i18n-colorPaletteNoColor=\"kendo.colorpalette.colorPaletteNoColor|The aria-label applied to the ColorPalette component when the value is empty.\"\n colorPaletteNoColor=\"Colorpalette no color chosen\">\n </ng-container>\n <div role=\"listbox\"\n [attr.aria-activedescendant]=\"activeCellId\">\n <table class=\"k-
|
|
488
|
+
template: "\n <ng-container kendoColorPaletteLocalizedMessages\n i18n-colorPaletteNoColor=\"kendo.colorpalette.colorPaletteNoColor|The aria-label applied to the ColorPalette component when the value is empty.\"\n colorPaletteNoColor=\"Colorpalette no color chosen\">\n </ng-container>\n <div role=\"listbox\" class=\"k-colorpalette-table-wrap\"\n [attr.aria-activedescendant]=\"activeCellId\">\n <table class=\"k-colorpalette-table k-palette\">\n <tbody>\n <tr *ngFor=\"let row of colorRows; let rowIndex = index\">\n <td *ngFor=\"let color of row; let colIndex = index\"\n role=\"option\"\n [class.k-state-selected]=\"selectedCell?.row === rowIndex && selectedCell?.col === colIndex\"\n [class.k-state-focus]=\"focusInComponent && focusedCell?.row === rowIndex && focusedCell?.col === colIndex\"\n [attr.aria-selected]=\"selectedCell?.row === rowIndex && selectedCell?.col === colIndex\"\n [attr.aria-label]=\"color\"\n class=\"k-colorpalette-tile\"\n [id]=\"rowIndex + '-' + colIndex\"\n [attr.value]=\"color\"\n (click)=\"handleCellSelection(color, { row: rowIndex, col: colIndex })\"\n [ngStyle]=\"{\n backgroundColor: color,\n width: tileLayout.width + 'px',\n height: tileLayout.height + 'px',\n minWidth: tileLayout.width + 'px'\n }\">\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n "
|
|
487
489
|
}),
|
|
488
490
|
tslib_1.__metadata("design:paramtypes", [ElementRef,
|
|
489
491
|
ColorPaletteService,
|
|
@@ -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 var DEFAULT_OUTPUT_FORMAT = 'rgba';
|
|
9
|
+
/**
|
|
10
|
+
* @hidden
|
|
11
|
+
*/
|
|
12
|
+
export var DEFAULT_GRADIENT_BACKGROUND_COLOR = 'rgba(255, 0, 0, 1)';
|
|
13
|
+
/**
|
|
14
|
+
* @hidden
|
|
15
|
+
*/
|
|
16
|
+
export var DRAGHANDLE_MOVE_SPEED = 5;
|
|
17
|
+
/**
|
|
18
|
+
* @hidden
|
|
19
|
+
*/
|
|
20
|
+
export var AAA_RATIO = 7.0;
|
|
21
|
+
/**
|
|
22
|
+
* @hidden
|
|
23
|
+
*/
|
|
24
|
+
export var AA_RATIO = 4.5;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
import * as tslib_1 from "tslib";
|
|
6
|
+
import { LocalizationService } from '@progress/kendo-angular-l10n';
|
|
7
|
+
import { Component, Input } from '@angular/core';
|
|
8
|
+
/**
|
|
9
|
+
* @hidden
|
|
10
|
+
*/
|
|
11
|
+
var ContrastValidationComponent = /** @class */ (function () {
|
|
12
|
+
function ContrastValidationComponent(localization) {
|
|
13
|
+
this.localization = localization;
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(ContrastValidationComponent.prototype, "passMessage", {
|
|
16
|
+
get: function () {
|
|
17
|
+
return this.localization.get('passContrast');
|
|
18
|
+
},
|
|
19
|
+
enumerable: true,
|
|
20
|
+
configurable: true
|
|
21
|
+
});
|
|
22
|
+
Object.defineProperty(ContrastValidationComponent.prototype, "failMessage", {
|
|
23
|
+
get: function () {
|
|
24
|
+
return this.localization.get('failContrast');
|
|
25
|
+
},
|
|
26
|
+
enumerable: true,
|
|
27
|
+
configurable: true
|
|
28
|
+
});
|
|
29
|
+
Object.defineProperty(ContrastValidationComponent.prototype, "contrastText", {
|
|
30
|
+
get: function () {
|
|
31
|
+
return this.type + ": " + this.ratio.toFixed(1);
|
|
32
|
+
},
|
|
33
|
+
enumerable: true,
|
|
34
|
+
configurable: true
|
|
35
|
+
});
|
|
36
|
+
tslib_1.__decorate([
|
|
37
|
+
Input(),
|
|
38
|
+
tslib_1.__metadata("design:type", String)
|
|
39
|
+
], ContrastValidationComponent.prototype, "type", void 0);
|
|
40
|
+
tslib_1.__decorate([
|
|
41
|
+
Input(),
|
|
42
|
+
tslib_1.__metadata("design:type", Number)
|
|
43
|
+
], ContrastValidationComponent.prototype, "ratio", void 0);
|
|
44
|
+
tslib_1.__decorate([
|
|
45
|
+
Input(),
|
|
46
|
+
tslib_1.__metadata("design:type", Boolean)
|
|
47
|
+
], ContrastValidationComponent.prototype, "pass", void 0);
|
|
48
|
+
ContrastValidationComponent = tslib_1.__decorate([
|
|
49
|
+
Component({
|
|
50
|
+
selector: '[kendoContrastValidation]',
|
|
51
|
+
template: "\n <span>{{contrastText}}</span>\n <span class=\"k-contrast-validation k-text-success\" *ngIf=\"pass\">\n {{passMessage}}\n <span class=\"k-icon k-i-check\"></span>\n </span>\n <span class=\"k-contrast-validation k-text-error\" *ngIf=\"!pass\">\n {{failMessage}}\n <span class=\"k-icon k-i-close\"></span>\n </span>\n "
|
|
52
|
+
}),
|
|
53
|
+
tslib_1.__metadata("design:paramtypes", [LocalizationService])
|
|
54
|
+
], ContrastValidationComponent);
|
|
55
|
+
return ContrastValidationComponent;
|
|
56
|
+
}());
|
|
57
|
+
export { ContrastValidationComponent };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
import * as tslib_1 from "tslib";
|
|
6
|
+
import { LocalizationService } from '@progress/kendo-angular-l10n';
|
|
7
|
+
import { Component, Input } from '@angular/core';
|
|
8
|
+
import { getContrastFromTwoRGBAs, getRGBA } from './utils';
|
|
9
|
+
import { AA_RATIO, AAA_RATIO } from './constants';
|
|
10
|
+
/**
|
|
11
|
+
* @hidden
|
|
12
|
+
*/
|
|
13
|
+
var ContrastComponent = /** @class */ (function () {
|
|
14
|
+
function ContrastComponent(localization) {
|
|
15
|
+
this.localization = localization;
|
|
16
|
+
this.aaRatio = AA_RATIO;
|
|
17
|
+
this.aaaRatio = AAA_RATIO;
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(ContrastComponent.prototype, "formatedRatio", {
|
|
20
|
+
get: function () {
|
|
21
|
+
return this.contrastRatio.toFixed(2);
|
|
22
|
+
},
|
|
23
|
+
enumerable: true,
|
|
24
|
+
configurable: true
|
|
25
|
+
});
|
|
26
|
+
Object.defineProperty(ContrastComponent.prototype, "contrastRatioMessage", {
|
|
27
|
+
get: function () {
|
|
28
|
+
return this.localization.get('contrastRatio');
|
|
29
|
+
},
|
|
30
|
+
enumerable: true,
|
|
31
|
+
configurable: true
|
|
32
|
+
});
|
|
33
|
+
Object.defineProperty(ContrastComponent.prototype, "satisfiesAACondition", {
|
|
34
|
+
get: function () {
|
|
35
|
+
return this.contrastRatio >= this.aaRatio;
|
|
36
|
+
},
|
|
37
|
+
enumerable: true,
|
|
38
|
+
configurable: true
|
|
39
|
+
});
|
|
40
|
+
Object.defineProperty(ContrastComponent.prototype, "satisfiesAAACondition", {
|
|
41
|
+
get: function () {
|
|
42
|
+
return this.contrastRatio >= this.aaaRatio;
|
|
43
|
+
},
|
|
44
|
+
enumerable: true,
|
|
45
|
+
configurable: true
|
|
46
|
+
});
|
|
47
|
+
Object.defineProperty(ContrastComponent.prototype, "contrastRatio", {
|
|
48
|
+
get: function () {
|
|
49
|
+
var contrast = getContrastFromTwoRGBAs(getRGBA(this.value), getRGBA(this.ratio));
|
|
50
|
+
return contrast;
|
|
51
|
+
},
|
|
52
|
+
enumerable: true,
|
|
53
|
+
configurable: true
|
|
54
|
+
});
|
|
55
|
+
tslib_1.__decorate([
|
|
56
|
+
Input(),
|
|
57
|
+
tslib_1.__metadata("design:type", String)
|
|
58
|
+
], ContrastComponent.prototype, "value", void 0);
|
|
59
|
+
tslib_1.__decorate([
|
|
60
|
+
Input(),
|
|
61
|
+
tslib_1.__metadata("design:type", String)
|
|
62
|
+
], ContrastComponent.prototype, "ratio", void 0);
|
|
63
|
+
ContrastComponent = tslib_1.__decorate([
|
|
64
|
+
Component({
|
|
65
|
+
selector: '[kendoContrastTool]',
|
|
66
|
+
template: "\n <div class=\"k-contrast-ratio\">\n <span class=\"k-contrast-ratio-text\">{{contrastRatioMessage}}: {{formatedRatio}}</span>\n <span class=\"k-contrast-validation k-text-success\" *ngIf=\"satisfiesAACondition\">\n <span class=\"k-icon k-i-check\"></span>\n <span class=\"k-icon k-i-check\" *ngIf=\"satisfiesAAACondition\"></span>\n </span>\n <span class=\"k-contrast-validation k-text-error\" *ngIf=\"!satisfiesAACondition\">\n <span class=\"k-icon k-i-close\"></span>\n </span>\n </div>\n <div kendoContrastValidation\n type=\"AA\"\n [ratio]=\"aaaRatio\"\n [pass]=\"satisfiesAACondition\">\n </div>\n <div kendoContrastValidation\n type=\"AAA\"\n [ratio]=\"aaaRatio\"\n [pass]=\"satisfiesAAACondition\">\n </div>\n "
|
|
67
|
+
}),
|
|
68
|
+
tslib_1.__metadata("design:paramtypes", [LocalizationService])
|
|
69
|
+
], ContrastComponent);
|
|
70
|
+
return ContrastComponent;
|
|
71
|
+
}());
|
|
72
|
+
export { ContrastComponent };
|
|
@@ -57,6 +57,18 @@ var ColorPickerMessages = /** @class */ (function (_super) {
|
|
|
57
57
|
Input(),
|
|
58
58
|
tslib_1.__metadata("design:type", String)
|
|
59
59
|
], ColorPickerMessages.prototype, "alphaInputPlaceholder", void 0);
|
|
60
|
+
tslib_1.__decorate([
|
|
61
|
+
Input(),
|
|
62
|
+
tslib_1.__metadata("design:type", String)
|
|
63
|
+
], ColorPickerMessages.prototype, "passContrast", void 0);
|
|
64
|
+
tslib_1.__decorate([
|
|
65
|
+
Input(),
|
|
66
|
+
tslib_1.__metadata("design:type", String)
|
|
67
|
+
], ColorPickerMessages.prototype, "failContrast", void 0);
|
|
68
|
+
tslib_1.__decorate([
|
|
69
|
+
Input(),
|
|
70
|
+
tslib_1.__metadata("design:type", String)
|
|
71
|
+
], ColorPickerMessages.prototype, "contrastRatio", void 0);
|
|
60
72
|
return ColorPickerMessages;
|
|
61
73
|
}(ComponentMessages));
|
|
62
74
|
export { ColorPickerMessages };
|
|
@@ -0,0 +1,4 @@
|
|
|
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
|
+
*-------------------------------------------------------------------------------------------*/
|
|
@@ -103,3 +103,55 @@ export function nameFormat(value, safe) {
|
|
|
103
103
|
}
|
|
104
104
|
return key;
|
|
105
105
|
}
|
|
106
|
+
/**
|
|
107
|
+
* @hidden
|
|
108
|
+
*
|
|
109
|
+
* Returns the RGB object representation of the color based on the background color.
|
|
110
|
+
*/
|
|
111
|
+
export var getRGBFromRGBA = function (foregroundColor, backgroundColor) {
|
|
112
|
+
var r1 = fitIntoBounds(foregroundColor.r, 0, 255);
|
|
113
|
+
var g1 = fitIntoBounds(foregroundColor.g, 0, 255);
|
|
114
|
+
var b1 = fitIntoBounds(foregroundColor.b, 0, 255);
|
|
115
|
+
var a1 = fitIntoBounds(foregroundColor.a, 0, 1);
|
|
116
|
+
var r2 = fitIntoBounds(backgroundColor.r, 0, 255);
|
|
117
|
+
var g2 = fitIntoBounds(backgroundColor.g, 0, 255);
|
|
118
|
+
var b2 = fitIntoBounds(backgroundColor.b, 0, 255);
|
|
119
|
+
return {
|
|
120
|
+
r: Math.round(((1 - a1) * r2) + (a1 * r1)),
|
|
121
|
+
g: Math.round(((1 - a1) * g2) + (a1 * g1)),
|
|
122
|
+
b: Math.round(((1 - a1) * b2) + (a1 * b1))
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* @hidden
|
|
127
|
+
*
|
|
128
|
+
* Returns the relative luminance.
|
|
129
|
+
*/
|
|
130
|
+
export var getLuminance = function (rgb) {
|
|
131
|
+
var a = [rgb.r, rgb.g, rgb.b].map(function (v) {
|
|
132
|
+
v /= 255;
|
|
133
|
+
return v <= 0.03928
|
|
134
|
+
? v / 12.92
|
|
135
|
+
: Math.pow((v + 0.055) / 1.055, 2.4);
|
|
136
|
+
});
|
|
137
|
+
return a[0] * 0.2126 + a[1] * 0.7152 + a[2] * 0.0722;
|
|
138
|
+
};
|
|
139
|
+
/**
|
|
140
|
+
* @hidden
|
|
141
|
+
*
|
|
142
|
+
* Returns the color contrast.
|
|
143
|
+
*/
|
|
144
|
+
export var getContrast = function (luminance1, luminance2) {
|
|
145
|
+
var brightest = Math.max(luminance1, luminance2);
|
|
146
|
+
var darkest = Math.min(luminance1, luminance2);
|
|
147
|
+
return (brightest + 0.05)
|
|
148
|
+
/ (darkest + 0.05);
|
|
149
|
+
};
|
|
150
|
+
/**
|
|
151
|
+
* @hidden
|
|
152
|
+
*
|
|
153
|
+
* Returns the color contrast from two RGBA colors.
|
|
154
|
+
*/
|
|
155
|
+
export var getContrastFromTwoRGBAs = function (a, b) {
|
|
156
|
+
return getContrast(getLuminance(getRGBFromRGBA(a, b)), getLuminance(getRGBFromRGBA(b, { r: 0, g: 0, b: 0, a: 1 })));
|
|
157
|
+
};
|
|
@@ -16,6 +16,8 @@ import { ColorInputComponent } from './colorpicker/color-input.component';
|
|
|
16
16
|
import { ColorPickerCustomMessagesComponent } from './colorpicker/localization/custom-messages.component';
|
|
17
17
|
import { LocalizedColorPickerMessagesDirective } from './colorpicker/localization/localized-colorpicker-messages.directive';
|
|
18
18
|
import { FocusOnDomReadyDirective } from './colorpicker/focus-on-dom-ready.directive';
|
|
19
|
+
import { ContrastValidationComponent } from './colorpicker/contrast-validation.component';
|
|
20
|
+
import { ContrastComponent } from './colorpicker/contrast.component';
|
|
19
21
|
var PUBLIC_DIRECTIVES = [
|
|
20
22
|
ColorPickerComponent,
|
|
21
23
|
ColorPaletteComponent,
|
|
@@ -25,7 +27,9 @@ var PUBLIC_DIRECTIVES = [
|
|
|
25
27
|
];
|
|
26
28
|
var INTERNAL_DIRECTIVES = [
|
|
27
29
|
ColorInputComponent,
|
|
28
|
-
FocusOnDomReadyDirective
|
|
30
|
+
FocusOnDomReadyDirective,
|
|
31
|
+
ContrastComponent,
|
|
32
|
+
ContrastValidationComponent
|
|
29
33
|
];
|
|
30
34
|
/**
|
|
31
35
|
* Represents the [NgModule]({{ site.data.urls.angular['ngmoduleapi'] }})
|
package/dist/es/index.js
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
export * from './main';
|
|
9
9
|
export { CheckBoxModule } from './checkbox.module';
|
|
10
10
|
export { ColorInputComponent } from './colorpicker/color-input.component';
|
|
11
|
+
export { ContrastValidationComponent } from './colorpicker/contrast-validation.component';
|
|
12
|
+
export { ContrastComponent } from './colorpicker/contrast.component';
|
|
11
13
|
export { FocusOnDomReadyDirective } from './colorpicker/focus-on-dom-ready.directive';
|
|
12
14
|
export { ColorGradientLocalizationService } from './colorpicker/localization/colorgradient-localization.service';
|
|
13
15
|
export { ColorPaletteLocalizationService } from './colorpicker/localization/colorpalette-localization.service';
|
|
@@ -16,7 +16,7 @@ import { L10N_PREFIX, LocalizationService } from '@progress/kendo-angular-l10n';
|
|
|
16
16
|
import { validatePackage } from '@progress/kendo-licensing';
|
|
17
17
|
import { packageMetadata } from '../package-metadata';
|
|
18
18
|
import { MIN_DOC_LINK, MAX_DOC_LINK, POINT, INITIAL_SPIN_DELAY, SPIN_DELAY, EXPONENT_REGEX } from './constants';
|
|
19
|
-
import { defined, noop, numericRegex, isNumber, pad, decimalPart, getDeltaFromMouseWheel, getCaretPosition, extractSignificantNumericChars } from './utils';
|
|
19
|
+
import { defined, noop, numericRegex, isNumber, pad, decimalPart, getDeltaFromMouseWheel, getCaretPosition, extractSignificantNumericChars, isRightClick } from './utils';
|
|
20
20
|
import { ArrowDirection } from './arrow-direction';
|
|
21
21
|
import { mobileOS } from '@progress/kendo-common';
|
|
22
22
|
var PARSABLE_OPTIONS = ['min', 'max', 'step', 'decimals'];
|
|
@@ -533,7 +533,7 @@ var NumericTextBoxComponent = /** @class */ (function () {
|
|
|
533
533
|
});
|
|
534
534
|
NumericTextBoxComponent.prototype.arrowPress = function (direction, e) {
|
|
535
535
|
e.preventDefault();
|
|
536
|
-
if (this.isDisabled) {
|
|
536
|
+
if (this.isDisabled || isRightClick(e)) {
|
|
537
537
|
return;
|
|
538
538
|
}
|
|
539
539
|
if (!mobileOS) {
|
|
@@ -81,3 +81,11 @@ export var extractSignificantNumericChars = function (formattedString, separator
|
|
|
81
81
|
var significantCharacters = separator + "0123456789-";
|
|
82
82
|
return formattedString.split('').reduce(function (acc, curr) { return significantCharacters.includes(curr) ? ++acc : acc; }, 0);
|
|
83
83
|
};
|
|
84
|
+
/**
|
|
85
|
+
* @hidden
|
|
86
|
+
*/
|
|
87
|
+
export var isRightClick = function (event) {
|
|
88
|
+
var isRightClickIE = event.button && event.button === 2;
|
|
89
|
+
var isRightClickOther = event.which && event.which === 3;
|
|
90
|
+
return isRightClickIE || isRightClickOther;
|
|
91
|
+
};
|
|
@@ -9,7 +9,7 @@ export var packageMetadata = {
|
|
|
9
9
|
name: '@progress/kendo-angular-inputs',
|
|
10
10
|
productName: 'Kendo UI for Angular',
|
|
11
11
|
productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
|
|
12
|
-
publishDate:
|
|
12
|
+
publishDate: 1635407992,
|
|
13
13
|
version: '',
|
|
14
14
|
licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning'
|
|
15
15
|
};
|
|
@@ -71,6 +71,11 @@ export declare class ColorGradientComponent implements OnChanges, OnDestroy, Con
|
|
|
71
71
|
* Specifies the value of the initially selected color.
|
|
72
72
|
*/
|
|
73
73
|
value: string;
|
|
74
|
+
/**
|
|
75
|
+
* Enables the color contrast tool. Accepts the background color that will be compared to the selected value.
|
|
76
|
+
* The tool will calculate the contrast ratio between two colors. Currently, only the RGBA format is supported.
|
|
77
|
+
*/
|
|
78
|
+
contrastTool: string;
|
|
74
79
|
/**
|
|
75
80
|
* Specifies the [tabindex](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the component.
|
|
76
81
|
*/
|
|
@@ -126,6 +131,10 @@ export declare class ColorGradientComponent implements OnChanges, OnDestroy, Con
|
|
|
126
131
|
private alphaSlider;
|
|
127
132
|
private gradientWrapper;
|
|
128
133
|
private readonly gradientRect;
|
|
134
|
+
/**
|
|
135
|
+
* @hidden
|
|
136
|
+
*/
|
|
137
|
+
readonly contrastToolVisible: boolean;
|
|
129
138
|
constructor(host: ElementRef, ngZone: NgZone, renderer: Renderer2, cdr: ChangeDetectorRef, localizationService: LocalizationService);
|
|
130
139
|
ngAfterViewInit(): void;
|
|
131
140
|
ngOnChanges(changes: SimpleChanges): void;
|