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

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 (285) hide show
  1. package/README.md +42 -0
  2. package/README.zh.md +6 -3
  3. package/coverage/base.css +224 -0
  4. package/coverage/block-navigation.js +87 -0
  5. package/coverage/coverage-final.json +106 -0
  6. package/coverage/favicon.png +0 -0
  7. package/coverage/index.html +926 -0
  8. package/coverage/prettify.css +1 -0
  9. package/coverage/prettify.js +2 -0
  10. package/coverage/sort-arrow-sprite.png +0 -0
  11. package/coverage/sorter.js +210 -0
  12. package/dist/font.css +1 -1
  13. package/dist/index.d.ts +1593 -248
  14. package/dist/normalize.css +2 -0
  15. package/dist/pixelium-vue-icon-hn.cjs +1 -1
  16. package/dist/pixelium-vue-icon-hn.css +2 -1
  17. package/dist/pixelium-vue-icon-hn.js +8533 -8154
  18. package/dist/pixelium-vue-icon-hn.umd.cjs +1 -1
  19. package/dist/pixelium-vue-icon-pa.cjs +1 -1
  20. package/dist/pixelium-vue-icon-pa.css +2 -1
  21. package/dist/pixelium-vue-icon-pa.js +10625 -10143
  22. package/dist/pixelium-vue-icon-pa.umd.cjs +1 -1
  23. package/dist/pixelium-vue.cjs +2 -2
  24. package/dist/pixelium-vue.css +2 -1
  25. package/dist/pixelium-vue.js +7402 -5854
  26. package/dist/pixelium-vue.umd.cjs +2 -2
  27. package/es/aside/index.js +46 -151
  28. package/es/auto-complete/draw.d.ts +1 -1
  29. package/es/auto-complete/draw.js +26 -51
  30. package/es/auto-complete/index.css +92 -32
  31. package/es/auto-complete/index.d.ts +12 -15
  32. package/es/auto-complete/index.js +338 -400
  33. package/es/auto-complete/type.d.ts +25 -13
  34. package/es/avatar/css.js +2 -0
  35. package/es/avatar/draw.d.ts +2 -0
  36. package/es/avatar/draw.js +11 -0
  37. package/es/avatar/index.css +49 -0
  38. package/es/avatar/index.d.ts +15 -0
  39. package/es/avatar/index.js +110 -0
  40. package/es/avatar/type.d.ts +34 -0
  41. package/es/button/draw.d.ts +4 -4
  42. package/es/button/draw.js +213 -297
  43. package/es/button/index.css +40 -30
  44. package/es/button/index.d.ts +0 -4
  45. package/es/button/index.js +230 -256
  46. package/es/button/type.d.ts +3 -3
  47. package/es/button-group/index.css +0 -3
  48. package/es/button-group/index.d.ts +1 -2
  49. package/es/button-group/index.js +59 -31
  50. package/es/button-group/type.d.ts +21 -4
  51. package/es/checkbox/css.js +2 -0
  52. package/es/checkbox/draw.d.ts +4 -0
  53. package/es/checkbox/draw.js +46 -0
  54. package/es/checkbox/index.css +85 -0
  55. package/es/checkbox/index.d.ts +31 -0
  56. package/es/checkbox/index.js +206 -0
  57. package/es/checkbox/type.d.ts +88 -0
  58. package/es/checkbox-group/css.js +2 -0
  59. package/es/checkbox-group/index.css +20 -0
  60. package/es/checkbox-group/index.d.ts +23 -0
  61. package/es/checkbox-group/index.js +84 -0
  62. package/es/checkbox-group/type.d.ts +78 -0
  63. package/es/col/index.d.ts +2 -2
  64. package/es/col/index.js +43 -58
  65. package/es/container/index.js +18 -31
  66. package/es/divider/index.js +39 -53
  67. package/es/empty/index.css +4 -4
  68. package/es/empty/index.js +16 -71
  69. package/es/entry.js +102 -0
  70. package/es/footer/index.js +31 -40
  71. package/es/form/css.js +1 -0
  72. package/es/form/index.d.ts +27 -0
  73. package/es/form/index.js +125 -0
  74. package/es/form/type.d.ts +238 -0
  75. package/es/form/use-form.d.ts +4 -0
  76. package/es/form/use-form.js +48 -0
  77. package/es/form-item/css.js +2 -0
  78. package/es/form-item/index.css +77 -0
  79. package/es/form-item/index.d.ts +37 -0
  80. package/es/form-item/index.js +318 -0
  81. package/es/form-item/type.d.ts +96 -0
  82. package/es/grid/index.js +56 -75
  83. package/es/grid-item/css.js +0 -1
  84. package/es/grid-item/index.d.ts +1 -1
  85. package/es/grid-item/index.js +85 -121
  86. package/es/header/index.js +31 -40
  87. package/es/icon/index.js +44 -55
  88. package/es/icons/css-hn.js +0 -1
  89. package/es/icons/css-pa.js +0 -1
  90. package/es/icons/icon-hn.js +10337 -15986
  91. package/es/icons/icon-pa.js +12573 -17447
  92. package/es/image/css.js +2 -0
  93. package/es/image/index.css +69 -0
  94. package/es/image/index.d.ts +35 -0
  95. package/es/image/index.js +199 -0
  96. package/es/image/type.d.ts +126 -0
  97. package/es/index.css +1 -515
  98. package/es/index.d.ts +22 -2
  99. package/es/index.js +143 -123
  100. package/es/input/draw.d.ts +1 -1
  101. package/es/input/draw.js +26 -51
  102. package/es/input/index.css +85 -33
  103. package/es/input/index.d.ts +9 -16
  104. package/es/input/index.js +319 -423
  105. package/es/input/type.d.ts +3 -3
  106. package/es/input-group/index.css +0 -1
  107. package/es/input-group/index.d.ts +2 -2
  108. package/es/input-group/index.js +66 -37
  109. package/es/input-group/type.d.ts +16 -4
  110. package/es/input-group-label/draw.d.ts +1 -1
  111. package/es/input-group-label/draw.js +26 -51
  112. package/es/input-group-label/index.css +33 -22
  113. package/es/input-group-label/index.d.ts +1 -4
  114. package/es/input-group-label/index.js +104 -127
  115. package/es/input-group-label/type.d.ts +3 -3
  116. package/es/input-number/draw.d.ts +1 -1
  117. package/es/input-number/draw.js +26 -51
  118. package/es/input-number/index.css +90 -35
  119. package/es/input-number/index.d.ts +9 -16
  120. package/es/input-number/index.js +428 -536
  121. package/es/input-number/type.d.ts +3 -3
  122. package/es/input-tag/draw.d.ts +1 -1
  123. package/es/input-tag/draw.js +26 -48
  124. package/es/input-tag/index.css +100 -33
  125. package/es/input-tag/index.d.ts +7 -13
  126. package/es/input-tag/index.js +442 -467
  127. package/es/input-tag/type.d.ts +24 -13
  128. package/es/link/index.js +75 -106
  129. package/es/main/index.js +11 -15
  130. package/es/mask/index.js +94 -115
  131. package/es/message/index.css +1 -1
  132. package/es/message/index.js +168 -346
  133. package/es/message-box/css.js +1 -1
  134. package/es/message-box/index.js +98 -114
  135. package/es/message-box/message-box-wrapped.js +33 -46
  136. package/es/message-box/message-box.js +79 -111
  137. package/es/option-list/index.css +13 -13
  138. package/es/option-list/index.d.ts +4 -31
  139. package/es/option-list/index.js +99 -167
  140. package/es/option-list/type.d.ts +5 -1
  141. package/es/pixelate/pixel.d.ts +5 -0
  142. package/es/pixelate/pixel.js +70 -0
  143. package/es/pixelate/pixelate.worker.d.ts +1 -0
  144. package/es/popover/index.d.ts +13 -99
  145. package/es/popover/index.js +75 -238
  146. package/es/popover/type.d.ts +7 -2
  147. package/es/popup/css.js +1 -0
  148. package/es/popup/index.d.ts +210 -0
  149. package/es/popup/index.js +203 -0
  150. package/es/popup/type.d.ts +105 -0
  151. package/es/popup-content/draw.d.ts +2 -2
  152. package/es/popup-content/draw.js +98 -143
  153. package/es/popup-content/index.css +11 -11
  154. package/es/popup-content/index.d.ts +1 -0
  155. package/es/popup-content/index.js +253 -1576
  156. package/es/popup-content/type.d.ts +1 -0
  157. package/es/popup-trigger/index.d.ts +8 -2
  158. package/es/popup-trigger/index.js +122 -95
  159. package/es/popup-trigger/type.d.ts +4 -1
  160. package/es/popup-wrapper/css.js +2 -0
  161. package/es/popup-wrapper/index.css +14 -0
  162. package/es/popup-wrapper/index.d.ts +18 -0
  163. package/es/popup-wrapper/index.js +67 -0
  164. package/es/popup-wrapper/type.d.ts +9 -0
  165. package/es/radio/css.js +1 -0
  166. package/es/radio/draw.d.ts +4 -0
  167. package/es/radio/draw.js +47 -0
  168. package/es/radio/index.d.ts +30 -0
  169. package/es/radio/index.js +190 -0
  170. package/es/radio/style.css +73 -0
  171. package/es/radio/type.d.ts +76 -0
  172. package/es/radio-group/css.js +2 -0
  173. package/es/radio-group/index.css +20 -0
  174. package/es/radio-group/index.d.ts +23 -0
  175. package/es/radio-group/index.js +77 -0
  176. package/es/radio-group/type.d.ts +77 -0
  177. package/es/row/index.js +56 -70
  178. package/es/select/draw.d.ts +1 -1
  179. package/es/select/draw.js +26 -51
  180. package/es/select/index.css +118 -36
  181. package/es/select/index.d.ts +14 -16
  182. package/es/select/index.js +625 -675
  183. package/es/select/type.d.ts +60 -25
  184. package/es/share/const/event-bus-key.js +1 -6
  185. package/es/share/const/index.d.ts +4 -0
  186. package/es/share/const/index.js +22 -24
  187. package/es/share/const/provide-key.d.ts +5 -0
  188. package/es/share/const/provide-key.js +6 -5
  189. package/es/share/const/style.d.ts +6 -0
  190. package/es/share/const/style.js +7 -0
  191. package/es/share/hook/use-cancelable-delay.d.ts +1 -0
  192. package/es/share/hook/use-cancelable-delay.js +42 -0
  193. package/es/share/hook/use-click-outside-listener.d.ts +1 -1
  194. package/es/share/hook/use-click-outside-listener.js +28 -41
  195. package/es/share/hook/use-composition.js +17 -15
  196. package/es/share/hook/use-controlled-mode.d.ts +3 -3
  197. package/es/share/hook/use-controlled-mode.js +20 -23
  198. package/es/share/hook/use-dark-mode.js +51 -65
  199. package/es/share/hook/use-index-of-children.d.ts +2 -1
  200. package/es/share/hook/use-index-of-children.js +47 -45
  201. package/es/share/hook/use-lazy-load.d.ts +10 -0
  202. package/es/share/hook/use-lazy-load.js +133 -0
  203. package/es/share/hook/use-props-detect.d.ts +2 -0
  204. package/es/share/hook/use-resize-observer.d.ts +1 -2
  205. package/es/share/hook/use-resize-observer.js +28 -20
  206. package/es/share/hook/use-screen-width.js +27 -36
  207. package/es/share/hook/use-smooth-transition.d.ts +2 -0
  208. package/es/share/hook/use-smooth-transition.js +65 -0
  209. package/es/share/hook/use-textarea-height.js +86 -92
  210. package/es/share/hook/use-theme-mode.js +41 -42
  211. package/es/share/hook/use-transition-end.d.ts +2 -0
  212. package/es/share/hook/use-transition-end.js +12 -0
  213. package/es/share/hook/use-watch-global-css-var.js +12 -16
  214. package/es/share/hook/use-window-resize-listener.d.ts +1 -0
  215. package/es/share/hook/use-window-resize-listener.js +15 -0
  216. package/es/share/hook/use-z-index.js +30 -27
  217. package/es/share/type/index.d.ts +18 -3
  218. package/es/share/util/color.d.ts +5 -3
  219. package/es/share/util/color.js +156 -149
  220. package/es/share/util/common.d.ts +7 -2
  221. package/es/share/util/common.js +127 -65
  222. package/es/share/util/console.d.ts +3 -3
  223. package/es/share/util/console.js +10 -7
  224. package/es/share/util/dom.d.ts +19 -0
  225. package/es/share/util/dom.js +88 -0
  226. package/es/share/util/env.d.ts +1 -0
  227. package/es/share/util/env.js +5 -4
  228. package/es/share/util/event-bus.js +3 -20
  229. package/es/share/util/lru-cache.js +29 -33
  230. package/es/share/util/pixel.d.ts +4 -0
  231. package/es/share/util/plot.d.ts +8 -3
  232. package/es/share/util/plot.js +457 -229
  233. package/es/share/util/reactivity.d.ts +8 -0
  234. package/es/share/util/reactivity.js +23 -0
  235. package/es/share/util/render.js +31 -41
  236. package/es/share/util/theme.d.ts +3 -0
  237. package/es/share/util/theme.js +77 -57
  238. package/es/slider/css.js +2 -0
  239. package/es/slider/draw.d.ts +25 -0
  240. package/es/slider/draw.js +113 -0
  241. package/es/slider/index.css +119 -0
  242. package/es/slider/index.d.ts +66 -0
  243. package/es/slider/index.js +503 -0
  244. package/es/slider/type.d.ts +162 -0
  245. package/es/slider/util.d.ts +37 -0
  246. package/es/slider/util.js +130 -0
  247. package/es/space/index.css +24 -29
  248. package/es/space/index.js +73 -97
  249. package/es/spin/index.css +18 -17
  250. package/es/spin/index.js +72 -102
  251. package/es/spin/type.d.ts +11 -5
  252. package/es/switch/css.js +2 -0
  253. package/es/switch/draw.d.ts +2 -0
  254. package/es/switch/draw.js +18 -0
  255. package/es/switch/index.css +121 -0
  256. package/es/switch/index.d.ts +42 -0
  257. package/es/switch/index.js +259 -0
  258. package/es/switch/type.d.ts +133 -0
  259. package/es/tag/draw.d.ts +2 -2
  260. package/es/tag/draw.js +80 -127
  261. package/es/tag/index.css +38 -22
  262. package/es/tag/index.d.ts +2 -2
  263. package/es/tag/index.js +121 -190
  264. package/es/tag/type.d.ts +3 -3
  265. package/es/text-outline/css.js +2 -0
  266. package/es/text-outline/index.css +4 -0
  267. package/es/text-outline/index.d.ts +17 -0
  268. package/es/text-outline/index.js +33 -0
  269. package/es/text-outline/type.d.ts +23 -0
  270. package/es/textarea/draw.js +9 -11
  271. package/es/textarea/index.css +37 -23
  272. package/es/textarea/index.d.ts +8 -14
  273. package/es/textarea/index.js +274 -262
  274. package/es/tooltip/index.d.ts +100 -4
  275. package/es/tooltip/index.js +70 -226
  276. package/es/tooltip/type.d.ts +7 -2
  277. package/es/vendor.js +504 -0
  278. package/es/virtual-list/css.js +2 -0
  279. package/es/virtual-list/index.css +25 -0
  280. package/es/virtual-list/index.d.ts +11 -0
  281. package/es/virtual-list/index.js +313 -0
  282. package/es/virtual-list/type.d.ts +26 -0
  283. package/package.json +10 -16
  284. package/es/grid-item/index.css +0 -0
  285. /package/es/message-box/{message-box.css → index.css} +0 -0
