@v-c/input 1.0.3 → 1.1.0-rc.2
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.js +7 -3
- package/dist/interface.d.ts +3 -0
- package/package.json +1 -1
package/dist/BaseInput.js
CHANGED
|
@@ -31,21 +31,25 @@ var BaseInput = /* @__PURE__ */ defineComponent((props, { slots, expose, attrs }
|
|
|
31
31
|
if (hasAffix.value) {
|
|
32
32
|
let clearIcon = null;
|
|
33
33
|
if (allowClear) {
|
|
34
|
-
const
|
|
34
|
+
const clearDisabled = typeof allowClear === "object" && allowClear?.disabled;
|
|
35
|
+
const needClear = !disabled && !readOnly && value && !clearDisabled;
|
|
35
36
|
const clearIconCls = `${prefixCls}-clear-icon`;
|
|
36
37
|
const iconNode = typeof allowClear === "object" && allowClear?.clearIcon ? allowClear.clearIcon : "✖";
|
|
37
38
|
clearIcon = createVNode("button", {
|
|
38
39
|
"type": "button",
|
|
39
40
|
"tabindex": -1,
|
|
41
|
+
"disabled": clearDisabled || void 0,
|
|
40
42
|
"onClick": (event) => {
|
|
43
|
+
if (clearDisabled) return;
|
|
41
44
|
handleReset?.(event);
|
|
42
45
|
onClear?.();
|
|
43
46
|
},
|
|
44
47
|
"onMousedown": (e) => e.preventDefault(),
|
|
45
|
-
"class": clsx(clearIconCls, {
|
|
48
|
+
"class": clsx(clearIconCls, classNames?.clear, {
|
|
46
49
|
[`${clearIconCls}-hidden`]: !needClear,
|
|
47
50
|
[`${clearIconCls}-has-suffix`]: !!suffix
|
|
48
|
-
})
|
|
51
|
+
}),
|
|
52
|
+
"style": styles?.clear
|
|
49
53
|
}, [iconNode]);
|
|
50
54
|
}
|
|
51
55
|
const affixWrapperPrefixCls = `${prefixCls}-affix-wrapper`;
|
package/dist/interface.d.ts
CHANGED
|
@@ -21,14 +21,17 @@ export interface CommonInputProps {
|
|
|
21
21
|
groupWrapper?: string;
|
|
22
22
|
wrapper?: string;
|
|
23
23
|
variant?: string;
|
|
24
|
+
clear?: string;
|
|
24
25
|
};
|
|
25
26
|
styles?: {
|
|
26
27
|
affixWrapper?: CSSProperties;
|
|
27
28
|
prefix?: CSSProperties;
|
|
28
29
|
suffix?: CSSProperties;
|
|
30
|
+
clear?: CSSProperties;
|
|
29
31
|
};
|
|
30
32
|
allowClear?: boolean | {
|
|
31
33
|
clearIcon?: VueNode;
|
|
34
|
+
disabled?: boolean;
|
|
32
35
|
};
|
|
33
36
|
}
|
|
34
37
|
type DataAttr = Record<`data-${string}`, string>;
|