@wfrog/vc-ui 1.11.10 → 1.11.11

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.
Files changed (134) hide show
  1. package/dist/es/chunk/Bw0Rhd-r.mjs +110 -0
  2. package/dist/es/chunk/CqTdDZkE.mjs +31 -0
  3. package/dist/es/chunk/{DAnWZLYj.mjs → CzWfBa_8.mjs} +96 -2
  4. package/dist/es/chunk/D229kQ56.mjs +28 -0
  5. package/dist/es/chunk/{Cxx_YWUC.mjs → DcouM6gM.mjs} +6 -548
  6. package/dist/es/chunk/Fo0dZYnz.mjs +128 -0
  7. package/dist/es/chunk/KanuIcmc.mjs +412 -0
  8. package/dist/es/chunk/{B71xEPfK.mjs → uuUHUjSk.mjs} +4 -35
  9. package/dist/es/components/backbottom/backbottom.mjs +3 -2
  10. package/dist/es/components/button/button.mjs +4 -5
  11. package/dist/es/components/choice/choice.mjs +4 -4
  12. package/dist/es/components/choice/index.css +1 -1
  13. package/dist/es/components/color-switch/color-switch.mjs +73 -1046
  14. package/dist/es/components/color-switch/index.css +1 -1
  15. package/dist/es/components/cropper/cropper.mjs +11 -117
  16. package/dist/es/components/cropper/index.css +1 -1
  17. package/dist/es/components/currency/currency.mjs +4 -5
  18. package/dist/es/components/daterange-picker/daterange-picker.mjs +8 -6253
  19. package/dist/es/components/dialog/dialog.mjs +7 -400
  20. package/dist/es/components/dialog/index.css +1 -1
  21. package/dist/es/components/dialog-camera-upload/dialog-camera-upload.mjs +10 -11
  22. package/dist/es/components/dialog-map-point/dialog-map-point.mjs +4 -3
  23. package/dist/es/components/dialog-upload-images/dialog-upload-images.mjs +9 -1374
  24. package/dist/es/components/dialog-upload-images/index.css +1 -1
  25. package/dist/es/components/drag-verify/drag-verify.mjs +3 -2
  26. package/dist/es/components/drawer/drawer.mjs +10 -352
  27. package/dist/es/components/drawer/index.css +1 -1
  28. package/dist/es/components/easy-pagination/easy-pagination.mjs +3 -2
  29. package/dist/es/components/explorer/explorer.mjs +3 -3
  30. package/dist/es/components/explorer-column-table/explorer-column-table.mjs +5 -7
  31. package/dist/es/components/explorer-column-table/index.css +1 -1
  32. package/dist/es/components/explorer-container/explorer-container.d.ts +1 -1
  33. package/dist/es/components/explorer-container/explorer-container.mjs +4 -3
  34. package/dist/es/components/explorer-filter/explorer-filter.mjs +5 -4
  35. package/dist/es/components/explorer-footer/explorer-footer.mjs +4 -8
  36. package/dist/es/components/explorer-form/explorer-form.mjs +4 -3
  37. package/dist/es/components/explorer-list/explorer-list.mjs +5 -4
  38. package/dist/es/components/explorer-modal-form/explorer-modal-form.mjs +4 -3
  39. package/dist/es/components/explorer-panel/explorer-panel.mjs +3 -3
  40. package/dist/es/components/explorer-query/explorer-query.mjs +9 -2201
  41. package/dist/es/components/explorer-query/index.css +1 -1
  42. package/dist/es/components/explorer-table/explorer-table.mjs +5 -8
  43. package/dist/es/components/explorer-tools/explorer-tools.mjs +13 -264
  44. package/dist/es/components/explorer-tools/index.css +1 -1
  45. package/dist/es/components/explorer-tree/explorer-tree.mjs +4 -5
  46. package/dist/es/components/icon-picker/icon-picker.mjs +8 -12
  47. package/dist/es/components/image/image.mjs +4 -4
  48. package/dist/es/components/info-tooltip/info-tooltip.mjs +336 -4
  49. package/dist/es/components/input/input.mjs +3 -2
  50. package/dist/es/components/input-number/input-number.mjs +3 -3
  51. package/dist/es/components/pca-picker/index.css +1 -1
  52. package/dist/es/components/pca-picker/pca-picker.mjs +443 -601
  53. package/dist/es/components/screenfull/screenfull.mjs +4 -3
  54. package/dist/es/components/scrollbar/scrollbar.mjs +3 -2
  55. package/dist/es/components/select/select.mjs +3 -5
  56. package/dist/es/components/single-player/index.css +1 -1
  57. package/dist/es/components/single-player/single-player.mjs +10 -1087
  58. package/dist/es/components/splitter/splitter.mjs +3 -3
  59. package/dist/es/components/splitter-panel/splitter-panel.mjs +3 -3
  60. package/dist/es/components/switch/index.css +1 -1
  61. package/dist/es/components/switch/switch.mjs +9 -395
  62. package/dist/es/components/tags/tags.mjs +7 -9
  63. package/dist/es/components/text-ellipsis/text-ellipsis.mjs +3 -3
  64. package/dist/es/components/thousand-input/thousand-input.mjs +33 -1
  65. package/dist/es/components/tinymce/tinymce.mjs +4 -3
  66. package/dist/es/components/transfer/transfer.mjs +3 -4
  67. package/dist/es/components/transfer-panel/transfer-panel.mjs +5 -4
  68. package/dist/es/components/tree-picker/popover-cascader.css +1 -1
  69. package/dist/es/components/tree-picker/tree-picker.mjs +5 -10
  70. package/dist/es/index.mjs +1 -1
  71. package/dist/index.css +13 -40
  72. package/package.json +1 -1
  73. package/dist/es/chunk/B-rxnVJv.mjs +0 -3
  74. package/dist/es/chunk/B5HpgPRt.mjs +0 -69
  75. package/dist/es/chunk/BBhZKpIc.mjs +0 -2179
  76. package/dist/es/chunk/BDcsaNYa.mjs +0 -59
  77. package/dist/es/chunk/BTSSEFfD.mjs +0 -319
  78. package/dist/es/chunk/BTpNRPQW.mjs +0 -55
  79. package/dist/es/chunk/BVBK1U57.mjs +0 -96
  80. package/dist/es/chunk/Bc6yUGLs.mjs +0 -45
  81. package/dist/es/chunk/BjVI1XMz.mjs +0 -40
  82. package/dist/es/chunk/BlzQCBDu.mjs +0 -5741
  83. package/dist/es/chunk/BpJKnxlF.mjs +0 -476
  84. package/dist/es/chunk/Brp-qSBw.mjs +0 -2003
  85. package/dist/es/chunk/BunQI8Jb.mjs +0 -390
  86. package/dist/es/chunk/C0XgBrDz.mjs +0 -775
  87. package/dist/es/chunk/C0pTANRX.mjs +0 -109
  88. package/dist/es/chunk/CBMjhoFP.mjs +0 -101
  89. package/dist/es/chunk/CBiNtNvQ.mjs +0 -242
  90. package/dist/es/chunk/CBlJeNBO.mjs +0 -890
  91. package/dist/es/chunk/CCVL_Zj-.mjs +0 -427
  92. package/dist/es/chunk/CEl4MyfJ.mjs +0 -252
  93. package/dist/es/chunk/CJK5_jsA.mjs +0 -53
  94. package/dist/es/chunk/CKOcwq5V.mjs +0 -44
  95. package/dist/es/chunk/COs9dJZa.mjs +0 -66
  96. package/dist/es/chunk/CPt6MxJW.mjs +0 -375
  97. package/dist/es/chunk/CVqW0jzp.mjs +0 -107
  98. package/dist/es/chunk/CccIsEqA.mjs +0 -128
  99. package/dist/es/chunk/CjLR27-a.mjs +0 -582
  100. package/dist/es/chunk/CoGexPPD.mjs +0 -2192
  101. package/dist/es/chunk/CsLIbnzG.mjs +0 -64
  102. package/dist/es/chunk/Ct6q2FXg.mjs +0 -5
  103. package/dist/es/chunk/Cuq5meQh.mjs +0 -184
  104. package/dist/es/chunk/CvYIOfT1.mjs +0 -23
  105. package/dist/es/chunk/CxHJBf4l.mjs +0 -31
  106. package/dist/es/chunk/CzdaOBtA.mjs +0 -66
  107. package/dist/es/chunk/D0QTifnI.mjs +0 -54
  108. package/dist/es/chunk/D1QnA2iT.mjs +0 -229
  109. package/dist/es/chunk/D3AvJlVX.mjs +0 -188
  110. package/dist/es/chunk/D9Lr0Bzb.mjs +0 -1136
  111. package/dist/es/chunk/DCkPv0hy.mjs +0 -29
  112. package/dist/es/chunk/DRwwUUhy.mjs +0 -49
  113. package/dist/es/chunk/DX-2VRY2.mjs +0 -836
  114. package/dist/es/chunk/DZ2oTFad.mjs +0 -687
  115. package/dist/es/chunk/D_bou1py.mjs +0 -55
  116. package/dist/es/chunk/Da199A5L.mjs +0 -314
  117. package/dist/es/chunk/DbhQlaOz.mjs +0 -94
  118. package/dist/es/chunk/Dgu95mOy.mjs +0 -237
  119. package/dist/es/chunk/DhGOsWxx.mjs +0 -6
  120. package/dist/es/chunk/Dm_Sj5aH.mjs +0 -487
  121. package/dist/es/chunk/Dmi-1GRO.mjs +0 -163
  122. package/dist/es/chunk/DodoD9a9.mjs +0 -52
  123. package/dist/es/chunk/DrrVDcwm.mjs +0 -955
  124. package/dist/es/chunk/Du_zJ1Fz.mjs +0 -49
  125. package/dist/es/chunk/DxxbB5jY.mjs +0 -34
  126. package/dist/es/chunk/Gk1J52Yw.mjs +0 -207
  127. package/dist/es/chunk/NsldgdCh.mjs +0 -704
  128. package/dist/es/chunk/V6KjsUQN.mjs +0 -35
  129. package/dist/es/chunk/eEsLFV3s.mjs +0 -76
  130. package/dist/es/chunk/fqiLhk0V.mjs +0 -2065
  131. package/dist/es/chunk/nxVM7re4.mjs +0 -35
  132. package/dist/es/chunk/s7HLrANj.mjs +0 -215
  133. package/dist/es/chunk/vPhxogl3.mjs +0 -19
  134. package/dist/es/components/icon/icon2.mjs +0 -27