@@ -1,543 +1,435 @@
1
1
  import './css.js'
2
- import { defineComponent, createElementBlock, openBlock, normalizeStyle, createElementVNode, getCurrentInstance, ref, inject, computed, shallowRef, watch, useSlots, onMounted, nextTick, normalizeClass, createCommentVNode, unref, renderSlot, createBlock, withModifiers, createVNode } 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 { a as canvasPreprocess, c as calcPixelSize, 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 { T as TimesCircleSolid, S as SpinnerThirdSolid } from "../auto-complete/index.js";
9
- import { z, N, k, R } from "../aside/index.js";
10
- import { u as useComposition } from "../share/hook/use-composition.js";
11
- import { c as clamp } from "../share/util/common.js";
12
- import { u as useWatchGlobalCssVal } from "../share/hook/use-watch-global-css-var.js";
13
- import { _ as _sfc_main$1 } from "../input-group/index.js";
14
- import { I as INPUT_GROUP_UPDATE } from "../share/const/event-bus-key.js";
15
- import { u as useIndexOfChildren } from "../share/hook/use-index-of-children.js";
16
- import { I as INPUT_GROUP_PROVIDE } from "../share/const/provide-key.js";
17
- import { B as BORDER_CORNER_RAD_RANGE } from "../share/const/index.js";
18
- import { u as useControlledMode } from "../share/hook/use-controlled-mode.js";
19
- const Minus = /* @__PURE__ */ defineComponent({
20
- props: {
21
- size: {},
22
- color: {}
23
- },
24
- setup(__props) {
25
- const props = __props;
26
- return (_ctx, _cache) => {
27
- return openBlock(), createElementBlock(
28
- "svg",
29
- {
30
- class: "px-icon-hn",
31
- style: normalizeStyle({ color: props.color, fontSize: props.size + "px" }),
32
- xmlns: "http://www.w3.org/2000/svg",
33
- viewBox: "0 0 24 24"
34
- },
35
- [..._cache[0] || (_cache[0] = [
36
- createElementVNode(
37
- "path",
38
- { d: "M1 11h22v2H1z" },
39
- null,
40
- -1
41
- /* CACHED */
42
- )
43
- ])],
44
- 4
45
- /* STYLE */
46
- );
47
- };
48
- }
49
- });
50
- const Plus = /* @__PURE__ */ defineComponent({
51
- props: {
52
- size: {},
53
- color: {}
54
- },
55
- setup(__props) {
56
- const props = __props;
57
- return (_ctx, _cache) => {
58
- return openBlock(), createElementBlock(
59
- "svg",
60
- {
61
- class: "px-icon-hn",
62
- style: normalizeStyle({ color: props.color, fontSize: props.size + "px" }),
63
- xmlns: "http://www.w3.org/2000/svg",
64
- viewBox: "0 0 24 24"
65
- },
66
- [..._cache[0] || (_cache[0] = [
67
- createElementVNode(
68
- "path",
69
- { d: "M23 11v2H13v10h-2V13H1v-2h10V1h2v10z" },
70
- null,
71
- -1
72
- /* CACHED */
73
- )
74
- ])],
75
- 4
76
- /* STYLE */
77
- );
78
- };
79
- }
80
- });
81
- const _hoisted_1 = {
82
- key: 0,
83
- class: "px-input-number-prefix-wrapper"
2
+ import { P as ke, T as R, V as spinner_third_solid_default, _ as E, a as minus_default, g as A, i as plus_default, l as times_circle_solid_default, v as F } from "../vendor.js";
3
+ import { t as BORDER_CORNER_RAD_RANGE } from "../share/const/index.js";
4
+ import { i as fixedNumber } 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 drawBorder } from "./draw.js";
18
+ import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, getCurrentInstance, inject, nextTick, normalizeClass, onMounted, openBlock, ref, renderSlot, shallowRef, unref, useSlots, watch, withModifiers } from "vue";
19
+ var _hoisted_1 = {
20
+ key: 0,
21
+ class: "px-input-number-prefix-wrapper"
84
22
  };
