@nocobase/plugin-block-template 1.6.0-alpha.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.
- package/LICENSE.txt +161 -0
- package/README.md +1 -0
- package/client.d.ts +2 -0
- package/client.js +1 -0
- package/dist/client/collections/blockTemplates.d.ts +46 -0
- package/dist/client/components/AddNewTemplate.d.ts +3 -0
- package/dist/client/components/BlockTemplateInfoContext.d.ts +11 -0
- package/dist/client/components/BlockTemplateList.d.ts +10 -0
- package/dist/client/components/BlockTemplateMenusProvider.d.ts +22 -0
- package/dist/client/components/BlockTemplateMobilePage.d.ts +10 -0
- package/dist/client/components/BlockTemplatePage.d.ts +10 -0
- package/dist/client/components/ConfigureLink.d.ts +10 -0
- package/dist/client/components/DisabledDeleteItem.d.ts +10 -0
- package/dist/client/components/RevertSetting.d.ts +10 -0
- package/dist/client/components/TemplateGridDecorator.d.ts +10 -0
- package/dist/client/components/index.d.ts +17 -0
- package/dist/client/constants.d.ts +11 -0
- package/dist/client/hooks/index.d.ts +14 -0
- package/dist/client/hooks/useBulkDestroyAction.d.ts +11 -0
- package/dist/client/hooks/useCreateActionProps.d.ts +12 -0
- package/dist/client/hooks/useDeleteAction.d.ts +11 -0
- package/dist/client/hooks/useDuplicateAction.d.ts +11 -0
- package/dist/client/hooks/useEditActionProps.d.ts +12 -0
- package/dist/client/hooks/useEditFormProps.d.ts +11 -0
- package/dist/client/hooks/useIsInTemplate.d.ts +16 -0
- package/dist/client/index.d.ts +25 -0
- package/dist/client/index.js +10 -0
- package/dist/client/initializers/TemplateBlockInitializer.d.ts +16 -0
- package/dist/client/initializers/index.d.ts +10 -0
- package/dist/client/initializers/templateBlockInitializerItem.d.ts +10 -0
- package/dist/client/locale.d.ts +10 -0
- package/dist/client/schemas/blockTemplates.d.ts +10 -0
- package/dist/client/schemas/bulkDestroySchema.d.ts +61 -0
- package/dist/client/schemas/createActionSchema.d.ts +70 -0
- package/dist/client/schemas/editActionSchema.d.ts +66 -0
- package/dist/client/schemas/index.d.ts +12 -0
- package/dist/client/settings/disabledDeleteSetting.d.ts +15 -0
- package/dist/client/settings/revertSetting.d.ts +15 -0
- package/dist/client/utils/interceptors.d.ts +15 -0
- package/dist/client/utils/schema.d.ts +21 -0
- package/dist/client/utils/setting.d.ts +13 -0
- package/dist/client/utils/template.d.ts +50 -0
- package/dist/externalVersion.js +30 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +48 -0
- package/dist/locale/en-US.json +37 -0
- package/dist/locale/zh-CN.json +37 -0
- package/dist/server/actions/destroy.d.ts +10 -0
- package/dist/server/actions/destroy.js +137 -0
- package/dist/server/actions/index.d.ts +11 -0
- package/dist/server/actions/index.js +34 -0
- package/dist/server/actions/link.d.ts +10 -0
- package/dist/server/actions/link.js +43 -0
- package/dist/server/actions/saveSchema.d.ts +10 -0
- package/dist/server/actions/saveSchema.js +46 -0
- package/dist/server/collections/blockTemplateLinks.d.ts +2 -0
- package/dist/server/collections/blockTemplateLinks.js +56 -0
- package/dist/server/collections/blockTemplates.d.ts +10 -0
- package/dist/server/collections/blockTemplates.js +91 -0
- package/dist/server/index.d.ts +9 -0
- package/dist/server/index.js +42 -0
- package/dist/server/middlewares/templateData.d.ts +17 -0
- package/dist/server/middlewares/templateData.js +122 -0
- package/dist/server/plugin.d.ts +18 -0
- package/dist/server/plugin.js +59 -0
- package/dist/server/utils/index.d.ts +1 -0
- package/dist/server/utils/index.js +30 -0
- package/dist/server/utils/template.d.ts +13 -0
- package/dist/server/utils/template.js +392 -0
- package/package.json +23 -0
- package/server.d.ts +2 -0
- package/server.js +1 -0
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
*/
|
|
9
|
+
|
|
10
|
+
module.exports = {
|
|
11
|
+
"@nocobase/client": "1.6.0-alpha.29",
|
|
12
|
+
"@formily/json-schema": "2.3.0",
|
|
13
|
+
"lodash": "4.17.21",
|
|
14
|
+
"@nocobase/plugin-mobile": "1.6.0-alpha.29",
|
|
15
|
+
"@nocobase/server": "1.6.0-alpha.29",
|
|
16
|
+
"react": "18.2.0",
|
|
17
|
+
"antd": "5.12.8",
|
|
18
|
+
"@ant-design/icons": "5.6.1",
|
|
19
|
+
"@formily/core": "2.3.0",
|
|
20
|
+
"@nocobase/utils": "1.6.0-alpha.29",
|
|
21
|
+
"ahooks": "3.7.8",
|
|
22
|
+
"react-router-dom": "6.28.1",
|
|
23
|
+
"react-router": "6.28.1",
|
|
24
|
+
"@formily/react": "2.3.0",
|
|
25
|
+
"axios": "1.7.7",
|
|
26
|
+
"@nocobase/actions": "1.6.0-alpha.29",
|
|
27
|
+
"@nocobase/database": "1.6.0-alpha.29",
|
|
28
|
+
"@nocobase/plugin-ui-schema-storage": "1.6.0-alpha.29",
|
|
29
|
+
"sequelize": "6.35.2"
|
|
30
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
*/
|
|
9
|
+
export * from './server';
|
|
10
|
+
export { default } from './server';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __create = Object.create;
|
|
11
|
+
var __defProp = Object.defineProperty;
|
|
12
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
15
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16
|
+
var __export = (target, all) => {
|
|
17
|
+
for (var name in all)
|
|
18
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
19
|
+
};
|
|
20
|
+
var __copyProps = (to, from, except, desc) => {
|
|
21
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
22
|
+
for (let key of __getOwnPropNames(from))
|
|
23
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
24
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
25
|
+
}
|
|
26
|
+
return to;
|
|
27
|
+
};
|
|
28
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
29
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
30
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
31
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
32
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
33
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
34
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
35
|
+
mod
|
|
36
|
+
));
|
|
37
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
38
|
+
var src_exports = {};
|
|
39
|
+
__export(src_exports, {
|
|
40
|
+
default: () => import_server.default
|
|
41
|
+
});
|
|
42
|
+
module.exports = __toCommonJS(src_exports);
|
|
43
|
+
__reExport(src_exports, require("./server"), module.exports);
|
|
44
|
+
var import_server = __toESM(require("./server"));
|
|
45
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
46
|
+
0 && (module.exports = {
|
|
47
|
+
...require("./server")
|
|
48
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Associate record": "Associate record",
|
|
3
|
+
"Form type": "Form type",
|
|
4
|
+
"Add new": "Add new",
|
|
5
|
+
"Edit": "Edit",
|
|
6
|
+
"Title": "Title",
|
|
7
|
+
"Description": "Description",
|
|
8
|
+
"Configure": "Configure",
|
|
9
|
+
"None": "None",
|
|
10
|
+
"Type": "Type",
|
|
11
|
+
"Desktop": "Desktop",
|
|
12
|
+
"Mobile": "Mobile",
|
|
13
|
+
"Current": "Current record",
|
|
14
|
+
"Revert to template": "Revert to template",
|
|
15
|
+
"Are you sure you want to revert all changes from the template?": "Are you sure you want to revert all changes from the template?",
|
|
16
|
+
"Templates": "Templates",
|
|
17
|
+
"Block templates": "Block templates",
|
|
18
|
+
"Submit": "Submit",
|
|
19
|
+
"Cancel": "Cancel",
|
|
20
|
+
"Duplicate": "Duplicate",
|
|
21
|
+
"Duplicate to new template": "Duplicate to new template",
|
|
22
|
+
"Saved successfully": "Saved successfully",
|
|
23
|
+
"Block template": "Block template",
|
|
24
|
+
"Reset successfully": "Reset successfully",
|
|
25
|
+
"Delete successfully": "Delete successfully",
|
|
26
|
+
"Template block settings": "Template block settings",
|
|
27
|
+
"Filter": "Filter",
|
|
28
|
+
"Refresh": "Refresh",
|
|
29
|
+
"Delete record": "Delete record",
|
|
30
|
+
"Are you sure you want to delete it?": "Are you sure you want to delete it?",
|
|
31
|
+
"Delete": "Delete",
|
|
32
|
+
"Deleted successfully": "Deleted successfully",
|
|
33
|
+
"Keep the created blocks?": "Keep the created blocks?",
|
|
34
|
+
"Please select the records you want to delete": "Please select the records you want to delete",
|
|
35
|
+
"Search and select template": "Search and select template",
|
|
36
|
+
"This is part of a template, deletion is not allowed": "This is part of a template, deletion is not allowed"
|
|
37
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Associate record": "关联记录",
|
|
3
|
+
"Form type": "表单类型",
|
|
4
|
+
"Add new": "新增",
|
|
5
|
+
"Edit": "编辑",
|
|
6
|
+
"Title": "标题",
|
|
7
|
+
"Description": "描述",
|
|
8
|
+
"Configure": "配置",
|
|
9
|
+
"None": "无",
|
|
10
|
+
"Type": "类型",
|
|
11
|
+
"Desktop": "桌面端",
|
|
12
|
+
"Mobile": "移动端",
|
|
13
|
+
"Current": "当前记录",
|
|
14
|
+
"Revert to template": "恢复到模板",
|
|
15
|
+
"Are you sure you want to revert all changes from the template?": "您确定要恢复所有对模板的更改吗?",
|
|
16
|
+
"Templates": "模板",
|
|
17
|
+
"Block templates": "区块模板",
|
|
18
|
+
"Submit": "提交",
|
|
19
|
+
"Cancel": "取消",
|
|
20
|
+
"Duplicate": "复制",
|
|
21
|
+
"Duplicate to new template": "复制到新模板",
|
|
22
|
+
"Saved successfully": "保存成功",
|
|
23
|
+
"Block template": "区块模板",
|
|
24
|
+
"Reset successfully": "重置成功",
|
|
25
|
+
"Delete successfully": "删除成功",
|
|
26
|
+
"Template block settings": "模板区块设置",
|
|
27
|
+
"Filter": "筛选",
|
|
28
|
+
"Refresh": "刷新",
|
|
29
|
+
"Delete record": "删除记录",
|
|
30
|
+
"Are you sure you want to delete it?": "您确定要删除吗?",
|
|
31
|
+
"Delete": "删除",
|
|
32
|
+
"Deleted successfully": "删除成功",
|
|
33
|
+
"Keep the created blocks?": "保留创建的区块?",
|
|
34
|
+
"Please select the records you want to delete": "请选择要删除的记录",
|
|
35
|
+
"Search and select template": "搜索并选择模板",
|
|
36
|
+
"This is part of a template, deletion is not allowed": "这是模板的一部分,不允许删除"
|
|
37
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
*/
|
|
9
|
+
import { Context } from '@nocobase/actions';
|
|
10
|
+
export declare function destroy(ctx: Context, next: any): Promise<void>;
|
|
@@ -0,0 +1,137 @@
|
|
|
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
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
var destroy_exports = {};
|
|
28
|
+
__export(destroy_exports, {
|
|
29
|
+
destroy: () => destroy
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(destroy_exports);
|
|
32
|
+
var import_utils = require("../utils");
|
|
33
|
+
var import_sequelize = require("sequelize");
|
|
34
|
+
async function destroy(ctx, next) {
|
|
35
|
+
const { filterByTk, removeSchema = false } = ctx.action.params;
|
|
36
|
+
const repository = ctx.db.getRepository("blockTemplates");
|
|
37
|
+
const blockTemplateLinksRepository = ctx.db.getRepository("blockTemplateLinks");
|
|
38
|
+
const transaction = await ctx.db.sequelize.transaction();
|
|
39
|
+
try {
|
|
40
|
+
const filter = Array.isArray(filterByTk) ? { key: { $in: filterByTk } } : { key: filterByTk };
|
|
41
|
+
const templates = await repository.find({
|
|
42
|
+
filter,
|
|
43
|
+
transaction
|
|
44
|
+
});
|
|
45
|
+
const links = await blockTemplateLinksRepository.find({
|
|
46
|
+
filter: {
|
|
47
|
+
templateKey: filter.key
|
|
48
|
+
},
|
|
49
|
+
transaction
|
|
50
|
+
});
|
|
51
|
+
const uiSchemaRepository = ctx.db.getRepository("uiSchemas");
|
|
52
|
+
if (removeSchema === "true") {
|
|
53
|
+
for (const link of links) {
|
|
54
|
+
await uiSchemaRepository.remove(link.blockUid, {
|
|
55
|
+
transaction,
|
|
56
|
+
removeParentsIfNoChildren: true,
|
|
57
|
+
breakRemoveOn: {
|
|
58
|
+
"x-component": "Grid"
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
} else {
|
|
63
|
+
for (const link of links) {
|
|
64
|
+
const fullBlock = await (0, import_utils.getNewFullBlock)(ctx.db, transaction, link.blockUid);
|
|
65
|
+
const parentInfo = await ctx.db.getRepository("uiSchemaTreePath").findOne({
|
|
66
|
+
filter: {
|
|
67
|
+
descendant: link.blockUid,
|
|
68
|
+
depth: 1
|
|
69
|
+
},
|
|
70
|
+
transaction
|
|
71
|
+
});
|
|
72
|
+
const parentUid = parentInfo == null ? void 0 : parentInfo.get("ancestor");
|
|
73
|
+
if (!parentUid) {
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
const treePathTableName = uiSchemaRepository.uiSchemaTreePathTableName;
|
|
77
|
+
const positionInfo = await ctx.db.sequelize.query(
|
|
78
|
+
`SELECT TreeTable.sort, TreeTable.type
|
|
79
|
+
FROM ${treePathTableName} as TreeTable
|
|
80
|
+
WHERE TreeTable.depth = 1 AND TreeTable.descendant = :uid`,
|
|
81
|
+
{
|
|
82
|
+
replacements: { uid: link.blockUid },
|
|
83
|
+
type: import_sequelize.QueryTypes.SELECT,
|
|
84
|
+
transaction
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
await uiSchemaRepository.remove(link.blockUid, {
|
|
88
|
+
transaction,
|
|
89
|
+
removeParentsIfNoChildren: false
|
|
90
|
+
});
|
|
91
|
+
const position = positionInfo[0];
|
|
92
|
+
await uiSchemaRepository.insertAdjacent(
|
|
93
|
+
"beforeEnd",
|
|
94
|
+
parentUid,
|
|
95
|
+
{
|
|
96
|
+
...fullBlock,
|
|
97
|
+
childOptions: {
|
|
98
|
+
parentUid,
|
|
99
|
+
type: (position == null ? void 0 : position.type) ?? "properties",
|
|
100
|
+
sort: (position == null ? void 0 : position.sort) ?? 0
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
transaction,
|
|
105
|
+
wrap: false
|
|
106
|
+
}
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
for (const template of templates) {
|
|
111
|
+
await uiSchemaRepository.remove(template.uid, {
|
|
112
|
+
transaction,
|
|
113
|
+
removeParentsIfNoChildren: true
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
await blockTemplateLinksRepository.destroy({
|
|
117
|
+
filter: {
|
|
118
|
+
templateKey: filter.key
|
|
119
|
+
},
|
|
120
|
+
transaction
|
|
121
|
+
});
|
|
122
|
+
const result = await repository.destroy({
|
|
123
|
+
filter,
|
|
124
|
+
transaction
|
|
125
|
+
});
|
|
126
|
+
await transaction.commit();
|
|
127
|
+
ctx.body = result;
|
|
128
|
+
} catch (error) {
|
|
129
|
+
await transaction.rollback();
|
|
130
|
+
throw error;
|
|
131
|
+
}
|
|
132
|
+
await next();
|
|
133
|
+
}
|
|
134
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
135
|
+
0 && (module.exports = {
|
|
136
|
+
destroy
|
|
137
|
+
});
|
|
@@ -0,0 +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
|
+
*/
|
|
9
|
+
export * from './destroy';
|
|
10
|
+
export * from './link';
|
|
11
|
+
export * from './saveSchema';
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __copyProps = (to, from, except, desc) => {
|
|
15
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
+
for (let key of __getOwnPropNames(from))
|
|
17
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
18
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
|
+
var actions_exports = {};
|
|
25
|
+
module.exports = __toCommonJS(actions_exports);
|
|
26
|
+
__reExport(actions_exports, require("./destroy"), module.exports);
|
|
27
|
+
__reExport(actions_exports, require("./link"), module.exports);
|
|
28
|
+
__reExport(actions_exports, require("./saveSchema"), module.exports);
|
|
29
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
+
0 && (module.exports = {
|
|
31
|
+
...require("./destroy"),
|
|
32
|
+
...require("./link"),
|
|
33
|
+
...require("./saveSchema")
|
|
34
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
*/
|
|
9
|
+
import { Context } from '@nocobase/actions';
|
|
10
|
+
export declare function link(ctx: Context, next: any): Promise<void>;
|
|
@@ -0,0 +1,43 @@
|
|
|
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
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
var link_exports = {};
|
|
28
|
+
__export(link_exports, {
|
|
29
|
+
link: () => link
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(link_exports);
|
|
32
|
+
async function link(ctx, next) {
|
|
33
|
+
const { values } = ctx.action.params;
|
|
34
|
+
const repository = ctx.db.getRepository("blockTemplateLinks");
|
|
35
|
+
await repository.create({
|
|
36
|
+
values
|
|
37
|
+
});
|
|
38
|
+
await next();
|
|
39
|
+
}
|
|
40
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
41
|
+
0 && (module.exports = {
|
|
42
|
+
link
|
|
43
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
*/
|
|
9
|
+
import { Context } from '@nocobase/actions';
|
|
10
|
+
export declare function saveSchema(ctx: Context, next: any): Promise<void>;
|
|
@@ -0,0 +1,46 @@
|
|
|
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
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
var saveSchema_exports = {};
|
|
28
|
+
__export(saveSchema_exports, {
|
|
29
|
+
saveSchema: () => saveSchema
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(saveSchema_exports);
|
|
32
|
+
async function saveSchema(ctx, next) {
|
|
33
|
+
const { filterByTk, values, removeParentsIfNoChildren, breakRemoveOn, position } = ctx.action.params;
|
|
34
|
+
const repository = ctx.db.getRepository("uiSchemas");
|
|
35
|
+
const schema = values.schema;
|
|
36
|
+
ctx.body = await repository.insertAdjacent(position, filterByTk, schema, {
|
|
37
|
+
removeParentsIfNoChildren,
|
|
38
|
+
breakRemoveOn,
|
|
39
|
+
wrap: null
|
|
40
|
+
});
|
|
41
|
+
await next();
|
|
42
|
+
}
|
|
43
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
+
0 && (module.exports = {
|
|
45
|
+
saveSchema
|
|
46
|
+
});
|
|
@@ -0,0 +1,56 @@
|
|
|
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
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
var blockTemplateLinks_exports = {};
|
|
28
|
+
__export(blockTemplateLinks_exports, {
|
|
29
|
+
default: () => blockTemplateLinks_default
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(blockTemplateLinks_exports);
|
|
32
|
+
var import_database = require("@nocobase/database");
|
|
33
|
+
var blockTemplateLinks_default = (0, import_database.defineCollection)({
|
|
34
|
+
dumpRules: "required",
|
|
35
|
+
name: "blockTemplateLinks",
|
|
36
|
+
fields: [
|
|
37
|
+
{
|
|
38
|
+
type: "string",
|
|
39
|
+
name: "templateKey"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
type: "belongsTo",
|
|
43
|
+
name: "templateBlock",
|
|
44
|
+
target: "uiSchemas",
|
|
45
|
+
foreignKey: "templateBlockUid",
|
|
46
|
+
targetKey: "x-uid"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
type: "belongsTo",
|
|
50
|
+
name: "block",
|
|
51
|
+
target: "uiSchemas",
|
|
52
|
+
foreignKey: "blockUid",
|
|
53
|
+
targetKey: "x-uid"
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
*/
|
|
9
|
+
declare const _default: import("@nocobase/database").CollectionOptions;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,91 @@
|
|
|
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
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
var blockTemplates_exports = {};
|
|
28
|
+
__export(blockTemplates_exports, {
|
|
29
|
+
default: () => blockTemplates_default
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(blockTemplates_exports);
|
|
32
|
+
var import_database = require("@nocobase/database");
|
|
33
|
+
var blockTemplates_default = (0, import_database.defineCollection)({
|
|
34
|
+
dumpRules: "required",
|
|
35
|
+
name: "blockTemplates",
|
|
36
|
+
autoGenId: false,
|
|
37
|
+
fields: [
|
|
38
|
+
{
|
|
39
|
+
type: "uid",
|
|
40
|
+
name: "key",
|
|
41
|
+
primaryKey: true
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
type: "string",
|
|
45
|
+
name: "title"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
type: "string",
|
|
49
|
+
name: "description"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
type: "string",
|
|
53
|
+
name: "type",
|
|
54
|
+
defaultValue: "Desktop"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
type: "belongsTo",
|
|
58
|
+
name: "uiSchema",
|
|
59
|
+
target: "uiSchemas",
|
|
60
|
+
foreignKey: "uid"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
type: "boolean",
|
|
64
|
+
name: "configured",
|
|
65
|
+
defaultValue: false
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
type: "string",
|
|
69
|
+
name: "collection"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
type: "string",
|
|
73
|
+
name: "dataSource"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
type: "string",
|
|
77
|
+
name: "componentType"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
type: "string",
|
|
81
|
+
name: "menuName"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
type: "hasMany",
|
|
85
|
+
name: "links",
|
|
86
|
+
target: "blockTemplateLinks",
|
|
87
|
+
foreignKey: "templateKey",
|
|
88
|
+
targetKey: "key"
|
|
89
|
+
}
|
|
90
|
+
]
|
|
91
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
*/
|
|
9
|
+
export { default } from './plugin';
|