@v-c/input 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/BaseInput.cjs +21 -15
- package/dist/BaseInput.js +8 -5
- package/dist/hooks/useCount.cjs +5 -2
- package/dist/hooks/useCount.js +1 -1
- package/dist/index.cjs +4 -1
- package/dist/input.cjs +26 -21
- package/dist/input.js +9 -7
- package/dist/interface.cjs +1 -0
- package/dist/utils/commonUtils.cjs +30 -20
- package/dist/utils/commonUtils.js +27 -18
- package/dist/utils/types.cjs +1 -0
- package/package.json +2 -2
package/dist/BaseInput.cjs
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
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_commonUtils = require("./utils/commonUtils.cjs");
|
|
4
7
|
let vue = require("vue");
|
|
5
|
-
let
|
|
6
|
-
let
|
|
8
|
+
let _v_c_util = require("@v-c/util");
|
|
9
|
+
let _v_c_util_dist_props_util = require("@v-c/util/dist/props-util");
|
|
7
10
|
function _isSlot(s) {
|
|
8
11
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !(0, vue.isVNode)(s);
|
|
9
12
|
}
|
|
@@ -17,7 +20,7 @@ var BaseInput = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots, expose
|
|
|
17
20
|
expose({ nativeElement: (0, vue.computed)(() => groupRef.value || containerRef.value) });
|
|
18
21
|
return () => {
|
|
19
22
|
const { components, allowClear, readOnly, disabled, value, prefixCls, handleReset, onClear, suffix, focused, classNames, styles, dataAttrs, prefix, addonAfter, addonBefore, hidden } = props;
|
|
20
|
-
let children = (0,
|
|
23
|
+
let children = (0, _v_c_util_dist_props_util.filterEmpty)(slots?.default?.() ?? []);
|
|
21
24
|
if (children.length === 1) children = children[0];
|
|
22
25
|
else children = (0, vue.createVNode)(vue.Fragment, null, children);
|
|
23
26
|
const inputElement = children;
|
|
@@ -43,14 +46,14 @@ var BaseInput = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots, expose
|
|
|
43
46
|
onClear?.();
|
|
44
47
|
},
|
|
45
48
|
"onMousedown": (e) => e.preventDefault(),
|
|
46
|
-
"class": (0,
|
|
49
|
+
"class": (0, _v_c_util.clsx)(clearIconCls, {
|
|
47
50
|
[`${clearIconCls}-hidden`]: !needClear,
|
|
48
51
|
[`${clearIconCls}-has-suffix`]: !!suffix
|
|
49
52
|
})
|
|
50
53
|
}, [iconNode]);
|
|
51
54
|
}
|
|
52
55
|
const affixWrapperPrefixCls = `${prefixCls}-affix-wrapper`;
|
|
53
|
-
const affixWrapperCls = (0,
|
|
56
|
+
const affixWrapperCls = (0, _v_c_util.clsx)(affixWrapperPrefixCls, {
|
|
54
57
|
[`${prefixCls}-disabled`]: disabled,
|
|
55
58
|
[`${affixWrapperPrefixCls}-disabled`]: disabled,
|
|
56
59
|
[`${affixWrapperPrefixCls}-focused`]: focused,
|
|
@@ -58,7 +61,7 @@ var BaseInput = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots, expose
|
|
|
58
61
|
[`${affixWrapperPrefixCls}-input-with-clear-btn`]: suffix && allowClear && value
|
|
59
62
|
}, classNames?.affixWrapper, classNames?.variant);
|
|
60
63
|
const suffixNode = (suffix || allowClear) && (0, vue.createVNode)("span", {
|
|
61
|
-
"class": (0,
|
|
64
|
+
"class": (0, _v_c_util.clsx)(`${prefixCls}-suffix`, classNames?.suffix),
|
|
62
65
|
"style": styles?.suffix
|
|
63
66
|
}, [clearIcon, suffix]);
|
|
64
67
|
const _element = function() {
|
|
@@ -70,7 +73,7 @@ var BaseInput = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots, expose
|
|
|
70
73
|
"onClick": onInputClick
|
|
71
74
|
}, dataAttrs?.affixWrapper, { "ref": containerRef }), { default: () => [
|
|
72
75
|
prefix && (0, vue.createVNode)("span", {
|
|
73
|
-
"class": (0,
|
|
76
|
+
"class": (0, _v_c_util.clsx)(`${prefixCls}-prefix`, classNames?.prefix),
|
|
74
77
|
"style": styles?.prefix
|
|
75
78
|
}, [prefix]),
|
|
76
79
|
_element,
|
|
@@ -81,8 +84,8 @@ var BaseInput = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots, expose
|
|
|
81
84
|
const wrapperCls = `${prefixCls}-group`;
|
|
82
85
|
const addonCls = `${wrapperCls}-addon`;
|
|
83
86
|
const groupWrapperCls = `${wrapperCls}-wrapper`;
|
|
84
|
-
const mergedWrapperClassName = (0,
|
|
85
|
-
const mergedGroupClassName = (0,
|
|
87
|
+
const mergedWrapperClassName = (0, _v_c_util.clsx)(`${prefixCls}-wrapper`, wrapperCls, classNames?.wrapper);
|
|
88
|
+
const mergedGroupClassName = (0, _v_c_util.clsx)(groupWrapperCls, { [`${groupWrapperCls}-disabled`]: disabled }, classNames?.groupWrapper);
|
|
86
89
|
element = (0, vue.createVNode)(GroupWrapperComponent, {
|
|
87
90
|
"class": mergedGroupClassName,
|
|
88
91
|
"ref": groupRef
|
|
@@ -100,7 +103,6 @@ var BaseInput = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots, expose
|
|
|
100
103
|
}, {
|
|
101
104
|
props: {
|
|
102
105
|
value: {
|
|
103
|
-
type: null,
|
|
104
106
|
required: false,
|
|
105
107
|
default: void 0
|
|
106
108
|
},
|
|
@@ -156,6 +158,8 @@ var BaseInput = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots, expose
|
|
|
156
158
|
},
|
|
157
159
|
prefix: {
|
|
158
160
|
type: [
|
|
161
|
+
Object,
|
|
162
|
+
Function,
|
|
159
163
|
String,
|
|
160
164
|
Number,
|
|
161
165
|
null,
|
|
@@ -163,11 +167,12 @@ var BaseInput = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots, expose
|
|
|
163
167
|
Array
|
|
164
168
|
],
|
|
165
169
|
required: false,
|
|
166
|
-
skipCheck: true,
|
|
167
170
|
default: void 0
|
|
168
171
|
},
|
|
169
172
|
suffix: {
|
|
170
173
|
type: [
|
|
174
|
+
Object,
|
|
175
|
+
Function,
|
|
171
176
|
String,
|
|
172
177
|
Number,
|
|
173
178
|
null,
|
|
@@ -175,11 +180,12 @@ var BaseInput = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots, expose
|
|
|
175
180
|
Array
|
|
176
181
|
],
|
|
177
182
|
required: false,
|
|
178
|
-
skipCheck: true,
|
|
179
183
|
default: void 0
|
|
180
184
|
},
|
|
181
185
|
addonBefore: {
|
|
182
186
|
type: [
|
|
187
|
+
Object,
|
|
188
|
+
Function,
|
|
183
189
|
String,
|
|
184
190
|
Number,
|
|
185
191
|
null,
|
|
@@ -187,11 +193,12 @@ var BaseInput = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots, expose
|
|
|
187
193
|
Array
|
|
188
194
|
],
|
|
189
195
|
required: false,
|
|
190
|
-
skipCheck: true,
|
|
191
196
|
default: void 0
|
|
192
197
|
},
|
|
193
198
|
addonAfter: {
|
|
194
199
|
type: [
|
|
200
|
+
Object,
|
|
201
|
+
Function,
|
|
195
202
|
String,
|
|
196
203
|
Number,
|
|
197
204
|
null,
|
|
@@ -199,7 +206,6 @@ var BaseInput = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots, expose
|
|
|
199
206
|
Array
|
|
200
207
|
],
|
|
201
208
|
required: false,
|
|
202
|
-
skipCheck: true,
|
|
203
209
|
default: void 0
|
|
204
210
|
},
|
|
205
211
|
classes: {
|
package/dist/BaseInput.js
CHANGED
|
@@ -98,7 +98,6 @@ var BaseInput_default = /* @__PURE__ */ defineComponent((props, { slots, expose,
|
|
|
98
98
|
}, {
|
|
99
99
|
props: {
|
|
100
100
|
value: {
|
|
101
|
-
type: null,
|
|
102
101
|
required: false,
|
|
103
102
|
default: void 0
|
|
104
103
|
},
|
|
@@ -154,6 +153,8 @@ var BaseInput_default = /* @__PURE__ */ defineComponent((props, { slots, expose,
|
|
|
154
153
|
},
|
|
155
154
|
prefix: {
|
|
156
155
|
type: [
|
|
156
|
+
Object,
|
|
157
|
+
Function,
|
|
157
158
|
String,
|
|
158
159
|
Number,
|
|
159
160
|
null,
|
|
@@ -161,11 +162,12 @@ var BaseInput_default = /* @__PURE__ */ defineComponent((props, { slots, expose,
|
|
|
161
162
|
Array
|
|
162
163
|
],
|
|
163
164
|
required: false,
|
|
164
|
-
skipCheck: true,
|
|
165
165
|
default: void 0
|
|
166
166
|
},
|
|
167
167
|
suffix: {
|
|
168
168
|
type: [
|
|
169
|
+
Object,
|
|
170
|
+
Function,
|
|
169
171
|
String,
|
|
170
172
|
Number,
|
|
171
173
|
null,
|
|
@@ -173,11 +175,12 @@ var BaseInput_default = /* @__PURE__ */ defineComponent((props, { slots, expose,
|
|
|
173
175
|
Array
|
|
174
176
|
],
|
|
175
177
|
required: false,
|
|
176
|
-
skipCheck: true,
|
|
177
178
|
default: void 0
|
|
178
179
|
},
|
|
179
180
|
addonBefore: {
|
|
180
181
|
type: [
|
|
182
|
+
Object,
|
|
183
|
+
Function,
|
|
181
184
|
String,
|
|
182
185
|
Number,
|
|
183
186
|
null,
|
|
@@ -185,11 +188,12 @@ var BaseInput_default = /* @__PURE__ */ defineComponent((props, { slots, expose,
|
|
|
185
188
|
Array
|
|
186
189
|
],
|
|
187
190
|
required: false,
|
|
188
|
-
skipCheck: true,
|
|
189
191
|
default: void 0
|
|
190
192
|
},
|
|
191
193
|
addonAfter: {
|
|
192
194
|
type: [
|
|
195
|
+
Object,
|
|
196
|
+
Function,
|
|
193
197
|
String,
|
|
194
198
|
Number,
|
|
195
199
|
null,
|
|
@@ -197,7 +201,6 @@ var BaseInput_default = /* @__PURE__ */ defineComponent((props, { slots, expose,
|
|
|
197
201
|
Array
|
|
198
202
|
],
|
|
199
203
|
required: false,
|
|
200
|
-
skipCheck: true,
|
|
201
204
|
default: void 0
|
|
202
205
|
},
|
|
203
206
|
classes: {
|
package/dist/hooks/useCount.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_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
|
|
3
6
|
let vue = require("vue");
|
|
4
7
|
function inCountRange(value, countConfig) {
|
|
@@ -13,7 +16,7 @@ function useCount(count, showCount) {
|
|
|
13
16
|
...mergedConfig,
|
|
14
17
|
...count?.value
|
|
15
18
|
};
|
|
16
|
-
const { show
|
|
19
|
+
const { show, ...rest } = mergedConfig;
|
|
17
20
|
return {
|
|
18
21
|
...rest,
|
|
19
22
|
show: !!show,
|
package/dist/hooks/useCount.js
CHANGED
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_commonUtils = require("./utils/commonUtils.cjs");
|
|
3
6
|
const require_BaseInput = require("./BaseInput.cjs");
|
|
4
7
|
const require_useCount = require("./hooks/useCount.cjs");
|
package/dist/input.cjs
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
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_commonUtils = require("./utils/commonUtils.cjs");
|
|
4
7
|
const require_BaseInput = require("./BaseInput.cjs");
|
|
5
8
|
const require_useCount = require("./hooks/useCount.cjs");
|
|
6
9
|
let vue = require("vue");
|
|
7
|
-
let
|
|
8
|
-
let
|
|
9
|
-
let
|
|
10
|
-
let
|
|
11
|
-
let
|
|
12
|
-
|
|
10
|
+
let _v_c_util = require("@v-c/util");
|
|
11
|
+
let _v_c_util_dist_props_util = require("@v-c/util/dist/props-util");
|
|
12
|
+
let _v_c_util_dist_Dom_focus = require("@v-c/util/dist/Dom/focus");
|
|
13
|
+
let _v_c_util_dist_KeyCode = require("@v-c/util/dist/KeyCode");
|
|
14
|
+
let _v_c_util_dist_omit = require("@v-c/util/dist/omit");
|
|
15
|
+
_v_c_util_dist_omit = require_rolldown_runtime.__toESM(_v_c_util_dist_omit);
|
|
13
16
|
function _isSlot(s) {
|
|
14
17
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !(0, vue.isVNode)(s);
|
|
15
18
|
}
|
|
@@ -21,14 +24,14 @@ var Input = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots, expose, at
|
|
|
21
24
|
const focused = (0, vue.shallowRef)(false);
|
|
22
25
|
const compositionRef = (0, vue.shallowRef)(false);
|
|
23
26
|
const keyLockRef = (0, vue.shallowRef)(false);
|
|
24
|
-
const { count, showCount } = (0,
|
|
27
|
+
const { count, showCount } = (0, _v_c_util_dist_props_util.toPropsRefs)(props, "count", "showCount");
|
|
25
28
|
const onChange = (e) => {
|
|
26
29
|
props?.onChange?.(e);
|
|
27
30
|
};
|
|
28
31
|
const inputRef = (0, vue.shallowRef)();
|
|
29
32
|
const holderRef = (0, vue.shallowRef)();
|
|
30
33
|
const focus = (option) => {
|
|
31
|
-
if (inputRef.value) (0,
|
|
34
|
+
if (inputRef.value) (0, _v_c_util_dist_Dom_focus.triggerFocus)(inputRef.value, option);
|
|
32
35
|
};
|
|
33
36
|
const value = (0, vue.shallowRef)(props?.value ?? props?.defaultValue);
|
|
34
37
|
(0, vue.watch)(() => props.value, (newValue) => {
|
|
@@ -84,7 +87,7 @@ var Input = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots, expose, at
|
|
|
84
87
|
props?.onCompositionEnd?.(e);
|
|
85
88
|
};
|
|
86
89
|
const handleKeyDown = (e) => {
|
|
87
|
-
if (e.key ===
|
|
90
|
+
if (e.key === _v_c_util_dist_KeyCode.KeyCodeStr.Enter && !keyLockRef.value && !e.isComposing) {
|
|
88
91
|
keyLockRef.value = true;
|
|
89
92
|
props.onPressEnter?.(e);
|
|
90
93
|
}
|
|
@@ -119,7 +122,7 @@ var Input = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots, expose, at
|
|
|
119
122
|
});
|
|
120
123
|
return () => {
|
|
121
124
|
const { autoComplete, prefixCls = defaults.prefixCls, disabled, htmlSize, classNames, styles, suffix, type = defaults.type, classes, readOnly, hidden, dataAttrs, components } = props;
|
|
122
|
-
const { class: className, style
|
|
125
|
+
const { class: className, style, ...restAttrs } = attrs;
|
|
123
126
|
const mergedClassName = className ?? props.class;
|
|
124
127
|
const mergedStyle = style ?? props.style;
|
|
125
128
|
const prefixNode = slots.prefix?.() ?? props.prefix;
|
|
@@ -136,11 +139,11 @@ var Input = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots, expose, at
|
|
|
136
139
|
maxLength: mergedMax.value
|
|
137
140
|
}) : `${valueLength.value}${hasMaxLength ? ` / ${mergedMax.value}` : ""}`;
|
|
138
141
|
mergedSuffix = (0, vue.createVNode)(vue.Fragment, null, [config?.show && (0, vue.createVNode)("span", {
|
|
139
|
-
"class": (0,
|
|
142
|
+
"class": (0, _v_c_util.clsx)(`${prefixCls}-show-count-suffix`, { [`${prefixCls}-show-count-has-suffix`]: !!suffixNode }, classNames?.count),
|
|
140
143
|
"style": styles?.count
|
|
141
144
|
}, [dataCount]), suffixNode]);
|
|
142
145
|
}
|
|
143
|
-
const inputElement = (0, vue.createVNode)("input", (0, vue.mergeProps)(restAttrs, (0,
|
|
146
|
+
const inputElement = (0, vue.createVNode)("input", (0, vue.mergeProps)(restAttrs, (0, _v_c_util_dist_omit.default)(props, [
|
|
144
147
|
"prefixCls",
|
|
145
148
|
"onPressEnter",
|
|
146
149
|
"addonBefore",
|
|
@@ -181,7 +184,7 @@ var Input = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots, expose, at
|
|
|
181
184
|
"onBlur": handleBlur,
|
|
182
185
|
"onKeydown": handleKeyDown,
|
|
183
186
|
"onKeyup": handleKeyUp,
|
|
184
|
-
"class": (0,
|
|
187
|
+
"class": (0, _v_c_util.clsx)(prefixCls, { [`${prefixCls}-disabled`]: disabled }, classNames?.input),
|
|
185
188
|
"style": styles?.input,
|
|
186
189
|
"size": htmlSize,
|
|
187
190
|
"type": type,
|
|
@@ -195,7 +198,7 @@ var Input = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots, expose, at
|
|
|
195
198
|
"ref": holderRef,
|
|
196
199
|
"value": formatValue.value,
|
|
197
200
|
"prefixCls": prefixCls,
|
|
198
|
-
"class": (0,
|
|
201
|
+
"class": (0, _v_c_util.clsx)(mergedClassName, isOutOfRange.value && `${prefixCls}-out-of-range`),
|
|
199
202
|
"style": mergedStyle,
|
|
200
203
|
"allowClear": mergedAllowClear.value,
|
|
201
204
|
"handleReset": handleReset,
|
|
@@ -219,12 +222,10 @@ var Input = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots, expose, at
|
|
|
219
222
|
}, {
|
|
220
223
|
props: /* @__PURE__ */ (0, vue.mergeDefaults)({
|
|
221
224
|
value: {
|
|
222
|
-
type: null,
|
|
223
225
|
required: false,
|
|
224
226
|
default: void 0
|
|
225
227
|
},
|
|
226
228
|
defaultValue: {
|
|
227
|
-
type: null,
|
|
228
229
|
required: false,
|
|
229
230
|
default: void 0
|
|
230
231
|
},
|
|
@@ -350,6 +351,8 @@ var Input = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots, expose, at
|
|
|
350
351
|
},
|
|
351
352
|
prefix: {
|
|
352
353
|
type: [
|
|
354
|
+
Object,
|
|
355
|
+
Function,
|
|
353
356
|
String,
|
|
354
357
|
Number,
|
|
355
358
|
null,
|
|
@@ -357,11 +360,12 @@ var Input = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots, expose, at
|
|
|
357
360
|
Array
|
|
358
361
|
],
|
|
359
362
|
required: false,
|
|
360
|
-
skipCheck: true,
|
|
361
363
|
default: void 0
|
|
362
364
|
},
|
|
363
365
|
suffix: {
|
|
364
366
|
type: [
|
|
367
|
+
Object,
|
|
368
|
+
Function,
|
|
365
369
|
String,
|
|
366
370
|
Number,
|
|
367
371
|
null,
|
|
@@ -369,11 +373,12 @@ var Input = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots, expose, at
|
|
|
369
373
|
Array
|
|
370
374
|
],
|
|
371
375
|
required: false,
|
|
372
|
-
skipCheck: true,
|
|
373
376
|
default: void 0
|
|
374
377
|
},
|
|
375
378
|
addonBefore: {
|
|
376
379
|
type: [
|
|
380
|
+
Object,
|
|
381
|
+
Function,
|
|
377
382
|
String,
|
|
378
383
|
Number,
|
|
379
384
|
null,
|
|
@@ -381,11 +386,12 @@ var Input = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots, expose, at
|
|
|
381
386
|
Array
|
|
382
387
|
],
|
|
383
388
|
required: false,
|
|
384
|
-
skipCheck: true,
|
|
385
389
|
default: void 0
|
|
386
390
|
},
|
|
387
391
|
addonAfter: {
|
|
388
392
|
type: [
|
|
393
|
+
Object,
|
|
394
|
+
Function,
|
|
389
395
|
String,
|
|
390
396
|
Number,
|
|
391
397
|
null,
|
|
@@ -393,7 +399,6 @@ var Input = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots, expose, at
|
|
|
393
399
|
Array
|
|
394
400
|
],
|
|
395
401
|
required: false,
|
|
396
|
-
skipCheck: true,
|
|
397
402
|
default: void 0
|
|
398
403
|
},
|
|
399
404
|
classes: {
|
package/dist/input.js
CHANGED
|
@@ -116,7 +116,7 @@ var input_default = /* @__PURE__ */ defineComponent((props, { slots, expose, att
|
|
|
116
116
|
});
|
|
117
117
|
return () => {
|
|
118
118
|
const { autoComplete, prefixCls = defaults.prefixCls, disabled, htmlSize, classNames, styles, suffix, type = defaults.type, classes, readOnly, hidden, dataAttrs, components } = props;
|
|
119
|
-
const { class: className, style
|
|
119
|
+
const { class: className, style, ...restAttrs } = attrs;
|
|
120
120
|
const mergedClassName = className ?? props.class;
|
|
121
121
|
const mergedStyle = style ?? props.style;
|
|
122
122
|
const prefixNode = slots.prefix?.() ?? props.prefix;
|
|
@@ -216,12 +216,10 @@ var input_default = /* @__PURE__ */ defineComponent((props, { slots, expose, att
|
|
|
216
216
|
}, {
|
|
217
217
|
props: /* @__PURE__ */ mergeDefaults({
|
|
218
218
|
value: {
|
|
219
|
-
type: null,
|
|
220
219
|
required: false,
|
|
221
220
|
default: void 0
|
|
222
221
|
},
|
|
223
222
|
defaultValue: {
|
|
224
|
-
type: null,
|
|
225
223
|
required: false,
|
|
226
224
|
default: void 0
|
|
227
225
|
},
|
|
@@ -347,6 +345,8 @@ var input_default = /* @__PURE__ */ defineComponent((props, { slots, expose, att
|
|
|
347
345
|
},
|
|
348
346
|
prefix: {
|
|
349
347
|
type: [
|
|
348
|
+
Object,
|
|
349
|
+
Function,
|
|
350
350
|
String,
|
|
351
351
|
Number,
|
|
352
352
|
null,
|
|
@@ -354,11 +354,12 @@ var input_default = /* @__PURE__ */ defineComponent((props, { slots, expose, att
|
|
|
354
354
|
Array
|
|
355
355
|
],
|
|
356
356
|
required: false,
|
|
357
|
-
skipCheck: true,
|
|
358
357
|
default: void 0
|
|
359
358
|
},
|
|
360
359
|
suffix: {
|
|
361
360
|
type: [
|
|
361
|
+
Object,
|
|
362
|
+
Function,
|
|
362
363
|
String,
|
|
363
364
|
Number,
|
|
364
365
|
null,
|
|
@@ -366,11 +367,12 @@ var input_default = /* @__PURE__ */ defineComponent((props, { slots, expose, att
|
|
|
366
367
|
Array
|
|
367
368
|
],
|
|
368
369
|
required: false,
|
|
369
|
-
skipCheck: true,
|
|
370
370
|
default: void 0
|
|
371
371
|
},
|
|
372
372
|
addonBefore: {
|
|
373
373
|
type: [
|
|
374
|
+
Object,
|
|
375
|
+
Function,
|
|
374
376
|
String,
|
|
375
377
|
Number,
|
|
376
378
|
null,
|
|
@@ -378,11 +380,12 @@ var input_default = /* @__PURE__ */ defineComponent((props, { slots, expose, att
|
|
|
378
380
|
Array
|
|
379
381
|
],
|
|
380
382
|
required: false,
|
|
381
|
-
skipCheck: true,
|
|
382
383
|
default: void 0
|
|
383
384
|
},
|
|
384
385
|
addonAfter: {
|
|
385
386
|
type: [
|
|
387
|
+
Object,
|
|
388
|
+
Function,
|
|
386
389
|
String,
|
|
387
390
|
Number,
|
|
388
391
|
null,
|
|
@@ -390,7 +393,6 @@ var input_default = /* @__PURE__ */ defineComponent((props, { slots, expose, att
|
|
|
390
393
|
Array
|
|
391
394
|
],
|
|
392
395
|
required: false,
|
|
393
|
-
skipCheck: true,
|
|
394
396
|
default: void 0
|
|
395
397
|
},
|
|
396
398
|
classes: {
|
package/dist/interface.cjs
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
@@ -1,20 +1,33 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
1
2
|
const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
|
|
2
|
-
let
|
|
3
|
-
function
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
target: { value: currentTarget },
|
|
7
|
-
currentTarget: { value: currentTarget }
|
|
8
|
-
});
|
|
9
|
-
currentTarget.value = value;
|
|
3
|
+
let _v_c_util_dist_Dom_focus = require("@v-c/util/dist/Dom/focus");
|
|
4
|
+
function createPatchedTarget(target, value) {
|
|
5
|
+
const patched = target.cloneNode(true);
|
|
6
|
+
patched.value = value;
|
|
10
7
|
if (typeof target.selectionStart === "number" && typeof target.selectionEnd === "number") {
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
patched.selectionStart = target.selectionStart;
|
|
9
|
+
patched.selectionEnd = target.selectionEnd;
|
|
13
10
|
}
|
|
14
|
-
|
|
11
|
+
patched.setSelectionRange = (start, end, direction) => {
|
|
15
12
|
target.setSelectionRange(start, end, direction);
|
|
16
13
|
};
|
|
17
|
-
return
|
|
14
|
+
return patched;
|
|
15
|
+
}
|
|
16
|
+
function cloneEvent(event, target, value) {
|
|
17
|
+
const patchedTarget = createPatchedTarget(target, value);
|
|
18
|
+
return {
|
|
19
|
+
type: event?.type,
|
|
20
|
+
timeStamp: event?.timeStamp,
|
|
21
|
+
bubbles: event?.bubbles,
|
|
22
|
+
cancelable: event?.cancelable,
|
|
23
|
+
composed: event?.composed,
|
|
24
|
+
target: patchedTarget,
|
|
25
|
+
currentTarget: patchedTarget,
|
|
26
|
+
preventDefault: event?.preventDefault ? event.preventDefault.bind(event) : void 0,
|
|
27
|
+
stopPropagation: event?.stopPropagation ? event.stopPropagation.bind(event) : void 0,
|
|
28
|
+
stopImmediatePropagation: event?.stopImmediatePropagation ? event.stopImmediatePropagation.bind(event) : void 0,
|
|
29
|
+
nativeEvent: event
|
|
30
|
+
};
|
|
18
31
|
}
|
|
19
32
|
function hasAddon(props) {
|
|
20
33
|
return !!(props.addonBefore || props.addonAfter);
|
|
@@ -24,20 +37,17 @@ function hasPrefixSuffix(props) {
|
|
|
24
37
|
}
|
|
25
38
|
function resolveOnChange(target, e, onChange, targetValue) {
|
|
26
39
|
if (!onChange) return;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
event = cloneEvent(e, target, "");
|
|
30
|
-
onChange(event);
|
|
40
|
+
if (e?.type === "click") {
|
|
41
|
+
onChange(cloneEvent(e, target, ""));
|
|
31
42
|
return;
|
|
32
43
|
}
|
|
33
44
|
if (target.type !== "file" && targetValue !== void 0) {
|
|
34
|
-
|
|
35
|
-
onChange(event);
|
|
45
|
+
onChange(cloneEvent(e, target, targetValue));
|
|
36
46
|
return;
|
|
37
47
|
}
|
|
38
|
-
onChange(
|
|
48
|
+
onChange(e);
|
|
39
49
|
}
|
|
40
|
-
const triggerFocus =
|
|
50
|
+
const triggerFocus = _v_c_util_dist_Dom_focus.triggerFocus;
|
|
41
51
|
exports.hasAddon = hasAddon;
|
|
42
52
|
exports.hasPrefixSuffix = hasPrefixSuffix;
|
|
43
53
|
exports.resolveOnChange = resolveOnChange;
|
|
@@ -1,19 +1,31 @@
|
|
|
1
1
|
import { triggerFocus as triggerFocus$1 } from "@v-c/util/dist/Dom/focus";
|
|
2
|
-
function
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
target: { value: currentTarget },
|
|
6
|
-
currentTarget: { value: currentTarget }
|
|
7
|
-
});
|
|
8
|
-
currentTarget.value = value;
|
|
2
|
+
function createPatchedTarget(target, value) {
|
|
3
|
+
const patched = target.cloneNode(true);
|
|
4
|
+
patched.value = value;
|
|
9
5
|
if (typeof target.selectionStart === "number" && typeof target.selectionEnd === "number") {
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
patched.selectionStart = target.selectionStart;
|
|
7
|
+
patched.selectionEnd = target.selectionEnd;
|
|
12
8
|
}
|
|
13
|
-
|
|
9
|
+
patched.setSelectionRange = (start, end, direction) => {
|
|
14
10
|
target.setSelectionRange(start, end, direction);
|
|
15
11
|
};
|
|
16
|
-
return
|
|
12
|
+
return patched;
|
|
13
|
+
}
|
|
14
|
+
function cloneEvent(event, target, value) {
|
|
15
|
+
const patchedTarget = createPatchedTarget(target, value);
|
|
16
|
+
return {
|
|
17
|
+
type: event?.type,
|
|
18
|
+
timeStamp: event?.timeStamp,
|
|
19
|
+
bubbles: event?.bubbles,
|
|
20
|
+
cancelable: event?.cancelable,
|
|
21
|
+
composed: event?.composed,
|
|
22
|
+
target: patchedTarget,
|
|
23
|
+
currentTarget: patchedTarget,
|
|
24
|
+
preventDefault: event?.preventDefault ? event.preventDefault.bind(event) : void 0,
|
|
25
|
+
stopPropagation: event?.stopPropagation ? event.stopPropagation.bind(event) : void 0,
|
|
26
|
+
stopImmediatePropagation: event?.stopImmediatePropagation ? event.stopImmediatePropagation.bind(event) : void 0,
|
|
27
|
+
nativeEvent: event
|
|
28
|
+
};
|
|
17
29
|
}
|
|
18
30
|
function hasAddon(props) {
|
|
19
31
|
return !!(props.addonBefore || props.addonAfter);
|
|
@@ -23,18 +35,15 @@ function hasPrefixSuffix(props) {
|
|
|
23
35
|
}
|
|
24
36
|
function resolveOnChange(target, e, onChange, targetValue) {
|
|
25
37
|
if (!onChange) return;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
event = cloneEvent(e, target, "");
|
|
29
|
-
onChange(event);
|
|
38
|
+
if (e?.type === "click") {
|
|
39
|
+
onChange(cloneEvent(e, target, ""));
|
|
30
40
|
return;
|
|
31
41
|
}
|
|
32
42
|
if (target.type !== "file" && targetValue !== void 0) {
|
|
33
|
-
|
|
34
|
-
onChange(event);
|
|
43
|
+
onChange(cloneEvent(e, target, targetValue));
|
|
35
44
|
return;
|
|
36
45
|
}
|
|
37
|
-
onChange(
|
|
46
|
+
onChange(e);
|
|
38
47
|
}
|
|
39
48
|
const triggerFocus = triggerFocus$1;
|
|
40
49
|
export { hasAddon, hasPrefixSuffix, resolveOnChange, triggerFocus };
|
package/dist/utils/types.cjs
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@v-c/input",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.1",
|
|
5
5
|
"description": "",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"vue": "^3.0.0"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@v-c/util": "^1.0.
|
|
27
|
+
"@v-c/util": "^1.0.8"
|
|
28
28
|
},
|
|
29
29
|
"scripts": {
|
|
30
30
|
"build": "vite build",
|