@progress/kendo-angular-inputs 7.5.1-dev.202110280909 → 8.0.0-dev.202112161434
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/js/kendo-angular-inputs.js +2 -2
- package/dist/cdn/main.js +1 -1
- package/dist/es/colorpicker/color-contrast-svg.component.js +95 -0
- package/dist/es/colorpicker/color-gradient.component.js +109 -81
- package/dist/es/colorpicker/color-input.component.js +39 -18
- package/dist/es/colorpicker/color-palette.component.js +28 -18
- package/dist/es/colorpicker/colorpicker.component.js +170 -76
- package/dist/es/colorpicker/constants.js +12 -0
- package/dist/es/colorpicker/contrast-validation.component.js +8 -6
- package/dist/es/colorpicker/contrast.component.js +6 -8
- package/dist/es/colorpicker/{models → events}/active-color-click-event.js +0 -0
- package/dist/es/colorpicker/events/cancel-event.js +19 -0
- package/dist/es/colorpicker/events/close-event.js +17 -0
- package/dist/es/colorpicker/{models → events}/kendo-drag-event.js +0 -0
- package/dist/es/colorpicker/events/open-event.js +17 -0
- package/dist/es/colorpicker/events.js +8 -0
- package/dist/es/colorpicker/flatcolorpicker-actions.component.js +50 -0
- package/dist/es/colorpicker/flatcolorpicker-header.component.js +94 -0
- package/dist/es/colorpicker/flatcolorpicker.component.js +553 -0
- package/dist/es/colorpicker/localization/colorgradient-localization.service.js +7 -7
- package/dist/es/colorpicker/localization/colorpalette-localization.service.js +7 -7
- package/dist/es/colorpicker/localization/custom-messages.component.js +1 -1
- package/dist/es/colorpicker/localization/flatcolorpicker-localization.service.js +34 -0
- package/dist/es/colorpicker/localization/localized-colorpicker-messages.directive.js +1 -1
- package/dist/es/colorpicker/localization/messages.js +36 -0
- package/dist/es/colorpicker/models/{color-picker-view.js → actions-layout.js} +0 -0
- package/dist/{es2015/colorpicker/models/color-picker-view.js → es/colorpicker/models/colorpicker-view.js} +0 -0
- package/dist/es/colorpicker/{utils → models}/palette-presets.js +0 -0
- package/dist/es/colorpicker/models.js +1 -2
- package/dist/es/colorpicker/services/flatcolorpicker.service.js +41 -0
- package/dist/es/colorpicker/utils/color-parser.js +18 -5
- package/dist/es/colorpicker/utils/contrast-curve.js +91 -0
- package/dist/es/colorpicker/utils.js +1 -1
- package/dist/es/colorpicker.module.js +9 -1
- package/dist/es/index.js +5 -0
- package/dist/es/main.js +4 -1
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/shared/utils.js +23 -0
- package/dist/es/textbox/textbox.component.js +3 -1
- package/dist/es2015/colorpicker/color-contrast-svg.component.d.ts +26 -0
- package/dist/es2015/colorpicker/color-contrast-svg.component.js +97 -0
- package/dist/es2015/colorpicker/color-gradient.component.d.ts +32 -43
- package/dist/es2015/colorpicker/color-gradient.component.js +125 -92
- package/dist/es2015/colorpicker/color-input.component.d.ts +11 -4
- package/dist/es2015/colorpicker/color-input.component.js +52 -32
- package/dist/es2015/colorpicker/color-palette.component.d.ts +8 -3
- package/dist/es2015/colorpicker/color-palette.component.js +28 -18
- package/dist/es2015/colorpicker/colorpicker.component.d.ts +84 -24
- package/dist/es2015/colorpicker/colorpicker.component.js +195 -112
- package/dist/es2015/colorpicker/constants.d.ts +12 -0
- package/dist/es2015/colorpicker/constants.js +12 -0
- package/dist/es2015/colorpicker/contrast-validation.component.d.ts +1 -1
- package/dist/es2015/colorpicker/contrast-validation.component.js +16 -12
- package/dist/es2015/colorpicker/contrast.component.d.ts +1 -3
- package/dist/es2015/colorpicker/contrast.component.js +17 -17
- package/dist/es2015/colorpicker/{models → events}/active-color-click-event.d.ts +0 -0
- package/dist/es2015/colorpicker/{models → events}/active-color-click-event.js +0 -0
- package/dist/es2015/colorpicker/events/cancel-event.d.ts +15 -0
- package/dist/es2015/colorpicker/events/cancel-event.js +14 -0
- package/dist/es2015/colorpicker/events/close-event.d.ts +10 -0
- package/dist/es2015/colorpicker/events/close-event.js +10 -0
- package/dist/es2015/colorpicker/{models → events}/kendo-drag-event.d.ts +0 -0
- package/dist/es2015/colorpicker/{models → events}/kendo-drag-event.js +0 -0
- package/dist/es2015/colorpicker/events/open-event.d.ts +10 -0
- package/dist/es2015/colorpicker/events/open-event.js +10 -0
- package/dist/es2015/colorpicker/events.d.ts +8 -0
- package/dist/es2015/colorpicker/events.js +8 -0
- package/dist/es2015/colorpicker/flatcolorpicker-actions.component.d.ts +18 -0
- package/dist/es2015/colorpicker/flatcolorpicker-actions.component.js +60 -0
- package/dist/es2015/colorpicker/flatcolorpicker-header.component.d.ts +30 -0
- package/dist/es2015/colorpicker/flatcolorpicker-header.component.js +131 -0
- package/dist/es2015/colorpicker/flatcolorpicker.component.d.ts +214 -0
- package/dist/es2015/colorpicker/flatcolorpicker.component.js +593 -0
- package/dist/es2015/colorpicker/localization/colorgradient-localization.service.d.ts +3 -3
- package/dist/es2015/colorpicker/localization/colorgradient-localization.service.js +7 -7
- package/dist/es2015/colorpicker/localization/colorpalette-localization.service.d.ts +3 -3
- package/dist/es2015/colorpicker/localization/colorpalette-localization.service.js +7 -7
- package/dist/es2015/colorpicker/localization/custom-messages.component.js +1 -1
- package/dist/es2015/colorpicker/localization/flatcolorpicker-localization.service.d.ts +14 -0
- package/dist/es2015/colorpicker/localization/flatcolorpicker-localization.service.js +31 -0
- package/dist/es2015/colorpicker/localization/localized-colorpicker-messages.directive.js +1 -1
- package/dist/es2015/colorpicker/localization/messages.d.ts +36 -0
- package/dist/es2015/colorpicker/localization/messages.js +36 -0
- package/dist/es2015/colorpicker/models/actions-layout.d.ts +8 -0
- package/dist/es2015/colorpicker/models/actions-layout.js +4 -0
- package/dist/es2015/colorpicker/models/colorpicker-view.d.ts +8 -0
- package/dist/es2015/colorpicker/models/colorpicker-view.js +4 -0
- package/dist/es2015/colorpicker/models/gradient-settings.d.ts +4 -3
- package/dist/es2015/colorpicker/models/output-format.d.ts +0 -5
- package/dist/es2015/colorpicker/{utils → models}/palette-presets.d.ts +0 -0
- package/dist/es2015/colorpicker/{utils → models}/palette-presets.js +0 -0
- package/dist/es2015/colorpicker/models/palette-settings.d.ts +2 -3
- package/dist/es2015/colorpicker/models/tile-size.d.ts +1 -5
- package/dist/es2015/colorpicker/models.d.ts +10 -10
- package/dist/es2015/colorpicker/models.js +1 -2
- package/dist/es2015/colorpicker/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/index.d.ts +5 -0
- package/dist/es2015/index.js +5 -0
- package/dist/es2015/index.metadata.json +1 -1
- package/dist/es2015/main.d.ts +4 -1
- package/dist/es2015/main.js +4 -1
- package/dist/es2015/package-metadata.js +1 -1
- package/dist/es2015/{colorpicker/models/color-picker-view.d.ts → shared/utils.d.ts} +9 -6
- package/dist/es2015/shared/utils.js +23 -0
- package/dist/es2015/textbox/textbox.component.js +3 -1
- package/dist/fesm2015/index.js +2229 -1046
- package/dist/fesm5/index.js +2026 -904
- package/dist/npm/colorpicker/color-contrast-svg.component.js +97 -0
- package/dist/npm/colorpicker/color-gradient.component.js +109 -81
- package/dist/npm/colorpicker/color-input.component.js +38 -17
- package/dist/npm/colorpicker/color-palette.component.js +29 -19
- package/dist/npm/colorpicker/colorpicker.component.js +177 -83
- package/dist/npm/colorpicker/constants.js +12 -0
- package/dist/npm/colorpicker/contrast-validation.component.js +8 -6
- package/dist/npm/colorpicker/contrast.component.js +6 -8
- package/dist/npm/colorpicker/{models → events}/active-color-click-event.js +0 -0
- package/dist/npm/colorpicker/events/cancel-event.js +21 -0
- package/dist/npm/colorpicker/events/close-event.js +19 -0
- package/dist/npm/colorpicker/{models → events}/kendo-drag-event.js +0 -0
- package/dist/npm/colorpicker/events/open-event.js +19 -0
- package/dist/npm/colorpicker/events.js +11 -0
- package/dist/npm/colorpicker/flatcolorpicker-actions.component.js +52 -0
- package/dist/npm/colorpicker/flatcolorpicker-header.component.js +96 -0
- package/dist/npm/colorpicker/flatcolorpicker.component.js +555 -0
- package/dist/npm/colorpicker/localization/colorgradient-localization.service.js +7 -7
- package/dist/npm/colorpicker/localization/colorpalette-localization.service.js +7 -7
- package/dist/npm/colorpicker/localization/custom-messages.component.js +1 -1
- package/dist/npm/colorpicker/localization/flatcolorpicker-localization.service.js +36 -0
- package/dist/npm/colorpicker/localization/localized-colorpicker-messages.directive.js +1 -1
- package/dist/npm/colorpicker/localization/messages.js +36 -0
- package/dist/npm/colorpicker/models/{color-picker-view.js → actions-layout.js} +0 -0
- package/dist/npm/colorpicker/models/colorpicker-view.js +6 -0
- package/dist/npm/colorpicker/{utils → models}/palette-presets.js +0 -0
- package/dist/npm/colorpicker/models.js +1 -2
- package/dist/npm/colorpicker/services/flatcolorpicker.service.js +43 -0
- package/dist/npm/colorpicker/utils/color-parser.js +18 -5
- package/dist/npm/colorpicker/utils/contrast-curve.js +93 -0
- package/dist/npm/colorpicker/utils.js +1 -1
- package/dist/npm/colorpicker.module.js +9 -1
- package/dist/npm/index.js +10 -0
- package/dist/npm/main.js +7 -2
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/shared/utils.js +25 -0
- package/dist/npm/textbox/textbox.component.js +6 -4
- package/dist/systemjs/kendo-angular-inputs.js +1 -1
- package/package.json +10 -7
- package/dist/es/colorpicker/models/preventable-event.js +0 -29
- package/dist/es2015/colorpicker/models/preventable-event.d.ts +0 -21
- package/dist/es2015/colorpicker/models/preventable-event.js +0 -27
- package/dist/npm/colorpicker/models/preventable-event.js +0 -31
package/dist/fesm5/index.js
CHANGED
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
import { __extends, __decorate, __param, __metadata, __assign } from 'tslib';
|
|
6
6
|
import { isDevMode, Directive, Optional, TemplateRef, Input, Output, EventEmitter, HostBinding, ViewChild, ElementRef, ContentChild, Component, forwardRef, Injector, Renderer2, NgZone, ChangeDetectorRef, Inject, Injectable, HostListener, ViewChildren, QueryList, NgModule, ViewContainerRef, ContentChildren } from '@angular/core';
|
|
7
7
|
import { NgControl, NG_VALUE_ACCESSOR, NG_VALIDATORS, RadioControlValueAccessor } from '@angular/forms';
|
|
8
|
-
import { Subscription, fromEvent, interval, merge, Observable, Subject } from 'rxjs';
|
|
8
|
+
import { Subscription, fromEvent, interval, merge, Observable, BehaviorSubject, Subject } from 'rxjs';
|
|
9
9
|
import { take, filter, concatMap, startWith, takeUntil, skip, debounceTime, throttleTime } from 'rxjs/operators';
|
|
10
10
|
import { LocalizationService, L10N_PREFIX, RTL, ComponentMessages, MessageService } from '@progress/kendo-angular-l10n';
|
|
11
|
-
import { Keys, guid, hasObservers, anyChanged, isDocumentAvailable, KendoInput, isChanged, DraggableModule, EventsModule, ResizeSensorModule } from '@progress/kendo-angular-common';
|
|
11
|
+
import { Keys, guid, hasObservers, anyChanged, isDocumentAvailable, KendoInput, isChanged, DraggableModule, EventsModule, ResizeSensorModule, PreventableEvent } from '@progress/kendo-angular-common';
|
|
12
12
|
import { validatePackage } from '@progress/kendo-licensing';
|
|
13
|
-
import { browser, mobileOS } from '@progress/kendo-common';
|
|
13
|
+
import { browser, mobileOS, detectDesktopBrowser, detectMobileOS } from '@progress/kendo-common';
|
|
14
14
|
import { IntlService } from '@progress/kendo-angular-intl';
|
|
15
15
|
import { CommonModule } from '@angular/common';
|
|
16
16
|
import { PopupService, PopupModule } from '@progress/kendo-angular-popup';
|
|
@@ -493,7 +493,7 @@ var packageMetadata = {
|
|
|
493
493
|
name: '@progress/kendo-angular-inputs',
|
|
494
494
|
productName: 'Kendo UI for Angular',
|
|
495
495
|
productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
|
|
496
|
-
publishDate:
|
|
496
|
+
publishDate: 1639665048,
|
|
497
497
|
version: '',
|
|
498
498
|
licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning'
|
|
499
499
|
};
|
|
@@ -5736,6 +5736,25 @@ var MaskedTextBoxModule = /** @class */ (function () {
|
|
|
5736
5736
|
return MaskedTextBoxModule;
|
|
5737
5737
|
}());
|
|
5738
5738
|
|
|
5739
|
+
/**
|
|
5740
|
+
* @hidden
|
|
5741
|
+
*
|
|
5742
|
+
* Returns true if the used browser is Safari.
|
|
5743
|
+
*/
|
|
5744
|
+
var isSafari = function (userAgent) {
|
|
5745
|
+
return detectDesktopBrowser(userAgent).safari ||
|
|
5746
|
+
(detectMobileOS(userAgent) && detectMobileOS(userAgent).browser === 'mobilesafari');
|
|
5747
|
+
};
|
|
5748
|
+
/**
|
|
5749
|
+
* @hidden
|
|
5750
|
+
*
|
|
5751
|
+
* Checks if input is Japanese IME
|
|
5752
|
+
*/
|
|
5753
|
+
var isJapanese = function (input) {
|
|
5754
|
+
var japaneseRegex = /[\u3000-\u303F]|[\u3040-\u309F]|[\u30A0-\u30FF]|[\uFF00-\uFFEF]|[\u4E00-\u9FAF]|[\u2605-\u2606]|[\u2190-\u2195]|\u203B/g;
|
|
5755
|
+
return japaneseRegex.test(input);
|
|
5756
|
+
};
|
|
5757
|
+
|
|
5739
5758
|
/**
|
|
5740
5759
|
* Specifies the adornments in the suffix container ([see examples]({% slug adornments_textbox %}#toc-suffixadornments)).
|
|
5741
5760
|
* @example
|
|
@@ -5981,7 +6000,7 @@ var TextBoxComponent = /** @class */ (function () {
|
|
|
5981
6000
|
* @hidden
|
|
5982
6001
|
*/
|
|
5983
6002
|
this.handleInput = function (ev) {
|
|
5984
|
-
var incomingValue = ev.target.value;
|
|
6003
|
+
var incomingValue = isSafari(navigator.userAgent) && isJapanese(ev.target.value) ? ev.data : ev.target.value;
|
|
5985
6004
|
_this.updateValue(incomingValue);
|
|
5986
6005
|
};
|
|
5987
6006
|
this.ngChange = function (_) { };
|
|
@@ -7335,28 +7354,206 @@ var TextAreaModule = /** @class */ (function () {
|
|
|
7335
7354
|
/**
|
|
7336
7355
|
* @hidden
|
|
7337
7356
|
*/
|
|
7338
|
-
var
|
|
7339
|
-
|
|
7340
|
-
|
|
7357
|
+
var ColorPickerLocalizationService = /** @class */ (function (_super) {
|
|
7358
|
+
__extends(ColorPickerLocalizationService, _super);
|
|
7359
|
+
function ColorPickerLocalizationService(prefix, messageService, _rtl) {
|
|
7360
|
+
return _super.call(this, prefix, messageService, _rtl) || this;
|
|
7341
7361
|
}
|
|
7342
|
-
|
|
7343
|
-
|
|
7344
|
-
|
|
7345
|
-
|
|
7346
|
-
|
|
7347
|
-
|
|
7362
|
+
ColorPickerLocalizationService = __decorate([
|
|
7363
|
+
__param(0, Inject(L10N_PREFIX)),
|
|
7364
|
+
__param(1, Optional()),
|
|
7365
|
+
__param(2, Optional()), __param(2, Inject(RTL)),
|
|
7366
|
+
__metadata("design:paramtypes", [String, MessageService, Boolean])
|
|
7367
|
+
], ColorPickerLocalizationService);
|
|
7368
|
+
return ColorPickerLocalizationService;
|
|
7369
|
+
}(LocalizationService));
|
|
7370
|
+
|
|
7371
|
+
/**
|
|
7372
|
+
* @hidden
|
|
7373
|
+
*/
|
|
7374
|
+
var FlatColorPickerLocalizationService = /** @class */ (function (_super) {
|
|
7375
|
+
__extends(FlatColorPickerLocalizationService, _super);
|
|
7376
|
+
function FlatColorPickerLocalizationService(prefix, messageService, _rtl, colorPickerLocalization) {
|
|
7377
|
+
var _this = _super.call(this, prefix, messageService, _rtl) || this;
|
|
7378
|
+
_this.colorPickerLocalization = colorPickerLocalization;
|
|
7379
|
+
return _this;
|
|
7380
|
+
}
|
|
7381
|
+
FlatColorPickerLocalizationService.prototype.get = function (shortKey) {
|
|
7382
|
+
if (this.colorPickerLocalization) {
|
|
7383
|
+
return this.colorPickerLocalization.get(shortKey);
|
|
7384
|
+
}
|
|
7385
|
+
return _super.prototype.get.call(this, shortKey);
|
|
7348
7386
|
};
|
|
7349
|
-
|
|
7350
|
-
|
|
7351
|
-
|
|
7352
|
-
|
|
7353
|
-
|
|
7354
|
-
|
|
7355
|
-
|
|
7387
|
+
FlatColorPickerLocalizationService = __decorate([
|
|
7388
|
+
__param(0, Inject(L10N_PREFIX)),
|
|
7389
|
+
__param(1, Optional()),
|
|
7390
|
+
__param(2, Optional()), __param(2, Inject(RTL)),
|
|
7391
|
+
__param(3, Optional()), __param(3, Inject(ColorPickerLocalizationService)),
|
|
7392
|
+
__metadata("design:paramtypes", [String, MessageService, Boolean, ColorPickerLocalizationService])
|
|
7393
|
+
], FlatColorPickerLocalizationService);
|
|
7394
|
+
return FlatColorPickerLocalizationService;
|
|
7395
|
+
}(LocalizationService));
|
|
7396
|
+
|
|
7397
|
+
/**
|
|
7398
|
+
* @hidden
|
|
7399
|
+
*/
|
|
7400
|
+
var DEFAULT_OUTPUT_FORMAT = 'rgba';
|
|
7401
|
+
/**
|
|
7402
|
+
* @hidden
|
|
7403
|
+
*/
|
|
7404
|
+
var DEFAULT_GRADIENT_BACKGROUND_COLOR = 'rgba(255, 0, 0, 1)';
|
|
7405
|
+
/**
|
|
7406
|
+
* @hidden
|
|
7407
|
+
*/
|
|
7408
|
+
var DRAGHANDLE_MOVE_SPEED = 5;
|
|
7409
|
+
/**
|
|
7410
|
+
* @hidden
|
|
7411
|
+
*/
|
|
7412
|
+
var AAA_RATIO = 7.0;
|
|
7413
|
+
/**
|
|
7414
|
+
* @hidden
|
|
7415
|
+
*/
|
|
7416
|
+
var AA_RATIO = 4.5;
|
|
7417
|
+
/**
|
|
7418
|
+
* @hidden
|
|
7419
|
+
*/
|
|
7420
|
+
var DEFAULT_PRESET = 'office';
|
|
7421
|
+
/**
|
|
7422
|
+
* @hidden
|
|
7423
|
+
*/
|
|
7424
|
+
var DEFAULT_ACCESSIBLE_PRESET = 'accessible';
|
|
7425
|
+
/**
|
|
7426
|
+
* @hidden
|
|
7427
|
+
*/
|
|
7428
|
+
var STEP_COUNT = 16;
|
|
7429
|
+
|
|
7430
|
+
// tslint:disable:max-line-length
|
|
7431
|
+
/**
|
|
7432
|
+
* @hidden
|
|
7433
|
+
*/
|
|
7434
|
+
var PALETTEPRESETS = {
|
|
7435
|
+
basic: {
|
|
7436
|
+
colors: '000000,7f7f7f,880015,ed1c24,ff7f27,fff200,22b14c,00a2e8,3f48cc,a349a4,ffffff,c3c3c3,b97a57,ffaec9,ffc90e,efe4b0,b5e61d,99d9ea,7092be,c8bfe7',
|
|
7437
|
+
columns: 10
|
|
7438
|
+
},
|
|
7439
|
+
office: {
|
|
7440
|
+
colors: 'ffffff, 000000, e6e6e6, 435569, 4371c4, ed7e32, a5a4a5, febf04, 5a9bd5, 71ae48, f2f2f3, 7f7f7f, d1cece, d5dde3, dae1f4, fce5d4, deeded, fff2cc, deeaf6, e1efd9, d7d8d8, 585959, aeabab, adbaca, b4c5e7, f6caac, dbdbdb, ffe498, bcd6ee, c5e0b2, bfbfc0, 3f3f3f, 767070, 8595b1, 8fabdb, f5b183, c9c8c9, fed965, 9bc4e5, a8d08d, a5a5a6, 262625, 393939, 334050, 2e5496, c45a11, 7b7b7a, bf9000, 2f75b5, 548235, 7f7f7f, 0b0c0c, 161616, 222a34, 203764, 843d0b, 525252, 7f6000, 1d4d79, 375623',
|
|
7441
|
+
columns: 10
|
|
7442
|
+
},
|
|
7443
|
+
apex: {
|
|
7444
|
+
colors: 'ffffff, 000000, c9c2d1, 69676d, ceb966, 9cb084, 6bb1c9, 6585cf, 7e6bc9, a379bb, f2f2f2, 7f7f7f, f4f2f5, e0e0e2, f5f1e0, ebefe6, e1eff4, e0e6f5, e5e1f4, ece4f1, d8d8d8, 595959, e9e6ec, c2c1c5, ebe3c1, d7dfcd, c3dfe9, c1ceeb, cbc3e9, dac9e3, bfbfbf, 3f3f3f, dedae3, a4a3a8, e1d5a3, c3cfb5, a6d0de, a2b5e2, b1a6de, c7aed6, a5a5a5, 262626, 9688a5, 4e4d51, ae9638, 758c5a, 3d8da9, 365bb0, 533da9, 7d4d99, 7f7f7f, 0c0c0c, 635672, 343336, 746425, 4e5d3c, 295e70, 243c75, 372970, 533366',
|
|
7445
|
+
columns: 10
|
|
7446
|
+
},
|
|
7447
|
+
austin: {
|
|
7448
|
+
colors: 'ffffff, 000000, caf278, 3e3d2d, 94c600, 71685a, ff6700, 909465, 956b43, fea022, f2f2f2, 7f7f7f, f4fce4, dddcd0, efffc0, e3e1dc, ffe0cb, e8e9df, ece1d6, feecd2, d8d8d8, 595959, e9f9c9, bbb9a1, dfff82, c8c3ba, ffc299, d2d4c0, dac3ad, fed9a6, bfbfbf, 3f3f3f, dff7ae, ada598, cfff43, ada598, ffa365, bcbfa1, c8a585, fec67a, a5a5a5, 262626, a9ea25, 2e2d21, 6f9400, 544e43, bf4d00, 6c6f4b, 6f5032, d77b00, 7f7f7f, 0c0c0c, 74a50f, 1f1e16, 4a6300, 38342d, 7f3300, 484a32, 4a3521, 8f5200',
|
|
7449
|
+
columns: 10
|
|
7450
|
+
},
|
|
7451
|
+
clarity: {
|
|
7452
|
+
colors: 'ffffff, 292934, f3f2dc, d2533c, 93a299, ad8f67, 726056, 4c5a6a, 808da0, 79463d, f2f2f2, e7e7ec, e7e5b9, f6dcd8, e9ecea, eee8e0, e4dedb, d8dde3, e5e8ec, e9d6d3, d8d8d8, c4c4d1, d5d185, edbab1, d3d9d6, ded2c2, c9beb8, b2bcc8, ccd1d9, d3aea7, bfbfbf, 8a8aa3, aca73b, e4978a, bec7c1, cdbba3, af9e94, 8c9bac, b2bac6, bd857c, a5a5a5, 56566e, 56531d, a43925, 6b7c72, 866b48, 554840, 39434f, 5c697b, 5a342d, 7f7f7f, 3b3b4b, 22210b, 6d2619, 47534c, 594730, 39302b, 262d35, 3d4652, 3c231e',
|
|
7453
|
+
columns: 10
|
|
7454
|
+
},
|
|
7455
|
+
slipstream: {
|
|
7456
|
+
colors: 'ffffff, 000000, b4dcfa, 212745, 4e67c8, 5eccf3, a7ea52, 5dceaf, ff8021, f14124, f2f2f2, 7f7f7f, 8bc9f7, c7cce4, dbe0f4, def4fc, edfadc, def5ef, ffe5d2, fcd9d3, d8d8d8, 595959, 4facf3, 909aca, b8c2e9, beeafa, dbf6b9, beebdf, ffcca6, f9b3a7, bfbfbf, 3f3f3f, 0d78c9, 5967af, 94a3de, 9ee0f7, caf297, 9de1cf, ffb279, f68d7b, a5a5a5, 262626, 063c64, 181d33, 31479f, 11b2eb, 81d319, 34ac8b, d85c00, c3260c, 7f7f7f, 0c0c0c, 021828, 101322, 202f6a, 0b769c, 568c11, 22725c, 903d00, 821908',
|
|
7457
|
+
columns: 10
|
|
7458
|
+
},
|
|
7459
|
+
metro: {
|
|
7460
|
+
colors: 'ffffff, 000000, d6ecff, 4e5b6f, 7fd13b, ea157a, feb80a, 00addc, 738ac8, 1ab39f, f2f2f2, 7f7f7f, a7d6ff, d9dde4, e5f5d7, fad0e4, fef0cd, c5f2ff, e2e7f4, c9f7f1, d8d8d8, 595959, 60b5ff, b3bcca, cbecb0, f6a1c9, fee29c, 8be6ff, c7d0e9, 94efe3, bfbfbf, 3f3f3f, 007dea, 8d9baf, b2e389, f272af, fed46b, 51d9ff, aab8de, 5fe7d5, a5a5a5, 262626, 003e75, 3a4453, 5ea226, af0f5b, c58c00, 0081a5, 425ea9, 138677, 7f7f7f, 0c0c0c, 00192e, 272d37, 3f6c19, 750a3d, 835d00, 00566e, 2c3f71, 0c594f',
|
|
7461
|
+
columns: 10
|
|
7462
|
+
},
|
|
7463
|
+
flow: {
|
|
7464
|
+
colors: 'ffffff, 000000, dbf5f9, 04617b, 0f6fc6, 009dd9, 0bd0d9, 10cf9b, 7cca62, a5c249, f2f2f2, 7f7f7f, b2e9f2, b4ecfc, c7e2fa, c4eeff, c9fafc, c9faed, e4f4df, edf2da, d8d8d8, 595959, 76d9e8, 6adafa, 90c6f6, 89deff, 93f5f9, 94f6db, cae9c0, dbe6b6, bfbfbf, 3f3f3f, 21b2c8, 20c8f7, 59a9f2, 4fceff, 5df0f6, 5ff2ca, b0dfa0, c9da91, a5a5a5, 262626, 105964, 02485c, 0b5394, 0075a2, 089ca2, 0b9b74, 54a838, 7e9532, 7f7f7f, 0c0c0c, 062328, 01303d, 073763, 004e6c, 05686c, 07674d, 387025, 546321',
|
|
7465
|
+
columns: 10
|
|
7466
|
+
},
|
|
7467
|
+
hardcover: {
|
|
7468
|
+
colors: 'ffffff, 000000, ece9c6, 895d1d, 873624, d6862d, d0be40, 877f6c, 972109, aeb795, f2f2f2, 7f7f7f, e1dca5, f2e0c6, f0d0c9, f6e6d5, f5f2d8, e7e5e1, fbc7bc, eef0e9, d8d8d8, 595959, d0c974, e6c28d, e2a293, eeceaa, ece5b2, cfccc3, f78f7a, dee2d4, bfbfbf, 3f3f3f, a29a36, daa454, d4735e, e6b681, e2d88c, b7b2a5, f35838, ced3bf, a5a5a5, 262626, 514d1b, 664515, 65281a, a2641f, a39428, 655f50, 711806, 879464, 7f7f7f, 0c0c0c, 201e0a, 442e0e, 431b11, 6c4315, 6d621a, 433f35, 4b1004, 5a6243',
|
|
7469
|
+
columns: 10
|
|
7470
|
+
},
|
|
7471
|
+
trek: {
|
|
7472
|
+
colors: 'ffffff, 000000, fbeec9, 4e3b30, f0a22e, a5644e, b58b80, c3986d, a19574, c17529, f2f2f2, 7f7f7f, f7e09e, e1d6cf, fcecd5, eddfda, f0e7e5, f3eae1, ece9e3, f5e3d1, d8d8d8, 595959, f3cc5f, c4ad9f, f9d9ab, dcc0b6, e1d0cc, e7d5c4, d9d4c7, ebc7a3, bfbfbf, 3f3f3f, d29f0f, a78470, f6c781, cba092, d2b9b2, dbc1a7, c6bfab, e1ac76, a5a5a5, 262626, 694f07, 3a2c24, c87d0e, 7b4b3a, 926255, a17242, 7b7153, 90571e, 7f7f7f, 0c0c0c, 2a1f03, 271d18, 855309, 523226, 614138, 6b4c2c, 524b37, 603a14',
|
|
7473
|
+
columns: 10
|
|
7474
|
+
},
|
|
7475
|
+
verve: {
|
|
7476
|
+
colors: 'ffffff, 000000, d2d2d2, 666666, ff388c, e40059, 9c007f, 68007f, 005bd3, 00349e, f2f2f2, 7f7f7f, bdbdbd, e0e0e0, ffd7e8, ffc6dc, ffb8f1, f1b2ff, c3dcff, b8cfff, d8d8d8, 595959, 9d9d9d, c1c1c1, ffafd1, ff8eba, ff71e4, e365ff, 87baff, 72a0ff, bfbfbf, 3f3f3f, 696969, a3a3a3, ff87ba, ff5597, ff2ad7, d519ff, 4b98ff, 2b71ff, a5a5a5, 262626, 343434, 4c4c4c, e90062, ab0042, 75005f, 4e005f, 00449e, 002676, 7f7f7f, 0c0c0c, 151515, 333333, 9b0041, 72002c, 4e003f, 34003f, 002d69, 00194f',
|
|
7477
|
+
columns: 10
|
|
7478
|
+
},
|
|
7479
|
+
monochrome: {
|
|
7480
|
+
colors: '000000, 1a1a1a, 333333, 4d4d4d, 666666, 808080, 999999, b3b3b3, cccccc, e6e6e6, f2f2f2, ffffff',
|
|
7481
|
+
columns: 12
|
|
7482
|
+
},
|
|
7483
|
+
accessible: {
|
|
7484
|
+
colors: 'black, grey, darkred, red, darkorange, gold, green, blue, darkblue, purple, white, darkgrey, saddlebrown, pink, orange, yellow, lightgreen, lightskyblue, lightblue, mediumpurple',
|
|
7485
|
+
columns: 10
|
|
7486
|
+
}
|
|
7487
|
+
};
|
|
7488
|
+
|
|
7489
|
+
/**
|
|
7490
|
+
* @hidden
|
|
7491
|
+
*/
|
|
7492
|
+
var FlatColorPickerService = /** @class */ (function () {
|
|
7493
|
+
function FlatColorPickerService() {
|
|
7494
|
+
}
|
|
7495
|
+
FlatColorPickerService.prototype.getPaletteSettings = function (settings, format) {
|
|
7496
|
+
var defaultPreset = (format !== 'name') ? DEFAULT_PRESET : DEFAULT_ACCESSIBLE_PRESET;
|
|
7497
|
+
var settingsPalette = settings.palette;
|
|
7498
|
+
var presetColumns = typeof settingsPalette === 'string' && PALETTEPRESETS[settingsPalette] ?
|
|
7499
|
+
PALETTEPRESETS[settingsPalette].columns :
|
|
7500
|
+
undefined;
|
|
7501
|
+
return {
|
|
7502
|
+
palette: settingsPalette || defaultPreset,
|
|
7503
|
+
tileSize: settings.tileSize || 24,
|
|
7504
|
+
columns: settings.columns || presetColumns || 10
|
|
7505
|
+
};
|
|
7506
|
+
};
|
|
7507
|
+
FlatColorPickerService.prototype.paletteTileLayout = function (tileSize) {
|
|
7508
|
+
if (typeof tileSize === 'number') {
|
|
7509
|
+
return { width: tileSize, height: tileSize };
|
|
7510
|
+
}
|
|
7511
|
+
return {
|
|
7512
|
+
width: tileSize.width ? tileSize.width : tileSize.height,
|
|
7513
|
+
height: tileSize.height ? tileSize.height : tileSize.width
|
|
7514
|
+
};
|
|
7356
7515
|
};
|
|
7357
|
-
|
|
7516
|
+
FlatColorPickerService = __decorate([
|
|
7517
|
+
Injectable()
|
|
7518
|
+
], FlatColorPickerService);
|
|
7519
|
+
return FlatColorPickerService;
|
|
7358
7520
|
}());
|
|
7359
7521
|
|
|
7522
|
+
/**
|
|
7523
|
+
* Arguments for the `cancel` event of the ColorPicker and FlatColorPicker components.
|
|
7524
|
+
*/
|
|
7525
|
+
var ColorPickerCancelEvent = /** @class */ (function (_super) {
|
|
7526
|
+
__extends(ColorPickerCancelEvent, _super);
|
|
7527
|
+
function ColorPickerCancelEvent(originalEvent) {
|
|
7528
|
+
var _this = _super.call(this) || this;
|
|
7529
|
+
_this.originalEvent = originalEvent;
|
|
7530
|
+
return _this;
|
|
7531
|
+
}
|
|
7532
|
+
return ColorPickerCancelEvent;
|
|
7533
|
+
}(PreventableEvent));
|
|
7534
|
+
|
|
7535
|
+
/**
|
|
7536
|
+
* Arguments for the `close` event of the ColorPicker component.
|
|
7537
|
+
*/
|
|
7538
|
+
var ColorPickerCloseEvent = /** @class */ (function (_super) {
|
|
7539
|
+
__extends(ColorPickerCloseEvent, _super);
|
|
7540
|
+
function ColorPickerCloseEvent() {
|
|
7541
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
7542
|
+
}
|
|
7543
|
+
return ColorPickerCloseEvent;
|
|
7544
|
+
}(PreventableEvent));
|
|
7545
|
+
|
|
7546
|
+
/**
|
|
7547
|
+
* Arguments for the `open` event of the ColorPicker component.
|
|
7548
|
+
*/
|
|
7549
|
+
var ColorPickerOpenEvent = /** @class */ (function (_super) {
|
|
7550
|
+
__extends(ColorPickerOpenEvent, _super);
|
|
7551
|
+
function ColorPickerOpenEvent() {
|
|
7552
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
7553
|
+
}
|
|
7554
|
+
return ColorPickerOpenEvent;
|
|
7555
|
+
}(PreventableEvent));
|
|
7556
|
+
|
|
7360
7557
|
/**
|
|
7361
7558
|
* Fires each time the left side of the ColorPicker wrapper is clicked.
|
|
7362
7559
|
* The event is triggered regardless of whether a ColorPicker icon is set or not.
|
|
@@ -7418,7 +7615,8 @@ var ActiveColorClickEvent = /** @class */ (function () {
|
|
|
7418
7615
|
*
|
|
7419
7616
|
* Returns the hex or rgba string representation of the color.
|
|
7420
7617
|
*/
|
|
7421
|
-
var parseColor$1 = function (value, format, safe) {
|
|
7618
|
+
var parseColor$1 = function (value, format, opacityEnabled, safe) {
|
|
7619
|
+
if (opacityEnabled === void 0) { opacityEnabled = false; }
|
|
7422
7620
|
if (safe === void 0) { safe = true; }
|
|
7423
7621
|
var allowedFormats = ['hex', 'rgba', 'name'];
|
|
7424
7622
|
if (allowedFormats.indexOf(format) === -1) {
|
|
@@ -7434,7 +7632,8 @@ var parseColor$1 = function (value, format, safe) {
|
|
|
7434
7632
|
if (!isPresent(parsedColor)) {
|
|
7435
7633
|
return;
|
|
7436
7634
|
}
|
|
7437
|
-
|
|
7635
|
+
var parsedColorResult = format === 'hex' ? getHexValue(parsedColor, opacityEnabled) : parsedColor.toCssRgba();
|
|
7636
|
+
return parsedColorResult;
|
|
7438
7637
|
};
|
|
7439
7638
|
/**
|
|
7440
7639
|
* @hidden
|
|
@@ -7467,12 +7666,23 @@ var getRGBA = function (value, safe) {
|
|
|
7467
7666
|
*
|
|
7468
7667
|
* Returns the RGBA string representation of the color.
|
|
7469
7668
|
*/
|
|
7470
|
-
var getColorFromHSV = function (hsva) {
|
|
7669
|
+
var getColorFromHSV = function (hsva, format, opacityEnabled) {
|
|
7670
|
+
if (format === void 0) { format = 'rgba'; }
|
|
7671
|
+
if (opacityEnabled === void 0) { opacityEnabled = false; }
|
|
7471
7672
|
var hue = fitIntoBounds(hsva.h, 0, 359.9);
|
|
7472
7673
|
var saturation = fitIntoBounds(hsva.s, 0, 1);
|
|
7473
7674
|
var value = fitIntoBounds(hsva.v, 0, 1);
|
|
7474
7675
|
var alpha = fitIntoBounds(hsva.a, 0, 1);
|
|
7475
|
-
|
|
7676
|
+
var color = Color.fromHSV(hue, saturation, value, alpha);
|
|
7677
|
+
return format === 'hex' ? getHexValue(color, opacityEnabled) : color.toCssRgba();
|
|
7678
|
+
};
|
|
7679
|
+
/**
|
|
7680
|
+
* @hidden
|
|
7681
|
+
*
|
|
7682
|
+
* Returns the HEX value.
|
|
7683
|
+
*/
|
|
7684
|
+
var getHexValue = function (color, opacity) {
|
|
7685
|
+
return opacity && color.a < 1 ? color.toCss({ alpha: true }) : color.toCss();
|
|
7476
7686
|
};
|
|
7477
7687
|
/**
|
|
7478
7688
|
* @hidden
|
|
@@ -7508,7 +7718,7 @@ function nameFormat(value, safe) {
|
|
|
7508
7718
|
}
|
|
7509
7719
|
var key = Object.keys(namedColors).find(function (key) { return namedColors[key] === value; });
|
|
7510
7720
|
if (!key && !safe) {
|
|
7511
|
-
throw new Error("The provided color " + value + " is not supported for 'format=\"name\"' property.To display " + value + " color, the component 'format' property
|
|
7721
|
+
throw new Error("The provided color " + value + " is not supported for 'format=\"name\"' property.To display " + value + " color, the component 'format' property should be set to 'hex' or 'rgba' ");
|
|
7512
7722
|
}
|
|
7513
7723
|
return key;
|
|
7514
7724
|
}
|
|
@@ -7565,95 +7775,90 @@ var getContrastFromTwoRGBAs = function (a, b) {
|
|
|
7565
7775
|
return getContrast(getLuminance(getRGBFromRGBA(a, b)), getLuminance(getRGBFromRGBA(b, { r: 0, g: 0, b: 0, a: 1 })));
|
|
7566
7776
|
};
|
|
7567
7777
|
|
|
7568
|
-
// tslint:disable:max-line-length
|
|
7569
7778
|
/**
|
|
7570
7779
|
* @hidden
|
|
7571
7780
|
*/
|
|
7572
|
-
var
|
|
7573
|
-
|
|
7574
|
-
|
|
7575
|
-
|
|
7576
|
-
|
|
7577
|
-
|
|
7578
|
-
|
|
7579
|
-
|
|
7580
|
-
|
|
7581
|
-
|
|
7582
|
-
|
|
7583
|
-
|
|
7584
|
-
|
|
7585
|
-
|
|
7586
|
-
|
|
7587
|
-
|
|
7588
|
-
|
|
7589
|
-
|
|
7590
|
-
|
|
7591
|
-
|
|
7592
|
-
|
|
7593
|
-
|
|
7594
|
-
|
|
7595
|
-
|
|
7596
|
-
|
|
7597
|
-
|
|
7598
|
-
|
|
7599
|
-
|
|
7600
|
-
},
|
|
7601
|
-
flow: {
|
|
7602
|
-
colors: 'ffffff, 000000, dbf5f9, 04617b, 0f6fc6, 009dd9, 0bd0d9, 10cf9b, 7cca62, a5c249, f2f2f2, 7f7f7f, b2e9f2, b4ecfc, c7e2fa, c4eeff, c9fafc, c9faed, e4f4df, edf2da, d8d8d8, 595959, 76d9e8, 6adafa, 90c6f6, 89deff, 93f5f9, 94f6db, cae9c0, dbe6b6, bfbfbf, 3f3f3f, 21b2c8, 20c8f7, 59a9f2, 4fceff, 5df0f6, 5ff2ca, b0dfa0, c9da91, a5a5a5, 262626, 105964, 02485c, 0b5394, 0075a2, 089ca2, 0b9b74, 54a838, 7e9532, 7f7f7f, 0c0c0c, 062328, 01303d, 073763, 004e6c, 05686c, 07674d, 387025, 546321',
|
|
7603
|
-
columns: 10
|
|
7604
|
-
},
|
|
7605
|
-
hardcover: {
|
|
7606
|
-
colors: 'ffffff, 000000, ece9c6, 895d1d, 873624, d6862d, d0be40, 877f6c, 972109, aeb795, f2f2f2, 7f7f7f, e1dca5, f2e0c6, f0d0c9, f6e6d5, f5f2d8, e7e5e1, fbc7bc, eef0e9, d8d8d8, 595959, d0c974, e6c28d, e2a293, eeceaa, ece5b2, cfccc3, f78f7a, dee2d4, bfbfbf, 3f3f3f, a29a36, daa454, d4735e, e6b681, e2d88c, b7b2a5, f35838, ced3bf, a5a5a5, 262626, 514d1b, 664515, 65281a, a2641f, a39428, 655f50, 711806, 879464, 7f7f7f, 0c0c0c, 201e0a, 442e0e, 431b11, 6c4315, 6d621a, 433f35, 4b1004, 5a6243',
|
|
7607
|
-
columns: 10
|
|
7608
|
-
},
|
|
7609
|
-
trek: {
|
|
7610
|
-
colors: 'ffffff, 000000, fbeec9, 4e3b30, f0a22e, a5644e, b58b80, c3986d, a19574, c17529, f2f2f2, 7f7f7f, f7e09e, e1d6cf, fcecd5, eddfda, f0e7e5, f3eae1, ece9e3, f5e3d1, d8d8d8, 595959, f3cc5f, c4ad9f, f9d9ab, dcc0b6, e1d0cc, e7d5c4, d9d4c7, ebc7a3, bfbfbf, 3f3f3f, d29f0f, a78470, f6c781, cba092, d2b9b2, dbc1a7, c6bfab, e1ac76, a5a5a5, 262626, 694f07, 3a2c24, c87d0e, 7b4b3a, 926255, a17242, 7b7153, 90571e, 7f7f7f, 0c0c0c, 2a1f03, 271d18, 855309, 523226, 614138, 6b4c2c, 524b37, 603a14',
|
|
7611
|
-
columns: 10
|
|
7612
|
-
},
|
|
7613
|
-
verve: {
|
|
7614
|
-
colors: 'ffffff, 000000, d2d2d2, 666666, ff388c, e40059, 9c007f, 68007f, 005bd3, 00349e, f2f2f2, 7f7f7f, bdbdbd, e0e0e0, ffd7e8, ffc6dc, ffb8f1, f1b2ff, c3dcff, b8cfff, d8d8d8, 595959, 9d9d9d, c1c1c1, ffafd1, ff8eba, ff71e4, e365ff, 87baff, 72a0ff, bfbfbf, 3f3f3f, 696969, a3a3a3, ff87ba, ff5597, ff2ad7, d519ff, 4b98ff, 2b71ff, a5a5a5, 262626, 343434, 4c4c4c, e90062, ab0042, 75005f, 4e005f, 00449e, 002676, 7f7f7f, 0c0c0c, 151515, 333333, 9b0041, 72002c, 4e003f, 34003f, 002d69, 00194f',
|
|
7615
|
-
columns: 10
|
|
7616
|
-
},
|
|
7617
|
-
monochrome: {
|
|
7618
|
-
colors: '000000, 1a1a1a, 333333, 4d4d4d, 666666, 808080, 999999, b3b3b3, cccccc, e6e6e6, f2f2f2, ffffff',
|
|
7619
|
-
columns: 12
|
|
7620
|
-
},
|
|
7621
|
-
accessible: {
|
|
7622
|
-
colors: 'black, grey, darkred, red, darkorange, gold, green, blue, darkblue, purple, white, darkgrey, saddlebrown, pink, orange, yellow, lightgreen, lightskyblue, lightblue, mediumpurple',
|
|
7623
|
-
columns: 10
|
|
7624
|
-
}
|
|
7781
|
+
var bezierCommand = function (controlPointCalc) { return function (point, i, a) {
|
|
7782
|
+
// start control point
|
|
7783
|
+
var _a = controlPointCalc(a[i - 1], a[i - 2], point), cpsX = _a[0], cpsY = _a[1];
|
|
7784
|
+
// end control point
|
|
7785
|
+
var _b = controlPointCalc(point, a[i - 1], a[i + 1], true), cpeX = _b[0], cpeY = _b[1];
|
|
7786
|
+
return "C " + cpsX + "," + cpsY + " " + cpeX + "," + cpeY + " " + point[0] + "," + point[1];
|
|
7787
|
+
}; };
|
|
7788
|
+
/**
|
|
7789
|
+
* @hidden
|
|
7790
|
+
*/
|
|
7791
|
+
var controlPoint = function (lineCalc) {
|
|
7792
|
+
return function (current, previous, next, reverse) {
|
|
7793
|
+
// when 'current' is the first or last point of the array
|
|
7794
|
+
// 'previous' and 'next' are undefined
|
|
7795
|
+
// replace with 'current'
|
|
7796
|
+
var p = previous || current;
|
|
7797
|
+
var n = next || current;
|
|
7798
|
+
var smooth = 0.1;
|
|
7799
|
+
// properties of the line between previous and next
|
|
7800
|
+
var l = lineCalc(p, n);
|
|
7801
|
+
// If is end-control-point, add PI to the angle to go backward
|
|
7802
|
+
var angle = l.angle + (reverse ? Math.PI : 0);
|
|
7803
|
+
var length = l.length * smooth;
|
|
7804
|
+
// The control point position is relative to the current point
|
|
7805
|
+
var x = current[0] + Math.cos(angle) * length;
|
|
7806
|
+
var y = current[1] + Math.sin(angle) * length;
|
|
7807
|
+
return [x, y];
|
|
7808
|
+
};
|
|
7625
7809
|
};
|
|
7626
|
-
|
|
7627
7810
|
/**
|
|
7628
7811
|
* @hidden
|
|
7629
7812
|
*/
|
|
7630
|
-
var
|
|
7631
|
-
|
|
7632
|
-
|
|
7633
|
-
|
|
7813
|
+
var line = function (pointA, pointB) {
|
|
7814
|
+
var lengthX = pointB[0] - pointA[0];
|
|
7815
|
+
var lengthY = pointB[1] - pointA[1];
|
|
7816
|
+
return {
|
|
7817
|
+
length: Math.sqrt(Math.pow(lengthX, 2) + Math.pow(lengthY, 2)),
|
|
7818
|
+
angle: Math.atan2(lengthY, lengthX)
|
|
7819
|
+
};
|
|
7820
|
+
};
|
|
7821
|
+
/**
|
|
7822
|
+
* @hidden
|
|
7823
|
+
*
|
|
7824
|
+
* Render the svg <path> element.
|
|
7825
|
+
*
|
|
7826
|
+
* @param points (array) Represents the points coordinates as an array of tuples.
|
|
7827
|
+
* @param command (function) The command that is used (bezierCommand, lineCommand).
|
|
7828
|
+
* @param point (array) [x,y] Represents the current point coordinates.
|
|
7829
|
+
* @param i (integer) Represents the index of 'point' in the array 'a'.
|
|
7830
|
+
* @param a (array) Represents the complete array of points coordinates.
|
|
7831
|
+
* @output (string) a svg path command.
|
|
7832
|
+
* @output (string) a Svg <path> element
|
|
7833
|
+
*/
|
|
7834
|
+
var svgPath = function (points, command) {
|
|
7835
|
+
if (points.length === 0) {
|
|
7836
|
+
return '';
|
|
7634
7837
|
}
|
|
7635
|
-
|
|
7636
|
-
|
|
7637
|
-
|
|
7638
|
-
|
|
7639
|
-
|
|
7640
|
-
|
|
7641
|
-
|
|
7642
|
-
}
|
|
7838
|
+
// build the d attributes by looping over the points
|
|
7839
|
+
var d = points.reduce(function (acc, point, i, a) {
|
|
7840
|
+
return i === 0 ?
|
|
7841
|
+
// if first point
|
|
7842
|
+
"M " + point[0] + "," + point[1] :
|
|
7843
|
+
// else
|
|
7844
|
+
acc + " " + command(point, i, a);
|
|
7845
|
+
}, '');
|
|
7846
|
+
return d;
|
|
7847
|
+
};
|
|
7643
7848
|
|
|
7644
7849
|
/**
|
|
7645
7850
|
* @hidden
|
|
7646
7851
|
*/
|
|
7647
7852
|
var ColorGradientLocalizationService = /** @class */ (function (_super) {
|
|
7648
7853
|
__extends(ColorGradientLocalizationService, _super);
|
|
7649
|
-
function ColorGradientLocalizationService(prefix, messageService, _rtl,
|
|
7854
|
+
function ColorGradientLocalizationService(prefix, messageService, _rtl, flatColorPickerLocalization) {
|
|
7650
7855
|
var _this = _super.call(this, prefix, messageService, _rtl) || this;
|
|
7651
|
-
_this.
|
|
7856
|
+
_this.flatColorPickerLocalization = flatColorPickerLocalization;
|
|
7652
7857
|
return _this;
|
|
7653
7858
|
}
|
|
7654
7859
|
ColorGradientLocalizationService.prototype.get = function (shortKey) {
|
|
7655
|
-
if (this.
|
|
7656
|
-
return this.
|
|
7860
|
+
if (this.flatColorPickerLocalization) {
|
|
7861
|
+
return this.flatColorPickerLocalization.get(shortKey);
|
|
7657
7862
|
}
|
|
7658
7863
|
return _super.prototype.get.call(this, shortKey);
|
|
7659
7864
|
};
|
|
@@ -7661,8 +7866,8 @@ var ColorGradientLocalizationService = /** @class */ (function (_super) {
|
|
|
7661
7866
|
__param(0, Inject(L10N_PREFIX)),
|
|
7662
7867
|
__param(1, Optional()),
|
|
7663
7868
|
__param(2, Optional()), __param(2, Inject(RTL)),
|
|
7664
|
-
__param(3, Optional()), __param(3, Inject(
|
|
7665
|
-
__metadata("design:paramtypes", [String, MessageService, Boolean,
|
|
7869
|
+
__param(3, Optional()), __param(3, Inject(FlatColorPickerLocalizationService)),
|
|
7870
|
+
__metadata("design:paramtypes", [String, MessageService, Boolean, FlatColorPickerLocalizationService])
|
|
7666
7871
|
], ColorGradientLocalizationService);
|
|
7667
7872
|
return ColorGradientLocalizationService;
|
|
7668
7873
|
}(LocalizationService));
|
|
@@ -7671,10 +7876,14 @@ var ColorGradientLocalizationService = /** @class */ (function (_super) {
|
|
|
7671
7876
|
* @hidden
|
|
7672
7877
|
*/
|
|
7673
7878
|
var ColorInputComponent = /** @class */ (function () {
|
|
7674
|
-
function ColorInputComponent(
|
|
7675
|
-
this.localization = localization;
|
|
7879
|
+
function ColorInputComponent(host, renderer, localizationService) {
|
|
7676
7880
|
this.host = host;
|
|
7677
7881
|
this.renderer = renderer;
|
|
7882
|
+
this.localizationService = localizationService;
|
|
7883
|
+
/**
|
|
7884
|
+
* The id of the hex input.
|
|
7885
|
+
*/
|
|
7886
|
+
this.focusableId = "k-" + guid();
|
|
7678
7887
|
/**
|
|
7679
7888
|
* Sets whether the alpha slider will be shown.
|
|
7680
7889
|
*/
|
|
@@ -7733,11 +7942,18 @@ var ColorInputComponent = /** @class */ (function () {
|
|
|
7733
7942
|
};
|
|
7734
7943
|
ColorInputComponent.prototype.ngOnChanges = function (changes) {
|
|
7735
7944
|
if (isPresent(changes.value) && !this.isFocused) {
|
|
7736
|
-
this.hex = parseColor$1(this.value, 'hex');
|
|
7945
|
+
this.hex = parseColor$1(this.value, 'hex', this.opacity);
|
|
7737
7946
|
this.rgba = getRGBA(this.value);
|
|
7738
|
-
this.rgba.a = parseColor$1(this.value, 'rgba') ? this.rgba.a : 1;
|
|
7947
|
+
this.rgba.a = parseColor$1(this.value, 'rgba', this.opacity) ? this.rgba.a : 1;
|
|
7739
7948
|
}
|
|
7740
7949
|
};
|
|
7950
|
+
Object.defineProperty(ColorInputComponent.prototype, "formatButtonTitle", {
|
|
7951
|
+
get: function () {
|
|
7952
|
+
return this.localizationService.get('formatButton');
|
|
7953
|
+
},
|
|
7954
|
+
enumerable: true,
|
|
7955
|
+
configurable: true
|
|
7956
|
+
});
|
|
7741
7957
|
ColorInputComponent.prototype.handleRgbaValueChange = function () {
|
|
7742
7958
|
var color = getColorFromRGBA(this.rgba);
|
|
7743
7959
|
if (!this.rgbaInputValid || color === this.value) {
|
|
@@ -7745,12 +7961,12 @@ var ColorInputComponent = /** @class */ (function () {
|
|
|
7745
7961
|
}
|
|
7746
7962
|
this.value = color;
|
|
7747
7963
|
this.rgba = getRGBA(this.value);
|
|
7748
|
-
this.hex = parseColor$1(color, 'hex');
|
|
7964
|
+
this.hex = parseColor$1(color, 'hex', this.opacity);
|
|
7749
7965
|
this.valueChange.emit(color);
|
|
7750
7966
|
};
|
|
7751
7967
|
ColorInputComponent.prototype.handleHexValueChange = function (hex) {
|
|
7752
7968
|
this.hex = hex;
|
|
7753
|
-
var color = parseColor$1(hex, 'rgba');
|
|
7969
|
+
var color = parseColor$1(hex, 'rgba', this.opacity);
|
|
7754
7970
|
if (!isPresent(color) || color === this.value) {
|
|
7755
7971
|
return;
|
|
7756
7972
|
}
|
|
@@ -7764,10 +7980,7 @@ var ColorInputComponent = /** @class */ (function () {
|
|
|
7764
7980
|
}
|
|
7765
7981
|
};
|
|
7766
7982
|
ColorInputComponent.prototype.handleHexInputBlur = function () {
|
|
7767
|
-
this.hex = parseColor$1(this.value, 'hex');
|
|
7768
|
-
};
|
|
7769
|
-
ColorInputComponent.prototype.textFor = function (key) {
|
|
7770
|
-
return this.localization.get(key);
|
|
7983
|
+
this.hex = parseColor$1(this.value, 'hex', this.opacity);
|
|
7771
7984
|
};
|
|
7772
7985
|
ColorInputComponent.prototype.toggleFormatView = function () {
|
|
7773
7986
|
this.formatView = this.formatView === 'hex' ? 'rgba' : 'hex';
|
|
@@ -7779,6 +7992,10 @@ var ColorInputComponent = /** @class */ (function () {
|
|
|
7779
7992
|
}
|
|
7780
7993
|
this.subscriptions.add(this.renderer.listen(this.toggleFormatButton.nativeElement, 'click', function () { return _this.toggleFormatView(); }));
|
|
7781
7994
|
};
|
|
7995
|
+
__decorate([
|
|
7996
|
+
Input(),
|
|
7997
|
+
__metadata("design:type", String)
|
|
7998
|
+
], ColorInputComponent.prototype, "focusableId", void 0);
|
|
7782
7999
|
__decorate([
|
|
7783
8000
|
Input(),
|
|
7784
8001
|
__metadata("design:type", String)
|
|
@@ -7809,9 +8026,17 @@ var ColorInputComponent = /** @class */ (function () {
|
|
|
7809
8026
|
__metadata("design:type", Boolean)
|
|
7810
8027
|
], ColorInputComponent.prototype, "colorInputClass", void 0);
|
|
7811
8028
|
__decorate([
|
|
7812
|
-
ViewChild('opacityInput', {
|
|
7813
|
-
__metadata("design:type",
|
|
8029
|
+
ViewChild('opacityInput', { static: false }),
|
|
8030
|
+
__metadata("design:type", NumericTextBoxComponent)
|
|
7814
8031
|
], ColorInputComponent.prototype, "opacityInput", void 0);
|
|
8032
|
+
__decorate([
|
|
8033
|
+
ViewChild('hexInput', { read: ElementRef, static: false }),
|
|
8034
|
+
__metadata("design:type", ElementRef)
|
|
8035
|
+
], ColorInputComponent.prototype, "hexInput", void 0);
|
|
8036
|
+
__decorate([
|
|
8037
|
+
ViewChild('blueInput', { read: ElementRef, static: false }),
|
|
8038
|
+
__metadata("design:type", ElementRef)
|
|
8039
|
+
], ColorInputComponent.prototype, "blueInput", void 0);
|
|
7815
8040
|
__decorate([
|
|
7816
8041
|
ViewChild('toggleFormatButton', { static: false }),
|
|
7817
8042
|
__metadata("design:type", ElementRef)
|
|
@@ -7819,36 +8044,15 @@ var ColorInputComponent = /** @class */ (function () {
|
|
|
7819
8044
|
ColorInputComponent = __decorate([
|
|
7820
8045
|
Component({
|
|
7821
8046
|
selector: 'kendo-colorinput',
|
|
7822
|
-
template: "\n <div class=\"k-vstack\">\n <button class=\"k-colorgradient-toggle-mode k-button k-icon-button k-flat\"
|
|
8047
|
+
template: "\n <div class=\"k-vstack\">\n <button #toggleFormatButton\n class=\"k-colorgradient-toggle-mode k-button k-icon-button k-flat\"\n [attr.aria-label]=\"formatButtonTitle\"\n [attr.title]=\"formatButtonTitle\"\n >\n <span class=\"k-button-icon k-icon k-i-arrows-kpi\"></span>\n </button>\n </div>\n <div *ngIf=\"formatView === 'hex'\" class=\"k-vstack\">\n <input\n #hexInput\n [id]=\"focusableId\"\n class=\"k-textbox k-hex-value\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly\"\n [value]=\"hex || ''\"\n (blur)=\"handleHexInputBlur()\"\n (input)=\"handleHexValueChange(hexInput.value)\"\n />\n <label [for]=\"focusableId\" class=\"k-colorgradient-input-label\">HEX</label>\n </div>\n <ng-container *ngIf=\"formatView === 'rgba'\">\n <div class=\"k-vstack\">\n <kendo-numerictextbox\n #red\n [disabled]=\"disabled\"\n [readonly]=\"readonly\"\n [min]=\"0\"\n [max]=\"255\"\n [(value)]=\"rgba.r\"\n [autoCorrect]=\"true\"\n [spinners]=\"false\"\n [format]=\"'n'\"\n [decimals]=\"0\"\n (blur)=\"handleRgbaInputBlur()\"\n (valueChange)=\"handleRgbaValueChange()\">\n </kendo-numerictextbox>\n <label [for]=\"red.focusableId\" class=\"k-colorgradient-input-label\">R</label>\n </div>\n <div class=\"k-vstack\">\n <kendo-numerictextbox\n #green\n [disabled]=\"disabled\"\n [readonly]=\"readonly\"\n [min]=\"0\"\n [max]=\"255\"\n [(value)]=\"rgba.g\"\n [autoCorrect]=\"true\"\n [spinners]=\"false\"\n [format]=\"'n'\"\n [decimals]=\"0\"\n (blur)=\"handleRgbaInputBlur()\"\n (valueChange)=\"handleRgbaValueChange()\">\n </kendo-numerictextbox>\n <label [for]=\"green.focusableId\" class=\"k-colorgradient-input-label\">G</label>\n </div>\n <div class=\"k-vstack\">\n <kendo-numerictextbox\n #blue\n [disabled]=\"disabled\"\n [readonly]=\"readonly\"\n [min]=\"0\"\n [max]=\"255\"\n [(value)]=\"rgba.b\"\n [autoCorrect]=\"true\"\n [spinners]=\"false\"\n [format]=\"'n'\"\n [decimals]=\"0\"\n (blur)=\"handleRgbaInputBlur()\"\n (valueChange)=\"handleRgbaValueChange()\">\n </kendo-numerictextbox>\n <label [for]=\"blue.focusableId\" class=\"k-colorgradient-input-label\">B</label>\n </div>\n <div class=\"k-vstack\" *ngIf=\"opacity\">\n <kendo-numerictextbox #opacityInput\n #alpha\n [disabled]=\"disabled\"\n [readonly]=\"readonly\"\n [min]=\"0\"\n [max]=\"1\"\n [(value)]=\"rgba.a\"\n [autoCorrect]=\"true\"\n [spinners]=\"false\"\n [step]=\"0.01\"\n [format]=\"'n2'\"\n [decimals]=\"2\"\n (blur)=\"handleRgbaInputBlur()\"\n (valueChange)=\"handleRgbaValueChange()\">\n </kendo-numerictextbox>\n <label [for]=\"alpha.focusableId\" class=\"k-colorgradient-input-label\">A</label>\n </div>\n </ng-container>\n "
|
|
7823
8048
|
}),
|
|
7824
|
-
__metadata("design:paramtypes", [
|
|
7825
|
-
|
|
7826
|
-
|
|
8049
|
+
__metadata("design:paramtypes", [ElementRef,
|
|
8050
|
+
Renderer2,
|
|
8051
|
+
LocalizationService])
|
|
7827
8052
|
], ColorInputComponent);
|
|
7828
8053
|
return ColorInputComponent;
|
|
7829
8054
|
}());
|
|
7830
8055
|
|
|
7831
|
-
/**
|
|
7832
|
-
* @hidden
|
|
7833
|
-
*/
|
|
7834
|
-
var DEFAULT_OUTPUT_FORMAT = 'rgba';
|
|
7835
|
-
/**
|
|
7836
|
-
* @hidden
|
|
7837
|
-
*/
|
|
7838
|
-
var DEFAULT_GRADIENT_BACKGROUND_COLOR = 'rgba(255, 0, 0, 1)';
|
|
7839
|
-
/**
|
|
7840
|
-
* @hidden
|
|
7841
|
-
*/
|
|
7842
|
-
var DRAGHANDLE_MOVE_SPEED = 5;
|
|
7843
|
-
/**
|
|
7844
|
-
* @hidden
|
|
7845
|
-
*/
|
|
7846
|
-
var AAA_RATIO = 7.0;
|
|
7847
|
-
/**
|
|
7848
|
-
* @hidden
|
|
7849
|
-
*/
|
|
7850
|
-
var AA_RATIO = 4.5;
|
|
7851
|
-
|
|
7852
8056
|
var serial = 0;
|
|
7853
8057
|
/**
|
|
7854
8058
|
* The ColorGradient component enables smooth color transitions and provides options for selecting specific colors over the drag handle.
|
|
@@ -7862,9 +8066,6 @@ var ColorGradientComponent = /** @class */ (function () {
|
|
|
7862
8066
|
this.renderer = renderer;
|
|
7863
8067
|
this.cdr = cdr;
|
|
7864
8068
|
this.localizationService = localizationService;
|
|
7865
|
-
/**
|
|
7866
|
-
* @hidden
|
|
7867
|
-
*/
|
|
7868
8069
|
this.hostClasses = true;
|
|
7869
8070
|
/**
|
|
7870
8071
|
* @hidden
|
|
@@ -7872,18 +8073,26 @@ var ColorGradientComponent = /** @class */ (function () {
|
|
|
7872
8073
|
this.id = "k-colorgradient-" + serial++;
|
|
7873
8074
|
/**
|
|
7874
8075
|
* Defines whether the alpha slider will be displayed.
|
|
8076
|
+
*
|
|
8077
|
+
* @default true
|
|
7875
8078
|
*/
|
|
7876
8079
|
this.opacity = true;
|
|
7877
8080
|
/**
|
|
7878
8081
|
* Sets the disabled state of the ColorGradient.
|
|
8082
|
+
*
|
|
8083
|
+
* @default false
|
|
7879
8084
|
*/
|
|
7880
8085
|
this.disabled = false;
|
|
7881
8086
|
/**
|
|
7882
8087
|
* Sets the read-only state of the ColorGradient.
|
|
8088
|
+
*
|
|
8089
|
+
* @default false
|
|
7883
8090
|
*/
|
|
7884
8091
|
this.readonly = false;
|
|
7885
8092
|
/**
|
|
7886
8093
|
* Specifies whether the ColorGradient should display a 'Clear color' button.
|
|
8094
|
+
*
|
|
8095
|
+
* @default false
|
|
7887
8096
|
*/
|
|
7888
8097
|
this.clearButton = false;
|
|
7889
8098
|
/**
|
|
@@ -7892,6 +8101,16 @@ var ColorGradientComponent = /** @class */ (function () {
|
|
|
7892
8101
|
* @default 0
|
|
7893
8102
|
*/
|
|
7894
8103
|
this.delay = 0;
|
|
8104
|
+
/**
|
|
8105
|
+
* Specifies the output format of the ColorGradientComponent.
|
|
8106
|
+
* The input value may be in a different format, but it will be parsed into the output `format`
|
|
8107
|
+
* after the component processes it.
|
|
8108
|
+
*
|
|
8109
|
+
* The supported values are:
|
|
8110
|
+
* * (Default) `rgba`
|
|
8111
|
+
* * `hex`
|
|
8112
|
+
*/
|
|
8113
|
+
this.format = DEFAULT_OUTPUT_FORMAT;
|
|
7895
8114
|
/**
|
|
7896
8115
|
* Fires each time the user selects a new color.
|
|
7897
8116
|
*/
|
|
@@ -7907,17 +8126,7 @@ var ColorGradientComponent = /** @class */ (function () {
|
|
|
7907
8126
|
* The values are initially set in `ngOnInit` or in `ngOnChanges` and are
|
|
7908
8127
|
* updated on moving the drag handle or the sliders.
|
|
7909
8128
|
*/
|
|
7910
|
-
this.hsva = {};
|
|
7911
|
-
/**
|
|
7912
|
-
* Specifies the output format of the ColorGradientComponent.
|
|
7913
|
-
* The input value may be in a different format. However, it will be parsed into the output `format`
|
|
7914
|
-
* after the component processes it.
|
|
7915
|
-
*
|
|
7916
|
-
* The supported values are:
|
|
7917
|
-
* * (Default) `rgba`
|
|
7918
|
-
* * `hex`
|
|
7919
|
-
*/
|
|
7920
|
-
this.format = DEFAULT_OUTPUT_FORMAT;
|
|
8129
|
+
this.hsva = new BehaviorSubject({});
|
|
7921
8130
|
this._tabindex = 0;
|
|
7922
8131
|
this.listeners = [];
|
|
7923
8132
|
this.updateValues = new Subject();
|
|
@@ -7930,9 +8139,6 @@ var ColorGradientComponent = /** @class */ (function () {
|
|
|
7930
8139
|
}
|
|
7931
8140
|
ColorGradientComponent_1 = ColorGradientComponent;
|
|
7932
8141
|
Object.defineProperty(ColorGradientComponent.prototype, "readonlyAttribute", {
|
|
7933
|
-
/**
|
|
7934
|
-
* @hidden
|
|
7935
|
-
*/
|
|
7936
8142
|
get: function () {
|
|
7937
8143
|
return this.readonly;
|
|
7938
8144
|
},
|
|
@@ -7940,31 +8146,22 @@ var ColorGradientComponent = /** @class */ (function () {
|
|
|
7940
8146
|
configurable: true
|
|
7941
8147
|
});
|
|
7942
8148
|
Object.defineProperty(ColorGradientComponent.prototype, "disabledClass", {
|
|
7943
|
-
/**
|
|
7944
|
-
* @hidden
|
|
7945
|
-
*/
|
|
7946
8149
|
get: function () {
|
|
7947
8150
|
return this.disabled;
|
|
7948
8151
|
},
|
|
7949
8152
|
enumerable: true,
|
|
7950
8153
|
configurable: true
|
|
7951
8154
|
});
|
|
7952
|
-
Object.defineProperty(ColorGradientComponent.prototype, "
|
|
7953
|
-
/**
|
|
7954
|
-
* @hidden
|
|
7955
|
-
*/
|
|
8155
|
+
Object.defineProperty(ColorGradientComponent.prototype, "gradientId", {
|
|
7956
8156
|
get: function () {
|
|
7957
|
-
return this.
|
|
8157
|
+
return this.id;
|
|
7958
8158
|
},
|
|
7959
8159
|
enumerable: true,
|
|
7960
8160
|
configurable: true
|
|
7961
8161
|
});
|
|
7962
|
-
Object.defineProperty(ColorGradientComponent.prototype, "
|
|
7963
|
-
/**
|
|
7964
|
-
* @hidden
|
|
7965
|
-
*/
|
|
8162
|
+
Object.defineProperty(ColorGradientComponent.prototype, "hostTabindex", {
|
|
7966
8163
|
get: function () {
|
|
7967
|
-
return this.
|
|
8164
|
+
return this.tabindex;
|
|
7968
8165
|
},
|
|
7969
8166
|
enumerable: true,
|
|
7970
8167
|
configurable: true
|
|
@@ -7977,7 +8174,21 @@ var ColorGradientComponent = /** @class */ (function () {
|
|
|
7977
8174
|
* Specifies the value of the initially selected color.
|
|
7978
8175
|
*/
|
|
7979
8176
|
set: function (value) {
|
|
7980
|
-
this._value = parseColor$1(value, this.format);
|
|
8177
|
+
this._value = parseColor$1(value, this.format, this.opacity);
|
|
8178
|
+
},
|
|
8179
|
+
enumerable: true,
|
|
8180
|
+
configurable: true
|
|
8181
|
+
});
|
|
8182
|
+
Object.defineProperty(ColorGradientComponent.prototype, "contrastTool", {
|
|
8183
|
+
get: function () {
|
|
8184
|
+
return this._contrastTool;
|
|
8185
|
+
},
|
|
8186
|
+
/**
|
|
8187
|
+
* Enables the color contrast tool. Accepts the background color that will be compared to the selected value.
|
|
8188
|
+
* The tool will calculate the contrast ratio between the two colors.
|
|
8189
|
+
*/
|
|
8190
|
+
set: function (value) {
|
|
8191
|
+
this._contrastTool = parseColor$1(value, this.format, this.opacity);
|
|
7981
8192
|
},
|
|
7982
8193
|
enumerable: true,
|
|
7983
8194
|
configurable: true
|
|
@@ -7988,11 +8199,18 @@ var ColorGradientComponent = /** @class */ (function () {
|
|
|
7988
8199
|
},
|
|
7989
8200
|
/**
|
|
7990
8201
|
* Specifies the [tabindex](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the component.
|
|
8202
|
+
*
|
|
8203
|
+
* @default 0
|
|
7991
8204
|
*/
|
|
7992
8205
|
set: function (value) {
|
|
7993
|
-
|
|
7994
|
-
|
|
7995
|
-
|
|
8206
|
+
if (isPresent(value)) {
|
|
8207
|
+
var tabindex = Number(value);
|
|
8208
|
+
this._tabindex = !isNaN(tabindex) ? tabindex : 0;
|
|
8209
|
+
}
|
|
8210
|
+
else {
|
|
8211
|
+
// Allows removal of the tabindex attribute
|
|
8212
|
+
this._tabindex = value;
|
|
8213
|
+
}
|
|
7996
8214
|
},
|
|
7997
8215
|
enumerable: true,
|
|
7998
8216
|
configurable: true
|
|
@@ -8016,10 +8234,10 @@ var ColorGradientComponent = /** @class */ (function () {
|
|
|
8016
8234
|
*/
|
|
8017
8235
|
get: function () {
|
|
8018
8236
|
// setting the initial value to undefined to force the slider to recalculate the height of the slider track on the next cdr run
|
|
8019
|
-
if (!(isPresent(this.hsva) && isPresent(this.hsva.a))) {
|
|
8237
|
+
if (!(isPresent(this.hsva.value) && isPresent(this.hsva.value.a))) {
|
|
8020
8238
|
return;
|
|
8021
8239
|
}
|
|
8022
|
-
return this.hsva.a * 100;
|
|
8240
|
+
return this.hsva.value.a * 100;
|
|
8023
8241
|
},
|
|
8024
8242
|
enumerable: true,
|
|
8025
8243
|
configurable: true
|
|
@@ -8036,7 +8254,7 @@ var ColorGradientComponent = /** @class */ (function () {
|
|
|
8036
8254
|
* @hidden
|
|
8037
8255
|
*/
|
|
8038
8256
|
get: function () {
|
|
8039
|
-
return
|
|
8257
|
+
return this.contrastTool && this.contrastTool.length > 0;
|
|
8040
8258
|
},
|
|
8041
8259
|
enumerable: true,
|
|
8042
8260
|
configurable: true
|
|
@@ -8070,7 +8288,7 @@ var ColorGradientComponent = /** @class */ (function () {
|
|
|
8070
8288
|
if (this.disabled) {
|
|
8071
8289
|
return;
|
|
8072
8290
|
}
|
|
8073
|
-
this.
|
|
8291
|
+
this.gradientDragHandle.nativeElement.focus();
|
|
8074
8292
|
};
|
|
8075
8293
|
/**
|
|
8076
8294
|
* @hidden
|
|
@@ -8108,7 +8326,7 @@ var ColorGradientComponent = /** @class */ (function () {
|
|
|
8108
8326
|
return;
|
|
8109
8327
|
}
|
|
8110
8328
|
this.renderer.removeClass(this.gradientWrapper.nativeElement, 'k-dragging');
|
|
8111
|
-
this.handleValueChange(getColorFromHSV(this.hsva));
|
|
8329
|
+
this.handleValueChange(getColorFromHSV(this.hsva.value, this.format, this.opacity));
|
|
8112
8330
|
};
|
|
8113
8331
|
/**
|
|
8114
8332
|
* @hidden
|
|
@@ -8155,15 +8373,19 @@ var ColorGradientComponent = /** @class */ (function () {
|
|
|
8155
8373
|
return;
|
|
8156
8374
|
}
|
|
8157
8375
|
this.gradientDragHandle.nativeElement.focus();
|
|
8158
|
-
var
|
|
8159
|
-
var
|
|
8376
|
+
var gradientRect = this.gradientRect;
|
|
8377
|
+
var newX = position.clientX - gradientRect.left;
|
|
8378
|
+
var newY = position.clientY - gradientRect.top;
|
|
8160
8379
|
this.ngZone.run(function () { return _this.moveDragHandle(newX, newY); });
|
|
8161
8380
|
};
|
|
8162
8381
|
/**
|
|
8163
8382
|
* @hidden
|
|
8164
8383
|
*/
|
|
8165
8384
|
ColorGradientComponent.prototype.handleHueSliderChange = function (hue) {
|
|
8166
|
-
this.
|
|
8385
|
+
var hsva = this.hsva.value;
|
|
8386
|
+
hsva.h = hue;
|
|
8387
|
+
this.hsva.next(hsva);
|
|
8388
|
+
this.handleValueChange(getColorFromHSV(this.hsva.value, this.format, this.opacity));
|
|
8167
8389
|
this.backgroundColor = getColorFromHue(hue);
|
|
8168
8390
|
this.setAlphaSliderBackground(this.backgroundColor);
|
|
8169
8391
|
};
|
|
@@ -8171,14 +8393,16 @@ var ColorGradientComponent = /** @class */ (function () {
|
|
|
8171
8393
|
* @hidden
|
|
8172
8394
|
*/
|
|
8173
8395
|
ColorGradientComponent.prototype.handleAlphaSliderChange = function (alpha) {
|
|
8174
|
-
this.hsva.
|
|
8175
|
-
|
|
8396
|
+
var hsva = this.hsva.value;
|
|
8397
|
+
hsva.a = alpha / 100;
|
|
8398
|
+
this.hsva.next(hsva);
|
|
8399
|
+
this.handleValueChange(getColorFromHSV(this.hsva.value, this.format, this.opacity));
|
|
8176
8400
|
};
|
|
8177
8401
|
/**
|
|
8178
8402
|
* @hidden
|
|
8179
8403
|
*/
|
|
8180
8404
|
ColorGradientComponent.prototype.handleInputsValueChange = function (color) {
|
|
8181
|
-
var parsed = parseColor$1(color, this.format);
|
|
8405
|
+
var parsed = parseColor$1(color, this.format, this.opacity);
|
|
8182
8406
|
if (this.value !== parsed) {
|
|
8183
8407
|
this.handleValueChange(parsed);
|
|
8184
8408
|
this.updateUI();
|
|
@@ -8227,7 +8451,7 @@ var ColorGradientComponent = /** @class */ (function () {
|
|
|
8227
8451
|
* @hidden
|
|
8228
8452
|
*/
|
|
8229
8453
|
get: function () {
|
|
8230
|
-
var parsed = parseColor$1(this.value, this.format);
|
|
8454
|
+
var parsed = parseColor$1(this.value, this.format, this.opacity);
|
|
8231
8455
|
return "" + (this.value ? parsed : this.localizationService.get('colorGradientHandle'));
|
|
8232
8456
|
},
|
|
8233
8457
|
enumerable: true,
|
|
@@ -8265,29 +8489,35 @@ var ColorGradientComponent = /** @class */ (function () {
|
|
|
8265
8489
|
});
|
|
8266
8490
|
/**
|
|
8267
8491
|
* @hidden
|
|
8268
|
-
* Used by the
|
|
8492
|
+
* Used by the FloatingLabel to determine if the component is empty.
|
|
8269
8493
|
*/
|
|
8270
8494
|
ColorGradientComponent.prototype.isEmpty = function () {
|
|
8271
8495
|
return false;
|
|
8272
8496
|
};
|
|
8273
8497
|
ColorGradientComponent.prototype.moveDragHandle = function (positionX, positionY) {
|
|
8274
|
-
var
|
|
8275
|
-
var
|
|
8498
|
+
var gradientRect = this.gradientRect;
|
|
8499
|
+
var gradientRectWidth = gradientRect.width;
|
|
8500
|
+
var gradientRectHeight = gradientRect.height;
|
|
8501
|
+
var top = fitIntoBounds(positionY, 0, gradientRectHeight);
|
|
8502
|
+
var left = fitIntoBounds(positionX, 0, gradientRectWidth);
|
|
8276
8503
|
this.setDragHandleElementPosition(top, left);
|
|
8277
|
-
|
|
8278
|
-
|
|
8279
|
-
|
|
8280
|
-
this.
|
|
8504
|
+
var hsva = this.hsva.value;
|
|
8505
|
+
hsva.s = left / gradientRectWidth;
|
|
8506
|
+
hsva.v = 1 - top / gradientRectHeight;
|
|
8507
|
+
this.hsva.next(hsva);
|
|
8508
|
+
this.updateValues.next(getColorFromHSV(this.hsva.value, this.format, this.opacity));
|
|
8509
|
+
this.setAlphaSliderBackground(getColorFromHSV(__assign({}, this.hsva.value, { a: 1 }), this.format, this.opacity));
|
|
8281
8510
|
};
|
|
8282
8511
|
ColorGradientComponent.prototype.updateUI = function () {
|
|
8283
8512
|
if (!isDocumentAvailable()) {
|
|
8284
8513
|
return;
|
|
8285
8514
|
}
|
|
8286
|
-
this.hsva
|
|
8287
|
-
var
|
|
8288
|
-
var
|
|
8515
|
+
this.hsva.next(this.value ? getHSV(this.value) : { h: 0, s: 0, v: 1, a: 1 });
|
|
8516
|
+
var gradientRect = this.gradientRect;
|
|
8517
|
+
var top = (1 - this.hsva.value.v) * gradientRect.height;
|
|
8518
|
+
var left = this.hsva.value.s * gradientRect.width;
|
|
8289
8519
|
this.setDragHandleElementPosition(top, left);
|
|
8290
|
-
this.backgroundColor = getColorFromHue(this.hsva.h);
|
|
8520
|
+
this.backgroundColor = getColorFromHue(this.hsva.value.h);
|
|
8291
8521
|
this.setAlphaSliderBackground(this.backgroundColor);
|
|
8292
8522
|
this.setHostElementAriaLabel();
|
|
8293
8523
|
};
|
|
@@ -8313,7 +8543,7 @@ var ColorGradientComponent = /** @class */ (function () {
|
|
|
8313
8543
|
this.renderer.setStyle(sliderTrack, 'background', "linear-gradient(to top, transparent, " + backgroundColor + ")");
|
|
8314
8544
|
};
|
|
8315
8545
|
ColorGradientComponent.prototype.setHostElementAriaLabel = function () {
|
|
8316
|
-
var parsed = parseColor$1(this.value, this.format);
|
|
8546
|
+
var parsed = parseColor$1(this.value, this.format, this.opacity);
|
|
8317
8547
|
this.renderer.setAttribute(this.host.nativeElement, 'aria-label', "" + (this.value ? parsed : this.localizationService.get('colorGradientNoColor')));
|
|
8318
8548
|
};
|
|
8319
8549
|
ColorGradientComponent.prototype.addEventListeners = function () {
|
|
@@ -8330,7 +8560,7 @@ var ColorGradientComponent = /** @class */ (function () {
|
|
|
8330
8560
|
var keyupListener = _this.renderer.listen(_this.gradientDragHandle.nativeElement, 'keyup', function () {
|
|
8331
8561
|
_this.renderer.removeClass(_this.gradientWrapper.nativeElement, 'k-dragging');
|
|
8332
8562
|
if (!_this.readonly && !_this.disabled) {
|
|
8333
|
-
_this.ngZone.run(function () { return _this.handleValueChange(getColorFromHSV(_this.hsva)); });
|
|
8563
|
+
_this.ngZone.run(function () { return _this.handleValueChange(getColorFromHSV(_this.hsva.value, _this.format, _this.opacity)); });
|
|
8334
8564
|
}
|
|
8335
8565
|
});
|
|
8336
8566
|
var dragHandleFocusInListener = _this.renderer.listen(_this.gradientDragHandle.nativeElement, 'focusin', function () {
|
|
@@ -8368,24 +8598,24 @@ var ColorGradientComponent = /** @class */ (function () {
|
|
|
8368
8598
|
__metadata("design:type", Boolean),
|
|
8369
8599
|
__metadata("design:paramtypes", [])
|
|
8370
8600
|
], ColorGradientComponent.prototype, "disabledClass", null);
|
|
8371
|
-
__decorate([
|
|
8372
|
-
HostBinding('attr.tabindex'),
|
|
8373
|
-
__metadata("design:type", Number),
|
|
8374
|
-
__metadata("design:paramtypes", [])
|
|
8375
|
-
], ColorGradientComponent.prototype, "hostTabindex", null);
|
|
8376
8601
|
__decorate([
|
|
8377
8602
|
HostBinding('attr.id'),
|
|
8378
8603
|
__metadata("design:type", String),
|
|
8379
8604
|
__metadata("design:paramtypes", [])
|
|
8380
8605
|
], ColorGradientComponent.prototype, "gradientId", null);
|
|
8381
|
-
__decorate([
|
|
8382
|
-
Input(),
|
|
8383
|
-
__metadata("design:type", String)
|
|
8384
|
-
], ColorGradientComponent.prototype, "id", void 0);
|
|
8385
8606
|
__decorate([
|
|
8386
8607
|
HostBinding('attr.dir'),
|
|
8387
8608
|
__metadata("design:type", String)
|
|
8388
8609
|
], ColorGradientComponent.prototype, "direction", void 0);
|
|
8610
|
+
__decorate([
|
|
8611
|
+
HostBinding('attr.tabindex'),
|
|
8612
|
+
__metadata("design:type", Number),
|
|
8613
|
+
__metadata("design:paramtypes", [])
|
|
8614
|
+
], ColorGradientComponent.prototype, "hostTabindex", null);
|
|
8615
|
+
__decorate([
|
|
8616
|
+
Input(),
|
|
8617
|
+
__metadata("design:type", String)
|
|
8618
|
+
], ColorGradientComponent.prototype, "id", void 0);
|
|
8389
8619
|
__decorate([
|
|
8390
8620
|
Input(),
|
|
8391
8621
|
__metadata("design:type", Boolean)
|
|
@@ -8413,21 +8643,22 @@ var ColorGradientComponent = /** @class */ (function () {
|
|
|
8413
8643
|
], ColorGradientComponent.prototype, "value", null);
|
|
8414
8644
|
__decorate([
|
|
8415
8645
|
Input(),
|
|
8416
|
-
__metadata("design:type", String)
|
|
8417
|
-
|
|
8646
|
+
__metadata("design:type", String),
|
|
8647
|
+
__metadata("design:paramtypes", [String])
|
|
8648
|
+
], ColorGradientComponent.prototype, "contrastTool", null);
|
|
8418
8649
|
__decorate([
|
|
8419
8650
|
Input(),
|
|
8420
8651
|
__metadata("design:type", Number),
|
|
8421
8652
|
__metadata("design:paramtypes", [Number])
|
|
8422
8653
|
], ColorGradientComponent.prototype, "tabindex", null);
|
|
8423
|
-
__decorate([
|
|
8424
|
-
Output(),
|
|
8425
|
-
__metadata("design:type", EventEmitter)
|
|
8426
|
-
], ColorGradientComponent.prototype, "valueChange", void 0);
|
|
8427
8654
|
__decorate([
|
|
8428
8655
|
Input(),
|
|
8429
8656
|
__metadata("design:type", String)
|
|
8430
8657
|
], ColorGradientComponent.prototype, "format", void 0);
|
|
8658
|
+
__decorate([
|
|
8659
|
+
Output(),
|
|
8660
|
+
__metadata("design:type", EventEmitter)
|
|
8661
|
+
], ColorGradientComponent.prototype, "valueChange", void 0);
|
|
8431
8662
|
__decorate([
|
|
8432
8663
|
ViewChild('gradientDragHandle', { read: ElementRef, static: false }),
|
|
8433
8664
|
__metadata("design:type", ElementRef)
|
|
@@ -8446,6 +8677,7 @@ var ColorGradientComponent = /** @class */ (function () {
|
|
|
8446
8677
|
], ColorGradientComponent.prototype, "gradientWrapper", void 0);
|
|
8447
8678
|
ColorGradientComponent = ColorGradientComponent_1 = __decorate([
|
|
8448
8679
|
Component({
|
|
8680
|
+
exportAs: 'kendoColorGradient',
|
|
8449
8681
|
selector: 'kendo-colorgradient',
|
|
8450
8682
|
providers: [
|
|
8451
8683
|
{
|
|
@@ -8467,8 +8699,8 @@ var ColorGradientComponent = /** @class */ (function () {
|
|
|
8467
8699
|
useValue: 'kendo.colorgradient'
|
|
8468
8700
|
}
|
|
8469
8701
|
],
|
|
8470
|
-
template: "\n <ng-container kendoColorGradientLocalizedMessages\n i18n-colorGradientNoColor=\"kendo.colorgradient.colorGradientNoColor|The aria-label applied to the ColorGradient component when the value is empty.\"\n colorGradientNoColor=\"Colorgradient no color chosen\"\n i18n-colorGradientHandle=\"kendo.colorgradient.colorGradientHandle|The title for the gradient color drag handle chooser.\"\n colorGradientHandle=\"Choose color\"\n i18n-clearButton=\"kendo.colorgradient.clearButton|The title for the clear button.\"\n clearButton=\"Clear value\"\n i18n-hueSliderHandle=\"kendo.colorgradient.hueSliderHandle|The title for the hue slider handle.\"\n hueSliderHandle=\"Set hue\"\n i18n-opacitySliderHandle=\"kendo.colorgradient.opacitySliderHandle|The title for the opacity slider handle.\"\n opacitySliderHandle=\"Set opacity\"\n i18n-
|
|
8471
|
-
styles: ["\n .k-clear-color {\n position: absolute;\n left: 50%;\n transform: translateX(-50%);\n }\n .k-align-self-end {\n height: 140px;\n }\n "]
|
|
8702
|
+
template: "\n <ng-container kendoColorGradientLocalizedMessages\n i18n-colorGradientNoColor=\"kendo.colorgradient.colorGradientNoColor|The aria-label applied to the ColorGradient component when the value is empty.\"\n colorGradientNoColor=\"Colorgradient no color chosen\"\n i18n-colorGradientHandle=\"kendo.colorgradient.colorGradientHandle|The title for the gradient color drag handle chooser.\"\n colorGradientHandle=\"Choose color\"\n i18n-clearButton=\"kendo.colorgradient.clearButton|The title for the clear button.\"\n clearButton=\"Clear value\"\n i18n-hueSliderHandle=\"kendo.colorgradient.hueSliderHandle|The title for the hue slider handle.\"\n hueSliderHandle=\"Set hue\"\n i18n-opacitySliderHandle=\"kendo.colorgradient.opacitySliderHandle|The title for the opacity slider handle.\"\n opacitySliderHandle=\"Set opacity\"\n i18n-passContrast=\"kendo.colorgradient.passContrast|The pass message for the contrast tool.\"\n passContrast=\"Pass\"\n i18n-failContrast=\"kendo.colorgradient.failContrast|The fail message for the contrast tool.\"\n failContrast=\"Fail\"\n i18n-contrastRatio=\"kendo.colorgradient.contrastRatio|The contrast ratio message for the contrast tool.\"\n contrastRatio=\"Contrast ratio\"\n i18n-formatButton=\"kendo.colorgradient.formatButton|The message for the input format toggle button.\"\n formatButton=\"Change color format\">\n </ng-container>\n <div class=\"k-colorgradient-canvas k-hstack\">\n <div class=\"k-hsv-rectangle\" [style.background]=\"backgroundColor\">\n <div\n #gradientWrapper\n kendoDraggable\n class=\"k-hsv-gradient\"\n (click)=\"changePosition($event)\"\n (kendoPress)=\"handleDragPress($event)\"\n (kendoDrag)=\"onHandleDrag($event)\"\n (kendoRelease)=\"onHandleRelease()\">\n <div\n #gradientDragHandle\n class=\"k-hsv-draghandle k-draghandle\"\n tabindex=\"0\"\n [attr.title]=\"colorGradientHandleTitle\"\n [attr.aria-label]=\"colorGradientHandleAriaLabel\"\n >\n </div>\n </div>\n <svg kendoColorContrastSvg\n *ngIf=\"contrastToolVisible && gradientWrapper\"\n class=\"k-color-contrast-svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n [wrapper]=\"gradientWrapper ? gradientWrapper : undefined\"\n [hsva]=\"hsva\"\n [backgroundColor]=\"contrastTool\">\n </svg>\n </div>\n <div class=\"k-hsv-controls k-hstack {{ clearButton ? 'k-sliders-wrap-clearable' : '' }}\">\n <span class=\"k-clear-color k-button k-flat k-button-icon\"\n *ngIf=\"clearButton\"\n (click)=\"reset()\"\n (keydown.enter)=\"reset()\"\n (keydown.space)=\"reset()\"\n [attr.aria-label]=\"clearButtonTitle\"\n [attr.title]=\"clearButtonTitle\"\n tabindex=\"0\">\n <span class=\"k-icon k-i-reset-color\"></span>\n </span>\n <kendo-slider\n [ngClass]=\"{'k-align-self-end': clearButton}\"\n class=\"k-hue-slider k-colorgradient-slider\"\n [dragHandleTitle]=\"hueSliderTitle\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly\"\n [showButtons]=\"false\"\n [tickPlacement]=\"'none'\"\n [vertical]=\"true\"\n [min]=\"0\"\n [max]=\"360\"\n [smallStep]=\"5\"\n [largeStep]=\"10\"\n [value]=\"hsva.value.h\"\n (valueChange)=\"handleHueSliderChange($event)\"\n >\n </kendo-slider>\n <kendo-slider\n *ngIf=\"opacity\"\n #alphaSlider\n [ngClass]=\"{'k-align-self-end': clearButton}\"\n class=\"k-alpha-slider k-colorgradient-slider\"\n [dragHandleTitle]=\"opacitySliderTitle\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly\"\n [showButtons]=\"false\"\n [tickPlacement]=\"'none'\"\n [vertical]=\"true\"\n [min]=\"0\"\n [max]=\"100\"\n [smallStep]=\"1\"\n [largeStep]=\"10\"\n [value]=\"alphaSliderValue\"\n (valueChange)=\"handleAlphaSliderChange($event)\"\n >\n </kendo-slider>\n </div>\n </div>\n <kendo-colorinput #inputs\n [opacity]=\"opacity\"\n [formatView]=\"format\"\n [value]=\"value\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly\"\n (valueChange)=\"handleInputsValueChange($event)\"\n >\n </kendo-colorinput>\n <div class=\"k-colorgradient-color-contrast k-vbox\" *ngIf=\"contrastToolVisible\"\n kendoContrastTool\n [value]=\"value\"\n [ratio]=\"contrastTool\">\n </div>\n ",
|
|
8703
|
+
styles: ["\n .k-clear-color {\n position: absolute;\n top: 0;\n left: 50%;\n transform: translateX(-50%);\n }\n .k-colorgradient-slider.k-align-self-end {\n height: 140px;\n }\n\n .k-color-contrast-svg {\n position: absolute;\n overflow: visible;\n pointer-events: none;\n left: 0px;\n top: 0px;\n }\n "]
|
|
8472
8704
|
}),
|
|
8473
8705
|
__metadata("design:paramtypes", [ElementRef,
|
|
8474
8706
|
NgZone,
|
|
@@ -8479,148 +8711,237 @@ var ColorGradientComponent = /** @class */ (function () {
|
|
|
8479
8711
|
return ColorGradientComponent;
|
|
8480
8712
|
}());
|
|
8481
8713
|
|
|
8482
|
-
|
|
8483
|
-
|
|
8714
|
+
/**
|
|
8715
|
+
* @hidden
|
|
8716
|
+
*/
|
|
8717
|
+
var ColorPaletteService = /** @class */ (function () {
|
|
8718
|
+
function ColorPaletteService() {
|
|
8719
|
+
this.colorRows = [];
|
|
8720
|
+
}
|
|
8721
|
+
ColorPaletteService.prototype.setColorMatrix = function (palette, columns) {
|
|
8722
|
+
this.colorRows = [];
|
|
8723
|
+
if (!(isPresent(palette) && palette.length)) {
|
|
8724
|
+
return;
|
|
8725
|
+
}
|
|
8726
|
+
columns = columns || palette.length;
|
|
8727
|
+
for (var start = 0; start < palette.length; start += columns) {
|
|
8728
|
+
var row = palette.slice(start, columns + start);
|
|
8729
|
+
this.colorRows.push(row);
|
|
8730
|
+
}
|
|
8731
|
+
};
|
|
8732
|
+
ColorPaletteService.prototype.getCellCoordsFor = function (color) {
|
|
8733
|
+
if (!isPresent(color)) {
|
|
8734
|
+
return;
|
|
8735
|
+
}
|
|
8736
|
+
for (var row = 0; row < this.colorRows.length; row++) {
|
|
8737
|
+
for (var col = 0; col < this.colorRows[row].length; col++) {
|
|
8738
|
+
if (this.colorRows[row][col] === color) {
|
|
8739
|
+
return { row: row, col: col };
|
|
8740
|
+
}
|
|
8741
|
+
}
|
|
8742
|
+
}
|
|
8743
|
+
};
|
|
8744
|
+
ColorPaletteService.prototype.getColorAt = function (cellCoords) {
|
|
8745
|
+
if (!(isPresent(cellCoords) && isPresent(this.colorRows[cellCoords.row]))) {
|
|
8746
|
+
return;
|
|
8747
|
+
}
|
|
8748
|
+
return this.colorRows[cellCoords.row][cellCoords.col];
|
|
8749
|
+
};
|
|
8750
|
+
ColorPaletteService.prototype.getNextCell = function (current, horizontalStep, verticalStep) {
|
|
8751
|
+
if (!(isPresent(current) && isPresent(current.row) && isPresent(current.col))) {
|
|
8752
|
+
return { row: 0, col: 0 };
|
|
8753
|
+
}
|
|
8754
|
+
var row = this.clampIndex(current.row + verticalStep, this.colorRows.length - 1);
|
|
8755
|
+
var col = this.clampIndex(current.col + horizontalStep, this.colorRows[row].length - 1);
|
|
8756
|
+
return { row: row, col: col };
|
|
8757
|
+
};
|
|
8758
|
+
ColorPaletteService.prototype.clampIndex = function (index, max) {
|
|
8759
|
+
var minArrayIndex = 0;
|
|
8760
|
+
if (index < minArrayIndex) {
|
|
8761
|
+
return minArrayIndex;
|
|
8762
|
+
}
|
|
8763
|
+
if (index > max) {
|
|
8764
|
+
return max;
|
|
8765
|
+
}
|
|
8766
|
+
return index;
|
|
8767
|
+
};
|
|
8768
|
+
ColorPaletteService = __decorate([
|
|
8769
|
+
Injectable()
|
|
8770
|
+
], ColorPaletteService);
|
|
8771
|
+
return ColorPaletteService;
|
|
8772
|
+
}());
|
|
8773
|
+
|
|
8774
|
+
/**
|
|
8775
|
+
* @hidden
|
|
8776
|
+
*/
|
|
8777
|
+
var ColorPaletteLocalizationService = /** @class */ (function (_super) {
|
|
8778
|
+
__extends(ColorPaletteLocalizationService, _super);
|
|
8779
|
+
function ColorPaletteLocalizationService(prefix, messageService, _rtl, flatColorPickerLocalization) {
|
|
8780
|
+
var _this = _super.call(this, prefix, messageService, _rtl) || this;
|
|
8781
|
+
_this.flatColorPickerLocalization = flatColorPickerLocalization;
|
|
8782
|
+
return _this;
|
|
8783
|
+
}
|
|
8784
|
+
ColorPaletteLocalizationService.prototype.get = function (shortKey) {
|
|
8785
|
+
if (this.flatColorPickerLocalization) {
|
|
8786
|
+
return this.flatColorPickerLocalization.get(shortKey);
|
|
8787
|
+
}
|
|
8788
|
+
return _super.prototype.get.call(this, shortKey);
|
|
8789
|
+
};
|
|
8790
|
+
ColorPaletteLocalizationService = __decorate([
|
|
8791
|
+
__param(0, Inject(L10N_PREFIX)),
|
|
8792
|
+
__param(1, Optional()),
|
|
8793
|
+
__param(2, Optional()), __param(2, Inject(RTL)),
|
|
8794
|
+
__param(3, Optional()), __param(3, Inject(FlatColorPickerLocalizationService)),
|
|
8795
|
+
__metadata("design:paramtypes", [String, MessageService, Boolean, FlatColorPickerLocalizationService])
|
|
8796
|
+
], ColorPaletteLocalizationService);
|
|
8797
|
+
return ColorPaletteLocalizationService;
|
|
8798
|
+
}(LocalizationService));
|
|
8799
|
+
|
|
8800
|
+
var DEFAULT_TILE_SIZE = 24;
|
|
8801
|
+
var DEFAULT_COLUMNS_COUNT = 10;
|
|
8802
|
+
var DEFAULT_PRESET$1 = 'office';
|
|
8803
|
+
var DEFAULT_ACCESSIBLE_PRESET$1 = 'accessible';
|
|
8484
8804
|
var serial$1 = 0;
|
|
8485
8805
|
/**
|
|
8486
|
-
*
|
|
8487
|
-
*
|
|
8806
|
+
* The ColorPalette component provides a set of predefined palette presets and enables you to implement a custom color palette.
|
|
8807
|
+
* The ColorPalette is independently used by `kendo-colorpicker` and can be directly added to the page.
|
|
8488
8808
|
*/
|
|
8489
|
-
var
|
|
8490
|
-
function
|
|
8809
|
+
var ColorPaletteComponent = /** @class */ (function () {
|
|
8810
|
+
function ColorPaletteComponent(host, service, cdr, renderer, localizationService) {
|
|
8491
8811
|
var _this = this;
|
|
8492
|
-
this.
|
|
8812
|
+
this.host = host;
|
|
8813
|
+
this.service = service;
|
|
8493
8814
|
this.cdr = cdr;
|
|
8815
|
+
this.renderer = renderer;
|
|
8494
8816
|
this.localizationService = localizationService;
|
|
8495
|
-
this.ngZone = ngZone;
|
|
8496
|
-
/**
|
|
8497
|
-
* @hidden
|
|
8498
|
-
*/
|
|
8499
|
-
this.hostClasses = true;
|
|
8500
8817
|
/**
|
|
8501
8818
|
* @hidden
|
|
8502
8819
|
*/
|
|
8503
|
-
this.
|
|
8504
|
-
/**
|
|
8505
|
-
* Sets what view the ColorPicker will render in the popup.
|
|
8506
|
-
*/
|
|
8507
|
-
this.view = 'gradient';
|
|
8820
|
+
this.id = "k-colorpalette-" + serial$1++;
|
|
8508
8821
|
/**
|
|
8509
|
-
*
|
|
8510
|
-
*/
|
|
8511
|
-
this.readonly = false;
|
|
8512
|
-
/**
|
|
8513
|
-
* Sets the disabled state of the ColorPicker.
|
|
8514
|
-
*/
|
|
8515
|
-
this.disabled = false;
|
|
8516
|
-
/**
|
|
8517
|
-
* Specifies the output format of the ColorPicker.
|
|
8822
|
+
* Specifies the output format of the ColorPaletteComponent.
|
|
8518
8823
|
* The input value may be in a different format. However, it will be parsed into the output `format`
|
|
8519
8824
|
* after the component processes it.
|
|
8520
8825
|
*
|
|
8521
|
-
* If the `gradient` view is used with the `opacity` option set to true, this setting will be ignored and `rgba` will be used instead.
|
|
8522
|
-
*
|
|
8523
8826
|
* The supported values are:
|
|
8524
|
-
* * `
|
|
8525
|
-
* * `
|
|
8526
|
-
* *
|
|
8827
|
+
* * (Default) `hex`
|
|
8828
|
+
* * `rgba`
|
|
8829
|
+
* * `name`
|
|
8527
8830
|
*/
|
|
8528
|
-
this.format = '
|
|
8831
|
+
this.format = 'hex';
|
|
8529
8832
|
/**
|
|
8530
|
-
*
|
|
8833
|
+
* Sets the disabled state of the ColorPalette.
|
|
8531
8834
|
*/
|
|
8532
|
-
this.
|
|
8835
|
+
this.disabled = false;
|
|
8533
8836
|
/**
|
|
8534
|
-
*
|
|
8535
|
-
* This event is preventable. If you cancel it, the popup will remain closed.
|
|
8837
|
+
* Sets the read-only state of the ColorPalette.
|
|
8536
8838
|
*/
|
|
8537
|
-
this.
|
|
8839
|
+
this.readonly = false;
|
|
8538
8840
|
/**
|
|
8539
|
-
*
|
|
8540
|
-
*
|
|
8841
|
+
* Specifies the size of a color cell.
|
|
8842
|
+
*
|
|
8843
|
+
* The possible values are:
|
|
8844
|
+
* * (Default) `tileSize = 24`
|
|
8845
|
+
* * `{ width: number, height: number }`
|
|
8541
8846
|
*/
|
|
8542
|
-
this.
|
|
8847
|
+
this.tileSize = { width: DEFAULT_TILE_SIZE, height: DEFAULT_TILE_SIZE };
|
|
8543
8848
|
/**
|
|
8544
|
-
* Fires each time
|
|
8849
|
+
* Fires each time the color selection is changed.
|
|
8545
8850
|
*/
|
|
8546
|
-
this.
|
|
8851
|
+
this.selectionChange = new EventEmitter();
|
|
8547
8852
|
/**
|
|
8548
|
-
* Fires each time the
|
|
8853
|
+
* Fires each time the value is changed.
|
|
8549
8854
|
*/
|
|
8550
|
-
this.
|
|
8855
|
+
this.valueChange = new EventEmitter();
|
|
8551
8856
|
/**
|
|
8552
|
-
* Fires each time the
|
|
8553
|
-
* The event is triggered regardless of whether a ColorPicker icon is set or not.
|
|
8857
|
+
* Fires each time the user selects a cell with the mouse or presses `Enter`.
|
|
8554
8858
|
*
|
|
8555
|
-
*
|
|
8859
|
+
* @hidden
|
|
8556
8860
|
*/
|
|
8557
|
-
this.
|
|
8861
|
+
this.cellSelection = new EventEmitter();
|
|
8862
|
+
/**
|
|
8863
|
+
* @hidden
|
|
8864
|
+
*/
|
|
8865
|
+
this.hostClasses = true;
|
|
8866
|
+
/**
|
|
8867
|
+
* @hidden
|
|
8868
|
+
*/
|
|
8869
|
+
this.uniqueId = guid();
|
|
8558
8870
|
this._tabindex = 0;
|
|
8559
|
-
this._popupSettings = { animate: true };
|
|
8560
|
-
this._paletteSettings = {};
|
|
8561
|
-
this._gradientSettings = { opacity: true, clearButton: false, delay: 0 };
|
|
8562
8871
|
this.notifyNgTouched = function () { };
|
|
8563
8872
|
this.notifyNgChanged = function () { };
|
|
8564
|
-
|
|
8565
|
-
this.dynamicRTLSubscription = this.localizationService.changes.subscribe(function (_a) {
|
|
8873
|
+
this.dynamicRTLSubscription = localizationService.changes.subscribe(function (_a) {
|
|
8566
8874
|
var rtl = _a.rtl;
|
|
8567
8875
|
_this.direction = rtl ? 'rtl' : 'ltr';
|
|
8568
8876
|
});
|
|
8569
8877
|
}
|
|
8570
|
-
|
|
8571
|
-
Object.defineProperty(
|
|
8572
|
-
get: function () {
|
|
8573
|
-
return this._value;
|
|
8574
|
-
},
|
|
8878
|
+
ColorPaletteComponent_1 = ColorPaletteComponent;
|
|
8879
|
+
Object.defineProperty(ColorPaletteComponent.prototype, "paletteId", {
|
|
8575
8880
|
/**
|
|
8576
|
-
*
|
|
8881
|
+
* @hidden
|
|
8577
8882
|
*/
|
|
8578
|
-
|
|
8579
|
-
|
|
8883
|
+
get: function () {
|
|
8884
|
+
return this.id;
|
|
8580
8885
|
},
|
|
8581
8886
|
enumerable: true,
|
|
8582
8887
|
configurable: true
|
|
8583
8888
|
});
|
|
8584
|
-
Object.defineProperty(
|
|
8889
|
+
Object.defineProperty(ColorPaletteComponent.prototype, "value", {
|
|
8585
8890
|
get: function () {
|
|
8586
|
-
return this.
|
|
8891
|
+
return this._value;
|
|
8587
8892
|
},
|
|
8588
8893
|
/**
|
|
8589
|
-
*
|
|
8894
|
+
* Specifies the value of the initially selected color.
|
|
8590
8895
|
*/
|
|
8591
8896
|
set: function (value) {
|
|
8592
|
-
this.
|
|
8897
|
+
this._value = parseColor$1(value, this.format);
|
|
8593
8898
|
},
|
|
8594
8899
|
enumerable: true,
|
|
8595
8900
|
configurable: true
|
|
8596
8901
|
});
|
|
8597
|
-
Object.defineProperty(
|
|
8902
|
+
Object.defineProperty(ColorPaletteComponent.prototype, "columns", {
|
|
8598
8903
|
get: function () {
|
|
8599
|
-
return this.
|
|
8904
|
+
return this._columns;
|
|
8600
8905
|
},
|
|
8601
8906
|
/**
|
|
8602
|
-
*
|
|
8907
|
+
* Specifies the number of columns that will be displayed.
|
|
8908
|
+
* Defaults to `10`.
|
|
8603
8909
|
*/
|
|
8604
8910
|
set: function (value) {
|
|
8605
|
-
|
|
8911
|
+
var minColumnsCount = 1;
|
|
8912
|
+
this._columns = value > minColumnsCount ? value : minColumnsCount;
|
|
8606
8913
|
},
|
|
8607
8914
|
enumerable: true,
|
|
8608
8915
|
configurable: true
|
|
8609
8916
|
});
|
|
8610
|
-
Object.defineProperty(
|
|
8917
|
+
Object.defineProperty(ColorPaletteComponent.prototype, "palette", {
|
|
8611
8918
|
get: function () {
|
|
8612
|
-
return this.
|
|
8919
|
+
return this._palette;
|
|
8613
8920
|
},
|
|
8614
8921
|
/**
|
|
8615
|
-
*
|
|
8922
|
+
* The color palette that will be displayed.
|
|
8923
|
+
*
|
|
8924
|
+
* The supported values are:
|
|
8925
|
+
* * The name of the predefined palette preset (for example, `office`, `basic`, and `apex`).
|
|
8926
|
+
* * A string with comma-separated colors.
|
|
8927
|
+
* * A string array.
|
|
8616
8928
|
*/
|
|
8617
8929
|
set: function (value) {
|
|
8618
|
-
|
|
8930
|
+
var _this = this;
|
|
8931
|
+
if (!isPresent(value)) {
|
|
8932
|
+
value = DEFAULT_PRESET$1;
|
|
8933
|
+
}
|
|
8934
|
+
if (typeof value === 'string' && isPresent(PALETTEPRESETS[value])) {
|
|
8935
|
+
this.columns = this.columns || PALETTEPRESETS[value].columns;
|
|
8936
|
+
value = PALETTEPRESETS[value].colors;
|
|
8937
|
+
}
|
|
8938
|
+
var colors = (typeof value === 'string') ? value.split(',') : value;
|
|
8939
|
+
this._palette = colors.map(function (color) { return parseColor$1(color, _this.format, false, false); });
|
|
8619
8940
|
},
|
|
8620
8941
|
enumerable: true,
|
|
8621
8942
|
configurable: true
|
|
8622
8943
|
});
|
|
8623
|
-
Object.defineProperty(
|
|
8944
|
+
Object.defineProperty(ColorPaletteComponent.prototype, "tabindex", {
|
|
8624
8945
|
get: function () {
|
|
8625
8946
|
return !this.disabled ? this._tabindex : undefined;
|
|
8626
8947
|
},
|
|
@@ -8635,603 +8956,1133 @@ var ColorPickerComponent = /** @class */ (function () {
|
|
|
8635
8956
|
enumerable: true,
|
|
8636
8957
|
configurable: true
|
|
8637
8958
|
});
|
|
8638
|
-
Object.defineProperty(
|
|
8959
|
+
Object.defineProperty(ColorPaletteComponent.prototype, "tileLayout", {
|
|
8639
8960
|
/**
|
|
8640
|
-
*
|
|
8961
|
+
* @hidden
|
|
8641
8962
|
*/
|
|
8642
8963
|
get: function () {
|
|
8643
|
-
|
|
8964
|
+
if (typeof this.tileSize !== 'number') {
|
|
8965
|
+
return this.tileSize;
|
|
8966
|
+
}
|
|
8967
|
+
return { width: this.tileSize, height: this.tileSize };
|
|
8644
8968
|
},
|
|
8645
8969
|
enumerable: true,
|
|
8646
8970
|
configurable: true
|
|
8647
8971
|
});
|
|
8648
|
-
Object.defineProperty(
|
|
8972
|
+
Object.defineProperty(ColorPaletteComponent.prototype, "colorRows", {
|
|
8649
8973
|
/**
|
|
8650
8974
|
* @hidden
|
|
8651
8975
|
*/
|
|
8652
8976
|
get: function () {
|
|
8653
|
-
|
|
8654
|
-
return this.iconClass;
|
|
8655
|
-
}
|
|
8656
|
-
if (this.icon) {
|
|
8657
|
-
return "k-icon k-i-" + this.icon;
|
|
8658
|
-
}
|
|
8977
|
+
return this.service.colorRows;
|
|
8659
8978
|
},
|
|
8660
8979
|
enumerable: true,
|
|
8661
8980
|
configurable: true
|
|
8662
8981
|
});
|
|
8663
|
-
|
|
8664
|
-
|
|
8665
|
-
|
|
8666
|
-
|
|
8667
|
-
|
|
8668
|
-
|
|
8669
|
-
|
|
8670
|
-
|
|
8671
|
-
|
|
8672
|
-
|
|
8673
|
-
|
|
8674
|
-
|
|
8675
|
-
|
|
8676
|
-
|
|
8677
|
-
|
|
8678
|
-
|
|
8679
|
-
|
|
8680
|
-
|
|
8681
|
-
|
|
8982
|
+
Object.defineProperty(ColorPaletteComponent.prototype, "hostTabindex", {
|
|
8983
|
+
/**
|
|
8984
|
+
* @hidden
|
|
8985
|
+
*/
|
|
8986
|
+
get: function () { return this.tabindex; },
|
|
8987
|
+
enumerable: true,
|
|
8988
|
+
configurable: true
|
|
8989
|
+
});
|
|
8990
|
+
Object.defineProperty(ColorPaletteComponent.prototype, "disabledClass", {
|
|
8991
|
+
/**
|
|
8992
|
+
* @hidden
|
|
8993
|
+
*/
|
|
8994
|
+
get: function () { return this.disabled; },
|
|
8995
|
+
enumerable: true,
|
|
8996
|
+
configurable: true
|
|
8997
|
+
});
|
|
8998
|
+
Object.defineProperty(ColorPaletteComponent.prototype, "readonlyAttribute", {
|
|
8999
|
+
/**
|
|
9000
|
+
* @hidden
|
|
9001
|
+
*/
|
|
9002
|
+
get: function () { return this.readonly; },
|
|
9003
|
+
enumerable: true,
|
|
9004
|
+
configurable: true
|
|
9005
|
+
});
|
|
9006
|
+
ColorPaletteComponent.prototype.ngOnInit = function () {
|
|
9007
|
+
if (this.colorRows.length === 0) {
|
|
9008
|
+
var defaultPreset = (this.format !== 'name') ? DEFAULT_PRESET$1 : DEFAULT_ACCESSIBLE_PRESET$1;
|
|
9009
|
+
this.palette = this.palette || defaultPreset;
|
|
9010
|
+
this.setRows();
|
|
9011
|
+
this.focusedCell = this.service.getCellCoordsFor(this.value);
|
|
8682
9012
|
}
|
|
8683
9013
|
};
|
|
8684
|
-
|
|
8685
|
-
this.
|
|
9014
|
+
ColorPaletteComponent.prototype.ngAfterViewInit = function () {
|
|
9015
|
+
this.setHostElementAriaLabel();
|
|
9016
|
+
};
|
|
9017
|
+
ColorPaletteComponent.prototype.ngOnDestroy = function () {
|
|
8686
9018
|
if (this.dynamicRTLSubscription) {
|
|
8687
9019
|
this.dynamicRTLSubscription.unsubscribe();
|
|
8688
9020
|
}
|
|
8689
9021
|
};
|
|
8690
|
-
|
|
8691
|
-
|
|
8692
|
-
|
|
8693
|
-
|
|
8694
|
-
|
|
8695
|
-
|
|
9022
|
+
ColorPaletteComponent.prototype.ngOnChanges = function (changes) {
|
|
9023
|
+
if (changes.palette || changes.columns) {
|
|
9024
|
+
this.setRows();
|
|
9025
|
+
}
|
|
9026
|
+
if (changes.palette || changes.value || changes.columns) {
|
|
9027
|
+
this.focusedCell = this.service.getCellCoordsFor(this.value);
|
|
9028
|
+
this.setHostElementAriaLabel();
|
|
9029
|
+
}
|
|
8696
9030
|
};
|
|
8697
9031
|
/**
|
|
8698
9032
|
* @hidden
|
|
8699
9033
|
*/
|
|
8700
|
-
|
|
8701
|
-
this.
|
|
8702
|
-
|
|
8703
|
-
|
|
8704
|
-
|
|
8705
|
-
|
|
9034
|
+
ColorPaletteComponent.prototype.handleKeydown = function (event) {
|
|
9035
|
+
var isRTL = this.direction === 'rtl';
|
|
9036
|
+
switch (event.keyCode) {
|
|
9037
|
+
case Keys.ArrowDown:
|
|
9038
|
+
this.handleCellNavigation(0, 1);
|
|
9039
|
+
break;
|
|
9040
|
+
case Keys.ArrowUp:
|
|
9041
|
+
this.handleCellNavigation(0, -1);
|
|
9042
|
+
break;
|
|
9043
|
+
case Keys.ArrowRight:
|
|
9044
|
+
this.handleCellNavigation(isRTL ? -1 : 1, 0);
|
|
9045
|
+
break;
|
|
9046
|
+
case Keys.ArrowLeft:
|
|
9047
|
+
this.handleCellNavigation(isRTL ? 1 : -1, 0);
|
|
9048
|
+
break;
|
|
9049
|
+
case Keys.Enter:
|
|
9050
|
+
this.handleEnter();
|
|
9051
|
+
break;
|
|
9052
|
+
default: return;
|
|
8706
9053
|
}
|
|
9054
|
+
event.preventDefault();
|
|
8707
9055
|
};
|
|
8708
9056
|
/**
|
|
8709
|
-
*
|
|
9057
|
+
* @hidden
|
|
8710
9058
|
*/
|
|
8711
|
-
|
|
8712
|
-
|
|
8713
|
-
|
|
8714
|
-
}
|
|
8715
|
-
this.wrapper.nativeElement.focus();
|
|
9059
|
+
ColorPaletteComponent.prototype.handleHostBlur = function () {
|
|
9060
|
+
this.notifyNgTouched();
|
|
9061
|
+
this.handleCellFocusOnBlur();
|
|
8716
9062
|
};
|
|
8717
9063
|
/**
|
|
8718
9064
|
* @hidden
|
|
8719
9065
|
*/
|
|
8720
|
-
|
|
8721
|
-
if (
|
|
8722
|
-
this.palette.nativeElement.focus();
|
|
8723
|
-
}
|
|
8724
|
-
if (this.isFocused) {
|
|
9066
|
+
ColorPaletteComponent.prototype.handleCellSelection = function (value, focusedCell) {
|
|
9067
|
+
if (this.readonly) {
|
|
8725
9068
|
return;
|
|
8726
9069
|
}
|
|
8727
|
-
this.
|
|
8728
|
-
this.
|
|
9070
|
+
this.selectedCell = focusedCell;
|
|
9071
|
+
this.focusedCell = this.selectedCell;
|
|
9072
|
+
this.focusInComponent = true;
|
|
9073
|
+
var parsedColor = parseColor$1(value, this.format, false, false);
|
|
9074
|
+
this.cellSelection.emit(parsedColor);
|
|
9075
|
+
this.handleValueChange(parsedColor);
|
|
9076
|
+
if (this.selection !== parsedColor) {
|
|
9077
|
+
this.selection = parsedColor;
|
|
9078
|
+
this.selectionChange.emit(parsedColor);
|
|
9079
|
+
}
|
|
9080
|
+
if (focusedCell) {
|
|
9081
|
+
this.activeCellId = "k-" + this.selectedCell.row + "-" + this.selectedCell.col + "-" + this.uniqueId;
|
|
9082
|
+
}
|
|
8729
9083
|
};
|
|
8730
9084
|
/**
|
|
8731
|
-
*
|
|
9085
|
+
* @hidden
|
|
8732
9086
|
*/
|
|
8733
|
-
|
|
8734
|
-
this.
|
|
9087
|
+
ColorPaletteComponent.prototype.writeValue = function (value) {
|
|
9088
|
+
this.value = value;
|
|
9089
|
+
this.focusedCell = this.service.getCellCoordsFor(this.value);
|
|
8735
9090
|
};
|
|
8736
9091
|
/**
|
|
8737
9092
|
* @hidden
|
|
8738
9093
|
*/
|
|
8739
|
-
|
|
8740
|
-
|
|
9094
|
+
ColorPaletteComponent.prototype.registerOnChange = function (fn) {
|
|
9095
|
+
this.notifyNgChanged = fn;
|
|
9096
|
+
};
|
|
9097
|
+
/**
|
|
9098
|
+
* @hidden
|
|
9099
|
+
*/
|
|
9100
|
+
ColorPaletteComponent.prototype.registerOnTouched = function (fn) {
|
|
9101
|
+
this.notifyNgTouched = fn;
|
|
9102
|
+
};
|
|
9103
|
+
/**
|
|
9104
|
+
* @hidden
|
|
9105
|
+
*/
|
|
9106
|
+
ColorPaletteComponent.prototype.setDisabledState = function (isDisabled) {
|
|
9107
|
+
this.cdr.markForCheck();
|
|
9108
|
+
this.disabled = isDisabled;
|
|
9109
|
+
};
|
|
9110
|
+
/**
|
|
9111
|
+
* @hidden
|
|
9112
|
+
* Used by the FloatingLabel to determine if the component is empty.
|
|
9113
|
+
*/
|
|
9114
|
+
ColorPaletteComponent.prototype.isEmpty = function () {
|
|
9115
|
+
return false;
|
|
9116
|
+
};
|
|
9117
|
+
/**
|
|
9118
|
+
* Clears the color value of the ColorPalette.
|
|
9119
|
+
*/
|
|
9120
|
+
ColorPaletteComponent.prototype.reset = function () {
|
|
9121
|
+
this.focusedCell = null;
|
|
9122
|
+
if (isPresent(this.value)) {
|
|
9123
|
+
this.handleValueChange(undefined);
|
|
9124
|
+
}
|
|
9125
|
+
this.selectedCell = undefined;
|
|
9126
|
+
};
|
|
9127
|
+
ColorPaletteComponent.prototype.handleValueChange = function (color) {
|
|
9128
|
+
if (this.value === color) {
|
|
9129
|
+
return;
|
|
9130
|
+
}
|
|
9131
|
+
this.value = color;
|
|
9132
|
+
this.valueChange.emit(color);
|
|
9133
|
+
this.notifyNgChanged(color);
|
|
9134
|
+
this.setHostElementAriaLabel();
|
|
9135
|
+
};
|
|
9136
|
+
ColorPaletteComponent.prototype.handleCellFocusOnBlur = function () {
|
|
9137
|
+
this.focusInComponent = false;
|
|
9138
|
+
this.focusedCell = this.selectedCell;
|
|
9139
|
+
};
|
|
9140
|
+
ColorPaletteComponent.prototype.setRows = function () {
|
|
9141
|
+
if (!isPresent(this.palette)) {
|
|
9142
|
+
return;
|
|
9143
|
+
}
|
|
9144
|
+
this.columns = this.columns || DEFAULT_COLUMNS_COUNT;
|
|
9145
|
+
this.service.setColorMatrix(this.palette, this.columns);
|
|
9146
|
+
};
|
|
9147
|
+
ColorPaletteComponent.prototype.handleCellNavigation = function (horizontalStep, verticalStep) {
|
|
9148
|
+
if (this.readonly) {
|
|
9149
|
+
return;
|
|
9150
|
+
}
|
|
9151
|
+
this.focusedCell = this.service.getNextCell(this.focusedCell, horizontalStep, verticalStep);
|
|
9152
|
+
this.focusInComponent = true;
|
|
9153
|
+
};
|
|
9154
|
+
ColorPaletteComponent.prototype.setHostElementAriaLabel = function () {
|
|
9155
|
+
var parsed = parseColor$1(this.value, this.format);
|
|
9156
|
+
this.renderer.setAttribute(this.host.nativeElement, 'aria-label', "" + (this.value ? parsed : this.localizationService.get('colorPaletteNoColor')));
|
|
9157
|
+
};
|
|
9158
|
+
ColorPaletteComponent.prototype.handleEnter = function () {
|
|
9159
|
+
if (!isPresent(this.focusedCell)) {
|
|
9160
|
+
return;
|
|
9161
|
+
}
|
|
9162
|
+
var selectedColor = this.service.getColorAt(this.focusedCell);
|
|
9163
|
+
this.handleCellSelection(selectedColor, this.focusedCell);
|
|
9164
|
+
};
|
|
9165
|
+
var ColorPaletteComponent_1;
|
|
9166
|
+
__decorate([
|
|
9167
|
+
HostBinding('attr.dir'),
|
|
9168
|
+
__metadata("design:type", String)
|
|
9169
|
+
], ColorPaletteComponent.prototype, "direction", void 0);
|
|
9170
|
+
__decorate([
|
|
9171
|
+
HostBinding('attr.id'),
|
|
9172
|
+
__metadata("design:type", String),
|
|
9173
|
+
__metadata("design:paramtypes", [])
|
|
9174
|
+
], ColorPaletteComponent.prototype, "paletteId", null);
|
|
9175
|
+
__decorate([
|
|
9176
|
+
Input(),
|
|
9177
|
+
__metadata("design:type", String)
|
|
9178
|
+
], ColorPaletteComponent.prototype, "id", void 0);
|
|
9179
|
+
__decorate([
|
|
9180
|
+
Input(),
|
|
9181
|
+
__metadata("design:type", String)
|
|
9182
|
+
], ColorPaletteComponent.prototype, "format", void 0);
|
|
9183
|
+
__decorate([
|
|
9184
|
+
Input(),
|
|
9185
|
+
__metadata("design:type", String),
|
|
9186
|
+
__metadata("design:paramtypes", [String])
|
|
9187
|
+
], ColorPaletteComponent.prototype, "value", null);
|
|
9188
|
+
__decorate([
|
|
9189
|
+
Input(),
|
|
9190
|
+
__metadata("design:type", Number),
|
|
9191
|
+
__metadata("design:paramtypes", [Number])
|
|
9192
|
+
], ColorPaletteComponent.prototype, "columns", null);
|
|
9193
|
+
__decorate([
|
|
9194
|
+
Input(),
|
|
9195
|
+
__metadata("design:type", Object),
|
|
9196
|
+
__metadata("design:paramtypes", [Object])
|
|
9197
|
+
], ColorPaletteComponent.prototype, "palette", null);
|
|
9198
|
+
__decorate([
|
|
9199
|
+
Input(),
|
|
9200
|
+
__metadata("design:type", Number),
|
|
9201
|
+
__metadata("design:paramtypes", [Number])
|
|
9202
|
+
], ColorPaletteComponent.prototype, "tabindex", null);
|
|
9203
|
+
__decorate([
|
|
9204
|
+
Input(),
|
|
9205
|
+
__metadata("design:type", Boolean)
|
|
9206
|
+
], ColorPaletteComponent.prototype, "disabled", void 0);
|
|
9207
|
+
__decorate([
|
|
9208
|
+
Input(),
|
|
9209
|
+
__metadata("design:type", Boolean)
|
|
9210
|
+
], ColorPaletteComponent.prototype, "readonly", void 0);
|
|
9211
|
+
__decorate([
|
|
9212
|
+
Input(),
|
|
9213
|
+
__metadata("design:type", Object)
|
|
9214
|
+
], ColorPaletteComponent.prototype, "tileSize", void 0);
|
|
9215
|
+
__decorate([
|
|
9216
|
+
Output(),
|
|
9217
|
+
__metadata("design:type", EventEmitter)
|
|
9218
|
+
], ColorPaletteComponent.prototype, "selectionChange", void 0);
|
|
9219
|
+
__decorate([
|
|
9220
|
+
Output(),
|
|
9221
|
+
__metadata("design:type", EventEmitter)
|
|
9222
|
+
], ColorPaletteComponent.prototype, "valueChange", void 0);
|
|
9223
|
+
__decorate([
|
|
9224
|
+
Output(),
|
|
9225
|
+
__metadata("design:type", EventEmitter)
|
|
9226
|
+
], ColorPaletteComponent.prototype, "cellSelection", void 0);
|
|
9227
|
+
__decorate([
|
|
9228
|
+
HostBinding('attr.tabindex'),
|
|
9229
|
+
__metadata("design:type", Number),
|
|
9230
|
+
__metadata("design:paramtypes", [])
|
|
9231
|
+
], ColorPaletteComponent.prototype, "hostTabindex", null);
|
|
9232
|
+
__decorate([
|
|
9233
|
+
HostBinding('class.k-colorpalette'),
|
|
9234
|
+
__metadata("design:type", Boolean)
|
|
9235
|
+
], ColorPaletteComponent.prototype, "hostClasses", void 0);
|
|
9236
|
+
__decorate([
|
|
9237
|
+
HostBinding('attr.aria-disabled'),
|
|
9238
|
+
HostBinding('class.k-state-disabled'),
|
|
9239
|
+
__metadata("design:type", Boolean),
|
|
9240
|
+
__metadata("design:paramtypes", [])
|
|
9241
|
+
], ColorPaletteComponent.prototype, "disabledClass", null);
|
|
9242
|
+
__decorate([
|
|
9243
|
+
HostBinding('attr.aria-readonly'),
|
|
9244
|
+
__metadata("design:type", Boolean),
|
|
9245
|
+
__metadata("design:paramtypes", [])
|
|
9246
|
+
], ColorPaletteComponent.prototype, "readonlyAttribute", null);
|
|
9247
|
+
__decorate([
|
|
9248
|
+
HostListener('keydown', ['$event']),
|
|
9249
|
+
__metadata("design:type", Function),
|
|
9250
|
+
__metadata("design:paramtypes", [Object]),
|
|
9251
|
+
__metadata("design:returntype", void 0)
|
|
9252
|
+
], ColorPaletteComponent.prototype, "handleKeydown", null);
|
|
9253
|
+
__decorate([
|
|
9254
|
+
HostListener('blur'),
|
|
9255
|
+
__metadata("design:type", Function),
|
|
9256
|
+
__metadata("design:paramtypes", []),
|
|
9257
|
+
__metadata("design:returntype", void 0)
|
|
9258
|
+
], ColorPaletteComponent.prototype, "handleHostBlur", null);
|
|
9259
|
+
ColorPaletteComponent = ColorPaletteComponent_1 = __decorate([
|
|
9260
|
+
Component({
|
|
9261
|
+
exportAs: 'kendoColorPalette',
|
|
9262
|
+
selector: 'kendo-colorpalette',
|
|
9263
|
+
providers: [
|
|
9264
|
+
{
|
|
9265
|
+
multi: true,
|
|
9266
|
+
provide: NG_VALUE_ACCESSOR,
|
|
9267
|
+
useExisting: forwardRef(function () { return ColorPaletteComponent_1; }) // tslint:disable-line:no-forward-ref
|
|
9268
|
+
}, {
|
|
9269
|
+
provide: KendoInput,
|
|
9270
|
+
useExisting: forwardRef(function () { return ColorPaletteComponent_1; })
|
|
9271
|
+
},
|
|
9272
|
+
ColorPaletteService,
|
|
9273
|
+
ColorPaletteLocalizationService,
|
|
9274
|
+
{
|
|
9275
|
+
provide: LocalizationService,
|
|
9276
|
+
useExisting: ColorPaletteLocalizationService
|
|
9277
|
+
},
|
|
9278
|
+
{
|
|
9279
|
+
provide: L10N_PREFIX,
|
|
9280
|
+
useValue: 'kendo.colorpalette'
|
|
9281
|
+
}
|
|
9282
|
+
],
|
|
9283
|
+
template: "\n <ng-container kendoColorPaletteLocalizedMessages\n i18n-colorPaletteNoColor=\"kendo.colorpalette.colorPaletteNoColor|The aria-label applied to the ColorPalette component when the value is empty.\"\n colorPaletteNoColor=\"Colorpalette no color chosen\">\n </ng-container>\n <div role=\"listbox\" class=\"k-colorpalette-table-wrap\"\n [attr.aria-activedescendant]=\"activeCellId\">\n <table class=\"k-colorpalette-table k-palette\">\n <tbody>\n <tr *ngFor=\"let row of colorRows; let rowIndex = index\">\n <td *ngFor=\"let color of row; let colIndex = index\"\n role=\"option\"\n [class.k-state-selected]=\"selectedCell?.row === rowIndex && selectedCell?.col === colIndex\"\n [class.k-state-focus]=\"focusInComponent && focusedCell?.row === rowIndex && focusedCell?.col === colIndex\"\n [attr.aria-selected]=\"selectedCell?.row === rowIndex && selectedCell?.col === colIndex\"\n [attr.aria-label]=\"color\"\n class=\"k-colorpalette-tile\"\n [id]=\"'k-' + rowIndex + '-' + colIndex + '-' + uniqueId\"\n [attr.value]=\"color\"\n (click)=\"handleCellSelection(color, { row: rowIndex, col: colIndex })\"\n [ngStyle]=\"{\n backgroundColor: color,\n width: tileLayout.width + 'px',\n height: tileLayout.height + 'px',\n minWidth: tileLayout.width + 'px'\n }\">\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n "
|
|
9284
|
+
}),
|
|
9285
|
+
__metadata("design:paramtypes", [ElementRef,
|
|
9286
|
+
ColorPaletteService,
|
|
9287
|
+
ChangeDetectorRef,
|
|
9288
|
+
Renderer2,
|
|
9289
|
+
LocalizationService])
|
|
9290
|
+
], ColorPaletteComponent);
|
|
9291
|
+
return ColorPaletteComponent;
|
|
9292
|
+
}());
|
|
9293
|
+
|
|
9294
|
+
/**
|
|
9295
|
+
* @hidden
|
|
9296
|
+
*/
|
|
9297
|
+
var FlatColorPickerHeaderComponent = /** @class */ (function () {
|
|
9298
|
+
function FlatColorPickerHeaderComponent(localizationService) {
|
|
9299
|
+
this.localizationService = localizationService;
|
|
9300
|
+
this.hostClasses = true;
|
|
9301
|
+
this.viewChange = new EventEmitter();
|
|
9302
|
+
this.valuePaneClick = new EventEmitter();
|
|
9303
|
+
this.clearButtonClick = new EventEmitter();
|
|
9304
|
+
}
|
|
9305
|
+
FlatColorPickerHeaderComponent.prototype.onViewButtonClick = function (view) {
|
|
9306
|
+
this.activeView = view;
|
|
9307
|
+
this.viewChange.emit(view);
|
|
9308
|
+
};
|
|
9309
|
+
Object.defineProperty(FlatColorPickerHeaderComponent.prototype, "viewButtons", {
|
|
9310
|
+
get: function () {
|
|
9311
|
+
return this.views && this.views.indexOf('gradient') >= 0 && this.views.indexOf('palette') >= 0;
|
|
9312
|
+
},
|
|
9313
|
+
enumerable: true,
|
|
9314
|
+
configurable: true
|
|
9315
|
+
});
|
|
9316
|
+
FlatColorPickerHeaderComponent.prototype.getViewButtonIcon = function (view) {
|
|
9317
|
+
return view === 'gradient' ? 'k-i-color-canvas' : 'k-i-palette';
|
|
9318
|
+
};
|
|
9319
|
+
FlatColorPickerHeaderComponent.prototype.getText = function (text) {
|
|
9320
|
+
return this.localizationService.get(text);
|
|
9321
|
+
};
|
|
9322
|
+
__decorate([
|
|
9323
|
+
HostBinding('class.k-coloreditor-header'),
|
|
9324
|
+
HostBinding('class.k-hstack'),
|
|
9325
|
+
__metadata("design:type", Boolean)
|
|
9326
|
+
], FlatColorPickerHeaderComponent.prototype, "hostClasses", void 0);
|
|
9327
|
+
__decorate([
|
|
9328
|
+
Input(),
|
|
9329
|
+
__metadata("design:type", Boolean)
|
|
9330
|
+
], FlatColorPickerHeaderComponent.prototype, "clearButton", void 0);
|
|
9331
|
+
__decorate([
|
|
9332
|
+
Input(),
|
|
9333
|
+
__metadata("design:type", String)
|
|
9334
|
+
], FlatColorPickerHeaderComponent.prototype, "activeView", void 0);
|
|
9335
|
+
__decorate([
|
|
9336
|
+
Input(),
|
|
9337
|
+
__metadata("design:type", Array)
|
|
9338
|
+
], FlatColorPickerHeaderComponent.prototype, "views", void 0);
|
|
9339
|
+
__decorate([
|
|
9340
|
+
Input(),
|
|
9341
|
+
__metadata("design:type", Boolean)
|
|
9342
|
+
], FlatColorPickerHeaderComponent.prototype, "preview", void 0);
|
|
9343
|
+
__decorate([
|
|
9344
|
+
Input(),
|
|
9345
|
+
__metadata("design:type", String)
|
|
9346
|
+
], FlatColorPickerHeaderComponent.prototype, "value", void 0);
|
|
9347
|
+
__decorate([
|
|
9348
|
+
Input(),
|
|
9349
|
+
__metadata("design:type", String)
|
|
9350
|
+
], FlatColorPickerHeaderComponent.prototype, "selection", void 0);
|
|
9351
|
+
__decorate([
|
|
9352
|
+
Output(),
|
|
9353
|
+
__metadata("design:type", EventEmitter)
|
|
9354
|
+
], FlatColorPickerHeaderComponent.prototype, "viewChange", void 0);
|
|
9355
|
+
__decorate([
|
|
9356
|
+
Output(),
|
|
9357
|
+
__metadata("design:type", EventEmitter)
|
|
9358
|
+
], FlatColorPickerHeaderComponent.prototype, "valuePaneClick", void 0);
|
|
9359
|
+
__decorate([
|
|
9360
|
+
Output(),
|
|
9361
|
+
__metadata("design:type", EventEmitter)
|
|
9362
|
+
], FlatColorPickerHeaderComponent.prototype, "clearButtonClick", void 0);
|
|
9363
|
+
__decorate([
|
|
9364
|
+
ViewChildren('viewButtons', { read: ElementRef }),
|
|
9365
|
+
__metadata("design:type", QueryList)
|
|
9366
|
+
], FlatColorPickerHeaderComponent.prototype, "viewButtonsCollection", void 0);
|
|
9367
|
+
__decorate([
|
|
9368
|
+
ViewChild('clearButton', { read: ElementRef, static: false }),
|
|
9369
|
+
__metadata("design:type", ElementRef)
|
|
9370
|
+
], FlatColorPickerHeaderComponent.prototype, "clearButtonElement", void 0);
|
|
9371
|
+
FlatColorPickerHeaderComponent = __decorate([
|
|
9372
|
+
Component({
|
|
9373
|
+
selector: '[kendoFlatColorPickerHeader]',
|
|
9374
|
+
template: "\n <div class=\"k-coloreditor-header-actions k-hstack\">\n <div *ngIf=\"viewButtons\" class=\"k-button-group k-button-group-flat\">\n <button *ngFor=\"let view of views\"\n #viewButtons\n (click)=\"onViewButtonClick(view)\"\n class=\"k-button k-icon-button k-flat\"\n [attr.title]=\"getText(view === 'gradient' ? 'gradientView' : 'paletteView')\"\n [attr.aria-label]=\"getText(view === 'gradient' ? 'gradientView' : 'paletteView')\"\n [attr.aria-pressed]=\"activeView === view\"\n [ngClass]=\"activeView === view ? 'k-state-selected' : ''\"\n >\n <span\n class=\"k-button-icon k-icon\"\n [ngClass]=\"getViewButtonIcon(view)\">\n </span>\n </button>\n </div>\n </div>\n <div class=\"k-spacer\"></div>\n <div class=\"k-coloreditor-header-actions k-hstack\">\n <button *ngIf=\"clearButton\"\n #clearButton\n class=\"k-button k-icon-button k-flat k-coloreditor-reset\"\n [attr.aria-label]=\"getText('clearButton')\"\n [attr.title]=\"getText('clearButton')\"\n (click)=\"clearButtonClick.emit()\">\n <span class=\"k-button-icon k-icon k-i-reset-color\"></span>\n </button>\n <div class=\"k-coloreditor-preview k-vstack\" *ngIf=\"preview\">\n <span\n class=\"k-coloreditor-preview-color k-color-preview\"\n [attr.title]=\"getText('previewColor')\"\n [style.background-color]=\"selection\">\n </span>\n <span class=\"k-coloreditor-current-color k-color-preview\"\n [style.background-color]=\"value\"\n [attr.title]=\"getText('revertSelection')\"\n (click)=\"valuePaneClick.emit($event)\">\n </span>\n </div>\n </div>\n "
|
|
9375
|
+
}),
|
|
9376
|
+
__metadata("design:paramtypes", [LocalizationService])
|
|
9377
|
+
], FlatColorPickerHeaderComponent);
|
|
9378
|
+
return FlatColorPickerHeaderComponent;
|
|
9379
|
+
}());
|
|
9380
|
+
|
|
9381
|
+
/**
|
|
9382
|
+
* @hidden
|
|
9383
|
+
*/
|
|
9384
|
+
var FlatColorPickerActionButtonsComponent = /** @class */ (function () {
|
|
9385
|
+
function FlatColorPickerActionButtonsComponent(localizationService) {
|
|
9386
|
+
this.localizationService = localizationService;
|
|
9387
|
+
this.hostClasses = true;
|
|
9388
|
+
this.actionButtonClick = new EventEmitter();
|
|
9389
|
+
}
|
|
9390
|
+
FlatColorPickerActionButtonsComponent.prototype.getText = function (text) {
|
|
9391
|
+
return this.localizationService.get(text);
|
|
9392
|
+
};
|
|
9393
|
+
FlatColorPickerActionButtonsComponent.prototype.onActionButtonClick = function (type, ev) {
|
|
9394
|
+
var args = {
|
|
9395
|
+
target: type,
|
|
9396
|
+
originalEvent: ev
|
|
9397
|
+
};
|
|
9398
|
+
this.actionButtonClick.emit(args);
|
|
9399
|
+
};
|
|
9400
|
+
__decorate([
|
|
9401
|
+
HostBinding('class.k-coloreditor-footer'),
|
|
9402
|
+
HostBinding('class.k-actions'),
|
|
9403
|
+
HostBinding('class.k-hstack'),
|
|
9404
|
+
__metadata("design:type", Boolean)
|
|
9405
|
+
], FlatColorPickerActionButtonsComponent.prototype, "hostClasses", void 0);
|
|
9406
|
+
__decorate([
|
|
9407
|
+
Output(),
|
|
9408
|
+
__metadata("design:type", EventEmitter)
|
|
9409
|
+
], FlatColorPickerActionButtonsComponent.prototype, "actionButtonClick", void 0);
|
|
9410
|
+
__decorate([
|
|
9411
|
+
ViewChild('last', { read: ElementRef, static: false }),
|
|
9412
|
+
__metadata("design:type", ElementRef)
|
|
9413
|
+
], FlatColorPickerActionButtonsComponent.prototype, "lastButton", void 0);
|
|
9414
|
+
FlatColorPickerActionButtonsComponent = __decorate([
|
|
9415
|
+
Component({
|
|
9416
|
+
selector: '[kendoFlatColorPickerActionButtons]',
|
|
9417
|
+
template: "\n <button\n class=\"k-coloreditor-cancel k-button\"\n [attr.title]=\"getText('cancelButton')\"\n (click)=\"onActionButtonClick('cancel', $event)\"\n >{{getText('cancelButton')}}</button>\n <button #last\n class=\"k-coloreditor-apply k-button k-primary\"\n [attr.title]=\"getText('applyButton')\"\n (click)=\"onActionButtonClick('apply', $event)\"\n >{{getText('applyButton')}}</button>\n "
|
|
9418
|
+
}),
|
|
9419
|
+
__metadata("design:paramtypes", [LocalizationService])
|
|
9420
|
+
], FlatColorPickerActionButtonsComponent);
|
|
9421
|
+
return FlatColorPickerActionButtonsComponent;
|
|
9422
|
+
}());
|
|
9423
|
+
|
|
9424
|
+
/**
|
|
9425
|
+
* Represents the [Kendo UI FlatColorPicker component for Angular]({% slug overview_flatcolorpicker %}).
|
|
9426
|
+
*
|
|
9427
|
+
* The FlatColorPicker is a powerful tool which allows the user to choose colors through palettes with predefined sets of colors and
|
|
9428
|
+
* through a gradient that renders an hsv canvas. It supports previewing the selected color, reverting it to its previous state or clearing it completely.
|
|
9429
|
+
*/
|
|
9430
|
+
var FlatColorPickerComponent = /** @class */ (function () {
|
|
9431
|
+
function FlatColorPickerComponent(service, host, localizationService, cdr, renderer, ngZone) {
|
|
9432
|
+
var _this = this;
|
|
9433
|
+
this.service = service;
|
|
9434
|
+
this.host = host;
|
|
9435
|
+
this.localizationService = localizationService;
|
|
9436
|
+
this.cdr = cdr;
|
|
9437
|
+
this.renderer = renderer;
|
|
9438
|
+
this.ngZone = ngZone;
|
|
9439
|
+
this.hostClasses = true;
|
|
9440
|
+
/**
|
|
9441
|
+
* Sets the read-only state of the FlatColorPicker.
|
|
9442
|
+
*
|
|
9443
|
+
* @default false
|
|
9444
|
+
*/
|
|
9445
|
+
this.readonly = false;
|
|
9446
|
+
/**
|
|
9447
|
+
* Sets the disabled state of the FlatColorPicker.
|
|
9448
|
+
*
|
|
9449
|
+
* @default false
|
|
9450
|
+
*/
|
|
9451
|
+
this.disabled = false;
|
|
9452
|
+
/**
|
|
9453
|
+
* Specifies the output format of the FlatColorPicker.
|
|
9454
|
+
*
|
|
9455
|
+
* If the input value is in a different format, it will be parsed into the specified output `format`.
|
|
9456
|
+
*
|
|
9457
|
+
* The supported values are:
|
|
9458
|
+
* * `rgba` (default)
|
|
9459
|
+
* * `hex`
|
|
9460
|
+
*/
|
|
9461
|
+
this.format = 'rgba';
|
|
9462
|
+
/**
|
|
9463
|
+
* Specifies whether the FlatColorPicker should display a 'Clear color' button.
|
|
9464
|
+
*
|
|
9465
|
+
* @default true
|
|
9466
|
+
*/
|
|
9467
|
+
this.clearButton = true;
|
|
9468
|
+
/**
|
|
9469
|
+
* Displays `Apply` and `Cancel` action buttons and a color preview pane.
|
|
9470
|
+
*
|
|
9471
|
+
* When enabled, the component value will not change immediately upon
|
|
9472
|
+
* color selection, but only after the `Apply` button is clicked.
|
|
9473
|
+
*
|
|
9474
|
+
* The `Cancel` button reverts the current selection to its
|
|
9475
|
+
* initial state i.e. to the current value.
|
|
9476
|
+
*
|
|
9477
|
+
* @default true
|
|
9478
|
+
*/
|
|
9479
|
+
this.preview = true;
|
|
9480
|
+
/**
|
|
9481
|
+
* Configures the layout of the `Apply` and `Cancel` action buttons.
|
|
9482
|
+
* * `start`
|
|
9483
|
+
* * `center`
|
|
9484
|
+
* * `end` (default)
|
|
9485
|
+
* * `stretch`
|
|
9486
|
+
*/
|
|
9487
|
+
this.actionsLayout = 'end';
|
|
9488
|
+
/**
|
|
9489
|
+
* Specifies the views that will be rendered. Default value is gradient and palette.
|
|
9490
|
+
*/
|
|
9491
|
+
this.views = ['gradient', 'palette'];
|
|
9492
|
+
/**
|
|
9493
|
+
* Fires each time the component value is changed.
|
|
9494
|
+
*/
|
|
9495
|
+
this.valueChange = new EventEmitter();
|
|
9496
|
+
/**
|
|
9497
|
+
* Fires when the user cancels the current color selection.
|
|
9498
|
+
*
|
|
9499
|
+
* The event is emitted on preview pane or on 'Cancel' button click.
|
|
9500
|
+
*/
|
|
9501
|
+
this.cancel = new EventEmitter();
|
|
9502
|
+
/**
|
|
9503
|
+
* Fires each time the view is about to change.
|
|
9504
|
+
* Used to provide a two-way binding for the `activeView` property.
|
|
9505
|
+
*/
|
|
9506
|
+
this.activeViewChange = new EventEmitter();
|
|
9507
|
+
/**
|
|
9508
|
+
* @hidden
|
|
9509
|
+
*/
|
|
9510
|
+
this.actionButtonClick = new EventEmitter();
|
|
9511
|
+
this._tabindex = 0;
|
|
9512
|
+
this._gradientSettings = { opacity: true, delay: 0 };
|
|
9513
|
+
this._paletteSettings = {};
|
|
9514
|
+
this.subscriptions = new Subscription();
|
|
9515
|
+
this.notifyNgChanged = function () { };
|
|
9516
|
+
this.notifyNgTouched = function () { };
|
|
9517
|
+
this.dynamicRTLSubscription = this.localizationService.changes.subscribe(function (_a) {
|
|
9518
|
+
var rtl = _a.rtl;
|
|
9519
|
+
_this.direction = rtl ? 'rtl' : 'ltr';
|
|
9520
|
+
});
|
|
9521
|
+
}
|
|
9522
|
+
FlatColorPickerComponent_1 = FlatColorPickerComponent;
|
|
9523
|
+
Object.defineProperty(FlatColorPickerComponent.prototype, "disabledClass", {
|
|
9524
|
+
get: function () {
|
|
9525
|
+
return this.disabled;
|
|
9526
|
+
},
|
|
9527
|
+
enumerable: true,
|
|
9528
|
+
configurable: true
|
|
9529
|
+
});
|
|
9530
|
+
Object.defineProperty(FlatColorPickerComponent.prototype, "ariaReadonly", {
|
|
9531
|
+
get: function () {
|
|
9532
|
+
return this.readonly;
|
|
9533
|
+
},
|
|
9534
|
+
enumerable: true,
|
|
9535
|
+
configurable: true
|
|
9536
|
+
});
|
|
9537
|
+
Object.defineProperty(FlatColorPickerComponent.prototype, "hostTabindex", {
|
|
9538
|
+
get: function () {
|
|
9539
|
+
return this.tabindex;
|
|
9540
|
+
},
|
|
9541
|
+
enumerable: true,
|
|
9542
|
+
configurable: true
|
|
9543
|
+
});
|
|
9544
|
+
Object.defineProperty(FlatColorPickerComponent.prototype, "value", {
|
|
9545
|
+
get: function () {
|
|
9546
|
+
return this._value;
|
|
9547
|
+
},
|
|
9548
|
+
/**
|
|
9549
|
+
* Specifies the initially selected color.
|
|
9550
|
+
*/
|
|
9551
|
+
set: function (value) {
|
|
9552
|
+
this._value = parseColor$1(value, this.format, this.gradientSettings.opacity);
|
|
9553
|
+
},
|
|
9554
|
+
enumerable: true,
|
|
9555
|
+
configurable: true
|
|
9556
|
+
});
|
|
9557
|
+
Object.defineProperty(FlatColorPickerComponent.prototype, "tabindex", {
|
|
9558
|
+
get: function () {
|
|
9559
|
+
return !this.disabled ? this._tabindex : undefined;
|
|
9560
|
+
},
|
|
9561
|
+
/**
|
|
9562
|
+
* Specifies the [tabindex](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the component.
|
|
9563
|
+
*
|
|
9564
|
+
* @default 0
|
|
9565
|
+
*/
|
|
9566
|
+
set: function (value) {
|
|
9567
|
+
var tabindex = Number(value);
|
|
9568
|
+
var defaultValue = 0;
|
|
9569
|
+
this._tabindex = !isNaN(tabindex) ? tabindex : defaultValue;
|
|
9570
|
+
},
|
|
9571
|
+
enumerable: true,
|
|
9572
|
+
configurable: true
|
|
9573
|
+
});
|
|
9574
|
+
Object.defineProperty(FlatColorPickerComponent.prototype, "gradientSettings", {
|
|
9575
|
+
get: function () {
|
|
9576
|
+
return this._gradientSettings;
|
|
9577
|
+
},
|
|
9578
|
+
/**
|
|
9579
|
+
* Configures the gradient view.
|
|
9580
|
+
*/
|
|
9581
|
+
set: function (value) {
|
|
9582
|
+
Object.assign(this._gradientSettings, value);
|
|
9583
|
+
},
|
|
9584
|
+
enumerable: true,
|
|
9585
|
+
configurable: true
|
|
9586
|
+
});
|
|
9587
|
+
Object.defineProperty(FlatColorPickerComponent.prototype, "paletteSettings", {
|
|
9588
|
+
get: function () {
|
|
9589
|
+
return this._paletteSettings;
|
|
9590
|
+
},
|
|
9591
|
+
/**
|
|
9592
|
+
* Configures the palette view.
|
|
9593
|
+
*/
|
|
9594
|
+
set: function (value) {
|
|
9595
|
+
Object.assign(this._paletteSettings, value);
|
|
9596
|
+
},
|
|
9597
|
+
enumerable: true,
|
|
9598
|
+
configurable: true
|
|
9599
|
+
});
|
|
9600
|
+
FlatColorPickerComponent.prototype.ngOnInit = function () {
|
|
9601
|
+
this.selection = this.value;
|
|
9602
|
+
this._paletteSettings = this.service.getPaletteSettings(this._paletteSettings, this.format);
|
|
9603
|
+
this.setActiveView();
|
|
9604
|
+
};
|
|
9605
|
+
FlatColorPickerComponent.prototype.ngAfterViewInit = function () {
|
|
9606
|
+
this.setHostElementAriaLabel();
|
|
9607
|
+
this.initDomEvents();
|
|
9608
|
+
this.setSizingVariables();
|
|
9609
|
+
};
|
|
9610
|
+
FlatColorPickerComponent.prototype.ngOnChanges = function (changes) {
|
|
9611
|
+
if (isChanged('value', changes)) {
|
|
9612
|
+
this.setHostElementAriaLabel();
|
|
9613
|
+
}
|
|
9614
|
+
if (isChanged('paletteSettings', changes)) {
|
|
9615
|
+
this.setSizingVariables();
|
|
9616
|
+
}
|
|
9617
|
+
};
|
|
9618
|
+
FlatColorPickerComponent.prototype.ngOnDestroy = function () {
|
|
9619
|
+
if (this.dynamicRTLSubscription) {
|
|
9620
|
+
this.dynamicRTLSubscription.unsubscribe();
|
|
9621
|
+
}
|
|
9622
|
+
this.subscriptions.unsubscribe();
|
|
9623
|
+
};
|
|
9624
|
+
Object.defineProperty(FlatColorPickerComponent.prototype, "headerHasContent", {
|
|
9625
|
+
/**
|
|
9626
|
+
* @hidden
|
|
9627
|
+
*/
|
|
9628
|
+
get: function () {
|
|
9629
|
+
return this.preview || this.views.length > 1 || this.clearButton;
|
|
9630
|
+
},
|
|
9631
|
+
enumerable: true,
|
|
9632
|
+
configurable: true
|
|
9633
|
+
});
|
|
9634
|
+
/**
|
|
9635
|
+
* @hidden
|
|
9636
|
+
* Used by the FloatingLabel to determine if the component is empty.
|
|
9637
|
+
*/
|
|
9638
|
+
FlatColorPickerComponent.prototype.isEmpty = function () {
|
|
9639
|
+
return false;
|
|
9640
|
+
};
|
|
9641
|
+
/**
|
|
9642
|
+
* Focuses the wrapper of the FlatColorPicker.
|
|
9643
|
+
*/
|
|
9644
|
+
FlatColorPickerComponent.prototype.focus = function () {
|
|
9645
|
+
if (this.disabled && this.focused) {
|
|
9646
|
+
return;
|
|
9647
|
+
}
|
|
9648
|
+
this.host.nativeElement.focus();
|
|
9649
|
+
this.focused = true;
|
|
9650
|
+
};
|
|
9651
|
+
/**
|
|
9652
|
+
* Blurs the wrapper of the FlatColorPicker.
|
|
9653
|
+
*/
|
|
9654
|
+
FlatColorPickerComponent.prototype.blur = function () {
|
|
9655
|
+
if (!this.focused) {
|
|
8741
9656
|
return;
|
|
8742
9657
|
}
|
|
8743
|
-
this.isFocused = false;
|
|
8744
|
-
this.onBlur.emit();
|
|
8745
9658
|
this.notifyNgTouched();
|
|
9659
|
+
this.host.nativeElement.blur();
|
|
9660
|
+
this.focused = false;
|
|
8746
9661
|
};
|
|
8747
9662
|
/**
|
|
8748
|
-
* Clears the
|
|
9663
|
+
* Clears the value of the FlatColorPicker.
|
|
8749
9664
|
*/
|
|
8750
|
-
|
|
9665
|
+
FlatColorPickerComponent.prototype.reset = function () {
|
|
8751
9666
|
if (!isPresent(this.value)) {
|
|
8752
9667
|
return;
|
|
8753
9668
|
}
|
|
8754
|
-
this.
|
|
9669
|
+
this.value = undefined;
|
|
8755
9670
|
this.notifyNgChanged(undefined);
|
|
9671
|
+
this.setHostElementAriaLabel();
|
|
8756
9672
|
};
|
|
8757
9673
|
/**
|
|
8758
|
-
*
|
|
8759
|
-
* Does not trigger the `open` and `close` events of the component.
|
|
8760
|
-
*
|
|
8761
|
-
* @param open An optional parameter. Specifies whether the popup will be opened or closed.
|
|
9674
|
+
* @hidden
|
|
8762
9675
|
*/
|
|
8763
|
-
|
|
8764
|
-
|
|
9676
|
+
FlatColorPickerComponent.prototype.onViewChange = function (view) {
|
|
9677
|
+
var _this = this;
|
|
9678
|
+
if (this.activeView === view) {
|
|
8765
9679
|
return;
|
|
8766
9680
|
}
|
|
8767
|
-
this.
|
|
8768
|
-
|
|
8769
|
-
if (
|
|
8770
|
-
this.
|
|
9681
|
+
this.activeView = view;
|
|
9682
|
+
this.activeViewChange.emit(view);
|
|
9683
|
+
if (this.activeView === 'gradient') {
|
|
9684
|
+
this.ngZone.runOutsideAngular(function () {
|
|
9685
|
+
setTimeout(function () {
|
|
9686
|
+
_this.gradient.gradientDragHandle.nativeElement.focus();
|
|
9687
|
+
});
|
|
9688
|
+
});
|
|
8771
9689
|
}
|
|
8772
9690
|
};
|
|
8773
9691
|
/**
|
|
8774
9692
|
* @hidden
|
|
8775
9693
|
*/
|
|
8776
|
-
|
|
8777
|
-
|
|
8778
|
-
|
|
8779
|
-
if (closePopup) {
|
|
8780
|
-
this.toggleWithEvents(false);
|
|
8781
|
-
this.focus();
|
|
8782
|
-
}
|
|
8783
|
-
if (valueChange) {
|
|
8784
|
-
this.value = parsedColor;
|
|
8785
|
-
this.valueChange.emit(parsedColor);
|
|
8786
|
-
this.notifyNgChanged(parsedColor);
|
|
8787
|
-
}
|
|
9694
|
+
FlatColorPickerComponent.prototype.onClearButtonClick = function () {
|
|
9695
|
+
this.resetInnerComponentValue();
|
|
9696
|
+
this.host.nativeElement.focus();
|
|
8788
9697
|
};
|
|
8789
9698
|
/**
|
|
8790
9699
|
* @hidden
|
|
8791
9700
|
*/
|
|
8792
|
-
|
|
8793
|
-
|
|
8794
|
-
var wrapperClicked = event.relatedTarget === this.wrapper.nativeElement;
|
|
8795
|
-
if (!this.isFocused || wrapperClicked || focusInPopupElement) {
|
|
9701
|
+
FlatColorPickerComponent.prototype.handleValueChange = function (color) {
|
|
9702
|
+
if (this.value === color) {
|
|
8796
9703
|
return;
|
|
8797
9704
|
}
|
|
8798
|
-
this.
|
|
8799
|
-
|
|
8800
|
-
|
|
8801
|
-
|
|
9705
|
+
if (this.preview) {
|
|
9706
|
+
this.changeCurrentValue(color);
|
|
9707
|
+
}
|
|
9708
|
+
else {
|
|
9709
|
+
this.setFlatColorPickerValue(color);
|
|
9710
|
+
}
|
|
8802
9711
|
};
|
|
8803
9712
|
/**
|
|
8804
9713
|
* @hidden
|
|
8805
9714
|
*/
|
|
8806
|
-
|
|
9715
|
+
FlatColorPickerComponent.prototype.onAction = function (ev) {
|
|
9716
|
+
ev.target === 'apply' ? this.setFlatColorPickerValue(this.selection) : this.resetSelection(ev.originalEvent);
|
|
9717
|
+
this.actionButtonClick.emit();
|
|
9718
|
+
};
|
|
9719
|
+
/**
|
|
9720
|
+
* @hidden
|
|
9721
|
+
*/
|
|
9722
|
+
FlatColorPickerComponent.prototype.writeValue = function (value) {
|
|
8807
9723
|
this.value = value;
|
|
8808
9724
|
};
|
|
8809
9725
|
/**
|
|
8810
9726
|
* @hidden
|
|
8811
9727
|
*/
|
|
8812
|
-
|
|
9728
|
+
FlatColorPickerComponent.prototype.registerOnChange = function (fn) {
|
|
8813
9729
|
this.notifyNgChanged = fn;
|
|
8814
9730
|
};
|
|
8815
9731
|
/**
|
|
8816
9732
|
* @hidden
|
|
8817
9733
|
*/
|
|
8818
|
-
|
|
9734
|
+
FlatColorPickerComponent.prototype.registerOnTouched = function (fn) {
|
|
8819
9735
|
this.notifyNgTouched = fn;
|
|
8820
9736
|
};
|
|
8821
9737
|
/**
|
|
8822
9738
|
* @hidden
|
|
8823
9739
|
*/
|
|
8824
|
-
|
|
9740
|
+
FlatColorPickerComponent.prototype.setDisabledState = function (isDisabled) {
|
|
8825
9741
|
this.cdr.markForCheck();
|
|
8826
9742
|
this.disabled = isDisabled;
|
|
8827
9743
|
};
|
|
8828
9744
|
/**
|
|
8829
9745
|
* @hidden
|
|
8830
9746
|
*/
|
|
8831
|
-
|
|
8832
|
-
|
|
8833
|
-
|
|
8834
|
-
|
|
9747
|
+
FlatColorPickerComponent.prototype.resetSelection = function (ev) {
|
|
9748
|
+
var eventArgs = new ColorPickerCancelEvent(ev);
|
|
9749
|
+
this.cancel.emit(eventArgs);
|
|
9750
|
+
if (!eventArgs.isDefaultPrevented()) {
|
|
9751
|
+
this.selection = this.value;
|
|
8835
9752
|
}
|
|
9753
|
+
this.notifyNgTouched();
|
|
8836
9754
|
};
|
|
8837
|
-
|
|
8838
|
-
|
|
8839
|
-
|
|
8840
|
-
|
|
8841
|
-
if (event.keyCode === Keys.Escape) {
|
|
8842
|
-
this.toggleWithEvents(false);
|
|
8843
|
-
this.wrapper.nativeElement.focus();
|
|
8844
|
-
}
|
|
8845
|
-
if (event.keyCode === Keys.Tab) {
|
|
8846
|
-
var firstElement = this.colorGradient ? this.colorGradient.gradientDragHandle.nativeElement : this.palette.nativeElement;
|
|
8847
|
-
var lastElement = this.palette ? this.palette.nativeElement :
|
|
8848
|
-
this.colorGradient.inputs.opacityInput.nativeElement.childNodes[1].children[0];
|
|
8849
|
-
if (event.shiftKey) {
|
|
8850
|
-
if (event.target === firstElement) {
|
|
8851
|
-
event.preventDefault();
|
|
8852
|
-
lastElement.focus();
|
|
8853
|
-
return;
|
|
8854
|
-
}
|
|
8855
|
-
}
|
|
8856
|
-
else {
|
|
8857
|
-
if (event.target === lastElement) {
|
|
8858
|
-
event.preventDefault();
|
|
8859
|
-
firstElement.focus();
|
|
8860
|
-
return;
|
|
8861
|
-
}
|
|
8862
|
-
}
|
|
8863
|
-
}
|
|
9755
|
+
FlatColorPickerComponent.prototype.setHostElementAriaLabel = function () {
|
|
9756
|
+
var parsed = parseColor$1(this.value, this.format, this.gradientSettings.opacity);
|
|
9757
|
+
var ariaLabelValue = "" + (this.value ? parsed : this.localizationService.get('flatColorPickerNoColor'));
|
|
9758
|
+
this.renderer.setAttribute(this.host.nativeElement, 'aria-label', ariaLabelValue);
|
|
8864
9759
|
};
|
|
8865
|
-
|
|
8866
|
-
|
|
8867
|
-
|
|
8868
|
-
|
|
8869
|
-
ColorPickerComponent.prototype.isEmpty = function () {
|
|
8870
|
-
return false;
|
|
9760
|
+
FlatColorPickerComponent.prototype.setSizingVariables = function () {
|
|
9761
|
+
var paletteTileSize = this.service.paletteTileLayout(this.paletteSettings.tileSize);
|
|
9762
|
+
var value = "--kendo-color-preview-columns: " + this.paletteSettings.columns + ";\n --kendo-color-preview-width: " + paletteTileSize.width + "px;\n --kendo-color-preview-height: " + paletteTileSize.height + "px;";
|
|
9763
|
+
this.host.nativeElement.querySelector('.k-coloreditor-views.k-vstack').setAttribute('style', value);
|
|
8871
9764
|
};
|
|
8872
|
-
|
|
8873
|
-
|
|
8874
|
-
|
|
8875
|
-
|
|
9765
|
+
FlatColorPickerComponent.prototype.changeCurrentValue = function (color) {
|
|
9766
|
+
this.selection = color;
|
|
9767
|
+
this.notifyNgTouched();
|
|
9768
|
+
};
|
|
9769
|
+
FlatColorPickerComponent.prototype.resetInnerComponentValue = function () {
|
|
9770
|
+
this.selection = null;
|
|
9771
|
+
if (this.gradient) {
|
|
9772
|
+
this.gradient.reset();
|
|
8876
9773
|
return;
|
|
8877
9774
|
}
|
|
8878
|
-
|
|
8879
|
-
|
|
8880
|
-
|
|
8881
|
-
|
|
9775
|
+
this.palette.reset();
|
|
9776
|
+
};
|
|
9777
|
+
FlatColorPickerComponent.prototype.setFlatColorPickerValue = function (color) {
|
|
9778
|
+
if (this.value === color) {
|
|
9779
|
+
return;
|
|
8882
9780
|
}
|
|
8883
|
-
|
|
8884
|
-
|
|
8885
|
-
|
|
8886
|
-
|
|
8887
|
-
|
|
8888
|
-
|
|
8889
|
-
|
|
8890
|
-
|
|
9781
|
+
this.value = color;
|
|
9782
|
+
this.valueChange.emit(color);
|
|
9783
|
+
this.notifyNgChanged(color);
|
|
9784
|
+
this.setHostElementAriaLabel();
|
|
9785
|
+
};
|
|
9786
|
+
FlatColorPickerComponent.prototype.setActiveView = function () {
|
|
9787
|
+
if (!isPresent(this.activeView)) {
|
|
9788
|
+
this.activeView = this.views[0];
|
|
9789
|
+
return;
|
|
9790
|
+
}
|
|
9791
|
+
if (isDevMode() && this.views.indexOf(this.activeView) === -1) {
|
|
9792
|
+
throw new Error("Invalid configuration: The current activeView is not present in the views collection");
|
|
8891
9793
|
}
|
|
8892
9794
|
};
|
|
8893
|
-
|
|
9795
|
+
FlatColorPickerComponent.prototype.initDomEvents = function () {
|
|
8894
9796
|
var _this = this;
|
|
8895
|
-
|
|
8896
|
-
var anchorPosition = { horizontal: horizontalAlign, vertical: "bottom" };
|
|
8897
|
-
var popupPosition = { horizontal: horizontalAlign, vertical: "top" };
|
|
8898
|
-
this.popupRef = this.popupService.open({
|
|
8899
|
-
anchor: this.wrapper,
|
|
8900
|
-
animate: this.popupSettings.animate,
|
|
8901
|
-
appendTo: this.popupSettings.appendTo,
|
|
8902
|
-
popupAlign: popupPosition,
|
|
8903
|
-
anchorAlign: anchorPosition,
|
|
8904
|
-
popupClass: 'k-colorpicker-popup',
|
|
8905
|
-
content: this.popupTemplate,
|
|
8906
|
-
positionMode: 'absolute'
|
|
8907
|
-
});
|
|
8908
|
-
this.popupRef.popupAnchorViewportLeave.subscribe(function () {
|
|
8909
|
-
_this.toggleWithEvents(false);
|
|
8910
|
-
if (!_this.isOpen) {
|
|
8911
|
-
_this.wrapper.nativeElement.focus({
|
|
8912
|
-
preventScroll: true
|
|
8913
|
-
});
|
|
8914
|
-
}
|
|
8915
|
-
});
|
|
8916
|
-
};
|
|
8917
|
-
ColorPickerComponent.prototype.closePopup = function () {
|
|
8918
|
-
if (!this.isOpen) {
|
|
9797
|
+
if (!this.host) {
|
|
8919
9798
|
return;
|
|
8920
9799
|
}
|
|
8921
|
-
this.
|
|
8922
|
-
this.
|
|
8923
|
-
|
|
9800
|
+
var hostElement = this.host.nativeElement;
|
|
9801
|
+
this.ngZone.runOutsideAngular(function () {
|
|
9802
|
+
_this.subscriptions.add(_this.renderer.listen(hostElement, 'focus', function () {
|
|
9803
|
+
_this.focused = true;
|
|
9804
|
+
}));
|
|
9805
|
+
_this.subscriptions.add(_this.renderer.listen(hostElement, 'blur', function () {
|
|
9806
|
+
_this.focused = false;
|
|
9807
|
+
_this.notifyNgTouched();
|
|
9808
|
+
}));
|
|
9809
|
+
});
|
|
8924
9810
|
};
|
|
8925
|
-
var
|
|
9811
|
+
var FlatColorPickerComponent_1;
|
|
8926
9812
|
__decorate([
|
|
8927
|
-
HostBinding('class.k-
|
|
8928
|
-
HostBinding('class.k-
|
|
9813
|
+
HostBinding('class.k-flatcolorpicker'),
|
|
9814
|
+
HostBinding('class.k-coloreditor'),
|
|
8929
9815
|
__metadata("design:type", Boolean)
|
|
8930
|
-
],
|
|
9816
|
+
], FlatColorPickerComponent.prototype, "hostClasses", void 0);
|
|
8931
9817
|
__decorate([
|
|
8932
|
-
HostBinding('
|
|
8933
|
-
|
|
8934
|
-
|
|
9818
|
+
HostBinding('class.k-state-disabled'),
|
|
9819
|
+
HostBinding('attr.aria-disabled'),
|
|
9820
|
+
__metadata("design:type", Boolean),
|
|
9821
|
+
__metadata("design:paramtypes", [])
|
|
9822
|
+
], FlatColorPickerComponent.prototype, "disabledClass", null);
|
|
8935
9823
|
__decorate([
|
|
8936
|
-
|
|
8937
|
-
__metadata("design:type",
|
|
8938
|
-
|
|
9824
|
+
HostBinding('attr.aria-readonly'),
|
|
9825
|
+
__metadata("design:type", Boolean),
|
|
9826
|
+
__metadata("design:paramtypes", [])
|
|
9827
|
+
], FlatColorPickerComponent.prototype, "ariaReadonly", null);
|
|
8939
9828
|
__decorate([
|
|
8940
|
-
|
|
9829
|
+
HostBinding('attr.dir'),
|
|
8941
9830
|
__metadata("design:type", String)
|
|
8942
|
-
],
|
|
9831
|
+
], FlatColorPickerComponent.prototype, "direction", void 0);
|
|
9832
|
+
__decorate([
|
|
9833
|
+
HostBinding('attr.tabindex'),
|
|
9834
|
+
__metadata("design:type", Number),
|
|
9835
|
+
__metadata("design:paramtypes", [])
|
|
9836
|
+
], FlatColorPickerComponent.prototype, "hostTabindex", null);
|
|
8943
9837
|
__decorate([
|
|
8944
9838
|
Input(),
|
|
8945
9839
|
__metadata("design:type", Boolean)
|
|
8946
|
-
],
|
|
9840
|
+
], FlatColorPickerComponent.prototype, "readonly", void 0);
|
|
8947
9841
|
__decorate([
|
|
8948
9842
|
Input(),
|
|
8949
9843
|
__metadata("design:type", Boolean)
|
|
8950
|
-
],
|
|
9844
|
+
], FlatColorPickerComponent.prototype, "disabled", void 0);
|
|
8951
9845
|
__decorate([
|
|
8952
9846
|
Input(),
|
|
8953
9847
|
__metadata("design:type", String)
|
|
8954
|
-
],
|
|
9848
|
+
], FlatColorPickerComponent.prototype, "format", void 0);
|
|
8955
9849
|
__decorate([
|
|
8956
9850
|
Input(),
|
|
8957
9851
|
__metadata("design:type", String),
|
|
8958
9852
|
__metadata("design:paramtypes", [String])
|
|
8959
|
-
],
|
|
9853
|
+
], FlatColorPickerComponent.prototype, "value", null);
|
|
8960
9854
|
__decorate([
|
|
8961
9855
|
Input(),
|
|
8962
|
-
__metadata("design:type",
|
|
8963
|
-
__metadata("design:paramtypes", [
|
|
8964
|
-
],
|
|
9856
|
+
__metadata("design:type", Number),
|
|
9857
|
+
__metadata("design:paramtypes", [Number])
|
|
9858
|
+
], FlatColorPickerComponent.prototype, "tabindex", null);
|
|
8965
9859
|
__decorate([
|
|
8966
9860
|
Input(),
|
|
8967
|
-
__metadata("design:type",
|
|
8968
|
-
|
|
8969
|
-
], ColorPickerComponent.prototype, "paletteSettings", null);
|
|
9861
|
+
__metadata("design:type", Boolean)
|
|
9862
|
+
], FlatColorPickerComponent.prototype, "clearButton", void 0);
|
|
8970
9863
|
__decorate([
|
|
8971
9864
|
Input(),
|
|
8972
|
-
__metadata("design:type",
|
|
8973
|
-
|
|
8974
|
-
], ColorPickerComponent.prototype, "gradientSettings", null);
|
|
9865
|
+
__metadata("design:type", Boolean)
|
|
9866
|
+
], FlatColorPickerComponent.prototype, "preview", void 0);
|
|
8975
9867
|
__decorate([
|
|
8976
9868
|
Input(),
|
|
8977
9869
|
__metadata("design:type", String)
|
|
8978
|
-
],
|
|
9870
|
+
], FlatColorPickerComponent.prototype, "actionsLayout", void 0);
|
|
8979
9871
|
__decorate([
|
|
8980
9872
|
Input(),
|
|
8981
|
-
__metadata("design:type",
|
|
8982
|
-
],
|
|
9873
|
+
__metadata("design:type", String)
|
|
9874
|
+
], FlatColorPickerComponent.prototype, "activeView", void 0);
|
|
8983
9875
|
__decorate([
|
|
8984
9876
|
Input(),
|
|
8985
|
-
__metadata("design:type",
|
|
8986
|
-
|
|
8987
|
-
], ColorPickerComponent.prototype, "tabindex", null);
|
|
9877
|
+
__metadata("design:type", Array)
|
|
9878
|
+
], FlatColorPickerComponent.prototype, "views", void 0);
|
|
8988
9879
|
__decorate([
|
|
8989
|
-
|
|
8990
|
-
__metadata("design:type",
|
|
8991
|
-
|
|
9880
|
+
Input(),
|
|
9881
|
+
__metadata("design:type", Object),
|
|
9882
|
+
__metadata("design:paramtypes", [Object])
|
|
9883
|
+
], FlatColorPickerComponent.prototype, "gradientSettings", null);
|
|
8992
9884
|
__decorate([
|
|
8993
|
-
|
|
8994
|
-
__metadata("design:type",
|
|
8995
|
-
|
|
9885
|
+
Input(),
|
|
9886
|
+
__metadata("design:type", Object),
|
|
9887
|
+
__metadata("design:paramtypes", [Object])
|
|
9888
|
+
], FlatColorPickerComponent.prototype, "paletteSettings", null);
|
|
8996
9889
|
__decorate([
|
|
8997
9890
|
Output(),
|
|
8998
9891
|
__metadata("design:type", EventEmitter)
|
|
8999
|
-
],
|
|
9892
|
+
], FlatColorPickerComponent.prototype, "valueChange", void 0);
|
|
9000
9893
|
__decorate([
|
|
9001
|
-
Output(
|
|
9894
|
+
Output(),
|
|
9002
9895
|
__metadata("design:type", EventEmitter)
|
|
9003
|
-
],
|
|
9896
|
+
], FlatColorPickerComponent.prototype, "cancel", void 0);
|
|
9004
9897
|
__decorate([
|
|
9005
|
-
Output(
|
|
9898
|
+
Output(),
|
|
9006
9899
|
__metadata("design:type", EventEmitter)
|
|
9007
|
-
],
|
|
9900
|
+
], FlatColorPickerComponent.prototype, "activeViewChange", void 0);
|
|
9008
9901
|
__decorate([
|
|
9009
9902
|
Output(),
|
|
9010
9903
|
__metadata("design:type", EventEmitter)
|
|
9011
|
-
],
|
|
9012
|
-
__decorate([
|
|
9013
|
-
ViewChild('container', { read: ViewContainerRef, static: true }),
|
|
9014
|
-
__metadata("design:type", ViewContainerRef)
|
|
9015
|
-
], ColorPickerComponent.prototype, "container", void 0);
|
|
9904
|
+
], FlatColorPickerComponent.prototype, "actionButtonClick", void 0);
|
|
9016
9905
|
__decorate([
|
|
9017
|
-
ViewChild('
|
|
9018
|
-
__metadata("design:type",
|
|
9019
|
-
],
|
|
9906
|
+
ViewChild('header', { static: false }),
|
|
9907
|
+
__metadata("design:type", FlatColorPickerHeaderComponent)
|
|
9908
|
+
], FlatColorPickerComponent.prototype, "header", void 0);
|
|
9020
9909
|
__decorate([
|
|
9021
|
-
ViewChild('
|
|
9022
|
-
__metadata("design:type",
|
|
9023
|
-
],
|
|
9910
|
+
ViewChild('gradient', { static: false }),
|
|
9911
|
+
__metadata("design:type", ColorGradientComponent)
|
|
9912
|
+
], FlatColorPickerComponent.prototype, "gradient", void 0);
|
|
9024
9913
|
__decorate([
|
|
9025
|
-
ViewChild('palette', {
|
|
9026
|
-
__metadata("design:type",
|
|
9027
|
-
],
|
|
9914
|
+
ViewChild('palette', { static: false }),
|
|
9915
|
+
__metadata("design:type", ColorPaletteComponent)
|
|
9916
|
+
], FlatColorPickerComponent.prototype, "palette", void 0);
|
|
9028
9917
|
__decorate([
|
|
9029
|
-
ViewChild('
|
|
9030
|
-
__metadata("design:type",
|
|
9031
|
-
],
|
|
9032
|
-
|
|
9918
|
+
ViewChild('footer', { static: false }),
|
|
9919
|
+
__metadata("design:type", FlatColorPickerActionButtonsComponent)
|
|
9920
|
+
], FlatColorPickerComponent.prototype, "footer", void 0);
|
|
9921
|
+
FlatColorPickerComponent = FlatColorPickerComponent_1 = __decorate([
|
|
9033
9922
|
Component({
|
|
9034
|
-
|
|
9035
|
-
|
|
9923
|
+
exportAs: 'kendoFlatColorPicker',
|
|
9924
|
+
selector: 'kendo-flatcolorpicker',
|
|
9925
|
+
providers: [
|
|
9926
|
+
{
|
|
9036
9927
|
multi: true,
|
|
9037
9928
|
provide: NG_VALUE_ACCESSOR,
|
|
9038
|
-
useExisting: forwardRef(function () { return
|
|
9039
|
-
},
|
|
9929
|
+
useExisting: forwardRef(function () { return FlatColorPickerComponent_1; })
|
|
9930
|
+
},
|
|
9931
|
+
{
|
|
9040
9932
|
provide: KendoInput,
|
|
9041
|
-
useExisting: forwardRef(function () { return
|
|
9933
|
+
useExisting: forwardRef(function () { return FlatColorPickerComponent_1; })
|
|
9042
9934
|
},
|
|
9043
|
-
|
|
9935
|
+
FlatColorPickerService,
|
|
9936
|
+
FlatColorPickerLocalizationService,
|
|
9044
9937
|
{
|
|
9045
9938
|
provide: LocalizationService,
|
|
9046
|
-
useExisting:
|
|
9939
|
+
useExisting: FlatColorPickerLocalizationService
|
|
9047
9940
|
},
|
|
9048
9941
|
{
|
|
9049
9942
|
provide: L10N_PREFIX,
|
|
9050
|
-
useValue: 'kendo.
|
|
9943
|
+
useValue: 'kendo.flatcolorpicker'
|
|
9051
9944
|
}
|
|
9052
9945
|
],
|
|
9053
|
-
template: "\n <ng-container
|
|
9054
|
-
}),
|
|
9055
|
-
__metadata("design:paramtypes", [
|
|
9056
|
-
|
|
9946
|
+
template: "\n <ng-container kendoFlatColorPickerLocalizedMessages\n i18n-flatColorPickerNoColor=\"kendo.flatcolorpicker.flatColorPickerNoColor|The aria-label applied to the FlatColorPicker component when the value is empty.\"\n flatColorPickerNoColor=\"Flatcolorpicker no color chosen\"\n i18n-colorGradientNoColor=\"kendo.flatcolorpicker.colorGradientNoColor|The aria-label applied to the ColorGradient component when the value is empty.\"\n colorGradientNoColor=\"Colorgradient no color chosen\"\n i18n-colorPaletteNoColor=\"kendo.flatcolorpicker.colorPaletteNoColor|The aria-label applied to the ColorPalette component when the value is empty.\"\n colorPaletteNoColor=\"Colorpalette no color chosen\"\n i18n-colorGradientHandle=\"kendo.flatcolorpicker.colorGradientHandle|The title for the gradient color drag handle chooser.\"\n colorGradientHandle=\"Choose color\"\n i18n-clearButton=\"kendo.flatcolorpicker.clearButton|The title for the clear button.\"\n clearButton=\"Clear value\"\n i18n-hueSliderHandle=\"kendo.flatcolorpicker.hueSliderHandle|The title for the hue slider handle.\"\n hueSliderHandle=\"Set hue\"\n i18n-opacitySliderHandle=\"kendo.flatcolorpicker.opacitySliderHandle|The title for the opacity slider handle.\"\n opacitySliderHandle=\"Set opacity\"\n i18n-contrastRatio=\"kendo.flatcolorpicker.contrastRatio|The contrast ratio message for the contrast tool.\"\n contrastRatio=\"Contrast ratio\"\n i18n-previewColor=\"kendo.flatcolorpicker.previewColor|The message for the color preview pane.\"\n previewColor=\"Color preview\"\n i18n-revertSelection=\"kendo.flatcolorpicker.revertSelection|The message for the selected color pane.\"\n revertSelection=\"Revert selection\"\n i18n-gradientView=\"kendo.flatcolorpicker.gradientView|The message for the gradient view button.\"\n gradientView=\"Gradient view\"\n i18n-paletteView=\"kendo.flatcolorpicker.paletteView|The message for the palette view button.\"\n paletteView=\"Palette view\"\n i18n-formatButton=\"kendo.flatcolorpicker.formatButton|The message for the input format toggle button.\"\n formatButton=\"Change color format\"\n i18n-applyButton=\"kendo.flatcolorpicker.applyButton|The message for the Apply action button.\"\n applyButton=\"Apply\"\n i18n-cancelButton=\"kendo.flatcolorpicker.cancelButton|The message for the Cancel action button.\"\n cancelButton=\"Cancel\">\n </ng-container>\n <div kendoFlatColorPickerHeader\n *ngIf=\"headerHasContent\"\n #header\n [clearButton]=\"clearButton\"\n [activeView]=\"activeView\"\n [views]=\"views\"\n [value]=\"value\"\n [selection]=\"selection\"\n [preview]=\"preview\"\n (clearButtonClick)=\"onClearButtonClick()\"\n (viewChange)=\"onViewChange($event)\"\n (valuePaneClick)=\"resetSelection($event)\">\n </div>\n <div class=\"k-coloreditor-views k-vstack\">\n <kendo-colorgradient #gradient\n *ngIf=\"activeView === 'gradient'\"\n [tabindex]=\"null\"\n [value]=\"selection\"\n [format]=\"format\"\n [opacity]=\"gradientSettings.opacity\"\n [delay]=\"gradientSettings.delay\"\n [contrastTool]=\"gradientSettings.contrastTool\"\n [readonly]=\"readonly\"\n (valueChange)=\"handleValueChange($event)\"\n >\n </kendo-colorgradient>\n <kendo-colorpalette #palette\n *ngIf=\"activeView === 'palette'\"\n kendoFocusOnDomReady\n [palette]=\"paletteSettings.palette\"\n [columns]=\"paletteSettings.columns\"\n [tileSize]=\"paletteSettings.tileSize\"\n [format]=\"format\"\n [value]=\"selection\"\n (valueChange)=\"handleValueChange($event)\"\n >\n </kendo-colorpalette>\n </div>\n <div kendoFlatColorPickerActionButtons *ngIf=\"preview\"\n #footer\n [ngClass]=\"'k-justify-content-' + actionsLayout\"\n (actionButtonClick)=\"onAction($event)\">\n </div>\n"
|
|
9947
|
+
}),
|
|
9948
|
+
__metadata("design:paramtypes", [FlatColorPickerService,
|
|
9949
|
+
ElementRef,
|
|
9057
9950
|
LocalizationService,
|
|
9951
|
+
ChangeDetectorRef,
|
|
9952
|
+
Renderer2,
|
|
9058
9953
|
NgZone])
|
|
9059
|
-
],
|
|
9060
|
-
return
|
|
9061
|
-
}());
|
|
9062
|
-
|
|
9063
|
-
/**
|
|
9064
|
-
* @hidden
|
|
9065
|
-
*/
|
|
9066
|
-
var ColorPaletteService = /** @class */ (function () {
|
|
9067
|
-
function ColorPaletteService() {
|
|
9068
|
-
this.colorRows = [];
|
|
9069
|
-
}
|
|
9070
|
-
ColorPaletteService.prototype.setColorMatrix = function (palette, columns) {
|
|
9071
|
-
this.colorRows = [];
|
|
9072
|
-
if (!(isPresent(palette) && palette.length)) {
|
|
9073
|
-
return;
|
|
9074
|
-
}
|
|
9075
|
-
columns = columns || palette.length;
|
|
9076
|
-
for (var start = 0; start < palette.length; start += columns) {
|
|
9077
|
-
var row = palette.slice(start, columns + start);
|
|
9078
|
-
this.colorRows.push(row);
|
|
9079
|
-
}
|
|
9080
|
-
};
|
|
9081
|
-
ColorPaletteService.prototype.getCellCoordsFor = function (color) {
|
|
9082
|
-
if (!isPresent(color)) {
|
|
9083
|
-
return;
|
|
9084
|
-
}
|
|
9085
|
-
for (var row = 0; row < this.colorRows.length; row++) {
|
|
9086
|
-
for (var col = 0; col < this.colorRows[row].length; col++) {
|
|
9087
|
-
if (this.colorRows[row][col] === color) {
|
|
9088
|
-
return { row: row, col: col };
|
|
9089
|
-
}
|
|
9090
|
-
}
|
|
9091
|
-
}
|
|
9092
|
-
};
|
|
9093
|
-
ColorPaletteService.prototype.getColorAt = function (cellCoords) {
|
|
9094
|
-
if (!(isPresent(cellCoords) && isPresent(this.colorRows[cellCoords.row]))) {
|
|
9095
|
-
return;
|
|
9096
|
-
}
|
|
9097
|
-
return this.colorRows[cellCoords.row][cellCoords.col];
|
|
9098
|
-
};
|
|
9099
|
-
ColorPaletteService.prototype.getNextCell = function (current, horizontalStep, verticalStep) {
|
|
9100
|
-
if (!(isPresent(current) && isPresent(current.row) && isPresent(current.col))) {
|
|
9101
|
-
return { row: 0, col: 0 };
|
|
9102
|
-
}
|
|
9103
|
-
var row = this.clampIndex(current.row + verticalStep, this.colorRows.length - 1);
|
|
9104
|
-
var col = this.clampIndex(current.col + horizontalStep, this.colorRows[row].length - 1);
|
|
9105
|
-
return { row: row, col: col };
|
|
9106
|
-
};
|
|
9107
|
-
ColorPaletteService.prototype.clampIndex = function (index, max) {
|
|
9108
|
-
var minArrayIndex = 0;
|
|
9109
|
-
if (index < minArrayIndex) {
|
|
9110
|
-
return minArrayIndex;
|
|
9111
|
-
}
|
|
9112
|
-
if (index > max) {
|
|
9113
|
-
return max;
|
|
9114
|
-
}
|
|
9115
|
-
return index;
|
|
9116
|
-
};
|
|
9117
|
-
ColorPaletteService = __decorate([
|
|
9118
|
-
Injectable()
|
|
9119
|
-
], ColorPaletteService);
|
|
9120
|
-
return ColorPaletteService;
|
|
9954
|
+
], FlatColorPickerComponent);
|
|
9955
|
+
return FlatColorPickerComponent;
|
|
9121
9956
|
}());
|
|
9122
9957
|
|
|
9123
|
-
/**
|
|
9124
|
-
* @hidden
|
|
9125
|
-
*/
|
|
9126
|
-
var ColorPaletteLocalizationService = /** @class */ (function (_super) {
|
|
9127
|
-
__extends(ColorPaletteLocalizationService, _super);
|
|
9128
|
-
function ColorPaletteLocalizationService(prefix, messageService, _rtl, colorPickerLocalization) {
|
|
9129
|
-
var _this = _super.call(this, prefix, messageService, _rtl) || this;
|
|
9130
|
-
_this.colorPickerLocalization = colorPickerLocalization;
|
|
9131
|
-
return _this;
|
|
9132
|
-
}
|
|
9133
|
-
ColorPaletteLocalizationService.prototype.get = function (shortKey) {
|
|
9134
|
-
if (this.colorPickerLocalization) {
|
|
9135
|
-
return this.colorPickerLocalization.get(shortKey);
|
|
9136
|
-
}
|
|
9137
|
-
return _super.prototype.get.call(this, shortKey);
|
|
9138
|
-
};
|
|
9139
|
-
ColorPaletteLocalizationService = __decorate([
|
|
9140
|
-
__param(0, Inject(L10N_PREFIX)),
|
|
9141
|
-
__param(1, Optional()),
|
|
9142
|
-
__param(2, Optional()), __param(2, Inject(RTL)),
|
|
9143
|
-
__param(3, Optional()), __param(3, Inject(ColorPickerLocalizationService)),
|
|
9144
|
-
__metadata("design:paramtypes", [String, MessageService, Boolean, ColorPickerLocalizationService])
|
|
9145
|
-
], ColorPaletteLocalizationService);
|
|
9146
|
-
return ColorPaletteLocalizationService;
|
|
9147
|
-
}(LocalizationService));
|
|
9148
|
-
|
|
9149
|
-
var DEFAULT_TILE_SIZE = 24;
|
|
9150
|
-
var DEFAULT_COLUMNS_COUNT = 10;
|
|
9151
|
-
var DEFAULT_PRESET$1 = 'office';
|
|
9152
|
-
var DEFAULT_ACCESSIBLE_PRESET$1 = 'accessible';
|
|
9153
9958
|
var serial$2 = 0;
|
|
9154
9959
|
/**
|
|
9155
|
-
*
|
|
9156
|
-
*
|
|
9960
|
+
* Represents the [Kendo UI ColorPicker component for Angular]({% slug overview_colorpicker %}).
|
|
9961
|
+
*
|
|
9962
|
+
* The ColorPicker is a powerful tool for choosing colors from Gradient and Palette views
|
|
9963
|
+
* which are rendered in its popup. It supports previewing the selected color, reverting it to its previous state or clearing it completely.
|
|
9157
9964
|
*/
|
|
9158
|
-
var
|
|
9159
|
-
function
|
|
9965
|
+
var ColorPickerComponent = /** @class */ (function () {
|
|
9966
|
+
function ColorPickerComponent(popupService, cdr, localizationService, ngZone) {
|
|
9160
9967
|
var _this = this;
|
|
9161
|
-
this.
|
|
9162
|
-
this.service = service;
|
|
9968
|
+
this.popupService = popupService;
|
|
9163
9969
|
this.cdr = cdr;
|
|
9164
|
-
this.renderer = renderer;
|
|
9165
9970
|
this.localizationService = localizationService;
|
|
9971
|
+
this.ngZone = ngZone;
|
|
9972
|
+
this.hostClasses = true;
|
|
9166
9973
|
/**
|
|
9167
9974
|
* @hidden
|
|
9168
9975
|
*/
|
|
9169
|
-
this.
|
|
9976
|
+
this.focusableId = "k-colorpicker-" + serial$2++;
|
|
9170
9977
|
/**
|
|
9171
|
-
* Specifies the
|
|
9172
|
-
*
|
|
9173
|
-
|
|
9978
|
+
* Specifies the views that will be rendered in the popup.
|
|
9979
|
+
* By default both the gradient and palette views will be rendered.
|
|
9980
|
+
*/
|
|
9981
|
+
this.views = ['gradient', 'palette'];
|
|
9982
|
+
/**
|
|
9983
|
+
* Sets the read-only state of the ColorPicker.
|
|
9174
9984
|
*
|
|
9175
|
-
*
|
|
9176
|
-
* * (Default) `hex`
|
|
9177
|
-
* * `rgba`
|
|
9178
|
-
* * `name`
|
|
9985
|
+
* @default false
|
|
9179
9986
|
*/
|
|
9180
|
-
this.
|
|
9987
|
+
this.readonly = false;
|
|
9181
9988
|
/**
|
|
9182
|
-
* Sets the disabled state of the
|
|
9989
|
+
* Sets the disabled state of the ColorPicker.
|
|
9990
|
+
*
|
|
9991
|
+
* @default false
|
|
9183
9992
|
*/
|
|
9184
9993
|
this.disabled = false;
|
|
9185
9994
|
/**
|
|
9186
|
-
*
|
|
9995
|
+
* Specifies the output format of the ColorPicker.
|
|
9996
|
+
*
|
|
9997
|
+
* If the input value is in a different format, it will be parsed into the specified output `format`.
|
|
9998
|
+
*
|
|
9999
|
+
* The supported values are:
|
|
10000
|
+
* * `rgba` (default)
|
|
10001
|
+
* * `hex`
|
|
9187
10002
|
*/
|
|
9188
|
-
this.
|
|
10003
|
+
this.format = 'rgba';
|
|
9189
10004
|
/**
|
|
9190
|
-
* Specifies the
|
|
10005
|
+
* Specifies whether the ColorPicker should display a 'Clear color' button.
|
|
9191
10006
|
*
|
|
9192
|
-
*
|
|
9193
|
-
* * (Default) `tileSize = 24`
|
|
9194
|
-
* * `{ width: number, height: number }`
|
|
10007
|
+
* @default true
|
|
9195
10008
|
*/
|
|
9196
|
-
this.
|
|
10009
|
+
this.clearButton = true;
|
|
9197
10010
|
/**
|
|
9198
|
-
*
|
|
10011
|
+
* Displays `Apply` and `Cancel` action buttons and color preview panes.
|
|
10012
|
+
*
|
|
10013
|
+
* When enabled, the component value will not change immediately upon
|
|
10014
|
+
* color selection, but only after the `Apply` button is clicked.
|
|
10015
|
+
*
|
|
10016
|
+
* The `Cancel` button reverts the current selection to its
|
|
10017
|
+
* previous state i.e. to the current value.
|
|
10018
|
+
*
|
|
10019
|
+
* @default false
|
|
9199
10020
|
*/
|
|
9200
|
-
this.
|
|
10021
|
+
this.preview = false;
|
|
10022
|
+
/**
|
|
10023
|
+
* Configures the layout of the `Apply` and `Cancel` action buttons.
|
|
10024
|
+
*
|
|
10025
|
+
* The possible values are:
|
|
10026
|
+
* * `start`
|
|
10027
|
+
* * `center`
|
|
10028
|
+
* * `end` (default)
|
|
10029
|
+
* * `stretch`
|
|
10030
|
+
*/
|
|
10031
|
+
this.actionsLayout = 'end';
|
|
9201
10032
|
/**
|
|
9202
10033
|
* Fires each time the value is changed.
|
|
9203
10034
|
*/
|
|
9204
10035
|
this.valueChange = new EventEmitter();
|
|
9205
10036
|
/**
|
|
9206
|
-
* Fires each time the
|
|
10037
|
+
* Fires each time the popup is about to open.
|
|
10038
|
+
* This event is preventable. If you cancel it, the popup will remain closed.
|
|
10039
|
+
*/
|
|
10040
|
+
this.open = new EventEmitter();
|
|
10041
|
+
/**
|
|
10042
|
+
* Fires each time the popup is about to close.
|
|
10043
|
+
* This event is preventable. If you cancel it, the popup will remain open.
|
|
10044
|
+
*/
|
|
10045
|
+
this.close = new EventEmitter();
|
|
10046
|
+
/**
|
|
10047
|
+
* Fires each time ColorPicker is focused.
|
|
10048
|
+
*/
|
|
10049
|
+
this.onFocus = new EventEmitter();
|
|
10050
|
+
/**
|
|
10051
|
+
* Fires each time the ColorPicker is blurred.
|
|
10052
|
+
*/
|
|
10053
|
+
this.onBlur = new EventEmitter();
|
|
10054
|
+
/**
|
|
10055
|
+
* Fires when the user cancels the current color selection.
|
|
9207
10056
|
*
|
|
9208
|
-
*
|
|
10057
|
+
* Fires on preview pane or 'Cancel' button click.
|
|
9209
10058
|
*/
|
|
9210
|
-
this.
|
|
10059
|
+
this.cancel = new EventEmitter();
|
|
9211
10060
|
/**
|
|
9212
|
-
*
|
|
10061
|
+
* Fires each time the left side of the ColorPicker wrapper is clicked.
|
|
10062
|
+
* The event is triggered regardless of whether a ColorPicker icon is set or not.
|
|
10063
|
+
*
|
|
10064
|
+
* The [ActiveColorClickEvent]({% slug api_inputs_activecolorclickevent %}) event provides the option to prevent the popup opening.
|
|
9213
10065
|
*/
|
|
9214
|
-
this.
|
|
10066
|
+
this.activeColorClick = new EventEmitter();
|
|
10067
|
+
/**
|
|
10068
|
+
* Fires each time the view is about to change.
|
|
10069
|
+
* Used to provide a two-way binding for the `activeView` property.
|
|
10070
|
+
*/
|
|
10071
|
+
this.activeViewChange = new EventEmitter();
|
|
9215
10072
|
this._tabindex = 0;
|
|
10073
|
+
this._popupSettings = { animate: true };
|
|
10074
|
+
this._paletteSettings = {};
|
|
10075
|
+
this._gradientSettings = { opacity: true, delay: 0 };
|
|
9216
10076
|
this.notifyNgTouched = function () { };
|
|
9217
10077
|
this.notifyNgChanged = function () { };
|
|
9218
|
-
|
|
10078
|
+
validatePackage(packageMetadata);
|
|
10079
|
+
this.dynamicRTLSubscription = this.localizationService.changes.subscribe(function (_a) {
|
|
9219
10080
|
var rtl = _a.rtl;
|
|
9220
10081
|
_this.direction = rtl ? 'rtl' : 'ltr';
|
|
9221
10082
|
});
|
|
9222
10083
|
}
|
|
9223
|
-
|
|
9224
|
-
Object.defineProperty(
|
|
9225
|
-
/**
|
|
9226
|
-
* @hidden
|
|
9227
|
-
*/
|
|
9228
|
-
get: function () {
|
|
9229
|
-
return this.id;
|
|
9230
|
-
},
|
|
9231
|
-
enumerable: true,
|
|
9232
|
-
configurable: true
|
|
9233
|
-
});
|
|
9234
|
-
Object.defineProperty(ColorPaletteComponent.prototype, "value", {
|
|
10084
|
+
ColorPickerComponent_1 = ColorPickerComponent;
|
|
10085
|
+
Object.defineProperty(ColorPickerComponent.prototype, "value", {
|
|
9235
10086
|
get: function () {
|
|
9236
10087
|
return this._value;
|
|
9237
10088
|
},
|
|
@@ -9239,396 +10090,543 @@ var ColorPaletteComponent = /** @class */ (function () {
|
|
|
9239
10090
|
* Specifies the value of the initially selected color.
|
|
9240
10091
|
*/
|
|
9241
10092
|
set: function (value) {
|
|
9242
|
-
this._value = parseColor$1(value, this.format);
|
|
10093
|
+
this._value = parseColor$1(value, this.format, this.gradientSettings.opacity);
|
|
9243
10094
|
},
|
|
9244
10095
|
enumerable: true,
|
|
9245
10096
|
configurable: true
|
|
9246
10097
|
});
|
|
9247
|
-
Object.defineProperty(
|
|
10098
|
+
Object.defineProperty(ColorPickerComponent.prototype, "popupSettings", {
|
|
9248
10099
|
get: function () {
|
|
9249
|
-
return this.
|
|
10100
|
+
return this._popupSettings;
|
|
9250
10101
|
},
|
|
9251
10102
|
/**
|
|
9252
|
-
*
|
|
9253
|
-
* Defaults to `10`.
|
|
10103
|
+
* Configures the popup of the ColorPicker.
|
|
9254
10104
|
*/
|
|
9255
10105
|
set: function (value) {
|
|
9256
|
-
|
|
9257
|
-
this._columns = value > minColumnsCount ? value : minColumnsCount;
|
|
10106
|
+
this._popupSettings = Object.assign(this._popupSettings, value);
|
|
9258
10107
|
},
|
|
9259
10108
|
enumerable: true,
|
|
9260
10109
|
configurable: true
|
|
9261
10110
|
});
|
|
9262
|
-
Object.defineProperty(
|
|
10111
|
+
Object.defineProperty(ColorPickerComponent.prototype, "paletteSettings", {
|
|
9263
10112
|
get: function () {
|
|
9264
|
-
return this.
|
|
10113
|
+
return this._paletteSettings;
|
|
9265
10114
|
},
|
|
9266
10115
|
/**
|
|
9267
|
-
*
|
|
9268
|
-
*
|
|
9269
|
-
* The supported values are:
|
|
9270
|
-
* * The name of the predefined palette preset (for example, `office`, `basic`, and `apex`).
|
|
9271
|
-
* * A string with comma-separated colors.
|
|
9272
|
-
* * A string array.
|
|
10116
|
+
* Configures the palette that is displayed in the ColorPicker popup.
|
|
9273
10117
|
*/
|
|
9274
10118
|
set: function (value) {
|
|
9275
|
-
|
|
9276
|
-
if (!isPresent(value)) {
|
|
9277
|
-
value = DEFAULT_PRESET$1;
|
|
9278
|
-
}
|
|
9279
|
-
if (typeof value === 'string' && isPresent(PALETTEPRESETS[value])) {
|
|
9280
|
-
this.columns = this.columns || PALETTEPRESETS[value].columns;
|
|
9281
|
-
value = PALETTEPRESETS[value].colors;
|
|
9282
|
-
}
|
|
9283
|
-
var colors = (typeof value === 'string') ? value.split(',') : value;
|
|
9284
|
-
this._palette = colors.map(function (color) { return parseColor$1(color, _this.format, false); });
|
|
10119
|
+
this._paletteSettings = Object.assign(this._paletteSettings, value);
|
|
9285
10120
|
},
|
|
9286
10121
|
enumerable: true,
|
|
9287
10122
|
configurable: true
|
|
9288
10123
|
});
|
|
9289
|
-
Object.defineProperty(
|
|
10124
|
+
Object.defineProperty(ColorPickerComponent.prototype, "gradientSettings", {
|
|
9290
10125
|
get: function () {
|
|
9291
|
-
return
|
|
10126
|
+
return this._gradientSettings;
|
|
9292
10127
|
},
|
|
9293
10128
|
/**
|
|
9294
|
-
*
|
|
10129
|
+
* Configures the gradient that is displayed in the ColorPicker popup.
|
|
9295
10130
|
*/
|
|
9296
10131
|
set: function (value) {
|
|
9297
|
-
|
|
9298
|
-
var defaultValue = 0;
|
|
9299
|
-
this._tabindex = !isNaN(tabindex) ? tabindex : defaultValue;
|
|
10132
|
+
this._gradientSettings = Object.assign(this._gradientSettings, value);
|
|
9300
10133
|
},
|
|
9301
10134
|
enumerable: true,
|
|
9302
10135
|
configurable: true
|
|
9303
10136
|
});
|
|
9304
|
-
Object.defineProperty(
|
|
9305
|
-
/**
|
|
9306
|
-
* @hidden
|
|
9307
|
-
*/
|
|
10137
|
+
Object.defineProperty(ColorPickerComponent.prototype, "tabindex", {
|
|
9308
10138
|
get: function () {
|
|
9309
|
-
|
|
9310
|
-
|
|
9311
|
-
}
|
|
9312
|
-
return { width: this.tileSize, height: this.tileSize };
|
|
9313
|
-
},
|
|
9314
|
-
enumerable: true,
|
|
9315
|
-
configurable: true
|
|
9316
|
-
});
|
|
9317
|
-
Object.defineProperty(ColorPaletteComponent.prototype, "colorRows", {
|
|
10139
|
+
return !this.disabled ? this._tabindex : undefined;
|
|
10140
|
+
},
|
|
9318
10141
|
/**
|
|
9319
|
-
*
|
|
10142
|
+
* Specifies the [tabindex](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the component.
|
|
10143
|
+
*
|
|
10144
|
+
* @default 0
|
|
9320
10145
|
*/
|
|
9321
|
-
|
|
9322
|
-
|
|
10146
|
+
set: function (value) {
|
|
10147
|
+
var tabindex = Number(value);
|
|
10148
|
+
var defaultValue = 0;
|
|
10149
|
+
this._tabindex = !isNaN(tabindex) ? tabindex : defaultValue;
|
|
9323
10150
|
},
|
|
9324
10151
|
enumerable: true,
|
|
9325
10152
|
configurable: true
|
|
9326
10153
|
});
|
|
9327
|
-
Object.defineProperty(
|
|
10154
|
+
Object.defineProperty(ColorPickerComponent.prototype, "isOpen", {
|
|
9328
10155
|
/**
|
|
9329
|
-
*
|
|
10156
|
+
* Indicates whether the ColorPicker popup is open.
|
|
9330
10157
|
*/
|
|
9331
|
-
get: function () {
|
|
10158
|
+
get: function () {
|
|
10159
|
+
return isPresent(this.popupRef);
|
|
10160
|
+
},
|
|
9332
10161
|
enumerable: true,
|
|
9333
10162
|
configurable: true
|
|
9334
10163
|
});
|
|
9335
|
-
Object.defineProperty(
|
|
10164
|
+
Object.defineProperty(ColorPickerComponent.prototype, "iconStyles", {
|
|
9336
10165
|
/**
|
|
9337
10166
|
* @hidden
|
|
9338
10167
|
*/
|
|
9339
|
-
get: function () {
|
|
10168
|
+
get: function () {
|
|
10169
|
+
if (this.iconClass) {
|
|
10170
|
+
return this.iconClass;
|
|
10171
|
+
}
|
|
10172
|
+
if (this.icon) {
|
|
10173
|
+
return "k-icon k-i-" + this.icon;
|
|
10174
|
+
}
|
|
10175
|
+
},
|
|
9340
10176
|
enumerable: true,
|
|
9341
10177
|
configurable: true
|
|
9342
10178
|
});
|
|
9343
|
-
|
|
10179
|
+
ColorPickerComponent.prototype.ngOnInit = function () {
|
|
10180
|
+
var defaultPreset = (this.format !== 'name') ? DEFAULT_PRESET : DEFAULT_ACCESSIBLE_PRESET;
|
|
10181
|
+
var settingsPalette = this._paletteSettings.palette;
|
|
10182
|
+
var presetColumns = typeof settingsPalette === 'string' && PALETTEPRESETS[settingsPalette] ?
|
|
10183
|
+
PALETTEPRESETS[settingsPalette].columns :
|
|
10184
|
+
undefined;
|
|
10185
|
+
this._paletteSettings = {
|
|
10186
|
+
palette: settingsPalette || defaultPreset,
|
|
10187
|
+
tileSize: this._paletteSettings.tileSize || 24,
|
|
10188
|
+
columns: this._paletteSettings.columns || presetColumns || 10
|
|
10189
|
+
};
|
|
10190
|
+
};
|
|
10191
|
+
ColorPickerComponent.prototype.ngOnChanges = function (changes) {
|
|
10192
|
+
if (changes.format && changes.format.currentValue === 'name') {
|
|
10193
|
+
this.activeView = 'palette';
|
|
10194
|
+
}
|
|
10195
|
+
if (this.activeView === 'gradient' && this.gradientSettings.opacity) {
|
|
10196
|
+
this.format = 'rgba';
|
|
10197
|
+
this.value = parseColor$1(this.value, this.format, this.gradientSettings.opacity);
|
|
10198
|
+
}
|
|
10199
|
+
};
|
|
10200
|
+
ColorPickerComponent.prototype.ngOnDestroy = function () {
|
|
10201
|
+
this.closePopup();
|
|
10202
|
+
if (this.dynamicRTLSubscription) {
|
|
10203
|
+
this.dynamicRTLSubscription.unsubscribe();
|
|
10204
|
+
}
|
|
10205
|
+
};
|
|
10206
|
+
Object.defineProperty(ColorPickerComponent.prototype, "colorPickerAriaLabel", {
|
|
9344
10207
|
/**
|
|
9345
10208
|
* @hidden
|
|
9346
10209
|
*/
|
|
9347
|
-
get: function () {
|
|
10210
|
+
get: function () {
|
|
10211
|
+
return this.value ? this.value : this.localizationService.get('colorPickerNoColor');
|
|
10212
|
+
},
|
|
9348
10213
|
enumerable: true,
|
|
9349
10214
|
configurable: true
|
|
9350
10215
|
});
|
|
9351
|
-
|
|
9352
|
-
|
|
9353
|
-
|
|
9354
|
-
|
|
9355
|
-
|
|
9356
|
-
this.focusedCell = this.service.getCellCoordsFor(this.value);
|
|
9357
|
-
}
|
|
10216
|
+
/**
|
|
10217
|
+
* @hidden
|
|
10218
|
+
*/
|
|
10219
|
+
ColorPickerComponent.prototype.handleCancelEvent = function (ev) {
|
|
10220
|
+
this.cancel.emit(ev);
|
|
9358
10221
|
};
|
|
9359
|
-
|
|
9360
|
-
|
|
10222
|
+
/**
|
|
10223
|
+
* @hidden
|
|
10224
|
+
*/
|
|
10225
|
+
ColorPickerComponent.prototype.togglePopup = function () {
|
|
10226
|
+
this.toggleWithEvents(!this.isOpen);
|
|
10227
|
+
this.focus();
|
|
9361
10228
|
};
|
|
9362
|
-
|
|
9363
|
-
|
|
9364
|
-
|
|
10229
|
+
/**
|
|
10230
|
+
* @hidden
|
|
10231
|
+
*/
|
|
10232
|
+
ColorPickerComponent.prototype.handleActiveColorClick = function () {
|
|
10233
|
+
this.focus();
|
|
10234
|
+
var event = new ActiveColorClickEvent(this.value);
|
|
10235
|
+
this.activeColorClick.emit(event);
|
|
10236
|
+
if (!event.isOpenPrevented() || this.isOpen) {
|
|
10237
|
+
this.togglePopup();
|
|
9365
10238
|
}
|
|
9366
10239
|
};
|
|
9367
|
-
|
|
9368
|
-
|
|
9369
|
-
|
|
9370
|
-
|
|
9371
|
-
if (
|
|
9372
|
-
|
|
9373
|
-
this.setHostElementAriaLabel();
|
|
10240
|
+
/**
|
|
10241
|
+
* Focuses the wrapper of the ColorPicker.
|
|
10242
|
+
*/
|
|
10243
|
+
ColorPickerComponent.prototype.focus = function () {
|
|
10244
|
+
if (this.disabled) {
|
|
10245
|
+
return;
|
|
9374
10246
|
}
|
|
10247
|
+
this.wrapper.nativeElement.focus();
|
|
9375
10248
|
};
|
|
9376
10249
|
/**
|
|
9377
10250
|
* @hidden
|
|
9378
10251
|
*/
|
|
9379
|
-
|
|
9380
|
-
|
|
9381
|
-
|
|
9382
|
-
case Keys.ArrowDown:
|
|
9383
|
-
this.handleCellNavigation(0, 1);
|
|
9384
|
-
break;
|
|
9385
|
-
case Keys.ArrowUp:
|
|
9386
|
-
this.handleCellNavigation(0, -1);
|
|
9387
|
-
break;
|
|
9388
|
-
case Keys.ArrowRight:
|
|
9389
|
-
this.handleCellNavigation(isRTL ? -1 : 1, 0);
|
|
9390
|
-
break;
|
|
9391
|
-
case Keys.ArrowLeft:
|
|
9392
|
-
this.handleCellNavigation(isRTL ? 1 : -1, 0);
|
|
9393
|
-
break;
|
|
9394
|
-
case Keys.Enter:
|
|
9395
|
-
this.handleEnter();
|
|
9396
|
-
break;
|
|
9397
|
-
default: return;
|
|
10252
|
+
ColorPickerComponent.prototype.handleWrapperFocus = function () {
|
|
10253
|
+
if (this.isFocused) {
|
|
10254
|
+
return;
|
|
9398
10255
|
}
|
|
9399
|
-
|
|
10256
|
+
this.isFocused = true;
|
|
10257
|
+
this.onFocus.emit();
|
|
10258
|
+
};
|
|
10259
|
+
/**
|
|
10260
|
+
* Blurs the ColorPicker.
|
|
10261
|
+
*/
|
|
10262
|
+
ColorPickerComponent.prototype.blur = function () {
|
|
10263
|
+
this.wrapper.nativeElement.blur();
|
|
9400
10264
|
};
|
|
9401
10265
|
/**
|
|
9402
10266
|
* @hidden
|
|
9403
10267
|
*/
|
|
9404
|
-
|
|
10268
|
+
ColorPickerComponent.prototype.handleWrapperBlur = function () {
|
|
10269
|
+
if (this.isOpen) {
|
|
10270
|
+
return;
|
|
10271
|
+
}
|
|
10272
|
+
this.isFocused = false;
|
|
10273
|
+
this.onBlur.emit();
|
|
9405
10274
|
this.notifyNgTouched();
|
|
9406
|
-
this.handleCellFocusOnBlur();
|
|
9407
10275
|
};
|
|
9408
10276
|
/**
|
|
9409
|
-
*
|
|
10277
|
+
* Clears the value of the ColorPicker.
|
|
9410
10278
|
*/
|
|
9411
|
-
|
|
9412
|
-
if (this.
|
|
10279
|
+
ColorPickerComponent.prototype.reset = function () {
|
|
10280
|
+
if (!isPresent(this.value)) {
|
|
9413
10281
|
return;
|
|
9414
10282
|
}
|
|
9415
|
-
this.
|
|
9416
|
-
this.
|
|
9417
|
-
|
|
9418
|
-
|
|
9419
|
-
|
|
9420
|
-
|
|
10283
|
+
this._value = undefined;
|
|
10284
|
+
this.notifyNgChanged(undefined);
|
|
10285
|
+
};
|
|
10286
|
+
/**
|
|
10287
|
+
* Toggles the popup of the ColorPicker.
|
|
10288
|
+
* Does not trigger the `open` and `close` events of the component.
|
|
10289
|
+
*
|
|
10290
|
+
* @param open An optional parameter. Specifies whether the popup will be opened or closed.
|
|
10291
|
+
*/
|
|
10292
|
+
ColorPickerComponent.prototype.toggle = function (open) {
|
|
10293
|
+
if (this.disabled || this.readonly) {
|
|
10294
|
+
return;
|
|
10295
|
+
}
|
|
10296
|
+
this.closePopup();
|
|
10297
|
+
open = isPresent(open) ? open : !this.isOpen;
|
|
10298
|
+
if (open) {
|
|
10299
|
+
this.openPopup();
|
|
10300
|
+
}
|
|
10301
|
+
};
|
|
10302
|
+
/**
|
|
10303
|
+
* @hidden
|
|
10304
|
+
*/
|
|
10305
|
+
ColorPickerComponent.prototype.handleValueChange = function (color) {
|
|
10306
|
+
var parsedColor = parseColor$1(color, this.format, this.gradientSettings.opacity);
|
|
10307
|
+
var valueChange = parsedColor !== this.value;
|
|
10308
|
+
if (valueChange) {
|
|
9421
10309
|
this.value = parsedColor;
|
|
9422
10310
|
this.valueChange.emit(parsedColor);
|
|
9423
10311
|
this.notifyNgChanged(parsedColor);
|
|
9424
|
-
this.setHostElementAriaLabel();
|
|
9425
|
-
}
|
|
9426
|
-
if (this.selection !== parsedColor) {
|
|
9427
|
-
this.selection = parsedColor;
|
|
9428
|
-
this.selectionChange.emit(parsedColor);
|
|
9429
10312
|
}
|
|
9430
|
-
|
|
9431
|
-
|
|
10313
|
+
};
|
|
10314
|
+
/**
|
|
10315
|
+
* @hidden
|
|
10316
|
+
*/
|
|
10317
|
+
ColorPickerComponent.prototype.handlePopupBlur = function (event) {
|
|
10318
|
+
if (this.popupBlurInvalid(event)) {
|
|
10319
|
+
return;
|
|
9432
10320
|
}
|
|
10321
|
+
this.isFocused = false;
|
|
10322
|
+
this.onBlur.emit();
|
|
10323
|
+
this.notifyNgTouched();
|
|
10324
|
+
this.toggleWithEvents(false);
|
|
9433
10325
|
};
|
|
9434
10326
|
/**
|
|
9435
10327
|
* @hidden
|
|
9436
10328
|
*/
|
|
9437
|
-
|
|
10329
|
+
ColorPickerComponent.prototype.writeValue = function (value) {
|
|
9438
10330
|
this.value = value;
|
|
9439
|
-
this.focusedCell = this.service.getCellCoordsFor(this.value);
|
|
9440
10331
|
};
|
|
9441
10332
|
/**
|
|
9442
10333
|
* @hidden
|
|
9443
10334
|
*/
|
|
9444
|
-
|
|
10335
|
+
ColorPickerComponent.prototype.registerOnChange = function (fn) {
|
|
9445
10336
|
this.notifyNgChanged = fn;
|
|
9446
10337
|
};
|
|
9447
10338
|
/**
|
|
9448
10339
|
* @hidden
|
|
9449
10340
|
*/
|
|
9450
|
-
|
|
10341
|
+
ColorPickerComponent.prototype.registerOnTouched = function (fn) {
|
|
9451
10342
|
this.notifyNgTouched = fn;
|
|
9452
10343
|
};
|
|
9453
10344
|
/**
|
|
9454
10345
|
* @hidden
|
|
9455
10346
|
*/
|
|
9456
|
-
|
|
10347
|
+
ColorPickerComponent.prototype.setDisabledState = function (isDisabled) {
|
|
9457
10348
|
this.cdr.markForCheck();
|
|
9458
10349
|
this.disabled = isDisabled;
|
|
9459
10350
|
};
|
|
9460
10351
|
/**
|
|
9461
10352
|
* @hidden
|
|
9462
|
-
* Used by the TextBoxContainer to determine if the component is empty.
|
|
9463
10353
|
*/
|
|
9464
|
-
|
|
9465
|
-
|
|
10354
|
+
ColorPickerComponent.prototype.handleWrapperKeyDown = function (event) {
|
|
10355
|
+
if (event.keyCode === Keys.ArrowDown || event.keyCode === Keys.Enter) {
|
|
10356
|
+
event.preventDefault();
|
|
10357
|
+
this.toggleWithEvents(true);
|
|
10358
|
+
}
|
|
9466
10359
|
};
|
|
9467
10360
|
/**
|
|
9468
|
-
*
|
|
10361
|
+
* @hidden
|
|
9469
10362
|
*/
|
|
9470
|
-
|
|
9471
|
-
|
|
9472
|
-
|
|
9473
|
-
this.
|
|
9474
|
-
|
|
10363
|
+
ColorPickerComponent.prototype.handlePopupKeyDown = function (event) {
|
|
10364
|
+
if (event.keyCode === Keys.Escape) {
|
|
10365
|
+
this.toggleWithEvents(false);
|
|
10366
|
+
this.wrapper.nativeElement.focus();
|
|
10367
|
+
}
|
|
10368
|
+
if (event.keyCode === Keys.Tab) {
|
|
10369
|
+
var currentElement = event.shiftKey ? this.firstFocusableElement.nativeElement : this.lastFocusableElement.nativeElement;
|
|
10370
|
+
var nextElement = event.shiftKey ? this.lastFocusableElement.nativeElement : this.firstFocusableElement.nativeElement;
|
|
10371
|
+
if (event.target === currentElement) {
|
|
10372
|
+
event.preventDefault();
|
|
10373
|
+
nextElement.nativeElement.focus();
|
|
10374
|
+
}
|
|
9475
10375
|
}
|
|
9476
10376
|
};
|
|
9477
|
-
|
|
9478
|
-
|
|
9479
|
-
|
|
10377
|
+
/**
|
|
10378
|
+
* @hidden
|
|
10379
|
+
* Used by the FloatingLabel to determine if the component is empty.
|
|
10380
|
+
*/
|
|
10381
|
+
ColorPickerComponent.prototype.isEmpty = function () {
|
|
10382
|
+
return false;
|
|
9480
10383
|
};
|
|
9481
|
-
|
|
9482
|
-
|
|
9483
|
-
|
|
9484
|
-
|
|
9485
|
-
this.columns = this.columns || DEFAULT_COLUMNS_COUNT;
|
|
9486
|
-
this.service.setColorMatrix(this.palette, this.columns);
|
|
10384
|
+
ColorPickerComponent.prototype.popupBlurInvalid = function (ev) {
|
|
10385
|
+
var focusInPopupElement = this.popupRef.popupElement.contains(ev.relatedTarget);
|
|
10386
|
+
var wrapperClicked = ev.relatedTarget === this.wrapper.nativeElement;
|
|
10387
|
+
return !this.isFocused || wrapperClicked || focusInPopupElement;
|
|
9487
10388
|
};
|
|
9488
|
-
|
|
9489
|
-
|
|
10389
|
+
ColorPickerComponent.prototype.toggleWithEvents = function (open) {
|
|
10390
|
+
var sameState = this.isOpen === open;
|
|
10391
|
+
if (this.disabled || this.readonly || sameState) {
|
|
9490
10392
|
return;
|
|
9491
10393
|
}
|
|
9492
|
-
|
|
9493
|
-
|
|
10394
|
+
var eventArgs;
|
|
10395
|
+
if (open) {
|
|
10396
|
+
eventArgs = new ColorPickerOpenEvent();
|
|
10397
|
+
this.open.emit(eventArgs);
|
|
10398
|
+
}
|
|
10399
|
+
else {
|
|
10400
|
+
eventArgs = new ColorPickerCloseEvent();
|
|
10401
|
+
this.close.emit(eventArgs);
|
|
10402
|
+
}
|
|
10403
|
+
if (!eventArgs.isDefaultPrevented()) {
|
|
10404
|
+
this.toggle(open);
|
|
10405
|
+
}
|
|
10406
|
+
if (open) {
|
|
10407
|
+
this.focusFirstElement();
|
|
10408
|
+
}
|
|
9494
10409
|
};
|
|
9495
|
-
|
|
9496
|
-
var
|
|
9497
|
-
this.
|
|
10410
|
+
ColorPickerComponent.prototype.focusFirstElement = function () {
|
|
10411
|
+
var _this = this;
|
|
10412
|
+
this.ngZone.runOutsideAngular(function () {
|
|
10413
|
+
setTimeout(function () {
|
|
10414
|
+
var elementToFocus = _this.flatColorPicker.gradient ? _this.flatColorPicker.gradient.gradientDragHandle :
|
|
10415
|
+
_this.flatColorPicker.palette.host;
|
|
10416
|
+
elementToFocus.nativeElement.focus();
|
|
10417
|
+
});
|
|
10418
|
+
});
|
|
10419
|
+
};
|
|
10420
|
+
ColorPickerComponent.prototype.openPopup = function () {
|
|
10421
|
+
var _this = this;
|
|
10422
|
+
var horizontalAlign = this.direction === "rtl" ? "right" : "left";
|
|
10423
|
+
var anchorPosition = { horizontal: horizontalAlign, vertical: "bottom" };
|
|
10424
|
+
var popupPosition = { horizontal: horizontalAlign, vertical: "top" };
|
|
10425
|
+
this.popupRef = this.popupService.open({
|
|
10426
|
+
anchor: this.wrapper,
|
|
10427
|
+
animate: this.popupSettings.animate,
|
|
10428
|
+
appendTo: this.popupSettings.appendTo,
|
|
10429
|
+
popupAlign: popupPosition,
|
|
10430
|
+
anchorAlign: anchorPosition,
|
|
10431
|
+
popupClass: 'k-colorpicker-popup',
|
|
10432
|
+
content: this.popupTemplate,
|
|
10433
|
+
positionMode: 'absolute'
|
|
10434
|
+
});
|
|
10435
|
+
this.popupRef.popupAnchorViewportLeave.subscribe(function () {
|
|
10436
|
+
_this.toggleWithEvents(false);
|
|
10437
|
+
if (!_this.isOpen) {
|
|
10438
|
+
_this.wrapper.nativeElement.focus({
|
|
10439
|
+
preventScroll: true
|
|
10440
|
+
});
|
|
10441
|
+
}
|
|
10442
|
+
});
|
|
9498
10443
|
};
|
|
9499
|
-
|
|
9500
|
-
if (!
|
|
10444
|
+
ColorPickerComponent.prototype.closePopup = function () {
|
|
10445
|
+
if (!this.isOpen) {
|
|
9501
10446
|
return;
|
|
9502
10447
|
}
|
|
9503
|
-
|
|
9504
|
-
this.
|
|
10448
|
+
this.popupRef.close();
|
|
10449
|
+
this.popupRef = null;
|
|
9505
10450
|
};
|
|
9506
|
-
|
|
10451
|
+
Object.defineProperty(ColorPickerComponent.prototype, "firstFocusableElement", {
|
|
10452
|
+
get: function () {
|
|
10453
|
+
if (!this.flatColorPicker.header || (this.views.length <= 1 && !this.flatColorPicker.clearButton)) {
|
|
10454
|
+
return this.flatColorPicker.gradient ? this.flatColorPicker.gradient.gradientDragHandle : this.flatColorPicker.palette.host;
|
|
10455
|
+
}
|
|
10456
|
+
return this.views.length > 1 ? this.flatColorPicker.header.viewButtonsCollection.toArray()[0] : this.flatColorPicker.header.clearButtonElement;
|
|
10457
|
+
},
|
|
10458
|
+
enumerable: true,
|
|
10459
|
+
configurable: true
|
|
10460
|
+
});
|
|
10461
|
+
Object.defineProperty(ColorPickerComponent.prototype, "lastFocusableElement", {
|
|
10462
|
+
get: function () {
|
|
10463
|
+
if (this.preview) {
|
|
10464
|
+
return this.flatColorPicker.footer.lastButton;
|
|
10465
|
+
}
|
|
10466
|
+
if (this.flatColorPicker.palette) {
|
|
10467
|
+
return this.flatColorPicker.palette.host;
|
|
10468
|
+
}
|
|
10469
|
+
return this.gradientSettings.opacity ? this.flatColorPicker.gradient.inputs.opacityInput.numericInput : this.flatColorPicker.gradient.inputs.blueInput;
|
|
10470
|
+
},
|
|
10471
|
+
enumerable: true,
|
|
10472
|
+
configurable: true
|
|
10473
|
+
});
|
|
10474
|
+
var ColorPickerComponent_1;
|
|
10475
|
+
__decorate([
|
|
10476
|
+
HostBinding('class.k-colorpicker'),
|
|
10477
|
+
__metadata("design:type", Boolean)
|
|
10478
|
+
], ColorPickerComponent.prototype, "hostClasses", void 0);
|
|
9507
10479
|
__decorate([
|
|
9508
10480
|
HostBinding('attr.dir'),
|
|
9509
10481
|
__metadata("design:type", String)
|
|
9510
|
-
],
|
|
10482
|
+
], ColorPickerComponent.prototype, "direction", void 0);
|
|
9511
10483
|
__decorate([
|
|
9512
|
-
|
|
9513
|
-
__metadata("design:type", String)
|
|
9514
|
-
|
|
9515
|
-
|
|
10484
|
+
Input(),
|
|
10485
|
+
__metadata("design:type", String)
|
|
10486
|
+
], ColorPickerComponent.prototype, "focusableId", void 0);
|
|
10487
|
+
__decorate([
|
|
10488
|
+
Input(),
|
|
10489
|
+
__metadata("design:type", Array)
|
|
10490
|
+
], ColorPickerComponent.prototype, "views", void 0);
|
|
9516
10491
|
__decorate([
|
|
9517
10492
|
Input(),
|
|
9518
10493
|
__metadata("design:type", String)
|
|
9519
|
-
],
|
|
10494
|
+
], ColorPickerComponent.prototype, "activeView", void 0);
|
|
10495
|
+
__decorate([
|
|
10496
|
+
Input(),
|
|
10497
|
+
__metadata("design:type", Boolean)
|
|
10498
|
+
], ColorPickerComponent.prototype, "readonly", void 0);
|
|
10499
|
+
__decorate([
|
|
10500
|
+
Input(),
|
|
10501
|
+
__metadata("design:type", Boolean)
|
|
10502
|
+
], ColorPickerComponent.prototype, "disabled", void 0);
|
|
9520
10503
|
__decorate([
|
|
9521
10504
|
Input(),
|
|
9522
10505
|
__metadata("design:type", String)
|
|
9523
|
-
],
|
|
10506
|
+
], ColorPickerComponent.prototype, "format", void 0);
|
|
9524
10507
|
__decorate([
|
|
9525
10508
|
Input(),
|
|
9526
10509
|
__metadata("design:type", String),
|
|
9527
10510
|
__metadata("design:paramtypes", [String])
|
|
9528
|
-
],
|
|
10511
|
+
], ColorPickerComponent.prototype, "value", null);
|
|
9529
10512
|
__decorate([
|
|
9530
10513
|
Input(),
|
|
9531
|
-
__metadata("design:type",
|
|
9532
|
-
__metadata("design:paramtypes", [
|
|
9533
|
-
],
|
|
10514
|
+
__metadata("design:type", Object),
|
|
10515
|
+
__metadata("design:paramtypes", [Object])
|
|
10516
|
+
], ColorPickerComponent.prototype, "popupSettings", null);
|
|
9534
10517
|
__decorate([
|
|
9535
10518
|
Input(),
|
|
9536
10519
|
__metadata("design:type", Object),
|
|
9537
10520
|
__metadata("design:paramtypes", [Object])
|
|
9538
|
-
],
|
|
10521
|
+
], ColorPickerComponent.prototype, "paletteSettings", null);
|
|
9539
10522
|
__decorate([
|
|
9540
10523
|
Input(),
|
|
9541
|
-
__metadata("design:type",
|
|
9542
|
-
__metadata("design:paramtypes", [
|
|
9543
|
-
],
|
|
10524
|
+
__metadata("design:type", Object),
|
|
10525
|
+
__metadata("design:paramtypes", [Object])
|
|
10526
|
+
], ColorPickerComponent.prototype, "gradientSettings", null);
|
|
10527
|
+
__decorate([
|
|
10528
|
+
Input(),
|
|
10529
|
+
__metadata("design:type", String)
|
|
10530
|
+
], ColorPickerComponent.prototype, "icon", void 0);
|
|
10531
|
+
__decorate([
|
|
10532
|
+
Input(),
|
|
10533
|
+
__metadata("design:type", Object)
|
|
10534
|
+
], ColorPickerComponent.prototype, "iconClass", void 0);
|
|
9544
10535
|
__decorate([
|
|
9545
10536
|
Input(),
|
|
9546
10537
|
__metadata("design:type", Boolean)
|
|
9547
|
-
],
|
|
10538
|
+
], ColorPickerComponent.prototype, "clearButton", void 0);
|
|
10539
|
+
__decorate([
|
|
10540
|
+
Input(),
|
|
10541
|
+
__metadata("design:type", Number),
|
|
10542
|
+
__metadata("design:paramtypes", [Number])
|
|
10543
|
+
], ColorPickerComponent.prototype, "tabindex", null);
|
|
9548
10544
|
__decorate([
|
|
9549
10545
|
Input(),
|
|
9550
10546
|
__metadata("design:type", Boolean)
|
|
9551
|
-
],
|
|
10547
|
+
], ColorPickerComponent.prototype, "preview", void 0);
|
|
9552
10548
|
__decorate([
|
|
9553
10549
|
Input(),
|
|
9554
|
-
__metadata("design:type",
|
|
9555
|
-
],
|
|
10550
|
+
__metadata("design:type", String)
|
|
10551
|
+
], ColorPickerComponent.prototype, "actionsLayout", void 0);
|
|
9556
10552
|
__decorate([
|
|
9557
10553
|
Output(),
|
|
9558
10554
|
__metadata("design:type", EventEmitter)
|
|
9559
|
-
],
|
|
10555
|
+
], ColorPickerComponent.prototype, "valueChange", void 0);
|
|
9560
10556
|
__decorate([
|
|
9561
10557
|
Output(),
|
|
9562
10558
|
__metadata("design:type", EventEmitter)
|
|
9563
|
-
],
|
|
10559
|
+
], ColorPickerComponent.prototype, "open", void 0);
|
|
9564
10560
|
__decorate([
|
|
9565
10561
|
Output(),
|
|
9566
10562
|
__metadata("design:type", EventEmitter)
|
|
9567
|
-
],
|
|
10563
|
+
], ColorPickerComponent.prototype, "close", void 0);
|
|
9568
10564
|
__decorate([
|
|
9569
|
-
|
|
9570
|
-
__metadata("design:type",
|
|
9571
|
-
|
|
9572
|
-
], ColorPaletteComponent.prototype, "hostTabindex", null);
|
|
10565
|
+
Output('focus'),
|
|
10566
|
+
__metadata("design:type", EventEmitter)
|
|
10567
|
+
], ColorPickerComponent.prototype, "onFocus", void 0);
|
|
9573
10568
|
__decorate([
|
|
9574
|
-
|
|
9575
|
-
__metadata("design:type",
|
|
9576
|
-
],
|
|
10569
|
+
Output('blur'),
|
|
10570
|
+
__metadata("design:type", EventEmitter)
|
|
10571
|
+
], ColorPickerComponent.prototype, "onBlur", void 0);
|
|
9577
10572
|
__decorate([
|
|
9578
|
-
|
|
9579
|
-
|
|
9580
|
-
|
|
9581
|
-
__metadata("design:paramtypes", [])
|
|
9582
|
-
], ColorPaletteComponent.prototype, "disabledClass", null);
|
|
10573
|
+
Output(),
|
|
10574
|
+
__metadata("design:type", EventEmitter)
|
|
10575
|
+
], ColorPickerComponent.prototype, "cancel", void 0);
|
|
9583
10576
|
__decorate([
|
|
9584
|
-
|
|
9585
|
-
__metadata("design:type",
|
|
9586
|
-
|
|
9587
|
-
], ColorPaletteComponent.prototype, "readonlyAttribute", null);
|
|
10577
|
+
Output(),
|
|
10578
|
+
__metadata("design:type", EventEmitter)
|
|
10579
|
+
], ColorPickerComponent.prototype, "activeColorClick", void 0);
|
|
9588
10580
|
__decorate([
|
|
9589
|
-
|
|
9590
|
-
__metadata("design:type",
|
|
9591
|
-
|
|
9592
|
-
__metadata("design:returntype", void 0)
|
|
9593
|
-
], ColorPaletteComponent.prototype, "handleKeydown", null);
|
|
10581
|
+
Output(),
|
|
10582
|
+
__metadata("design:type", EventEmitter)
|
|
10583
|
+
], ColorPickerComponent.prototype, "activeViewChange", void 0);
|
|
9594
10584
|
__decorate([
|
|
9595
|
-
|
|
9596
|
-
__metadata("design:type",
|
|
9597
|
-
|
|
9598
|
-
|
|
9599
|
-
|
|
9600
|
-
|
|
10585
|
+
ViewChild('container', { read: ViewContainerRef, static: true }),
|
|
10586
|
+
__metadata("design:type", ViewContainerRef)
|
|
10587
|
+
], ColorPickerComponent.prototype, "container", void 0);
|
|
10588
|
+
__decorate([
|
|
10589
|
+
ViewChild('wrapper', { static: true }),
|
|
10590
|
+
__metadata("design:type", ElementRef)
|
|
10591
|
+
], ColorPickerComponent.prototype, "wrapper", void 0);
|
|
10592
|
+
__decorate([
|
|
10593
|
+
ViewChild('popupTemplate', { static: true }),
|
|
10594
|
+
__metadata("design:type", TemplateRef)
|
|
10595
|
+
], ColorPickerComponent.prototype, "popupTemplate", void 0);
|
|
10596
|
+
__decorate([
|
|
10597
|
+
ViewChild('flatColorPicker', { static: false }),
|
|
10598
|
+
__metadata("design:type", FlatColorPickerComponent)
|
|
10599
|
+
], ColorPickerComponent.prototype, "flatColorPicker", void 0);
|
|
10600
|
+
ColorPickerComponent = ColorPickerComponent_1 = __decorate([
|
|
9601
10601
|
Component({
|
|
9602
|
-
|
|
9603
|
-
|
|
9604
|
-
|
|
10602
|
+
exportAs: 'kendoColorPicker',
|
|
10603
|
+
selector: 'kendo-colorpicker',
|
|
10604
|
+
providers: [{
|
|
9605
10605
|
multi: true,
|
|
9606
10606
|
provide: NG_VALUE_ACCESSOR,
|
|
9607
|
-
useExisting: forwardRef(function () { return
|
|
10607
|
+
useExisting: forwardRef(function () { return ColorPickerComponent_1; })
|
|
9608
10608
|
}, {
|
|
9609
10609
|
provide: KendoInput,
|
|
9610
|
-
useExisting: forwardRef(function () { return
|
|
10610
|
+
useExisting: forwardRef(function () { return ColorPickerComponent_1; })
|
|
9611
10611
|
},
|
|
9612
|
-
|
|
9613
|
-
ColorPaletteLocalizationService,
|
|
10612
|
+
ColorPickerLocalizationService,
|
|
9614
10613
|
{
|
|
9615
10614
|
provide: LocalizationService,
|
|
9616
|
-
useExisting:
|
|
10615
|
+
useExisting: ColorPickerLocalizationService
|
|
9617
10616
|
},
|
|
9618
10617
|
{
|
|
9619
10618
|
provide: L10N_PREFIX,
|
|
9620
|
-
useValue: 'kendo.
|
|
10619
|
+
useValue: 'kendo.colorpicker'
|
|
9621
10620
|
}
|
|
9622
10621
|
],
|
|
9623
|
-
template: "\n <ng-container
|
|
10622
|
+
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-picker-wrap': true,\n 'k-state-disabled': this.disabled,\n 'k-state-focused': 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 *ngIf=\"!iconStyles\" class=\"k-selected-color\" [style.background]=\"value\" (click)=\"handleActiveColorClick()\">\n <span class=\"k-icon k-i-line\" *ngIf=\"!value\"></span>\n </span>\n <span *ngIf=\"iconStyles\" class=\"k-tool-icon\" [ngClass]=\"iconStyles\" (click)=\"handleActiveColorClick()\">\n <span class=\"k-selected-color\" [style.background-color]=\"value\"></span>\n </span>\n <span class=\"k-select\" (click)=\"togglePopup()\">\n <span class=\"k-icon k-i-arrow-s\"></span>\n </span>\n </span>\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 "
|
|
9624
10623
|
}),
|
|
9625
|
-
__metadata("design:paramtypes", [
|
|
9626
|
-
ColorPaletteService,
|
|
10624
|
+
__metadata("design:paramtypes", [PopupService,
|
|
9627
10625
|
ChangeDetectorRef,
|
|
9628
|
-
|
|
9629
|
-
|
|
9630
|
-
],
|
|
9631
|
-
return
|
|
10626
|
+
LocalizationService,
|
|
10627
|
+
NgZone])
|
|
10628
|
+
], ColorPickerComponent);
|
|
10629
|
+
return ColorPickerComponent;
|
|
9632
10630
|
}());
|
|
9633
10631
|
|
|
9634
10632
|
/**
|
|
@@ -9647,6 +10645,14 @@ var ColorPickerMessages = /** @class */ (function (_super) {
|
|
|
9647
10645
|
Input(),
|
|
9648
10646
|
__metadata("design:type", String)
|
|
9649
10647
|
], ColorPickerMessages.prototype, "colorGradientNoColor", void 0);
|
|
10648
|
+
__decorate([
|
|
10649
|
+
Input(),
|
|
10650
|
+
__metadata("design:type", String)
|
|
10651
|
+
], ColorPickerMessages.prototype, "flatColorPickerNoColor", void 0);
|
|
10652
|
+
__decorate([
|
|
10653
|
+
Input(),
|
|
10654
|
+
__metadata("design:type", String)
|
|
10655
|
+
], ColorPickerMessages.prototype, "colorPickerNoColor", void 0);
|
|
9650
10656
|
__decorate([
|
|
9651
10657
|
Input(),
|
|
9652
10658
|
__metadata("design:type", String)
|
|
@@ -9695,6 +10701,34 @@ var ColorPickerMessages = /** @class */ (function (_super) {
|
|
|
9695
10701
|
Input(),
|
|
9696
10702
|
__metadata("design:type", String)
|
|
9697
10703
|
], ColorPickerMessages.prototype, "contrastRatio", void 0);
|
|
10704
|
+
__decorate([
|
|
10705
|
+
Input(),
|
|
10706
|
+
__metadata("design:type", String)
|
|
10707
|
+
], ColorPickerMessages.prototype, "previewColor", void 0);
|
|
10708
|
+
__decorate([
|
|
10709
|
+
Input(),
|
|
10710
|
+
__metadata("design:type", String)
|
|
10711
|
+
], ColorPickerMessages.prototype, "revertSelection", void 0);
|
|
10712
|
+
__decorate([
|
|
10713
|
+
Input(),
|
|
10714
|
+
__metadata("design:type", String)
|
|
10715
|
+
], ColorPickerMessages.prototype, "gradientView", void 0);
|
|
10716
|
+
__decorate([
|
|
10717
|
+
Input(),
|
|
10718
|
+
__metadata("design:type", String)
|
|
10719
|
+
], ColorPickerMessages.prototype, "paletteView", void 0);
|
|
10720
|
+
__decorate([
|
|
10721
|
+
Input(),
|
|
10722
|
+
__metadata("design:type", String)
|
|
10723
|
+
], ColorPickerMessages.prototype, "formatButton", void 0);
|
|
10724
|
+
__decorate([
|
|
10725
|
+
Input(),
|
|
10726
|
+
__metadata("design:type", String)
|
|
10727
|
+
], ColorPickerMessages.prototype, "applyButton", void 0);
|
|
10728
|
+
__decorate([
|
|
10729
|
+
Input(),
|
|
10730
|
+
__metadata("design:type", String)
|
|
10731
|
+
], ColorPickerMessages.prototype, "cancelButton", void 0);
|
|
9698
10732
|
return ColorPickerMessages;
|
|
9699
10733
|
}(ComponentMessages));
|
|
9700
10734
|
|
|
@@ -9725,7 +10759,7 @@ var ColorPickerCustomMessagesComponent = /** @class */ (function (_super) {
|
|
|
9725
10759
|
useExisting: forwardRef(function () { return ColorPickerCustomMessagesComponent_1; }) // tslint:disable-line:no-forward-ref
|
|
9726
10760
|
}
|
|
9727
10761
|
],
|
|
9728
|
-
selector: 'kendo-colorpicker-messages, kendo-colorgradient-messages, kendo-colorpalette-messages',
|
|
10762
|
+
selector: 'kendo-colorpicker-messages, kendo-flatcolorpicker-messages, kendo-colorgradient-messages, kendo-colorpalette-messages',
|
|
9729
10763
|
template: ""
|
|
9730
10764
|
}),
|
|
9731
10765
|
__metadata("design:paramtypes", [LocalizationService])
|
|
@@ -9753,7 +10787,7 @@ var LocalizedColorPickerMessagesDirective = /** @class */ (function (_super) {
|
|
|
9753
10787
|
useExisting: forwardRef(function () { return LocalizedColorPickerMessagesDirective_1; }) // tslint:disable-line:no-forward-ref
|
|
9754
10788
|
}
|
|
9755
10789
|
],
|
|
9756
|
-
selector: '[kendoColorPickerLocalizedMessages], [kendoColorGradientLocalizedMessages], [kendoColorPaletteLocalizedMessages]'
|
|
10790
|
+
selector: '[kendoColorPickerLocalizedMessages], [kendoFlatColorPickerLocalizedMessages], [kendoColorGradientLocalizedMessages], [kendoColorPaletteLocalizedMessages]'
|
|
9757
10791
|
}),
|
|
9758
10792
|
__metadata("design:paramtypes", [LocalizationService])
|
|
9759
10793
|
], LocalizedColorPickerMessagesDirective);
|
|
@@ -9808,7 +10842,8 @@ var ContrastValidationComponent = /** @class */ (function () {
|
|
|
9808
10842
|
});
|
|
9809
10843
|
Object.defineProperty(ContrastValidationComponent.prototype, "contrastText", {
|
|
9810
10844
|
get: function () {
|
|
9811
|
-
|
|
10845
|
+
var ratio = this.type === 'AA' ? AA_RATIO : AAA_RATIO;
|
|
10846
|
+
return this.type + ": " + ratio.toFixed(1);
|
|
9812
10847
|
},
|
|
9813
10848
|
enumerable: true,
|
|
9814
10849
|
configurable: true
|
|
@@ -9817,18 +10852,18 @@ var ContrastValidationComponent = /** @class */ (function () {
|
|
|
9817
10852
|
Input(),
|
|
9818
10853
|
__metadata("design:type", String)
|
|
9819
10854
|
], ContrastValidationComponent.prototype, "type", void 0);
|
|
9820
|
-
__decorate([
|
|
9821
|
-
Input(),
|
|
9822
|
-
__metadata("design:type", Number)
|
|
9823
|
-
], ContrastValidationComponent.prototype, "ratio", void 0);
|
|
9824
10855
|
__decorate([
|
|
9825
10856
|
Input(),
|
|
9826
10857
|
__metadata("design:type", Boolean)
|
|
9827
10858
|
], ContrastValidationComponent.prototype, "pass", void 0);
|
|
10859
|
+
__decorate([
|
|
10860
|
+
Input(),
|
|
10861
|
+
__metadata("design:type", String)
|
|
10862
|
+
], ContrastValidationComponent.prototype, "value", void 0);
|
|
9828
10863
|
ContrastValidationComponent = __decorate([
|
|
9829
10864
|
Component({
|
|
9830
10865
|
selector: '[kendoContrastValidation]',
|
|
9831
|
-
template: "\n <span>{{contrastText}}</span>\n
|
|
10866
|
+
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 "
|
|
9832
10867
|
}),
|
|
9833
10868
|
__metadata("design:paramtypes", [LocalizationService])
|
|
9834
10869
|
], ContrastValidationComponent);
|
|
@@ -9841,8 +10876,6 @@ var ContrastValidationComponent = /** @class */ (function () {
|
|
|
9841
10876
|
var ContrastComponent = /** @class */ (function () {
|
|
9842
10877
|
function ContrastComponent(localization) {
|
|
9843
10878
|
this.localization = localization;
|
|
9844
|
-
this.aaRatio = AA_RATIO;
|
|
9845
|
-
this.aaaRatio = AAA_RATIO;
|
|
9846
10879
|
}
|
|
9847
10880
|
Object.defineProperty(ContrastComponent.prototype, "formatedRatio", {
|
|
9848
10881
|
get: function () {
|
|
@@ -9851,23 +10884,23 @@ var ContrastComponent = /** @class */ (function () {
|
|
|
9851
10884
|
enumerable: true,
|
|
9852
10885
|
configurable: true
|
|
9853
10886
|
});
|
|
9854
|
-
Object.defineProperty(ContrastComponent.prototype, "
|
|
10887
|
+
Object.defineProperty(ContrastComponent.prototype, "contrastRatioText", {
|
|
9855
10888
|
get: function () {
|
|
9856
|
-
return this.localization.get('contrastRatio');
|
|
10889
|
+
return this.localization.get('contrastRatio') + ": " + (this.value ? this.formatedRatio : 'n/a');
|
|
9857
10890
|
},
|
|
9858
10891
|
enumerable: true,
|
|
9859
10892
|
configurable: true
|
|
9860
10893
|
});
|
|
9861
10894
|
Object.defineProperty(ContrastComponent.prototype, "satisfiesAACondition", {
|
|
9862
10895
|
get: function () {
|
|
9863
|
-
return this.contrastRatio >=
|
|
10896
|
+
return this.contrastRatio >= AA_RATIO;
|
|
9864
10897
|
},
|
|
9865
10898
|
enumerable: true,
|
|
9866
10899
|
configurable: true
|
|
9867
10900
|
});
|
|
9868
10901
|
Object.defineProperty(ContrastComponent.prototype, "satisfiesAAACondition", {
|
|
9869
10902
|
get: function () {
|
|
9870
|
-
return this.contrastRatio >=
|
|
10903
|
+
return this.contrastRatio >= AAA_RATIO;
|
|
9871
10904
|
},
|
|
9872
10905
|
enumerable: true,
|
|
9873
10906
|
configurable: true
|
|
@@ -9891,17 +10924,103 @@ var ContrastComponent = /** @class */ (function () {
|
|
|
9891
10924
|
ContrastComponent = __decorate([
|
|
9892
10925
|
Component({
|
|
9893
10926
|
selector: '[kendoContrastTool]',
|
|
9894
|
-
template: "\n <div class=\"k-contrast-ratio\">\n <span class=\"k-contrast-ratio-text\">{{
|
|
10927
|
+
template: "\n <div class=\"k-contrast-ratio\">\n <span class=\"k-contrast-ratio-text\">{{contrastRatioText}}</span>\n <ng-container *ngIf=\"value\">\n <span class=\"k-contrast-validation k-text-success\" *ngIf=\"satisfiesAACondition\">\n <span class=\"k-icon k-i-check\"></span>\n <span class=\"k-icon k-i-check\" *ngIf=\"satisfiesAAACondition\"></span>\n </span>\n <span class=\"k-contrast-validation k-text-error\" *ngIf=\"!satisfiesAACondition\">\n <span class=\"k-icon k-i-close\"></span>\n </span>\n </ng-container>\n </div>\n <div kendoContrastValidation\n type=\"AA\"\n [value]=\"value\"\n [pass]=\"satisfiesAACondition\">\n </div>\n <div kendoContrastValidation\n type=\"AAA\"\n [value]=\"value\"\n [pass]=\"satisfiesAAACondition\">\n </div>\n "
|
|
9895
10928
|
}),
|
|
9896
10929
|
__metadata("design:paramtypes", [LocalizationService])
|
|
9897
10930
|
], ContrastComponent);
|
|
9898
10931
|
return ContrastComponent;
|
|
9899
10932
|
}());
|
|
9900
10933
|
|
|
10934
|
+
/**
|
|
10935
|
+
* @hidden
|
|
10936
|
+
*/
|
|
10937
|
+
var ColorContrastSvgComponent = /** @class */ (function () {
|
|
10938
|
+
function ColorContrastSvgComponent() {
|
|
10939
|
+
this.hostClass = true;
|
|
10940
|
+
}
|
|
10941
|
+
ColorContrastSvgComponent.prototype.ngAfterViewInit = function () {
|
|
10942
|
+
var _this = this;
|
|
10943
|
+
this.metrics = this.wrapper.getBoundingClientRect();
|
|
10944
|
+
this.oldA = this.hsva.value.a;
|
|
10945
|
+
this.oldH = this.hsva.value.h;
|
|
10946
|
+
this.hsva.subscribe(function (value) {
|
|
10947
|
+
if (value.h !== _this.oldH || value.a !== _this.oldA) {
|
|
10948
|
+
_this.oldH = value.h;
|
|
10949
|
+
_this.oldA = value.a;
|
|
10950
|
+
_this.setPaths();
|
|
10951
|
+
}
|
|
10952
|
+
});
|
|
10953
|
+
};
|
|
10954
|
+
ColorContrastSvgComponent.prototype.ngOnChanges = function (changes) {
|
|
10955
|
+
if (isPresent(changes.backgroundColor) && this.metrics) {
|
|
10956
|
+
this.setPaths();
|
|
10957
|
+
}
|
|
10958
|
+
};
|
|
10959
|
+
ColorContrastSvgComponent.prototype.setPaths = function () {
|
|
10960
|
+
var bezierCommandCalc = bezierCommand(controlPoint(line));
|
|
10961
|
+
this.paths = [svgPath(this.getPaths(AA_RATIO, STEP_COUNT), bezierCommandCalc),
|
|
10962
|
+
svgPath(this.getPaths(AA_RATIO, STEP_COUNT, true), bezierCommandCalc),
|
|
10963
|
+
svgPath(this.getPaths(AAA_RATIO, STEP_COUNT), bezierCommandCalc),
|
|
10964
|
+
svgPath(this.getPaths(AAA_RATIO, STEP_COUNT, true), bezierCommandCalc)];
|
|
10965
|
+
};
|
|
10966
|
+
ColorContrastSvgComponent.prototype.findValue = function (contrast, saturation, low, high, comparer) {
|
|
10967
|
+
var mid = (low + high) / 2;
|
|
10968
|
+
var hsva = Object.assign({}, this.hsva.value, { s: saturation / this.metrics.width, v: 1 - mid / this.metrics.height });
|
|
10969
|
+
var currentContrast = getContrastFromTwoRGBAs(getRGBA(getColorFromHSV(hsva)), getRGBA(this.backgroundColor || ''));
|
|
10970
|
+
if (low + 0.5 > high) {
|
|
10971
|
+
if (currentContrast < contrast + 1 && currentContrast > contrast - 1) {
|
|
10972
|
+
return mid;
|
|
10973
|
+
}
|
|
10974
|
+
else {
|
|
10975
|
+
return null;
|
|
10976
|
+
}
|
|
10977
|
+
}
|
|
10978
|
+
if (comparer(currentContrast, contrast)) {
|
|
10979
|
+
return this.findValue(contrast, saturation, low, high - (high - low) / 2, comparer);
|
|
10980
|
+
}
|
|
10981
|
+
return this.findValue(contrast, saturation, low + (high - low) / 2, high, comparer);
|
|
10982
|
+
};
|
|
10983
|
+
ColorContrastSvgComponent.prototype.getPaths = function (contrast, stepCount, reversed) {
|
|
10984
|
+
if (reversed === void 0) { reversed = false; }
|
|
10985
|
+
var points = [];
|
|
10986
|
+
for (var i = 0; i <= this.metrics.width; i += this.metrics.width / stepCount) {
|
|
10987
|
+
var value = this.findValue(contrast, i, 0, this.metrics.height, reversed ? (function (a, b) { return a < b; }) : (function (a, b) { return a > b; }));
|
|
10988
|
+
if (value !== null) {
|
|
10989
|
+
points.push([i, value]);
|
|
10990
|
+
}
|
|
10991
|
+
}
|
|
10992
|
+
return points;
|
|
10993
|
+
};
|
|
10994
|
+
__decorate([
|
|
10995
|
+
HostBinding('class.k-color-contrast-svg'),
|
|
10996
|
+
__metadata("design:type", Boolean)
|
|
10997
|
+
], ColorContrastSvgComponent.prototype, "hostClass", void 0);
|
|
10998
|
+
__decorate([
|
|
10999
|
+
Input(),
|
|
11000
|
+
__metadata("design:type", Object)
|
|
11001
|
+
], ColorContrastSvgComponent.prototype, "wrapper", void 0);
|
|
11002
|
+
__decorate([
|
|
11003
|
+
Input(),
|
|
11004
|
+
__metadata("design:type", BehaviorSubject)
|
|
11005
|
+
], ColorContrastSvgComponent.prototype, "hsva", void 0);
|
|
11006
|
+
__decorate([
|
|
11007
|
+
Input(),
|
|
11008
|
+
__metadata("design:type", String)
|
|
11009
|
+
], ColorContrastSvgComponent.prototype, "backgroundColor", void 0);
|
|
11010
|
+
ColorContrastSvgComponent = __decorate([
|
|
11011
|
+
Component({
|
|
11012
|
+
selector: '[kendoColorContrastSvg]',
|
|
11013
|
+
template: "\n <svg:path *ngFor=\"let path of paths\" [attr.d]=\"path\" fill=\"none\" stroke=\"white\" stroke-width=\"1\"></svg:path>\n "
|
|
11014
|
+
})
|
|
11015
|
+
], ColorContrastSvgComponent);
|
|
11016
|
+
return ColorContrastSvgComponent;
|
|
11017
|
+
}());
|
|
11018
|
+
|
|
9901
11019
|
var PUBLIC_DIRECTIVES = [
|
|
9902
11020
|
ColorPickerComponent,
|
|
9903
11021
|
ColorPaletteComponent,
|
|
9904
11022
|
ColorGradientComponent,
|
|
11023
|
+
FlatColorPickerComponent,
|
|
9905
11024
|
LocalizedColorPickerMessagesDirective,
|
|
9906
11025
|
ColorPickerCustomMessagesComponent
|
|
9907
11026
|
];
|
|
@@ -9909,7 +11028,10 @@ var INTERNAL_DIRECTIVES = [
|
|
|
9909
11028
|
ColorInputComponent,
|
|
9910
11029
|
FocusOnDomReadyDirective,
|
|
9911
11030
|
ContrastComponent,
|
|
9912
|
-
ContrastValidationComponent
|
|
11031
|
+
ContrastValidationComponent,
|
|
11032
|
+
FlatColorPickerHeaderComponent,
|
|
11033
|
+
FlatColorPickerActionButtonsComponent,
|
|
11034
|
+
ColorContrastSvgComponent
|
|
9913
11035
|
];
|
|
9914
11036
|
/**
|
|
9915
11037
|
* Represents the [NgModule]({{ site.data.urls.angular['ngmoduleapi'] }})
|
|
@@ -10613,4 +11735,4 @@ var InputsModule = /** @class */ (function () {
|
|
|
10613
11735
|
* Generated bundle index. Do not edit.
|
|
10614
11736
|
*/
|
|
10615
11737
|
|
|
10616
|
-
export { CheckBoxModule, ColorInputComponent, ContrastValidationComponent, ContrastComponent, FocusOnDomReadyDirective, ColorGradientLocalizationService, ColorPaletteLocalizationService, ColorPickerLocalizationService, ColorPickerCustomMessagesComponent, ColorPickerMessages, ColorPaletteService, MaskingService, NumericTextBoxMessages, RadioButtonModule, RangeSliderCustomMessagesComponent, RangeSliderMessages, SHARED_DIRECTIVES, SliderCustomMessagesComponent, SliderMessages, SliderBase, SlidersCommonModule, SwitchCustomMessagesComponent, Messages, TextFieldsBase, TextBoxCustomMessagesComponent, TextBoxMessages, SliderComponent, RangeSliderComponent, LabelTemplateDirective, SwitchComponent, TextBoxContainerComponent, TextBoxDirective, TextAreaDirective, NumericTextBoxComponent, NumericTextBoxCustomMessagesComponent, MaskedTextBoxComponent, InputsModule, SliderTicksComponent, SliderModule, RangeSliderModule, SwitchModule, NumericTextBoxModule, MaskedTextBoxModule, TextBoxModule, TextAreaModule, ColorPickerComponent, ColorPaletteComponent, ColorGradientComponent, ColorPickerModule,
|
|
11738
|
+
export { CheckBoxModule, ColorContrastSvgComponent, ColorInputComponent, ContrastValidationComponent, ContrastComponent, FlatColorPickerActionButtonsComponent, FlatColorPickerHeaderComponent, FocusOnDomReadyDirective, ColorGradientLocalizationService, ColorPaletteLocalizationService, ColorPickerLocalizationService, ColorPickerCustomMessagesComponent, FlatColorPickerLocalizationService, ColorPickerMessages, ColorPaletteService, FlatColorPickerService, MaskingService, NumericTextBoxMessages, RadioButtonModule, RangeSliderCustomMessagesComponent, RangeSliderMessages, SHARED_DIRECTIVES, SliderCustomMessagesComponent, SliderMessages, SliderBase, SlidersCommonModule, SwitchCustomMessagesComponent, Messages, TextFieldsBase, TextBoxCustomMessagesComponent, TextBoxMessages, SliderComponent, RangeSliderComponent, LabelTemplateDirective, SwitchComponent, TextBoxContainerComponent, TextBoxDirective, TextAreaDirective, NumericTextBoxComponent, NumericTextBoxCustomMessagesComponent, MaskedTextBoxComponent, InputsModule, SliderTicksComponent, SliderModule, RangeSliderModule, SwitchModule, NumericTextBoxModule, MaskedTextBoxModule, TextBoxModule, TextAreaModule, ColorPickerComponent, ColorPaletteComponent, ColorGradientComponent, ColorPickerModule, FlatColorPickerComponent, ColorPickerCancelEvent, CheckBoxDirective, RadioButtonDirective, HintComponent, ErrorComponent, FormFieldComponent, FormFieldModule, TextBoxComponent, TextBoxPrefixTemplateDirective, TextBoxSuffixTemplateDirective, TextAreaComponent, TextAreaSuffixComponent, InputSeparatorComponent, SharedModule, LocalizedColorPickerMessagesDirective, LocalizedNumericTextBoxMessagesDirective, LocalizedTextBoxMessagesDirective, LocalizedSliderMessagesDirective, LocalizedRangeSliderMessagesDirective, LocalizedSwitchMessagesDirective, ColorPickerCloseEvent, ColorPickerOpenEvent, ActiveColorClickEvent };
|