@nocobase/plugin-action-import 1.0.0-alpha.1

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.
Files changed (76) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +222 -0
  3. package/README.zh-CN.md +222 -0
  4. package/client.d.ts +2 -0
  5. package/client.js +1 -0
  6. package/dist/client/ImportActionInitializer.d.ts +9 -0
  7. package/dist/client/ImportDesigner.d.ts +2 -0
  8. package/dist/client/ImportModal.d.ts +6 -0
  9. package/dist/client/ImportPluginProvider.d.ts +3 -0
  10. package/dist/client/constants.d.ts +1 -0
  11. package/dist/client/context.d.ts +29 -0
  12. package/dist/client/index.d.ts +9 -0
  13. package/dist/client/index.js +24 -0
  14. package/dist/client/locale/index.d.ts +2 -0
  15. package/dist/client/schemaSettings.d.ts +2 -0
  16. package/dist/client/useFields.d.ts +1 -0
  17. package/dist/client/useImportAction.d.ts +6 -0
  18. package/dist/client/useShared.d.ts +76 -0
  19. package/dist/externalVersion.js +18 -0
  20. package/dist/index.d.ts +3 -0
  21. package/dist/index.js +43 -0
  22. package/dist/locale/en-US.json +28 -0
  23. package/dist/locale/es-ES.json +27 -0
  24. package/dist/locale/ko_KR.json +28 -0
  25. package/dist/locale/pt-BR.json +27 -0
  26. package/dist/locale/zh-CN.json +29 -0
  27. package/dist/node_modules/node-xlsx/lib/helpers.js +142 -0
  28. package/dist/node_modules/node-xlsx/lib/index.js +6 -0
  29. package/dist/node_modules/node-xlsx/lib/workbook.js +16 -0
  30. package/dist/node_modules/node-xlsx/package.json +1 -0
  31. package/dist/node_modules/xlsx/LICENSE +201 -0
  32. package/dist/node_modules/xlsx/bin/xlsx.njs +302 -0
  33. package/dist/node_modules/xlsx/bower.json +22 -0
  34. package/dist/node_modules/xlsx/dist/cpexcel.js +1506 -0
  35. package/dist/node_modules/xlsx/dist/jszip.js +9000 -0
  36. package/dist/node_modules/xlsx/dist/shim.min.js +2 -0
  37. package/dist/node_modules/xlsx/dist/xlsx.core.min.js +18 -0
  38. package/dist/node_modules/xlsx/dist/xlsx.extendscript.js +31850 -0
  39. package/dist/node_modules/xlsx/dist/xlsx.full.min.js +24 -0
  40. package/dist/node_modules/xlsx/dist/xlsx.js +22693 -0
  41. package/dist/node_modules/xlsx/dist/xlsx.min.js +15 -0
  42. package/dist/node_modules/xlsx/dist/xlsx.mini.min.js +9 -0
  43. package/dist/node_modules/xlsx/jszip.js +9000 -0
  44. package/dist/node_modules/xlsx/package.json +1 -0
  45. package/dist/node_modules/xlsx/types/index.d.ts +853 -0
  46. package/dist/node_modules/xlsx/xlsx.js +6 -0
  47. package/dist/node_modules/xlsx/xlsx.mini.js +10709 -0
  48. package/dist/node_modules/xlsx/xlsxworker.js +15 -0
  49. package/dist/server/actions/downloadXlsxTemplate.d.ts +2 -0
  50. package/dist/server/actions/downloadXlsxTemplate.js +62 -0
  51. package/dist/server/actions/importXlsx.d.ts +2 -0
  52. package/dist/server/actions/importXlsx.js +185 -0
  53. package/dist/server/actions/index.d.ts +2 -0
  54. package/dist/server/actions/index.js +23 -0
  55. package/dist/server/index.d.ts +7 -0
  56. package/dist/server/index.js +59 -0
  57. package/dist/server/locale/en-US.d.ts +11 -0
  58. package/dist/server/locale/en-US.js +32 -0
  59. package/dist/server/locale/fr-FR.d.ts +11 -0
  60. package/dist/server/locale/fr-FR.js +32 -0
  61. package/dist/server/locale/index.d.ts +2 -0
  62. package/dist/server/locale/index.js +40 -0
  63. package/dist/server/locale/zh-CN.d.ts +12 -0
  64. package/dist/server/locale/zh-CN.js +33 -0
  65. package/dist/server/middleware/index.d.ts +2 -0
  66. package/dist/server/middleware/index.js +34 -0
  67. package/dist/server/migrations/20240425223956-change-locale-module.d.ts +6 -0
  68. package/dist/server/migrations/20240425223956-change-locale-module.js +42 -0
  69. package/dist/server/utils/index.d.ts +6 -0
  70. package/dist/server/utils/index.js +54 -0
  71. package/dist/server/utils/transform.d.ts +84 -0
  72. package/dist/server/utils/transform.js +226 -0
  73. package/dist/swagger/index.json +33 -0
  74. package/package.json +41 -0
  75. package/server.d.ts +2 -0
  76. package/server.js +1 -0
