@qin-ui/element-plus-pro 1.0.8 → 1.1.1
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/AI-CONTEXT.md +49 -37
- package/LICENSE +9 -0
- package/api.json +45 -28
- package/bin/init-ai.mjs +0 -0
- package/es/components/component-provider/components/index.vue.d.ts +27 -0
- package/es/components/component-provider/components/index.vue.d.ts.map +1 -0
- package/es/components/component-provider/constants/index.d.ts +16 -0
- package/es/components/component-provider/constants/index.d.ts.map +1 -0
- package/es/components/component-provider/index.d.ts +4 -0
- package/es/components/component-provider/index.d.ts.map +1 -0
- package/es/components/component-provider/types/index.d.ts +35 -0
- package/es/components/component-provider/types/index.d.ts.map +1 -0
- package/es/components/form/components/BaseField/index.vue.d.ts +13 -0
- package/es/components/form/components/BaseField/index.vue.d.ts.map +1 -0
- package/es/components/form/components/BaseField/utils/index.d.ts +3 -0
- package/es/components/form/components/BaseField/utils/index.d.ts.map +1 -0
- package/es/components/form/components/BaseFormItem/index.vue.d.ts +9 -0
- package/es/components/form/components/BaseFormItem/index.vue.d.ts.map +1 -0
- package/es/components/form/components/ContainerFragment/index.vue.d.ts +23 -0
- package/es/components/form/components/ContainerFragment/index.vue.d.ts.map +1 -0
- package/es/components/form/components/GroupedFieldAttrs/index.vue.d.ts +31 -0
- package/es/components/form/components/GroupedFieldAttrs/index.vue.d.ts.map +1 -0
- package/es/components/form/components/PathProvider/index.vue.d.ts +24 -0
- package/es/components/form/components/PathProvider/index.vue.d.ts.map +1 -0
- package/es/components/form/components/ProForm/index.vue.d.ts +36 -0
- package/es/components/form/components/ProForm/index.vue.d.ts.map +1 -0
- package/es/components/form/components/SlotComponent/index.vue.d.ts +7 -0
- package/es/components/form/components/SlotComponent/index.vue.d.ts.map +1 -0
- package/es/components/form/components/index.d.ts +12 -0
- package/es/components/form/components/index.d.ts.map +1 -0
- package/es/components/form/constants/index.d.ts +67 -0
- package/es/components/form/constants/index.d.ts.map +1 -0
- package/es/components/form/hooks/index.d.ts +5 -0
- package/es/components/form/hooks/index.d.ts.map +1 -0
- package/es/components/form/hooks/useFields.d.ts +57 -0
- package/es/components/form/hooks/useFields.d.ts.map +1 -0
- package/es/components/form/hooks/useForm.d.ts +93 -0
- package/es/components/form/hooks/useForm.d.ts.map +1 -0
- package/es/components/form/hooks/useFormRef.d.ts +30 -0
- package/es/components/form/hooks/useFormRef.d.ts.map +1 -0
- package/es/components/form/index.d.ts +7 -0
- package/es/components/form/index.d.ts.map +1 -0
- package/es/components/form/types/index.d.ts +234 -0
- package/es/components/form/types/index.d.ts.map +1 -0
- package/es/components/table/components/ColumnControl.vue.d.ts +9 -0
- package/es/components/table/components/ColumnControl.vue.d.ts.map +1 -0
- package/es/components/table/components/DefaultSearchFormContainer.vue.d.ts +18 -0
- package/es/components/table/components/DefaultSearchFormContainer.vue.d.ts.map +1 -0
- package/es/components/table/components/DefaultTableContainer.vue.d.ts +18 -0
- package/es/components/table/components/DefaultTableContainer.vue.d.ts.map +1 -0
- package/es/components/table/components/ProTable.vue.d.ts +47 -0
- package/es/components/table/components/ProTable.vue.d.ts.map +1 -0
- package/es/components/table/components/SearchForm.vue.d.ts +48 -0
- package/es/components/table/components/SearchForm.vue.d.ts.map +1 -0
- package/es/components/table/components/SizeControl.vue.d.ts +12 -0
- package/es/components/table/components/SizeControl.vue.d.ts.map +1 -0
- package/es/components/table/components/TableColumnRenderer.vue.d.ts +17 -0
- package/es/components/table/components/TableColumnRenderer.vue.d.ts.map +1 -0
- package/es/components/table/components/icons/ColumnHeightOutlined.vue.d.ts +3 -0
- package/es/components/table/components/icons/ColumnHeightOutlined.vue.d.ts.map +1 -0
- package/es/components/table/components/icons/DownOutlined.vue.d.ts +3 -0
- package/es/components/table/components/icons/DownOutlined.vue.d.ts.map +1 -0
- package/es/components/table/components/icons/FilterOutlined.vue.d.ts +3 -0
- package/es/components/table/components/icons/FilterOutlined.vue.d.ts.map +1 -0
- package/es/components/table/components/index.d.ts +5 -0
- package/es/components/table/components/index.d.ts.map +1 -0
- package/es/components/table/index.d.ts +33 -0
- package/es/components/table/index.d.ts.map +1 -0
- package/es/components/table/types/index.d.ts +67 -0
- package/es/components/table/types/index.d.ts.map +1 -0
- package/es/components/table/useTable.d.ts +111 -0
- package/es/components/table/useTable.d.ts.map +1 -0
- package/es/element-plus-pro.css +10 -10
- package/es/index.d.ts +76 -1472
- package/es/index.d.ts.map +1 -0
- package/es/index.js +1534 -29
- package/es/index.js.map +1 -0
- package/es/shared/core/index.d.ts +6 -0
- package/es/shared/core/index.d.ts.map +1 -0
- package/es/shared/ui/index.d.ts +12 -0
- package/es/shared/ui/index.d.ts.map +1 -0
- package/package.json +20 -13
- package/src/components/component-provider/components/index.vue +67 -0
- package/src/components/component-provider/constants/index.ts +209 -0
- package/src/components/component-provider/index.ts +6 -0
- package/src/components/component-provider/types/index.ts +64 -0
- package/src/components/form/components/BaseField/index.vue +181 -0
- package/src/components/form/components/BaseField/utils/index.ts +15 -0
- package/src/components/form/components/BaseFormItem/index.vue +170 -0
- package/src/components/form/components/ContainerFragment/index.vue +24 -0
- package/src/components/form/components/GroupedFieldAttrs/index.vue +115 -0
- package/src/components/form/components/PathProvider/index.vue +19 -0
- package/src/components/form/components/ProForm/index.vue +106 -0
- package/src/components/form/components/SlotComponent/index.vue +26 -0
- package/src/components/form/components/index.ts +15 -0
- package/src/components/form/constants/index.ts +116 -0
- package/src/components/form/hooks/index.ts +5 -0
- package/src/components/form/hooks/useFields.ts +67 -0
- package/src/components/form/hooks/useForm.ts +110 -0
- package/src/components/form/hooks/useFormRef.ts +35 -0
- package/src/components/form/index.ts +29 -0
- package/src/components/form/types/index.ts +300 -0
- package/src/components/table/components/ColumnControl.vue +136 -0
- package/src/components/table/components/DefaultSearchFormContainer.vue +14 -0
- package/src/components/table/components/DefaultTableContainer.vue +14 -0
- package/src/components/table/components/ProTable.vue +420 -0
- package/src/components/table/components/SearchForm.vue +302 -0
- package/src/components/table/components/SizeControl.vue +55 -0
- package/src/components/table/components/TableColumnRenderer.vue +71 -0
- package/src/components/table/components/icons/ColumnHeightOutlined.vue +4 -0
- package/src/components/table/components/icons/DownOutlined.vue +4 -0
- package/src/components/table/components/icons/FilterOutlined.vue +4 -0
- package/src/components/table/components/index.ts +4 -0
- package/src/components/table/index.ts +38 -0
- package/src/components/table/types/index.ts +77 -0
- package/src/components/table/useTable.ts +144 -0
- package/src/index.ts +81 -0
- package/src/shared/core/index.ts +38 -0
- package/src/shared/ui/index.ts +106 -0
- package/es/component-provider/index-Bmx9Q9Q-.js +0 -220
- package/es/component-provider/index.js +0 -4
- package/es/core/index-C0Pbv44C.js +0 -360
- package/es/form/index-D8btGgqa.js +0 -470
- package/es/form/index.js +0 -13
- package/es/table/index.js +0 -856
- package/es/vendor/utils/lodash-es-p6jau26B.js +0 -1120
package/es/table/index.js
DELETED
|
@@ -1,856 +0,0 @@
|
|
|
1
|
-
import { createElementBlock, openBlock, createElementVNode, defineComponent, ref, computed, watch, watchEffect, createBlock, unref, mergeProps, withKeys, withCtx, createVNode, renderSlot, createCommentVNode, Fragment, resolveDynamicComponent, createTextVNode, toDisplayString, normalizeStyle, useModel, renderList, withModifiers, mergeModels, inject, useAttrs, useSlots, onMounted, resolveDirective, normalizeClass, withDirectives, createSlots, normalizeProps, guardReactiveProps, nextTick } from "vue";
|
|
2
|
-
import { ElSpace, ElButton, ElDropdown, ElDropdownMenu, ElDropdownItem, ElCheckbox, ElTableColumn, ElTable, ElPagination } from "element-plus";
|
|
3
|
-
import { _ as _export_sfc, a as _sfc_main$a, t as tableProps, p as paginationProps, b as _sfc_main$b } from "../form/index-D8btGgqa.js";
|
|
4
|
-
import { I as INJECT_CONFIG } from "../component-provider/index-Bmx9Q9Q-.js";
|
|
5
|
-
import { c as camelizeProperties, g as getObject, f as useTable$1 } from "../core/index-C0Pbv44C.js";
|
|
6
|
-
import { g as get, t as toPath, p as pick } from "../vendor/utils/lodash-es-p6jau26B.js";
|
|
7
|
-
const _sfc_main$9 = {};
|
|
8
|
-
const _hoisted_1$5 = {
|
|
9
|
-
focusable: "false",
|
|
10
|
-
"data-icon": "down",
|
|
11
|
-
width: "1em",
|
|
12
|
-
height: "1em",
|
|
13
|
-
fill: "currentColor",
|
|
14
|
-
"aria-hidden": "true",
|
|
15
|
-
viewBox: "64 64 896 896"
|
|
16
|
-
};
|
|
17
|
-
function _sfc_render$4(_ctx, _cache) {
|
|
18
|
-
return openBlock(), createElementBlock("svg", _hoisted_1$5, [..._cache[0] || (_cache[0] = [
|
|
19
|
-
createElementVNode("path", { d: "M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z" }, null, -1)
|
|
20
|
-
])]);
|
|
21
|
-
}
|
|
22
|
-
const DownOutlined = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["render", _sfc_render$4]]);
|
|
23
|
-
const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
24
|
-
...{ name: "SearchForm" },
|
|
25
|
-
__name: "SearchForm",
|
|
26
|
-
props: {
|
|
27
|
-
form: {},
|
|
28
|
-
layout: { default: "grid" },
|
|
29
|
-
expand: { type: [Boolean, Object], default: true },
|
|
30
|
-
searchButton: { type: [Object, Function, Boolean], default: void 0 },
|
|
31
|
-
resetButton: { type: [Object, Function, Boolean], default: void 0 },
|
|
32
|
-
expandButton: { type: [Object, Function, Boolean], default: void 0 },
|
|
33
|
-
rowGap: { default: 16 },
|
|
34
|
-
columnGap: { default: 24 },
|
|
35
|
-
class: {},
|
|
36
|
-
style: {}
|
|
37
|
-
},
|
|
38
|
-
emits: ["search", "reset"],
|
|
39
|
-
setup(__props, { emit: __emit }) {
|
|
40
|
-
const emit = __emit;
|
|
41
|
-
const proFormHeight = ref("unset");
|
|
42
|
-
const collapseHeight = ref(0);
|
|
43
|
-
let rowHeight = 32;
|
|
44
|
-
const computedExpand = computed(() => {
|
|
45
|
-
if (!__props.expand) return false;
|
|
46
|
-
if (__props.expand === true) return { minExpandRows: 2, expandStatus: false };
|
|
47
|
-
return {
|
|
48
|
-
minExpandRows: Math.max(Math.floor(__props.expand.minExpandRows ?? 2), 1),
|
|
49
|
-
expandStatus: __props.expand.expandStatus ?? false
|
|
50
|
-
};
|
|
51
|
-
});
|
|
52
|
-
const showExpandToggle = ref(false);
|
|
53
|
-
const expandStatus = ref(true);
|
|
54
|
-
const changeExpandStatus = () => {
|
|
55
|
-
expandStatus.value = !expandStatus.value;
|
|
56
|
-
};
|
|
57
|
-
const { formRef, getFormData } = __props.form;
|
|
58
|
-
const setInitExpandStatus = () => {
|
|
59
|
-
expandStatus.value = false;
|
|
60
|
-
if (formRef.value && __props.expand) {
|
|
61
|
-
const formEl = formRef.value.$el;
|
|
62
|
-
const formItemsEl = formEl.querySelectorAll(
|
|
63
|
-
"[class*='-form-item'] > [path]"
|
|
64
|
-
);
|
|
65
|
-
const observer = new IntersectionObserver(
|
|
66
|
-
(entries) => {
|
|
67
|
-
expandStatus.value = entries.some((e) => {
|
|
68
|
-
if (e.intersectionRatio === 0) {
|
|
69
|
-
const path = e.target.getAttribute("path");
|
|
70
|
-
const searchFieldValue = path ? getFormData == null ? void 0 : getFormData(path) : void 0;
|
|
71
|
-
return ![null, void 0].includes(searchFieldValue);
|
|
72
|
-
}
|
|
73
|
-
return __props.expand.expandStatus;
|
|
74
|
-
});
|
|
75
|
-
observer.disconnect();
|
|
76
|
-
},
|
|
77
|
-
{ root: formEl }
|
|
78
|
-
);
|
|
79
|
-
formItemsEl.forEach((element) => {
|
|
80
|
-
observer.observe(element);
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
watch(
|
|
85
|
-
[
|
|
86
|
-
() => {
|
|
87
|
-
var _a, _b, _c;
|
|
88
|
-
return (_c = (_b = (_a = __props.form) == null ? void 0 : _a.fields.value) == null ? void 0 : _b.filter((f) => !f.hidden)) == null ? void 0 : _c.length;
|
|
89
|
-
},
|
|
90
|
-
() => formRef.value,
|
|
91
|
-
() => __props.expand
|
|
92
|
-
],
|
|
93
|
-
() => {
|
|
94
|
-
var _a, _b, _c, _d, _e;
|
|
95
|
-
if (!__props.expand || !expandStatus.value || !formRef.value) return;
|
|
96
|
-
const proFormEl = (_a = formRef.value) == null ? void 0 : _a.$el;
|
|
97
|
-
const { height = 0 } = ((_b = proFormEl == null ? void 0 : proFormEl.getBoundingClientRect) == null ? void 0 : _b.call(proFormEl)) || {};
|
|
98
|
-
proFormHeight.value = height;
|
|
99
|
-
rowHeight = (_e = (_d = (_c = proFormEl == null ? void 0 : proFormEl.querySelector("[class*='-form-item']")) == null ? void 0 : _c.getBoundingClientRect) == null ? void 0 : _d.call(_c)) == null ? void 0 : _e.height;
|
|
100
|
-
},
|
|
101
|
-
{ flush: "post", immediate: true }
|
|
102
|
-
);
|
|
103
|
-
watchEffect(
|
|
104
|
-
() => {
|
|
105
|
-
if (typeof proFormHeight.value !== "number") return;
|
|
106
|
-
if (__props.layout === "grid" && computedExpand.value) {
|
|
107
|
-
const { minExpandRows } = computedExpand.value;
|
|
108
|
-
collapseHeight.value = Math.min(
|
|
109
|
-
minExpandRows * rowHeight + (minExpandRows - 1) * __props.rowGap,
|
|
110
|
-
+proFormHeight.value
|
|
111
|
-
);
|
|
112
|
-
showExpandToggle.value = +proFormHeight.value - collapseHeight.value > 1;
|
|
113
|
-
if (showExpandToggle.value) {
|
|
114
|
-
setInitExpandStatus();
|
|
115
|
-
}
|
|
116
|
-
} else {
|
|
117
|
-
showExpandToggle.value = false;
|
|
118
|
-
}
|
|
119
|
-
},
|
|
120
|
-
{ flush: "post" }
|
|
121
|
-
);
|
|
122
|
-
const layoutProps = computed(
|
|
123
|
-
() => __props.layout === "grid" ? {
|
|
124
|
-
grid: {
|
|
125
|
-
gutter: __props.columnGap,
|
|
126
|
-
style: { rowGap: `${__props.rowGap}px` }
|
|
127
|
-
},
|
|
128
|
-
style: {
|
|
129
|
-
display: "flex",
|
|
130
|
-
overflow: "hidden",
|
|
131
|
-
columnGap: `${__props.columnGap}px`,
|
|
132
|
-
height: `${expandStatus.value ? proFormHeight.value : collapseHeight.value}px`
|
|
133
|
-
}
|
|
134
|
-
} : {
|
|
135
|
-
inline: true,
|
|
136
|
-
style: {
|
|
137
|
-
display: "flex",
|
|
138
|
-
flexWrap: "wrap",
|
|
139
|
-
gap: `${__props.rowGap}px ${__props.columnGap}px`
|
|
140
|
-
},
|
|
141
|
-
grid: false
|
|
142
|
-
}
|
|
143
|
-
);
|
|
144
|
-
const onReset = () => {
|
|
145
|
-
emit("reset");
|
|
146
|
-
};
|
|
147
|
-
const onSearch = () => {
|
|
148
|
-
emit("search");
|
|
149
|
-
};
|
|
150
|
-
return (_ctx, _cache) => {
|
|
151
|
-
return openBlock(), createBlock(unref(_sfc_main$a), mergeProps(layoutProps.value, {
|
|
152
|
-
form: __props.form,
|
|
153
|
-
class: "pro-table_search-form transition",
|
|
154
|
-
onKeyup: withKeys(onSearch, ["enter"])
|
|
155
|
-
}), {
|
|
156
|
-
default: withCtx(() => [
|
|
157
|
-
createVNode(unref(ElSpace), {
|
|
158
|
-
alignment: "start",
|
|
159
|
-
class: "pro-table_search-form_button-group"
|
|
160
|
-
}, {
|
|
161
|
-
default: withCtx(() => [
|
|
162
|
-
renderSlot(_ctx.$slots, "reset-button", { onClick: onReset }, () => [
|
|
163
|
-
__props.resetButton !== false ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
164
|
-
__props.resetButton ? (openBlock(), createBlock(resolveDynamicComponent(__props.resetButton), {
|
|
165
|
-
key: 0,
|
|
166
|
-
onClick: onReset
|
|
167
|
-
})) : (openBlock(), createBlock(unref(ElButton), {
|
|
168
|
-
key: 1,
|
|
169
|
-
class: "pro-table_search-form_reset-button",
|
|
170
|
-
onClick: onReset
|
|
171
|
-
}, {
|
|
172
|
-
default: withCtx(() => [..._cache[0] || (_cache[0] = [
|
|
173
|
-
createTextVNode("重置", -1)
|
|
174
|
-
])]),
|
|
175
|
-
_: 1
|
|
176
|
-
}))
|
|
177
|
-
], 64)) : createCommentVNode("", true)
|
|
178
|
-
], true),
|
|
179
|
-
renderSlot(_ctx.$slots, "search-button", { onClick: onSearch }, () => [
|
|
180
|
-
__props.searchButton !== false ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
181
|
-
__props.searchButton ? (openBlock(), createBlock(resolveDynamicComponent(__props.searchButton), {
|
|
182
|
-
key: 0,
|
|
183
|
-
onClick: onSearch
|
|
184
|
-
})) : (openBlock(), createBlock(unref(ElButton), {
|
|
185
|
-
key: 1,
|
|
186
|
-
class: "pro-table_search-form_search-button",
|
|
187
|
-
type: "primary",
|
|
188
|
-
"native-type": "submit",
|
|
189
|
-
onClick: onSearch
|
|
190
|
-
}, {
|
|
191
|
-
default: withCtx(() => [..._cache[1] || (_cache[1] = [
|
|
192
|
-
createTextVNode(" 查询 ", -1)
|
|
193
|
-
])]),
|
|
194
|
-
_: 1
|
|
195
|
-
}))
|
|
196
|
-
], 64)) : createCommentVNode("", true)
|
|
197
|
-
], true),
|
|
198
|
-
renderSlot(_ctx.$slots, "expand-button", { onClick: changeExpandStatus }, () => [
|
|
199
|
-
__props.expandButton !== false && showExpandToggle.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
200
|
-
__props.expandButton ? (openBlock(), createBlock(resolveDynamicComponent(__props.expandButton), {
|
|
201
|
-
key: 0,
|
|
202
|
-
"expand-status": expandStatus.value,
|
|
203
|
-
onClick: changeExpandStatus
|
|
204
|
-
}, null, 8, ["expand-status"])) : (openBlock(), createBlock(unref(ElButton), {
|
|
205
|
-
key: 1,
|
|
206
|
-
text: "",
|
|
207
|
-
class: "pro-table_search-form_expand-toggle-button",
|
|
208
|
-
onClick: changeExpandStatus
|
|
209
|
-
}, {
|
|
210
|
-
default: withCtx(() => [
|
|
211
|
-
createTextVNode(toDisplayString(expandStatus.value ? "收起" : "展开") + " ", 1),
|
|
212
|
-
createVNode(DownOutlined, {
|
|
213
|
-
class: "transition",
|
|
214
|
-
style: normalizeStyle([{ "margin-left": "4px" }, { transform: `rotate(${expandStatus.value ? -180 : 0}deg)` }])
|
|
215
|
-
}, null, 8, ["style"])
|
|
216
|
-
]),
|
|
217
|
-
_: 1
|
|
218
|
-
}))
|
|
219
|
-
], 64)) : createCommentVNode("", true)
|
|
220
|
-
], true)
|
|
221
|
-
]),
|
|
222
|
-
_: 3
|
|
223
|
-
})
|
|
224
|
-
]),
|
|
225
|
-
_: 3
|
|
226
|
-
}, 16, ["form"]);
|
|
227
|
-
};
|
|
228
|
-
}
|
|
229
|
-
});
|
|
230
|
-
const SearchForm = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-d286f62d"]]);
|
|
231
|
-
const _sfc_main$7 = {};
|
|
232
|
-
const _hoisted_1$4 = { class: "pro-table_search-form-container" };
|
|
233
|
-
function _sfc_render$3(_ctx, _cache) {
|
|
234
|
-
return openBlock(), createElementBlock("div", _hoisted_1$4, [
|
|
235
|
-
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
236
|
-
]);
|
|
237
|
-
}
|
|
238
|
-
const DefaultSearchFormContainer = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$3], ["__scopeId", "data-v-45e627f4"]]);
|
|
239
|
-
const _sfc_main$6 = {};
|
|
240
|
-
const _hoisted_1$3 = { class: "pro-table_table-container" };
|
|
241
|
-
function _sfc_render$2(_ctx, _cache) {
|
|
242
|
-
return openBlock(), createElementBlock("div", _hoisted_1$3, [
|
|
243
|
-
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
244
|
-
]);
|
|
245
|
-
}
|
|
246
|
-
const DefaultTableContainer = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", _sfc_render$2], ["__scopeId", "data-v-55d01897"]]);
|
|
247
|
-
const _sfc_main$5 = {};
|
|
248
|
-
const _hoisted_1$2 = {
|
|
249
|
-
focusable: "false",
|
|
250
|
-
"data-icon": "column-height",
|
|
251
|
-
width: "1em",
|
|
252
|
-
height: "1em",
|
|
253
|
-
fill: "currentColor",
|
|
254
|
-
"aria-hidden": "true",
|
|
255
|
-
viewBox: "64 64 896 896"
|
|
256
|
-
};
|
|
257
|
-
function _sfc_render$1(_ctx, _cache) {
|
|
258
|
-
return openBlock(), createElementBlock("svg", _hoisted_1$2, [..._cache[0] || (_cache[0] = [
|
|
259
|
-
createElementVNode("path", { d: "M840 836H184c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h656c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zm0-724H184c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h656c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zM610.8 378c6 0 9.4-7 5.7-11.7L515.7 238.7a7.14 7.14 0 00-11.3 0L403.6 366.3a7.23 7.23 0 005.7 11.7H476v268h-62.8c-6 0-9.4 7-5.7 11.7l100.8 127.5c2.9 3.7 8.5 3.7 11.3 0l100.8-127.5c3.7-4.7.4-11.7-5.7-11.7H548V378h62.8z" }, null, -1)
|
|
260
|
-
])]);
|
|
261
|
-
}
|
|
262
|
-
const ColumnHeightOutlined = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$1]]);
|
|
263
|
-
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
264
|
-
__name: "SizeControl",
|
|
265
|
-
props: {
|
|
266
|
-
"size": {},
|
|
267
|
-
"sizeModifiers": {}
|
|
268
|
-
},
|
|
269
|
-
emits: ["update:size"],
|
|
270
|
-
setup(__props) {
|
|
271
|
-
const size = useModel(__props, "size");
|
|
272
|
-
size.value = size.value ?? "default";
|
|
273
|
-
const items = [
|
|
274
|
-
{ label: "默认", key: "default" },
|
|
275
|
-
{ label: "中等", key: "large" },
|
|
276
|
-
{ label: "紧凑", key: "small" }
|
|
277
|
-
];
|
|
278
|
-
return (_ctx, _cache) => {
|
|
279
|
-
return openBlock(), createBlock(unref(ElDropdown), {
|
|
280
|
-
trigger: "click",
|
|
281
|
-
onCommand: _cache[0] || (_cache[0] = (val) => size.value = val)
|
|
282
|
-
}, {
|
|
283
|
-
dropdown: withCtx(() => [
|
|
284
|
-
createVNode(unref(ElDropdownMenu), null, {
|
|
285
|
-
default: withCtx(() => [
|
|
286
|
-
(openBlock(), createElementBlock(Fragment, null, renderList(items, (item) => {
|
|
287
|
-
return createVNode(unref(ElDropdownItem), {
|
|
288
|
-
key: item.key,
|
|
289
|
-
command: item.key,
|
|
290
|
-
disabled: item.key === size.value
|
|
291
|
-
}, {
|
|
292
|
-
default: withCtx(() => [
|
|
293
|
-
createTextVNode(toDisplayString(item.label), 1)
|
|
294
|
-
]),
|
|
295
|
-
_: 2
|
|
296
|
-
}, 1032, ["command", "disabled"]);
|
|
297
|
-
}), 64))
|
|
298
|
-
]),
|
|
299
|
-
_: 1
|
|
300
|
-
})
|
|
301
|
-
]),
|
|
302
|
-
default: withCtx(() => [
|
|
303
|
-
createVNode(unref(ElButton), {
|
|
304
|
-
text: "",
|
|
305
|
-
class: "pro-table_size-control_button"
|
|
306
|
-
}, {
|
|
307
|
-
default: withCtx(() => [
|
|
308
|
-
createVNode(ColumnHeightOutlined)
|
|
309
|
-
]),
|
|
310
|
-
_: 1
|
|
311
|
-
})
|
|
312
|
-
]),
|
|
313
|
-
_: 1
|
|
314
|
-
});
|
|
315
|
-
};
|
|
316
|
-
}
|
|
317
|
-
});
|
|
318
|
-
const SizeControl = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-7af52d04"]]);
|
|
319
|
-
const _sfc_main$3 = {};
|
|
320
|
-
const _hoisted_1$1 = {
|
|
321
|
-
focusable: "false",
|
|
322
|
-
"data-icon": "filter",
|
|
323
|
-
width: "1em",
|
|
324
|
-
height: "1em",
|
|
325
|
-
fill: "currentColor",
|
|
326
|
-
"aria-hidden": "true",
|
|
327
|
-
viewBox: "64 64 896 896"
|
|
328
|
-
};
|
|
329
|
-
function _sfc_render(_ctx, _cache) {
|
|
330
|
-
return openBlock(), createElementBlock("svg", _hoisted_1$1, [..._cache[0] || (_cache[0] = [
|
|
331
|
-
createElementVNode("path", { d: "M880.1 154H143.9c-24.5 0-39.8 26.7-27.5 48L349 597.4V838c0 17.7 14.2 32 31.8 32h262.4c17.6 0 31.8-14.3 31.8-32V597.4L907.7 202c12.2-21.3-3.1-48-27.6-48zM603.4 798H420.6V642h182.9v156zm9.6-236.6l-9.5 16.6h-183l-9.5-16.6L212.7 226h598.6L613 561.4z" }, null, -1)
|
|
332
|
-
])]);
|
|
333
|
-
}
|
|
334
|
-
const FilterOutlined = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render]]);
|
|
335
|
-
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
336
|
-
__name: "ColumnControl",
|
|
337
|
-
props: {
|
|
338
|
-
columns: {},
|
|
339
|
-
table: { default: () => void 0 }
|
|
340
|
-
},
|
|
341
|
-
setup(__props) {
|
|
342
|
-
const open = ref(false);
|
|
343
|
-
const checkAll = ref(false);
|
|
344
|
-
const indeterminate = ref(false);
|
|
345
|
-
const getColumnKey = (column, index) => {
|
|
346
|
-
const key = column.key ?? column.prop;
|
|
347
|
-
if (key === void 0 || key === null) return `__idx_${index}`;
|
|
348
|
-
return Array.isArray(key) ? key.join(".") : String(key);
|
|
349
|
-
};
|
|
350
|
-
const checkedColumnsOptions = computed(
|
|
351
|
-
() => __props.columns.map((item, index) => ({
|
|
352
|
-
label: String(item.label ?? item.prop ?? `列${index + 1}`),
|
|
353
|
-
value: getColumnKey(item, index),
|
|
354
|
-
checked: !item.hidden,
|
|
355
|
-
column: item
|
|
356
|
-
}))
|
|
357
|
-
);
|
|
358
|
-
const checkedColumnKeys = computed({
|
|
359
|
-
get() {
|
|
360
|
-
return checkedColumnsOptions.value.flatMap(
|
|
361
|
-
(item) => item.checked ? item.value : []
|
|
362
|
-
);
|
|
363
|
-
},
|
|
364
|
-
set(val) {
|
|
365
|
-
checkedColumnsOptions.value.forEach((item) => {
|
|
366
|
-
var _a;
|
|
367
|
-
(_a = __props.table) == null ? void 0 : _a.setColumn(item.value, {
|
|
368
|
-
hidden: !val.includes(item.value)
|
|
369
|
-
});
|
|
370
|
-
});
|
|
371
|
-
}
|
|
372
|
-
});
|
|
373
|
-
const onCheckAllChange = (value) => {
|
|
374
|
-
var _a;
|
|
375
|
-
const checked = !!(((_a = value == null ? void 0 : value.target) == null ? void 0 : _a.checked) ?? value);
|
|
376
|
-
checkedColumnKeys.value = checked ? checkedColumnsOptions.value.map((item) => item.value) : [];
|
|
377
|
-
indeterminate.value = false;
|
|
378
|
-
};
|
|
379
|
-
const toggleColumnsItem = (val) => {
|
|
380
|
-
if (checkedColumnKeys.value.includes(val)) {
|
|
381
|
-
checkedColumnKeys.value = checkedColumnKeys.value.filter(
|
|
382
|
-
(item) => item !== val
|
|
383
|
-
);
|
|
384
|
-
} else {
|
|
385
|
-
checkedColumnKeys.value = [...checkedColumnKeys.value, val];
|
|
386
|
-
}
|
|
387
|
-
};
|
|
388
|
-
watch(
|
|
389
|
-
checkedColumnKeys,
|
|
390
|
-
(val) => {
|
|
391
|
-
indeterminate.value = !!val.length && val.length < checkedColumnsOptions.value.length;
|
|
392
|
-
checkAll.value = val.length > 0 && val.length === checkedColumnsOptions.value.length;
|
|
393
|
-
},
|
|
394
|
-
{ immediate: true }
|
|
395
|
-
);
|
|
396
|
-
return (_ctx, _cache) => {
|
|
397
|
-
return openBlock(), createBlock(unref(ElDropdown), {
|
|
398
|
-
trigger: "click",
|
|
399
|
-
"hide-on-click": false,
|
|
400
|
-
visible: open.value,
|
|
401
|
-
onVisibleChange: _cache[0] || (_cache[0] = (val) => open.value = val)
|
|
402
|
-
}, {
|
|
403
|
-
dropdown: withCtx(() => [
|
|
404
|
-
createVNode(unref(ElDropdownMenu), null, {
|
|
405
|
-
default: withCtx(() => [
|
|
406
|
-
createVNode(unref(ElDropdownItem), {
|
|
407
|
-
disabled: true,
|
|
408
|
-
divided: false
|
|
409
|
-
}, {
|
|
410
|
-
default: withCtx(() => [
|
|
411
|
-
createVNode(unref(ElCheckbox), {
|
|
412
|
-
"model-value": checkAll.value,
|
|
413
|
-
indeterminate: indeterminate.value,
|
|
414
|
-
onChange: onCheckAllChange
|
|
415
|
-
}, {
|
|
416
|
-
default: withCtx(() => [..._cache[1] || (_cache[1] = [
|
|
417
|
-
createTextVNode(" 全选 ", -1)
|
|
418
|
-
])]),
|
|
419
|
-
_: 1
|
|
420
|
-
}, 8, ["model-value", "indeterminate"])
|
|
421
|
-
]),
|
|
422
|
-
_: 1
|
|
423
|
-
}),
|
|
424
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(checkedColumnsOptions.value, (item) => {
|
|
425
|
-
return openBlock(), createBlock(unref(ElDropdownItem), {
|
|
426
|
-
key: item.value,
|
|
427
|
-
command: item.value,
|
|
428
|
-
onClick: withModifiers(($event) => toggleColumnsItem(item.value), ["stop"])
|
|
429
|
-
}, {
|
|
430
|
-
default: withCtx(() => [
|
|
431
|
-
createVNode(unref(ElCheckbox), {
|
|
432
|
-
"model-value": item.checked,
|
|
433
|
-
onChange: () => toggleColumnsItem(item.value)
|
|
434
|
-
}, {
|
|
435
|
-
default: withCtx(() => [
|
|
436
|
-
createTextVNode(toDisplayString(item.label), 1)
|
|
437
|
-
]),
|
|
438
|
-
_: 2
|
|
439
|
-
}, 1032, ["model-value", "onChange"])
|
|
440
|
-
]),
|
|
441
|
-
_: 2
|
|
442
|
-
}, 1032, ["command", "onClick"]);
|
|
443
|
-
}), 128))
|
|
444
|
-
]),
|
|
445
|
-
_: 1
|
|
446
|
-
})
|
|
447
|
-
]),
|
|
448
|
-
default: withCtx(() => [
|
|
449
|
-
createVNode(unref(ElButton), {
|
|
450
|
-
text: "",
|
|
451
|
-
class: "pro-table_column-control_button"
|
|
452
|
-
}, {
|
|
453
|
-
default: withCtx(() => [
|
|
454
|
-
createVNode(FilterOutlined)
|
|
455
|
-
]),
|
|
456
|
-
_: 1
|
|
457
|
-
})
|
|
458
|
-
]),
|
|
459
|
-
_: 1
|
|
460
|
-
}, 8, ["visible"]);
|
|
461
|
-
};
|
|
462
|
-
}
|
|
463
|
-
});
|
|
464
|
-
const ColumnControl = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-ce445821"]]);
|
|
465
|
-
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
466
|
-
...{ name: "TableColumnRenderer" },
|
|
467
|
-
__name: "TableColumnRenderer",
|
|
468
|
-
props: {
|
|
469
|
-
columns: {}
|
|
470
|
-
},
|
|
471
|
-
setup(__props) {
|
|
472
|
-
const getColumnKey = (column, index) => {
|
|
473
|
-
const key = column.key ?? column.prop;
|
|
474
|
-
if (key === void 0 || key === null) return `__idx_${index}`;
|
|
475
|
-
return Array.isArray(key) ? key.join(".") : String(key);
|
|
476
|
-
};
|
|
477
|
-
const getCellValue = (row, column) => {
|
|
478
|
-
const path = column.prop;
|
|
479
|
-
if (!path) return void 0;
|
|
480
|
-
return get(row, toPath(path));
|
|
481
|
-
};
|
|
482
|
-
const normalizedColumns = computed(() => {
|
|
483
|
-
return __props.columns.filter((column) => !column.hidden);
|
|
484
|
-
});
|
|
485
|
-
const getColumnProps = (column) => {
|
|
486
|
-
const { hidden, render, key, ...rest } = column;
|
|
487
|
-
const prop = Array.isArray(column.prop) ? column.prop.join(".") : column.prop ? String(column.prop) : void 0;
|
|
488
|
-
return {
|
|
489
|
-
...rest,
|
|
490
|
-
prop,
|
|
491
|
-
columnKey: key ? String(key) : prop
|
|
492
|
-
};
|
|
493
|
-
};
|
|
494
|
-
return (_ctx, _cache) => {
|
|
495
|
-
return openBlock(true), createElementBlock(Fragment, null, renderList(normalizedColumns.value, (column, index) => {
|
|
496
|
-
return openBlock(), createBlock(unref(ElTableColumn), mergeProps({
|
|
497
|
-
key: getColumnKey(column, index),
|
|
498
|
-
ref_for: true
|
|
499
|
-
}, getColumnProps(column)), {
|
|
500
|
-
default: withCtx((scope) => {
|
|
501
|
-
var _a;
|
|
502
|
-
return [
|
|
503
|
-
typeof column.render === "function" ? (openBlock(), createBlock(resolveDynamicComponent(
|
|
504
|
-
(_a = column.render) == null ? void 0 : _a.call(column, {
|
|
505
|
-
...scope,
|
|
506
|
-
column,
|
|
507
|
-
cellValue: getCellValue(scope.row, column)
|
|
508
|
-
})
|
|
509
|
-
), { key: 0 })) : createCommentVNode("", true)
|
|
510
|
-
];
|
|
511
|
-
}),
|
|
512
|
-
_: 2
|
|
513
|
-
}, 1040);
|
|
514
|
-
}), 128);
|
|
515
|
-
};
|
|
516
|
-
}
|
|
517
|
-
});
|
|
518
|
-
const _hoisted_1 = { class: "pro-table_header" };
|
|
519
|
-
const _hoisted_2 = {
|
|
520
|
-
key: 0,
|
|
521
|
-
class: "pro-table_header_button-bar"
|
|
522
|
-
};
|
|
523
|
-
const _hoisted_3 = {
|
|
524
|
-
key: 1,
|
|
525
|
-
class: "pro-table_header_toolbar"
|
|
526
|
-
};
|
|
527
|
-
const _hoisted_4 = {
|
|
528
|
-
key: 2,
|
|
529
|
-
class: "pro-table_header_size-control"
|
|
530
|
-
};
|
|
531
|
-
const _hoisted_5 = {
|
|
532
|
-
key: 3,
|
|
533
|
-
class: "pro-table_header_column-control"
|
|
534
|
-
};
|
|
535
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
536
|
-
...{ name: "ProTable", inheritAttrs: false },
|
|
537
|
-
__name: "BaseTable",
|
|
538
|
-
props: /* @__PURE__ */ mergeModels({
|
|
539
|
-
table: { default: () => void 0 },
|
|
540
|
-
search: { type: Function, default: void 0 },
|
|
541
|
-
addIndexColumn: { type: Boolean, default: () => void 0 },
|
|
542
|
-
immediateSearch: { type: Boolean, default: () => void 0 },
|
|
543
|
-
control: { type: [Boolean, Object], default: () => void 0 },
|
|
544
|
-
searchFormConfig: { default: () => void 0 },
|
|
545
|
-
tableContainer: { type: [Object, Function, Boolean], default: void 0 },
|
|
546
|
-
columns: { default: () => void 0 },
|
|
547
|
-
data: { default: () => void 0 },
|
|
548
|
-
pagination: { type: [Boolean, Object], default: () => void 0 },
|
|
549
|
-
size: {},
|
|
550
|
-
width: {},
|
|
551
|
-
height: {},
|
|
552
|
-
maxHeight: {},
|
|
553
|
-
fit: { type: Boolean },
|
|
554
|
-
stripe: { type: Boolean },
|
|
555
|
-
border: { type: Boolean },
|
|
556
|
-
rowKey: { type: [String, Function] },
|
|
557
|
-
context: {},
|
|
558
|
-
showHeader: { type: Boolean },
|
|
559
|
-
showSummary: { type: Boolean },
|
|
560
|
-
sumText: {},
|
|
561
|
-
summaryMethod: { type: Function },
|
|
562
|
-
rowClassName: { type: [String, Function] },
|
|
563
|
-
rowStyle: { type: [Object, Function] },
|
|
564
|
-
cellClassName: { type: [String, Function] },
|
|
565
|
-
cellStyle: { type: [Object, Function] },
|
|
566
|
-
headerRowClassName: { type: [String, Function] },
|
|
567
|
-
headerRowStyle: { type: [Object, Function] },
|
|
568
|
-
headerCellClassName: { type: [String, Function] },
|
|
569
|
-
headerCellStyle: { type: [Object, Function] },
|
|
570
|
-
highlightCurrentRow: { type: Boolean },
|
|
571
|
-
currentRowKey: {},
|
|
572
|
-
emptyText: {},
|
|
573
|
-
expandRowKeys: {},
|
|
574
|
-
defaultExpandAll: { type: Boolean },
|
|
575
|
-
rowExpandable: { type: Function },
|
|
576
|
-
defaultSort: {},
|
|
577
|
-
tooltipEffect: {},
|
|
578
|
-
tooltipOptions: {},
|
|
579
|
-
spanMethod: { type: Function },
|
|
580
|
-
selectOnIndeterminate: { type: Boolean },
|
|
581
|
-
indent: {},
|
|
582
|
-
treeProps: {},
|
|
583
|
-
lazy: { type: Boolean },
|
|
584
|
-
load: { type: Function },
|
|
585
|
-
className: {},
|
|
586
|
-
style: { type: [Boolean, null, String, Object, Array] },
|
|
587
|
-
tableLayout: {},
|
|
588
|
-
scrollbarAlwaysOn: { type: Boolean },
|
|
589
|
-
flexible: { type: Boolean },
|
|
590
|
-
showOverflowTooltip: { type: [Boolean, Object] },
|
|
591
|
-
tooltipFormatter: { type: Function },
|
|
592
|
-
appendFilterPanelTo: {},
|
|
593
|
-
scrollbarTabindex: {},
|
|
594
|
-
nativeScrollbar: { type: Boolean }
|
|
595
|
-
}, {
|
|
596
|
-
"size": {},
|
|
597
|
-
"sizeModifiers": {},
|
|
598
|
-
"loading": { type: Boolean },
|
|
599
|
-
"loadingModifiers": {}
|
|
600
|
-
}),
|
|
601
|
-
emits: ["update:size", "update:loading"],
|
|
602
|
-
setup(__props) {
|
|
603
|
-
const config = INJECT_CONFIG["pro-table"];
|
|
604
|
-
const injectProps = inject(config.injectionKey, config.default);
|
|
605
|
-
const tableProperties = Object.keys(tableProps());
|
|
606
|
-
const paginationProperties = Object.keys(paginationProps());
|
|
607
|
-
const attrs = useAttrs();
|
|
608
|
-
const injectTableAttrs = computed(() => {
|
|
609
|
-
return pick(injectProps, tableProperties);
|
|
610
|
-
});
|
|
611
|
-
const attrsTableProps = computed(() => {
|
|
612
|
-
return pick(
|
|
613
|
-
camelizeProperties(attrs),
|
|
614
|
-
tableProperties
|
|
615
|
-
);
|
|
616
|
-
});
|
|
617
|
-
const {
|
|
618
|
-
columns: tableColumns,
|
|
619
|
-
data: tableData,
|
|
620
|
-
searchForm,
|
|
621
|
-
pageParam,
|
|
622
|
-
setPageParam
|
|
623
|
-
} = __props.table || {};
|
|
624
|
-
const size = useModel(__props, "size");
|
|
625
|
-
const loading = useModel(__props, "loading");
|
|
626
|
-
const _search = async () => {
|
|
627
|
-
var _a;
|
|
628
|
-
try {
|
|
629
|
-
loading.value = true;
|
|
630
|
-
await ((_a = __props.search) == null ? void 0 : _a.call(__props));
|
|
631
|
-
} finally {
|
|
632
|
-
loading.value = false;
|
|
633
|
-
}
|
|
634
|
-
};
|
|
635
|
-
const reset = () => {
|
|
636
|
-
var _a;
|
|
637
|
-
(_a = __props.table) == null ? void 0 : _a.resetQueryParams();
|
|
638
|
-
nextTick(() => {
|
|
639
|
-
_search();
|
|
640
|
-
});
|
|
641
|
-
};
|
|
642
|
-
const slots = useSlots();
|
|
643
|
-
const searchFormSlot = slots["search-form"];
|
|
644
|
-
const buttonBarSlot = slots["button-bar"];
|
|
645
|
-
const toolbarSlot = slots["toolbar"];
|
|
646
|
-
const tableSlots = computed(() => {
|
|
647
|
-
const customNames = /* @__PURE__ */ new Set([
|
|
648
|
-
"search-form",
|
|
649
|
-
"button-bar",
|
|
650
|
-
"toolbar",
|
|
651
|
-
"table"
|
|
652
|
-
]);
|
|
653
|
-
return Object.fromEntries(
|
|
654
|
-
Object.entries(slots).filter(([name]) => !customNames.has(name))
|
|
655
|
-
);
|
|
656
|
-
});
|
|
657
|
-
const tableSlotNames = computed(() => Object.keys(tableSlots.value));
|
|
658
|
-
const searchPage1st = () => {
|
|
659
|
-
setPageParam == null ? void 0 : setPageParam({ current: 1 });
|
|
660
|
-
_search();
|
|
661
|
-
};
|
|
662
|
-
const computedSearchFormConfig = computed(() => {
|
|
663
|
-
var _a, _b;
|
|
664
|
-
const container = ((_a = __props.searchFormConfig) == null ? void 0 : _a.container) ?? ((_b = injectProps.searchFormConfig) == null ? void 0 : _b.container) ?? DefaultSearchFormContainer;
|
|
665
|
-
return {
|
|
666
|
-
...injectProps.searchFormConfig,
|
|
667
|
-
...getObject(__props.searchFormConfig),
|
|
668
|
-
container: container ? container : void 0
|
|
669
|
-
};
|
|
670
|
-
});
|
|
671
|
-
const computedTableContainer = computed(() => {
|
|
672
|
-
const container = __props.tableContainer ?? injectProps.tableContainer ?? DefaultTableContainer;
|
|
673
|
-
return container ? container : void 0;
|
|
674
|
-
});
|
|
675
|
-
const normalizedRawColumns = computed(() => {
|
|
676
|
-
const source = __props.columns ?? (tableColumns == null ? void 0 : tableColumns.value) ?? [];
|
|
677
|
-
const normalized = source.map((item, index) => {
|
|
678
|
-
const current = { ...item };
|
|
679
|
-
if (current.label === void 0 && current.title !== void 0) {
|
|
680
|
-
current.label = current.title;
|
|
681
|
-
}
|
|
682
|
-
if (current.prop === void 0 && current.dataIndex !== void 0) {
|
|
683
|
-
current.prop = Array.isArray(current.dataIndex) ? current.dataIndex.join(".") : current.dataIndex;
|
|
684
|
-
}
|
|
685
|
-
if (current.key === void 0) {
|
|
686
|
-
current.key = current.prop ?? (typeof current.columnKey === "string" ? current.columnKey : void 0) ?? `col-${index}`;
|
|
687
|
-
}
|
|
688
|
-
return current;
|
|
689
|
-
});
|
|
690
|
-
if (__props.addIndexColumn ?? injectProps.addIndexColumn) {
|
|
691
|
-
return [
|
|
692
|
-
{
|
|
693
|
-
key: "_index",
|
|
694
|
-
type: "index",
|
|
695
|
-
label: "序号",
|
|
696
|
-
width: 80
|
|
697
|
-
},
|
|
698
|
-
...normalized
|
|
699
|
-
];
|
|
700
|
-
}
|
|
701
|
-
return normalized;
|
|
702
|
-
});
|
|
703
|
-
const computedDataSource = computed(() => {
|
|
704
|
-
const attrsData = attrsTableProps.value.data;
|
|
705
|
-
return __props.data ?? attrsData ?? (tableData == null ? void 0 : tableData.value) ?? [];
|
|
706
|
-
});
|
|
707
|
-
const computedTableProps = computed(() => {
|
|
708
|
-
const merged = {
|
|
709
|
-
...injectTableAttrs.value,
|
|
710
|
-
...attrsTableProps.value
|
|
711
|
-
};
|
|
712
|
-
delete merged.data;
|
|
713
|
-
return merged;
|
|
714
|
-
});
|
|
715
|
-
const computedPagination = computed(() => {
|
|
716
|
-
if (__props.pagination === false) return false;
|
|
717
|
-
const pageConfig = __props.pagination ?? {};
|
|
718
|
-
return {
|
|
719
|
-
...injectProps.pagination,
|
|
720
|
-
...pick(pageConfig, paginationProperties),
|
|
721
|
-
currentPage: pageConfig.currentPage ?? (pageParam == null ? void 0 : pageParam.current) ?? 1,
|
|
722
|
-
pageSize: pageConfig.pageSize ?? (pageParam == null ? void 0 : pageParam.pageSize) ?? 10,
|
|
723
|
-
total: pageConfig.total ?? (pageParam == null ? void 0 : pageParam.total) ?? 0
|
|
724
|
-
};
|
|
725
|
-
});
|
|
726
|
-
const showPagination = computed(() => computedPagination.value !== false);
|
|
727
|
-
const onCurrentChange = (current) => {
|
|
728
|
-
setPageParam == null ? void 0 : setPageParam({ current });
|
|
729
|
-
_search();
|
|
730
|
-
};
|
|
731
|
-
const onSizeChange = (pageSize) => {
|
|
732
|
-
setPageParam == null ? void 0 : setPageParam({ pageSize, current: 1 });
|
|
733
|
-
_search();
|
|
734
|
-
};
|
|
735
|
-
const onPaginationChange = (currentPage, pageSize) => {
|
|
736
|
-
var _a;
|
|
737
|
-
(_a = attrs.onChange) == null ? void 0 : _a.call(attrs, currentPage, pageSize);
|
|
738
|
-
};
|
|
739
|
-
const showSearch = computed(() => {
|
|
740
|
-
var _a, _b;
|
|
741
|
-
return !!(searchFormSlot || ((_a = computedSearchFormConfig.value) == null ? void 0 : _a.hidden) !== true && searchForm && ((_b = searchForm.fields.value.filter((item) => !item.hidden)) == null ? void 0 : _b.length) > 0);
|
|
742
|
-
});
|
|
743
|
-
const computedControl = computed(() => {
|
|
744
|
-
const mergedControl = __props.control ?? injectProps.control;
|
|
745
|
-
const sizeControl = (mergedControl == null ? void 0 : mergedControl.sizeControl) ?? mergedControl;
|
|
746
|
-
const columnControl = (mergedControl == null ? void 0 : mergedControl.columnControl) ?? mergedControl;
|
|
747
|
-
return { sizeControl: !!sizeControl, columnControl: !!columnControl };
|
|
748
|
-
});
|
|
749
|
-
const resolvedSize = computed(() => {
|
|
750
|
-
return size.value ?? attrsTableProps.value.size ?? injectTableAttrs.value.size;
|
|
751
|
-
});
|
|
752
|
-
onMounted(() => {
|
|
753
|
-
if (__props.immediateSearch ?? injectProps.immediateSearch) {
|
|
754
|
-
_search();
|
|
755
|
-
}
|
|
756
|
-
});
|
|
757
|
-
return (_ctx, _cache) => {
|
|
758
|
-
const _directive_loading = resolveDirective("loading");
|
|
759
|
-
return openBlock(), createElementBlock("div", {
|
|
760
|
-
class: normalizeClass(["pro-table", _ctx.$attrs.class]),
|
|
761
|
-
style: normalizeStyle(_ctx.$attrs.style)
|
|
762
|
-
}, [
|
|
763
|
-
showSearch.value ? (openBlock(), createBlock(unref(_sfc_main$b), {
|
|
764
|
-
key: 0,
|
|
765
|
-
component: computedSearchFormConfig.value.container
|
|
766
|
-
}, {
|
|
767
|
-
default: withCtx(() => [
|
|
768
|
-
renderSlot(_ctx.$slots, "search-form", {}, () => [
|
|
769
|
-
unref(searchForm) ? (openBlock(), createBlock(SearchForm, mergeProps({
|
|
770
|
-
key: 0,
|
|
771
|
-
form: unref(searchForm)
|
|
772
|
-
}, computedSearchFormConfig.value, {
|
|
773
|
-
onSearch: searchPage1st,
|
|
774
|
-
onReset: reset
|
|
775
|
-
}), null, 16, ["form"])) : createCommentVNode("", true)
|
|
776
|
-
], true)
|
|
777
|
-
]),
|
|
778
|
-
_: 3
|
|
779
|
-
}, 8, ["component"])) : createCommentVNode("", true),
|
|
780
|
-
createVNode(unref(_sfc_main$b), { component: computedTableContainer.value }, {
|
|
781
|
-
default: withCtx(() => [
|
|
782
|
-
createElementVNode("div", _hoisted_1, [
|
|
783
|
-
unref(buttonBarSlot) ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
784
|
-
renderSlot(_ctx.$slots, "button-bar", {}, void 0, true)
|
|
785
|
-
])) : createCommentVNode("", true),
|
|
786
|
-
unref(toolbarSlot) ? (openBlock(), createElementBlock("div", _hoisted_3, [
|
|
787
|
-
renderSlot(_ctx.$slots, "toolbar", {}, void 0, true)
|
|
788
|
-
])) : createCommentVNode("", true),
|
|
789
|
-
computedControl.value.sizeControl ? (openBlock(), createElementBlock("div", _hoisted_4, [
|
|
790
|
-
createVNode(unref(SizeControl), {
|
|
791
|
-
size: size.value,
|
|
792
|
-
"onUpdate:size": _cache[0] || (_cache[0] = ($event) => size.value = $event)
|
|
793
|
-
}, null, 8, ["size"])
|
|
794
|
-
])) : createCommentVNode("", true),
|
|
795
|
-
computedControl.value.columnControl ? (openBlock(), createElementBlock("div", _hoisted_5, [
|
|
796
|
-
createVNode(unref(ColumnControl), {
|
|
797
|
-
columns: normalizedRawColumns.value,
|
|
798
|
-
table: __props.table
|
|
799
|
-
}, null, 8, ["columns", "table"])
|
|
800
|
-
])) : createCommentVNode("", true)
|
|
801
|
-
]),
|
|
802
|
-
renderSlot(_ctx.$slots, "table", {}, () => [
|
|
803
|
-
withDirectives((openBlock(), createBlock(unref(ElTable), mergeProps({ class: "pro-table_content" }, computedTableProps.value, {
|
|
804
|
-
size: resolvedSize.value,
|
|
805
|
-
data: computedDataSource.value
|
|
806
|
-
}), createSlots({
|
|
807
|
-
default: withCtx(() => [
|
|
808
|
-
createVNode(_sfc_main$1, { columns: normalizedRawColumns.value }, null, 8, ["columns"])
|
|
809
|
-
]),
|
|
810
|
-
_: 2
|
|
811
|
-
}, [
|
|
812
|
-
renderList(tableSlotNames.value, (name) => {
|
|
813
|
-
return {
|
|
814
|
-
name,
|
|
815
|
-
fn: withCtx((scoped) => [
|
|
816
|
-
renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(scoped)), void 0, true)
|
|
817
|
-
])
|
|
818
|
-
};
|
|
819
|
-
})
|
|
820
|
-
]), 1040, ["size", "data"])), [
|
|
821
|
-
[_directive_loading, loading.value]
|
|
822
|
-
])
|
|
823
|
-
], true),
|
|
824
|
-
showPagination.value ? (openBlock(), createBlock(unref(ElPagination), mergeProps({
|
|
825
|
-
key: 0,
|
|
826
|
-
class: "pro-table_pagination"
|
|
827
|
-
}, computedPagination.value, {
|
|
828
|
-
onCurrentChange,
|
|
829
|
-
onSizeChange,
|
|
830
|
-
onChange: onPaginationChange
|
|
831
|
-
}), null, 16)) : createCommentVNode("", true)
|
|
832
|
-
]),
|
|
833
|
-
_: 3
|
|
834
|
-
}, 8, ["component"])
|
|
835
|
-
], 6);
|
|
836
|
-
};
|
|
837
|
-
}
|
|
838
|
-
});
|
|
839
|
-
const BaseTable = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-939fc661"]]);
|
|
840
|
-
const useTable = (params = {}) => {
|
|
841
|
-
const { data, ...rest } = params;
|
|
842
|
-
const coreTable = useTable$1({
|
|
843
|
-
...rest,
|
|
844
|
-
dataSource: data
|
|
845
|
-
});
|
|
846
|
-
const { dataSource, ...tableWithoutDataSource } = coreTable;
|
|
847
|
-
const table = {
|
|
848
|
-
...tableWithoutDataSource,
|
|
849
|
-
data: dataSource
|
|
850
|
-
};
|
|
851
|
-
return table;
|
|
852
|
-
};
|
|
853
|
-
export {
|
|
854
|
-
BaseTable as default,
|
|
855
|
-
useTable
|
|
856
|
-
};
|