@@ -1,1053 +1,80 @@
1
1
  import './index.css'
2
- import { b as buildProps, d as definePropType, u as useNamespace, i as isString, h as hasOwn, a as debugWarn } from '../../chunk/Gk1J52Yw.mjs';
3
- import '../../chunk/CoGexPPD.mjs';
4
- /* empty css */
5
- import { E as ElInput } from '../../chunk/DX-2VRY2.mjs';
6
- import { getCurrentInstance, shallowRef, computed, ref, onMounted, watch, defineComponent, createElementBlock, openBlock, normalizeClass, unref, createElementVNode, normalizeStyle, inject, watchEffect, Fragment, renderList, reactive, nextTick, provide, createBlock, createCommentVNode, createVNode, renderSlot, onBeforeMount, useTemplateRef, withCtx, isRef } from 'vue';
2
+ import { ElPopover, ElColorPickerPanel } from 'element-plus/es';
3
+ import 'element-plus/es/components/base/style/css';
4
+ import 'element-plus/es/components/popover/style/css';
5
+ import 'element-plus/es/components/color-picker-panel/style/css';
6
+ import { onBeforeMount, watch, defineComponent, useTemplateRef, createBlock, openBlock, unref, withCtx, createVNode, isRef, createElementVNode, normalizeClass } from 'vue';
7
7
  import { C as Component$1 } from '../iconify-icon/iconify-icon.mjs';
