@progress/kendo-angular-inputs 13.2.1-develop.11 → 13.2.1-develop.13
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/LICENSE.md +11 -0
- package/NOTICE.txt +654 -0
- package/README.md +184 -0
- package/checkbox/checkbox.directive.d.ts +52 -0
- package/checkbox.module.d.ts +43 -0
- package/colorpicker/color-contrast-svg.component.d.ts +29 -0
- package/colorpicker/color-gradient-numeric-label.directive.d.ts +20 -0
- package/colorpicker/color-gradient.component.d.ts +281 -0
- package/colorpicker/color-input.component.d.ts +95 -0
- package/colorpicker/color-palette.component.d.ts +221 -0
- package/colorpicker/colorpicker.component.d.ts +383 -0
- package/colorpicker/constants.d.ts +41 -0
- package/colorpicker/contrast-validation.component.d.ts +24 -0
- package/colorpicker/contrast.component.d.ts +25 -0
- package/colorpicker/events/active-color-click-event.d.ts +53 -0
- package/colorpicker/events/cancel-event.d.ts +15 -0
- package/colorpicker/events/close-event.d.ts +10 -0
- package/colorpicker/events/kendo-drag-event.d.ts +21 -0
- package/colorpicker/events/open-event.d.ts +10 -0
- package/colorpicker/events.d.ts +8 -0
- package/colorpicker/flatcolorpicker-actions.component.d.ts +24 -0
- package/colorpicker/flatcolorpicker-header.component.d.ts +43 -0
- package/colorpicker/flatcolorpicker.component.d.ts +267 -0
- package/colorpicker/focus-on-dom-ready.directive.d.ts +18 -0
- package/colorpicker/localization/colorgradient-localization.service.d.ts +17 -0
- package/colorpicker/localization/colorpalette-localization.service.d.ts +17 -0
- package/colorpicker/localization/colorpicker-localization.service.d.ts +14 -0
- package/colorpicker/localization/custom-messages.component.d.ts +17 -0
- package/colorpicker/localization/flatcolorpicker-localization.service.d.ts +17 -0
- package/colorpicker/localization/localized-colorpicker-messages.directive.d.ts +16 -0
- package/colorpicker/localization/messages.d.ts +121 -0
- package/colorpicker/models/actions-layout.d.ts +8 -0
- package/colorpicker/models/colorpicker-view.d.ts +8 -0
- package/colorpicker/models/gradient-settings.d.ts +35 -0
- package/colorpicker/models/hsva.d.ts +13 -0
- package/colorpicker/models/output-format.d.ts +8 -0
- package/colorpicker/models/palette-presets.d.ts +61 -0
- package/colorpicker/models/palette-settings.d.ts +33 -0
- package/colorpicker/models/popup-settings.d.ts +18 -0
- package/colorpicker/models/rgb.d.ts +12 -0
- package/colorpicker/models/rgba.d.ts +13 -0
- package/colorpicker/models/table-cell.d.ts +11 -0
- package/colorpicker/models/tile-size.d.ts +11 -0
- package/colorpicker/models.d.ts +16 -0
- package/colorpicker/services/color-palette.service.d.ts +19 -0
- package/colorpicker/services/flatcolorpicker.service.d.ts +15 -0
- package/colorpicker/utils/color-parser.d.ts +77 -0
- package/colorpicker/utils/contrast-curve.d.ts +37 -0
- package/colorpicker/utils.d.ts +6 -0
- package/colorpicker.module.d.ts +35 -0
- package/common/dom-utils.d.ts +25 -0
- package/common/math.d.ts +36 -0
- package/common/models/fillmode.d.ts +9 -0
- package/common/models/rounded.d.ts +14 -0
- package/common/models/size.d.ts +9 -0
- package/common/models/styling-classes.d.ts +11 -0
- package/common/models.d.ts +8 -0
- package/common/utils.d.ts +56 -0
- package/esm2020/checkbox/checkbox.directive.mjs +94 -0
- package/esm2020/checkbox.module.mjs +52 -0
- package/esm2020/colorpicker/color-contrast-svg.component.mjs +97 -0
- package/esm2020/colorpicker/color-gradient-numeric-label.directive.mjs +31 -0
- package/esm2020/colorpicker/color-gradient.component.mjs +1003 -0
- package/esm2020/colorpicker/color-input.component.mjs +433 -0
- package/esm2020/colorpicker/color-palette.component.mjs +553 -0
- package/esm2020/colorpicker/colorpicker.component.mjs +1086 -0
- package/esm2020/colorpicker/constants.mjs +40 -0
- package/esm2020/colorpicker/contrast-validation.component.mjs +72 -0
- package/esm2020/colorpicker/contrast.component.mjs +100 -0
- package/esm2020/colorpicker/events/active-color-click-event.mjs +58 -0
- package/esm2020/colorpicker/events/cancel-event.mjs +14 -0
- package/esm2020/colorpicker/events/close-event.mjs +10 -0
- package/esm2020/colorpicker/events/kendo-drag-event.mjs +5 -0
- package/esm2020/colorpicker/events/open-event.mjs +10 -0
- package/esm2020/colorpicker/events.mjs +8 -0
- package/esm2020/colorpicker/flatcolorpicker-actions.component.mjs +93 -0
- package/esm2020/colorpicker/flatcolorpicker-header.component.mjs +217 -0
- package/esm2020/colorpicker/flatcolorpicker.component.mjs +829 -0
- package/esm2020/colorpicker/focus-on-dom-ready.directive.mjs +29 -0
- package/esm2020/colorpicker/localization/colorgradient-localization.service.mjs +45 -0
- package/esm2020/colorpicker/localization/colorpalette-localization.service.mjs +45 -0
- package/esm2020/colorpicker/localization/colorpicker-localization.service.mjs +31 -0
- package/esm2020/colorpicker/localization/custom-messages.component.mjs +41 -0
- package/esm2020/colorpicker/localization/flatcolorpicker-localization.service.mjs +45 -0
- package/esm2020/colorpicker/localization/localized-colorpicker-messages.directive.mjs +37 -0
- package/esm2020/colorpicker/localization/messages.mjs +75 -0
- package/esm2020/colorpicker/models/actions-layout.mjs +5 -0
- package/esm2020/colorpicker/models/colorpicker-view.mjs +5 -0
- package/esm2020/colorpicker/models/gradient-settings.mjs +5 -0
- package/esm2020/colorpicker/models/hsva.mjs +5 -0
- package/esm2020/colorpicker/models/output-format.mjs +5 -0
- package/esm2020/colorpicker/models/palette-presets.mjs +62 -0
- package/esm2020/colorpicker/models/palette-settings.mjs +5 -0
- package/esm2020/colorpicker/models/popup-settings.mjs +5 -0
- package/esm2020/colorpicker/models/rgb.mjs +5 -0
- package/esm2020/colorpicker/models/rgba.mjs +5 -0
- package/esm2020/colorpicker/models/table-cell.mjs +5 -0
- package/esm2020/colorpicker/models/tile-size.mjs +6 -0
- package/esm2020/colorpicker/models.mjs +16 -0
- package/esm2020/colorpicker/services/color-palette.service.mjs +67 -0
- package/esm2020/colorpicker/services/flatcolorpicker.service.mjs +39 -0
- package/esm2020/colorpicker/utils/color-parser.mjs +164 -0
- package/esm2020/colorpicker/utils/contrast-curve.mjs +85 -0
- package/esm2020/colorpicker/utils.mjs +6 -0
- package/esm2020/colorpicker.module.mjs +104 -0
- package/esm2020/common/dom-utils.mjs +36 -0
- package/esm2020/common/math.mjs +65 -0
- package/esm2020/common/models/fillmode.mjs +5 -0
- package/esm2020/common/models/rounded.mjs +5 -0
- package/esm2020/common/models/size.mjs +5 -0
- package/esm2020/common/models/styling-classes.mjs +5 -0
- package/esm2020/common/models.mjs +8 -0
- package/esm2020/common/utils.mjs +81 -0
- package/esm2020/formfield/error.component.mjs +68 -0
- package/esm2020/formfield/formfield.component.mjs +284 -0
- package/esm2020/formfield/hint.component.mjs +63 -0
- package/esm2020/formfield/models/message-align.mjs +5 -0
- package/esm2020/formfield/models/orientation.mjs +5 -0
- package/esm2020/formfield/models/show-options.mjs +5 -0
- package/esm2020/formfield.module.mjs +54 -0
- package/esm2020/index.mjs +66 -0
- package/esm2020/inputs.module.mjs +98 -0
- package/esm2020/maskedtextbox/maskedtextbox.component.mjs +711 -0
- package/esm2020/maskedtextbox/masking.service.mjs +191 -0
- package/esm2020/maskedtextbox/parsing/combinators.mjs +28 -0
- package/esm2020/maskedtextbox/parsing/parsers.mjs +147 -0
- package/esm2020/maskedtextbox/parsing/result.mjs +41 -0
- package/esm2020/maskedtextbox/parsing/stream.mjs +41 -0
- package/esm2020/maskedtextbox.module.mjs +53 -0
- package/esm2020/numerictextbox/arrow-direction.mjs +13 -0
- package/esm2020/numerictextbox/constants.mjs +28 -0
- package/esm2020/numerictextbox/localization/custom-messages.component.mjs +41 -0
- package/esm2020/numerictextbox/localization/localized-numerictextbox-messages.directive.mjs +37 -0
- package/esm2020/numerictextbox/localization/messages.mjs +25 -0
- package/esm2020/numerictextbox/numerictextbox.component.mjs +1105 -0
- package/esm2020/numerictextbox/utils.mjs +92 -0
- package/esm2020/numerictextbox.module.mjs +66 -0
- package/esm2020/package-metadata.mjs +15 -0
- package/esm2020/progress-kendo-angular-inputs.mjs +8 -0
- package/esm2020/radiobutton/radiobutton.directive.mjs +76 -0
- package/esm2020/radiobutton.module.mjs +52 -0
- package/esm2020/rangeslider/localization/custom-messages.component.mjs +41 -0
- package/esm2020/rangeslider/localization/localized-rangeslider-messages.directive.mjs +37 -0
- package/esm2020/rangeslider/localization/messages.mjs +25 -0
- package/esm2020/rangeslider/rangeslider-model.mjs +52 -0
- package/esm2020/rangeslider/rangeslider-value.type.mjs +5 -0
- package/esm2020/rangeslider/rangeslider.component.mjs +605 -0
- package/esm2020/rangeslider.module.mjs +71 -0
- package/esm2020/shared/input-separator.component.mjs +41 -0
- package/esm2020/shared/textarea.directive.mjs +260 -0
- package/esm2020/shared/utils.mjs +13 -0
- package/esm2020/shared.module.mjs +32 -0
- package/esm2020/signature/events/close-event.mjs +10 -0
- package/esm2020/signature/events/index.mjs +6 -0
- package/esm2020/signature/events/open-event.mjs +10 -0
- package/esm2020/signature/localization/custom-messages.component.mjs +41 -0
- package/esm2020/signature/localization/index.mjs +7 -0
- package/esm2020/signature/localization/localized-signature-messages.directive.mjs +37 -0
- package/esm2020/signature/localization/messages.mjs +29 -0
- package/esm2020/signature/signature.component.mjs +906 -0
- package/esm2020/signature.module.mjs +79 -0
- package/esm2020/slider/localization/custom-messages.component.mjs +41 -0
- package/esm2020/slider/localization/localized-slider-messages.directive.mjs +37 -0
- package/esm2020/slider/localization/messages.mjs +27 -0
- package/esm2020/slider/slider-model.mjs +34 -0
- package/esm2020/slider/slider.component.mjs +646 -0
- package/esm2020/slider.module.mjs +73 -0
- package/esm2020/sliders-common/label-template.directive.mjs +45 -0
- package/esm2020/sliders-common/slider-base.mjs +255 -0
- package/esm2020/sliders-common/slider-model.base.mjs +93 -0
- package/esm2020/sliders-common/slider-ticks.component.mjs +125 -0
- package/esm2020/sliders-common/sliders-common.module.mjs +42 -0
- package/esm2020/sliders-common/sliders-util.mjs +219 -0
- package/esm2020/sliders-common/title-callback.mjs +5 -0
- package/esm2020/switch/events/blur-event.mjs +9 -0
- package/esm2020/switch/events/focus-event.mjs +9 -0
- package/esm2020/switch/localization/custom-messages.component.mjs +41 -0
- package/esm2020/switch/localization/localized-switch-messages.directive.mjs +37 -0
- package/esm2020/switch/localization/messages.mjs +25 -0
- package/esm2020/switch/switch.component.mjs +577 -0
- package/esm2020/switch.module.mjs +68 -0
- package/esm2020/text-fields-common/text-fields-base.mjs +128 -0
- package/esm2020/textarea/models/flow.mjs +5 -0
- package/esm2020/textarea/models/resize.mjs +5 -0
- package/esm2020/textarea/textarea-suffix.component.mjs +40 -0
- package/esm2020/textarea/textarea.component.mjs +604 -0
- package/esm2020/textarea.module.mjs +68 -0
- package/esm2020/textbox/localization/custom-messages.component.mjs +41 -0
- package/esm2020/textbox/localization/localized-textbox-messages.directive.mjs +37 -0
- package/esm2020/textbox/localization/messages.mjs +23 -0
- package/esm2020/textbox/models/icon-show-options.mjs +5 -0
- package/esm2020/textbox/textbox-prefix.directive.mjs +38 -0
- package/esm2020/textbox/textbox-suffix.directive.mjs +37 -0
- package/esm2020/textbox/textbox.component.mjs +849 -0
- package/esm2020/textbox/textbox.directive.mjs +121 -0
- package/esm2020/textbox.module.mjs +89 -0
- package/esm2020/validators/max.validator.mjs +21 -0
- package/esm2020/validators/min.validator.mjs +21 -0
- package/fesm2015/progress-kendo-angular-inputs.mjs +15090 -0
- package/fesm2020/progress-kendo-angular-inputs.mjs +15055 -0
- package/formfield/error.component.d.ts +31 -0
- package/formfield/formfield.component.d.ts +98 -0
- package/formfield/hint.component.d.ts +29 -0
- package/formfield/models/message-align.d.ts +8 -0
- package/formfield/models/orientation.d.ts +9 -0
- package/formfield/models/show-options.d.ts +16 -0
- package/formfield.module.d.ts +45 -0
- package/index.d.ts +76 -0
- package/inputs.module.d.ts +55 -0
- package/maskedtextbox/maskedtextbox.component.d.ts +315 -0
- package/maskedtextbox/masking.service.d.ts +48 -0
- package/maskedtextbox/parsing/combinators.d.ts +13 -0
- package/maskedtextbox/parsing/parsers.d.ts +51 -0
- package/maskedtextbox/parsing/result.d.ts +27 -0
- package/maskedtextbox/parsing/stream.d.ts +26 -0
- package/maskedtextbox.module.d.ts +44 -0
- package/numerictextbox/arrow-direction.d.ts +12 -0
- package/numerictextbox/constants.d.ts +28 -0
- package/numerictextbox/localization/custom-messages.component.d.ts +17 -0
- package/numerictextbox/localization/localized-numerictextbox-messages.directive.d.ts +16 -0
- package/numerictextbox/localization/messages.d.ts +21 -0
- package/numerictextbox/numerictextbox.component.d.ts +364 -0
- package/numerictextbox/utils.d.ts +44 -0
- package/numerictextbox.module.d.ts +47 -0
- package/package-metadata.d.ts +9 -0
- package/package.json +74 -0
- package/progress-kendo-angular-inputs.d.ts +9 -0
- package/radiobutton/radiobutton.directive.d.ts +38 -0
- package/radiobutton.module.d.ts +43 -0
- package/rangeslider/localization/custom-messages.component.d.ts +17 -0
- package/rangeslider/localization/localized-rangeslider-messages.directive.d.ts +16 -0
- package/rangeslider/localization/messages.d.ts +21 -0
- package/rangeslider/rangeslider-model.d.ts +15 -0
- package/rangeslider/rangeslider-value.type.d.ts +9 -0
- package/rangeslider/rangeslider.component.d.ts +139 -0
- package/rangeslider.module.d.ts +48 -0
- package/schematics/collection.json +12 -0
- package/schematics/ngAdd/index.js +11 -0
- package/schematics/ngAdd/schema.json +28 -0
- package/shared/input-separator.component.d.ts +28 -0
- package/shared/textarea.directive.d.ts +99 -0
- package/shared/utils.d.ts +10 -0
- package/shared.module.d.ts +19 -0
- package/signature/events/close-event.d.ts +10 -0
- package/signature/events/index.d.ts +6 -0
- package/signature/events/open-event.d.ts +10 -0
- package/signature/localization/custom-messages.component.d.ts +17 -0
- package/signature/localization/index.d.ts +7 -0
- package/signature/localization/localized-signature-messages.directive.d.ts +16 -0
- package/signature/localization/messages.d.ts +29 -0
- package/signature/signature.component.d.ts +364 -0
- package/signature.module.d.ts +48 -0
- package/slider/localization/custom-messages.component.d.ts +17 -0
- package/slider/localization/localized-slider-messages.directive.d.ts +16 -0
- package/slider/localization/messages.d.ts +25 -0
- package/slider/slider-model.d.ts +14 -0
- package/slider/slider.component.d.ts +175 -0
- package/slider.module.d.ts +50 -0
- package/sliders-common/label-template.directive.d.ts +36 -0
- package/sliders-common/slider-base.d.ts +141 -0
- package/sliders-common/slider-model.base.d.ts +26 -0
- package/sliders-common/slider-ticks.component.d.ts +26 -0
- package/sliders-common/sliders-common.module.d.ts +17 -0
- package/sliders-common/sliders-util.d.ts +119 -0
- package/sliders-common/title-callback.d.ts +10 -0
- package/switch/events/blur-event.d.ts +13 -0
- package/switch/events/focus-event.d.ts +13 -0
- package/switch/localization/custom-messages.component.d.ts +17 -0
- package/switch/localization/localized-switch-messages.directive.d.ts +16 -0
- package/switch/localization/messages.d.ts +21 -0
- package/switch/switch.component.d.ts +216 -0
- package/switch.module.d.ts +46 -0
- package/text-fields-common/text-fields-base.d.ts +91 -0
- package/textarea/models/flow.d.ts +12 -0
- package/textarea/models/resize.d.ts +16 -0
- package/textarea/textarea-suffix.component.d.ts +26 -0
- package/textarea/textarea.component.d.ts +225 -0
- package/textarea.module.d.ts +48 -0
- package/textbox/localization/custom-messages.component.d.ts +17 -0
- package/textbox/localization/localized-textbox-messages.directive.d.ts +16 -0
- package/textbox/localization/messages.d.ts +17 -0
- package/textbox/models/icon-show-options.d.ts +13 -0
- package/textbox/textbox-prefix.directive.d.ts +29 -0
- package/textbox/textbox-suffix.directive.d.ts +28 -0
- package/textbox/textbox.component.d.ts +376 -0
- package/textbox/textbox.directive.d.ts +59 -0
- package/textbox.module.d.ts +53 -0
- package/validators/max.validator.d.ts +8 -0
- package/validators/min.validator.d.ts +8 -0
|
@@ -0,0 +1,1003 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2023 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
6
|
+
import { Component, Input, ViewChild, ElementRef, Renderer2, NgZone, Output, EventEmitter, HostBinding, forwardRef, ChangeDetectorRef, Injector, HostListener } from '@angular/core';
|
|
7
|
+
import { NgControl, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
8
|
+
import { BehaviorSubject, Subject } from 'rxjs';
|
|
9
|
+
import { take, throttleTime } from 'rxjs/operators';
|
|
10
|
+
import { LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
|
|
11
|
+
import { isChanged, isDocumentAvailable, KendoInput } from '@progress/kendo-angular-common';
|
|
12
|
+
import { validatePackage } from '@progress/kendo-licensing';
|
|
13
|
+
import { containsFocus, isUntouched } from '../common/dom-utils';
|
|
14
|
+
import { parseColor, getHSV, getColorFromHSV, getColorFromHue } from './utils';
|
|
15
|
+
import { isPresent, fitIntoBounds } from '../common/utils';
|
|
16
|
+
import { SliderComponent } from '../slider/slider.component';
|
|
17
|
+
import { ColorGradientLocalizationService } from './localization/colorgradient-localization.service';
|
|
18
|
+
import { ColorInputComponent } from './color-input.component';
|
|
19
|
+
import { DEFAULT_GRADIENT_BACKGROUND_COLOR, DEFAULT_OUTPUT_FORMAT, DRAGHANDLE_MOVE_SPEED, DRAGHANDLE_MOVE_SPEED_SMALL_STEP } from './constants';
|
|
20
|
+
import { packageMetadata } from '../package-metadata';
|
|
21
|
+
import { dropletSlashIcon } from '@progress/kendo-svg-icons';
|
|
22
|
+
import * as i0 from "@angular/core";
|
|
23
|
+
import * as i1 from "@progress/kendo-angular-l10n";
|
|
24
|
+
import * as i2 from "./color-contrast-svg.component";
|
|
25
|
+
import * as i3 from "@progress/kendo-angular-buttons";
|
|
26
|
+
import * as i4 from "../slider/slider.component";
|
|
27
|
+
import * as i5 from "./color-input.component";
|
|
28
|
+
import * as i6 from "./contrast.component";
|
|
29
|
+
import * as i7 from "./localization/localized-colorpicker-messages.directive";
|
|
30
|
+
import * as i8 from "@progress/kendo-angular-common";
|
|
31
|
+
import * as i9 from "@angular/common";
|
|
32
|
+
let serial = 0;
|
|
33
|
+
/**
|
|
34
|
+
* The ColorGradient component enables smooth color transitions and provides options for selecting specific colors over the drag handle.
|
|
35
|
+
* The ColorGradient is independently used by `kendo-colorpicker` and can be directly added to the page.
|
|
36
|
+
*/
|
|
37
|
+
export class ColorGradientComponent {
|
|
38
|
+
constructor(host, ngZone, renderer, cdr, localizationService, injector) {
|
|
39
|
+
this.host = host;
|
|
40
|
+
this.ngZone = ngZone;
|
|
41
|
+
this.renderer = renderer;
|
|
42
|
+
this.cdr = cdr;
|
|
43
|
+
this.localizationService = localizationService;
|
|
44
|
+
this.injector = injector;
|
|
45
|
+
this.hostClasses = true;
|
|
46
|
+
this.ariaRole = 'textbox';
|
|
47
|
+
/**
|
|
48
|
+
* @hidden
|
|
49
|
+
*/
|
|
50
|
+
this.id = `k-colorgradient-${serial++}`;
|
|
51
|
+
/**
|
|
52
|
+
* Defines whether the alpha slider will be displayed.
|
|
53
|
+
*
|
|
54
|
+
* @default true
|
|
55
|
+
*/
|
|
56
|
+
this.opacity = true;
|
|
57
|
+
/**
|
|
58
|
+
* Sets the disabled state of the ColorGradient.
|
|
59
|
+
*
|
|
60
|
+
* @default false
|
|
61
|
+
*/
|
|
62
|
+
this.disabled = false;
|
|
63
|
+
/**
|
|
64
|
+
* Sets the read-only state of the ColorGradient.
|
|
65
|
+
*
|
|
66
|
+
* @default false
|
|
67
|
+
*/
|
|
68
|
+
this.readonly = false;
|
|
69
|
+
/**
|
|
70
|
+
* Specifies whether the ColorGradient should display a 'Clear color' button.
|
|
71
|
+
*
|
|
72
|
+
* @default false
|
|
73
|
+
*/
|
|
74
|
+
this.clearButton = false;
|
|
75
|
+
/**
|
|
76
|
+
* Determines the delay time (in milliseconds) before the value is changed on handle drag. A value of 0 indicates no delay.
|
|
77
|
+
*
|
|
78
|
+
* @default 0
|
|
79
|
+
*/
|
|
80
|
+
this.delay = 0;
|
|
81
|
+
/**
|
|
82
|
+
* Specifies the output format of the ColorGradientComponent.
|
|
83
|
+
* The input value may be in a different format, but it will be parsed into the output `format`
|
|
84
|
+
* after the component processes it.
|
|
85
|
+
*
|
|
86
|
+
* The supported values are:
|
|
87
|
+
* * (Default) `rgba`
|
|
88
|
+
* * `hex`
|
|
89
|
+
*/
|
|
90
|
+
this.format = DEFAULT_OUTPUT_FORMAT;
|
|
91
|
+
/**
|
|
92
|
+
* Fires each time the user selects a new color.
|
|
93
|
+
*/
|
|
94
|
+
this.valueChange = new EventEmitter();
|
|
95
|
+
/**
|
|
96
|
+
* @hidden
|
|
97
|
+
*/
|
|
98
|
+
this.backgroundColor = DEFAULT_GRADIENT_BACKGROUND_COLOR;
|
|
99
|
+
/**
|
|
100
|
+
* @hidden
|
|
101
|
+
*
|
|
102
|
+
* Represents the currently selected `hue`, `saturation`, `value`, and `alpha` values.
|
|
103
|
+
* The values are initially set in `ngOnInit` or in `ngOnChanges` and are
|
|
104
|
+
* updated on moving the drag handle or the sliders.
|
|
105
|
+
*/
|
|
106
|
+
this.hsva = new BehaviorSubject({});
|
|
107
|
+
/**
|
|
108
|
+
* Determines the step (in pixels) when moving the gradient drag handle using the keyboard arrow keys.
|
|
109
|
+
*
|
|
110
|
+
* @default 5
|
|
111
|
+
*/
|
|
112
|
+
this.gradientSliderStep = DRAGHANDLE_MOVE_SPEED;
|
|
113
|
+
/**
|
|
114
|
+
* Determines the step (in pixels) when moving the gradient drag handle using the keyboard arrow keys while holding the shift key.
|
|
115
|
+
*
|
|
116
|
+
* @default 2
|
|
117
|
+
*/
|
|
118
|
+
this.gradientSliderSmallStep = DRAGHANDLE_MOVE_SPEED_SMALL_STEP;
|
|
119
|
+
/**
|
|
120
|
+
* @hidden
|
|
121
|
+
*/
|
|
122
|
+
this.internalNavigation = false;
|
|
123
|
+
/**
|
|
124
|
+
* @hidden
|
|
125
|
+
*/
|
|
126
|
+
this.dropletSlashIcon = dropletSlashIcon;
|
|
127
|
+
this._tabindex = 0;
|
|
128
|
+
this.listeners = [];
|
|
129
|
+
this.hueSliderTouched = false;
|
|
130
|
+
this.alphaSliderTouched = false;
|
|
131
|
+
this.updateValues = new Subject();
|
|
132
|
+
this.hsvHandleCoordinates = { x: 0, y: 0 };
|
|
133
|
+
this.notifyNgChanged = () => { };
|
|
134
|
+
this.notifyNgTouched = () => { };
|
|
135
|
+
validatePackage(packageMetadata);
|
|
136
|
+
this.dynamicRTLSubscription = localizationService.changes.subscribe(({ rtl }) => {
|
|
137
|
+
this.direction = rtl ? 'rtl' : 'ltr';
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
get readonlyAttribute() {
|
|
141
|
+
return this.readonly;
|
|
142
|
+
}
|
|
143
|
+
get disabledClass() {
|
|
144
|
+
return this.disabled;
|
|
145
|
+
}
|
|
146
|
+
get gradientId() {
|
|
147
|
+
return this.id;
|
|
148
|
+
}
|
|
149
|
+
get hostTabindex() {
|
|
150
|
+
return this.tabindex?.toString() || '0';
|
|
151
|
+
}
|
|
152
|
+
get isControlInvalid() {
|
|
153
|
+
return (this.control?.invalid)?.toString();
|
|
154
|
+
}
|
|
155
|
+
get isDisabled() {
|
|
156
|
+
return this.disabled?.toString() || undefined;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* @hidden
|
|
160
|
+
*/
|
|
161
|
+
enterHandler(event) {
|
|
162
|
+
if (event.target !== this.host.nativeElement) {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
this.internalNavigation = true;
|
|
166
|
+
this.gradientDragHandle.nativeElement.focus();
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* @hidden
|
|
170
|
+
*/
|
|
171
|
+
escapeHandler(event) {
|
|
172
|
+
if (!this.host.nativeElement.matches(':focus')) {
|
|
173
|
+
event.stopImmediatePropagation();
|
|
174
|
+
}
|
|
175
|
+
this.internalNavigation = false;
|
|
176
|
+
this.host.nativeElement.focus();
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* @hidden
|
|
180
|
+
*/
|
|
181
|
+
focusHandler(ev) {
|
|
182
|
+
this.internalNavigation = ev.target !== this.host.nativeElement;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Specifies the value of the initially selected color.
|
|
186
|
+
*/
|
|
187
|
+
set value(value) {
|
|
188
|
+
this._value = parseColor(value, this.format, this.opacity);
|
|
189
|
+
}
|
|
190
|
+
get value() {
|
|
191
|
+
return this._value;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Enables the color contrast tool. Accepts the background color that will be compared to the selected value.
|
|
195
|
+
* The tool will calculate the contrast ratio between the two colors.
|
|
196
|
+
*/
|
|
197
|
+
set contrastTool(value) {
|
|
198
|
+
this._contrastTool = parseColor(value, this.format, this.opacity);
|
|
199
|
+
}
|
|
200
|
+
get contrastTool() {
|
|
201
|
+
return this._contrastTool;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Specifies the [tabindex](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the component.
|
|
205
|
+
*
|
|
206
|
+
* @default 0
|
|
207
|
+
*/
|
|
208
|
+
set tabindex(value) {
|
|
209
|
+
if (isPresent(value)) {
|
|
210
|
+
const tabindex = Number(value);
|
|
211
|
+
this._tabindex = !isNaN(tabindex) ? tabindex : 0;
|
|
212
|
+
}
|
|
213
|
+
else {
|
|
214
|
+
// Allows removal of the tabindex attribute
|
|
215
|
+
this._tabindex = value;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
get tabindex() {
|
|
219
|
+
return !this.disabled ? this._tabindex : undefined;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Indicates whether the ColorGradient or any of its content is focused.
|
|
223
|
+
*/
|
|
224
|
+
get isFocused() {
|
|
225
|
+
if (!(isDocumentAvailable() && isPresent(this.host))) {
|
|
226
|
+
return false;
|
|
227
|
+
}
|
|
228
|
+
return this.host.nativeElement === document.activeElement || this.host.nativeElement.contains(document.activeElement);
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* @hidden
|
|
232
|
+
*/
|
|
233
|
+
get alphaSliderValue() {
|
|
234
|
+
// setting the initial value to undefined to force the slider to recalculate the height of the slider track on the next cdr run
|
|
235
|
+
if (!(isPresent(this.hsva.value) && isPresent(this.hsva.value.a))) {
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
return this.hsva.value.a * 100;
|
|
239
|
+
}
|
|
240
|
+
get gradientRect() {
|
|
241
|
+
return this.gradientWrapper.nativeElement.getBoundingClientRect();
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* @hidden
|
|
245
|
+
*/
|
|
246
|
+
get hsvSliderValueText() {
|
|
247
|
+
return `X: ${this.hsvHandleCoordinates.x} Y: ${this.hsvHandleCoordinates.y}`;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* @hidden
|
|
251
|
+
*/
|
|
252
|
+
get contrastToolVisible() {
|
|
253
|
+
return this.contrastTool && this.contrastTool.length > 0;
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* @hidden
|
|
257
|
+
*/
|
|
258
|
+
get innerTabIndex() {
|
|
259
|
+
return this.internalNavigation ? 0 : -1;
|
|
260
|
+
}
|
|
261
|
+
ngOnInit() {
|
|
262
|
+
this.control = this.injector.get(NgControl, null);
|
|
263
|
+
}
|
|
264
|
+
ngAfterViewInit() {
|
|
265
|
+
this.ngZone.onStable.pipe(take(1)).subscribe(() => {
|
|
266
|
+
this.updateUI();
|
|
267
|
+
this.cdr.detectChanges();
|
|
268
|
+
});
|
|
269
|
+
this.addEventListeners();
|
|
270
|
+
this.subscribeChanges();
|
|
271
|
+
}
|
|
272
|
+
ngOnChanges(changes) {
|
|
273
|
+
if (isChanged('value', changes) && !this.isFocused) {
|
|
274
|
+
this.updateUI();
|
|
275
|
+
}
|
|
276
|
+
if (isChanged('delay', changes)) {
|
|
277
|
+
this.unsubscribeChanges();
|
|
278
|
+
this.subscribeChanges();
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
ngOnDestroy() {
|
|
282
|
+
this.listeners.forEach(removeListener => removeListener());
|
|
283
|
+
if (this.dynamicRTLSubscription) {
|
|
284
|
+
this.dynamicRTLSubscription.unsubscribe();
|
|
285
|
+
}
|
|
286
|
+
this.unsubscribeChanges();
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Focuses the component.
|
|
290
|
+
*/
|
|
291
|
+
focus() {
|
|
292
|
+
if (this.disabled) {
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
this.gradientDragHandle.nativeElement.focus();
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* @hidden
|
|
299
|
+
*/
|
|
300
|
+
reset() {
|
|
301
|
+
this.handleValueChange(undefined);
|
|
302
|
+
this.updateUI();
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* @hidden
|
|
306
|
+
*/
|
|
307
|
+
handleDragPress(args) {
|
|
308
|
+
if (this.disabled || this.readonly || !isPresent(args.originalEvent)) {
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
this.focus();
|
|
312
|
+
args.originalEvent.preventDefault();
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* @hidden
|
|
316
|
+
*/
|
|
317
|
+
onHandleDrag(args) {
|
|
318
|
+
if (this.disabled || this.readonly) {
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
this.renderer.addClass(this.gradientWrapper.nativeElement, 'k-dragging');
|
|
322
|
+
this.changePosition(args);
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* @hidden
|
|
326
|
+
*/
|
|
327
|
+
onHandleRelease() {
|
|
328
|
+
if (this.disabled || this.readonly) {
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
this.renderer.removeClass(this.gradientWrapper.nativeElement, 'k-dragging');
|
|
332
|
+
this.handleValueChange(getColorFromHSV(this.hsva.value, this.format, this.opacity));
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* @hidden
|
|
336
|
+
*/
|
|
337
|
+
onKeyboardAction(args) {
|
|
338
|
+
if (this.disabled || this.readonly) {
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
341
|
+
if (args.key && args.key.indexOf('Arrow') !== -1) {
|
|
342
|
+
args.preventDefault();
|
|
343
|
+
const dragHandleElement = this.gradientDragHandle.nativeElement;
|
|
344
|
+
this.renderer.addClass(this.gradientWrapper.nativeElement, 'k-dragging');
|
|
345
|
+
let keyboardMoveX = 0;
|
|
346
|
+
let keyboardMoveY = 0;
|
|
347
|
+
const shiftKey = args.shiftKey;
|
|
348
|
+
switch (args.key) {
|
|
349
|
+
case 'ArrowRight':
|
|
350
|
+
keyboardMoveX = shiftKey ? this.gradientSliderSmallStep : this.gradientSliderStep;
|
|
351
|
+
break;
|
|
352
|
+
case 'ArrowLeft':
|
|
353
|
+
keyboardMoveX = shiftKey ? -this.gradientSliderSmallStep : -this.gradientSliderStep;
|
|
354
|
+
break;
|
|
355
|
+
case 'ArrowUp':
|
|
356
|
+
keyboardMoveY = shiftKey ? -this.gradientSliderSmallStep : -this.gradientSliderStep;
|
|
357
|
+
break;
|
|
358
|
+
case 'ArrowDown':
|
|
359
|
+
keyboardMoveY = shiftKey ? this.gradientSliderSmallStep : this.gradientSliderStep;
|
|
360
|
+
break;
|
|
361
|
+
default: break;
|
|
362
|
+
}
|
|
363
|
+
const newY = parseInt(dragHandleElement.style.top, 10) + keyboardMoveY;
|
|
364
|
+
const newX = parseInt(dragHandleElement.style.left, 10) + keyboardMoveX;
|
|
365
|
+
this.renderer.setStyle(dragHandleElement, 'top', `${newY}px`);
|
|
366
|
+
this.renderer.setStyle(dragHandleElement, 'left', `${newX}px`);
|
|
367
|
+
this.ngZone.run(() => this.moveDragHandle(newX, newY));
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* @hidden
|
|
372
|
+
*/
|
|
373
|
+
changePosition(position) {
|
|
374
|
+
if (this.disabled || this.readonly) {
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
this.gradientDragHandle.nativeElement.focus();
|
|
378
|
+
const gradientRect = this.gradientRect;
|
|
379
|
+
const newX = position.clientX - gradientRect.left;
|
|
380
|
+
const newY = position.clientY - gradientRect.top;
|
|
381
|
+
this.ngZone.run(() => this.moveDragHandle(newX, newY));
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* @hidden
|
|
385
|
+
*/
|
|
386
|
+
handleHueSliderChange(hue) {
|
|
387
|
+
const hsva = this.hsva.value;
|
|
388
|
+
hsva.h = hue;
|
|
389
|
+
this.hsva.next(hsva);
|
|
390
|
+
this.handleValueChange(getColorFromHSV(this.hsva.value, this.format, this.opacity));
|
|
391
|
+
this.backgroundColor = getColorFromHue(hue);
|
|
392
|
+
this.setBackgroundColor(this.backgroundColor);
|
|
393
|
+
this.setAlphaSliderBackground(this.backgroundColor);
|
|
394
|
+
this.hueSliderTouched = true;
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* @hidden
|
|
398
|
+
*/
|
|
399
|
+
handleAlphaSliderChange(alpha) {
|
|
400
|
+
const hsva = this.hsva.value;
|
|
401
|
+
hsva.a = alpha / 100;
|
|
402
|
+
this.hsva.next(hsva);
|
|
403
|
+
this.handleValueChange(getColorFromHSV(this.hsva.value, this.format, this.opacity));
|
|
404
|
+
this.alphaSliderTouched = true;
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* @hidden
|
|
408
|
+
*/
|
|
409
|
+
handleInputsValueChange(color) {
|
|
410
|
+
const parsed = parseColor(color, this.format, this.opacity);
|
|
411
|
+
if (this.value !== parsed) {
|
|
412
|
+
this.handleValueChange(parsed);
|
|
413
|
+
this.updateUI();
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* @hidden
|
|
418
|
+
*/
|
|
419
|
+
writeValue(value) {
|
|
420
|
+
this.value = value;
|
|
421
|
+
if (isPresent(this.gradientWrapper)) {
|
|
422
|
+
this.updateUI();
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* @hidden
|
|
427
|
+
*/
|
|
428
|
+
registerOnChange(fn) {
|
|
429
|
+
this.notifyNgChanged = fn;
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* @hidden
|
|
433
|
+
*/
|
|
434
|
+
registerOnTouched(fn) {
|
|
435
|
+
this.notifyNgTouched = fn;
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* @hidden
|
|
439
|
+
*/
|
|
440
|
+
setDisabledState(isDisabled) {
|
|
441
|
+
this.cdr.markForCheck();
|
|
442
|
+
this.disabled = isDisabled;
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* @hidden
|
|
446
|
+
*/
|
|
447
|
+
get colorGradientHandleTitle() {
|
|
448
|
+
return this.localizationService.get('colorGradientHandle');
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* @hidden
|
|
452
|
+
*/
|
|
453
|
+
get colorGradientHandleAriaLabel() {
|
|
454
|
+
const parsed = parseColor(this.value, this.format, this.opacity);
|
|
455
|
+
return `${this.value ? parsed : this.localizationService.get('colorGradientNoColor')}`;
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* @hidden
|
|
459
|
+
*/
|
|
460
|
+
get hueSliderTitle() {
|
|
461
|
+
return this.localizationService.get('hueSliderHandle');
|
|
462
|
+
}
|
|
463
|
+
/**
|
|
464
|
+
* @hidden
|
|
465
|
+
*/
|
|
466
|
+
get opacitySliderTitle() {
|
|
467
|
+
return this.localizationService.get('opacitySliderHandle');
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* @hidden
|
|
471
|
+
*/
|
|
472
|
+
get clearButtonTitle() {
|
|
473
|
+
return this.localizationService.get('clearButton');
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* @hidden
|
|
477
|
+
* Used by the FloatingLabel to determine if the component is empty.
|
|
478
|
+
*/
|
|
479
|
+
isEmpty() {
|
|
480
|
+
return false;
|
|
481
|
+
}
|
|
482
|
+
moveDragHandle(positionX, positionY) {
|
|
483
|
+
const gradientRect = this.gradientRect;
|
|
484
|
+
const gradientRectWidth = gradientRect.width;
|
|
485
|
+
const gradientRectHeight = gradientRect.height;
|
|
486
|
+
const top = fitIntoBounds(positionY, 0, gradientRectHeight);
|
|
487
|
+
const left = fitIntoBounds(positionX, 0, gradientRectWidth);
|
|
488
|
+
this.setDragHandleElementPosition(top, left);
|
|
489
|
+
const hsva = this.hsva.value;
|
|
490
|
+
hsva.s = left / gradientRectWidth;
|
|
491
|
+
hsva.v = 1 - top / gradientRectHeight;
|
|
492
|
+
this.hsva.next(hsva);
|
|
493
|
+
this.updateValues.next(getColorFromHSV(this.hsva.value, this.format, this.opacity));
|
|
494
|
+
this.setAlphaSliderBackground(getColorFromHSV({ ...this.hsva.value, a: 1 }, this.format, this.opacity));
|
|
495
|
+
}
|
|
496
|
+
handleValueChange(color) {
|
|
497
|
+
if (this.value === color) {
|
|
498
|
+
return;
|
|
499
|
+
}
|
|
500
|
+
this.value = color;
|
|
501
|
+
this.valueChange.emit(color);
|
|
502
|
+
this.notifyNgChanged(color);
|
|
503
|
+
this.setHostElementAriaLabel();
|
|
504
|
+
}
|
|
505
|
+
setDragHandleElementPosition(top, left) {
|
|
506
|
+
const dragHandle = this.gradientDragHandle.nativeElement;
|
|
507
|
+
this.hsvHandleCoordinates = { x: left, y: top };
|
|
508
|
+
this.renderer.setStyle(dragHandle, 'top', `${top}px`);
|
|
509
|
+
this.renderer.setStyle(dragHandle, 'left', `${left}px`);
|
|
510
|
+
}
|
|
511
|
+
setAlphaSliderBackground(backgroundColor) {
|
|
512
|
+
if (!isPresent(this.alphaSlider)) {
|
|
513
|
+
return;
|
|
514
|
+
}
|
|
515
|
+
const sliderTrack = this.alphaSlider.track.nativeElement;
|
|
516
|
+
this.renderer.setStyle(sliderTrack, 'background', `linear-gradient(to top, transparent, ${backgroundColor})`);
|
|
517
|
+
}
|
|
518
|
+
setHostElementAriaLabel() {
|
|
519
|
+
const parsed = parseColor(this.value, this.format, this.opacity);
|
|
520
|
+
this.renderer.setAttribute(this.host.nativeElement, 'aria-label', `${this.value ? parsed : this.localizationService.get('colorGradientNoColor')}`);
|
|
521
|
+
}
|
|
522
|
+
setBackgroundColor(color) {
|
|
523
|
+
this.renderer.setStyle(this.hsvRectangle.nativeElement, 'background', color);
|
|
524
|
+
}
|
|
525
|
+
updateUI() {
|
|
526
|
+
if (!isDocumentAvailable()) {
|
|
527
|
+
return;
|
|
528
|
+
}
|
|
529
|
+
if (this.hueSliderTouched || this.alphaSliderTouched) {
|
|
530
|
+
this.hueSliderTouched = false;
|
|
531
|
+
this.alphaSliderTouched = false;
|
|
532
|
+
return;
|
|
533
|
+
}
|
|
534
|
+
this.hsva.next(this.value ? getHSV(this.value) : { h: 0, s: 0, v: 1, a: 1 });
|
|
535
|
+
const gradientRect = this.gradientRect;
|
|
536
|
+
const top = (1 - this.hsva.value.v) * gradientRect.height;
|
|
537
|
+
const left = this.hsva.value.s * gradientRect.width;
|
|
538
|
+
this.setDragHandleElementPosition(top, left);
|
|
539
|
+
this.backgroundColor = getColorFromHue(this.hsva.value.h);
|
|
540
|
+
this.setBackgroundColor(this.backgroundColor);
|
|
541
|
+
this.setAlphaSliderBackground(this.backgroundColor);
|
|
542
|
+
this.setHostElementAriaLabel();
|
|
543
|
+
}
|
|
544
|
+
addEventListeners() {
|
|
545
|
+
this.ngZone.runOutsideAngular(() => {
|
|
546
|
+
const focusOutListener = this.renderer.listen(this.host.nativeElement, 'focusout', (event) => {
|
|
547
|
+
if (!containsFocus(this.host.nativeElement, event.relatedTarget) && isUntouched(this.host)) {
|
|
548
|
+
this.ngZone.run(() => this.notifyNgTouched());
|
|
549
|
+
}
|
|
550
|
+
});
|
|
551
|
+
const keydownListener = this.renderer.listen(this.gradientDragHandle.nativeElement, 'keydown', (event) => {
|
|
552
|
+
this.onKeyboardAction(event);
|
|
553
|
+
});
|
|
554
|
+
const keyupListener = this.renderer.listen(this.gradientDragHandle.nativeElement, 'keyup', () => {
|
|
555
|
+
this.renderer.removeClass(this.gradientWrapper.nativeElement, 'k-dragging');
|
|
556
|
+
if (!this.readonly && !this.disabled) {
|
|
557
|
+
this.ngZone.run(() => this.handleValueChange(getColorFromHSV(this.hsva.value, this.format, this.opacity)));
|
|
558
|
+
}
|
|
559
|
+
});
|
|
560
|
+
const dragHandleFocusInListener = this.renderer.listen(this.gradientDragHandle.nativeElement, 'focusin', () => {
|
|
561
|
+
this.renderer.addClass(this.gradientDragHandle.nativeElement, 'k-focus');
|
|
562
|
+
});
|
|
563
|
+
const dragHandleFocusOutListener = this.renderer.listen(this.gradientDragHandle.nativeElement, 'focusout', () => {
|
|
564
|
+
this.renderer.removeClass(this.gradientDragHandle.nativeElement, 'k-focus');
|
|
565
|
+
});
|
|
566
|
+
this.listeners.push(focusOutListener, keydownListener, keyupListener, dragHandleFocusInListener, dragHandleFocusOutListener);
|
|
567
|
+
});
|
|
568
|
+
}
|
|
569
|
+
subscribeChanges() {
|
|
570
|
+
this.changeRequestsSubscription = this.updateValues.pipe(throttleTime(this.delay)).subscribe(value => {
|
|
571
|
+
this.handleValueChange(value);
|
|
572
|
+
});
|
|
573
|
+
}
|
|
574
|
+
unsubscribeChanges() {
|
|
575
|
+
if (this.changeRequestsSubscription) {
|
|
576
|
+
this.changeRequestsSubscription.unsubscribe();
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
ColorGradientComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ColorGradientComponent, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: i1.LocalizationService }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
|
|
581
|
+
ColorGradientComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: ColorGradientComponent, selector: "kendo-colorgradient", inputs: { id: "id", opacity: "opacity", disabled: "disabled", readonly: "readonly", clearButton: "clearButton", delay: "delay", value: "value", contrastTool: "contrastTool", tabindex: "tabindex", format: "format", gradientSliderStep: "gradientSliderStep", gradientSliderSmallStep: "gradientSliderSmallStep" }, outputs: { valueChange: "valueChange" }, host: { listeners: { "keydown.enter": "enterHandler($event)", "keydown.escape": "escapeHandler($event)", "focusin": "focusHandler($event)" }, properties: { "class.k-colorgradient": "this.hostClasses", "attr.aria-readonly": "this.readonlyAttribute", "class.k-disabled": "this.disabledClass", "attr.id": "this.gradientId", "attr.dir": "this.direction", "attr.tabindex": "this.hostTabindex", "attr.role": "this.ariaRole", "attr.aria-invalid": "this.isControlInvalid", "attr.aria-disabled": "this.isDisabled" } }, providers: [
|
|
582
|
+
{
|
|
583
|
+
multi: true,
|
|
584
|
+
provide: NG_VALUE_ACCESSOR,
|
|
585
|
+
useExisting: forwardRef(() => ColorGradientComponent)
|
|
586
|
+
},
|
|
587
|
+
{
|
|
588
|
+
provide: KendoInput,
|
|
589
|
+
useExisting: forwardRef(() => ColorGradientComponent)
|
|
590
|
+
},
|
|
591
|
+
ColorGradientLocalizationService,
|
|
592
|
+
{
|
|
593
|
+
provide: LocalizationService,
|
|
594
|
+
useExisting: ColorGradientLocalizationService
|
|
595
|
+
},
|
|
596
|
+
{
|
|
597
|
+
provide: L10N_PREFIX,
|
|
598
|
+
useValue: 'kendo.colorgradient'
|
|
599
|
+
}
|
|
600
|
+
], viewQueries: [{ propertyName: "gradientDragHandle", first: true, predicate: ["gradientDragHandle"], descendants: true }, { propertyName: "inputs", first: true, predicate: ["inputs"], descendants: true }, { propertyName: "alphaSlider", first: true, predicate: ["alphaSlider"], descendants: true }, { propertyName: "gradientWrapper", first: true, predicate: ["gradientWrapper"], descendants: true }, { propertyName: "hsvRectangle", first: true, predicate: ["hsvRectangle"], descendants: true }], exportAs: ["kendoColorGradient"], usesOnChanges: true, ngImport: i0, template: `
|
|
601
|
+
<ng-container kendoColorGradientLocalizedMessages
|
|
602
|
+
i18n-colorGradientNoColor="kendo.colorgradient.colorGradientNoColor|The aria-label applied to the ColorGradient component when the value is empty."
|
|
603
|
+
colorGradientNoColor="Colorgradient no color chosen"
|
|
604
|
+
i18n-colorGradientHandle="kendo.colorgradient.colorGradientHandle|The title for the gradient color drag handle chooser."
|
|
605
|
+
colorGradientHandle="Choose color"
|
|
606
|
+
i18n-clearButton="kendo.colorgradient.clearButton|The title for the clear button."
|
|
607
|
+
clearButton="Clear value"
|
|
608
|
+
i18n-hueSliderHandle="kendo.colorgradient.hueSliderHandle|The title for the hue slider handle."
|
|
609
|
+
hueSliderHandle="Set hue"
|
|
610
|
+
i18n-opacitySliderHandle="kendo.colorgradient.opacitySliderHandle|The title for the opacity slider handle."
|
|
611
|
+
opacitySliderHandle="Set opacity"
|
|
612
|
+
i18n-passContrast="kendo.colorgradient.passContrast|The pass message for the contrast tool."
|
|
613
|
+
passContrast="Pass"
|
|
614
|
+
i18n-failContrast="kendo.colorgradient.failContrast|The fail message for the contrast tool."
|
|
615
|
+
failContrast="Fail"
|
|
616
|
+
i18n-contrastRatio="kendo.colorgradient.contrastRatio|The contrast ratio message for the contrast tool."
|
|
617
|
+
contrastRatio="Contrast ratio"
|
|
618
|
+
i18n-formatButton="kendo.colorgradient.formatButton|The message for the input format toggle button."
|
|
619
|
+
formatButton="Change color format"
|
|
620
|
+
i18n-redChannelLabel="kendo.colorgradient.redChannelLabel|The label of the NumericTextBox representing the red color channel."
|
|
621
|
+
redChannelLabel="Red channel"
|
|
622
|
+
i18n-greenChannelLabel="kendo.colorgradient.greenChannelLabel|The label of the NumericTextBox representing the green color channel."
|
|
623
|
+
greenChannelLabel="Green channel"
|
|
624
|
+
i18n-blueChannelLabel="kendo.colorgradient.blueChannelLabel|The label of the NumericTextBox representing the blue color channel."
|
|
625
|
+
blueChannelLabel="Blue channel"
|
|
626
|
+
i18n-alphaChannelLabel="kendo.colorgradient.alphaChannelLabel|The label of the NumericTextBox representing the alpha color channel."
|
|
627
|
+
alphaChannelLabel="Alpha channel"
|
|
628
|
+
i18n-redInputPlaceholder="kendo.colorgradient.redInputPlaceholder|The placeholder for the red color input."
|
|
629
|
+
redChannelLabel="R"
|
|
630
|
+
i18n-greenInputPlaceholder="kendo.colorgradient.greenInputPlaceholder|The placeholder for the green color input."
|
|
631
|
+
greenInputPlaceholder="G"
|
|
632
|
+
i18n-blueInputPlaceholder="kendo.colorgradient.blueInputPlaceholder|The placeholder for the blue color input."
|
|
633
|
+
blueInputPlaceholder="B"
|
|
634
|
+
i18n-hexInputPlaceholder="kendo.colorgradient.hexInputPlaceholder|The placeholder for the HEX color input."
|
|
635
|
+
hexInputPlaceholder="HEX">
|
|
636
|
+
</ng-container>
|
|
637
|
+
<div class="k-colorgradient-canvas k-hstack">
|
|
638
|
+
<div class="k-hsv-rectangle" #hsvRectangle>
|
|
639
|
+
<div
|
|
640
|
+
#gradientWrapper
|
|
641
|
+
kendoDraggable
|
|
642
|
+
class="k-hsv-gradient"
|
|
643
|
+
(click)="changePosition($event)"
|
|
644
|
+
(kendoPress)="handleDragPress($event)"
|
|
645
|
+
(kendoDrag)="onHandleDrag($event)"
|
|
646
|
+
(kendoRelease)="onHandleRelease()">
|
|
647
|
+
<div
|
|
648
|
+
#gradientDragHandle
|
|
649
|
+
class="k-hsv-draghandle k-draghandle"
|
|
650
|
+
[tabindex]="innerTabIndex.toString()"
|
|
651
|
+
[attr.title]="colorGradientHandleTitle"
|
|
652
|
+
[attr.aria-label]="colorGradientHandleTitle + ' ' + colorGradientHandleAriaLabel"
|
|
653
|
+
role="slider"
|
|
654
|
+
[attr.aria-valuetext]="hsvSliderValueText"
|
|
655
|
+
[attr.aria-readonly]="readonly ? readonly : undefined"
|
|
656
|
+
[attr.aria-disabled]="disabled ? disabled : undefined"
|
|
657
|
+
[attr.aria-orientation]="'undefined'"
|
|
658
|
+
[attr.aria-valuenow]="'0'"
|
|
659
|
+
(keydown.shift.tab)="$event.preventDefault(); inputs.focusLast();">
|
|
660
|
+
</div>
|
|
661
|
+
</div>
|
|
662
|
+
<svg kendoColorContrastSvg
|
|
663
|
+
*ngIf="contrastToolVisible && gradientWrapper"
|
|
664
|
+
class="k-color-contrast-svg"
|
|
665
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
666
|
+
[wrapper]="gradientWrapper ? gradientWrapper : undefined"
|
|
667
|
+
[hsva]="hsva"
|
|
668
|
+
[backgroundColor]="contrastTool"
|
|
669
|
+
[style]="'position: absolute; overflow: visible; pointer-events: none; left: 0px; top: 0px;'">
|
|
670
|
+
</svg>
|
|
671
|
+
</div>
|
|
672
|
+
<div class="k-hsv-controls k-hstack {{ clearButton ? 'k-sliders-wrap-clearable' : '' }}">
|
|
673
|
+
|
|
674
|
+
<button
|
|
675
|
+
kendoButton
|
|
676
|
+
*ngIf="clearButton"
|
|
677
|
+
class="k-clear-color"
|
|
678
|
+
fillMode="flat"
|
|
679
|
+
icon="droplet-slash"
|
|
680
|
+
[svgIcon]="dropletSlashIcon"
|
|
681
|
+
(click)="reset()"
|
|
682
|
+
(keydown.enter)="reset()"
|
|
683
|
+
(keydown.space)="reset()"
|
|
684
|
+
[attr.aria-label]="clearButtonTitle"
|
|
685
|
+
[attr.title]="clearButtonTitle"
|
|
686
|
+
[tabindex]="innerTabIndex.toString()"
|
|
687
|
+
[style]="'position: absolute; top: 0; left: 50%; transform: translateX(-50%);'"
|
|
688
|
+
>
|
|
689
|
+
</button>
|
|
690
|
+
<kendo-slider
|
|
691
|
+
[ngClass]="{'k-align-self-end': clearButton}"
|
|
692
|
+
[style.height.px]="clearButton ? '140' : null"
|
|
693
|
+
class="k-hue-slider k-colorgradient-slider"
|
|
694
|
+
[dragHandleTitle]="hueSliderTitle"
|
|
695
|
+
[tabindex]="innerTabIndex"
|
|
696
|
+
[disabled]="disabled"
|
|
697
|
+
[readonly]="readonly"
|
|
698
|
+
[showButtons]="false"
|
|
699
|
+
tickPlacement="none"
|
|
700
|
+
[vertical]="true"
|
|
701
|
+
[min]="0"
|
|
702
|
+
[max]="360"
|
|
703
|
+
[value]="hsva.value.h"
|
|
704
|
+
[smallStep]="5"
|
|
705
|
+
[largeStep]="10"
|
|
706
|
+
(valueChange)="handleHueSliderChange($event)"
|
|
707
|
+
>
|
|
708
|
+
</kendo-slider>
|
|
709
|
+
<kendo-slider
|
|
710
|
+
*ngIf="opacity"
|
|
711
|
+
#alphaSlider
|
|
712
|
+
[tabindex]="innerTabIndex"
|
|
713
|
+
[ngClass]="{'k-align-self-end': clearButton}"
|
|
714
|
+
[style.height.px]="clearButton ? '140' : null"
|
|
715
|
+
class="k-alpha-slider k-colorgradient-slider"
|
|
716
|
+
[dragHandleTitle]="opacitySliderTitle"
|
|
717
|
+
[disabled]="disabled"
|
|
718
|
+
[readonly]="readonly"
|
|
719
|
+
[showButtons]="false"
|
|
720
|
+
tickPlacement="none"
|
|
721
|
+
[vertical]="true"
|
|
722
|
+
[min]="0"
|
|
723
|
+
[max]="100"
|
|
724
|
+
[smallStep]="1"
|
|
725
|
+
[largeStep]="10"
|
|
726
|
+
[value]="alphaSliderValue"
|
|
727
|
+
(valueChange)="handleAlphaSliderChange($event)"
|
|
728
|
+
>
|
|
729
|
+
</kendo-slider>
|
|
730
|
+
</div>
|
|
731
|
+
</div>
|
|
732
|
+
<kendo-colorinput #inputs
|
|
733
|
+
[tabindex]="innerTabIndex"
|
|
734
|
+
[opacity]="opacity"
|
|
735
|
+
[formatView]="format"
|
|
736
|
+
[value]="value"
|
|
737
|
+
[disabled]="disabled"
|
|
738
|
+
[readonly]="readonly"
|
|
739
|
+
(valueChange)="handleInputsValueChange($event)"
|
|
740
|
+
(tabOut)="gradientDragHandle.focus()"
|
|
741
|
+
>
|
|
742
|
+
</kendo-colorinput>
|
|
743
|
+
<div class="k-colorgradient-color-contrast k-vbox"
|
|
744
|
+
*ngIf="contrastToolVisible"
|
|
745
|
+
kendoContrastTool
|
|
746
|
+
[value]="value"
|
|
747
|
+
[ratio]="contrastTool">
|
|
748
|
+
</div>
|
|
749
|
+
`, isInline: true, components: [{ type: i2.ColorContrastSvgComponent, selector: "[kendoColorContrastSvg]", inputs: ["wrapper", "hsva", "backgroundColor"] }, { type: i3.ButtonComponent, selector: "button[kendoButton], span[kendoButton], kendo-button", inputs: ["toggleable", "togglable", "selected", "tabIndex", "imageUrl", "iconClass", "icon", "disabled", "size", "rounded", "fillMode", "themeColor", "svgIcon", "role", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }, { type: i4.SliderComponent, selector: "kendo-slider", inputs: ["focusableId", "dragHandleTitle", "incrementTitle", "animate", "decrementTitle", "showButtons", "value", "tabIndex"], exportAs: ["kendoSlider"] }, { type: i5.ColorInputComponent, selector: "kendo-colorinput", inputs: ["focusableId", "formatView", "tabindex", "value", "opacity", "disabled", "readonly"], outputs: ["valueChange", "tabOut"] }, { type: i6.ContrastComponent, selector: "[kendoContrastTool]", inputs: ["value", "ratio"] }], directives: [{ type: i7.LocalizedColorPickerMessagesDirective, selector: "[kendoColorPickerLocalizedMessages], [kendoFlatColorPickerLocalizedMessages], [kendoColorGradientLocalizedMessages], [kendoColorPaletteLocalizedMessages]" }, { type: i8.DraggableDirective, selector: "[kendoDraggable]", inputs: ["enableDrag"], outputs: ["kendoPress", "kendoDrag", "kendoRelease"] }, { type: i9.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i9.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
|
|
750
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ColorGradientComponent, decorators: [{
|
|
751
|
+
type: Component,
|
|
752
|
+
args: [{
|
|
753
|
+
exportAs: 'kendoColorGradient',
|
|
754
|
+
selector: 'kendo-colorgradient',
|
|
755
|
+
providers: [
|
|
756
|
+
{
|
|
757
|
+
multi: true,
|
|
758
|
+
provide: NG_VALUE_ACCESSOR,
|
|
759
|
+
useExisting: forwardRef(() => ColorGradientComponent)
|
|
760
|
+
},
|
|
761
|
+
{
|
|
762
|
+
provide: KendoInput,
|
|
763
|
+
useExisting: forwardRef(() => ColorGradientComponent)
|
|
764
|
+
},
|
|
765
|
+
ColorGradientLocalizationService,
|
|
766
|
+
{
|
|
767
|
+
provide: LocalizationService,
|
|
768
|
+
useExisting: ColorGradientLocalizationService
|
|
769
|
+
},
|
|
770
|
+
{
|
|
771
|
+
provide: L10N_PREFIX,
|
|
772
|
+
useValue: 'kendo.colorgradient'
|
|
773
|
+
}
|
|
774
|
+
],
|
|
775
|
+
template: `
|
|
776
|
+
<ng-container kendoColorGradientLocalizedMessages
|
|
777
|
+
i18n-colorGradientNoColor="kendo.colorgradient.colorGradientNoColor|The aria-label applied to the ColorGradient component when the value is empty."
|
|
778
|
+
colorGradientNoColor="Colorgradient no color chosen"
|
|
779
|
+
i18n-colorGradientHandle="kendo.colorgradient.colorGradientHandle|The title for the gradient color drag handle chooser."
|
|
780
|
+
colorGradientHandle="Choose color"
|
|
781
|
+
i18n-clearButton="kendo.colorgradient.clearButton|The title for the clear button."
|
|
782
|
+
clearButton="Clear value"
|
|
783
|
+
i18n-hueSliderHandle="kendo.colorgradient.hueSliderHandle|The title for the hue slider handle."
|
|
784
|
+
hueSliderHandle="Set hue"
|
|
785
|
+
i18n-opacitySliderHandle="kendo.colorgradient.opacitySliderHandle|The title for the opacity slider handle."
|
|
786
|
+
opacitySliderHandle="Set opacity"
|
|
787
|
+
i18n-passContrast="kendo.colorgradient.passContrast|The pass message for the contrast tool."
|
|
788
|
+
passContrast="Pass"
|
|
789
|
+
i18n-failContrast="kendo.colorgradient.failContrast|The fail message for the contrast tool."
|
|
790
|
+
failContrast="Fail"
|
|
791
|
+
i18n-contrastRatio="kendo.colorgradient.contrastRatio|The contrast ratio message for the contrast tool."
|
|
792
|
+
contrastRatio="Contrast ratio"
|
|
793
|
+
i18n-formatButton="kendo.colorgradient.formatButton|The message for the input format toggle button."
|
|
794
|
+
formatButton="Change color format"
|
|
795
|
+
i18n-redChannelLabel="kendo.colorgradient.redChannelLabel|The label of the NumericTextBox representing the red color channel."
|
|
796
|
+
redChannelLabel="Red channel"
|
|
797
|
+
i18n-greenChannelLabel="kendo.colorgradient.greenChannelLabel|The label of the NumericTextBox representing the green color channel."
|
|
798
|
+
greenChannelLabel="Green channel"
|
|
799
|
+
i18n-blueChannelLabel="kendo.colorgradient.blueChannelLabel|The label of the NumericTextBox representing the blue color channel."
|
|
800
|
+
blueChannelLabel="Blue channel"
|
|
801
|
+
i18n-alphaChannelLabel="kendo.colorgradient.alphaChannelLabel|The label of the NumericTextBox representing the alpha color channel."
|
|
802
|
+
alphaChannelLabel="Alpha channel"
|
|
803
|
+
i18n-redInputPlaceholder="kendo.colorgradient.redInputPlaceholder|The placeholder for the red color input."
|
|
804
|
+
redChannelLabel="R"
|
|
805
|
+
i18n-greenInputPlaceholder="kendo.colorgradient.greenInputPlaceholder|The placeholder for the green color input."
|
|
806
|
+
greenInputPlaceholder="G"
|
|
807
|
+
i18n-blueInputPlaceholder="kendo.colorgradient.blueInputPlaceholder|The placeholder for the blue color input."
|
|
808
|
+
blueInputPlaceholder="B"
|
|
809
|
+
i18n-hexInputPlaceholder="kendo.colorgradient.hexInputPlaceholder|The placeholder for the HEX color input."
|
|
810
|
+
hexInputPlaceholder="HEX">
|
|
811
|
+
</ng-container>
|
|
812
|
+
<div class="k-colorgradient-canvas k-hstack">
|
|
813
|
+
<div class="k-hsv-rectangle" #hsvRectangle>
|
|
814
|
+
<div
|
|
815
|
+
#gradientWrapper
|
|
816
|
+
kendoDraggable
|
|
817
|
+
class="k-hsv-gradient"
|
|
818
|
+
(click)="changePosition($event)"
|
|
819
|
+
(kendoPress)="handleDragPress($event)"
|
|
820
|
+
(kendoDrag)="onHandleDrag($event)"
|
|
821
|
+
(kendoRelease)="onHandleRelease()">
|
|
822
|
+
<div
|
|
823
|
+
#gradientDragHandle
|
|
824
|
+
class="k-hsv-draghandle k-draghandle"
|
|
825
|
+
[tabindex]="innerTabIndex.toString()"
|
|
826
|
+
[attr.title]="colorGradientHandleTitle"
|
|
827
|
+
[attr.aria-label]="colorGradientHandleTitle + ' ' + colorGradientHandleAriaLabel"
|
|
828
|
+
role="slider"
|
|
829
|
+
[attr.aria-valuetext]="hsvSliderValueText"
|
|
830
|
+
[attr.aria-readonly]="readonly ? readonly : undefined"
|
|
831
|
+
[attr.aria-disabled]="disabled ? disabled : undefined"
|
|
832
|
+
[attr.aria-orientation]="'undefined'"
|
|
833
|
+
[attr.aria-valuenow]="'0'"
|
|
834
|
+
(keydown.shift.tab)="$event.preventDefault(); inputs.focusLast();">
|
|
835
|
+
</div>
|
|
836
|
+
</div>
|
|
837
|
+
<svg kendoColorContrastSvg
|
|
838
|
+
*ngIf="contrastToolVisible && gradientWrapper"
|
|
839
|
+
class="k-color-contrast-svg"
|
|
840
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
841
|
+
[wrapper]="gradientWrapper ? gradientWrapper : undefined"
|
|
842
|
+
[hsva]="hsva"
|
|
843
|
+
[backgroundColor]="contrastTool"
|
|
844
|
+
[style]="'position: absolute; overflow: visible; pointer-events: none; left: 0px; top: 0px;'">
|
|
845
|
+
</svg>
|
|
846
|
+
</div>
|
|
847
|
+
<div class="k-hsv-controls k-hstack {{ clearButton ? 'k-sliders-wrap-clearable' : '' }}">
|
|
848
|
+
|
|
849
|
+
<button
|
|
850
|
+
kendoButton
|
|
851
|
+
*ngIf="clearButton"
|
|
852
|
+
class="k-clear-color"
|
|
853
|
+
fillMode="flat"
|
|
854
|
+
icon="droplet-slash"
|
|
855
|
+
[svgIcon]="dropletSlashIcon"
|
|
856
|
+
(click)="reset()"
|
|
857
|
+
(keydown.enter)="reset()"
|
|
858
|
+
(keydown.space)="reset()"
|
|
859
|
+
[attr.aria-label]="clearButtonTitle"
|
|
860
|
+
[attr.title]="clearButtonTitle"
|
|
861
|
+
[tabindex]="innerTabIndex.toString()"
|
|
862
|
+
[style]="'position: absolute; top: 0; left: 50%; transform: translateX(-50%);'"
|
|
863
|
+
>
|
|
864
|
+
</button>
|
|
865
|
+
<kendo-slider
|
|
866
|
+
[ngClass]="{'k-align-self-end': clearButton}"
|
|
867
|
+
[style.height.px]="clearButton ? '140' : null"
|
|
868
|
+
class="k-hue-slider k-colorgradient-slider"
|
|
869
|
+
[dragHandleTitle]="hueSliderTitle"
|
|
870
|
+
[tabindex]="innerTabIndex"
|
|
871
|
+
[disabled]="disabled"
|
|
872
|
+
[readonly]="readonly"
|
|
873
|
+
[showButtons]="false"
|
|
874
|
+
tickPlacement="none"
|
|
875
|
+
[vertical]="true"
|
|
876
|
+
[min]="0"
|
|
877
|
+
[max]="360"
|
|
878
|
+
[value]="hsva.value.h"
|
|
879
|
+
[smallStep]="5"
|
|
880
|
+
[largeStep]="10"
|
|
881
|
+
(valueChange)="handleHueSliderChange($event)"
|
|
882
|
+
>
|
|
883
|
+
</kendo-slider>
|
|
884
|
+
<kendo-slider
|
|
885
|
+
*ngIf="opacity"
|
|
886
|
+
#alphaSlider
|
|
887
|
+
[tabindex]="innerTabIndex"
|
|
888
|
+
[ngClass]="{'k-align-self-end': clearButton}"
|
|
889
|
+
[style.height.px]="clearButton ? '140' : null"
|
|
890
|
+
class="k-alpha-slider k-colorgradient-slider"
|
|
891
|
+
[dragHandleTitle]="opacitySliderTitle"
|
|
892
|
+
[disabled]="disabled"
|
|
893
|
+
[readonly]="readonly"
|
|
894
|
+
[showButtons]="false"
|
|
895
|
+
tickPlacement="none"
|
|
896
|
+
[vertical]="true"
|
|
897
|
+
[min]="0"
|
|
898
|
+
[max]="100"
|
|
899
|
+
[smallStep]="1"
|
|
900
|
+
[largeStep]="10"
|
|
901
|
+
[value]="alphaSliderValue"
|
|
902
|
+
(valueChange)="handleAlphaSliderChange($event)"
|
|
903
|
+
>
|
|
904
|
+
</kendo-slider>
|
|
905
|
+
</div>
|
|
906
|
+
</div>
|
|
907
|
+
<kendo-colorinput #inputs
|
|
908
|
+
[tabindex]="innerTabIndex"
|
|
909
|
+
[opacity]="opacity"
|
|
910
|
+
[formatView]="format"
|
|
911
|
+
[value]="value"
|
|
912
|
+
[disabled]="disabled"
|
|
913
|
+
[readonly]="readonly"
|
|
914
|
+
(valueChange)="handleInputsValueChange($event)"
|
|
915
|
+
(tabOut)="gradientDragHandle.focus()"
|
|
916
|
+
>
|
|
917
|
+
</kendo-colorinput>
|
|
918
|
+
<div class="k-colorgradient-color-contrast k-vbox"
|
|
919
|
+
*ngIf="contrastToolVisible"
|
|
920
|
+
kendoContrastTool
|
|
921
|
+
[value]="value"
|
|
922
|
+
[ratio]="contrastTool">
|
|
923
|
+
</div>
|
|
924
|
+
`
|
|
925
|
+
}]
|
|
926
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }, { type: i1.LocalizationService }, { type: i0.Injector }]; }, propDecorators: { hostClasses: [{
|
|
927
|
+
type: HostBinding,
|
|
928
|
+
args: ['class.k-colorgradient']
|
|
929
|
+
}], readonlyAttribute: [{
|
|
930
|
+
type: HostBinding,
|
|
931
|
+
args: ['attr.aria-readonly']
|
|
932
|
+
}], disabledClass: [{
|
|
933
|
+
type: HostBinding,
|
|
934
|
+
args: ['class.k-disabled']
|
|
935
|
+
}], gradientId: [{
|
|
936
|
+
type: HostBinding,
|
|
937
|
+
args: ['attr.id']
|
|
938
|
+
}], direction: [{
|
|
939
|
+
type: HostBinding,
|
|
940
|
+
args: ['attr.dir']
|
|
941
|
+
}], hostTabindex: [{
|
|
942
|
+
type: HostBinding,
|
|
943
|
+
args: ['attr.tabindex']
|
|
944
|
+
}], ariaRole: [{
|
|
945
|
+
type: HostBinding,
|
|
946
|
+
args: ['attr.role']
|
|
947
|
+
}], isControlInvalid: [{
|
|
948
|
+
type: HostBinding,
|
|
949
|
+
args: ['attr.aria-invalid']
|
|
950
|
+
}], isDisabled: [{
|
|
951
|
+
type: HostBinding,
|
|
952
|
+
args: ['attr.aria-disabled']
|
|
953
|
+
}], enterHandler: [{
|
|
954
|
+
type: HostListener,
|
|
955
|
+
args: ['keydown.enter', ['$event']]
|
|
956
|
+
}], escapeHandler: [{
|
|
957
|
+
type: HostListener,
|
|
958
|
+
args: ['keydown.escape', ['$event']]
|
|
959
|
+
}], focusHandler: [{
|
|
960
|
+
type: HostListener,
|
|
961
|
+
args: ['focusin', ['$event']]
|
|
962
|
+
}], id: [{
|
|
963
|
+
type: Input
|
|
964
|
+
}], opacity: [{
|
|
965
|
+
type: Input
|
|
966
|
+
}], disabled: [{
|
|
967
|
+
type: Input
|
|
968
|
+
}], readonly: [{
|
|
969
|
+
type: Input
|
|
970
|
+
}], clearButton: [{
|
|
971
|
+
type: Input
|
|
972
|
+
}], delay: [{
|
|
973
|
+
type: Input
|
|
974
|
+
}], value: [{
|
|
975
|
+
type: Input
|
|
976
|
+
}], contrastTool: [{
|
|
977
|
+
type: Input
|
|
978
|
+
}], tabindex: [{
|
|
979
|
+
type: Input
|
|
980
|
+
}], format: [{
|
|
981
|
+
type: Input
|
|
982
|
+
}], valueChange: [{
|
|
983
|
+
type: Output
|
|
984
|
+
}], gradientSliderStep: [{
|
|
985
|
+
type: Input
|
|
986
|
+
}], gradientSliderSmallStep: [{
|
|
987
|
+
type: Input
|
|
988
|
+
}], gradientDragHandle: [{
|
|
989
|
+
type: ViewChild,
|
|
990
|
+
args: ['gradientDragHandle']
|
|
991
|
+
}], inputs: [{
|
|
992
|
+
type: ViewChild,
|
|
993
|
+
args: ['inputs']
|
|
994
|
+
}], alphaSlider: [{
|
|
995
|
+
type: ViewChild,
|
|
996
|
+
args: ['alphaSlider']
|
|
997
|
+
}], gradientWrapper: [{
|
|
998
|
+
type: ViewChild,
|
|
999
|
+
args: ['gradientWrapper']
|
|
1000
|
+
}], hsvRectangle: [{
|
|
1001
|
+
type: ViewChild,
|
|
1002
|
+
args: ['hsvRectangle']
|
|
1003
|
+
}] } });
|