vft 0.0.335 → 0.0.338
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/index.css +1 -1
- package/es/components/carousel/use-carousel.js +1 -1
- package/es/components/form/form-item.vue.d.ts +3 -0
- package/es/components/form/form-item.vue2.js +101 -95
- package/es/components/form/index.d.ts +48 -0
- package/es/components/form/types.d.ts +2 -0
- package/es/components/input/input.vue2.js +4 -4
- package/es/components/input-tag/composables/use-input-tag.js +1 -1
- package/es/components/search/style/css.d.ts +1 -0
- package/es/components/search/style/css.js +1 -0
- package/es/components/search/style/index.d.ts +1 -0
- package/es/components/search/style/index.js +1 -0
- package/es/components/super-form/index.d.ts +15 -0
- package/es/components/super-form/super-form-item.vue2.js +1 -1
- package/es/components/super-form/super-form.vue.d.ts +1 -0
- package/es/components/super-form/super-form.vue2.js +3 -3
- package/es/components/super-form/types.d.ts +1 -0
- package/es/components/super-form/use/helper.js +53 -137
- package/es/package.json.d.ts +1 -1
- package/es/package.json.js +1 -1
- package/es/utils/vue/vnode.js +1 -1
- package/lib/components/form/form-item.vue.d.ts +3 -0
- package/lib/components/form/form-item.vue2.cjs +1 -1
- package/lib/components/form/index.d.ts +48 -0
- package/lib/components/form/types.d.ts +2 -0
- package/lib/components/input/input.vue2.cjs +1 -1
- package/lib/components/search/style/css.cjs +1 -1
- package/lib/components/search/style/css.d.ts +1 -0
- package/lib/components/search/style/index.cjs +1 -1
- package/lib/components/search/style/index.d.ts +1 -0
- package/lib/components/super-form/index.d.ts +15 -0
- package/lib/components/super-form/super-form.vue.d.ts +1 -0
- package/lib/components/super-form/super-form.vue2.cjs +1 -1
- package/lib/components/super-form/types.d.ts +1 -0
- package/lib/components/super-form/use/helper.cjs +1 -1
- package/lib/package.json.cjs +1 -1
- package/lib/package.json.d.ts +1 -1
- package/package.json +5 -5
- package/theme-style/index.css +1 -1
- package/theme-style/src/checkbox.scss +46 -45
- package/theme-style/vft-checkbox.css +1 -1
- package/web-types.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as $, computed as v, ref as ee, unref as u, useSlots as te, createVNode as f, mergeProps as L, withDirectives as re, vShow as ne,
|
|
1
|
+
import { defineComponent as $, computed as v, ref as ee, unref as u, useSlots as te, createVNode as f, mergeProps as L, withDirectives as re, vShow as ne, createTextVNode as G, isVNode as oe, resolveComponent as q } from "vue";
|
|
2
2
|
import { VftCol as J } from "../col/index.js";
|
|
3
3
|
import { VftDivider as le } from "../divider/index.js";
|
|
4
4
|
import { VftFormItem as se } from "../form/index.js";
|
|
@@ -79,6 +79,7 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
79
79
|
"onField-value-change"?: (() => any) | undefined;
|
|
80
80
|
}>, {
|
|
81
81
|
size: import("vft/es/constants").ComponentSize;
|
|
82
|
+
labelPosition: "left" | "right" | "top";
|
|
82
83
|
showResetButton: boolean;
|
|
83
84
|
showSubmitButton: boolean;
|
|
84
85
|
showCommonButton: boolean;
|
|
@@ -103,14 +103,14 @@ const Ee = W({
|
|
|
103
103
|
submitResetReverse: {
|
|
104
104
|
type: Boolean
|
|
105
105
|
},
|
|
106
|
+
labelPosition: {
|
|
107
|
+
default: "right"
|
|
108
|
+
},
|
|
106
109
|
disabled: {
|
|
107
110
|
type: Boolean
|
|
108
111
|
},
|
|
109
112
|
model: {},
|
|
110
113
|
rules: {},
|
|
111
|
-
labelPosition: {
|
|
112
|
-
default: "right"
|
|
113
|
-
},
|
|
114
114
|
requireAsteriskPosition: {
|
|
115
115
|
default: "left"
|
|
116
116
|
},
|
|
@@ -1,141 +1,57 @@
|
|
|
1
|
-
import "
|
|
2
|
-
import "
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
import "../../pagination/index.js";
|
|
51
|
-
import "../../popconfirm/index.js";
|
|
52
|
-
import "../../popover/index.js";
|
|
53
|
-
import "../../popper/index.js";
|
|
54
|
-
import "../../qrcode/index.js";
|
|
55
|
-
import "../../radio/index.js";
|
|
56
|
-
import "../../result/index.js";
|
|
57
|
-
import "../../router-view-content/index.js";
|
|
58
|
-
import "../../row/index.js";
|
|
59
|
-
import "../../scrollbar/index.js";
|
|
60
|
-
import "../../search/index.js";
|
|
61
|
-
import "../../select/index.js";
|
|
62
|
-
import "../../side-menu/index.js";
|
|
63
|
-
import "../../skeleton/index.js";
|
|
64
|
-
import "../../slider/index.js";
|
|
65
|
-
import "../../space/index.js";
|
|
66
|
-
import "../../steps/index.js";
|
|
67
|
-
import "../../switch/index.js";
|
|
68
|
-
import "../../table/index.js";
|
|
69
|
-
import "../../tabs/index.js";
|
|
70
|
-
import "../../tag/index.js";
|
|
71
|
-
import "../../time-picker/index.js";
|
|
72
|
-
import "../../tooltip/index.js";
|
|
73
|
-
import "../../tree/index.js";
|
|
74
|
-
import "../../verify-code/index.js";
|
|
75
|
-
import "../../virtual-list/components/fixed-size-list.js";
|
|
76
|
-
import "../../virtual-list/components/dynamic-size-list.js";
|
|
77
|
-
import "../../virtual-list/components/fixed-size-grid.js";
|
|
78
|
-
import "../../virtual-list/components/dynamic-size-grid.js";
|
|
79
|
-
import "../../virtual-list/props.js";
|
|
80
|
-
import "../../autocomplete/index.js";
|
|
81
|
-
import "../../breadcrumb/index.js";
|
|
82
|
-
import "../../carousel/index.js";
|
|
83
|
-
import "../../collapse/index.js";
|
|
84
|
-
import "../../countdown/index.js";
|
|
85
|
-
import "../../input-tag/index.js";
|
|
86
|
-
import "../../modal/index.js";
|
|
87
|
-
import "../../progress/index.js";
|
|
88
|
-
import "../../segmented/index.js";
|
|
89
|
-
import "../../statistic/index.js";
|
|
90
|
-
import "../index.js";
|
|
91
|
-
import "../../timeline/index.js";
|
|
92
|
-
import "../../transfer/index.js";
|
|
93
|
-
import "../../upload/index.js";
|
|
94
|
-
import "../../watermark/index.js";
|
|
95
|
-
import "../../md-code-demo/index.js";
|
|
96
|
-
import "../../md-code-tabs/index.js";
|
|
97
|
-
import "../../md-comment/index.js";
|
|
98
|
-
import "../../md-container/index.js";
|
|
99
|
-
import "../../md-tabs/index.js";
|
|
100
|
-
import "../../md-vue-playground/index.js";
|
|
101
|
-
import "../../infinite-scroll/index.js";
|
|
102
|
-
import "@vueuse/core";
|
|
103
|
-
import "../../config-provider/hooks/use-global-config.js";
|
|
104
|
-
import "lodash-es";
|
|
105
|
-
import "../../../hooks/use-model-toggle/index.js";
|
|
106
|
-
import "@popperjs/core";
|
|
107
|
-
import "../../../hooks/use-z-index/index.js";
|
|
108
|
-
import "../../message/index.js";
|
|
109
|
-
import "../../progress-i/index.js";
|
|
110
|
-
import { FormCompEnum as r, isInput as m } from "../component-map.js";
|
|
111
|
-
function Ei(i, o = "") {
|
|
112
|
-
return o = (o || "").replace(":", ""), [
|
|
113
|
-
r.INPUT,
|
|
114
|
-
r.INPUT_NUMBER,
|
|
115
|
-
r.TEXTAREA,
|
|
116
|
-
r.AUTOCOMPLETE
|
|
117
|
-
].includes(i) ? "请输入" + o : [r.PASSWORD].includes(i) ? "请输入密码" : [
|
|
118
|
-
r.SELECT,
|
|
119
|
-
r.RADIO,
|
|
120
|
-
r.Cascader,
|
|
121
|
-
r.ColorPicker
|
|
122
|
-
].includes(i) ? "请选择" + o : [r.SEARCH].includes(i) ? "请输入要搜索的内容" : [r.INPUT_TAG].includes(i) ? "请输入标签内容" : [r.Upload].includes(i) ? "请选择上传文件" : [r.Slider].includes(i) ? "请拖动滑块" : [
|
|
123
|
-
r.TIME_PICKER,
|
|
124
|
-
r.YEAR_PICKER,
|
|
125
|
-
r.MONTH_PICKER,
|
|
126
|
-
r.DATE_PICKER,
|
|
127
|
-
r.DATES_PICKER,
|
|
128
|
-
r.DATETIME_PICKER,
|
|
129
|
-
r.WEEK_PICKER,
|
|
130
|
-
r.DATETIMERANGE_PICKER,
|
|
131
|
-
r.DATERANGE_PICKER,
|
|
132
|
-
r.MONTHRANGE_PICKER
|
|
133
|
-
].includes(i) ? "请选择时间" : "";
|
|
1
|
+
import { isNumber as n } from "@vft/utils";
|
|
2
|
+
import { isInput as u, FormCompEnum as e } from "../component-map.js";
|
|
3
|
+
function s(r, E = "") {
|
|
4
|
+
if (E = (E || "").replace(":", "") || "", [
|
|
5
|
+
e.INPUT,
|
|
6
|
+
e.INPUT_NUMBER,
|
|
7
|
+
e.TEXTAREA,
|
|
8
|
+
e.AUTOCOMPLETE
|
|
9
|
+
].includes(r))
|
|
10
|
+
return "请输入" + E;
|
|
11
|
+
if ([e.PASSWORD].includes(r))
|
|
12
|
+
return "请输入密码";
|
|
13
|
+
if ([
|
|
14
|
+
e.SELECT,
|
|
15
|
+
e.RADIO,
|
|
16
|
+
e.RADIO_SINGLE,
|
|
17
|
+
e.RADIO_BUTTON,
|
|
18
|
+
e.Cascader,
|
|
19
|
+
e.ColorPicker,
|
|
20
|
+
e.CHECKBOX,
|
|
21
|
+
e.CHECKBOX_BUTTON
|
|
22
|
+
].includes(r))
|
|
23
|
+
return "请选择" + E;
|
|
24
|
+
if ([e.CHECKBOX_SINGLE].includes(r))
|
|
25
|
+
return "请勾选" + E;
|
|
26
|
+
if (![e.INPUT_TAG].includes(r)) {
|
|
27
|
+
if ([e.SEARCH].includes(r))
|
|
28
|
+
return "请输入要搜索的内容";
|
|
29
|
+
if ([e.INPUT_TAG].includes(r))
|
|
30
|
+
return "请输入标签内容";
|
|
31
|
+
if ([e.Upload].includes(r))
|
|
32
|
+
return "请选择上传文件";
|
|
33
|
+
if ([e.Slider].includes(r))
|
|
34
|
+
return "请拖动滑块";
|
|
35
|
+
if ([
|
|
36
|
+
e.TIME_PICKER,
|
|
37
|
+
e.YEAR_PICKER,
|
|
38
|
+
e.MONTH_PICKER,
|
|
39
|
+
e.DATE_PICKER,
|
|
40
|
+
e.DATES_PICKER,
|
|
41
|
+
e.DATETIME_PICKER,
|
|
42
|
+
e.WEEK_PICKER,
|
|
43
|
+
e.DATETIMERANGE_PICKER,
|
|
44
|
+
e.DATERANGE_PICKER,
|
|
45
|
+
e.MONTHRANGE_PICKER
|
|
46
|
+
].includes(r))
|
|
47
|
+
return "请选择时间";
|
|
48
|
+
}
|
|
49
|
+
return "";
|
|
134
50
|
}
|
|
135
|
-
function
|
|
136
|
-
return
|
|
51
|
+
function I(r, E) {
|
|
52
|
+
return r && u(r) && E && n(E) ? `${E}` : E;
|
|
137
53
|
}
|
|
138
54
|
export {
|
|
139
|
-
|
|
140
|
-
|
|
55
|
+
s as createPlaceholderMessage,
|
|
56
|
+
I as handleInputNumberValue
|
|
141
57
|
};
|
package/es/package.json.d.ts
CHANGED
package/es/package.json.js
CHANGED
package/es/utils/vue/vnode.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { hasOwn as m, camelize as N, isArray as E } from "@vft/utils";
|
|
2
2
|
import { isVNode as o, Fragment as S, Comment as A, Text as s, createCommentVNode as L, createBlock as _, openBlock as C } from "vue";
|
|
3
3
|
import { debugWarn as O } from "../error.js";
|
|
4
4
|
const R = "utils/vue/vnode";
|
|
@@ -13,6 +13,7 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
13
13
|
inlineMessage: string;
|
|
14
14
|
labelWidth: string;
|
|
15
15
|
showMessage: boolean;
|
|
16
|
+
hideLabel: boolean;
|
|
16
17
|
}>>, {
|
|
17
18
|
size: import("vue").ComputedRef<import("vft/es/constants").ComponentSize>;
|
|
18
19
|
validateMessage: import("vue").Ref<string, string>;
|
|
@@ -27,6 +28,7 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
27
28
|
inlineMessage: string;
|
|
28
29
|
labelWidth: string;
|
|
29
30
|
showMessage: boolean;
|
|
31
|
+
hideLabel: boolean;
|
|
30
32
|
}>>> & Readonly<{
|
|
31
33
|
"onUpdate:error"?: ((val: string) => any) | undefined;
|
|
32
34
|
}>, {
|
|
@@ -34,6 +36,7 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
34
36
|
labelWidth: string | number;
|
|
35
37
|
inlineMessage: string | boolean;
|
|
36
38
|
showMessage: boolean;
|
|
39
|
+
hideLabel: boolean;
|
|
37
40
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
38
41
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
|
|
39
42
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),oe=require("@vueuse/core"),m=require("@vft/utils"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),oe=require("@vueuse/core"),m=require("@vft/utils"),b=require("../../utils/helper.cjs"),g=require("lodash-es"),le=require("../../hooks/use-id/index.cjs"),ae=require("../../hooks/use-namespace/index.cjs");require("../../hooks/use-model-toggle/index.cjs");require("@popperjs/core");require("../../hooks/use-z-index/index.cjs");const se=require("async-validator"),z=require("./constants.cjs"),ie=require("./form-label-wrap.cjs"),ne=require("./hooks/use-form-common-props.cjs"),ue=["role","aria-labelledby"],de=e.defineComponent({name:"vft-form-item"}),ce=e.defineComponent({...de,props:{label:{},labelWidth:{default:""},labelPosition:{},prop:{},required:{type:Boolean,default:void 0},rules:{},error:{},for:{},validateStatus:{},inlineMessage:{type:[String,Boolean],default:""},showMessage:{type:Boolean,default:!0},size:{},hideRequiredAsterisk:{type:Boolean},hideLabel:{type:Boolean,default:!1}},emits:["update:error"],setup($,{expose:A,emit:j}){const r=$,E=j,B=e.useSlots(),l=e.inject(z.formContextKey,void 0),L=e.inject(z.formItemContextKey,void 0),y=ne.useFormSize(void 0,{formItem:!1}),s=ae.useNamespace("form-item"),q=le.useId().value,d=e.ref([]),c=e.ref(""),D=oe.refDebounced(c,100),n=e.ref(""),x=e.ref();let F,v=!1;const h=e.computed(()=>r.labelPosition||l?.labelPosition),M=e.computed(()=>{if(h.value==="top")return{};const t=b.addUnit(r.labelWidth||l?.labelWidth||"");return t?{width:t}:{}}),T=e.computed(()=>{if(h.value==="top"||l?.inline)return{};if(!r.label&&!r.labelWidth&&O)return{};const t=b.addUnit(r.labelWidth||l?.labelWidth||"");return!r.label&&!B.label?{marginLeft:t}:{}}),K=e.computed(()=>[s.b(),s.m(y.value),s.is("error",c.value==="error"),s.is("validating",c.value==="validating"),s.is("success",c.value==="success"),s.is("required",Q.value||r.required),s.is("no-asterisk",r?.hideRequiredAsterisk||l?.hideRequiredAsterisk),l?.requireAsteriskPosition==="right"?"asterisk-right":"asterisk-left",{[s.m("feedback")]:l?.statusIcon,[s.m(`label-${h.value}`)]:h.value}]),U=e.computed(()=>m.isBoolean(r.inlineMessage)?r.inlineMessage:l?.inlineMessage||!1),G=e.computed(()=>[s.e("error"),{[s.em("error","inline")]:U.value}]),P=e.computed(()=>r.prop?g.isArray(r.prop)?r.prop.join("."):r.prop:""),S=e.computed(()=>!!(r.label||B.label)),C=e.computed(()=>r.for??(d.value.length===1?d.value[0]:void 0)),k=e.computed(()=>!C.value&&S.value),O=!!L,V=e.computed(()=>{const t=l?.model;if(!(!t||!r.prop))return m.getProp(t,r.prop).value}),w=e.computed(()=>{const{required:t}=r,o=[];r.rules&&o.push(...b.castArray(r.rules).map(a=>(a.trigger=a.trigger||"blur",a)));const i=l?.rules;if(i&&r.prop){const a=m.getProp(i,r.prop).value;a&&o.push(...b.castArray(a))}if(t!==void 0){const a=o.map((u,f)=>[u,f]).filter(([u])=>Object.keys(u).includes("required"));if(a.length>0)for(const[u,f]of a)u.required!==t&&(o[f]={...u,required:t});else o.push({required:t})}return o}),H=e.computed(()=>w.value.length>0),J=t=>w.value.filter(i=>!i.trigger||!t?!0:g.isArray(i.trigger)?i.trigger.includes(t):i.trigger===t).map(({trigger:i,...a})=>a),Q=e.computed(()=>w.value.some(t=>t.required)),X=e.computed(()=>D.value==="error"&&r.showMessage&&(l?.showMessage??!0)),R=e.computed(()=>`${r.label||""}${l?.labelSuffix||""}`),p=t=>{c.value=t},Y=t=>{const{errors:o,fields:i}=t;(!o||!i)&&console.error(t),p("error"),n.value=o?o?.[0]?.message??`${r.prop} is required`:"",l?.emit("validate",r.prop,!1,n.value)},Z=()=>{p("success"),l?.emit("validate",r.prop,!0,"")},ee=async t=>{const o=P.value;return new se({[o]:t}).validate({[o]:V.value},{firstFields:!0}).then(()=>(Z(),!0)).catch(a=>(Y(a),Promise.reject(a)))},N=async(t,o)=>{if(v||!r.prop)return!1;const i=m.isFunction(o);if(!H.value)return o?.(!1),!1;const a=J(t);return a.length===0?(o?.(!0),!0):(p("validating"),ee(a).then(()=>(o?.(!0),!0)).catch(u=>{const{fields:f}=u;return o?.(!1,f),i?!1:Promise.reject(f)}))},I=()=>{r.error&&E("update:error",""),p(""),n.value="",v=!1},W=async()=>{const t=l?.model;if(!t||!r.prop)return;const o=m.getProp(t,r.prop);v=!0,o.value=g.clone(F),await e.nextTick(),I(),v=!1},te=t=>{d.value.includes(t)||d.value.push(t)},re=t=>{d.value=d.value.filter(o=>o!==t)};e.watch(()=>r.error,t=>{n.value=t||"",p(t?"error":"")},{immediate:!0}),e.watch(()=>r.validateStatus,t=>p(t||""));const _=e.reactive({...e.toRefs(r),$el:x,size:y,validateMessage:n,validateState:c,labelId:q,inputIds:d,isGroup:k,hasLabel:S,fieldValue:V,addInputId:te,removeInputId:re,resetField:W,clearValidate:I,validate:N,propString:P});return e.provide(z.formItemContextKey,_),e.onMounted(()=>{r.prop&&(l?.addField(_),F=g.clone(V.value))}),e.onBeforeUnmount(()=>{l?.removeField(_)}),A({size:y,validateMessage:n,validateState:c,validate:N,clearValidate:I,resetField:W}),(t,o)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"formItemRef",ref:x,class:e.normalizeClass(K.value),role:k.value?"group":void 0,"aria-labelledby":k.value?e.unref(q):void 0},[t.hideLabel?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(ie.default),{key:0,"is-auto-width":M.value.width==="auto","update-all":e.unref(l)?.labelWidth==="auto"},{default:e.withCtx(()=>[S.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(C.value?"label":"div"),{key:0,id:e.unref(q),for:C.value,class:e.normalizeClass(e.unref(s).e("label")),style:e.normalizeStyle(M.value)},{default:e.withCtx(()=>[e.renderSlot(t.$slots,"label",{label:R.value},()=>[e.createTextVNode(e.toDisplayString(R.value),1)])]),_:3},8,["id","for","class","style"])):e.createCommentVNode("",!0)]),_:3},8,["is-auto-width","update-all"])),e.createElementVNode("div",{class:e.normalizeClass(e.unref(s).e("content")),style:e.normalizeStyle(T.value)},[e.renderSlot(t.$slots,"default"),e.createVNode(e.TransitionGroup,{name:`${e.unref(s).namespace.value}-zoom-in-top`},{default:e.withCtx(()=>[X.value?e.renderSlot(t.$slots,"error",{key:0,error:n.value},()=>[e.createElementVNode("div",{class:e.normalizeClass(G.value)},e.toDisplayString(n.value),3)]):e.createCommentVNode("",!0)]),_:3},8,["name"])],6)],10,ue))}});exports.default=ce;
|
|
@@ -228,12 +228,19 @@ export declare const VftForm: import("vft/es/utils").SFCWithInstall<{
|
|
|
228
228
|
type: import("vue").PropType<boolean>;
|
|
229
229
|
default: boolean;
|
|
230
230
|
};
|
|
231
|
+
hideRequiredAsterisk: {
|
|
232
|
+
type: import("vue").PropType<boolean>;
|
|
233
|
+
};
|
|
231
234
|
for: {
|
|
232
235
|
type: import("vue").PropType<string>;
|
|
233
236
|
};
|
|
234
237
|
validateStatus: {
|
|
235
238
|
type: import("vue").PropType<"" | "error" | "validating" | "success">;
|
|
236
239
|
};
|
|
240
|
+
hideLabel: {
|
|
241
|
+
type: import("vue").PropType<boolean>;
|
|
242
|
+
default: boolean;
|
|
243
|
+
};
|
|
237
244
|
}>> & Readonly<{
|
|
238
245
|
"onUpdate:error"?: ((val: string) => any) | undefined;
|
|
239
246
|
}>, {
|
|
@@ -250,6 +257,7 @@ export declare const VftForm: import("vft/es/utils").SFCWithInstall<{
|
|
|
250
257
|
labelWidth: string | number;
|
|
251
258
|
inlineMessage: string | boolean;
|
|
252
259
|
showMessage: boolean;
|
|
260
|
+
hideLabel: boolean;
|
|
253
261
|
}, true, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
|
|
254
262
|
P: {};
|
|
255
263
|
B: {};
|
|
@@ -292,12 +300,19 @@ export declare const VftForm: import("vft/es/utils").SFCWithInstall<{
|
|
|
292
300
|
type: import("vue").PropType<boolean>;
|
|
293
301
|
default: boolean;
|
|
294
302
|
};
|
|
303
|
+
hideRequiredAsterisk: {
|
|
304
|
+
type: import("vue").PropType<boolean>;
|
|
305
|
+
};
|
|
295
306
|
for: {
|
|
296
307
|
type: import("vue").PropType<string>;
|
|
297
308
|
};
|
|
298
309
|
validateStatus: {
|
|
299
310
|
type: import("vue").PropType<"" | "error" | "validating" | "success">;
|
|
300
311
|
};
|
|
312
|
+
hideLabel: {
|
|
313
|
+
type: import("vue").PropType<boolean>;
|
|
314
|
+
default: boolean;
|
|
315
|
+
};
|
|
301
316
|
}>> & Readonly<{
|
|
302
317
|
"onUpdate:error"?: ((val: string) => any) | undefined;
|
|
303
318
|
}>, {
|
|
@@ -312,6 +327,7 @@ export declare const VftForm: import("vft/es/utils").SFCWithInstall<{
|
|
|
312
327
|
labelWidth: string | number;
|
|
313
328
|
inlineMessage: string | boolean;
|
|
314
329
|
showMessage: boolean;
|
|
330
|
+
hideLabel: boolean;
|
|
315
331
|
}>;
|
|
316
332
|
__isFragment?: never;
|
|
317
333
|
__isTeleport?: never;
|
|
@@ -351,12 +367,19 @@ export declare const VftForm: import("vft/es/utils").SFCWithInstall<{
|
|
|
351
367
|
type: import("vue").PropType<boolean>;
|
|
352
368
|
default: boolean;
|
|
353
369
|
};
|
|
370
|
+
hideRequiredAsterisk: {
|
|
371
|
+
type: import("vue").PropType<boolean>;
|
|
372
|
+
};
|
|
354
373
|
for: {
|
|
355
374
|
type: import("vue").PropType<string>;
|
|
356
375
|
};
|
|
357
376
|
validateStatus: {
|
|
358
377
|
type: import("vue").PropType<"" | "error" | "validating" | "success">;
|
|
359
378
|
};
|
|
379
|
+
hideLabel: {
|
|
380
|
+
type: import("vue").PropType<boolean>;
|
|
381
|
+
default: boolean;
|
|
382
|
+
};
|
|
360
383
|
}>> & Readonly<{
|
|
361
384
|
"onUpdate:error"?: ((val: string) => any) | undefined;
|
|
362
385
|
}>, {
|
|
@@ -373,6 +396,7 @@ export declare const VftForm: import("vft/es/utils").SFCWithInstall<{
|
|
|
373
396
|
labelWidth: string | number;
|
|
374
397
|
inlineMessage: string | boolean;
|
|
375
398
|
showMessage: boolean;
|
|
399
|
+
hideLabel: boolean;
|
|
376
400
|
}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
|
|
377
401
|
$slots: {
|
|
378
402
|
label?(_: {
|
|
@@ -421,12 +445,19 @@ export declare const VftFormItem: import("vft/es/utils").SFCWithInstall<{
|
|
|
421
445
|
type: import("vue").PropType<boolean>;
|
|
422
446
|
default: boolean;
|
|
423
447
|
};
|
|
448
|
+
hideRequiredAsterisk: {
|
|
449
|
+
type: import("vue").PropType<boolean>;
|
|
450
|
+
};
|
|
424
451
|
for: {
|
|
425
452
|
type: import("vue").PropType<string>;
|
|
426
453
|
};
|
|
427
454
|
validateStatus: {
|
|
428
455
|
type: import("vue").PropType<"" | "error" | "validating" | "success">;
|
|
429
456
|
};
|
|
457
|
+
hideLabel: {
|
|
458
|
+
type: import("vue").PropType<boolean>;
|
|
459
|
+
default: boolean;
|
|
460
|
+
};
|
|
430
461
|
}>> & Readonly<{
|
|
431
462
|
"onUpdate:error"?: ((val: string) => any) | undefined;
|
|
432
463
|
}>, {
|
|
@@ -443,6 +474,7 @@ export declare const VftFormItem: import("vft/es/utils").SFCWithInstall<{
|
|
|
443
474
|
labelWidth: string | number;
|
|
444
475
|
inlineMessage: string | boolean;
|
|
445
476
|
showMessage: boolean;
|
|
477
|
+
hideLabel: boolean;
|
|
446
478
|
}, true, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
|
|
447
479
|
P: {};
|
|
448
480
|
B: {};
|
|
@@ -485,12 +517,19 @@ export declare const VftFormItem: import("vft/es/utils").SFCWithInstall<{
|
|
|
485
517
|
type: import("vue").PropType<boolean>;
|
|
486
518
|
default: boolean;
|
|
487
519
|
};
|
|
520
|
+
hideRequiredAsterisk: {
|
|
521
|
+
type: import("vue").PropType<boolean>;
|
|
522
|
+
};
|
|
488
523
|
for: {
|
|
489
524
|
type: import("vue").PropType<string>;
|
|
490
525
|
};
|
|
491
526
|
validateStatus: {
|
|
492
527
|
type: import("vue").PropType<"" | "error" | "validating" | "success">;
|
|
493
528
|
};
|
|
529
|
+
hideLabel: {
|
|
530
|
+
type: import("vue").PropType<boolean>;
|
|
531
|
+
default: boolean;
|
|
532
|
+
};
|
|
494
533
|
}>> & Readonly<{
|
|
495
534
|
"onUpdate:error"?: ((val: string) => any) | undefined;
|
|
496
535
|
}>, {
|
|
@@ -505,6 +544,7 @@ export declare const VftFormItem: import("vft/es/utils").SFCWithInstall<{
|
|
|
505
544
|
labelWidth: string | number;
|
|
506
545
|
inlineMessage: string | boolean;
|
|
507
546
|
showMessage: boolean;
|
|
547
|
+
hideLabel: boolean;
|
|
508
548
|
}>;
|
|
509
549
|
__isFragment?: never;
|
|
510
550
|
__isTeleport?: never;
|
|
@@ -544,12 +584,19 @@ export declare const VftFormItem: import("vft/es/utils").SFCWithInstall<{
|
|
|
544
584
|
type: import("vue").PropType<boolean>;
|
|
545
585
|
default: boolean;
|
|
546
586
|
};
|
|
587
|
+
hideRequiredAsterisk: {
|
|
588
|
+
type: import("vue").PropType<boolean>;
|
|
589
|
+
};
|
|
547
590
|
for: {
|
|
548
591
|
type: import("vue").PropType<string>;
|
|
549
592
|
};
|
|
550
593
|
validateStatus: {
|
|
551
594
|
type: import("vue").PropType<"" | "error" | "validating" | "success">;
|
|
552
595
|
};
|
|
596
|
+
hideLabel: {
|
|
597
|
+
type: import("vue").PropType<boolean>;
|
|
598
|
+
default: boolean;
|
|
599
|
+
};
|
|
553
600
|
}>> & Readonly<{
|
|
554
601
|
"onUpdate:error"?: ((val: string) => any) | undefined;
|
|
555
602
|
}>, {
|
|
@@ -566,6 +613,7 @@ export declare const VftFormItem: import("vft/es/utils").SFCWithInstall<{
|
|
|
566
613
|
labelWidth: string | number;
|
|
567
614
|
inlineMessage: string | boolean;
|
|
568
615
|
showMessage: boolean;
|
|
616
|
+
hideLabel: boolean;
|
|
569
617
|
}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
|
|
570
618
|
$slots: {
|
|
571
619
|
label?(_: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue");require("../form/index.cjs");const k=require("../icon/index.cjs"),Y=require("@vueuse/core"),s=require("@vft/utils"),T=require("../../utils/error.cjs");require("../config-provider/hooks/use-global-config.cjs");const Be=require("lodash-es"),Z=require("../../hooks/use-namespace/index.cjs");require("../../hooks/use-model-toggle/index.cjs");require("@popperjs/core");require("../../hooks/use-z-index/index.cjs");const q=require("@vft/constants"),_=require("@vft/use"),ee=require("./utils.cjs"),te=require("../form/hooks/use-form-common-props.cjs"),oe=require("../form/hooks/use-form-item.cjs"),Ve=["role"],Ie=["id","type","disabled","formatter","parser","readonly","autocomplete","tabindex","aria-label","placeholder","form"],Se=["id","tabindex","disabled","readonly","autocomplete","aria-label","placeholder","form"],ze=e.defineComponent({__name:"input",props:{id:{},size:{default:""},disabled:{type:Boolean},modelValue:{},type:{default:"text"},resize:{},autosize:{type:[Object,Boolean],default:!1},autocomplete:{default:"off"},formatter:{},parser:{},placeholder:{},form:{},readonly:{type:Boolean},clearable:{type:Boolean},showPassword:{type:Boolean},showWordLimit:{type:Boolean},suffixIcon:{},prefixIcon:{},clearIcon:{},containerRole:{},label:{},tabindex:{default:0},validateEvent:{type:Boolean,default:!0},inputStyle:{type:[Boolean,null,String,Object,Array]}},emits:{[q.UPDATE_MODEL_EVENT]:t=>s.isString(t),input:t=>s.isString(t),change:t=>s.isString(t),suffixClick:t=>s.isString(t),prefixClick:t=>s.isString(t),focus:t=>t instanceof FocusEvent,blur:t=>t instanceof FocusEvent,clear:()=>!0,enter:()=>!0,mouseleave:t=>t instanceof MouseEvent,mouseenter:t=>t instanceof MouseEvent,keydown:t=>t instanceof Event,compositionstart:t=>t instanceof CompositionEvent,compositionupdate:t=>t instanceof CompositionEvent,compositionend:t=>t instanceof CompositionEvent},setup(t,{expose:ne,emit:ae}){const l=ae,v=e.useAttrs(),i=e.useSlots(),M=e.computed(()=>{const o={};return t.containerRole==="combobox"&&(o["aria-haspopup"]=v["aria-haspopup"],o["aria-owns"]=v["aria-owns"],o["aria-expanded"]=v["aria-expanded"]),o}),le=e.computed(()=>[t.type==="textarea"?A.b():n.b(),n.m(ie.value),n.is("disabled",m.value),n.is("exceed",fe.value),n.is("focus",c.value),{[n.b("group")]:i.prepend||i.append,[n.bm("group","append")]:i.append,[n.bm("group","prepend")]:i.prepend,[n.m("prefix")]:i.prefix||t.prefixIcon,[n.m("suffix")]:i.suffix||t.suffixIcon||t.clearable||t.showPassword,[n.bm("suffix","password-clear")]:E.value&&z.value},v.class]),se=e.getCurrentInstance(),re=e.computed(()=>[n.e("wrapper"),n.is("focus",c.value)]),r=_.useAttrs({excludeKeys:e.computed(()=>Object.keys(M.value))}),{form:ue,formItem:C}=oe.useFormItem(),{inputId:F}=oe.useFormItemInputId(se.props,{formItemContext:C}),ie=te.useFormSize(),m=te.useFormDisabled(),n=Z.useNamespace("input"),A=Z.useNamespace("textarea"),w=e.shallowRef(),f=e.shallowRef(),c=e.ref(!1),V=e.ref(!1),y=e.ref(!1),x=e.ref(!1),D=e.ref(),I=e.shallowRef(t.inputStyle),h=e.computed(()=>w.value||f.value),S=e.computed(()=>s.singleAttrToObj(t.prefixIcon,"icon",{size:16})),O=e.computed(()=>s.singleAttrToObj(t.suffixIcon,"icon",{size:16})),ce=e.computed(()=>s.singleAttrToObj(t.clearIcon,"icon",{icon:"icon-circle-close",size:16})),R=e.computed(()=>ue?.statusIcon??!1),g=e.computed(()=>C?.validateState||""),K=e.computed(()=>g.value&&{validating:"icon-loading",success:"icon-circle-check",error:"icon-circle-close"}[g.value]),de=e.computed(()=>x.value?{icon:"icon-view",size:16}:{icon:"icon-hide",size:16}),me=e.computed(()=>[v.style,t.inputStyle]),$=e.computed(()=>[t.inputStyle,I.value,{resize:t.resize}]),u=e.computed(()=>Be.isNil(t.modelValue)?"":String(t.modelValue)),E=e.computed(()=>t.clearable&&!m.value&&!t.readonly&&!!u.value&&(c.value||V.value)),z=e.computed(()=>t.showPassword&&!m.value&&!t.readonly&&!!u.value&&(!!u.value||c.value)),p=e.computed(()=>t.showWordLimit&&!!r.value.maxlength&&(t.type==="text"||t.type==="textarea")&&!m.value&&!t.readonly&&!t.showPassword),N=e.computed(()=>Array.from(u.value).length),fe=e.computed(()=>!!p.value&&N.value>Number(r.value.maxlength)),pe=e.computed(()=>!!i.suffix||!!t.suffixIcon||E.value||t.showPassword||p.value||!!g.value&&R.value),[ve,ye]=_.useCursor(w);Y.useResizeObserver(f,o=>{if(!p.value||t.resize!=="both")return;const a=o[0],{width:d}=a.contentRect;D.value={right:`calc(100% - ${d+15+6}px)`}});const B=()=>{if(!(!Y.isClient||t.type!=="textarea"))if(t.autosize){const o=s.isObject(t.autosize)?t.autosize.minRows:void 0,a=s.isObject(t.autosize)?t.autosize.maxRows:void 0;I.value={...ee.calcTextareaHeight(f.value,o,a)}}else I.value={minHeight:ee.calcTextareaHeight(f.value).minHeight}},b=()=>{const o=h.value;!o||o.value===u.value||(o.value=u.value)},P=async o=>{ve();let{value:a}=o.target;if(r.value.maxlength&&a.length>=r.value.maxlength&&(a=a.slice(0,Number(r.value.maxlength))),t.formatter&&(a=t.parser?t.parser(a):a,a=t.formatter(a)),!y.value){if(a===u.value){b();return}l(q.UPDATE_MODEL_EVENT,a),l("input",a),await e.nextTick(),b(),ye()}},j=o=>{l("change",o.target.value)},he=()=>{l("suffixClick",t.modelValue)},ge=()=>{l("prefixClick",t.modelValue)},L=o=>{l("compositionstart",o),y.value=!0},be=o=>/([(\uAC00-\uD7AF)|\u3130-\u318F])+/.test(o),W=o=>{l("compositionupdate",o);const a=o.target?.value,d=a[a.length-1]||"";y.value=!be(d)},H=o=>{l("compositionend",o),y.value&&(y.value=!1,P(o))},ke=()=>{x.value=!x.value,U()},U=async()=>{await e.nextTick(),h.value?.focus()},Ce=()=>h.value?.blur(),G=o=>{c.value=!0,l("focus",o)},J=o=>{c.value=!1,l("blur",o),t.validateEvent&&C?.validate?.("blur").catch(a=>T.debugWarn(a))},we=o=>{V.value=!1,l("mouseleave",o)},xe=o=>{V.value=!0,l("mouseenter",o)},Q=o=>{let a=o.key;if(o.target.type==="number"&&["e","+","-0","E"].includes(a))return o.returnValue=!1,!1;l("keydown",o)},Ee=()=>{h.value?.select()},X=()=>{l(q.UPDATE_MODEL_EVENT,""),l("change",""),l("clear"),l("input","")};return e.watch(()=>t.modelValue,()=>{e.nextTick(()=>B()),t.validateEvent&&C?.validate?.("change").catch(o=>T.debugWarn(o))}),e.watch(u,()=>b()),e.watch(()=>t.type,async()=>{await e.nextTick(),b(),B()}),e.onMounted(()=>{!t.formatter&&t.parser&&T.debugWarn("VftInput","If you set the parser, you also need to set the formatter."),b(),e.nextTick(B)}),ne({input:w,textarea:f,ref:h,textareaStyle:$,autosize:t.autosize,focus:U,blur:Ce,select:Ee,clear:X,resizeTextarea:B}),(o,a)=>e.withDirectives((e.openBlock(),e.createElementBlock("div",e.mergeProps(M.value,{class:le.value,style:me.value,role:o.containerRole,onMouseenter:xe,onMouseleave:we,onMousewheel:a[1]||(a[1]=d=>o.type==="number"&&c.value?d.preventDefault():null)}),[o.type!=="textarea"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[o.$slots.prepend?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(n).be("group","prepend"))},[e.renderSlot(o.$slots,"prepend")],2)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(re.value)},[o.$slots.prefix||S.value?.icon?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(e.unref(n).e("prefix"))},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(n).e("prefix-inner")),onClick:ge},[e.renderSlot(o.$slots,"prefix"),S.value?.icon?(e.openBlock(),e.createBlock(e.unref(k.VftIcon),e.mergeProps({key:0,pointer:""},S.value,{class:e.unref(n).e("icon")}),null,16,["class"])):e.createCommentVNode("",!0)],2)],2)):e.createCommentVNode("",!0),e.createElementVNode("input",e.mergeProps({id:e.unref(F),ref_key:"input",ref:w,class:e.unref(n).e("inner")},e.unref(r),{type:o.showPassword?x.value?"text":"password":o.type,disabled:e.unref(m),formatter:o.formatter,parser:o.parser,readonly:o.readonly,autocomplete:o.autocomplete,tabindex:o.tabindex,"aria-label":o.label,placeholder:o.placeholder,style:o.inputStyle,form:o.form,onCompositionstart:L,onCompositionupdate:W,onCompositionend:H,onInput:P,onFocus:G,onBlur:J,onChange:j,onKeydown:Q,onKeyup:a[0]||(a[0]=e.withKeys(d=>l("enter"),["enter"]))}),null,16,Ie),pe.value?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(e.unref(n).e("suffix"))},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(n).e("suffix-inner")),onClick:he},[!E.value||!z.value||!p.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.renderSlot(o.$slots,"suffix"),O.value?.icon?(e.openBlock(),e.createBlock(e.unref(k.VftIcon),e.mergeProps({key:0},O.value,{class:e.unref(n).e("icon")}),null,16,["class"])):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0),E.value?(e.openBlock(),e.createBlock(e.unref(k.VftIcon),e.mergeProps({key:1,pointer:"",class:[e.unref(n).e("icon"),e.unref(n).e("clear")]},ce.value,{onMousedown:e.withModifiers(e.unref(s.noop),["prevent"]),onClick:e.withModifiers(X,["stop"])}),null,16,["class","onMousedown"])):e.createCommentVNode("",!0),z.value?(e.openBlock(),e.createBlock(e.unref(k.VftIcon),e.mergeProps({key:2},de.value,{class:[e.unref(n).e("icon"),e.unref(n).e("password")],onClick:ke}),null,16,["class"])):e.createCommentVNode("",!0),p.value?(e.openBlock(),e.createElementBlock("span",{key:3,class:e.normalizeClass(e.unref(n).e("count"))},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(n).e("count-inner"))},e.toDisplayString(N.value)+" / "+e.toDisplayString(e.unref(r).maxlength),3)],2)):e.createCommentVNode("",!0),g.value&&K.value&&R.value?(e.openBlock(),e.createBlock(e.unref(k.VftIcon),{key:4,icon:K.value,class:e.normalizeClass([e.unref(n).e("icon"),e.unref(n).e("validateIcon"),e.unref(n).is("loading",g.value==="validating")])},null,8,["icon","class"])):e.createCommentVNode("",!0)],2)],2)):e.createCommentVNode("",!0)],2),o.$slots.append?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(e.unref(n).be("group","append"))},[e.renderSlot(o.$slots,"append")],2)):e.createCommentVNode("",!0)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("textarea",e.mergeProps({id:e.unref(F),ref_key:"textarea",ref:f,class:e.unref(A).e("inner")},e.unref(r),{tabindex:o.tabindex,disabled:e.unref(m),readonly:o.readonly,autocomplete:o.autocomplete,style:$.value,"aria-label":o.label,placeholder:o.placeholder,form:o.form,onCompositionstart:L,onCompositionupdate:W,onCompositionend:H,onInput:P,onFocus:G,onBlur:J,onChange:j,onKeydown:Q}),null,16,Se),p.value?(e.openBlock(),e.createElementBlock("span",{key:0,style:e.normalizeStyle(D.value),class:e.normalizeClass(e.unref(n).e("count"))},e.toDisplayString(N.value)+" / "+e.toDisplayString(e.unref(r).maxlength),7)):e.createCommentVNode("",!0)],64))],16,Ve)),[[e.vShow,o.type!=="hidden"]])}});exports.default=ze;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue");require("../form/index.cjs");const k=require("../icon/index.cjs"),Y=require("@vueuse/core"),s=require("@vft/utils"),T=require("../../utils/error.cjs");require("../config-provider/hooks/use-global-config.cjs");const Be=require("lodash-es"),Z=require("../../hooks/use-namespace/index.cjs");require("../../hooks/use-model-toggle/index.cjs");require("@popperjs/core");require("../../hooks/use-z-index/index.cjs");const q=require("@vft/constants"),_=require("@vft/use"),ee=require("./utils.cjs"),te=require("../form/hooks/use-form-item.cjs"),oe=require("../form/hooks/use-form-common-props.cjs"),Ve=["role"],Ie=["id","type","disabled","formatter","parser","readonly","autocomplete","tabindex","aria-label","placeholder","form"],Se=["id","tabindex","disabled","readonly","autocomplete","aria-label","placeholder","form"],ze=e.defineComponent({__name:"input",props:{id:{},size:{default:""},disabled:{type:Boolean},modelValue:{},type:{default:"text"},resize:{},autosize:{type:[Object,Boolean],default:!1},autocomplete:{default:"off"},formatter:{},parser:{},placeholder:{},form:{},readonly:{type:Boolean},clearable:{type:Boolean},showPassword:{type:Boolean},showWordLimit:{type:Boolean},suffixIcon:{},prefixIcon:{},clearIcon:{},containerRole:{},label:{},tabindex:{default:0},validateEvent:{type:Boolean,default:!0},inputStyle:{type:[Boolean,null,String,Object,Array]}},emits:{[q.UPDATE_MODEL_EVENT]:t=>s.isString(t),input:t=>s.isString(t),change:t=>s.isString(t),suffixClick:t=>s.isString(t),prefixClick:t=>s.isString(t),focus:t=>t instanceof FocusEvent,blur:t=>t instanceof FocusEvent,clear:()=>!0,enter:()=>!0,mouseleave:t=>t instanceof MouseEvent,mouseenter:t=>t instanceof MouseEvent,keydown:t=>t instanceof Event,compositionstart:t=>t instanceof CompositionEvent,compositionupdate:t=>t instanceof CompositionEvent,compositionend:t=>t instanceof CompositionEvent},setup(t,{expose:ne,emit:ae}){const l=ae,v=e.useAttrs(),i=e.useSlots(),M=e.computed(()=>{const o={};return t.containerRole==="combobox"&&(o["aria-haspopup"]=v["aria-haspopup"],o["aria-owns"]=v["aria-owns"],o["aria-expanded"]=v["aria-expanded"]),o}),le=e.computed(()=>[t.type==="textarea"?A.b():n.b(),n.m(ie.value),n.is("disabled",m.value),n.is("exceed",fe.value),n.is("focus",c.value),{[n.b("group")]:i.prepend||i.append,[n.bm("group","append")]:i.append,[n.bm("group","prepend")]:i.prepend,[n.m("prefix")]:i.prefix||t.prefixIcon,[n.m("suffix")]:i.suffix||t.suffixIcon||t.clearable||t.showPassword,[n.bm("suffix","password-clear")]:E.value&&z.value},v.class]),se=e.getCurrentInstance(),re=e.computed(()=>[n.e("wrapper"),n.is("focus",c.value)]),r=_.useAttrs({excludeKeys:e.computed(()=>Object.keys(M.value))}),{form:ue,formItem:C}=te.useFormItem(),{inputId:F}=te.useFormItemInputId(se.props,{formItemContext:C}),ie=oe.useFormSize(),m=oe.useFormDisabled(),n=Z.useNamespace("input"),A=Z.useNamespace("textarea"),w=e.shallowRef(),f=e.shallowRef(),c=e.ref(!1),V=e.ref(!1),y=e.ref(!1),x=e.ref(!1),D=e.ref(),I=e.shallowRef(t.inputStyle),h=e.computed(()=>w.value||f.value),S=e.computed(()=>s.singleAttrToObj(t.prefixIcon,"icon",{size:16})),O=e.computed(()=>s.singleAttrToObj(t.suffixIcon,"icon",{size:16})),ce=e.computed(()=>s.singleAttrToObj(t.clearIcon,"icon",{icon:"icon-circle-close",size:16})),R=e.computed(()=>ue?.statusIcon??!1),g=e.computed(()=>C?.validateState||""),K=e.computed(()=>g.value&&{validating:"icon-loading",success:"icon-circle-check",error:"icon-circle-close"}[g.value]),de=e.computed(()=>x.value?{icon:"icon-view",size:16}:{icon:"icon-hide",size:16}),me=e.computed(()=>[v.style,t.inputStyle]),$=e.computed(()=>[t.inputStyle,I.value,{resize:t.resize}]),u=e.computed(()=>Be.isNil(t.modelValue)?"":String(t.modelValue)),E=e.computed(()=>t.clearable&&!m.value&&!t.readonly&&!!u.value&&(c.value||V.value)),z=e.computed(()=>t.showPassword&&!m.value&&!t.readonly&&!!u.value&&(!!u.value||c.value)),p=e.computed(()=>t.showWordLimit&&!!r.value.maxlength&&(t.type==="text"||t.type==="textarea")&&!m.value&&!t.readonly&&!t.showPassword),N=e.computed(()=>Array.from(u.value).length),fe=e.computed(()=>!!p.value&&N.value>Number(r.value.maxlength)),pe=e.computed(()=>!!i.suffix||!!t.suffixIcon||E.value||t.showPassword||p.value||!!g.value&&R.value),[ve,ye]=_.useCursor(w);Y.useResizeObserver(f,o=>{if(!p.value||t.resize!=="both")return;const a=o[0],{width:d}=a.contentRect;D.value={right:`calc(100% - ${d+15+6}px)`}});const B=()=>{if(!(!Y.isClient||t.type!=="textarea"))if(t.autosize){const o=s.isObject(t.autosize)?t.autosize.minRows:void 0,a=s.isObject(t.autosize)?t.autosize.maxRows:void 0;I.value={...ee.calcTextareaHeight(f.value,o,a)}}else I.value={minHeight:ee.calcTextareaHeight(f.value).minHeight}},b=()=>{const o=h.value;!o||o.value===u.value||(o.value=u.value)},P=async o=>{ve();let{value:a}=o.target;if(r.value.maxlength&&a.length>=r.value.maxlength&&(a=a.slice(0,Number(r.value.maxlength))),t.formatter&&(a=t.parser?t.parser(a):a,a=t.formatter(a)),!y.value){if(a===u.value){b();return}l(q.UPDATE_MODEL_EVENT,a),l("input",a),await e.nextTick(),b(),ye()}},j=o=>{l("change",o.target.value)},he=()=>{l("suffixClick",t.modelValue)},ge=()=>{l("prefixClick",t.modelValue)},L=o=>{l("compositionstart",o),y.value=!0},be=o=>/([(\uAC00-\uD7AF)|\u3130-\u318F])+/.test(o),W=o=>{l("compositionupdate",o);const a=o.target?.value,d=a[a.length-1]||"";y.value=!be(d)},H=o=>{l("compositionend",o),y.value&&(y.value=!1,P(o))},ke=()=>{x.value=!x.value,U()},U=async()=>{await e.nextTick(),h.value?.focus()},Ce=()=>h.value?.blur(),G=o=>{c.value=!0,l("focus",o)},J=o=>{c.value=!1,l("blur",o),t.validateEvent&&C?.validate?.("blur").catch(a=>T.debugWarn(a))},we=o=>{V.value=!1,l("mouseleave",o)},xe=o=>{V.value=!0,l("mouseenter",o)},Q=o=>{let a=o.key;if(o.target.type==="number"&&["e","+","-0","E"].includes(a))return o.returnValue=!1,!1;l("keydown",o)},Ee=()=>{h.value?.select()},X=()=>{l(q.UPDATE_MODEL_EVENT,""),l("change",""),l("clear"),l("input","")};return e.watch(()=>t.modelValue,()=>{e.nextTick(()=>B()),t.validateEvent&&C?.validate?.("change").catch(o=>T.debugWarn(o))}),e.watch(u,()=>b()),e.watch(()=>t.type,async()=>{await e.nextTick(),b(),B()}),e.onMounted(()=>{!t.formatter&&t.parser&&T.debugWarn("VftInput","If you set the parser, you also need to set the formatter."),b(),e.nextTick(B)}),ne({input:w,textarea:f,ref:h,textareaStyle:$,autosize:t.autosize,focus:U,blur:Ce,select:Ee,clear:X,resizeTextarea:B}),(o,a)=>e.withDirectives((e.openBlock(),e.createElementBlock("div",e.mergeProps(M.value,{class:le.value,style:me.value,role:o.containerRole,onMouseenter:xe,onMouseleave:we,onMousewheel:a[1]||(a[1]=d=>o.type==="number"&&c.value?d.preventDefault():null)}),[o.type!=="textarea"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[o.$slots.prepend?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(n).be("group","prepend"))},[e.renderSlot(o.$slots,"prepend")],2)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(re.value)},[o.$slots.prefix||S.value?.icon?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(e.unref(n).e("prefix"))},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(n).e("prefix-inner")),onClick:ge},[e.renderSlot(o.$slots,"prefix"),S.value?.icon?(e.openBlock(),e.createBlock(e.unref(k.VftIcon),e.mergeProps({key:0,pointer:""},S.value,{class:e.unref(n).e("icon")}),null,16,["class"])):e.createCommentVNode("",!0)],2)],2)):e.createCommentVNode("",!0),e.createElementVNode("input",e.mergeProps({id:e.unref(F),ref_key:"input",ref:w,class:e.unref(n).e("inner")},e.unref(r),{type:o.showPassword?x.value?"text":"password":o.type,disabled:e.unref(m),formatter:o.formatter,parser:o.parser,readonly:o.readonly,autocomplete:o.autocomplete,tabindex:o.tabindex,"aria-label":o.label,placeholder:o.placeholder,style:o.inputStyle,form:o.form,onCompositionstart:L,onCompositionupdate:W,onCompositionend:H,onInput:P,onFocus:G,onBlur:J,onChange:j,onKeydown:Q,onKeyup:a[0]||(a[0]=e.withKeys(d=>l("enter"),["enter"]))}),null,16,Ie),pe.value?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(e.unref(n).e("suffix"))},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(n).e("suffix-inner")),onClick:he},[!E.value||!z.value||!p.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.renderSlot(o.$slots,"suffix"),O.value?.icon?(e.openBlock(),e.createBlock(e.unref(k.VftIcon),e.mergeProps({key:0},O.value,{class:e.unref(n).e("icon")}),null,16,["class"])):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0),E.value?(e.openBlock(),e.createBlock(e.unref(k.VftIcon),e.mergeProps({key:1,pointer:"",class:[e.unref(n).e("icon"),e.unref(n).e("clear")]},ce.value,{onMousedown:e.withModifiers(e.unref(s.noop),["prevent"]),onClick:e.withModifiers(X,["stop"])}),null,16,["class","onMousedown"])):e.createCommentVNode("",!0),z.value?(e.openBlock(),e.createBlock(e.unref(k.VftIcon),e.mergeProps({key:2},de.value,{class:[e.unref(n).e("icon"),e.unref(n).e("password")],onClick:ke}),null,16,["class"])):e.createCommentVNode("",!0),p.value?(e.openBlock(),e.createElementBlock("span",{key:3,class:e.normalizeClass(e.unref(n).e("count"))},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(n).e("count-inner"))},e.toDisplayString(N.value)+" / "+e.toDisplayString(e.unref(r).maxlength),3)],2)):e.createCommentVNode("",!0),g.value&&K.value&&R.value?(e.openBlock(),e.createBlock(e.unref(k.VftIcon),{key:4,icon:K.value,class:e.normalizeClass([e.unref(n).e("icon"),e.unref(n).e("validateIcon"),e.unref(n).is("loading",g.value==="validating")])},null,8,["icon","class"])):e.createCommentVNode("",!0)],2)],2)):e.createCommentVNode("",!0)],2),o.$slots.append?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(e.unref(n).be("group","append"))},[e.renderSlot(o.$slots,"append")],2)):e.createCommentVNode("",!0)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("textarea",e.mergeProps({id:e.unref(F),ref_key:"textarea",ref:f,class:e.unref(A).e("inner")},e.unref(r),{tabindex:o.tabindex,disabled:e.unref(m),readonly:o.readonly,autocomplete:o.autocomplete,style:$.value,"aria-label":o.label,placeholder:o.placeholder,form:o.form,onCompositionstart:L,onCompositionupdate:W,onCompositionend:H,onInput:P,onFocus:G,onBlur:J,onChange:j,onKeydown:Q}),null,16,Se),p.value?(e.openBlock(),e.createElementBlock("span",{key:0,style:e.normalizeStyle(D.value),class:e.normalizeClass(e.unref(n).e("count"))},e.toDisplayString(N.value)+" / "+e.toDisplayString(e.unref(r).maxlength),7)):e.createCommentVNode("",!0)],64))],16,Ve)),[[e.vShow,o.type!=="hidden"]])}});exports.default=ze;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";require("vft/theme-style/base.css");require("vft/theme-style/vft-input.css");require("vft/theme-style/vft-popover.css");require("vft/theme-style/vft-popper.css");require("vft/theme-style/vft-search.css");
|
|
1
|
+
"use strict";require("vft/theme-style/base.css");require("vft/theme-style/vft-input.css");require("vft/theme-style/vft-popover.css");require("vft/theme-style/vft-popper.css");require("vft/theme-style/vft-icon.css");require("vft/theme-style/vft-search.css");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";require("vft/theme-style/src/base.scss");require("vft/theme-style/src/input.scss");require("vft/theme-style/src/popper.scss");require("vft/theme-style/src/popover.scss");require("vft/theme-style/src/search.scss");
|
|
1
|
+
"use strict";require("vft/theme-style/src/base.scss");require("vft/theme-style/src/input.scss");require("vft/theme-style/src/popper.scss");require("vft/theme-style/src/popover.scss");require("vft/theme-style/src/icon.scss");require("vft/theme-style/src/search.scss");
|