@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,66 +3,96 @@
|
|
|
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, HostBinding, Input, Output, EventEmitter, ViewChild, ElementRef, TemplateRef, ViewContainerRef, forwardRef, ChangeDetectorRef, NgZone } from '@angular/core';
|
|
6
|
+
import { Component, HostBinding, Input, Output, EventEmitter, ViewChild, ElementRef, TemplateRef, ViewContainerRef, forwardRef, ChangeDetectorRef, NgZone, Renderer2 } from '@angular/core';
|
|
7
7
|
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
8
|
+
import { FlatColorPickerComponent } from './flatcolorpicker.component';
|
|
8
9
|
import { PopupService } from '@progress/kendo-angular-popup';
|
|
9
10
|
import { validatePackage } from '@progress/kendo-licensing';
|
|
10
|
-
import { packageMetadata } from '../package-metadata';
|
|
11
|
-
import { PreventableEvent, ActiveColorClickEvent } from './models';
|
|
12
|
-
import { parseColor } from './utils/color-parser';
|
|
13
|
-
import { isPresent } from '../common/utils';
|
|
14
11
|
import { Keys, KendoInput } from '@progress/kendo-angular-common';
|
|
15
12
|
import { LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
|
|
16
|
-
import {
|
|
13
|
+
import { packageMetadata } from '../package-metadata';
|
|
14
|
+
import { PALETTEPRESETS } from './models';
|
|
15
|
+
import { ActiveColorClickEvent, ColorPickerCloseEvent, ColorPickerOpenEvent } from './events';
|
|
16
|
+
import { parseColor } from './utils';
|
|
17
|
+
import { getStylingClasses, isPresent } from '../common/utils';
|
|
17
18
|
import { ColorPickerLocalizationService } from './localization/colorpicker-localization.service';
|
|
18
|
-
import {
|
|
19
|
-
var DEFAULT_PRESET = 'office';
|
|
20
|
-
var DEFAULT_ACCESSIBLE_PRESET = 'accessible';
|
|
19
|
+
import { DEFAULT_ACCESSIBLE_PRESET, DEFAULT_PRESET } from './constants';
|
|
21
20
|
var serial = 0;
|
|
22
21
|
/**
|
|
23
22
|
* Represents the [Kendo UI ColorPicker component for Angular]({% slug overview_colorpicker %}).
|
|
24
|
-
*
|
|
23
|
+
*
|
|
24
|
+
* The ColorPicker is a powerful tool for choosing colors from Gradient and Palette views
|
|
25
|
+
* which are rendered in its popup. It supports previewing the selected color, reverting it to its previous state or clearing it completely.
|
|
25
26
|
*/
|
|
26
27
|
var ColorPickerComponent = /** @class */ (function () {
|
|
27
|
-
function ColorPickerComponent(popupService, cdr, localizationService, ngZone) {
|
|
28
|
+
function ColorPickerComponent(host, popupService, cdr, localizationService, ngZone, renderer) {
|
|
28
29
|
var _this = this;
|
|
30
|
+
this.host = host;
|
|
29
31
|
this.popupService = popupService;
|
|
30
32
|
this.cdr = cdr;
|
|
31
33
|
this.localizationService = localizationService;
|
|
32
34
|
this.ngZone = ngZone;
|
|
33
|
-
|
|
34
|
-
* @hidden
|
|
35
|
-
*/
|
|
35
|
+
this.renderer = renderer;
|
|
36
36
|
this.hostClasses = true;
|
|
37
37
|
/**
|
|
38
38
|
* @hidden
|
|
39
39
|
*/
|
|
40
40
|
this.focusableId = "k-colorpicker-" + serial++;
|
|
41
41
|
/**
|
|
42
|
-
*
|
|
42
|
+
* Specifies the views that will be rendered in the popup.
|
|
43
|
+
* By default both the gradient and palette views will be rendered.
|
|
43
44
|
*/
|
|
44
|
-
this.
|
|
45
|
+
this.views = ['gradient', 'palette'];
|
|
45
46
|
/**
|
|
46
47
|
* Sets the read-only state of the ColorPicker.
|
|
48
|
+
*
|
|
49
|
+
* @default false
|
|
47
50
|
*/
|
|
48
51
|
this.readonly = false;
|
|
49
52
|
/**
|
|
50
53
|
* Sets the disabled state of the ColorPicker.
|
|
54
|
+
*
|
|
55
|
+
* @default false
|
|
51
56
|
*/
|
|
52
57
|
this.disabled = false;
|
|
53
58
|
/**
|
|
54
59
|
* Specifies the output format of the ColorPicker.
|
|
55
|
-
* The input value may be in a different format. However, it will be parsed into the output `format`
|
|
56
|
-
* after the component processes it.
|
|
57
60
|
*
|
|
58
|
-
* If the
|
|
61
|
+
* If the input value is in a different format, it will be parsed into the specified output `format`.
|
|
59
62
|
*
|
|
60
63
|
* The supported values are:
|
|
61
64
|
* * `rgba` (default)
|
|
62
65
|
* * `hex`
|
|
63
|
-
* * [name](https://www.w3.org/wiki/CSS/Properties/color/keywords)
|
|
64
66
|
*/
|
|
65
67
|
this.format = 'rgba';
|
|
68
|
+
/**
|
|
69
|
+
* Specifies whether the ColorPicker should display a 'Clear color' button.
|
|
70
|
+
*
|
|
71
|
+
* @default true
|
|
72
|
+
*/
|
|
73
|
+
this.clearButton = true;
|
|
74
|
+
/**
|
|
75
|
+
* Displays `Apply` and `Cancel` action buttons and color preview panes.
|
|
76
|
+
*
|
|
77
|
+
* When enabled, the component value will not change immediately upon
|
|
78
|
+
* color selection, but only after the `Apply` button is clicked.
|
|
79
|
+
*
|
|
80
|
+
* The `Cancel` button reverts the current selection to its
|
|
81
|
+
* previous state i.e. to the current value.
|
|
82
|
+
*
|
|
83
|
+
* @default false
|
|
84
|
+
*/
|
|
85
|
+
this.preview = false;
|
|
86
|
+
/**
|
|
87
|
+
* Configures the layout of the `Apply` and `Cancel` action buttons.
|
|
88
|
+
*
|
|
89
|
+
* The possible values are:
|
|
90
|
+
* * `start`
|
|
91
|
+
* * `center`
|
|
92
|
+
* * `end` (default)
|
|
93
|
+
* * `stretch`
|
|
94
|
+
*/
|
|
95
|
+
this.actionsLayout = 'end';
|
|
66
96
|
/**
|
|
67
97
|
* Fires each time the value is changed.
|
|
68
98
|
*/
|
|
@@ -85,6 +115,12 @@ var ColorPickerComponent = /** @class */ (function () {
|
|
|
85
115
|
* Fires each time the ColorPicker is blurred.
|
|
86
116
|
*/
|
|
87
117
|
this.onBlur = new EventEmitter();
|
|
118
|
+
/**
|
|
119
|
+
* Fires when the user cancels the current color selection.
|
|
120
|
+
*
|
|
121
|
+
* Fires on preview pane or 'Cancel' button click.
|
|
122
|
+
*/
|
|
123
|
+
this.cancel = new EventEmitter();
|
|
88
124
|
/**
|
|
89
125
|
* Fires each time the left side of the ColorPicker wrapper is clicked.
|
|
90
126
|
* The event is triggered regardless of whether a ColorPicker icon is set or not.
|
|
@@ -92,10 +128,18 @@ var ColorPickerComponent = /** @class */ (function () {
|
|
|
92
128
|
* The [ActiveColorClickEvent]({% slug api_inputs_activecolorclickevent %}) event provides the option to prevent the popup opening.
|
|
93
129
|
*/
|
|
94
130
|
this.activeColorClick = new EventEmitter();
|
|
131
|
+
/**
|
|
132
|
+
* Fires each time the view is about to change.
|
|
133
|
+
* Used to provide a two-way binding for the `activeView` property.
|
|
134
|
+
*/
|
|
135
|
+
this.activeViewChange = new EventEmitter();
|
|
95
136
|
this._tabindex = 0;
|
|
96
137
|
this._popupSettings = { animate: true };
|
|
97
138
|
this._paletteSettings = {};
|
|
98
|
-
this._gradientSettings = { opacity: true,
|
|
139
|
+
this._gradientSettings = { opacity: true, delay: 0 };
|
|
140
|
+
this._size = 'medium';
|
|
141
|
+
this._rounded = 'medium';
|
|
142
|
+
this._fillMode = 'solid';
|
|
99
143
|
this.notifyNgTouched = function () { };
|
|
100
144
|
this.notifyNgChanged = function () { };
|
|
101
145
|
validatePackage(packageMetadata);
|
|
@@ -113,7 +157,7 @@ var ColorPickerComponent = /** @class */ (function () {
|
|
|
113
157
|
* Specifies the value of the initially selected color.
|
|
114
158
|
*/
|
|
115
159
|
set: function (value) {
|
|
116
|
-
this._value = parseColor(value, this.format);
|
|
160
|
+
this._value = parseColor(value, this.format, this.gradientSettings.opacity);
|
|
117
161
|
},
|
|
118
162
|
enumerable: true,
|
|
119
163
|
configurable: true
|
|
@@ -163,6 +207,8 @@ var ColorPickerComponent = /** @class */ (function () {
|
|
|
163
207
|
},
|
|
164
208
|
/**
|
|
165
209
|
* Specifies the [tabindex](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the component.
|
|
210
|
+
*
|
|
211
|
+
* @default 0
|
|
166
212
|
*/
|
|
167
213
|
set: function (value) {
|
|
168
214
|
var tabindex = Number(value);
|
|
@@ -172,6 +218,70 @@ var ColorPickerComponent = /** @class */ (function () {
|
|
|
172
218
|
enumerable: true,
|
|
173
219
|
configurable: true
|
|
174
220
|
});
|
|
221
|
+
Object.defineProperty(ColorPickerComponent.prototype, "size", {
|
|
222
|
+
get: function () {
|
|
223
|
+
return this._size;
|
|
224
|
+
},
|
|
225
|
+
/**
|
|
226
|
+
* The size property specifies the font size and line height of the ColorPicker
|
|
227
|
+
* ([see example]({% slug appearance_colorpicker %}#toc-size)).
|
|
228
|
+
*
|
|
229
|
+
* The possible values are:
|
|
230
|
+
* * `'small'`
|
|
231
|
+
* * `'medium'` (default)
|
|
232
|
+
* * `'large'`
|
|
233
|
+
* * `null`
|
|
234
|
+
*/
|
|
235
|
+
set: function (size) {
|
|
236
|
+
this.handleClasses(size, 'size');
|
|
237
|
+
this._size = size;
|
|
238
|
+
},
|
|
239
|
+
enumerable: true,
|
|
240
|
+
configurable: true
|
|
241
|
+
});
|
|
242
|
+
Object.defineProperty(ColorPickerComponent.prototype, "rounded", {
|
|
243
|
+
get: function () {
|
|
244
|
+
return this._rounded;
|
|
245
|
+
},
|
|
246
|
+
/**
|
|
247
|
+
* The rounded property specifies the border radius of the ColorPicker
|
|
248
|
+
* ([see example]({% slug appearance_colorpicker %}#toc-rounded)).
|
|
249
|
+
*
|
|
250
|
+
* The possible values are:
|
|
251
|
+
* * `'small'`
|
|
252
|
+
* * `'medium'` (default)
|
|
253
|
+
* * `'large'`
|
|
254
|
+
* * `'full'`
|
|
255
|
+
* * `null`
|
|
256
|
+
*/
|
|
257
|
+
set: function (rounded) {
|
|
258
|
+
this.handleClasses(rounded, 'rounded');
|
|
259
|
+
this._rounded = rounded;
|
|
260
|
+
},
|
|
261
|
+
enumerable: true,
|
|
262
|
+
configurable: true
|
|
263
|
+
});
|
|
264
|
+
Object.defineProperty(ColorPickerComponent.prototype, "fillMode", {
|
|
265
|
+
get: function () {
|
|
266
|
+
return this._fillMode;
|
|
267
|
+
},
|
|
268
|
+
/**
|
|
269
|
+
* The fillMode property specifies the background and border styles of the ColorPicker
|
|
270
|
+
* ([see example]({% slug appearance_colorpicker %}#toc-fillMode)).
|
|
271
|
+
*
|
|
272
|
+
* The possible values are:
|
|
273
|
+
* * `'flat'`
|
|
274
|
+
* * `'solid'` (default)
|
|
275
|
+
* * `'outline'`
|
|
276
|
+
* * `null`
|
|
277
|
+
*/
|
|
278
|
+
set: function (fillMode) {
|
|
279
|
+
this.handleClasses(fillMode, 'fillMode');
|
|
280
|
+
this._fillMode = fillMode;
|
|
281
|
+
},
|
|
282
|
+
enumerable: true,
|
|
283
|
+
configurable: true
|
|
284
|
+
});
|
|
175
285
|
Object.defineProperty(ColorPickerComponent.prototype, "isOpen", {
|
|
176
286
|
/**
|
|
177
287
|
* Indicates whether the ColorPicker popup is open.
|
|
@@ -209,13 +319,20 @@ var ColorPickerComponent = /** @class */ (function () {
|
|
|
209
319
|
columns: this._paletteSettings.columns || presetColumns || 10
|
|
210
320
|
};
|
|
211
321
|
};
|
|
322
|
+
ColorPickerComponent.prototype.ngAfterViewInit = function () {
|
|
323
|
+
var _this = this;
|
|
324
|
+
var stylingInputs = ['size', 'rounded', 'fillMode'];
|
|
325
|
+
stylingInputs.forEach(function (input) {
|
|
326
|
+
_this.handleClasses(_this[input], input);
|
|
327
|
+
});
|
|
328
|
+
};
|
|
212
329
|
ColorPickerComponent.prototype.ngOnChanges = function (changes) {
|
|
213
330
|
if (changes.format && changes.format.currentValue === 'name') {
|
|
214
|
-
this.
|
|
331
|
+
this.activeView = 'palette';
|
|
215
332
|
}
|
|
216
|
-
if (this.
|
|
333
|
+
if (this.activeView === 'gradient' && this.gradientSettings.opacity) {
|
|
217
334
|
this.format = 'rgba';
|
|
218
|
-
this.value = parseColor(this.value, this.format);
|
|
335
|
+
this.value = parseColor(this.value, this.format, this.gradientSettings.opacity);
|
|
219
336
|
}
|
|
220
337
|
};
|
|
221
338
|
ColorPickerComponent.prototype.ngOnDestroy = function () {
|
|
@@ -224,10 +341,26 @@ var ColorPickerComponent = /** @class */ (function () {
|
|
|
224
341
|
this.dynamicRTLSubscription.unsubscribe();
|
|
225
342
|
}
|
|
226
343
|
};
|
|
344
|
+
Object.defineProperty(ColorPickerComponent.prototype, "colorPickerAriaLabel", {
|
|
345
|
+
/**
|
|
346
|
+
* @hidden
|
|
347
|
+
*/
|
|
348
|
+
get: function () {
|
|
349
|
+
return this.value ? this.value : this.localizationService.get('colorPickerNoColor');
|
|
350
|
+
},
|
|
351
|
+
enumerable: true,
|
|
352
|
+
configurable: true
|
|
353
|
+
});
|
|
354
|
+
/**
|
|
355
|
+
* @hidden
|
|
356
|
+
*/
|
|
357
|
+
ColorPickerComponent.prototype.handleCancelEvent = function (ev) {
|
|
358
|
+
this.cancel.emit(ev);
|
|
359
|
+
};
|
|
227
360
|
/**
|
|
228
361
|
* @hidden
|
|
229
362
|
*/
|
|
230
|
-
ColorPickerComponent.prototype.
|
|
363
|
+
ColorPickerComponent.prototype.togglePopup = function () {
|
|
231
364
|
this.toggleWithEvents(!this.isOpen);
|
|
232
365
|
this.focus();
|
|
233
366
|
};
|
|
@@ -239,7 +372,7 @@ var ColorPickerComponent = /** @class */ (function () {
|
|
|
239
372
|
var event = new ActiveColorClickEvent(this.value);
|
|
240
373
|
this.activeColorClick.emit(event);
|
|
241
374
|
if (!event.isOpenPrevented() || this.isOpen) {
|
|
242
|
-
this.
|
|
375
|
+
this.togglePopup();
|
|
243
376
|
}
|
|
244
377
|
};
|
|
245
378
|
/**
|
|
@@ -255,9 +388,6 @@ var ColorPickerComponent = /** @class */ (function () {
|
|
|
255
388
|
* @hidden
|
|
256
389
|
*/
|
|
257
390
|
ColorPickerComponent.prototype.handleWrapperFocus = function () {
|
|
258
|
-
if (isPresent(this.palette)) {
|
|
259
|
-
this.palette.nativeElement.focus();
|
|
260
|
-
}
|
|
261
391
|
if (this.isFocused) {
|
|
262
392
|
return;
|
|
263
393
|
}
|
|
@@ -282,7 +412,7 @@ var ColorPickerComponent = /** @class */ (function () {
|
|
|
282
412
|
this.notifyNgTouched();
|
|
283
413
|
};
|
|
284
414
|
/**
|
|
285
|
-
* Clears the
|
|
415
|
+
* Clears the value of the ColorPicker.
|
|
286
416
|
*/
|
|
287
417
|
ColorPickerComponent.prototype.reset = function () {
|
|
288
418
|
if (!isPresent(this.value)) {
|
|
@@ -310,13 +440,9 @@ var ColorPickerComponent = /** @class */ (function () {
|
|
|
310
440
|
/**
|
|
311
441
|
* @hidden
|
|
312
442
|
*/
|
|
313
|
-
ColorPickerComponent.prototype.handleValueChange = function (color
|
|
314
|
-
var parsedColor = parseColor(color, this.format);
|
|
443
|
+
ColorPickerComponent.prototype.handleValueChange = function (color) {
|
|
444
|
+
var parsedColor = parseColor(color, this.format, this.gradientSettings.opacity);
|
|
315
445
|
var valueChange = parsedColor !== this.value;
|
|
316
|
-
if (closePopup) {
|
|
317
|
-
this.toggleWithEvents(false);
|
|
318
|
-
this.focus();
|
|
319
|
-
}
|
|
320
446
|
if (valueChange) {
|
|
321
447
|
this.value = parsedColor;
|
|
322
448
|
this.valueChange.emit(parsedColor);
|
|
@@ -327,9 +453,7 @@ var ColorPickerComponent = /** @class */ (function () {
|
|
|
327
453
|
* @hidden
|
|
328
454
|
*/
|
|
329
455
|
ColorPickerComponent.prototype.handlePopupBlur = function (event) {
|
|
330
|
-
|
|
331
|
-
var wrapperClicked = event.relatedTarget === this.wrapper.nativeElement;
|
|
332
|
-
if (!this.isFocused || wrapperClicked || focusInPopupElement) {
|
|
456
|
+
if (this.popupBlurInvalid(event)) {
|
|
333
457
|
return;
|
|
334
458
|
}
|
|
335
459
|
this.isFocused = false;
|
|
@@ -380,53 +504,67 @@ var ColorPickerComponent = /** @class */ (function () {
|
|
|
380
504
|
this.wrapper.nativeElement.focus();
|
|
381
505
|
}
|
|
382
506
|
if (event.keyCode === Keys.Tab) {
|
|
383
|
-
var
|
|
384
|
-
var
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
event.preventDefault();
|
|
389
|
-
lastElement.focus();
|
|
390
|
-
return;
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
else {
|
|
394
|
-
if (event.target === lastElement) {
|
|
395
|
-
event.preventDefault();
|
|
396
|
-
firstElement.focus();
|
|
397
|
-
return;
|
|
398
|
-
}
|
|
507
|
+
var currentElement = event.shiftKey ? this.firstFocusableElement.nativeElement : this.lastFocusableElement.nativeElement;
|
|
508
|
+
var nextElement = event.shiftKey ? this.lastFocusableElement.nativeElement : this.firstFocusableElement.nativeElement;
|
|
509
|
+
if (event.target === currentElement) {
|
|
510
|
+
event.preventDefault();
|
|
511
|
+
nextElement.nativeElement.focus();
|
|
399
512
|
}
|
|
400
513
|
}
|
|
401
514
|
};
|
|
402
515
|
/**
|
|
403
516
|
* @hidden
|
|
404
|
-
* Used by the
|
|
517
|
+
* Used by the FloatingLabel to determine if the component is empty.
|
|
405
518
|
*/
|
|
406
519
|
ColorPickerComponent.prototype.isEmpty = function () {
|
|
407
520
|
return false;
|
|
408
521
|
};
|
|
522
|
+
ColorPickerComponent.prototype.handleClasses = function (value, input) {
|
|
523
|
+
var elem = this.host.nativeElement;
|
|
524
|
+
var classes = getStylingClasses('picker', input, this[input], value);
|
|
525
|
+
if (classes.toRemove) {
|
|
526
|
+
this.renderer.removeClass(elem, classes.toRemove);
|
|
527
|
+
}
|
|
528
|
+
if (classes.toAdd) {
|
|
529
|
+
this.renderer.addClass(elem, classes.toAdd);
|
|
530
|
+
}
|
|
531
|
+
};
|
|
532
|
+
ColorPickerComponent.prototype.popupBlurInvalid = function (ev) {
|
|
533
|
+
var focusInPopupElement = this.popupRef.popupElement.contains(ev.relatedTarget);
|
|
534
|
+
var wrapperClicked = ev.relatedTarget === this.wrapper.nativeElement;
|
|
535
|
+
return !this.isFocused || wrapperClicked || focusInPopupElement;
|
|
536
|
+
};
|
|
409
537
|
ColorPickerComponent.prototype.toggleWithEvents = function (open) {
|
|
410
|
-
var _this = this;
|
|
411
538
|
var sameState = this.isOpen === open;
|
|
412
539
|
if (this.disabled || this.readonly || sameState) {
|
|
413
540
|
return;
|
|
414
541
|
}
|
|
415
|
-
var eventArgs
|
|
416
|
-
|
|
542
|
+
var eventArgs;
|
|
543
|
+
if (open) {
|
|
544
|
+
eventArgs = new ColorPickerOpenEvent();
|
|
545
|
+
this.open.emit(eventArgs);
|
|
546
|
+
}
|
|
547
|
+
else {
|
|
548
|
+
eventArgs = new ColorPickerCloseEvent();
|
|
549
|
+
this.close.emit(eventArgs);
|
|
550
|
+
}
|
|
417
551
|
if (!eventArgs.isDefaultPrevented()) {
|
|
418
552
|
this.toggle(open);
|
|
419
553
|
}
|
|
420
554
|
if (open) {
|
|
421
|
-
this.
|
|
422
|
-
setTimeout(function () {
|
|
423
|
-
if (_this.colorGradient) {
|
|
424
|
-
_this.colorGradient.gradientDragHandle.nativeElement.focus();
|
|
425
|
-
}
|
|
426
|
-
});
|
|
427
|
-
});
|
|
555
|
+
this.focusFirstElement();
|
|
428
556
|
}
|
|
429
557
|
};
|
|
558
|
+
ColorPickerComponent.prototype.focusFirstElement = function () {
|
|
559
|
+
var _this = this;
|
|
560
|
+
this.ngZone.runOutsideAngular(function () {
|
|
561
|
+
setTimeout(function () {
|
|
562
|
+
var elementToFocus = _this.flatColorPicker.gradient ? _this.flatColorPicker.gradient.gradientDragHandle :
|
|
563
|
+
_this.flatColorPicker.palette.host;
|
|
564
|
+
elementToFocus.nativeElement.focus();
|
|
565
|
+
});
|
|
566
|
+
});
|
|
567
|
+
};
|
|
430
568
|
ColorPickerComponent.prototype.openPopup = function () {
|
|
431
569
|
var _this = this;
|
|
432
570
|
var horizontalAlign = this.direction === "rtl" ? "right" : "left";
|
|
@@ -457,12 +595,35 @@ var ColorPickerComponent = /** @class */ (function () {
|
|
|
457
595
|
}
|
|
458
596
|
this.popupRef.close();
|
|
459
597
|
this.popupRef = null;
|
|
460
|
-
this.palette = null;
|
|
461
598
|
};
|
|
599
|
+
Object.defineProperty(ColorPickerComponent.prototype, "firstFocusableElement", {
|
|
600
|
+
get: function () {
|
|
601
|
+
if (!this.flatColorPicker.header || (this.views.length <= 1 && !this.flatColorPicker.clearButton)) {
|
|
602
|
+
return this.flatColorPicker.gradient ? this.flatColorPicker.gradient.gradientDragHandle : this.flatColorPicker.palette.host;
|
|
603
|
+
}
|
|
604
|
+
return this.views.length > 1 ? this.flatColorPicker.header.viewButtonsCollection.toArray()[0] : this.flatColorPicker.header.clearButtonElement;
|
|
605
|
+
},
|
|
606
|
+
enumerable: true,
|
|
607
|
+
configurable: true
|
|
608
|
+
});
|
|
609
|
+
Object.defineProperty(ColorPickerComponent.prototype, "lastFocusableElement", {
|
|
610
|
+
get: function () {
|
|
611
|
+
if (this.preview) {
|
|
612
|
+
return this.flatColorPicker.footer.lastButton;
|
|
613
|
+
}
|
|
614
|
+
if (this.flatColorPicker.palette) {
|
|
615
|
+
return this.flatColorPicker.palette.host;
|
|
616
|
+
}
|
|
617
|
+
return this.gradientSettings.opacity ? this.flatColorPicker.gradient.inputs.opacityInput.numericInput : this.flatColorPicker.gradient.inputs.blueInput;
|
|
618
|
+
},
|
|
619
|
+
enumerable: true,
|
|
620
|
+
configurable: true
|
|
621
|
+
});
|
|
462
622
|
var ColorPickerComponent_1;
|
|
463
623
|
tslib_1.__decorate([
|
|
464
|
-
HostBinding('class.k-widget'),
|
|
465
624
|
HostBinding('class.k-colorpicker'),
|
|
625
|
+
HostBinding('class.k-icon-picker'),
|
|
626
|
+
HostBinding('class.k-picker'),
|
|
466
627
|
tslib_1.__metadata("design:type", Boolean)
|
|
467
628
|
], ColorPickerComponent.prototype, "hostClasses", void 0);
|
|
468
629
|
tslib_1.__decorate([
|
|
@@ -473,10 +634,14 @@ var ColorPickerComponent = /** @class */ (function () {
|
|
|
473
634
|
Input(),
|
|
474
635
|
tslib_1.__metadata("design:type", String)
|
|
475
636
|
], ColorPickerComponent.prototype, "focusableId", void 0);
|
|
637
|
+
tslib_1.__decorate([
|
|
638
|
+
Input(),
|
|
639
|
+
tslib_1.__metadata("design:type", Array)
|
|
640
|
+
], ColorPickerComponent.prototype, "views", void 0);
|
|
476
641
|
tslib_1.__decorate([
|
|
477
642
|
Input(),
|
|
478
643
|
tslib_1.__metadata("design:type", String)
|
|
479
|
-
], ColorPickerComponent.prototype, "
|
|
644
|
+
], ColorPickerComponent.prototype, "activeView", void 0);
|
|
480
645
|
tslib_1.__decorate([
|
|
481
646
|
Input(),
|
|
482
647
|
tslib_1.__metadata("design:type", Boolean)
|
|
@@ -517,11 +682,38 @@ var ColorPickerComponent = /** @class */ (function () {
|
|
|
517
682
|
Input(),
|
|
518
683
|
tslib_1.__metadata("design:type", Object)
|
|
519
684
|
], ColorPickerComponent.prototype, "iconClass", void 0);
|
|
685
|
+
tslib_1.__decorate([
|
|
686
|
+
Input(),
|
|
687
|
+
tslib_1.__metadata("design:type", Boolean)
|
|
688
|
+
], ColorPickerComponent.prototype, "clearButton", void 0);
|
|
520
689
|
tslib_1.__decorate([
|
|
521
690
|
Input(),
|
|
522
691
|
tslib_1.__metadata("design:type", Number),
|
|
523
692
|
tslib_1.__metadata("design:paramtypes", [Number])
|
|
524
693
|
], ColorPickerComponent.prototype, "tabindex", null);
|
|
694
|
+
tslib_1.__decorate([
|
|
695
|
+
Input(),
|
|
696
|
+
tslib_1.__metadata("design:type", Boolean)
|
|
697
|
+
], ColorPickerComponent.prototype, "preview", void 0);
|
|
698
|
+
tslib_1.__decorate([
|
|
699
|
+
Input(),
|
|
700
|
+
tslib_1.__metadata("design:type", String)
|
|
701
|
+
], ColorPickerComponent.prototype, "actionsLayout", void 0);
|
|
702
|
+
tslib_1.__decorate([
|
|
703
|
+
Input(),
|
|
704
|
+
tslib_1.__metadata("design:type", String),
|
|
705
|
+
tslib_1.__metadata("design:paramtypes", [String])
|
|
706
|
+
], ColorPickerComponent.prototype, "size", null);
|
|
707
|
+
tslib_1.__decorate([
|
|
708
|
+
Input(),
|
|
709
|
+
tslib_1.__metadata("design:type", String),
|
|
710
|
+
tslib_1.__metadata("design:paramtypes", [String])
|
|
711
|
+
], ColorPickerComponent.prototype, "rounded", null);
|
|
712
|
+
tslib_1.__decorate([
|
|
713
|
+
Input(),
|
|
714
|
+
tslib_1.__metadata("design:type", String),
|
|
715
|
+
tslib_1.__metadata("design:paramtypes", [String])
|
|
716
|
+
], ColorPickerComponent.prototype, "fillMode", null);
|
|
525
717
|
tslib_1.__decorate([
|
|
526
718
|
Output(),
|
|
527
719
|
tslib_1.__metadata("design:type", EventEmitter)
|
|
@@ -542,10 +734,18 @@ var ColorPickerComponent = /** @class */ (function () {
|
|
|
542
734
|
Output('blur'),
|
|
543
735
|
tslib_1.__metadata("design:type", EventEmitter)
|
|
544
736
|
], ColorPickerComponent.prototype, "onBlur", void 0);
|
|
737
|
+
tslib_1.__decorate([
|
|
738
|
+
Output(),
|
|
739
|
+
tslib_1.__metadata("design:type", EventEmitter)
|
|
740
|
+
], ColorPickerComponent.prototype, "cancel", void 0);
|
|
545
741
|
tslib_1.__decorate([
|
|
546
742
|
Output(),
|
|
547
743
|
tslib_1.__metadata("design:type", EventEmitter)
|
|
548
744
|
], ColorPickerComponent.prototype, "activeColorClick", void 0);
|
|
745
|
+
tslib_1.__decorate([
|
|
746
|
+
Output(),
|
|
747
|
+
tslib_1.__metadata("design:type", EventEmitter)
|
|
748
|
+
], ColorPickerComponent.prototype, "activeViewChange", void 0);
|
|
549
749
|
tslib_1.__decorate([
|
|
550
750
|
ViewChild('container', { read: ViewContainerRef, static: true }),
|
|
551
751
|
tslib_1.__metadata("design:type", ViewContainerRef)
|
|
@@ -559,15 +759,12 @@ var ColorPickerComponent = /** @class */ (function () {
|
|
|
559
759
|
tslib_1.__metadata("design:type", TemplateRef)
|
|
560
760
|
], ColorPickerComponent.prototype, "popupTemplate", void 0);
|
|
561
761
|
tslib_1.__decorate([
|
|
562
|
-
ViewChild('
|
|
563
|
-
tslib_1.__metadata("design:type",
|
|
564
|
-
], ColorPickerComponent.prototype, "
|
|
565
|
-
tslib_1.__decorate([
|
|
566
|
-
ViewChild('colorGradient', { static: false }),
|
|
567
|
-
tslib_1.__metadata("design:type", ColorGradientComponent)
|
|
568
|
-
], ColorPickerComponent.prototype, "colorGradient", void 0);
|
|
762
|
+
ViewChild('flatColorPicker', { static: false }),
|
|
763
|
+
tslib_1.__metadata("design:type", FlatColorPickerComponent)
|
|
764
|
+
], ColorPickerComponent.prototype, "flatColorPicker", void 0);
|
|
569
765
|
ColorPickerComponent = ColorPickerComponent_1 = tslib_1.__decorate([
|
|
570
766
|
Component({
|
|
767
|
+
exportAs: 'kendoColorPicker',
|
|
571
768
|
selector: 'kendo-colorpicker',
|
|
572
769
|
providers: [{
|
|
573
770
|
multi: true,
|
|
@@ -587,12 +784,14 @@ var ColorPickerComponent = /** @class */ (function () {
|
|
|
587
784
|
useValue: 'kendo.colorpicker'
|
|
588
785
|
}
|
|
589
786
|
],
|
|
590
|
-
template: "\n <ng-container kendoColorPickerLocalizedMessages\n i18n-
|
|
787
|
+
template: "\n <ng-container kendoColorPickerLocalizedMessages\n i18n-colorPickerNoColor=\"kendo.colorpicker.colorPickerNoColor|The aria-label applied to the ColorPicker component when the value is empty.\"\n colorPickerNoColor=\"Colorpicker no color chosen\"\n i18n-flatColorPickerNoColor=\"kendo.colorpicker.flatColorPickerNoColor|The aria-label applied to the FlatColorPicker component when the value is empty.\"\n flatColorPickerNoColor=\"Flatcolorpicker no color chosen\"\n i18n-colorGradientNoColor=\"kendo.colorpicker.colorGradientNoColor|The aria-label applied to the ColorGradient component when the value is empty.\"\n colorGradientNoColor=\"Colorgradient no color chosen\"\n i18n-colorPaletteNoColor=\"kendo.colorpicker.colorPaletteNoColor|The aria-label applied to the ColorPalette component when the value is empty.\"\n colorPaletteNoColor=\"Colorpalette no color chosen\"\n i18n-colorGradientHandle=\"kendo.colorpicker.colorGradientHandle|The title for the gradient color drag handle chooser.\"\n colorGradientHandle=\"Choose color\"\n i18n-clearButton=\"kendo.colorpicker.clearButton|The title for the clear button.\"\n clearButton=\"Clear value\"\n i18n-hueSliderHandle=\"kendo.colorpicker.hueSliderHandle|The title for the hue slider handle.\"\n hueSliderHandle=\"Set hue\"\n i18n-opacitySliderHandle=\"kendo.colorpicker.opacitySliderHandle|The title for the opacity slider handle.\"\n opacitySliderHandle=\"Set opacity\"\n i18n-contrastRatio=\"kendo.colorpicker.contrastRatio|The contrast ratio message for the contrast tool.\"\n contrastRatio=\"Contrast ratio\"\n i18n-previewColor=\"kendo.colorpicker.previewColor|The message for the color preview pane.\"\n previewColor=\"Color preview\"\n i18n-revertSelection=\"kendo.colorpicker.revertSelection|The message for the selected color pane.\"\n revertSelection=\"Revert selection\"\n i18n-gradientView=\"kendo.colorpicker.gradientView|The message for the gradient view button.\"\n gradientView=\"Gradient view\"\n i18n-paletteView=\"kendo.colorpicker.paletteView|The message for the palette view button.\"\n paletteView=\"Palette view\"\n i18n-formatButton=\"kendo.colorpicker.formatButton|The message for the input format toggle button.\"\n formatButton=\"Change color format\"\n i18n-applyButton=\"kendo.colorpicker.applyButton|The message for the Apply action button.\"\n applyButton=\"Apply\"\n i18n-cancelButton=\"kendo.colorpicker.cancelButton|The message for the Cancel action button.\"\n cancelButton=\"Cancel\">\n </ng-container>\n <span\n #wrapper\n [ngClass]=\"{\n 'k-input-inner': true,\n 'k-disabled': this.disabled,\n 'k-focus': this.isFocused\n }\"\n role=\"listbox\"\n [attr.aria-expanded]=\"isOpen\"\n [attr.aria-readonly]=\"readonly\"\n [attr.aria-disabled]=\"disabled\"\n [attr.aria-label]=\"colorPickerAriaLabel\"\n [id]=\"focusableId\"\n [attr.tabindex]=\"tabindex\"\n (focus)=\"handleWrapperFocus()\"\n (blur)=\"handleWrapperBlur()\"\n (mousedown)=\"$event.preventDefault()\"\n (keydown)=\"handleWrapperKeyDown($event)\"\n >\n <span\n class=\"k-value-icon k-color-preview\"\n [ngClass]=\"{'k-icon-color-preview': iconStyles, 'k-no-color': !value}\"\n (click)=\"handleActiveColorClick()\">\n <span *ngIf=\"iconClass || icon\" class=\"k-color-preview-icon k-icon\" [ngClass]=\"iconStyles\"></span>\n <span class=\"k-color-preview-mask\" [style.background-color]=\"value\"></span>\n </span>\n </span>\n <button\n type=\"button\"\n class=\"k-input-button k-button k-button-md k-button-solid k-button-solid-base k-icon-button\"\n [attr.aria-label]=\"colorPickerAriaLabel\"\n (click)=\"togglePopup()\">\n <span class=\"k-button-icon k-icon k-i-arrow-s\"></span>\n </button>\n <ng-template #popupTemplate>\n <kendo-flatcolorpicker\n #flatColorPicker\n [value]=\"value\"\n [format]=\"format\"\n [views]=\"views\"\n [activeView]=\"activeView\"\n [actionsLayout]=\"actionsLayout\"\n [preview]=\"preview\"\n [gradientSettings]=\"gradientSettings\"\n [paletteSettings]=\"paletteSettings\"\n [clearButton]=\"clearButton\"\n (focusout)=\"handlePopupBlur($event)\"\n (cancel)=\"handleCancelEvent($event)\"\n (valueChange)=\"handleValueChange($event)\"\n (keydown)=\"handlePopupKeyDown($event)\"\n (activeViewChange)=\"activeViewChange.emit($event)\"\n (actionButtonClick)=\"togglePopup()\">\n </kendo-flatcolorpicker>\n </ng-template>\n <ng-container #container></ng-container>\n "
|
|
591
788
|
}),
|
|
592
|
-
tslib_1.__metadata("design:paramtypes", [
|
|
789
|
+
tslib_1.__metadata("design:paramtypes", [ElementRef,
|
|
790
|
+
PopupService,
|
|
593
791
|
ChangeDetectorRef,
|
|
594
792
|
LocalizationService,
|
|
595
|
-
NgZone
|
|
793
|
+
NgZone,
|
|
794
|
+
Renderer2])
|
|
596
795
|
], ColorPickerComponent);
|
|
597
796
|
return ColorPickerComponent;
|
|
598
797
|
}());
|
|
@@ -22,3 +22,15 @@ export var AAA_RATIO = 7.0;
|
|
|
22
22
|
* @hidden
|
|
23
23
|
*/
|
|
24
24
|
export var AA_RATIO = 4.5;
|
|
25
|
+
/**
|
|
26
|
+
* @hidden
|
|
27
|
+
*/
|
|
28
|
+
export var DEFAULT_PRESET = 'office';
|
|
29
|
+
/**
|
|
30
|
+
* @hidden
|
|
31
|
+
*/
|
|
32
|
+
export var DEFAULT_ACCESSIBLE_PRESET = 'accessible';
|
|
33
|
+
/**
|
|
34
|
+
* @hidden
|
|
35
|
+
*/
|
|
36
|
+
export var STEP_COUNT = 16;
|
|
@@ -3,6 +3,7 @@
|
|
|
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 { AA_RATIO, AAA_RATIO } from './constants';
|
|
6
7
|
import { LocalizationService } from '@progress/kendo-angular-l10n';
|
|
7
8
|
import { Component, Input } from '@angular/core';
|
|
8
9
|
/**
|
|
@@ -28,7 +29,8 @@ var ContrastValidationComponent = /** @class */ (function () {
|
|
|
28
29
|
});
|
|
29
30
|
Object.defineProperty(ContrastValidationComponent.prototype, "contrastText", {
|
|
30
31
|
get: function () {
|
|
31
|
-
|
|
32
|
+
var ratio = this.type === 'AA' ? AA_RATIO : AAA_RATIO;
|
|
33
|
+
return this.type + ": " + ratio.toFixed(1);
|
|
32
34
|
},
|
|
33
35
|
enumerable: true,
|
|
34
36
|
configurable: true
|
|
@@ -37,18 +39,18 @@ var ContrastValidationComponent = /** @class */ (function () {
|
|
|
37
39
|
Input(),
|
|
38
40
|
tslib_1.__metadata("design:type", String)
|
|
39
41
|
], 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
42
|
tslib_1.__decorate([
|
|
45
43
|
Input(),
|
|
46
44
|
tslib_1.__metadata("design:type", Boolean)
|
|
47
45
|
], ContrastValidationComponent.prototype, "pass", void 0);
|
|
46
|
+
tslib_1.__decorate([
|
|
47
|
+
Input(),
|
|
48
|
+
tslib_1.__metadata("design:type", String)
|
|
49
|
+
], ContrastValidationComponent.prototype, "value", void 0);
|
|
48
50
|
ContrastValidationComponent = tslib_1.__decorate([
|
|
49
51
|
Component({
|
|
50
52
|
selector: '[kendoContrastValidation]',
|
|
51
|
-
template: "\n <span>{{contrastText}}</span>\n
|
|
53
|
+
template: "\n <span>{{contrastText}}</span>\n <ng-container *ngIf=\"value\">\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 </ng-container>\n "
|
|
52
54
|
}),
|
|
53
55
|
tslib_1.__metadata("design:paramtypes", [LocalizationService])
|
|
54
56
|
], ContrastValidationComponent);
|