@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.
- package/LICENSE +661 -0
- package/README.md +222 -0
- package/README.zh-CN.md +222 -0
- package/client.d.ts +2 -0
- package/client.js +1 -0
- package/dist/client/ImportActionInitializer.d.ts +9 -0
- package/dist/client/ImportDesigner.d.ts +2 -0
- package/dist/client/ImportModal.d.ts +6 -0
- package/dist/client/ImportPluginProvider.d.ts +3 -0
- package/dist/client/constants.d.ts +1 -0
- package/dist/client/context.d.ts +29 -0
- package/dist/client/index.d.ts +9 -0
- package/dist/client/index.js +24 -0
- package/dist/client/locale/index.d.ts +2 -0
- package/dist/client/schemaSettings.d.ts +2 -0
- package/dist/client/useFields.d.ts +1 -0
- package/dist/client/useImportAction.d.ts +6 -0
- package/dist/client/useShared.d.ts +76 -0
- package/dist/externalVersion.js +18 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +43 -0
- package/dist/locale/en-US.json +28 -0
- package/dist/locale/es-ES.json +27 -0
- package/dist/locale/ko_KR.json +28 -0
- package/dist/locale/pt-BR.json +27 -0
- package/dist/locale/zh-CN.json +29 -0
- package/dist/node_modules/node-xlsx/lib/helpers.js +142 -0
- package/dist/node_modules/node-xlsx/lib/index.js +6 -0
- package/dist/node_modules/node-xlsx/lib/workbook.js +16 -0
- package/dist/node_modules/node-xlsx/package.json +1 -0
- package/dist/node_modules/xlsx/LICENSE +201 -0
- package/dist/node_modules/xlsx/bin/xlsx.njs +302 -0
- package/dist/node_modules/xlsx/bower.json +22 -0
- package/dist/node_modules/xlsx/dist/cpexcel.js +1506 -0
- package/dist/node_modules/xlsx/dist/jszip.js +9000 -0
- package/dist/node_modules/xlsx/dist/shim.min.js +2 -0
- package/dist/node_modules/xlsx/dist/xlsx.core.min.js +18 -0
- package/dist/node_modules/xlsx/dist/xlsx.extendscript.js +31850 -0
- package/dist/node_modules/xlsx/dist/xlsx.full.min.js +24 -0
- package/dist/node_modules/xlsx/dist/xlsx.js +22693 -0
- package/dist/node_modules/xlsx/dist/xlsx.min.js +15 -0
- package/dist/node_modules/xlsx/dist/xlsx.mini.min.js +9 -0
- package/dist/node_modules/xlsx/jszip.js +9000 -0
- package/dist/node_modules/xlsx/package.json +1 -0
- package/dist/node_modules/xlsx/types/index.d.ts +853 -0
- package/dist/node_modules/xlsx/xlsx.js +6 -0
- package/dist/node_modules/xlsx/xlsx.mini.js +10709 -0
- package/dist/node_modules/xlsx/xlsxworker.js +15 -0
- package/dist/server/actions/downloadXlsxTemplate.d.ts +2 -0
- package/dist/server/actions/downloadXlsxTemplate.js +62 -0
- package/dist/server/actions/importXlsx.d.ts +2 -0
- package/dist/server/actions/importXlsx.js +185 -0
- package/dist/server/actions/index.d.ts +2 -0
- package/dist/server/actions/index.js +23 -0
- package/dist/server/index.d.ts +7 -0
- package/dist/server/index.js +59 -0
- package/dist/server/locale/en-US.d.ts +11 -0
- package/dist/server/locale/en-US.js +32 -0
- package/dist/server/locale/fr-FR.d.ts +11 -0
- package/dist/server/locale/fr-FR.js +32 -0
- package/dist/server/locale/index.d.ts +2 -0
- package/dist/server/locale/index.js +40 -0
- package/dist/server/locale/zh-CN.d.ts +12 -0
- package/dist/server/locale/zh-CN.js +33 -0
- package/dist/server/middleware/index.d.ts +2 -0
- package/dist/server/middleware/index.js +34 -0
- package/dist/server/migrations/20240425223956-change-locale-module.d.ts +6 -0
- package/dist/server/migrations/20240425223956-change-locale-module.js +42 -0
- package/dist/server/utils/index.d.ts +6 -0
- package/dist/server/utils/index.js +54 -0
- package/dist/server/utils/transform.d.ts +84 -0
- package/dist/server/utils/transform.js +226 -0
- package/dist/swagger/index.json +33 -0
- package/package.json +41 -0
- package/server.d.ts +2 -0
- package/server.js +1 -0
|
@@ -0,0 +1,54 @@
|
|
|
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 name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], 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 __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var utils_exports = {};
|
|
29
|
+
__export(utils_exports, {
|
|
30
|
+
transform: () => transform
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(utils_exports);
|
|
33
|
+
var import_lodash = __toESM(require("lodash"));
|
|
34
|
+
var transforms = __toESM(require("./transform"));
|
|
35
|
+
function getTransform(name) {
|
|
36
|
+
return transforms[name] || transforms._;
|
|
37
|
+
}
|
|
38
|
+
async function transform({ ctx, record, columns, fields }) {
|
|
39
|
+
const newRecord = {};
|
|
40
|
+
for (let index = 0, iLen = record.length; index < iLen; index++) {
|
|
41
|
+
const cell = record[index];
|
|
42
|
+
const column = columns[index] ?? {};
|
|
43
|
+
const { dataIndex } = column;
|
|
44
|
+
const field = fields.find((f) => f.name === dataIndex[0]);
|
|
45
|
+
const t = getTransform(field.options.interface);
|
|
46
|
+
const value = await t({ ctx, column, value: cell, field });
|
|
47
|
+
import_lodash.default.set(newRecord, dataIndex[0], value);
|
|
48
|
+
}
|
|
49
|
+
return newRecord;
|
|
50
|
+
}
|
|
51
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
52
|
+
0 && (module.exports = {
|
|
53
|
+
transform
|
|
54
|
+
});
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
export declare function _({ value, field }: {
|
|
2
|
+
value: any;
|
|
3
|
+
field: any;
|
|
4
|
+
}): Promise<any>;
|
|
5
|
+
export declare function email({ value, field, ctx }: {
|
|
6
|
+
value: any;
|
|
7
|
+
field: any;
|
|
8
|
+
ctx: any;
|
|
9
|
+
}): Promise<any>;
|
|
10
|
+
export declare function password({ value, field, ctx }: {
|
|
11
|
+
value: any;
|
|
12
|
+
field: any;
|
|
13
|
+
ctx: any;
|
|
14
|
+
}): Promise<string>;
|
|
15
|
+
export declare function o2o({ value, column, field, ctx }: {
|
|
16
|
+
value: any;
|
|
17
|
+
column: any;
|
|
18
|
+
field: any;
|
|
19
|
+
ctx: any;
|
|
20
|
+
}): Promise<any>;
|
|
21
|
+
export declare const oho: typeof o2o;
|
|
22
|
+
export declare const obo: typeof o2o;
|
|
23
|
+
export declare function o2m({ value, column, field, ctx }: {
|
|
24
|
+
value: any;
|
|
25
|
+
column: any;
|
|
26
|
+
field: any;
|
|
27
|
+
ctx: any;
|
|
28
|
+
}): Promise<any[]>;
|
|
29
|
+
export declare function m2o({ value, column, field, ctx }: {
|
|
30
|
+
value: any;
|
|
31
|
+
column: any;
|
|
32
|
+
field: any;
|
|
33
|
+
ctx: any;
|
|
34
|
+
}): Promise<any>;
|
|
35
|
+
export declare function m2m({ value, column, field, ctx }: {
|
|
36
|
+
value: any;
|
|
37
|
+
column: any;
|
|
38
|
+
field: any;
|
|
39
|
+
ctx: any;
|
|
40
|
+
}): Promise<any[]>;
|
|
41
|
+
export declare function datetime({ value, field, ctx }: {
|
|
42
|
+
value: any;
|
|
43
|
+
field: any;
|
|
44
|
+
ctx: any;
|
|
45
|
+
}): Promise<any>;
|
|
46
|
+
export declare function time({ value, field, ctx }: {
|
|
47
|
+
value: any;
|
|
48
|
+
field: any;
|
|
49
|
+
ctx: any;
|
|
50
|
+
}): Promise<any>;
|
|
51
|
+
export declare function percent({ value, field, ctx }: {
|
|
52
|
+
value: any;
|
|
53
|
+
field: any;
|
|
54
|
+
ctx: any;
|
|
55
|
+
}): Promise<number>;
|
|
56
|
+
export declare function checkbox({ value, column, field, ctx }: {
|
|
57
|
+
value: any;
|
|
58
|
+
column: any;
|
|
59
|
+
field: any;
|
|
60
|
+
ctx: any;
|
|
61
|
+
}): Promise<0 | 1>;
|
|
62
|
+
export declare const boolean: typeof checkbox;
|
|
63
|
+
export declare function select({ value, column, field, ctx }: {
|
|
64
|
+
value: any;
|
|
65
|
+
column: any;
|
|
66
|
+
field: any;
|
|
67
|
+
ctx: any;
|
|
68
|
+
}): Promise<any>;
|
|
69
|
+
export declare const radio: typeof select;
|
|
70
|
+
export declare const radioGroup: typeof select;
|
|
71
|
+
export declare function multipleSelect({ value, column, field, ctx }: {
|
|
72
|
+
value: any;
|
|
73
|
+
column: any;
|
|
74
|
+
field: any;
|
|
75
|
+
ctx: any;
|
|
76
|
+
}): Promise<any>;
|
|
77
|
+
export declare const checkboxes: typeof multipleSelect;
|
|
78
|
+
export declare const checkboxGroup: typeof multipleSelect;
|
|
79
|
+
export declare function chinaRegion({ value, column, field, ctx }: {
|
|
80
|
+
value: any;
|
|
81
|
+
column: any;
|
|
82
|
+
field: any;
|
|
83
|
+
ctx: any;
|
|
84
|
+
}): Promise<any>;
|
|
@@ -0,0 +1,226 @@
|
|
|
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 name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], 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 __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var transform_exports = {};
|
|
29
|
+
__export(transform_exports, {
|
|
30
|
+
_: () => _,
|
|
31
|
+
boolean: () => boolean,
|
|
32
|
+
checkbox: () => checkbox,
|
|
33
|
+
checkboxGroup: () => checkboxGroup,
|
|
34
|
+
checkboxes: () => checkboxes,
|
|
35
|
+
chinaRegion: () => chinaRegion,
|
|
36
|
+
datetime: () => datetime,
|
|
37
|
+
email: () => email,
|
|
38
|
+
m2m: () => m2m,
|
|
39
|
+
m2o: () => m2o,
|
|
40
|
+
multipleSelect: () => multipleSelect,
|
|
41
|
+
o2m: () => o2m,
|
|
42
|
+
o2o: () => o2o,
|
|
43
|
+
obo: () => obo,
|
|
44
|
+
oho: () => oho,
|
|
45
|
+
password: () => password,
|
|
46
|
+
percent: () => percent,
|
|
47
|
+
radio: () => radio,
|
|
48
|
+
radioGroup: () => radioGroup,
|
|
49
|
+
select: () => select,
|
|
50
|
+
time: () => time
|
|
51
|
+
});
|
|
52
|
+
module.exports = __toCommonJS(transform_exports);
|
|
53
|
+
var import_utils = require("@nocobase/utils");
|
|
54
|
+
var math = __toESM(require("mathjs"));
|
|
55
|
+
var import__ = require("../../");
|
|
56
|
+
async function _({ value, field }) {
|
|
57
|
+
return value;
|
|
58
|
+
}
|
|
59
|
+
async function email({ value, field, ctx }) {
|
|
60
|
+
if (!(value == null ? void 0 : value.trim())) {
|
|
61
|
+
return value;
|
|
62
|
+
}
|
|
63
|
+
const emailReg = /^([a-zA-Z0-9._-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/;
|
|
64
|
+
if (!emailReg.test(value)) {
|
|
65
|
+
throw new Error(ctx.t("Incorrect email format", { ns: import__.namespace }));
|
|
66
|
+
}
|
|
67
|
+
return value;
|
|
68
|
+
}
|
|
69
|
+
async function password({ value, field, ctx }) {
|
|
70
|
+
if (value === void 0 || value === null) {
|
|
71
|
+
throw new Error(ctx.t("password is empty", { ns: import__.namespace }));
|
|
72
|
+
}
|
|
73
|
+
return `${value}`;
|
|
74
|
+
}
|
|
75
|
+
async function o2o({ value, column, field, ctx }) {
|
|
76
|
+
const { dataIndex, enum: enumData } = column;
|
|
77
|
+
const repository = ctx.db.getRepository(field.options.target);
|
|
78
|
+
let enumItem = null;
|
|
79
|
+
if ((enumData == null ? void 0 : enumData.length) > 0) {
|
|
80
|
+
enumItem = enumData.find((e) => e.label === value);
|
|
81
|
+
}
|
|
82
|
+
const val = await repository.findOne({ filter: { [dataIndex[1]]: (enumItem == null ? void 0 : enumItem.value) ?? value } });
|
|
83
|
+
return val;
|
|
84
|
+
}
|
|
85
|
+
const oho = o2o;
|
|
86
|
+
const obo = o2o;
|
|
87
|
+
async function o2m({ value, column, field, ctx }) {
|
|
88
|
+
let results = [];
|
|
89
|
+
const values = value.split(";").map((val) => val.trim());
|
|
90
|
+
const { dataIndex, enum: enumData } = column;
|
|
91
|
+
const repository = ctx.db.getRepository(field.options.target);
|
|
92
|
+
if ((enumData == null ? void 0 : enumData.length) > 0) {
|
|
93
|
+
const enumValues = values.map((val) => {
|
|
94
|
+
const v = enumData.find((e) => e.label === val);
|
|
95
|
+
if (v === void 0) {
|
|
96
|
+
throw new Error(`not found enum value ${val}`);
|
|
97
|
+
}
|
|
98
|
+
return v.value;
|
|
99
|
+
});
|
|
100
|
+
results = await repository.find({ filter: { [dataIndex[1]]: enumValues } });
|
|
101
|
+
} else {
|
|
102
|
+
results = await repository.find({ filter: { [dataIndex[1]]: values } });
|
|
103
|
+
}
|
|
104
|
+
return results;
|
|
105
|
+
}
|
|
106
|
+
async function m2o({ value, column, field, ctx }) {
|
|
107
|
+
var _a;
|
|
108
|
+
let results = null;
|
|
109
|
+
const { dataIndex, enum: enumData } = column;
|
|
110
|
+
const repository = ctx.db.getRepository(field.options.target);
|
|
111
|
+
if ((enumData == null ? void 0 : enumData.length) > 0) {
|
|
112
|
+
const enumValue = (_a = enumData.find((e) => e.label === (value == null ? void 0 : value.trim()))) == null ? void 0 : _a.value;
|
|
113
|
+
results = await repository.findOne({ filter: { [dataIndex[1]]: enumValue } });
|
|
114
|
+
} else {
|
|
115
|
+
results = await repository.findOne({ filter: { [dataIndex[1]]: value } });
|
|
116
|
+
}
|
|
117
|
+
return results;
|
|
118
|
+
}
|
|
119
|
+
async function m2m({ value, column, field, ctx }) {
|
|
120
|
+
let results = [];
|
|
121
|
+
const values = value.split(";").map((val) => val.trim());
|
|
122
|
+
const { dataIndex, enum: enumData } = column;
|
|
123
|
+
const repository = ctx.db.getRepository(field.options.target);
|
|
124
|
+
if ((enumData == null ? void 0 : enumData.length) > 0) {
|
|
125
|
+
const enumValues = values.map((val) => {
|
|
126
|
+
const v = enumData.find((e) => e.label === val);
|
|
127
|
+
if (v === void 0) {
|
|
128
|
+
throw new Error(`not found enum value ${val}`);
|
|
129
|
+
}
|
|
130
|
+
return v.value;
|
|
131
|
+
});
|
|
132
|
+
results = await repository.find({ filter: { [dataIndex[1]]: enumValues } });
|
|
133
|
+
} else {
|
|
134
|
+
results = await repository.find({ filter: { [dataIndex[1]]: values } });
|
|
135
|
+
}
|
|
136
|
+
return results;
|
|
137
|
+
}
|
|
138
|
+
async function datetime({ value, field, ctx }) {
|
|
139
|
+
var _a, _b;
|
|
140
|
+
if (!value) {
|
|
141
|
+
return "";
|
|
142
|
+
}
|
|
143
|
+
const utcOffset = ctx.get("X-Timezone");
|
|
144
|
+
const props = ((_b = (_a = field.options) == null ? void 0 : _a.uiSchema) == null ? void 0 : _b["x-component-props"]) ?? {};
|
|
145
|
+
const m = (0, import_utils.str2moment)(value, { ...props, utcOffset });
|
|
146
|
+
if (!m.isValid()) {
|
|
147
|
+
throw new Error(ctx.t("Incorrect date format", { ns: import__.namespace }));
|
|
148
|
+
}
|
|
149
|
+
return m.toDate();
|
|
150
|
+
}
|
|
151
|
+
async function time({ value, field, ctx }) {
|
|
152
|
+
var _a, _b;
|
|
153
|
+
const { format } = ((_b = (_a = field.options) == null ? void 0 : _a.uiSchema) == null ? void 0 : _b["x-component-props"]) ?? {};
|
|
154
|
+
if (format) {
|
|
155
|
+
const m = (0, import_utils.dayjs)(value, format);
|
|
156
|
+
if (!m.isValid()) {
|
|
157
|
+
throw new Error(ctx.t("Incorrect time format", { ns: import__.namespace }));
|
|
158
|
+
}
|
|
159
|
+
return m.format(format);
|
|
160
|
+
}
|
|
161
|
+
return value;
|
|
162
|
+
}
|
|
163
|
+
async function percent({ value, field, ctx }) {
|
|
164
|
+
var _a;
|
|
165
|
+
if (value) {
|
|
166
|
+
const numberValue = Number(((_a = value == null ? void 0 : value.split("%")) == null ? void 0 : _a[0]) ?? value);
|
|
167
|
+
if (isNaN(numberValue)) {
|
|
168
|
+
throw new Error(ctx.t("Illegal percentage format", { ns: import__.namespace }));
|
|
169
|
+
}
|
|
170
|
+
return math.round(numberValue / 100, 9);
|
|
171
|
+
}
|
|
172
|
+
return 0;
|
|
173
|
+
}
|
|
174
|
+
async function checkbox({ value, column, field, ctx }) {
|
|
175
|
+
return value === ctx.t("Yes", { ns: import__.namespace }) ? 1 : 0;
|
|
176
|
+
}
|
|
177
|
+
const boolean = checkbox;
|
|
178
|
+
async function select({ value, column, field, ctx }) {
|
|
179
|
+
const { enum: enumData } = column;
|
|
180
|
+
const item = enumData.find((item2) => item2.label === value);
|
|
181
|
+
return item == null ? void 0 : item.value;
|
|
182
|
+
}
|
|
183
|
+
const radio = select;
|
|
184
|
+
const radioGroup = select;
|
|
185
|
+
async function multipleSelect({ value, column, field, ctx }) {
|
|
186
|
+
const values = value == null ? void 0 : value.split(";");
|
|
187
|
+
const { enum: enumData } = column;
|
|
188
|
+
const results = values == null ? void 0 : values.map((val) => {
|
|
189
|
+
const item = enumData.find((item2) => item2.label === val);
|
|
190
|
+
return item;
|
|
191
|
+
});
|
|
192
|
+
return results == null ? void 0 : results.map((result) => result == null ? void 0 : result.value);
|
|
193
|
+
}
|
|
194
|
+
const checkboxes = multipleSelect;
|
|
195
|
+
const checkboxGroup = multipleSelect;
|
|
196
|
+
async function chinaRegion({ value, column, field, ctx }) {
|
|
197
|
+
var _a;
|
|
198
|
+
const values = (_a = value == null ? void 0 : value.split("/")) == null ? void 0 : _a.map((val) => val.trim());
|
|
199
|
+
const repository = ctx.db.getRepository("chinaRegions");
|
|
200
|
+
const results = await repository.find({ filter: { name: values } });
|
|
201
|
+
return results;
|
|
202
|
+
}
|
|
203
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
204
|
+
0 && (module.exports = {
|
|
205
|
+
_,
|
|
206
|
+
boolean,
|
|
207
|
+
checkbox,
|
|
208
|
+
checkboxGroup,
|
|
209
|
+
checkboxes,
|
|
210
|
+
chinaRegion,
|
|
211
|
+
datetime,
|
|
212
|
+
email,
|
|
213
|
+
m2m,
|
|
214
|
+
m2o,
|
|
215
|
+
multipleSelect,
|
|
216
|
+
o2m,
|
|
217
|
+
o2o,
|
|
218
|
+
obo,
|
|
219
|
+
oho,
|
|
220
|
+
password,
|
|
221
|
+
percent,
|
|
222
|
+
radio,
|
|
223
|
+
radioGroup,
|
|
224
|
+
select,
|
|
225
|
+
time
|
|
226
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"openapi": "3.0.2",
|
|
3
|
+
"info": {
|
|
4
|
+
"title": "NocoBase API - Import plugin"
|
|
5
|
+
},
|
|
6
|
+
"tags": [],
|
|
7
|
+
"paths": {
|
|
8
|
+
"/{collectionName}:importXlsx": {
|
|
9
|
+
"post": {
|
|
10
|
+
"tags": ["$collection"],
|
|
11
|
+
"description": "",
|
|
12
|
+
"parameters": [],
|
|
13
|
+
"responses": {
|
|
14
|
+
"200": {
|
|
15
|
+
"description": "OK"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"/{collectionName}:downloadXlsxTemplate": {
|
|
21
|
+
"post": {
|
|
22
|
+
"tags": ["$collection"],
|
|
23
|
+
"description": "",
|
|
24
|
+
"parameters": [],
|
|
25
|
+
"responses": {
|
|
26
|
+
"200": {
|
|
27
|
+
"description": "OK"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nocobase/plugin-action-import",
|
|
3
|
+
"displayName": "Action: Import records",
|
|
4
|
+
"displayName.zh-CN": "操作:导入记录",
|
|
5
|
+
"description": "Import records using excel templates. You can configure which fields to import and templates will be generated automatically.",
|
|
6
|
+
"description.zh-CN": "使用 Excel 模板导入数据,可以配置导入哪些字段,自动生成模板。",
|
|
7
|
+
"version": "1.0.0-alpha.1",
|
|
8
|
+
"license": "AGPL-3.0",
|
|
9
|
+
"main": "./dist/server/index.js",
|
|
10
|
+
"homepage": "https://docs.nocobase.com/handbook/action-import",
|
|
11
|
+
"homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/action-import",
|
|
12
|
+
"devDependencies": {
|
|
13
|
+
"@ant-design/icons": "5.x",
|
|
14
|
+
"@formily/antd-v5": "1.x",
|
|
15
|
+
"@formily/core": "2.x",
|
|
16
|
+
"@formily/react": "2.x",
|
|
17
|
+
"@formily/shared": "2.x",
|
|
18
|
+
"@koa/multer": "^3.0.2",
|
|
19
|
+
"@types/node-xlsx": "^0.15.1",
|
|
20
|
+
"antd": "5.x",
|
|
21
|
+
"file-saver": "^2.0.5",
|
|
22
|
+
"mathjs": "^10.6.0",
|
|
23
|
+
"node-xlsx": "^0.16.1",
|
|
24
|
+
"react": "^18.2.0",
|
|
25
|
+
"react-dom": "^18.2.0",
|
|
26
|
+
"react-i18next": "^11.15.1",
|
|
27
|
+
"xlsx": "^0.17.0"
|
|
28
|
+
},
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"@nocobase/actions": "1.x",
|
|
31
|
+
"@nocobase/client": "1.x",
|
|
32
|
+
"@nocobase/database": "1.x",
|
|
33
|
+
"@nocobase/server": "1.x",
|
|
34
|
+
"@nocobase/test": "1.x",
|
|
35
|
+
"@nocobase/utils": "1.x"
|
|
36
|
+
},
|
|
37
|
+
"gitHead": "c73b6d2032a6151fdfeebeb0ec923d766578c53c",
|
|
38
|
+
"keywords": [
|
|
39
|
+
"Actions"
|
|
40
|
+
]
|
|
41
|
+
}
|
package/server.d.ts
ADDED
package/server.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./dist/server/index.js');
|