@v-c/input 1.1.1 → 1.1.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 +8 -8
- package/dist/utils/commonUtils.js +3 -2
- package/package.json +2 -2
package/dist/BaseInput.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { hasAddon, hasPrefixSuffix } from "./utils/commonUtils.js";
|
|
2
2
|
import { Fragment, computed, createVNode, defineComponent, isVNode, mergeProps, shallowRef } from "vue";
|
|
3
|
-
import { clsx } from "@v-c/util";
|
|
3
|
+
import { clsx, isVueRenderable } from "@v-c/util";
|
|
4
4
|
import { filterEmpty } from "@v-c/util/dist/props-util";
|
|
5
5
|
//#region src/BaseInput.tsx
|
|
6
6
|
function _isSlot(s) {
|
|
@@ -34,7 +34,7 @@ var BaseInput = /* @__PURE__ */ defineComponent((props, { slots, expose, attrs }
|
|
|
34
34
|
const clearDisabled = typeof allowClear === "object" && allowClear?.disabled;
|
|
35
35
|
const needClear = !disabled && !readOnly && value && !clearDisabled;
|
|
36
36
|
const clearIconCls = `${prefixCls}-clear-icon`;
|
|
37
|
-
const iconNode = typeof allowClear === "object" && allowClear?.clearIcon ? allowClear.clearIcon : "✖";
|
|
37
|
+
const iconNode = typeof allowClear === "object" && isVueRenderable(allowClear?.clearIcon) ? allowClear.clearIcon : "✖";
|
|
38
38
|
clearIcon = createVNode("button", {
|
|
39
39
|
"type": "button",
|
|
40
40
|
"disabled": clearDisabled || void 0,
|
|
@@ -46,7 +46,7 @@ var BaseInput = /* @__PURE__ */ defineComponent((props, { slots, expose, attrs }
|
|
|
46
46
|
"onMousedown": (e) => e.preventDefault(),
|
|
47
47
|
"class": clsx(clearIconCls, classNames?.clear, {
|
|
48
48
|
[`${clearIconCls}-hidden`]: !needClear,
|
|
49
|
-
[`${clearIconCls}-has-suffix`]:
|
|
49
|
+
[`${clearIconCls}-has-suffix`]: isVueRenderable(suffix)
|
|
50
50
|
}),
|
|
51
51
|
"style": styles?.clear
|
|
52
52
|
}, [iconNode]);
|
|
@@ -57,9 +57,9 @@ var BaseInput = /* @__PURE__ */ defineComponent((props, { slots, expose, attrs }
|
|
|
57
57
|
[`${affixWrapperPrefixCls}-disabled`]: disabled,
|
|
58
58
|
[`${affixWrapperPrefixCls}-focused`]: focused,
|
|
59
59
|
[`${affixWrapperPrefixCls}-readonly`]: readOnly,
|
|
60
|
-
[`${affixWrapperPrefixCls}-input-with-clear-btn`]: suffix && allowClear && value
|
|
60
|
+
[`${affixWrapperPrefixCls}-input-with-clear-btn`]: isVueRenderable(suffix) && allowClear && value
|
|
61
61
|
}, classNames?.affixWrapper, classNames?.variant);
|
|
62
|
-
const suffixNode = (suffix || allowClear) && createVNode("span", {
|
|
62
|
+
const suffixNode = (isVueRenderable(suffix) || allowClear) && createVNode("span", {
|
|
63
63
|
"class": clsx(`${prefixCls}-suffix`, classNames?.suffix),
|
|
64
64
|
"style": styles?.suffix
|
|
65
65
|
}, [clearIcon, suffix]);
|
|
@@ -71,7 +71,7 @@ var BaseInput = /* @__PURE__ */ defineComponent((props, { slots, expose, attrs }
|
|
|
71
71
|
"style": styles?.affixWrapper,
|
|
72
72
|
"onClick": onInputClick
|
|
73
73
|
}, dataAttrs?.affixWrapper, { "ref": containerRef }), { default: () => [
|
|
74
|
-
prefix && createVNode("span", {
|
|
74
|
+
isVueRenderable(prefix) && createVNode("span", {
|
|
75
75
|
"class": clsx(`${prefixCls}-prefix`, classNames?.prefix),
|
|
76
76
|
"style": styles?.prefix
|
|
77
77
|
}, [prefix]),
|
|
@@ -88,9 +88,9 @@ var BaseInput = /* @__PURE__ */ defineComponent((props, { slots, expose, attrs }
|
|
|
88
88
|
"class": clsx(groupWrapperCls, { [`${groupWrapperCls}-disabled`]: disabled }, classNames?.groupWrapper),
|
|
89
89
|
"ref": groupRef
|
|
90
90
|
}, { default: () => [createVNode(WrapperComponent, { "class": mergedWrapperClassName }, { default: () => [
|
|
91
|
-
addonBefore && createVNode(GroupAddonComponent, { "class": addonCls }, _isSlot(addonBefore) ? addonBefore : { default: () => [addonBefore] }),
|
|
91
|
+
isVueRenderable(addonBefore) && createVNode(GroupAddonComponent, { "class": addonCls }, _isSlot(addonBefore) ? addonBefore : { default: () => [addonBefore] }),
|
|
92
92
|
element,
|
|
93
|
-
addonAfter && createVNode(GroupAddonComponent, { "class": addonCls }, _isSlot(addonAfter) ? addonAfter : { default: () => [addonAfter] })
|
|
93
|
+
isVueRenderable(addonAfter) && createVNode(GroupAddonComponent, { "class": addonCls }, _isSlot(addonAfter) ? addonAfter : { default: () => [addonAfter] })
|
|
94
94
|
] })] });
|
|
95
95
|
}
|
|
96
96
|
return createVNode(element, {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isVueRenderable } from "@v-c/util";
|
|
1
2
|
import { triggerFocus as triggerFocus$1 } from "@v-c/util/dist/Dom/focus";
|
|
2
3
|
//#region src/utils/commonUtils.ts
|
|
3
4
|
function createPatchedTarget(target, value) {
|
|
@@ -34,10 +35,10 @@ function cloneEventWithTarget(event, target) {
|
|
|
34
35
|
return buildSafeEvent(event, target);
|
|
35
36
|
}
|
|
36
37
|
function hasAddon(props) {
|
|
37
|
-
return
|
|
38
|
+
return isVueRenderable(props.addonBefore) || isVueRenderable(props.addonAfter);
|
|
38
39
|
}
|
|
39
40
|
function hasPrefixSuffix(props) {
|
|
40
|
-
return
|
|
41
|
+
return isVueRenderable(props.prefix) || isVueRenderable(props.suffix) || Boolean(props.allowClear);
|
|
41
42
|
}
|
|
42
43
|
function resolveOnChange(target, e, onChange, targetValue) {
|
|
43
44
|
if (!onChange) return;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@v-c/input",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.2",
|
|
5
5
|
"description": "",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://github.com/antdv-next/vue-components/tree/next/packages/input",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"vue": "^3.0.0"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@v-c/util": "^1.0
|
|
33
|
+
"@v-c/util": "^1.2.0"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"build": "vite build",
|