@pixelium/web-vue 0.0.1-beta → 0.0.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.
Files changed (199) hide show
  1. package/README.md +21 -10
  2. package/README.zh.md +21 -10
  3. package/dist/icon-pa.d.ts +490 -0
  4. package/dist/index.d.ts +1586 -10
  5. package/dist/pixelium-vue-icon-pa.cjs +1 -0
  6. package/dist/pixelium-vue-icon-pa.css +1 -0
  7. package/dist/pixelium-vue-icon-pa.js +10143 -0
  8. package/dist/pixelium-vue-icon-pa.umd.cjs +1 -0
  9. package/dist/pixelium-vue.cjs +12 -1
  10. package/dist/pixelium-vue.css +1 -1
  11. package/dist/pixelium-vue.js +5368 -1093
  12. package/dist/pixelium-vue.umd.cjs +12 -1
  13. package/es/aside/css.js +1 -1
  14. package/es/aside/index.js +60 -13
  15. package/es/auto-complete/css.js +2 -0
  16. package/es/auto-complete/draw.d.ts +2 -0
  17. package/es/auto-complete/draw.js +52 -0
  18. package/es/auto-complete/index.css +123 -0
  19. package/es/auto-complete/index.d.ts +35 -0
  20. package/es/auto-complete/index.js +402 -0
  21. package/es/auto-complete/type.d.ts +192 -0
  22. package/es/button/css.js +1 -1
  23. package/es/button/draw.d.ts +1 -2
  24. package/es/button/draw.js +105 -123
  25. package/es/button/index.css +24 -14
  26. package/es/button/index.js +70 -121
  27. package/es/button-group/css.js +1 -1
  28. package/es/button-group/index.d.ts +0 -1
  29. package/es/button-group/index.js +11 -37
  30. package/es/button-group/type.d.ts +1 -1
  31. package/es/col/css.js +1 -1
  32. package/es/col/index.d.ts +2 -2
  33. package/es/container/css.js +1 -1
  34. package/es/divider/css.js +1 -1
  35. package/es/empty/css.js +2 -0
  36. package/es/empty/index.css +19 -0
  37. package/es/empty/index.d.ts +17 -0
  38. package/es/empty/index.js +73 -0
  39. package/es/empty/type.d.ts +19 -0
  40. package/es/footer/css.js +1 -1
  41. package/es/grid/css.js +1 -1
  42. package/es/grid/index.js +5 -1
  43. package/es/grid-item/css.js +1 -1
  44. package/es/grid-item/index.d.ts +1 -1
  45. package/es/grid-item/index.js +7 -3
  46. package/es/header/css.js +1 -1
  47. package/es/icon/css.js +1 -1
  48. package/es/icon/index.css +0 -3
  49. package/es/icon/index.js +1 -1
  50. package/es/icons/css-pa.js +2 -0
  51. package/es/icons/icon-hn.js +1 -1
  52. package/es/icons/icon-pa.css +9 -0
  53. package/es/icons/icon-pa.d.ts +490 -0
  54. package/es/icons/icon-pa.js +17449 -0
  55. package/es/index.css +22 -8
  56. package/es/index.d.ts +18 -1
  57. package/es/index.js +63 -2
  58. package/es/input/css.js +2 -0
  59. package/es/input/draw.d.ts +2 -0
  60. package/es/input/draw.js +52 -0
  61. package/es/input/index.css +138 -0
  62. package/es/input/index.d.ts +50 -0
  63. package/es/input/index.js +432 -0
  64. package/es/input/type.d.ts +175 -0
  65. package/es/input-group/css.js +2 -0
  66. package/es/input-group/index.css +24 -0
  67. package/es/input-group/index.d.ts +17 -0
  68. package/es/input-group/index.js +40 -0
  69. package/es/input-group/type.d.ts +30 -0
  70. package/es/input-group-label/css.js +2 -0
  71. package/es/input-group-label/draw.d.ts +2 -0
  72. package/es/input-group-label/draw.js +52 -0
  73. package/es/input-group-label/index.css +50 -0
  74. package/es/input-group-label/index.d.ts +16 -0
  75. package/es/input-group-label/index.js +129 -0
  76. package/es/input-group-label/type.d.ts +30 -0
  77. package/es/input-number/css.js +2 -0
  78. package/es/input-number/draw.d.ts +2 -0
  79. package/es/input-number/draw.js +52 -0
  80. package/es/input-number/index.css +161 -0
  81. package/es/input-number/index.d.ts +47 -0
  82. package/es/input-number/index.js +543 -0
  83. package/es/input-number/type.d.ts +183 -0
  84. package/es/input-tag/css.js +2 -0
  85. package/es/input-tag/draw.d.ts +2 -0
  86. package/es/input-tag/draw.js +49 -0
  87. package/es/input-tag/index.css +133 -0
  88. package/es/input-tag/index.d.ts +73 -0
  89. package/es/input-tag/index.js +474 -0
  90. package/es/input-tag/type.d.ts +212 -0
  91. package/es/link/css.js +1 -1
  92. package/es/link/index.css +2 -5
  93. package/es/link/index.js +10 -6
  94. package/es/main/css.js +1 -1
  95. package/es/mask/css.js +2 -0
  96. package/es/mask/index.css +17 -0
  97. package/es/mask/index.d.ts +8 -0
  98. package/es/mask/index.js +117 -0
  99. package/es/mask/type.d.ts +27 -0
  100. package/es/message/css.js +1 -1
  101. package/es/message/index.css +26 -26
  102. package/es/message/index.d.ts +1 -1
  103. package/es/message/index.js +22 -50
  104. package/es/message-box/css.js +1 -1
  105. package/es/message-box/index.js +40 -30
  106. package/es/message-box/message-box-wrapped.d.ts +0 -1
  107. package/es/message-box/message-box-wrapped.js +2 -2
  108. package/es/message-box/message-box.d.ts +2 -1
  109. package/es/message-box/message-box.js +10 -8
  110. package/es/message-box/type.d.ts +14 -4
  111. package/es/option-list/css.js +2 -0
  112. package/es/option-list/index.css +57 -0
  113. package/es/option-list/index.d.ts +38 -0
  114. package/es/option-list/index.js +169 -0
  115. package/es/option-list/type.d.ts +16 -0
  116. package/es/popover/css.js +1 -0
  117. package/es/popover/index.d.ts +203 -0
  118. package/es/popover/index.js +240 -0
  119. package/es/popover/type.d.ts +100 -0
  120. package/es/popup-content/css.js +2 -0
  121. package/es/popup-content/draw.d.ts +6 -0
  122. package/es/popup-content/draw.js +151 -0
  123. package/es/popup-content/index.css +99 -0
  124. package/es/popup-content/index.d.ts +30 -0
  125. package/es/popup-content/index.js +1578 -0
  126. package/es/popup-content/type.d.ts +20 -0
  127. package/es/popup-trigger/css.js +1 -0
  128. package/es/popup-trigger/index.d.ts +22 -0
  129. package/es/popup-trigger/index.js +97 -0
  130. package/es/popup-trigger/type.d.ts +9 -0
  131. package/es/row/css.js +1 -1
  132. package/es/select/css.js +2 -0
  133. package/es/select/draw.d.ts +2 -0
  134. package/es/select/draw.js +52 -0
  135. package/es/select/index.css +152 -0
  136. package/es/select/index.d.ts +44 -0
  137. package/es/select/index.js +674 -0
  138. package/es/select/type.d.ts +252 -0
  139. package/es/share/const/event-bus-key.d.ts +4 -0
  140. package/es/share/const/event-bus-key.js +10 -0
  141. package/es/share/const/index.d.ts +4 -0
  142. package/es/share/const/index.js +11 -2
  143. package/es/share/const/provide-key.d.ts +3 -0
  144. package/es/share/const/provide-key.js +8 -0
  145. package/es/share/hook/use-click-outside-listener.d.ts +4 -0
  146. package/es/share/hook/use-click-outside-listener.js +44 -0
  147. package/es/share/hook/use-composition.d.ts +5 -0
  148. package/es/share/hook/use-composition.js +17 -0
  149. package/es/share/hook/use-controlled-mode.d.ts +6 -0
  150. package/es/share/hook/use-controlled-mode.js +25 -0
  151. package/es/share/hook/use-dark-mode.js +11 -3
  152. package/es/share/hook/use-index-of-children.d.ts +2 -1
  153. package/es/share/hook/use-index-of-children.js +25 -35
  154. package/es/share/hook/use-resize-observer.js +1 -1
  155. package/es/share/hook/use-textarea-height.d.ts +5 -0
  156. package/es/share/hook/use-textarea-height.js +116 -0
  157. package/es/share/hook/use-watch-global-css-var.d.ts +1 -0
  158. package/es/share/hook/use-watch-global-css-var.js +19 -0
  159. package/es/share/hook/use-z-index.d.ts +6 -0
  160. package/es/share/hook/use-z-index.js +32 -0
  161. package/es/share/type/index.d.ts +9 -1
  162. package/es/share/util/color.js +4 -2
  163. package/es/share/util/common.d.ts +5 -0
  164. package/es/share/util/common.js +71 -0
  165. package/es/share/util/event-bus.d.ts +1 -0
  166. package/es/share/util/event-bus.js +20 -0
  167. package/es/share/util/plot.d.ts +15 -2
  168. package/es/share/util/plot.js +200 -30
  169. package/es/share/util/render.d.ts +1 -0
  170. package/es/share/util/render.js +10 -2
  171. package/es/share/util/theme.js +23 -4
  172. package/es/space/css.js +1 -1
  173. package/es/space/index.css +5 -0
  174. package/es/space/index.js +2 -2
  175. package/es/spin/css.js +2 -0
  176. package/es/spin/index.css +66 -0
  177. package/es/spin/index.d.ts +24 -0
  178. package/es/spin/index.js +104 -0
  179. package/es/spin/type.d.ts +54 -0
  180. package/es/tag/css.js +2 -0
  181. package/es/tag/draw.d.ts +6 -0
  182. package/es/tag/draw.js +135 -0
  183. package/es/tag/index.css +372 -0
  184. package/es/tag/index.d.ts +23 -0
  185. package/es/tag/index.js +193 -0
  186. package/es/tag/type.d.ts +58 -0
  187. package/es/textarea/css.js +2 -0
  188. package/es/textarea/draw.d.ts +2 -0
  189. package/es/textarea/draw.js +13 -0
  190. package/es/textarea/index.css +108 -0
  191. package/es/textarea/index.d.ts +49 -0
  192. package/es/textarea/index.js +267 -0
  193. package/es/textarea/type.d.ts +169 -0
  194. package/es/tooltip/css.js +1 -0
  195. package/es/tooltip/index.d.ts +20 -0
  196. package/es/tooltip/index.js +228 -0
  197. package/es/tooltip/type.d.ts +77 -0
  198. package/package.json +17 -3
  199. package/es/icons/{css.js → css-hn.js} +1 -1
