@pixelium/web-vue 0.0.1-beta → 0.0.2-fix

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 +5370 -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 +677 -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,677 @@
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
+ if (disabledComputed.value || props.readonly) {
294
+ return;
295
+ }
296
+ const target = e.target;
297
+ if (target instanceof HTMLElement || target instanceof SVGElement) {
298
+ if ((_a2 = closeRef.value) == null ? void 0 : _a2.$el.contains(target)) {
299
+ return;
300
+ }
301
+ }
302
+ focusImpl();
303
+ };
304
+ const blurSelect = async () => {
305
+ var _a2;
306
+ focusMode.value = false;
307
+ popoverVisible.value = false;
308
+ (_a2 = inputRef.value) == null ? void 0 : _a2.blur();
309
+ setTimeout(async () => {
310
+ await updateInputValue("");
311
+ emits("inputChange", "");
312
+ }, ANIMATION_DURATION);
313
+ emits("blur");
314
+ };
315
+ useClickOutsideListener([wrapperRef, () => {
316
+ var _a2, _b;
317
+ return (_b = (_a2 = popoverRef.value) == null ? void 0 : _a2.triggerContent) == null ? void 0 : _b.content;
318
+ }], blurSelect);
319
+ const hoverFlag = ref(false);
320
+ const mouseenterHandler = () => {
321
+ hoverFlag.value = true;
322
+ };
323
+ const mouseleaveHandler = () => {
324
+ hoverFlag.value = false;
325
+ };
326
+ const showClose = computed(() => {
327
+ return props.clearable && !disabledComputed.value && !props.readonly;
328
+ });
329
+ const getNextModelValue = (value) => {
330
+ if (!props.multiple) {
331
+ return value;
332
+ } else {
333
+ if ($(modelValue.value)) {
334
+ const nextValue = [...modelValue.value];
335
+ const idx = nextValue.findIndex((e) => e === value);
336
+ if (idx === -1) {
337
+ nextValue.push(value);
338
+ } else {
339
+ nextValue.splice(idx, 1);
340
+ }
341
+ return nextValue;
342
+ } else {
343
+ return [value];
344
+ }
345
+ }
346
+ };
347
+ const selectHandler = async (value, option, e) => {
348
+ await new Promise((res) => {
349
+ setTimeout(() => {
350
+ res();
351
+ });
352
+ });
353
+ const nextValue = getNextModelValue(value);
354
+ const nextInputValue = "";
355
+ await updateModelValue(nextValue);
356
+ if (!props.multiple) {
357
+ focusMode.value = false;
358
+ closePopover();
359
+ emits("select", nextValue, option, e);
360
+ setTimeout(async () => {
361
+ await updateInputValue(nextInputValue);
362
+ }, ANIMATION_DURATION);
363
+ }
364
+ };
365
+ const slots = useSlots();
366
+ const optionsFiltered = computed(() => {
367
+ const options = props.options || [];
368
+ if (!props.filterable) {
369
+ return options;
370
+ }
371
+ let ans = [];
372
+ if (props.filter) {
373
+ ans = props.filter(inputValue.value || "", options);
374
+ } else {
375
+ ans = defaultFilter(inputValue.value || "", options);
376
+ }
377
+ if (props.multiple) {
378
+ if (!modelValueIsFalse(modelValue.value)) {
379
+ modelValue.value.forEach((e) => {
380
+ const dataInAns4E = findSameOption(e, ans);
381
+ const dataInOptions4E = findSameOption(e, options);
382
+ if (!dataInAns4E.length) {
383
+ if (!dataInOptions4E.length) {
384
+ ans.push(e);
385
+ } else if (dataInOptions4E.length === 1) {
386
+ ans.push(dataInOptions4E[0]);
387
+ } else {
388
+ const group = dataInOptions4E[1];
389
+ const idx = ans.findIndex((e2) => d(e2) && "type" in e2 && e2.type === GROUP_OPTION_TYPE && e2.key === group.key);
390
+ if (idx) {
391
+ ans[idx].children.push(dataInOptions4E[0]);
392
+ } else {
393
+ ans.push({
394
+ ...group,
395
+ children: [dataInOptions4E[0]]
396
+ });
397
+ }
398
+ }
399
+ }
400
+ });
401
+ }
402
+ }
403
+ if (props.creatable && inputValue.value) {
404
+ const flag = findSameOption(inputValue.value, ans, true).length;
405
+ if (!flag) {
406
+ ans.push(inputValue.value);
407
+ }
408
+ }
409
+ return ans;
410
+ });
411
+ __expose({
412
+ focus: focusImpl,
413
+ blur: blurSelect,
414
+ clear: () => clearHandler()
415
+ });
416
+ const popoverVisible = ref(false);
417
+ const popoverVisibleUpdateHandler = (value) => {
418
+ if (!value) {
419
+ popoverVisible.value = value;
420
+ }
421
+ };
422
+ const showPlaceholder = computed(() => {
423
+ return modelValueIsFalse(modelValue.value) && (!props.multiple && !currentLabelSelected.value || props.multiple);
424
+ });
425
+ const tagSize = computed(() => {
426
+ return sizeComputed.value === "small" ? "small" : "medium";
427
+ });
428
+ const tagCanClose = computed(() => {
429
+ return !disabledComputed.value && !props.readonly;
430
+ });
431
+ const tagCloseHandler = async (value, e) => {
432
+ const nextValue = [...modelValue.value];
433
+ const idx = nextValue.findIndex((e2) => e2 === value);
434
+ if (idx === -1) {
435
+ return;
436
+ }
437
+ nextValue.splice(idx, 1);
438
+ await updateModelValue(nextValue);
439
+ emits("tagClose", value, e);
440
+ emits("change", nextValue);
441
+ };
442
+ const shouldCollapseTags = computed(() => {
443
+ return !!props.collapseTags && k(props.maxDisplayTags) && props.maxDisplayTags >= 0;
444
+ });
445
+ const tagsShowed = computed(() => {
446
+ if (!props.multiple) {
447
+ return [];
448
+ }
449
+ if (!props.options.length) {
450
+ return [];
451
+ }
452
+ if (N(modelValue.value)) {
453
+ return [];
454
+ }
455
+ return shouldCollapseTags.value ? modelValue.value.slice(0, props.maxDisplayTags) : modelValue.value;
456
+ });
457
+ const tagsCollapsed = computed(() => {
458
+ if (!props.multiple) {
459
+ return [];
460
+ }
461
+ if (!props.options.length) {
462
+ return [];
463
+ }
464
+ if (N(modelValue.value)) {
465
+ return [];
466
+ }
467
+ return shouldCollapseTags.value ? modelValue.value.slice(props.maxDisplayTags) : [];
468
+ });
469
+ const darkMode = useDarkMode();
470
+ watch([first, last, borderRadiusComputed, shapeComputed, sizeComputed, disabledComputed, () => slots, darkMode, focusMode, hoverFlag], () => {
471
+ setTimeout(() => {
472
+ drawPixel();
473
+ });
474
+ });
475
+ const drawPixel = () => {
476
+ const preprocessData = canvasPreprocess(wrapperRef, canvasRef);
477
+ if (!preprocessData) {
478
+ return;
479
+ }
480
+ const {
481
+ ctx,
482
+ width,
483
+ height,
484
+ canvas
485
+ } = preprocessData;
486
+ const pixelSize2 = calcPixelSize();
487
+ const borderRadius = getBorderRadius(canvas, pixelSize2, borderRadiusComputed.value, shapeComputed.value, sizeComputed.value || "medium", innerInputGroup.value, first.value, last.value);
488
+ 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);
489
+ const center = calcBorderCornerCenter(borderRadius, width, height, pixelSize2);
490
+ const rad = BORDER_CORNER_RAD_RANGE;
491
+ drawBorder(ctx, width, height, center, borderRadius, rad, borderColor, pixelSize2, innerInputGroup.value, first.value, last.value);
492
+ const backgroundColor = disabledComputed.value ? getGlobalThemeColor("neutral", 6) : getGlobalThemeColor("neutral", 1);
493
+ floodFill(ctx, Math.round(width / 2), Math.round(height / 2), backgroundColor);
494
+ };
495
+ onMounted(() => {
496
+ nextTick(() => {
497
+ drawPixel();
498
+ });
499
+ });
500
+ useResizeObserver(wrapperRef, drawPixel);
501
+ useWatchGlobalCssVal(drawPixel);
502
+ const stopHandler = (e) => {
503
+ e.stopPropagation();
504
+ };
505
+ return () => {
506
+ const Inner = createVNode(Fragment, null, [slots.prefix && createVNode("div", {
507
+ "class": "px-select-prefix-wrapper"
508
+ }, [slots.prefix()]), createVNode("div", {
509
+ "class": "px-select-content"
510
+ }, [props.multiple && tagsShowed.value.map((e, index) => {
511
+ return createVNode(_sfc_main$2, {
512
+ "key": e,
513
+ "size": tagSize.value,
514
+ "variant": props.tagVariant,
515
+ "theme": props.tagTheme,
516
+ "closable": tagCanClose.value,
517
+ "disabled": disabledComputed.value,
518
+ "color": props.tagColor,
519
+ "onClose": (event) => tagCloseHandler(e, event)
520
+ }, {
521
+ default: () => slots.tag ? slots.tag({
522
+ value: e,
523
+ label: currentLabelSelectedMultiple.value[index],
524
+ index
525
+ }) : currentLabelSelectedMultiple.value[index]
526
+ });
527
+ }), props.multiple && !!tagsCollapsed.value.length && shouldCollapseTags.value && createVNode(Fragment, null, [!props.collapseTagsPopover ? createVNode(_sfc_main$2, {
528
+ "size": tagSize.value,
529
+ "variant": props.tagVariant,
530
+ "theme": props.tagTheme,
531
+ "disabled": disabledComputed.value,
532
+ "color": props.tagColor
533
+ }, {
534
+ default: () => slots.tag ? slots.tag({
535
+ value: null,
536
+ label: `+${tagsCollapsed.value.length}`,
537
+ index: -1
538
+ }) : `+${tagsCollapsed.value.length}`
539
+ }) : createVNode(_sfc_main$3, null, {
540
+ default: () => createVNode(_sfc_main$2, {
541
+ "size": tagSize.value,
542
+ "variant": props.tagVariant,
543
+ "theme": props.tagTheme,
544
+ "disabled": disabledComputed.value,
545
+ "color": props.tagColor
546
+ }, {
547
+ default: () => slots.tag ? slots.tag({
548
+ value: null,
549
+ label: `+${tagsCollapsed.value.length}`,
550
+ index: -1
551
+ }) : `+${tagsCollapsed.value.length}`
552
+ }),
553
+ content: () => createVNode("div", {
554
+ "class": "px-input-tag-content"
555
+ }, [tagsCollapsed.value.map((e, index) => {
556
+ return createVNode(_sfc_main$2, {
557
+ "key": e,
558
+ "size": tagSize.value,
559
+ "variant": props.tagVariant,
560
+ "theme": props.tagTheme,
561
+ "disabled": disabledComputed.value,
562
+ "color": props.tagColor,
563
+ "closable": tagCanClose.value,
564
+ "onClose": (event) => tagCloseHandler(e, event)
565
+ }, {
566
+ default: () => {
567
+ const currentIndex = index + Math.floor(props.maxDisplayTags);
568
+ return slots.tag ? slots.tag({
569
+ value: e,
570
+ label: currentLabelSelectedMultiple.value[currentIndex],
571
+ index: currentIndex
572
+ }) : currentLabelSelectedMultiple.value[currentIndex];
573
+ }
574
+ });
575
+ })])
576
+ })]), withDirectives(createVNode("input", {
577
+ "ref": inputRef,
578
+ "class": "px-select-inner",
579
+ "value": inputValue.value,
580
+ "disabled": disabledComputed.value || props.readonly,
581
+ "onInput": inputHandler,
582
+ "onChange": changeHandler,
583
+ "onFocus": stopHandler,
584
+ "onBlur": stopHandler,
585
+ "onCompositionstart": compositionStartHandler,
586
+ "onCompositionend": compositionUpdateHandler,
587
+ "placeholder": showPlaceholder.value ? props.placeholder : ""
588
+ }, null), [[vShow, props.filterable && focusMode.value]]), withDirectives(createVNode("div", {
589
+ "class": {
590
+ "px-select-placeholder": true
591
+ }
592
+ }, [props.placeholder]), [[vShow, showPlaceholder.value && (!props.filterable || !focusMode.value)]]), !props.multiple && withDirectives(createVNode("div", {
593
+ "class": {
594
+ "px-select-label": true,
595
+ "px-select-label__disabled": disabledComputed.value
596
+ }
597
+ }, [currentLabelSelected.value]), [[vShow, !showPlaceholder.value && (!props.filterable || !focusMode.value)]])]), showClose.value && createVNode("div", {
598
+ "class": "px-select-close-wrapper"
599
+ }, [hoverFlag.value && !modelValueIsFalse(modelValue.value) ? createVNode(TimesCircleSolid, {
600
+ "class": "px-select-icon",
601
+ "onClick": clearHandler,
602
+ "ref": (el) => {
603
+ closeRef.value = el;
604
+ }
605
+ }, null) : createVNode("div", {
606
+ "class": "px-select-icon-placeholder"
607
+ }, null)]), props.loading && createVNode("div", {
608
+ "class": "px-select-loading-wrapper"
609
+ }, [createVNode(SpinnerThirdSolid, {
610
+ "class": "px-select-icon px-animation__loading"
611
+ }, null)]), slots.suffix && createVNode("div", {
612
+ "class": "px-select-suffix-wrapper"
613
+ }, [slots.suffix()]), createVNode("canvas", {
614
+ "ref": canvasRef,
615
+ "class": "px-select-canvas"
616
+ }, null)]);
617
+ const scopeObj = {};
618
+ const scopeId = instance == null ? void 0 : instance.vnode.scopeId;
619
+ const parentScopeId = instance == null ? void 0 : instance.vnode.scopeId;
620
+ if (scopeId) {
621
+ scopeObj[scopeId] = "";
622
+ }
623
+ if (parentScopeId) {
624
+ scopeObj[parentScopeId] = "";
625
+ }
626
+ const Render = createVNode(_sfc_main$3, {
627
+ "placement": "bottom",
628
+ "offset": 0,
629
+ "width-equal": true,
630
+ "arrow": false,
631
+ "visible": popoverVisible.value,
632
+ "onUpdate:visible": popoverVisibleUpdateHandler,
633
+ "trigger": "click",
634
+ "contentStyle": {
635
+ padding: `${pixelSize}px`
636
+ },
637
+ "ref": popoverRef
638
+ }, {
639
+ default: () => h("div", {
640
+ ref: wrapperRef,
641
+ class: ["pixelium px-select", sizeComputed.value && `px-select__${sizeComputed.value}`, shapeComputed.value && `px-select__${shapeComputed.value}`, {
642
+ "px-select__inner": innerInputGroup.value
643
+ }, {
644
+ "px-select__disabled": disabledComputed.value
645
+ }],
646
+ onClick: focusInputHandler,
647
+ onMouseenter: mouseenterHandler,
648
+ onMouseleave: mouseleaveHandler,
649
+ ...scopeObj,
650
+ ...attrs
651
+ }, [Inner]),
652
+ content: () => optionsFiltered.value.length ? createVNode(_sfc_main$4, {
653
+ "options": optionsFiltered.value,
654
+ "onSelect": selectHandler,
655
+ "activeValues": props.multiple ? modelValue.value : [modelValue.value]
656
+ }, {
657
+ "group-label": ({
658
+ option
659
+ }) => slots["group-label"] ? slots["group-label"]({
660
+ option
661
+ }) : option.label,
662
+ option: ({
663
+ option
664
+ }) => slots.option ? slots.option({
665
+ option
666
+ }) : p(option) ? option : option.label
667
+ }) : createVNode("div", {
668
+ "class": "px-select-empty"
669
+ }, [createVNode(_sfc_main$5, null, null)])
670
+ });
671
+ return Render;
672
+ };
673
+ }
674
+ });
675
+ export {
676
+ _sfc_main as _
677
+ };