@nocobase/plugin-graph-collection-manager 0.9.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/client.d.ts +4 -0
- package/client.js +30 -0
- package/lib/client/GraphCollectionProvider.d.ts +2 -0
- package/lib/client/GraphCollectionProvider.js +97 -0
- package/lib/client/GraphCollectionShortcut.d.ts +2 -0
- package/lib/client/GraphCollectionShortcut.js +236 -0
- package/lib/client/GraphDrawPage.d.ts +13 -0
- package/lib/client/GraphDrawPage.js +1746 -0
- package/lib/client/action-hooks.d.ts +44 -0
- package/lib/client/action-hooks.js +402 -0
- package/lib/client/components/AddCollectionAction.d.ts +3 -0
- package/lib/client/components/AddCollectionAction.js +73 -0
- package/lib/client/components/AddFieldAction.d.ts +3 -0
- package/lib/client/components/AddFieldAction.js +85 -0
- package/lib/client/components/CollectionNodeProvder.d.ts +10 -0
- package/lib/client/components/CollectionNodeProvder.js +42 -0
- package/lib/client/components/EditCollectionAction.d.ts +3 -0
- package/lib/client/components/EditCollectionAction.js +78 -0
- package/lib/client/components/EditFieldAction.d.ts +3 -0
- package/lib/client/components/EditFieldAction.js +81 -0
- package/lib/client/components/Entity.d.ts +8 -0
- package/lib/client/components/Entity.js +603 -0
- package/lib/client/components/FieldSummary.d.ts +2 -0
- package/lib/client/components/FieldSummary.js +98 -0
- package/lib/client/components/OverrideFieldAction.d.ts +3 -0
- package/lib/client/components/OverrideFieldAction.js +83 -0
- package/lib/client/components/ViewFieldAction.d.ts +3 -0
- package/lib/client/components/ViewFieldAction.js +57 -0
- package/lib/client/components/ViewNode.d.ts +5 -0
- package/lib/client/components/ViewNode.js +40 -0
- package/lib/client/index.d.ts +1 -0
- package/lib/client/index.js +13 -0
- package/lib/client/locale/en-US.d.ts +15 -0
- package/lib/client/locale/en-US.js +21 -0
- package/lib/client/locale/index.d.ts +3 -0
- package/lib/client/locale/index.js +31 -0
- package/lib/client/locale/ja-JP.d.ts +14 -0
- package/lib/client/locale/ja-JP.js +20 -0
- package/lib/client/locale/zh-CN.d.ts +16 -0
- package/lib/client/locale/zh-CN.js +22 -0
- package/lib/client/style.d.ts +9 -0
- package/lib/client/style.js +222 -0
- package/lib/client/utils.d.ts +11 -0
- package/lib/client/utils.js +565 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +15 -0
- package/lib/server/collections/graphPositions.d.ts +2 -0
- package/lib/server/collections/graphPositions.js +33 -0
- package/lib/server/index.d.ts +5 -0
- package/lib/server/index.js +51 -0
- package/package.json +18 -0
- package/server.d.ts +4 -0
- package/server.js +30 -0
|
@@ -0,0 +1,603 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
function _icons() {
|
|
9
|
+
const data = require("@ant-design/icons");
|
|
10
|
+
|
|
11
|
+
_icons = function _icons() {
|
|
12
|
+
return data;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
return data;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
require("@antv/x6-react-shape");
|
|
19
|
+
|
|
20
|
+
function _css() {
|
|
21
|
+
const data = require("@emotion/css");
|
|
22
|
+
|
|
23
|
+
_css = function _css() {
|
|
24
|
+
return data;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
return data;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function _shared() {
|
|
31
|
+
const data = require("@formily/shared");
|
|
32
|
+
|
|
33
|
+
_shared = function _shared() {
|
|
34
|
+
return data;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
return data;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function _client() {
|
|
41
|
+
const data = require("@nocobase/client");
|
|
42
|
+
|
|
43
|
+
_client = function _client() {
|
|
44
|
+
return data;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
return data;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function _reactI18next() {
|
|
51
|
+
const data = require("react-i18next");
|
|
52
|
+
|
|
53
|
+
_reactI18next = function _reactI18next() {
|
|
54
|
+
return data;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
return data;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function _antd() {
|
|
61
|
+
const data = require("antd");
|
|
62
|
+
|
|
63
|
+
_antd = function _antd() {
|
|
64
|
+
return data;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
return data;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function _react() {
|
|
71
|
+
const data = _interopRequireWildcard(require("react"));
|
|
72
|
+
|
|
73
|
+
_react = function _react() {
|
|
74
|
+
return data;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
return data;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function _lodash() {
|
|
81
|
+
const data = require("lodash");
|
|
82
|
+
|
|
83
|
+
_lodash = function _lodash() {
|
|
84
|
+
return data;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
return data;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
var _actionHooks = require("../action-hooks");
|
|
91
|
+
|
|
92
|
+
var _style = require("../style");
|
|
93
|
+
|
|
94
|
+
var _FieldSummary = require("./FieldSummary");
|
|
95
|
+
|
|
96
|
+
var _AddFieldAction = require("./AddFieldAction");
|
|
97
|
+
|
|
98
|
+
var _CollectionNodeProvder = require("./CollectionNodeProvder");
|
|
99
|
+
|
|
100
|
+
var _EditFieldAction = require("./EditFieldAction");
|
|
101
|
+
|
|
102
|
+
var _OverrideFieldAction = require("./OverrideFieldAction");
|
|
103
|
+
|
|
104
|
+
var _ViewFieldAction = require("./ViewFieldAction");
|
|
105
|
+
|
|
106
|
+
var _EditCollectionAction = require("./EditCollectionAction");
|
|
107
|
+
|
|
108
|
+
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); }
|
|
109
|
+
|
|
110
|
+
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; }
|
|
111
|
+
|
|
112
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
113
|
+
|
|
114
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
115
|
+
|
|
116
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
117
|
+
|
|
118
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
119
|
+
|
|
120
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
121
|
+
|
|
122
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
123
|
+
|
|
124
|
+
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); } }
|
|
125
|
+
|
|
126
|
+
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); }); }; }
|
|
127
|
+
|
|
128
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
129
|
+
|
|
130
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
131
|
+
|
|
132
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
133
|
+
|
|
134
|
+
const Entity = props => {
|
|
135
|
+
const node = props.node,
|
|
136
|
+
setTargetNode = props.setTargetNode,
|
|
137
|
+
targetGraph = props.targetGraph;
|
|
138
|
+
const _node$store$data = node.store.data,
|
|
139
|
+
title = _node$store$data.title,
|
|
140
|
+
name = _node$store$data.name,
|
|
141
|
+
item = _node$store$data.item,
|
|
142
|
+
attrs = _node$store$data.attrs,
|
|
143
|
+
select = _node$store$data.select,
|
|
144
|
+
id = node.id;
|
|
145
|
+
const database = (0, _client().useCurrentAppInfo)();
|
|
146
|
+
const collectionData = (0, _react().useRef)();
|
|
147
|
+
collectionData.current = _objectSpread(_objectSpread({}, item), {}, {
|
|
148
|
+
title,
|
|
149
|
+
inherits: item.inherits && new Proxy(item.inherits, {})
|
|
150
|
+
});
|
|
151
|
+
const compile = (0, _client().useCompile)();
|
|
152
|
+
|
|
153
|
+
const loadCollections = /*#__PURE__*/function () {
|
|
154
|
+
var _ref = _asyncToGenerator(function* (field) {
|
|
155
|
+
var _targetGraph$collecti;
|
|
156
|
+
|
|
157
|
+
return (_targetGraph$collecti = targetGraph.collections) === null || _targetGraph$collecti === void 0 ? void 0 : _targetGraph$collecti.map(collection => ({
|
|
158
|
+
label: compile(collection.title),
|
|
159
|
+
value: collection.name
|
|
160
|
+
}));
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
return function loadCollections(_x) {
|
|
164
|
+
return _ref.apply(this, arguments);
|
|
165
|
+
};
|
|
166
|
+
}();
|
|
167
|
+
|
|
168
|
+
const portsProps = {
|
|
169
|
+
targetGraph,
|
|
170
|
+
collectionData,
|
|
171
|
+
setTargetNode,
|
|
172
|
+
node,
|
|
173
|
+
loadCollections
|
|
174
|
+
};
|
|
175
|
+
return _react().default.createElement("div", {
|
|
176
|
+
className: (0, _css().cx)(_style.entityContainer),
|
|
177
|
+
style: {
|
|
178
|
+
boxShadow: attrs === null || attrs === void 0 ? void 0 : attrs.boxShadow,
|
|
179
|
+
border: select ? '2px dashed #f5a20a' : 0
|
|
180
|
+
}
|
|
181
|
+
}, _react().default.createElement("div", {
|
|
182
|
+
className: _style.headClass,
|
|
183
|
+
style: {
|
|
184
|
+
background: (attrs === null || attrs === void 0 ? void 0 : attrs.hightLight) ? '#1890ff' : null
|
|
185
|
+
}
|
|
186
|
+
}, _react().default.createElement("span", {
|
|
187
|
+
className: _style.tableNameClass
|
|
188
|
+
}, compile(title)), _react().default.createElement("div", {
|
|
189
|
+
className: _style.tableBtnClass
|
|
190
|
+
}, _react().default.createElement(_client().SchemaComponentProvider, null, _react().default.createElement(_CollectionNodeProvder.CollectionNodeProvder, {
|
|
191
|
+
setTargetNode: setTargetNode,
|
|
192
|
+
node: node
|
|
193
|
+
}, _react().default.createElement(_client().CollectionProvider, {
|
|
194
|
+
collection: _client().collection
|
|
195
|
+
}, _react().default.createElement(_client().SchemaComponent, {
|
|
196
|
+
scope: {
|
|
197
|
+
useUpdateCollectionActionAndRefreshCM: _actionHooks.useUpdateCollectionActionAndRefreshCM,
|
|
198
|
+
useCancelAction: _actionHooks.useCancelAction,
|
|
199
|
+
loadCollections,
|
|
200
|
+
useAsyncDataSource: _actionHooks.useAsyncDataSource,
|
|
201
|
+
Action: _client().Action,
|
|
202
|
+
DeleteOutlined: _icons().DeleteOutlined,
|
|
203
|
+
enableInherits: (database === null || database === void 0 ? void 0 : database.dialect) === 'postgres'
|
|
204
|
+
},
|
|
205
|
+
components: {
|
|
206
|
+
Action: _client().Action,
|
|
207
|
+
EditOutlined: _icons().EditOutlined,
|
|
208
|
+
FormItem: _client().FormItem,
|
|
209
|
+
CollectionField: _client().CollectionField,
|
|
210
|
+
Input: _client().Input,
|
|
211
|
+
Form: _client().Form,
|
|
212
|
+
Select: _client().Select,
|
|
213
|
+
EditCollectionAction: _EditCollectionAction.EditCollectionAction,
|
|
214
|
+
Checkbox: _client().Checkbox
|
|
215
|
+
},
|
|
216
|
+
schema: {
|
|
217
|
+
type: 'object',
|
|
218
|
+
properties: {
|
|
219
|
+
update: {
|
|
220
|
+
type: 'void',
|
|
221
|
+
title: '{{ t("Edit") }}',
|
|
222
|
+
'x-component': 'EditCollectionAction',
|
|
223
|
+
'x-component-props': {
|
|
224
|
+
type: 'primary',
|
|
225
|
+
item: collectionData.current
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
delete: {
|
|
229
|
+
type: 'void',
|
|
230
|
+
'x-action': 'destroy',
|
|
231
|
+
'x-component': 'Action',
|
|
232
|
+
'x-component-props': {
|
|
233
|
+
component: _icons().DeleteOutlined,
|
|
234
|
+
icon: 'DeleteOutlined',
|
|
235
|
+
className: (0, _css().css)`
|
|
236
|
+
background-color: rgb(255 236 232);
|
|
237
|
+
border-color: transparent;
|
|
238
|
+
color: #e31c1c;
|
|
239
|
+
height: 20px;
|
|
240
|
+
padding: 5px;
|
|
241
|
+
&:hover {
|
|
242
|
+
background-color: rgb(253 205 197);
|
|
243
|
+
}
|
|
244
|
+
`,
|
|
245
|
+
confirm: {
|
|
246
|
+
title: "{{t('Delete record')}}",
|
|
247
|
+
getContainer: () => {
|
|
248
|
+
return document.getElementById('graph_container');
|
|
249
|
+
},
|
|
250
|
+
collectionConten: "{{t('Are you sure you want to delete it?')}}"
|
|
251
|
+
},
|
|
252
|
+
useAction: () => (0, _actionHooks.useDestroyActionAndRefreshCM)({
|
|
253
|
+
name,
|
|
254
|
+
id
|
|
255
|
+
})
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
})))))), _react().default.createElement(PortsCom, _objectSpread({}, portsProps)));
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
const PortsCom = _react().default.memo(({
|
|
264
|
+
targetGraph,
|
|
265
|
+
collectionData,
|
|
266
|
+
setTargetNode,
|
|
267
|
+
node,
|
|
268
|
+
loadCollections
|
|
269
|
+
}) => {
|
|
270
|
+
var _portsData$initPorts, _portsData$morePorts;
|
|
271
|
+
|
|
272
|
+
const _node$store$data2 = node.store.data,
|
|
273
|
+
title = _node$store$data2.title,
|
|
274
|
+
name = _node$store$data2.name,
|
|
275
|
+
item = _node$store$data2.item,
|
|
276
|
+
ports = _node$store$data2.ports,
|
|
277
|
+
data = _node$store$data2.data,
|
|
278
|
+
sourcePort = _node$store$data2.sourcePort,
|
|
279
|
+
associated = _node$store$data2.associated,
|
|
280
|
+
targetPort = _node$store$data2.targetPort;
|
|
281
|
+
|
|
282
|
+
const _useState = (0, _react().useState)(false),
|
|
283
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
284
|
+
collapse = _useState2[0],
|
|
285
|
+
setCollapse = _useState2[1];
|
|
286
|
+
|
|
287
|
+
const _useTranslation = (0, _reactI18next().useTranslation)('graphPositions'),
|
|
288
|
+
t = _useTranslation.t;
|
|
289
|
+
|
|
290
|
+
const compile = (0, _client().useCompile)();
|
|
291
|
+
const portsData = (0, _lodash().groupBy)(ports.items, v => {
|
|
292
|
+
if (v.isForeignKey || v.primaryKey || ['obo', 'oho', 'o2o', 'o2m', 'm2o', 'm2m', 'linkTo', 'id'].includes(v.interface)) {
|
|
293
|
+
return 'initPorts';
|
|
294
|
+
} else {
|
|
295
|
+
return 'morePorts';
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
const useNewId = prefix => {
|
|
300
|
+
return `${prefix || ''}${(0, _shared().uid)()}`;
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
const CollectionConten = data => {
|
|
304
|
+
const type = data.type,
|
|
305
|
+
name = data.name,
|
|
306
|
+
primaryKey = data.primaryKey,
|
|
307
|
+
allowNull = data.allowNull,
|
|
308
|
+
autoIncrement = data.autoIncrement;
|
|
309
|
+
return _react().default.createElement("div", {
|
|
310
|
+
className: (0, _css().cx)(_style.collectiionPopoverClass)
|
|
311
|
+
}, _react().default.createElement("div", {
|
|
312
|
+
className: "field-content"
|
|
313
|
+
}, _react().default.createElement("div", null, _react().default.createElement("span", null, "name"), ": ", _react().default.createElement("span", {
|
|
314
|
+
className: "field-type"
|
|
315
|
+
}, name)), _react().default.createElement("div", null, _react().default.createElement("span", null, "type"), ": ", _react().default.createElement("span", {
|
|
316
|
+
className: "field-type"
|
|
317
|
+
}, type))), _react().default.createElement("p", null, primaryKey && _react().default.createElement(_antd().Tag, {
|
|
318
|
+
color: "green"
|
|
319
|
+
}, "PRIMARY"), allowNull && _react().default.createElement(_antd().Tag, {
|
|
320
|
+
color: "geekblue"
|
|
321
|
+
}, "ALLOWNULL"), autoIncrement && _react().default.createElement(_antd().Tag, {
|
|
322
|
+
color: "purple"
|
|
323
|
+
}, "AUTOINCREMENT")));
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
const typeColor = v => {
|
|
327
|
+
if (v.isForeignKey || v.primaryKey || v.interface === 'id') {
|
|
328
|
+
return 'red';
|
|
329
|
+
} else if (['obo', 'oho', 'o2o', 'o2m', 'm2o', 'm2m', 'linkTo'].includes(v.interface)) {
|
|
330
|
+
return 'orange';
|
|
331
|
+
}
|
|
332
|
+
};
|
|
333
|
+
|
|
334
|
+
const OperationButton = ({
|
|
335
|
+
property
|
|
336
|
+
}) => {
|
|
337
|
+
const isInheritField = !(property.collectionName !== name);
|
|
338
|
+
return _react().default.createElement("div", {
|
|
339
|
+
className: "field-operator"
|
|
340
|
+
}, _react().default.createElement(_client().SchemaComponentProvider, {
|
|
341
|
+
components: {
|
|
342
|
+
FormItem: _client().FormItem,
|
|
343
|
+
CollectionField: _client().CollectionField,
|
|
344
|
+
Input: _client().Input,
|
|
345
|
+
Form: _client().Form,
|
|
346
|
+
ResourceActionProvider: _client().ResourceActionProvider,
|
|
347
|
+
Select: props => _react().default.createElement(_client().Select, _objectSpread(_objectSpread({}, props), {}, {
|
|
348
|
+
getPopupContainer: () => {
|
|
349
|
+
return document.getElementById('graph_container');
|
|
350
|
+
}
|
|
351
|
+
})),
|
|
352
|
+
Checkbox: _client().Checkbox,
|
|
353
|
+
Radio: _client().Radio,
|
|
354
|
+
InputNumber: _client().InputNumber,
|
|
355
|
+
Grid: _client().Grid,
|
|
356
|
+
FieldSummary: _FieldSummary.FieldSummary,
|
|
357
|
+
Action: _client().Action,
|
|
358
|
+
EditOutlined: _icons().EditOutlined,
|
|
359
|
+
DeleteOutlined: _icons().DeleteOutlined,
|
|
360
|
+
AddFieldAction: _AddFieldAction.AddFieldAction,
|
|
361
|
+
OverrideFieldAction: _OverrideFieldAction.OverrideFieldAction,
|
|
362
|
+
ViewFieldAction: _ViewFieldAction.ViewFieldAction,
|
|
363
|
+
Dropdown: _antd().Dropdown,
|
|
364
|
+
Formula: _client().Formula
|
|
365
|
+
},
|
|
366
|
+
scope: {
|
|
367
|
+
useAsyncDataSource: _actionHooks.useAsyncDataSource,
|
|
368
|
+
loadCollections,
|
|
369
|
+
useCancelAction: _actionHooks.useCancelAction,
|
|
370
|
+
useNewId,
|
|
371
|
+
useCurrentFields,
|
|
372
|
+
useValuesFromRecord: _actionHooks.useValuesFromRecord,
|
|
373
|
+
useUpdateCollectionActionAndRefreshCM: _actionHooks.useUpdateCollectionActionAndRefreshCM,
|
|
374
|
+
isInheritField
|
|
375
|
+
}
|
|
376
|
+
}, _react().default.createElement(_CollectionNodeProvder.CollectionNodeProvder, {
|
|
377
|
+
record: collectionData.current,
|
|
378
|
+
setTargetNode: setTargetNode,
|
|
379
|
+
node: node,
|
|
380
|
+
handelOpenPorts: () => _handelOpenPorts(true)
|
|
381
|
+
}, _react().default.createElement(_client().SchemaComponent, {
|
|
382
|
+
scope: _actionHooks.useCancelAction,
|
|
383
|
+
schema: {
|
|
384
|
+
type: 'object',
|
|
385
|
+
properties: {
|
|
386
|
+
create: {
|
|
387
|
+
type: 'void',
|
|
388
|
+
'x-action': 'create',
|
|
389
|
+
'x-component': 'AddFieldAction',
|
|
390
|
+
'x-visible': '{{isInheritField}}',
|
|
391
|
+
'x-component-props': {
|
|
392
|
+
item: _objectSpread(_objectSpread({}, property), {}, {
|
|
393
|
+
title
|
|
394
|
+
})
|
|
395
|
+
}
|
|
396
|
+
},
|
|
397
|
+
update: {
|
|
398
|
+
type: 'void',
|
|
399
|
+
'x-action': 'update',
|
|
400
|
+
'x-component': _EditFieldAction.EditFieldAction,
|
|
401
|
+
'x-visible': '{{isInheritField}}',
|
|
402
|
+
'x-component-props': {
|
|
403
|
+
item: _objectSpread(_objectSpread({}, property), {}, {
|
|
404
|
+
title,
|
|
405
|
+
__parent: collectionData.current
|
|
406
|
+
})
|
|
407
|
+
}
|
|
408
|
+
},
|
|
409
|
+
delete: {
|
|
410
|
+
type: 'void',
|
|
411
|
+
'x-action': 'destroy',
|
|
412
|
+
'x-component': 'Action',
|
|
413
|
+
'x-visible': '{{isInheritField}}',
|
|
414
|
+
'x-component-props': {
|
|
415
|
+
component: _icons().DeleteOutlined,
|
|
416
|
+
icon: 'DeleteOutlined',
|
|
417
|
+
className: (0, _css().css)`
|
|
418
|
+
background-color: rgb(255 236 232);
|
|
419
|
+
border-color: transparent;
|
|
420
|
+
color: #e31c1c;
|
|
421
|
+
height: 20px;
|
|
422
|
+
width: 20px;
|
|
423
|
+
padding: 5px;
|
|
424
|
+
&:hover {
|
|
425
|
+
background-color: rgb(253 205 197);
|
|
426
|
+
}
|
|
427
|
+
`,
|
|
428
|
+
confirm: {
|
|
429
|
+
title: "{{t('Delete record')}}",
|
|
430
|
+
getContainer: () => {
|
|
431
|
+
return document.getElementById('graph_container');
|
|
432
|
+
},
|
|
433
|
+
collectionConten: "{{t('Are you sure you want to delete it?')}}"
|
|
434
|
+
},
|
|
435
|
+
useAction: () => (0, _actionHooks.useDestroyFieldActionAndRefreshCM)({
|
|
436
|
+
collectionName: property.collectionName,
|
|
437
|
+
name: property.name
|
|
438
|
+
})
|
|
439
|
+
}
|
|
440
|
+
},
|
|
441
|
+
override: {
|
|
442
|
+
type: 'void',
|
|
443
|
+
'x-action': 'create',
|
|
444
|
+
'x-visible': '{{!isInheritField}}',
|
|
445
|
+
'x-component': 'OverrideFieldAction',
|
|
446
|
+
'x-component-props': {
|
|
447
|
+
icon: 'ReconciliationOutlined',
|
|
448
|
+
item: _objectSpread(_objectSpread({}, property), {}, {
|
|
449
|
+
title,
|
|
450
|
+
__parent: collectionData.current,
|
|
451
|
+
targetCollection: name
|
|
452
|
+
})
|
|
453
|
+
}
|
|
454
|
+
},
|
|
455
|
+
view: {
|
|
456
|
+
type: 'void',
|
|
457
|
+
'x-action': 'view',
|
|
458
|
+
'x-visible': '{{!isInheritField}}',
|
|
459
|
+
'x-component': 'ViewFieldAction',
|
|
460
|
+
'x-component-props': {
|
|
461
|
+
icon: 'ReconciliationOutlined',
|
|
462
|
+
item: _objectSpread(_objectSpread({}, property), {}, {
|
|
463
|
+
title,
|
|
464
|
+
__parent: collectionData.current
|
|
465
|
+
})
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
}))));
|
|
471
|
+
};
|
|
472
|
+
|
|
473
|
+
const _useCollectionManager = (0, _client().useCollectionManager)(),
|
|
474
|
+
getInterface = _useCollectionManager.getInterface; // 获取当前字段列表
|
|
475
|
+
|
|
476
|
+
|
|
477
|
+
const useCurrentFields = () => {
|
|
478
|
+
const record = (0, _client().useRecord)();
|
|
479
|
+
|
|
480
|
+
const _useCollectionManager2 = (0, _client().useCollectionManager)(),
|
|
481
|
+
getCollectionFields = _useCollectionManager2.getCollectionFields;
|
|
482
|
+
|
|
483
|
+
const fields = getCollectionFields(record.collectionName || record.name);
|
|
484
|
+
return fields;
|
|
485
|
+
};
|
|
486
|
+
|
|
487
|
+
const _handelOpenPorts = isCollapse => {
|
|
488
|
+
var _targetGraph$getCellB;
|
|
489
|
+
|
|
490
|
+
(_targetGraph$getCellB = targetGraph.getCellById(item.name)) === null || _targetGraph$getCellB === void 0 ? void 0 : _targetGraph$getCellB.toFront();
|
|
491
|
+
setCollapse(isCollapse);
|
|
492
|
+
const collapseNodes = targetGraph.collapseNodes || [];
|
|
493
|
+
collapseNodes.push({
|
|
494
|
+
[item.name]: isCollapse
|
|
495
|
+
});
|
|
496
|
+
targetGraph.collapseNodes = collapseNodes;
|
|
497
|
+
targetGraph.getCellById(item.name).setData({
|
|
498
|
+
collapse: true
|
|
499
|
+
});
|
|
500
|
+
};
|
|
501
|
+
|
|
502
|
+
const isCollapse = collapse && (data === null || data === void 0 ? void 0 : data.collapse);
|
|
503
|
+
return _react().default.createElement("div", {
|
|
504
|
+
className: "body"
|
|
505
|
+
}, (_portsData$initPorts = portsData['initPorts']) === null || _portsData$initPorts === void 0 ? void 0 : _portsData$initPorts.map(property => {
|
|
506
|
+
var _property$uiSchema, _getInterface, _property$uiSchema2, _getInterface2;
|
|
507
|
+
|
|
508
|
+
return property.uiSchema && _react().default.createElement(_antd().Popover, {
|
|
509
|
+
content: CollectionConten(property),
|
|
510
|
+
getPopupContainer: () => {
|
|
511
|
+
return document.getElementById('graph_container');
|
|
512
|
+
},
|
|
513
|
+
mouseLeaveDelay: 0,
|
|
514
|
+
zIndex: 100,
|
|
515
|
+
title: _react().default.createElement("div", null, compile((_property$uiSchema = property.uiSchema) === null || _property$uiSchema === void 0 ? void 0 : _property$uiSchema.title), _react().default.createElement("span", {
|
|
516
|
+
style: {
|
|
517
|
+
color: '#ffa940',
|
|
518
|
+
float: 'right'
|
|
519
|
+
}
|
|
520
|
+
}, compile((_getInterface = getInterface(property.interface)) === null || _getInterface === void 0 ? void 0 : _getInterface.title))),
|
|
521
|
+
key: property.id,
|
|
522
|
+
placement: "right"
|
|
523
|
+
}, _react().default.createElement("div", {
|
|
524
|
+
className: "body-item",
|
|
525
|
+
key: property.id,
|
|
526
|
+
id: property.id,
|
|
527
|
+
style: {
|
|
528
|
+
background: targetPort || sourcePort === property.id || (associated === null || associated === void 0 ? void 0 : associated.includes(property.name)) ? '#e6f7ff' : null
|
|
529
|
+
}
|
|
530
|
+
}, _react().default.createElement("div", {
|
|
531
|
+
className: "name"
|
|
532
|
+
}, _react().default.createElement(_antd().Badge, {
|
|
533
|
+
color: typeColor(property)
|
|
534
|
+
}), compile((_property$uiSchema2 = property.uiSchema) === null || _property$uiSchema2 === void 0 ? void 0 : _property$uiSchema2.title)), _react().default.createElement("div", {
|
|
535
|
+
className: `type field_type`
|
|
536
|
+
}, compile((_getInterface2 = getInterface(property.interface)) === null || _getInterface2 === void 0 ? void 0 : _getInterface2.title)), _react().default.createElement(OperationButton, {
|
|
537
|
+
property: property
|
|
538
|
+
})));
|
|
539
|
+
}), _react().default.createElement("div", {
|
|
540
|
+
className: "morePorts"
|
|
541
|
+
}, isCollapse && ((_portsData$morePorts = portsData['morePorts']) === null || _portsData$morePorts === void 0 ? void 0 : _portsData$morePorts.map(property => {
|
|
542
|
+
var _property$uiSchema3, _getInterface3, _property$uiSchema4, _getInterface4;
|
|
543
|
+
|
|
544
|
+
return property.uiSchema && _react().default.createElement(_antd().Popover, {
|
|
545
|
+
content: CollectionConten(property),
|
|
546
|
+
getPopupContainer: () => {
|
|
547
|
+
return document.getElementById('graph_container');
|
|
548
|
+
},
|
|
549
|
+
mouseLeaveDelay: 0,
|
|
550
|
+
zIndex: 100,
|
|
551
|
+
title: _react().default.createElement("div", null, compile((_property$uiSchema3 = property.uiSchema) === null || _property$uiSchema3 === void 0 ? void 0 : _property$uiSchema3.title), _react().default.createElement("span", {
|
|
552
|
+
style: {
|
|
553
|
+
color: '#ffa940',
|
|
554
|
+
float: 'right'
|
|
555
|
+
}
|
|
556
|
+
}, compile((_getInterface3 = getInterface(property.interface)) === null || _getInterface3 === void 0 ? void 0 : _getInterface3.title))),
|
|
557
|
+
key: property.id,
|
|
558
|
+
placement: "right"
|
|
559
|
+
}, _react().default.createElement("div", {
|
|
560
|
+
className: "body-item",
|
|
561
|
+
key: property.id,
|
|
562
|
+
id: property.id,
|
|
563
|
+
style: {
|
|
564
|
+
background: targetPort || sourcePort === property.id || (associated === null || associated === void 0 ? void 0 : associated.includes(property.name)) ? '#e6f7ff' : null
|
|
565
|
+
}
|
|
566
|
+
}, _react().default.createElement("div", {
|
|
567
|
+
className: "name"
|
|
568
|
+
}, _react().default.createElement(_antd().Badge, {
|
|
569
|
+
color: "green"
|
|
570
|
+
}), compile((_property$uiSchema4 = property.uiSchema) === null || _property$uiSchema4 === void 0 ? void 0 : _property$uiSchema4.title)), _react().default.createElement("div", {
|
|
571
|
+
className: `type field_type`
|
|
572
|
+
}, compile((_getInterface4 = getInterface(property.interface)) === null || _getInterface4 === void 0 ? void 0 : _getInterface4.title)), _react().default.createElement(OperationButton, {
|
|
573
|
+
property: property
|
|
574
|
+
})));
|
|
575
|
+
}))), _react().default.createElement("a", {
|
|
576
|
+
className: (0, _css().css)`
|
|
577
|
+
display: block;
|
|
578
|
+
color: #958f8f;
|
|
579
|
+
padding: 10px 5px;
|
|
580
|
+
&:hover {
|
|
581
|
+
color: rgb(99 90 88);
|
|
582
|
+
}
|
|
583
|
+
`,
|
|
584
|
+
onClick: () => _handelOpenPorts(!isCollapse)
|
|
585
|
+
}, isCollapse ? [_react().default.createElement(_icons().UpOutlined, {
|
|
586
|
+
style: {
|
|
587
|
+
margin: '0px 8px 0px 5px'
|
|
588
|
+
},
|
|
589
|
+
key: "icon"
|
|
590
|
+
}), _react().default.createElement("span", {
|
|
591
|
+
key: "associate"
|
|
592
|
+
}, t('Association Fields'))] : [_react().default.createElement(_icons().DownOutlined, {
|
|
593
|
+
style: {
|
|
594
|
+
margin: '0px 8px 0px 5px'
|
|
595
|
+
},
|
|
596
|
+
key: "icon"
|
|
597
|
+
}), _react().default.createElement("span", {
|
|
598
|
+
key: "all"
|
|
599
|
+
}, t('All Fields'))]));
|
|
600
|
+
});
|
|
601
|
+
|
|
602
|
+
var _default = Entity;
|
|
603
|
+
exports.default = _default;
|