@progress/kendo-angular-inputs 7.5.1 → 8.0.0-dev.202112211528
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/js/kendo-angular-inputs.js +2 -2
- package/dist/cdn/main.js +1 -1
- package/dist/es/checkbox/checkbox.directive.js +79 -3
- package/dist/es/colorpicker/color-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 +279 -80
- 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/common/models/fillmode.js +4 -0
- package/dist/es/common/models/rounded.js +4 -0
- package/dist/es/common/models/size.js +4 -0
- package/dist/es/common/models/styling-classes.js +4 -0
- package/dist/{es2015/colorpicker/models/kendo-drag-event.js → es/common/models.js} +0 -0
- package/dist/es/common/utils.js +37 -0
- package/dist/es/index.js +5 -0
- package/dist/es/main.js +4 -2
- package/dist/es/maskedtextbox/maskedtextbox.component.js +101 -6
- package/dist/es/numerictextbox/numerictextbox.component.js +116 -20
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/radiobutton/radiobutton.directive.js +52 -3
- package/dist/es/shared/textarea.directive.js +3 -2
- package/dist/es/shared/utils.js +23 -0
- package/dist/es/switch/switch.component.js +167 -21
- package/dist/es/text-fields-common/text-fields-base.js +1 -1
- package/dist/es/textarea/textarea.component.js +101 -5
- package/dist/es/textbox/textbox.component.js +111 -12
- package/dist/es/textbox/textbox.directive.js +3 -2
- package/dist/es/textbox.module.js +0 -3
- package/dist/es2015/checkbox/checkbox.directive.d.ts +31 -0
- package/dist/es2015/checkbox/checkbox.directive.js +68 -10
- package/dist/es2015/colorpicker/color-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 +126 -93
- 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 +127 -25
- package/dist/es2015/colorpicker/colorpicker.component.js +305 -125
- 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/events/kendo-drag-event.js +4 -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/services/flatcolorpicker.service.d.ts +12 -0
- 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/{colorpicker/models/color-picker-view.d.ts → common/models/fillmode.d.ts} +5 -5
- package/dist/es2015/common/models/fillmode.js +4 -0
- package/dist/es2015/common/models/rounded.d.ts +23 -0
- package/dist/es2015/common/models/rounded.js +4 -0
- package/dist/es2015/common/models/size.d.ts +14 -0
- package/dist/es2015/common/models/size.js +4 -0
- package/dist/es2015/common/models/styling-classes.d.ts +11 -0
- package/dist/es2015/common/models/styling-classes.js +4 -0
- package/dist/es2015/common/models.d.ts +8 -0
- package/dist/es2015/common/models.js +4 -0
- package/dist/es2015/common/utils.d.ts +7 -0
- package/dist/es2015/common/utils.js +37 -0
- package/dist/es2015/index.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 +5 -2
- package/dist/es2015/main.js +4 -2
- package/dist/es2015/maskedtextbox/maskedtextbox.component.d.ts +39 -1
- package/dist/es2015/maskedtextbox/maskedtextbox.component.js +88 -6
- package/dist/es2015/numerictextbox/numerictextbox.component.d.ts +39 -2
- package/dist/es2015/numerictextbox/numerictextbox.component.js +124 -40
- package/dist/es2015/package-metadata.js +1 -1
- package/dist/es2015/radiobutton/radiobutton.directive.d.ts +18 -0
- package/dist/es2015/radiobutton/radiobutton.directive.js +46 -11
- package/dist/es2015/shared/textarea.directive.d.ts +1 -1
- package/dist/es2015/shared/textarea.directive.js +3 -2
- package/dist/es2015/shared/utils.d.ts +16 -0
- package/dist/es2015/shared/utils.js +23 -0
- package/dist/es2015/switch/switch.component.d.ts +48 -5
- package/dist/es2015/switch/switch.component.js +166 -24
- package/dist/es2015/text-fields-common/text-fields-base.js +1 -1
- package/dist/es2015/textarea/textarea.component.d.ts +39 -1
- package/dist/es2015/textarea/textarea.component.js +89 -5
- package/dist/es2015/textbox/textbox.component.d.ts +40 -1
- package/dist/es2015/textbox/textbox.component.js +99 -12
- package/dist/es2015/textbox/textbox.directive.d.ts +1 -1
- package/dist/es2015/textbox/textbox.directive.js +3 -2
- package/dist/es2015/textbox.module.js +0 -3
- package/dist/fesm2015/index.js +3118 -1477
- package/dist/fesm5/index.js +3040 -1387
- package/dist/npm/checkbox/checkbox.directive.js +78 -2
- 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 +285 -86
- 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/common/models/fillmode.js +6 -0
- package/dist/npm/common/models/rounded.js +6 -0
- package/dist/npm/common/models/size.js +6 -0
- package/dist/npm/common/models/styling-classes.js +6 -0
- package/dist/npm/common/models.js +6 -0
- package/dist/npm/common/utils.js +37 -0
- package/dist/npm/index.js +10 -0
- package/dist/npm/main.js +7 -4
- package/dist/npm/maskedtextbox/maskedtextbox.component.js +100 -5
- package/dist/npm/numerictextbox/numerictextbox.component.js +115 -19
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/radiobutton/radiobutton.directive.js +51 -2
- package/dist/npm/shared/textarea.directive.js +3 -2
- package/dist/npm/shared/utils.js +25 -0
- package/dist/npm/switch/switch.component.js +166 -20
- package/dist/npm/text-fields-common/text-fields-base.js +1 -1
- package/dist/npm/textarea/textarea.component.js +100 -4
- package/dist/npm/textbox/textbox.component.js +113 -14
- package/dist/npm/textbox/textbox.directive.js +3 -2
- package/dist/npm/textbox.module.js +0 -3
- package/dist/systemjs/kendo-angular-inputs.js +1 -1
- package/package.json +15 -12
- package/dist/es/colorpicker/models/preventable-event.js +0 -29
- package/dist/es/textbox/floating-label-input-adapter.js +0 -58
- package/dist/es/textbox/textbox-container.component.js +0 -224
- package/dist/es2015/colorpicker/models/preventable-event.d.ts +0 -21
- package/dist/es2015/colorpicker/models/preventable-event.js +0 -27
- package/dist/es2015/textbox/floating-label-input-adapter.d.ts +0 -20
- package/dist/es2015/textbox/floating-label-input-adapter.js +0 -52
- package/dist/es2015/textbox/textbox-container.component.d.ts +0 -59
- package/dist/es2015/textbox/textbox-container.component.js +0 -209
- package/dist/npm/colorpicker/models/preventable-event.js +0 -31
- package/dist/npm/textbox/floating-label-input-adapter.js +0 -60
- package/dist/npm/textbox/textbox-container.component.js +0 -226
|
@@ -3,7 +3,8 @@
|
|
|
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 { Directive, HostBinding } from '@angular/core';
|
|
6
|
+
import { Directive, ElementRef, HostBinding, Input, Renderer2 } from '@angular/core';
|
|
7
|
+
import { getStylingClasses } from '../common/utils';
|
|
7
8
|
/**
|
|
8
9
|
* Represents the directive that renders the [Kendo UI CheckBox]({% slug overview_checkbox %}) input component.
|
|
9
10
|
* The directive is placed on input type="checkbox" elements.
|
|
@@ -14,17 +15,92 @@ import { Directive, HostBinding } from '@angular/core';
|
|
|
14
15
|
* ```
|
|
15
16
|
*/
|
|
16
17
|
var CheckBoxDirective = /** @class */ (function () {
|
|
17
|
-
function CheckBoxDirective() {
|
|
18
|
+
function CheckBoxDirective(renderer, hostElement) {
|
|
19
|
+
this.renderer = renderer;
|
|
20
|
+
this.hostElement = hostElement;
|
|
18
21
|
this.kendoClass = true;
|
|
22
|
+
this._size = 'medium';
|
|
23
|
+
this._rounded = 'medium';
|
|
19
24
|
}
|
|
25
|
+
Object.defineProperty(CheckBoxDirective.prototype, "size", {
|
|
26
|
+
get: function () {
|
|
27
|
+
return this._size;
|
|
28
|
+
},
|
|
29
|
+
/**
|
|
30
|
+
* The size property specifies the width and height of the CheckBox
|
|
31
|
+
* ([see example]({% slug appearance_checkboxdirective %}#toc-size)).
|
|
32
|
+
*
|
|
33
|
+
* The possible values are:
|
|
34
|
+
* * `'small'`
|
|
35
|
+
* * `'medium'` (default)
|
|
36
|
+
* * `'large'`
|
|
37
|
+
* * `null`
|
|
38
|
+
*/
|
|
39
|
+
set: function (size) {
|
|
40
|
+
this.handleClasses(size, 'size');
|
|
41
|
+
this._size = size;
|
|
42
|
+
},
|
|
43
|
+
enumerable: true,
|
|
44
|
+
configurable: true
|
|
45
|
+
});
|
|
46
|
+
Object.defineProperty(CheckBoxDirective.prototype, "rounded", {
|
|
47
|
+
get: function () {
|
|
48
|
+
return this._rounded;
|
|
49
|
+
},
|
|
50
|
+
/**
|
|
51
|
+
* The rounded property specifies the border radius of the CheckBox
|
|
52
|
+
* ([see example]({% slug appearance_checkboxdirective %}#toc-rounded)).
|
|
53
|
+
*
|
|
54
|
+
* The possible values are:
|
|
55
|
+
* * `'small'`
|
|
56
|
+
* * `'medium'` (default)
|
|
57
|
+
* * `'large'`
|
|
58
|
+
* * `null`
|
|
59
|
+
*/
|
|
60
|
+
set: function (rounded) {
|
|
61
|
+
this.handleClasses(rounded, 'rounded');
|
|
62
|
+
this._rounded = rounded;
|
|
63
|
+
},
|
|
64
|
+
enumerable: true,
|
|
65
|
+
configurable: true
|
|
66
|
+
});
|
|
67
|
+
CheckBoxDirective.prototype.ngAfterViewInit = function () {
|
|
68
|
+
var _this = this;
|
|
69
|
+
var stylingInputs = ['size', 'rounded'];
|
|
70
|
+
stylingInputs.forEach(function (input) {
|
|
71
|
+
_this.handleClasses(_this[input], input);
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
CheckBoxDirective.prototype.handleClasses = function (value, input) {
|
|
75
|
+
var elem = this.hostElement.nativeElement;
|
|
76
|
+
var classes = getStylingClasses('checkbox', input, this[input], value);
|
|
77
|
+
if (classes.toRemove) {
|
|
78
|
+
this.renderer.removeClass(elem, classes.toRemove);
|
|
79
|
+
}
|
|
80
|
+
if (classes.toAdd) {
|
|
81
|
+
this.renderer.addClass(elem, classes.toAdd);
|
|
82
|
+
}
|
|
83
|
+
};
|
|
20
84
|
tslib_1.__decorate([
|
|
21
85
|
HostBinding('class.k-checkbox'),
|
|
22
86
|
tslib_1.__metadata("design:type", Boolean)
|
|
23
87
|
], CheckBoxDirective.prototype, "kendoClass", void 0);
|
|
88
|
+
tslib_1.__decorate([
|
|
89
|
+
Input(),
|
|
90
|
+
tslib_1.__metadata("design:type", String),
|
|
91
|
+
tslib_1.__metadata("design:paramtypes", [String])
|
|
92
|
+
], CheckBoxDirective.prototype, "size", null);
|
|
93
|
+
tslib_1.__decorate([
|
|
94
|
+
Input(),
|
|
95
|
+
tslib_1.__metadata("design:type", String),
|
|
96
|
+
tslib_1.__metadata("design:paramtypes", [String])
|
|
97
|
+
], CheckBoxDirective.prototype, "rounded", null);
|
|
24
98
|
CheckBoxDirective = tslib_1.__decorate([
|
|
25
99
|
Directive({
|
|
26
100
|
selector: 'input[kendoCheckBox]'
|
|
27
|
-
})
|
|
101
|
+
}),
|
|
102
|
+
tslib_1.__metadata("design:paramtypes", [Renderer2,
|
|
103
|
+
ElementRef])
|
|
28
104
|
], CheckBoxDirective);
|
|
29
105
|
return CheckBoxDirective;
|
|
30
106
|
}());
|
|
@@ -0,0 +1,95 @@
|
|
|
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 { Component, HostBinding, Input } from '@angular/core';
|
|
7
|
+
import { BehaviorSubject } from 'rxjs';
|
|
8
|
+
import { isPresent } from '../common/utils';
|
|
9
|
+
import { AA_RATIO, STEP_COUNT, AAA_RATIO } from './constants';
|
|
10
|
+
import { bezierCommand, getContrastFromTwoRGBAs, getRGBA, getColorFromHSV, svgPath, controlPoint, line } from './utils';
|
|
11
|
+
/**
|
|
12
|
+
* @hidden
|
|
13
|
+
*/
|
|
14
|
+
var ColorContrastSvgComponent = /** @class */ (function () {
|
|
15
|
+
function ColorContrastSvgComponent() {
|
|
16
|
+
this.hostClass = true;
|
|
17
|
+
}
|
|
18
|
+
ColorContrastSvgComponent.prototype.ngAfterViewInit = function () {
|
|
19
|
+
var _this = this;
|
|
20
|
+
this.metrics = this.wrapper.getBoundingClientRect();
|
|
21
|
+
this.oldA = this.hsva.value.a;
|
|
22
|
+
this.oldH = this.hsva.value.h;
|
|
23
|
+
this.hsva.subscribe(function (value) {
|
|
24
|
+
if (value.h !== _this.oldH || value.a !== _this.oldA) {
|
|
25
|
+
_this.oldH = value.h;
|
|
26
|
+
_this.oldA = value.a;
|
|
27
|
+
_this.setPaths();
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
ColorContrastSvgComponent.prototype.ngOnChanges = function (changes) {
|
|
32
|
+
if (isPresent(changes.backgroundColor) && this.metrics) {
|
|
33
|
+
this.setPaths();
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
ColorContrastSvgComponent.prototype.setPaths = function () {
|
|
37
|
+
var bezierCommandCalc = bezierCommand(controlPoint(line));
|
|
38
|
+
this.paths = [svgPath(this.getPaths(AA_RATIO, STEP_COUNT), bezierCommandCalc),
|
|
39
|
+
svgPath(this.getPaths(AA_RATIO, STEP_COUNT, true), bezierCommandCalc),
|
|
40
|
+
svgPath(this.getPaths(AAA_RATIO, STEP_COUNT), bezierCommandCalc),
|
|
41
|
+
svgPath(this.getPaths(AAA_RATIO, STEP_COUNT, true), bezierCommandCalc)];
|
|
42
|
+
};
|
|
43
|
+
ColorContrastSvgComponent.prototype.findValue = function (contrast, saturation, low, high, comparer) {
|
|
44
|
+
var mid = (low + high) / 2;
|
|
45
|
+
var hsva = Object.assign({}, this.hsva.value, { s: saturation / this.metrics.width, v: 1 - mid / this.metrics.height });
|
|
46
|
+
var currentContrast = getContrastFromTwoRGBAs(getRGBA(getColorFromHSV(hsva)), getRGBA(this.backgroundColor || ''));
|
|
47
|
+
if (low + 0.5 > high) {
|
|
48
|
+
if (currentContrast < contrast + 1 && currentContrast > contrast - 1) {
|
|
49
|
+
return mid;
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (comparer(currentContrast, contrast)) {
|
|
56
|
+
return this.findValue(contrast, saturation, low, high - (high - low) / 2, comparer);
|
|
57
|
+
}
|
|
58
|
+
return this.findValue(contrast, saturation, low + (high - low) / 2, high, comparer);
|
|
59
|
+
};
|
|
60
|
+
ColorContrastSvgComponent.prototype.getPaths = function (contrast, stepCount, reversed) {
|
|
61
|
+
if (reversed === void 0) { reversed = false; }
|
|
62
|
+
var points = [];
|
|
63
|
+
for (var i = 0; i <= this.metrics.width; i += this.metrics.width / stepCount) {
|
|
64
|
+
var value = this.findValue(contrast, i, 0, this.metrics.height, reversed ? (function (a, b) { return a < b; }) : (function (a, b) { return a > b; }));
|
|
65
|
+
if (value !== null) {
|
|
66
|
+
points.push([i, value]);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return points;
|
|
70
|
+
};
|
|
71
|
+
tslib_1.__decorate([
|
|
72
|
+
HostBinding('class.k-color-contrast-svg'),
|
|
73
|
+
tslib_1.__metadata("design:type", Boolean)
|
|
74
|
+
], ColorContrastSvgComponent.prototype, "hostClass", void 0);
|
|
75
|
+
tslib_1.__decorate([
|
|
76
|
+
Input(),
|
|
77
|
+
tslib_1.__metadata("design:type", Object)
|
|
78
|
+
], ColorContrastSvgComponent.prototype, "wrapper", void 0);
|
|
79
|
+
tslib_1.__decorate([
|
|
80
|
+
Input(),
|
|
81
|
+
tslib_1.__metadata("design:type", BehaviorSubject)
|
|
82
|
+
], ColorContrastSvgComponent.prototype, "hsva", void 0);
|
|
83
|
+
tslib_1.__decorate([
|
|
84
|
+
Input(),
|
|
85
|
+
tslib_1.__metadata("design:type", String)
|
|
86
|
+
], ColorContrastSvgComponent.prototype, "backgroundColor", void 0);
|
|
87
|
+
ColorContrastSvgComponent = tslib_1.__decorate([
|
|
88
|
+
Component({
|
|
89
|
+
selector: '[kendoColorContrastSvg]',
|
|
90
|
+
template: "\n <svg:path *ngFor=\"let path of paths\" [attr.d]=\"path\" fill=\"none\" stroke=\"white\" stroke-width=\"1\"></svg:path>\n "
|
|
91
|
+
})
|
|
92
|
+
], ColorContrastSvgComponent);
|
|
93
|
+
return ColorContrastSvgComponent;
|
|
94
|
+
}());
|
|
95
|
+
export { ColorContrastSvgComponent };
|
|
@@ -5,16 +5,16 @@
|
|
|
5
5
|
import * as tslib_1 from "tslib";
|
|
6
6
|
import { Component, Input, ViewChild, ElementRef, Renderer2, NgZone, Output, EventEmitter, HostBinding, forwardRef, ChangeDetectorRef } from '@angular/core';
|
|
7
7
|
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { BehaviorSubject, Subject } from 'rxjs';
|
|
9
|
+
import { throttleTime } from 'rxjs/operators';
|
|
10
|
+
import { LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
|
|
10
11
|
import { isChanged, isDocumentAvailable, KendoInput } from '@progress/kendo-angular-common';
|
|
11
12
|
import { containsFocus, isUntouched } from '../common/dom-utils';
|
|
13
|
+
import { parseColor, getHSV, getColorFromHSV, getColorFromHue } from './utils';
|
|
14
|
+
import { isPresent, fitIntoBounds } from '../common/utils';
|
|
12
15
|
import { SliderComponent } from '../slider/slider.component';
|
|
13
|
-
import { LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
|
|
14
|
-
import { Subject } from 'rxjs';
|
|
15
16
|
import { ColorGradientLocalizationService } from './localization/colorgradient-localization.service';
|
|
16
17
|
import { ColorInputComponent } from './color-input.component';
|
|
17
|
-
import { throttleTime } from 'rxjs/operators';
|
|
18
18
|
import { DEFAULT_GRADIENT_BACKGROUND_COLOR, DEFAULT_OUTPUT_FORMAT, DRAGHANDLE_MOVE_SPEED } from './constants';
|
|
19
19
|
var serial = 0;
|
|
20
20
|
/**
|
|
@@ -29,9 +29,6 @@ var ColorGradientComponent = /** @class */ (function () {
|
|
|
29
29
|
this.renderer = renderer;
|
|
30
30
|
this.cdr = cdr;
|
|
31
31
|
this.localizationService = localizationService;
|
|
32
|
-
/**
|
|
33
|
-
* @hidden
|
|
34
|
-
*/
|
|
35
32
|
this.hostClasses = true;
|
|
36
33
|
/**
|
|
37
34
|
* @hidden
|
|
@@ -39,18 +36,26 @@ var ColorGradientComponent = /** @class */ (function () {
|
|
|
39
36
|
this.id = "k-colorgradient-" + serial++;
|
|
40
37
|
/**
|
|
41
38
|
* Defines whether the alpha slider will be displayed.
|
|
39
|
+
*
|
|
40
|
+
* @default true
|
|
42
41
|
*/
|
|
43
42
|
this.opacity = true;
|
|
44
43
|
/**
|
|
45
44
|
* Sets the disabled state of the ColorGradient.
|
|
45
|
+
*
|
|
46
|
+
* @default false
|
|
46
47
|
*/
|
|
47
48
|
this.disabled = false;
|
|
48
49
|
/**
|
|
49
50
|
* Sets the read-only state of the ColorGradient.
|
|
51
|
+
*
|
|
52
|
+
* @default false
|
|
50
53
|
*/
|
|
51
54
|
this.readonly = false;
|
|
52
55
|
/**
|
|
53
56
|
* Specifies whether the ColorGradient should display a 'Clear color' button.
|
|
57
|
+
*
|
|
58
|
+
* @default false
|
|
54
59
|
*/
|
|
55
60
|
this.clearButton = false;
|
|
56
61
|
/**
|
|
@@ -59,6 +64,16 @@ var ColorGradientComponent = /** @class */ (function () {
|
|
|
59
64
|
* @default 0
|
|
60
65
|
*/
|
|
61
66
|
this.delay = 0;
|
|
67
|
+
/**
|
|
68
|
+
* Specifies the output format of the ColorGradientComponent.
|
|
69
|
+
* The input value may be in a different format, but it will be parsed into the output `format`
|
|
70
|
+
* after the component processes it.
|
|
71
|
+
*
|
|
72
|
+
* The supported values are:
|
|
73
|
+
* * (Default) `rgba`
|
|
74
|
+
* * `hex`
|
|
75
|
+
*/
|
|
76
|
+
this.format = DEFAULT_OUTPUT_FORMAT;
|
|
62
77
|
/**
|
|
63
78
|
* Fires each time the user selects a new color.
|
|
64
79
|
*/
|
|
@@ -74,17 +89,7 @@ var ColorGradientComponent = /** @class */ (function () {
|
|
|
74
89
|
* The values are initially set in `ngOnInit` or in `ngOnChanges` and are
|
|
75
90
|
* updated on moving the drag handle or the sliders.
|
|
76
91
|
*/
|
|
77
|
-
this.hsva = {};
|
|
78
|
-
/**
|
|
79
|
-
* Specifies the output format of the ColorGradientComponent.
|
|
80
|
-
* The input value may be in a different format. However, it will be parsed into the output `format`
|
|
81
|
-
* after the component processes it.
|
|
82
|
-
*
|
|
83
|
-
* The supported values are:
|
|
84
|
-
* * (Default) `rgba`
|
|
85
|
-
* * `hex`
|
|
86
|
-
*/
|
|
87
|
-
this.format = DEFAULT_OUTPUT_FORMAT;
|
|
92
|
+
this.hsva = new BehaviorSubject({});
|
|
88
93
|
this._tabindex = 0;
|
|
89
94
|
this.listeners = [];
|
|
90
95
|
this.updateValues = new Subject();
|
|
@@ -97,9 +102,6 @@ var ColorGradientComponent = /** @class */ (function () {
|
|
|
97
102
|
}
|
|
98
103
|
ColorGradientComponent_1 = ColorGradientComponent;
|
|
99
104
|
Object.defineProperty(ColorGradientComponent.prototype, "readonlyAttribute", {
|
|
100
|
-
/**
|
|
101
|
-
* @hidden
|
|
102
|
-
*/
|
|
103
105
|
get: function () {
|
|
104
106
|
return this.readonly;
|
|
105
107
|
},
|
|
@@ -107,31 +109,22 @@ var ColorGradientComponent = /** @class */ (function () {
|
|
|
107
109
|
configurable: true
|
|
108
110
|
});
|
|
109
111
|
Object.defineProperty(ColorGradientComponent.prototype, "disabledClass", {
|
|
110
|
-
/**
|
|
111
|
-
* @hidden
|
|
112
|
-
*/
|
|
113
112
|
get: function () {
|
|
114
113
|
return this.disabled;
|
|
115
114
|
},
|
|
116
115
|
enumerable: true,
|
|
117
116
|
configurable: true
|
|
118
117
|
});
|
|
119
|
-
Object.defineProperty(ColorGradientComponent.prototype, "
|
|
120
|
-
/**
|
|
121
|
-
* @hidden
|
|
122
|
-
*/
|
|
118
|
+
Object.defineProperty(ColorGradientComponent.prototype, "gradientId", {
|
|
123
119
|
get: function () {
|
|
124
|
-
return this.
|
|
120
|
+
return this.id;
|
|
125
121
|
},
|
|
126
122
|
enumerable: true,
|
|
127
123
|
configurable: true
|
|
128
124
|
});
|
|
129
|
-
Object.defineProperty(ColorGradientComponent.prototype, "
|
|
130
|
-
/**
|
|
131
|
-
* @hidden
|
|
132
|
-
*/
|
|
125
|
+
Object.defineProperty(ColorGradientComponent.prototype, "hostTabindex", {
|
|
133
126
|
get: function () {
|
|
134
|
-
return this.
|
|
127
|
+
return this.tabindex;
|
|
135
128
|
},
|
|
136
129
|
enumerable: true,
|
|
137
130
|
configurable: true
|
|
@@ -144,7 +137,21 @@ var ColorGradientComponent = /** @class */ (function () {
|
|
|
144
137
|
* Specifies the value of the initially selected color.
|
|
145
138
|
*/
|
|
146
139
|
set: function (value) {
|
|
147
|
-
this._value = parseColor(value, this.format);
|
|
140
|
+
this._value = parseColor(value, this.format, this.opacity);
|
|
141
|
+
},
|
|
142
|
+
enumerable: true,
|
|
143
|
+
configurable: true
|
|
144
|
+
});
|
|
145
|
+
Object.defineProperty(ColorGradientComponent.prototype, "contrastTool", {
|
|
146
|
+
get: function () {
|
|
147
|
+
return this._contrastTool;
|
|
148
|
+
},
|
|
149
|
+
/**
|
|
150
|
+
* Enables the color contrast tool. Accepts the background color that will be compared to the selected value.
|
|
151
|
+
* The tool will calculate the contrast ratio between the two colors.
|
|
152
|
+
*/
|
|
153
|
+
set: function (value) {
|
|
154
|
+
this._contrastTool = parseColor(value, this.format, this.opacity);
|
|
148
155
|
},
|
|
149
156
|
enumerable: true,
|
|
150
157
|
configurable: true
|
|
@@ -155,11 +162,18 @@ var ColorGradientComponent = /** @class */ (function () {
|
|
|
155
162
|
},
|
|
156
163
|
/**
|
|
157
164
|
* Specifies the [tabindex](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the component.
|
|
165
|
+
*
|
|
166
|
+
* @default 0
|
|
158
167
|
*/
|
|
159
168
|
set: function (value) {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
169
|
+
if (isPresent(value)) {
|
|
170
|
+
var tabindex = Number(value);
|
|
171
|
+
this._tabindex = !isNaN(tabindex) ? tabindex : 0;
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
// Allows removal of the tabindex attribute
|
|
175
|
+
this._tabindex = value;
|
|
176
|
+
}
|
|
163
177
|
},
|
|
164
178
|
enumerable: true,
|
|
165
179
|
configurable: true
|
|
@@ -183,10 +197,10 @@ var ColorGradientComponent = /** @class */ (function () {
|
|
|
183
197
|
*/
|
|
184
198
|
get: function () {
|
|
185
199
|
// setting the initial value to undefined to force the slider to recalculate the height of the slider track on the next cdr run
|
|
186
|
-
if (!(isPresent(this.hsva) && isPresent(this.hsva.a))) {
|
|
200
|
+
if (!(isPresent(this.hsva.value) && isPresent(this.hsva.value.a))) {
|
|
187
201
|
return;
|
|
188
202
|
}
|
|
189
|
-
return this.hsva.a * 100;
|
|
203
|
+
return this.hsva.value.a * 100;
|
|
190
204
|
},
|
|
191
205
|
enumerable: true,
|
|
192
206
|
configurable: true
|
|
@@ -203,7 +217,7 @@ var ColorGradientComponent = /** @class */ (function () {
|
|
|
203
217
|
* @hidden
|
|
204
218
|
*/
|
|
205
219
|
get: function () {
|
|
206
|
-
return
|
|
220
|
+
return this.contrastTool && this.contrastTool.length > 0;
|
|
207
221
|
},
|
|
208
222
|
enumerable: true,
|
|
209
223
|
configurable: true
|
|
@@ -237,7 +251,7 @@ var ColorGradientComponent = /** @class */ (function () {
|
|
|
237
251
|
if (this.disabled) {
|
|
238
252
|
return;
|
|
239
253
|
}
|
|
240
|
-
this.
|
|
254
|
+
this.gradientDragHandle.nativeElement.focus();
|
|
241
255
|
};
|
|
242
256
|
/**
|
|
243
257
|
* @hidden
|
|
@@ -275,7 +289,7 @@ var ColorGradientComponent = /** @class */ (function () {
|
|
|
275
289
|
return;
|
|
276
290
|
}
|
|
277
291
|
this.renderer.removeClass(this.gradientWrapper.nativeElement, 'k-dragging');
|
|
278
|
-
this.handleValueChange(getColorFromHSV(this.hsva));
|
|
292
|
+
this.handleValueChange(getColorFromHSV(this.hsva.value, this.format, this.opacity));
|
|
279
293
|
};
|
|
280
294
|
/**
|
|
281
295
|
* @hidden
|
|
@@ -322,15 +336,19 @@ var ColorGradientComponent = /** @class */ (function () {
|
|
|
322
336
|
return;
|
|
323
337
|
}
|
|
324
338
|
this.gradientDragHandle.nativeElement.focus();
|
|
325
|
-
var
|
|
326
|
-
var
|
|
339
|
+
var gradientRect = this.gradientRect;
|
|
340
|
+
var newX = position.clientX - gradientRect.left;
|
|
341
|
+
var newY = position.clientY - gradientRect.top;
|
|
327
342
|
this.ngZone.run(function () { return _this.moveDragHandle(newX, newY); });
|
|
328
343
|
};
|
|
329
344
|
/**
|
|
330
345
|
* @hidden
|
|
331
346
|
*/
|
|
332
347
|
ColorGradientComponent.prototype.handleHueSliderChange = function (hue) {
|
|
333
|
-
this.
|
|
348
|
+
var hsva = this.hsva.value;
|
|
349
|
+
hsva.h = hue;
|
|
350
|
+
this.hsva.next(hsva);
|
|
351
|
+
this.handleValueChange(getColorFromHSV(this.hsva.value, this.format, this.opacity));
|
|
334
352
|
this.backgroundColor = getColorFromHue(hue);
|
|
335
353
|
this.setAlphaSliderBackground(this.backgroundColor);
|
|
336
354
|
};
|
|
@@ -338,14 +356,16 @@ var ColorGradientComponent = /** @class */ (function () {
|
|
|
338
356
|
* @hidden
|
|
339
357
|
*/
|
|
340
358
|
ColorGradientComponent.prototype.handleAlphaSliderChange = function (alpha) {
|
|
341
|
-
this.hsva.
|
|
342
|
-
|
|
359
|
+
var hsva = this.hsva.value;
|
|
360
|
+
hsva.a = alpha / 100;
|
|
361
|
+
this.hsva.next(hsva);
|
|
362
|
+
this.handleValueChange(getColorFromHSV(this.hsva.value, this.format, this.opacity));
|
|
343
363
|
};
|
|
344
364
|
/**
|
|
345
365
|
* @hidden
|
|
346
366
|
*/
|
|
347
367
|
ColorGradientComponent.prototype.handleInputsValueChange = function (color) {
|
|
348
|
-
var parsed = parseColor(color, this.format);
|
|
368
|
+
var parsed = parseColor(color, this.format, this.opacity);
|
|
349
369
|
if (this.value !== parsed) {
|
|
350
370
|
this.handleValueChange(parsed);
|
|
351
371
|
this.updateUI();
|
|
@@ -394,7 +414,7 @@ var ColorGradientComponent = /** @class */ (function () {
|
|
|
394
414
|
* @hidden
|
|
395
415
|
*/
|
|
396
416
|
get: function () {
|
|
397
|
-
var parsed = parseColor(this.value, this.format);
|
|
417
|
+
var parsed = parseColor(this.value, this.format, this.opacity);
|
|
398
418
|
return "" + (this.value ? parsed : this.localizationService.get('colorGradientHandle'));
|
|
399
419
|
},
|
|
400
420
|
enumerable: true,
|
|
@@ -432,29 +452,35 @@ var ColorGradientComponent = /** @class */ (function () {
|
|
|
432
452
|
});
|
|
433
453
|
/**
|
|
434
454
|
* @hidden
|
|
435
|
-
* Used by the
|
|
455
|
+
* Used by the FloatingLabel to determine if the component is empty.
|
|
436
456
|
*/
|
|
437
457
|
ColorGradientComponent.prototype.isEmpty = function () {
|
|
438
458
|
return false;
|
|
439
459
|
};
|
|
440
460
|
ColorGradientComponent.prototype.moveDragHandle = function (positionX, positionY) {
|
|
441
|
-
var
|
|
442
|
-
var
|
|
461
|
+
var gradientRect = this.gradientRect;
|
|
462
|
+
var gradientRectWidth = gradientRect.width;
|
|
463
|
+
var gradientRectHeight = gradientRect.height;
|
|
464
|
+
var top = fitIntoBounds(positionY, 0, gradientRectHeight);
|
|
465
|
+
var left = fitIntoBounds(positionX, 0, gradientRectWidth);
|
|
443
466
|
this.setDragHandleElementPosition(top, left);
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
this.
|
|
467
|
+
var hsva = this.hsva.value;
|
|
468
|
+
hsva.s = left / gradientRectWidth;
|
|
469
|
+
hsva.v = 1 - top / gradientRectHeight;
|
|
470
|
+
this.hsva.next(hsva);
|
|
471
|
+
this.updateValues.next(getColorFromHSV(this.hsva.value, this.format, this.opacity));
|
|
472
|
+
this.setAlphaSliderBackground(getColorFromHSV(tslib_1.__assign({}, this.hsva.value, { a: 1 }), this.format, this.opacity));
|
|
448
473
|
};
|
|
449
474
|
ColorGradientComponent.prototype.updateUI = function () {
|
|
450
475
|
if (!isDocumentAvailable()) {
|
|
451
476
|
return;
|
|
452
477
|
}
|
|
453
|
-
this.hsva
|
|
454
|
-
var
|
|
455
|
-
var
|
|
478
|
+
this.hsva.next(this.value ? getHSV(this.value) : { h: 0, s: 0, v: 1, a: 1 });
|
|
479
|
+
var gradientRect = this.gradientRect;
|
|
480
|
+
var top = (1 - this.hsva.value.v) * gradientRect.height;
|
|
481
|
+
var left = this.hsva.value.s * gradientRect.width;
|
|
456
482
|
this.setDragHandleElementPosition(top, left);
|
|
457
|
-
this.backgroundColor = getColorFromHue(this.hsva.h);
|
|
483
|
+
this.backgroundColor = getColorFromHue(this.hsva.value.h);
|
|
458
484
|
this.setAlphaSliderBackground(this.backgroundColor);
|
|
459
485
|
this.setHostElementAriaLabel();
|
|
460
486
|
};
|
|
@@ -480,7 +506,7 @@ var ColorGradientComponent = /** @class */ (function () {
|
|
|
480
506
|
this.renderer.setStyle(sliderTrack, 'background', "linear-gradient(to top, transparent, " + backgroundColor + ")");
|
|
481
507
|
};
|
|
482
508
|
ColorGradientComponent.prototype.setHostElementAriaLabel = function () {
|
|
483
|
-
var parsed = parseColor(this.value, this.format);
|
|
509
|
+
var parsed = parseColor(this.value, this.format, this.opacity);
|
|
484
510
|
this.renderer.setAttribute(this.host.nativeElement, 'aria-label', "" + (this.value ? parsed : this.localizationService.get('colorGradientNoColor')));
|
|
485
511
|
};
|
|
486
512
|
ColorGradientComponent.prototype.addEventListeners = function () {
|
|
@@ -497,7 +523,7 @@ var ColorGradientComponent = /** @class */ (function () {
|
|
|
497
523
|
var keyupListener = _this.renderer.listen(_this.gradientDragHandle.nativeElement, 'keyup', function () {
|
|
498
524
|
_this.renderer.removeClass(_this.gradientWrapper.nativeElement, 'k-dragging');
|
|
499
525
|
if (!_this.readonly && !_this.disabled) {
|
|
500
|
-
_this.ngZone.run(function () { return _this.handleValueChange(getColorFromHSV(_this.hsva)); });
|
|
526
|
+
_this.ngZone.run(function () { return _this.handleValueChange(getColorFromHSV(_this.hsva.value, _this.format, _this.opacity)); });
|
|
501
527
|
}
|
|
502
528
|
});
|
|
503
529
|
var dragHandleFocusInListener = _this.renderer.listen(_this.gradientDragHandle.nativeElement, 'focusin', function () {
|
|
@@ -535,24 +561,24 @@ var ColorGradientComponent = /** @class */ (function () {
|
|
|
535
561
|
tslib_1.__metadata("design:type", Boolean),
|
|
536
562
|
tslib_1.__metadata("design:paramtypes", [])
|
|
537
563
|
], ColorGradientComponent.prototype, "disabledClass", null);
|
|
538
|
-
tslib_1.__decorate([
|
|
539
|
-
HostBinding('attr.tabindex'),
|
|
540
|
-
tslib_1.__metadata("design:type", Number),
|
|
541
|
-
tslib_1.__metadata("design:paramtypes", [])
|
|
542
|
-
], ColorGradientComponent.prototype, "hostTabindex", null);
|
|
543
564
|
tslib_1.__decorate([
|
|
544
565
|
HostBinding('attr.id'),
|
|
545
566
|
tslib_1.__metadata("design:type", String),
|
|
546
567
|
tslib_1.__metadata("design:paramtypes", [])
|
|
547
568
|
], ColorGradientComponent.prototype, "gradientId", null);
|
|
548
|
-
tslib_1.__decorate([
|
|
549
|
-
Input(),
|
|
550
|
-
tslib_1.__metadata("design:type", String)
|
|
551
|
-
], ColorGradientComponent.prototype, "id", void 0);
|
|
552
569
|
tslib_1.__decorate([
|
|
553
570
|
HostBinding('attr.dir'),
|
|
554
571
|
tslib_1.__metadata("design:type", String)
|
|
555
572
|
], ColorGradientComponent.prototype, "direction", void 0);
|
|
573
|
+
tslib_1.__decorate([
|
|
574
|
+
HostBinding('attr.tabindex'),
|
|
575
|
+
tslib_1.__metadata("design:type", Number),
|
|
576
|
+
tslib_1.__metadata("design:paramtypes", [])
|
|
577
|
+
], ColorGradientComponent.prototype, "hostTabindex", null);
|
|
578
|
+
tslib_1.__decorate([
|
|
579
|
+
Input(),
|
|
580
|
+
tslib_1.__metadata("design:type", String)
|
|
581
|
+
], ColorGradientComponent.prototype, "id", void 0);
|
|
556
582
|
tslib_1.__decorate([
|
|
557
583
|
Input(),
|
|
558
584
|
tslib_1.__metadata("design:type", Boolean)
|
|
@@ -580,21 +606,22 @@ var ColorGradientComponent = /** @class */ (function () {
|
|
|
580
606
|
], ColorGradientComponent.prototype, "value", null);
|
|
581
607
|
tslib_1.__decorate([
|
|
582
608
|
Input(),
|
|
583
|
-
tslib_1.__metadata("design:type", String)
|
|
584
|
-
|
|
609
|
+
tslib_1.__metadata("design:type", String),
|
|
610
|
+
tslib_1.__metadata("design:paramtypes", [String])
|
|
611
|
+
], ColorGradientComponent.prototype, "contrastTool", null);
|
|
585
612
|
tslib_1.__decorate([
|
|
586
613
|
Input(),
|
|
587
614
|
tslib_1.__metadata("design:type", Number),
|
|
588
615
|
tslib_1.__metadata("design:paramtypes", [Number])
|
|
589
616
|
], ColorGradientComponent.prototype, "tabindex", null);
|
|
590
|
-
tslib_1.__decorate([
|
|
591
|
-
Output(),
|
|
592
|
-
tslib_1.__metadata("design:type", EventEmitter)
|
|
593
|
-
], ColorGradientComponent.prototype, "valueChange", void 0);
|
|
594
617
|
tslib_1.__decorate([
|
|
595
618
|
Input(),
|
|
596
619
|
tslib_1.__metadata("design:type", String)
|
|
597
620
|
], ColorGradientComponent.prototype, "format", void 0);
|
|
621
|
+
tslib_1.__decorate([
|
|
622
|
+
Output(),
|
|
623
|
+
tslib_1.__metadata("design:type", EventEmitter)
|
|
624
|
+
], ColorGradientComponent.prototype, "valueChange", void 0);
|
|
598
625
|
tslib_1.__decorate([
|
|
599
626
|
ViewChild('gradientDragHandle', { read: ElementRef, static: false }),
|
|
600
627
|
tslib_1.__metadata("design:type", ElementRef)
|
|
@@ -613,6 +640,7 @@ var ColorGradientComponent = /** @class */ (function () {
|
|
|
613
640
|
], ColorGradientComponent.prototype, "gradientWrapper", void 0);
|
|
614
641
|
ColorGradientComponent = ColorGradientComponent_1 = tslib_1.__decorate([
|
|
615
642
|
Component({
|
|
643
|
+
exportAs: 'kendoColorGradient',
|
|
616
644
|
selector: 'kendo-colorgradient',
|
|
617
645
|
providers: [
|
|
618
646
|
{
|
|
@@ -634,8 +662,8 @@ var ColorGradientComponent = /** @class */ (function () {
|
|
|
634
662
|
useValue: 'kendo.colorgradient'
|
|
635
663
|
}
|
|
636
664
|
],
|
|
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-
|
|
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 "]
|
|
665
|
+
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-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 i18n-formatButton=\"kendo.colorgradient.formatButton|The message for the input format toggle button.\"\n formatButton=\"Change color format\">\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 <svg kendoColorContrastSvg\n *ngIf=\"contrastToolVisible && gradientWrapper\"\n class=\"k-color-contrast-svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n [wrapper]=\"gradientWrapper ? gradientWrapper : undefined\"\n [hsva]=\"hsva\"\n [backgroundColor]=\"contrastTool\">\n </svg>\n </div>\n <div class=\"k-hsv-controls k-hstack {{ clearButton ? 'k-sliders-wrap-clearable' : '' }}\">\n <span class=\"k-clear-color k-button k-button-md k-button-flat k-button-flat-base 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.value.h\"\n (valueChange)=\"handleHueSliderChange($event)\"\n >\n </kendo-slider>\n <kendo-slider\n *ngIf=\"opacity\"\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 ",
|
|
666
|
+
styles: ["\n .k-clear-color {\n position: absolute;\n top: 0;\n left: 50%;\n transform: translateX(-50%);\n }\n .k-colorgradient-slider.k-align-self-end {\n height: 140px;\n }\n\n .k-color-contrast-svg {\n position: absolute;\n overflow: visible;\n pointer-events: none;\n left: 0px;\n top: 0px;\n }\n "]
|
|
639
667
|
}),
|
|
640
668
|
tslib_1.__metadata("design:paramtypes", [ElementRef,
|
|
641
669
|
NgZone,
|