@pixelium/web-vue 0.0.2 → 0.0.3-alpha

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 (284) hide show
  1. package/README.md +42 -0
  2. package/README.zh.md +6 -3
  3. package/dist/font.css +1 -1
  4. package/dist/index.d.ts +1602 -248
  5. package/dist/normalize.css +2 -0
  6. package/dist/pixelium-vue-icon-hn.cjs +1 -1
  7. package/dist/pixelium-vue-icon-hn.css +2 -1
  8. package/dist/pixelium-vue-icon-hn.js +8533 -8154
  9. package/dist/pixelium-vue-icon-hn.umd.cjs +1 -1
  10. package/dist/pixelium-vue-icon-pa.cjs +1 -1
  11. package/dist/pixelium-vue-icon-pa.css +2 -1
  12. package/dist/pixelium-vue-icon-pa.js +10625 -10143
  13. package/dist/pixelium-vue-icon-pa.umd.cjs +1 -1
  14. package/dist/pixelium-vue.cjs +2 -2
  15. package/dist/pixelium-vue.css +2 -1
  16. package/dist/pixelium-vue.js +7407 -5852
  17. package/dist/pixelium-vue.umd.cjs +2 -2
  18. package/es/aside/index.css +1 -0
  19. package/es/aside/index.js +46 -151
  20. package/es/auto-complete/draw.d.ts +1 -1
  21. package/es/auto-complete/draw.js +26 -51
  22. package/es/auto-complete/index.css +92 -32
  23. package/es/auto-complete/index.d.ts +12 -15
  24. package/es/auto-complete/index.js +338 -400
  25. package/es/auto-complete/type.d.ts +25 -13
  26. package/es/avatar/css.js +2 -0
  27. package/es/avatar/draw.d.ts +2 -0
  28. package/es/avatar/draw.js +11 -0
  29. package/es/avatar/index.css +49 -0
  30. package/es/avatar/index.d.ts +15 -0
  31. package/es/avatar/index.js +110 -0
  32. package/es/avatar/type.d.ts +34 -0
  33. package/es/button/draw.d.ts +4 -4
  34. package/es/button/draw.js +213 -297
  35. package/es/button/index.css +40 -30
  36. package/es/button/index.d.ts +0 -4
  37. package/es/button/index.js +230 -256
  38. package/es/button/type.d.ts +3 -3
  39. package/es/button-group/index.css +0 -3
  40. package/es/button-group/index.d.ts +1 -2
  41. package/es/button-group/index.js +59 -31
  42. package/es/button-group/type.d.ts +21 -4
  43. package/es/checkbox/css.js +2 -0
  44. package/es/checkbox/draw.d.ts +4 -0
  45. package/es/checkbox/draw.js +46 -0
  46. package/es/checkbox/index.css +85 -0
  47. package/es/checkbox/index.d.ts +31 -0
  48. package/es/checkbox/index.js +206 -0
  49. package/es/checkbox/type.d.ts +88 -0
  50. package/es/checkbox-group/css.js +2 -0
  51. package/es/checkbox-group/index.css +20 -0
  52. package/es/checkbox-group/index.d.ts +23 -0
  53. package/es/checkbox-group/index.js +84 -0
  54. package/es/checkbox-group/type.d.ts +78 -0
  55. package/es/col/index.d.ts +2 -2
  56. package/es/col/index.js +43 -58
  57. package/es/container/index.css +1 -0
  58. package/es/container/index.js +18 -31
  59. package/es/divider/index.js +39 -53
  60. package/es/empty/index.css +4 -4
  61. package/es/empty/index.js +16 -71
  62. package/es/entry.js +102 -0
  63. package/es/footer/index.css +1 -0
  64. package/es/footer/index.js +31 -40
  65. package/es/form/css.js +1 -0
  66. package/es/form/index.d.ts +27 -0
  67. package/es/form/index.js +125 -0
  68. package/es/form/type.d.ts +238 -0
  69. package/es/form/use-form.d.ts +4 -0
  70. package/es/form/use-form.js +48 -0
  71. package/es/form-item/css.js +2 -0
  72. package/es/form-item/index.css +77 -0
  73. package/es/form-item/index.d.ts +37 -0
  74. package/es/form-item/index.js +318 -0
  75. package/es/form-item/type.d.ts +96 -0
  76. package/es/grid/index.js +56 -75
  77. package/es/grid-item/css.js +0 -1
  78. package/es/grid-item/index.d.ts +1 -1
  79. package/es/grid-item/index.js +85 -121
  80. package/es/header/index.css +1 -0
  81. package/es/header/index.js +31 -40
  82. package/es/icon/index.js +44 -55
  83. package/es/icons/css-hn.js +0 -1
  84. package/es/icons/css-pa.js +0 -1
  85. package/es/icons/icon-hn.js +10337 -15986
  86. package/es/icons/icon-pa.js +12573 -17447
  87. package/es/image/css.js +2 -0
  88. package/es/image/index.css +69 -0
  89. package/es/image/index.d.ts +35 -0
  90. package/es/image/index.js +199 -0
  91. package/es/image/type.d.ts +126 -0
  92. package/es/index.css +1 -515
  93. package/es/index.d.ts +22 -2
  94. package/es/index.js +144 -123
  95. package/es/input/draw.d.ts +1 -1
  96. package/es/input/draw.js +26 -51
  97. package/es/input/index.css +85 -33
  98. package/es/input/index.d.ts +9 -16
  99. package/es/input/index.js +319 -423
  100. package/es/input/type.d.ts +3 -3
  101. package/es/input-group/index.css +0 -1
  102. package/es/input-group/index.d.ts +2 -2
  103. package/es/input-group/index.js +66 -37
  104. package/es/input-group/type.d.ts +16 -4
  105. package/es/input-group-label/draw.d.ts +1 -1
  106. package/es/input-group-label/draw.js +26 -51
  107. package/es/input-group-label/index.css +33 -22
  108. package/es/input-group-label/index.d.ts +1 -4
  109. package/es/input-group-label/index.js +104 -127
  110. package/es/input-group-label/type.d.ts +3 -3
  111. package/es/input-number/draw.d.ts +1 -1
  112. package/es/input-number/draw.js +26 -51
  113. package/es/input-number/index.css +90 -35
  114. package/es/input-number/index.d.ts +9 -16
  115. package/es/input-number/index.js +428 -536
  116. package/es/input-number/type.d.ts +3 -3
  117. package/es/input-tag/draw.d.ts +1 -1
  118. package/es/input-tag/draw.js +26 -48
  119. package/es/input-tag/index.css +100 -33
  120. package/es/input-tag/index.d.ts +7 -13
  121. package/es/input-tag/index.js +442 -467
  122. package/es/input-tag/type.d.ts +24 -13
  123. package/es/link/index.js +75 -106
  124. package/es/main/index.css +4 -0
  125. package/es/main/index.d.ts +4 -1
  126. package/es/main/index.js +15 -15
  127. package/es/main/type.d.ts +7 -0
  128. package/es/mask/index.js +94 -115
  129. package/es/message/index.css +1 -1
  130. package/es/message/index.js +168 -346
  131. package/es/message-box/css.js +1 -1
  132. package/es/message-box/index.js +98 -114
  133. package/es/message-box/message-box-wrapped.js +33 -46
  134. package/es/message-box/message-box.js +79 -111
  135. package/es/option-list/index.css +13 -13
  136. package/es/option-list/index.d.ts +4 -31
  137. package/es/option-list/index.js +99 -167
  138. package/es/option-list/type.d.ts +5 -1
  139. package/es/pixelate/pixel.d.ts +5 -0
  140. package/es/pixelate/pixel.js +70 -0
  141. package/es/pixelate/pixelate.worker.d.ts +1 -0
  142. package/es/popover/index.d.ts +13 -99
  143. package/es/popover/index.js +75 -238
  144. package/es/popover/type.d.ts +7 -2
  145. package/es/popup/css.js +1 -0
  146. package/es/popup/index.d.ts +210 -0
  147. package/es/popup/index.js +203 -0
  148. package/es/popup/type.d.ts +105 -0
  149. package/es/popup-content/draw.d.ts +2 -2
  150. package/es/popup-content/draw.js +98 -143
  151. package/es/popup-content/index.css +11 -11
  152. package/es/popup-content/index.d.ts +1 -0
  153. package/es/popup-content/index.js +253 -1576
  154. package/es/popup-content/type.d.ts +1 -0
  155. package/es/popup-trigger/index.d.ts +8 -2
  156. package/es/popup-trigger/index.js +122 -95
  157. package/es/popup-trigger/type.d.ts +4 -1
  158. package/es/popup-wrapper/css.js +2 -0
  159. package/es/popup-wrapper/index.css +14 -0
  160. package/es/popup-wrapper/index.d.ts +18 -0
  161. package/es/popup-wrapper/index.js +67 -0
  162. package/es/popup-wrapper/type.d.ts +9 -0
  163. package/es/radio/css.js +1 -0
  164. package/es/radio/draw.d.ts +4 -0
  165. package/es/radio/draw.js +47 -0
  166. package/es/radio/index.d.ts +30 -0
  167. package/es/radio/index.js +190 -0
  168. package/es/radio/style.css +73 -0
  169. package/es/radio/type.d.ts +76 -0
  170. package/es/radio-group/css.js +2 -0
  171. package/es/radio-group/index.css +20 -0
  172. package/es/radio-group/index.d.ts +23 -0
  173. package/es/radio-group/index.js +77 -0
  174. package/es/radio-group/type.d.ts +77 -0
  175. package/es/row/index.js +56 -70
  176. package/es/select/draw.d.ts +1 -1
  177. package/es/select/draw.js +26 -51
  178. package/es/select/index.css +118 -36
  179. package/es/select/index.d.ts +14 -16
  180. package/es/select/index.js +625 -672
  181. package/es/select/type.d.ts +60 -25
  182. package/es/share/const/event-bus-key.js +1 -6
  183. package/es/share/const/index.d.ts +4 -0
  184. package/es/share/const/index.js +22 -24
  185. package/es/share/const/provide-key.d.ts +5 -0
  186. package/es/share/const/provide-key.js +6 -5
  187. package/es/share/const/style.d.ts +6 -0
  188. package/es/share/const/style.js +7 -0
  189. package/es/share/hook/use-cancelable-delay.d.ts +1 -0
  190. package/es/share/hook/use-cancelable-delay.js +42 -0
  191. package/es/share/hook/use-click-outside-listener.d.ts +1 -1
  192. package/es/share/hook/use-click-outside-listener.js +28 -41
  193. package/es/share/hook/use-composition.js +17 -15
  194. package/es/share/hook/use-controlled-mode.d.ts +3 -3
  195. package/es/share/hook/use-controlled-mode.js +20 -23
  196. package/es/share/hook/use-dark-mode.js +51 -65
  197. package/es/share/hook/use-index-of-children.d.ts +2 -1
  198. package/es/share/hook/use-index-of-children.js +47 -45
  199. package/es/share/hook/use-lazy-load.d.ts +10 -0
  200. package/es/share/hook/use-lazy-load.js +133 -0
  201. package/es/share/hook/use-props-detect.d.ts +2 -0
  202. package/es/share/hook/use-resize-observer.d.ts +1 -2
  203. package/es/share/hook/use-resize-observer.js +28 -20
  204. package/es/share/hook/use-screen-width.js +27 -36
  205. package/es/share/hook/use-smooth-transition.d.ts +2 -0
  206. package/es/share/hook/use-smooth-transition.js +65 -0
  207. package/es/share/hook/use-textarea-height.js +86 -92
  208. package/es/share/hook/use-theme-mode.js +41 -42
  209. package/es/share/hook/use-transition-end.d.ts +2 -0
  210. package/es/share/hook/use-transition-end.js +12 -0
  211. package/es/share/hook/use-watch-global-css-var.js +12 -16
  212. package/es/share/hook/use-window-resize-listener.d.ts +1 -0
  213. package/es/share/hook/use-window-resize-listener.js +15 -0
  214. package/es/share/hook/use-z-index.js +30 -27
  215. package/es/share/style/index.css +5 -0
  216. package/es/share/type/index.d.ts +18 -3
  217. package/es/share/util/color.d.ts +5 -3
  218. package/es/share/util/color.js +156 -149
  219. package/es/share/util/common.d.ts +7 -2
  220. package/es/share/util/common.js +127 -65
  221. package/es/share/util/console.d.ts +3 -3
  222. package/es/share/util/console.js +10 -7
  223. package/es/share/util/dom.d.ts +19 -0
  224. package/es/share/util/dom.js +88 -0
  225. package/es/share/util/env.d.ts +1 -0
  226. package/es/share/util/env.js +5 -4
  227. package/es/share/util/event-bus.js +3 -20
  228. package/es/share/util/lru-cache.js +29 -33
  229. package/es/share/util/pixel.d.ts +4 -0
  230. package/es/share/util/plot.d.ts +8 -3
  231. package/es/share/util/plot.js +457 -229
  232. package/es/share/util/reactivity.d.ts +8 -0
  233. package/es/share/util/reactivity.js +23 -0
  234. package/es/share/util/render.js +31 -41
  235. package/es/share/util/theme.d.ts +3 -0
  236. package/es/share/util/theme.js +77 -57
  237. package/es/slider/css.js +2 -0
  238. package/es/slider/draw.d.ts +25 -0
  239. package/es/slider/draw.js +113 -0
  240. package/es/slider/index.css +119 -0
  241. package/es/slider/index.d.ts +66 -0
  242. package/es/slider/index.js +503 -0
  243. package/es/slider/type.d.ts +162 -0
  244. package/es/slider/util.d.ts +37 -0
  245. package/es/slider/util.js +130 -0
  246. package/es/space/index.css +24 -29
  247. package/es/space/index.js +73 -97
  248. package/es/spin/index.css +18 -17
  249. package/es/spin/index.js +72 -102
  250. package/es/spin/type.d.ts +11 -5
  251. package/es/switch/css.js +2 -0
  252. package/es/switch/draw.d.ts +2 -0
  253. package/es/switch/draw.js +18 -0
  254. package/es/switch/index.css +121 -0
  255. package/es/switch/index.d.ts +42 -0
  256. package/es/switch/index.js +259 -0
  257. package/es/switch/type.d.ts +133 -0
  258. package/es/tag/draw.d.ts +2 -2
  259. package/es/tag/draw.js +80 -127
  260. package/es/tag/index.css +38 -22
  261. package/es/tag/index.d.ts +2 -2
  262. package/es/tag/index.js +121 -190
  263. package/es/tag/type.d.ts +3 -3
  264. package/es/text-outline/css.js +2 -0
  265. package/es/text-outline/index.css +4 -0
  266. package/es/text-outline/index.d.ts +17 -0
  267. package/es/text-outline/index.js +33 -0
  268. package/es/text-outline/type.d.ts +23 -0
  269. package/es/textarea/draw.js +9 -11
  270. package/es/textarea/index.css +37 -23
  271. package/es/textarea/index.d.ts +8 -14
  272. package/es/textarea/index.js +274 -262
  273. package/es/tooltip/index.d.ts +100 -4
  274. package/es/tooltip/index.js +70 -226
  275. package/es/tooltip/type.d.ts +7 -2
  276. package/es/vendor.js +504 -0
  277. package/es/virtual-list/css.js +2 -0
  278. package/es/virtual-list/index.css +25 -0
  279. package/es/virtual-list/index.d.ts +11 -0
  280. package/es/virtual-list/index.js +313 -0
  281. package/es/virtual-list/type.d.ts +26 -0
  282. package/package.json +10 -16
  283. package/es/grid-item/index.css +0 -0
  284. /package/es/message-box/{message-box.css → index.css} +0 -0
