vft 0.0.498 → 0.0.500
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/autocomplete/autocomplete.vue.d.ts +4 -4
- package/es/components/autocomplete/index.d.ts +12 -12
- package/es/components/carousel/use-carousel.js +1 -1
- package/es/components/config-provider/hooks/use-global-config.js +3 -3
- package/es/components/input/input.vue2.js +4 -4
- package/es/components/input-tag/composables/use-input-tag.js +1 -1
- package/es/components/popper/index.d.ts +3 -3
- package/es/components/select/index.d.ts +11 -11
- package/es/components/select/select.vue.d.ts +11 -11
- package/es/components/select/useSelect.d.ts +8 -8
- package/es/components/super-form/style/css.d.ts +1 -0
- package/es/components/super-form/style/index.d.ts +1 -0
- package/es/components/super-form/super-form-item.vue2.js +265 -249
- package/es/components/super-form/types.d.ts +3 -1
- package/es/components/table/table.vue2.js +51 -49
- package/es/components/table/use/use-data-source.js +166 -143
- package/es/components/table/use/use-loading.js +11 -11
- package/es/components/table/use/use-table.js +7 -6
- package/es/components/tooltip/index.d.ts +3 -3
- package/es/components/tree/index.d.ts +5 -5
- package/es/components/tree/tree.vue.d.ts +2 -2
- package/es/components/upload/index.d.ts +15 -15
- package/es/components/upload/upload-content.vue.d.ts +1 -1
- package/es/components/upload/upload.vue.d.ts +1 -1
- package/es/hooks/use-z-index/index.js +3 -3
- package/es/package.json.d.ts +1 -1
- package/es/package.json.js +1 -1
- package/es/utils/form-register.d.ts +1 -0
- package/es/utils/form-register.js +5 -4
- package/es/utils/vue/vnode.js +1 -1
- package/lib/components/autocomplete/autocomplete.vue.d.ts +4 -4
- package/lib/components/autocomplete/index.d.ts +12 -12
- package/lib/components/input/input.vue2.cjs +1 -1
- package/lib/components/popper/index.d.ts +3 -3
- package/lib/components/select/index.d.ts +11 -11
- package/lib/components/select/select.vue.d.ts +11 -11
- package/lib/components/select/useSelect.d.ts +8 -8
- package/lib/components/super-form/style/css.d.ts +1 -0
- package/lib/components/super-form/style/index.d.ts +1 -0
- package/lib/components/super-form/super-form-item.vue2.cjs +1 -1
- package/lib/components/super-form/types.d.ts +3 -1
- package/lib/components/table/table.vue2.cjs +1 -1
- package/lib/components/table/use/use-data-source.cjs +1 -1
- package/lib/components/table/use/use-loading.cjs +1 -1
- package/lib/components/table/use/use-table.cjs +1 -1
- package/lib/components/tooltip/index.d.ts +3 -3
- package/lib/components/tree/index.d.ts +5 -5
- package/lib/components/tree/tree.vue.d.ts +2 -2
- package/lib/components/upload/index.d.ts +15 -15
- package/lib/components/upload/upload-content.vue.d.ts +1 -1
- package/lib/components/upload/upload.vue.d.ts +1 -1
- package/lib/package.json.cjs +1 -1
- package/lib/package.json.d.ts +1 -1
- package/lib/utils/form-register.cjs +1 -1
- package/lib/utils/form-register.d.ts +1 -0
- package/package.json +6 -6
- package/theme-style/index.css +1 -1
- package/theme-style/src/icon-text.scss +1 -1
- package/theme-style/vft-icon-text.css +1 -1
- package/web-types.json +1 -1
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { ref as
|
|
1
|
+
import { ref as i, unref as o, watch as c, computed as g } from "vue";
|
|
2
2
|
import { useLoadingDelay as m } from "@vft/use";
|
|
3
|
-
function p(
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
[() =>
|
|
7
|
-
([
|
|
8
|
-
|
|
3
|
+
function p(t) {
|
|
4
|
+
const e = i(o(t).loading), { loading: l, start: u, cancel: d } = m(230), n = i(!0);
|
|
5
|
+
c(
|
|
6
|
+
[() => o(t).loading, l],
|
|
7
|
+
([a, f]) => {
|
|
8
|
+
e.value = a || f;
|
|
9
9
|
},
|
|
10
10
|
{ immediate: !0 }
|
|
11
11
|
);
|
|
12
|
-
const
|
|
13
|
-
function
|
|
14
|
-
|
|
12
|
+
const r = g(() => o(e));
|
|
13
|
+
function s(a) {
|
|
14
|
+
a ? n.value ? (e.value = !0, n.value = !1) : u() : (e.value = !1, d());
|
|
15
15
|
}
|
|
16
|
-
return { getLoading:
|
|
16
|
+
return { getLoading: r, setLoading: s };
|
|
17
17
|
}
|
|
18
18
|
export {
|
|
19
19
|
p as useLoading
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { getDynamicProps as c } from "@vft/utils";
|
|
2
2
|
import { tryOnBeforeUnmount as f } from "@vueuse/core";
|
|
3
|
-
import { ref as
|
|
3
|
+
import { ref as l, unref as u, watch as b, toRaw as p } from "vue";
|
|
4
4
|
function h(r) {
|
|
5
|
-
const n =
|
|
5
|
+
const n = l(null), o = l(!1), d = l(null);
|
|
6
6
|
let s;
|
|
7
7
|
function i(e, a) {
|
|
8
8
|
f(() => {
|
|
9
9
|
n.value = null, o.value = null;
|
|
10
|
-
}), !(
|
|
10
|
+
}), !(u(o) && e === u(n)) && (n.value = e, d.value = a, r && e.setProps(c(r)), o.value = !0, s?.(), s = b(
|
|
11
11
|
() => r,
|
|
12
12
|
() => {
|
|
13
13
|
r && e.setProps(c(r));
|
|
@@ -19,7 +19,7 @@ function h(r) {
|
|
|
19
19
|
));
|
|
20
20
|
}
|
|
21
21
|
function t() {
|
|
22
|
-
const e =
|
|
22
|
+
const e = u(n);
|
|
23
23
|
return e || console.error(
|
|
24
24
|
"The table instance has not been obtained yet, please make sure the table is presented when performing the table operation!"
|
|
25
25
|
), e;
|
|
@@ -36,7 +36,7 @@ function h(r) {
|
|
|
36
36
|
},
|
|
37
37
|
getColumns: () => {
|
|
38
38
|
const e = t().getColumns() || [];
|
|
39
|
-
return
|
|
39
|
+
return p(e);
|
|
40
40
|
},
|
|
41
41
|
setColumns: (e) => {
|
|
42
42
|
t().setColumns(e);
|
|
@@ -46,7 +46,8 @@ function h(r) {
|
|
|
46
46
|
deleteTableDataRecord: (e, a) => t().deleteTableDataRecord(e, a),
|
|
47
47
|
insertTableDataRecord: (e, a, m) => t().insertTableDataRecord(e, a, m),
|
|
48
48
|
updateTableDataRecord: (e, a) => t().updateTableDataRecord(e, a),
|
|
49
|
-
findTableDataRecord: (e) => t().findTableDataRecord(e)
|
|
49
|
+
findTableDataRecord: (e) => t().findTableDataRecord(e),
|
|
50
|
+
expandTreeLevel: (e) => t().expandTreeLevel(e)
|
|
50
51
|
}];
|
|
51
52
|
}
|
|
52
53
|
export {
|
|
@@ -2,7 +2,7 @@ import Tooltip from './tooltip.vue';
|
|
|
2
2
|
export declare const VftTooltip: import("vft/es/utils").SFCWithInstall<{
|
|
3
3
|
new (...args: any[]): import("vue").CreateComponentPublicInstanceWithMixins<Readonly<import("vue").ExtractPropTypes<{
|
|
4
4
|
role: {
|
|
5
|
-
type: import("vue").PropType<"dialog" | "menu" | "grid" | "group" | "listbox" | "tooltip" | "
|
|
5
|
+
type: import("vue").PropType<"tree" | "dialog" | "menu" | "grid" | "group" | "listbox" | "tooltip" | "navigation">;
|
|
6
6
|
};
|
|
7
7
|
showArrow: {
|
|
8
8
|
type: import("vue").PropType<boolean>;
|
|
@@ -173,7 +173,7 @@ export declare const VftTooltip: import("vft/es/utils").SFCWithInstall<{
|
|
|
173
173
|
Defaults: {};
|
|
174
174
|
}, Readonly<import("vue").ExtractPropTypes<{
|
|
175
175
|
role: {
|
|
176
|
-
type: import("vue").PropType<"dialog" | "menu" | "grid" | "group" | "listbox" | "tooltip" | "
|
|
176
|
+
type: import("vue").PropType<"tree" | "dialog" | "menu" | "grid" | "group" | "listbox" | "tooltip" | "navigation">;
|
|
177
177
|
};
|
|
178
178
|
showArrow: {
|
|
179
179
|
type: import("vue").PropType<boolean>;
|
|
@@ -334,7 +334,7 @@ export declare const VftTooltip: import("vft/es/utils").SFCWithInstall<{
|
|
|
334
334
|
__isSuspense?: never;
|
|
335
335
|
} & import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
|
|
336
336
|
role: {
|
|
337
|
-
type: import("vue").PropType<"dialog" | "menu" | "grid" | "group" | "listbox" | "tooltip" | "
|
|
337
|
+
type: import("vue").PropType<"tree" | "dialog" | "menu" | "grid" | "group" | "listbox" | "tooltip" | "navigation">;
|
|
338
338
|
};
|
|
339
339
|
showArrow: {
|
|
340
340
|
type: import("vue").PropType<boolean>;
|
|
@@ -97,12 +97,12 @@ export declare const VftTree: SFCWithInstall<{
|
|
|
97
97
|
};
|
|
98
98
|
}>> & Readonly<{
|
|
99
99
|
"onCurrent-change"?: (() => any) | undefined;
|
|
100
|
-
onCheck?: (() => any) | undefined;
|
|
101
100
|
"onCheck-change"?: (() => any) | undefined;
|
|
102
101
|
"onNode-click"?: (() => any) | undefined;
|
|
103
102
|
"onNode-contextmenu"?: (() => any) | undefined;
|
|
104
103
|
"onNode-collapse"?: (() => any) | undefined;
|
|
105
104
|
"onNode-expand"?: (() => any) | undefined;
|
|
105
|
+
onCheck?: (() => any) | undefined;
|
|
106
106
|
"onNode-drag-start"?: (() => any) | undefined;
|
|
107
107
|
"onNode-drag-end"?: (() => any) | undefined;
|
|
108
108
|
"onNode-drop"?: (() => any) | undefined;
|
|
@@ -134,12 +134,12 @@ export declare const VftTree: SFCWithInstall<{
|
|
|
134
134
|
updateNode: (data: import("./tree.type").TreeData, refNode: import("./tree.type").TreeKey | import("./tree.type").TreeNodeData | import("./model/node").default) => void;
|
|
135
135
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
136
136
|
"current-change": () => void;
|
|
137
|
-
check: () => void;
|
|
138
137
|
"check-change": () => void;
|
|
139
138
|
"node-click": () => void;
|
|
140
139
|
"node-contextmenu": () => void;
|
|
141
140
|
"node-collapse": () => void;
|
|
142
141
|
"node-expand": () => void;
|
|
142
|
+
check: () => void;
|
|
143
143
|
"node-drag-start": () => void;
|
|
144
144
|
"node-drag-end": () => void;
|
|
145
145
|
"node-drop": () => void;
|
|
@@ -251,12 +251,12 @@ export declare const VftTree: SFCWithInstall<{
|
|
|
251
251
|
};
|
|
252
252
|
}>> & Readonly<{
|
|
253
253
|
"onCurrent-change"?: (() => any) | undefined;
|
|
254
|
-
onCheck?: (() => any) | undefined;
|
|
255
254
|
"onCheck-change"?: (() => any) | undefined;
|
|
256
255
|
"onNode-click"?: (() => any) | undefined;
|
|
257
256
|
"onNode-contextmenu"?: (() => any) | undefined;
|
|
258
257
|
"onNode-collapse"?: (() => any) | undefined;
|
|
259
258
|
"onNode-expand"?: (() => any) | undefined;
|
|
259
|
+
onCheck?: (() => any) | undefined;
|
|
260
260
|
"onNode-drag-start"?: (() => any) | undefined;
|
|
261
261
|
"onNode-drag-end"?: (() => any) | undefined;
|
|
262
262
|
"onNode-drop"?: (() => any) | undefined;
|
|
@@ -388,12 +388,12 @@ export declare const VftTree: SFCWithInstall<{
|
|
|
388
388
|
};
|
|
389
389
|
}>> & Readonly<{
|
|
390
390
|
"onCurrent-change"?: (() => any) | undefined;
|
|
391
|
-
onCheck?: (() => any) | undefined;
|
|
392
391
|
"onCheck-change"?: (() => any) | undefined;
|
|
393
392
|
"onNode-click"?: (() => any) | undefined;
|
|
394
393
|
"onNode-contextmenu"?: (() => any) | undefined;
|
|
395
394
|
"onNode-collapse"?: (() => any) | undefined;
|
|
396
395
|
"onNode-expand"?: (() => any) | undefined;
|
|
396
|
+
onCheck?: (() => any) | undefined;
|
|
397
397
|
"onNode-drag-start"?: (() => any) | undefined;
|
|
398
398
|
"onNode-drag-end"?: (() => any) | undefined;
|
|
399
399
|
"onNode-drop"?: (() => any) | undefined;
|
|
@@ -425,12 +425,12 @@ export declare const VftTree: SFCWithInstall<{
|
|
|
425
425
|
updateNode: (data: import("./tree.type").TreeData, refNode: import("./tree.type").TreeKey | import("./tree.type").TreeNodeData | import("./model/node").default) => void;
|
|
426
426
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
427
427
|
"current-change": () => void;
|
|
428
|
-
check: () => void;
|
|
429
428
|
"check-change": () => void;
|
|
430
429
|
"node-click": () => void;
|
|
431
430
|
"node-contextmenu": () => void;
|
|
432
431
|
"node-collapse": () => void;
|
|
433
432
|
"node-expand": () => void;
|
|
433
|
+
check: () => void;
|
|
434
434
|
"node-drag-start": () => void;
|
|
435
435
|
"node-drag-end": () => void;
|
|
436
436
|
"node-drop": () => void;
|
|
@@ -69,12 +69,12 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
69
69
|
updateNode: (data: TreeData, refNode: TreeKey | TreeNodeData | Node) => void;
|
|
70
70
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
71
71
|
"current-change": () => void;
|
|
72
|
-
check: () => void;
|
|
73
72
|
"check-change": () => void;
|
|
74
73
|
"node-click": () => void;
|
|
75
74
|
"node-contextmenu": () => void;
|
|
76
75
|
"node-collapse": () => void;
|
|
77
76
|
"node-expand": () => void;
|
|
77
|
+
check: () => void;
|
|
78
78
|
"node-drag-start": () => void;
|
|
79
79
|
"node-drag-end": () => void;
|
|
80
80
|
"node-drop": () => void;
|
|
@@ -94,12 +94,12 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
94
94
|
indent: number;
|
|
95
95
|
}>>> & Readonly<{
|
|
96
96
|
"onCurrent-change"?: (() => any) | undefined;
|
|
97
|
-
onCheck?: (() => any) | undefined;
|
|
98
97
|
"onCheck-change"?: (() => any) | undefined;
|
|
99
98
|
"onNode-click"?: (() => any) | undefined;
|
|
100
99
|
"onNode-contextmenu"?: (() => any) | undefined;
|
|
101
100
|
"onNode-collapse"?: (() => any) | undefined;
|
|
102
101
|
"onNode-expand"?: (() => any) | undefined;
|
|
102
|
+
onCheck?: (() => any) | undefined;
|
|
103
103
|
"onNode-drag-start"?: (() => any) | undefined;
|
|
104
104
|
"onNode-drag-end"?: (() => any) | undefined;
|
|
105
105
|
"onNode-drop"?: (() => any) | undefined;
|
|
@@ -50,6 +50,10 @@ export declare const VftUpload: import("vft/es/utils").SFCWithInstall<{
|
|
|
50
50
|
type: import("vue").PropType<string>;
|
|
51
51
|
default: string;
|
|
52
52
|
};
|
|
53
|
+
accept: {
|
|
54
|
+
type: import("vue").PropType<string>;
|
|
55
|
+
default: string;
|
|
56
|
+
};
|
|
53
57
|
fileList: {
|
|
54
58
|
type: import("vue").PropType<import("./types").UploadUserFile[]>;
|
|
55
59
|
default: never[];
|
|
@@ -61,10 +65,6 @@ export declare const VftUpload: import("vft/es/utils").SFCWithInstall<{
|
|
|
61
65
|
type: import("vue").PropType<boolean>;
|
|
62
66
|
default: boolean;
|
|
63
67
|
};
|
|
64
|
-
accept: {
|
|
65
|
-
type: import("vue").PropType<string>;
|
|
66
|
-
default: string;
|
|
67
|
-
};
|
|
68
68
|
autoUpload: {
|
|
69
69
|
type: import("vue").PropType<boolean>;
|
|
70
70
|
default: boolean;
|
|
@@ -178,9 +178,9 @@ export declare const VftUpload: import("vft/es/utils").SFCWithInstall<{
|
|
|
178
178
|
sizeWidth: number;
|
|
179
179
|
sizeHeight: number;
|
|
180
180
|
action: string;
|
|
181
|
+
accept: string;
|
|
181
182
|
fileList: import("./types").UploadUserFile[];
|
|
182
183
|
showFileList: boolean;
|
|
183
|
-
accept: string;
|
|
184
184
|
autoUpload: boolean;
|
|
185
185
|
listType: import("./types").ListType;
|
|
186
186
|
httpRequest: import("./types").UploadRequestHandler;
|
|
@@ -246,6 +246,10 @@ export declare const VftUpload: import("vft/es/utils").SFCWithInstall<{
|
|
|
246
246
|
type: import("vue").PropType<string>;
|
|
247
247
|
default: string;
|
|
248
248
|
};
|
|
249
|
+
accept: {
|
|
250
|
+
type: import("vue").PropType<string>;
|
|
251
|
+
default: string;
|
|
252
|
+
};
|
|
249
253
|
fileList: {
|
|
250
254
|
type: import("vue").PropType<import("./types").UploadUserFile[]>;
|
|
251
255
|
default: never[];
|
|
@@ -257,10 +261,6 @@ export declare const VftUpload: import("vft/es/utils").SFCWithInstall<{
|
|
|
257
261
|
type: import("vue").PropType<boolean>;
|
|
258
262
|
default: boolean;
|
|
259
263
|
};
|
|
260
|
-
accept: {
|
|
261
|
-
type: import("vue").PropType<string>;
|
|
262
|
-
default: string;
|
|
263
|
-
};
|
|
264
264
|
autoUpload: {
|
|
265
265
|
type: import("vue").PropType<boolean>;
|
|
266
266
|
default: boolean;
|
|
@@ -374,9 +374,9 @@ export declare const VftUpload: import("vft/es/utils").SFCWithInstall<{
|
|
|
374
374
|
sizeWidth: number;
|
|
375
375
|
sizeHeight: number;
|
|
376
376
|
action: string;
|
|
377
|
+
accept: string;
|
|
377
378
|
fileList: import("./types").UploadUserFile[];
|
|
378
379
|
showFileList: boolean;
|
|
379
|
-
accept: string;
|
|
380
380
|
autoUpload: boolean;
|
|
381
381
|
listType: import("./types").ListType;
|
|
382
382
|
httpRequest: import("./types").UploadRequestHandler;
|
|
@@ -439,6 +439,10 @@ export declare const VftUpload: import("vft/es/utils").SFCWithInstall<{
|
|
|
439
439
|
type: import("vue").PropType<string>;
|
|
440
440
|
default: string;
|
|
441
441
|
};
|
|
442
|
+
accept: {
|
|
443
|
+
type: import("vue").PropType<string>;
|
|
444
|
+
default: string;
|
|
445
|
+
};
|
|
442
446
|
fileList: {
|
|
443
447
|
type: import("vue").PropType<import("./types").UploadUserFile[]>;
|
|
444
448
|
default: never[];
|
|
@@ -450,10 +454,6 @@ export declare const VftUpload: import("vft/es/utils").SFCWithInstall<{
|
|
|
450
454
|
type: import("vue").PropType<boolean>;
|
|
451
455
|
default: boolean;
|
|
452
456
|
};
|
|
453
|
-
accept: {
|
|
454
|
-
type: import("vue").PropType<string>;
|
|
455
|
-
default: string;
|
|
456
|
-
};
|
|
457
457
|
autoUpload: {
|
|
458
458
|
type: import("vue").PropType<boolean>;
|
|
459
459
|
default: boolean;
|
|
@@ -567,9 +567,9 @@ export declare const VftUpload: import("vft/es/utils").SFCWithInstall<{
|
|
|
567
567
|
sizeWidth: number;
|
|
568
568
|
sizeHeight: number;
|
|
569
569
|
action: string;
|
|
570
|
+
accept: string;
|
|
570
571
|
fileList: import("./types").UploadUserFile[];
|
|
571
572
|
showFileList: boolean;
|
|
572
|
-
accept: string;
|
|
573
573
|
autoUpload: boolean;
|
|
574
574
|
listType: import("./types").ListType;
|
|
575
575
|
httpRequest: import("./types").UploadRequestHandler;
|
|
@@ -50,9 +50,9 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
50
50
|
sizeWidth: number;
|
|
51
51
|
sizeHeight: number;
|
|
52
52
|
action: string;
|
|
53
|
+
accept: string;
|
|
53
54
|
fileList: import("./types").UploadUserFile[];
|
|
54
55
|
showFileList: boolean;
|
|
55
|
-
accept: string;
|
|
56
56
|
autoUpload: boolean;
|
|
57
57
|
listType: import("./types").ListType;
|
|
58
58
|
httpRequest: import("./types").UploadRequestHandler;
|
|
@@ -104,9 +104,9 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
104
104
|
sizeWidth: number;
|
|
105
105
|
sizeHeight: number;
|
|
106
106
|
action: string;
|
|
107
|
+
accept: string;
|
|
107
108
|
fileList: import("./types").UploadUserFile[];
|
|
108
109
|
showFileList: boolean;
|
|
109
|
-
accept: string;
|
|
110
110
|
autoUpload: boolean;
|
|
111
111
|
listType: import("./types").ListType;
|
|
112
112
|
httpRequest: import("./types").UploadRequestHandler;
|
|
@@ -2,14 +2,14 @@ import "@vueuse/core";
|
|
|
2
2
|
import { isNumber as m, isClient as p } from "@vft/utils";
|
|
3
3
|
import { debugWarn as l } from "../../utils/error.js";
|
|
4
4
|
import "../../components/config-provider/hooks/use-global-config.js";
|
|
5
|
-
import { getCurrentInstance as i, inject as e, computed as c, unref as
|
|
5
|
+
import { ref as v, getCurrentInstance as i, inject as e, computed as c, unref as Z } from "vue";
|
|
6
6
|
import "lodash-es";
|
|
7
7
|
import "../../components/form/index.js";
|
|
8
8
|
const s = {
|
|
9
9
|
current: 0
|
|
10
|
-
}, u =
|
|
10
|
+
}, u = v(0), f = 2e3, d = Symbol("vftZIndexContextKey"), y = Symbol("zIndexContextKey"), K = (I) => {
|
|
11
11
|
const n = i() ? e(d, s) : s, x = I || (i() ? e(y, void 0) : void 0), t = c(() => {
|
|
12
|
-
const r =
|
|
12
|
+
const r = Z(x);
|
|
13
13
|
return m(r) ? r : f;
|
|
14
14
|
}), o = c(() => t.value + u.value), a = () => (n.current++, u.value = n.current, o.value);
|
|
15
15
|
return !p && !e(d) && l(
|
package/es/package.json.d.ts
CHANGED
package/es/package.json.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const o = {
|
|
2
2
|
Custom: "custom",
|
|
3
3
|
AutoComplete: "autocomplete",
|
|
4
4
|
Cascader: "cascader",
|
|
@@ -12,6 +12,7 @@ const r = {
|
|
|
12
12
|
Slider: "slider",
|
|
13
13
|
Divider: "divider",
|
|
14
14
|
Select: "select",
|
|
15
|
+
Tree: "tree",
|
|
15
16
|
TreeSelect: "tree-select",
|
|
16
17
|
Search: "search",
|
|
17
18
|
Radio: "radio",
|
|
@@ -39,8 +40,8 @@ function i(e, n) {
|
|
|
39
40
|
t.set(e, n);
|
|
40
41
|
}
|
|
41
42
|
function c(e) {
|
|
42
|
-
Object.entries(e).forEach(([n,
|
|
43
|
-
t.set(n,
|
|
43
|
+
Object.entries(e).forEach(([n, r]) => {
|
|
44
|
+
t.set(n, r);
|
|
44
45
|
});
|
|
45
46
|
}
|
|
46
47
|
function a(e) {
|
|
@@ -59,7 +60,7 @@ function p() {
|
|
|
59
60
|
t.clear();
|
|
60
61
|
}
|
|
61
62
|
export {
|
|
62
|
-
|
|
63
|
+
o as FormCompEnum,
|
|
63
64
|
p as clearComponents,
|
|
64
65
|
a as getComponent,
|
|
65
66
|
m as getRegisteredComponents,
|
package/es/utils/vue/vnode.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isArray as E, hasOwn as m, camelize as N } 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";
|
|
@@ -112,7 +112,7 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
112
112
|
$el: any;
|
|
113
113
|
$options: import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
|
|
114
114
|
role: {
|
|
115
|
-
type: import("vue").PropType<"dialog" | "menu" | "grid" | "group" | "listbox" | "tooltip" | "
|
|
115
|
+
type: import("vue").PropType<"tree" | "dialog" | "menu" | "grid" | "group" | "listbox" | "tooltip" | "navigation">;
|
|
116
116
|
};
|
|
117
117
|
showArrow: {
|
|
118
118
|
type: import("vue").PropType<boolean>;
|
|
@@ -296,7 +296,7 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
296
296
|
$watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, import("@vue/reactivity").OnCleanup]) => any : (...args: [any, any, import("@vue/reactivity").OnCleanup]) => any, options?: import("vue").WatchOptions): import("vue").WatchStopHandle;
|
|
297
297
|
} & Readonly<{}> & Omit<Readonly<import("vue").ExtractPropTypes<{
|
|
298
298
|
role: {
|
|
299
|
-
type: import("vue").PropType<"dialog" | "menu" | "grid" | "group" | "listbox" | "tooltip" | "
|
|
299
|
+
type: import("vue").PropType<"tree" | "dialog" | "menu" | "grid" | "group" | "listbox" | "tooltip" | "navigation">;
|
|
300
300
|
};
|
|
301
301
|
showArrow: {
|
|
302
302
|
type: import("vue").PropType<boolean>;
|
|
@@ -530,7 +530,7 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
530
530
|
$el: any;
|
|
531
531
|
$options: import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
|
|
532
532
|
role: {
|
|
533
|
-
type: import("vue").PropType<"dialog" | "menu" | "grid" | "group" | "listbox" | "tooltip" | "
|
|
533
|
+
type: import("vue").PropType<"tree" | "dialog" | "menu" | "grid" | "group" | "listbox" | "tooltip" | "navigation">;
|
|
534
534
|
};
|
|
535
535
|
showArrow: {
|
|
536
536
|
type: import("vue").PropType<boolean>;
|
|
@@ -714,7 +714,7 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
714
714
|
$watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, import("@vue/reactivity").OnCleanup]) => any : (...args: [any, any, import("@vue/reactivity").OnCleanup]) => any, options?: import("vue").WatchOptions): import("vue").WatchStopHandle;
|
|
715
715
|
} & Readonly<{}> & Omit<Readonly<import("vue").ExtractPropTypes<{
|
|
716
716
|
role: {
|
|
717
|
-
type: import("vue").PropType<"dialog" | "menu" | "grid" | "group" | "listbox" | "tooltip" | "
|
|
717
|
+
type: import("vue").PropType<"tree" | "dialog" | "menu" | "grid" | "group" | "listbox" | "tooltip" | "navigation">;
|
|
718
718
|
};
|
|
719
719
|
showArrow: {
|
|
720
720
|
type: import("vue").PropType<boolean>;
|
|
@@ -135,7 +135,7 @@ export declare const VftAutocomplete: import("vft/es/utils").SFCWithInstall<{
|
|
|
135
135
|
$el: any;
|
|
136
136
|
$options: import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
|
|
137
137
|
role: {
|
|
138
|
-
type: import("vue").PropType<"dialog" | "menu" | "grid" | "group" | "listbox" | "tooltip" | "
|
|
138
|
+
type: import("vue").PropType<"tree" | "dialog" | "menu" | "grid" | "group" | "listbox" | "tooltip" | "navigation">;
|
|
139
139
|
};
|
|
140
140
|
showArrow: {
|
|
141
141
|
type: import("vue").PropType<boolean>;
|
|
@@ -319,7 +319,7 @@ export declare const VftAutocomplete: import("vft/es/utils").SFCWithInstall<{
|
|
|
319
319
|
$watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, import("@vue/reactivity").OnCleanup]) => any : (...args: [any, any, import("@vue/reactivity").OnCleanup]) => any, options?: import("vue").WatchOptions): import("vue").WatchStopHandle;
|
|
320
320
|
} & Readonly<{}> & Omit<Readonly<import("vue").ExtractPropTypes<{
|
|
321
321
|
role: {
|
|
322
|
-
type: import("vue").PropType<"dialog" | "menu" | "grid" | "group" | "listbox" | "tooltip" | "
|
|
322
|
+
type: import("vue").PropType<"tree" | "dialog" | "menu" | "grid" | "group" | "listbox" | "tooltip" | "navigation">;
|
|
323
323
|
};
|
|
324
324
|
showArrow: {
|
|
325
325
|
type: import("vue").PropType<boolean>;
|
|
@@ -553,7 +553,7 @@ export declare const VftAutocomplete: import("vft/es/utils").SFCWithInstall<{
|
|
|
553
553
|
$el: any;
|
|
554
554
|
$options: import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
|
|
555
555
|
role: {
|
|
556
|
-
type: import("vue").PropType<"dialog" | "menu" | "grid" | "group" | "listbox" | "tooltip" | "
|
|
556
|
+
type: import("vue").PropType<"tree" | "dialog" | "menu" | "grid" | "group" | "listbox" | "tooltip" | "navigation">;
|
|
557
557
|
};
|
|
558
558
|
showArrow: {
|
|
559
559
|
type: import("vue").PropType<boolean>;
|
|
@@ -737,7 +737,7 @@ export declare const VftAutocomplete: import("vft/es/utils").SFCWithInstall<{
|
|
|
737
737
|
$watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, import("@vue/reactivity").OnCleanup]) => any : (...args: [any, any, import("@vue/reactivity").OnCleanup]) => any, options?: import("vue").WatchOptions): import("vue").WatchStopHandle;
|
|
738
738
|
} & Readonly<{}> & Omit<Readonly<import("vue").ExtractPropTypes<{
|
|
739
739
|
role: {
|
|
740
|
-
type: import("vue").PropType<"dialog" | "menu" | "grid" | "group" | "listbox" | "tooltip" | "
|
|
740
|
+
type: import("vue").PropType<"tree" | "dialog" | "menu" | "grid" | "group" | "listbox" | "tooltip" | "navigation">;
|
|
741
741
|
};
|
|
742
742
|
showArrow: {
|
|
743
743
|
type: import("vue").PropType<boolean>;
|
|
@@ -1056,7 +1056,7 @@ export declare const VftAutocomplete: import("vft/es/utils").SFCWithInstall<{
|
|
|
1056
1056
|
$el: any;
|
|
1057
1057
|
$options: import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
|
|
1058
1058
|
role: {
|
|
1059
|
-
type: import("vue").PropType<"dialog" | "menu" | "grid" | "group" | "listbox" | "tooltip" | "
|
|
1059
|
+
type: import("vue").PropType<"tree" | "dialog" | "menu" | "grid" | "group" | "listbox" | "tooltip" | "navigation">;
|
|
1060
1060
|
};
|
|
1061
1061
|
showArrow: {
|
|
1062
1062
|
type: import("vue").PropType<boolean>;
|
|
@@ -1240,7 +1240,7 @@ export declare const VftAutocomplete: import("vft/es/utils").SFCWithInstall<{
|
|
|
1240
1240
|
$watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, import("@vue/reactivity").OnCleanup]) => any : (...args: [any, any, import("@vue/reactivity").OnCleanup]) => any, options?: import("vue").WatchOptions): import("vue").WatchStopHandle;
|
|
1241
1241
|
} & Readonly<{}> & Omit<Readonly<import("vue").ExtractPropTypes<{
|
|
1242
1242
|
role: {
|
|
1243
|
-
type: import("vue").PropType<"dialog" | "menu" | "grid" | "group" | "listbox" | "tooltip" | "
|
|
1243
|
+
type: import("vue").PropType<"tree" | "dialog" | "menu" | "grid" | "group" | "listbox" | "tooltip" | "navigation">;
|
|
1244
1244
|
};
|
|
1245
1245
|
showArrow: {
|
|
1246
1246
|
type: import("vue").PropType<boolean>;
|
|
@@ -1474,7 +1474,7 @@ export declare const VftAutocomplete: import("vft/es/utils").SFCWithInstall<{
|
|
|
1474
1474
|
$el: any;
|
|
1475
1475
|
$options: import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
|
|
1476
1476
|
role: {
|
|
1477
|
-
type: import("vue").PropType<"dialog" | "menu" | "grid" | "group" | "listbox" | "tooltip" | "
|
|
1477
|
+
type: import("vue").PropType<"tree" | "dialog" | "menu" | "grid" | "group" | "listbox" | "tooltip" | "navigation">;
|
|
1478
1478
|
};
|
|
1479
1479
|
showArrow: {
|
|
1480
1480
|
type: import("vue").PropType<boolean>;
|
|
@@ -1658,7 +1658,7 @@ export declare const VftAutocomplete: import("vft/es/utils").SFCWithInstall<{
|
|
|
1658
1658
|
$watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, import("@vue/reactivity").OnCleanup]) => any : (...args: [any, any, import("@vue/reactivity").OnCleanup]) => any, options?: import("vue").WatchOptions): import("vue").WatchStopHandle;
|
|
1659
1659
|
} & Readonly<{}> & Omit<Readonly<import("vue").ExtractPropTypes<{
|
|
1660
1660
|
role: {
|
|
1661
|
-
type: import("vue").PropType<"dialog" | "menu" | "grid" | "group" | "listbox" | "tooltip" | "
|
|
1661
|
+
type: import("vue").PropType<"tree" | "dialog" | "menu" | "grid" | "group" | "listbox" | "tooltip" | "navigation">;
|
|
1662
1662
|
};
|
|
1663
1663
|
showArrow: {
|
|
1664
1664
|
type: import("vue").PropType<boolean>;
|
|
@@ -1966,7 +1966,7 @@ export declare const VftAutocomplete: import("vft/es/utils").SFCWithInstall<{
|
|
|
1966
1966
|
$el: any;
|
|
1967
1967
|
$options: import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
|
|
1968
1968
|
role: {
|
|
1969
|
-
type: import("vue").PropType<"dialog" | "menu" | "grid" | "group" | "listbox" | "tooltip" | "
|
|
1969
|
+
type: import("vue").PropType<"tree" | "dialog" | "menu" | "grid" | "group" | "listbox" | "tooltip" | "navigation">;
|
|
1970
1970
|
};
|
|
1971
1971
|
showArrow: {
|
|
1972
1972
|
type: import("vue").PropType<boolean>;
|
|
@@ -2150,7 +2150,7 @@ export declare const VftAutocomplete: import("vft/es/utils").SFCWithInstall<{
|
|
|
2150
2150
|
$watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, import("@vue/reactivity").OnCleanup]) => any : (...args: [any, any, import("@vue/reactivity").OnCleanup]) => any, options?: import("vue").WatchOptions): import("vue").WatchStopHandle;
|
|
2151
2151
|
} & Readonly<{}> & Omit<Readonly<import("vue").ExtractPropTypes<{
|
|
2152
2152
|
role: {
|
|
2153
|
-
type: import("vue").PropType<"dialog" | "menu" | "grid" | "group" | "listbox" | "tooltip" | "
|
|
2153
|
+
type: import("vue").PropType<"tree" | "dialog" | "menu" | "grid" | "group" | "listbox" | "tooltip" | "navigation">;
|
|
2154
2154
|
};
|
|
2155
2155
|
showArrow: {
|
|
2156
2156
|
type: import("vue").PropType<boolean>;
|
|
@@ -2384,7 +2384,7 @@ export declare const VftAutocomplete: import("vft/es/utils").SFCWithInstall<{
|
|
|
2384
2384
|
$el: any;
|
|
2385
2385
|
$options: import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
|
|
2386
2386
|
role: {
|
|
2387
|
-
type: import("vue").PropType<"dialog" | "menu" | "grid" | "group" | "listbox" | "tooltip" | "
|
|
2387
|
+
type: import("vue").PropType<"tree" | "dialog" | "menu" | "grid" | "group" | "listbox" | "tooltip" | "navigation">;
|
|
2388
2388
|
};
|
|
2389
2389
|
showArrow: {
|
|
2390
2390
|
type: import("vue").PropType<boolean>;
|
|
@@ -2568,7 +2568,7 @@ export declare const VftAutocomplete: import("vft/es/utils").SFCWithInstall<{
|
|
|
2568
2568
|
$watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, import("@vue/reactivity").OnCleanup]) => any : (...args: [any, any, import("@vue/reactivity").OnCleanup]) => any, options?: import("vue").WatchOptions): import("vue").WatchStopHandle;
|
|
2569
2569
|
} & Readonly<{}> & Omit<Readonly<import("vue").ExtractPropTypes<{
|
|
2570
2570
|
role: {
|
|
2571
|
-
type: import("vue").PropType<"dialog" | "menu" | "grid" | "group" | "listbox" | "tooltip" | "
|
|
2571
|
+
type: import("vue").PropType<"tree" | "dialog" | "menu" | "grid" | "group" | "listbox" | "tooltip" | "navigation">;
|
|
2572
2572
|
};
|
|
2573
2573
|
showArrow: {
|
|
2574
2574
|
type: import("vue").PropType<boolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue");require("../form/index.cjs");const b=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"),ne=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:oe,emit:ae}){const l=ae,p=e.useAttrs(),i=e.useSlots(),M=e.computed(()=>{const n={};return t.containerRole==="combobox"&&(n["aria-haspopup"]=p["aria-haspopup"],n["aria-owns"]=p["aria-owns"],n["aria-expanded"]=p["aria-expanded"]),n}),le=e.computed(()=>[t.type==="textarea"?A.b():o.b(),o.m(ie.value),o.is("disabled",m.value),o.is("exceed",fe.value),o.is("focus",c.value),{[o.b("group")]:i.prepend||i.append,[o.bm("group","append")]:i.append,[o.bm("group","prepend")]:i.prepend,[o.m("prefix")]:i.prefix||t.prefixIcon,[o.m("suffix")]:i.suffix||t.suffixIcon||t.clearable||t.showPassword,[o.bm("suffix","password-clear")]:E.value&&z.value},p.class]),se=e.getCurrentInstance(),re=e.computed(()=>[o.e("wrapper"),o.is("focus",c.value)]),r=_.useAttrs({excludeKeys:e.computed(()=>Object.keys(M.value))}),{form:ue,formItem:k}=te.useFormItem(),{inputId:F}=te.useFormItemInputId(se.props,{formItemContext:k}),ie=ne.useFormSize(),m=ne.useFormDisabled(),o=Z.useNamespace("input"),A=Z.useNamespace("textarea"),C=e.shallowRef(),f=e.shallowRef(),c=e.ref(!1),V=e.ref(!1),y=e.ref(!1),w=e.ref(!1),D=e.ref(),I=e.shallowRef(t.inputStyle),h=e.computed(()=>C.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),x=e.computed(()=>k?.validateState||""),K=e.computed(()=>x.value&&{validating:"icon-loading",success:"icon-circle-check",error:"icon-circle-close"}[x.value]),de=e.computed(()=>w.value?{icon:"icon-view",size:16}:{icon:"icon-hide",size:16}),me=e.computed(()=>[p.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)),v=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(()=>!!v.value&&N.value>Number(r.value.maxlength)),ve=e.computed(()=>!!i.suffix||!!t.suffixIcon||E.value||t.showPassword||v.value||!!x.value&&R.value),[pe,ye]=_.useCursor(C);Y.useResizeObserver(f,n=>{if(!v.value||t.resize!=="both")return;const a=n[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 n=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,n,a)}}else I.value={minHeight:ee.calcTextareaHeight(f.value).minHeight}},g=()=>{const n=h.value;!n||n.value===u.value||(n.value=u.value)},P=async n=>{pe();let{value:a}=n.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){g();return}l(q.UPDATE_MODEL_EVENT,a),l("input",a),await e.nextTick(),g(),ye()}},j=n=>{l("change",n.target.value)},he=()=>{l("suffixClick",t.modelValue)},xe=()=>{l("prefixClick",t.modelValue)},L=n=>{l("compositionstart",n),y.value=!0},ge=n=>/([(\uAC00-\uD7AF)|\u3130-\u318F])+/.test(n),W=n=>{l("compositionupdate",n);const a=n.target?.value,d=a[a.length-1]||"";y.value=!ge(d)},H=n=>{l("compositionend",n),y.value&&(y.value=!1,P(n))},be=()=>{w.value=!w.value,U()},U=async()=>{await e.nextTick(),h.value?.focus()},ke=()=>h.value?.blur(),G=n=>{c.value=!0,l("focus",n)},J=n=>{c.value=!1,l("blur",n),t.validateEvent&&k?.validate?.("blur").catch(a=>T.debugWarn(a))},Ce=n=>{V.value=!1,l("mouseleave",n)},we=n=>{V.value=!0,l("mouseenter",n)},Q=n=>{const a=n.key;if(n.target.type==="number"&&["e","+","-0","E"].includes(a))return n.returnValue=!1,!1;l("keydown",n)},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&&k?.validate?.("change").catch(n=>T.debugWarn(n))}),e.watch(u,()=>g()),e.watch(()=>t.type,async()=>{await e.nextTick(),g(),B()}),e.onMounted(()=>{!t.formatter&&t.parser&&T.debugWarn("VftInput","If you set the parser, you also need to set the formatter."),g(),e.nextTick(B)}),oe({input:C,textarea:f,ref:h,textareaStyle:$,autosize:t.autosize,focus:U,blur:ke,select:Ee,clear:X,resizeTextarea:B}),(n,a)=>e.withDirectives((e.openBlock(),e.createElementBlock("div",e.mergeProps(M.value,{class:le.value,style:me.value,role:t.containerRole,onMouseenter:we,onMouseleave:Ce,onMousewheel:a[1]||(a[1]=d=>t.type==="number"&&c.value?d.preventDefault():null)}),[t.type!=="textarea"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[n.$slots.prepend?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(o).be("group","prepend"))},[e.renderSlot(n.$slots,"prepend")],2)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(re.value)},[n.$slots.prefix||S.value?.icon?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(e.unref(o).e("prefix"))},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(o).e("prefix-inner")),onClick:xe},[e.renderSlot(n.$slots,"prefix"),S.value?.icon?(e.openBlock(),e.createBlock(e.unref(b.VftIcon),e.mergeProps({key:0,pointer:""},S.value,{class:e.unref(o).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:C,class:e.unref(o).e("inner")},e.unref(r),{type:t.showPassword?w.value?"text":"password":t.type,disabled:e.unref(m),formatter:t.formatter,parser:t.parser,readonly:t.readonly,autocomplete:t.autocomplete,tabindex:t.tabindex,"aria-label":t.label,placeholder:t.placeholder,style:t.inputStyle,form:t.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),ve.value?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(e.unref(o).e("suffix"))},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(o).e("suffix-inner")),onClick:he},[!E.value||!z.value||!v.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.renderSlot(n.$slots,"suffix"),O.value?.icon?(e.openBlock(),e.createBlock(e.unref(b.VftIcon),e.mergeProps({key:0},O.value,{class:e.unref(o).e("icon")}),null,16,["class"])):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0),E.value?(e.openBlock(),e.createBlock(e.unref(b.VftIcon),e.mergeProps({key:1,pointer:"",class:[e.unref(o).e("icon"),e.unref(o).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(b.VftIcon),e.mergeProps({key:2},de.value,{class:[e.unref(o).e("icon"),e.unref(o).e("password")],onClick:be}),null,16,["class"])):e.createCommentVNode("",!0),v.value?(e.openBlock(),e.createElementBlock("span",{key:3,class:e.normalizeClass(e.unref(o).e("count"))},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(o).e("count-inner"))},e.toDisplayString(N.value)+" / "+e.toDisplayString(e.unref(r).maxlength),3)],2)):e.createCommentVNode("",!0),x.value&&K.value&&R.value?(e.openBlock(),e.createBlock(e.unref(b.VftIcon),{key:4,icon:K.value,class:e.normalizeClass([e.unref(o).e("icon"),e.unref(o).e("validateIcon"),e.unref(o).is("loading",x.value==="validating")])},null,8,["icon","class"])):e.createCommentVNode("",!0)],2)],2)):e.createCommentVNode("",!0)],2),n.$slots.append?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(e.unref(o).be("group","append"))},[e.renderSlot(n.$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:t.tabindex,disabled:e.unref(m),readonly:t.readonly,autocomplete:t.autocomplete,style:$.value,"aria-label":t.label,placeholder:t.placeholder,form:t.form,onCompositionstart:L,onCompositionupdate:W,onCompositionend:H,onInput:P,onFocus:G,onBlur:J,onChange:j,onKeydown:Q}),null,16,Se),v.value?(e.openBlock(),e.createElementBlock("span",{key:0,style:e.normalizeStyle(D.value),class:e.normalizeClass(e.unref(o).e("count"))},e.toDisplayString(N.value)+" / "+e.toDisplayString(e.unref(r).maxlength),7)):e.createCommentVNode("",!0)],64))],16,Ve)),[[e.vShow,t.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 b=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"),ne=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:oe,emit:ae}){const l=ae,p=e.useAttrs(),i=e.useSlots(),M=e.computed(()=>{const n={};return t.containerRole==="combobox"&&(n["aria-haspopup"]=p["aria-haspopup"],n["aria-owns"]=p["aria-owns"],n["aria-expanded"]=p["aria-expanded"]),n}),le=e.computed(()=>[t.type==="textarea"?A.b():o.b(),o.m(ie.value),o.is("disabled",m.value),o.is("exceed",fe.value),o.is("focus",c.value),{[o.b("group")]:i.prepend||i.append,[o.bm("group","append")]:i.append,[o.bm("group","prepend")]:i.prepend,[o.m("prefix")]:i.prefix||t.prefixIcon,[o.m("suffix")]:i.suffix||t.suffixIcon||t.clearable||t.showPassword,[o.bm("suffix","password-clear")]:E.value&&z.value},p.class]),se=e.getCurrentInstance(),re=e.computed(()=>[o.e("wrapper"),o.is("focus",c.value)]),r=_.useAttrs({excludeKeys:e.computed(()=>Object.keys(M.value))}),{form:ue,formItem:k}=ne.useFormItem(),{inputId:F}=ne.useFormItemInputId(se.props,{formItemContext:k}),ie=te.useFormSize(),m=te.useFormDisabled(),o=Z.useNamespace("input"),A=Z.useNamespace("textarea"),C=e.shallowRef(),f=e.shallowRef(),c=e.ref(!1),V=e.ref(!1),y=e.ref(!1),w=e.ref(!1),D=e.ref(),I=e.shallowRef(t.inputStyle),h=e.computed(()=>C.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),x=e.computed(()=>k?.validateState||""),K=e.computed(()=>x.value&&{validating:"icon-loading",success:"icon-circle-check",error:"icon-circle-close"}[x.value]),de=e.computed(()=>w.value?{icon:"icon-view",size:16}:{icon:"icon-hide",size:16}),me=e.computed(()=>[p.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)),v=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(()=>!!v.value&&N.value>Number(r.value.maxlength)),ve=e.computed(()=>!!i.suffix||!!t.suffixIcon||E.value||t.showPassword||v.value||!!x.value&&R.value),[pe,ye]=_.useCursor(C);Y.useResizeObserver(f,n=>{if(!v.value||t.resize!=="both")return;const a=n[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 n=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,n,a)}}else I.value={minHeight:ee.calcTextareaHeight(f.value).minHeight}},g=()=>{const n=h.value;!n||n.value===u.value||(n.value=u.value)},P=async n=>{pe();let{value:a}=n.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){g();return}l(q.UPDATE_MODEL_EVENT,a),l("input",a),await e.nextTick(),g(),ye()}},j=n=>{l("change",n.target.value)},he=()=>{l("suffixClick",t.modelValue)},xe=()=>{l("prefixClick",t.modelValue)},L=n=>{l("compositionstart",n),y.value=!0},ge=n=>/([(\uAC00-\uD7AF)|\u3130-\u318F])+/.test(n),W=n=>{l("compositionupdate",n);const a=n.target?.value,d=a[a.length-1]||"";y.value=!ge(d)},H=n=>{l("compositionend",n),y.value&&(y.value=!1,P(n))},be=()=>{w.value=!w.value,U()},U=async()=>{await e.nextTick(),h.value?.focus()},ke=()=>h.value?.blur(),G=n=>{c.value=!0,l("focus",n)},J=n=>{c.value=!1,l("blur",n),t.validateEvent&&k?.validate?.("blur").catch(a=>T.debugWarn(a))},Ce=n=>{V.value=!1,l("mouseleave",n)},we=n=>{V.value=!0,l("mouseenter",n)},Q=n=>{const a=n.key;if(n.target.type==="number"&&["e","+","-0","E"].includes(a))return n.returnValue=!1,!1;l("keydown",n)},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&&k?.validate?.("change").catch(n=>T.debugWarn(n))}),e.watch(u,()=>g()),e.watch(()=>t.type,async()=>{await e.nextTick(),g(),B()}),e.onMounted(()=>{!t.formatter&&t.parser&&T.debugWarn("VftInput","If you set the parser, you also need to set the formatter."),g(),e.nextTick(B)}),oe({input:C,textarea:f,ref:h,textareaStyle:$,autosize:t.autosize,focus:U,blur:ke,select:Ee,clear:X,resizeTextarea:B}),(n,a)=>e.withDirectives((e.openBlock(),e.createElementBlock("div",e.mergeProps(M.value,{class:le.value,style:me.value,role:t.containerRole,onMouseenter:we,onMouseleave:Ce,onMousewheel:a[1]||(a[1]=d=>t.type==="number"&&c.value?d.preventDefault():null)}),[t.type!=="textarea"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[n.$slots.prepend?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(o).be("group","prepend"))},[e.renderSlot(n.$slots,"prepend")],2)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(re.value)},[n.$slots.prefix||S.value?.icon?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(e.unref(o).e("prefix"))},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(o).e("prefix-inner")),onClick:xe},[e.renderSlot(n.$slots,"prefix"),S.value?.icon?(e.openBlock(),e.createBlock(e.unref(b.VftIcon),e.mergeProps({key:0,pointer:""},S.value,{class:e.unref(o).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:C,class:e.unref(o).e("inner")},e.unref(r),{type:t.showPassword?w.value?"text":"password":t.type,disabled:e.unref(m),formatter:t.formatter,parser:t.parser,readonly:t.readonly,autocomplete:t.autocomplete,tabindex:t.tabindex,"aria-label":t.label,placeholder:t.placeholder,style:t.inputStyle,form:t.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),ve.value?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(e.unref(o).e("suffix"))},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(o).e("suffix-inner")),onClick:he},[!E.value||!z.value||!v.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.renderSlot(n.$slots,"suffix"),O.value?.icon?(e.openBlock(),e.createBlock(e.unref(b.VftIcon),e.mergeProps({key:0},O.value,{class:e.unref(o).e("icon")}),null,16,["class"])):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0),E.value?(e.openBlock(),e.createBlock(e.unref(b.VftIcon),e.mergeProps({key:1,pointer:"",class:[e.unref(o).e("icon"),e.unref(o).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(b.VftIcon),e.mergeProps({key:2},de.value,{class:[e.unref(o).e("icon"),e.unref(o).e("password")],onClick:be}),null,16,["class"])):e.createCommentVNode("",!0),v.value?(e.openBlock(),e.createElementBlock("span",{key:3,class:e.normalizeClass(e.unref(o).e("count"))},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(o).e("count-inner"))},e.toDisplayString(N.value)+" / "+e.toDisplayString(e.unref(r).maxlength),3)],2)):e.createCommentVNode("",!0),x.value&&K.value&&R.value?(e.openBlock(),e.createBlock(e.unref(b.VftIcon),{key:4,icon:K.value,class:e.normalizeClass([e.unref(o).e("icon"),e.unref(o).e("validateIcon"),e.unref(o).is("loading",x.value==="validating")])},null,8,["icon","class"])):e.createCommentVNode("",!0)],2)],2)):e.createCommentVNode("",!0)],2),n.$slots.append?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(e.unref(o).be("group","append"))},[e.renderSlot(n.$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:t.tabindex,disabled:e.unref(m),readonly:t.readonly,autocomplete:t.autocomplete,style:$.value,"aria-label":t.label,placeholder:t.placeholder,form:t.form,onCompositionstart:L,onCompositionupdate:W,onCompositionend:H,onInput:P,onFocus:G,onBlur:J,onChange:j,onKeydown:Q}),null,16,Se),v.value?(e.openBlock(),e.createElementBlock("span",{key:0,style:e.normalizeStyle(D.value),class:e.normalizeClass(e.unref(o).e("count"))},e.toDisplayString(N.value)+" / "+e.toDisplayString(e.unref(r).maxlength),7)):e.createCommentVNode("",!0)],64))],16,Ve)),[[e.vShow,t.type!=="hidden"]])}});exports.default=ze;
|