@skyux/colorpicker 7.1.0 → 7.1.2
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/esm2020/lib/modules/colorpicker/colorpicker-slider.directive.mjs +9 -8
- package/esm2020/lib/modules/colorpicker/colorpicker.component.mjs +22 -24
- package/esm2020/testing/colorpicker-fixture.mjs +32 -30
- package/fesm2015/skyux-colorpicker-testing.mjs +35 -34
- package/fesm2015/skyux-colorpicker-testing.mjs.map +1 -1
- package/fesm2015/skyux-colorpicker.mjs +29 -30
- package/fesm2015/skyux-colorpicker.mjs.map +1 -1
- package/fesm2020/skyux-colorpicker-testing.mjs +31 -29
- package/fesm2020/skyux-colorpicker-testing.mjs.map +1 -1
- package/fesm2020/skyux-colorpicker.mjs +29 -30
- package/fesm2020/skyux-colorpicker.mjs.map +1 -1
- package/lib/modules/colorpicker/colorpicker-slider.directive.d.ts +0 -1
- package/lib/modules/colorpicker/colorpicker.component.d.ts +0 -2
- package/package.json +7 -7
- package/testing/colorpicker-fixture.d.ts +1 -6
|
@@ -1,33 +1,37 @@
|
|
|
1
|
+
import { __classPrivateFieldSet, __classPrivateFieldGet } from 'tslib';
|
|
1
2
|
import { By } from '@angular/platform-browser';
|
|
2
3
|
import { SkyAppTestUtility } from '@skyux-sdk/testing';
|
|
3
4
|
|
|
5
|
+
var _SkyColorpickerFixture_instances, _SkyColorpickerFixture_debugEl, _SkyColorpickerFixture_fixture, _SkyColorpickerFixture_clickColorpickerButtonEl, _SkyColorpickerFixture_clickColorpickerApplyButtonEl, _SkyColorpickerFixture_getColorpickerInputEl;
|
|
4
6
|
/**
|
|
5
7
|
* Allows interaction with a SKY UX colorpicker component.
|
|
6
8
|
* @internal
|
|
7
9
|
*/
|
|
8
10
|
class SkyColorpickerFixture {
|
|
9
11
|
constructor(fixture, skyTestId) {
|
|
10
|
-
this
|
|
11
|
-
this
|
|
12
|
-
|
|
12
|
+
_SkyColorpickerFixture_instances.add(this);
|
|
13
|
+
_SkyColorpickerFixture_debugEl.set(this, void 0);
|
|
14
|
+
_SkyColorpickerFixture_fixture.set(this, void 0);
|
|
15
|
+
__classPrivateFieldSet(this, _SkyColorpickerFixture_fixture, fixture, "f");
|
|
16
|
+
__classPrivateFieldSet(this, _SkyColorpickerFixture_debugEl, SkyAppTestUtility.getDebugElementByTestId(fixture, skyTestId, 'sky-colorpicker'), "f");
|
|
13
17
|
}
|
|
14
18
|
/**
|
|
15
19
|
* The colorpicker's currently selected color formatted to the `outputFormat`.
|
|
16
20
|
*/
|
|
17
21
|
get value() {
|
|
18
|
-
return this.
|
|
22
|
+
return __classPrivateFieldGet(this, _SkyColorpickerFixture_instances, "m", _SkyColorpickerFixture_getColorpickerInputEl).call(this).nativeElement.value;
|
|
19
23
|
}
|
|
20
24
|
/**
|
|
21
25
|
* Set the colorpicker's color hex code.
|
|
22
26
|
* @param hexValue The new color hex code. Must inculde '#'.
|
|
23
27
|
*/
|
|
24
28
|
async setValueFromHex(hexValue) {
|
|
25
|
-
await this.
|
|
29
|
+
await __classPrivateFieldGet(this, _SkyColorpickerFixture_instances, "m", _SkyColorpickerFixture_clickColorpickerButtonEl).call(this);
|
|
26
30
|
const hexInput = document.querySelector('input[id^=sky-colorpicker-hex-]');
|
|
27
31
|
hexInput.value = hexValue;
|
|
28
32
|
SkyAppTestUtility.fireDomEvent(hexInput, 'input');
|
|
29
|
-
await this.
|
|
30
|
-
return this.
|
|
33
|
+
await __classPrivateFieldGet(this, _SkyColorpickerFixture_instances, "m", _SkyColorpickerFixture_clickColorpickerApplyButtonEl).call(this);
|
|
34
|
+
return __classPrivateFieldGet(this, _SkyColorpickerFixture_fixture, "f").whenStable();
|
|
31
35
|
}
|
|
32
36
|
/**
|
|
33
37
|
* Set the colorpicker's color RGB values.
|
|
@@ -37,7 +41,7 @@ class SkyColorpickerFixture {
|
|
|
37
41
|
* @param alpha The alpha channel value.
|
|
38
42
|
*/
|
|
39
43
|
async setValueFromRGBA(red, green, blue, alpha) {
|
|
40
|
-
await this.
|
|
44
|
+
await __classPrivateFieldGet(this, _SkyColorpickerFixture_instances, "m", _SkyColorpickerFixture_clickColorpickerButtonEl).call(this);
|
|
41
45
|
const rInput = document.querySelector('input[id^=sky-colorpicker-red-]');
|
|
42
46
|
const gInput = document.querySelector('input[id^=sky-colorpicker-green-]');
|
|
43
47
|
const bInput = document.querySelector('input[id^=sky-colorpicker-blue-]');
|
|
@@ -50,40 +54,38 @@ class SkyColorpickerFixture {
|
|
|
50
54
|
SkyAppTestUtility.fireDomEvent(gInput, 'input');
|
|
51
55
|
SkyAppTestUtility.fireDomEvent(bInput, 'input');
|
|
52
56
|
SkyAppTestUtility.fireDomEvent(aInput, 'input');
|
|
53
|
-
await this.
|
|
54
|
-
return this.
|
|
57
|
+
await __classPrivateFieldGet(this, _SkyColorpickerFixture_instances, "m", _SkyColorpickerFixture_clickColorpickerApplyButtonEl).call(this);
|
|
58
|
+
return __classPrivateFieldGet(this, _SkyColorpickerFixture_fixture, "f").whenStable();
|
|
55
59
|
}
|
|
56
60
|
/**
|
|
57
61
|
* Set the colorpicker's color to the provided preset color at the given index.
|
|
58
62
|
* @param presetIndex The index of the color in the `presetColors` list to select.
|
|
59
63
|
*/
|
|
60
64
|
async setValueFromPresets(presetIndex) {
|
|
61
|
-
await this.
|
|
65
|
+
await __classPrivateFieldGet(this, _SkyColorpickerFixture_instances, "m", _SkyColorpickerFixture_clickColorpickerButtonEl).call(this);
|
|
62
66
|
const presetColors = document.querySelectorAll('.sky-colorpicker-preset-color-area button');
|
|
63
67
|
const presetColor = presetColors && presetColors[presetIndex];
|
|
64
68
|
if (presetColor) {
|
|
65
69
|
presetColor.click();
|
|
66
|
-
this.
|
|
70
|
+
__classPrivateFieldGet(this, _SkyColorpickerFixture_fixture, "f").detectChanges();
|
|
67
71
|
}
|
|
68
|
-
await this.
|
|
69
|
-
return this.
|
|
70
|
-
}
|
|
71
|
-
async clickColorpickerButtonEl() {
|
|
72
|
-
const colorpickerButton = this.debugEl.query(By.css('sky-colorpicker button')).nativeElement;
|
|
73
|
-
colorpickerButton.click();
|
|
74
|
-
this.fixture.detectChanges();
|
|
75
|
-
return this.fixture.whenStable();
|
|
76
|
-
}
|
|
77
|
-
async clickColorpickerApplyButtonEl() {
|
|
78
|
-
const applyButton = document.querySelector('.sky-btn-colorpicker-apply');
|
|
79
|
-
applyButton.click();
|
|
80
|
-
this.fixture.detectChanges();
|
|
81
|
-
return this.fixture.whenStable();
|
|
82
|
-
}
|
|
83
|
-
getColorpickerInputEl() {
|
|
84
|
-
return this.debugEl.query(By.css('sky-colorpicker input'));
|
|
72
|
+
await __classPrivateFieldGet(this, _SkyColorpickerFixture_instances, "m", _SkyColorpickerFixture_clickColorpickerApplyButtonEl).call(this);
|
|
73
|
+
return __classPrivateFieldGet(this, _SkyColorpickerFixture_fixture, "f").whenStable();
|
|
85
74
|
}
|
|
86
75
|
}
|
|
76
|
+
_SkyColorpickerFixture_debugEl = new WeakMap(), _SkyColorpickerFixture_fixture = new WeakMap(), _SkyColorpickerFixture_instances = new WeakSet(), _SkyColorpickerFixture_clickColorpickerButtonEl = async function _SkyColorpickerFixture_clickColorpickerButtonEl() {
|
|
77
|
+
const colorpickerButton = __classPrivateFieldGet(this, _SkyColorpickerFixture_debugEl, "f").query(By.css('sky-colorpicker button')).nativeElement;
|
|
78
|
+
colorpickerButton.click();
|
|
79
|
+
__classPrivateFieldGet(this, _SkyColorpickerFixture_fixture, "f").detectChanges();
|
|
80
|
+
return __classPrivateFieldGet(this, _SkyColorpickerFixture_fixture, "f").whenStable();
|
|
81
|
+
}, _SkyColorpickerFixture_clickColorpickerApplyButtonEl = async function _SkyColorpickerFixture_clickColorpickerApplyButtonEl() {
|
|
82
|
+
const applyButton = document.querySelector('.sky-btn-colorpicker-apply');
|
|
83
|
+
applyButton.click();
|
|
84
|
+
__classPrivateFieldGet(this, _SkyColorpickerFixture_fixture, "f").detectChanges();
|
|
85
|
+
return __classPrivateFieldGet(this, _SkyColorpickerFixture_fixture, "f").whenStable();
|
|
86
|
+
}, _SkyColorpickerFixture_getColorpickerInputEl = function _SkyColorpickerFixture_getColorpickerInputEl() {
|
|
87
|
+
return __classPrivateFieldGet(this, _SkyColorpickerFixture_debugEl, "f").query(By.css('sky-colorpicker input'));
|
|
88
|
+
};
|
|
87
89
|
|
|
88
90
|
/**
|
|
89
91
|
* Generated bundle index. Do not edit.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skyux-colorpicker-testing.mjs","sources":["../../../../../libs/components/colorpicker/testing/src/colorpicker-fixture.ts","../../../../../libs/components/colorpicker/testing/src/skyux-colorpicker-testing.ts"],"sourcesContent":["import { DebugElement } from '@angular/core';\nimport { ComponentFixture } from '@angular/core/testing';\nimport { By } from '@angular/platform-browser';\nimport { SkyAppTestUtility } from '@skyux-sdk/testing';\n\n/**\n * Allows interaction with a SKY UX colorpicker component.\n * @internal\n */\nexport class SkyColorpickerFixture {\n
|
|
1
|
+
{"version":3,"file":"skyux-colorpicker-testing.mjs","sources":["../../../../../libs/components/colorpicker/testing/src/colorpicker-fixture.ts","../../../../../libs/components/colorpicker/testing/src/skyux-colorpicker-testing.ts"],"sourcesContent":["import { DebugElement } from '@angular/core';\nimport { ComponentFixture } from '@angular/core/testing';\nimport { By } from '@angular/platform-browser';\nimport { SkyAppTestUtility } from '@skyux-sdk/testing';\n\n/**\n * Allows interaction with a SKY UX colorpicker component.\n * @internal\n */\nexport class SkyColorpickerFixture {\n #debugEl: DebugElement;\n #fixture: ComponentFixture<unknown>;\n\n constructor(fixture: ComponentFixture<unknown>, skyTestId: string) {\n this.#fixture = fixture;\n this.#debugEl = SkyAppTestUtility.getDebugElementByTestId(\n fixture,\n skyTestId,\n 'sky-colorpicker'\n );\n }\n\n /**\n * The colorpicker's currently selected color formatted to the `outputFormat`.\n */\n public get value(): string {\n return this.#getColorpickerInputEl().nativeElement.value;\n }\n\n /**\n * Set the colorpicker's color hex code.\n * @param hexValue The new color hex code. Must inculde '#'.\n */\n public async setValueFromHex(hexValue: string): Promise<void> {\n await this.#clickColorpickerButtonEl();\n\n const hexInput = document.querySelector(\n 'input[id^=sky-colorpicker-hex-]'\n ) as HTMLInputElement;\n\n hexInput.value = hexValue;\n SkyAppTestUtility.fireDomEvent(hexInput, 'input');\n\n await this.#clickColorpickerApplyButtonEl();\n\n return this.#fixture.whenStable();\n }\n\n /**\n * Set the colorpicker's color RGB values.\n * @param red The red color value.\n * @param green The green color value.\n * @param blue The blue color value.\n * @param alpha The alpha channel value.\n */\n public async setValueFromRGBA(\n red: number,\n green: number,\n blue: number,\n alpha: number\n ): Promise<void> {\n await this.#clickColorpickerButtonEl();\n\n const rInput = document.querySelector(\n 'input[id^=sky-colorpicker-red-]'\n ) as HTMLInputElement;\n const gInput = document.querySelector(\n 'input[id^=sky-colorpicker-green-]'\n ) as HTMLInputElement;\n const bInput = document.querySelector(\n 'input[id^=sky-colorpicker-blue-]'\n ) as HTMLInputElement;\n const aInput = document.querySelector(\n 'input[id^=sky-colorpicker-alpha-]'\n ) as HTMLInputElement;\n\n rInput.value = red.toString();\n gInput.value = green.toString();\n bInput.value = blue.toString();\n aInput.value = alpha.toString();\n\n SkyAppTestUtility.fireDomEvent(rInput, 'input');\n SkyAppTestUtility.fireDomEvent(gInput, 'input');\n SkyAppTestUtility.fireDomEvent(bInput, 'input');\n SkyAppTestUtility.fireDomEvent(aInput, 'input');\n\n await this.#clickColorpickerApplyButtonEl();\n\n return this.#fixture.whenStable();\n }\n\n /**\n * Set the colorpicker's color to the provided preset color at the given index.\n * @param presetIndex The index of the color in the `presetColors` list to select.\n */\n public async setValueFromPresets(presetIndex: number): Promise<void> {\n await this.#clickColorpickerButtonEl();\n\n const presetColors = document.querySelectorAll(\n '.sky-colorpicker-preset-color-area button'\n );\n const presetColor =\n presetColors && (presetColors[presetIndex] as HTMLButtonElement);\n\n if (presetColor) {\n presetColor.click();\n this.#fixture.detectChanges();\n }\n\n await this.#clickColorpickerApplyButtonEl();\n\n return this.#fixture.whenStable();\n }\n\n async #clickColorpickerButtonEl(): Promise<void> {\n const colorpickerButton = this.#debugEl.query(\n By.css('sky-colorpicker button')\n ).nativeElement;\n\n colorpickerButton.click();\n\n this.#fixture.detectChanges();\n\n return this.#fixture.whenStable();\n }\n\n async #clickColorpickerApplyButtonEl(): Promise<void> {\n const applyButton = document.querySelector(\n '.sky-btn-colorpicker-apply'\n ) as HTMLButtonElement;\n\n applyButton.click();\n\n this.#fixture.detectChanges();\n\n return this.#fixture.whenStable();\n }\n\n #getColorpickerInputEl(): DebugElement {\n return this.#debugEl.query(By.css('sky-colorpicker input'));\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;AAKA;;;AAGG;MACU,qBAAqB,CAAA;IAIhC,WAAY,CAAA,OAAkC,EAAE,SAAiB,EAAA;;QAHjE,8BAAuB,CAAA,GAAA,CAAA,IAAA,EAAA,KAAA,CAAA,CAAA,CAAA;QACvB,8BAAoC,CAAA,GAAA,CAAA,IAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAGlC,QAAA,sBAAA,CAAA,IAAI,EAAA,8BAAA,EAAY,OAAO,EAAA,GAAA,CAAA,CAAC;AACxB,QAAA,sBAAA,CAAA,IAAI,EAAA,8BAAA,EAAY,iBAAiB,CAAC,uBAAuB,CACvD,OAAO,EACP,SAAS,EACT,iBAAiB,CAClB,MAAA,CAAC;KACH;AAED;;AAEG;AACH,IAAA,IAAW,KAAK,GAAA;QACd,OAAO,sBAAA,CAAA,IAAI,EAAA,gCAAA,EAAA,GAAA,EAAA,4CAAA,CAAuB,CAA3B,IAAA,CAAA,IAAI,CAAyB,CAAC,aAAa,CAAC,KAAK,CAAC;KAC1D;AAED;;;AAGG;IACI,MAAM,eAAe,CAAC,QAAgB,EAAA;AAC3C,QAAA,MAAM,uBAAA,IAAI,EAAA,gCAAA,EAAA,GAAA,EAAA,+CAAA,CAA0B,CAA9B,IAAA,CAAA,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AAS,CAAC,KAAK,CAC3C,EAAE,CAAC,GAAG,CAAC,wBAAwB,CAAC,CACjC,CAAC,aAAa,CAAC;IAEhB,iBAAiB,CAAC,KAAK,EAAE,CAAC;AAE1B,IAAA,sBAAA,CAAA,IAAI,EAAA,8BAAA,EAAA,GAAA,CAAS,CAAC,aAAa,EAAE,CAAC;AAE9B,IAAA,OAAO,uBAAA,IAAI,EAAA,8BAAA,EAAA,GAAA,CAAS,CAAC,UAAU,EAAE,CAAC;AACpC,CAAC,yDAED,eAAK,oDAAA,GAAA;IACH,MAAM,WAAW,GAAG,QAAQ,CAAC,aAAa,CACxC,4BAA4B,CACR,CAAC;IAEvB,WAAW,CAAC,KAAK,EAAE,CAAC;AAEpB,IAAA,sBAAA,CAAA,IAAI,EAAA,8BAAA,EAAA,GAAA,CAAS,CAAC,aAAa,EAAE,CAAC;AAE9B,IAAA,OAAO,uBAAA,IAAI,EAAA,8BAAA,EAAA,GAAA,CAAS,CAAC,UAAU,EAAE,CAAC;AACpC,CAAC,EAAA,4CAAA,GAAA,SAAA,4CAAA,GAAA;AAGC,IAAA,OAAO,sBAAA,CAAA,IAAI,EAAS,8BAAA,EAAA,GAAA,CAAA,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC,CAAC;AAC9D,CAAC;;AC5IH;;AAEG;;;;"}
|
|
@@ -667,17 +667,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.11", ngImpo
|
|
|
667
667
|
args: ['change']
|
|
668
668
|
}] } });
|
|
669
669
|
|
|
670
|
-
var _SkyColorpickerSliderDirective_instances, _SkyColorpickerSliderDirective_listenerMove, _SkyColorpickerSliderDirective_listenerStop, _SkyColorpickerSliderDirective_setCursor;
|
|
670
|
+
var _SkyColorpickerSliderDirective_instances, _SkyColorpickerSliderDirective_listenerMove, _SkyColorpickerSliderDirective_listenerStop, _SkyColorpickerSliderDirective_el, _SkyColorpickerSliderDirective_setCursor;
|
|
671
671
|
/**
|
|
672
672
|
* @internal
|
|
673
673
|
*/
|
|
674
674
|
class SkyColorpickerSliderDirective {
|
|
675
675
|
constructor(el) {
|
|
676
|
-
this.el = el;
|
|
677
676
|
_SkyColorpickerSliderDirective_instances.add(this);
|
|
678
677
|
this.newColorContrast = new EventEmitter();
|
|
679
678
|
_SkyColorpickerSliderDirective_listenerMove.set(this, void 0);
|
|
680
679
|
_SkyColorpickerSliderDirective_listenerStop.set(this, void 0);
|
|
680
|
+
_SkyColorpickerSliderDirective_el.set(this, void 0);
|
|
681
|
+
__classPrivateFieldSet(this, _SkyColorpickerSliderDirective_el, el, "f");
|
|
681
682
|
__classPrivateFieldSet(this, _SkyColorpickerSliderDirective_listenerMove, (event) => {
|
|
682
683
|
this.move(event);
|
|
683
684
|
}, "f");
|
|
@@ -706,20 +707,20 @@ class SkyColorpickerSliderDirective {
|
|
|
706
707
|
/* Ignoring event.touches as tests are not run on a touch device. */
|
|
707
708
|
/* istanbul ignore next */
|
|
708
709
|
return (('pageX' in event ? event.pageX : event.touches[0].pageX) -
|
|
709
|
-
this.
|
|
710
|
+
__classPrivateFieldGet(this, _SkyColorpickerSliderDirective_el, "f").nativeElement.getBoundingClientRect().left -
|
|
710
711
|
window.pageXOffset);
|
|
711
712
|
}
|
|
712
713
|
getY(event) {
|
|
713
714
|
/* Ignoring event.touches as tests are not run on a touch device. */
|
|
714
715
|
/* istanbul ignore next */
|
|
715
716
|
return (('pageY' in event ? event.pageY : event.touches[0].pageY) -
|
|
716
|
-
this.
|
|
717
|
+
__classPrivateFieldGet(this, _SkyColorpickerSliderDirective_el, "f").nativeElement.getBoundingClientRect().top -
|
|
717
718
|
window.pageYOffset);
|
|
718
719
|
}
|
|
719
720
|
}
|
|
720
|
-
_SkyColorpickerSliderDirective_listenerMove = new WeakMap(), _SkyColorpickerSliderDirective_listenerStop = new WeakMap(), _SkyColorpickerSliderDirective_instances = new WeakSet(), _SkyColorpickerSliderDirective_setCursor = function _SkyColorpickerSliderDirective_setCursor(event) {
|
|
721
|
-
const height = this.
|
|
722
|
-
const width = this.
|
|
721
|
+
_SkyColorpickerSliderDirective_listenerMove = new WeakMap(), _SkyColorpickerSliderDirective_listenerStop = new WeakMap(), _SkyColorpickerSliderDirective_el = new WeakMap(), _SkyColorpickerSliderDirective_instances = new WeakSet(), _SkyColorpickerSliderDirective_setCursor = function _SkyColorpickerSliderDirective_setCursor(event) {
|
|
722
|
+
const height = __classPrivateFieldGet(this, _SkyColorpickerSliderDirective_el, "f").nativeElement.offsetHeight;
|
|
723
|
+
const width = __classPrivateFieldGet(this, _SkyColorpickerSliderDirective_el, "f").nativeElement.offsetWidth;
|
|
723
724
|
const xAxis = Math.max(0, Math.min(this.getX(event), width));
|
|
724
725
|
const yAxis = Math.max(0, Math.min(this.getY(event), height));
|
|
725
726
|
if (this.xAxis !== undefined && this.yAxis !== undefined) {
|
|
@@ -865,7 +866,7 @@ var SkyColorpickerMessageType;
|
|
|
865
866
|
SkyColorpickerMessageType[SkyColorpickerMessageType["Close"] = 3] = "Close";
|
|
866
867
|
})(SkyColorpickerMessageType || (SkyColorpickerMessageType = {}));
|
|
867
868
|
|
|
868
|
-
var _SkyColorpickerComponent_instances, _SkyColorpickerComponent_idIndex, _SkyColorpickerComponent_alphaChannel, _SkyColorpickerComponent_format, _SkyColorpickerComponent_outputFormat, _SkyColorpickerComponent_hsva, _SkyColorpickerComponent_sliderDimMax, _SkyColorpickerComponent_ngUnsubscribe, _SkyColorpickerComponent_affixer, _SkyColorpickerComponent_overlay, _SkyColorpickerComponent_pickerUnsubscribe, _SkyColorpickerComponent_affixSvc, _SkyColorpickerComponent_changeDetector, _SkyColorpickerComponent_coreAdapter, _SkyColorpickerComponent_overlaySvc, _SkyColorpickerComponent_svc, _SkyColorpickerComponent_themeSvc, _SkyColorpickerComponent__backgroundColorForDisplay, _SkyColorpickerComponent__colorpickerRef, _SkyColorpickerComponent__disabled, _SkyColorpickerComponent_update, _SkyColorpickerComponent_updateSlider, _SkyColorpickerComponent_openPicker, _SkyColorpickerComponent_sendMessage, _SkyColorpickerComponent_handleIncomingMessages, _SkyColorpickerComponent_createAffixer, _SkyColorpickerComponent_destroyAffixer, _SkyColorpickerComponent_addTriggerButtonEventListeners, _SkyColorpickerComponent_removePickerEventListeners, _SkyColorpickerComponent_getHsvaValue, _SkyColorpickerComponent_getAccessibleIconColor;
|
|
869
|
+
var _SkyColorpickerComponent_instances, _SkyColorpickerComponent_idIndex, _SkyColorpickerComponent_alphaChannel, _SkyColorpickerComponent_format, _SkyColorpickerComponent_outputFormat, _SkyColorpickerComponent_hsva, _SkyColorpickerComponent_sliderDimMax, _SkyColorpickerComponent_ngUnsubscribe, _SkyColorpickerComponent_affixer, _SkyColorpickerComponent_overlay, _SkyColorpickerComponent_pickerUnsubscribe, _SkyColorpickerComponent_affixSvc, _SkyColorpickerComponent_changeDetector, _SkyColorpickerComponent_coreAdapter, _SkyColorpickerComponent_overlaySvc, _SkyColorpickerComponent_svc, _SkyColorpickerComponent_themeSvc, _SkyColorpickerComponent__backgroundColorForDisplay, _SkyColorpickerComponent__colorpickerRef, _SkyColorpickerComponent__disabled, _SkyColorpickerComponent_update, _SkyColorpickerComponent_updateSlider, _SkyColorpickerComponent_openPicker, _SkyColorpickerComponent_sendMessage, _SkyColorpickerComponent_handleIncomingMessages, _SkyColorpickerComponent_createAffixer, _SkyColorpickerComponent_destroyAffixer, _SkyColorpickerComponent_createOverlay, _SkyColorpickerComponent_destroyOverlay, _SkyColorpickerComponent_addTriggerButtonEventListeners, _SkyColorpickerComponent_removePickerEventListeners, _SkyColorpickerComponent_getHsvaValue, _SkyColorpickerComponent_getAccessibleIconColor;
|
|
869
870
|
let componentIdIndex = 0;
|
|
870
871
|
/**
|
|
871
872
|
* Provides a SKY UX-themed replacement for the HTML `input` element with `type="color"`.
|
|
@@ -1088,14 +1089,14 @@ class SkyColorpickerComponent {
|
|
|
1088
1089
|
__classPrivateFieldGet(this, _SkyColorpickerComponent_ngUnsubscribe, "f").complete();
|
|
1089
1090
|
__classPrivateFieldGet(this, _SkyColorpickerComponent_instances, "m", _SkyColorpickerComponent_removePickerEventListeners).call(this);
|
|
1090
1091
|
__classPrivateFieldGet(this, _SkyColorpickerComponent_instances, "m", _SkyColorpickerComponent_destroyAffixer).call(this);
|
|
1091
|
-
this.
|
|
1092
|
+
__classPrivateFieldGet(this, _SkyColorpickerComponent_instances, "m", _SkyColorpickerComponent_destroyOverlay).call(this);
|
|
1092
1093
|
}
|
|
1093
1094
|
onTriggerButtonClick() {
|
|
1094
1095
|
__classPrivateFieldGet(this, _SkyColorpickerComponent_instances, "m", _SkyColorpickerComponent_sendMessage).call(this, SkyColorpickerMessageType.Open);
|
|
1095
1096
|
}
|
|
1096
1097
|
closePicker() {
|
|
1097
1098
|
__classPrivateFieldGet(this, _SkyColorpickerComponent_instances, "m", _SkyColorpickerComponent_destroyAffixer).call(this);
|
|
1098
|
-
this.
|
|
1099
|
+
__classPrivateFieldGet(this, _SkyColorpickerComponent_instances, "m", _SkyColorpickerComponent_destroyOverlay).call(this);
|
|
1099
1100
|
__classPrivateFieldGet(this, _SkyColorpickerComponent_instances, "m", _SkyColorpickerComponent_removePickerEventListeners).call(this);
|
|
1100
1101
|
this.triggerButtonRef?.nativeElement.focus();
|
|
1101
1102
|
this.isOpen = false;
|
|
@@ -1128,24 +1129,6 @@ class SkyColorpickerComponent {
|
|
|
1128
1129
|
__classPrivateFieldGet(this, _SkyColorpickerComponent_instances, "m", _SkyColorpickerComponent_update).call(this);
|
|
1129
1130
|
}
|
|
1130
1131
|
}
|
|
1131
|
-
createOverlay() {
|
|
1132
|
-
if (this.colorpickerTemplateRef) {
|
|
1133
|
-
const overlay = __classPrivateFieldGet(this, _SkyColorpickerComponent_overlaySvc, "f").create({
|
|
1134
|
-
enableClose: false,
|
|
1135
|
-
enablePointerEvents: false,
|
|
1136
|
-
enableScroll: true,
|
|
1137
|
-
});
|
|
1138
|
-
overlay.attachTemplate(this.colorpickerTemplateRef);
|
|
1139
|
-
__classPrivateFieldSet(this, _SkyColorpickerComponent_overlay, overlay, "f");
|
|
1140
|
-
}
|
|
1141
|
-
}
|
|
1142
|
-
destroyOverlay() {
|
|
1143
|
-
/*istanbul ignore else*/
|
|
1144
|
-
if (__classPrivateFieldGet(this, _SkyColorpickerComponent_overlay, "f")) {
|
|
1145
|
-
__classPrivateFieldGet(this, _SkyColorpickerComponent_overlaySvc, "f").close(__classPrivateFieldGet(this, _SkyColorpickerComponent_overlay, "f"));
|
|
1146
|
-
__classPrivateFieldSet(this, _SkyColorpickerComponent_overlay, undefined, "f");
|
|
1147
|
-
}
|
|
1148
|
-
}
|
|
1149
1132
|
}
|
|
1150
1133
|
_SkyColorpickerComponent_idIndex = new WeakMap(), _SkyColorpickerComponent_alphaChannel = new WeakMap(), _SkyColorpickerComponent_format = new WeakMap(), _SkyColorpickerComponent_outputFormat = new WeakMap(), _SkyColorpickerComponent_hsva = new WeakMap(), _SkyColorpickerComponent_sliderDimMax = new WeakMap(), _SkyColorpickerComponent_ngUnsubscribe = new WeakMap(), _SkyColorpickerComponent_affixer = new WeakMap(), _SkyColorpickerComponent_overlay = new WeakMap(), _SkyColorpickerComponent_pickerUnsubscribe = new WeakMap(), _SkyColorpickerComponent_affixSvc = new WeakMap(), _SkyColorpickerComponent_changeDetector = new WeakMap(), _SkyColorpickerComponent_coreAdapter = new WeakMap(), _SkyColorpickerComponent_overlaySvc = new WeakMap(), _SkyColorpickerComponent_svc = new WeakMap(), _SkyColorpickerComponent_themeSvc = new WeakMap(), _SkyColorpickerComponent__backgroundColorForDisplay = new WeakMap(), _SkyColorpickerComponent__colorpickerRef = new WeakMap(), _SkyColorpickerComponent__disabled = new WeakMap(), _SkyColorpickerComponent_instances = new WeakSet(), _SkyColorpickerComponent_update = function _SkyColorpickerComponent_update() {
|
|
1151
1134
|
var _a;
|
|
@@ -1178,8 +1161,8 @@ _SkyColorpickerComponent_idIndex = new WeakMap(), _SkyColorpickerComponent_alpha
|
|
|
1178
1161
|
}, _SkyColorpickerComponent_openPicker = function _SkyColorpickerComponent_openPicker() {
|
|
1179
1162
|
this.isPickerVisible = false;
|
|
1180
1163
|
__classPrivateFieldGet(this, _SkyColorpickerComponent_instances, "m", _SkyColorpickerComponent_removePickerEventListeners).call(this);
|
|
1181
|
-
this.
|
|
1182
|
-
this.
|
|
1164
|
+
__classPrivateFieldGet(this, _SkyColorpickerComponent_instances, "m", _SkyColorpickerComponent_destroyOverlay).call(this);
|
|
1165
|
+
__classPrivateFieldGet(this, _SkyColorpickerComponent_instances, "m", _SkyColorpickerComponent_createOverlay).call(this);
|
|
1183
1166
|
this.isOpen = true;
|
|
1184
1167
|
}, _SkyColorpickerComponent_sendMessage = function _SkyColorpickerComponent_sendMessage(type) {
|
|
1185
1168
|
this.messageStream.next({ type });
|
|
@@ -1232,6 +1215,22 @@ _SkyColorpickerComponent_idIndex = new WeakMap(), _SkyColorpickerComponent_alpha
|
|
|
1232
1215
|
__classPrivateFieldGet(this, _SkyColorpickerComponent_affixer, "f").destroy();
|
|
1233
1216
|
__classPrivateFieldSet(this, _SkyColorpickerComponent_affixer, undefined, "f");
|
|
1234
1217
|
}
|
|
1218
|
+
}, _SkyColorpickerComponent_createOverlay = function _SkyColorpickerComponent_createOverlay() {
|
|
1219
|
+
if (this.colorpickerTemplateRef) {
|
|
1220
|
+
const overlay = __classPrivateFieldGet(this, _SkyColorpickerComponent_overlaySvc, "f").create({
|
|
1221
|
+
enableClose: false,
|
|
1222
|
+
enablePointerEvents: false,
|
|
1223
|
+
enableScroll: true,
|
|
1224
|
+
});
|
|
1225
|
+
overlay.attachTemplate(this.colorpickerTemplateRef);
|
|
1226
|
+
__classPrivateFieldSet(this, _SkyColorpickerComponent_overlay, overlay, "f");
|
|
1227
|
+
}
|
|
1228
|
+
}, _SkyColorpickerComponent_destroyOverlay = function _SkyColorpickerComponent_destroyOverlay() {
|
|
1229
|
+
/*istanbul ignore else*/
|
|
1230
|
+
if (__classPrivateFieldGet(this, _SkyColorpickerComponent_overlay, "f")) {
|
|
1231
|
+
__classPrivateFieldGet(this, _SkyColorpickerComponent_overlaySvc, "f").close(__classPrivateFieldGet(this, _SkyColorpickerComponent_overlay, "f"));
|
|
1232
|
+
__classPrivateFieldSet(this, _SkyColorpickerComponent_overlay, undefined, "f");
|
|
1233
|
+
}
|
|
1235
1234
|
}, _SkyColorpickerComponent_addTriggerButtonEventListeners = function _SkyColorpickerComponent_addTriggerButtonEventListeners() {
|
|
1236
1235
|
fromEvent(window.document, 'keydown')
|
|
1237
1236
|
.pipe(takeUntil(__classPrivateFieldGet(this, _SkyColorpickerComponent_ngUnsubscribe, "f")))
|