ele-admin-plus 1.1.9-beta.8 → 1.1.9-beta.9
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/es/ele-app/el.d.ts +6 -1
- package/es/ele-app/plus.d.ts +9 -0
- package/es/ele-config-provider/index.d.ts +2 -2
- package/es/ele-config-provider/props.d.ts +3 -3
- package/es/ele-config-provider/props.js +2 -2
- package/es/ele-config-provider/types.d.ts +2 -0
- package/es/ele-data-table/index.d.ts +2 -2
- package/es/ele-data-table/index.js +8 -0
- package/es/ele-data-table/style/index.scss +4 -0
- package/es/ele-data-table/types.d.ts +10 -0
- package/es/ele-data-table/util.d.ts +5 -0
- package/es/ele-data-table/util.js +14 -0
- package/es/ele-modal/style/index.scss +18 -29
- package/es/ele-pagination/index.d.ts +4 -2
- package/es/ele-pagination/index.js +17 -5
- package/es/ele-pagination/props.d.ts +3 -2
- package/es/ele-pagination/props.js +2 -0
- package/es/ele-pagination/style/index.scss +9 -0
- package/es/ele-pagination/types.d.ts +6 -1
- package/es/ele-printer/util.js +1 -1
- package/es/ele-pro-table/components/table-tools.d.ts +99 -8
- package/es/ele-pro-table/components/table-tools.js +125 -8
- package/es/ele-pro-table/components/tool-column-list.js +1 -0
- package/es/ele-pro-table/components/tool-column.js +6 -2
- package/es/ele-pro-table/components/tool-export.d.ts +457 -0
- package/es/ele-pro-table/components/tool-export.js +451 -0
- package/es/ele-pro-table/components/tool-print-body-cell.d.ts +34 -0
- package/es/ele-pro-table/components/tool-print-body-cell.js +88 -0
- package/es/ele-pro-table/components/tool-print-header-cell.d.ts +34 -0
- package/es/ele-pro-table/components/tool-print-header-cell.js +88 -0
- package/es/ele-pro-table/components/tool-print.d.ts +899 -0
- package/es/ele-pro-table/components/tool-print.js +547 -0
- package/es/ele-pro-table/index.d.ts +28 -9
- package/es/ele-pro-table/index.js +56 -8
- package/es/ele-pro-table/props.d.ts +11 -5
- package/es/ele-pro-table/props.js +6 -2
- package/es/ele-pro-table/style/index.js +9 -0
- package/es/ele-pro-table/style/index.scss +33 -5
- package/es/ele-pro-table/types.d.ts +147 -5
- package/es/ele-pro-table/util.d.ts +47 -3
- package/es/ele-pro-table/util.js +119 -13
- package/es/ele-table/index.d.ts +3 -0
- package/es/ele-table/index.js +2 -1
- package/es/ele-table/props.d.ts +2 -0
- package/es/ele-table/props.js +3 -1
- package/es/ele-table/style/index.scss +35 -0
- package/es/ele-tool/index.d.ts +1 -1
- package/es/ele-tool/index.js +2 -4
- package/es/ele-tool/props.d.ts +7 -0
- package/es/ele-tool/props.js +5 -0
- package/es/ele-virtual-table/components/body-cell.d.ts +0 -1
- package/es/ele-virtual-table/components/body-cell.js +32 -47
- package/es/ele-virtual-table/components/footer-row.d.ts +2 -2
- package/es/ele-virtual-table/components/footer-row.js +15 -10
- package/es/ele-virtual-table/types.d.ts +15 -1
- package/es/ele-virtual-table/util.d.ts +26 -3
- package/es/ele-virtual-table/util.js +44 -0
- package/es/icons/PrinterOutlined.d.ts +2 -0
- package/es/icons/PrinterOutlined.js +29 -0
- package/es/icons/VerticalLeftOutlined.js +2 -2
- package/es/icons/VerticalRightOutlined.js +2 -2
- package/es/icons/index.d.ts +1 -0
- package/es/icons/index.js +58 -56
- package/es/lang/en_US.js +13 -2
- package/es/lang/zh_CN.js +13 -2
- package/es/lang/zh_TW.js +12 -1
- package/es/utils/resolvers.js +2 -2
- package/lib/ele-app/el.d.ts +6 -1
- package/lib/ele-app/plus.d.ts +9 -0
- package/lib/ele-config-provider/index.d.ts +2 -2
- package/lib/ele-config-provider/props.cjs +2 -2
- package/lib/ele-config-provider/props.d.ts +3 -3
- package/lib/ele-config-provider/types.d.ts +2 -0
- package/lib/ele-data-table/index.cjs +8 -0
- package/lib/ele-data-table/index.d.ts +2 -2
- package/lib/ele-data-table/style/index.scss +4 -0
- package/lib/ele-data-table/types.d.ts +10 -0
- package/lib/ele-data-table/util.cjs +14 -0
- package/lib/ele-data-table/util.d.ts +5 -0
- package/lib/ele-modal/style/index.scss +18 -29
- package/lib/ele-pagination/index.cjs +16 -4
- package/lib/ele-pagination/index.d.ts +4 -2
- package/lib/ele-pagination/props.cjs +2 -0
- package/lib/ele-pagination/props.d.ts +3 -2
- package/lib/ele-pagination/style/index.scss +9 -0
- package/lib/ele-pagination/types.d.ts +6 -1
- package/lib/ele-printer/util.cjs +1 -1
- package/lib/ele-pro-table/components/table-tools.cjs +124 -7
- package/lib/ele-pro-table/components/table-tools.d.ts +99 -8
- package/lib/ele-pro-table/components/tool-column-list.cjs +1 -0
- package/lib/ele-pro-table/components/tool-column.cjs +6 -2
- package/lib/ele-pro-table/components/tool-export.cjs +450 -0
- package/lib/ele-pro-table/components/tool-export.d.ts +457 -0
- package/lib/ele-pro-table/components/tool-print-body-cell.cjs +87 -0
- package/lib/ele-pro-table/components/tool-print-body-cell.d.ts +34 -0
- package/lib/ele-pro-table/components/tool-print-header-cell.cjs +87 -0
- package/lib/ele-pro-table/components/tool-print-header-cell.d.ts +34 -0
- package/lib/ele-pro-table/components/tool-print.cjs +546 -0
- package/lib/ele-pro-table/components/tool-print.d.ts +899 -0
- package/lib/ele-pro-table/index.cjs +56 -8
- package/lib/ele-pro-table/index.d.ts +28 -9
- package/lib/ele-pro-table/props.cjs +6 -2
- package/lib/ele-pro-table/props.d.ts +11 -5
- package/lib/ele-pro-table/style/index.cjs +9 -0
- package/lib/ele-pro-table/style/index.scss +33 -5
- package/lib/ele-pro-table/types.d.ts +147 -5
- package/lib/ele-pro-table/util.cjs +119 -13
- package/lib/ele-pro-table/util.d.ts +47 -3
- package/lib/ele-table/index.cjs +2 -1
- package/lib/ele-table/index.d.ts +3 -0
- package/lib/ele-table/props.cjs +3 -1
- package/lib/ele-table/props.d.ts +2 -0
- package/lib/ele-table/style/index.scss +35 -0
- package/lib/ele-tool/index.cjs +1 -3
- package/lib/ele-tool/index.d.ts +1 -1
- package/lib/ele-tool/props.cjs +5 -0
- package/lib/ele-tool/props.d.ts +7 -0
- package/lib/ele-virtual-table/components/body-cell.cjs +31 -46
- package/lib/ele-virtual-table/components/body-cell.d.ts +0 -1
- package/lib/ele-virtual-table/components/footer-row.cjs +13 -8
- package/lib/ele-virtual-table/components/footer-row.d.ts +2 -2
- package/lib/ele-virtual-table/types.d.ts +15 -1
- package/lib/ele-virtual-table/util.cjs +44 -0
- package/lib/ele-virtual-table/util.d.ts +26 -3
- package/lib/icons/PrinterOutlined.cjs +28 -0
- package/lib/icons/PrinterOutlined.d.ts +2 -0
- package/lib/icons/VerticalLeftOutlined.cjs +2 -2
- package/lib/icons/VerticalRightOutlined.cjs +2 -2
- package/lib/icons/index.cjs +2 -0
- package/lib/icons/index.d.ts +1 -0
- package/lib/lang/en_US.cjs +13 -2
- package/lib/lang/zh_CN.cjs +13 -2
- package/lib/lang/zh_TW.cjs +12 -1
- package/lib/utils/resolvers.cjs +2 -2
- package/package.json +1 -1
package/es/ele-pro-table/util.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { omit, eachTree, findTree, uuid, mapTree } from "../utils/core";
|
|
1
2
|
import { getValue } from "../ele-data-table/util";
|
|
2
|
-
import {
|
|
3
|
+
import { getIndexValue, analyseColumns, getCellSpan, getUserSums, getSumValue } from "../ele-virtual-table/util";
|
|
3
4
|
function mergeProps(props, globalProps) {
|
|
4
5
|
if (props == null) {
|
|
5
6
|
return globalProps ?? true;
|
|
@@ -230,7 +231,7 @@ function getInitCacheColumns(columns, cacheKey, sortable) {
|
|
|
230
231
|
}
|
|
231
232
|
return getCheckedColumns(columns, cache, sortable);
|
|
232
233
|
}
|
|
233
|
-
function getCheckedColumns(columns, cols, sortable) {
|
|
234
|
+
function getCheckedColumns(columns, cols, sortable, filter) {
|
|
234
235
|
const data = [];
|
|
235
236
|
if (!columns || !columns.length) {
|
|
236
237
|
return data;
|
|
@@ -240,26 +241,23 @@ function getCheckedColumns(columns, cols, sortable) {
|
|
|
240
241
|
if (colId == null) {
|
|
241
242
|
return;
|
|
242
243
|
}
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
return false;
|
|
248
|
-
}
|
|
249
|
-
});
|
|
244
|
+
if (filter && !filter(d)) {
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
const temp = findTree(cols, (t) => t.uid === colId);
|
|
250
248
|
if (temp && !temp.checked) {
|
|
251
249
|
return;
|
|
252
250
|
}
|
|
253
251
|
const fixed = (temp == null ? void 0 : temp.fixed) ?? d.fixed;
|
|
254
252
|
const uid = uuid(8);
|
|
255
|
-
if (d.children) {
|
|
256
|
-
const children = getCheckedColumns(d.children, cols, sortable);
|
|
253
|
+
if (d.children && d.children.length) {
|
|
254
|
+
const children = getCheckedColumns(d.children, cols, sortable, filter);
|
|
257
255
|
if (children.length) {
|
|
258
256
|
data.push({ ...d, fixed, uid, children });
|
|
259
257
|
}
|
|
260
|
-
|
|
261
|
-
data.push({ ...d, fixed, uid });
|
|
258
|
+
return;
|
|
262
259
|
}
|
|
260
|
+
data.push({ ...d, fixed, uid });
|
|
263
261
|
});
|
|
264
262
|
if (!sortable || !data.length) {
|
|
265
263
|
return data;
|
|
@@ -305,6 +303,22 @@ function getCheckedColumns(columns, cols, sortable) {
|
|
|
305
303
|
});
|
|
306
304
|
return data;
|
|
307
305
|
}
|
|
306
|
+
function getColItems(columns, untitledText, filter) {
|
|
307
|
+
return mapTree(columns, (d) => {
|
|
308
|
+
const colId = getColId(d);
|
|
309
|
+
if (!colId || filter && !filter(d)) {
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
return {
|
|
313
|
+
uid: colId,
|
|
314
|
+
prop: d.prop,
|
|
315
|
+
columnKey: d.columnKey,
|
|
316
|
+
label: d.label || untitledText,
|
|
317
|
+
checked: !d.hideInTable,
|
|
318
|
+
fixed: d.fixed
|
|
319
|
+
};
|
|
320
|
+
});
|
|
321
|
+
}
|
|
308
322
|
function getSettingCols(columns, untitledText, cacheKey) {
|
|
309
323
|
const cacheResult = getCacheCols(cacheKey);
|
|
310
324
|
if (cacheResult) {
|
|
@@ -375,15 +389,107 @@ function addDefaultRowKey(data, rowKey, page) {
|
|
|
375
389
|
return item;
|
|
376
390
|
});
|
|
377
391
|
}
|
|
392
|
+
function getCellText(column, row, index, pageIndex) {
|
|
393
|
+
if (!column) {
|
|
394
|
+
return "";
|
|
395
|
+
}
|
|
396
|
+
if (column.type === "index") {
|
|
397
|
+
return getIndexValue(index, column.index, pageIndex);
|
|
398
|
+
}
|
|
399
|
+
const propValue = getValue(row, column.prop);
|
|
400
|
+
if (typeof column.formatter === "function") {
|
|
401
|
+
return column.formatter(row, column, propValue, index, "export");
|
|
402
|
+
}
|
|
403
|
+
return propValue == null ? "" : String(propValue);
|
|
404
|
+
}
|
|
405
|
+
function getHeaderCellText(column, index) {
|
|
406
|
+
if (!column) {
|
|
407
|
+
return "";
|
|
408
|
+
}
|
|
409
|
+
if (typeof column.renderHeader === "function") {
|
|
410
|
+
const params = { column, $index: index, action: "export" };
|
|
411
|
+
return column.renderHeader(params);
|
|
412
|
+
}
|
|
413
|
+
return column.label == null ? "" : String(column.label);
|
|
414
|
+
}
|
|
415
|
+
function getExportData(data, columns, spanMethod, pageIndex, showSummary, sumText, summaryMethod) {
|
|
416
|
+
const { rows: headerRows, cols: bodyCols } = analyseColumns(columns);
|
|
417
|
+
const bodyData = [];
|
|
418
|
+
data.forEach((row, index) => {
|
|
419
|
+
const bodyRowData = [];
|
|
420
|
+
bodyCols.forEach((col, columnIndex) => {
|
|
421
|
+
const { key, originalCol: column } = col;
|
|
422
|
+
const { colspan, rowspan } = getCellSpan(
|
|
423
|
+
{ column, columnIndex, row, rowIndex: index },
|
|
424
|
+
spanMethod
|
|
425
|
+
);
|
|
426
|
+
const isNone = colspan == 0 || rowspan == 0;
|
|
427
|
+
const text = isNone ? "" : getCellText(column, row, index, pageIndex);
|
|
428
|
+
bodyRowData.push({ key, row, index, column, text, colspan, rowspan });
|
|
429
|
+
});
|
|
430
|
+
bodyData.push(bodyRowData);
|
|
431
|
+
});
|
|
432
|
+
const headerData = [];
|
|
433
|
+
headerRows.forEach((headerCols, index) => {
|
|
434
|
+
const headerRowData = [];
|
|
435
|
+
headerCols.forEach((col) => {
|
|
436
|
+
const { key, colspan, rowspan, originalCol: column } = col;
|
|
437
|
+
const isNone = colspan == 0 || rowspan == 0;
|
|
438
|
+
const text = isNone ? "" : getHeaderCellText(column, index);
|
|
439
|
+
headerRowData.push({ key, index, column, text, colspan, rowspan });
|
|
440
|
+
});
|
|
441
|
+
headerData.push(headerRowData);
|
|
442
|
+
});
|
|
443
|
+
const footerData = [];
|
|
444
|
+
if (showSummary && data.length) {
|
|
445
|
+
const footerRowData = [];
|
|
446
|
+
const userSums = getUserSums(summaryMethod, bodyCols, data);
|
|
447
|
+
bodyCols.forEach((col, i) => {
|
|
448
|
+
const { key, dataKey, originalCol: column } = col;
|
|
449
|
+
const sumValue = getSumValue(data, dataKey);
|
|
450
|
+
footerRowData.push({
|
|
451
|
+
key,
|
|
452
|
+
column,
|
|
453
|
+
text: userSums == null ? i === 0 ? sumText : sumValue : userSums[i],
|
|
454
|
+
index: 0
|
|
455
|
+
});
|
|
456
|
+
});
|
|
457
|
+
footerData.push(footerRowData);
|
|
458
|
+
}
|
|
459
|
+
return { headerData, bodyData, footerData, bodyCols };
|
|
460
|
+
}
|
|
461
|
+
function exportCSV(fileName, headerData, bodyData, footerData) {
|
|
462
|
+
const csvRows = [];
|
|
463
|
+
[...headerData, ...bodyData, ...footerData].forEach((item) => {
|
|
464
|
+
csvRows.push(item.map((d) => d.text ?? "").join(","));
|
|
465
|
+
});
|
|
466
|
+
const content = encodeURIComponent(csvRows.join("\n"));
|
|
467
|
+
const a = document.createElement("a");
|
|
468
|
+
a.href = "data:text/csv;charset=utf-8," + content;
|
|
469
|
+
a.download = fileName + ".csv";
|
|
470
|
+
a.style.display = "none";
|
|
471
|
+
document.body.appendChild(a);
|
|
472
|
+
a.click();
|
|
473
|
+
document.body.removeChild(a);
|
|
474
|
+
}
|
|
475
|
+
function exportColumnsfilter(item) {
|
|
476
|
+
return !item.type || !["selection", "expand"].includes(item.type);
|
|
477
|
+
}
|
|
378
478
|
export {
|
|
379
479
|
addDefaultRowKey,
|
|
480
|
+
exportCSV,
|
|
481
|
+
exportColumnsfilter,
|
|
380
482
|
getCacheCols,
|
|
381
483
|
getCacheSize,
|
|
484
|
+
getCellText,
|
|
382
485
|
getCheckedColumns,
|
|
383
486
|
getColId,
|
|
487
|
+
getColItems,
|
|
384
488
|
getColsCacheKey,
|
|
385
489
|
getDefaultFilter,
|
|
386
490
|
getDefaultRowKey,
|
|
491
|
+
getExportData,
|
|
492
|
+
getHeaderCellText,
|
|
387
493
|
getInitCacheColumns,
|
|
388
494
|
getInitColumns,
|
|
389
495
|
getOrderItems,
|
package/es/ele-table/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
7
7
|
default: boolean;
|
|
8
8
|
};
|
|
9
9
|
hasFooter: BooleanConstructor;
|
|
10
|
+
printSkin: BooleanConstructor;
|
|
10
11
|
}, unknown, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
11
12
|
stripe: BooleanConstructor;
|
|
12
13
|
border: BooleanConstructor;
|
|
@@ -16,10 +17,12 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
16
17
|
default: boolean;
|
|
17
18
|
};
|
|
18
19
|
hasFooter: BooleanConstructor;
|
|
20
|
+
printSkin: BooleanConstructor;
|
|
19
21
|
}>>, {
|
|
20
22
|
stripe: boolean;
|
|
21
23
|
border: boolean;
|
|
22
24
|
hasFooter: boolean;
|
|
23
25
|
hasHeader: boolean;
|
|
26
|
+
printSkin: boolean;
|
|
24
27
|
}, {}>;
|
|
25
28
|
export default _default;
|
package/es/ele-table/index.js
CHANGED
|
@@ -20,7 +20,8 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
20
20
|
{ "is-stripe": _ctx.stripe },
|
|
21
21
|
{ "is-border": _ctx.border },
|
|
22
22
|
{ "is-large": _ctx.size === "large" },
|
|
23
|
-
{ "is-small": _ctx.size === "small" }
|
|
23
|
+
{ "is-small": _ctx.size === "small" },
|
|
24
|
+
{ "is-print-skin": _ctx.printSkin }
|
|
24
25
|
])
|
|
25
26
|
}, [
|
|
26
27
|
renderSlot(_ctx.$slots, "default")
|
package/es/ele-table/props.d.ts
CHANGED
package/es/ele-table/props.js
CHANGED
|
@@ -30,6 +30,19 @@
|
|
|
30
30
|
vertical-align: middle;
|
|
31
31
|
box-sizing: border-box;
|
|
32
32
|
text-align: left;
|
|
33
|
+
|
|
34
|
+
/* 单元格对齐方式 */
|
|
35
|
+
&.is-align-left {
|
|
36
|
+
text-align: left;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
&.is-align-center {
|
|
40
|
+
text-align: center;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&.is-align-right {
|
|
44
|
+
text-align: right;
|
|
45
|
+
}
|
|
33
46
|
}
|
|
34
47
|
|
|
35
48
|
& > td {
|
|
@@ -166,4 +179,26 @@
|
|
|
166
179
|
|
|
167
180
|
/* 表格内组件样式优化 */
|
|
168
181
|
@include table-common-style();
|
|
182
|
+
|
|
183
|
+
/* 打印风格的皮肤 */
|
|
184
|
+
&.is-print-skin {
|
|
185
|
+
table-layout: fixed;
|
|
186
|
+
border-collapse: collapse;
|
|
187
|
+
word-break: break-all;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
body table.ele-table.is-print-skin {
|
|
192
|
+
#{eleVarName('table', 'color')}: #000;
|
|
193
|
+
#{eleVarName('table', 'th-color')}: #000;
|
|
194
|
+
#{eleVarName('table', 'border-color')}: #000;
|
|
195
|
+
#{eleVarName('table', 'bg')}: transparent;
|
|
196
|
+
#{eleVarName('table', 'th-bg')}: transparent;
|
|
197
|
+
#{eleVarName('table', 'tr-bg')}: transparent;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
table.ele-table.is-border.is-print-skin {
|
|
201
|
+
#{eleVarName('table', 'radius')}: 0;
|
|
202
|
+
#{eleVarName('table', 'sm-radius')}: 0;
|
|
203
|
+
#{eleVarName('table', 'lg-radius')}: 0;
|
|
169
204
|
}
|
package/es/ele-tool/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
10
10
|
updateVisible: (value: boolean) => void;
|
|
11
11
|
onClick: (e: MouseEvent) => void;
|
|
12
12
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
13
|
-
click: (_e: MouseEvent) =>
|
|
13
|
+
click: (_e: MouseEvent) => boolean;
|
|
14
14
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
15
15
|
title: StringConstructor;
|
|
16
16
|
placement: {
|
package/es/ele-tool/index.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { defineComponent, ref, watch, resolveComponent, openBlock, createElementBlock, createVNode, withCtx, createElementVNode, renderSlot } from "vue";
|
|
2
2
|
import EleTooltip from "../ele-tooltip/index";
|
|
3
|
-
import { toolProps } from "./props";
|
|
3
|
+
import { toolProps, toolEmits } from "./props";
|
|
4
4
|
const _sfc_main = defineComponent({
|
|
5
5
|
name: "EleTool",
|
|
6
6
|
components: { EleTooltip },
|
|
7
7
|
props: toolProps,
|
|
8
|
-
emits:
|
|
9
|
-
click: (_e) => true
|
|
10
|
-
},
|
|
8
|
+
emits: toolEmits,
|
|
11
9
|
setup(props, { emit }) {
|
|
12
10
|
const visible = ref(false);
|
|
13
11
|
const updateVisible = (value) => {
|
package/es/ele-tool/props.d.ts
CHANGED
package/es/ele-tool/props.js
CHANGED
|
@@ -55,7 +55,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
55
55
|
colType: import("vue").ComputedRef<string | undefined>;
|
|
56
56
|
cellClass: import("vue").ComputedRef<string>;
|
|
57
57
|
cellStyle: import("vue").ComputedRef<StyleValues | undefined>;
|
|
58
|
-
indexText: import("vue").ComputedRef<string>;
|
|
59
58
|
cellText: import("vue").ComputedRef<string | undefined>;
|
|
60
59
|
isExpandCol: import("vue").ComputedRef<boolean>;
|
|
61
60
|
renderOpt: import("vue").ComputedRef<CustomRenderProps>;
|
|
@@ -3,7 +3,7 @@ import { ElIcon } from "element-plus";
|
|
|
3
3
|
import { getValue } from "../../ele-data-table/util";
|
|
4
4
|
import { ArrowDown, LoadingDotOutlined } from "../../icons";
|
|
5
5
|
import CellCheckbox from "./cell-checkbox";
|
|
6
|
-
import { CellRender } from "../util";
|
|
6
|
+
import { CellRender, getCellSpan, getIndexValue } from "../util";
|
|
7
7
|
const _sfc_main = defineComponent({
|
|
8
8
|
name: "BodyCell",
|
|
9
9
|
components: {
|
|
@@ -87,28 +87,7 @@ const _sfc_main = defineComponent({
|
|
|
87
87
|
};
|
|
88
88
|
});
|
|
89
89
|
const cellSpan = computed(() => {
|
|
90
|
-
const span =
|
|
91
|
-
if (typeof props.spanMethod === "function") {
|
|
92
|
-
const result = props.spanMethod(cellParam.value);
|
|
93
|
-
if (result != null) {
|
|
94
|
-
if (Array.isArray(result)) {
|
|
95
|
-
const [rowspan, colspan] = result;
|
|
96
|
-
if (rowspan != null) {
|
|
97
|
-
span.rowspan = rowspan;
|
|
98
|
-
}
|
|
99
|
-
if (colspan != null) {
|
|
100
|
-
span.colspan = colspan;
|
|
101
|
-
}
|
|
102
|
-
} else {
|
|
103
|
-
if (result.rowspan != null) {
|
|
104
|
-
span.rowspan = result.rowspan;
|
|
105
|
-
}
|
|
106
|
-
if (result.colspan != null) {
|
|
107
|
-
span.colspan = result.colspan;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
90
|
+
const span = getCellSpan(cellParam.value, props.spanMethod);
|
|
112
91
|
if (colType.value && ["indedx", "selection", "expand"].includes(colType.value)) {
|
|
113
92
|
span.rowspan = 1;
|
|
114
93
|
}
|
|
@@ -236,6 +215,13 @@ const _sfc_main = defineComponent({
|
|
|
236
215
|
];
|
|
237
216
|
});
|
|
238
217
|
const cellText = computed(() => {
|
|
218
|
+
const col = originalCol.value;
|
|
219
|
+
if (col && col.type === "index") {
|
|
220
|
+
if (typeof col.index === "function") {
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
return getIndexValue(props.rowIndex, col.index, props.pageIndex);
|
|
224
|
+
}
|
|
239
225
|
const prop = props.column ? props.column.dataKey : void 0;
|
|
240
226
|
const { rowspan, colspan } = cellSpan.value;
|
|
241
227
|
if (rowspan === 0 || colspan === 0 || prop == null || !props.rowData) {
|
|
@@ -243,12 +229,6 @@ const _sfc_main = defineComponent({
|
|
|
243
229
|
}
|
|
244
230
|
return getValue(props.rowData, prop);
|
|
245
231
|
});
|
|
246
|
-
const indexText = computed(() => {
|
|
247
|
-
const rowIndex = props.rowIndex || 0;
|
|
248
|
-
const index = originalCol.value ? originalCol.value.index : void 0;
|
|
249
|
-
const start = typeof index === "function" ? index(rowIndex) : index;
|
|
250
|
-
return String((props.pageIndex || start || 0) + rowIndex);
|
|
251
|
-
});
|
|
252
232
|
const isExpandCol = computed(() => {
|
|
253
233
|
return props.column != null && props.expandColumnKey != null && props.expandColumnKey === props.column.key;
|
|
254
234
|
});
|
|
@@ -256,18 +236,26 @@ const _sfc_main = defineComponent({
|
|
|
256
236
|
const col = originalCol.value;
|
|
257
237
|
const { rowspan, colspan } = cellSpan.value;
|
|
258
238
|
if (col && rowspan !== 0 && colspan !== 0) {
|
|
239
|
+
const { rowIndex, rowData } = props;
|
|
240
|
+
if (col.type === "index") {
|
|
241
|
+
if (typeof col.index === "function") {
|
|
242
|
+
return {
|
|
243
|
+
render: col.index,
|
|
244
|
+
params: [rowIndex]
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
return {};
|
|
248
|
+
}
|
|
259
249
|
if (col.slot && typeof slots[col.slot] === "function") {
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
column: col,
|
|
263
|
-
$index: props.rowIndex
|
|
250
|
+
return {
|
|
251
|
+
render: slots[col.slot],
|
|
252
|
+
params: [{ row: rowData, column: col, $index: rowIndex }]
|
|
264
253
|
};
|
|
265
|
-
return { render: slots[col.slot], params: [param] };
|
|
266
254
|
}
|
|
267
255
|
if (typeof col.formatter === "function") {
|
|
268
256
|
return {
|
|
269
257
|
render: col.formatter,
|
|
270
|
-
params: [
|
|
258
|
+
params: [rowData, col, cellText.value, rowIndex]
|
|
271
259
|
};
|
|
272
260
|
}
|
|
273
261
|
}
|
|
@@ -330,7 +318,6 @@ const _sfc_main = defineComponent({
|
|
|
330
318
|
colType,
|
|
331
319
|
cellClass,
|
|
332
320
|
cellStyle,
|
|
333
|
-
indexText,
|
|
334
321
|
cellText,
|
|
335
322
|
isExpandCol,
|
|
336
323
|
renderOpt,
|
|
@@ -360,8 +347,8 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
360
347
|
const _component_LoadingDotOutlined = resolveComponent("LoadingDotOutlined");
|
|
361
348
|
const _component_ArrowDown = resolveComponent("ArrowDown");
|
|
362
349
|
const _component_ElIcon = resolveComponent("ElIcon");
|
|
363
|
-
const _component_CellRender = resolveComponent("CellRender");
|
|
364
350
|
const _component_CellCheckbox = resolveComponent("CellCheckbox");
|
|
351
|
+
const _component_CellRender = resolveComponent("CellRender");
|
|
365
352
|
return openBlock(), createElementBlock("div", {
|
|
366
353
|
class: normalizeClass(_ctx.cellClass),
|
|
367
354
|
style: normalizeStyle(_ctx.cellStyle),
|
|
@@ -396,20 +383,18 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
396
383
|
}, 8, ["class"])
|
|
397
384
|
], 2)) : (openBlock(), createElementBlock("div", _hoisted_1))
|
|
398
385
|
], 64)) : createCommentVNode("", true),
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
createTextVNode(toDisplayString(_ctx.cellText), 1)
|
|
402
|
-
]),
|
|
403
|
-
_: 1
|
|
404
|
-
}, 16)) : _ctx.colType === "index" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
405
|
-
createTextVNode(toDisplayString(_ctx.indexText), 1)
|
|
406
|
-
], 64)) : _ctx.colType === "selection" ? (openBlock(), createBlock(_component_CellCheckbox, {
|
|
407
|
-
key: 3,
|
|
386
|
+
_ctx.colType === "selection" ? (openBlock(), createBlock(_component_CellCheckbox, {
|
|
387
|
+
key: 1,
|
|
408
388
|
checked: _ctx.isChecked,
|
|
409
389
|
disabled: _ctx.rowData ? _ctx.rowData._rowDisabled : false,
|
|
410
390
|
size: _ctx.tableSize,
|
|
411
391
|
onChange: _ctx.onCheckedChange
|
|
412
|
-
}, null, 8, ["checked", "disabled", "size", "onChange"])) :
|
|
392
|
+
}, null, 8, ["checked", "disabled", "size", "onChange"])) : _ctx.colType !== "expand" ? (openBlock(), createBlock(_component_CellRender, normalizeProps(mergeProps({ key: 2 }, _ctx.renderOpt)), {
|
|
393
|
+
default: withCtx(() => [
|
|
394
|
+
createTextVNode(toDisplayString(_ctx.cellText), 1)
|
|
395
|
+
]),
|
|
396
|
+
_: 1
|
|
397
|
+
}, 16)) : createCommentVNode("", true)
|
|
413
398
|
])
|
|
414
399
|
], 38);
|
|
415
400
|
}
|
|
@@ -15,7 +15,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
15
15
|
/** 合计行文本 */
|
|
16
16
|
sumText: StringConstructor;
|
|
17
17
|
/** 合计行自定义方法 */
|
|
18
|
-
summaryMethod:
|
|
18
|
+
summaryMethod: PropType<import("element-plus/es/components/table/src/table/defaults").SummaryMethod<DataItem> | undefined>;
|
|
19
19
|
}, {
|
|
20
20
|
sumCols: import("vue").ComputedRef<SumCol[]>;
|
|
21
21
|
onMouseenter: (e: MouseEvent) => void;
|
|
@@ -36,7 +36,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
36
36
|
/** 合计行文本 */
|
|
37
37
|
sumText: StringConstructor;
|
|
38
38
|
/** 合计行自定义方法 */
|
|
39
|
-
summaryMethod:
|
|
39
|
+
summaryMethod: PropType<import("element-plus/es/components/table/src/table/defaults").SummaryMethod<DataItem> | undefined>;
|
|
40
40
|
}>> & {
|
|
41
41
|
onMouseenter?: ((_e: MouseEvent) => any) | undefined;
|
|
42
42
|
}, {}, {}>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { defineComponent, computed, openBlock, createElementBlock, normalizeStyle, Fragment, renderList, normalizeClass, createElementVNode,
|
|
2
|
-
import { getSumValue } from "../util";
|
|
1
|
+
import { defineComponent, computed, resolveComponent, openBlock, createElementBlock, normalizeStyle, Fragment, renderList, normalizeClass, createElementVNode, createVNode } from "vue";
|
|
2
|
+
import { CellRender, getUserSums, getSumValue } from "../util";
|
|
3
3
|
const _sfc_main = defineComponent({
|
|
4
4
|
name: "FooterRow",
|
|
5
|
+
components: { CellRender },
|
|
5
6
|
props: {
|
|
6
7
|
/** 表格主体列配置 */
|
|
7
8
|
bodyCols: Array,
|
|
@@ -24,13 +25,11 @@ const _sfc_main = defineComponent({
|
|
|
24
25
|
},
|
|
25
26
|
setup(props, { emit }) {
|
|
26
27
|
const userSums = computed(() => {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
});
|
|
33
|
-
return props.summaryMethod({ columns, data: props.tableData });
|
|
28
|
+
return getUserSums(
|
|
29
|
+
props.summaryMethod,
|
|
30
|
+
props.bodyCols,
|
|
31
|
+
props.tableData
|
|
32
|
+
);
|
|
34
33
|
});
|
|
35
34
|
const sumCols = computed(() => {
|
|
36
35
|
if (!props.bodyCols) {
|
|
@@ -69,6 +68,7 @@ const _export_sfc = (sfc, props) => {
|
|
|
69
68
|
};
|
|
70
69
|
const _hoisted_1 = { class: "ele-table-cell" };
|
|
71
70
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
71
|
+
const _component_CellRender = resolveComponent("CellRender");
|
|
72
72
|
return openBlock(), createElementBlock("div", {
|
|
73
73
|
class: "ele-table-foot-tr",
|
|
74
74
|
style: normalizeStyle({ width: (_ctx.sumWidth || 0) + "px", height: (_ctx.rowHeight || 0) + "px" })
|
|
@@ -94,7 +94,12 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
94
94
|
}),
|
|
95
95
|
onMouseenter: _cache[0] || (_cache[0] = (...args) => _ctx.onMouseenter && _ctx.onMouseenter(...args))
|
|
96
96
|
}, [
|
|
97
|
-
createElementVNode("div", _hoisted_1,
|
|
97
|
+
createElementVNode("div", _hoisted_1, [
|
|
98
|
+
createVNode(_component_CellRender, {
|
|
99
|
+
render: () => col.text,
|
|
100
|
+
params: []
|
|
101
|
+
}, null, 8, ["render"])
|
|
102
|
+
])
|
|
98
103
|
], 38);
|
|
99
104
|
}), 128))
|
|
100
105
|
], 4);
|
|
@@ -149,7 +149,7 @@ export interface CellSpan {
|
|
|
149
149
|
*/
|
|
150
150
|
export interface CustomRenderProps {
|
|
151
151
|
/** 自定义渲染方法 */
|
|
152
|
-
render?: (...params: any) => string | VNode | VNode[] | undefined;
|
|
152
|
+
render?: (...params: any) => string | VNode | VNode[] | number | undefined;
|
|
153
153
|
/** 自定义渲染参数 */
|
|
154
154
|
params?: Array<any>;
|
|
155
155
|
}
|
|
@@ -193,3 +193,17 @@ export interface SumCol extends ColSize {
|
|
|
193
193
|
/** 是否是第一个右侧固定列 */
|
|
194
194
|
isFixedRightFirst?: boolean;
|
|
195
195
|
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* 单元格获取自定义配置的参数
|
|
199
|
+
*/
|
|
200
|
+
export interface CellParams {
|
|
201
|
+
/** 列配置 */
|
|
202
|
+
column?: Column;
|
|
203
|
+
/** 列索引 */
|
|
204
|
+
columnIndex: number;
|
|
205
|
+
/** 行数据 */
|
|
206
|
+
row: DataItem;
|
|
207
|
+
/** 行索引 */
|
|
208
|
+
rowIndex: number;
|
|
209
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { SetupContext } from 'vue';
|
|
2
2
|
import { TableV2SortOrder } from 'element-plus';
|
|
3
|
-
import type { DataKey, DataItem, Column, Columns, Sorter, Filter, FilterValue, OrderValue, TableSize, RowKey, RowSelectable, TreeProps, ShowOverflowTooltip } from '../ele-data-table/types';
|
|
4
|
-
import type { VirtualColumn, VirtualColumns, BodyColumns, HeaderColumn, HeaderRows, ColSize, CustomRenderProps, SortBy, TreeTableProps } from './types';
|
|
3
|
+
import type { DataKey, DataItem, Column, Columns, Sorter, Filter, FilterValue, OrderValue, TableSize, RowKey, RowSelectable, TreeProps, ShowOverflowTooltip, SpanMethod, ColumnIndex, SummaryMethod } from '../ele-data-table/types';
|
|
4
|
+
import type { VirtualColumn, VirtualColumns, BodyColumns, HeaderColumn, HeaderRows, ColSize, CustomRenderProps, SortBy, TreeTableProps, CellSpan, CellParams } from './types';
|
|
5
5
|
/**
|
|
6
6
|
* 获取行高
|
|
7
7
|
* @param size 表格尺寸
|
|
@@ -123,7 +123,7 @@ export declare function isAutoRowHeight(hasExpandCol: boolean, bodyCols: BodyCol
|
|
|
123
123
|
* @param props 属性
|
|
124
124
|
* @param ctx SetupContext
|
|
125
125
|
*/
|
|
126
|
-
export declare function CellRender(props: CustomRenderProps, ctx: SetupContext): (string | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
126
|
+
export declare function CellRender(props: CustomRenderProps, ctx: SetupContext): (string | number | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
127
127
|
[key: string]: any;
|
|
128
128
|
}>)[] | undefined;
|
|
129
129
|
/**
|
|
@@ -168,6 +168,29 @@ export declare function getSelectableFunction(cols: BodyColumns): ((row: any, in
|
|
|
168
168
|
* @param treeProps 嵌套数据配置项
|
|
169
169
|
*/
|
|
170
170
|
export declare function getTreeProps(treeProps?: TreeProps): TreeTableProps;
|
|
171
|
+
/**
|
|
172
|
+
* 获取序号列值
|
|
173
|
+
* @param rowIndex 行索引
|
|
174
|
+
* @param index 自定义起始索引
|
|
175
|
+
* @param pageIndex 表格分页起始索引
|
|
176
|
+
*/
|
|
177
|
+
export declare function getIndexValue(rowIndex?: number, index?: ColumnIndex, pageIndex?: number): string;
|
|
178
|
+
/**
|
|
179
|
+
* 获取单元格的跨行和跨列
|
|
180
|
+
* @param column 列配置
|
|
181
|
+
* @param columnIndex 列索引
|
|
182
|
+
* @param row 行数据
|
|
183
|
+
* @param rowIndex 行索引
|
|
184
|
+
* @param spanMethod 跨行跨列方法
|
|
185
|
+
*/
|
|
186
|
+
export declare function getCellSpan(params: CellParams, spanMethod?: SpanMethod): CellSpan;
|
|
187
|
+
/**
|
|
188
|
+
* 获取自定义的合计列
|
|
189
|
+
* @param summaryMethod 自定义方法
|
|
190
|
+
* @param bodyCols 表格主体列配置
|
|
191
|
+
* @param data 表格数据
|
|
192
|
+
*/
|
|
193
|
+
export declare function getUserSums(summaryMethod?: SummaryMethod, bodyCols?: BodyColumns, data?: DataItem[]): string[] | undefined;
|
|
171
194
|
/**
|
|
172
195
|
* 计算列合计值
|
|
173
196
|
* @param data 表格数据
|