85
- const _hoisted_2 = ["value", "placeholder", "disabled", "autofocus"];
86
- const _hoisted_3 = {
87
- key: 2,
88
- class: "px-input-number-close-wrapper"
23
+ var _hoisted_2 = [
24
+ "value",
25
+ "placeholder",
26
+ "disabled",
27
+ "autofocus"
28
+ ];
29
+ var _hoisted_3 = {
30
+ key: 2,
31
+ class: "px-input-number-close-wrapper"
89
32
  };
90
- const _hoisted_4 = {
91
- key: 1,
92
- class: "px-input-number-icon-placeholder"
33
+ var _hoisted_4 = {
34
+ key: 1,
35
+ class: "px-input-number-icon-placeholder"
93
36
  };
94
- const _hoisted_5 = {
95
- key: 4,
96
- class: "px-input-number-loading-wrapper"
37
+ var _hoisted_5 = {
38
+ key: 4,
39
+ class: "px-input-number-loading-wrapper"
97
40
  };
98
- const _hoisted_6 = {
99
- key: 5,
100
- class: "px-input-number-suffix-wrapper"
41
+ var _hoisted_6 = {
42
+ key: 5,
43
+ class: "px-input-number-suffix-wrapper"
101
44
  };
102
- const _sfc_main = /* @__PURE__ */ defineComponent({
103
- ...{
104
- name: "InputNumber"
105
- },
106
- __name: "index",
107
- props: {
108
- modelValue: null,
109
- defaultValue: null,
110
- placeholder: null,
111
- disabled: { type: Boolean, default: false },
112
- readonly: { type: Boolean, default: false },
113
- max: { default: Number.MAX_SAFE_INTEGER },
114
- min: { default: Number.MIN_SAFE_INTEGER },
115
- step: { default: 1 },
116
- precision: null,
117
- strickStep: { type: Boolean, default: false },
118
- format: { type: Function },
119
- allowInput: { type: Function },
120
- parse: { type: Function },
121
- clearable: { type: Boolean, default: false },
122
- loading: { type: Boolean, default: false },
123
- size: { default: "medium" },
124
- shape: { default: "default" },
125
- borderRadius: null,
126
- buttonPlacement: { default: "end" },
127
- status: { default: "normal" },
128
- autofocus: { type: Boolean }
129
- },
130
- emits: ["input", "update:modelValue", "change", "clear", "blur", "focus"],
131
- setup(__props, { expose: __expose, emit: __emit }) {
132
- var _a;
133
- const props = __props;
134
- const emits = __emit;
135
- const instance = getCurrentInstance();
136
- const innerInputGroup = ref(((_a = instance == null ? void 0 : instance.parent) == null ? void 0 : _a.type) === _sfc_main$1);
137
- const [_, first, last] = innerInputGroup.value ? useIndexOfChildren(INPUT_GROUP_UPDATE) : [ref(0), ref(false), ref(false)];
138
- const inputGroupProps = inject(INPUT_GROUP_PROVIDE);
139
- const borderRadiusComputed = computed(() => {
140
- return innerInputGroup.value && inputGroupProps ? inputGroupProps.borderRadius : props.borderRadius;
141
- });
142
- const sizeComputed = computed(() => {
143
- return innerInputGroup.value && inputGroupProps ? inputGroupProps.size : props.size;
144
- });
145
- const shapeComputed = computed(() => {
146
- return innerInputGroup.value && inputGroupProps ? inputGroupProps.shape : props.shape;
147
- });
148
- const disabledComputed = computed(() => {
149
- return innerInputGroup.value && inputGroupProps ? inputGroupProps.disabled || props.disabled : props.disabled;
150
- });
151
- const reg4Number = /^[+-]?\d+(?:\.\d*)?$/;
152
- const adjustValue = (value) => {
153
- if (z(value)) {
154
- value = 0;
155
- }
156
- if (k(props.precision)) {
157
- value = parseFloat(value.toFixed(clamp(Math.round(props.precision), 0, 100)));
158
- }
159
- const min = props.min ?? Number.MIN_SAFE_INTEGER;
160
- const max = props.max ?? Number.MAX_SAFE_INTEGER;
161
- value = clamp(value, min, max);
162
- if (props.strickStep && !R(props.step) && !z(props.step) && props.step !== 0) {
163
- let valueWithStrickStep = Math.round(value / props.step) * props.step;
164
- if (valueWithStrickStep < min) {
165
- valueWithStrickStep = Math.ceil(value / props.step) * props.step;
166
- }
167
- if (valueWithStrickStep > max) {
168
- valueWithStrickStep = Math.floor(value / props.step) * props.step;
169
- }
170
- value = valueWithStrickStep;
171
- }
172
- return value;
173
- };
174
- const formatNumberValue = (value) => {
175
- if (props.format) {
176
- return props.format(value);
177
- }
178
- if (z(value) || N(value)) {
179
- return "";
180
- }
181
- const ans = k(props.precision) ? value.toFixed(clamp(Math.round(props.precision), 0, 100)) : value + "";
182
- return ans;
183
- };
184
- const checkInputValue = (value) => {
185
- if (props.allowInput) {
186
- return props.allowInput(value);
187
- }
188
- if (!value.length) {
189
- return true;
190
- }
191
- return reg4Number.test(value);
192
- };
193
- const formatEmitModelValue = (value) => {
194
- if (props.parse) {
195
- return props.parse(value);
196
- }
197
- if (!value.length) {
198
- return 0;
199
- }
200
- return parseFloat(value);
201
- };
202
- const [modelValue, updateModelValue] = useControlledMode("modelValue", props, emits, {
203
- defaultField: "defaultValue",
204
- transform: (value) => {
205
- if (!N(value)) {
206
- const adjustedInitValue = adjustValue(value);
207
- if (adjustedInitValue !== value) {
208
- emits("update:modelValue", adjustedInitValue);
209
- }
210
- return adjustedInitValue;
211
- }
212
- return value;
213
- }
214
- });
215
- const inputValue = ref(formatNumberValue(modelValue.value));
216
- const [isComposing, compositionStartHandler, compositionUpdateHandler] = useComposition({
217
- afterComposition: (e) => {
218
- nextTick(() => {
219
- inputHandler(e);
220
- });
221
- }
222
- });
223
- const wrapperRef = shallowRef(null);
224
- const canvasRef = shallowRef(null);
225
- const inputRef = shallowRef(null);
226
- const setInputValue = (value) => {
227
- inputValue.value = value;
228
- };
229
- watch(modelValue, (val) => {
230
- if (!focusMode.value) {
231
- setInputValue(formatNumberValue(val));
232
- }
233
- });
234
- const inputHandler = async (e) => {
235
- const target = e.target;
236
- const newValue = target.value;
237
- if (isComposing.value) {
238
- return;
239
- }
240
- if (!checkInputValue(newValue)) {
241
- if (inputRef.value) {
242
- inputRef.value.value = inputValue.value;
243
- }
244
- return;
245
- }
246
- inputValue.value = newValue;
247
- const nextValue = adjustValue(formatEmitModelValue(newValue));
248
- emits("input", nextValue, e);
249
- await updateModelValue(nextValue);
250
- };
251
- const clearHandler = async () => {
252
- const defaultValue = adjustValue(0);
253
- await updateModelValue(defaultValue);
254
- setInputValue(formatNumberValue(modelValue.value));
255
- emits("change", defaultValue);
256
- emits("clear", defaultValue);
257
- };
258
- const changeHandler = (e) => {
259
- const target = e.target;
260
- const numberValue = formatEmitModelValue(target.value);
261
- setInputValue(formatNumberValue(modelValue.value));
262
- emits("change", numberValue, e);
263
- };
264
- const focusMode = ref(false);
265
- const blurHandler = () => {
266
- setInputValue(formatNumberValue(modelValue.value));
267
- focusMode.value = false;
268
- };
269
- const focusHandler = () => {
270
- focusMode.value = true;
271
- };
272
- const showClose = computed(() => {
273
- return props.clearable && !disabledComputed.value && !props.readonly;
274
- });
275
- const slots = useSlots();
276
- __expose({
277
- focus: () => {
278
- var _a2;
279
- (_a2 = inputRef.value) == null ? void 0 : _a2.focus();
280
- },
281
- blur: () => {
282
- var _a2;
283
- (_a2 = inputRef.value) == null ? void 0 : _a2.blur();
284
- },
285
- clear: () => clearHandler(),
286
- select: () => {
287
- var _a2;
288
- (_a2 = inputRef.value) == null ? void 0 : _a2.select();
289
- }
290
- });
291
- const increaseDisabled = computed(() => {
292
- return props.readonly || disabledComputed.value || modelValue.value && modelValue.value >= props.max;
293
- });
294
- const decreaseDisabled = computed(() => {
295
- return props.readonly || disabledComputed.value || modelValue.value && modelValue.value <= props.min;
296
- });
297
- const increaseHandler = async () => {
298
- if (increaseDisabled.value) {
299
- return;
300
- }
301
- let currentValue = modelValue.value;
302
- if (N(currentValue)) {
303
- const defaultValue = adjustValue(0);
304
- currentValue = defaultValue;
305
- }
306
- const nextValue = adjustValue(currentValue + props.step);
307
- await updateModelValue(nextValue);
308
- setInputValue(formatNumberValue(modelValue.value));
309
- };
310
- const decreaseHandler = async () => {
311
- if (decreaseDisabled.value) {
312
- return;
313
- }
314
- let currentValue = modelValue.value;
315
- if (N(currentValue)) {
316
- const defaultValue = adjustValue(0);
317
- currentValue = defaultValue;
318
- }
319
- const nextValue = adjustValue(currentValue - props.step);
320
- await updateModelValue(nextValue);
321
- setInputValue(formatNumberValue(modelValue.value));
322
- };
323
- const showSettingSuffix = computed(() => {
324
- return props.buttonPlacement === "both" || props.buttonPlacement === "both-reverse" || props.buttonPlacement === "end" || props.buttonPlacement === "end-reverse";
325
- });
326
- const showPlusSuffix = computed(() => {
327
- return props.buttonPlacement === "both-reverse" || props.buttonPlacement === "end" || props.buttonPlacement === "end-reverse";
328
- });
329
- const showMinusSuffix = computed(() => {
330
- return props.buttonPlacement === "both" || props.buttonPlacement === "end" || props.buttonPlacement === "end-reverse";
331
- });
332
- const showSettingPrefix = computed(() => {
333
- return props.buttonPlacement === "both" || props.buttonPlacement === "both-reverse" || props.buttonPlacement === "start" || props.buttonPlacement === "start-reverse";
334
- });
335
- const showPlusPrefix = computed(() => {
336
- return props.buttonPlacement === "both" || props.buttonPlacement === "start" || props.buttonPlacement === "start-reverse";
337
- });
338
- const showMinusPrefix = computed(() => {
339
- return props.buttonPlacement === "both-reverse" || props.buttonPlacement === "start" || props.buttonPlacement === "start-reverse";
340
- });
341
- const subButtonMousedownHandler = (e) => {
342
- if (e.detail > 1) {
343
- e.preventDefault();
344
- }
345
- };
346
- const focusInputHandler = () => {
347
- var _a2;
348
- (_a2 = inputRef.value) == null ? void 0 : _a2.focus();
349
- };
350
- const hoverFlag = ref(false);
351
- const mouseenterHandler = () => {
352
- hoverFlag.value = true;
353
- };
354
- const mouseleaveHandler = () => {
355
- hoverFlag.value = false;
356
- };
357
- const darkMode = useDarkMode();
358
- watch(
359
- [
360
- () => props.status,
361
- borderRadiusComputed,
362
- shapeComputed,
363
- sizeComputed,
364
- disabledComputed,
365
- () => slots,
366
- first,
367
- last,
368
- darkMode,
369
- hoverFlag,
370
- focusMode
371
- ],
372
- () => {
373
- setTimeout(() => {
374
- drawPixel();
375
- });
376
- }
377
- );
378
- const drawPixel = () => {
379
- const preprocessData = canvasPreprocess(wrapperRef, canvasRef);
380
- if (!preprocessData) {
381
- return;
382
- }
383
- const { ctx, width, height, canvas } = preprocessData;
384
- const pixelSize = calcPixelSize();
385
- const borderRadius = getBorderRadius(
386
- canvas,
387
- pixelSize,
388
- borderRadiusComputed.value,
389
- shapeComputed.value,
390
- sizeComputed.value || "medium",
391
- innerInputGroup.value,
392
- first.value,
393
- last.value
394
- );
395
- 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);
396
- const center = calcBorderCornerCenter(borderRadius, width, height, pixelSize);
397
- const rad = BORDER_CORNER_RAD_RANGE;
398
- drawBorder(
399
- ctx,
400
- width,
401
- height,
402
- center,
403
- borderRadius,
404
- rad,
405
- borderColor,
406
- pixelSize,
407
- innerInputGroup.value,
408
- first.value,
409
- last.value
410
- );
411
- const backgroundColor = disabledComputed.value ? getGlobalThemeColor("neutral", 6) : getGlobalThemeColor("neutral", 1);
412
- floodFill(ctx, Math.round(width / 2), Math.round(height / 2), backgroundColor);
413
- };
414
- onMounted(() => {
415
- nextTick(() => {
416
- drawPixel();
417
- });
418
- });
419
- useResizeObserver(wrapperRef, drawPixel);
420
- useWatchGlobalCssVal(drawPixel);
421
- return (_ctx, _cache) => {
422
- return openBlock(), createElementBlock(
423
- "div",
424
- {
425
- class: normalizeClass(["pixelium px-input-number", {
426
- [`px-input-number__${sizeComputed.value}`]: !!sizeComputed.value,
427
- [`px-input-number__${shapeComputed.value}`]: !!shapeComputed.value,
428
- "px-input-number__inner": innerInputGroup.value,
429
- "px-input-number__disabled": !!disabledComputed.value
430
- }]),
431
- ref_key: "wrapperRef",
432
- ref: wrapperRef,
433
- onClick: focusInputHandler,
434
- onMouseenter: mouseenterHandler,
435
- onMouseleave: mouseleaveHandler
436
- },
437
- [
438
- unref(slots).prefix ? (openBlock(), createElementBlock("div", _hoisted_1, [
439
- renderSlot(_ctx.$slots, "prefix")
440
- ])) : createCommentVNode("v-if", true),
441
- showSettingPrefix.value ? (openBlock(), createElementBlock(
442
- "div",
443
- {
444
- key: 1,
445
- class: normalizeClass([
446
- "px-input-number-setting-prefix-wrapper",
447
- props.buttonPlacement === "start-reverse" && "px-input-number-setting-prefix-wrapper__reverse"
448
- ])
449
- },
450
- [
451
- showPlusPrefix.value ? (openBlock(), createBlock(unref(Plus), {
452
- key: 0,
453
- class: normalizeClass(["px-input-number-icon", increaseDisabled.value && "px-input-number-icon__disabled"]),
454
- onClick: increaseHandler,
455
- onMousedown: subButtonMousedownHandler
456
- }, null, 8, ["class"])) : createCommentVNode("v-if", true),
457
- showMinusPrefix.value ? (openBlock(), createBlock(unref(Minus), {
458
- key: 1,
459
- class: normalizeClass(["px-input-number-icon", decreaseDisabled.value && "px-input-number-icon__disabled"]),
460
- onClick: decreaseHandler,
461
- onMousedown: subButtonMousedownHandler
462
- }, null, 8, ["class"])) : createCommentVNode("v-if", true)
463
- ],
464
- 2
465
- /* CLASS */
466
- )) : createCommentVNode("v-if", true),
467
- createElementVNode("input", {
468
- class: "px-input-number-inner",
469
- value: inputValue.value,
470
- ref_key: "inputRef",
471
- ref: inputRef,
472
- placeholder: props.placeholder,
473
- disabled: disabledComputed.value || props.readonly,
474
- autofocus: __props.autofocus,
475
- onInput: withModifiers(inputHandler, ["stop"]),
476
- onChange: withModifiers(changeHandler, ["stop"]),
477
- onBlur: blurHandler,
478
- onFocus: focusHandler,
479
- onCompositionstart: _cache[0] || (_cache[0] = //@ts-ignore
480
- (...args) => unref(compositionStartHandler) && unref(compositionStartHandler)(...args)),
481
- onCompositionend: _cache[1] || (_cache[1] = //@ts-ignore
482
- (...args) => unref(compositionUpdateHandler) && unref(compositionUpdateHandler)(...args))
483
- }, null, 40, _hoisted_2),
484
- showClose.value ? (openBlock(), createElementBlock("div", _hoisted_3, [
485
- hoverFlag.value && !!inputValue.value ? (openBlock(), createBlock(unref(TimesCircleSolid), {
486
- key: 0,
487
- class: "px-input-number-icon",
488
- onClick: clearHandler
489
- })) : (openBlock(), createElementBlock("div", _hoisted_4))
490
- ])) : createCommentVNode("v-if", true),
491
- showSettingSuffix.value ? (openBlock(), createElementBlock(
492
- "div",
493
- {
494
- key: 3,
495
- class: normalizeClass([
496
- "px-input-number-setting-suffix-wrapper",
497
- props.buttonPlacement === "end-reverse" && "px-input-number-setting-suffix-wrapper__reverse"
498
- ])
499
- },
500
- [
501
- showPlusSuffix.value ? (openBlock(), createBlock(unref(Plus), {
502
- key: 0,
503
- class: normalizeClass(["px-input-number-icon", increaseDisabled.value && "px-input-number-icon__disabled"]),
504
- onClick: increaseHandler,
505
- onMousedown: subButtonMousedownHandler
506
- }, null, 8, ["class"])) : createCommentVNode("v-if", true),
507
- showMinusSuffix.value ? (openBlock(), createBlock(unref(Minus), {
508
- key: 1,
509
- class: normalizeClass(["px-input-number-icon", decreaseDisabled.value && "px-input-number-icon__disabled"]),
510
- onClick: decreaseHandler,
511
- onMousedown: subButtonMousedownHandler
512
- }, null, 8, ["class"])) : createCommentVNode("v-if", true)
513
- ],
514
- 2
515
- /* CLASS */
516
- )) : createCommentVNode("v-if", true),
517
- props.loading ? (openBlock(), createElementBlock("div", _hoisted_5, [
518
- createVNode(unref(SpinnerThirdSolid), { class: "px-input-number-icon px-animation__loading" })
519
- ])) : createCommentVNode("v-if", true),
520
- unref(slots).suffix ? (openBlock(), createElementBlock("div", _hoisted_6, [
521
- renderSlot(_ctx.$slots, "suffix")
522
- ])) : createCommentVNode("v-if", true),
523
- createElementVNode(
524
- "canvas",
525
- {
526
- class: "px-input-number-canvas",
527
- ref_key: "canvasRef",
528
- ref: canvasRef
529
- },
530
- null,
531
- 512
532
- /* NEED_PATCH */
533
- )
534
- ],
535
- 34
536
- /* CLASS, NEED_HYDRATION */
537
- );
538
- };
539
- }
45
+ var input_number_default = /* @__PURE__ */ defineComponent({
46
+ name: "InputNumber",
47
+ __name: "index",
48
+ props: {
49
+ modelValue: null,
50
+ defaultValue: null,
51
+ placeholder: null,
52
+ disabled: {
53
+ type: Boolean,
54
+ default: false
55
+ },
56
+ readonly: {
57
+ type: Boolean,
58
+ default: false
59
+ },
60
+ max: { default: Number.MAX_SAFE_INTEGER },
61
+ min: { default: Number.MIN_SAFE_INTEGER },
62
+ step: { default: 1 },
63
+ precision: null,
64
+ strickStep: {
65
+ type: Boolean,
66
+ default: false
67
+ },
68
+ format: { type: Function },
69
+ allowInput: { type: Function },
70
+ parse: { type: Function },
71
+ clearable: {
72
+ type: Boolean,
73
+ default: false
74
+ },
75
+ loading: {
76
+ type: Boolean,
77
+ default: false
78
+ },
79
+ size: null,
80
+ shape: null,
81
+ borderRadius: null,
82
+ buttonPlacement: { default: "end" },
83
+ status: { default: "normal" },
84
+ autofocus: { type: Boolean }
85
+ },
86
+ emits: [
87
+ "input",
88
+ "update:modelValue",
89
+ "change",
90
+ "clear",
91
+ "blur",
92
+ "focus"
93
+ ],
94
+ setup(__props, { expose: __expose, emit: __emit }) {
95
+ var _instance$parent;
96
+ const props = __props;
97
+ const emits = __emit;
98
+ const instance = getCurrentInstance();
99
+ const innerInputGroup = ref((instance === null || instance === void 0 || (_instance$parent = instance.parent) === null || _instance$parent === void 0 ? void 0 : _instance$parent.type.name) === "InputGroup");
100
+ const [index, first, last] = innerInputGroup.value ? useIndexOfChildren(INPUT_GROUP_UPDATE) : [
101
+ ref(0),
102
+ ref(false),
103
+ ref(false)
104
+ ];
105
+ const inputGroupProvide = inject(INPUT_GROUP_PROVIDE);
106
+ const formItemProvide = inject(FORM_ITEM_PROVIDE);
107
+ const borderRadiusComputed = createProvideComputed("borderRadius", [innerInputGroup.value && inputGroupProvide, props]);
108
+ const sizeComputed = createProvideComputed("size", () => [
109
+ innerInputGroup.value && inputGroupProvide,
110
+ props.size && props,
111
+ formItemProvide,
112
+ props
113
+ ], "nullish", (val) => val || "medium");
114
+ const shapeComputed = createProvideComputed("shape", [innerInputGroup.value && inputGroupProvide, props], "nullish", (val) => val || "rect");
115
+ const disabledComputed = createProvideComputed("disabled", [
116
+ innerInputGroup.value && inputGroupProvide,
117
+ formItemProvide,
118
+ props
119
+ ], "or");
120
+ const readonlyComputed = createProvideComputed("readonly", [
121
+ innerInputGroup.value && inputGroupProvide,
122
+ formItemProvide,
123
+ props
124
+ ], "or");
125
+ const statusComputed = createProvideComputed("status", [formItemProvide, props]);
126
+ const nextIsTextButton = computed(() => {
127
+ if (index.value >= 0) {
128
+ var _inputGroupProvide$ch;
129
+ 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;
130
+ } else return false;
131
+ });
132
+ const reg4Number = /^[+-]?\d+(?:\.\d*)?$/;
133
+ const adjustValue = (value) => {
134
+ if (F(value)) value = 0;
135
+ if (A(props.precision)) value = fixedNumber(value, props.precision);
136
+ const min = props.min ?? Number.MIN_SAFE_INTEGER;
137
+ const max = props.max ?? Number.MAX_SAFE_INTEGER;
138
+ value = ke(value, min, max);
139
+ if (props.strickStep && !R(props.step) && !F(props.step) && props.step !== 0) {
140
+ let valueWithStrickStep = Math.round(value / props.step) * props.step;
141
+ if (valueWithStrickStep < min) valueWithStrickStep = Math.ceil(value / props.step) * props.step;
142
+ if (valueWithStrickStep > max) valueWithStrickStep = Math.floor(value / props.step) * props.step;
143
+ value = valueWithStrickStep;
144
+ }
145
+ return value;
146
+ };
147
+ const formatNumberValue = (value) => {
148
+ if (props.format) return props.format(value);
149
+ if (F(value) || E(value)) return "";
150
+ return A(props.precision) ? value.toFixed(ke(Math.round(props.precision), 0, 100)) : value + "";
151
+ };
152
+ const checkInputValue = (value) => {
153
+ if (props.allowInput) return props.allowInput(value);
154
+ if (!value.length) return true;
155
+ return reg4Number.test(value);
156
+ };
157
+ const formatEmitModelValue = (value) => {
158
+ if (props.parse) return props.parse(value);
159
+ if (!value.length) return 0;
160
+ return parseFloat(value);
161
+ };
162
+ const [modelValue, updateModelValue] = useControlledMode("modelValue", props, emits, {
163
+ defaultField: "defaultValue",
164
+ transform: (value) => {
165
+ if (!E(value)) {
166
+ const adjustedInitValue = adjustValue(value);
167
+ if (adjustedInitValue !== value) emits("update:modelValue", adjustedInitValue);
168
+ return adjustedInitValue;
169
+ }
170
+ return value;
171
+ }
172
+ });
173
+ const inputValue = ref(formatNumberValue(modelValue.value));
174
+ const [isComposing, compositionStartHandler, compositionUpdateHandler] = useComposition({ afterComposition: (e) => {
175
+ nextTick(() => {
176
+ inputHandler(e);
177
+ });
178
+ } });
179
+ const wrapperRef = shallowRef(null);
180
+ const canvasRef = shallowRef(null);
181
+ const inputRef = shallowRef(null);
182
+ const plusRef = shallowRef(null);
183
+ const minusRef = shallowRef(null);
184
+ const setInputValue = (value) => {
185
+ inputValue.value = value;
186
+ };
187
+ watch(modelValue, (val) => {
188
+ if (!focusMode.value) setInputValue(formatNumberValue(val));
189
+ });
190
+ const inputHandler = async (e) => {
191
+ const newValue = e.target.value;
192
+ if (isComposing.value) return;
193
+ if (!checkInputValue(newValue)) {
194
+ if (inputRef.value) inputRef.value.value = inputValue.value;
195
+ return;
196
+ }
197
+ inputValue.value = newValue;
198
+ const nextValue = adjustValue(formatEmitModelValue(newValue));
199
+ emits("input", nextValue, e);
200
+ await updateModelValue(nextValue);
201
+ };
202
+ const clearHandler = async () => {
203
+ const defaultValue = adjustValue(0);
204
+ await updateModelValue(defaultValue);
205
+ setInputValue(formatNumberValue(modelValue.value));
206
+ emits("change", defaultValue);
207
+ emits("clear", defaultValue);
208
+ formItemProvide === null || formItemProvide === void 0 || formItemProvide.changeHandler();
209
+ };
210
+ const changeHandler = (e) => {
211
+ const target = e.target;
212
+ const numberValue = formatEmitModelValue(target.value);
213
+ setInputValue(formatNumberValue(modelValue.value));
214
+ emits("change", numberValue, e);
215
+ formItemProvide === null || formItemProvide === void 0 || formItemProvide.changeHandler();
216
+ };
217
+ const focusMode = ref(false);
218
+ const blurHandler = (e) => {
219
+ setInputValue(formatNumberValue(modelValue.value));
220
+ focusMode.value = false;
221
+ emits("blur", e);
222
+ formItemProvide === null || formItemProvide === void 0 || formItemProvide.blurHandler();
223
+ };
224
+ const focusHandler = (e) => {
225
+ focusMode.value = true;
226
+ emits("focus", e);
227
+ };
228
+ const showClose = computed(() => {
229
+ return props.clearable && !disabledComputed.value && !readonlyComputed.value;
230
+ });
231
+ const slots = useSlots();
232
+ __expose({
233
+ focus: () => {
234
+ var _inputRef$value;
235
+ (_inputRef$value = inputRef.value) === null || _inputRef$value === void 0 || _inputRef$value.focus();
236
+ },
237
+ blur: () => {
238
+ var _inputRef$value2;
239
+ (_inputRef$value2 = inputRef.value) === null || _inputRef$value2 === void 0 || _inputRef$value2.blur();
240
+ },
241
+ clear: () => clearHandler(),
242
+ select: () => {
243
+ var _inputRef$value3;
244
+ (_inputRef$value3 = inputRef.value) === null || _inputRef$value3 === void 0 || _inputRef$value3.select();
245
+ }
246
+ });
247
+ const increaseDisabled = computed(() => {
248
+ return readonlyComputed.value || disabledComputed.value || !E(modelValue.value) && modelValue.value >= props.max;
249
+ });
250
+ const decreaseDisabled = computed(() => {
251
+ return readonlyComputed.value || disabledComputed.value || !E(modelValue.value) && modelValue.value <= props.min;
252
+ });
253
+ const increaseHandler = async () => {
254
+ if (increaseDisabled.value) return;
255
+ let currentValue = modelValue.value;
256
+ if (E(currentValue)) currentValue = adjustValue(0);
257
+ const nextValue = adjustValue(currentValue + props.step);
258
+ await updateModelValue(nextValue);
259
+ emits("change", nextValue);
260
+ setInputValue(formatNumberValue(modelValue.value));
261
+ formItemProvide === null || formItemProvide === void 0 || formItemProvide.changeHandler();
262
+ };
263
+ const decreaseHandler = async () => {
264
+ if (decreaseDisabled.value) return;
265
+ let currentValue = modelValue.value;
266
+ if (E(currentValue)) currentValue = adjustValue(0);
267
+ const nextValue = adjustValue(currentValue - props.step);
268
+ await updateModelValue(nextValue);
269
+ emits("change", nextValue);
270
+ setInputValue(formatNumberValue(modelValue.value));
271
+ formItemProvide === null || formItemProvide === void 0 || formItemProvide.changeHandler();
272
+ };
273
+ const showSettingSuffix = computed(() => {
274
+ return props.buttonPlacement === "both" || props.buttonPlacement === "both-reverse" || props.buttonPlacement === "end" || props.buttonPlacement === "end-reverse";
275
+ });
276
+ const showPlusSuffix = computed(() => {
277
+ return props.buttonPlacement === "both-reverse" || props.buttonPlacement === "end" || props.buttonPlacement === "end-reverse";
278
+ });
279
+ const showMinusSuffix = computed(() => {
280
+ return props.buttonPlacement === "both" || props.buttonPlacement === "end" || props.buttonPlacement === "end-reverse";
281
+ });
282
+ const showSettingPrefix = computed(() => {
283
+ return props.buttonPlacement === "both" || props.buttonPlacement === "both-reverse" || props.buttonPlacement === "start" || props.buttonPlacement === "start-reverse";
284
+ });
285
+ const showPlusPrefix = computed(() => {
286
+ return props.buttonPlacement === "both" || props.buttonPlacement === "start" || props.buttonPlacement === "start-reverse";
287
+ });
288
+ const showMinusPrefix = computed(() => {
289
+ return props.buttonPlacement === "both-reverse" || props.buttonPlacement === "start" || props.buttonPlacement === "start-reverse";
290
+ });
291
+ const subButtonMousedownHandler = (e) => {
292
+ if (e.detail > 1) e.preventDefault();
293
+ };
294
+ const focusInputHandler = (e) => {
295
+ var _inputRef$value4, _inputRef$value5;
296
+ const target = e.target;
297
+ const plusIcon = plusRef.value.$el;
298
+ const minusIcon = minusRef.value.$el;
299
+ if (((_inputRef$value4 = inputRef.value) === null || _inputRef$value4 === void 0 ? void 0 : _inputRef$value4.contains(target)) || (minusIcon === null || minusIcon === void 0 ? void 0 : minusIcon.contains(target)) || (plusIcon === null || plusIcon === void 0 ? void 0 : plusIcon.contains(target))) return;
300
+ (_inputRef$value5 = inputRef.value) === null || _inputRef$value5 === void 0 || _inputRef$value5.focus();
301
+ };
302
+ const hoverFlag = ref(false);
303
+ const mouseenterHandler = () => {
304
+ hoverFlag.value = true;
305
+ };
306
+ const mouseleaveHandler = () => {
307
+ hoverFlag.value = false;
308
+ };
309
+ watch([
310
+ statusComputed,
311
+ borderRadiusComputed,
312
+ shapeComputed,
313
+ sizeComputed,
314
+ readonlyComputed,
315
+ disabledComputed,
316
+ () => slots,
317
+ first,
318
+ last,
319
+ useDarkMode(),
320
+ hoverFlag,
321
+ focusMode,
322
+ nextIsTextButton
323
+ ], () => {
324
+ setTimeout(() => {
325
+ drawPixel();
326
+ });
327
+ });
328
+ const drawPixel = () => {
329
+ const preprocessData = canvasPreprocess(wrapperRef, canvasRef);
330
+ if (!preprocessData) return;
331
+ const { ctx, width, height, canvas } = preprocessData;
332
+ const pixelSize = calcPixelSize();
333
+ const borderRadius = getBorderRadius(canvas, pixelSize, borderRadiusComputed.value, shapeComputed.value, sizeComputed.value || "medium", innerInputGroup.value, first.value, last.value);
334
+ 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);
335
+ const center = calcBorderCornerCenter(borderRadius, width, height, pixelSize);
336
+ const rad = BORDER_CORNER_RAD_RANGE;
337
+ if (borderColor) drawBorder(ctx, width, height, center, borderRadius, rad, borderColor, pixelSize, innerInputGroup.value, first.value, last.value, nextIsTextButton.value);
338
+ const backgroundColor = disabledComputed.value ? getGlobalThemeColor("neutral", 6) : getGlobalThemeColor("neutral", 1);
339
+ if (backgroundColor) floodFill(ctx, Math.round(width / 2), Math.round(height / 2), backgroundColor);
340
+ };
341
+ onMounted(() => {
342
+ nextTick(() => {
343
+ drawPixel();
344
+ });
345
+ });
346
+ useResizeObserver(wrapperRef, drawPixel);
347
+ useWatchGlobalCssVal(drawPixel);
348
+ useTransitionEnd(wrapperRef, drawPixel);
349
+ return (_ctx, _cache) => {
350
+ return openBlock(), createElementBlock("div", {
351
+ class: normalizeClass(["pixelium px-input-number", {
352
+ [`px-input-number__${unref(sizeComputed)}`]: !!unref(sizeComputed),
353
+ [`px-input-number__${unref(shapeComputed)}`]: !!unref(shapeComputed),
354
+ "px-input-number__inner": innerInputGroup.value,
355
+ "px-input-number__disabled": !!unref(disabledComputed)
356
+ }]),
357
+ ref_key: "wrapperRef",
358
+ ref: wrapperRef,
359
+ onClick: focusInputHandler,
360
+ onMouseenter: mouseenterHandler,
361
+ onMouseleave: mouseleaveHandler,
362
+ onFocusout: blurHandler,
363
+ onFocusin: focusHandler
364
+ }, [
365
+ unref(slots).prefix ? (openBlock(), createElementBlock("div", _hoisted_1, [renderSlot(_ctx.$slots, "prefix")])) : createCommentVNode("v-if", true),
366
+ showSettingPrefix.value ? (openBlock(), createElementBlock("div", {
367
+ key: 1,
368
+ class: normalizeClass(["px-input-number-setting-prefix-wrapper", props.buttonPlacement === "start-reverse" && "px-input-number-setting-prefix-wrapper__reverse"])
369
+ }, [showPlusPrefix.value ? (openBlock(), createBlock(unref(plus_default), {
370
+ key: 0,
371
+ class: normalizeClass(["px-input-number-icon", increaseDisabled.value && "px-input-number-icon__disabled"]),
372
+ onClick: increaseHandler,
373
+ onMousedown: subButtonMousedownHandler,
374
+ tabindex: unref(disabledComputed) || unref(readonlyComputed) || increaseDisabled.value ? -1 : 0,
375
+ ref_key: "plusRef",
376
+ ref: plusRef
377
+ }, null, 8, ["tabindex", "class"])) : createCommentVNode("v-if", true), showMinusPrefix.value ? (openBlock(), createBlock(unref(minus_default), {
378
+ key: 1,
379
+ class: normalizeClass(["px-input-number-icon", decreaseDisabled.value && "px-input-number-icon__disabled"]),
380
+ onClick: decreaseHandler,
381
+ onMousedown: subButtonMousedownHandler,
382
+ tabindex: unref(disabledComputed) || unref(readonlyComputed) || decreaseDisabled.value ? -1 : 0,
383
+ ref_key: "minusRef",
384
+ ref: minusRef
385
+ }, null, 8, ["tabindex", "class"])) : createCommentVNode("v-if", true)], 2)) : createCommentVNode("v-if", true),
386
+ createElementVNode("input", {
387
+ class: "px-input-number-inner",
388
+ value: inputValue.value,
389
+ ref_key: "inputRef",
390
+ ref: inputRef,
391
+ placeholder: props.placeholder,
392
+ disabled: unref(disabledComputed) || unref(readonlyComputed),
393
+ autofocus: __props.autofocus,
394
+ onInput: withModifiers(inputHandler, ["stop"]),
395
+ onChange: withModifiers(changeHandler, ["stop"]),
396
+ onCompositionstart: _cache[0] || (_cache[0] = (...args) => unref(compositionStartHandler) && unref(compositionStartHandler)(...args)),
397
+ onCompositionend: _cache[1] || (_cache[1] = (...args) => unref(compositionUpdateHandler) && unref(compositionUpdateHandler)(...args))
398
+ }, null, 40, _hoisted_2),
399
+ showClose.value ? (openBlock(), createElementBlock("div", _hoisted_3, [hoverFlag.value && !!inputValue.value ? (openBlock(), createBlock(unref(times_circle_solid_default), {
400
+ key: 0,
401
+ class: "px-input-number-icon",
402
+ onClick: clearHandler
403
+ })) : (openBlock(), createElementBlock("div", _hoisted_4))])) : createCommentVNode("v-if", true),
404
+ showSettingSuffix.value ? (openBlock(), createElementBlock("div", {
405
+ key: 3,
406
+ class: normalizeClass(["px-input-number-setting-suffix-wrapper", props.buttonPlacement === "end-reverse" && "px-input-number-setting-suffix-wrapper__reverse"])
407
+ }, [showPlusSuffix.value ? (openBlock(), createBlock(unref(plus_default), {
408
+ key: 0,
409
+ class: normalizeClass(["px-input-number-icon", increaseDisabled.value && "px-input-number-icon__disabled"]),
410
+ onClick: increaseHandler,
411
+ onMousedown: subButtonMousedownHandler,
412
+ tabindex: unref(disabledComputed) || unref(readonlyComputed) || increaseDisabled.value ? -1 : 0,
413
+ ref_key: "plusRef",
414
+ ref: plusRef
415
+ }, null, 8, ["tabindex", "class"])) : createCommentVNode("v-if", true), showMinusSuffix.value ? (openBlock(), createBlock(unref(minus_default), {
416
+ key: 1,
417
+ class: normalizeClass(["px-input-number-icon", decreaseDisabled.value && "px-input-number-icon__disabled"]),
418
+ onClick: decreaseHandler,
419
+ onMousedown: subButtonMousedownHandler,
420
+ tabindex: unref(disabledComputed) || unref(readonlyComputed) || decreaseDisabled.value ? -1 : 0,
421
+ ref_key: "minusRef",
422
+ ref: minusRef
423
+ }, null, 8, ["tabindex", "class"])) : createCommentVNode("v-if", true)], 2)) : createCommentVNode("v-if", true),
424
+ props.loading ? (openBlock(), createElementBlock("div", _hoisted_5, [createVNode(unref(spinner_third_solid_default), { class: "px-input-number-icon px-animation__loading" })])) : createCommentVNode("v-if", true),
425
+ unref(slots).suffix ? (openBlock(), createElementBlock("div", _hoisted_6, [renderSlot(_ctx.$slots, "suffix")])) : createCommentVNode("v-if", true),
426
+ createElementVNode("canvas", {
427
+ class: "px-input-number-canvas",
428
+ ref_key: "canvasRef",
429
+ ref: canvasRef
430
+ }, null, 512)
431
+ ], 34);
432
+ };
433
+ }
540
434
  });
541
- export {
542
- _sfc_main as _
543
- };
435
+ export { input_number_default as t };