@nocobase/plugin-graph-collection-manager 0.10.0-alpha.5 → 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/AddFieldAction.d.ts +2 -1
- package/lib/client/components/AddFieldAction.js +3 -1
- package/lib/client/components/EditCollectionAction.js +1 -8
- package/lib/client/components/Entity.js +19 -24
- 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/client.d.ts
CHANGED
package/client.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/client"));
|
|
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/client/index.js');
|
|
@@ -20,7 +20,6 @@ function _react() {
|
|
|
20
20
|
}
|
|
21
21
|
var _GraphCollectionShortcut = require("./GraphCollectionShortcut");
|
|
22
22
|
var _utils = require("./utils");
|
|
23
|
-
const _excluded = ["routes", "components"];
|
|
24
23
|
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); }
|
|
25
24
|
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; }
|
|
26
25
|
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; }
|
|
@@ -28,14 +27,8 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
28
27
|
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; }
|
|
29
28
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
30
29
|
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); }
|
|
31
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
32
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
33
30
|
const GraphCollectionProvider = _react().default.memo(props => {
|
|
34
31
|
const ctx = (0, _react().useContext)(_client().PluginManagerContext);
|
|
35
|
-
const _useContext = (0, _react().useContext)(_client().RouteSwitchContext),
|
|
36
|
-
routes = _useContext.routes,
|
|
37
|
-
components = _useContext.components,
|
|
38
|
-
others = _objectWithoutProperties(_useContext, _excluded);
|
|
39
32
|
// i18n.addResources('en-US', 'graphPositions', enUS);
|
|
40
33
|
// i18n.addResources('ja-JP', 'graphPositions', jaJP);
|
|
41
34
|
// i18n.addResources('zh-CN', 'graphPositions', zhCN);
|
|
@@ -52,13 +45,7 @@ const GraphCollectionProvider = _react().default.memo(props => {
|
|
|
52
45
|
value: {
|
|
53
46
|
components: _objectSpread({}, ctx === null || ctx === void 0 ? void 0 : ctx.components)
|
|
54
47
|
}
|
|
55
|
-
},
|
|
56
|
-
value: _objectSpread(_objectSpread({
|
|
57
|
-
components: _objectSpread({}, components)
|
|
58
|
-
}, others), {}, {
|
|
59
|
-
routes
|
|
60
|
-
})
|
|
61
|
-
}, props.children)));
|
|
48
|
+
}, props.children));
|
|
62
49
|
});
|
|
63
50
|
exports.GraphCollectionProvider = GraphCollectionProvider;
|
|
64
51
|
GraphCollectionProvider.displayName = 'GraphCollectionProvider';
|
|
@@ -11,13 +11,6 @@ function _icons() {
|
|
|
11
11
|
};
|
|
12
12
|
return data;
|
|
13
13
|
}
|
|
14
|
-
function _css() {
|
|
15
|
-
const data = require("@emotion/css");
|
|
16
|
-
_css = function _css() {
|
|
17
|
-
return data;
|
|
18
|
-
};
|
|
19
|
-
return data;
|
|
20
|
-
}
|
|
21
14
|
function _shared() {
|
|
22
15
|
const data = require("@formily/shared");
|
|
23
16
|
_shared = function _shared() {
|
|
@@ -39,8 +32,8 @@ function _react() {
|
|
|
39
32
|
};
|
|
40
33
|
return data;
|
|
41
34
|
}
|
|
42
|
-
var _GraphDrawPage = require("./GraphDrawPage");
|
|
43
35
|
var _actionHooks = require("./action-hooks");
|
|
36
|
+
var _GraphDrawPage = require("./GraphDrawPage");
|
|
44
37
|
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); }
|
|
45
38
|
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; }
|
|
46
39
|
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; }
|
|
@@ -145,7 +138,7 @@ const useCollectionValues = options => {
|
|
|
145
138
|
};
|
|
146
139
|
const GraphCollectionPane = () => {
|
|
147
140
|
return _react().default.createElement("div", {
|
|
148
|
-
className: (0,
|
|
141
|
+
className: (0, _client().css)`
|
|
149
142
|
height: calc(100vh - 160px);
|
|
150
143
|
overflow: auto;
|
|
151
144
|
margin: calc(var(--nb-spacing) * -1);
|
|
@@ -19,13 +19,6 @@ function _x4() {
|
|
|
19
19
|
return data;
|
|
20
20
|
}
|
|
21
21
|
require("@antv/x6-react-shape");
|
|
22
|
-
function _css() {
|
|
23
|
-
const data = require("@emotion/css");
|
|
24
|
-
_css = function _css() {
|
|
25
|
-
return data;
|
|
26
|
-
};
|
|
27
|
-
return data;
|
|
28
|
-
}
|
|
29
22
|
function _react() {
|
|
30
23
|
const data = require("@formily/react");
|
|
31
24
|
_react = function _react() {
|
|
@@ -40,6 +33,13 @@ function _client() {
|
|
|
40
33
|
};
|
|
41
34
|
return data;
|
|
42
35
|
}
|
|
36
|
+
function _client2() {
|
|
37
|
+
const data = require("@nocobase/utils/client");
|
|
38
|
+
_client2 = function _client2() {
|
|
39
|
+
return data;
|
|
40
|
+
};
|
|
41
|
+
return data;
|
|
42
|
+
}
|
|
43
43
|
function _ahooks() {
|
|
44
44
|
const data = require("ahooks");
|
|
45
45
|
_ahooks = function _ahooks() {
|
|
@@ -61,13 +61,6 @@ function _dagre() {
|
|
|
61
61
|
};
|
|
62
62
|
return data;
|
|
63
63
|
}
|
|
64
|
-
function _lodash() {
|
|
65
|
-
const data = require("lodash");
|
|
66
|
-
_lodash = function _lodash() {
|
|
67
|
-
return data;
|
|
68
|
-
};
|
|
69
|
-
return data;
|
|
70
|
-
}
|
|
71
64
|
function _react2() {
|
|
72
65
|
const data = _interopRequireWildcard(require("react"));
|
|
73
66
|
_react2 = function _react2() {
|
|
@@ -97,6 +90,12 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typ
|
|
|
97
90
|
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); }
|
|
98
91
|
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); } }
|
|
99
92
|
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); }); }; }
|
|
93
|
+
const drop = _client2().lodash.drop,
|
|
94
|
+
groupBy = _client2().lodash.groupBy,
|
|
95
|
+
last = _client2().lodash.last,
|
|
96
|
+
maxBy = _client2().lodash.maxBy,
|
|
97
|
+
minBy = _client2().lodash.minBy,
|
|
98
|
+
take = _client2().lodash.take;
|
|
100
99
|
const LINE_HEIGHT = 40;
|
|
101
100
|
const NODE_WIDTH = 250;
|
|
102
101
|
let targetGraph;
|
|
@@ -184,7 +183,7 @@ function _layout() {
|
|
|
184
183
|
});
|
|
185
184
|
targetGraph.unfreeze();
|
|
186
185
|
if (targetNode) {
|
|
187
|
-
typeof targetNode === 'string' ? targetGraph.positionCell(
|
|
186
|
+
typeof targetNode === 'string' ? targetGraph.positionCell(last(nodes), 'top', {
|
|
188
187
|
padding: 100
|
|
189
188
|
}) : targetGraph.positionCell(targetNode, 'top', {
|
|
190
189
|
padding: 100
|
|
@@ -307,7 +306,7 @@ const formatNodeData = () => {
|
|
|
307
306
|
layoutNodes.push(edge.getSourceCellId());
|
|
308
307
|
layoutNodes.push(edge.getTargetCellId());
|
|
309
308
|
});
|
|
310
|
-
const nodeGroup =
|
|
309
|
+
const nodeGroup = groupBy(nodes, v => {
|
|
311
310
|
if (layoutNodes.includes(v.id)) {
|
|
312
311
|
return 'linkNodes';
|
|
313
312
|
} else {
|
|
@@ -357,8 +356,8 @@ const handelResetLayout = () => {
|
|
|
357
356
|
_dagre().default.layout(g);
|
|
358
357
|
targetGraph.freeze();
|
|
359
358
|
const gNodes = g.nodes();
|
|
360
|
-
const nodeWithEdges =
|
|
361
|
-
const nodeWithoutEdges =
|
|
359
|
+
const nodeWithEdges = take(gNodes, linkNodes.length);
|
|
360
|
+
const nodeWithoutEdges = drop(gNodes, linkNodes.length);
|
|
362
361
|
nodeWithEdges.forEach(id => {
|
|
363
362
|
var _positions$find;
|
|
364
363
|
const node = targetGraph.getCell(id);
|
|
@@ -375,25 +374,25 @@ const handelResetLayout = () => {
|
|
|
375
374
|
});
|
|
376
375
|
if (nodeWithEdges.length) {
|
|
377
376
|
var _targetGraph$getCell;
|
|
378
|
-
maxY = targetGraph.getCellById(
|
|
377
|
+
maxY = targetGraph.getCellById(maxBy(nodeWithEdges, k => {
|
|
379
378
|
return targetGraph.getCellById(k).position().y;
|
|
380
379
|
})).position().y;
|
|
381
|
-
minX = targetGraph.getCellById(
|
|
380
|
+
minX = targetGraph.getCellById(minBy(nodeWithEdges, k => {
|
|
382
381
|
return targetGraph.getCellById(k).position().x;
|
|
383
382
|
})).position().x;
|
|
384
|
-
const maxX = targetGraph.getCellById(
|
|
383
|
+
const maxX = targetGraph.getCellById(maxBy(nodeWithEdges, k => {
|
|
385
384
|
return targetGraph.getCellById(k).position().x;
|
|
386
385
|
})).position().x;
|
|
387
386
|
const yNodes = nodeWithEdges.filter(v => {
|
|
388
387
|
return Math.abs(targetGraph.getCellById(v).position().y - maxY) < 50;
|
|
389
388
|
});
|
|
390
|
-
const referenceNode = (_targetGraph$getCell = targetGraph.getCell(
|
|
389
|
+
const referenceNode = (_targetGraph$getCell = targetGraph.getCell(maxBy(yNodes, k => targetGraph.getCellById(k).position().x))) === null || _targetGraph$getCell === void 0 ? void 0 : _targetGraph$getCell.position();
|
|
391
390
|
num = Math.round(maxX / 320) || 1;
|
|
392
391
|
alternateNum = Math.floor((4500 - (maxX + 100 - referenceNode.x)) / 280);
|
|
393
392
|
rawEntity = getGridData(num, rawNodes);
|
|
394
393
|
if (alternateNum >= 1) {
|
|
395
|
-
const alternateNodes =
|
|
396
|
-
rawEntity = getGridData(num,
|
|
394
|
+
const alternateNodes = take(nodeWithoutEdges, alternateNum);
|
|
395
|
+
rawEntity = getGridData(num, drop(nodeWithoutEdges, alternateNum));
|
|
397
396
|
alternateNodes.forEach((id, index) => {
|
|
398
397
|
const node = targetGraph.getCell(id);
|
|
399
398
|
if (node) {
|
|
@@ -711,7 +710,7 @@ const GraphDrawPage = _react2().default.memo(() => {
|
|
|
711
710
|
});
|
|
712
711
|
targetGraph.on('blank:click', e => {
|
|
713
712
|
var _targetGraph3, _targetGraph$collapse;
|
|
714
|
-
if ((_targetGraph3 = targetGraph)
|
|
713
|
+
if ((_targetGraph3 = targetGraph) !== null && _targetGraph3 !== void 0 && _targetGraph3.activeEdge) {
|
|
715
714
|
var _targetGraph4;
|
|
716
715
|
handleEdgeUnActive((_targetGraph4 = targetGraph) === null || _targetGraph4 === void 0 ? void 0 : _targetGraph4.activeEdge);
|
|
717
716
|
}
|
|
@@ -861,7 +860,7 @@ const GraphDrawPage = _react2().default.memo(() => {
|
|
|
861
860
|
inheritEdges = _formatData2.inheritEdges;
|
|
862
861
|
const currentNodes = targetGraph.getNodes().map(v => v.store.data);
|
|
863
862
|
const totalEdges = targetGraph.getEdges().map(v => v.store.data);
|
|
864
|
-
const currentEdgesGroup =
|
|
863
|
+
const currentEdgesGroup = groupBy(totalEdges, v => {
|
|
865
864
|
if (v.connectionType) {
|
|
866
865
|
return 'currentInheritEdges';
|
|
867
866
|
} else {
|
|
@@ -879,15 +878,15 @@ const GraphDrawPage = _react2().default.memo(() => {
|
|
|
879
878
|
const updateNode = targetGraph.getCellById(node.id);
|
|
880
879
|
switch (status) {
|
|
881
880
|
case 'add':
|
|
882
|
-
const maxY =
|
|
881
|
+
const maxY = maxBy(positions, 'y').y;
|
|
883
882
|
const yNodes = positions.filter(v => {
|
|
884
883
|
return Math.abs(v.y - maxY) < 100;
|
|
885
884
|
});
|
|
886
|
-
let referenceNode =
|
|
885
|
+
let referenceNode = maxBy(yNodes, 'x');
|
|
887
886
|
let position;
|
|
888
887
|
if (referenceNode.x > 4500) {
|
|
889
|
-
const minX =
|
|
890
|
-
referenceNode =
|
|
888
|
+
const minX = minBy(positions, 'x').x;
|
|
889
|
+
referenceNode = minBy(yNodes, 'x');
|
|
891
890
|
position = {
|
|
892
891
|
x: minX,
|
|
893
892
|
y: referenceNode.y + 400
|
|
@@ -990,7 +989,7 @@ const GraphDrawPage = _react2().default.memo(() => {
|
|
|
990
989
|
const connectedEdges = targetGraph.getConnectedEdges(node);
|
|
991
990
|
const visibleEdges = connectedEdges.filter(v => {
|
|
992
991
|
var _v$store$data;
|
|
993
|
-
return !((_v$store$data = v.store.data)
|
|
992
|
+
return !((_v$store$data = v.store.data) !== null && _v$store$data !== void 0 && _v$store$data.connectionType) && v.getTargetCellId() === key;
|
|
994
993
|
});
|
|
995
994
|
visibleEdges.forEach(v => {
|
|
996
995
|
var _node$store$data$attr2;
|
|
@@ -1001,7 +1000,7 @@ const GraphDrawPage = _react2().default.memo(() => {
|
|
|
1001
1000
|
var _node$store$data$attr;
|
|
1002
1001
|
const sourceId = m2mEdge.getSourceCellId();
|
|
1003
1002
|
const node = targetGraph.getCellById(sourceId);
|
|
1004
|
-
if (!((_node$store$data$attr = node.store.data.attrs)
|
|
1003
|
+
if (!((_node$store$data$attr = node.store.data.attrs) !== null && _node$store$data$attr !== void 0 && _node$store$data$attr.hightLight)) {
|
|
1005
1004
|
node.setAttrs({
|
|
1006
1005
|
hightLight: true,
|
|
1007
1006
|
direction: DirectionType.Target,
|
|
@@ -1014,7 +1013,7 @@ const GraphDrawPage = _react2().default.memo(() => {
|
|
|
1014
1013
|
}
|
|
1015
1014
|
const sourceId = v.getSourceCellId();
|
|
1016
1015
|
const node = targetGraph.getCellById(sourceId);
|
|
1017
|
-
if (!((_node$store$data$attr2 = node.store.data.attrs)
|
|
1016
|
+
if (!((_node$store$data$attr2 = node.store.data.attrs) !== null && _node$store$data$attr2 !== void 0 && _node$store$data$attr2.hightLight)) {
|
|
1018
1017
|
node.setAttrs({
|
|
1019
1018
|
hightLight: true,
|
|
1020
1019
|
direction: DirectionType.Target,
|
|
@@ -1030,7 +1029,7 @@ const GraphDrawPage = _react2().default.memo(() => {
|
|
|
1030
1029
|
const connectedEdges = targetGraph.getConnectedEdges(node);
|
|
1031
1030
|
const visibleEdges = connectedEdges.filter(v => {
|
|
1032
1031
|
var _v$store$data2;
|
|
1033
|
-
return !((_v$store$data2 = v.store.data)
|
|
1032
|
+
return !((_v$store$data2 = v.store.data) !== null && _v$store$data2 !== void 0 && _v$store$data2.connectionType) && v.getSourceCellId() === key;
|
|
1034
1033
|
});
|
|
1035
1034
|
visibleEdges.forEach(v => {
|
|
1036
1035
|
var _node$store$data$attr4;
|
|
@@ -1041,7 +1040,7 @@ const GraphDrawPage = _react2().default.memo(() => {
|
|
|
1041
1040
|
var _node$store$data$attr3;
|
|
1042
1041
|
const targetId = m2mEdge.getTargetCellId();
|
|
1043
1042
|
const node = targetGraph.getCellById(targetId);
|
|
1044
|
-
if (!((_node$store$data$attr3 = node.store.data.attrs)
|
|
1043
|
+
if (!((_node$store$data$attr3 = node.store.data.attrs) !== null && _node$store$data$attr3 !== void 0 && _node$store$data$attr3.hightLight)) {
|
|
1045
1044
|
node.setAttrs({
|
|
1046
1045
|
hightLight: true,
|
|
1047
1046
|
direction: DirectionType.Source,
|
|
@@ -1054,7 +1053,7 @@ const GraphDrawPage = _react2().default.memo(() => {
|
|
|
1054
1053
|
}
|
|
1055
1054
|
const targetId = v.getTargetCellId();
|
|
1056
1055
|
const node = targetGraph.getCellById(targetId);
|
|
1057
|
-
if (!((_node$store$data$attr4 = node.store.data.attrs)
|
|
1056
|
+
if (!((_node$store$data$attr4 = node.store.data.attrs) !== null && _node$store$data$attr4 !== void 0 && _node$store$data$attr4.hightLight)) {
|
|
1058
1057
|
node.setAttrs({
|
|
1059
1058
|
hightLight: true,
|
|
1060
1059
|
direction: DirectionType.Source,
|
|
@@ -1194,7 +1193,7 @@ const GraphDrawPage = _react2().default.memo(() => {
|
|
|
1194
1193
|
};
|
|
1195
1194
|
}();
|
|
1196
1195
|
return _react2().default.createElement(_antd().Layout, null, _react2().default.createElement("div", {
|
|
1197
|
-
className: (0,
|
|
1196
|
+
className: (0, _client().cx)(_style.graphCollectionContainerClass)
|
|
1198
1197
|
}, _react2().default.createElement(_client().CollectionManagerProvider, {
|
|
1199
1198
|
collections: (_targetGraph7 = targetGraph) === null || _targetGraph7 === void 0 ? void 0 : _targetGraph7.collections,
|
|
1200
1199
|
refreshCM: refreshGM
|
|
@@ -1204,11 +1203,11 @@ const GraphDrawPage = _react2().default.memo(() => {
|
|
|
1204
1203
|
handleSearchCollection
|
|
1205
1204
|
}
|
|
1206
1205
|
}, _react2().default.createElement("div", {
|
|
1207
|
-
className: (0,
|
|
1206
|
+
className: (0, _client().cx)(_style.collectionListClass)
|
|
1208
1207
|
}, _react2().default.createElement(_client().SchemaComponent, {
|
|
1209
1208
|
components: {
|
|
1210
1209
|
Select: props => _react2().default.createElement(_client().Select, _objectSpread(_objectSpread({
|
|
1211
|
-
|
|
1210
|
+
popupMatchSelectWidth: false
|
|
1212
1211
|
}, props), {}, {
|
|
1213
1212
|
getPopupContainer: _utils.getPopupContainer
|
|
1214
1213
|
})),
|
|
@@ -1299,7 +1298,7 @@ const GraphDrawPage = _react2().default.memo(() => {
|
|
|
1299
1298
|
}), _react2().default.createElement(_antd().Menu, {
|
|
1300
1299
|
selectedKeys: selectedKeys,
|
|
1301
1300
|
selectable: true,
|
|
1302
|
-
className: (0,
|
|
1301
|
+
className: (0, _client().css)`
|
|
1303
1302
|
.ant-menu-item {
|
|
1304
1303
|
height: 32px;
|
|
1305
1304
|
line-height: 32px;
|
|
@@ -1335,7 +1334,7 @@ const GraphDrawPage = _react2().default.memo(() => {
|
|
|
1335
1334
|
placement: "bottomRight",
|
|
1336
1335
|
trigger: ['click'],
|
|
1337
1336
|
getPopupContainer: _utils.getPopupContainer,
|
|
1338
|
-
overlayClassName: (0,
|
|
1337
|
+
overlayClassName: (0, _client().css)`
|
|
1339
1338
|
.ant-popover-inner-content {
|
|
1340
1339
|
padding: 0;
|
|
1341
1340
|
}
|
|
@@ -1388,7 +1387,7 @@ const GraphDrawPage = _react2().default.memo(() => {
|
|
|
1388
1387
|
const content = _react2().default.createElement("div", null, _react2().default.createElement(_antd().Menu, {
|
|
1389
1388
|
defaultSelectedKeys: [ConnectionType.Both],
|
|
1390
1389
|
selectable: true,
|
|
1391
|
-
className: (0,
|
|
1390
|
+
className: (0, _client().css)`
|
|
1392
1391
|
.ant-menu-item {
|
|
1393
1392
|
height: 32px;
|
|
1394
1393
|
line-height: 32px;
|
|
@@ -1421,7 +1420,7 @@ const GraphDrawPage = _react2().default.memo(() => {
|
|
|
1421
1420
|
placement: "bottomRight",
|
|
1422
1421
|
trigger: ['click'],
|
|
1423
1422
|
getPopupContainer: _utils.getPopupContainer,
|
|
1424
|
-
overlayClassName: (0,
|
|
1423
|
+
overlayClassName: (0, _client().css)`
|
|
1425
1424
|
.ant-popover-inner-content {
|
|
1426
1425
|
padding: 0;
|
|
1427
1426
|
}
|
|
@@ -1453,7 +1452,7 @@ const GraphDrawPage = _react2().default.memo(() => {
|
|
|
1453
1452
|
const content = _react2().default.createElement("div", null, _react2().default.createElement(_antd().Menu, {
|
|
1454
1453
|
defaultSelectedKeys: [DirectionType.Target],
|
|
1455
1454
|
selectable: true,
|
|
1456
|
-
className: (0,
|
|
1455
|
+
className: (0, _client().css)`
|
|
1457
1456
|
.ant-menu-item {
|
|
1458
1457
|
height: 32px;
|
|
1459
1458
|
line-height: 32px;
|
|
@@ -1487,7 +1486,7 @@ const GraphDrawPage = _react2().default.memo(() => {
|
|
|
1487
1486
|
placement: "bottomRight",
|
|
1488
1487
|
trigger: ['click'],
|
|
1489
1488
|
getPopupContainer: _utils.getPopupContainer,
|
|
1490
|
-
overlayClassName: (0,
|
|
1489
|
+
overlayClassName: (0, _client().css)`
|
|
1491
1490
|
.ant-popover-inner-content {
|
|
1492
1491
|
padding: 0;
|
|
1493
1492
|
}
|
|
@@ -32,9 +32,9 @@ function _antd() {
|
|
|
32
32
|
};
|
|
33
33
|
return data;
|
|
34
34
|
}
|
|
35
|
-
function
|
|
36
|
-
const data =
|
|
37
|
-
|
|
35
|
+
function _client2() {
|
|
36
|
+
const data = require("@nocobase/utils/client");
|
|
37
|
+
_client2 = function _client2() {
|
|
38
38
|
return data;
|
|
39
39
|
};
|
|
40
40
|
return data;
|
|
@@ -56,7 +56,6 @@ function _reactI18next() {
|
|
|
56
56
|
var _CollectionNodeProvder = require("./components/CollectionNodeProvder");
|
|
57
57
|
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); }
|
|
58
58
|
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; }
|
|
59
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
60
59
|
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); } }
|
|
61
60
|
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); }); }; }
|
|
62
61
|
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; }
|
|
@@ -84,7 +83,7 @@ const SourceCollection = (0, _react().observer)(() => {
|
|
|
84
83
|
record = _useContext.record;
|
|
85
84
|
const compile = (0, _client().useCompile)();
|
|
86
85
|
return _react2().default.createElement("div", null, _react2().default.createElement(_antd().Select, {
|
|
87
|
-
|
|
86
|
+
popupMatchSelectWidth: false,
|
|
88
87
|
disabled: true,
|
|
89
88
|
value: record.name,
|
|
90
89
|
options: [{
|
|
@@ -147,7 +146,7 @@ const useCreateAction = (collectionName, targetId) => {
|
|
|
147
146
|
return _asyncToGenerator(function* () {
|
|
148
147
|
yield form.submit();
|
|
149
148
|
const values = getValues();
|
|
150
|
-
const formValues = (
|
|
149
|
+
const formValues = _client2().lodash.omit(values, ['key', 'uiSchemaUid', 'collectionName', 'autoCreateReverseField', 'uiSchema.x-uid', 'reverseField.key', 'reverseField.uiSchemaUid']);
|
|
151
150
|
const isOpenPorts = !['obo', 'oho', 'o2o', 'o2m', 'm2o', 'm2m', 'linkTo', 'id'].includes(values.interface);
|
|
152
151
|
const _yield$api$resource$c = yield api.resource('collections.fields', collectionName).create({
|
|
153
152
|
values: formValues
|
|
@@ -223,7 +222,7 @@ const useUpdateCollectionActionAndRefreshCM = () => {
|
|
|
223
222
|
yield form.submit();
|
|
224
223
|
yield api.resource('collections').update({
|
|
225
224
|
filterByTk: name,
|
|
226
|
-
values: _objectSpread({}, (
|
|
225
|
+
values: _objectSpread({}, _client2().lodash.omit(form.values, ['fields']))
|
|
227
226
|
});
|
|
228
227
|
ctx.setVisible(false);
|
|
229
228
|
_antd().message.success(t('Saved successfully'));
|
|
@@ -43,7 +43,8 @@ const _useCreateCollectionField = record => {
|
|
|
43
43
|
};
|
|
44
44
|
};
|
|
45
45
|
const AddFieldAction = ({
|
|
46
|
-
item: record
|
|
46
|
+
item: record,
|
|
47
|
+
database
|
|
47
48
|
}) => {
|
|
48
49
|
return _react().default.createElement(_client().AddFieldAction, {
|
|
49
50
|
trigger: ['click'],
|
|
@@ -54,6 +55,7 @@ const AddFieldAction = ({
|
|
|
54
55
|
},
|
|
55
56
|
|
|
56
57
|
item: record,
|
|
58
|
+
database: database,
|
|
57
59
|
scope: {
|
|
58
60
|
useCancelAction: _actionHooks.useCancelAction,
|
|
59
61
|
useCreateCollectionField: () => _useCreateCollectionField(record)
|
|
@@ -11,13 +11,6 @@ function _icons() {
|
|
|
11
11
|
};
|
|
12
12
|
return data;
|
|
13
13
|
}
|
|
14
|
-
function _css() {
|
|
15
|
-
const data = require("@emotion/css");
|
|
16
|
-
_css = function _css() {
|
|
17
|
-
return data;
|
|
18
|
-
};
|
|
19
|
-
return data;
|
|
20
|
-
}
|
|
21
14
|
function _client() {
|
|
22
15
|
const data = require("@nocobase/client");
|
|
23
16
|
_client = function _client() {
|
|
@@ -47,7 +40,7 @@ const EditCollectionAction = ({
|
|
|
47
40
|
},
|
|
48
41
|
getContainer: _utils.getPopupContainer
|
|
49
42
|
}, _react().default.createElement(_icons().EditOutlined, {
|
|
50
|
-
className: (0,
|
|
43
|
+
className: (0, _client().css)`
|
|
51
44
|
border-color: transparent;
|
|
52
45
|
color: rgb(78 89 105);
|
|
53
46
|
height: 20px;
|
|
@@ -12,13 +12,6 @@ function _icons() {
|
|
|
12
12
|
return data;
|
|
13
13
|
}
|
|
14
14
|
require("@antv/x6-react-shape");
|
|
15
|
-
function _css() {
|
|
16
|
-
const data = require("@emotion/css");
|
|
17
|
-
_css = function _css() {
|
|
18
|
-
return data;
|
|
19
|
-
};
|
|
20
|
-
return data;
|
|
21
|
-
}
|
|
22
15
|
function _shared() {
|
|
23
16
|
const data = require("@formily/shared");
|
|
24
17
|
_shared = function _shared() {
|
|
@@ -33,16 +26,16 @@ function _client() {
|
|
|
33
26
|
};
|
|
34
27
|
return data;
|
|
35
28
|
}
|
|
36
|
-
function
|
|
37
|
-
const data = require("
|
|
38
|
-
|
|
29
|
+
function _client2() {
|
|
30
|
+
const data = require("@nocobase/utils/client");
|
|
31
|
+
_client2 = function _client2() {
|
|
39
32
|
return data;
|
|
40
33
|
};
|
|
41
34
|
return data;
|
|
42
35
|
}
|
|
43
|
-
function
|
|
44
|
-
const data = require("
|
|
45
|
-
|
|
36
|
+
function _antd() {
|
|
37
|
+
const data = require("antd");
|
|
38
|
+
_antd = function _antd() {
|
|
46
39
|
return data;
|
|
47
40
|
};
|
|
48
41
|
return data;
|
|
@@ -130,7 +123,7 @@ const Entity = props => {
|
|
|
130
123
|
loadCollections
|
|
131
124
|
};
|
|
132
125
|
return _react().default.createElement("div", {
|
|
133
|
-
className: (0,
|
|
126
|
+
className: (0, _client().cx)(_style.entityContainer),
|
|
134
127
|
style: {
|
|
135
128
|
boxShadow: attrs === null || attrs === void 0 ? void 0 : attrs.boxShadow,
|
|
136
129
|
border: select ? '2px dashed #f5a20a' : 0
|
|
@@ -149,7 +142,7 @@ const Entity = props => {
|
|
|
149
142
|
}), _react().default.createElement("div", {
|
|
150
143
|
className: _style.headClass,
|
|
151
144
|
style: {
|
|
152
|
-
background:
|
|
145
|
+
background: attrs !== null && attrs !== void 0 && attrs.hightLight ? '#1890ff' : null,
|
|
153
146
|
paddingTop: category.length * 3
|
|
154
147
|
}
|
|
155
148
|
}, _react().default.createElement("span", {
|
|
@@ -202,7 +195,7 @@ const Entity = props => {
|
|
|
202
195
|
'x-component-props': {
|
|
203
196
|
component: _icons().DeleteOutlined,
|
|
204
197
|
icon: 'DeleteOutlined',
|
|
205
|
-
className: (0,
|
|
198
|
+
className: (0, _client().css)`
|
|
206
199
|
background-color: rgb(255 236 232);
|
|
207
200
|
border-color: transparent;
|
|
208
201
|
color: #e31c1c;
|
|
@@ -251,7 +244,8 @@ const PortsCom = _react().default.memo(({
|
|
|
251
244
|
const _useGCMTranslation = (0, _utils.useGCMTranslation)(),
|
|
252
245
|
t = _useGCMTranslation.t;
|
|
253
246
|
const compile = (0, _client().useCompile)();
|
|
254
|
-
const
|
|
247
|
+
const database = (0, _client().useCurrentAppInfo)();
|
|
248
|
+
const portsData = _client2().lodash.groupBy(ports.items, v => {
|
|
255
249
|
if (v.isForeignKey || v.primaryKey || ['obo', 'oho', 'o2o', 'o2m', 'm2o', 'm2m', 'linkTo', 'id'].includes(v.interface)) {
|
|
256
250
|
return 'initPorts';
|
|
257
251
|
} else {
|
|
@@ -268,7 +262,7 @@ const PortsCom = _react().default.memo(({
|
|
|
268
262
|
allowNull = data.allowNull,
|
|
269
263
|
autoIncrement = data.autoIncrement;
|
|
270
264
|
return _react().default.createElement("div", {
|
|
271
|
-
className: (0,
|
|
265
|
+
className: (0, _client().cx)(_style.collectiionPopoverClass)
|
|
272
266
|
}, _react().default.createElement("div", {
|
|
273
267
|
className: "field-content"
|
|
274
268
|
}, _react().default.createElement("div", null, _react().default.createElement("span", null, "name"), ": ", _react().default.createElement("span", {
|
|
@@ -304,7 +298,7 @@ const PortsCom = _react().default.memo(({
|
|
|
304
298
|
Form: _client().Form,
|
|
305
299
|
ResourceActionProvider: _client().ResourceActionProvider,
|
|
306
300
|
Select: props => _react().default.createElement(_client().Select, _objectSpread(_objectSpread({
|
|
307
|
-
|
|
301
|
+
popupMatchSelectWidth: false
|
|
308
302
|
}, props), {}, {
|
|
309
303
|
getPopupContainer: _utils.getPopupContainer
|
|
310
304
|
})),
|
|
@@ -350,7 +344,8 @@ const PortsCom = _react().default.memo(({
|
|
|
350
344
|
'x-component-props': {
|
|
351
345
|
item: _objectSpread(_objectSpread({}, property), {}, {
|
|
352
346
|
title
|
|
353
|
-
})
|
|
347
|
+
}),
|
|
348
|
+
database
|
|
354
349
|
}
|
|
355
350
|
},
|
|
356
351
|
update: {
|
|
@@ -373,7 +368,7 @@ const PortsCom = _react().default.memo(({
|
|
|
373
368
|
'x-component-props': {
|
|
374
369
|
component: _icons().DeleteOutlined,
|
|
375
370
|
icon: 'DeleteOutlined',
|
|
376
|
-
className: (0,
|
|
371
|
+
className: (0, _client().css)`
|
|
377
372
|
background-color: rgb(255 236 232);
|
|
378
373
|
border-color: transparent;
|
|
379
374
|
color: #e31c1c;
|
|
@@ -472,7 +467,7 @@ const PortsCom = _react().default.memo(({
|
|
|
472
467
|
key: property.id,
|
|
473
468
|
id: property.id,
|
|
474
469
|
style: {
|
|
475
|
-
background: targetPort || sourcePort === property.id ||
|
|
470
|
+
background: targetPort || sourcePort === property.id || associated !== null && associated !== void 0 && associated.includes(property.name) ? '#e6f7ff' : null
|
|
476
471
|
}
|
|
477
472
|
}, _react().default.createElement("div", {
|
|
478
473
|
className: "name"
|
|
@@ -505,7 +500,7 @@ const PortsCom = _react().default.memo(({
|
|
|
505
500
|
key: property.id,
|
|
506
501
|
id: property.id,
|
|
507
502
|
style: {
|
|
508
|
-
background: targetPort || sourcePort === property.id ||
|
|
503
|
+
background: targetPort || sourcePort === property.id || associated !== null && associated !== void 0 && associated.includes(property.name) ? '#e6f7ff' : null
|
|
509
504
|
}
|
|
510
505
|
}, _react().default.createElement("div", {
|
|
511
506
|
className: "name"
|
|
@@ -517,7 +512,7 @@ const PortsCom = _react().default.memo(({
|
|
|
517
512
|
property: property
|
|
518
513
|
})));
|
|
519
514
|
}))), _react().default.createElement("a", {
|
|
520
|
-
className: (0,
|
|
515
|
+
className: (0, _client().css)`
|
|
521
516
|
display: block;
|
|
522
517
|
color: #958f8f;
|
|
523
518
|
padding: 10px 5px;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export declare const FieldSummary: React.MemoExoticComponent<import("@formily/react").ReactFC<
|
|
2
|
+
export declare const FieldSummary: React.MemoExoticComponent<import("@formily/react").ReactFC<Omit<any, "ref">>>;
|