@progress/kendo-angular-inputs 7.5.2 → 8.0.0-dev.202112161434
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/js/kendo-angular-inputs.js +2 -2
- package/dist/cdn/main.js +1 -1
- package/dist/es/colorpicker/color-contrast-svg.component.js +95 -0
- package/dist/es/colorpicker/color-gradient.component.js +109 -81
- package/dist/es/colorpicker/color-input.component.js +39 -18
- package/dist/es/colorpicker/color-palette.component.js +28 -18
- package/dist/es/colorpicker/colorpicker.component.js +170 -76
- package/dist/es/colorpicker/constants.js +12 -0
- package/dist/es/colorpicker/contrast-validation.component.js +8 -6
- package/dist/es/colorpicker/contrast.component.js +6 -8
- package/dist/es/colorpicker/{models → events}/active-color-click-event.js +0 -0
- package/dist/es/colorpicker/events/cancel-event.js +19 -0
- package/dist/es/colorpicker/events/close-event.js +17 -0
- package/dist/es/colorpicker/{models → events}/kendo-drag-event.js +0 -0
- package/dist/es/colorpicker/events/open-event.js +17 -0
- package/dist/es/colorpicker/events.js +8 -0
- package/dist/es/colorpicker/flatcolorpicker-actions.component.js +50 -0
- package/dist/es/colorpicker/flatcolorpicker-header.component.js +94 -0
- package/dist/es/colorpicker/flatcolorpicker.component.js +553 -0
- package/dist/es/colorpicker/localization/colorgradient-localization.service.js +7 -7
- package/dist/es/colorpicker/localization/colorpalette-localization.service.js +7 -7
- package/dist/es/colorpicker/localization/custom-messages.component.js +1 -1
- package/dist/es/colorpicker/localization/flatcolorpicker-localization.service.js +34 -0
- package/dist/es/colorpicker/localization/localized-colorpicker-messages.directive.js +1 -1
- package/dist/es/colorpicker/localization/messages.js +36 -0
- package/dist/es/colorpicker/models/{color-picker-view.js → actions-layout.js} +0 -0
- package/dist/{es2015/colorpicker/models/color-picker-view.js → es/colorpicker/models/colorpicker-view.js} +0 -0
- package/dist/es/colorpicker/{utils → models}/palette-presets.js +0 -0
- package/dist/es/colorpicker/models.js +1 -2
- package/dist/es/colorpicker/services/flatcolorpicker.service.js +41 -0
- package/dist/es/colorpicker/utils/color-parser.js +18 -5
- package/dist/es/colorpicker/utils/contrast-curve.js +91 -0
- package/dist/es/colorpicker/utils.js +1 -1
- package/dist/es/colorpicker.module.js +9 -1
- package/dist/es/index.js +5 -0
- package/dist/es/main.js +4 -1
- package/dist/es/package-metadata.js +1 -1
- package/dist/es2015/colorpicker/color-contrast-svg.component.d.ts +26 -0
- package/dist/es2015/colorpicker/color-contrast-svg.component.js +97 -0
- package/dist/es2015/colorpicker/color-gradient.component.d.ts +32 -43
- package/dist/es2015/colorpicker/color-gradient.component.js +125 -92
- package/dist/es2015/colorpicker/color-input.component.d.ts +11 -4
- package/dist/es2015/colorpicker/color-input.component.js +52 -32
- package/dist/es2015/colorpicker/color-palette.component.d.ts +8 -3
- package/dist/es2015/colorpicker/color-palette.component.js +28 -18
- package/dist/es2015/colorpicker/colorpicker.component.d.ts +84 -24
- package/dist/es2015/colorpicker/colorpicker.component.js +195 -112
- package/dist/es2015/colorpicker/constants.d.ts +12 -0
- package/dist/es2015/colorpicker/constants.js +12 -0
- package/dist/es2015/colorpicker/contrast-validation.component.d.ts +1 -1
- package/dist/es2015/colorpicker/contrast-validation.component.js +16 -12
- package/dist/es2015/colorpicker/contrast.component.d.ts +1 -3
- package/dist/es2015/colorpicker/contrast.component.js +17 -17
- package/dist/es2015/colorpicker/{models → events}/active-color-click-event.d.ts +0 -0
- package/dist/es2015/colorpicker/{models → events}/active-color-click-event.js +0 -0
- package/dist/es2015/colorpicker/events/cancel-event.d.ts +15 -0
- package/dist/es2015/colorpicker/events/cancel-event.js +14 -0
- package/dist/es2015/colorpicker/events/close-event.d.ts +10 -0
- package/dist/es2015/colorpicker/events/close-event.js +10 -0
- package/dist/es2015/colorpicker/{models → events}/kendo-drag-event.d.ts +0 -0
- package/dist/es2015/colorpicker/{models → events}/kendo-drag-event.js +0 -0
- package/dist/es2015/colorpicker/events/open-event.d.ts +10 -0
- package/dist/es2015/colorpicker/events/open-event.js +10 -0
- package/dist/es2015/colorpicker/events.d.ts +8 -0
- package/dist/es2015/colorpicker/events.js +8 -0
- package/dist/es2015/colorpicker/flatcolorpicker-actions.component.d.ts +18 -0
- package/dist/es2015/colorpicker/flatcolorpicker-actions.component.js +60 -0
- package/dist/es2015/colorpicker/flatcolorpicker-header.component.d.ts +30 -0
- package/dist/es2015/colorpicker/flatcolorpicker-header.component.js +131 -0
- package/dist/es2015/colorpicker/flatcolorpicker.component.d.ts +214 -0
- package/dist/es2015/colorpicker/flatcolorpicker.component.js +593 -0
- package/dist/es2015/colorpicker/localization/colorgradient-localization.service.d.ts +3 -3
- package/dist/es2015/colorpicker/localization/colorgradient-localization.service.js +7 -7
- package/dist/es2015/colorpicker/localization/colorpalette-localization.service.d.ts +3 -3
- package/dist/es2015/colorpicker/localization/colorpalette-localization.service.js +7 -7
- package/dist/es2015/colorpicker/localization/custom-messages.component.js +1 -1
- package/dist/es2015/colorpicker/localization/flatcolorpicker-localization.service.d.ts +14 -0
- package/dist/es2015/colorpicker/localization/flatcolorpicker-localization.service.js +31 -0
- package/dist/es2015/colorpicker/localization/localized-colorpicker-messages.directive.js +1 -1
- package/dist/es2015/colorpicker/localization/messages.d.ts +36 -0
- package/dist/es2015/colorpicker/localization/messages.js +36 -0
- package/dist/es2015/colorpicker/models/actions-layout.d.ts +8 -0
- package/dist/es2015/colorpicker/models/actions-layout.js +4 -0
- package/dist/es2015/colorpicker/models/colorpicker-view.d.ts +8 -0
- package/dist/es2015/colorpicker/models/colorpicker-view.js +4 -0
- package/dist/es2015/colorpicker/models/gradient-settings.d.ts +4 -3
- package/dist/es2015/colorpicker/models/output-format.d.ts +0 -5
- package/dist/es2015/colorpicker/{utils → models}/palette-presets.d.ts +0 -0
- package/dist/es2015/colorpicker/{utils → models}/palette-presets.js +0 -0
- package/dist/es2015/colorpicker/models/palette-settings.d.ts +2 -3
- package/dist/es2015/colorpicker/models/tile-size.d.ts +1 -5
- package/dist/es2015/colorpicker/models.d.ts +10 -10
- package/dist/es2015/colorpicker/models.js +1 -2
- package/dist/es2015/colorpicker/{models/color-picker-view.d.ts → services/flatcolorpicker.service.d.ts} +6 -7
- package/dist/es2015/colorpicker/services/flatcolorpicker.service.js +38 -0
- package/dist/es2015/colorpicker/utils/color-parser.d.ts +8 -2
- package/dist/es2015/colorpicker/utils/color-parser.js +15 -5
- package/dist/es2015/colorpicker/utils/contrast-curve.d.ts +37 -0
- package/dist/es2015/colorpicker/utils/contrast-curve.js +85 -0
- package/dist/es2015/colorpicker/utils.d.ts +1 -1
- package/dist/es2015/colorpicker/utils.js +1 -1
- package/dist/es2015/colorpicker.module.js +9 -1
- package/dist/es2015/index.d.ts +5 -0
- package/dist/es2015/index.js +5 -0
- package/dist/es2015/index.metadata.json +1 -1
- package/dist/es2015/main.d.ts +4 -1
- package/dist/es2015/main.js +4 -1
- package/dist/es2015/package-metadata.js +1 -1
- package/dist/fesm2015/index.js +2207 -1043
- package/dist/fesm5/index.js +2010 -907
- package/dist/npm/colorpicker/color-contrast-svg.component.js +97 -0
- package/dist/npm/colorpicker/color-gradient.component.js +109 -81
- package/dist/npm/colorpicker/color-input.component.js +38 -17
- package/dist/npm/colorpicker/color-palette.component.js +29 -19
- package/dist/npm/colorpicker/colorpicker.component.js +177 -83
- package/dist/npm/colorpicker/constants.js +12 -0
- package/dist/npm/colorpicker/contrast-validation.component.js +8 -6
- package/dist/npm/colorpicker/contrast.component.js +6 -8
- package/dist/npm/colorpicker/{models → events}/active-color-click-event.js +0 -0
- package/dist/npm/colorpicker/events/cancel-event.js +21 -0
- package/dist/npm/colorpicker/events/close-event.js +19 -0
- package/dist/npm/colorpicker/{models → events}/kendo-drag-event.js +0 -0
- package/dist/npm/colorpicker/events/open-event.js +19 -0
- package/dist/npm/colorpicker/events.js +11 -0
- package/dist/npm/colorpicker/flatcolorpicker-actions.component.js +52 -0
- package/dist/npm/colorpicker/flatcolorpicker-header.component.js +96 -0
- package/dist/npm/colorpicker/flatcolorpicker.component.js +555 -0
- package/dist/npm/colorpicker/localization/colorgradient-localization.service.js +7 -7
- package/dist/npm/colorpicker/localization/colorpalette-localization.service.js +7 -7
- package/dist/npm/colorpicker/localization/custom-messages.component.js +1 -1
- package/dist/npm/colorpicker/localization/flatcolorpicker-localization.service.js +36 -0
- package/dist/npm/colorpicker/localization/localized-colorpicker-messages.directive.js +1 -1
- package/dist/npm/colorpicker/localization/messages.js +36 -0
- package/dist/npm/colorpicker/models/{color-picker-view.js → actions-layout.js} +0 -0
- package/dist/npm/colorpicker/models/colorpicker-view.js +6 -0
- package/dist/npm/colorpicker/{utils → models}/palette-presets.js +0 -0
- package/dist/npm/colorpicker/models.js +1 -2
- package/dist/npm/colorpicker/services/flatcolorpicker.service.js +43 -0
- package/dist/npm/colorpicker/utils/color-parser.js +18 -5
- package/dist/npm/colorpicker/utils/contrast-curve.js +93 -0
- package/dist/npm/colorpicker/utils.js +1 -1
- package/dist/npm/colorpicker.module.js +9 -1
- package/dist/npm/index.js +10 -0
- package/dist/npm/main.js +7 -2
- package/dist/npm/package-metadata.js +1 -1
- package/dist/systemjs/kendo-angular-inputs.js +1 -1
- package/package.json +3 -2
- package/dist/es/colorpicker/models/preventable-event.js +0 -29
- package/dist/es2015/colorpicker/models/preventable-event.d.ts +0 -21
- package/dist/es2015/colorpicker/models/preventable-event.js +0 -27
- package/dist/npm/colorpicker/models/preventable-event.js +0 -31
|
@@ -6,17 +6,22 @@ import * as tslib_1 from "tslib";
|
|
|
6
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
|
-
import { isDocumentAvailable } from '@progress/kendo-angular-common';
|
|
10
|
-
import { LocalizationService } from '@progress/kendo-angular-l10n';
|
|
9
|
+
import { guid, isDocumentAvailable } from '@progress/kendo-angular-common';
|
|
11
10
|
import { Subscription } from 'rxjs';
|
|
11
|
+
import { LocalizationService } from '@progress/kendo-angular-l10n';
|
|
12
|
+
import { NumericTextBoxComponent } from './../numerictextbox/numerictextbox.component';
|
|
12
13
|
/**
|
|
13
14
|
* @hidden
|
|
14
15
|
*/
|
|
15
16
|
var ColorInputComponent = /** @class */ (function () {
|
|
16
|
-
function ColorInputComponent(
|
|
17
|
-
this.localization = localization;
|
|
17
|
+
function ColorInputComponent(host, renderer, localizationService) {
|
|
18
18
|
this.host = host;
|
|
19
19
|
this.renderer = renderer;
|
|
20
|
+
this.localizationService = localizationService;
|
|
21
|
+
/**
|
|
22
|
+
* The id of the hex input.
|
|
23
|
+
*/
|
|
24
|
+
this.focusableId = "k-" + guid();
|
|
20
25
|
/**
|
|
21
26
|
* Sets whether the alpha slider will be shown.
|
|
22
27
|
*/
|
|
@@ -75,11 +80,18 @@ var ColorInputComponent = /** @class */ (function () {
|
|
|
75
80
|
};
|
|
76
81
|
ColorInputComponent.prototype.ngOnChanges = function (changes) {
|
|
77
82
|
if (isPresent(changes.value) && !this.isFocused) {
|
|
78
|
-
this.hex = parseColor(this.value, 'hex');
|
|
83
|
+
this.hex = parseColor(this.value, 'hex', this.opacity);
|
|
79
84
|
this.rgba = getRGBA(this.value);
|
|
80
|
-
this.rgba.a = parseColor(this.value, 'rgba') ? this.rgba.a : 1;
|
|
85
|
+
this.rgba.a = parseColor(this.value, 'rgba', this.opacity) ? this.rgba.a : 1;
|
|
81
86
|
}
|
|
82
87
|
};
|
|
88
|
+
Object.defineProperty(ColorInputComponent.prototype, "formatButtonTitle", {
|
|
89
|
+
get: function () {
|
|
90
|
+
return this.localizationService.get('formatButton');
|
|
91
|
+
},
|
|
92
|
+
enumerable: true,
|
|
93
|
+
configurable: true
|
|
94
|
+
});
|
|
83
95
|
ColorInputComponent.prototype.handleRgbaValueChange = function () {
|
|
84
96
|
var color = getColorFromRGBA(this.rgba);
|
|
85
97
|
if (!this.rgbaInputValid || color === this.value) {
|
|
@@ -87,12 +99,12 @@ var ColorInputComponent = /** @class */ (function () {
|
|
|
87
99
|
}
|
|
88
100
|
this.value = color;
|
|
89
101
|
this.rgba = getRGBA(this.value);
|
|
90
|
-
this.hex = parseColor(color, 'hex');
|
|
102
|
+
this.hex = parseColor(color, 'hex', this.opacity);
|
|
91
103
|
this.valueChange.emit(color);
|
|
92
104
|
};
|
|
93
105
|
ColorInputComponent.prototype.handleHexValueChange = function (hex) {
|
|
94
106
|
this.hex = hex;
|
|
95
|
-
var color = parseColor(hex, 'rgba');
|
|
107
|
+
var color = parseColor(hex, 'rgba', this.opacity);
|
|
96
108
|
if (!isPresent(color) || color === this.value) {
|
|
97
109
|
return;
|
|
98
110
|
}
|
|
@@ -106,10 +118,7 @@ var ColorInputComponent = /** @class */ (function () {
|
|
|
106
118
|
}
|
|
107
119
|
};
|
|
108
120
|
ColorInputComponent.prototype.handleHexInputBlur = function () {
|
|
109
|
-
this.hex = parseColor(this.value, 'hex');
|
|
110
|
-
};
|
|
111
|
-
ColorInputComponent.prototype.textFor = function (key) {
|
|
112
|
-
return this.localization.get(key);
|
|
121
|
+
this.hex = parseColor(this.value, 'hex', this.opacity);
|
|
113
122
|
};
|
|
114
123
|
ColorInputComponent.prototype.toggleFormatView = function () {
|
|
115
124
|
this.formatView = this.formatView === 'hex' ? 'rgba' : 'hex';
|
|
@@ -121,6 +130,10 @@ var ColorInputComponent = /** @class */ (function () {
|
|
|
121
130
|
}
|
|
122
131
|
this.subscriptions.add(this.renderer.listen(this.toggleFormatButton.nativeElement, 'click', function () { return _this.toggleFormatView(); }));
|
|
123
132
|
};
|
|
133
|
+
tslib_1.__decorate([
|
|
134
|
+
Input(),
|
|
135
|
+
tslib_1.__metadata("design:type", String)
|
|
136
|
+
], ColorInputComponent.prototype, "focusableId", void 0);
|
|
124
137
|
tslib_1.__decorate([
|
|
125
138
|
Input(),
|
|
126
139
|
tslib_1.__metadata("design:type", String)
|
|
@@ -151,9 +164,17 @@ var ColorInputComponent = /** @class */ (function () {
|
|
|
151
164
|
tslib_1.__metadata("design:type", Boolean)
|
|
152
165
|
], ColorInputComponent.prototype, "colorInputClass", void 0);
|
|
153
166
|
tslib_1.__decorate([
|
|
154
|
-
ViewChild('opacityInput', {
|
|
155
|
-
tslib_1.__metadata("design:type",
|
|
167
|
+
ViewChild('opacityInput', { static: false }),
|
|
168
|
+
tslib_1.__metadata("design:type", NumericTextBoxComponent)
|
|
156
169
|
], ColorInputComponent.prototype, "opacityInput", void 0);
|
|
170
|
+
tslib_1.__decorate([
|
|
171
|
+
ViewChild('hexInput', { read: ElementRef, static: false }),
|
|
172
|
+
tslib_1.__metadata("design:type", ElementRef)
|
|
173
|
+
], ColorInputComponent.prototype, "hexInput", void 0);
|
|
174
|
+
tslib_1.__decorate([
|
|
175
|
+
ViewChild('blueInput', { read: ElementRef, static: false }),
|
|
176
|
+
tslib_1.__metadata("design:type", ElementRef)
|
|
177
|
+
], ColorInputComponent.prototype, "blueInput", void 0);
|
|
157
178
|
tslib_1.__decorate([
|
|
158
179
|
ViewChild('toggleFormatButton', { static: false }),
|
|
159
180
|
tslib_1.__metadata("design:type", ElementRef)
|
|
@@ -161,11 +182,11 @@ var ColorInputComponent = /** @class */ (function () {
|
|
|
161
182
|
ColorInputComponent = tslib_1.__decorate([
|
|
162
183
|
Component({
|
|
163
184
|
selector: 'kendo-colorinput',
|
|
164
|
-
template: "\n <div class=\"k-vstack\">\n <button class=\"k-colorgradient-toggle-mode k-button k-icon-button k-flat\"
|
|
185
|
+
template: "\n <div class=\"k-vstack\">\n <button #toggleFormatButton\n class=\"k-colorgradient-toggle-mode k-button k-icon-button k-flat\"\n [attr.aria-label]=\"formatButtonTitle\"\n [attr.title]=\"formatButtonTitle\"\n >\n <span class=\"k-button-icon k-icon k-i-arrows-kpi\"></span>\n </button>\n </div>\n <div *ngIf=\"formatView === 'hex'\" class=\"k-vstack\">\n <input\n #hexInput\n [id]=\"focusableId\"\n class=\"k-textbox k-hex-value\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly\"\n [value]=\"hex || ''\"\n (blur)=\"handleHexInputBlur()\"\n (input)=\"handleHexValueChange(hexInput.value)\"\n />\n <label [for]=\"focusableId\" class=\"k-colorgradient-input-label\">HEX</label>\n </div>\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 [(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 [(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 [(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 [(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 "
|
|
165
186
|
}),
|
|
166
|
-
tslib_1.__metadata("design:paramtypes", [
|
|
167
|
-
|
|
168
|
-
|
|
187
|
+
tslib_1.__metadata("design:paramtypes", [ElementRef,
|
|
188
|
+
Renderer2,
|
|
189
|
+
LocalizationService])
|
|
169
190
|
], ColorInputComponent);
|
|
170
191
|
return ColorInputComponent;
|
|
171
192
|
}());
|
|
@@ -5,10 +5,11 @@
|
|
|
5
5
|
import * as tslib_1 from "tslib";
|
|
6
6
|
import { Component, Input, EventEmitter, Output, HostBinding, HostListener, forwardRef, ChangeDetectorRef, Renderer2, ElementRef } from '@angular/core';
|
|
7
7
|
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
8
|
-
import { PALETTEPRESETS
|
|
8
|
+
import { PALETTEPRESETS } from './models';
|
|
9
|
+
import { parseColor } from './utils';
|
|
9
10
|
import { isPresent } from '../common/utils';
|
|
10
11
|
import { ColorPaletteService } from './services/color-palette.service';
|
|
11
|
-
import { Keys, KendoInput } from '@progress/kendo-angular-common';
|
|
12
|
+
import { Keys, KendoInput, guid } from '@progress/kendo-angular-common';
|
|
12
13
|
import { LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
|
|
13
14
|
import { ColorPaletteLocalizationService } from './localization/colorpalette-localization.service';
|
|
14
15
|
var DEFAULT_TILE_SIZE = 24;
|
|
@@ -77,6 +78,10 @@ var ColorPaletteComponent = /** @class */ (function () {
|
|
|
77
78
|
* @hidden
|
|
78
79
|
*/
|
|
79
80
|
this.hostClasses = true;
|
|
81
|
+
/**
|
|
82
|
+
* @hidden
|
|
83
|
+
*/
|
|
84
|
+
this.uniqueId = guid();
|
|
80
85
|
this._tabindex = 0;
|
|
81
86
|
this.notifyNgTouched = function () { };
|
|
82
87
|
this.notifyNgChanged = function () { };
|
|
@@ -146,7 +151,7 @@ var ColorPaletteComponent = /** @class */ (function () {
|
|
|
146
151
|
value = PALETTEPRESETS[value].colors;
|
|
147
152
|
}
|
|
148
153
|
var colors = (typeof value === 'string') ? value.split(',') : value;
|
|
149
|
-
this._palette = colors.map(function (color) { return parseColor(color, _this.format, false); });
|
|
154
|
+
this._palette = colors.map(function (color) { return parseColor(color, _this.format, false, false); });
|
|
150
155
|
},
|
|
151
156
|
enumerable: true,
|
|
152
157
|
configurable: true
|
|
@@ -273,27 +278,22 @@ var ColorPaletteComponent = /** @class */ (function () {
|
|
|
273
278
|
/**
|
|
274
279
|
* @hidden
|
|
275
280
|
*/
|
|
276
|
-
ColorPaletteComponent.prototype.handleCellSelection = function (value,
|
|
281
|
+
ColorPaletteComponent.prototype.handleCellSelection = function (value, focusedCell) {
|
|
277
282
|
if (this.readonly) {
|
|
278
283
|
return;
|
|
279
284
|
}
|
|
280
|
-
this.selectedCell =
|
|
285
|
+
this.selectedCell = focusedCell;
|
|
281
286
|
this.focusedCell = this.selectedCell;
|
|
282
287
|
this.focusInComponent = true;
|
|
283
|
-
var parsedColor = parseColor(value, this.format, false);
|
|
288
|
+
var parsedColor = parseColor(value, this.format, false, false);
|
|
284
289
|
this.cellSelection.emit(parsedColor);
|
|
285
|
-
|
|
286
|
-
this.value = parsedColor;
|
|
287
|
-
this.valueChange.emit(parsedColor);
|
|
288
|
-
this.notifyNgChanged(parsedColor);
|
|
289
|
-
this.setHostElementAriaLabel();
|
|
290
|
-
}
|
|
290
|
+
this.handleValueChange(parsedColor);
|
|
291
291
|
if (this.selection !== parsedColor) {
|
|
292
292
|
this.selection = parsedColor;
|
|
293
293
|
this.selectionChange.emit(parsedColor);
|
|
294
294
|
}
|
|
295
|
-
if (
|
|
296
|
-
this.activeCellId = this.selectedCell.row + "-" + this.selectedCell.col;
|
|
295
|
+
if (focusedCell) {
|
|
296
|
+
this.activeCellId = "k-" + this.selectedCell.row + "-" + this.selectedCell.col + "-" + this.uniqueId;
|
|
297
297
|
}
|
|
298
298
|
};
|
|
299
299
|
/**
|
|
@@ -324,7 +324,7 @@ var ColorPaletteComponent = /** @class */ (function () {
|
|
|
324
324
|
};
|
|
325
325
|
/**
|
|
326
326
|
* @hidden
|
|
327
|
-
* Used by the
|
|
327
|
+
* Used by the FloatingLabel to determine if the component is empty.
|
|
328
328
|
*/
|
|
329
329
|
ColorPaletteComponent.prototype.isEmpty = function () {
|
|
330
330
|
return false;
|
|
@@ -335,9 +335,18 @@ var ColorPaletteComponent = /** @class */ (function () {
|
|
|
335
335
|
ColorPaletteComponent.prototype.reset = function () {
|
|
336
336
|
this.focusedCell = null;
|
|
337
337
|
if (isPresent(this.value)) {
|
|
338
|
-
this.
|
|
339
|
-
this.notifyNgChanged(undefined);
|
|
338
|
+
this.handleValueChange(undefined);
|
|
340
339
|
}
|
|
340
|
+
this.selectedCell = undefined;
|
|
341
|
+
};
|
|
342
|
+
ColorPaletteComponent.prototype.handleValueChange = function (color) {
|
|
343
|
+
if (this.value === color) {
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
this.value = color;
|
|
347
|
+
this.valueChange.emit(color);
|
|
348
|
+
this.notifyNgChanged(color);
|
|
349
|
+
this.setHostElementAriaLabel();
|
|
341
350
|
};
|
|
342
351
|
ColorPaletteComponent.prototype.handleCellFocusOnBlur = function () {
|
|
343
352
|
this.focusInComponent = false;
|
|
@@ -464,6 +473,7 @@ var ColorPaletteComponent = /** @class */ (function () {
|
|
|
464
473
|
], ColorPaletteComponent.prototype, "handleHostBlur", null);
|
|
465
474
|
ColorPaletteComponent = ColorPaletteComponent_1 = tslib_1.__decorate([
|
|
466
475
|
Component({
|
|
476
|
+
exportAs: 'kendoColorPalette',
|
|
467
477
|
selector: 'kendo-colorpalette',
|
|
468
478
|
providers: [
|
|
469
479
|
{
|
|
@@ -485,7 +495,7 @@ var ColorPaletteComponent = /** @class */ (function () {
|
|
|
485
495
|
useValue: 'kendo.colorpalette'
|
|
486
496
|
}
|
|
487
497
|
],
|
|
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 "
|
|
498
|
+
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]=\"'k-' + rowIndex + '-' + colIndex + '-' + uniqueId\"\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 "
|
|
489
499
|
}),
|
|
490
500
|
tslib_1.__metadata("design:paramtypes", [ElementRef,
|
|
491
501
|
ColorPaletteService,
|