vft 0.0.496 → 0.0.498
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/component.js +18 -16
- package/es/components/autocomplete/autocomplete.vue.d.ts +2 -2
- package/es/components/autocomplete/index.d.ts +6 -6
- package/es/components/button/index.d.ts +9 -9
- package/es/components/index.d.ts +1 -0
- package/es/components/index.js +257 -255
- package/es/components/modal/index.d.ts +6 -0
- package/es/components/modal/modal.vue.d.ts +3 -0
- package/es/components/modal/modal.vue2.js +12 -12
- package/es/components/popconfirm/index.d.ts +15 -15
- package/es/components/popconfirm/popconfirm.vue.d.ts +1 -1
- package/es/components/select/defaults.d.ts +4 -0
- package/es/components/select/defaults.js +7 -3
- package/es/components/select/index.d.ts +13 -4
- package/es/components/select/select.vue.d.ts +13 -4
- package/es/components/select/select.vue.js +9 -8
- package/es/components/select/select.vue2.js +40 -29
- package/es/components/select/token.d.ts +4 -1
- package/es/components/select/useSelect.d.ts +4 -4
- package/es/components/super-form/index.d.ts +9 -0
- package/es/components/super-form/style/css.d.ts +1 -0
- package/es/components/super-form/style/css.js +2 -0
- package/es/components/super-form/style/index.d.ts +1 -0
- package/es/components/super-form/style/index.js +2 -0
- package/es/components/super-form/super-form-item.vue2.js +355 -255
- package/es/components/super-form/super-form.vue2.js +1 -1
- package/es/components/super-form/types.d.ts +26 -1
- package/es/components/super-form/use/helper.js +37 -36
- package/es/components/super-form/use/use-form-events.js +126 -125
- package/es/components/table/index.d.ts +9 -6
- package/es/components/table/style/css.js +2 -0
- package/es/components/table/style/index.js +2 -0
- package/es/components/table/table.vue.d.ts +2 -1
- package/es/components/table/table.vue2.js +99 -94
- package/es/components/table/types.d.ts +5 -3
- package/es/components/table/use/use-data-source.d.ts +6 -4
- package/es/components/table/use/use-data-source.js +150 -148
- package/es/components/table/use/use-table.js +8 -8
- package/es/components/tree/index.d.ts +71 -71
- package/es/components/tree/tree-node.vue.d.ts +1 -1
- package/es/components/tree/tree.type.d.ts +2 -0
- package/es/components/tree/tree.vue.d.ts +14 -14
- package/es/components/tree-select/cache-options.d.ts +20 -0
- package/es/components/tree-select/cache-options.js +30 -0
- package/es/components/tree-select/index.d.ts +8 -0
- package/es/components/tree-select/index.js +10 -0
- package/es/components/tree-select/instance.d.ts +5 -0
- package/es/components/tree-select/instance.js +1 -0
- package/es/components/tree-select/select.d.ts +10 -0
- package/es/components/tree-select/select.js +129 -0
- package/es/components/tree-select/style/css.d.ts +4 -0
- package/es/components/tree-select/style/css.js +11 -0
- package/es/components/tree-select/style/index.d.ts +4 -0
- package/es/components/tree-select/style/index.js +11 -0
- package/es/components/tree-select/tree-select-option.d.ts +42 -0
- package/es/components/tree-select/tree-select-option.js +35 -0
- package/es/components/tree-select/tree-select.vue.d.ts +4 -0
- package/es/components/tree-select/tree-select.vue.js +5 -0
- package/es/components/tree-select/tree-select.vue2.js +155 -0
- package/es/components/tree-select/tree.d.ts +11 -0
- package/es/components/tree-select/tree.js +201 -0
- package/es/components/tree-select/utils.d.ts +10 -0
- package/es/components/tree-select/utils.js +45 -0
- package/es/index.js +1 -0
- package/es/package.json.d.ts +1 -1
- package/es/package.json.js +1 -1
- package/es/script.css +1 -1
- package/es/utils/form-register.d.ts +1 -0
- package/es/utils/form-register.js +11 -10
- package/lib/component.cjs +1 -1
- package/lib/components/autocomplete/autocomplete.vue.d.ts +2 -2
- package/lib/components/autocomplete/index.d.ts +6 -6
- package/lib/components/button/index.d.ts +9 -9
- package/lib/components/index.cjs +1 -1
- package/lib/components/index.d.ts +1 -0
- package/lib/components/modal/index.d.ts +6 -0
- package/lib/components/modal/modal.vue.d.ts +3 -0
- package/lib/components/modal/modal.vue2.cjs +1 -1
- package/lib/components/popconfirm/index.d.ts +15 -15
- package/lib/components/popconfirm/popconfirm.vue.d.ts +1 -1
- package/lib/components/select/defaults.cjs +1 -1
- package/lib/components/select/defaults.d.ts +4 -0
- package/lib/components/select/index.d.ts +13 -4
- package/lib/components/select/select.vue.cjs +1 -1
- package/lib/components/select/select.vue.d.ts +13 -4
- package/lib/components/select/select.vue2.cjs +1 -1
- package/lib/components/select/token.d.ts +4 -1
- package/lib/components/select/useSelect.d.ts +4 -4
- package/lib/components/super-form/index.d.ts +9 -0
- package/lib/components/super-form/style/css.cjs +1 -1
- package/lib/components/super-form/style/css.d.ts +1 -0
- package/lib/components/super-form/style/index.cjs +1 -1
- 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/super-form.vue2.cjs +1 -1
- package/lib/components/super-form/types.d.ts +26 -1
- package/lib/components/super-form/use/helper.cjs +1 -1
- package/lib/components/super-form/use/use-form-events.cjs +1 -1
- package/lib/components/table/index.d.ts +9 -6
- package/lib/components/table/style/css.cjs +1 -1
- package/lib/components/table/style/index.cjs +1 -1
- package/lib/components/table/table.vue.d.ts +2 -1
- package/lib/components/table/table.vue2.cjs +1 -1
- package/lib/components/table/types.d.ts +5 -3
- package/lib/components/table/use/use-data-source.cjs +1 -1
- package/lib/components/table/use/use-data-source.d.ts +6 -4
- package/lib/components/table/use/use-table.cjs +1 -1
- package/lib/components/tree/index.d.ts +71 -71
- package/lib/components/tree/tree-node.vue.d.ts +1 -1
- package/lib/components/tree/tree.type.d.ts +2 -0
- package/lib/components/tree/tree.vue.d.ts +14 -14
- package/lib/components/tree-select/cache-options.cjs +1 -0
- package/lib/components/tree-select/cache-options.d.ts +20 -0
- package/lib/components/tree-select/index.cjs +1 -0
- package/lib/components/tree-select/index.d.ts +8 -0
- package/lib/components/tree-select/instance.cjs +1 -0
- package/lib/components/tree-select/instance.d.ts +5 -0
- package/lib/components/tree-select/select.cjs +1 -0
- package/lib/components/tree-select/select.d.ts +10 -0
- package/lib/components/tree-select/style/css.cjs +1 -0
- package/lib/components/tree-select/style/css.d.ts +4 -0
- package/lib/components/tree-select/style/index.cjs +1 -0
- package/lib/components/tree-select/style/index.d.ts +4 -0
- package/lib/components/tree-select/tree-select-option.cjs +1 -0
- package/lib/components/tree-select/tree-select-option.d.ts +42 -0
- package/lib/components/tree-select/tree-select.vue.cjs +1 -0
- package/lib/components/tree-select/tree-select.vue.d.ts +4 -0
- package/lib/components/tree-select/tree-select.vue2.cjs +1 -0
- package/lib/components/tree-select/tree.cjs +1 -0
- package/lib/components/tree-select/tree.d.ts +11 -0
- package/lib/components/tree-select/utils.cjs +1 -0
- package/lib/components/tree-select/utils.d.ts +10 -0
- package/lib/index.cjs +1 -1
- package/lib/package.json.cjs +1 -1
- package/lib/package.json.d.ts +1 -1
- package/lib/script.css +1 -1
- package/lib/utils/form-register.cjs +1 -1
- package/lib/utils/form-register.d.ts +1 -0
- package/package.json +5 -5
- package/theme-style/index.css +1 -1
- package/theme-style/src/cascader.scss +1 -12
- package/theme-style/src/tree-select.scss +10 -1
- package/theme-style/vft-cascader.css +1 -1
- package/theme-style/vft-tree-select.css +1 -1
- package/web-types.json +1 -1
|
@@ -76,9 +76,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
76
76
|
}>, {
|
|
77
77
|
props: Record<string, any>;
|
|
78
78
|
node: Node;
|
|
79
|
-
accordion: boolean;
|
|
80
79
|
renderAfterExpand: boolean;
|
|
81
80
|
showCheckbox: boolean;
|
|
81
|
+
accordion: boolean;
|
|
82
82
|
}, {}, {
|
|
83
83
|
CollapseTransition: import("vft/es/utils").SFCWithInstall<{
|
|
84
84
|
new (...args: any[]): import("vue").CreateComponentPublicInstanceWithMixins<Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, import("vue").PublicProps, {}, true, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Component, ComponentInternalInstance, h, Ref, SetupContext, VNode } from 'vue';
|
|
2
2
|
import type Node from './model/node';
|
|
3
3
|
import type TreeStore from './model/tree-store';
|
|
4
|
+
import type Tree from './tree.vue';
|
|
4
5
|
export interface RootTreeType {
|
|
5
6
|
ctx: SetupContext<any>;
|
|
6
7
|
props: TreeComponentProps;
|
|
@@ -101,3 +102,4 @@ export declare interface TreeComponentProps {
|
|
|
101
102
|
icon: string | Component;
|
|
102
103
|
}
|
|
103
104
|
export declare type NodeDropType = 'before' | 'after' | 'inner' | 'none';
|
|
105
|
+
export type TreeInstance = InstanceType<typeof Tree> & unknown;
|
|
@@ -70,17 +70,17 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
70
70
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
71
71
|
"current-change": () => void;
|
|
72
72
|
check: () => void;
|
|
73
|
-
"node-drag-start": () => void;
|
|
74
|
-
"node-drag-leave": () => void;
|
|
75
|
-
"node-drag-enter": () => void;
|
|
76
|
-
"node-drag-over": () => void;
|
|
77
|
-
"node-drag-end": () => void;
|
|
78
|
-
"node-drop": () => void;
|
|
79
|
-
"node-expand": () => void;
|
|
80
73
|
"check-change": () => void;
|
|
81
74
|
"node-click": () => void;
|
|
82
75
|
"node-contextmenu": () => void;
|
|
83
76
|
"node-collapse": () => void;
|
|
77
|
+
"node-expand": () => void;
|
|
78
|
+
"node-drag-start": () => void;
|
|
79
|
+
"node-drag-end": () => void;
|
|
80
|
+
"node-drop": () => void;
|
|
81
|
+
"node-drag-leave": () => void;
|
|
82
|
+
"node-drag-enter": () => void;
|
|
83
|
+
"node-drag-over": () => void;
|
|
84
84
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<TreeProps>, {
|
|
85
85
|
renderAfterExpand: boolean;
|
|
86
86
|
expandOnClickNode: boolean;
|
|
@@ -95,17 +95,17 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
95
95
|
}>>> & Readonly<{
|
|
96
96
|
"onCurrent-change"?: (() => any) | undefined;
|
|
97
97
|
onCheck?: (() => any) | undefined;
|
|
98
|
-
"onNode-drag-start"?: (() => any) | undefined;
|
|
99
|
-
"onNode-drag-leave"?: (() => any) | undefined;
|
|
100
|
-
"onNode-drag-enter"?: (() => any) | undefined;
|
|
101
|
-
"onNode-drag-over"?: (() => any) | undefined;
|
|
102
|
-
"onNode-drag-end"?: (() => any) | undefined;
|
|
103
|
-
"onNode-drop"?: (() => any) | undefined;
|
|
104
|
-
"onNode-expand"?: (() => any) | undefined;
|
|
105
98
|
"onCheck-change"?: (() => any) | undefined;
|
|
106
99
|
"onNode-click"?: (() => any) | undefined;
|
|
107
100
|
"onNode-contextmenu"?: (() => any) | undefined;
|
|
108
101
|
"onNode-collapse"?: (() => any) | undefined;
|
|
102
|
+
"onNode-expand"?: (() => any) | undefined;
|
|
103
|
+
"onNode-drag-start"?: (() => any) | undefined;
|
|
104
|
+
"onNode-drag-end"?: (() => any) | undefined;
|
|
105
|
+
"onNode-drop"?: (() => any) | undefined;
|
|
106
|
+
"onNode-drag-leave"?: (() => any) | undefined;
|
|
107
|
+
"onNode-drag-enter"?: (() => any) | undefined;
|
|
108
|
+
"onNode-drag-over"?: (() => any) | undefined;
|
|
109
109
|
}>, {
|
|
110
110
|
data: Array<any>;
|
|
111
111
|
props: TreeComponentProps["props"];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { PropType } from 'vue';
|
|
2
|
+
export type CacheOption = {
|
|
3
|
+
value: string | number | boolean | object;
|
|
4
|
+
currentLabel: string | number;
|
|
5
|
+
isDisabled: boolean;
|
|
6
|
+
};
|
|
7
|
+
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
8
|
+
data: {
|
|
9
|
+
type: PropType<CacheOption[]>;
|
|
10
|
+
default: () => never[];
|
|
11
|
+
};
|
|
12
|
+
}>, () => undefined, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
13
|
+
data: {
|
|
14
|
+
type: PropType<CacheOption[]>;
|
|
15
|
+
default: () => never[];
|
|
16
|
+
};
|
|
17
|
+
}>> & Readonly<{}>, {
|
|
18
|
+
data: CacheOption[];
|
|
19
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
20
|
+
export default _default;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { defineComponent as e, inject as o, watch as r } from "vue";
|
|
2
|
+
import { selectV2InjectionKey as p } from "../select/token.js";
|
|
3
|
+
import "@vueuse/core";
|
|
4
|
+
import "@vft/utils";
|
|
5
|
+
import "../config-provider/hooks/use-global-config.js";
|
|
6
|
+
import "lodash-es";
|
|
7
|
+
import "../form/index.js";
|
|
8
|
+
const u = e({
|
|
9
|
+
props: {
|
|
10
|
+
data: {
|
|
11
|
+
type: Array,
|
|
12
|
+
default: () => []
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
setup(t) {
|
|
16
|
+
return o(
|
|
17
|
+
p,
|
|
18
|
+
null
|
|
19
|
+
), r(
|
|
20
|
+
() => t.data,
|
|
21
|
+
() => {
|
|
22
|
+
},
|
|
23
|
+
{ flush: "post", immediate: !0 }
|
|
24
|
+
), () => {
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
export {
|
|
29
|
+
u as default
|
|
30
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { SFCWithInstall } from 'vft/es/utils';
|
|
2
|
+
import TreeSelect from './tree-select.vue';
|
|
3
|
+
declare const _TreeSelect: SFCWithInstall<typeof TreeSelect>;
|
|
4
|
+
export default _TreeSelect;
|
|
5
|
+
export declare const VftTreeSelect: SFCWithInstall<import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>>;
|
|
8
|
+
export type { TreeSelectInstance } from './instance';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Ref } from 'vue';
|
|
2
|
+
import type { SelectV2Instance } from 'vft/es/components/select/token';
|
|
3
|
+
export declare const useSelect: (props: any, { attrs, emit }: {
|
|
4
|
+
attrs: any;
|
|
5
|
+
emit: any;
|
|
6
|
+
}, { select, tree, key, }: {
|
|
7
|
+
select: Ref<SelectV2Instance | undefined>;
|
|
8
|
+
tree: Ref<any>;
|
|
9
|
+
key: Ref<string>;
|
|
10
|
+
}) => any;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { watch as g, nextTick as v, computed as c, onMounted as A, toRefs as T } from "vue";
|
|
2
|
+
import { useEventListener as L } from "@vueuse/core";
|
|
3
|
+
import { pick as k, get as d } from "lodash-es";
|
|
4
|
+
import "../select/index.js";
|
|
5
|
+
import { selectV2Props as C } from "../select/defaults.js";
|
|
6
|
+
import "@vft/utils";
|
|
7
|
+
import "../config-provider/hooks/use-global-config.js";
|
|
8
|
+
import { EVENT_CODE as h } from "../../constants/aria.js";
|
|
9
|
+
import { UPDATE_MODEL_EVENT as O } from "../../constants/event.js";
|
|
10
|
+
import "../form/index.js";
|
|
11
|
+
import { useNamespace as w } from "../../hooks/use-namespace/index.js";
|
|
12
|
+
import "../../hooks/use-model-toggle/index.js";
|
|
13
|
+
import "@popperjs/core";
|
|
14
|
+
import "../../hooks/use-z-index/index.js";
|
|
15
|
+
import { treeEach as $ } from "./utils.js";
|
|
16
|
+
const j = (e) => e.code || e.key || "";
|
|
17
|
+
function D(e, s, f, l) {
|
|
18
|
+
if (!Array.isArray(e) || e.length === 0) return [];
|
|
19
|
+
const r = [];
|
|
20
|
+
return $(
|
|
21
|
+
e,
|
|
22
|
+
(n) => {
|
|
23
|
+
r.push({
|
|
24
|
+
[s]: d(n, s),
|
|
25
|
+
[f]: d(n, f)
|
|
26
|
+
});
|
|
27
|
+
},
|
|
28
|
+
(n) => d(n, l) || []
|
|
29
|
+
), r;
|
|
30
|
+
}
|
|
31
|
+
const Z = (e, { attrs: s, emit: f }, {
|
|
32
|
+
select: l,
|
|
33
|
+
tree: r,
|
|
34
|
+
key: n
|
|
35
|
+
}) => {
|
|
36
|
+
const b = w("tree-select");
|
|
37
|
+
g(
|
|
38
|
+
() => e.data,
|
|
39
|
+
() => {
|
|
40
|
+
e.filterable && v(() => {
|
|
41
|
+
const t = l.value?.states?.inputValue || "";
|
|
42
|
+
r.value?.filter(t);
|
|
43
|
+
});
|
|
44
|
+
},
|
|
45
|
+
{ flush: "post" }
|
|
46
|
+
);
|
|
47
|
+
const y = (t) => {
|
|
48
|
+
const o = t.at(-1);
|
|
49
|
+
if (o.expanded && o.childNodes.at(-1))
|
|
50
|
+
y([o.childNodes.at(-1)]);
|
|
51
|
+
else {
|
|
52
|
+
r.value?.el$?.querySelector(
|
|
53
|
+
`[data-key="${t.at(-1).key}"]`
|
|
54
|
+
)?.focus({ preventScroll: !0 });
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
}, m = c(() => ({
|
|
58
|
+
value: n.value,
|
|
59
|
+
label: "label",
|
|
60
|
+
children: "children",
|
|
61
|
+
...e.props
|
|
62
|
+
})), x = () => {
|
|
63
|
+
v(() => {
|
|
64
|
+
const t = l.value;
|
|
65
|
+
if (!t?.states) return;
|
|
66
|
+
const o = e.data || [], i = m.value.value, p = m.value.label, u = m.value.children, M = D(o, i, p, u), a = e.modelValue;
|
|
67
|
+
if (a == null || Array.isArray(a) && a.length === 0) {
|
|
68
|
+
t.states.selectedLabel = "";
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const S = (Array.isArray(a) ? a : [a]).map((N) => {
|
|
72
|
+
const E = M.find((V) => d(V, i) === N);
|
|
73
|
+
return E ? d(E, p) : "";
|
|
74
|
+
});
|
|
75
|
+
t.states.selectedLabel = S.filter(Boolean).join(", ");
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
return A(() => {
|
|
79
|
+
x(), L(
|
|
80
|
+
() => l.value?.selectRef,
|
|
81
|
+
"keydown",
|
|
82
|
+
async (t) => {
|
|
83
|
+
const o = j(t), i = l.value?.expanded;
|
|
84
|
+
[h.down, h.up].includes(o) && i && (await v(), setTimeout(() => {
|
|
85
|
+
if (h.up === o) {
|
|
86
|
+
const u = r.value?.store?.root?.childNodes;
|
|
87
|
+
u && y(u);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
(l.value?.states?.hoveringIndex ?? -1) >= 0 && l.value?.filteredOptions && r.value?.el$?.querySelector("[data-key]")?.focus({ preventScroll: !0 });
|
|
91
|
+
}));
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
capture: !0
|
|
95
|
+
}
|
|
96
|
+
);
|
|
97
|
+
}), g(
|
|
98
|
+
() => [e.data, e.modelValue],
|
|
99
|
+
x,
|
|
100
|
+
{ immediate: !0, deep: !0 }
|
|
101
|
+
), {
|
|
102
|
+
...k(T(e), Object.keys(C)),
|
|
103
|
+
...s,
|
|
104
|
+
class: c(() => s.class),
|
|
105
|
+
style: c(() => s.style),
|
|
106
|
+
// attrs is not reactive, when v-model binding source changes,
|
|
107
|
+
// this listener is still old, see the bug(or test 'v-model source change'):
|
|
108
|
+
// https://github.com/element-plus/element-plus/issues/14204
|
|
109
|
+
"onUpdate:modelValue": (t) => f(O, t),
|
|
110
|
+
valueKey: n,
|
|
111
|
+
popperClass: c(() => {
|
|
112
|
+
const t = [b.e("popper")];
|
|
113
|
+
return e.popperClass && t.push(e.popperClass), t.join(" ");
|
|
114
|
+
}),
|
|
115
|
+
popperStyle: c(() => {
|
|
116
|
+
const t = e.dropdownMaxHeight, o = typeof t == "number" ? `${t}px` : String(t || "274px");
|
|
117
|
+
return {
|
|
118
|
+
...e.popperStyle || {},
|
|
119
|
+
"--vft-tree-select-dropdown-max-height": o
|
|
120
|
+
};
|
|
121
|
+
}),
|
|
122
|
+
filterMethod: (t = "") => {
|
|
123
|
+
e.filterMethod ? e.filterMethod(t) : e.remoteMethod ? e.remoteMethod(t) : r.value?.filter(t);
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
export {
|
|
128
|
+
Z as useSelect
|
|
129
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import "vft/theme-style/base.css";
|
|
2
|
+
import "vft/theme-style/vft-input.css";
|
|
3
|
+
import "vft/theme-style/vft-tag.css";
|
|
4
|
+
import "vft/theme-style/vft-scrollbar.css";
|
|
5
|
+
import "vft/theme-style/vft-popper.css";
|
|
6
|
+
import "vft/theme-style/vft-virtual-list.css";
|
|
7
|
+
import "vft/theme-style/vft-select.css";
|
|
8
|
+
import "vft/theme-style/vft-checkbox.css";
|
|
9
|
+
import "vft/theme-style/vft-tree.css";
|
|
10
|
+
import "vft/theme-style/vft-icon.css";
|
|
11
|
+
import "vft/theme-style/vft-tree-select.css";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import "vft/theme-style/src/base.scss";
|
|
2
|
+
import "vft/theme-style/src/input.scss";
|
|
3
|
+
import "vft/theme-style/src/tag.scss";
|
|
4
|
+
import "vft/theme-style/src/scrollbar.scss";
|
|
5
|
+
import "vft/theme-style/src/popper.scss";
|
|
6
|
+
import "vft/theme-style/src/virtual-list.scss";
|
|
7
|
+
import "vft/theme-style/src/select.scss";
|
|
8
|
+
import "vft/theme-style/src/checkbox.scss";
|
|
9
|
+
import "vft/theme-style/src/tree.scss";
|
|
10
|
+
import "vft/theme-style/src/icon.scss";
|
|
11
|
+
import "vft/theme-style/src/tree-select.scss";
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
declare const component: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
2
|
+
value: {
|
|
3
|
+
type: (ObjectConstructor | StringConstructor | NumberConstructor | BooleanConstructor)[];
|
|
4
|
+
required: true;
|
|
5
|
+
};
|
|
6
|
+
label: {
|
|
7
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
8
|
+
default: string;
|
|
9
|
+
};
|
|
10
|
+
disabled: {
|
|
11
|
+
type: BooleanConstructor;
|
|
12
|
+
default: boolean;
|
|
13
|
+
};
|
|
14
|
+
visible: {
|
|
15
|
+
type: BooleanConstructor;
|
|
16
|
+
default: boolean;
|
|
17
|
+
};
|
|
18
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
19
|
+
[key: string]: any;
|
|
20
|
+
}> | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
21
|
+
value: {
|
|
22
|
+
type: (ObjectConstructor | StringConstructor | NumberConstructor | BooleanConstructor)[];
|
|
23
|
+
required: true;
|
|
24
|
+
};
|
|
25
|
+
label: {
|
|
26
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
27
|
+
default: string;
|
|
28
|
+
};
|
|
29
|
+
disabled: {
|
|
30
|
+
type: BooleanConstructor;
|
|
31
|
+
default: boolean;
|
|
32
|
+
};
|
|
33
|
+
visible: {
|
|
34
|
+
type: BooleanConstructor;
|
|
35
|
+
default: boolean;
|
|
36
|
+
};
|
|
37
|
+
}>> & Readonly<{}>, {
|
|
38
|
+
label: string | number;
|
|
39
|
+
disabled: boolean;
|
|
40
|
+
visible: boolean;
|
|
41
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
42
|
+
export default component;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { defineComponent as l, h as a } from "vue";
|
|
2
|
+
const u = l({
|
|
3
|
+
name: "TreeSelectOption",
|
|
4
|
+
props: {
|
|
5
|
+
value: {
|
|
6
|
+
type: [String, Number, Boolean, Object],
|
|
7
|
+
required: !0
|
|
8
|
+
},
|
|
9
|
+
label: {
|
|
10
|
+
type: [String, Number],
|
|
11
|
+
default: ""
|
|
12
|
+
},
|
|
13
|
+
disabled: {
|
|
14
|
+
type: Boolean,
|
|
15
|
+
default: !1
|
|
16
|
+
},
|
|
17
|
+
visible: {
|
|
18
|
+
type: Boolean,
|
|
19
|
+
default: !0
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
setup(e, { slots: t }) {
|
|
23
|
+
return () => e.visible ? a(
|
|
24
|
+
"span",
|
|
25
|
+
{
|
|
26
|
+
class: "vft-tree-select-option",
|
|
27
|
+
"data-value": e.value
|
|
28
|
+
},
|
|
29
|
+
t.default ? t.default() : e.label
|
|
30
|
+
) : null;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
export {
|
|
34
|
+
u as default
|
|
35
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
2
|
+
[key: string]: any;
|
|
3
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { defineComponent as h, ref as s, computed as m, reactive as a, onMounted as g, h as l } from "vue";
|
|
2
|
+
import { pick as u } from "lodash-es";
|
|
3
|
+
import { VftSelect as C } from "../select/index.js";
|
|
4
|
+
import { selectV2Props as k } from "../select/defaults.js";
|
|
5
|
+
import { VftTree as b } from "../tree/index.js";
|
|
6
|
+
import { useSelect as B } from "./select.js";
|
|
7
|
+
import { useTree as N } from "./tree.js";
|
|
8
|
+
const v = {
|
|
9
|
+
data: Array,
|
|
10
|
+
emptyText: String,
|
|
11
|
+
renderAfterExpand: {
|
|
12
|
+
type: Boolean,
|
|
13
|
+
default: !0
|
|
14
|
+
},
|
|
15
|
+
nodeKey: String,
|
|
16
|
+
checkStrictly: Boolean,
|
|
17
|
+
defaultExpandAll: Boolean,
|
|
18
|
+
expandOnClickNode: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
default: !0
|
|
21
|
+
},
|
|
22
|
+
checkOnClickNode: Boolean,
|
|
23
|
+
checkDescendants: Boolean,
|
|
24
|
+
autoExpandParent: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
default: !0
|
|
27
|
+
},
|
|
28
|
+
defaultCheckedKeys: Array,
|
|
29
|
+
defaultExpandedKeys: Array,
|
|
30
|
+
currentNodeKey: [String, Number],
|
|
31
|
+
renderContent: Function,
|
|
32
|
+
showCheckbox: Boolean,
|
|
33
|
+
draggable: Boolean,
|
|
34
|
+
allowDrag: Function,
|
|
35
|
+
allowDrop: Function,
|
|
36
|
+
props: {
|
|
37
|
+
type: Object,
|
|
38
|
+
default: () => ({
|
|
39
|
+
children: "children",
|
|
40
|
+
label: "label",
|
|
41
|
+
disabled: "disabled"
|
|
42
|
+
})
|
|
43
|
+
},
|
|
44
|
+
lazy: Boolean,
|
|
45
|
+
highlightCurrent: Boolean,
|
|
46
|
+
load: Function,
|
|
47
|
+
filterNodeMethod: Function,
|
|
48
|
+
accordion: Boolean,
|
|
49
|
+
indent: {
|
|
50
|
+
type: Number,
|
|
51
|
+
default: 18
|
|
52
|
+
},
|
|
53
|
+
icon: [String, Object]
|
|
54
|
+
}, D = h({
|
|
55
|
+
name: "VftTreeSelect",
|
|
56
|
+
// disable `VftSelect` inherit current attrs
|
|
57
|
+
inheritAttrs: !1,
|
|
58
|
+
props: {
|
|
59
|
+
...k,
|
|
60
|
+
...v,
|
|
61
|
+
/**
|
|
62
|
+
* @description The cached data of the lazy node, the structure is the same as the data, used to get the label of the unloaded data
|
|
63
|
+
*/
|
|
64
|
+
cacheData: {
|
|
65
|
+
type: Array,
|
|
66
|
+
default: () => []
|
|
67
|
+
},
|
|
68
|
+
/**
|
|
69
|
+
* @description Override options prop to make it optional for TreeSelect
|
|
70
|
+
* VftSelect requires options, but TreeSelect uses Tree component instead
|
|
71
|
+
*/
|
|
72
|
+
options: {
|
|
73
|
+
type: Array,
|
|
74
|
+
default: () => []
|
|
75
|
+
},
|
|
76
|
+
/**
|
|
77
|
+
* @description 下拉内容最大高度(px),超出出现滚动条
|
|
78
|
+
*/
|
|
79
|
+
dropdownMaxHeight: {
|
|
80
|
+
type: [Number, String],
|
|
81
|
+
default: 274
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
setup(o, r) {
|
|
85
|
+
const { expose: i } = r, e = s(), t = s(), d = m(() => o.nodeKey || o.valueKey || "value"), f = B(o, r, { select: e, tree: t, key: d }), p = N(o, r, {
|
|
86
|
+
select: e,
|
|
87
|
+
tree: t,
|
|
88
|
+
key: d
|
|
89
|
+
}), { cacheOptions: K, ...y } = p, c = a({});
|
|
90
|
+
return i(c), g(() => {
|
|
91
|
+
Object.assign(c, {
|
|
92
|
+
//TODO: let only tree and select in 3.0
|
|
93
|
+
...u(t.value, [
|
|
94
|
+
"filter",
|
|
95
|
+
"updateKeyChildren",
|
|
96
|
+
"getCheckedNodes",
|
|
97
|
+
"setCheckedNodes",
|
|
98
|
+
"getCheckedKeys",
|
|
99
|
+
"setCheckedKeys",
|
|
100
|
+
"setChecked",
|
|
101
|
+
"getHalfCheckedNodes",
|
|
102
|
+
"getHalfCheckedKeys",
|
|
103
|
+
"getCurrentKey",
|
|
104
|
+
"getCurrentNode",
|
|
105
|
+
"setCurrentKey",
|
|
106
|
+
"setCurrentNode",
|
|
107
|
+
"getNode",
|
|
108
|
+
"remove",
|
|
109
|
+
"append",
|
|
110
|
+
"insertBefore",
|
|
111
|
+
"insertAfter"
|
|
112
|
+
]),
|
|
113
|
+
...u(e.value, ["focus", "blur"]),
|
|
114
|
+
selectedLabel: e.value?.selectedLabel ?? "",
|
|
115
|
+
treeRef: t.value,
|
|
116
|
+
selectRef: e.value
|
|
117
|
+
});
|
|
118
|
+
}), () => l(
|
|
119
|
+
C,
|
|
120
|
+
/**
|
|
121
|
+
* 1. The `props` is processed into `Refs`, but `v-bind` and
|
|
122
|
+
* render function props cannot read `Refs`, so use `reactive`
|
|
123
|
+
* unwrap the `Refs` and keep reactive.
|
|
124
|
+
* 2. The keyword `ref` requires `Ref`, but `reactive` broke it,
|
|
125
|
+
* so use function.
|
|
126
|
+
* 3. VftSelect requires `options` prop, but we use custom slots
|
|
127
|
+
* so we pass an empty array.
|
|
128
|
+
*/
|
|
129
|
+
a({
|
|
130
|
+
...f,
|
|
131
|
+
// Pass a dummy option to prevent "No data" from showing
|
|
132
|
+
// Since we use custom slots (Tree in footer), this won't be rendered
|
|
133
|
+
ref: (n) => e.value = n
|
|
134
|
+
}),
|
|
135
|
+
{
|
|
136
|
+
default: () => null,
|
|
137
|
+
// Custom rendering in footer
|
|
138
|
+
empty: () => l("div", {
|
|
139
|
+
style: { display: "none" }
|
|
140
|
+
}),
|
|
141
|
+
// Hide "No data" container completely
|
|
142
|
+
footer: () => l(
|
|
143
|
+
b,
|
|
144
|
+
a({
|
|
145
|
+
...y,
|
|
146
|
+
ref: (n) => t.value = n
|
|
147
|
+
})
|
|
148
|
+
)
|
|
149
|
+
}
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
export {
|
|
154
|
+
D as default
|
|
155
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Ref } from 'vue';
|
|
2
|
+
import type { SelectV2Instance } from 'vft/es/components/select/token';
|
|
3
|
+
export declare const useTree: (props: any, { attrs, slots, emit }: {
|
|
4
|
+
attrs: any;
|
|
5
|
+
slots: any;
|
|
6
|
+
emit: any;
|
|
7
|
+
}, { select, tree, key, }: {
|
|
8
|
+
select: Ref<SelectV2Instance | undefined>;
|
|
9
|
+
tree: Ref<any>;
|
|
10
|
+
key: Ref<string>;
|
|
11
|
+
}) => any;
|