8
- import { isClient, useDark, useStorage } from '@vueuse/core';
9
- import { t as throttle } from '../../chunk/B5HpgPRt.mjs';
10
- import { E as ElPopover } from '../../chunk/Da199A5L.mjs';
11
- import { g as getClientXY } from '../../chunk/DxxbB5jY.mjs';
12
- import { a as addUnit } from '../../chunk/DodoD9a9.mjs';
13
- import { g as getEventCode, E as EVENT_CODE } from '../../chunk/BTpNRPQW.mjs';
14
- import { _ as _export_sfc, w as withInstall } from '../../chunk/V6KjsUQN.mjs';
15
- import { u as useLocale } from '../../chunk/CEl4MyfJ.mjs';
16
- import { U as UPDATE_MODEL_EVENT } from '../../chunk/Ct6q2FXg.mjs';
17
- import { i as isNil } from '../../chunk/Bc6yUGLs.mjs';
18
- import { T as TinyColor } from '../../chunk/D9Lr0Bzb.mjs';
19
- import { u as useFormItem, a as useFormDisabled } from '../../chunk/CBMjhoFP.mjs';
20
- import { _ as _export_sfc$1 } from '../../chunk/pcqpp-6-.mjs';
21
-
22
- const alphaSliderProps = buildProps({
23
- color: {
24
- type: definePropType(Object),
25
- required: true
26
- },
27
- vertical: Boolean,
28
- disabled: Boolean
29
- });
30
- const hueSliderProps = alphaSliderProps;
31
-
32
- let isDragging = false;
33
- function draggable(element, options) {
34
- if (!isClient)
35
- return;
36
- const moveFn = function(event) {
37
- var _a;
38
- (_a = options.drag) == null ? void 0 : _a.call(options, event);
39
- };
40
- const upFn = function(event) {
41
- var _a;
42
- document.removeEventListener("mousemove", moveFn);
43
- document.removeEventListener("mouseup", upFn);
44
- document.removeEventListener("touchmove", moveFn);
45
- document.removeEventListener("touchend", upFn);
46
- document.onselectstart = null;
47
- document.ondragstart = null;
48
- isDragging = false;
49
- (_a = options.end) == null ? void 0 : _a.call(options, event);
50
- };
51
- const downFn = function(event) {
52
- var _a;
53
- if (isDragging)
54
- return;
55
- document.onselectstart = () => false;
56
- document.ondragstart = () => false;
57
- document.addEventListener("mousemove", moveFn);
58
- document.addEventListener("mouseup", upFn);
59
- document.addEventListener("touchmove", moveFn);
60
- document.addEventListener("touchend", upFn);
61
- isDragging = true;
62
- (_a = options.start) == null ? void 0 : _a.call(options, event);
63
- };
64
- element.addEventListener("mousedown", downFn);
65
- element.addEventListener("touchstart", downFn, { passive: false });
66
- }
67
-
68
- const useSlider = (props, { key, minValue, maxValue }) => {
69
- const instance = getCurrentInstance();
70
- const thumb = shallowRef();
71
- const bar = shallowRef();
72
- const currentValue = computed(() => props.color.get(key));
73
- function handleClick(event) {
74
- var _a;
75
- if (props.disabled)
76
- return;
77
- const target = event.target;
78
- if (target !== thumb.value) {
79
- handleDrag(event);
80
- }
81
- (_a = thumb.value) == null ? void 0 : _a.focus();
82
- }
83
- function handleDrag(event) {
84
- if (!bar.value || !thumb.value || props.disabled)
85
- return;
86
- const el = instance.vnode.el;
87
- const rect = el.getBoundingClientRect();
88
- const { clientX, clientY } = getClientXY(event);
89
- let value;
90
- if (!props.vertical) {
91
- let left = clientX - rect.left;
92
- left = Math.max(thumb.value.offsetWidth / 2, left);
93
- left = Math.min(left, rect.width - thumb.value.offsetWidth / 2);
94
- value = Math.round(
95
- (left - thumb.value.offsetWidth / 2) / (rect.width - thumb.value.offsetWidth) * maxValue
96
- );
97
- } else {
98
- let top = clientY - rect.top;
99
- top = Math.max(thumb.value.offsetHeight / 2, top);
100
- top = Math.min(top, rect.height - thumb.value.offsetHeight / 2);
101
- value = Math.round(
102
- (top - thumb.value.offsetHeight / 2) / (rect.height - thumb.value.offsetHeight) * maxValue
103
- );
104
- }
105
- props.color.set(key, value);
106
- }
107
- function handleKeydown(event) {
108
- if (props.disabled)
109
- return;
110
- const { shiftKey } = event;
111
- const code = getEventCode(event);
112
- const step = shiftKey ? 10 : 1;
113
- const reverse = key === "hue" ? -1 : 1;
114
- let isPreventDefault = true;
115
- switch (code) {
116
- case EVENT_CODE.left:
117
- case EVENT_CODE.down:
118
- incrementPosition(-step * reverse);
119
- break;
120
- case EVENT_CODE.right:
121
- case EVENT_CODE.up:
122
- incrementPosition(step * reverse);
123
- break;
124
- case EVENT_CODE.home:
125
- props.color.set(key, key === "hue" ? maxValue : minValue);
126
- break;
127
- case EVENT_CODE.end:
128
- props.color.set(key, key === "hue" ? minValue : maxValue);
129
- break;
130
- case EVENT_CODE.pageDown:
131
- incrementPosition(-4 * reverse);
132
- break;
133
- case EVENT_CODE.pageUp:
134
- incrementPosition(4 * reverse);
135
- break;
136
- default:
137
- isPreventDefault = false;
138
- break;
139
- }
140
- isPreventDefault && event.preventDefault();
141
- }
142
- function incrementPosition(step) {
143
- let next = currentValue.value + step;
144
- next = next < minValue ? minValue : next > maxValue ? maxValue : next;
145
- props.color.set(key, next);
146
- }
147
- return {
148
- thumb,
149
- bar,
150
- currentValue,
151
- handleDrag,
152
- handleClick,
153
- handleKeydown
154
- };
155
- };
156
- const useSliderDOM = (props, {
157
- namespace,
158
- maxValue,
159
- bar,
160
- thumb,
161
- currentValue,
162
- handleDrag,
163
- getBackground
164
- }) => {
165
- const instance = getCurrentInstance();
166
- const ns = useNamespace(namespace);
167
- const thumbLeft = ref(0);
168
- const thumbTop = ref(0);
169
- const background = ref();
170
- function getThumbLeft() {
171
- if (!thumb.value)
172
- return 0;
173
- if (props.vertical)
174
- return 0;
175
- const el = instance.vnode.el;
176
- const value = currentValue.value;
177
- if (!el)
178
- return 0;
179
- return Math.round(
180
- value * (el.offsetWidth - thumb.value.offsetWidth / 2) / maxValue
181
- );
182
- }
183
- function getThumbTop() {
184
- if (!thumb.value)
185
- return 0;
186
- const el = instance.vnode.el;
187
- if (!props.vertical)
188
- return 0;
189
- const value = currentValue.value;
190
- if (!el)
191
- return 0;
192
- return Math.round(
193
- value * (el.offsetHeight - thumb.value.offsetHeight / 2) / maxValue
194
- );
195
- }
196
- function update() {
197
- thumbLeft.value = getThumbLeft();
198
- thumbTop.value = getThumbTop();
199
- background.value = getBackground == null ? void 0 : getBackground();
200
- }
201
- onMounted(() => {
202
- if (!bar.value || !thumb.value)
203
- return;
204
- const dragConfig = {
205
- drag: (event) => {
206
- handleDrag(event);
207
- },
208
- end: (event) => {
209
- handleDrag(event);
210
- }
211
- };
212
- draggable(bar.value, dragConfig);
213
- draggable(thumb.value, dragConfig);
214
- update();
8
+ import { useDark, useStorage } from '@vueuse/core';
9
+ import { d as debounce } from '../../chunk/CzWfBa_8.mjs';
10
+ import { i as isObject } from '../../chunk/CqTdDZkE.mjs';
11
+ import { _ as _export_sfc } from '../../chunk/pcqpp-6-.mjs';
12
+
13
+ /** Error message constants. */
14
+ var FUNC_ERROR_TEXT = 'Expected a function';
15
+
16
+ /**
17
+ * Creates a throttled function that only invokes `func` at most once per
18
+ * every `wait` milliseconds. The throttled function comes with a `cancel`
19
+ * method to cancel delayed `func` invocations and a `flush` method to
20
+ * immediately invoke them. Provide `options` to indicate whether `func`
21
+ * should be invoked on the leading and/or trailing edge of the `wait`
22
+ * timeout. The `func` is invoked with the last arguments provided to the
23
+ * throttled function. Subsequent calls to the throttled function return the
24
+ * result of the last `func` invocation.
25
+ *
26
+ * **Note:** If `leading` and `trailing` options are `true`, `func` is
27
+ * invoked on the trailing edge of the timeout only if the throttled function
28
+ * is invoked more than once during the `wait` timeout.
29
+ *
30
+ * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
31
+ * until to the next tick, similar to `setTimeout` with a timeout of `0`.
32
+ *
33
+ * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
34
+ * for details over the differences between `_.throttle` and `_.debounce`.
35
+ *
36
+ * @static
37
+ * @memberOf _
38
+ * @since 0.1.0
39
+ * @category Function
40
+ * @param {Function} func The function to throttle.
41
+ * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
42
+ * @param {Object} [options={}] The options object.
43
+ * @param {boolean} [options.leading=true]
44
+ * Specify invoking on the leading edge of the timeout.
45
+ * @param {boolean} [options.trailing=true]
46
+ * Specify invoking on the trailing edge of the timeout.
47
+ * @returns {Function} Returns the new throttled function.
48
+ * @example
49
+ *
50
+ * // Avoid excessively updating the position while scrolling.
51
+ * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
52
+ *
53
+ * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
54
+ * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
55
+ * jQuery(element).on('click', throttled);
56
+ *
57
+ * // Cancel the trailing throttled invocation.
58
+ * jQuery(window).on('popstate', throttled.cancel);
59
+ */
60
+ function throttle(func, wait, options) {
61
+ var leading = true,
62
+ trailing = true;
63
+
64
+ if (typeof func != 'function') {
65
+ throw new TypeError(FUNC_ERROR_TEXT);
66
+ }
67
+ if (isObject(options)) {
68
+ leading = 'leading' in options ? !!options.leading : leading;
69
+ trailing = 'trailing' in options ? !!options.trailing : trailing;
70
+ }
71
+ return debounce(func, wait, {
72
+ 'leading': leading,
73
+ 'maxWait': wait,
74
+ 'trailing': trailing
215
75
  });
216
- watch(currentValue, () => update());
217
- watch(
218
- () => props.color.value,
219
- () => update()
220
- );
221
- const rootKls = computed(() => [
222
- ns.b(),
223
- ns.is("vertical", props.vertical),
224
- ns.is("disabled", props.disabled)
225
- ]);
226
- const barKls = computed(() => ns.e("bar"));
227
- const thumbKls = computed(() => ns.e("thumb"));
228
- const barStyle = computed(() => ({ background: background.value }));
229
- const thumbStyle = computed(() => ({
230
- left: addUnit(thumbLeft.value),
231
- top: addUnit(thumbTop.value)
232
- }));
233
- return {
234
- rootKls,
235
- barKls,
236
- barStyle,
237
- thumbKls,
238
- thumbStyle,
239
- thumbLeft,
240
- thumbTop,
241
- update
242
- };
243
- };
244
-
245
- const _hoisted_1$3 = ["aria-label", "aria-valuenow", "aria-valuetext", "aria-orientation", "tabindex", "aria-disabled"];
246
- const minValue$1 = 0;
247
- const maxValue$1 = 100;
248
- const _sfc_main$5 = defineComponent({
249
- ...{
250
- name: "ElColorAlphaSlider"
251
- },
252
- __name: "alpha-slider",
253
- props: alphaSliderProps,
254
- setup(__props, { expose: __expose }) {
255
- const props = __props;
256
- const { currentValue, bar, thumb, handleDrag, handleClick, handleKeydown } = useSlider(props, { key: "alpha", minValue: minValue$1, maxValue: maxValue$1 });
257
- const { rootKls, barKls, barStyle, thumbKls, thumbStyle, update } = useSliderDOM(props, {
258
- namespace: "color-alpha-slider",
259
- maxValue: maxValue$1,
260
- currentValue,
261
- bar,
262
- thumb,
263
- handleDrag,
264
- getBackground
265
- });
266
- const { t } = useLocale();
267
- const ariaLabel = computed(() => t("el.colorpicker.alphaLabel"));
268
- const ariaValuetext = computed(() => {
269
- return t("el.colorpicker.alphaDescription", {
270
- alpha: currentValue.value,
271
- color: props.color.value
272
- });
273
- });
274
- function getBackground() {
275
- if (props.color && props.color.value) {
276
- const { r, g, b } = props.color.toRgb();
277
- return `linear-gradient(to right, rgba(${r}, ${g}, ${b}, 0) 0%, rgba(${r}, ${g}, ${b}, 1) 100%)`;
278
- }
279
- return "";
280
- }
281
- __expose({
282
- update,
283
- bar,
284
- thumb
285
- });
286
- return (_ctx, _cache) => {
287
- return openBlock(), createElementBlock(
288
- "div",
289
- {
290
- class: normalizeClass(unref(rootKls))
291
- },
292
- [
293
- createElementVNode(
294
- "div",
295
- {
296
- ref_key: "bar",
297
- ref: bar,
298
- class: normalizeClass(unref(barKls)),
299
- style: normalizeStyle(unref(barStyle)),
300
- onClick: _cache[0] || (_cache[0] = (...args) => unref(handleClick) && unref(handleClick)(...args))
301
- },
302
- null,
303
- 6
304
- ),
305
- createElementVNode("div", {
306
- ref_key: "thumb",
307
- ref: thumb,
308
- class: normalizeClass(unref(thumbKls)),
309
- style: normalizeStyle(unref(thumbStyle)),
310
- "aria-label": ariaLabel.value,
311
- "aria-valuenow": unref(currentValue),
312
- "aria-valuetext": ariaValuetext.value,
313
- "aria-orientation": _ctx.vertical ? "vertical" : "horizontal",
314
- "aria-valuemin": minValue$1,
315
- "aria-valuemax": maxValue$1,
316
- role: "slider",
317
- tabindex: _ctx.disabled ? void 0 : 0,
318
- "aria-disabled": _ctx.disabled,
319
- onKeydown: _cache[1] || (_cache[1] = (...args) => unref(handleKeydown) && unref(handleKeydown)(...args))
320
- }, null, 46, _hoisted_1$3)
321
- ],
322
- 2
323
- );
324
- };
325
- }
326
- });
327
- var AlphaSlider = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/color-picker-panel/src/components/alpha-slider.vue"]]);
328
-
329
- const _hoisted_1$2 = ["aria-label", "aria-valuenow", "aria-valuetext", "aria-orientation", "tabindex", "aria-disabled"];
330
- const minValue = 0;
331
- const maxValue = 360;
332
- const _sfc_main$4 = defineComponent({
333
- ...{
334
- name: "ElColorHueSlider"
335
- },
336
- __name: "hue-slider",
337
- props: hueSliderProps,
338
- setup(__props, { expose: __expose }) {
339
- const props = __props;
340
- const { currentValue, bar, thumb, handleDrag, handleClick, handleKeydown } = useSlider(props, { key: "hue", minValue, maxValue });
341
- const { rootKls, barKls, thumbKls, thumbStyle, thumbTop, update } = useSliderDOM(props, {
342
- namespace: "color-hue-slider",
343
- maxValue,
344
- currentValue,
345
- bar,
346
- thumb,
347
- handleDrag
348
- });
349
- const { t } = useLocale();
350
- const ariaLabel = computed(() => t("el.colorpicker.hueLabel"));
351
- const ariaValuetext = computed(() => {
352
- return t("el.colorpicker.hueDescription", {
353
- hue: currentValue.value,
354
- color: props.color.value
355
- });
356
- });
357
- __expose({
358
- bar,
359
- thumb,
360
- thumbTop,
361
- update
362
- });
363
- return (_ctx, _cache) => {
364
- return openBlock(), createElementBlock(
365
- "div",
366
- {
367
- class: normalizeClass(unref(rootKls))
368
- },
369
- [
370
- createElementVNode(
371
- "div",
372
- {
373
- ref_key: "bar",
374
- ref: bar,
375
- class: normalizeClass(unref(barKls)),
376
- onClick: _cache[0] || (_cache[0] = (...args) => unref(handleClick) && unref(handleClick)(...args))
377
- },
378
- null,
379
- 2
380
- ),
381
- createElementVNode("div", {
382
- ref_key: "thumb",
383
- ref: thumb,
384
- class: normalizeClass(unref(thumbKls)),
385
- style: normalizeStyle(unref(thumbStyle)),
386
- "aria-label": ariaLabel.value,
387
- "aria-valuenow": unref(currentValue),
388
- "aria-valuetext": ariaValuetext.value,
389
- "aria-orientation": _ctx.vertical ? "vertical" : "horizontal",
390
- "aria-valuemin": minValue,
391
- "aria-valuemax": maxValue,
392
- role: "slider",
393
- tabindex: _ctx.disabled ? void 0 : 0,
394
- "aria-disabled": _ctx.disabled,
395
- onKeydown: _cache[1] || (_cache[1] = (...args) => unref(handleKeydown) && unref(handleKeydown)(...args))
396
- }, null, 46, _hoisted_1$2)
397
- ],
398
- 2
399
- );
400
- };
401
- }
402
- });
403
- var HueSlider = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/color-picker-panel/src/components/hue-slider.vue"]]);
404
-
405
- const predefineProps = buildProps({
406
- colors: {
407
- type: definePropType(Array),
408
- required: true
409
- },
410
- color: {
411
- type: definePropType(Object),
412
- required: true
413
- },
414
- enableAlpha: {
415
- type: Boolean,
416
- required: true
417
- },
418
- disabled: Boolean
419
- });
420
-
421
- const colorPickerPanelProps = buildProps({
422
- modelValue: {
423
- type: definePropType(String),
424
- default: void 0
425
- },
426
- border: {
427
- type: Boolean,
428
- default: true
429
- },
430
- showAlpha: Boolean,
431
- colorFormat: String,
432
- disabled: Boolean,
433
- predefine: {
434
- type: definePropType(Array)
435
- },
436
- validateEvent: {
437
- type: Boolean,
438
- default: true
439
- }
440
- });
441
- const colorPickerPanelEmits = {
442
- [UPDATE_MODEL_EVENT]: (val) => isString(val) || isNil(val)
443
- };
444
- const ROOT_COMMON_COLOR_INJECTION_KEY = Symbol("colorCommonPickerKey");
445
- const colorPickerPanelContextKey = Symbol("colorPickerPanelContextKey");
446
-
447
- class Color {
448
- constructor(options = {}) {
449
- this._hue = 0;
450
- this._saturation = 100;
451
- this._value = 100;
452
- this._alpha = 100;
453
- this._tiny = new TinyColor();
454
- this._isValid = false;
455
- this.enableAlpha = false;
456
- this.format = "";
457
- this.value = "";
458
- for (const option in options) {
459
- if (hasOwn(options, option)) {
460
- this[option] = options[option];
461
- }
462
- }
463
- if (options.value) {
464
- this.fromString(options.value);
465
- } else {
466
- this.doOnChange();
467
- }
468
- }
469
- set(prop, value) {
470
- if (arguments.length === 1 && typeof prop === "object") {
471
- for (const p in prop) {
472
- if (hasOwn(prop, p)) {
473
- this.set(p, prop[p]);
474
- }
475
- }
476
- return;
477
- }
478
- this[`_${prop}`] = value;
479
- this._isValid = true;
480
- this.doOnChange();
481
- }
482
- get(prop) {
483
- if (["hue", "saturation", "value", "alpha"].includes(prop)) {
484
- return Math.round(this[`_${prop}`]);
485
- }
486
- return this[`_${prop}`];
487
- }
488
- toRgb() {
489
- return this._isValid ? this._tiny.toRgb() : { r: 255, g: 255, b: 255, a: 0 };
490
- }
491
- fromString(value) {
492
- const color = new TinyColor(value);
493
- this._isValid = color.isValid;
494
- if (color.isValid) {
495
- const { h, s, v, a } = color.toHsv();
496
- this._hue = h;
497
- this._saturation = s * 100;
498
- this._value = v * 100;
499
- this._alpha = a * 100;
500
- } else {
501
- this._hue = 0;
502
- this._saturation = 100;
503
- this._value = 100;
504
- this._alpha = 100;
505
- }
506
- this.doOnChange();
507
- }
508
- clear() {
509
- this._isValid = false;
510
- this.value = "";
511
- this._hue = 0;
512
- this._saturation = 100;
513
- this._value = 100;
514
- this._alpha = 100;
515
- }
516
- compare(color) {
517
- const compareColor = new TinyColor({
518
- h: color._hue,
519
- s: color._saturation / 100,
520
- v: color._value / 100,
521
- a: color._alpha / 100
522
- });
523
- return this._tiny.equals(compareColor);
524
- }
525
- doOnChange() {
526
- const { _hue, _saturation, _value, _alpha, format, enableAlpha } = this;
527
- let _format = format || (enableAlpha ? "rgb" : "hex");
528
- if (format === "hex" && enableAlpha) {
529
- _format = "hex8";
530
- }
531
- this._tiny = new TinyColor({
532
- h: _hue,
533
- s: _saturation / 100,
534
- v: _value / 100,
535
- a: _alpha / 100
536
- });
537
- this.value = this._isValid ? this._tiny.toString(_format) : "";
538
- }
539
76
  }
540
77
 
541
- const usePredefine = (props) => {
542
- const { currentColor } = inject(colorPickerPanelContextKey);
543
- const rgbaColors = ref(parseColors(props.colors, props.color));
544
- watch(
545
- () => currentColor.value,
546
- (val) => {
547
- const color = new Color({
548
- value: val,
549
- enableAlpha: props.enableAlpha
550
- });
551
- rgbaColors.value.forEach((item) => {
552
- item.selected = color.compare(item);
553
- });
554
- }
555
- );
556
- watchEffect(() => {
557
- rgbaColors.value = parseColors(props.colors, props.color);
558
- });
559
- function handleSelect(index) {
560
- props.color.fromString(props.colors[index]);
561
- }
562
- function parseColors(colors, color) {
563
- return colors.map((value) => {
564
- const c = new Color({
565
- value,
566
- enableAlpha: props.enableAlpha
567
- });
568
- c.selected = c.compare(color);
569
- return c;
570
- });
571
- }
572
- return {
573
- rgbaColors,
574
- handleSelect
575
- };
576
- };
577
- const usePredefineDOM = (props) => {
578
- const ns = useNamespace("color-predefine");
579
- const rootKls = computed(() => [ns.b(), ns.is("disabled", props.disabled)]);
580
- const colorsKls = computed(() => ns.e("colors"));
581
- function colorSelectorKls(item) {
582
- return [
583
- ns.e("color-selector"),
584
- ns.is("alpha", item.get("alpha") < 100),
585
- { selected: item.selected }
586
- ];
587
- }
588
- return {
589
- rootKls,
590
- colorsKls,
591
- colorSelectorKls
592
- };
593
- };
594
-
595
- const _hoisted_1$1 = ["disabled", "aria-label", "onClick"];
596
- const _sfc_main$3 = defineComponent({
597
- ...{
598
- name: "ElColorPredefine"
599
- },
600
- __name: "predefine",
601
- props: predefineProps,
602
- setup(__props) {
603
- const props = __props;
604
- const { rgbaColors, handleSelect } = usePredefine(props);
605
- const { rootKls, colorsKls, colorSelectorKls } = usePredefineDOM(props);
606
- const { t } = useLocale();
607
- const ariaLabel = (value) => {
608
- return t("el.colorpicker.predefineDescription", { value });
609
- };
610
- return (_ctx, _cache) => {
611
- return openBlock(), createElementBlock(
612
- "div",
613
- {
614
- class: normalizeClass(unref(rootKls))
615
- },
616
- [
617
- createElementVNode(
618
- "div",
619
- {
620
- class: normalizeClass(unref(colorsKls))
621
- },
622
- [
623
- (openBlock(true), createElementBlock(
624
- Fragment,
625
- null,
626
- renderList(unref(rgbaColors), (item, index) => {
627
- return openBlock(), createElementBlock("button", {
628
- key: _ctx.colors[index],
629
- type: "button",
630
- disabled: _ctx.disabled,
631
- "aria-label": ariaLabel(item.value),
632
- class: normalizeClass(unref(colorSelectorKls)(item)),
633
- onClick: ($event) => unref(handleSelect)(index)
634
- }, [
635
- createElementVNode(
636
- "div",
637
- {
638
- style: normalizeStyle({ backgroundColor: item.value })
639
- },
640
- null,
641
- 4
642
- )
643
- ], 10, _hoisted_1$1);
644
- }),
645
- 128
646
- ))
647
- ],
648
- 2
649
- )
650
- ],
651
- 2
652
- );
653
- };
654
- }
655
- });
656
- var Predefine = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/color-picker-panel/src/components/predefine.vue"]]);
657
-
658
- const svPanelProps = buildProps({
659
- color: {
660
- type: definePropType(Object),
661
- required: true
662
- },
663
- disabled: Boolean
664
- });
665
-
666
- const useSvPanel = (props) => {
667
- const instance = getCurrentInstance();
668
- const cursorRef = ref();
669
- const cursorTop = ref(0);
670
- const cursorLeft = ref(0);
671
- const background = ref("hsl(0, 100%, 50%)");
672
- const saturation = computed(() => props.color.get("saturation"));
673
- const brightness = computed(() => props.color.get("value"));
674
- const hue = computed(() => props.color.get("hue"));
675
- function handleClick(event) {
676
- var _a;
677
- if (props.disabled)
678
- return;
679
- const target = event.target;
680
- if (target !== cursorRef.value) {
681
- handleDrag(event);
682
- }
683
- (_a = cursorRef.value) == null ? void 0 : _a.focus({ preventScroll: true });
684
- }
685
- function handleDrag(event) {
686
- if (props.disabled)
687
- return;
688
- const el = instance.vnode.el;
689
- const rect = el.getBoundingClientRect();
690
- const { clientX, clientY } = getClientXY(event);
691
- let left = clientX - rect.left;
692
- let top = clientY - rect.top;
693
- left = Math.max(0, left);
694
- left = Math.min(left, rect.width);
695
- top = Math.max(0, top);
696
- top = Math.min(top, rect.height);
697
- cursorLeft.value = left;
698
- cursorTop.value = top;
699
- props.color.set({
700
- saturation: left / rect.width * 100,
701
- value: 100 - top / rect.height * 100
702
- });
703
- }
704
- function handleKeydown(event) {
705
- if (props.disabled)
706
- return;
707
- const { shiftKey } = event;
708
- const code = getEventCode(event);
709
- const step = shiftKey ? 10 : 1;
710
- let isPreventDefault = true;
711
- switch (code) {
712
- case EVENT_CODE.left:
713
- incrementSaturation(-step);
714
- break;
715
- case EVENT_CODE.right:
716
- incrementSaturation(step);
717
- break;
718
- case EVENT_CODE.up:
719
- incrementBrightness(step);
720
- break;
721
- case EVENT_CODE.down:
722
- incrementBrightness(-step);
723
- break;
724
- default:
725
- isPreventDefault = false;
726
- break;
727
- }
728
- isPreventDefault && event.preventDefault();
729
- }
730
- function incrementSaturation(step) {
731
- let next = saturation.value + step;
732
- next = next < 0 ? 0 : next > 100 ? 100 : next;
733
- props.color.set("saturation", next);
734
- }
735
- function incrementBrightness(step) {
736
- let next = brightness.value + step;
737
- next = next < 0 ? 0 : next > 100 ? 100 : next;
738
- props.color.set("value", next);
739
- }
740
- return {
741
- cursorRef,
742
- cursorTop,
743
- cursorLeft,
744
- background,
745
- saturation,
746
- brightness,
747
- hue,
748
- handleClick,
749
- handleDrag,
750
- handleKeydown
751
- };
752
- };
753
- const useSvPanelDOM = (props, {
754
- cursorTop,
755
- cursorLeft,
756
- background,
757
- handleDrag
758
- }) => {
759
- const instance = getCurrentInstance();
760
- const ns = useNamespace("color-svpanel");
761
- function update() {
762
- const saturation = props.color.get("saturation");
763
- const brightness = props.color.get("value");
764
- const el = instance.vnode.el;
765
- const { clientWidth: width, clientHeight: height } = el;
766
- cursorLeft.value = saturation * width / 100;
767
- cursorTop.value = (100 - brightness) * height / 100;
768
- background.value = `hsl(${props.color.get("hue")}, 100%, 50%)`;
769
- }
770
- onMounted(() => {
771
- draggable(instance.vnode.el, {
772
- drag: (event) => {
773
- handleDrag(event);
774
- },
775
- end: (event) => {
776
- handleDrag(event);
777
- }
778
- });
779
- update();
780
- });
781
- watch(
782
- [
783
- () => props.color.get("hue"),
784
- () => props.color.get("value"),
785
- () => props.color.value
786
- ],
787
- () => update()
788
- );
789
- const rootKls = computed(() => ns.b());
790
- const cursorKls = computed(() => ns.e("cursor"));
791
- const rootStyle = computed(() => ({
792
- backgroundColor: background.value
793
- }));
794
- const cursorStyle = computed(() => ({
795
- top: addUnit(cursorTop.value),
796
- left: addUnit(cursorLeft.value)
797
- }));
798
- return {
799
- rootKls,
800
- cursorKls,
801
- rootStyle,
802
- cursorStyle,
803
- update
804
- };
805
- };
806
-
807
- const _hoisted_1 = ["tabindex", "aria-disabled", "aria-label", "aria-valuenow", "aria-valuetext"];
808
- const _sfc_main$2 = defineComponent({
809
- ...{
810
- name: "ElSvPanel"
811
- },
812
- __name: "sv-panel",
813
- props: svPanelProps,
814
- setup(__props, { expose: __expose }) {
815
- const props = __props;
816
- const {
817
- cursorRef,
818
- cursorTop,
819
- cursorLeft,
820
- background,
821
- saturation,
822
- brightness,
823
- handleClick,
824
- handleDrag,
825
- handleKeydown
826
- } = useSvPanel(props);
827
- const { rootKls, cursorKls, rootStyle, cursorStyle, update } = useSvPanelDOM(
828
- props,
829
- {
830
- cursorTop,
831
- cursorLeft,
832
- background,
833
- handleDrag
834
- }
835
- );
836
- const { t } = useLocale();
837
- const ariaLabel = computed(() => t("el.colorpicker.svLabel"));
838
- const ariaValuetext = computed(() => {
839
- return t("el.colorpicker.svDescription", {
840
- saturation: saturation.value,
841
- brightness: brightness.value,
842
- color: props.color.value
843
- });
844
- });
845
- __expose({
846
- update
847
- });
848
- return (_ctx, _cache) => {
849
- return openBlock(), createElementBlock(
850
- "div",
851
- {
852
- class: normalizeClass(unref(rootKls)),
853
- style: normalizeStyle(unref(rootStyle)),
854
- onClick: _cache[1] || (_cache[1] = (...args) => unref(handleClick) && unref(handleClick)(...args))
855
- },
856
- [
857
- createElementVNode("div", {
858
- ref_key: "cursorRef",
859
- ref: cursorRef,
860
- class: normalizeClass(unref(cursorKls)),
861
- style: normalizeStyle(unref(cursorStyle)),
862
- tabindex: _ctx.disabled ? void 0 : 0,
863
- "aria-disabled": _ctx.disabled,
864
- role: "slider",
865
- "aria-valuemin": "0,0",
866
- "aria-valuemax": "100,100",
867
- "aria-label": ariaLabel.value,
868
- "aria-valuenow": `${unref(saturation)},${unref(brightness)}`,
869
- "aria-valuetext": ariaValuetext.value,
870
- onKeydown: _cache[0] || (_cache[0] = (...args) => unref(handleKeydown) && unref(handleKeydown)(...args))
871
- }, null, 46, _hoisted_1)
872
- ],
873
- 6
874
- );
875
- };
876
- }
877
- });
878
- var SvPanel = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/color-picker-panel/src/components/sv-panel.vue"]]);
879
-
880
- const useCommonColor = (props, emit) => {
881
- const color = reactive(
882
- new Color({
883
- enableAlpha: props.showAlpha,
884
- format: props.colorFormat || "",
885
- value: props.modelValue
886
- })
887
- );
888
- watch(
889
- () => [props.colorFormat, props.showAlpha],
890
- () => {
891
- color.enableAlpha = props.showAlpha;
892
- color.format = props.colorFormat || color.format;
893
- color.doOnChange();
894
- emit(UPDATE_MODEL_EVENT, color.value);
895
- }
896
- );
897
- return {
898
- color
899
- };
900
- };
901
-
902
- const _sfc_main$1 = defineComponent({
903
- ...{
904
- name: "ElColorPickerPanel"
905
- },
906
- __name: "color-picker-panel",
907
- props: colorPickerPanelProps,
908
- emits: colorPickerPanelEmits,
909
- setup(__props, { expose: __expose, emit: __emit }) {
910
- const props = __props;
911
- const emit = __emit;
912
- const ns = useNamespace("color-picker-panel");
913
- const { formItem } = useFormItem();
914
- const disabled = useFormDisabled();
915
- const hueRef = ref();
916
- const svRef = ref();
917
- const alphaRef = ref();
918
- const inputRef = ref();
919
- const customInput = ref("");
920
- const { color } = inject(
921
- ROOT_COMMON_COLOR_INJECTION_KEY,
922
- () => useCommonColor(props, emit),
923
- true
924
- );
925
- function handleConfirm() {
926
- color.fromString(customInput.value);
927
- if (color.value !== customInput.value) {
928
- customInput.value = color.value;
929
- }
930
- }
931
- function handleFocusout() {
932
- var _a;
933
- if (props.validateEvent) {
934
- (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "blur").catch((err) => debugWarn(err));
935
- }
936
- }
937
- function update() {
938
- var _a, _b, _c;
939
- (_a = hueRef.value) == null ? void 0 : _a.update();
940
- (_b = svRef.value) == null ? void 0 : _b.update();
941
- (_c = alphaRef.value) == null ? void 0 : _c.update();
942
- }
943
- onMounted(() => {
944
- if (props.modelValue) {
945
- customInput.value = color.value;
946
- }
947
- nextTick(update);
948
- });
949
- watch(
950
- () => props.modelValue,
951
- (newVal) => {
952
- if (newVal !== color.value) {
953
- newVal ? color.fromString(newVal) : color.clear();
954
- }
955
- }
956
- );
957
- watch(
958
- () => color.value,
959
- (val) => {
960
- emit(UPDATE_MODEL_EVENT, val);
961
- customInput.value = val;
962
- if (props.validateEvent) {
963
- formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn(err));
964
- }
965
- }
966
- );
967
- provide(colorPickerPanelContextKey, {
968
- currentColor: computed(() => color.value)
969
- });
970
- __expose({
971
- color,
972
- inputRef,
973
- update
974
- });
975
- return (_ctx, _cache) => {
976
- return openBlock(), createElementBlock(
977
- "div",
978
- {
979
- class: normalizeClass([unref(ns).b(), unref(ns).is("disabled", unref(disabled)), unref(ns).is("border", _ctx.border)]),
980
- onFocusout: handleFocusout
981
- },
982
- [
983
- createElementVNode(
984
- "div",
985
- {
986
- class: normalizeClass(unref(ns).e("wrapper"))
987
- },
988
- [
989
- createVNode(HueSlider, {
990
- ref_key: "hueRef",
991
- ref: hueRef,
992
- class: "hue-slider",
993
- color: unref(color),
994
- vertical: "",
995
- disabled: unref(disabled)
996
- }, null, 8, ["color", "disabled"]),
997
- createVNode(SvPanel, {
998
- ref_key: "svRef",
999
- ref: svRef,
1000
- color: unref(color),
1001
- disabled: unref(disabled)
1002
- }, null, 8, ["color", "disabled"])
1003
- ],
1004
- 2
1005
- ),
1006
- _ctx.showAlpha ? (openBlock(), createBlock(AlphaSlider, {
1007
- key: 0,
1008
- ref_key: "alphaRef",
1009
- ref: alphaRef,
1010
- color: unref(color),
1011
- disabled: unref(disabled)
1012
- }, null, 8, ["color", "disabled"])) : createCommentVNode("v-if", true),
1013
- _ctx.predefine ? (openBlock(), createBlock(Predefine, {
1014
- key: 1,
1015
- ref: "predefine",
1016
- "enable-alpha": _ctx.showAlpha,
1017
- color: unref(color),
1018
- colors: _ctx.predefine,
1019
- disabled: unref(disabled)
1020
- }, null, 8, ["enable-alpha", "color", "colors", "disabled"])) : createCommentVNode("v-if", true),
1021
- createElementVNode(
1022
- "div",
1023
- {
1024
- class: normalizeClass(unref(ns).e("footer"))
1025
- },
1026
- [
1027
- createVNode(unref(ElInput), {
1028
- ref_key: "inputRef",
1029
- ref: inputRef,
1030
- modelValue: customInput.value,
1031
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => customInput.value = $event),
1032
- "validate-event": false,
1033
- size: "small",
1034
- disabled: unref(disabled),
1035
- onChange: handleConfirm
1036
- }, null, 8, ["modelValue", "disabled"]),
1037
- renderSlot(_ctx.$slots, "footer")
1038
- ],
1039
- 2
1040
- )
1041
- ],
1042
- 34
1043
- );
1044
- };
1045
- }
1046
- });
1047
- var ColorPickerPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/color-picker-panel/src/color-picker-panel.vue"]]);
1048
-
1049
- const ElColorPickerPanel = withInstall(ColorPickerPanel);
1050
-
1051
78
  var r={grad:.9,turn:360,rad:360/(2*Math.PI)},t=function(r){return "string"==typeof r?r.length>0:"number"==typeof r},n=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*r)/n+0},e=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),r>n?n:r>t?r:t},u=function(r){return (r=isFinite(r)?r%360:0)>0?r:r+360},a=function(r){return {r:e(r.r,0,255),g:e(r.g,0,255),b:e(r.b,0,255),a:e(r.a)}},o=function(r){return {r:n(r.r),g:n(r.g),b:n(r.b),a:n(r.a,3)}},i=/^#([0-9a-f]{3,8})$/i,s=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},h=function(r){var t=r.r,n=r.g,e=r.b,u=r.a,a=Math.max(t,n,e),o=a-Math.min(t,n,e),i=o?a===t?(n-e)/o:a===n?2+(e-t)/o:4+(t-n)/o:0;return {h:60*(i<0?i+6:i),s:a?o/a*100:0,v:a/255*100,a:u}},b=function(r){var t=r.h,n=r.s,e=r.v,u=r.a;t=t/360*6,n/=100,e/=100;var a=Math.floor(t),o=e*(1-n),i=e*(1-(t-a)*n),s=e*(1-(1-t+a)*n),h=a%6;return {r:255*[e,i,o,o,s,e][h],g:255*[s,e,e,i,o,o][h],b:255*[o,o,s,e,e,i][h],a:u}},g=function(r){return {h:u(r.h),s:e(r.s,0,100),l:e(r.l,0,100),a:e(r.a)}},d=function(r){return {h:n(r.h),s:n(r.s),l:n(r.l),a:n(r.a,3)}},f=function(r){return b((n=(t=r).s,{h:t.h,s:(n*=((e=t.l)<50?e:100-e)/100)>0?2*n/(e+n)*100:0,v:e+n,a:t.a}));var t,n,e;},c=function(r){return {h:(t=h(r)).h,s:(u=(200-(n=t.s))*(e=t.v)/100)>0&&u<200?n*e/100/(u<=100?u:200-u)*100:0,l:u/2,a:t.a};var t,n,e,u;},l=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,p=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,v=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,m=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,y={string:[[function(r){var t=i.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:4===r.length?n(parseInt(r[3]+r[3],16)/255,2):1}:6===r.length||8===r.length?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:8===r.length?n(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=v.exec(r)||m.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:a({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:void 0===t[7]?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(t){var n=l.exec(t)||p.exec(t);if(!n)return null;var e,u,a=g({h:(e=n[1],u=n[2],void 0===u&&(u="deg"),Number(e)*(r[u]||1)),s:Number(n[3]),l:Number(n[4]),a:void 0===n[5]?1:Number(n[5])/(n[6]?100:1)});return f(a)},"hsl"]],object:[[function(r){var n=r.r,e=r.g,u=r.b,o=r.a,i=void 0===o?1:o;return t(n)&&t(e)&&t(u)?a({r:Number(n),g:Number(e),b:Number(u),a:Number(i)}):null},"rgb"],[function(r){var n=r.h,e=r.s,u=r.l,a=r.a,o=void 0===a?1:a;if(!t(n)||!t(e)||!t(u))return null;var i=g({h:Number(n),s:Number(e),l:Number(u),a:Number(o)});return f(i)},"hsl"],[function(r){var n=r.h,a=r.s,o=r.v,i=r.a,s=void 0===i?1:i;if(!t(n)||!t(a)||!t(o))return null;var h=function(r){return {h:u(r.h),s:e(r.s,0,100),v:e(r.v,0,100),a:e(r.a)}}({h:Number(n),s:Number(a),v:Number(o),a:Number(s)});return b(h)},"hsv"]]},N=function(r,t){for(var n=0;n<t.length;n++){var e=t[n][0](r);if(e)return [e,t[n][1]]}return [null,void 0]},x=function(r){return "string"==typeof r?N(r.trim(),y.string):"object"==typeof r&&null!==r?N(r,y.object):[null,void 0]},M=function(r,t){var n=c(r);return {h:n.h,s:e(n.s+100*t,0,100),l:n.l,a:n.a}},H=function(r){return (299*r.r+587*r.g+114*r.b)/1e3/255},$=function(r,t){var n=c(r);return {h:n.h,s:n.s,l:e(n.l+100*t,0,100),a:n.a}},j=function(){function r(r){this.parsed=x(r)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1};}return r.prototype.isValid=function(){return null!==this.parsed},r.prototype.brightness=function(){return n(H(this.rgba),2)},r.prototype.isDark=function(){return H(this.rgba)<.5},r.prototype.isLight=function(){return H(this.rgba)>=.5},r.prototype.toHex=function(){return r=o(this.rgba),t=r.r,e=r.g,u=r.b,i=(a=r.a)<1?s(n(255*a)):"","#"+s(t)+s(e)+s(u)+i;var r,t,e,u,a,i;},r.prototype.toRgb=function(){return o(this.rgba)},r.prototype.toRgbString=function(){return r=o(this.rgba),t=r.r,n=r.g,e=r.b,(u=r.a)<1?"rgba("+t+", "+n+", "+e+", "+u+")":"rgb("+t+", "+n+", "+e+")";var r,t,n,e,u;},r.prototype.toHsl=function(){return d(c(this.rgba))},r.prototype.toHslString=function(){return r=d(c(this.rgba)),t=r.h,n=r.s,e=r.l,(u=r.a)<1?"hsla("+t+", "+n+"%, "+e+"%, "+u+")":"hsl("+t+", "+n+"%, "+e+"%)";var r,t,n,e,u;},r.prototype.toHsv=function(){return r=h(this.rgba),{h:n(r.h),s:n(r.s),v:n(r.v),a:n(r.a,3)};var r;},r.prototype.invert=function(){return w({r:255-(r=this.rgba).r,g:255-r.g,b:255-r.b,a:r.a});var r;},r.prototype.saturate=function(r){return void 0===r&&(r=.1),w(M(this.rgba,r))},r.prototype.desaturate=function(r){return void 0===r&&(r=.1),w(M(this.rgba,-r))},r.prototype.grayscale=function(){return w(M(this.rgba,-1))},r.prototype.lighten=function(r){return void 0===r&&(r=.1),w($(this.rgba,r))},r.prototype.darken=function(r){return void 0===r&&(r=.1),w($(this.rgba,-r))},r.prototype.rotate=function(r){return void 0===r&&(r=15),this.hue(this.hue()+r)},r.prototype.alpha=function(r){return "number"==typeof r?w({r:(t=this.rgba).r,g:t.g,b:t.b,a:r}):n(this.rgba.a,3);var t;},r.prototype.hue=function(r){var t=c(this.rgba);return "number"==typeof r?w({h:r,s:t.s,l:t.l,a:t.a}):n(t.h)},r.prototype.isEqual=function(r){return this.toHex()===w(r).toHex()},r}(),w=function(r){return r instanceof j?r:new j(r)};
1052
79
 
1053
80
  const PRESET_COLORS = [
@@ -1205,7 +232,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1205
232
  const cssModules = {
1206
233
  "$style": style0
1207
234
  };
1208
- const Component = /* @__PURE__ */ _export_sfc$1(_sfc_main, [["__cssModules", cssModules]]);
235
+ const Component = /* @__PURE__ */ _export_sfc(_sfc_main, [["__cssModules", cssModules]]);
1209
236
 
1210
237
  const __vite_glob_0_6 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
1211
238
  __proto__: null,