@nocobase/plugin-action-export 1.6.27 → 1.6.29

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.
@@ -10,16 +10,16 @@
10
10
  module.exports = {
11
11
  "@formily/react": "2.3.0",
12
12
  "@formily/shared": "2.3.2",
13
- "@nocobase/client": "1.6.27",
13
+ "@nocobase/client": "1.6.29",
14
14
  "react": "18.2.0",
15
15
  "@formily/antd-v5": "1.1.9",
16
16
  "react-i18next": "11.18.6",
17
17
  "lodash": "4.17.21",
18
18
  "file-saver": "2.0.5",
19
19
  "antd": "5.12.8",
20
- "@nocobase/server": "1.6.27",
21
- "@nocobase/actions": "1.6.27",
22
- "@nocobase/database": "1.6.27",
20
+ "@nocobase/server": "1.6.29",
21
+ "@nocobase/actions": "1.6.29",
22
+ "@nocobase/database": "1.6.29",
23
23
  "async-mutex": "0.5.0",
24
- "@nocobase/data-source-manager": "1.6.27"
24
+ "@nocobase/data-source-manager": "1.6.29"
25
25
  };
@@ -1 +1 @@
1
- {"name":"xlsx","version":"0.20.2","author":"sheetjs","description":"SheetJS Spreadsheet data parser and writer","keywords":["excel","xls","xlsx","xlsb","xlsm","ods","csv","dbf","dif","sylk","office","spreadsheet"],"bin":{"xlsx":"./bin/xlsx.njs"},"main":"xlsx.js","module":"xlsx.mjs","unpkg":"dist/xlsx.full.min.js","jsdelivr":"dist/xlsx.full.min.js","types":"types/index.d.ts","exports":{".":{"import":"./xlsx.mjs","require":"./xlsx.js","types":"./types/index.d.ts"},"./xlsx.mjs":{"import":"./xlsx.mjs","types":"./types/index.d.ts"},"./xlsx.js":{"require":"./xlsx.js","types":"./types/index.d.ts"},"./dist/xlsx.core.min":{"import":"./dist/xlsx.core.min.js","require":"./dist/xlsx.core.min.js","types":"./types/index.d.ts"},"./dist/xlsx.core.min.js":{"import":"./dist/xlsx.core.min.js","require":"./dist/xlsx.core.min.js","types":"./types/index.d.ts"},"./dist/xlsx.full.min":{"import":"./dist/xlsx.full.min.js","require":"./dist/xlsx.full.min.js","types":"./types/index.d.ts"},"./dist/xlsx.full.min.js":{"import":"./dist/xlsx.full.min.js","require":"./dist/xlsx.full.min.js","types":"./types/index.d.ts"},"./dist/xlsx.mini.min":{"import":"./dist/xlsx.mini.min.js","require":"./dist/xlsx.mini.min.js","types":"./types/index.d.ts"},"./dist/xlsx.mini.min.js":{"import":"./dist/xlsx.mini.min.js","require":"./dist/xlsx.mini.min.js","types":"./types/index.d.ts"},"./dist/xlsx.zahl":{"import":"./dist/xlsx.zahl.mjs","require":"./dist/xlsx.zahl.js","types":"./dist/zahl.d.ts"},"./dist/xlsx.zahl.mjs":{"import":"./dist/xlsx.zahl.mjs","types":"./dist/zahl.d.ts"},"./dist/xlsx.zahl.js":{"require":"./dist/xlsx.zahl.js","types":"./dist/zahl.d.ts"},"./dist/cpexcel":{"import":"./dist/cpexcel.full.mjs","require":"./dist/cpexcel.js","types":"./dist/cpexcel.d.ts"},"./dist/cpexcel.js":{"require":"./dist/cpexcel.js","types":"./dist/cpexcel.d.ts"},"./dist/cpexcel.full":{"import":"./dist/cpexcel.full.mjs","require":"./dist/cpexcel.js","types":"./dist/cpexcel.d.ts"},"./dist/cpexcel.full.mjs":{"import":"./dist/cpexcel.full.mjs","types":"./dist/cpexcel.d.ts"}},"browser":{"buffer":false,"crypto":false,"stream":false,"process":false,"fs":false},"sideEffects":false,"dependencies":{},"devDependencies":{"@sheetjs/uglify-js":"~2.7.3","@types/node":"^8.5.9","acorn":"7.4.1","adler-32":"~1.3.1","alex":"8.1.1","blanket":"~1.2.3","cfb":"~1.2.2","codepage":"~1.15.0","commander":"~2.17.1","crc-32":"~1.2.2","dtslint":"^0.1.2","eslint":"7.23.0","eslint-plugin-html":"^6.1.2","eslint-plugin-json":"^2.1.2","exit-on-epipe":"~1.0.1","fflate":"^0.7.1","jsdom":"~11.1.0","markdown-spellcheck":"^1.3.1","mocha":"~2.5.3","sinon":"^1.17.7","ssf":"~0.11.2","typescript":"2.2.0","wmf":"~1.0.1","word":"~0.3.0"},"repository":{"type":"git","url":"https://git.sheetjs.com/SheetJS/sheetjs"},"scripts":{"pretest":"npm run lint","test":"npm run tests-only","pretest-only":"git submodule init && git submodule update","tests-only":"make travis","build":"make","lint":"make fullint","dtslint":"dtslint types"},"config":{"blanket":{"pattern":"xlsx.js"}},"alex":{"allow":["chinese","special","simple","just","crash","wtf","holes"]},"homepage":"https://sheetjs.com/","files":["CHANGELOG.md","LICENSE","README.md","bower.json","package.json","xlsx.js","xlsx.mjs","xlsxworker.js","bin/xlsx.njs","dist/LICENSE","dist/*.mjs","dist/*.js","dist/*.map","dist/*.d.ts","types/index.d.ts","types/tsconfig.json"],"bugs":{"url":"https://git.sheetjs.com/SheetJS/sheetjs/issues"},"license":"Apache-2.0","engines":{"node":">=0.8"},"_lastModified":"2025-05-08T01:40:43.056Z"}
1
+ {"name":"xlsx","version":"0.20.2","author":"sheetjs","description":"SheetJS Spreadsheet data parser and writer","keywords":["excel","xls","xlsx","xlsb","xlsm","ods","csv","dbf","dif","sylk","office","spreadsheet"],"bin":{"xlsx":"./bin/xlsx.njs"},"main":"xlsx.js","module":"xlsx.mjs","unpkg":"dist/xlsx.full.min.js","jsdelivr":"dist/xlsx.full.min.js","types":"types/index.d.ts","exports":{".":{"import":"./xlsx.mjs","require":"./xlsx.js","types":"./types/index.d.ts"},"./xlsx.mjs":{"import":"./xlsx.mjs","types":"./types/index.d.ts"},"./xlsx.js":{"require":"./xlsx.js","types":"./types/index.d.ts"},"./dist/xlsx.core.min":{"import":"./dist/xlsx.core.min.js","require":"./dist/xlsx.core.min.js","types":"./types/index.d.ts"},"./dist/xlsx.core.min.js":{"import":"./dist/xlsx.core.min.js","require":"./dist/xlsx.core.min.js","types":"./types/index.d.ts"},"./dist/xlsx.full.min":{"import":"./dist/xlsx.full.min.js","require":"./dist/xlsx.full.min.js","types":"./types/index.d.ts"},"./dist/xlsx.full.min.js":{"import":"./dist/xlsx.full.min.js","require":"./dist/xlsx.full.min.js","types":"./types/index.d.ts"},"./dist/xlsx.mini.min":{"import":"./dist/xlsx.mini.min.js","require":"./dist/xlsx.mini.min.js","types":"./types/index.d.ts"},"./dist/xlsx.mini.min.js":{"import":"./dist/xlsx.mini.min.js","require":"./dist/xlsx.mini.min.js","types":"./types/index.d.ts"},"./dist/xlsx.zahl":{"import":"./dist/xlsx.zahl.mjs","require":"./dist/xlsx.zahl.js","types":"./dist/zahl.d.ts"},"./dist/xlsx.zahl.mjs":{"import":"./dist/xlsx.zahl.mjs","types":"./dist/zahl.d.ts"},"./dist/xlsx.zahl.js":{"require":"./dist/xlsx.zahl.js","types":"./dist/zahl.d.ts"},"./dist/cpexcel":{"import":"./dist/cpexcel.full.mjs","require":"./dist/cpexcel.js","types":"./dist/cpexcel.d.ts"},"./dist/cpexcel.js":{"require":"./dist/cpexcel.js","types":"./dist/cpexcel.d.ts"},"./dist/cpexcel.full":{"import":"./dist/cpexcel.full.mjs","require":"./dist/cpexcel.js","types":"./dist/cpexcel.d.ts"},"./dist/cpexcel.full.mjs":{"import":"./dist/cpexcel.full.mjs","types":"./dist/cpexcel.d.ts"}},"browser":{"buffer":false,"crypto":false,"stream":false,"process":false,"fs":false},"sideEffects":false,"dependencies":{},"devDependencies":{"@sheetjs/uglify-js":"~2.7.3","@types/node":"^8.5.9","acorn":"7.4.1","adler-32":"~1.3.1","alex":"8.1.1","blanket":"~1.2.3","cfb":"~1.2.2","codepage":"~1.15.0","commander":"~2.17.1","crc-32":"~1.2.2","dtslint":"^0.1.2","eslint":"7.23.0","eslint-plugin-html":"^6.1.2","eslint-plugin-json":"^2.1.2","exit-on-epipe":"~1.0.1","fflate":"^0.7.1","jsdom":"~11.1.0","markdown-spellcheck":"^1.3.1","mocha":"~2.5.3","sinon":"^1.17.7","ssf":"~0.11.2","typescript":"2.2.0","wmf":"~1.0.1","word":"~0.3.0"},"repository":{"type":"git","url":"https://git.sheetjs.com/SheetJS/sheetjs"},"scripts":{"pretest":"npm run lint","test":"npm run tests-only","pretest-only":"git submodule init && git submodule update","tests-only":"make travis","build":"make","lint":"make fullint","dtslint":"dtslint types"},"config":{"blanket":{"pattern":"xlsx.js"}},"alex":{"allow":["chinese","special","simple","just","crash","wtf","holes"]},"homepage":"https://sheetjs.com/","files":["CHANGELOG.md","LICENSE","README.md","bower.json","package.json","xlsx.js","xlsx.mjs","xlsxworker.js","bin/xlsx.njs","dist/LICENSE","dist/*.mjs","dist/*.js","dist/*.map","dist/*.d.ts","types/index.d.ts","types/tsconfig.json"],"bugs":{"url":"https://git.sheetjs.com/SheetJS/sheetjs/issues"},"license":"Apache-2.0","engines":{"node":">=0.8"},"_lastModified":"2025-05-13T06:31:55.618Z"}
@@ -7,11 +7,9 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
 