@@ -0,0 +1,18 @@
1
+ module.exports = {
2
+ "@formily/react": "2.3.0",
3
+ "@formily/shared": "2.3.0",
4
+ "@nocobase/client": "1.0.0-alpha.1",
5
+ "react": "18.2.0",
6
+ "antd": "5.12.8",
7
+ "@formily/antd-v5": "1.1.9",
8
+ "react-i18next": "11.18.6",
9
+ "@ant-design/icons": "5.2.6",
10
+ "react-dom": "18.2.0",
11
+ "lodash": "4.17.21",
12
+ "@formily/core": "2.3.0",
13
+ "@nocobase/server": "1.0.0-alpha.1",
14
+ "@nocobase/actions": "1.0.0-alpha.1",
15
+ "@nocobase/database": "1.0.0-alpha.1",
16
+ "@nocobase/utils": "1.0.0-alpha.1",
17
+ "mathjs": "10.6.4"
18
+ };
@@ -0,0 +1,3 @@
1
+ export * from './server';
2
+ export { default } from './server';
3
+ export declare const namespace: string;
package/dist/index.js ADDED
@@ -0,0 +1,43 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name2 in all)
9
+ __defProp(target, name2, { get: all[name2], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var src_exports = {};
30
+ __export(src_exports, {
31
+ default: () => import_server.default,
32
+ namespace: () => namespace
33
+ });
34
+ module.exports = __toCommonJS(src_exports);
35
+ var import_package = require("../package.json");
36
+ __reExport(src_exports, require("./server"), module.exports);
37
+ var import_server = __toESM(require("./server"));
38
+ const namespace = import_package.name;
39
+ // Annotate the CommonJS export names for ESM import in node:
40
+ 0 && (module.exports = {
41
+ namespace,
42
+ ...require("./server")
43
+ });
@@ -0,0 +1,28 @@
1
+ {
2
+ "Only one file is allowed to be uploaded": "Only one file is allowed to be uploaded",
3
+ "File size cannot exceed 10M": "File size cannot exceed 10M",
4
+ "Please upload the file of Excel": "Please upload the file of Excel",
5
+ "Import Data": "Import Data",
6
+ "Start import": "Start import",
7
+ "Import explain": "Guide",
8
+ "Download template": "Download template",
9
+ "Step 1: Download template": "Step 1: Download template",
10
+ "Step 2: Upload Excel": "Step 2: Upload Excel",
11
+ "Download tip": "- Download the template and fill in the data according to the format \r\n - Import only the first worksheet \r\n - Support single import of up to 1,000 rows of data \r\n - Do not change the header of the template to prevent import failure",
12
+ "Import warning": "You can import up to 200 rows of data at a time, any excess will be ignored.",
13
+ "Upload placeholder": "Drag and drop the file here or click to upload, file size should not exceed 30M",
14
+ "Excel data importing": "Excel data importing",
15
+ "Import done, total success have {{successCount}} , total failure have {{failureCount}}": "Import is complete, with a total of {{successCount}} successful and {{failureCount}} failed",
16
+ "To download the failure data": "To download the failure data",
17
+ "Add importable field": "Add importable field",
18
+ "Done": "Done",
19
+ "Yes": "Yes",
20
+ "No": "No",
21
+ "Field {{fieldName}} does not exist": "Field {{fieldName}} does not exist",
22
+ "can not find value": "can not find value",
23
+ "password is empty": "password is empty",
24
+ "Incorrect time format": "Incorrect time format",
25
+ "Incorrect date format": "Incorrect date format",
26
+ "Incorrect email format": "Incorrect email format",
27
+ "Illegal percentage format": "Illegal percentage format"
28
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "Only one file is allowed to be uploaded": "Sólo se permite cargar un archivo",
3
+ "File size cannot exceed 10M": "El tamaño del archivo no puede superar los 10M",
4
+ "Please upload the file of Excel": "Por favor, cargue el archivo de Excel",
5
+ "Import Data": "Importar datos",
6
+ "Start import": "Iniciar importación",
7
+ "Import explain": "Guía",
8
+ "Download template": "Descargar plantilla",
9
+ "Step 1: Download template": "Paso 1: Descargar plantilla",
10
+ "Step 2: Upload Excel": "Paso 2: Cargar Excel",
11
+ "Download tip": "- Descargar la plantilla y rellenar los datos según el formato \r\n - Importar sólo la primera hoja de cálculo \r\n - Soportar una única importación de hasta 10.000 filas de datos \r\n - No cambiar la cabecera de la plantilla para evitar fallos en la importación",
12
+ "Upload placeholder": "Arrastra y suelta el archivo aquí o haga clic para cargarlo, el tamaño del archivo no debe superar los 10M",
13
+ "Excel data importing": "Importación de datos Excel",
14
+ "Import done, total success have {{successCount}} , total failure have {{failureCount}}": "La importación se ha completado, con un total de {{successCount}} correctos y {{failureCount}} fallidos",
15
+ "To download the failure data": "Para descargar los datos de fallo",
16
+ "Add importable field": "Añadir campo importable",
17
+ "Done": "Hecho",
18
+ "Yes": "Sí",
19
+ "No": "No",
20
+ "Field {{fieldName}} does not exist": "El campo {{fieldName}} no existe",
21
+ "can not find value": "no se puede encontrar el valor",
22
+ "password is empty": "la contraseña está vacía",
23
+ "Incorrect time format": "Formato de hora incorrecto",
24
+ "Incorrect date format": "Formato de fecha incorrecto",
25
+ "Incorrect email format": "Formato de correo electrónico incorrecto",
26
+ "Illegal percentage format": "Formato de porcentaje ilegal"
27
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "Only one file is allowed to be uploaded": "하나의 파일만 업로드 할 수 있습니다",
3
+ "File size cannot exceed 10M": "파일 크기는 10M을 초과할 수 없습니다",
4
+ "Please upload the file of Excel": "Excel 파일을 업로드하십시오",
5
+ "Import Data": "데이터 가져오기",
6
+ "Start import": "가져오기 시작",
7
+ "Import explain": "가져오기 설명",
8
+ "Download template": "템플릿 다운로드",
9
+ "Step 1: Download template": "단계 1: 템플릿 다운로드",
10
+ "Step 2: Upload Excel": "단계 2: Excel 업로드",
11
+ "Download tip": "- 템플릿을 다운로드하고 형식에 맞게 데이터를 작성합니다.\r\n - 첫 번째 시트만 가져옵니다.\r\n - 단일 가져오기로 10000행 이하의 데이터를 지원합니다.\r\n - 템플릿 헤더를 수정하지 마세요. 가져오기 실패를 방지합니다.",
12
+ "Upload placeholder": "파일을 여기에 드래그하거나 클릭하여 업로드하십시오. 파일 크기는 10M을 초과할 수 없습니다.",
13
+ "Excel data importing": "Excel 데이터 가져오기 중입니다. 창을 닫지 마십시오.",
14
+ "Import done, total success have {{successCount}} , total failure have {{failureCount}}": "가져오기 완료, 총 성공 {{successCount}} 건, 총 실패 {{failureCount}} 건",
15
+ "To download the failure data": "실패한 데이터를 다운로드하려면",
16
+ "Add importable field": "가져올 수 있는 필드 추가",
17
+ "Done": "완료",
18
+ "Yes": "예",
19
+ "No": "아니요",
20
+ "Field {{fieldName}} does not exist": "필드 {{fieldName}}가 존재하지 않습니다",
21
+ "can not find value": "값을 찾을 수 없습니다",
22
+ "password is empty": "암호가 비어 있습니다",
23
+ "Incorrect time format": "잘못된 시간 형식",
24
+ "Incorrect date format": "잘못된 날짜 형식",
25
+ "Incorrect email format": "잘못된 이메일 형식",
26
+ "Illegal percentage format": "잘못된 백분율 형식",
27
+ "Imported template does not match, please download again.": "가져온 템플릿이 일치하지 않습니다. 다시 다운로드하세요."
28
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "Only one file is allowed to be uploaded": "Somente um arquivo pode ser enviado de cada vez",
3
+ "File size cannot exceed 10M": "O tamanho do arquivo não pode exceder 10 MB",
4
+ "Please upload the file of Excel": "Por favor, envie um arquivo do Excel",
5
+ "Import Data": "Importar dados",
6
+ "Start import": "Iniciar importação",
7
+ "Import explain": "Guia",
8
+ "Download template": "Baixar modelo",
9
+ "Step 1: Download template": "Passo 1: Baixar modelo",
10
+ "Step 2: Upload Excel": "Passo 2: Enviar Excel",
11
+ "Download tip": "- Baixe o modelo e preencha os dados de acordo com o formato \r\n - Importe apenas a primeira planilha \r\n - Suporte de importação única de até 10.000 linhas de dados \r\n - Não altere o cabeçalho do modelo para evitar falhas de importação",
12
+ "Upload placeholder": "Arraste e solte o arquivo aqui ou clique para enviar, o tamanho do arquivo não deve exceder 10 MB",
13
+ "Excel data importing": "Importando dados do Excel",
14
+ "Import done, total success have {{successCount}} , total failure have {{failureCount}}": "Importação concluída, com um total de {{successCount}} sucesso e {{failureCount}} falhas",
15
+ "To download the failure data": "Para baixar os dados que falharam",
16
+ "Add importable field": "Adicionar campo importável",
17
+ "Done": "Concluído",
18
+ "Yes": "Sim",
19
+ "No": "Não",
20
+ "Field {{fieldName}} does not exist": "O campo {{fieldName}} não existe",
21
+ "can not find value": "Não foi possível encontrar o valor",
22
+ "password is empty": "A senha está vazia",
23
+ "Incorrect time format": "Formato de hora incorreto",
24
+ "Incorrect date format": "Formato de data incorreto",
25
+ "Incorrect email format": "Formato de e-mail incorreto",
26
+ "Illegal percentage format": "Formato de porcentagem ilegal"
27
+ }
@@ -0,0 +1,29 @@
1
+ {
2
+ "Only one file is allowed to be uploaded": "只允许上传一个文件",
3
+ "File size cannot exceed 10M": "文件大小不能超过10M",
4
+ "Please upload the file of Excel": "请上传Excel的文件",
5
+ "Import Data": "导入数据",
6
+ "Start import": "开始导入",
7
+ "Import explain": "说明",
8
+ "Download template": "下载模板",
9
+ "Step 1: Download template": "1.下载模板",
10
+ "Step 2: Upload Excel": "2.上传完善后的表格",
11
+ "Download tip": "- 下载模板后,按格式填写数据\r\n - 只导入第一张工作表\r\n - 支持单次导入不超过1000行数据\r\n - 请勿改模板表头,防止导入失败",
12
+ "Import warning": "每次最多导入 200 行数据,超出的将被忽略。",
13
+ "Upload placeholder": "将文件拖曳到此处或点击上传,文件大小不超过10M",
14
+ "Excel data importing": "数据导入中,请勿关闭窗口",
15
+ "Import done, total success have {{successCount}} , total failure have {{failureCount}}": "导入完成,共导入成功{{successCount}}条数据,共导入失败{{failureCount}}条数据",
16
+ "To download the failure data": "下载导入失败的数据",
17
+ "Add importable field": "添加可导入字段",
18
+ "Done": "完成",
19
+ "Yes": "是",
20
+ "No": "否",
21
+ "Field {{fieldName}} does not exist": "字段 {{fieldName}} 不存在",
22
+ "can not find value": "找不到对应值",
23
+ "password is empty": "密码为空",
24
+ "Incorrect time format": "时间格式不正确",
25
+ "Incorrect date format": "日期格式不正确",
26
+ "Incorrect email format": "邮箱格式不正确",
27
+ "Illegal percentage format": "百分比格式有误",
28
+ "Imported template does not match, please download again.": "导入模板不匹配,请检查导入文件标题行或重新下载导入模板"
29
+ }
@@ -0,0 +1,142 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ exports.__esModule = true;
6
+ exports.buildSheetFromMatrix = exports.buildExcelDate = exports.isCellDescriptor = exports.isObject = exports.isString = exports.isNumber = exports.isBoolean = void 0;
7
+
8
+ var _xlsx = _interopRequireDefault(require("xlsx"));
9
+
10
+ var ORIGIN_DATE = new Date(Date.UTC(1899, 11, 30));
11
+
12
+ var isBoolean = function isBoolean(maybeBoolean) {
13
+ return typeof maybeBoolean === 'boolean';
14
+ };
15
+
16
+ exports.isBoolean = isBoolean;
17
+
18
+ var isNumber = function isNumber(maybeNumber) {
19
+ return typeof maybeNumber === 'number';
20
+ };
21
+
22
+ exports.isNumber = isNumber;
23
+
24
+ var isString = function isString(maybeString) {
25
+ return typeof maybeString === 'string';
26
+ };
27
+
28
+ exports.isString = isString;
29
+
30
+ var isObject = function isObject(maybeObject) {
31
+ return maybeObject !== null && typeof maybeObject === 'object';
32
+ };
33
+
34
+ exports.isObject = isObject;
35
+
36
+ var isCellDescriptor = function isCellDescriptor(maybeCell) {
37
+ return isObject(maybeCell) && 'v' in maybeCell;
38
+ };
39
+
40
+ exports.isCellDescriptor = isCellDescriptor;
41
+
42
+ var buildExcelDate = function buildExcelDate(value, is1904) {
43
+ var epoch = Date.parse(value + (is1904 ? 1462 : 0));
44
+ return (epoch - ORIGIN_DATE) / 864e5;
45
+ };
46
+
47
+ exports.buildExcelDate = buildExcelDate;
48
+
49
+ var buildSheetFromMatrix = function buildSheetFromMatrix(data, options) {
50
+ if (options === void 0) {
51
+ options = {};
52
+ }
53
+
54
+ var workSheet = {};
55
+ var range = {
56
+ s: {
57
+ c: 1e7,
58
+ r: 1e7
59
+ },
60
+ e: {
61
+ c: 0,
62
+ r: 0
63
+ }
64
+ };
65
+ if (!Array.isArray(data)) throw new Error('sheet data is not array');
66
+
67
+ for (var R = 0; R !== data.length; R += 1) {
68
+ for (var C = 0; C !== data[R].length; C += 1) {
69
+ if (!Array.isArray(data[R])) throw new Error(`${R}th row data is not array`);
70
+ if (range.s.r > R) range.s.r = R;
71
+ if (range.s.c > C) range.s.c = C;
72
+ if (range.e.r < R) range.e.r = R;
73
+ if (range.e.c < C) range.e.c = C;
74
+
75
+ if (data[R][C] === null) {
76
+ continue; // eslint-disable-line
77
+ }
78
+
79
+ var cell = isCellDescriptor(data[R][C]) ? data[R][C] : {
80
+ v: data[R][C]
81
+ };
82
+
83
+ var cellRef = _xlsx.default.utils.encode_cell({
84
+ c: C,
85
+ r: R
86
+ });
87
+
88
+ if (isNumber(cell.v)) {
89
+ cell.t = 'n';
90
+ } else if (isBoolean(cell.v)) {
91
+ cell.t = 'b';
92
+ } else if (cell.v instanceof Date) {
93
+ cell.t = 'n';
94
+ cell.v = buildExcelDate(cell.v);
95
+ cell.z = cell.z || _xlsx.default.SSF._table[14]; // eslint-disable-line no-underscore-dangle
96
+
97
+ /* eslint-disable spaced-comment, no-trailing-spaces */
98
+
99
+ /***
100
+ * Allows for an non-abstracted representation of the data
101
+ *
102
+ * example: {t:'n', z:10, f:'=AVERAGE(A:A)'}
103
+ *
104
+ * Documentation:
105
+ * - Cell Object: https://sheetjs.gitbooks.io/docs/#cell-object
106
+ * - Data Types: https://sheetjs.gitbooks.io/docs/#data-types
107
+ * - Format: https://sheetjs.gitbooks.io/docs/#number-formats
108
+ **/
109
+
110
+ /* eslint-disable spaced-comment, no-trailing-spaces */
111
+ } else if (isObject(cell.v)) {
112
+ cell.t = cell.v.t;
113
+ cell.f = cell.v.f;
114
+ cell.F = cell.v.F;
115
+ cell.z = cell.v.z;
116
+ } else {
117
+ cell.t = 's';
118
+ }
119
+
120
+ if (isNumber(cell.z)) cell.z = _xlsx.default.SSF._table[cell.z]; // eslint-disable-line no-underscore-dangle
121
+
122
+ workSheet[cellRef] = cell;
123
+ }
124
+ }
125
+
126
+ if (range.s.c < 1e7) {
127
+ workSheet['!ref'] = _xlsx.default.utils.encode_range(range);
128
+ }
129
+
130
+ if (options['!cols']) {
131
+ workSheet['!cols'] = options['!cols'];
132
+ }
133
+
134
+ if (options['!merges']) {
135
+ workSheet['!merges'] = options['!merges'];
136
+ }
137
+
138
+ return workSheet;
139
+ };
140
+
141
+ exports.buildSheetFromMatrix = buildSheetFromMatrix;
142
+ //# sourceMappingURL=helpers.js.map