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
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const util = require("../ele-data-table/util");
|
|
4
3
|
const core = require("../utils/core");
|
|
4
|
+
const util = require("../ele-data-table/util");
|
|
5
|
+
const util$1 = require("../ele-virtual-table/util");
|
|
5
6
|
function mergeProps(props, globalProps) {
|
|
6
7
|
if (props == null) {
|
|
7
8
|
return globalProps ?? true;
|
|
@@ -232,7 +233,7 @@ function getInitCacheColumns(columns, cacheKey, sortable) {
|
|
|
232
233
|
}
|
|
233
234
|
return getCheckedColumns(columns, cache, sortable);
|
|
234
235
|
}
|
|
235
|
-
function getCheckedColumns(columns, cols, sortable) {
|
|
236
|
+
function getCheckedColumns(columns, cols, sortable, filter) {
|
|
236
237
|
const data = [];
|
|
237
238
|
if (!columns || !columns.length) {
|
|
238
239
|
return data;
|
|
@@ -242,26 +243,23 @@ function getCheckedColumns(columns, cols, sortable) {
|
|
|
242
243
|
if (colId == null) {
|
|
243
244
|
return;
|
|
244
245
|
}
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
return false;
|
|
250
|
-
}
|
|
251
|
-
});
|
|
246
|
+
if (filter && !filter(d)) {
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
const temp = core.findTree(cols, (t) => t.uid === colId);
|
|
252
250
|
if (temp && !temp.checked) {
|
|
253
251
|
return;
|
|
254
252
|
}
|
|
255
253
|
const fixed = (temp == null ? void 0 : temp.fixed) ?? d.fixed;
|
|
256
254
|
const uid = core.uuid(8);
|
|
257
|
-
if (d.children) {
|
|
258
|
-
const children = getCheckedColumns(d.children, cols, sortable);
|
|
255
|
+
if (d.children && d.children.length) {
|
|
256
|
+
const children = getCheckedColumns(d.children, cols, sortable, filter);
|
|
259
257
|
if (children.length) {
|
|
260
258
|
data.push({ ...d, fixed, uid, children });
|
|
261
259
|
}
|
|
262
|
-
|
|
263
|
-
data.push({ ...d, fixed, uid });
|
|
260
|
+
return;
|
|
264
261
|
}
|
|
262
|
+
data.push({ ...d, fixed, uid });
|
|
265
263
|
});
|
|
266
264
|
if (!sortable || !data.length) {
|
|
267
265
|
return data;
|
|
@@ -307,6 +305,22 @@ function getCheckedColumns(columns, cols, sortable) {
|
|
|
307
305
|
});
|
|
308
306
|
return data;
|
|
309
307
|
}
|
|
308
|
+
function getColItems(columns, untitledText, filter) {
|
|
309
|
+
return core.mapTree(columns, (d) => {
|
|
310
|
+
const colId = getColId(d);
|
|
311
|
+
if (!colId || filter && !filter(d)) {
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
return {
|
|
315
|
+
uid: colId,
|
|
316
|
+
prop: d.prop,
|
|
317
|
+
columnKey: d.columnKey,
|
|
318
|
+
label: d.label || untitledText,
|
|
319
|
+
checked: !d.hideInTable,
|
|
320
|
+
fixed: d.fixed
|
|
321
|
+
};
|
|
322
|
+
});
|
|
323
|
+
}
|
|
310
324
|
function getSettingCols(columns, untitledText, cacheKey) {
|
|
311
325
|
const cacheResult = getCacheCols(cacheKey);
|
|
312
326
|
if (cacheResult) {
|
|
@@ -377,14 +391,106 @@ function addDefaultRowKey(data, rowKey, page) {
|
|
|
377
391
|
return item;
|
|
378
392
|
});
|
|
379
393
|
}
|
|
394
|
+
function getCellText(column, row, index, pageIndex) {
|
|
395
|
+
if (!column) {
|
|
396
|
+
return "";
|
|
397
|
+
}
|
|
398
|
+
if (column.type === "index") {
|
|
399
|
+
return util$1.getIndexValue(index, column.index, pageIndex);
|
|
400
|
+
}
|
|
401
|
+
const propValue = util.getValue(row, column.prop);
|
|
402
|
+
if (typeof column.formatter === "function") {
|
|
403
|
+
return column.formatter(row, column, propValue, index, "export");
|
|
404
|
+
}
|
|
405
|
+
return propValue == null ? "" : String(propValue);
|
|
406
|
+
}
|
|
407
|
+
function getHeaderCellText(column, index) {
|
|
408
|
+
if (!column) {
|
|
409
|
+
return "";
|
|
410
|
+
}
|
|
411
|
+
if (typeof column.renderHeader === "function") {
|
|
412
|
+
const params = { column, $index: index, action: "export" };
|
|
413
|
+
return column.renderHeader(params);
|
|
414
|
+
}
|
|
415
|
+
return column.label == null ? "" : String(column.label);
|
|
416
|
+
}
|
|
417
|
+
function getExportData(data, columns, spanMethod, pageIndex, showSummary, sumText, summaryMethod) {
|
|
418
|
+
const { rows: headerRows, cols: bodyCols } = util$1.analyseColumns(columns);
|
|
419
|
+
const bodyData = [];
|
|
420
|
+
data.forEach((row, index) => {
|
|
421
|
+
const bodyRowData = [];
|
|
422
|
+
bodyCols.forEach((col, columnIndex) => {
|
|
423
|
+
const { key, originalCol: column } = col;
|
|
424
|
+
const { colspan, rowspan } = util$1.getCellSpan(
|
|
425
|
+
{ column, columnIndex, row, rowIndex: index },
|
|
426
|
+
spanMethod
|
|
427
|
+
);
|
|
428
|
+
const isNone = colspan == 0 || rowspan == 0;
|
|
429
|
+
const text = isNone ? "" : getCellText(column, row, index, pageIndex);
|
|
430
|
+
bodyRowData.push({ key, row, index, column, text, colspan, rowspan });
|
|
431
|
+
});
|
|
432
|
+
bodyData.push(bodyRowData);
|
|
433
|
+
});
|
|
434
|
+
const headerData = [];
|
|
435
|
+
headerRows.forEach((headerCols, index) => {
|
|
436
|
+
const headerRowData = [];
|
|
437
|
+
headerCols.forEach((col) => {
|
|
438
|
+
const { key, colspan, rowspan, originalCol: column } = col;
|
|
439
|
+
const isNone = colspan == 0 || rowspan == 0;
|
|
440
|
+
const text = isNone ? "" : getHeaderCellText(column, index);
|
|
441
|
+
headerRowData.push({ key, index, column, text, colspan, rowspan });
|
|
442
|
+
});
|
|
443
|
+
headerData.push(headerRowData);
|
|
444
|
+
});
|
|
445
|
+
const footerData = [];
|
|
446
|
+
if (showSummary && data.length) {
|
|
447
|
+
const footerRowData = [];
|
|
448
|
+
const userSums = util$1.getUserSums(summaryMethod, bodyCols, data);
|
|
449
|
+
bodyCols.forEach((col, i) => {
|
|
450
|
+
const { key, dataKey, originalCol: column } = col;
|
|
451
|
+
const sumValue = util$1.getSumValue(data, dataKey);
|
|
452
|
+
footerRowData.push({
|
|
453
|
+
key,
|
|
454
|
+
column,
|
|
455
|
+
text: userSums == null ? i === 0 ? sumText : sumValue : userSums[i],
|
|
456
|
+
index: 0
|
|
457
|
+
});
|
|
458
|
+
});
|
|
459
|
+
footerData.push(footerRowData);
|
|
460
|
+
}
|
|
461
|
+
return { headerData, bodyData, footerData, bodyCols };
|
|
462
|
+
}
|
|
463
|
+
function exportCSV(fileName, headerData, bodyData, footerData) {
|
|
464
|
+
const csvRows = [];
|
|
465
|
+
[...headerData, ...bodyData, ...footerData].forEach((item) => {
|
|
466
|
+
csvRows.push(item.map((d) => d.text ?? "").join(","));
|
|
467
|
+
});
|
|
468
|
+
const content = encodeURIComponent(csvRows.join("\n"));
|
|
469
|
+
const a = document.createElement("a");
|
|
470
|
+
a.href = "data:text/csv;charset=utf-8," + content;
|
|
471
|
+
a.download = fileName + ".csv";
|
|
472
|
+
a.style.display = "none";
|
|
473
|
+
document.body.appendChild(a);
|
|
474
|
+
a.click();
|
|
475
|
+
document.body.removeChild(a);
|
|
476
|
+
}
|
|
477
|
+
function exportColumnsfilter(item) {
|
|
478
|
+
return !item.type || !["selection", "expand"].includes(item.type);
|
|
479
|
+
}
|
|
380
480
|
exports.addDefaultRowKey = addDefaultRowKey;
|
|
481
|
+
exports.exportCSV = exportCSV;
|
|
482
|
+
exports.exportColumnsfilter = exportColumnsfilter;
|
|
381
483
|
exports.getCacheCols = getCacheCols;
|
|
382
484
|
exports.getCacheSize = getCacheSize;
|
|
485
|
+
exports.getCellText = getCellText;
|
|
383
486
|
exports.getCheckedColumns = getCheckedColumns;
|
|
384
487
|
exports.getColId = getColId;
|
|
488
|
+
exports.getColItems = getColItems;
|
|
385
489
|
exports.getColsCacheKey = getColsCacheKey;
|
|
386
490
|
exports.getDefaultFilter = getDefaultFilter;
|
|
387
491
|
exports.getDefaultRowKey = getDefaultRowKey;
|
|
492
|
+
exports.getExportData = getExportData;
|
|
493
|
+
exports.getHeaderCellText = getHeaderCellText;
|
|
388
494
|
exports.getInitCacheColumns = getInitCacheColumns;
|
|
389
495
|
exports.getInitColumns = getInitColumns;
|
|
390
496
|
exports.getOrderItems = getOrderItems;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ElePaginationProps } from '../ele-app/plus';
|
|
2
|
-
import type { DataItem, Column, Columns, Sorter, Filter, TableSize, TreeProps, RowKey } from '../ele-data-table/types';
|
|
3
|
-
import type { Orders, Filters, OrderItem, RequestOption, ResponseOption, TablePagination, DatasourceResult, ResponseResult, ReloadDataResult, ColItem, ProProps } from './types';
|
|
2
|
+
import type { DataItem, Column, Columns, Sorter, Filter, TableSize, TreeProps, RowKey, SpanMethod, SummaryMethod } from '../ele-data-table/types';
|
|
3
|
+
import type { Orders, Filters, OrderItem, RequestOption, ResponseOption, TablePagination, DatasourceResult, ResponseResult, ReloadDataResult, ColItem, ProProps, ExportDataItem, ExportDataResult } from './types';
|
|
4
4
|
/**
|
|
5
5
|
* 合并复合属性
|
|
6
6
|
* @param props 属性
|
|
@@ -127,7 +127,14 @@ export declare function getInitCacheColumns(columns: Columns, cacheKey?: string,
|
|
|
127
127
|
* @param cols 列配置数据
|
|
128
128
|
* @param sortable 是否进行排序
|
|
129
129
|
*/
|
|
130
|
-
export declare function getCheckedColumns(columns: Columns | undefined, cols: ColItem[], sortable?: boolean): Columns;
|
|
130
|
+
export declare function getCheckedColumns(columns: Columns | undefined, cols: ColItem[], sortable?: boolean, filter?: (item: Column) => boolean): Columns;
|
|
131
|
+
/**
|
|
132
|
+
* 获取列展示列表数据
|
|
133
|
+
* @param columns 列数据
|
|
134
|
+
* @param untitledText 未命名列文字
|
|
135
|
+
* @param filter 过滤的方法
|
|
136
|
+
*/
|
|
137
|
+
export declare function getColItems(columns?: Columns, untitledText?: string, filter?: (item: Column) => boolean): ColItem[];
|
|
131
138
|
/**
|
|
132
139
|
* 获取列配置
|
|
133
140
|
* @param columns 列数据
|
|
@@ -170,3 +177,40 @@ export declare function getRowKey(rowKey?: RowKey): string | ((row: DataItem) =>
|
|
|
170
177
|
* @param page 页码
|
|
171
178
|
*/
|
|
172
179
|
export declare function addDefaultRowKey(data: DataItem[], rowKey: string | undefined, page: number): DataItem[];
|
|
180
|
+
/**
|
|
181
|
+
* 导出获取单元格文本
|
|
182
|
+
* @param column 列配置
|
|
183
|
+
* @param row 行数据
|
|
184
|
+
* @param index 行索引
|
|
185
|
+
* @param pageIndex 序号列起始索引
|
|
186
|
+
*/
|
|
187
|
+
export declare function getCellText(column: Column | undefined, row: DataItem, index: number, pageIndex?: number): string;
|
|
188
|
+
/**
|
|
189
|
+
* 导出获取表头单元格文本
|
|
190
|
+
* @param column 列配置
|
|
191
|
+
* @param index 行索引
|
|
192
|
+
*/
|
|
193
|
+
export declare function getHeaderCellText(column: Column | undefined, index: number): string;
|
|
194
|
+
/**
|
|
195
|
+
* 获取导出的数据
|
|
196
|
+
* @param data 元数据
|
|
197
|
+
* @param columns 列配置
|
|
198
|
+
* @param spanMethod 单元格合并方法
|
|
199
|
+
* @param pageIndex 序号列起始索引
|
|
200
|
+
* @param showSummary 是否显示合计行
|
|
201
|
+
* @param sumText 合计行文本
|
|
202
|
+
* @param summaryMethod 合计行自定义方法
|
|
203
|
+
*/
|
|
204
|
+
export declare function getExportData(data: DataItem[], columns: Columns, spanMethod?: SpanMethod, pageIndex?: number, showSummary?: boolean, sumText?: string, summaryMethod?: SummaryMethod): ExportDataResult;
|
|
205
|
+
/**
|
|
206
|
+
* 导出csv文件
|
|
207
|
+
* @param fileName 文件名
|
|
208
|
+
* @param headerData 表头数据
|
|
209
|
+
* @param bodyData 主体数据
|
|
210
|
+
*/
|
|
211
|
+
export declare function exportCSV(fileName: string, headerData: ExportDataItem[][], bodyData: ExportDataItem[][], footerData: ExportDataItem[][]): void;
|
|
212
|
+
/**
|
|
213
|
+
* 导出判断列是否显示
|
|
214
|
+
* @param item 列配置
|
|
215
|
+
*/
|
|
216
|
+
export declare function exportColumnsfilter(item: Column): boolean;
|
package/lib/ele-table/index.cjs
CHANGED
|
@@ -21,7 +21,8 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
21
21
|
{ "is-stripe": _ctx.stripe },
|
|
22
22
|
{ "is-border": _ctx.border },
|
|
23
23
|
{ "is-large": _ctx.size === "large" },
|
|
24
|
-
{ "is-small": _ctx.size === "small" }
|
|
24
|
+
{ "is-small": _ctx.size === "small" },
|
|
25
|
+
{ "is-print-skin": _ctx.printSkin }
|
|
25
26
|
])
|
|
26
27
|
}, [
|
|
27
28
|
vue.renderSlot(_ctx.$slots, "default")
|
package/lib/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/lib/ele-table/props.cjs
CHANGED
package/lib/ele-table/props.d.ts
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/lib/ele-tool/index.cjs
CHANGED
|
@@ -6,9 +6,7 @@ const _sfc_main = vue.defineComponent({
|
|
|
6
6
|
name: "EleTool",
|
|
7
7
|
components: { EleTooltip },
|
|
8
8
|
props: props.toolProps,
|
|
9
|
-
emits:
|
|
10
|
-
click: (_e) => true
|
|
11
|
-
},
|
|
9
|
+
emits: props.toolEmits,
|
|
12
10
|
setup(props2, { emit }) {
|
|
13
11
|
const visible = vue.ref(false);
|
|
14
12
|
const updateVisible = (value) => {
|
package/lib/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/lib/ele-tool/props.cjs
CHANGED
package/lib/ele-tool/props.d.ts
CHANGED
|
@@ -88,28 +88,7 @@ const _sfc_main = vue.defineComponent({
|
|
|
88
88
|
};
|
|
89
89
|
});
|
|
90
90
|
const cellSpan = vue.computed(() => {
|
|
91
|
-
const span =
|
|
92
|
-
if (typeof props.spanMethod === "function") {
|
|
93
|
-
const result = props.spanMethod(cellParam.value);
|
|
94
|
-
if (result != null) {
|
|
95
|
-
if (Array.isArray(result)) {
|
|
96
|
-
const [rowspan, colspan] = result;
|
|
97
|
-
if (rowspan != null) {
|
|
98
|
-
span.rowspan = rowspan;
|
|
99
|
-
}
|
|
100
|
-
if (colspan != null) {
|
|
101
|
-
span.colspan = colspan;
|
|
102
|
-
}
|
|
103
|
-
} else {
|
|
104
|
-
if (result.rowspan != null) {
|
|
105
|
-
span.rowspan = result.rowspan;
|
|
106
|
-
}
|
|
107
|
-
if (result.colspan != null) {
|
|
108
|
-
span.colspan = result.colspan;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
91
|
+
const span = util.getCellSpan(cellParam.value, props.spanMethod);
|
|
113
92
|
if (colType.value && ["indedx", "selection", "expand"].includes(colType.value)) {
|
|
114
93
|
span.rowspan = 1;
|
|
115
94
|
}
|
|
@@ -237,6 +216,13 @@ const _sfc_main = vue.defineComponent({
|
|
|
237
216
|
];
|
|
238
217
|
});
|
|
239
218
|
const cellText = vue.computed(() => {
|
|
219
|
+
const col = originalCol.value;
|
|
220
|
+
if (col && col.type === "index") {
|
|
221
|
+
if (typeof col.index === "function") {
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
return util.getIndexValue(props.rowIndex, col.index, props.pageIndex);
|
|
225
|
+
}
|
|
240
226
|
const prop = props.column ? props.column.dataKey : void 0;
|
|
241
227
|
const { rowspan, colspan } = cellSpan.value;
|
|
242
228
|
if (rowspan === 0 || colspan === 0 || prop == null || !props.rowData) {
|
|
@@ -244,12 +230,6 @@ const _sfc_main = vue.defineComponent({
|
|
|
244
230
|
}
|
|
245
231
|
return util$1.getValue(props.rowData, prop);
|
|
246
232
|
});
|
|
247
|
-
const indexText = vue.computed(() => {
|
|
248
|
-
const rowIndex = props.rowIndex || 0;
|
|
249
|
-
const index = originalCol.value ? originalCol.value.index : void 0;
|
|
250
|
-
const start = typeof index === "function" ? index(rowIndex) : index;
|
|
251
|
-
return String((props.pageIndex || start || 0) + rowIndex);
|
|
252
|
-
});
|
|
253
233
|
const isExpandCol = vue.computed(() => {
|
|
254
234
|
return props.column != null && props.expandColumnKey != null && props.expandColumnKey === props.column.key;
|
|
255
235
|
});
|
|
@@ -257,18 +237,26 @@ const _sfc_main = vue.defineComponent({
|
|
|
257
237
|
const col = originalCol.value;
|
|
258
238
|
const { rowspan, colspan } = cellSpan.value;
|
|
259
239
|
if (col && rowspan !== 0 && colspan !== 0) {
|
|
240
|
+
const { rowIndex, rowData } = props;
|
|
241
|
+
if (col.type === "index") {
|
|
242
|
+
if (typeof col.index === "function") {
|
|
243
|
+
return {
|
|
244
|
+
render: col.index,
|
|
245
|
+
params: [rowIndex]
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
return {};
|
|
249
|
+
}
|
|
260
250
|
if (col.slot && typeof slots[col.slot] === "function") {
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
column: col,
|
|
264
|
-
$index: props.rowIndex
|
|
251
|
+
return {
|
|
252
|
+
render: slots[col.slot],
|
|
253
|
+
params: [{ row: rowData, column: col, $index: rowIndex }]
|
|
265
254
|
};
|
|
266
|
-
return { render: slots[col.slot], params: [param] };
|
|
267
255
|
}
|
|
268
256
|
if (typeof col.formatter === "function") {
|
|
269
257
|
return {
|
|
270
258
|
render: col.formatter,
|
|
271
|
-
params: [
|
|
259
|
+
params: [rowData, col, cellText.value, rowIndex]
|
|
272
260
|
};
|
|
273
261
|
}
|
|
274
262
|
}
|
|
@@ -331,7 +319,6 @@ const _sfc_main = vue.defineComponent({
|
|
|
331
319
|
colType,
|
|
332
320
|
cellClass,
|
|
333
321
|
cellStyle,
|
|
334
|
-
indexText,
|
|
335
322
|
cellText,
|
|
336
323
|
isExpandCol,
|
|
337
324
|
renderOpt,
|
|
@@ -361,8 +348,8 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
361
348
|
const _component_LoadingDotOutlined = vue.resolveComponent("LoadingDotOutlined");
|
|
362
349
|
const _component_ArrowDown = vue.resolveComponent("ArrowDown");
|
|
363
350
|
const _component_ElIcon = vue.resolveComponent("ElIcon");
|
|
364
|
-
const _component_CellRender = vue.resolveComponent("CellRender");
|
|
365
351
|
const _component_CellCheckbox = vue.resolveComponent("CellCheckbox");
|
|
352
|
+
const _component_CellRender = vue.resolveComponent("CellRender");
|
|
366
353
|
return vue.openBlock(), vue.createElementBlock("div", {
|
|
367
354
|
class: vue.normalizeClass(_ctx.cellClass),
|
|
368
355
|
style: vue.normalizeStyle(_ctx.cellStyle),
|
|
@@ -397,20 +384,18 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
397
384
|
}, 8, ["class"])
|
|
398
385
|
], 2)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1))
|
|
399
386
|
], 64)) : vue.createCommentVNode("", true),
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
vue.createTextVNode(vue.toDisplayString(_ctx.cellText), 1)
|
|
403
|
-
]),
|
|
404
|
-
_: 1
|
|
405
|
-
}, 16)) : _ctx.colType === "index" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
|
|
406
|
-
vue.createTextVNode(vue.toDisplayString(_ctx.indexText), 1)
|
|
407
|
-
], 64)) : _ctx.colType === "selection" ? (vue.openBlock(), vue.createBlock(_component_CellCheckbox, {
|
|
408
|
-
key: 3,
|
|
387
|
+
_ctx.colType === "selection" ? (vue.openBlock(), vue.createBlock(_component_CellCheckbox, {
|
|
388
|
+
key: 1,
|
|
409
389
|
checked: _ctx.isChecked,
|
|
410
390
|
disabled: _ctx.rowData ? _ctx.rowData._rowDisabled : false,
|
|
411
391
|
size: _ctx.tableSize,
|
|
412
392
|
onChange: _ctx.onCheckedChange
|
|
413
|
-
}, null, 8, ["checked", "disabled", "size", "onChange"])) : vue.
|
|
393
|
+
}, null, 8, ["checked", "disabled", "size", "onChange"])) : _ctx.colType !== "expand" ? (vue.openBlock(), vue.createBlock(_component_CellRender, vue.normalizeProps(vue.mergeProps({ key: 2 }, _ctx.renderOpt)), {
|
|
394
|
+
default: vue.withCtx(() => [
|
|
395
|
+
vue.createTextVNode(vue.toDisplayString(_ctx.cellText), 1)
|
|
396
|
+
]),
|
|
397
|
+
_: 1
|
|
398
|
+
}, 16)) : vue.createCommentVNode("", true)
|
|
414
399
|
])
|
|
415
400
|
], 38);
|
|
416
401
|
}
|
|
@@ -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,6 +3,7 @@ const vue = require("vue");
|
|
|
3
3
|
const util = require("../util");
|
|
4
4
|
const _sfc_main = vue.defineComponent({
|
|
5
5
|
name: "FooterRow",
|
|
6
|
+
components: { CellRender: util.CellRender },
|
|
6
7
|
props: {
|
|
7
8
|
/** 表格主体列配置 */
|
|
8
9
|
bodyCols: Array,
|
|
@@ -25,13 +26,11 @@ const _sfc_main = vue.defineComponent({
|
|
|
25
26
|
},
|
|
26
27
|
setup(props, { emit }) {
|
|
27
28
|
const userSums = vue.computed(() => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
});
|
|
34
|
-
return props.summaryMethod({ columns, data: props.tableData });
|
|
29
|
+
return util.getUserSums(
|
|
30
|
+
props.summaryMethod,
|
|
31
|
+
props.bodyCols,
|
|
32
|
+
props.tableData
|
|
33
|
+
);
|
|
35
34
|
});
|
|
36
35
|
const sumCols = vue.computed(() => {
|
|
37
36
|
if (!props.bodyCols) {
|
|
@@ -70,6 +69,7 @@ const _export_sfc = (sfc, props) => {
|
|
|
70
69
|
};
|
|
71
70
|
const _hoisted_1 = { class: "ele-table-cell" };
|
|
72
71
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
72
|
+
const _component_CellRender = vue.resolveComponent("CellRender");
|
|
73
73
|
return vue.openBlock(), vue.createElementBlock("div", {
|
|
74
74
|
class: "ele-table-foot-tr",
|
|
75
75
|
style: vue.normalizeStyle({ width: (_ctx.sumWidth || 0) + "px", height: (_ctx.rowHeight || 0) + "px" })
|
|
@@ -95,7 +95,12 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
95
95
|
}),
|
|
96
96
|
onMouseenter: _cache[0] || (_cache[0] = (...args) => _ctx.onMouseenter && _ctx.onMouseenter(...args))
|
|
97
97
|
}, [
|
|
98
|
-
vue.createElementVNode("div", _hoisted_1,
|
|
98
|
+
vue.createElementVNode("div", _hoisted_1, [
|
|
99
|
+
vue.createVNode(_component_CellRender, {
|
|
100
|
+
render: () => col.text,
|
|
101
|
+
params: []
|
|
102
|
+
}, null, 8, ["render"])
|
|
103
|
+
])
|
|
99
104
|
], 38);
|
|
100
105
|
}), 128))
|
|
101
106
|
], 4);
|
|
@@ -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
|
}, {}, {}>;
|
|
@@ -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
|
+
}
|