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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (199) hide show
  1. package/README.md +21 -10
  2. package/README.zh.md +21 -10
  3. package/dist/icon-pa.d.ts +490 -0
  4. package/dist/index.d.ts +1586 -10
  5. package/dist/pixelium-vue-icon-pa.cjs +1 -0
  6. package/dist/pixelium-vue-icon-pa.css +1 -0
  7. package/dist/pixelium-vue-icon-pa.js +10143 -0
  8. package/dist/pixelium-vue-icon-pa.umd.cjs +1 -0
  9. package/dist/pixelium-vue.cjs +12 -1
  10. package/dist/pixelium-vue.css +1 -1
  11. package/dist/pixelium-vue.js +5370 -1093
  12. package/dist/pixelium-vue.umd.cjs +12 -1
  13. package/es/aside/css.js +1 -1
  14. package/es/aside/index.js +60 -13
  15. package/es/auto-complete/css.js +2 -0
  16. package/es/auto-complete/draw.d.ts +2 -0
  17. package/es/auto-complete/draw.js +52 -0
  18. package/es/auto-complete/index.css +123 -0
  19. package/es/auto-complete/index.d.ts +35 -0
  20. package/es/auto-complete/index.js +402 -0
  21. package/es/auto-complete/type.d.ts +192 -0
  22. package/es/button/css.js +1 -1
  23. package/es/button/draw.d.ts +1 -2
  24. package/es/button/draw.js +105 -123
  25. package/es/button/index.css +24 -14
  26. package/es/button/index.js +70 -121
  27. package/es/button-group/css.js +1 -1
  28. package/es/button-group/index.d.ts +0 -1
  29. package/es/button-group/index.js +11 -37
  30. package/es/button-group/type.d.ts +1 -1
  31. package/es/col/css.js +1 -1
  32. package/es/col/index.d.ts +2 -2
  33. package/es/container/css.js +1 -1
  34. package/es/divider/css.js +1 -1
  35. package/es/empty/css.js +2 -0
  36. package/es/empty/index.css +19 -0
  37. package/es/empty/index.d.ts +17 -0
  38. package/es/empty/index.js +73 -0
  39. package/es/empty/type.d.ts +19 -0
  40. package/es/footer/css.js +1 -1
  41. package/es/grid/css.js +1 -1
  42. package/es/grid/index.js +5 -1
  43. package/es/grid-item/css.js +1 -1
  44. package/es/grid-item/index.d.ts +1 -1
  45. package/es/grid-item/index.js +7 -3
  46. package/es/header/css.js +1 -1
  47. package/es/icon/css.js +1 -1
  48. package/es/icon/index.css +0 -3
  49. package/es/icon/index.js +1 -1
  50. package/es/icons/css-pa.js +2 -0
  51. package/es/icons/icon-hn.js +1 -1
  52. package/es/icons/icon-pa.css +9 -0
  53. package/es/icons/icon-pa.d.ts +490 -0
  54. package/es/icons/icon-pa.js +17449 -0
  55. package/es/index.css +22 -8
  56. package/es/index.d.ts +18 -1
  57. package/es/index.js +63 -2
  58. package/es/input/css.js +2 -0
  59. package/es/input/draw.d.ts +2 -0
  60. package/es/input/draw.js +52 -0
  61. package/es/input/index.css +138 -0
  62. package/es/input/index.d.ts +50 -0
  63. package/es/input/index.js +432 -0
  64. package/es/input/type.d.ts +175 -0
  65. package/es/input-group/css.js +2 -0
  66. package/es/input-group/index.css +24 -0
  67. package/es/input-group/index.d.ts +17 -0
  68. package/es/input-group/index.js +40 -0
  69. package/es/input-group/type.d.ts +30 -0
  70. package/es/input-group-label/css.js +2 -0
  71. package/es/input-group-label/draw.d.ts +2 -0
  72. package/es/input-group-label/draw.js +52 -0
  73. package/es/input-group-label/index.css +50 -0
  74. package/es/input-group-label/index.d.ts +16 -0
  75. package/es/input-group-label/index.js +129 -0
  76. package/es/input-group-label/type.d.ts +30 -0
  77. package/es/input-number/css.js +2 -0
  78. package/es/input-number/draw.d.ts +2 -0
  79. package/es/input-number/draw.js +52 -0
  80. package/es/input-number/index.css +161 -0
  81. package/es/input-number/index.d.ts +47 -0
  82. package/es/input-number/index.js +543 -0
  83. package/es/input-number/type.d.ts +183 -0
  84. package/es/input-tag/css.js +2 -0
  85. package/es/input-tag/draw.d.ts +2 -0
  86. package/es/input-tag/draw.js +49 -0
  87. package/es/input-tag/index.css +133 -0
  88. package/es/input-tag/index.d.ts +73 -0
  89. package/es/input-tag/index.js +474 -0
  90. package/es/input-tag/type.d.ts +212 -0
  91. package/es/link/css.js +1 -1
  92. package/es/link/index.css +2 -5
  93. package/es/link/index.js +10 -6
  94. package/es/main/css.js +1 -1
  95. package/es/mask/css.js +2 -0
  96. package/es/mask/index.css +17 -0
  97. package/es/mask/index.d.ts +8 -0
  98. package/es/mask/index.js +117 -0
  99. package/es/mask/type.d.ts +27 -0
  100. package/es/message/css.js +1 -1
  101. package/es/message/index.css +26 -26
  102. package/es/message/index.d.ts +1 -1
  103. package/es/message/index.js +22 -50
  104. package/es/message-box/css.js +1 -1
  105. package/es/message-box/index.js +40 -30
  106. package/es/message-box/message-box-wrapped.d.ts +0 -1
  107. package/es/message-box/message-box-wrapped.js +2 -2
  108. package/es/message-box/message-box.d.ts +2 -1
  109. package/es/message-box/message-box.js +10 -8
  110. package/es/message-box/type.d.ts +14 -4
  111. package/es/option-list/css.js +2 -0
  112. package/es/option-list/index.css +57 -0
  113. package/es/option-list/index.d.ts +38 -0
  114. package/es/option-list/index.js +169 -0
  115. package/es/option-list/type.d.ts +16 -0
  116. package/es/popover/css.js +1 -0
  117. package/es/popover/index.d.ts +203 -0
  118. package/es/popover/index.js +240 -0
  119. package/es/popover/type.d.ts +100 -0
  120. package/es/popup-content/css.js +2 -0
  121. package/es/popup-content/draw.d.ts +6 -0
  122. package/es/popup-content/draw.js +151 -0
  123. package/es/popup-content/index.css +99 -0
  124. package/es/popup-content/index.d.ts +30 -0
  125. package/es/popup-content/index.js +1578 -0
  126. package/es/popup-content/type.d.ts +20 -0
  127. package/es/popup-trigger/css.js +1 -0
  128. package/es/popup-trigger/index.d.ts +22 -0
  129. package/es/popup-trigger/index.js +97 -0
  130. package/es/popup-trigger/type.d.ts +9 -0
  131. package/es/row/css.js +1 -1
  132. package/es/select/css.js +2 -0
  133. package/es/select/draw.d.ts +2 -0
  134. package/es/select/draw.js +52 -0
  135. package/es/select/index.css +152 -0
  136. package/es/select/index.d.ts +44 -0
  137. package/es/select/index.js +677 -0
  138. package/es/select/type.d.ts +252 -0
  139. package/es/share/const/event-bus-key.d.ts +4 -0
  140. package/es/share/const/event-bus-key.js +10 -0
  141. package/es/share/const/index.d.ts +4 -0
  142. package/es/share/const/index.js +11 -2
  143. package/es/share/const/provide-key.d.ts +3 -0
  144. package/es/share/const/provide-key.js +8 -0
  145. package/es/share/hook/use-click-outside-listener.d.ts +4 -0
  146. package/es/share/hook/use-click-outside-listener.js +44 -0
  147. package/es/share/hook/use-composition.d.ts +5 -0
  148. package/es/share/hook/use-composition.js +17 -0
  149. package/es/share/hook/use-controlled-mode.d.ts +6 -0
  150. package/es/share/hook/use-controlled-mode.js +25 -0
  151. package/es/share/hook/use-dark-mode.js +11 -3
  152. package/es/share/hook/use-index-of-children.d.ts +2 -1
  153. package/es/share/hook/use-index-of-children.js +25 -35
  154. package/es/share/hook/use-resize-observer.js +1 -1
  155. package/es/share/hook/use-textarea-height.d.ts +5 -0
  156. package/es/share/hook/use-textarea-height.js +116 -0
  157. package/es/share/hook/use-watch-global-css-var.d.ts +1 -0
  158. package/es/share/hook/use-watch-global-css-var.js +19 -0
  159. package/es/share/hook/use-z-index.d.ts +6 -0
  160. package/es/share/hook/use-z-index.js +32 -0
  161. package/es/share/type/index.d.ts +9 -1
  162. package/es/share/util/color.js +4 -2
  163. package/es/share/util/common.d.ts +5 -0
  164. package/es/share/util/common.js +71 -0
  165. package/es/share/util/event-bus.d.ts +1 -0
  166. package/es/share/util/event-bus.js +20 -0
  167. package/es/share/util/plot.d.ts +15 -2
  168. package/es/share/util/plot.js +200 -30
  169. package/es/share/util/render.d.ts +1 -0
  170. package/es/share/util/render.js +10 -2
  171. package/es/share/util/theme.js +23 -4
  172. package/es/space/css.js +1 -1
  173. package/es/space/index.css +5 -0
  174. package/es/space/index.js +2 -2
  175. package/es/spin/css.js +2 -0
  176. package/es/spin/index.css +66 -0
  177. package/es/spin/index.d.ts +24 -0
  178. package/es/spin/index.js +104 -0
  179. package/es/spin/type.d.ts +54 -0
  180. package/es/tag/css.js +2 -0
  181. package/es/tag/draw.d.ts +6 -0
  182. package/es/tag/draw.js +135 -0
  183. package/es/tag/index.css +372 -0
  184. package/es/tag/index.d.ts +23 -0
  185. package/es/tag/index.js +193 -0
  186. package/es/tag/type.d.ts +58 -0
  187. package/es/textarea/css.js +2 -0
  188. package/es/textarea/draw.d.ts +2 -0
  189. package/es/textarea/draw.js +13 -0
  190. package/es/textarea/index.css +108 -0
  191. package/es/textarea/index.d.ts +49 -0
  192. package/es/textarea/index.js +267 -0
  193. package/es/textarea/type.d.ts +169 -0
  194. package/es/tooltip/css.js +1 -0
  195. package/es/tooltip/index.d.ts +20 -0
  196. package/es/tooltip/index.js +228 -0
  197. package/es/tooltip/type.d.ts +77 -0
  198. package/package.json +17 -3
  199. package/es/icons/{css.js → css-hn.js} +1 -1
@@ -0,0 +1,543 @@
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"
84
+ };
85
+ const _hoisted_2 = ["value", "placeholder", "disabled", "autofocus"];
86
+ const _hoisted_3 = {
87
+ key: 2,
88
+ class: "px-input-number-close-wrapper"
89
+ };
90
+ const _hoisted_4 = {
91
+ key: 1,
92
+ class: "px-input-number-icon-placeholder"
93
+ };
94
+ const _hoisted_5 = {
95
+ key: 4,
96
+ class: "px-input-number-loading-wrapper"
97
+ };
98
+ const _hoisted_6 = {
99
+ key: 5,
100
+ class: "px-input-number-suffix-wrapper"
101
+ };
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
+ }
540
+ });
541
+ export {
542
+ _sfc_main as _
543
+ };