ele-admin-plus 1.2.1-beta.6 → 1.2.2-beta.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/README.md +1 -1
- package/es/ele-app/components/form-item-rest.d.ts +4 -0
- package/es/ele-app/components/form-item-rest.js +15 -0
- package/es/ele-data-table/index.d.ts +16 -326
- package/es/ele-data-table/index.js +142 -225
- package/es/ele-data-table/util.d.ts +0 -5
- package/es/ele-data-table/util.js +1 -29
- package/es/ele-dropdown/components/pro-dropdown.d.ts +9 -0
- package/es/ele-dropdown/index.d.ts +15 -389
- package/es/ele-dropdown/index.js +4 -2
- package/es/ele-dropdown/props.d.ts +18 -3
- package/es/ele-dropdown/props.js +6 -1
- package/es/ele-file-list/index.js +2 -1
- package/es/ele-menus/index.d.ts +8 -41
- package/es/ele-menus/index.js +3 -1
- package/es/ele-pro-table/components/table-tools.d.ts +3 -378
- package/es/ele-pro-table/components/table-tools.js +1 -0
- package/es/ele-pro-table/index.d.ts +7 -929
- package/es/ele-pro-table/index.js +19 -5
- package/es/ele-pro-table/props.d.ts +17 -2
- package/es/ele-segmented/index.d.ts +9 -0
- package/es/ele-segmented/index.js +3 -1
- package/es/ele-segmented/props.d.ts +5 -0
- package/es/ele-segmented/props.js +6 -1
- package/es/ele-tab-wrap/components/tab-dropdown.js +2 -1
- package/es/ele-tabs/index.js +1 -0
- package/es/ele-toolbar/index.d.ts +5 -3241
- package/es/ele-virtual-table/index.d.ts +1 -1
- package/es/icons/LoadingOutlined.js +1 -1
- package/lib/ele-app/components/form-item-rest.cjs +14 -0
- package/lib/ele-app/components/form-item-rest.d.ts +4 -0
- package/lib/ele-data-table/index.cjs +139 -222
- package/lib/ele-data-table/index.d.ts +16 -326
- package/lib/ele-data-table/util.cjs +0 -28
- package/lib/ele-data-table/util.d.ts +0 -5
- package/lib/ele-dropdown/components/pro-dropdown.d.ts +9 -0
- package/lib/ele-dropdown/index.cjs +4 -2
- package/lib/ele-dropdown/index.d.ts +15 -389
- package/lib/ele-dropdown/props.cjs +6 -1
- package/lib/ele-dropdown/props.d.ts +18 -3
- package/lib/ele-file-list/index.cjs +2 -1
- package/lib/ele-menus/index.cjs +3 -1
- package/lib/ele-menus/index.d.ts +8 -41
- package/lib/ele-pro-table/components/table-tools.cjs +1 -0
- package/lib/ele-pro-table/components/table-tools.d.ts +3 -378
- package/lib/ele-pro-table/index.cjs +19 -5
- package/lib/ele-pro-table/index.d.ts +7 -929
- package/lib/ele-pro-table/props.d.ts +17 -2
- package/lib/ele-segmented/index.cjs +3 -1
- package/lib/ele-segmented/index.d.ts +9 -0
- package/lib/ele-segmented/props.cjs +6 -1
- package/lib/ele-segmented/props.d.ts +5 -0
- package/lib/ele-tab-wrap/components/tab-dropdown.cjs +2 -1
- package/lib/ele-tabs/index.cjs +1 -0
- package/lib/ele-toolbar/index.d.ts +5 -3241
- package/lib/ele-virtual-table/index.d.ts +1 -1
- package/lib/icons/LoadingOutlined.cjs +1 -1
- package/package.json +1 -1
- package/typings/global.d.ts +1 -1
- package/es/ele-data-table/components/table-columns.d.ts +0 -32
- package/es/ele-data-table/components/table-columns.js +0 -124
- package/lib/ele-data-table/components/table-columns.cjs +0 -123
- package/lib/ele-data-table/components/table-columns.d.ts +0 -32
|
@@ -1,20 +1,29 @@
|
|
|
1
|
-
import { defineComponent, ref, computed, watch, nextTick, onMounted,
|
|
2
|
-
import { ElTable, ElEmpty } from "element-plus";
|
|
1
|
+
import { defineComponent, ref, computed, watch, nextTick, onMounted, createVNode, mergeProps, h } from "vue";
|
|
2
|
+
import { ElTable, ElEmpty, ElTableColumn } from "element-plus";
|
|
3
|
+
import { FilterFilled } from "../icons";
|
|
3
4
|
import { pick, omit, getValue, eachTree } from "../utils/core";
|
|
4
|
-
import
|
|
5
|
-
import { useEmits, useMethods, useStickyHeader, useScrollAlive, isReserveChecked, getGlobalTooltipProps, getStateCols, getBodyRowClass, getHeadRowClass, isDisableRow, getTableFilter, getRowKeys, valueIsChanged, getRowByKey, arrayIsChanged, getKeysAndList, toggleRowSelectionPro } from "./util";
|
|
5
|
+
import { useEmits, useMethods, useStickyHeader, isReserveChecked, getGlobalTooltipProps, getStateCols, getBodyRowClass, getHeadRowClass, isDisableRow, getTableFilter, getRowKeys, valueIsChanged, getRowByKey, arrayIsChanged, getKeysAndList, toggleRowSelectionPro, getCellClass, getFilterPopperClass, getTooltipProps } from "./util";
|
|
6
6
|
import { dataTableProps, dataTableEmits, tablePropKeys } from "./props";
|
|
7
7
|
const ownSlots = ["default", "append", "empty"];
|
|
8
|
-
const
|
|
8
|
+
const index = /* @__PURE__ */ defineComponent({
|
|
9
9
|
name: "EleDataTable",
|
|
10
|
-
components: {
|
|
10
|
+
components: {
|
|
11
|
+
ElTable,
|
|
12
|
+
ElEmpty
|
|
13
|
+
},
|
|
11
14
|
props: dataTableProps,
|
|
12
15
|
emits: dataTableEmits,
|
|
13
|
-
setup(props, {
|
|
16
|
+
setup(props, {
|
|
17
|
+
emit,
|
|
18
|
+
slots,
|
|
19
|
+
expose
|
|
20
|
+
}) {
|
|
14
21
|
const events = useEmits(emit);
|
|
15
22
|
const methods = useMethods(() => tableRef.value);
|
|
16
|
-
const {
|
|
17
|
-
|
|
23
|
+
const {
|
|
24
|
+
isLayoutFixedHead,
|
|
25
|
+
isLayoutMaximized
|
|
26
|
+
} = useStickyHeader();
|
|
18
27
|
const tableState = {
|
|
19
28
|
sorter: props.defaultSort,
|
|
20
29
|
key: null,
|
|
@@ -25,39 +34,17 @@ const _sfc_main = defineComponent({
|
|
|
25
34
|
const tableRef = ref(null);
|
|
26
35
|
const tableCols = ref(props.columns ?? []);
|
|
27
36
|
const tableOverflowTooltip = computed(() => {
|
|
28
|
-
return getGlobalTooltipProps(
|
|
29
|
-
props.showOverflowTooltip,
|
|
30
|
-
props.tooltipEffect,
|
|
31
|
-
props.tooltipOptions
|
|
32
|
-
);
|
|
37
|
+
return getGlobalTooltipProps(props.showOverflowTooltip, props.tooltipEffect, props.tooltipOptions);
|
|
33
38
|
});
|
|
34
39
|
const childKey = computed(() => {
|
|
35
40
|
var _a;
|
|
36
41
|
return ((_a = props.treeProps) == null ? void 0 : _a.children) || "children";
|
|
37
42
|
});
|
|
38
43
|
const tableProps = computed(() => {
|
|
39
|
-
const propKeys = tablePropKeys.filter(
|
|
40
|
-
(k) => ![
|
|
41
|
-
"currentRowKey",
|
|
42
|
-
"showOverflowTooltip",
|
|
43
|
-
"tooltipOptions",
|
|
44
|
-
"tooltipEffect"
|
|
45
|
-
].includes(k)
|
|
46
|
-
);
|
|
44
|
+
const propKeys = tablePropKeys.filter((k) => !["currentRowKey", "showOverflowTooltip", "tooltipOptions", "tooltipEffect"].includes(k));
|
|
47
45
|
return {
|
|
48
46
|
...pick(props, propKeys),
|
|
49
|
-
...omit(events, [
|
|
50
|
-
"onUpdate:currentRowKey",
|
|
51
|
-
"onUpdate:selectedRowKeys",
|
|
52
|
-
"onRowClick",
|
|
53
|
-
"onHeaderClick",
|
|
54
|
-
"onSortChange",
|
|
55
|
-
"onFilterChange",
|
|
56
|
-
"onCurrentChange",
|
|
57
|
-
"onSelect",
|
|
58
|
-
"onSelectAll",
|
|
59
|
-
"onSelectionChange"
|
|
60
|
-
])
|
|
47
|
+
...omit(events, ["onUpdate:currentRowKey", "onUpdate:selectedRowKeys", "onRowClick", "onHeaderClick", "onSortChange", "onFilterChange", "onCurrentChange", "onSelect", "onSelectAll", "onSelectionChange"])
|
|
61
48
|
};
|
|
62
49
|
});
|
|
63
50
|
const handleRowClick = (row, column, event) => {
|
|
@@ -137,11 +124,7 @@ const _sfc_main = defineComponent({
|
|
|
137
124
|
};
|
|
138
125
|
const setSelectedRows = (rows) => {
|
|
139
126
|
if (rows) {
|
|
140
|
-
updateCheckedState(
|
|
141
|
-
getRowKeys(rows, props.rowKey),
|
|
142
|
-
rows,
|
|
143
|
-
!!rows.length
|
|
144
|
-
);
|
|
127
|
+
updateCheckedState(getRowKeys(rows, props.rowKey), rows, !!rows.length);
|
|
145
128
|
}
|
|
146
129
|
};
|
|
147
130
|
const setSelectedRowKeys = (keys) => {
|
|
@@ -150,16 +133,12 @@ const _sfc_main = defineComponent({
|
|
|
150
133
|
}
|
|
151
134
|
};
|
|
152
135
|
const toggleRowExpansionAll = (expanded) => {
|
|
153
|
-
eachTree(
|
|
154
|
-
|
|
155
|
-
(row)
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}
|
|
160
|
-
},
|
|
161
|
-
childKey.value
|
|
162
|
-
);
|
|
136
|
+
eachTree(props.data, (row) => {
|
|
137
|
+
var _a;
|
|
138
|
+
if ((_a = row[childKey.value]) == null ? void 0 : _a.length) {
|
|
139
|
+
methods.toggleRowExpansion(row, expanded);
|
|
140
|
+
}
|
|
141
|
+
}, childKey.value);
|
|
163
142
|
};
|
|
164
143
|
const updateSelectedState = (key, item) => {
|
|
165
144
|
if (!valueIsChanged(tableState.key, key)) {
|
|
@@ -173,22 +152,12 @@ const _sfc_main = defineComponent({
|
|
|
173
152
|
return;
|
|
174
153
|
}
|
|
175
154
|
if (key != null) {
|
|
176
|
-
const row = getRowByKey(
|
|
177
|
-
key,
|
|
178
|
-
props.data,
|
|
179
|
-
props.rowKey,
|
|
180
|
-
childKey.value
|
|
181
|
-
);
|
|
155
|
+
const row = getRowByKey(key, props.data, props.rowKey, childKey.value);
|
|
182
156
|
if (row != null || props.reserveCurrent) {
|
|
183
157
|
tableState.oldRow = tableState.row;
|
|
184
158
|
tableState.row = row || item || void 0;
|
|
185
159
|
if (tableState.row == null && props.cacheData != null) {
|
|
186
|
-
tableState.row = getRowByKey(
|
|
187
|
-
key,
|
|
188
|
-
props.cacheData,
|
|
189
|
-
props.rowKey,
|
|
190
|
-
childKey.value
|
|
191
|
-
);
|
|
160
|
+
tableState.row = getRowByKey(key, props.cacheData, props.rowKey, childKey.value);
|
|
192
161
|
}
|
|
193
162
|
tableState.key = key;
|
|
194
163
|
methods.setCurrentRow(row);
|
|
@@ -210,20 +179,10 @@ const _sfc_main = defineComponent({
|
|
|
210
179
|
if (!force && !arrayIsChanged(tableState.checkedKeys, keys)) {
|
|
211
180
|
return;
|
|
212
181
|
}
|
|
213
|
-
const [dataKeys, list] = getKeysAndList(
|
|
214
|
-
|
|
215
|
-
props.rowKey,
|
|
216
|
-
childKey.value
|
|
217
|
-
);
|
|
218
|
-
const [cacheKeys, cacheList] = getKeysAndList(
|
|
219
|
-
props.cacheData,
|
|
220
|
-
props.rowKey,
|
|
221
|
-
childKey.value
|
|
222
|
-
);
|
|
182
|
+
const [dataKeys, list] = getKeysAndList(props.data, props.rowKey, childKey.value);
|
|
183
|
+
const [cacheKeys, cacheList] = getKeysAndList(props.cacheData, props.rowKey, childKey.value);
|
|
223
184
|
const itemKeys = items ? items.map((d) => getValue(d, props.rowKey)) : [];
|
|
224
|
-
const oldKeys = tableState.checked.map(
|
|
225
|
-
(d) => getValue(d, props.rowKey)
|
|
226
|
-
);
|
|
185
|
+
const oldKeys = tableState.checked.map((d) => getValue(d, props.rowKey));
|
|
227
186
|
const checkedKeys = [];
|
|
228
187
|
const checked = [];
|
|
229
188
|
keys.forEach((key) => {
|
|
@@ -253,7 +212,10 @@ const _sfc_main = defineComponent({
|
|
|
253
212
|
return;
|
|
254
213
|
}
|
|
255
214
|
if (typeof props.rowKey === "string") {
|
|
256
|
-
checked.push({
|
|
215
|
+
checked.push({
|
|
216
|
+
[props.rowKey]: key,
|
|
217
|
+
_isMock: true
|
|
218
|
+
});
|
|
257
219
|
}
|
|
258
220
|
}
|
|
259
221
|
});
|
|
@@ -274,23 +236,13 @@ const _sfc_main = defineComponent({
|
|
|
274
236
|
const updateSelectedAndChecked = () => {
|
|
275
237
|
const key = tableState.key;
|
|
276
238
|
if (key != null) {
|
|
277
|
-
const row = getRowByKey(
|
|
278
|
-
key,
|
|
279
|
-
props.data,
|
|
280
|
-
props.rowKey,
|
|
281
|
-
childKey.value
|
|
282
|
-
);
|
|
239
|
+
const row = getRowByKey(key, props.data, props.rowKey, childKey.value);
|
|
283
240
|
if (row != null) {
|
|
284
241
|
updateSelectedState(key, row);
|
|
285
242
|
} else if (!props.reserveCurrent) {
|
|
286
243
|
updateSelectedState(null);
|
|
287
244
|
} else if (props.cacheData != null) {
|
|
288
|
-
const temp = getRowByKey(
|
|
289
|
-
key,
|
|
290
|
-
props.cacheData,
|
|
291
|
-
props.rowKey,
|
|
292
|
-
childKey.value
|
|
293
|
-
);
|
|
245
|
+
const temp = getRowByKey(key, props.cacheData, props.rowKey, childKey.value);
|
|
294
246
|
if (temp != null) {
|
|
295
247
|
updateSelectedState(key, temp);
|
|
296
248
|
}
|
|
@@ -311,51 +263,40 @@ const _sfc_main = defineComponent({
|
|
|
311
263
|
events["onUpdate:selectedRowKeys"](keys);
|
|
312
264
|
}
|
|
313
265
|
};
|
|
314
|
-
watch(
|
|
315
|
-
|
|
316
|
-
(columns)
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
);
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
methods.
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
}
|
|
336
|
-
});
|
|
337
|
-
}
|
|
338
|
-
},
|
|
339
|
-
{ deep: true }
|
|
340
|
-
);
|
|
266
|
+
watch(() => props.columns, (columns) => {
|
|
267
|
+
tableState.reserveChecked = isReserveChecked(columns);
|
|
268
|
+
if (!columns) {
|
|
269
|
+
tableCols.value = [];
|
|
270
|
+
} else {
|
|
271
|
+
const {
|
|
272
|
+
cols,
|
|
273
|
+
sorter
|
|
274
|
+
} = getStateCols(columns, tableState.sorter, tableState.filter);
|
|
275
|
+
tableCols.value = cols;
|
|
276
|
+
nextTick(() => {
|
|
277
|
+
methods.doLayout();
|
|
278
|
+
updateScrollBar();
|
|
279
|
+
if (sorter) {
|
|
280
|
+
methods.sort(sorter.prop, sorter.order || "ascending");
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
}, {
|
|
285
|
+
deep: true
|
|
286
|
+
});
|
|
341
287
|
watch([() => props.data, () => props.cacheData], () => {
|
|
342
288
|
nextTick(() => {
|
|
343
289
|
updateSelectedAndChecked();
|
|
344
290
|
});
|
|
345
291
|
});
|
|
346
|
-
watch(
|
|
347
|
-
()
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
(selectedRowKeys) => {
|
|
355
|
-
updateCheckedState(selectedRowKeys || []);
|
|
356
|
-
},
|
|
357
|
-
{ deep: true }
|
|
358
|
-
);
|
|
292
|
+
watch(() => props.currentRowKey, (key) => {
|
|
293
|
+
updateSelectedState(key);
|
|
294
|
+
});
|
|
295
|
+
watch(() => props.selectedRowKeys, (selectedRowKeys) => {
|
|
296
|
+
updateCheckedState(selectedRowKeys || []);
|
|
297
|
+
}, {
|
|
298
|
+
deep: true
|
|
299
|
+
});
|
|
359
300
|
onMounted(() => {
|
|
360
301
|
if (props.currentRowKey != null) {
|
|
361
302
|
updateSelectedState(props.currentRowKey);
|
|
@@ -364,24 +305,8 @@ const _sfc_main = defineComponent({
|
|
|
364
305
|
updateCheckedState(props.selectedRowKeys);
|
|
365
306
|
}
|
|
366
307
|
});
|
|
367
|
-
|
|
368
|
-
ownSlots,
|
|
369
|
-
getBodyRowClass,
|
|
370
|
-
getHeadRowClass,
|
|
308
|
+
const exposeValue = {
|
|
371
309
|
...methods,
|
|
372
|
-
isLayoutFixedHead,
|
|
373
|
-
isLayoutMaximized,
|
|
374
|
-
tableRef,
|
|
375
|
-
tableCols,
|
|
376
|
-
tableOverflowTooltip,
|
|
377
|
-
tableProps,
|
|
378
|
-
handleRowClick,
|
|
379
|
-
handleHeaderClick,
|
|
380
|
-
handleSortChange,
|
|
381
|
-
handleFilterChange,
|
|
382
|
-
handleCurrentChange,
|
|
383
|
-
handleSelect,
|
|
384
|
-
handleSelectAll,
|
|
385
310
|
clearSort,
|
|
386
311
|
clearSelection,
|
|
387
312
|
toggleRowSelection,
|
|
@@ -391,90 +316,82 @@ const _sfc_main = defineComponent({
|
|
|
391
316
|
setSelectedRows,
|
|
392
317
|
setSelectedRowKeys,
|
|
393
318
|
toggleRowExpansionAll,
|
|
394
|
-
updateSelectedAndChecked
|
|
319
|
+
updateSelectedAndChecked,
|
|
320
|
+
tableRef
|
|
321
|
+
};
|
|
322
|
+
expose(exposeValue);
|
|
323
|
+
const renderTableColumn = (col) => {
|
|
324
|
+
return createVNode(ElTableColumn, mergeProps(omit(col, ["showOverflowTooltip", "filterClassName", "columnKey", "className", "uid", "slot", "headerSlot", "hideInTable", "hideInSetting", "hideInExport", "hideInPrint", "printSlot", "children"]), {
|
|
325
|
+
"key": col.uid ?? col.columnKey ?? col.prop,
|
|
326
|
+
"index": col.index ?? props.pageIndex,
|
|
327
|
+
"className": getCellClass(col),
|
|
328
|
+
"columnKey": col.columnKey ?? col.prop,
|
|
329
|
+
"filterClassName": getFilterPopperClass(col.filterClassName),
|
|
330
|
+
"showOverflowTooltip": getTooltipProps(col.showOverflowTooltip, tableOverflowTooltip.value)
|
|
331
|
+
}), {
|
|
332
|
+
header: (slotProps) => {
|
|
333
|
+
var _a, _b, _c;
|
|
334
|
+
return createVNode("div", {
|
|
335
|
+
"class": "ele-cell-title",
|
|
336
|
+
"title": (_a = slotProps == null ? void 0 : slotProps.column) == null ? void 0 : _a.label
|
|
337
|
+
}, [col.headerSlot && !ownSlots.includes(col.headerSlot) && slots[col.headerSlot] ? (_b = slots[col.headerSlot]) == null ? void 0 : _b.call(slots, slotProps) : (_c = slotProps == null ? void 0 : slotProps.column) == null ? void 0 : _c.label]);
|
|
338
|
+
},
|
|
339
|
+
["filter-icon"]: (slotProps) => {
|
|
340
|
+
var _a;
|
|
341
|
+
return !col.filterIcon ? createVNode(FilterFilled, null, null) : typeof col.filterIcon === "string" && !ownSlots.includes(col.filterIcon) && slots[col.filterIcon] ? (_a = slots[col.filterIcon]) == null ? void 0 : _a.call(slots, slotProps) : h(col.filterIcon);
|
|
342
|
+
},
|
|
343
|
+
default: (slotProps) => {
|
|
344
|
+
var _a;
|
|
345
|
+
return col.slot && !ownSlots.includes(col.slot) && slots[col.slot] && (!props.slotNormalize || (slotProps == null ? void 0 : slotProps.$index) != -1) ? (_a = slots[col.slot]) == null ? void 0 : _a.call(slots, slotProps) : col.children && col.children.length ? col.children.map(renderTableColumn) : void 0;
|
|
346
|
+
}
|
|
347
|
+
});
|
|
395
348
|
};
|
|
349
|
+
return () => createVNode(ElTable, mergeProps(tableProps.value, {
|
|
350
|
+
"ref": tableRef,
|
|
351
|
+
"emptyText": props.errorText || props.emptyText,
|
|
352
|
+
"rowClassName": (param) => getBodyRowClass(props.rowClassName, param),
|
|
353
|
+
"headerRowClassName": (param) => getHeadRowClass(props.headerRowClassName, param, props.headerEllipsis),
|
|
354
|
+
"class": ["ele-data-table", {
|
|
355
|
+
"is-sticky": props.sticky
|
|
356
|
+
}, {
|
|
357
|
+
"is-layout-fixed-head": props.sticky && isLayoutFixedHead.value
|
|
358
|
+
}, {
|
|
359
|
+
"is-layout-maximized": props.sticky && isLayoutMaximized.value
|
|
360
|
+
}, {
|
|
361
|
+
"is-sticky": props.sticky
|
|
362
|
+
}, {
|
|
363
|
+
"hide-header": !props.showHeader
|
|
364
|
+
}, {
|
|
365
|
+
"hide-bottom-line": !props.bottomLine
|
|
366
|
+
}],
|
|
367
|
+
"onRowClick": handleRowClick,
|
|
368
|
+
"onHeaderClick": handleHeaderClick,
|
|
369
|
+
"onSortChange": handleSortChange,
|
|
370
|
+
"onFilterChange": handleFilterChange,
|
|
371
|
+
"onCurrentChange": handleCurrentChange,
|
|
372
|
+
"onSelect": handleSelect,
|
|
373
|
+
"onSelectAll": handleSelectAll
|
|
374
|
+
}), {
|
|
375
|
+
append: slots.append ? (slotProps) => {
|
|
376
|
+
var _a;
|
|
377
|
+
return (_a = slots.append) == null ? void 0 : _a.call(slots, slotProps);
|
|
378
|
+
} : void 0,
|
|
379
|
+
empty: slots.empty ? () => {
|
|
380
|
+
var _a;
|
|
381
|
+
return (_a = slots.empty) == null ? void 0 : _a.call(slots, {
|
|
382
|
+
text: props.emptyText,
|
|
383
|
+
error: props.errorText
|
|
384
|
+
});
|
|
385
|
+
} : props.emptyProps ? () => createVNode(ElEmpty, mergeProps({
|
|
386
|
+
"imageSize": 68
|
|
387
|
+
}, !props.emptyProps || props.emptyProps === true ? {} : props.emptyProps, {
|
|
388
|
+
"description": props.errorText || props.emptyText,
|
|
389
|
+
"class": "ele-table-empty"
|
|
390
|
+
}), null) : void 0,
|
|
391
|
+
default: () => tableCols.value.map(renderTableColumn)
|
|
392
|
+
});
|
|
396
393
|
}
|
|
397
394
|
});
|
|
398
|
-
const _export_sfc = (sfc, props) => {
|
|
399
|
-
const target = sfc.__vccOpts || sfc;
|
|
400
|
-
for (const [key, val] of props) {
|
|
401
|
-
target[key] = val;
|
|
402
|
-
}
|
|
403
|
-
return target;
|
|
404
|
-
};
|
|
405
|
-
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
406
|
-
const _component_TableColumns = resolveComponent("TableColumns");
|
|
407
|
-
const _component_ElEmpty = resolveComponent("ElEmpty");
|
|
408
|
-
const _component_ElTable = resolveComponent("ElTable");
|
|
409
|
-
return openBlock(), createBlock(_component_ElTable, mergeProps(_ctx.tableProps, {
|
|
410
|
-
ref: "tableRef",
|
|
411
|
-
emptyText: _ctx.errorText || _ctx.emptyText,
|
|
412
|
-
rowClassName: (param) => _ctx.getBodyRowClass(_ctx.rowClassName, param),
|
|
413
|
-
headerRowClassName: (param) => _ctx.getHeadRowClass(_ctx.headerRowClassName, param, _ctx.headerEllipsis),
|
|
414
|
-
class: [
|
|
415
|
-
"ele-data-table",
|
|
416
|
-
{ "is-sticky": _ctx.sticky },
|
|
417
|
-
{ "is-layout-fixed-head": _ctx.sticky && _ctx.isLayoutFixedHead },
|
|
418
|
-
{ "is-layout-maximized": _ctx.sticky && _ctx.isLayoutMaximized },
|
|
419
|
-
{ "is-sticky": _ctx.sticky },
|
|
420
|
-
{ "hide-header": !_ctx.showHeader },
|
|
421
|
-
{ "hide-bottom-line": !_ctx.bottomLine }
|
|
422
|
-
],
|
|
423
|
-
onRowClick: _ctx.handleRowClick,
|
|
424
|
-
onHeaderClick: _ctx.handleHeaderClick,
|
|
425
|
-
onSortChange: _ctx.handleSortChange,
|
|
426
|
-
onFilterChange: _ctx.handleFilterChange,
|
|
427
|
-
onCurrentChange: _ctx.handleCurrentChange,
|
|
428
|
-
onSelect: _ctx.handleSelect,
|
|
429
|
-
onSelectAll: _ctx.handleSelectAll
|
|
430
|
-
}), createSlots({
|
|
431
|
-
default: withCtx(() => [
|
|
432
|
-
_ctx.tableCols && _ctx.tableCols.length ? (openBlock(), createBlock(_component_TableColumns, {
|
|
433
|
-
key: 0,
|
|
434
|
-
columns: _ctx.tableCols,
|
|
435
|
-
pageIndex: _ctx.pageIndex,
|
|
436
|
-
slotNormalize: _ctx.slotNormalize,
|
|
437
|
-
globalTooltip: _ctx.tableOverflowTooltip
|
|
438
|
-
}, createSlots({ _: 2 }, [
|
|
439
|
-
renderList(Object.keys(_ctx.$slots).filter((k) => !_ctx.ownSlots.includes(k)), (name) => {
|
|
440
|
-
return {
|
|
441
|
-
name,
|
|
442
|
-
fn: withCtx((slotProps) => [
|
|
443
|
-
renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(slotProps || {})))
|
|
444
|
-
])
|
|
445
|
-
};
|
|
446
|
-
})
|
|
447
|
-
]), 1032, ["columns", "pageIndex", "slotNormalize", "globalTooltip"])) : createCommentVNode("", true)
|
|
448
|
-
]),
|
|
449
|
-
_: 2
|
|
450
|
-
}, [
|
|
451
|
-
_ctx.$slots.append ? {
|
|
452
|
-
name: "append",
|
|
453
|
-
fn: withCtx((slotProps) => [
|
|
454
|
-
renderSlot(_ctx.$slots, "append", normalizeProps(guardReactiveProps(slotProps || {})))
|
|
455
|
-
]),
|
|
456
|
-
key: "0"
|
|
457
|
-
} : void 0,
|
|
458
|
-
_ctx.$slots.empty || _ctx.emptyProps ? {
|
|
459
|
-
name: "empty",
|
|
460
|
-
fn: withCtx(() => [
|
|
461
|
-
_ctx.$slots.empty ? renderSlot(_ctx.$slots, "empty", {
|
|
462
|
-
key: 0,
|
|
463
|
-
text: _ctx.emptyText,
|
|
464
|
-
error: _ctx.errorText
|
|
465
|
-
}) : _ctx.emptyProps ? (openBlock(), createBlock(_component_ElEmpty, mergeProps({
|
|
466
|
-
key: 1,
|
|
467
|
-
imageSize: 68
|
|
468
|
-
}, !_ctx.emptyProps || _ctx.emptyProps === true ? {} : _ctx.emptyProps, {
|
|
469
|
-
description: _ctx.errorText || _ctx.emptyText,
|
|
470
|
-
class: "ele-table-empty"
|
|
471
|
-
}), null, 16, ["description"])) : createCommentVNode("", true)
|
|
472
|
-
]),
|
|
473
|
-
key: "1"
|
|
474
|
-
} : void 0
|
|
475
|
-
]), 1040, ["emptyText", "rowClassName", "headerRowClassName", "class", "onRowClick", "onHeaderClick", "onSortChange", "onFilterChange", "onCurrentChange", "onSelect", "onSelectAll"]);
|
|
476
|
-
}
|
|
477
|
-
const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
478
395
|
export {
|
|
479
396
|
index as default
|
|
480
397
|
};
|
|
@@ -138,11 +138,6 @@ export declare function useStickyHeader(): {
|
|
|
138
138
|
isLayoutFixedHead: import('vue').ComputedRef<boolean | undefined>;
|
|
139
139
|
isLayoutMaximized: import('vue').ComputedRef<boolean | undefined>;
|
|
140
140
|
};
|
|
141
|
-
/**
|
|
142
|
-
* 表格滚动条适配 KeepAlive
|
|
143
|
-
* @param getInstance 获取表格实例方法
|
|
144
|
-
*/
|
|
145
|
-
export declare function useScrollAlive(getInstance: GetInstance): void;
|
|
146
141
|
/**
|
|
147
142
|
* 表格实例方法统一处理
|
|
148
143
|
* @param getInstance 获取表格实例方法
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { unref, computed
|
|
1
|
+
import { unref, computed } from "vue";
|
|
2
2
|
import { mapTree, findTree, eachTree, getValue } from "../utils/core";
|
|
3
3
|
import { useLayoutState } from "../ele-pro-layout/util";
|
|
4
4
|
function getRowClass(rowClass, param) {
|
|
@@ -213,33 +213,6 @@ function useStickyHeader() {
|
|
|
213
213
|
);
|
|
214
214
|
return { isLayoutFixedHead, isLayoutMaximized };
|
|
215
215
|
}
|
|
216
|
-
function useScrollAlive(getInstance) {
|
|
217
|
-
let scrollTop;
|
|
218
|
-
let scrollLeft;
|
|
219
|
-
const getWrapEl = () => {
|
|
220
|
-
var _a;
|
|
221
|
-
const ins = getInstance();
|
|
222
|
-
return (_a = ins == null ? void 0 : ins.scrollBarRef) == null ? void 0 : _a.wrapRef;
|
|
223
|
-
};
|
|
224
|
-
onDeactivated(() => {
|
|
225
|
-
const wrapEl = getWrapEl();
|
|
226
|
-
if (!wrapEl) {
|
|
227
|
-
scrollTop = void 0;
|
|
228
|
-
scrollLeft = void 0;
|
|
229
|
-
return;
|
|
230
|
-
}
|
|
231
|
-
scrollTop = wrapEl.scrollTop;
|
|
232
|
-
scrollLeft = wrapEl.scrollLeft;
|
|
233
|
-
});
|
|
234
|
-
onActivated(() => {
|
|
235
|
-
const ins = getInstance();
|
|
236
|
-
if (ins && (scrollTop || scrollLeft)) {
|
|
237
|
-
ins.scrollTo(scrollLeft || 0, scrollTop || 0);
|
|
238
|
-
scrollTop = void 0;
|
|
239
|
-
scrollLeft = void 0;
|
|
240
|
-
}
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
216
|
function useMethods(getInstance) {
|
|
244
217
|
const methods = {
|
|
245
218
|
clearSelection: () => {
|
|
@@ -413,7 +386,6 @@ export {
|
|
|
413
386
|
toggleRowSelectionPro,
|
|
414
387
|
useEmits,
|
|
415
388
|
useMethods,
|
|
416
|
-
useScrollAlive,
|
|
417
389
|
useStickyHeader,
|
|
418
390
|
valueIsChanged
|
|
419
391
|
};
|
|
@@ -17,6 +17,10 @@ declare const _default: import('vue').DefineComponent<{
|
|
|
17
17
|
preventContextmenu: BooleanConstructor;
|
|
18
18
|
splitButtonProps: PropType<import('../../ele-app/el').ElButtonProps>;
|
|
19
19
|
caretButtonProps: PropType<import('../../ele-app/el').ElButtonProps>;
|
|
20
|
+
formValidate: {
|
|
21
|
+
type: BooleanConstructor;
|
|
22
|
+
default: boolean;
|
|
23
|
+
};
|
|
20
24
|
type: {
|
|
21
25
|
readonly type: import('vue').PropType<import('element-plus/es/utils/index').EpPropMergeType<(new (...args: any[]) => import('element-plus/es/utils/index').EpPropMergeType<StringConstructor, "" | "text" | "default" | "success" | "warning" | "info" | "primary" | "danger", unknown> & {}) | (() => import('element-plus/es/utils/index').EpPropMergeType<StringConstructor, "" | "text" | "default" | "success" | "warning" | "info" | "primary" | "danger", unknown>) | ((new (...args: any[]) => import('element-plus/es/utils/index').EpPropMergeType<StringConstructor, "" | "text" | "default" | "success" | "warning" | "info" | "primary" | "danger", unknown> & {}) | (() => import('element-plus/es/utils/index').EpPropMergeType<StringConstructor, "" | "text" | "default" | "success" | "warning" | "info" | "primary" | "danger", unknown>))[], unknown, unknown>>;
|
|
22
26
|
readonly required: false;
|
|
@@ -128,6 +132,10 @@ declare const _default: import('vue').DefineComponent<{
|
|
|
128
132
|
preventContextmenu: BooleanConstructor;
|
|
129
133
|
splitButtonProps: PropType<import('../../ele-app/el').ElButtonProps>;
|
|
130
134
|
caretButtonProps: PropType<import('../../ele-app/el').ElButtonProps>;
|
|
135
|
+
formValidate: {
|
|
136
|
+
type: BooleanConstructor;
|
|
137
|
+
default: boolean;
|
|
138
|
+
};
|
|
131
139
|
type: {
|
|
132
140
|
readonly type: import('vue').PropType<import('element-plus/es/utils/index').EpPropMergeType<(new (...args: any[]) => import('element-plus/es/utils/index').EpPropMergeType<StringConstructor, "" | "text" | "default" | "success" | "warning" | "info" | "primary" | "danger", unknown> & {}) | (() => import('element-plus/es/utils/index').EpPropMergeType<StringConstructor, "" | "text" | "default" | "success" | "warning" | "info" | "primary" | "danger", unknown>) | ((new (...args: any[]) => import('element-plus/es/utils/index').EpPropMergeType<StringConstructor, "" | "text" | "default" | "success" | "warning" | "info" | "primary" | "danger", unknown> & {}) | (() => import('element-plus/es/utils/index').EpPropMergeType<StringConstructor, "" | "text" | "default" | "success" | "warning" | "info" | "primary" | "danger", unknown>))[], unknown, unknown>>;
|
|
133
141
|
readonly required: false;
|
|
@@ -234,5 +242,6 @@ declare const _default: import('vue').DefineComponent<{
|
|
|
234
242
|
virtualTriggering: boolean;
|
|
235
243
|
gpuAcceleration: import('element-plus/es/utils/index').EpPropMergeType<BooleanConstructor, unknown, unknown>;
|
|
236
244
|
preventContextmenu: boolean;
|
|
245
|
+
formValidate: boolean;
|
|
237
246
|
}, {}>;
|
|
238
247
|
export default _default;
|