cosey 0.3.1 → 0.3.3
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/components/table/table-export/table-export.d.ts +4 -0
- package/components/table/table-export/table-export.js +4 -0
- package/components/table/table-export/table-export.vue.d.ts +9 -0
- package/components/table/table-export/table-export.vue.js +3 -1
- package/components/table/table-footer/utils.js +1 -1
- package/components/table/table.vue.js +4 -2
- package/package.json +1 -1
- package/utils/excel/index.d.ts +4 -1
- package/utils/excel/index.js +3 -2
|
@@ -13,6 +13,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
13
13
|
filename: string;
|
|
14
14
|
}>;
|
|
15
15
|
};
|
|
16
|
+
footerCount: {
|
|
17
|
+
type: NumberConstructor;
|
|
18
|
+
default: number;
|
|
19
|
+
};
|
|
16
20
|
width: {
|
|
17
21
|
type: import("vue").PropType<import("../..").FormDialogWidth>;
|
|
18
22
|
default: string;
|
|
@@ -184,6 +188,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
184
188
|
filename: string;
|
|
185
189
|
}>;
|
|
186
190
|
};
|
|
191
|
+
footerCount: {
|
|
192
|
+
type: NumberConstructor;
|
|
193
|
+
default: number;
|
|
194
|
+
};
|
|
187
195
|
width: {
|
|
188
196
|
type: import("vue").PropType<import("../..").FormDialogWidth>;
|
|
189
197
|
default: string;
|
|
@@ -369,5 +377,6 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
369
377
|
alignCenter: boolean;
|
|
370
378
|
fullscreen: boolean;
|
|
371
379
|
ariaLevel: string;
|
|
380
|
+
footerCount: number;
|
|
372
381
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
373
382
|
export default _default;
|
|
@@ -164,7 +164,9 @@ var stdin_default = /* @__PURE__ */defineComponent({
|
|
|
164
164
|
};
|
|
165
165
|
};
|
|
166
166
|
const onSubmit = async () => {
|
|
167
|
-
await exportExcel(getScheme(), props.data
|
|
167
|
+
await exportExcel(getScheme(), props.data, {
|
|
168
|
+
footerCount: props.footerCount
|
|
169
|
+
});
|
|
168
170
|
ElMessage.success(t("co.common.exportSuccess"));
|
|
169
171
|
};
|
|
170
172
|
return (_ctx, _cache) => {
|
|
@@ -51,7 +51,7 @@ const isFixedColumn = (index, fixed, store, realColumns) => {
|
|
|
51
51
|
const getFixedColumnsClass = (namespace, index, fixed, store, realColumns, offset = 0) => {
|
|
52
52
|
const classes = [];
|
|
53
53
|
const { direction, start, after } = isFixedColumn(index, fixed, store, realColumns);
|
|
54
|
-
if (direction
|
|
54
|
+
if (direction) {
|
|
55
55
|
const isLeft = direction === "left";
|
|
56
56
|
classes.push(`${namespace}-fixed-column--${direction}`);
|
|
57
57
|
if (isLeft && after + offset === unref(store.states.fixedLeafColumnsLength) - 1) {
|
|
@@ -148,6 +148,7 @@ var stdin_default = /* @__PURE__ */defineComponent({
|
|
|
148
148
|
}
|
|
149
149
|
return data;
|
|
150
150
|
});
|
|
151
|
+
const footerCount = computed(() => tableDataWithSummary.value.length - tableData.value.length);
|
|
151
152
|
const getFetchParams = () => {
|
|
152
153
|
const params = {
|
|
153
154
|
...orderParams,
|
|
@@ -415,8 +416,9 @@ var stdin_default = /* @__PURE__ */defineComponent({
|
|
|
415
416
|
title: unref(t)("co.table.exportData"),
|
|
416
417
|
config: mergedToolbarConfig.value.export,
|
|
417
418
|
columns: exportColumns.value,
|
|
418
|
-
data: tableDataWithSummary.value
|
|
419
|
-
|
|
419
|
+
data: tableDataWithSummary.value,
|
|
420
|
+
"footer-count": footerCount.value
|
|
421
|
+
}, null, 8, ["modelValue", "title", "config", "columns", "data", "footer-count"])])) : createCommentVNode("v-if", true), mergedToolbarConfig.value.fullScreen ? (openBlock(), createElementBlock("div", _hoisted_3, [createVNode(_component_el_tooltip, {
|
|
420
422
|
content: unref(isFullPage) ? unref(t)("co.table.exitFullScreen") : unref(t)("co.table.fullScreen"),
|
|
421
423
|
placement: "top",
|
|
422
424
|
"show-after": 200,
|
package/package.json
CHANGED
package/utils/excel/index.d.ts
CHANGED
|
@@ -5,11 +5,14 @@ import { type TableColumnProps } from '../../components/table/table-column/table
|
|
|
5
5
|
* 只取最底层的列组成表头
|
|
6
6
|
*/
|
|
7
7
|
export declare function flatColumns(columns: TableColumnProps[]): TableColumnProps[];
|
|
8
|
+
export interface ExportExcelOptions {
|
|
9
|
+
footerCount?: number;
|
|
10
|
+
}
|
|
8
11
|
/**
|
|
9
12
|
* 根据数据和配置,导出 excel 文件
|
|
10
13
|
*/
|
|
11
14
|
declare function exportExcel(scheme: ExportExcelScheme, data: Record<string, any>[] | {
|
|
12
15
|
[sheetName: string]: Record<string, any>[];
|
|
13
|
-
}): Promise<void>;
|
|
16
|
+
}, options?: ExportExcelOptions): Promise<void>;
|
|
14
17
|
export { bookFormats, exportExcel };
|
|
15
18
|
export type { ExportBookType, ExportExcelScheme };
|
package/utils/excel/index.js
CHANGED
|
@@ -122,7 +122,8 @@ function columns2lastLevelAoa(columns) {
|
|
|
122
122
|
})
|
|
123
123
|
];
|
|
124
124
|
}
|
|
125
|
-
async function exportExcel(scheme, data) {
|
|
125
|
+
async function exportExcel(scheme, data, options) {
|
|
126
|
+
const { footerCount = 0 } = options || {};
|
|
126
127
|
const worksheets = scheme.worksheet ? [scheme.worksheet] : scheme.worksheets || [];
|
|
127
128
|
const bookType = scheme.bookType || "csv";
|
|
128
129
|
const filename = scheme.filename + getExtByBookType(bookType);
|
|
@@ -134,7 +135,7 @@ async function exportExcel(scheme, data) {
|
|
|
134
135
|
let aoa = ooa.map(
|
|
135
136
|
(obj, index) => fColumns.map((column) => {
|
|
136
137
|
const value = obj[column.prop];
|
|
137
|
-
return transform ? transform(obj, column, value, index) : value;
|
|
138
|
+
return transform && index < ooa.length - footerCount ? transform(obj, column, value, index) : value;
|
|
138
139
|
})
|
|
139
140
|
);
|
|
140
141
|
let headAoa = [];
|