@@ -1,402 +1,340 @@
1
1
  import './css.js'
2
- import { defineComponent, createElementBlock, openBlock, normalizeStyle, createElementVNode, useAttrs, getCurrentInstance, ref, inject, computed, shallowRef, useSlots, watch, onMounted, nextTick, createVNode, Fragment, 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 { u as useWatchGlobalCssVal } from "../share/hook/use-watch-global-css-var.js";
10
- import { _ as _sfc_main$1 } from "../input-group/index.js";
11
- import { I as INPUT_GROUP_UPDATE } from "../share/const/event-bus-key.js";
12
- import { u as useIndexOfChildren } from "../share/hook/use-index-of-children.js";
13
- import { I as INPUT_GROUP_PROVIDE } from "../share/const/provide-key.js";
14
- import { _ as _sfc_main$2 } from "../popover/index.js";
15
- import { _ as _sfc_main$4 } from "../empty/index.js";
16
- import { _ as _sfc_main$3 } from "../option-list/index.js";
17
- import { d as defaultFilter } from "../share/util/common.js";
18
- import { p } from "../aside/index.js";
19
- import { B as BORDER_CORNER_RAD_RANGE } from "../share/const/index.js";
20
- import { u as useControlledMode } from "../share/hook/use-controlled-mode.js";
21
- const SpinnerThirdSolid = /* @__PURE__ */ defineComponent({
22
- props: {
23
- size: {},
24
- color: {}
25
- },
26
- setup(__props) {
27
- const props = __props;
28
- return (_ctx, _cache) => {
29
- return openBlock(), createElementBlock(
30
- "svg",
31
- {
32
- class: "px-icon-hn",
33
- style: normalizeStyle({ color: props.color, fontSize: props.size + "px" }),
34
- xmlns: "http://www.w3.org/2000/svg",
35
- viewBox: "0 0 24 24"
36
- },
37
- [..._cache[0] || (_cache[0] = [
38
- createElementVNode(
39
- "path",
40
- { d: "M23 9v6h-1v2h-3v-2h1V9h-1V7h-1V6h-1V5h-2V4h-2V3h-1V1h3v1h2v1h2v1h1v1h1v2h1v2z" },
41
- null,
42
- -1
43
- /* CACHED */
44
- )
45
- ])],
46
- 4
47
- /* STYLE */
48
- );
49
- };
50
- }
2
+ import { B as y, V as spinner_third_solid_default, l as times_circle_solid_default } from "../vendor.js";
3
+ import { r as GET_ELEMENT_RENDERED, t as BORDER_CORNER_RAD_RANGE } from "../share/const/index.js";
4
+ import { t as defaultFilter } from "../share/util/common.js";
5
+ import { i as canvasPreprocess, l as getBorderRadius, n as calcPixelSize, s as floodFill, t as calcBorderCornerCenter } from "../share/util/plot.js";
6
+ import { n as getGlobalThemeColor } from "../share/util/color.js";
7
+ import { t as useDarkMode } from "../share/hook/use-dark-mode.js";
8
+ import { t as useResizeObserver } from "../share/hook/use-resize-observer.js";
9
+ import { i as INPUT_GROUP_UPDATE } from "../share/const/event-bus-key.js";
10
+ import { t as useWatchGlobalCssVal } from "../share/hook/use-watch-global-css-var.js";
11
+ import { n as useIndexOfChildren } from "../share/hook/use-index-of-children.js";
12
+ import { i as FORM_ITEM_PROVIDE, s as INPUT_GROUP_PROVIDE } from "../share/const/provide-key.js";
13
+ import { t as createProvideComputed } from "../share/util/reactivity.js";
14
+ import { t as useTransitionEnd } from "../share/hook/use-transition-end.js";
15
+ import { t as useComposition } from "../share/hook/use-composition.js";
16
+ import { t as useControlledMode } from "../share/hook/use-controlled-mode.js";
17
+ import { t as popover_default } from "../popover/index.js";
18
+ import { t as empty_default } from "../empty/index.js";
19
+ import { t as drawBorder } from "./draw.js";
20
+ import { t as option_list_default } from "../option-list/index.js";
21
+ import { Fragment, computed, createVNode, defineComponent, getCurrentInstance, h, inject, nextTick, onMounted, ref, shallowRef, useAttrs, useSlots, watch } from "vue";
22
+ var auto_complete_default = /* @__PURE__ */ defineComponent({
23
+ name: "AutoComplete",
24
+ __name: "index",
25
+ props: {
26
+ modelValue: null,
27
+ defaultValue: null,
28
+ options: { default: () => [] },
29
+ placeholder: null,
30
+ disabled: {
31
+ type: Boolean,
32
+ default: false
33
+ },
34
+ readonly: {
35
+ type: Boolean,
36
+ default: false
37
+ },
38
+ clearable: {
39
+ type: Boolean,
40
+ default: false
41
+ },
42
+ loading: {
43
+ type: Boolean,
44
+ default: false
45
+ },
46
+ size: null,
47
+ shape: null,
48
+ showPopoverEmpty: {
49
+ type: Boolean,
50
+ default: false
51
+ },
52
+ shouldShowPopover: { type: Function },
53
+ filter: { type: Function },
54
+ append: {
55
+ type: Boolean,
56
+ default: false
57
+ },
58
+ virtualScroll: {
59
+ type: Boolean,
60
+ default: false
61
+ },
62
+ virtualListProps: null,
63
+ borderRadius: null,
64
+ status: { default: "normal" },
65
+ autofocus: { type: Boolean },
66
+ optionsDestroyOnHide: {
67
+ type: Boolean,
68
+ default: false
69
+ }
70
+ },
71
+ emits: [
72
+ "input",
73
+ "update:modelValue",
74
+ "change",
75
+ "clear",
76
+ "blur",
77
+ "focus",
78
+ "select"
79
+ ],
80
+ setup(__props, { expose: __expose, emit: __emit }) {
81
+ var _instance$parent;
82
+ const attrs = useAttrs();
83
+ const props = __props;
84
+ const emits = __emit;
85
+ const [isComposing, compositionStartHandler, compositionUpdateHandler] = useComposition({ afterComposition: (e) => {
86
+ nextTick(() => {
87
+ inputHandler(e);
88
+ });
89
+ } });
90
+ const instance = getCurrentInstance();
91
+ const innerInputGroup = ref((instance === null || instance === void 0 || (_instance$parent = instance.parent) === null || _instance$parent === void 0 ? void 0 : _instance$parent.type.name) === "InputGroup");
92
+ const [index, first, last] = innerInputGroup.value ? useIndexOfChildren(INPUT_GROUP_UPDATE, (instance$1) => {
93
+ var _instance$vnode$el;
94
+ return instance$1 === null || instance$1 === void 0 || (_instance$vnode$el = instance$1.vnode.el) === null || _instance$vnode$el === void 0 ? void 0 : _instance$vnode$el.nextElementSibling;
95
+ }) : [
96
+ ref(0),
97
+ ref(false),
98
+ ref(false)
99
+ ];
100
+ const inputGroupProvide = inject(INPUT_GROUP_PROVIDE, void 0);
101
+ const formItemProvide = inject(FORM_ITEM_PROVIDE, void 0);
102
+ const borderRadiusComputed = createProvideComputed("borderRadius", [innerInputGroup.value && inputGroupProvide, props]);
103
+ const sizeComputed = createProvideComputed("size", () => [
104
+ innerInputGroup.value && inputGroupProvide,
105
+ props.size && props,
106
+ formItemProvide,
107
+ props
108
+ ], "nullish", (val) => val || "medium");
109
+ const shapeComputed = createProvideComputed("shape", [innerInputGroup.value && inputGroupProvide, props], "nullish", (val) => val || "rect");
110
+ const disabledComputed = createProvideComputed("disabled", [
111
+ formItemProvide,
112
+ innerInputGroup.value && inputGroupProvide,
113
+ props
114
+ ], "or");
115
+ const readonlyComputed = createProvideComputed("readonly", [
116
+ formItemProvide,
117
+ innerInputGroup.value && inputGroupProvide,
118
+ props
119
+ ], "or");
120
+ const statusComputed = createProvideComputed("status", [formItemProvide, props]);
121
+ const nextIsTextButton = computed(() => {
122
+ if (index.value >= 0) {
123
+ var _inputGroupProvide$ch;
124
+ return innerInputGroup.value ? !!((inputGroupProvide === null || inputGroupProvide === void 0 || (_inputGroupProvide$ch = inputGroupProvide.childrenInfo.value.find((e) => e.index === index.value + 1)) === null || _inputGroupProvide$ch === void 0 ? void 0 : _inputGroupProvide$ch.variant) === "text") : false;
125
+ } else return false;
126
+ });
127
+ const [modelValue, updateModelValue] = useControlledMode("modelValue", props, emits, {
128
+ defaultField: "defaultValue",
129
+ transform: (e) => {
130
+ return e || "";
131
+ }
132
+ });
133
+ const wrapperRef = shallowRef(null);
134
+ const canvasRef = shallowRef(null);
135
+ const inputRef = shallowRef(null);
136
+ const triggerPopover = async () => {
137
+ await nextTick();
138
+ if (props.shouldShowPopover) {
139
+ popoverVisible.value = !!props.shouldShowPopover(modelValue.value || "", optionsFiltered.value);
140
+ return;
141
+ }
142
+ if (modelValue.value && (!props.showPopoverEmpty && optionsFiltered.value.length || props.showPopoverEmpty)) popoverVisible.value = true;
143
+ else popoverVisible.value = false;
144
+ };
145
+ const inputHandler = async (e) => {
146
+ e.stopPropagation();
147
+ const newValue = e.target.value;
148
+ modelValue.value = newValue;
149
+ if (isComposing.value) return;
150
+ emits("input", newValue, e);
151
+ formItemProvide === null || formItemProvide === void 0 || formItemProvide.inputHandler();
152
+ await updateModelValue(newValue);
153
+ triggerPopover();
154
+ };
155
+ const clearHandler = async () => {
156
+ await updateModelValue("");
157
+ emits("change", "");
158
+ emits("clear", "");
159
+ formItemProvide === null || formItemProvide === void 0 || formItemProvide.changeHandler();
160
+ };
161
+ const changeHandler = (e) => {
162
+ e.stopPropagation();
163
+ const target = e.target;
164
+ emits("change", target.value, e);
165
+ formItemProvide === null || formItemProvide === void 0 || formItemProvide.changeHandler();
166
+ };
167
+ const focusMode = ref(false);
168
+ const blurHandler = (e) => {
169
+ e.stopPropagation();
170
+ emits("blur", e);
171
+ focusMode.value = false;
172
+ formItemProvide === null || formItemProvide === void 0 || formItemProvide.blurHandler();
173
+ };
174
+ const focusHandler = (e) => {
175
+ e.stopPropagation();
176
+ emits("focus", e);
177
+ focusMode.value = true;
178
+ };
179
+ const focusInputHandler = () => {
180
+ var _inputRef$value;
181
+ (_inputRef$value = inputRef.value) === null || _inputRef$value === void 0 || _inputRef$value.focus();
182
+ };
183
+ const hoverFlag = ref(false);
184
+ const mouseenterHandler = () => {
185
+ hoverFlag.value = true;
186
+ };
187
+ const mouseleaveHandler = () => {
188
+ hoverFlag.value = false;
189
+ };
190
+ const showClose = computed(() => {
191
+ return props.clearable && !disabledComputed.value && !readonlyComputed.value;
192
+ });
193
+ const selectHandler = async (value, option, e) => {
194
+ const nextValue = props.append ? modelValue.value + value : value;
195
+ await updateModelValue(nextValue);
196
+ popoverVisible.value = false;
197
+ emits("select", nextValue, option, e);
198
+ emits("change", nextValue, e);
199
+ formItemProvide === null || formItemProvide === void 0 || formItemProvide.changeHandler();
200
+ };
201
+ const slots = useSlots();
202
+ const optionsFiltered = computed(() => {
203
+ if (props.filter) return props.filter(modelValue.value || "", props.options || []);
204
+ if (!modelValue.value || !modelValue.value.trim()) return [];
205
+ return defaultFilter(modelValue.value, props.options || []);
206
+ });
207
+ __expose({
208
+ focus: () => {
209
+ var _inputRef$value2;
210
+ (_inputRef$value2 = inputRef.value) === null || _inputRef$value2 === void 0 || _inputRef$value2.focus();
211
+ },
212
+ blur: () => {
213
+ var _inputRef$value3;
214
+ (_inputRef$value3 = inputRef.value) === null || _inputRef$value3 === void 0 || _inputRef$value3.blur();
215
+ },
216
+ clear: () => clearHandler(),
217
+ select: () => {
218
+ var _inputRef$value4;
219
+ (_inputRef$value4 = inputRef.value) === null || _inputRef$value4 === void 0 || _inputRef$value4.select();
220
+ },
221
+ [GET_ELEMENT_RENDERED]: () => wrapperRef.value
222
+ });
223
+ const popoverVisible = ref(false);
224
+ const popoverVisibleUpdateHandler = (value) => {
225
+ if (!value) popoverVisible.value = value;
226
+ };
227
+ watch([
228
+ first,
229
+ last,
230
+ borderRadiusComputed,
231
+ shapeComputed,
232
+ sizeComputed,
233
+ disabledComputed,
234
+ () => slots,
235
+ useDarkMode(),
236
+ focusMode,
237
+ hoverFlag,
238
+ readonlyComputed,
239
+ statusComputed,
240
+ nextIsTextButton
241
+ ], () => {
242
+ setTimeout(() => {
243
+ drawPixel();
244
+ });
245
+ });
246
+ const drawPixel = () => {
247
+ const preprocessData = canvasPreprocess(wrapperRef, canvasRef);
248
+ if (!preprocessData) return;
249
+ const { ctx, width, height, canvas } = preprocessData;
250
+ const pixelSize = calcPixelSize();
251
+ const borderRadius = getBorderRadius(canvas, pixelSize, borderRadiusComputed.value, shapeComputed.value || "rect", sizeComputed.value || "medium", innerInputGroup.value, first.value, last.value);
252
+ const borderColor = statusComputed.value !== "normal" ? getGlobalThemeColor(statusComputed.value === "error" ? "danger" : statusComputed.value, 6) : (hoverFlag.value || focusMode.value) && !disabledComputed.value && !readonlyComputed.value ? getGlobalThemeColor("primary", 6) : getGlobalThemeColor("neutral", 10);
253
+ const center = calcBorderCornerCenter(borderRadius, width, height, pixelSize);
254
+ const rad = BORDER_CORNER_RAD_RANGE;
255
+ if (borderColor) drawBorder(ctx, width, height, center, borderRadius, rad, borderColor, pixelSize, innerInputGroup.value, first.value, last.value, nextIsTextButton.value);
256
+ const backgroundColor = disabledComputed.value ? getGlobalThemeColor("neutral", 6) : getGlobalThemeColor("neutral", 1);
257
+ if (backgroundColor) floodFill(ctx, Math.round(width / 2), Math.round(height / 2), backgroundColor);
258
+ };
259
+ onMounted(() => {
260
+ nextTick(() => {
261
+ drawPixel();
262
+ });
263
+ });
264
+ useResizeObserver(wrapperRef, drawPixel);
265
+ useWatchGlobalCssVal(drawPixel);
266
+ useTransitionEnd(wrapperRef, drawPixel);
267
+ return () => {
268
+ const Inner = createVNode(Fragment, null, [
269
+ slots.prefix && createVNode("div", { "class": "px-auto-complete-prefix-wrapper" }, [slots.prefix()]),
270
+ createVNode("input", {
271
+ "ref": inputRef,
272
+ "class": "px-auto-complete-inner",
273
+ "value": modelValue.value,
274
+ "placeholder": props.placeholder,
275
+ "disabled": disabledComputed.value || readonlyComputed.value,
276
+ "autofocus": props.autofocus,
277
+ "onInput": inputHandler,
278
+ "onChange": changeHandler,
279
+ "onCompositionstart": compositionStartHandler,
280
+ "onCompositionend": compositionUpdateHandler
281
+ }, null),
282
+ showClose.value && createVNode("div", { "class": "px-auto-complete-close-wrapper" }, [hoverFlag.value && modelValue.value ? createVNode(times_circle_solid_default, {
283
+ "class": "px-auto-complete-icon",
284
+ "onClick": clearHandler
285
+ }, null) : createVNode("div", { "class": "px-auto-complete-icon-placeholder" }, null)]),
286
+ props.loading && createVNode("div", { "class": "px-auto-complete-loading-wrapper" }, [createVNode(spinner_third_solid_default, { "class": "px-auto-complete-icon px-animation__loading" }, null)]),
287
+ slots.suffix && createVNode("div", { "class": "px-auto-complete-suffix-wrapper" }, [slots.suffix()]),
288
+ createVNode("canvas", {
289
+ "ref": canvasRef,
290
+ "class": "px-auto-complete-canvas"
291
+ }, null)
292
+ ]);
293
+ const scopeObj = {};
294
+ const scopeId = instance === null || instance === void 0 ? void 0 : instance.vnode.scopeId;
295
+ const parentScopeId = instance === null || instance === void 0 ? void 0 : instance.vnode.scopeId;
296
+ if (scopeId) scopeObj[scopeId] = "";
297
+ if (parentScopeId) scopeObj[parentScopeId] = "";
298
+ const pixelSize = calcPixelSize();
299
+ return createVNode(popover_default, {
300
+ "placement": "bottom",
301
+ "offset": 0,
302
+ "width-equal": true,
303
+ "arrow": false,
304
+ "visible": popoverVisible.value,
305
+ "onUpdate:visible": popoverVisibleUpdateHandler,
306
+ "trigger": "click",
307
+ "contentStyle": { padding: `${pixelSize}px` },
308
+ "destroyOnHide": props.optionsDestroyOnHide
309
+ }, {
310
+ default: () => h("div", {
311
+ ref: wrapperRef,
312
+ class: [
313
+ "pixelium px-auto-complete",
314
+ sizeComputed.value && `px-auto-complete__${sizeComputed.value}`,
315
+ shapeComputed.value && `px-auto-complete__${shapeComputed.value}`,
316
+ { "px-auto-complete__inner": innerInputGroup.value },
317
+ { "px-auto-complete__disabled": disabledComputed.value }
318
+ ],
319
+ onClick: focusInputHandler,
320
+ onMouseenter: mouseenterHandler,
321
+ onMouseleave: mouseleaveHandler,
322
+ onFocusout: blurHandler,
323
+ onFocusin: focusHandler,
324
+ ...scopeObj,
325
+ ...attrs
326
+ }, [Inner]),
327
+ content: () => optionsFiltered.value.length ? createVNode(option_list_default, {
328
+ "options": optionsFiltered.value,
329
+ "onSelect": selectHandler,
330
+ "virtualScroll": props.virtualScroll,
331
+ "virtualListProps": props.virtualListProps
332
+ }, {
333
+ "group-label": ({ option }) => slots["group-label"] ? slots["group-label"]({ option }) : option.label,
334
+ option: ({ option }) => slots.option ? slots.option({ option }) : y(option) ? option : option.label
335
+ }) : createVNode("div", { "class": "px-auto-complete-empty" }, [createVNode(empty_default, null, null)])
336
+ });
337
+ };
338
+ }
51
339
  });
52
- const TimesCircleSolid = /* @__PURE__ */ defineComponent({
53
- props: {
54
- size: {},
55
- color: {}
56
- },
57
- setup(__props) {
58
- const props = __props;
59
- return (_ctx, _cache) => {
60
- return openBlock(), createElementBlock(
61
- "svg",
62
- {
63
- class: "px-icon-hn",
64
- style: normalizeStyle({ color: props.color, fontSize: props.size + "px" }),
65
- xmlns: "http://www.w3.org/2000/svg",
66
- viewBox: "0 0 24 24"
67
- },
68
- [..._cache[0] || (_cache[0] = [
69
- createElementVNode(
70
- "path",
71
- { d: "M22 9V7h-1V5h-1V4h-1V3h-2V2h-2V1H9v1H7v1H5v1H4v1H3v2H2v2H1v6h1v2h1v2h1v1h1v1h2v1h2v1h6v-1h2v-1h2v-1h1v-1h1v-2h1v-2h1V9zm-8 7v-1h-1v-1h-2v1h-1v1H9v1H8v-1H7v-1h1v-1h1v-1h1v-2H9v-1H8V9H7V8h1V7h1v1h1v1h1v1h2V9h1V8h1V7h1v1h1v1h-1v1h-1v1h-1v2h1v1h1v1h1v1h-1v1h-1v-1z" },
72
- null,
73
- -1
74
- /* CACHED */
75
- )
76
- ])],
77
- 4
78
- /* STYLE */
79
- );
80
- };
81
- }
82
- });
83
- const _sfc_main = /* @__PURE__ */ defineComponent({
84
- ...{
85
- name: "AutoComplete"
86
- },
87
- __name: "index",
88
- props: {
89
- modelValue: null,
90
- defaultValue: null,
91
- options: {
92
- default: () => []
93
- },
94
- placeholder: null,
95
- disabled: {
96
- type: Boolean,
97
- default: false
98
- },
99
- readonly: {
100
- type: Boolean,
101
- default: false
102
- },
103
- clearable: {
104
- type: Boolean,
105
- default: false
106
- },
107
- loading: {
108
- type: Boolean,
109
- default: false
110
- },
111
- showPopoverEmpty: {
112
- type: Boolean,
113
- default: false
114
- },
115
- shouldShowPopover: {
116
- type: Function
117
- },
118
- filter: {
119
- type: Function
120
- },
121
- append: {
122
- type: Boolean,
123
- default: false
124
- },
125
- size: {
126
- default: "medium"
127
- },
128
- shape: {
129
- default: "default"
130
- },
131
- borderRadius: null,
132
- status: {
133
- default: "normal"
134
- },
135
- autofocus: {
136
- type: Boolean
137
- }
138
- },
139
- emits: ["input", "update:modelValue", "change", "clear", "blur", "focus", "select"],
140
- setup(__props, {
141
- expose: __expose,
142
- emit: __emit
143
- }) {
144
- var _a;
145
- const attrs = useAttrs();
146
- const pixelSize = calcPixelSize();
147
- const props = __props;
148
- const emits = __emit;
149
- const [isComposing, compositionStartHandler, compositionUpdateHandler] = useComposition({
150
- afterComposition: (e) => {
151
- nextTick(() => {
152
- inputHandler(e);
153
- });
154
- }
155
- });
156
- const instance = getCurrentInstance();
157
- const innerInputGroup = ref(((_a = instance == null ? void 0 : instance.parent) == null ? void 0 : _a.type) === _sfc_main$1);
158
- const [_, first, last] = innerInputGroup.value ? useIndexOfChildren(INPUT_GROUP_UPDATE) : [ref(0), ref(false), ref(false)];
159
- const inputGroupProps = inject(INPUT_GROUP_PROVIDE);
160
- const borderRadiusComputed = computed(() => {
161
- return innerInputGroup.value && inputGroupProps ? inputGroupProps.borderRadius : props.borderRadius;
162
- });
163
- const sizeComputed = computed(() => {
164
- return innerInputGroup.value && inputGroupProps ? inputGroupProps.size : props.size;
165
- });
166
- const shapeComputed = computed(() => {
167
- return innerInputGroup.value && inputGroupProps ? inputGroupProps.shape : props.shape;
168
- });
169
- const disabledComputed = computed(() => {
170
- return innerInputGroup.value && inputGroupProps ? inputGroupProps.disabled || props.disabled : props.disabled;
171
- });
172
- const [modelValue, updateModelValue] = useControlledMode("modelValue", props, emits, {
173
- defaultField: "defaultValue",
174
- transform: (e) => {
175
- return e || "";
176
- }
177
- });
178
- const wrapperRef = shallowRef(null);
179
- const canvasRef = shallowRef(null);
180
- const inputRef = shallowRef(null);
181
- const triggerPopover = async () => {
182
- await nextTick();
183
- if (props.shouldShowPopover) {
184
- popoverVisible.value = !!props.shouldShowPopover(modelValue.value || "", optionsFiltered.value);
185
- return;
186
- }
187
- if (modelValue.value && (!props.showPopoverEmpty && optionsFiltered.value.length || props.showPopoverEmpty)) {
188
- popoverVisible.value = true;
189
- } else {
190
- popoverVisible.value = false;
191
- }
192
- };
193
- const closePopover = async () => {
194
- popoverVisible.value = false;
195
- };
196
- const inputHandler = async (e) => {
197
- e.stopPropagation();
198
- const target = e.target;
199
- const newValue = target.value;
200
- modelValue.value = newValue;
201
- if (isComposing.value) {
202
- return;
203
- }
204
- emits("input", newValue, e);
205
- await updateModelValue(newValue);
206
- triggerPopover();
207
- };
208
- const clearHandler = async () => {
209
- await updateModelValue("");
210
- emits("change", "");
211
- emits("clear", "");
212
- };
213
- const changeHandler = (e) => {
214
- e.stopPropagation();
215
- const target = e.target;
216
- emits("change", target.value, e);
217
- };
218
- const focusMode = ref(false);
219
- const blurHandler = () => {
220
- focusMode.value = false;
221
- };
222
- const focusHandler = () => {
223
- focusMode.value = true;
224
- };
225
- const focusInputHandler = () => {
226
- var _a2;
227
- (_a2 = inputRef.value) == null ? void 0 : _a2.focus();
228
- };
229
- const hoverFlag = ref(false);
230
- const mouseenterHandler = () => {
231
- hoverFlag.value = true;
232
- };
233
- const mouseleaveHandler = () => {
234
- hoverFlag.value = false;
235
- };
236
- const showClose = computed(() => {
237
- return props.clearable && !disabledComputed.value && !props.readonly;
238
- });
239
- const selectHandler = async (value, option, e) => {
240
- const nextValue = props.append ? modelValue.value + value : value;
241
- await updateModelValue(nextValue);
242
- closePopover();
243
- emits("select", nextValue, option, e);
244
- };
245
- const slots = useSlots();
246
- const optionsFiltered = computed(() => {
247
- if (props.filter) {
248
- return props.filter(modelValue.value || "", props.options || []);
249
- }
250
- if (!modelValue.value || !modelValue.value.trim()) {
251
- return [];
252
- }
253
- return defaultFilter(modelValue.value, props.options || []);
254
- });
255
- __expose({
256
- focus: () => {
257
- var _a2;
258
- (_a2 = inputRef.value) == null ? void 0 : _a2.focus();
259
- },
260
- blur: () => {
261
- var _a2;
262
- (_a2 = inputRef.value) == null ? void 0 : _a2.blur();
263
- },
264
- clear: () => clearHandler(),
265
- select: () => {
266
- var _a2;
267
- (_a2 = inputRef.value) == null ? void 0 : _a2.select();
268
- }
269
- });
270
- const popoverVisible = ref(false);
271
- const popoverVisibleUpdateHandler = (value) => {
272
- if (!value) {
273
- popoverVisible.value = value;
274
- }
275
- };
276
- const darkMode = useDarkMode();
277
- watch([first, last, borderRadiusComputed, shapeComputed, sizeComputed, disabledComputed, () => slots, darkMode, focusMode, hoverFlag], () => {
278
- setTimeout(() => {
279
- drawPixel();
280
- });
281
- });
282
- const drawPixel = () => {
283
- const preprocessData = canvasPreprocess(wrapperRef, canvasRef);
284
- if (!preprocessData) {
285
- return;
286
- }
287
- const {
288
- ctx,
289
- width,
290
- height,
291
- canvas
292
- } = preprocessData;
293
- const pixelSize2 = calcPixelSize();
294
- const borderRadius = getBorderRadius(canvas, pixelSize2, borderRadiusComputed.value, shapeComputed.value, sizeComputed.value || "medium", innerInputGroup.value, first.value, last.value);
295
- 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);
296
- const center = calcBorderCornerCenter(borderRadius, width, height, pixelSize2);
297
- const rad = BORDER_CORNER_RAD_RANGE;
298
- drawBorder(ctx, width, height, center, borderRadius, rad, borderColor, pixelSize2, innerInputGroup.value, first.value, last.value);
299
- const backgroundColor = disabledComputed.value ? getGlobalThemeColor("neutral", 6) : getGlobalThemeColor("neutral", 1);
300
- floodFill(ctx, Math.round(width / 2), Math.round(height / 2), backgroundColor);
301
- };
302
- onMounted(() => {
303
- nextTick(() => {
304
- drawPixel();
305
- });
306
- });
307
- useResizeObserver(wrapperRef, drawPixel);
308
- useWatchGlobalCssVal(drawPixel);
309
- return () => {
310
- const Inner = createVNode(Fragment, null, [slots.prefix && createVNode("div", {
311
- "class": "px-auto-complete-prefix-wrapper"
312
- }, [slots.prefix()]), createVNode("input", {
313
- "ref": inputRef,
314
- "class": "px-auto-complete-inner",
315
- "value": modelValue.value,
316
- "placeholder": props.placeholder,
317
- "disabled": disabledComputed.value || props.readonly,
318
- "autofocus": props.autofocus,
319
- "onInput": inputHandler,
320
- "onChange": changeHandler,
321
- "onBlur": blurHandler,
322
- "onFocus": focusHandler,
323
- "onCompositionstart": compositionStartHandler,
324
- "onCompositionend": compositionUpdateHandler
325
- }, null), showClose.value && createVNode("div", {
326
- "class": "px-auto-complete-close-wrapper"
327
- }, [hoverFlag.value && modelValue.value ? createVNode(TimesCircleSolid, {
328
- "class": "px-auto-complete-icon",
329
- "onClick": clearHandler
330
- }, null) : createVNode("div", {
331
- "class": "px-auto-complete-icon-placeholder"
332
- }, null)]), props.loading && createVNode("div", {
333
- "class": "px-auto-complete-loading-wrapper"
334
- }, [createVNode(SpinnerThirdSolid, {
335
- "class": "px-auto-complete-icon px-animation__loading"
336
- }, null)]), slots.suffix && createVNode("div", {
337
- "class": "px-auto-complete-suffix-wrapper"
338
- }, [slots.suffix()]), createVNode("canvas", {
339
- "ref": canvasRef,
340
- "class": "px-auto-complete-canvas"
341
- }, null)]);
342
- const scopeObj = {};
343
- const scopeId = instance == null ? void 0 : instance.vnode.scopeId;
344
- const parentScopeId = instance == null ? void 0 : instance.vnode.scopeId;
345
- if (scopeId) {
346
- scopeObj[scopeId] = "";
347
- }
348
- if (parentScopeId) {
349
- scopeObj[parentScopeId] = "";
350
- }
351
- const Render = createVNode(_sfc_main$2, {
352
- "placement": "bottom",
353
- "offset": 0,
354
- "width-equal": true,
355
- "arrow": false,
356
- "visible": popoverVisible.value,
357
- "onUpdate:visible": popoverVisibleUpdateHandler,
358
- "trigger": "click",
359
- "contentStyle": {
360
- padding: `${pixelSize}px`
361
- }
362
- }, {
363
- default: () => h("div", {
364
- ref: wrapperRef,
365
- class: ["pixelium px-auto-complete", sizeComputed.value && `px-auto-complete__${sizeComputed.value}`, shapeComputed.value && `px-auto-complete__${shapeComputed.value}`, {
366
- "px-auto-complete__inner": innerInputGroup.value
367
- }, {
368
- "px-auto-complete__disabled": disabledComputed.value
369
- }],
370
- onClick: focusInputHandler,
371
- onMouseenter: mouseenterHandler,
372
- onMouseleave: mouseleaveHandler,
373
- ...scopeObj,
374
- ...attrs
375
- }, [Inner]),
376
- content: () => optionsFiltered.value.length ? createVNode(_sfc_main$3, {
377
- "options": optionsFiltered.value,
378
- "onSelect": selectHandler
379
- }, {
380
- "group-label": ({
381
- option
382
- }) => slots["group-label"] ? slots["group-label"]({
383
- option
384
- }) : option.label,
385
- option: ({
386
- option
387
- }) => slots.option ? slots.option({
388
- option
389
- }) : p(option) ? option : option.label
390
- }) : createVNode("div", {
391
- "class": "px-auto-complete-empty"
392
- }, [createVNode(_sfc_main$4, null, null)])
393
- });
394
- return Render;
395
- };
396
- }
397
- });
398
- export {
399
- SpinnerThirdSolid as S,
400
- TimesCircleSolid as T,
401
- _sfc_main as _
402
- };
340
+ export { auto_complete_default as t };