cosey 0.3.2 → 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.
@@ -15,6 +15,10 @@ export declare const tableExportProps: {
15
15
  filename: string;
16
16
  }>;
17
17
  };
18
+ footerCount: {
19
+ type: NumberConstructor;
20
+ default: number;
21
+ };
18
22
  width: {
19
23
  type: PropType<import("../..").FormDialogWidth>;
20
24
  default: string;
@@ -11,6 +11,10 @@ const tableExportExtraProps = {
11
11
  },
12
12
  config: {
13
13
  type: [Boolean, Object]
14
+ },
15
+ footerCount: {
16
+ type: Number,
17
+ default: 0
14
18
  }
15
19
  };
16
20
  const tableExportProps = {
@@ -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) => {
@@ -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
- }, null, 8, ["modelValue", "title", "config", "columns", "data"])])) : createCommentVNode("v-if", true), mergedToolbarConfig.value.fullScreen ? (openBlock(), createElementBlock("div", _hoisted_3, [createVNode(_component_el_tooltip, {
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cosey",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "description": "基于 Vue3 + vite 的后台管理系统框架",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -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 };
@@ -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 = [];