10
- var __create = Object.create;
11
10
  var __defProp = Object.defineProperty;
12
11
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
12
  var __getOwnPropNames = Object.getOwnPropertyNames;
14
- var __getProtoOf = Object.getPrototypeOf;
15
13
  var __hasOwnProp = Object.prototype.hasOwnProperty;
16
14
  var __export = (target, all) => {
17
15
  for (var name in all)
@@ -25,14 +23,6 @@ var __copyProps = (to, from, except, desc) => {
25
23
  }
26
24
  return to;
27
25
  };
28
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
29
- // If the importer is in node compatibility mode or this is not an ESM
30
- // file that has been converted to a CommonJS file using a Babel-
31
- // compatible transform (i.e. "__esModule" has not been set), then set
32
- // "default" to the CommonJS "module.exports" for node compatibility.
33
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
34
- mod
35
- ));
36
26
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
37
27
  var export_xlsx_exports = {};
38
28
  __export(export_xlsx_exports, {
@@ -40,7 +30,6 @@ __export(export_xlsx_exports, {
40
30
  });
41
31
  module.exports = __toCommonJS(export_xlsx_exports);
42
32
  var import_xlsx_exporter = require("../services/xlsx-exporter");
43
- var import_xlsx = __toESM(require("xlsx"));
44
33
  var import_async_mutex = require("async-mutex");
45
34
  const mutex = new import_async_mutex.Mutex();
46
35
  async function exportXlsxAction(ctx, next) {
@@ -66,7 +55,7 @@ async function exportXlsxAction(ctx, next) {
66
55
  }
67
56
  });
68
57
  const wb = await xlsxExporter.run(ctx);
69
- ctx.body = import_xlsx.default.write(wb, { type: "buffer", bookType: "xlsx" });
58
+ ctx.body = import_xlsx_exporter.XlsxExporter.xlsxSafeWrite(wb, { type: "buffer", bookType: "xlsx" });
70
59
  ctx.set({
71
60
  "Content-Type": "application/octet-stream",
72
61
  "Content-Disposition": `attachment; filename=${encodeURI(title)}.xlsx`
@@ -84,16 +84,18 @@ class BaseExporter extends import_events.default {
84
84
  return this.finalize();
85
85
  }
86
86
  getAppendOptionsFromFields(ctx) {
87
- var _a, _b, _c, _d, _e;
88
- const fields = this.options.fields.map((x) => x[0]);
89
- const hasPermissionFields = import_lodash.default.isEmpty((_b = (_a = ctx == null ? void 0 : ctx.permission) == null ? void 0 : _a.can) == null ? void 0 : _b.params) ? fields : import_lodash.default.intersection(((_e = (_d = (_c = ctx == null ? void 0 : ctx.permission) == null ? void 0 : _c.can) == null ? void 0 : _d.params) == null ? void 0 : _e.appends) || [], fields);
90
- return hasPermissionFields.map((field) => {
91
- const fieldInstance = this.options.collection.getField(field);
87
+ return this.options.fields.filter((fieldPath) => {
88
+ var _a, _b, _c, _d, _e;
89
+ const field = fieldPath[0];
90
+ const hasPermission = import_lodash.default.isEmpty((_b = (_a = ctx == null ? void 0 : ctx.permission) == null ? void 0 : _a.can) == null ? void 0 : _b.params) || (((_e = (_d = (_c = ctx == null ? void 0 : ctx.permission) == null ? void 0 : _c.can) == null ? void 0 : _d.params) == null ? void 0 : _e.appends) || []).includes(field);
91
+ return hasPermission;
92
+ }).map((fieldPath) => {
93
+ const fieldInstance = this.options.collection.getField(fieldPath[0]);
92
94
  if (!fieldInstance) {
93
- throw new Error(`Field "${field}" not found: , please check the fields configuration.`);
95
+ throw new Error(`Field "${fieldPath[0]}" not found: , please check the fields configuration.`);
94
96
  }
95
97
  if (fieldInstance.isRelationField()) {
96
- return field;
98
+ return fieldPath.join(".");
97
99
  }
98
100
  return null;
99
101
  }).filter(Boolean);
@@ -1,3 +1,11 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
1
9
  import XLSX from 'xlsx';
2
10
  import { BaseExporter, ExportOptions } from './base-exporter';
3
11
  type ExportColumn = {
@@ -30,5 +38,6 @@ export declare class XlsxExporter extends BaseExporter<XlsxExportOptions & {
30
38
  handleRow(row: any, ctx?: any): Promise<void>;
31
39
  finalize(): Promise<XLSX.WorkBook>;
32
40
  private renderHeaders;
41
+ static xlsxSafeWrite(wb: XLSX.WorkBook, opts: XLSX.WritingOptions, path?: string): any;
33
42
  }
34
43
  export {};
@@ -42,6 +42,7 @@ module.exports = __toCommonJS(xlsx_exporter_exports);
42
42
  var import_xlsx = __toESM(require("xlsx"));
43
43
  var import_base_exporter = require("./base-exporter");
44
44
  var import_database = require("@nocobase/database");
45
+ const XLSX_LIMIT_CHAER = 32767;
45
46
  class XlsxExporter extends import_base_exporter.BaseExporter {
46
47
  /**
47
48
  * You can adjust the maximum number of exported rows based on business needs and system
@@ -103,6 +104,17 @@ class XlsxExporter extends import_base_exporter.BaseExporter {
103
104
  return col.title || (fieldInstance == null ? void 0 : fieldInstance.options.title) || col.defaultTitle;
104
105
  });
105
106
  }
107
+ static xlsxSafeWrite(wb, opts, path) {
108
+ var _a;
109
+ const data = wb.Sheets.Data;
110
+ for (const key of Object.keys(data)) {
111
+ const v = (_a = data[key]) == null ? void 0 : _a.v;
112
+ if ((v == null ? void 0 : v.length) > XLSX_LIMIT_CHAER) {
113
+ data[key].v = v.slice(0, XLSX_LIMIT_CHAER);
114
+ }
115
+ }
116
+ return path ? import_xlsx.default.writeFileXLSX(wb, path) : import_xlsx.default.write(wb, opts);
117
+ }
106
118
  }
107
119
  function isNumeric(n) {
108
120
  return !isNaN(parseFloat(n)) && isFinite(n);
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "displayName.zh-CN": "操作:导出记录",
5
5
  "description": "Export filtered records to excel, you can configure which fields to export.",
6
6
  "description.zh-CN": "导出筛选后的记录到 Excel 中,可以配置导出哪些字段。",
7
- "version": "1.6.27",
7
+ "version": "1.6.29",
8
8
  "license": "AGPL-3.0",
9
9
  "main": "./dist/server/index.js",
10
10
  "homepage": "https://docs.nocobase.com/handbook/action-export",
@@ -29,7 +29,7 @@
29
29
  "@nocobase/test": "1.x",
30
30
  "@nocobase/utils": "1.x"
31
31
  },
32
- "gitHead": "ec32854b338d799b52278829261355b756e577b5",
32
+ "gitHead": "9539ebb7c421a09dc795507edb1e3adcb2686038",
33
33
  "keywords": [
34
34
  "Actions"
35
35
  ]