@nocobase/plugin-graph-collection-manager 0.10.1-alpha.1 → 0.11.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/client.d.ts +2 -3
- package/client.js +1 -30
- package/lib/client/GraphCollectionProvider.js +1 -14
- package/lib/client/GraphCollectionShortcut.js +2 -9
- package/lib/client/GraphDrawPage.js +44 -45
- package/lib/client/action-hooks.js +6 -7
- package/lib/client/components/EditCollectionAction.js +1 -8
- package/lib/client/components/Entity.js +16 -23
- package/lib/client/components/FieldSummary.d.ts +1 -1
- package/lib/client/components/FieldSummary.js +9 -16
- package/lib/client/index.d.ts +5 -1
- package/lib/client/index.js +21 -6
- package/lib/client/style.js +12 -12
- package/lib/client/utils.d.ts +2 -1
- package/lib/client/utils.js +15 -11
- package/package.json +27 -6
- package/server.d.ts +2 -3
- package/server.js +1 -30
- package/src/client/GraphCollectionProvider.tsx +33 -0
- package/src/client/GraphCollectionShortcut.tsx +141 -0
- package/src/client/GraphDrawPage.tsx +1375 -0
- package/src/client/action-hooks.tsx +232 -0
- package/src/client/components/AddCollectionAction.tsx +28 -0
- package/src/client/components/AddFieldAction.tsx +37 -0
- package/src/client/components/CollectionNodeProvder.tsx +28 -0
- package/src/client/components/EditCollectionAction.tsx +33 -0
- package/src/client/components/EditFieldAction.tsx +30 -0
- package/src/client/components/Entity.tsx +510 -0
- package/src/client/components/FieldSummary.tsx +42 -0
- package/src/client/components/OverrideFieldAction.tsx +30 -0
- package/src/client/components/ViewFieldAction.tsx +12 -0
- package/src/client/components/ViewNode.tsx +22 -0
- package/src/client/index.tsx +10 -0
- package/src/client/locale/en-US.ts +15 -0
- package/src/client/locale/es-ES.ts +15 -0
- package/src/client/locale/index.ts +3 -0
- package/src/client/locale/ja-JP.ts +13 -0
- package/src/client/locale/pt-BR.ts +15 -0
- package/src/client/locale/zh-CN.ts +16 -0
- package/src/client/style.tsx +206 -0
- package/src/client/utils.tsx +548 -0
- package/src/index.ts +1 -0
- package/src/server/actions/.gitkeep +0 -0
- package/src/server/collections/.gitkeep +0 -0
- package/src/server/collections/graphPositions.ts +22 -0
- package/src/server/index.ts +13 -0
- package/src/server/models/.gitkeep +0 -0
- package/src/server/repositories/.gitkeep +0 -0
package/lib/client/index.d.ts
CHANGED
package/lib/client/index.js
CHANGED
|
@@ -3,10 +3,25 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
exports.default = exports.GraphCollectionPlugin = void 0;
|
|
7
|
+
function _client() {
|
|
8
|
+
const data = require("@nocobase/client");
|
|
9
|
+
_client = function _client() {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
var _GraphCollectionProvider = require("./GraphCollectionProvider");
|
|
15
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
16
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
17
|
+
class GraphCollectionPlugin extends _client().Plugin {
|
|
18
|
+
load() {
|
|
19
|
+
var _this = this;
|
|
20
|
+
return _asyncToGenerator(function* () {
|
|
21
|
+
_this.app.use(_GraphCollectionProvider.GraphCollectionProvider);
|
|
22
|
+
})();
|
|
10
23
|
}
|
|
11
|
-
}
|
|
12
|
-
|
|
24
|
+
}
|
|
25
|
+
exports.GraphCollectionPlugin = GraphCollectionPlugin;
|
|
26
|
+
var _default = GraphCollectionPlugin;
|
|
27
|
+
exports.default = _default;
|
package/lib/client/style.js
CHANGED
|
@@ -4,25 +4,25 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.tableNameClass = exports.tableBtnClass = exports.nodeSubtreeClass = exports.headClass = exports.graphCollectionContainerClass = exports.entityContainer = exports.collectionListClass = exports.collectiionPopoverClass = exports.addButtonClass = void 0;
|
|
7
|
-
function
|
|
8
|
-
const data = require("@
|
|
9
|
-
|
|
7
|
+
function _client() {
|
|
8
|
+
const data = require("@nocobase/client");
|
|
9
|
+
_client = function _client() {
|
|
10
10
|
return data;
|
|
11
11
|
};
|
|
12
12
|
return data;
|
|
13
13
|
}
|
|
14
|
-
const nodeSubtreeClass = (0,
|
|
14
|
+
const nodeSubtreeClass = (0, _client().css)`
|
|
15
15
|
display: flex;
|
|
16
16
|
flex-direction: column-reverse;
|
|
17
17
|
align-items: center;
|
|
18
18
|
`;
|
|
19
19
|
exports.nodeSubtreeClass = nodeSubtreeClass;
|
|
20
|
-
const addButtonClass = (0,
|
|
20
|
+
const addButtonClass = (0, _client().css)`
|
|
21
21
|
flex-shrink: 0;
|
|
22
22
|
padding: 2em 0;
|
|
23
23
|
`;
|
|
24
24
|
exports.addButtonClass = addButtonClass;
|
|
25
|
-
const entityContainer = (0,
|
|
25
|
+
const entityContainer = (0, _client().css)`
|
|
26
26
|
width: 250px;
|
|
27
27
|
height: 100%;
|
|
28
28
|
border-radius: 2px;
|
|
@@ -138,7 +138,7 @@ const entityContainer = (0, _css().css)`
|
|
|
138
138
|
}
|
|
139
139
|
`;
|
|
140
140
|
exports.entityContainer = entityContainer;
|
|
141
|
-
const headClass = (0,
|
|
141
|
+
const headClass = (0, _client().css)`
|
|
142
142
|
height: 50px;
|
|
143
143
|
font-size: 14px;
|
|
144
144
|
font-weight: 500;
|
|
@@ -152,7 +152,7 @@ const headClass = (0, _css().css)`
|
|
|
152
152
|
border-radius: 3px;
|
|
153
153
|
`;
|
|
154
154
|
exports.headClass = headClass;
|
|
155
|
-
const tableNameClass = (0,
|
|
155
|
+
const tableNameClass = (0, _client().css)`
|
|
156
156
|
max-width: 80%;
|
|
157
157
|
overflow: hidden;
|
|
158
158
|
text-overflow: ellipsis;
|
|
@@ -160,14 +160,14 @@ const tableNameClass = (0, _css().css)`
|
|
|
160
160
|
font-weight: 500;
|
|
161
161
|
`;
|
|
162
162
|
exports.tableNameClass = tableNameClass;
|
|
163
|
-
const tableBtnClass = (0,
|
|
163
|
+
const tableBtnClass = (0, _client().css)`
|
|
164
164
|
display: flex;
|
|
165
165
|
span {
|
|
166
166
|
cursor: pointer;
|
|
167
167
|
}
|
|
168
168
|
`;
|
|
169
169
|
exports.tableBtnClass = tableBtnClass;
|
|
170
|
-
const collectiionPopoverClass = (0,
|
|
170
|
+
const collectiionPopoverClass = (0, _client().css)`
|
|
171
171
|
div.field-content {
|
|
172
172
|
font-size: 14px;
|
|
173
173
|
color: rgb(134 144 156);
|
|
@@ -180,7 +180,7 @@ const collectiionPopoverClass = (0, _css().css)`
|
|
|
180
180
|
}
|
|
181
181
|
`;
|
|
182
182
|
exports.collectiionPopoverClass = collectiionPopoverClass;
|
|
183
|
-
const collectionListClass = (0,
|
|
183
|
+
const collectionListClass = (0, _client().css)`
|
|
184
184
|
float: right;
|
|
185
185
|
position: fixed;
|
|
186
186
|
margin-top: 24px;
|
|
@@ -208,7 +208,7 @@ const collectionListClass = (0, _css().css)`
|
|
|
208
208
|
}
|
|
209
209
|
`;
|
|
210
210
|
exports.collectionListClass = collectionListClass;
|
|
211
|
-
const graphCollectionContainerClass = (0,
|
|
211
|
+
const graphCollectionContainerClass = (0, _client().css)`
|
|
212
212
|
overflow: hidden;
|
|
213
213
|
.x6-graph-scroller {
|
|
214
214
|
height: calc(100vh) !important;
|
package/lib/client/utils.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { lodash } from '@nocobase/utils/client';
|
|
1
2
|
export declare const useGCMTranslation: () => import("react-i18next").UseTranslationResponse<"graph-collection-manager", undefined>;
|
|
2
3
|
export declare const getInheritCollections: (collections: any, name: any) => any[];
|
|
3
4
|
export declare const getChildrenCollections: (collections: any, name: any) => any[];
|
|
@@ -6,7 +7,7 @@ export declare const formatData: (data: any) => {
|
|
|
6
7
|
edgesData: any[];
|
|
7
8
|
inheritEdges: any[];
|
|
8
9
|
};
|
|
9
|
-
export declare const formatPortData: (ports: any) =>
|
|
10
|
+
export declare const formatPortData: (ports: any) => lodash.Dictionary<any[]>;
|
|
10
11
|
export declare const formatInheritEdgeData: (collections: any) => any[];
|
|
11
12
|
export declare const getDiffNode: (newNodes: any, oldNodes: any) => any[];
|
|
12
13
|
export declare const getDiffEdge: (newEdges: any, oldEdges: any) => any[];
|
package/lib/client/utils.js
CHANGED
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.useGCMTranslation = exports.getPopupContainer = exports.getInheritCollections = exports.getDiffNode = exports.getDiffEdge = exports.getChildrenCollections = exports.formatPortData = exports.formatInheritEdgeData = exports.formatData = void 0;
|
|
7
|
-
function
|
|
8
|
-
const data = require("
|
|
9
|
-
|
|
7
|
+
function _client() {
|
|
8
|
+
const data = require("@nocobase/utils/client");
|
|
9
|
+
_client = function _client() {
|
|
10
10
|
return data;
|
|
11
11
|
};
|
|
12
12
|
return data;
|
|
@@ -23,6 +23,10 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
23
23
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
24
24
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
25
25
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
26
|
+
const groupBy = _client().lodash.groupBy,
|
|
27
|
+
reduce = _client().lodash.reduce,
|
|
28
|
+
uniq = _client().lodash.uniq,
|
|
29
|
+
uniqBy = _client().lodash.uniqBy;
|
|
26
30
|
const shape = {
|
|
27
31
|
ER: 'er-rect',
|
|
28
32
|
EDGE: 'edge'
|
|
@@ -45,7 +49,7 @@ const getInheritCollections = (collections, name) => {
|
|
|
45
49
|
}
|
|
46
50
|
}
|
|
47
51
|
}
|
|
48
|
-
return
|
|
52
|
+
return uniq(parents);
|
|
49
53
|
};
|
|
50
54
|
return getParents(name);
|
|
51
55
|
};
|
|
@@ -74,7 +78,7 @@ const formatData = data => {
|
|
|
74
78
|
const ports = [];
|
|
75
79
|
const totalFields = [...item.fields];
|
|
76
80
|
const inheritCollections = getInheritCollections(data, item.name);
|
|
77
|
-
const inheritedFields =
|
|
81
|
+
const inheritedFields = reduce(inheritCollections, (result, value) => {
|
|
78
82
|
var _data$find;
|
|
79
83
|
const arr = result;
|
|
80
84
|
const parentFields = (_data$find = data.find(k => k.name === value)) === null || _data$find === void 0 ? void 0 : _data$find.fields.map(v => {
|
|
@@ -84,7 +88,7 @@ const formatData = data => {
|
|
|
84
88
|
});
|
|
85
89
|
return arr.concat(parentFields);
|
|
86
90
|
}, []);
|
|
87
|
-
|
|
91
|
+
uniqBy(totalFields.concat(inheritedFields), 'name').forEach(field => {
|
|
88
92
|
field.uiSchema && ports.push(_objectSpread({
|
|
89
93
|
id: field.key,
|
|
90
94
|
group: 'list'
|
|
@@ -114,7 +118,7 @@ const formatData = data => {
|
|
|
114
118
|
};
|
|
115
119
|
exports.formatData = formatData;
|
|
116
120
|
const formatPortData = ports => {
|
|
117
|
-
const portsData =
|
|
121
|
+
const portsData = groupBy(ports, v => {
|
|
118
122
|
if (v.isForeignKey || v.primaryKey || ['obo', 'oho', 'o2o', 'o2m', 'm2o', 'm2m', 'linkTo', 'id'].includes(v.interface)) {
|
|
119
123
|
return 'initPorts';
|
|
120
124
|
} else {
|
|
@@ -168,7 +172,7 @@ const formatInheritEdgeData = collections => {
|
|
|
168
172
|
ref: 'labelText',
|
|
169
173
|
refWidth: '100%',
|
|
170
174
|
refHeight: '100%',
|
|
171
|
-
fill: '
|
|
175
|
+
fill: 'var(--nb-box-bg)'
|
|
172
176
|
}
|
|
173
177
|
},
|
|
174
178
|
position: {
|
|
@@ -258,7 +262,7 @@ const formatEdgeData = (data, targetTables, tableData) => {
|
|
|
258
262
|
refWidth: '100%',
|
|
259
263
|
refHeight: '100%',
|
|
260
264
|
stroke: '#ddd',
|
|
261
|
-
fill: '
|
|
265
|
+
fill: 'var(--nb-box-bg)',
|
|
262
266
|
strokeWidth: 1,
|
|
263
267
|
rx: 10,
|
|
264
268
|
ry: 10
|
|
@@ -297,7 +301,7 @@ const formatEdgeData = (data, targetTables, tableData) => {
|
|
|
297
301
|
refWidth: '100%',
|
|
298
302
|
refHeight: '100%',
|
|
299
303
|
stroke: '#ddd',
|
|
300
|
-
fill: '
|
|
304
|
+
fill: 'var(--nb-box-bg)',
|
|
301
305
|
rx: 10,
|
|
302
306
|
ry: 10,
|
|
303
307
|
strokeWidth: 1
|
|
@@ -425,7 +429,7 @@ const formatEdgeData = (data, targetTables, tableData) => {
|
|
|
425
429
|
}
|
|
426
430
|
}
|
|
427
431
|
}
|
|
428
|
-
return
|
|
432
|
+
return uniqBy(edges, 'id');
|
|
429
433
|
};
|
|
430
434
|
const getRelationship = relatioship => {
|
|
431
435
|
switch (relatioship) {
|
package/package.json
CHANGED
|
@@ -4,18 +4,39 @@
|
|
|
4
4
|
"displayName.zh-CN": "数据库可视化管理",
|
|
5
5
|
"description": "database collection manage",
|
|
6
6
|
"description.zh-CN": "数据库管理。",
|
|
7
|
-
"version": "0.
|
|
7
|
+
"version": "0.11.0-alpha.1",
|
|
8
8
|
"license": "AGPL-3.0",
|
|
9
|
-
"main": "./lib/index.js",
|
|
10
|
-
"
|
|
9
|
+
"main": "./lib/server/index.js",
|
|
10
|
+
"files": [
|
|
11
|
+
"lib",
|
|
12
|
+
"src",
|
|
13
|
+
"README.md",
|
|
14
|
+
"README.zh-CN.md",
|
|
15
|
+
"CHANGELOG.md",
|
|
16
|
+
"server.js",
|
|
17
|
+
"server.d.ts",
|
|
18
|
+
"client.js",
|
|
19
|
+
"client.d.ts"
|
|
20
|
+
],
|
|
11
21
|
"dependencies": {
|
|
12
22
|
"@antv/x6": "^1.9.0",
|
|
13
23
|
"@antv/x6-react-shape": "^1.6.2",
|
|
24
|
+
"ahooks": "^3.7.2",
|
|
14
25
|
"dagre": "^0.8.5"
|
|
15
26
|
},
|
|
16
27
|
"devDependencies": {
|
|
17
|
-
"@
|
|
18
|
-
"@
|
|
28
|
+
"@ant-design/icons": "^5.1.4",
|
|
29
|
+
"@formily/react": "2.2.26",
|
|
30
|
+
"@formily/reactive": "2.2.26",
|
|
31
|
+
"@formily/shared": "2.2.26",
|
|
32
|
+
"@nocobase/client": "0.11.0-alpha.1",
|
|
33
|
+
"@nocobase/database": "0.11.0-alpha.1",
|
|
34
|
+
"@nocobase/server": "0.11.0-alpha.1",
|
|
35
|
+
"@nocobase/test": "0.11.0-alpha.1",
|
|
36
|
+
"@nocobase/utils": "0.11.0-alpha.1",
|
|
37
|
+
"antd": "^5.6.4",
|
|
38
|
+
"react": "^18.2.0",
|
|
39
|
+
"react-i18next": "^11.15.1"
|
|
19
40
|
},
|
|
20
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "7581b6d3a3a54f09f06a9effb7e3e65328281b2b"
|
|
21
42
|
}
|
package/server.d.ts
CHANGED
package/server.js
CHANGED
|
@@ -1,30 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
4
|
-
|
|
5
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
6
|
-
|
|
7
|
-
var _index = _interopRequireWildcard(require("./lib/server"));
|
|
8
|
-
|
|
9
|
-
Object.defineProperty(exports, "__esModule", {
|
|
10
|
-
value: true
|
|
11
|
-
});
|
|
12
|
-
var _exportNames = {};
|
|
13
|
-
Object.defineProperty(exports, "default", {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
get: function get() {
|
|
16
|
-
return _index.default;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
Object.keys(_index).forEach(function (key) {
|
|
21
|
-
if (key === "default" || key === "__esModule") return;
|
|
22
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
23
|
-
if (key in exports && exports[key] === _index[key]) return;
|
|
24
|
-
Object.defineProperty(exports, key, {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function get() {
|
|
27
|
-
return _index[key];
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
});
|
|
1
|
+
module.exports = require('./lib/server/index.js');
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { PluginManagerContext, SettingsCenterContext, SettingsCenterProvider } from '@nocobase/client';
|
|
2
|
+
import React, { useContext } from 'react';
|
|
3
|
+
import { GraphCollectionPane } from './GraphCollectionShortcut';
|
|
4
|
+
import { useGCMTranslation } from './utils';
|
|
5
|
+
|
|
6
|
+
export const GraphCollectionProvider = React.memo((props) => {
|
|
7
|
+
const ctx = useContext(PluginManagerContext);
|
|
8
|
+
// i18n.addResources('en-US', 'graphPositions', enUS);
|
|
9
|
+
// i18n.addResources('ja-JP', 'graphPositions', jaJP);
|
|
10
|
+
// i18n.addResources('zh-CN', 'graphPositions', zhCN);
|
|
11
|
+
const { t } = useGCMTranslation();
|
|
12
|
+
const items = useContext(SettingsCenterContext);
|
|
13
|
+
|
|
14
|
+
items['collection-manager']['tabs']['graph'] = {
|
|
15
|
+
title: t('Graphical interface'),
|
|
16
|
+
component: GraphCollectionPane,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<SettingsCenterProvider settings={items}>
|
|
21
|
+
<PluginManagerContext.Provider
|
|
22
|
+
value={{
|
|
23
|
+
components: {
|
|
24
|
+
...ctx?.components,
|
|
25
|
+
},
|
|
26
|
+
}}
|
|
27
|
+
>
|
|
28
|
+
{props.children}
|
|
29
|
+
</PluginManagerContext.Provider>
|
|
30
|
+
</SettingsCenterProvider>
|
|
31
|
+
);
|
|
32
|
+
});
|
|
33
|
+
GraphCollectionProvider.displayName = 'GraphCollectionProvider';
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { DeleteOutlined } from '@ant-design/icons';
|
|
2
|
+
import { uid } from '@formily/shared';
|
|
3
|
+
import { css, SchemaComponent, useActionContext, useRequest } from '@nocobase/client';
|
|
4
|
+
import React, { useEffect } from 'react';
|
|
5
|
+
import { useCreateActionAndRefreshCM } from './action-hooks';
|
|
6
|
+
import { GraphDrawPage } from './GraphDrawPage';
|
|
7
|
+
|
|
8
|
+
const useCollectionValues = (options) => {
|
|
9
|
+
const { visible } = useActionContext();
|
|
10
|
+
const result = useRequest(
|
|
11
|
+
() =>
|
|
12
|
+
Promise.resolve({
|
|
13
|
+
data: {
|
|
14
|
+
name: `t_${uid()}`,
|
|
15
|
+
createdBy: true,
|
|
16
|
+
updatedBy: true,
|
|
17
|
+
sortable: true,
|
|
18
|
+
logging: true,
|
|
19
|
+
fields: [
|
|
20
|
+
{
|
|
21
|
+
name: 'id',
|
|
22
|
+
type: 'integer',
|
|
23
|
+
autoIncrement: true,
|
|
24
|
+
primaryKey: true,
|
|
25
|
+
allowNull: false,
|
|
26
|
+
uiSchema: { type: 'number', title: '{{t("ID")}}', 'x-component': 'InputNumber', 'x-read-pretty': true },
|
|
27
|
+
interface: 'id',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
interface: 'createdAt',
|
|
31
|
+
type: 'date',
|
|
32
|
+
field: 'createdAt',
|
|
33
|
+
name: 'createdAt',
|
|
34
|
+
uiSchema: {
|
|
35
|
+
type: 'datetime',
|
|
36
|
+
title: '{{t("Created at")}}',
|
|
37
|
+
'x-component': 'DatePicker',
|
|
38
|
+
'x-component-props': {},
|
|
39
|
+
'x-read-pretty': true,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
interface: 'createdBy',
|
|
44
|
+
type: 'belongsTo',
|
|
45
|
+
target: 'users',
|
|
46
|
+
foreignKey: 'createdById',
|
|
47
|
+
name: 'createdBy',
|
|
48
|
+
uiSchema: {
|
|
49
|
+
type: 'object',
|
|
50
|
+
title: '{{t("Created by")}}',
|
|
51
|
+
'x-component': 'RecordPicker',
|
|
52
|
+
'x-component-props': {
|
|
53
|
+
fieldNames: {
|
|
54
|
+
value: 'id',
|
|
55
|
+
label: 'nickname',
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
'x-read-pretty': true,
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
type: 'date',
|
|
63
|
+
field: 'updatedAt',
|
|
64
|
+
name: 'updatedAt',
|
|
65
|
+
interface: 'updatedAt',
|
|
66
|
+
uiSchema: {
|
|
67
|
+
type: 'string',
|
|
68
|
+
title: '{{t("Last updated at")}}',
|
|
69
|
+
'x-component': 'DatePicker',
|
|
70
|
+
'x-component-props': {},
|
|
71
|
+
'x-read-pretty': true,
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
type: 'belongsTo',
|
|
76
|
+
target: 'users',
|
|
77
|
+
foreignKey: 'updatedById',
|
|
78
|
+
name: 'updatedBy',
|
|
79
|
+
interface: 'updatedBy',
|
|
80
|
+
uiSchema: {
|
|
81
|
+
type: 'object',
|
|
82
|
+
title: '{{t("Last updated by")}}',
|
|
83
|
+
'x-component': 'RecordPicker',
|
|
84
|
+
'x-component-props': {
|
|
85
|
+
fieldNames: {
|
|
86
|
+
value: 'id',
|
|
87
|
+
label: 'nickname',
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
'x-read-pretty': true,
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
],
|
|
94
|
+
},
|
|
95
|
+
}),
|
|
96
|
+
{
|
|
97
|
+
...options,
|
|
98
|
+
manual: true,
|
|
99
|
+
},
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
useEffect(() => {
|
|
103
|
+
if (visible) {
|
|
104
|
+
result.run();
|
|
105
|
+
}
|
|
106
|
+
}, [visible]);
|
|
107
|
+
|
|
108
|
+
return result;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
export const GraphCollectionPane = () => {
|
|
112
|
+
return (
|
|
113
|
+
<div
|
|
114
|
+
className={css`
|
|
115
|
+
height: calc(100vh - 160px);
|
|
116
|
+
overflow: auto;
|
|
117
|
+
margin: calc(var(--nb-spacing) * -1);
|
|
118
|
+
position: relative;
|
|
119
|
+
`}
|
|
120
|
+
id="graph_container"
|
|
121
|
+
>
|
|
122
|
+
<SchemaComponent
|
|
123
|
+
schema={{
|
|
124
|
+
type: 'void',
|
|
125
|
+
'x-component': 'div',
|
|
126
|
+
properties: {
|
|
127
|
+
editor: {
|
|
128
|
+
type: 'void',
|
|
129
|
+
'x-component': 'GraphDrawPage',
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
}}
|
|
133
|
+
components={{
|
|
134
|
+
GraphDrawPage,
|
|
135
|
+
DeleteOutlined,
|
|
136
|
+
}}
|
|
137
|
+
scope={{ useCollectionValues, useCreateActionAndRefreshCM }}
|
|
138
|
+
/>
|
|
139
|
+
</div>
|
|
140
|
+
);
|
|
141
|
+
};
|