@v-c/input-number 1.0.0 → 1.0.1
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.
- package/dist/InputNumber.cjs +34 -42
- package/dist/InputNumber.js +1 -12
- package/dist/StepHandler.cjs +12 -9
- package/dist/hooks/useCursor.cjs +7 -4
- package/dist/hooks/useFrame.cjs +8 -5
- package/dist/index.cjs +4 -1
- package/dist/utils/numberUtil.cjs +4 -3
- package/package.json +4 -4
package/dist/InputNumber.cjs
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
Object.
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
2
5
|
const require_rolldown_runtime = require("./_virtual/rolldown_runtime.cjs");
|
|
3
6
|
const require_useCursor = require("./hooks/useCursor.cjs");
|
|
4
7
|
const require_useFrame = require("./hooks/useFrame.cjs");
|
|
5
8
|
const require_StepHandler = require("./StepHandler.cjs");
|
|
6
9
|
const require_numberUtil = require("./utils/numberUtil.cjs");
|
|
7
10
|
let vue = require("vue");
|
|
8
|
-
let
|
|
9
|
-
|
|
10
|
-
let
|
|
11
|
-
let
|
|
12
|
-
let
|
|
13
|
-
let
|
|
14
|
-
|
|
11
|
+
let _v_c_mini_decimal = require("@v-c/mini-decimal");
|
|
12
|
+
_v_c_mini_decimal = require_rolldown_runtime.__toESM(_v_c_mini_decimal);
|
|
13
|
+
let _v_c_util = require("@v-c/util");
|
|
14
|
+
let _v_c_util_dist_Dom_focus = require("@v-c/util/dist/Dom/focus");
|
|
15
|
+
let _v_c_util_dist_KeyCode = require("@v-c/util/dist/KeyCode");
|
|
16
|
+
let _v_c_util_dist_omit = require("@v-c/util/dist/omit");
|
|
17
|
+
_v_c_util_dist_omit = require_rolldown_runtime.__toESM(_v_c_util_dist_omit);
|
|
15
18
|
function _isSlot(s) {
|
|
16
19
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !(0, vue.isVNode)(s);
|
|
17
20
|
}
|
|
@@ -28,7 +31,7 @@ function getDecimalValue(stringMode, decimalValue) {
|
|
|
28
31
|
return decimalValue.toNumber();
|
|
29
32
|
}
|
|
30
33
|
function getDecimalIfValidate(value) {
|
|
31
|
-
const decimal = (0,
|
|
34
|
+
const decimal = (0, _v_c_mini_decimal.default)(value);
|
|
32
35
|
return decimal.isInvalidate() ? null : decimal;
|
|
33
36
|
}
|
|
34
37
|
var InputNumber = /* @__PURE__ */ (0, vue.defineComponent)((props, { attrs, slots, expose, emit }) => {
|
|
@@ -40,7 +43,7 @@ var InputNumber = /* @__PURE__ */ (0, vue.defineComponent)((props, { attrs, slot
|
|
|
40
43
|
const inputRef = (0, vue.shallowRef)();
|
|
41
44
|
expose({
|
|
42
45
|
focus: (option) => {
|
|
43
|
-
if (inputRef.value) (0,
|
|
46
|
+
if (inputRef.value) (0, _v_c_util_dist_Dom_focus.triggerFocus)(inputRef.value, option);
|
|
44
47
|
},
|
|
45
48
|
blur: () => {
|
|
46
49
|
inputRef.value?.blur?.();
|
|
@@ -48,14 +51,14 @@ var InputNumber = /* @__PURE__ */ (0, vue.defineComponent)((props, { attrs, slot
|
|
|
48
51
|
nativeElement: (0, vue.computed)(() => rootRef.value || inputRef.value || null),
|
|
49
52
|
input: inputRef
|
|
50
53
|
});
|
|
51
|
-
const decimalValue = (0, vue.shallowRef)((0,
|
|
54
|
+
const decimalValue = (0, vue.shallowRef)((0, _v_c_mini_decimal.default)(props.value ?? props.defaultValue ?? ""));
|
|
52
55
|
const setUncontrolledDecimalValue = (newDecimal) => {
|
|
53
56
|
if (props.value === void 0) decimalValue.value = newDecimal;
|
|
54
57
|
};
|
|
55
58
|
const getPrecision = (numStr, userTyping) => {
|
|
56
59
|
if (userTyping) return;
|
|
57
60
|
if (props.precision !== void 0 && props.precision >= 0) return props.precision;
|
|
58
|
-
return Math.max((0,
|
|
61
|
+
return Math.max((0, _v_c_mini_decimal.getNumberPrecision)(numStr), (0, _v_c_mini_decimal.getNumberPrecision)(props.step ?? 1));
|
|
59
62
|
};
|
|
60
63
|
const mergedParser = (num) => {
|
|
61
64
|
const numStr = String(num);
|
|
@@ -71,12 +74,12 @@ var InputNumber = /* @__PURE__ */ (0, vue.defineComponent)((props, { attrs, slot
|
|
|
71
74
|
userTyping,
|
|
72
75
|
input: String(inputValueRef.value)
|
|
73
76
|
});
|
|
74
|
-
let str = typeof number === "number" ? (0,
|
|
77
|
+
let str = typeof number === "number" ? (0, _v_c_mini_decimal.num2str)(number) : number;
|
|
75
78
|
if (!userTyping) {
|
|
76
79
|
const mergedPrecision = getPrecision(str, userTyping);
|
|
77
|
-
if ((0,
|
|
80
|
+
if ((0, _v_c_mini_decimal.validateNumber)(str) && (props.decimalSeparator || mergedPrecision !== void 0 && mergedPrecision >= 0)) {
|
|
78
81
|
const separatorStr = props.decimalSeparator || ".";
|
|
79
|
-
str = (0,
|
|
82
|
+
str = (0, _v_c_mini_decimal.toFixed)(str, separatorStr, mergedPrecision);
|
|
80
83
|
}
|
|
81
84
|
}
|
|
82
85
|
return str;
|
|
@@ -132,8 +135,8 @@ var InputNumber = /* @__PURE__ */ (0, vue.defineComponent)((props, { attrs, slot
|
|
|
132
135
|
const numStr = updateValue.toString();
|
|
133
136
|
const mergedPrecision = getPrecision(numStr, userTyping);
|
|
134
137
|
if (mergedPrecision !== void 0 && mergedPrecision >= 0) {
|
|
135
|
-
updateValue = (0,
|
|
136
|
-
if (!isInRange(updateValue)) updateValue = (0,
|
|
138
|
+
updateValue = (0, _v_c_mini_decimal.default)((0, _v_c_mini_decimal.toFixed)(numStr, ".", mergedPrecision));
|
|
139
|
+
if (!isInRange(updateValue)) updateValue = (0, _v_c_mini_decimal.default)((0, _v_c_mini_decimal.toFixed)(numStr, ".", mergedPrecision, true));
|
|
137
140
|
}
|
|
138
141
|
if (!updateValue.equals(decimalValue.value)) {
|
|
139
142
|
setUncontrolledDecimalValue(updateValue);
|
|
@@ -152,7 +155,7 @@ var InputNumber = /* @__PURE__ */ (0, vue.defineComponent)((props, { attrs, slot
|
|
|
152
155
|
inputValueRef.value = inputStr;
|
|
153
156
|
inputValue.value = inputStr;
|
|
154
157
|
if (!compositionRef.value) {
|
|
155
|
-
const finalDecimal = (0,
|
|
158
|
+
const finalDecimal = (0, _v_c_mini_decimal.default)(mergedParser(inputStr));
|
|
156
159
|
if (!finalDecimal.isNaN()) triggerValueUpdate(finalDecimal, true);
|
|
157
160
|
}
|
|
158
161
|
props.onInput?.(inputStr);
|
|
@@ -177,9 +180,9 @@ var InputNumber = /* @__PURE__ */ (0, vue.defineComponent)((props, { attrs, slot
|
|
|
177
180
|
const onInternalStep = (up, emitter) => {
|
|
178
181
|
if (up && upDisabled.value || !up && downDisabled.value) return;
|
|
179
182
|
userTypingRef.value = false;
|
|
180
|
-
let stepDecimal = (0,
|
|
183
|
+
let stepDecimal = (0, _v_c_mini_decimal.default)(shiftKeyRef.value ? require_numberUtil.getDecupleSteps(props.step ?? 1) : props.step ?? 1);
|
|
181
184
|
if (!up) stepDecimal = stepDecimal.negate();
|
|
182
|
-
const updatedValue = triggerValueUpdate((decimalValue.value || (0,
|
|
185
|
+
const updatedValue = triggerValueUpdate((decimalValue.value || (0, _v_c_mini_decimal.default)(0)).add(stepDecimal.toString()), false);
|
|
183
186
|
const outValue = getDecimalValue(props.stringMode, updatedValue);
|
|
184
187
|
props.onStep?.(outValue, {
|
|
185
188
|
offset: shiftKeyRef.value ? require_numberUtil.getDecupleSteps(props.step ?? 1) : props.step ?? 1,
|
|
@@ -189,7 +192,7 @@ var InputNumber = /* @__PURE__ */ (0, vue.defineComponent)((props, { attrs, slot
|
|
|
189
192
|
inputRef.value?.focus();
|
|
190
193
|
};
|
|
191
194
|
const flushInputValue = (userTyping) => {
|
|
192
|
-
const parsedValue = (0,
|
|
195
|
+
const parsedValue = (0, _v_c_mini_decimal.default)(mergedParser(inputValue.value));
|
|
193
196
|
let formatValue;
|
|
194
197
|
if (!parsedValue.isNaN()) formatValue = triggerValueUpdate(parsedValue, userTyping);
|
|
195
198
|
else formatValue = triggerValueUpdate(decimalValue.value, userTyping);
|
|
@@ -204,7 +207,7 @@ var InputNumber = /* @__PURE__ */ (0, vue.defineComponent)((props, { attrs, slot
|
|
|
204
207
|
const { key, shiftKey } = event;
|
|
205
208
|
userTypingRef.value = true;
|
|
206
209
|
shiftKeyRef.value = shiftKey;
|
|
207
|
-
if (key ===
|
|
210
|
+
if (key === _v_c_util_dist_KeyCode.KeyCodeStr.Enter) {
|
|
208
211
|
if (!compositionRef.value) userTypingRef.value = false;
|
|
209
212
|
flushInputValue(false);
|
|
210
213
|
props.onPressEnter?.(event);
|
|
@@ -264,9 +267,9 @@ var InputNumber = /* @__PURE__ */ (0, vue.defineComponent)((props, { attrs, slot
|
|
|
264
267
|
if (!decimalValue.value.isInvalidate()) setInputValue(decimalValue.value, false);
|
|
265
268
|
});
|
|
266
269
|
(0, vue.watch)(() => props.value, (newVal) => {
|
|
267
|
-
const newValue = (0,
|
|
270
|
+
const newValue = (0, _v_c_mini_decimal.default)(newVal ?? "");
|
|
268
271
|
decimalValue.value = newValue;
|
|
269
|
-
const currentParsedValue = (0,
|
|
272
|
+
const currentParsedValue = (0, _v_c_mini_decimal.default)(mergedParser(inputValue.value));
|
|
270
273
|
if (!newValue.equals(currentParsedValue) || !userTypingRef.value || props.formatter) setInputValue(newValue, userTypingRef.value);
|
|
271
274
|
});
|
|
272
275
|
(0, vue.watch)(() => inputValue.value, () => {
|
|
@@ -275,7 +278,7 @@ var InputNumber = /* @__PURE__ */ (0, vue.defineComponent)((props, { attrs, slot
|
|
|
275
278
|
return () => {
|
|
276
279
|
const { prefixCls = defaults.prefixCls, classNames, styles, step = defaults.step, disabled, readOnly, controls = defaults.controls, mode = defaults.mode } = props;
|
|
277
280
|
const mergedPrefixCls = prefixCls || defaults.prefixCls;
|
|
278
|
-
const { class: className, style
|
|
281
|
+
const { class: className, style, ...restAttrs } = attrs;
|
|
279
282
|
const mergedClassName = props.className || className;
|
|
280
283
|
const mergedStyle = {
|
|
281
284
|
...styles?.root,
|
|
@@ -302,7 +305,7 @@ var InputNumber = /* @__PURE__ */ (0, vue.defineComponent)((props, { attrs, slot
|
|
|
302
305
|
"className": classNames?.action,
|
|
303
306
|
"style": styles?.action
|
|
304
307
|
}, _isSlot(downNode) ? downNode : { default: () => [downNode] });
|
|
305
|
-
const inputAttrs = (0,
|
|
308
|
+
const inputAttrs = (0, _v_c_util_dist_omit.default)({ ...restAttrs }, [
|
|
306
309
|
"prefixCls",
|
|
307
310
|
"classNames",
|
|
308
311
|
"styles",
|
|
@@ -344,7 +347,7 @@ var InputNumber = /* @__PURE__ */ (0, vue.defineComponent)((props, { attrs, slot
|
|
|
344
347
|
]);
|
|
345
348
|
return (0, vue.createVNode)("div", {
|
|
346
349
|
"ref": rootRef,
|
|
347
|
-
"class": (0,
|
|
350
|
+
"class": (0, _v_c_util.clsx)(mergedPrefixCls, `${mergedPrefixCls}-mode-${mode}`, mergedClassName, classNames?.root, {
|
|
348
351
|
[`${mergedPrefixCls}-focused`]: focus.value,
|
|
349
352
|
[`${mergedPrefixCls}-disabled`]: disabled,
|
|
350
353
|
[`${mergedPrefixCls}-readonly`]: readOnly,
|
|
@@ -374,7 +377,7 @@ var InputNumber = /* @__PURE__ */ (0, vue.defineComponent)((props, { attrs, slot
|
|
|
374
377
|
}, [
|
|
375
378
|
mode === "spinner" && controls && downHandlerNode,
|
|
376
379
|
!!prefixNode && (0, vue.createVNode)("div", {
|
|
377
|
-
"class": (0,
|
|
380
|
+
"class": (0, _v_c_util.clsx)(`${mergedPrefixCls}-prefix`, classNames?.prefix),
|
|
378
381
|
"style": styles?.prefix
|
|
379
382
|
}, [prefixNode]),
|
|
380
383
|
(0, vue.createVNode)("input", (0, vue.mergeProps)({
|
|
@@ -385,7 +388,7 @@ var InputNumber = /* @__PURE__ */ (0, vue.defineComponent)((props, { attrs, slot
|
|
|
385
388
|
"aria-valuenow": decimalValue.value.isInvalidate() ? null : decimalValue.value.toString(),
|
|
386
389
|
"step": step,
|
|
387
390
|
"ref": inputRef,
|
|
388
|
-
"class": (0,
|
|
391
|
+
"class": (0, _v_c_util.clsx)(`${mergedPrefixCls}-input`, classNames?.input),
|
|
389
392
|
"style": styles?.input,
|
|
390
393
|
"value": inputValue.value,
|
|
391
394
|
"onInput": onInternalInput,
|
|
@@ -400,12 +403,12 @@ var InputNumber = /* @__PURE__ */ (0, vue.defineComponent)((props, { attrs, slot
|
|
|
400
403
|
"onBeforeinput": onBeforeInput
|
|
401
404
|
}, inputAttrs), null),
|
|
402
405
|
!!suffixNode && (0, vue.createVNode)("div", {
|
|
403
|
-
"class": (0,
|
|
406
|
+
"class": (0, _v_c_util.clsx)(`${mergedPrefixCls}-suffix`, classNames?.suffix),
|
|
404
407
|
"style": styles?.suffix
|
|
405
408
|
}, [suffixNode]),
|
|
406
409
|
mode === "spinner" && controls && upHandlerNode,
|
|
407
410
|
mode === "input" && controls && (0, vue.createVNode)("div", {
|
|
408
|
-
"class": (0,
|
|
411
|
+
"class": (0, _v_c_util.clsx)(`${mergedPrefixCls}-actions`, classNames?.actions),
|
|
409
412
|
"style": styles?.actions
|
|
410
413
|
}, [upHandlerNode, downHandlerNode])
|
|
411
414
|
]);
|
|
@@ -423,7 +426,6 @@ var InputNumber = /* @__PURE__ */ (0, vue.defineComponent)((props, { attrs, slot
|
|
|
423
426
|
default: void 0
|
|
424
427
|
},
|
|
425
428
|
class: {
|
|
426
|
-
type: null,
|
|
427
429
|
required: false,
|
|
428
430
|
default: void 0
|
|
429
431
|
},
|
|
@@ -433,7 +435,6 @@ var InputNumber = /* @__PURE__ */ (0, vue.defineComponent)((props, { attrs, slot
|
|
|
433
435
|
default: void 0
|
|
434
436
|
},
|
|
435
437
|
style: {
|
|
436
|
-
type: null,
|
|
437
438
|
required: false,
|
|
438
439
|
default: void 0
|
|
439
440
|
},
|
|
@@ -448,27 +449,22 @@ var InputNumber = /* @__PURE__ */ (0, vue.defineComponent)((props, { attrs, slot
|
|
|
448
449
|
default: void 0
|
|
449
450
|
},
|
|
450
451
|
min: {
|
|
451
|
-
type: null,
|
|
452
452
|
required: false,
|
|
453
453
|
default: void 0
|
|
454
454
|
},
|
|
455
455
|
max: {
|
|
456
|
-
type: null,
|
|
457
456
|
required: false,
|
|
458
457
|
default: void 0
|
|
459
458
|
},
|
|
460
459
|
step: {
|
|
461
|
-
type: null,
|
|
462
460
|
required: false,
|
|
463
461
|
default: void 0
|
|
464
462
|
},
|
|
465
463
|
defaultValue: {
|
|
466
|
-
type: null,
|
|
467
464
|
required: false,
|
|
468
465
|
default: void 0
|
|
469
466
|
},
|
|
470
467
|
value: {
|
|
471
|
-
type: null,
|
|
472
468
|
required: false,
|
|
473
469
|
default: void 0
|
|
474
470
|
},
|
|
@@ -483,22 +479,18 @@ var InputNumber = /* @__PURE__ */ (0, vue.defineComponent)((props, { attrs, slot
|
|
|
483
479
|
default: void 0
|
|
484
480
|
},
|
|
485
481
|
prefix: {
|
|
486
|
-
type: null,
|
|
487
482
|
required: false,
|
|
488
483
|
default: void 0
|
|
489
484
|
},
|
|
490
485
|
suffix: {
|
|
491
|
-
type: null,
|
|
492
486
|
required: false,
|
|
493
487
|
default: void 0
|
|
494
488
|
},
|
|
495
489
|
upHandler: {
|
|
496
|
-
type: null,
|
|
497
490
|
required: false,
|
|
498
491
|
default: void 0
|
|
499
492
|
},
|
|
500
493
|
downHandler: {
|
|
501
|
-
type: null,
|
|
502
494
|
required: false,
|
|
503
495
|
default: void 0
|
|
504
496
|
},
|
package/dist/InputNumber.js
CHANGED
|
@@ -271,7 +271,7 @@ var InputNumber_default = /* @__PURE__ */ defineComponent((props, { attrs, slots
|
|
|
271
271
|
return () => {
|
|
272
272
|
const { prefixCls = defaults.prefixCls, classNames: classNames$1, styles, step = defaults.step, disabled, readOnly, controls = defaults.controls, mode = defaults.mode } = props;
|
|
273
273
|
const mergedPrefixCls = prefixCls || defaults.prefixCls;
|
|
274
|
-
const { class: className, style
|
|
274
|
+
const { class: className, style, ...restAttrs } = attrs;
|
|
275
275
|
const mergedClassName = props.className || className;
|
|
276
276
|
const mergedStyle = {
|
|
277
277
|
...styles?.root,
|
|
@@ -419,7 +419,6 @@ var InputNumber_default = /* @__PURE__ */ defineComponent((props, { attrs, slots
|
|
|
419
419
|
default: void 0
|
|
420
420
|
},
|
|
421
421
|
class: {
|
|
422
|
-
type: null,
|
|
423
422
|
required: false,
|
|
424
423
|
default: void 0
|
|
425
424
|
},
|
|
@@ -429,7 +428,6 @@ var InputNumber_default = /* @__PURE__ */ defineComponent((props, { attrs, slots
|
|
|
429
428
|
default: void 0
|
|
430
429
|
},
|
|
431
430
|
style: {
|
|
432
|
-
type: null,
|
|
433
431
|
required: false,
|
|
434
432
|
default: void 0
|
|
435
433
|
},
|
|
@@ -444,27 +442,22 @@ var InputNumber_default = /* @__PURE__ */ defineComponent((props, { attrs, slots
|
|
|
444
442
|
default: void 0
|
|
445
443
|
},
|
|
446
444
|
min: {
|
|
447
|
-
type: null,
|
|
448
445
|
required: false,
|
|
449
446
|
default: void 0
|
|
450
447
|
},
|
|
451
448
|
max: {
|
|
452
|
-
type: null,
|
|
453
449
|
required: false,
|
|
454
450
|
default: void 0
|
|
455
451
|
},
|
|
456
452
|
step: {
|
|
457
|
-
type: null,
|
|
458
453
|
required: false,
|
|
459
454
|
default: void 0
|
|
460
455
|
},
|
|
461
456
|
defaultValue: {
|
|
462
|
-
type: null,
|
|
463
457
|
required: false,
|
|
464
458
|
default: void 0
|
|
465
459
|
},
|
|
466
460
|
value: {
|
|
467
|
-
type: null,
|
|
468
461
|
required: false,
|
|
469
462
|
default: void 0
|
|
470
463
|
},
|
|
@@ -479,22 +472,18 @@ var InputNumber_default = /* @__PURE__ */ defineComponent((props, { attrs, slots
|
|
|
479
472
|
default: void 0
|
|
480
473
|
},
|
|
481
474
|
prefix: {
|
|
482
|
-
type: null,
|
|
483
475
|
required: false,
|
|
484
476
|
default: void 0
|
|
485
477
|
},
|
|
486
478
|
suffix: {
|
|
487
|
-
type: null,
|
|
488
479
|
required: false,
|
|
489
480
|
default: void 0
|
|
490
481
|
},
|
|
491
482
|
upHandler: {
|
|
492
|
-
type: null,
|
|
493
483
|
required: false,
|
|
494
484
|
default: void 0
|
|
495
485
|
},
|
|
496
486
|
downHandler: {
|
|
497
|
-
type: null,
|
|
498
487
|
required: false,
|
|
499
488
|
default: void 0
|
|
500
489
|
},
|
package/dist/StepHandler.cjs
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
Object.
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
2
5
|
const require_rolldown_runtime = require("./_virtual/rolldown_runtime.cjs");
|
|
3
6
|
let vue = require("vue");
|
|
4
|
-
let
|
|
5
|
-
let
|
|
6
|
-
|
|
7
|
-
let
|
|
7
|
+
let _v_c_util = require("@v-c/util");
|
|
8
|
+
let _v_c_util_dist_raf = require("@v-c/util/dist/raf");
|
|
9
|
+
_v_c_util_dist_raf = require_rolldown_runtime.__toESM(_v_c_util_dist_raf);
|
|
10
|
+
let _v_c_util_dist_props_util = require("@v-c/util/dist/props-util");
|
|
8
11
|
var STEP_INTERVAL = 200;
|
|
9
12
|
var STEP_DELAY = 600;
|
|
10
13
|
var StepHandler_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
@@ -49,15 +52,15 @@ var StepHandler_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
49
52
|
};
|
|
50
53
|
(0, vue.onUnmounted)(() => {
|
|
51
54
|
onStopStep();
|
|
52
|
-
frameIds.value.forEach((id) =>
|
|
55
|
+
frameIds.value.forEach((id) => _v_c_util_dist_raf.default.cancel(id));
|
|
53
56
|
});
|
|
54
57
|
return () => {
|
|
55
58
|
const { prefixCls, action, disabled, className, style } = props;
|
|
56
59
|
const isUpAction = action === "up";
|
|
57
60
|
const actionClassName = `${prefixCls}-action`;
|
|
58
|
-
const mergedClassName = (0,
|
|
59
|
-
const safeOnStopStep = () => frameIds.value.push((0,
|
|
60
|
-
const children = (0,
|
|
61
|
+
const mergedClassName = (0, _v_c_util.classNames)(actionClassName, `${actionClassName}-${action}`, { [`${actionClassName}-${action}-disabled`]: disabled }, className);
|
|
62
|
+
const safeOnStopStep = () => frameIds.value.push((0, _v_c_util_dist_raf.default)(onStopStep));
|
|
63
|
+
const children = (0, _v_c_util_dist_props_util.filterEmpty)(slots?.default?.());
|
|
61
64
|
return (0, vue.createVNode)("span", {
|
|
62
65
|
"unselectable": "on",
|
|
63
66
|
"role": "button",
|
package/dist/hooks/useCursor.cjs
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
Object.
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
2
5
|
const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
|
|
3
6
|
let vue = require("vue");
|
|
4
|
-
let
|
|
5
|
-
|
|
7
|
+
let _v_c_util_dist_warning = require("@v-c/util/dist/warning");
|
|
8
|
+
_v_c_util_dist_warning = require_rolldown_runtime.__toESM(_v_c_util_dist_warning);
|
|
6
9
|
function useCursor(input, focused) {
|
|
7
10
|
const selectionRef = (0, vue.ref)(null);
|
|
8
11
|
function recordCursor() {
|
|
@@ -31,7 +34,7 @@ function useCursor(input, focused) {
|
|
|
31
34
|
}
|
|
32
35
|
input.setSelectionRange(startPos, startPos);
|
|
33
36
|
} catch (e) {
|
|
34
|
-
(0,
|
|
37
|
+
(0, _v_c_util_dist_warning.default)(false, `Something warning of cursor restore. Please fire issue about this: ${e.message}`);
|
|
35
38
|
}
|
|
36
39
|
}
|
|
37
40
|
return [recordCursor, restoreCursor];
|
package/dist/hooks/useFrame.cjs
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
Object.
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
2
5
|
const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
|
|
3
6
|
let vue = require("vue");
|
|
4
|
-
let
|
|
5
|
-
|
|
7
|
+
let _v_c_util_dist_raf = require("@v-c/util/dist/raf");
|
|
8
|
+
_v_c_util_dist_raf = require_rolldown_runtime.__toESM(_v_c_util_dist_raf);
|
|
6
9
|
var useFrame_default = () => {
|
|
7
10
|
const idRef = (0, vue.ref)(0);
|
|
8
11
|
const cleanUp = () => {
|
|
9
|
-
|
|
12
|
+
_v_c_util_dist_raf.default.cancel(idRef.value);
|
|
10
13
|
};
|
|
11
14
|
(0, vue.onUnmounted)(cleanUp);
|
|
12
15
|
return (callback) => {
|
|
13
16
|
cleanUp();
|
|
14
|
-
idRef.value = (0,
|
|
17
|
+
idRef.value = (0, _v_c_util_dist_raf.default)(() => {
|
|
15
18
|
callback();
|
|
16
19
|
});
|
|
17
20
|
};
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
Object.
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
2
5
|
const require_InputNumber = require("./InputNumber.cjs");
|
|
3
6
|
var src_default = require_InputNumber.default;
|
|
4
7
|
exports.default = src_default;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
1
2
|
const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
|
|
2
|
-
let
|
|
3
|
+
let _v_c_mini_decimal = require("@v-c/mini-decimal");
|
|
3
4
|
function getDecupleSteps(step) {
|
|
4
|
-
const stepStr = typeof step === "number" ? (0,
|
|
5
|
+
const stepStr = typeof step === "number" ? (0, _v_c_mini_decimal.num2str)(step) : (0, _v_c_mini_decimal.trimNumber)(step).fullStr;
|
|
5
6
|
if (!stepStr.includes(".")) return `${step}0`;
|
|
6
|
-
return (0,
|
|
7
|
+
return (0, _v_c_mini_decimal.trimNumber)(stepStr.replace(/(\d)\.(\d)/g, "$1$2.")).fullStr;
|
|
7
8
|
}
|
|
8
9
|
exports.getDecupleSteps = getDecupleSteps;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@v-c/input-number",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.1",
|
|
5
5
|
"description": "",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
"vue": "^3.0.0"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@v-c/
|
|
28
|
-
"@v-c/
|
|
29
|
-
"@v-c/
|
|
27
|
+
"@v-c/input": "^1.0.2",
|
|
28
|
+
"@v-c/mini-decimal": "^1.0.1",
|
|
29
|
+
"@v-c/util": "^1.0.9"
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
32
32
|
"build": "vite build",
|