@nocobase/plugin-action-export 1.6.21 → 1.6.23

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.21",
13
+ "@nocobase/client": "1.6.23",
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.21",
21
- "@nocobase/actions": "1.6.21",
22
- "@nocobase/database": "1.6.21",
20
+ "@nocobase/server": "1.6.23",
21
+ "@nocobase/actions": "1.6.23",
22
+ "@nocobase/database": "1.6.23",
23
23
  "async-mutex": "0.5.0",
24
- "@nocobase/data-source-manager": "1.6.21"
24
+ "@nocobase/data-source-manager": "1.6.23"
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-04-17T07:01:09.413Z"}
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-04-23T15:15:47.860Z"}
@@ -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
  /// <reference types="node" />
2
10
  import { FindOptions, ICollection, ICollectionManager, IField, IModel } from '@nocobase/data-source-manager';
3
11
  import EventEmitter from 'events';
@@ -29,8 +37,8 @@ declare abstract class BaseExporter<T extends ExportOptions = ExportOptions> ext
29
37
  abstract finalize(): Promise<any>;
30
38
  abstract handleRow(row: any, ctx?: any): Promise<void>;
31
39
  run(ctx?: any): Promise<any>;
32
- protected getAppendOptionsFromFields(): string[];
33
- protected getFindOptions(): any;
40
+ protected getAppendOptionsFromFields(ctx?: any): string[];
41
+ protected getFindOptions(ctx?: any): any;
34
42
  protected findFieldByDataIndex(dataIndex: Array<string>): IField;
35
43
  protected renderRawValue(value: any): any;
36
44
  protected getFieldRenderer(field?: IField, ctx?: any): (value: any) => any;
@@ -43,6 +43,7 @@ var import_events = __toESM(require("events"));
43
43
  var import_deep_get = require("../utils/deep-get");
44
44
  var import_path = __toESM(require("path"));
45
45
  var import_os = __toESM(require("os"));
46
+ var import_lodash = __toESM(require("lodash"));
46
47
  class BaseExporter extends import_events.default {
47
48
  constructor(options) {
48
49
  super();
@@ -64,10 +65,10 @@ class BaseExporter extends import_events.default {
64
65
  async run(ctx) {
65
66
  await this.init(ctx);
66
67
  const { collection, chunkSize, repository } = this.options;
67
- const total = await (repository || collection.repository).count(this.getFindOptions());
68
+ const total = await (repository || collection.repository).count(this.getFindOptions(ctx));
68
69
  let current = 0;
69
70
  await (repository || collection.repository).chunk({
70
- ...this.getFindOptions(),
71
+ ...this.getFindOptions(ctx),
71
72
  chunkSize: chunkSize || 200,
72
73
  callback: async (rows, options) => {
73
74
  for (const row of rows) {
@@ -82,24 +83,27 @@ class BaseExporter extends import_events.default {
82
83
  });
83
84
  return this.finalize();
84
85
  }
85
- getAppendOptionsFromFields() {
86
- return this.options.fields.map((field) => {
87
- const fieldInstance = this.options.collection.getField(field[0]);
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);
88
92
  if (!fieldInstance) {
89
- throw new Error(`Field "${field[0]}" not found: , please check the fields configuration.`);
93
+ throw new Error(`Field "${field}" not found: , please check the fields configuration.`);
90
94
  }
91
95
  if (fieldInstance.isRelationField()) {
92
- return field.join(".");
96
+ return field;
93
97
  }
94
98
  return null;
95
99
  }).filter(Boolean);
96
100
  }
97
- getFindOptions() {
101
+ getFindOptions(ctx) {
98
102
  const { findOptions = {} } = this.options;
99
103
  if (this.limit) {
100
104
  findOptions.limit = this.limit;
101
105
  }
102
- const appendOptions = this.getAppendOptionsFromFields();
106
+ const appendOptions = this.getAppendOptionsFromFields(ctx);
103
107
  if (appendOptions.length) {
104
108
  return {
105
109
  ...findOptions,
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.21",
7
+ "version": "1.6.23",
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": "2538df7c081e1bb558acead3f0cd87b6a7f02c78",
32
+ "gitHead": "2ec917c09dc303978bdd33893d27c775d532c8f9",
33
33
  "keywords": [
34
34
  "Actions"
35
35
  ]