@@ -0,0 +1,674 @@
1
+ import './css.js'
2
+ import { defineComponent, useAttrs, getCurrentInstance, ref, inject, computed, shallowRef, watch, useSlots, onMounted, nextTick, createVNode, Fragment, withDirectives, vShow, h } from "vue";
3
+ import { u as useResizeObserver } from "../share/hook/use-resize-observer.js";
4
+ import { d as drawBorder } from "./draw.js";
5
+ import { g as getGlobalThemeColor } from "../share/util/color.js";
6
+ import { c as calcPixelSize, a as canvasPreprocess, g as getBorderRadius, b as calcBorderCornerCenter, f as floodFill } from "../share/util/plot.js";
7
+ import { u as useDarkMode } from "../share/hook/use-dark-mode.js";
8
+ import { u as useComposition } from "../share/hook/use-composition.js";
9
+ import { T as TimesCircleSolid, S as SpinnerThirdSolid } from "../auto-complete/index.js";
10
+ import { u as useWatchGlobalCssVal } from "../share/hook/use-watch-global-css-var.js";
11
+ import { _ as _sfc_main$1 } from "../input-group/index.js";
12
+ import { I as INPUT_GROUP_UPDATE } from "../share/const/event-bus-key.js";
13
+ import { u as useIndexOfChildren } from "../share/hook/use-index-of-children.js";
14
+ import { I as INPUT_GROUP_PROVIDE } from "../share/const/provide-key.js";
15
+ import { _ as _sfc_main$3 } from "../popover/index.js";
16
+ import { _ as _sfc_main$5 } from "../empty/index.js";
17
+ import { _ as _sfc_main$4 } from "../option-list/index.js";
18
+ import { d as defaultFilter, a as findSameOption } from "../share/util/common.js";
19
+ import { p, d, k, N, P as Pn, e as en, $ } from "../aside/index.js";
20
+ import { G as GROUP_OPTION_TYPE, B as BORDER_CORNER_RAD_RANGE } from "../share/const/index.js";
21
+ import { u as useClickOutsideListener } from "../share/hook/use-click-outside-listener.js";
22
+ import { _ as _sfc_main$2 } from "../tag/index.js";
23
+ import { u as useControlledMode } from "../share/hook/use-controlled-mode.js";
24
+ const ANIMATION_DURATION = 250;
25
+ const _sfc_main = /* @__PURE__ */ defineComponent({
26
+ ...{
27
+ name: "Select"
28
+ },
29
+ __name: "index",
30
+ props: {
31
+ modelValue: null,
32
+ defaultValue: null,
33
+ options: {
34
+ default: () => []
35
+ },
36
+ placeholder: null,
37
+ disabled: {
38
+ type: Boolean,
39
+ default: false
40
+ },
41
+ readonly: {
42
+ type: Boolean,
43
+ default: false
44
+ },
45
+ clearable: {
46
+ type: Boolean,
47
+ default: false
48
+ },
49
+ multiple: {
50
+ type: Boolean,
51
+ default: false
52
+ },
53
+ loading: {
54
+ type: Boolean,
55
+ default: false
56
+ },
57
+ inputValue: null,
58
+ defaultInputValue: null,
59
+ filterable: {
60
+ type: Boolean,
61
+ default: false
62
+ },
63
+ shouldShowPopover: {
64
+ type: Function
65
+ },
66
+ filter: {
67
+ type: Function
68
+ },
69
+ creatable: {
70
+ type: Boolean
71
+ },
72
+ collapseTags: {
73
+ type: Boolean,
74
+ default: false
75
+ },
76
+ maxDisplayTags: null,
77
+ collapseTagsPopover: {
78
+ type: Boolean,
79
+ default: true
80
+ },
81
+ tagTheme: {
82
+ default: "info"
83
+ },
84
+ tagVariant: {
85
+ default: "plain"
86
+ },
87
+ tagColor: null,
88
+ size: {
89
+ default: "medium"
90
+ },
91
+ shape: {
92
+ default: "default"
93
+ },
94
+ borderRadius: null,
95
+ status: {
96
+ default: "normal"
97
+ }
98
+ },
99
+ emits: ["input", "update:modelValue", "update:inputValue", "change", "inputChange", "clear", "blur", "focus", "select", "tagClose"],
100
+ setup(__props, {
101
+ expose: __expose,
102
+ emit: __emit
103
+ }) {
104
+ var _a;
105
+ const attrs = useAttrs();
106
+ const pixelSize = calcPixelSize();
107
+ const props = __props;
108
+ const emits = __emit;
109
+ const [isComposing, compositionStartHandler, compositionUpdateHandler] = useComposition({
110
+ afterComposition: (e) => {
111
+ nextTick(() => {
112
+ inputHandler(e);
113
+ });
114
+ }
115
+ });
116
+ const instance = getCurrentInstance();
117
+ const innerInputGroup = ref(((_a = instance == null ? void 0 : instance.parent) == null ? void 0 : _a.type) === _sfc_main$1);
118
+ const [_, first, last] = innerInputGroup.value ? useIndexOfChildren(INPUT_GROUP_UPDATE) : [ref(0), ref(false), ref(false)];
119
+ const inputGroupProps = inject(INPUT_GROUP_PROVIDE);
120
+ const borderRadiusComputed = computed(() => {
121
+ return innerInputGroup.value && inputGroupProps ? inputGroupProps.borderRadius : props.borderRadius;
122
+ });
123
+ const sizeComputed = computed(() => {
124
+ return innerInputGroup.value && inputGroupProps ? inputGroupProps.size : props.size;
125
+ });
126
+ const shapeComputed = computed(() => {
127
+ return innerInputGroup.value && inputGroupProps ? inputGroupProps.shape : props.shape;
128
+ });
129
+ const disabledComputed = computed(() => {
130
+ return innerInputGroup.value && inputGroupProps ? inputGroupProps.disabled || props.disabled : props.disabled;
131
+ });
132
+ const modelValueIsFalse = (modelValue2) => {
133
+ return Pn(modelValue2) || en(modelValue2) || props.multiple && $(modelValue2) && modelValue2.length === 0;
134
+ };
135
+ const [modelValue, updateModelValue] = useControlledMode("modelValue", props, emits, {
136
+ defaultField: "defaultValue",
137
+ transform: (nextValue) => {
138
+ if (!props.multiple) {
139
+ return nextValue;
140
+ } else {
141
+ if (N(nextValue)) {
142
+ return;
143
+ } else if ($(nextValue)) {
144
+ return [...nextValue];
145
+ } else {
146
+ return [nextValue];
147
+ }
148
+ }
149
+ }
150
+ });
151
+ const [inputValue, updateInputValue] = useControlledMode("inputValue", props, emits, {
152
+ defaultField: "defaultInputValue",
153
+ transform: (nextValue) => {
154
+ return nextValue || "";
155
+ }
156
+ });
157
+ const currentLabelSelectedMultiple = computed(() => {
158
+ if (!props.multiple) {
159
+ return [];
160
+ }
161
+ if (!props.options.length) {
162
+ return [];
163
+ }
164
+ if (modelValueIsFalse(modelValue.value)) {
165
+ return [];
166
+ }
167
+ const labelMap = /* @__PURE__ */ new Map();
168
+ props.options.forEach((option) => {
169
+ if (p(option)) {
170
+ labelMap.set(option, option);
171
+ } else if ("type" in option && option.type === GROUP_OPTION_TYPE) {
172
+ return option.children.some((child) => {
173
+ if (p(child)) {
174
+ labelMap.set(child, child);
175
+ } else {
176
+ labelMap.set(child.value, child.label);
177
+ }
178
+ });
179
+ } else {
180
+ labelMap.set(option.value, option.label);
181
+ }
182
+ });
183
+ return modelValue.value.map((e) => labelMap.has(e) ? labelMap.get(e) : String(e));
184
+ });
185
+ const currentLabelSelected = computed(() => {
186
+ if (props.multiple) {
187
+ return "";
188
+ }
189
+ if (!props.options.length) {
190
+ return "";
191
+ }
192
+ if (modelValueIsFalse(modelValue.value)) {
193
+ return "";
194
+ }
195
+ let currentLabel = String(modelValue.value);
196
+ props.options.some((option) => {
197
+ if (p(option)) {
198
+ return modelValue.value === option;
199
+ } else if ("type" in option && option.type === GROUP_OPTION_TYPE) {
200
+ return option.children.some((child) => {
201
+ if (p(child)) {
202
+ return modelValue.value === child;
203
+ } else {
204
+ if (child.value === modelValue.value) {
205
+ currentLabel = child.label;
206
+ return true;
207
+ }
208
+ return false;
209
+ }
210
+ });
211
+ } else {
212
+ if (option.value === modelValue.value) {
213
+ currentLabel = option.label;
214
+ return true;
215
+ }
216
+ return false;
217
+ }
218
+ });
219
+ return currentLabel;
220
+ });
221
+ const wrapperRef = shallowRef(null);
222
+ const canvasRef = shallowRef(null);
223
+ const inputRef = shallowRef(null);
224
+ const popoverRef = shallowRef(null);
225
+ const closeRef = shallowRef(null);
226
+ watch(() => props.multiple, (val, old) => {
227
+ if (val && !old) {
228
+ updateModelValue([modelValue.value]);
229
+ } else {
230
+ updateModelValue(modelValue.value[0] || null);
231
+ }
232
+ });
233
+ const triggerPopover = async () => {
234
+ await nextTick();
235
+ if (props.shouldShowPopover) {
236
+ popoverVisible.value = !!props.shouldShowPopover(inputValue.value || "", optionsFiltered.value);
237
+ return;
238
+ }
239
+ popoverVisible.value = true;
240
+ };
241
+ const closePopover = async () => {
242
+ popoverVisible.value = false;
243
+ };
244
+ const inputHandler = async (e) => {
245
+ e.stopPropagation();
246
+ const target = e.target;
247
+ const newValue = target.value;
248
+ inputValue.value = newValue;
249
+ if (isComposing.value) {
250
+ return;
251
+ }
252
+ emits("input", newValue, e);
253
+ updateInputValue(newValue);
254
+ await emits("update:inputValue", newValue);
255
+ triggerPopover();
256
+ };
257
+ const clearHandler = async () => {
258
+ await new Promise((res) => {
259
+ setTimeout(() => {
260
+ res();
261
+ });
262
+ });
263
+ const nextModelValue = props.multiple ? [] : null;
264
+ await updateInputValue("");
265
+ await updateModelValue(nextModelValue);
266
+ emits("change", nextModelValue);
267
+ emits("clear", nextModelValue);
268
+ emits("inputChange", "");
269
+ };
270
+ const changeHandler = (e) => {
271
+ e.stopPropagation();
272
+ const target = e.target;
273
+ emits("inputChange", target.value, e);
274
+ };
275
+ const focusMode = ref(false);
276
+ const focusImpl = () => {
277
+ focusMode.value = true;
278
+ nextTick(() => {
279
+ if (inputRef.value && props.filterable) {
280
+ inputRef.value.focus();
281
+ if (props.multiple) {
282
+ return;
283
+ }
284
+ const nextInput = modelValueIsFalse(modelValue.value) ? inputValue.value || "" : currentLabelSelected.value;
285
+ updateInputValue(nextInput);
286
+ }
287
+ });
288
+ triggerPopover();
289
+ emits("focus");
290
+ };
291
+ const focusInputHandler = (e) => {
292
+ var _a2;
293
+ const target = e.target;
294
+ if (target instanceof HTMLElement || target instanceof SVGElement) {
295
+ if ((_a2 = closeRef.value) == null ? void 0 : _a2.$el.contains(target)) {
296
+ return;
297
+ }
298
+ }
299
+ focusImpl();
300
+ };
301
+ const blurSelect = async () => {
302
+ var _a2;
303
+ focusMode.value = false;
304
+ popoverVisible.value = false;
305
+ (_a2 = inputRef.value) == null ? void 0 : _a2.blur();
306
+ setTimeout(async () => {
307
+ await updateInputValue("");
308
+ emits("inputChange", "");
309
+ }, ANIMATION_DURATION);
310
+ emits("blur");
311
+ };
312
+ useClickOutsideListener([wrapperRef, () => {
313
+ var _a2, _b;
314
+ return (_b = (_a2 = popoverRef.value) == null ? void 0 : _a2.triggerContent) == null ? void 0 : _b.content;
315
+ }], blurSelect);
316
+ const hoverFlag = ref(false);
317
+ const mouseenterHandler = () => {
318
+ hoverFlag.value = true;
319
+ };
320
+ const mouseleaveHandler = () => {
321
+ hoverFlag.value = false;
322
+ };
323
+ const showClose = computed(() => {
324
+ return props.clearable && !disabledComputed.value && !props.readonly;
325
+ });
326
+ const getNextModelValue = (value) => {
327
+ if (!props.multiple) {
328
+ return value;
329
+ } else {
330
+ if ($(modelValue.value)) {
331
+ const nextValue = [...modelValue.value];
332
+ const idx = nextValue.findIndex((e) => e === value);
333
+ if (idx === -1) {
334
+ nextValue.push(value);
335
+ } else {
336
+ nextValue.splice(idx, 1);
337
+ }
338
+ return nextValue;
339
+ } else {
340
+ return [value];
341
+ }
342
+ }
343
+ };
344
+ const selectHandler = async (value, option, e) => {
345
+ await new Promise((res) => {
346
+ setTimeout(() => {
347
+ res();
348
+ });
349
+ });
350
+ const nextValue = getNextModelValue(value);
351
+ const nextInputValue = "";
352
+ await updateModelValue(nextValue);
353
+ if (!props.multiple) {
354
+ focusMode.value = false;
355
+ closePopover();
356
+ emits("select", nextValue, option, e);
357
+ setTimeout(async () => {
358
+ await updateInputValue(nextInputValue);
359
+ }, ANIMATION_DURATION);
360
+ }
361
+ };
362
+ const slots = useSlots();
363
+ const optionsFiltered = computed(() => {
364
+ const options = props.options || [];
365
+ if (!props.filterable) {
366
+ return options;
367
+ }
368
+ let ans = [];
369
+ if (props.filter) {
370
+ ans = props.filter(inputValue.value || "", options);
371
+ } else {
372
+ ans = defaultFilter(inputValue.value || "", options);
373
+ }
374
+ if (props.multiple) {
375
+ if (!modelValueIsFalse(modelValue.value)) {
376
+ modelValue.value.forEach((e) => {
377
+ const dataInAns4E = findSameOption(e, ans);
378
+ const dataInOptions4E = findSameOption(e, options);
379
+ if (!dataInAns4E.length) {
380
+ if (!dataInOptions4E.length) {
381
+ ans.push(e);
382
+ } else if (dataInOptions4E.length === 1) {
383
+ ans.push(dataInOptions4E[0]);
384
+ } else {
385
+ const group = dataInOptions4E[1];
386
+ const idx = ans.findIndex((e2) => d(e2) && "type" in e2 && e2.type === GROUP_OPTION_TYPE && e2.key === group.key);
387
+ if (idx) {
388
+ ans[idx].children.push(dataInOptions4E[0]);
389
+ } else {
390
+ ans.push({
391
+ ...group,
392
+ children: [dataInOptions4E[0]]
393
+ });
394
+ }
395
+ }
396
+ }
397
+ });
398
+ }
399
+ }
400
+ if (props.creatable && inputValue.value) {
401
+ const flag = findSameOption(inputValue.value, ans, true).length;
402
+ if (!flag) {
403
+ ans.push(inputValue.value);
404
+ }
405
+ }
406
+ return ans;
407
+ });
408
+ __expose({
409
+ focus: focusImpl,
410
+ blur: blurSelect,
411
+ clear: () => clearHandler()
412
+ });
413
+ const popoverVisible = ref(false);
414
+ const popoverVisibleUpdateHandler = (value) => {
415
+ if (!value) {
416
+ popoverVisible.value = value;
417
+ }
418
+ };
419
+ const showPlaceholder = computed(() => {
420
+ return modelValueIsFalse(modelValue.value) && (!props.multiple && !currentLabelSelected.value || props.multiple);
421
+ });
422
+ const tagSize = computed(() => {
423
+ return sizeComputed.value === "small" ? "small" : "medium";
424
+ });
425
+ const tagCanClose = computed(() => {
426
+ return !disabledComputed.value && !props.readonly;
427
+ });
428
+ const tagCloseHandler = async (value, e) => {
429
+ const nextValue = [...modelValue.value];
430
+ const idx = nextValue.findIndex((e2) => e2 === value);
431
+ if (idx === -1) {
432
+ return;
433
+ }
434
+ nextValue.splice(idx, 1);
435
+ await updateModelValue(nextValue);
436
+ emits("tagClose", value, e);
437
+ emits("change", nextValue);
438
+ };
439
+ const shouldCollapseTags = computed(() => {
440
+ return !!props.collapseTags && k(props.maxDisplayTags) && props.maxDisplayTags >= 0;
441
+ });
442
+ const tagsShowed = computed(() => {
443
+ if (!props.multiple) {
444
+ return [];
445
+ }
446
+ if (!props.options.length) {
447
+ return [];
448
+ }
449
+ if (N(modelValue.value)) {
450
+ return [];
451
+ }
452
+ return shouldCollapseTags.value ? modelValue.value.slice(0, props.maxDisplayTags) : modelValue.value;
453
+ });
454
+ const tagsCollapsed = computed(() => {
455
+ if (!props.multiple) {
456
+ return [];
457
+ }
458
+ if (!props.options.length) {
459
+ return [];
460
+ }
461
+ if (N(modelValue.value)) {
462
+ return [];
463
+ }
464
+ return shouldCollapseTags.value ? modelValue.value.slice(props.maxDisplayTags) : [];
465
+ });
466
+ const darkMode = useDarkMode();
467
+ watch([first, last, borderRadiusComputed, shapeComputed, sizeComputed, disabledComputed, () => slots, darkMode, focusMode, hoverFlag], () => {
468
+ setTimeout(() => {
469
+ drawPixel();
470
+ });
471
+ });
472
+ const drawPixel = () => {
473
+ const preprocessData = canvasPreprocess(wrapperRef, canvasRef);
474
+ if (!preprocessData) {
475
+ return;
476
+ }
477
+ const {
478
+ ctx,
479
+ width,
480
+ height,
481
+ canvas
482
+ } = preprocessData;
483
+ const pixelSize2 = calcPixelSize();
484
+ const borderRadius = getBorderRadius(canvas, pixelSize2, borderRadiusComputed.value, shapeComputed.value, sizeComputed.value || "medium", innerInputGroup.value, first.value, last.value);
485
+ const borderColor = props.status !== "normal" ? getGlobalThemeColor(props.status === "error" ? "danger" : props.status, 6) : (hoverFlag.value || focusMode.value) && !disabledComputed.value && !props.readonly ? getGlobalThemeColor("primary", 6) : getGlobalThemeColor("neutral", 10);
486
+ const center = calcBorderCornerCenter(borderRadius, width, height, pixelSize2);
487
+ const rad = BORDER_CORNER_RAD_RANGE;
488
+ drawBorder(ctx, width, height, center, borderRadius, rad, borderColor, pixelSize2, innerInputGroup.value, first.value, last.value);
489
+ const backgroundColor = disabledComputed.value ? getGlobalThemeColor("neutral", 6) : getGlobalThemeColor("neutral", 1);
490
+ floodFill(ctx, Math.round(width / 2), Math.round(height / 2), backgroundColor);
491
+ };
492
+ onMounted(() => {
493
+ nextTick(() => {
494
+ drawPixel();
495
+ });
496
+ });
497
+ useResizeObserver(wrapperRef, drawPixel);
498
+ useWatchGlobalCssVal(drawPixel);
499
+ const stopHandler = (e) => {
500
+ e.stopPropagation();
501
+ };
502
+ return () => {
503
+ const Inner = createVNode(Fragment, null, [slots.prefix && createVNode("div", {
504
+ "class": "px-select-prefix-wrapper"
505
+ }, [slots.prefix()]), createVNode("div", {
506
+ "class": "px-select-content"
507
+ }, [props.multiple && tagsShowed.value.map((e, index) => {
508
+ return createVNode(_sfc_main$2, {
509
+ "key": e,
510
+ "size": tagSize.value,
511
+ "variant": props.tagVariant,
512
+ "theme": props.tagTheme,
513
+ "closable": tagCanClose.value,
514
+ "disabled": disabledComputed.value,
515
+ "color": props.tagColor,
516
+ "onClose": (event) => tagCloseHandler(e, event)
517
+ }, {
518
+ default: () => slots.tag ? slots.tag({
519
+ value: e,
520
+ label: currentLabelSelectedMultiple.value[index],
521
+ index
522
+ }) : currentLabelSelectedMultiple.value[index]
523
+ });
524
+ }), props.multiple && !!tagsCollapsed.value.length && shouldCollapseTags.value && createVNode(Fragment, null, [!props.collapseTagsPopover ? createVNode(_sfc_main$2, {
525
+ "size": tagSize.value,
526
+ "variant": props.tagVariant,
527
+ "theme": props.tagTheme,
528
+ "disabled": disabledComputed.value,
529
+ "color": props.tagColor
530
+ }, {
531
+ default: () => slots.tag ? slots.tag({
532
+ value: null,
533
+ label: `+${tagsCollapsed.value.length}`,
534
+ index: -1
535
+ }) : `+${tagsCollapsed.value.length}`
536
+ }) : createVNode(_sfc_main$3, null, {
537
+ default: () => createVNode(_sfc_main$2, {
538
+ "size": tagSize.value,
539
+ "variant": props.tagVariant,
540
+ "theme": props.tagTheme,
541
+ "disabled": disabledComputed.value,
542
+ "color": props.tagColor
543
+ }, {
544
+ default: () => slots.tag ? slots.tag({
545
+ value: null,
546
+ label: `+${tagsCollapsed.value.length}`,
547
+ index: -1
548
+ }) : `+${tagsCollapsed.value.length}`
549
+ }),
550
+ content: () => createVNode("div", {
551
+ "class": "px-input-tag-content"
552
+ }, [tagsCollapsed.value.map((e, index) => {
553
+ return createVNode(_sfc_main$2, {
554
+ "key": e,
555
+ "size": tagSize.value,
556
+ "variant": props.tagVariant,
557
+ "theme": props.tagTheme,
558
+ "disabled": disabledComputed.value,
559
+ "color": props.tagColor,
560
+ "closable": tagCanClose.value,
561
+ "onClose": (event) => tagCloseHandler(e, event)
562
+ }, {
563
+ default: () => {
564
+ const currentIndex = index + Math.floor(props.maxDisplayTags);
565
+ return slots.tag ? slots.tag({
566
+ value: e,
567
+ label: currentLabelSelectedMultiple.value[currentIndex],
568
+ index: currentIndex
569
+ }) : currentLabelSelectedMultiple.value[currentIndex];
570
+ }
571
+ });
572
+ })])
573
+ })]), withDirectives(createVNode("input", {
574
+ "ref": inputRef,
575
+ "class": "px-select-inner",
576
+ "value": inputValue.value,
577
+ "disabled": disabledComputed.value || props.readonly,
578
+ "onInput": inputHandler,
579
+ "onChange": changeHandler,
580
+ "onFocus": stopHandler,
581
+ "onBlur": stopHandler,
582
+ "onCompositionstart": compositionStartHandler,
583
+ "onCompositionend": compositionUpdateHandler,
584
+ "placeholder": showPlaceholder.value ? props.placeholder : ""
585
+ }, null), [[vShow, props.filterable && focusMode.value]]), withDirectives(createVNode("div", {
586
+ "class": {
587
+ "px-select-placeholder": true
588
+ }
589
+ }, [props.placeholder]), [[vShow, showPlaceholder.value && (!props.filterable || !focusMode.value)]]), !props.multiple && withDirectives(createVNode("div", {
590
+ "class": {
591
+ "px-select-label": true,
592
+ "px-select-label__disabled": disabledComputed.value
593
+ }
594
+ }, [currentLabelSelected.value]), [[vShow, !showPlaceholder.value && (!props.filterable || !focusMode.value)]])]), showClose.value && createVNode("div", {
595
+ "class": "px-select-close-wrapper"
596
+ }, [hoverFlag.value && !modelValueIsFalse(modelValue.value) ? createVNode(TimesCircleSolid, {
597
+ "class": "px-select-icon",
598
+ "onClick": clearHandler,
599
+ "ref": (el) => {
600
+ closeRef.value = el;
601
+ }
602
+ }, null) : createVNode("div", {
603
+ "class": "px-select-icon-placeholder"
604
+ }, null)]), props.loading && createVNode("div", {
605
+ "class": "px-select-loading-wrapper"
606
+ }, [createVNode(SpinnerThirdSolid, {
607
+ "class": "px-select-icon px-animation__loading"
608
+ }, null)]), slots.suffix && createVNode("div", {
609
+ "class": "px-select-suffix-wrapper"
610
+ }, [slots.suffix()]), createVNode("canvas", {
611
+ "ref": canvasRef,
612
+ "class": "px-select-canvas"
613
+ }, null)]);
614
+ const scopeObj = {};
615
+ const scopeId = instance == null ? void 0 : instance.vnode.scopeId;
616
+ const parentScopeId = instance == null ? void 0 : instance.vnode.scopeId;
617
+ if (scopeId) {
618
+ scopeObj[scopeId] = "";
619
+ }
620
+ if (parentScopeId) {
621
+ scopeObj[parentScopeId] = "";
622
+ }
623
+ const Render = createVNode(_sfc_main$3, {
624
+ "placement": "bottom",
625
+ "offset": 0,
626
+ "width-equal": true,
627
+ "arrow": false,
628
+ "visible": popoverVisible.value,
629
+ "onUpdate:visible": popoverVisibleUpdateHandler,
630
+ "trigger": "click",
631
+ "contentStyle": {
632
+ padding: `${pixelSize}px`
633
+ },
634
+ "ref": popoverRef
635
+ }, {
636
+ default: () => h("div", {
637
+ ref: wrapperRef,
638
+ class: ["pixelium px-select", sizeComputed.value && `px-select__${sizeComputed.value}`, shapeComputed.value && `px-select__${shapeComputed.value}`, {
639
+ "px-select__inner": innerInputGroup.value
640
+ }, {
641
+ "px-select__disabled": disabledComputed.value
642
+ }],
643
+ onClick: focusInputHandler,
644
+ onMouseenter: mouseenterHandler,
645
+ onMouseleave: mouseleaveHandler,
646
+ ...scopeObj,
647
+ ...attrs
648
+ }, [Inner]),
649
+ content: () => optionsFiltered.value.length ? createVNode(_sfc_main$4, {
650
+ "options": optionsFiltered.value,
651
+ "onSelect": selectHandler,
652
+ "activeValues": props.multiple ? modelValue.value : [modelValue.value]
653
+ }, {
654
+ "group-label": ({
655
+ option
656
+ }) => slots["group-label"] ? slots["group-label"]({
657
+ option
658
+ }) : option.label,
659
+ option: ({
660
+ option
661
+ }) => slots.option ? slots.option({
662
+ option
663
+ }) : p(option) ? option : option.label
664
+ }) : createVNode("div", {
665
+ "class": "px-select-empty"
666
+ }, [createVNode(_sfc_main$5, null, null)])
667
+ });
668
+ return Render;
669
+ };
670
+ }
671
+ });
672
+ export {
673
+ _sfc_main as _
674
+ };