@skyux/colorpicker 5.5.0 → 5.6.0
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/bundles/skyux-colorpicker.umd.js +387 -387
- package/documentation.json +87 -87
- package/esm2015/lib/modules/colorpicker/colorpicker-input.directive.js +5 -5
- package/esm2015/lib/modules/colorpicker/colorpicker-input.directive.js.map +1 -1
- package/esm2015/lib/modules/colorpicker/colorpicker-slider.directive.js +5 -5
- package/esm2015/lib/modules/colorpicker/colorpicker-slider.directive.js.map +1 -1
- package/esm2015/lib/modules/colorpicker/colorpicker-text.directive.js +3 -3
- package/esm2015/lib/modules/colorpicker/colorpicker-text.directive.js.map +1 -1
- package/esm2015/lib/modules/colorpicker/colorpicker.component.js +13 -13
- package/esm2015/lib/modules/colorpicker/colorpicker.component.js.map +1 -1
- package/esm2015/lib/modules/colorpicker/colorpicker.module.js +1 -1
- package/esm2015/lib/modules/colorpicker/colorpicker.module.js.map +1 -1
- package/esm2015/lib/modules/colorpicker/colorpicker.service.js +19 -19
- package/esm2015/lib/modules/colorpicker/colorpicker.service.js.map +1 -1
- package/esm2015/lib/modules/colorpicker/types/colorpicker-result.js.map +1 -1
- package/esm2015/lib/modules/shared/sky-colorpicker-resources.module.js +2 -2
- package/esm2015/lib/modules/shared/sky-colorpicker-resources.module.js.map +1 -1
- package/esm2015/testing/colorpicker-fixture.js.map +1 -1
- package/fesm2015/skyux-colorpicker-testing.js.map +1 -1
- package/fesm2015/skyux-colorpicker.js +79 -79
- package/fesm2015/skyux-colorpicker.js.map +1 -1
- package/lib/modules/colorpicker/colorpicker-input.directive.d.ts +1 -1
- package/lib/modules/colorpicker/colorpicker.component.d.ts +4 -4
- package/lib/modules/colorpicker/colorpicker.service.d.ts +1 -1
- package/package.json +6 -6
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/core'), require('@skyux/core'), require('@skyux/forms'), require('@skyux/i18n'), require('@skyux/indicators'), require('@skyux/theme'), require('
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@skyux/colorpicker', ['exports', '@angular/common', '@angular/core', '@skyux/core', '@skyux/forms', '@skyux/i18n', '@skyux/indicators', '@skyux/theme', '
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.skyux = global.skyux || {}, global.skyux.colorpicker = {}), global.ng.common, global.ng.core, global.i1, global.i5, global.i2, global.i4, global.i3, global.
|
|
5
|
-
})(this, (function (exports, i6, i0, i1, i5, i2, i4, i3, rxjs, operators
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/core'), require('@skyux/core'), require('@skyux/forms'), require('@skyux/i18n'), require('@skyux/indicators'), require('@skyux/theme'), require('@angular/forms'), require('rxjs'), require('rxjs/operators')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@skyux/colorpicker', ['exports', '@angular/common', '@angular/core', '@skyux/core', '@skyux/forms', '@skyux/i18n', '@skyux/indicators', '@skyux/theme', '@angular/forms', 'rxjs', 'rxjs/operators'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.skyux = global.skyux || {}, global.skyux.colorpicker = {}), global.ng.common, global.ng.core, global.i1, global.i5, global.i2, global.i4, global.i3, global.ng.forms, global.rxjs, global.rxjs.operators));
|
|
5
|
+
})(this, (function (exports, i6, i0, i1, i5, i2, i4, i3, forms, rxjs, operators) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopNamespace(e) {
|
|
8
8
|
if (e && e.__esModule) return e;
|
|
@@ -102,29 +102,6 @@
|
|
|
102
102
|
}]
|
|
103
103
|
}] });
|
|
104
104
|
|
|
105
|
-
/**
|
|
106
|
-
* Specifies the commands to provide the colorpicker.
|
|
107
|
-
*/
|
|
108
|
-
exports.SkyColorpickerMessageType = void 0;
|
|
109
|
-
(function (SkyColorpickerMessageType) {
|
|
110
|
-
/**
|
|
111
|
-
* Opens the colorpicker.
|
|
112
|
-
*/
|
|
113
|
-
SkyColorpickerMessageType[SkyColorpickerMessageType["Open"] = 0] = "Open";
|
|
114
|
-
/**
|
|
115
|
-
* Resets the selection in the colorpicker.
|
|
116
|
-
*/
|
|
117
|
-
SkyColorpickerMessageType[SkyColorpickerMessageType["Reset"] = 1] = "Reset";
|
|
118
|
-
/**
|
|
119
|
-
* Toggles whether to display a reset button beside the colorpicker.
|
|
120
|
-
*/
|
|
121
|
-
SkyColorpickerMessageType[SkyColorpickerMessageType["ToggleResetButton"] = 2] = "ToggleResetButton";
|
|
122
|
-
/**
|
|
123
|
-
* Closes the colorpicker.
|
|
124
|
-
*/
|
|
125
|
-
SkyColorpickerMessageType[SkyColorpickerMessageType["Close"] = 3] = "Close";
|
|
126
|
-
})(exports.SkyColorpickerMessageType || (exports.SkyColorpickerMessageType = {}));
|
|
127
|
-
|
|
128
105
|
// spell-checker:ignore hsva, hsla, cmyk, denormalize, colorpicker,Injectable
|
|
129
106
|
/**
|
|
130
107
|
* @internal
|
|
@@ -471,118 +448,354 @@
|
|
|
471
448
|
type: i0.Injectable
|
|
472
449
|
}], ctorParameters: function () { return []; } });
|
|
473
450
|
|
|
474
|
-
//
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
451
|
+
// tslint:disable:no-forward-ref no-use-before-declare
|
|
452
|
+
var SKY_COLORPICKER_VALUE_ACCESSOR = {
|
|
453
|
+
provide: forms.NG_VALUE_ACCESSOR,
|
|
454
|
+
useExisting: i0.forwardRef(function () { return SkyColorpickerInputDirective; }),
|
|
455
|
+
multi: true,
|
|
456
|
+
};
|
|
457
|
+
var SKY_COLORPICKER_VALIDATOR = {
|
|
458
|
+
provide: forms.NG_VALIDATORS,
|
|
459
|
+
useExisting: i0.forwardRef(function () { return SkyColorpickerInputDirective; }),
|
|
460
|
+
multi: true,
|
|
461
|
+
};
|
|
462
|
+
// tslint:enable
|
|
463
|
+
var SKY_COLORPICKER_DEFAULT_COLOR = '#FFFFFF';
|
|
487
464
|
/**
|
|
488
|
-
*
|
|
465
|
+
* Creates the colorpicker element and dropdown.
|
|
489
466
|
*/
|
|
490
|
-
var
|
|
491
|
-
function
|
|
492
|
-
this.
|
|
493
|
-
this.
|
|
494
|
-
this.
|
|
495
|
-
this.
|
|
467
|
+
var SkyColorpickerInputDirective = /** @class */ (function () {
|
|
468
|
+
function SkyColorpickerInputDirective(elementRef, renderer, service, resourcesService, injector) {
|
|
469
|
+
this.elementRef = elementRef;
|
|
470
|
+
this.renderer = renderer;
|
|
471
|
+
this.service = service;
|
|
472
|
+
this.resourcesService = resourcesService;
|
|
473
|
+
this.injector = injector;
|
|
474
|
+
/**
|
|
475
|
+
* This property is deprecated and does not affect the colorpicker.
|
|
476
|
+
* We recommend against using it.
|
|
477
|
+
* @deprecated
|
|
478
|
+
* @default "rgba"
|
|
479
|
+
*/
|
|
480
|
+
this.returnFormat = 'rgba';
|
|
481
|
+
/**
|
|
482
|
+
* Specifies the format to use for the color when the colorpicker uses a native input
|
|
483
|
+
* element such as a standard text input or a button. This property accepts `rgba`, `hex`,
|
|
484
|
+
* or `hsla`, but we do not recommend using it because users never see or use its value.
|
|
485
|
+
* Instead, if you need to access this format value, see the demo for an example.
|
|
486
|
+
*@default "rgba"
|
|
487
|
+
*/
|
|
488
|
+
this.outputFormat = 'rgba';
|
|
489
|
+
/**
|
|
490
|
+
* Specifies an array of colors to load as preset choices. The colorpicker displays the
|
|
491
|
+
* colors in a series of 12 boxes for users to select.
|
|
492
|
+
*/
|
|
493
|
+
this.presetColors = ['#333', '#888', '#EFEFEF', '#FFF'];
|
|
494
|
+
/**
|
|
495
|
+
* Specifies the type of transparency to use in the transparency slider.
|
|
496
|
+
*@default "hex6"
|
|
497
|
+
*/
|
|
498
|
+
this.alphaChannel = 'hex6';
|
|
499
|
+
/**
|
|
500
|
+
* Indicates whether to display a transparency slider for users to select transparency
|
|
501
|
+
* levels.
|
|
502
|
+
*/
|
|
503
|
+
this.allowTransparency = true;
|
|
504
|
+
/*istanbul ignore next */
|
|
505
|
+
this._onChange = function (_) { };
|
|
506
|
+
/*istanbul ignore next */
|
|
507
|
+
this._onTouched = function () { };
|
|
508
|
+
this._validatorChange = function () { };
|
|
496
509
|
}
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
510
|
+
Object.defineProperty(SkyColorpickerInputDirective.prototype, "initialColor", {
|
|
511
|
+
get: function () {
|
|
512
|
+
return this._initialColor || SKY_COLORPICKER_DEFAULT_COLOR;
|
|
513
|
+
},
|
|
514
|
+
/**
|
|
515
|
+
* Specifies an initial color to load in the colorpicker. Use a reactive or
|
|
516
|
+
* template-driven form to set this value. This property is deprecated. As an alternative,
|
|
517
|
+
* we recommend the `formControlName` property on reactive forms or `ngModel` on
|
|
518
|
+
* template-driven forms. See the demo for examples.
|
|
519
|
+
* @deprecated
|
|
520
|
+
*/
|
|
521
|
+
set: function (value) {
|
|
522
|
+
/* istanbul ignore else */
|
|
523
|
+
if (!this._initialColor && !this.modelValue) {
|
|
524
|
+
this.writeValue(value);
|
|
525
|
+
}
|
|
526
|
+
this._initialColor = value;
|
|
527
|
+
},
|
|
528
|
+
enumerable: false,
|
|
529
|
+
configurable: true
|
|
530
|
+
});
|
|
531
|
+
SkyColorpickerInputDirective.prototype.changeInput = function (event) {
|
|
532
|
+
var value = event.target.value;
|
|
533
|
+
this.skyColorpickerInput.updatePickerValues(value);
|
|
534
|
+
this.skyColorpickerInput.backgroundColorForDisplay = value;
|
|
535
|
+
};
|
|
536
|
+
SkyColorpickerInputDirective.prototype.onChange = function (event) {
|
|
537
|
+
var newValue = event.target.value;
|
|
538
|
+
this.modelValue = this.formatter(newValue);
|
|
539
|
+
this._validatorChange();
|
|
540
|
+
this._onChange(this.modelValue);
|
|
541
|
+
this.writeModelValue(this.modelValue);
|
|
542
|
+
};
|
|
543
|
+
/* istanbul ignore next */
|
|
544
|
+
SkyColorpickerInputDirective.prototype.onBlur = function () {
|
|
545
|
+
/*istanbul ignore next */
|
|
546
|
+
this._onTouched();
|
|
547
|
+
};
|
|
548
|
+
SkyColorpickerInputDirective.prototype.ngOnInit = function () {
|
|
506
549
|
var _this = this;
|
|
507
|
-
|
|
508
|
-
this.
|
|
509
|
-
this.
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
var xAxis = Math.max(0, Math.min(this.getX(event), width));
|
|
520
|
-
var yAxis = Math.max(0, Math.min(this.getY(event), height));
|
|
521
|
-
if (this.xAxis !== undefined && this.yAxis !== undefined) {
|
|
522
|
-
this.newColorContrast.emit({
|
|
523
|
-
xCoordinate: xAxis / width,
|
|
524
|
-
yCoordinate: 1 - yAxis / height,
|
|
525
|
-
xAxis: this.xAxis,
|
|
526
|
-
yAxis: this.yAxis,
|
|
550
|
+
var element = this.elementRef.nativeElement;
|
|
551
|
+
this.renderer.addClass(element, 'sky-form-control');
|
|
552
|
+
this.skyColorpickerInput.initialColor = this.initialColor;
|
|
553
|
+
this.skyColorpickerInput.returnFormat = this.returnFormat;
|
|
554
|
+
this.pickerChangedSubscription =
|
|
555
|
+
this.skyColorpickerInput.selectedColorChanged.subscribe(function (newColor) {
|
|
556
|
+
/* istanbul ignore else */
|
|
557
|
+
if (newColor) {
|
|
558
|
+
_this.modelValue = _this.formatter(newColor);
|
|
559
|
+
_this.writeModelValue(_this.modelValue);
|
|
560
|
+
}
|
|
561
|
+
_this._onChange(newColor);
|
|
527
562
|
});
|
|
563
|
+
this.skyColorpickerInput.updatePickerValues(this.initialColor);
|
|
564
|
+
/* Sanity check */
|
|
565
|
+
/* istanbul ignore else */
|
|
566
|
+
if (!this._disabled) {
|
|
567
|
+
this.skyColorpickerInput.backgroundColorForDisplay = this.initialColor;
|
|
568
|
+
}
|
|
569
|
+
/// Set aria-label as default, if not set
|
|
570
|
+
if (!element.getAttribute('aria-label')) {
|
|
571
|
+
this.renderer.setAttribute(element, 'aria-label', this.getString('skyux_colorpicker_input_default_label'));
|
|
572
|
+
}
|
|
573
|
+
var typeAttr = element.getAttribute('type');
|
|
574
|
+
if (typeAttr && typeAttr === 'hidden') {
|
|
575
|
+
this.skyColorpickerInput.isVisible = false;
|
|
528
576
|
}
|
|
529
577
|
else {
|
|
530
|
-
this.
|
|
531
|
-
xCoordinate: xAxis / width,
|
|
532
|
-
maxRange: this.xAxis,
|
|
533
|
-
});
|
|
578
|
+
this.skyColorpickerInput.isVisible = true;
|
|
534
579
|
}
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
this.newColorContrast.emit({ yCoordinate: yAxis / height, maxRange: this.yAxis });
|
|
538
|
-
} */
|
|
580
|
+
element.setAttribute('readonly', 'true');
|
|
581
|
+
this.renderer.addClass(element, 'sky-colorpicker-input');
|
|
539
582
|
};
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
this.setCursor(event);
|
|
583
|
+
SkyColorpickerInputDirective.prototype.ngOnDestroy = function () {
|
|
584
|
+
this.pickerChangedSubscription.unsubscribe();
|
|
543
585
|
};
|
|
544
|
-
|
|
545
|
-
this.
|
|
546
|
-
document.addEventListener('mousemove', this.listenerMove);
|
|
547
|
-
document.addEventListener('touchmove', this.listenerMove);
|
|
548
|
-
document.addEventListener('mouseup', this.listenerStop);
|
|
549
|
-
document.addEventListener('touchend', this.listenerStop);
|
|
586
|
+
SkyColorpickerInputDirective.prototype.setColorPickerDefaults = function () {
|
|
587
|
+
this.skyColorpickerInput.setDialog(this, this.elementRef, this.initialColor, this.outputFormat, this.presetColors, this.alphaChannel, this.allowTransparency);
|
|
550
588
|
};
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
document.removeEventListener('touchend', this.listenerStop);
|
|
589
|
+
SkyColorpickerInputDirective.prototype.ngOnChanges = function () {
|
|
590
|
+
this._validatorChange();
|
|
591
|
+
this.skyColorpickerInput.returnFormat = this.returnFormat;
|
|
592
|
+
this.setColorPickerDefaults();
|
|
556
593
|
};
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
/* istanbul ignore next */
|
|
560
|
-
return ((event.pageX !== undefined ? event.pageX : event.touches[0].pageX) -
|
|
561
|
-
this.el.nativeElement.getBoundingClientRect().left -
|
|
562
|
-
window.pageXOffset);
|
|
594
|
+
SkyColorpickerInputDirective.prototype.registerOnChange = function (fn) {
|
|
595
|
+
this._onChange = fn;
|
|
563
596
|
};
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
/* istanbul ignore next */
|
|
567
|
-
return ((event.pageY !== undefined ? event.pageY : event.touches[0].pageY) -
|
|
568
|
-
this.el.nativeElement.getBoundingClientRect().top -
|
|
569
|
-
window.pageYOffset);
|
|
597
|
+
SkyColorpickerInputDirective.prototype.registerOnTouched = function (fn) {
|
|
598
|
+
this._onTouched = fn;
|
|
570
599
|
};
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
600
|
+
SkyColorpickerInputDirective.prototype.registerOnValidatorChange = function (fn) {
|
|
601
|
+
this._validatorChange = fn;
|
|
602
|
+
};
|
|
603
|
+
SkyColorpickerInputDirective.prototype.writeValue = function (value) {
|
|
604
|
+
if (this.skyColorpickerInput &&
|
|
605
|
+
value &&
|
|
606
|
+
value !== this.skyColorpickerInput.lastAppliedColor) {
|
|
607
|
+
this.modelValue = this.formatter(value);
|
|
608
|
+
this.writeModelValue(this.modelValue);
|
|
609
|
+
if (!this._initialColor) {
|
|
610
|
+
this._initialColor = value;
|
|
611
|
+
this.skyColorpickerInput.initialColor = value;
|
|
612
|
+
}
|
|
613
|
+
this.skyColorpickerInput.lastAppliedColor = value;
|
|
614
|
+
var control = this.injector.get(forms.NgControl)
|
|
615
|
+
.control;
|
|
616
|
+
if (control) {
|
|
617
|
+
control.setValue(this.modelValue, { emitEvent: false });
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
};
|
|
621
|
+
SkyColorpickerInputDirective.prototype.validate = function (control) {
|
|
622
|
+
var value = control.value;
|
|
623
|
+
if (!value) {
|
|
624
|
+
return;
|
|
625
|
+
}
|
|
626
|
+
// Validation
|
|
627
|
+
};
|
|
628
|
+
/**
|
|
629
|
+
* Implemented as part of ControlValueAccessor.
|
|
630
|
+
*/
|
|
631
|
+
SkyColorpickerInputDirective.prototype.setDisabledState = function (isDisabled) {
|
|
632
|
+
this._disabled = isDisabled;
|
|
633
|
+
this.skyColorpickerInput.disabled = isDisabled;
|
|
634
|
+
if (this._disabled) {
|
|
635
|
+
this.skyColorpickerInput.backgroundColorForDisplay = '#fff';
|
|
636
|
+
}
|
|
637
|
+
else {
|
|
638
|
+
this.skyColorpickerInput.backgroundColorForDisplay = this.modelValue.hex;
|
|
639
|
+
}
|
|
640
|
+
};
|
|
641
|
+
SkyColorpickerInputDirective.prototype.writeModelValue = function (model) {
|
|
642
|
+
var setElementValue = model.rgbaText;
|
|
643
|
+
var element = this.elementRef.nativeElement;
|
|
644
|
+
var output;
|
|
645
|
+
// tslint:disable-next-line:switch-default
|
|
646
|
+
switch (this.outputFormat) {
|
|
647
|
+
case 'rgba':
|
|
648
|
+
output = model.rgbaText;
|
|
649
|
+
break;
|
|
650
|
+
case 'hsla':
|
|
651
|
+
output = model.hslaText;
|
|
652
|
+
break;
|
|
653
|
+
case 'cmyk':
|
|
654
|
+
output = model.cmykText;
|
|
655
|
+
break;
|
|
656
|
+
case 'hex':
|
|
657
|
+
output = model.hex;
|
|
658
|
+
break;
|
|
659
|
+
}
|
|
660
|
+
this.skyColorpickerInput.updatePickerValues(output);
|
|
661
|
+
this.skyColorpickerInput.backgroundColorForDisplay = output;
|
|
662
|
+
this.renderer.setStyle(element, 'background-color', setElementValue);
|
|
663
|
+
this.renderer.setProperty(element, 'value', output);
|
|
664
|
+
};
|
|
665
|
+
SkyColorpickerInputDirective.prototype.formatter = function (color) {
|
|
666
|
+
if (color && typeof color !== 'string') {
|
|
667
|
+
return color;
|
|
668
|
+
}
|
|
669
|
+
var formatColor;
|
|
670
|
+
var hsva = this.service.stringToHsva(color, this.alphaChannel === 'hex8');
|
|
671
|
+
formatColor = this.service.skyColorpickerOut(hsva);
|
|
672
|
+
return formatColor;
|
|
673
|
+
};
|
|
674
|
+
SkyColorpickerInputDirective.prototype.getString = function (key) {
|
|
675
|
+
// TODO: Need to implement the async `getString` method in a breaking change.
|
|
676
|
+
return this.resourcesService.getStringForLocale({ locale: 'en-US' }, key);
|
|
677
|
+
};
|
|
678
|
+
return SkyColorpickerInputDirective;
|
|
679
|
+
}());
|
|
680
|
+
SkyColorpickerInputDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyColorpickerInputDirective, deps: [{ token: i0__namespace.ElementRef }, { token: i0__namespace.Renderer2 }, { token: SkyColorpickerService }, { token: i2__namespace.SkyLibResourcesService }, { token: i0__namespace.Injector }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
|
681
|
+
SkyColorpickerInputDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: SkyColorpickerInputDirective, selector: "[skyColorpickerInput]", inputs: { skyColorpickerInput: "skyColorpickerInput", initialColor: "initialColor", returnFormat: "returnFormat", outputFormat: "outputFormat", presetColors: "presetColors", alphaChannel: "alphaChannel", allowTransparency: "allowTransparency" }, host: { listeners: { "input": "changeInput($event)", "change": "onChange($event)", "blur": "onBlur()" } }, providers: [SKY_COLORPICKER_VALUE_ACCESSOR, SKY_COLORPICKER_VALIDATOR], usesOnChanges: true, ngImport: i0__namespace });
|
|
682
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyColorpickerInputDirective, decorators: [{
|
|
683
|
+
type: i0.Directive,
|
|
684
|
+
args: [{
|
|
685
|
+
selector: '[skyColorpickerInput]',
|
|
686
|
+
providers: [SKY_COLORPICKER_VALUE_ACCESSOR, SKY_COLORPICKER_VALIDATOR],
|
|
687
|
+
}]
|
|
688
|
+
}], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.Renderer2 }, { type: SkyColorpickerService }, { type: i2__namespace.SkyLibResourcesService }, { type: i0__namespace.Injector }]; }, propDecorators: { skyColorpickerInput: [{
|
|
689
|
+
type: i0.Input
|
|
690
|
+
}], initialColor: [{
|
|
691
|
+
type: i0.Input
|
|
692
|
+
}], returnFormat: [{
|
|
693
|
+
type: i0.Input
|
|
694
|
+
}], outputFormat: [{
|
|
695
|
+
type: i0.Input
|
|
696
|
+
}], presetColors: [{
|
|
697
|
+
type: i0.Input
|
|
698
|
+
}], alphaChannel: [{
|
|
699
|
+
type: i0.Input
|
|
700
|
+
}], allowTransparency: [{
|
|
701
|
+
type: i0.Input
|
|
702
|
+
}], changeInput: [{
|
|
703
|
+
type: i0.HostListener,
|
|
704
|
+
args: ['input', ['$event']]
|
|
705
|
+
}], onChange: [{
|
|
706
|
+
type: i0.HostListener,
|
|
707
|
+
args: ['change', ['$event']]
|
|
708
|
+
}], onBlur: [{
|
|
709
|
+
type: i0.HostListener,
|
|
710
|
+
args: ['blur']
|
|
711
|
+
}] } });
|
|
712
|
+
|
|
713
|
+
// spell-checker:ignore Colorpicker
|
|
714
|
+
/**
|
|
715
|
+
* @internal
|
|
716
|
+
*/
|
|
717
|
+
var SkyColorpickerSliderDirective = /** @class */ (function () {
|
|
718
|
+
function SkyColorpickerSliderDirective(el) {
|
|
719
|
+
var _this = this;
|
|
720
|
+
this.el = el;
|
|
721
|
+
this.newColorContrast = new i0.EventEmitter();
|
|
722
|
+
this.listenerMove = function (event) {
|
|
723
|
+
_this.move(event);
|
|
724
|
+
};
|
|
725
|
+
this.listenerStop = function () {
|
|
726
|
+
_this.stop();
|
|
727
|
+
};
|
|
728
|
+
}
|
|
729
|
+
SkyColorpickerSliderDirective.prototype.setCursor = function (event) {
|
|
730
|
+
var height = this.el.nativeElement.offsetHeight;
|
|
731
|
+
var width = this.el.nativeElement.offsetWidth;
|
|
732
|
+
var xAxis = Math.max(0, Math.min(this.getX(event), width));
|
|
733
|
+
var yAxis = Math.max(0, Math.min(this.getY(event), height));
|
|
734
|
+
if (this.xAxis !== undefined && this.yAxis !== undefined) {
|
|
735
|
+
this.newColorContrast.emit({
|
|
736
|
+
xCoordinate: xAxis / width,
|
|
737
|
+
yCoordinate: 1 - yAxis / height,
|
|
738
|
+
xAxis: this.xAxis,
|
|
739
|
+
yAxis: this.yAxis,
|
|
740
|
+
});
|
|
741
|
+
}
|
|
742
|
+
else {
|
|
743
|
+
this.newColorContrast.emit({
|
|
744
|
+
xCoordinate: xAxis / width,
|
|
745
|
+
maxRange: this.xAxis,
|
|
746
|
+
});
|
|
747
|
+
}
|
|
748
|
+
/* // No vertical bars
|
|
749
|
+
if (this.xAxis === undefined && this.yAxis !== undefined) {
|
|
750
|
+
this.newColorContrast.emit({ yCoordinate: yAxis / height, maxRange: this.yAxis });
|
|
751
|
+
} */
|
|
752
|
+
};
|
|
753
|
+
SkyColorpickerSliderDirective.prototype.move = function (event) {
|
|
754
|
+
event.preventDefault();
|
|
755
|
+
this.setCursor(event);
|
|
756
|
+
};
|
|
757
|
+
SkyColorpickerSliderDirective.prototype.start = function (event) {
|
|
758
|
+
this.setCursor(event);
|
|
759
|
+
document.addEventListener('mousemove', this.listenerMove);
|
|
760
|
+
document.addEventListener('touchmove', this.listenerMove);
|
|
761
|
+
document.addEventListener('mouseup', this.listenerStop);
|
|
762
|
+
document.addEventListener('touchend', this.listenerStop);
|
|
763
|
+
};
|
|
764
|
+
SkyColorpickerSliderDirective.prototype.stop = function () {
|
|
765
|
+
document.removeEventListener('mousemove', this.listenerMove);
|
|
766
|
+
document.removeEventListener('touchmove', this.listenerMove);
|
|
767
|
+
document.removeEventListener('mouseup', this.listenerStop);
|
|
768
|
+
document.removeEventListener('touchend', this.listenerStop);
|
|
769
|
+
};
|
|
770
|
+
SkyColorpickerSliderDirective.prototype.getX = function (event) {
|
|
771
|
+
/* Ignoring event.touches as tests are not run on a touch device. */
|
|
772
|
+
/* istanbul ignore next */
|
|
773
|
+
return ((event.pageX !== undefined ? event.pageX : event.touches[0].pageX) -
|
|
774
|
+
this.el.nativeElement.getBoundingClientRect().left -
|
|
775
|
+
window.pageXOffset);
|
|
776
|
+
};
|
|
777
|
+
SkyColorpickerSliderDirective.prototype.getY = function (event) {
|
|
778
|
+
/* Ignoring event.touches as tests are not run on a touch device. */
|
|
779
|
+
/* istanbul ignore next */
|
|
780
|
+
return ((event.pageY !== undefined ? event.pageY : event.touches[0].pageY) -
|
|
781
|
+
this.el.nativeElement.getBoundingClientRect().top -
|
|
782
|
+
window.pageYOffset);
|
|
783
|
+
};
|
|
784
|
+
return SkyColorpickerSliderDirective;
|
|
785
|
+
}());
|
|
786
|
+
SkyColorpickerSliderDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyColorpickerSliderDirective, deps: [{ token: i0__namespace.ElementRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
|
787
|
+
SkyColorpickerSliderDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: SkyColorpickerSliderDirective, selector: "[skyColorpickerSlider]", inputs: { skyColorpickerSlider: "skyColorpickerSlider", color: "color", xAxis: "xAxis", yAxis: "yAxis" }, outputs: { newColorContrast: "newColorContrast" }, host: { listeners: { "touchstart": "start($event)", "mousedown": "start($event)" } }, ngImport: i0__namespace });
|
|
788
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyColorpickerSliderDirective, decorators: [{
|
|
789
|
+
type: i0.Directive,
|
|
790
|
+
args: [{
|
|
791
|
+
selector: '[skyColorpickerSlider]',
|
|
792
|
+
}]
|
|
793
|
+
}], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }]; }, propDecorators: { newColorContrast: [{
|
|
794
|
+
type: i0.Output
|
|
795
|
+
}], skyColorpickerSlider: [{
|
|
796
|
+
type: i0.Input
|
|
797
|
+
}], color: [{
|
|
798
|
+
type: i0.Input
|
|
586
799
|
}], xAxis: [{
|
|
587
800
|
type: i0.Input
|
|
588
801
|
}], yAxis: [{
|
|
@@ -645,6 +858,55 @@
|
|
|
645
858
|
args: ['input', ['$event']]
|
|
646
859
|
}] } });
|
|
647
860
|
|
|
861
|
+
// spell-checker:ignore colorpicker
|
|
862
|
+
/**
|
|
863
|
+
* @internal
|
|
864
|
+
*/
|
|
865
|
+
var SliderPosition = /** @class */ (function () {
|
|
866
|
+
function SliderPosition(hue, saturation, value, alpha) {
|
|
867
|
+
this.hue = hue;
|
|
868
|
+
this.saturation = saturation;
|
|
869
|
+
this.value = value;
|
|
870
|
+
this.alpha = alpha;
|
|
871
|
+
}
|
|
872
|
+
return SliderPosition;
|
|
873
|
+
}());
|
|
874
|
+
/**
|
|
875
|
+
* @internal
|
|
876
|
+
*/
|
|
877
|
+
var SliderDimension = /** @class */ (function () {
|
|
878
|
+
function SliderDimension(hue, saturation, value, alpha) {
|
|
879
|
+
this.hue = hue;
|
|
880
|
+
this.saturation = saturation;
|
|
881
|
+
this.value = value;
|
|
882
|
+
this.alpha = alpha;
|
|
883
|
+
}
|
|
884
|
+
return SliderDimension;
|
|
885
|
+
}());
|
|
886
|
+
|
|
887
|
+
/**
|
|
888
|
+
* Specifies the commands to provide the colorpicker.
|
|
889
|
+
*/
|
|
890
|
+
exports.SkyColorpickerMessageType = void 0;
|
|
891
|
+
(function (SkyColorpickerMessageType) {
|
|
892
|
+
/**
|
|
893
|
+
* Opens the colorpicker.
|
|
894
|
+
*/
|
|
895
|
+
SkyColorpickerMessageType[SkyColorpickerMessageType["Open"] = 0] = "Open";
|
|
896
|
+
/**
|
|
897
|
+
* Resets the selection in the colorpicker.
|
|
898
|
+
*/
|
|
899
|
+
SkyColorpickerMessageType[SkyColorpickerMessageType["Reset"] = 1] = "Reset";
|
|
900
|
+
/**
|
|
901
|
+
* Toggles whether to display a reset button beside the colorpicker.
|
|
902
|
+
*/
|
|
903
|
+
SkyColorpickerMessageType[SkyColorpickerMessageType["ToggleResetButton"] = 2] = "ToggleResetButton";
|
|
904
|
+
/**
|
|
905
|
+
* Closes the colorpicker.
|
|
906
|
+
*/
|
|
907
|
+
SkyColorpickerMessageType[SkyColorpickerMessageType["Close"] = 3] = "Close";
|
|
908
|
+
})(exports.SkyColorpickerMessageType || (exports.SkyColorpickerMessageType = {}));
|
|
909
|
+
|
|
648
910
|
var componentIdIndex = 0;
|
|
649
911
|
/**
|
|
650
912
|
* Provides a SKY UX-themed replacement for the HTML `input` element with `type="color"`.
|
|
@@ -1099,268 +1361,6 @@
|
|
|
1099
1361
|
}]
|
|
1100
1362
|
}] } });
|
|
1101
1363
|
|
|
1102
|
-
// tslint:disable:no-forward-ref no-use-before-declare
|
|
1103
|
-
var SKY_COLORPICKER_VALUE_ACCESSOR = {
|
|
1104
|
-
provide: forms.NG_VALUE_ACCESSOR,
|
|
1105
|
-
useExisting: i0.forwardRef(function () { return SkyColorpickerInputDirective; }),
|
|
1106
|
-
multi: true,
|
|
1107
|
-
};
|
|
1108
|
-
var SKY_COLORPICKER_VALIDATOR = {
|
|
1109
|
-
provide: forms.NG_VALIDATORS,
|
|
1110
|
-
useExisting: i0.forwardRef(function () { return SkyColorpickerInputDirective; }),
|
|
1111
|
-
multi: true,
|
|
1112
|
-
};
|
|
1113
|
-
// tslint:enable
|
|
1114
|
-
var SKY_COLORPICKER_DEFAULT_COLOR = '#FFFFFF';
|
|
1115
|
-
/**
|
|
1116
|
-
* Creates the colorpicker element and dropdown.
|
|
1117
|
-
*/
|
|
1118
|
-
var SkyColorpickerInputDirective = /** @class */ (function () {
|
|
1119
|
-
function SkyColorpickerInputDirective(elementRef, renderer, service, resourcesService, injector) {
|
|
1120
|
-
this.elementRef = elementRef;
|
|
1121
|
-
this.renderer = renderer;
|
|
1122
|
-
this.service = service;
|
|
1123
|
-
this.resourcesService = resourcesService;
|
|
1124
|
-
this.injector = injector;
|
|
1125
|
-
/**
|
|
1126
|
-
* This property is deprecated and does not affect the colorpicker.
|
|
1127
|
-
* We recommend against using it.
|
|
1128
|
-
* @deprecated
|
|
1129
|
-
* @default "rgba"
|
|
1130
|
-
*/
|
|
1131
|
-
this.returnFormat = 'rgba';
|
|
1132
|
-
/**
|
|
1133
|
-
* Specifies the format to use for the color when the colorpicker uses a native input
|
|
1134
|
-
* element such as a standard text input or a button. This property accepts `rgba`, `hex`,
|
|
1135
|
-
* or `hsla`, but we do not recommend using it because users never see or use its value.
|
|
1136
|
-
* Instead, if you need to access this format value, see the demo for an example.
|
|
1137
|
-
*@default "rgba"
|
|
1138
|
-
*/
|
|
1139
|
-
this.outputFormat = 'rgba';
|
|
1140
|
-
/**
|
|
1141
|
-
* Specifies an array of colors to load as preset choices. The colorpicker displays the
|
|
1142
|
-
* colors in a series of 12 boxes for users to select.
|
|
1143
|
-
*/
|
|
1144
|
-
this.presetColors = ['#333', '#888', '#EFEFEF', '#FFF'];
|
|
1145
|
-
/**
|
|
1146
|
-
* Specifies the type of transparency to use in the transparency slider.
|
|
1147
|
-
*@default "hex6"
|
|
1148
|
-
*/
|
|
1149
|
-
this.alphaChannel = 'hex6';
|
|
1150
|
-
/**
|
|
1151
|
-
* Indicates whether to display a transparency slider for users to select transparency
|
|
1152
|
-
* levels.
|
|
1153
|
-
*/
|
|
1154
|
-
this.allowTransparency = true;
|
|
1155
|
-
/*istanbul ignore next */
|
|
1156
|
-
this._onChange = function (_) { };
|
|
1157
|
-
/*istanbul ignore next */
|
|
1158
|
-
this._onTouched = function () { };
|
|
1159
|
-
this._validatorChange = function () { };
|
|
1160
|
-
}
|
|
1161
|
-
Object.defineProperty(SkyColorpickerInputDirective.prototype, "initialColor", {
|
|
1162
|
-
get: function () {
|
|
1163
|
-
return this._initialColor || SKY_COLORPICKER_DEFAULT_COLOR;
|
|
1164
|
-
},
|
|
1165
|
-
/**
|
|
1166
|
-
* Specifies an initial color to load in the colorpicker. Use a reactive or
|
|
1167
|
-
* template-driven form to set this value. This property is deprecated. As an alternative,
|
|
1168
|
-
* we recommend the `formControlName` property on reactive forms or `ngModel` on
|
|
1169
|
-
* template-driven forms. See the demo for examples.
|
|
1170
|
-
* @deprecated
|
|
1171
|
-
*/
|
|
1172
|
-
set: function (value) {
|
|
1173
|
-
/* istanbul ignore else */
|
|
1174
|
-
if (!this._initialColor && !this.modelValue) {
|
|
1175
|
-
this.writeValue(value);
|
|
1176
|
-
}
|
|
1177
|
-
this._initialColor = value;
|
|
1178
|
-
},
|
|
1179
|
-
enumerable: false,
|
|
1180
|
-
configurable: true
|
|
1181
|
-
});
|
|
1182
|
-
SkyColorpickerInputDirective.prototype.changeInput = function (event) {
|
|
1183
|
-
var value = event.target.value;
|
|
1184
|
-
this.skyColorpickerInput.updatePickerValues(value);
|
|
1185
|
-
this.skyColorpickerInput.backgroundColorForDisplay = value;
|
|
1186
|
-
};
|
|
1187
|
-
SkyColorpickerInputDirective.prototype.onChange = function (event) {
|
|
1188
|
-
var newValue = event.target.value;
|
|
1189
|
-
this.modelValue = this.formatter(newValue);
|
|
1190
|
-
this._validatorChange();
|
|
1191
|
-
this._onChange(this.modelValue);
|
|
1192
|
-
this.writeModelValue(this.modelValue);
|
|
1193
|
-
};
|
|
1194
|
-
/* istanbul ignore next */
|
|
1195
|
-
SkyColorpickerInputDirective.prototype.onBlur = function () {
|
|
1196
|
-
/*istanbul ignore next */
|
|
1197
|
-
this._onTouched();
|
|
1198
|
-
};
|
|
1199
|
-
SkyColorpickerInputDirective.prototype.ngOnInit = function () {
|
|
1200
|
-
var _this = this;
|
|
1201
|
-
var element = this.elementRef.nativeElement;
|
|
1202
|
-
this.renderer.addClass(element, 'sky-form-control');
|
|
1203
|
-
this.skyColorpickerInput.initialColor = this.initialColor;
|
|
1204
|
-
this.skyColorpickerInput.returnFormat = this.returnFormat;
|
|
1205
|
-
this.pickerChangedSubscription =
|
|
1206
|
-
this.skyColorpickerInput.selectedColorChanged.subscribe(function (newColor) {
|
|
1207
|
-
/* istanbul ignore else */
|
|
1208
|
-
if (newColor) {
|
|
1209
|
-
_this.modelValue = _this.formatter(newColor);
|
|
1210
|
-
_this.writeModelValue(_this.modelValue);
|
|
1211
|
-
}
|
|
1212
|
-
_this._onChange(newColor);
|
|
1213
|
-
});
|
|
1214
|
-
this.skyColorpickerInput.updatePickerValues(this.initialColor);
|
|
1215
|
-
/* Sanity check */
|
|
1216
|
-
/* istanbul ignore else */
|
|
1217
|
-
if (!this._disabled) {
|
|
1218
|
-
this.skyColorpickerInput.backgroundColorForDisplay = this.initialColor;
|
|
1219
|
-
}
|
|
1220
|
-
/// Set aria-label as default, if not set
|
|
1221
|
-
if (!element.getAttribute('aria-label')) {
|
|
1222
|
-
this.renderer.setAttribute(element, 'aria-label', this.getString('skyux_colorpicker_input_default_label'));
|
|
1223
|
-
}
|
|
1224
|
-
var typeAttr = element.getAttribute('type');
|
|
1225
|
-
if (typeAttr && typeAttr === 'hidden') {
|
|
1226
|
-
this.skyColorpickerInput.isVisible = false;
|
|
1227
|
-
}
|
|
1228
|
-
else {
|
|
1229
|
-
this.skyColorpickerInput.isVisible = true;
|
|
1230
|
-
}
|
|
1231
|
-
element.setAttribute('readonly', 'true');
|
|
1232
|
-
this.renderer.addClass(element, 'sky-colorpicker-input');
|
|
1233
|
-
};
|
|
1234
|
-
SkyColorpickerInputDirective.prototype.ngOnDestroy = function () {
|
|
1235
|
-
this.pickerChangedSubscription.unsubscribe();
|
|
1236
|
-
};
|
|
1237
|
-
SkyColorpickerInputDirective.prototype.setColorPickerDefaults = function () {
|
|
1238
|
-
this.skyColorpickerInput.setDialog(this, this.elementRef, this.initialColor, this.outputFormat, this.presetColors, this.alphaChannel, this.allowTransparency);
|
|
1239
|
-
};
|
|
1240
|
-
SkyColorpickerInputDirective.prototype.ngOnChanges = function () {
|
|
1241
|
-
this._validatorChange();
|
|
1242
|
-
this.skyColorpickerInput.returnFormat = this.returnFormat;
|
|
1243
|
-
this.setColorPickerDefaults();
|
|
1244
|
-
};
|
|
1245
|
-
SkyColorpickerInputDirective.prototype.registerOnChange = function (fn) {
|
|
1246
|
-
this._onChange = fn;
|
|
1247
|
-
};
|
|
1248
|
-
SkyColorpickerInputDirective.prototype.registerOnTouched = function (fn) {
|
|
1249
|
-
this._onTouched = fn;
|
|
1250
|
-
};
|
|
1251
|
-
SkyColorpickerInputDirective.prototype.registerOnValidatorChange = function (fn) {
|
|
1252
|
-
this._validatorChange = fn;
|
|
1253
|
-
};
|
|
1254
|
-
SkyColorpickerInputDirective.prototype.writeValue = function (value) {
|
|
1255
|
-
if (this.skyColorpickerInput &&
|
|
1256
|
-
value &&
|
|
1257
|
-
value !== this.skyColorpickerInput.lastAppliedColor) {
|
|
1258
|
-
this.modelValue = this.formatter(value);
|
|
1259
|
-
this.writeModelValue(this.modelValue);
|
|
1260
|
-
if (!this._initialColor) {
|
|
1261
|
-
this._initialColor = value;
|
|
1262
|
-
this.skyColorpickerInput.initialColor = value;
|
|
1263
|
-
}
|
|
1264
|
-
this.skyColorpickerInput.lastAppliedColor = value;
|
|
1265
|
-
var control = this.injector.get(forms.NgControl)
|
|
1266
|
-
.control;
|
|
1267
|
-
if (control) {
|
|
1268
|
-
control.setValue(this.modelValue, { emitEvent: false });
|
|
1269
|
-
}
|
|
1270
|
-
}
|
|
1271
|
-
};
|
|
1272
|
-
SkyColorpickerInputDirective.prototype.validate = function (control) {
|
|
1273
|
-
var value = control.value;
|
|
1274
|
-
if (!value) {
|
|
1275
|
-
return;
|
|
1276
|
-
}
|
|
1277
|
-
// Validation
|
|
1278
|
-
};
|
|
1279
|
-
/**
|
|
1280
|
-
* Implemented as part of ControlValueAccessor.
|
|
1281
|
-
*/
|
|
1282
|
-
SkyColorpickerInputDirective.prototype.setDisabledState = function (isDisabled) {
|
|
1283
|
-
this._disabled = isDisabled;
|
|
1284
|
-
this.skyColorpickerInput.disabled = isDisabled;
|
|
1285
|
-
if (this._disabled) {
|
|
1286
|
-
this.skyColorpickerInput.backgroundColorForDisplay = '#fff';
|
|
1287
|
-
}
|
|
1288
|
-
else {
|
|
1289
|
-
this.skyColorpickerInput.backgroundColorForDisplay = this.modelValue.hex;
|
|
1290
|
-
}
|
|
1291
|
-
};
|
|
1292
|
-
SkyColorpickerInputDirective.prototype.writeModelValue = function (model) {
|
|
1293
|
-
var setElementValue = model.rgbaText;
|
|
1294
|
-
var element = this.elementRef.nativeElement;
|
|
1295
|
-
var output;
|
|
1296
|
-
// tslint:disable-next-line:switch-default
|
|
1297
|
-
switch (this.outputFormat) {
|
|
1298
|
-
case 'rgba':
|
|
1299
|
-
output = model.rgbaText;
|
|
1300
|
-
break;
|
|
1301
|
-
case 'hsla':
|
|
1302
|
-
output = model.hslaText;
|
|
1303
|
-
break;
|
|
1304
|
-
case 'cmyk':
|
|
1305
|
-
output = model.cmykText;
|
|
1306
|
-
break;
|
|
1307
|
-
case 'hex':
|
|
1308
|
-
output = model.hex;
|
|
1309
|
-
break;
|
|
1310
|
-
}
|
|
1311
|
-
this.skyColorpickerInput.updatePickerValues(output);
|
|
1312
|
-
this.skyColorpickerInput.backgroundColorForDisplay = output;
|
|
1313
|
-
this.renderer.setStyle(element, 'background-color', setElementValue);
|
|
1314
|
-
this.renderer.setProperty(element, 'value', output);
|
|
1315
|
-
};
|
|
1316
|
-
SkyColorpickerInputDirective.prototype.formatter = function (color) {
|
|
1317
|
-
if (color && typeof color !== 'string') {
|
|
1318
|
-
return color;
|
|
1319
|
-
}
|
|
1320
|
-
var formatColor;
|
|
1321
|
-
var hsva = this.service.stringToHsva(color, this.alphaChannel === 'hex8');
|
|
1322
|
-
formatColor = this.service.skyColorpickerOut(hsva);
|
|
1323
|
-
return formatColor;
|
|
1324
|
-
};
|
|
1325
|
-
SkyColorpickerInputDirective.prototype.getString = function (key) {
|
|
1326
|
-
// TODO: Need to implement the async `getString` method in a breaking change.
|
|
1327
|
-
return this.resourcesService.getStringForLocale({ locale: 'en-US' }, key);
|
|
1328
|
-
};
|
|
1329
|
-
return SkyColorpickerInputDirective;
|
|
1330
|
-
}());
|
|
1331
|
-
SkyColorpickerInputDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyColorpickerInputDirective, deps: [{ token: i0__namespace.ElementRef }, { token: i0__namespace.Renderer2 }, { token: SkyColorpickerService }, { token: i2__namespace.SkyLibResourcesService }, { token: i0__namespace.Injector }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
|
1332
|
-
SkyColorpickerInputDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: SkyColorpickerInputDirective, selector: "[skyColorpickerInput]", inputs: { skyColorpickerInput: "skyColorpickerInput", initialColor: "initialColor", returnFormat: "returnFormat", outputFormat: "outputFormat", presetColors: "presetColors", alphaChannel: "alphaChannel", allowTransparency: "allowTransparency" }, host: { listeners: { "input": "changeInput($event)", "change": "onChange($event)", "blur": "onBlur()" } }, providers: [SKY_COLORPICKER_VALUE_ACCESSOR, SKY_COLORPICKER_VALIDATOR], usesOnChanges: true, ngImport: i0__namespace });
|
|
1333
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyColorpickerInputDirective, decorators: [{
|
|
1334
|
-
type: i0.Directive,
|
|
1335
|
-
args: [{
|
|
1336
|
-
selector: '[skyColorpickerInput]',
|
|
1337
|
-
providers: [SKY_COLORPICKER_VALUE_ACCESSOR, SKY_COLORPICKER_VALIDATOR],
|
|
1338
|
-
}]
|
|
1339
|
-
}], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.Renderer2 }, { type: SkyColorpickerService }, { type: i2__namespace.SkyLibResourcesService }, { type: i0__namespace.Injector }]; }, propDecorators: { skyColorpickerInput: [{
|
|
1340
|
-
type: i0.Input
|
|
1341
|
-
}], initialColor: [{
|
|
1342
|
-
type: i0.Input
|
|
1343
|
-
}], returnFormat: [{
|
|
1344
|
-
type: i0.Input
|
|
1345
|
-
}], outputFormat: [{
|
|
1346
|
-
type: i0.Input
|
|
1347
|
-
}], presetColors: [{
|
|
1348
|
-
type: i0.Input
|
|
1349
|
-
}], alphaChannel: [{
|
|
1350
|
-
type: i0.Input
|
|
1351
|
-
}], allowTransparency: [{
|
|
1352
|
-
type: i0.Input
|
|
1353
|
-
}], changeInput: [{
|
|
1354
|
-
type: i0.HostListener,
|
|
1355
|
-
args: ['input', ['$event']]
|
|
1356
|
-
}], onChange: [{
|
|
1357
|
-
type: i0.HostListener,
|
|
1358
|
-
args: ['change', ['$event']]
|
|
1359
|
-
}], onBlur: [{
|
|
1360
|
-
type: i0.HostListener,
|
|
1361
|
-
args: ['blur']
|
|
1362
|
-
}] } });
|
|
1363
|
-
|
|
1364
1364
|
var SkyColorpickerModule = /** @class */ (function () {
|
|
1365
1365
|
function SkyColorpickerModule() {
|
|
1366
1366
|
}
|