@silver-formily/element-plus 2.4.0 → 3.0.0
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/README.en-US.md +32 -32
- package/README.md +32 -32
- package/esm/__builtins__/configs/index.mjs.map +1 -1
- package/esm/__builtins__/index.mjs +18 -18
- package/esm/__builtins__/shared/loading.mjs.map +1 -1
- package/esm/__builtins__/shared/simple-version-compare.mjs.map +1 -1
- package/esm/__builtins__/shared/transform-component.d.ts +1 -1
- package/esm/__builtins__/shared/transform-component.mjs.map +1 -1
- package/esm/__builtins__/shared/use-enter-submit.mjs.map +1 -1
- package/esm/__builtins__/shared/utils.mjs +0 -2
- package/esm/__builtins__/shared/utils.mjs.map +1 -1
- package/esm/array-base/index.mjs +59 -63
- package/esm/array-base/index.mjs.map +1 -1
- package/esm/array-base/symbols.mjs +1 -1
- package/esm/array-base/symbols.mjs.map +1 -1
- package/esm/array-base/utils.mjs +31 -38
- package/esm/array-base/utils.mjs.map +1 -1
- package/esm/array-cards/index.mjs +33 -36
- package/esm/array-cards/index.mjs.map +1 -1
- package/esm/array-collapse/index.mjs +38 -43
- package/esm/array-collapse/index.mjs.map +1 -1
- package/esm/array-collapse/utils.mjs +2 -9
- package/esm/array-collapse/utils.mjs.map +1 -1
- package/esm/array-items/index.mjs +34 -38
- package/esm/array-items/index.mjs.map +1 -1
- package/esm/array-list-tabs/index.mjs +39 -41
- package/esm/array-list-tabs/index.mjs.map +1 -1
- package/esm/array-list-tabs/utils.mjs +5 -12
- package/esm/array-list-tabs/utils.mjs.map +1 -1
- package/esm/array-table/index.mjs +63 -68
- package/esm/array-table/index.mjs.map +1 -1
- package/esm/array-table/utils.mjs +11 -18
- package/esm/array-table/utils.mjs.map +1 -1
- package/esm/array-tabs/index.mjs +25 -29
- package/esm/array-tabs/index.mjs.map +1 -1
- package/esm/autocomplete/autocomplete.d.ts +16 -16
- package/esm/autocomplete/index.d.ts +8 -8
- package/esm/autocomplete/index.mjs +18 -24
- package/esm/autocomplete/index.mjs.map +1 -1
- package/esm/cascader/index.mjs +18 -22
- package/esm/cascader/index.mjs.map +1 -1
- package/esm/checkbox/index.d.ts +27 -27
- package/esm/checkbox/index.mjs +21 -30
- package/esm/checkbox/index.mjs.map +1 -1
- package/esm/color-picker/index.mjs +6 -9
- package/esm/color-picker/index.mjs.map +1 -1
- package/esm/color-picker-panel/index.mjs +6 -9
- package/esm/color-picker-panel/index.mjs.map +1 -1
- package/esm/date-picker/index.mjs +11 -14
- package/esm/date-picker/index.mjs.map +1 -1
- package/esm/date-picker/utils.mjs.map +1 -1
- package/esm/date-picker-panel/index.mjs +11 -14
- package/esm/date-picker-panel/index.mjs.map +1 -1
- package/esm/editable/editable.d.ts +12 -12
- package/esm/editable/index.d.ts +6 -6
- package/esm/editable/index.mjs +49 -58
- package/esm/editable/index.mjs.map +1 -1
- package/esm/env.d.d.ts +1 -0
- package/esm/form/form.mjs +10 -10
- package/esm/form/form.mjs.map +1 -1
- package/esm/form-button-group/index.mjs +14 -25
- package/esm/form-button-group/index.mjs.map +1 -1
- package/esm/form-button-group/utils.mjs +2 -9
- package/esm/form-button-group/utils.mjs.map +1 -1
- package/esm/form-collapse/index.mjs +19 -22
- package/esm/form-collapse/index.mjs.map +1 -1
- package/esm/form-collapse/utils.mjs +0 -2
- package/esm/form-collapse/utils.mjs.map +1 -1
- package/esm/form-dialog/index.mjs +63 -70
- package/esm/form-dialog/index.mjs.map +1 -1
- package/esm/form-drawer/index.mjs +62 -69
- package/esm/form-drawer/index.mjs.map +1 -1
- package/esm/form-grid/form-grid.d.ts +2 -2
- package/esm/form-grid/hooks.d.ts +1 -2
- package/esm/form-grid/hooks.mjs +4 -11
- package/esm/form-grid/hooks.mjs.map +1 -1
- package/esm/form-grid/index.mjs +39 -40
- package/esm/form-grid/index.mjs.map +1 -1
- package/esm/form-item/index.mjs +57 -65
- package/esm/form-item/index.mjs.map +1 -1
- package/esm/form-item/types.d.ts +8 -6
- package/esm/form-item/utils.mjs.map +1 -1
- package/esm/form-layout/form-layout.mjs +12 -16
- package/esm/form-layout/form-layout.mjs.map +1 -1
- package/esm/form-layout/utils.mjs +2 -2
- package/esm/form-layout/utils.mjs.map +1 -1
- package/esm/form-step/index.mjs +27 -30
- package/esm/form-step/index.mjs.map +1 -1
- package/esm/form-step/utils.mjs +0 -3
- package/esm/form-step/utils.mjs.map +1 -1
- package/esm/form-tab/hooks.d.ts +2 -1
- package/esm/form-tab/hooks.mjs +13 -20
- package/esm/form-tab/hooks.mjs.map +1 -1
- package/esm/form-tab/index.mjs +38 -41
- package/esm/form-tab/index.mjs.map +1 -1
- package/esm/form-tab/utils.mjs.map +1 -1
- package/esm/index.mjs +76 -76
- package/esm/input/index.mjs +26 -30
- package/esm/input/index.mjs.map +1 -1
- package/esm/input-number/index.d.ts +15 -15
- package/esm/input-number/index.mjs +8 -11
- package/esm/input-number/index.mjs.map +1 -1
- package/esm/input-tag/index.mjs +16 -20
- package/esm/input-tag/index.mjs.map +1 -1
- package/esm/mention/index.mjs +20 -24
- package/esm/mention/index.mjs.map +1 -1
- package/esm/pagination/components/jumper.mjs.map +1 -1
- package/esm/pagination/components/next.mjs.map +1 -1
- package/esm/pagination/components/pager.mjs.map +1 -1
- package/esm/pagination/components/prev.mjs.map +1 -1
- package/esm/pagination/components/total.mjs.map +1 -1
- package/esm/pagination/pagination.mjs +1 -1
- package/esm/pagination/pagination.mjs.map +1 -1
- package/esm/password/index.mjs.map +1 -1
- package/esm/preview-text/index.mjs +27 -40
- package/esm/preview-text/index.mjs.map +1 -1
- package/esm/preview-text/utils.mjs +1 -1
- package/esm/preview-text/utils.mjs.map +1 -1
- package/esm/query-form/default-components.mjs.map +1 -1
- package/esm/query-form/hooks.mjs.map +1 -1
- package/esm/query-form/index.d.ts +3 -3
- package/esm/query-form/index.mjs +55 -61
- package/esm/query-form/index.mjs.map +1 -1
- package/esm/query-form/query-form.d.ts +1 -1
- package/esm/query-form/types.d.ts +1 -1
- package/esm/query-form-item/index.mjs +37 -44
- package/esm/query-form-item/index.mjs.map +1 -1
- package/esm/radio/index.d.ts +18 -18
- package/esm/radio/index.mjs +30 -39
- package/esm/radio/index.mjs.map +1 -1
- package/esm/rate/index.mjs +10 -13
- package/esm/rate/index.mjs.map +1 -1
- package/esm/reset/index.mjs +2 -2
- package/esm/reset/index.mjs.map +1 -1
- package/esm/segmented/index.mjs +13 -17
- package/esm/segmented/index.mjs.map +1 -1
- package/esm/select/index.d.ts +16 -16
- package/esm/select/index.mjs +22 -26
- package/esm/select/index.mjs.map +1 -1
- package/esm/select-table/index.d.ts +6 -6
- package/esm/select-table/index.mjs +16 -21
- package/esm/select-table/index.mjs.map +1 -1
- package/esm/select-table/select-table.d.ts +2 -2
- package/esm/shared/overlay-elements.mjs.map +1 -1
- package/esm/slider/index.mjs +10 -13
- package/esm/slider/index.mjs.map +1 -1
- package/esm/styles/form-grid/index.css +1 -1
- package/esm/submit/index.mjs +3 -3
- package/esm/submit/index.mjs.map +1 -1
- package/esm/switch/index.d.ts +9 -9
- package/esm/switch/index.mjs.map +1 -1
- package/esm/time-picker/index.mjs +6 -9
- package/esm/time-picker/index.mjs.map +1 -1
- package/esm/time-select/index.d.ts +12 -12
- package/esm/time-select/index.mjs +6 -9
- package/esm/time-select/index.mjs.map +1 -1
- package/esm/transfer/index.d.ts +12 -12
- package/esm/transfer/index.mjs.map +1 -1
- package/esm/tree/index.mjs +29 -33
- package/esm/tree/index.mjs.map +1 -1
- package/esm/tree/utils.mjs +0 -2
- package/esm/tree/utils.mjs.map +1 -1
- package/esm/tree-select/index.mjs +14 -18
- package/esm/tree-select/index.mjs.map +1 -1
- package/esm/upload/index.d.ts +12 -12
- package/esm/upload/index.mjs +10 -13
- package/esm/upload/index.mjs.map +1 -1
- package/esm/upload/upload.d.ts +24 -24
- package/esm/vendor/icon.mjs.map +1 -1
- package/esm/vendor/lodash.mjs +111 -85
- package/esm/vendor/lodash.mjs.map +1 -1
- package/esm/vendor/runtime.mjs +23 -29
- package/esm/vendor/runtime.mjs.map +1 -1
- package/esm/vendor/shared.esm-bundler.mjs +2 -7
- package/esm/vendor/shared.esm-bundler.mjs.map +1 -1
- package/esm/vendor/sizes.mjs.map +1 -1
- package/esm/vendor/types.mjs +5 -5
- package/esm/vendor/types.mjs.map +1 -1
- package/package.json +56 -82
- package/LICENSE +0 -21
package/esm/switch/index.d.ts
CHANGED
|
@@ -17,12 +17,12 @@ export declare const Switch: import('element-plus/es/utils/index.mjs').SFCWithIn
|
|
|
17
17
|
type: import('vue').PropType<boolean>;
|
|
18
18
|
default: undefined;
|
|
19
19
|
};
|
|
20
|
-
id: {
|
|
21
|
-
type: import('vue').PropType<string>;
|
|
22
|
-
};
|
|
23
20
|
loading: {
|
|
24
21
|
type: import('vue').PropType<boolean>;
|
|
25
22
|
};
|
|
23
|
+
id: {
|
|
24
|
+
type: import('vue').PropType<string>;
|
|
25
|
+
};
|
|
26
26
|
modelValue: {
|
|
27
27
|
type: import('vue').PropType<string | number | boolean>;
|
|
28
28
|
default: boolean;
|
|
@@ -115,12 +115,12 @@ export declare const Switch: import('element-plus/es/utils/index.mjs').SFCWithIn
|
|
|
115
115
|
type: import('vue').PropType<boolean>;
|
|
116
116
|
default: undefined;
|
|
117
117
|
};
|
|
118
|
-
id: {
|
|
119
|
-
type: import('vue').PropType<string>;
|
|
120
|
-
};
|
|
121
118
|
loading: {
|
|
122
119
|
type: import('vue').PropType<boolean>;
|
|
123
120
|
};
|
|
121
|
+
id: {
|
|
122
|
+
type: import('vue').PropType<string>;
|
|
123
|
+
};
|
|
124
124
|
modelValue: {
|
|
125
125
|
type: import('vue').PropType<string | number | boolean>;
|
|
126
126
|
default: boolean;
|
|
@@ -206,12 +206,12 @@ export declare const Switch: import('element-plus/es/utils/index.mjs').SFCWithIn
|
|
|
206
206
|
type: import('vue').PropType<boolean>;
|
|
207
207
|
default: undefined;
|
|
208
208
|
};
|
|
209
|
-
id: {
|
|
210
|
-
type: import('vue').PropType<string>;
|
|
211
|
-
};
|
|
212
209
|
loading: {
|
|
213
210
|
type: import('vue').PropType<boolean>;
|
|
214
211
|
};
|
|
212
|
+
id: {
|
|
213
|
+
type: import('vue').PropType<string>;
|
|
214
|
+
};
|
|
215
215
|
modelValue: {
|
|
216
216
|
type: import('vue').PropType<string | number | boolean>;
|
|
217
217
|
default: boolean;
|
package/esm/switch/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/switch/index.ts"],"sourcesContent":["import { connect, mapProps } from '@silver-formily/vue'\nimport { ElSwitch } from 'element-plus'\n\nexport type SwitchProps = typeof ElSwitch\n\nexport const Switch = connect<typeof ElSwitch>(\n ElSwitch,\n mapProps({\n readOnly: 'readonly',\n }),\n)\n\nexport default Switch\n"],"names":["Switch","connect","ElSwitch","mapProps"],"mappings":";;AAKO,MAAMA,IAASC;AAAA,EACpBC;AAAA,EACAC,EAAS;AAAA,IACP,UAAU;AAAA,EAAA,CACX;AACH;"}
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/switch/index.ts"],"sourcesContent":["import { connect, mapProps } from '@silver-formily/vue'\r\nimport { ElSwitch } from 'element-plus'\r\n\r\nexport type SwitchProps = typeof ElSwitch\r\n\r\nexport const Switch = connect<typeof ElSwitch>(\r\n ElSwitch,\r\n mapProps({\r\n readOnly: 'readonly',\r\n }),\r\n)\r\n\r\nexport default Switch\r\n"],"names":["Switch","connect","ElSwitch","mapProps"],"mappings":";;AAKO,MAAMA,IAASC;AAAA,EACpBC;AAAA,EACAC,EAAS;AAAA,IACP,UAAU;AAAA,EAAA,CACX;AACH;"}
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import { connect as r, mapProps as e } from "@silver-formily/vue";
|
|
2
2
|
import { ElTimePicker as m } from "element-plus";
|
|
3
|
-
import "
|
|
4
|
-
import "
|
|
5
|
-
|
|
6
|
-
import { mapReadPretty as o } from "../__builtins__/shared/transform-component.mjs";
|
|
7
|
-
import { PreviewText as i } from "../preview-text/index.mjs";
|
|
8
|
-
const d = r(
|
|
3
|
+
import { PreviewText as o } from "../preview-text/index.mjs";
|
|
4
|
+
import { mapReadPretty as i } from "../__builtins__/shared/transform-component.mjs";
|
|
5
|
+
const P = r(
|
|
9
6
|
m,
|
|
10
7
|
e({ readOnly: "readonly" }),
|
|
11
|
-
o
|
|
8
|
+
i(o.TimePicker)
|
|
12
9
|
);
|
|
13
10
|
export {
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
P as TimePicker,
|
|
12
|
+
P as default
|
|
16
13
|
};
|
|
17
14
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/time-picker/index.ts"],"sourcesContent":["import { connect, mapProps } from '@silver-formily/vue'\nimport { ElTimePicker } from 'element-plus'\nimport { mapReadPretty } from '../__builtins__'\nimport { PreviewText } from '../preview-text'\n\nexport type TimePickerProps = typeof ElTimePicker\n\nexport const TimePicker = connect<typeof ElTimePicker>(\n ElTimePicker,\n mapProps({ readOnly: 'readonly' }),\n mapReadPretty(PreviewText.TimePicker),\n)\n\nexport default TimePicker\n"],"names":["TimePicker","connect","ElTimePicker","mapProps","mapReadPretty","PreviewText"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/time-picker/index.ts"],"sourcesContent":["import { connect, mapProps } from '@silver-formily/vue'\r\nimport { ElTimePicker } from 'element-plus'\r\nimport { mapReadPretty } from '../__builtins__'\r\nimport { PreviewText } from '../preview-text'\r\n\r\nexport type TimePickerProps = typeof ElTimePicker\r\n\r\nexport const TimePicker = connect<typeof ElTimePicker>(\r\n ElTimePicker,\r\n mapProps({ readOnly: 'readonly' }),\r\n mapReadPretty(PreviewText.TimePicker),\r\n)\r\n\r\nexport default TimePicker\r\n"],"names":["TimePicker","connect","ElTimePicker","mapProps","mapReadPretty","PreviewText"],"mappings":";;;;AAOO,MAAMA,IAAaC;AAAA,EACxBC;AAAA,EACAC,EAAS,EAAE,UAAU,YAAY;AAAA,EACjCC,EAAcC,EAAY,UAAU;AACtC;"}
|
|
@@ -12,6 +12,10 @@ export declare const TimeSelect: import('element-plus/es/utils/index.mjs').SFCWi
|
|
|
12
12
|
name: {
|
|
13
13
|
type: import('vue').PropType<string>;
|
|
14
14
|
};
|
|
15
|
+
format: {
|
|
16
|
+
type: import('vue').PropType<string>;
|
|
17
|
+
default: string;
|
|
18
|
+
};
|
|
15
19
|
editable: {
|
|
16
20
|
type: import('vue').PropType<boolean>;
|
|
17
21
|
default: boolean;
|
|
@@ -20,8 +24,8 @@ export declare const TimeSelect: import('element-plus/es/utils/index.mjs').SFCWi
|
|
|
20
24
|
type: import('vue').PropType<boolean>;
|
|
21
25
|
default: undefined;
|
|
22
26
|
};
|
|
23
|
-
|
|
24
|
-
type: import('vue').PropType<
|
|
27
|
+
effect: {
|
|
28
|
+
type: import('vue').PropType<import('element-plus').PopperEffect>;
|
|
25
29
|
default: string;
|
|
26
30
|
};
|
|
27
31
|
placeholder: {
|
|
@@ -62,10 +66,6 @@ export declare const TimeSelect: import('element-plus/es/utils/index.mjs').SFCWi
|
|
|
62
66
|
type: import('vue').PropType<string>;
|
|
63
67
|
default: string;
|
|
64
68
|
};
|
|
65
|
-
effect: {
|
|
66
|
-
type: import('vue').PropType<import('element-plus').PopperEffect>;
|
|
67
|
-
default: string;
|
|
68
|
-
};
|
|
69
69
|
minTime: {
|
|
70
70
|
type: import('vue').PropType<string>;
|
|
71
71
|
};
|
|
@@ -98,6 +98,10 @@ export declare const TimeSelect: import('element-plus/es/utils/index.mjs').SFCWi
|
|
|
98
98
|
name: {
|
|
99
99
|
type: import('vue').PropType<string>;
|
|
100
100
|
};
|
|
101
|
+
format: {
|
|
102
|
+
type: import('vue').PropType<string>;
|
|
103
|
+
default: string;
|
|
104
|
+
};
|
|
101
105
|
editable: {
|
|
102
106
|
type: import('vue').PropType<boolean>;
|
|
103
107
|
default: boolean;
|
|
@@ -106,8 +110,8 @@ export declare const TimeSelect: import('element-plus/es/utils/index.mjs').SFCWi
|
|
|
106
110
|
type: import('vue').PropType<boolean>;
|
|
107
111
|
default: undefined;
|
|
108
112
|
};
|
|
109
|
-
|
|
110
|
-
type: import('vue').PropType<
|
|
113
|
+
effect: {
|
|
114
|
+
type: import('vue').PropType<import('element-plus').PopperEffect>;
|
|
111
115
|
default: string;
|
|
112
116
|
};
|
|
113
117
|
placeholder: {
|
|
@@ -148,10 +152,6 @@ export declare const TimeSelect: import('element-plus/es/utils/index.mjs').SFCWi
|
|
|
148
152
|
type: import('vue').PropType<string>;
|
|
149
153
|
default: string;
|
|
150
154
|
};
|
|
151
|
-
effect: {
|
|
152
|
-
type: import('vue').PropType<import('element-plus').PopperEffect>;
|
|
153
|
-
default: string;
|
|
154
|
-
};
|
|
155
155
|
minTime: {
|
|
156
156
|
type: import('vue').PropType<string>;
|
|
157
157
|
};
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import { connect as e, mapProps as t } from "@silver-formily/vue";
|
|
2
2
|
import { ElTimeSelect as m } from "element-plus";
|
|
3
|
-
import "
|
|
4
|
-
import "
|
|
5
|
-
|
|
6
|
-
import { mapReadPretty as o } from "../__builtins__/shared/transform-component.mjs";
|
|
7
|
-
import { PreviewText as r } from "../preview-text/index.mjs";
|
|
8
|
-
const s = e(
|
|
3
|
+
import { PreviewText as o } from "../preview-text/index.mjs";
|
|
4
|
+
import { mapReadPretty as r } from "../__builtins__/shared/transform-component.mjs";
|
|
5
|
+
const l = e(
|
|
9
6
|
m,
|
|
10
7
|
t({ disabled: "disabled", editable: "editable" }),
|
|
11
|
-
o
|
|
8
|
+
r(o.Input)
|
|
12
9
|
);
|
|
13
10
|
export {
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
l as TimeSelect,
|
|
12
|
+
l as default
|
|
16
13
|
};
|
|
17
14
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/time-select/index.ts"],"sourcesContent":["import { connect, mapProps } from '@silver-formily/vue'\r\nimport { ElTimeSelect } from 'element-plus'\r\nimport { mapReadPretty } from '../__builtins__'\r\nimport { PreviewText } from '../preview-text'\r\n\r\nexport const TimeSelect = connect<typeof ElTimeSelect>(\n ElTimeSelect,\n mapProps({ disabled: 'disabled', editable: 'editable' }),\r\n mapReadPretty(PreviewText.Input),\r\n)\r\n\r\nexport default TimeSelect\r\n"],"names":["TimeSelect","connect","ElTimeSelect","mapProps","mapReadPretty","PreviewText"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/time-select/index.ts"],"sourcesContent":["import { connect, mapProps } from '@silver-formily/vue'\r\nimport { ElTimeSelect } from 'element-plus'\r\nimport { mapReadPretty } from '../__builtins__'\r\nimport { PreviewText } from '../preview-text'\r\n\r\nexport const TimeSelect = connect<typeof ElTimeSelect>(\n ElTimeSelect,\n mapProps({ disabled: 'disabled', editable: 'editable' }),\r\n mapReadPretty(PreviewText.Input),\r\n)\r\n\r\nexport default TimeSelect\r\n"],"names":["TimeSelect","connect","ElTimeSelect","mapProps","mapReadPretty","PreviewText"],"mappings":";;;;AAKO,MAAMA,IAAaC;AAAA,EACxBC;AAAA,EACAC,EAAS,EAAE,UAAU,YAAY,UAAU,YAAY;AAAA,EACvDC,EAAcC,EAAY,KAAK;AACjC;"}
|
package/esm/transfer/index.d.ts
CHANGED
|
@@ -6,6 +6,10 @@ export declare const Transfer: import('element-plus/es/utils/index.mjs').SFCWith
|
|
|
6
6
|
type: import('vue').PropType<import('element-plus').TransferDataItem[]>;
|
|
7
7
|
default: () => never[];
|
|
8
8
|
};
|
|
9
|
+
format: {
|
|
10
|
+
type: import('vue').PropType<import('element-plus').TransferFormat>;
|
|
11
|
+
default: () => {};
|
|
12
|
+
};
|
|
9
13
|
props: {
|
|
10
14
|
type: import('vue').PropType<import('element-plus').TransferPropsAlias>;
|
|
11
15
|
default: () => {
|
|
@@ -14,10 +18,6 @@ export declare const Transfer: import('element-plus/es/utils/index.mjs').SFCWith
|
|
|
14
18
|
disabled: string;
|
|
15
19
|
};
|
|
16
20
|
};
|
|
17
|
-
format: {
|
|
18
|
-
type: import('vue').PropType<import('element-plus').TransferFormat>;
|
|
19
|
-
default: () => {};
|
|
20
|
-
};
|
|
21
21
|
modelValue: {
|
|
22
22
|
type: import('vue').PropType<import('element-plus').TransferKey[]>;
|
|
23
23
|
default: () => never[];
|
|
@@ -95,6 +95,10 @@ export declare const Transfer: import('element-plus/es/utils/index.mjs').SFCWith
|
|
|
95
95
|
type: import('vue').PropType<import('element-plus').TransferDataItem[]>;
|
|
96
96
|
default: () => never[];
|
|
97
97
|
};
|
|
98
|
+
format: {
|
|
99
|
+
type: import('vue').PropType<import('element-plus').TransferFormat>;
|
|
100
|
+
default: () => {};
|
|
101
|
+
};
|
|
98
102
|
props: {
|
|
99
103
|
type: import('vue').PropType<import('element-plus').TransferPropsAlias>;
|
|
100
104
|
default: () => {
|
|
@@ -103,10 +107,6 @@ export declare const Transfer: import('element-plus/es/utils/index.mjs').SFCWith
|
|
|
103
107
|
disabled: string;
|
|
104
108
|
};
|
|
105
109
|
};
|
|
106
|
-
format: {
|
|
107
|
-
type: import('vue').PropType<import('element-plus').TransferFormat>;
|
|
108
|
-
default: () => {};
|
|
109
|
-
};
|
|
110
110
|
modelValue: {
|
|
111
111
|
type: import('vue').PropType<import('element-plus').TransferKey[]>;
|
|
112
112
|
default: () => never[];
|
|
@@ -176,6 +176,10 @@ export declare const Transfer: import('element-plus/es/utils/index.mjs').SFCWith
|
|
|
176
176
|
type: import('vue').PropType<import('element-plus').TransferDataItem[]>;
|
|
177
177
|
default: () => never[];
|
|
178
178
|
};
|
|
179
|
+
format: {
|
|
180
|
+
type: import('vue').PropType<import('element-plus').TransferFormat>;
|
|
181
|
+
default: () => {};
|
|
182
|
+
};
|
|
179
183
|
props: {
|
|
180
184
|
type: import('vue').PropType<import('element-plus').TransferPropsAlias>;
|
|
181
185
|
default: () => {
|
|
@@ -184,10 +188,6 @@ export declare const Transfer: import('element-plus/es/utils/index.mjs').SFCWith
|
|
|
184
188
|
disabled: string;
|
|
185
189
|
};
|
|
186
190
|
};
|
|
187
|
-
format: {
|
|
188
|
-
type: import('vue').PropType<import('element-plus').TransferFormat>;
|
|
189
|
-
default: () => {};
|
|
190
|
-
};
|
|
191
191
|
modelValue: {
|
|
192
192
|
type: import('vue').PropType<import('element-plus').TransferKey[]>;
|
|
193
193
|
default: () => never[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/transfer/index.ts"],"sourcesContent":["import { connect, mapProps } from '@silver-formily/vue'\nimport { ElTransfer } from 'element-plus'\n\nexport type TransferProps = typeof ElTransfer\n\nexport const Transfer = connect<typeof ElTransfer>(\n ElTransfer,\n mapProps({ dataSource: 'data' }),\n)\n\nexport default Transfer\n"],"names":["Transfer","connect","ElTransfer","mapProps"],"mappings":";;AAKO,MAAMA,IAAWC;AAAA,EACtBC;AAAA,EACAC,EAAS,EAAE,YAAY,OAAA,CAAQ;AACjC;"}
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/transfer/index.ts"],"sourcesContent":["import { connect, mapProps } from '@silver-formily/vue'\r\nimport { ElTransfer } from 'element-plus'\r\n\r\nexport type TransferProps = typeof ElTransfer\r\n\r\nexport const Transfer = connect<typeof ElTransfer>(\r\n ElTransfer,\r\n mapProps({ dataSource: 'data' }),\r\n)\r\n\r\nexport default Transfer\r\n"],"names":["Transfer","connect","ElTransfer","mapProps"],"mappings":";;AAKO,MAAMA,IAAWC;AAAA,EACtBC;AAAA,EACAC,EAAS,EAAE,YAAY,OAAA,CAAQ;AACjC;"}
|
package/esm/tree/index.mjs
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
import { useField as _, connect as A, mapProps as D } from "@silver-formily/vue";
|
|
2
|
-
import {
|
|
3
|
-
import "
|
|
4
|
-
import "@
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
import "@silver-formily/reactive-vue";
|
|
11
|
-
import { useCleanAttrs as G } from "../__builtins__/shared/utils.mjs";
|
|
12
|
-
import { addDisabledToNodes as J, flattenTree as M, getInputKeys as Q, getOutputData as U } from "./utils.mjs";
|
|
13
|
-
const W = /* @__PURE__ */ w({
|
|
2
|
+
import { PreviewText as H } from "../preview-text/index.mjs";
|
|
3
|
+
import { defineComponent as P, useSlots as R, ref as h, computed as y, watch as v, nextTick as k, openBlock as g, createBlock as C, unref as a, withCtx as T, withDirectives as w, mergeProps as F, createSlots as B, renderList as E, renderSlot as L, normalizeProps as j, guardReactiveProps as z } from "vue";
|
|
4
|
+
import { isFn as I } from "@formily/shared";
|
|
5
|
+
import { ElScrollbar as N, ElTree as O, vLoading as $ } from "element-plus";
|
|
6
|
+
import { addDisabledToNodes as q, flattenTree as G, getInputKeys as J, getOutputData as M } from "./utils.mjs";
|
|
7
|
+
import { useCleanAttrs as Q } from "../__builtins__/shared/utils.mjs";
|
|
8
|
+
import { mapReadPretty as U } from "../__builtins__/shared/transform-component.mjs";
|
|
9
|
+
const W = /* @__PURE__ */ P({
|
|
14
10
|
name: "Tree",
|
|
15
11
|
inheritAttrs: !1,
|
|
16
12
|
__name: "tree",
|
|
@@ -32,13 +28,13 @@ const W = /* @__PURE__ */ w({
|
|
|
32
28
|
},
|
|
33
29
|
emits: ["update:modelValue"],
|
|
34
30
|
setup(K, { emit: V }) {
|
|
35
|
-
const e = K,
|
|
36
|
-
async function
|
|
31
|
+
const e = K, s = V, b = R(), { props: l } = Q(), o = h(), d = h([]), n = y(() => q(e.data ?? [], l.value.disabled, e.props)), c = y(() => G(n.value ?? [], [], e.props.children));
|
|
32
|
+
async function u() {
|
|
37
33
|
await k();
|
|
38
34
|
const t = o.value.getCheckedKeys(), f = o.value.getHalfCheckedKeys() || [];
|
|
39
35
|
d.value = t;
|
|
40
|
-
const { value: m, nodes: r } =
|
|
41
|
-
flatData:
|
|
36
|
+
const { value: m, nodes: r } = M(t, f, {
|
|
37
|
+
flatData: c.value,
|
|
42
38
|
nodeKey: e.nodeKey,
|
|
43
39
|
propsConfig: e.props,
|
|
44
40
|
data: e.data ?? [],
|
|
@@ -46,13 +42,13 @@ const W = /* @__PURE__ */ w({
|
|
|
46
42
|
includeHalfChecked: e.includeHalfChecked,
|
|
47
43
|
checkStrictly: l.value.checkStrictly
|
|
48
44
|
});
|
|
49
|
-
e.optionAsValue ?
|
|
45
|
+
e.optionAsValue ? I(e.optionFormatter) ? s("update:modelValue", r.map((i, x, S) => e.optionFormatter(i, x, S))) : s("update:modelValue", r) : s("update:modelValue", m);
|
|
50
46
|
}
|
|
51
47
|
v(() => e.modelValue, (t) => {
|
|
52
|
-
t !== void 0 && (d.value =
|
|
48
|
+
t !== void 0 && (d.value = J(t, {
|
|
53
49
|
optionAsValue: e.optionAsValue,
|
|
54
50
|
nodeKey: e.nodeKey,
|
|
55
|
-
flatData:
|
|
51
|
+
flatData: c.value,
|
|
56
52
|
propsConfig: e.props,
|
|
57
53
|
data: e.data ?? [],
|
|
58
54
|
valueType: e.valueType,
|
|
@@ -61,17 +57,17 @@ const W = /* @__PURE__ */ w({
|
|
|
61
57
|
o.value && o.value.setCheckedKeys(d.value);
|
|
62
58
|
}));
|
|
63
59
|
}, { immediate: !0 }), v(() => [e.valueType, e.optionAsValue, e.includeHalfChecked], () => {
|
|
64
|
-
|
|
60
|
+
u();
|
|
65
61
|
}, { immediate: !1 });
|
|
66
|
-
const
|
|
67
|
-
return
|
|
62
|
+
const p = _();
|
|
63
|
+
return p.value?.inject({
|
|
68
64
|
getTreeRef: () => o
|
|
69
|
-
}), (t, f) => (
|
|
65
|
+
}), (t, f) => (g(), C(a(N), {
|
|
70
66
|
height: e.height,
|
|
71
67
|
"max-height": e.maxHeight
|
|
72
68
|
}, {
|
|
73
69
|
default: T(() => [
|
|
74
|
-
|
|
70
|
+
w((g(), C(a(O), F({
|
|
75
71
|
ref_key: "treeRef",
|
|
76
72
|
ref: o,
|
|
77
73
|
data: n.value,
|
|
@@ -79,27 +75,27 @@ const W = /* @__PURE__ */ w({
|
|
|
79
75
|
"node-key": e.nodeKey,
|
|
80
76
|
"default-checked-keys": d.value,
|
|
81
77
|
"show-checkbox": !0
|
|
82
|
-
}, a(l), { onCheck:
|
|
83
|
-
|
|
78
|
+
}, a(l), { onCheck: u }), B({ _: 2 }, [
|
|
79
|
+
E(a(b), (m, r) => ({
|
|
84
80
|
name: r,
|
|
85
|
-
fn: T((
|
|
86
|
-
|
|
81
|
+
fn: T((i) => [
|
|
82
|
+
L(t.$slots, r, j(z({ field: a(p), ...i })))
|
|
87
83
|
])
|
|
88
84
|
}))
|
|
89
85
|
]), 1040, ["data", "props", "node-key", "default-checked-keys"])), [
|
|
90
|
-
[a(
|
|
86
|
+
[a($), a(l).loading]
|
|
91
87
|
])
|
|
92
88
|
]),
|
|
93
89
|
_: 3
|
|
94
90
|
}, 8, ["height", "max-height"]));
|
|
95
91
|
}
|
|
96
|
-
}),
|
|
92
|
+
}), re = A(
|
|
97
93
|
W,
|
|
98
94
|
D({ dataSource: "data", loading: "loading", disabled: !0 }),
|
|
99
|
-
|
|
95
|
+
U(H.Tree)
|
|
100
96
|
);
|
|
101
97
|
export {
|
|
102
|
-
|
|
103
|
-
|
|
98
|
+
re as Tree,
|
|
99
|
+
re as default
|
|
104
100
|
};
|
|
105
101
|
//# sourceMappingURL=index.mjs.map
|
package/esm/tree/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/tree/tree.vue","../../src/tree/index.ts"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { Field } from '@formily/core'\nimport type { TreeValueTypeProps } from './types'\nimport { isFn } from '@formily/shared'\nimport { useField } from '@silver-formily/vue'\nimport { ElScrollbar, ElTree, vLoading } from 'element-plus'\nimport { computed, nextTick, ref, useSlots, watch } from 'vue'\nimport { useCleanAttrs } from '../__builtins__'\nimport { addDisabledToNodes, flattenTree, getInputKeys, getOutputData } from './utils'\n\ndefineOptions({\n name: 'Tree',\n inheritAttrs: false,\n})\n\nconst props = withDefaults(defineProps<TreeValueTypeProps>(), {\n valueType: 'all',\n optionAsValue: false,\n includeHalfChecked: false,\n props: {\n children: 'children',\n label: 'label',\n disabled: 'disabled',\n },\n})\n\nconst emit = defineEmits<{\n 'update:modelValue': [value: any]\n}>()\n\nconst slots = useSlots()\n\nconst { props: attrs } = useCleanAttrs()\nconst treeRef = ref<InstanceType<typeof ElTree>>()\nconst checkedKeys = ref<any[]>([])\n\nconst processedData = computed(() => {\n return addDisabledToNodes(props.data ?? [], attrs.value.disabled, props.props)\n})\n\nconst flatData = computed(() => flattenTree(processedData.value ?? [], [], props.props.children))\n\nasync function handleCheck() {\n await nextTick()\n const keys = treeRef.value.getCheckedKeys()\n const halfCheckedKeys = treeRef.value.getHalfCheckedKeys() || []\n checkedKeys.value = keys\n\n const { value, nodes } = getOutputData(keys, halfCheckedKeys, {\n flatData: flatData.value,\n nodeKey: props.nodeKey,\n propsConfig: props.props,\n data: props.data ?? [],\n valueType: props.valueType,\n includeHalfChecked: props.includeHalfChecked,\n checkStrictly: attrs.value.checkStrictly,\n })\n\n if (props.optionAsValue) {\n isFn(props.optionFormatter)\n ? emit('update:modelValue', nodes.map((element, index, array) => {\n return props.optionFormatter(element, index, array)\n }))\n : emit('update:modelValue', nodes)\n }\n else {\n emit('update:modelValue', value)\n }\n}\n\nwatch(() => props.modelValue, (newValue) => {\n if (newValue !== undefined) {\n checkedKeys.value = getInputKeys(newValue, {\n optionAsValue: props.optionAsValue,\n nodeKey: props.nodeKey,\n flatData: flatData.value,\n propsConfig: props.props,\n data: props.data ?? [],\n valueType: props.valueType,\n checkStrictly: attrs.value.checkStrictly,\n })\n nextTick(() => {\n if (treeRef.value) {\n treeRef.value.setCheckedKeys(checkedKeys.value)\n }\n })\n }\n}, { immediate: true })\n\nwatch(() => [props.valueType, props.optionAsValue, props.includeHalfChecked], () => {\n handleCheck()\n}, { immediate: false })\n\nconst fieldRef = useField<Field>()\nfieldRef.value?.inject({\n getTreeRef: () => {\n return treeRef\n },\n})\n</script>\n\n<template>\n <ElScrollbar :height=\"props.height\" :max-height=\"props.maxHeight\">\n <ElTree\n ref=\"treeRef\"\n v-loading=\"attrs.loading\"\n :data=\"processedData\"\n :props=\"props.props\"\n :node-key=\"props.nodeKey\"\n :default-checked-keys=\"checkedKeys\"\n :show-checkbox=\"true\"\n v-bind=\"attrs\"\n @check=\"handleCheck\"\n >\n <template v-for=\"(_, name) of slots\" #[name]=\"slotData\">\n <slot :name=\"name\" v-bind=\"{ field: fieldRef, ...slotData }\" />\n </template>\n </ElTree>\n </ElScrollbar>\n</template>\n","import { connect, mapProps } from '@silver-formily/vue'\nimport { mapReadPretty } from '../__builtins__'\nimport { PreviewText } from '../preview-text'\nimport InnerTree from './tree.vue'\n\nconst Tree = connect<typeof InnerTree>(\n InnerTree,\n mapProps({ dataSource: 'data', loading: 'loading', disabled: true }),\n mapReadPretty(PreviewText.Tree),\n)\n\nexport { Tree }\n\nexport default Tree\n"],"names":["props","__props","emit","__emit","slots","useSlots","attrs","useCleanAttrs","treeRef","ref","checkedKeys","processedData","computed","addDisabledToNodes","flatData","flattenTree","handleCheck","nextTick","keys","halfCheckedKeys","value","nodes","getOutputData","isFn","element","index","array","watch","newValue","getInputKeys","fieldRef","useField","_createBlock","_unref","ElScrollbar","_withDirectives","_openBlock","_mergeProps","_createSlots","_","name","_withCtx","slotData","_renderSlot","_ctx","_normalizeProps","_guardReactiveProps","vLoading","Tree","connect","InnerTree","mapProps","mapReadPretty","PreviewText"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/tree/tree.vue","../../src/tree/index.ts"],"sourcesContent":["<script setup lang=\"ts\">\r\nimport type { Field } from '@formily/core'\r\nimport type { TreeValueTypeProps } from './types'\r\nimport { isFn } from '@formily/shared'\r\nimport { useField } from '@silver-formily/vue'\r\nimport { ElScrollbar, ElTree, vLoading } from 'element-plus'\r\nimport { computed, nextTick, ref, useSlots, watch } from 'vue'\r\nimport { useCleanAttrs } from '../__builtins__'\r\nimport { addDisabledToNodes, flattenTree, getInputKeys, getOutputData } from './utils'\r\n\r\ndefineOptions({\r\n name: 'Tree',\r\n inheritAttrs: false,\r\n})\r\n\r\nconst props = withDefaults(defineProps<TreeValueTypeProps>(), {\r\n valueType: 'all',\r\n optionAsValue: false,\r\n includeHalfChecked: false,\r\n props: {\r\n children: 'children',\r\n label: 'label',\r\n disabled: 'disabled',\r\n },\r\n})\r\n\r\nconst emit = defineEmits<{\r\n 'update:modelValue': [value: any]\r\n}>()\r\n\r\nconst slots = useSlots()\r\n\r\nconst { props: attrs } = useCleanAttrs()\r\nconst treeRef = ref<InstanceType<typeof ElTree>>()\r\nconst checkedKeys = ref<any[]>([])\r\n\r\nconst processedData = computed(() => {\r\n return addDisabledToNodes(props.data ?? [], attrs.value.disabled, props.props)\r\n})\r\n\r\nconst flatData = computed(() => flattenTree(processedData.value ?? [], [], props.props.children))\r\n\r\nasync function handleCheck() {\r\n await nextTick()\r\n const keys = treeRef.value.getCheckedKeys()\r\n const halfCheckedKeys = treeRef.value.getHalfCheckedKeys() || []\r\n checkedKeys.value = keys\r\n\r\n const { value, nodes } = getOutputData(keys, halfCheckedKeys, {\r\n flatData: flatData.value,\r\n nodeKey: props.nodeKey,\r\n propsConfig: props.props,\r\n data: props.data ?? [],\r\n valueType: props.valueType,\r\n includeHalfChecked: props.includeHalfChecked,\r\n checkStrictly: attrs.value.checkStrictly,\r\n })\r\n\r\n if (props.optionAsValue) {\r\n isFn(props.optionFormatter)\r\n ? emit('update:modelValue', nodes.map((element, index, array) => {\r\n return props.optionFormatter(element, index, array)\r\n }))\r\n : emit('update:modelValue', nodes)\r\n }\r\n else {\r\n emit('update:modelValue', value)\r\n }\r\n}\r\n\r\nwatch(() => props.modelValue, (newValue) => {\r\n if (newValue !== undefined) {\r\n checkedKeys.value = getInputKeys(newValue, {\r\n optionAsValue: props.optionAsValue,\r\n nodeKey: props.nodeKey,\r\n flatData: flatData.value,\r\n propsConfig: props.props,\r\n data: props.data ?? [],\r\n valueType: props.valueType,\r\n checkStrictly: attrs.value.checkStrictly,\r\n })\r\n nextTick(() => {\r\n if (treeRef.value) {\r\n treeRef.value.setCheckedKeys(checkedKeys.value)\r\n }\r\n })\r\n }\r\n}, { immediate: true })\r\n\r\nwatch(() => [props.valueType, props.optionAsValue, props.includeHalfChecked], () => {\r\n handleCheck()\r\n}, { immediate: false })\r\n\r\nconst fieldRef = useField<Field>()\r\nfieldRef.value?.inject({\r\n getTreeRef: () => {\r\n return treeRef\r\n },\r\n})\r\n</script>\r\n\r\n<template>\r\n <ElScrollbar :height=\"props.height\" :max-height=\"props.maxHeight\">\r\n <ElTree\r\n ref=\"treeRef\"\r\n v-loading=\"attrs.loading\"\r\n :data=\"processedData\"\r\n :props=\"props.props\"\r\n :node-key=\"props.nodeKey\"\r\n :default-checked-keys=\"checkedKeys\"\r\n :show-checkbox=\"true\"\r\n v-bind=\"attrs\"\r\n @check=\"handleCheck\"\r\n >\r\n <template v-for=\"(_, name) of slots\" #[name]=\"slotData\">\r\n <slot :name=\"name\" v-bind=\"{ field: fieldRef, ...slotData }\" />\r\n </template>\r\n </ElTree>\r\n </ElScrollbar>\r\n</template>\r\n","import { connect, mapProps } from '@silver-formily/vue'\r\nimport { mapReadPretty } from '../__builtins__'\r\nimport { PreviewText } from '../preview-text'\r\nimport InnerTree from './tree.vue'\r\n\r\nconst Tree = connect<typeof InnerTree>(\r\n InnerTree,\r\n mapProps({ dataSource: 'data', loading: 'loading', disabled: true }),\r\n mapReadPretty(PreviewText.Tree),\r\n)\r\n\r\nexport { Tree }\r\n\r\nexport default Tree\r\n"],"names":["props","__props","emit","__emit","slots","useSlots","attrs","useCleanAttrs","treeRef","ref","checkedKeys","processedData","computed","addDisabledToNodes","flatData","flattenTree","handleCheck","nextTick","keys","halfCheckedKeys","value","nodes","getOutputData","isFn","element","index","array","watch","newValue","getInputKeys","fieldRef","useField","_createBlock","_unref","ElScrollbar","_withDirectives","_openBlock","_mergeProps","_createSlots","_","name","_withCtx","slotData","_renderSlot","_ctx","_normalizeProps","_guardReactiveProps","vLoading","Tree","connect","InnerTree","mapProps","mapReadPretty","PreviewText"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,UAAMA,IAAQC,GAWRC,IAAOC,GAIPC,IAAQC,EAAA,GAER,EAAE,OAAOC,EAAA,IAAUC,EAAA,GACnBC,IAAUC,EAAA,GACVC,IAAcD,EAAW,EAAE,GAE3BE,IAAgBC,EAAS,MACtBC,EAAmBb,EAAM,QAAQ,CAAA,GAAIM,EAAM,MAAM,UAAUN,EAAM,KAAK,CAC9E,GAEKc,IAAWF,EAAS,MAAMG,EAAYJ,EAAc,SAAS,CAAA,GAAI,IAAIX,EAAM,MAAM,QAAQ,CAAC;AAEhG,mBAAegB,IAAc;AAC3B,YAAMC,EAAA;AACN,YAAMC,IAAOV,EAAQ,MAAM,eAAA,GACrBW,IAAkBX,EAAQ,MAAM,mBAAA,KAAwB,CAAA;AAC9D,MAAAE,EAAY,QAAQQ;AAEpB,YAAM,EAAE,OAAAE,GAAO,OAAAC,EAAA,IAAUC,EAAcJ,GAAMC,GAAiB;AAAA,QAC5D,UAAUL,EAAS;AAAA,QACnB,SAASd,EAAM;AAAA,QACf,aAAaA,EAAM;AAAA,QACnB,MAAMA,EAAM,QAAQ,CAAA;AAAA,QACpB,WAAWA,EAAM;AAAA,QACjB,oBAAoBA,EAAM;AAAA,QAC1B,eAAeM,EAAM,MAAM;AAAA,MAAA,CAC5B;AAED,MAAIN,EAAM,gBACRuB,EAAKvB,EAAM,eAAe,IACtBE,EAAK,qBAAqBmB,EAAM,IAAI,CAACG,GAASC,GAAOC,MAC5C1B,EAAM,gBAAgBwB,GAASC,GAAOC,CAAK,CACnD,CAAC,IACFxB,EAAK,qBAAqB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,CAD4CC,MAAQ;AAAA,cACpDC,EAA+DC,EAAA,QAAlDJ,GAAIK,EAAAC,EAAA,EAAA,OAAmBb,EAAAH,CAAA,MAAaY,EAAA,CAAQ,CAAA,CAAA;AAAA,YAAA;;;UAVhD,CAAAT,EAAAc,CAAA,GAAAd,EAAA3B,CAAA,EAAM,OAAO;AAAA,QAAA;;;;;ICpGxB0C,KAAOC;AAAA,EACXC;AAAAA,EACAC,EAAS,EAAE,YAAY,QAAQ,SAAS,WAAW,UAAU,IAAM;AAAA,EACnEC,EAAcC,EAAY,IAAI;AAChC;"}
|
package/esm/tree/utils.mjs
CHANGED
|
@@ -54,7 +54,6 @@ function T(c, r, t, e, n = []) {
|
|
|
54
54
|
return u;
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
/* istanbul ignore next -- @preserve */
|
|
58
57
|
return [];
|
|
59
58
|
}
|
|
60
59
|
function v(c, r, t, e) {
|
|
@@ -114,7 +113,6 @@ function D(c, r = [], t) {
|
|
|
114
113
|
}
|
|
115
114
|
function b(c, r) {
|
|
116
115
|
const { optionAsValue: t, nodeKey: e, flatData: n, propsConfig: l, data: i, valueType: o, checkStrictly: u } = r;
|
|
117
|
-
/* istanbul ignore if -- @preserve */
|
|
118
116
|
if (!c || !Array.isArray(c))
|
|
119
117
|
return [];
|
|
120
118
|
const a = t ? c.map((d) => d[e]) : c;
|
package/esm/tree/utils.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.mjs","sources":["../../src/tree/utils.ts"],"sourcesContent":["import type { TreeNodeData } from 'element-plus'\n\nexport function flattenTree(nodes: TreeNodeData[], result: TreeNodeData[] = [], childrenKey = 'children'): TreeNodeData[] {\n for (const node of nodes) {\n result.push(node)\n if (node[childrenKey] && node[childrenKey].length > 0) {\n flattenTree(node[childrenKey], result, childrenKey)\n }\n }\n return result\n}\n\nexport function addDisabledToNodes(nodes: TreeNodeData[], disabled: boolean, propsConfig: any): TreeNodeData[] {\n if (!disabled) {\n return nodes\n }\n\n return nodes.map((node) => {\n const newNode = { ...node }\n newNode[propsConfig.disabled!] = true\n\n if (node[propsConfig.children!] && node[propsConfig.children!].length > 0) {\n newNode[propsConfig.children!] = addDisabledToNodes(node[propsConfig.children!], disabled, propsConfig)\n }\n\n return newNode\n })\n}\n\nexport function traverseTree(\n nodes: TreeNodeData[],\n callback: (node: TreeNodeData) => void,\n options: {\n leafOnly?: boolean\n childrenKey?: string\n } = {},\n) {\n const { leafOnly = false, childrenKey = 'children' } = options\n\n for (const node of nodes) {\n const children = node[childrenKey] || []\n const isLeaf = children.length === 0\n\n if (!leafOnly || isLeaf) {\n callback(node)\n }\n if (children.length > 0) {\n traverseTree(children, callback, options)\n }\n }\n}\n\nexport function getChildrenKeys(node: TreeNodeData, nodeKey: string, propsConfig: any): any[] {\n const children = node[propsConfig.children!] || []\n if (children.length === 0)\n return []\n\n const keys: any[] = []\n traverseTree(children, (child) => {\n keys.push(child[nodeKey])\n }, { childrenKey: propsConfig.children })\n\n return keys\n}\n\nexport function extractKeysFromPath(pathNodes: TreeNodeData[], nodeKey: string, propsConfig: any): any[] {\n const keys: any[] = []\n traverseTree(pathNodes, (node) => {\n keys.push(node[nodeKey])\n }, { leafOnly: true, childrenKey: propsConfig.children })\n\n return keys\n}\n\nexport function getSelectedPath(nodes: TreeNodeData[], selectedKeys: any[], nodeKey: string, propsConfig: any): TreeNodeData[] {\n const result: TreeNodeData[] = []\n\n for (const node of nodes) {\n const children = node[propsConfig.children!] || []\n const hasSelectedChild = children.length > 0\n ? getSelectedPath(children, selectedKeys, nodeKey, propsConfig).length > 0\n : false\n\n if (selectedKeys.includes(node[nodeKey]) || hasSelectedChild) {\n const newNode = { ...node }\n if (hasSelectedChild && children.length > 0) {\n newNode[propsConfig.children!] = getSelectedPath(children, selectedKeys, nodeKey, propsConfig)\n }\n result.push(newNode)\n }\n }\n\n return result\n}\n\n/**\n * 查找节点的所有父节点路径\n */\nexport function findParents(nodes: TreeNodeData[], targetKey: any, nodeKey: string, propsConfig: any, parents: any[] = []): any[] {\n for (const node of nodes) {\n const currentPath = [...parents, node[nodeKey]]\n\n if (node[nodeKey] === targetKey) {\n return currentPath\n }\n\n const children = node[propsConfig.children!] || []\n if (children.length > 0) {\n const found = findParents(children, targetKey, nodeKey, propsConfig, currentPath)\n if (found.length > 0) {\n return found\n }\n }\n }\n /* istanbul ignore next -- @preserve */\n return []\n}\n\n/**\n * 过滤叶子节点\n */\nexport function filterLeafNodes(keys: any[], flatData: TreeNodeData[], nodeKey: string, propsConfig: any): any[] {\n return keys.filter((key) => {\n const node = flatData.find(n => n[nodeKey] === key)\n if (!node)\n return false\n const children = node[propsConfig.children!] || []\n return children.length === 0\n })\n}\n\n/**\n * 获取输出数据\n */\nexport function getOutputData(\n keys: any[],\n halfCheckedKeys: any[] = [],\n options: {\n flatData: TreeNodeData[]\n nodeKey: string\n propsConfig: any\n data: TreeNodeData[]\n valueType: string\n includeHalfChecked: boolean\n checkStrictly: boolean\n },\n) {\n const { flatData, nodeKey, propsConfig, data, valueType, includeHalfChecked, checkStrictly } = options\n\n const selectedNodes = flatData.filter(node =>\n keys.includes(node[nodeKey]),\n )\n\n let outputKeys = [...keys]\n let outputNodes = [...selectedNodes]\n\n if (checkStrictly) {\n return {\n value: outputKeys,\n nodes: outputNodes,\n }\n }\n\n switch (valueType) {\n case 'parent': {\n const allChildKeys: any[] = []\n for (const node of selectedNodes) {\n allChildKeys.push(...getChildrenKeys(node, nodeKey, propsConfig))\n }\n outputKeys = keys.filter(key => !allChildKeys.includes(key))\n outputNodes = selectedNodes.filter(node =>\n outputKeys.includes(node[nodeKey]),\n )\n break\n }\n\n case 'child': {\n for (const node of selectedNodes) {\n const childKeys = getChildrenKeys(node, nodeKey, propsConfig)\n const hasSelectedChild = childKeys.some(key => keys.includes(key))\n if (hasSelectedChild) {\n outputKeys = outputKeys.filter(key => key !== node[nodeKey])\n outputNodes = outputNodes.filter(n =>\n n[nodeKey] !== node[nodeKey],\n )\n }\n }\n break\n }\n\n case 'path': {\n const selectedPath = getSelectedPath(data, keys, nodeKey, propsConfig)\n return {\n value: selectedPath,\n nodes: selectedPath,\n }\n }\n\n default: { // 'all'\n if (includeHalfChecked && halfCheckedKeys.length > 0) {\n const halfCheckedNodes = flatData.filter(node =>\n halfCheckedKeys.includes(node[nodeKey]),\n )\n outputKeys = [...outputKeys, ...halfCheckedKeys]\n outputNodes = [...outputNodes, ...halfCheckedNodes]\n }\n break\n }\n }\n\n return {\n value: outputKeys,\n nodes: outputNodes,\n }\n}\n\n/**\n * 根据valueType将输入值转换为checkedKeys\n */\nexport function getInputKeys(\n inputValue: any,\n options: {\n optionAsValue: boolean\n nodeKey: string\n flatData: TreeNodeData[]\n propsConfig: any\n data: TreeNodeData[]\n valueType: string\n checkStrictly: boolean\n },\n): any[] {\n const { optionAsValue, nodeKey, flatData, propsConfig, data, valueType, checkStrictly } = options\n\n /* istanbul ignore if -- @preserve */\n if (!inputValue || !Array.isArray(inputValue))\n return []\n\n const valueArray = optionAsValue ? inputValue.map((item: any) => item[nodeKey]) : inputValue\n\n if (checkStrictly) {\n return valueArray\n }\n\n switch (valueType) {\n case 'parent': {\n const allKeys = [...valueArray]\n\n for (const key of valueArray) {\n const node = flatData.find(n => n[nodeKey] === key)\n if (node) {\n const childKeys = getChildrenKeys(node, nodeKey, propsConfig)\n allKeys.push(...childKeys)\n }\n }\n return filterLeafNodes(allKeys, flatData, nodeKey, propsConfig)\n }\n\n case 'child': {\n const allKeys = [...valueArray]\n for (const key of valueArray) {\n const parentPath = findParents(data, key, nodeKey, propsConfig)\n allKeys.push(...parentPath)\n }\n return filterLeafNodes(allKeys, flatData, nodeKey, propsConfig)\n }\n\n case 'path': {\n return extractKeysFromPath(valueArray, nodeKey, propsConfig)\n }\n\n default: { // 'all'\n return filterLeafNodes(valueArray, flatData, nodeKey, propsConfig)\n }\n }\n}\n"],"names":["flattenTree","nodes","result","childrenKey","node","addDisabledToNodes","disabled","propsConfig","newNode","traverseTree","callback","options","leafOnly","children","isLeaf","getChildrenKeys","nodeKey","keys","child","extractKeysFromPath","pathNodes","getSelectedPath","selectedKeys","hasSelectedChild","findParents","targetKey","parents","currentPath","found","filterLeafNodes","flatData","key","n","getOutputData","halfCheckedKeys","data","valueType","includeHalfChecked","checkStrictly","selectedNodes","outputKeys","outputNodes","allChildKeys","selectedPath","halfCheckedNodes","getInputKeys","inputValue","optionAsValue","valueArray","item","allKeys","childKeys","parentPath"],"mappings":"AAEO,SAASA,EAAYC,GAAuBC,IAAyB,CAAA,GAAIC,IAAc,YAA4B;AACxH,aAAWC,KAAQH;AACjB,IAAAC,EAAO,KAAKE,CAAI,GACZA,EAAKD,CAAW,KAAKC,EAAKD,CAAW,EAAE,SAAS,KAClDH,EAAYI,EAAKD,CAAW,GAAGD,GAAQC,CAAW;AAGtD,SAAOD;AACT;AAEO,SAASG,EAAmBJ,GAAuBK,GAAmBC,GAAkC;AAC7G,SAAKD,IAIEL,EAAM,IAAI,CAACG,MAAS;AACzB,UAAMI,IAAU,EAAE,GAAGJ,EAAA;AACrB,WAAAI,EAAQD,EAAY,QAAS,IAAI,IAE7BH,EAAKG,EAAY,QAAS,KAAKH,EAAKG,EAAY,QAAS,EAAE,SAAS,MACtEC,EAAQD,EAAY,QAAS,IAAIF,EAAmBD,EAAKG,EAAY,QAAS,GAAGD,GAAUC,CAAW,IAGjGC;AAAA,EACT,CAAC,IAZQP;AAaX;AAEO,SAASQ,EACdR,GACAS,GACAC,IAGI,CAAA,GACJ;AACA,QAAM,EAAE,UAAAC,IAAW,IAAO,aAAAT,IAAc,eAAeQ;AAEvD,aAAWP,KAAQH,GAAO;AACxB,UAAMY,IAAWT,EAAKD,CAAW,KAAK,CAAA,GAChCW,IAASD,EAAS,WAAW;AAEnC,KAAI,CAACD,KAAYE,MACfJ,EAASN,CAAI,GAEXS,EAAS,SAAS,KACpBJ,EAAaI,GAAUH,GAAUC,CAAO;AAAA,EAE5C;AACF;AAEO,SAASI,EAA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WAAOU;AAGT,UAAQZ,GAAA;AAAA,IACN,KAAK,UAAU;AACb,YAAMc,IAAU,CAAC,GAAGF,CAAU;AAE9B,iBAAWjB,KAAOiB,GAAY;AAC5B,cAAM5C,IAAO0B,EAAS,KAAK,OAAKE,EAAEhB,CAAO,MAAMe,CAAG;AAClD,YAAI3B,GAAM;AACR,gBAAM+C,IAAYpC,EAAgBX,GAAMY,GAAST,CAAW;AAC5D,UAAA2C,EAAQ,KAAK,GAAGC,CAAS;AAAA,QAC3B;AAAA,MACF;AACA,aAAOtB,EAAgBqB,GAASpB,GAAUd,GAAST,CAAW;AAAA,IAChE;AAAA,IAEA,KAAK,SAAS;AACZ,YAAM2C,IAAU,CAAC,GAAGF,CAAU;AAC9B,iBAAWjB,KAAOiB,GAAY;AAC5B,cAAMI,IAAa5B,EAAYW,GAAMJ,GAAKf,GAAST,CAAW;AAC9D,QAAA2C,EAAQ,KAAK,GAAGE,CAAU;AAAA,MAC5B;AACA,aAAOvB,EAAgBqB,GAASpB,GAAUd,GAAST,CAAW;AAAA,IAChE;AAAA,IAEA,KAAK;AACH,aAAOY,EAAoB6B,GAAYhC,GAAST,CAAW;AAAA,IAG7D;AACE,aAAOsB,EAAgBmB,GAAYlB,GAAUd,GAAST,CAAW;AAAA,EACnE;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"utils.mjs","sources":["../../src/tree/utils.ts"],"sourcesContent":["import type { TreeNodeData } from 'element-plus'\r\n\r\nexport function flattenTree(nodes: TreeNodeData[], result: TreeNodeData[] = [], childrenKey = 'children'): TreeNodeData[] {\r\n for (const node of nodes) {\r\n result.push(node)\r\n if (node[childrenKey] && node[childrenKey].length > 0) {\r\n flattenTree(node[childrenKey], result, childrenKey)\r\n }\r\n }\r\n return result\r\n}\r\n\r\nexport function addDisabledToNodes(nodes: TreeNodeData[], disabled: boolean, propsConfig: any): TreeNodeData[] {\r\n if (!disabled) {\r\n return nodes\r\n }\r\n\r\n return nodes.map((node) => {\r\n const newNode = { ...node }\r\n newNode[propsConfig.disabled!] = true\r\n\r\n if (node[propsConfig.children!] && node[propsConfig.children!].length > 0) {\r\n newNode[propsConfig.children!] = addDisabledToNodes(node[propsConfig.children!], disabled, propsConfig)\r\n }\r\n\r\n return newNode\r\n })\r\n}\r\n\r\nexport function traverseTree(\r\n nodes: TreeNodeData[],\r\n callback: (node: TreeNodeData) => void,\r\n options: {\r\n leafOnly?: boolean\r\n childrenKey?: string\r\n } = {},\r\n) {\r\n const { leafOnly = false, childrenKey = 'children' } = options\r\n\r\n for (const node of nodes) {\r\n const children = node[childrenKey] || []\r\n const isLeaf = children.length === 0\r\n\r\n if (!leafOnly || isLeaf) {\r\n callback(node)\r\n }\r\n if (children.length > 0) {\r\n traverseTree(children, callback, options)\r\n }\r\n }\r\n}\r\n\r\nexport function getChildrenKeys(node: TreeNodeData, nodeKey: string, propsConfig: any): any[] {\r\n const children = node[propsConfig.children!] || []\r\n if (children.length === 0)\r\n return []\r\n\r\n const keys: any[] = []\r\n traverseTree(children, (child) => {\r\n keys.push(child[nodeKey])\r\n }, { childrenKey: propsConfig.children })\r\n\r\n return keys\r\n}\r\n\r\nexport function extractKeysFromPath(pathNodes: TreeNodeData[], nodeKey: string, propsConfig: any): any[] {\r\n const keys: any[] = []\r\n traverseTree(pathNodes, (node) => {\r\n keys.push(node[nodeKey])\r\n }, { leafOnly: true, childrenKey: propsConfig.children })\r\n\r\n return keys\r\n}\r\n\r\nexport function getSelectedPath(nodes: TreeNodeData[], selectedKeys: any[], nodeKey: string, propsConfig: any): TreeNodeData[] {\r\n const result: TreeNodeData[] = []\r\n\r\n for (const node of nodes) {\r\n const children = node[propsConfig.children!] || []\r\n const hasSelectedChild = children.length > 0\r\n ? getSelectedPath(children, selectedKeys, nodeKey, propsConfig).length > 0\r\n : false\r\n\r\n if (selectedKeys.includes(node[nodeKey]) || hasSelectedChild) {\r\n const newNode = { ...node }\r\n if (hasSelectedChild && children.length > 0) {\r\n newNode[propsConfig.children!] = getSelectedPath(children, selectedKeys, nodeKey, propsConfig)\r\n }\r\n result.push(newNode)\r\n }\r\n }\r\n\r\n return result\r\n}\r\n\r\n/**\r\n * 查找节点的所有父节点路径\r\n */\r\nexport function findParents(nodes: TreeNodeData[], targetKey: any, nodeKey: string, propsConfig: any, parents: any[] = []): any[] {\r\n for (const node of nodes) {\r\n const currentPath = [...parents, node[nodeKey]]\r\n\r\n if (node[nodeKey] === targetKey) {\r\n return currentPath\r\n }\r\n\r\n const children = node[propsConfig.children!] || []\r\n if (children.length > 0) {\r\n const found = findParents(children, targetKey, nodeKey, propsConfig, currentPath)\r\n if (found.length > 0) {\r\n return found\r\n }\r\n }\r\n }\r\n /* istanbul ignore next -- @preserve */\r\n return []\r\n}\r\n\r\n/**\r\n * 过滤叶子节点\r\n */\r\nexport function filterLeafNodes(keys: any[], flatData: TreeNodeData[], nodeKey: string, propsConfig: any): any[] {\r\n return keys.filter((key) => {\r\n const node = flatData.find(n => n[nodeKey] === key)\r\n if (!node)\r\n return false\r\n const children = node[propsConfig.children!] || []\r\n return children.length === 0\r\n })\r\n}\r\n\r\n/**\r\n * 获取输出数据\r\n */\r\nexport function getOutputData(\r\n keys: any[],\r\n halfCheckedKeys: any[] = [],\r\n options: {\r\n flatData: TreeNodeData[]\r\n nodeKey: string\r\n propsConfig: any\r\n data: TreeNodeData[]\r\n valueType: string\r\n includeHalfChecked: boolean\r\n checkStrictly: boolean\r\n },\r\n) {\r\n const { flatData, nodeKey, propsConfig, data, valueType, includeHalfChecked, checkStrictly } = options\r\n\r\n const selectedNodes = flatData.filter(node =>\r\n keys.includes(node[nodeKey]),\r\n )\r\n\r\n let outputKeys = [...keys]\r\n let outputNodes = [...selectedNodes]\r\n\r\n if (checkStrictly) {\r\n return {\r\n value: outputKeys,\r\n nodes: outputNodes,\r\n }\r\n }\r\n\r\n switch (valueType) {\r\n case 'parent': {\r\n const allChildKeys: any[] = []\r\n for (const node of selectedNodes) {\r\n allChildKeys.push(...getChildrenKeys(node, nodeKey, propsConfig))\r\n }\r\n outputKeys = keys.filter(key => !allChildKeys.includes(key))\r\n outputNodes = selectedNodes.filter(node =>\r\n outputKeys.includes(node[nodeKey]),\r\n )\r\n break\r\n }\r\n\r\n case 'child': {\r\n for (const node of selectedNodes) {\r\n const childKeys = getChildrenKeys(node, nodeKey, propsConfig)\r\n const hasSelectedChild = childKeys.some(key => keys.includes(key))\r\n if (hasSelectedChild) {\r\n outputKeys = outputKeys.filter(key => key !== node[nodeKey])\r\n outputNodes = outputNodes.filter(n =>\r\n n[nodeKey] !== node[nodeKey],\r\n )\r\n }\r\n }\r\n break\r\n }\r\n\r\n case 'path': {\r\n const selectedPath = getSelectedPath(data, keys, nodeKey, propsConfig)\r\n return {\r\n value: selectedPath,\r\n nodes: selectedPath,\r\n }\r\n }\r\n\r\n default: { // 'all'\r\n if (includeHalfChecked && halfCheckedKeys.length > 0) {\r\n const halfCheckedNodes = flatData.filter(node =>\r\n halfCheckedKeys.includes(node[nodeKey]),\r\n )\r\n outputKeys = [...outputKeys, ...halfCheckedKeys]\r\n outputNodes = [...outputNodes, ...halfCheckedNodes]\r\n }\r\n break\r\n }\r\n }\r\n\r\n return {\r\n value: outputKeys,\r\n nodes: outputNodes,\r\n }\r\n}\r\n\r\n/**\r\n * 根据valueType将输入值转换为checkedKeys\r\n */\r\nexport function getInputKeys(\r\n inputValue: any,\r\n options: {\r\n optionAsValue: boolean\r\n nodeKey: string\r\n flatData: TreeNodeData[]\r\n propsConfig: any\r\n data: TreeNodeData[]\r\n valueType: string\r\n checkStrictly: boolean\r\n },\r\n): any[] {\r\n const { optionAsValue, nodeKey, flatData, propsConfig, data, valueType, checkStrictly } = options\r\n\r\n /* istanbul ignore if -- @preserve */\r\n if (!inputValue || !Array.isArray(inputValue))\r\n return []\r\n\r\n const valueArray = optionAsValue ? inputValue.map((item: any) => item[nodeKey]) : inputValue\r\n\r\n if (checkStrictly) {\r\n return valueArray\r\n }\r\n\r\n switch (valueType) {\r\n case 'parent': {\r\n const allKeys = [...valueArray]\r\n\r\n for (const key of valueArray) {\r\n const node = flatData.find(n => n[nodeKey] === key)\r\n if (node) {\r\n const childKeys = getChildrenKeys(node, nodeKey, propsConfig)\r\n allKeys.push(...childKeys)\r\n }\r\n }\r\n return filterLeafNodes(allKeys, flatData, nodeKey, propsConfig)\r\n }\r\n\r\n case 'child': {\r\n const allKeys = [...valueArray]\r\n for (const key of valueArray) {\r\n const parentPath = findParents(data, key, nodeKey, propsConfig)\r\n allKeys.push(...parentPath)\r\n }\r\n return filterLeafNodes(allKeys, flatData, nodeKey, propsConfig)\r\n }\r\n\r\n case 'path': {\r\n return extractKeysFromPath(valueArray, nodeKey, propsConfig)\r\n }\r\n\r\n default: { // 'all'\r\n return filterLeafNodes(valueArray, flatData, nodeKey, propsConfig)\r\n }\r\n }\r\n}\r\n"],"names":["flattenTree","nodes","result","childrenKey","node","addDisabledToNodes","disabled","propsConfig","newNode","traverseTree","callback","options","leafOnly","children","isLeaf","getChildrenKeys","nodeKey","keys","child","extractKeysFromPath","pathNodes","getSelectedPath","selectedKeys","hasSelectedChild","findParents","targetKey","parents","currentPath","found","filterLeafNodes","flatData","key","n","getOutputData","halfCheckedKeys","data","valueType","includeHalfChecked","checkStrictly","selectedNodes","outputKeys","outputNodes","allChildKeys","selectedPath","halfCheckedNodes","getInputKeys","inputValue","optionAsValue","valueArray","item","allKeys","childKeys","parentPath"],"mappings":"AAEO,SAASA,EAAYC,GAAuBC,IAAyB,CAAA,GAAIC,IAAc,YAA4B;AACxH,aAAWC,KAAQH;AACjB,IAAAC,EAAO,KAAKE,CAAI,GACZA,EAAKD,CAAW,KAAKC,EAAKD,CAAW,EAAE,SAAS,KAClDH,EAAYI,EAAKD,CAAW,GAAGD,GAAQC,CAAW;AAGtD,SAAOD;AACT;AAEO,SAASG,EAAmBJ,GAAuBK,GAAmBC,GAAkC;AAC7G,SAAKD,IAIEL,EAAM,IAAI,CAACG,MAAS;AACzB,UAAMI,IAAU,EAAE,GAAGJ,EAAA;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AoB6B,GAAYhC,GAAST,CAAW;AAAA,IAG7D;AACE,aAAOsB,EAAgBmB,GAAYlB,GAAUd,GAAST,CAAW;AAAA,EACnE;AAEJ;"}
|
|
@@ -1,22 +1,18 @@
|
|
|
1
|
-
import { useField as c, connect as i, mapProps as
|
|
2
|
-
import {
|
|
3
|
-
import "
|
|
4
|
-
import "
|
|
5
|
-
import {
|
|
6
|
-
import { mapReadPretty as
|
|
7
|
-
|
|
8
|
-
import "@formily/core";
|
|
9
|
-
import "@silver-formily/reactive-vue";
|
|
10
|
-
import { useCleanAttrs as C } from "../__builtins__/shared/utils.mjs";
|
|
11
|
-
const w = /* @__PURE__ */ f({
|
|
1
|
+
import { useField as c, connect as i, mapProps as f } from "@silver-formily/vue";
|
|
2
|
+
import { PreviewText as p } from "../preview-text/index.mjs";
|
|
3
|
+
import { defineComponent as m, useSlots as d, ref as u, openBlock as S, createBlock as _, unref as e, mergeProps as g, createSlots as P, renderList as R, withCtx as T, renderSlot as v, normalizeProps as y, guardReactiveProps as h } from "vue";
|
|
4
|
+
import { ElTreeSelect as k } from "element-plus";
|
|
5
|
+
import { useCleanAttrs as x } from "../__builtins__/shared/utils.mjs";
|
|
6
|
+
import { mapReadPretty as C } from "../__builtins__/shared/transform-component.mjs";
|
|
7
|
+
const w = /* @__PURE__ */ m({
|
|
12
8
|
name: "FSelectTree",
|
|
13
9
|
inheritAttrs: !1,
|
|
14
10
|
__name: "tree-select",
|
|
15
11
|
setup(A) {
|
|
16
|
-
const n = d(), { props: l } =
|
|
12
|
+
const n = d(), { props: l } = x(), r = u(), t = c();
|
|
17
13
|
return t.value?.inject({
|
|
18
14
|
getTreeSelectRef: () => r
|
|
19
|
-
}), (s, B) => (
|
|
15
|
+
}), (s, B) => (S(), _(e(k), g({
|
|
20
16
|
ref_key: "treeSelectRef",
|
|
21
17
|
ref: r,
|
|
22
18
|
loading: e(t).value?.loading
|
|
@@ -29,13 +25,13 @@ const w = /* @__PURE__ */ f({
|
|
|
29
25
|
}))
|
|
30
26
|
]), 1040, ["loading"]));
|
|
31
27
|
}
|
|
32
|
-
}),
|
|
28
|
+
}), b = i(
|
|
33
29
|
w,
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
f({ readOnly: "readonly", dataSource: "data" }),
|
|
31
|
+
C(p.Select)
|
|
36
32
|
);
|
|
37
33
|
export {
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
b as TreeSelect,
|
|
35
|
+
b as default
|
|
40
36
|
};
|
|
41
37
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/tree-select/tree-select.vue","../../src/tree-select/index.ts"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { Field } from '@formily/core'\nimport { useField } from '@silver-formily/vue'\nimport { ElTreeSelect } from 'element-plus'\nimport { ref, useSlots } from 'vue'\nimport { useCleanAttrs } from '../__builtins__'\n\ndefineOptions({\n name: 'FSelectTree',\n inheritAttrs: false,\n})\n\nconst slots = useSlots()\n\nconst { props: attrs } = useCleanAttrs()\n\nconst treeSelectRef = ref()\n\nconst fieldRef = useField<Field>()\n\nfieldRef.value?.inject({\n getTreeSelectRef: () => {\n return treeSelectRef\n },\n})\n</script>\n\n<template>\n <ElTreeSelect\n ref=\"treeSelectRef\"\n :loading=\"fieldRef.value?.loading\"\n v-bind=\"attrs\"\n >\n <template v-for=\"(_, name) of slots\" #[name]=\"slotData\">\n <slot :name=\"name\" v-bind=\"{ field: fieldRef, ...slotData }\" />\n </template>\n </ElTreeSelect>\n</template>\n","import { connect, mapProps } from '@silver-formily/vue'\r\nimport { mapReadPretty } from '../__builtins__'\r\nimport { PreviewText } from '../preview-text'\r\nimport FTreeSelect from './tree-select.vue'\r\n\r\nexport const TreeSelect = connect<typeof FTreeSelect>(\n FTreeSelect,\n mapProps({ readOnly: 'readonly', dataSource: 'data' }),\r\n mapReadPretty(PreviewText.Select),\r\n)\r\n\r\nexport default TreeSelect\r\n"],"names":["slots","useSlots","attrs","useCleanAttrs","treeSelectRef","ref","fieldRef","useField","_openBlock","_createBlock","_unref","_mergeProps","_createSlots","_","name","_withCtx","slotData","_renderSlot","_ctx","_normalizeProps","_guardReactiveProps","TreeSelect","connect","FTreeSelect","mapProps","mapReadPretty","PreviewText"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/tree-select/tree-select.vue","../../src/tree-select/index.ts"],"sourcesContent":["<script setup lang=\"ts\">\r\nimport type { Field } from '@formily/core'\r\nimport { useField } from '@silver-formily/vue'\r\nimport { ElTreeSelect } from 'element-plus'\r\nimport { ref, useSlots } from 'vue'\r\nimport { useCleanAttrs } from '../__builtins__'\r\n\r\ndefineOptions({\r\n name: 'FSelectTree',\r\n inheritAttrs: false,\r\n})\r\n\r\nconst slots = useSlots()\r\n\r\nconst { props: attrs } = useCleanAttrs()\r\n\r\nconst treeSelectRef = ref()\r\n\r\nconst fieldRef = useField<Field>()\r\n\r\nfieldRef.value?.inject({\r\n getTreeSelectRef: () => {\r\n return treeSelectRef\r\n },\r\n})\r\n</script>\r\n\r\n<template>\r\n <ElTreeSelect\r\n ref=\"treeSelectRef\"\r\n :loading=\"fieldRef.value?.loading\"\r\n v-bind=\"attrs\"\r\n >\r\n <template v-for=\"(_, name) of slots\" #[name]=\"slotData\">\r\n <slot :name=\"name\" v-bind=\"{ field: fieldRef, ...slotData }\" />\r\n </template>\r\n </ElTreeSelect>\r\n</template>\r\n","import { connect, mapProps } from '@silver-formily/vue'\r\nimport { mapReadPretty } from '../__builtins__'\r\nimport { PreviewText } from '../preview-text'\r\nimport FTreeSelect from './tree-select.vue'\r\n\r\nexport const TreeSelect = connect<typeof FTreeSelect>(\n FTreeSelect,\n mapProps({ readOnly: 'readonly', dataSource: 'data' }),\r\n mapReadPretty(PreviewText.Select),\r\n)\r\n\r\nexport default TreeSelect\r\n"],"names":["slots","useSlots","attrs","useCleanAttrs","treeSelectRef","ref","fieldRef","useField","_openBlock","_createBlock","_unref","_mergeProps","_createSlots","_","name","_withCtx","slotData","_renderSlot","_ctx","_normalizeProps","_guardReactiveProps","TreeSelect","connect","FTreeSelect","mapProps","mapReadPretty","PreviewText"],"mappings":";;;;;;;;;;;AAYA,UAAMA,IAAQC,EAAA,GAER,EAAE,OAAOC,EAAA,IAAUC,EAAA,GAEnBC,IAAgBC,EAAA,GAEhBC,IAAWC,EAAA;AAEjB,WAAAD,EAAS,OAAO,OAAO;AAAA,MACrB,kBAAkB,MACTF;AAAA,IACT,CACD,cAICI,KAAAC,EAQeC,MARfC,EAQe;AAAA,eAPT;AAAA,MAAJ,KAAIP;AAAA,MACH,SAASM,EAAAJ,CAAA,EAAS,OAAO;AAAA,IAAA,GAClBI,EAAAR,CAAA,CAAK,GAAAU,EAAA,EAAA,GAAA,KAAA;AAAA,QAEiBF,EAAAV,CAAA,GAAK,CAAjBa,GAAGC;;QACnB,IAAAC,EAAA,CAD4CC,MAAQ;AAAA,UACpDC,EAA+DC,EAAA,QAAlDJ,GAAIK,EAAAC,EAAA,EAAA,OAAmBV,EAAAJ,CAAA,MAAaU,EAAA,CAAQ,CAAA,CAAA;AAAA,QAAA;;;;IC7BlDK,IAAaC;AAAA,EACxBC;AAAAA,EACAC,EAAS,EAAE,UAAU,YAAY,YAAY,QAAQ;AAAA,EACrDC,EAAcC,EAAY,MAAM;AAClC;"}
|