@nocobase/plugin-graph-collection-manager 0.11.0-alpha.1 → 0.11.1-alpha.2
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/lib/client/GraphDrawPage.js +11 -4
- package/lib/client/action-hooks.d.ts +14 -1
- package/lib/client/action-hooks.js +9 -7
- package/lib/client/components/EditCollectionAction.d.ts +2 -1
- package/lib/client/components/EditCollectionAction.js +3 -12
- package/lib/client/components/Entity.js +16 -28
- package/lib/client/style.d.ts +12 -9
- package/lib/client/style.js +208 -193
- package/lib/client/utils.d.ts +3 -4
- package/package.json +7 -7
- package/src/client/GraphDrawPage.tsx +17 -10
- package/src/client/action-hooks.tsx +11 -6
- package/src/client/components/EditCollectionAction.tsx +3 -15
- package/src/client/components/Entity.tsx +15 -30
- package/src/client/style.tsx +205 -184
|
@@ -72,7 +72,7 @@ var _actionHooks = require("./action-hooks");
|
|
|
72
72
|
var _AddCollectionAction = require("./components/AddCollectionAction");
|
|
73
73
|
var _Entity = _interopRequireDefault(require("./components/Entity"));
|
|
74
74
|
var _ViewNode = require("./components/ViewNode");
|
|
75
|
-
var _style = require("./style");
|
|
75
|
+
var _style = _interopRequireDefault(require("./style"));
|
|
76
76
|
var _utils = require("./utils");
|
|
77
77
|
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); }
|
|
78
78
|
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; }
|
|
@@ -449,6 +449,10 @@ const handelResetLayout = () => {
|
|
|
449
449
|
};
|
|
450
450
|
const GraphDrawPage = _react2().default.memo(() => {
|
|
451
451
|
var _targetGraph7;
|
|
452
|
+
const _useGlobalTheme = (0, _client().useGlobalTheme)(),
|
|
453
|
+
theme = _useGlobalTheme.theme;
|
|
454
|
+
const _useStyles = (0, _style.default)(),
|
|
455
|
+
styles = _useStyles.styles;
|
|
452
456
|
const options = (0, _react2().useContext)(_react().SchemaOptionsContext);
|
|
453
457
|
const ctx = (0, _react2().useContext)(_client().CollectionManagerContext);
|
|
454
458
|
const api = (0, _client().useAPIClient)();
|
|
@@ -634,6 +638,8 @@ const GraphDrawPage = _react2().default.memo(() => {
|
|
|
634
638
|
collections: (_targetGraph2 = targetGraph) === null || _targetGraph2 === void 0 ? void 0 : _targetGraph2.collections,
|
|
635
639
|
refreshCM: refreshGM,
|
|
636
640
|
interfaces: ctx.interfaces
|
|
641
|
+
}, _react2().default.createElement(_antd().ConfigProvider, {
|
|
642
|
+
theme: theme
|
|
637
643
|
}, _react2().default.createElement("div", {
|
|
638
644
|
style: {
|
|
639
645
|
height: 'auto'
|
|
@@ -642,7 +648,7 @@ const GraphDrawPage = _react2().default.memo(() => {
|
|
|
642
648
|
node: node,
|
|
643
649
|
setTargetNode: setTargetNode,
|
|
644
650
|
targetGraph: targetGraph
|
|
645
|
-
})))))));
|
|
651
|
+
}))))))));
|
|
646
652
|
},
|
|
647
653
|
ports: {
|
|
648
654
|
groups: {
|
|
@@ -1193,7 +1199,7 @@ const GraphDrawPage = _react2().default.memo(() => {
|
|
|
1193
1199
|
};
|
|
1194
1200
|
}();
|
|
1195
1201
|
return _react2().default.createElement(_antd().Layout, null, _react2().default.createElement("div", {
|
|
1196
|
-
className:
|
|
1202
|
+
className: styles.graphCollectionContainerClass
|
|
1197
1203
|
}, _react2().default.createElement(_client().CollectionManagerProvider, {
|
|
1198
1204
|
collections: (_targetGraph7 = targetGraph) === null || _targetGraph7 === void 0 ? void 0 : _targetGraph7.collections,
|
|
1199
1205
|
refreshCM: refreshGM
|
|
@@ -1203,7 +1209,7 @@ const GraphDrawPage = _react2().default.memo(() => {
|
|
|
1203
1209
|
handleSearchCollection
|
|
1204
1210
|
}
|
|
1205
1211
|
}, _react2().default.createElement("div", {
|
|
1206
|
-
className: (0, _client().cx)(
|
|
1212
|
+
className: (0, _client().cx)(styles.collectionListClass)
|
|
1207
1213
|
}, _react2().default.createElement(_client().SchemaComponent, {
|
|
1208
1214
|
components: {
|
|
1209
1215
|
Select: props => _react2().default.createElement(_client().Select, _objectSpread(_objectSpread({
|
|
@@ -1526,6 +1532,7 @@ const GraphDrawPage = _react2().default.memo(() => {
|
|
|
1526
1532
|
}
|
|
1527
1533
|
}), _react2().default.createElement("div", {
|
|
1528
1534
|
id: "graph-minimap",
|
|
1535
|
+
className: styles.graphMinimap,
|
|
1529
1536
|
style: {
|
|
1530
1537
|
width: '300px',
|
|
1531
1538
|
height: '250px',
|
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export declare const useValuesFromRecord: (options: any, data: any) =>
|
|
2
|
+
export declare const useValuesFromRecord: (options: any, data: any) => {
|
|
3
|
+
state: {};
|
|
4
|
+
setState: import("ahooks/lib/useSetState").SetState<{}>;
|
|
5
|
+
loading: boolean;
|
|
6
|
+
data?: unknown;
|
|
7
|
+
error?: Error;
|
|
8
|
+
params: any;
|
|
9
|
+
cancel: () => void;
|
|
10
|
+
refresh: () => void;
|
|
11
|
+
refreshAsync: () => Promise<unknown>;
|
|
12
|
+
run: (...params: any) => void;
|
|
13
|
+
runAsync: (...params: any) => Promise<unknown>;
|
|
14
|
+
mutate: (data?: unknown) => void;
|
|
15
|
+
};
|
|
3
16
|
export declare const SourceCollection: React.MemoExoticComponent<import("@formily/react").ReactFC<unknown>>;
|
|
4
17
|
export declare const useCancelAction: () => {
|
|
5
18
|
run(): Promise<void>;
|
|
@@ -25,16 +25,16 @@ function _client() {
|
|
|
25
25
|
};
|
|
26
26
|
return data;
|
|
27
27
|
}
|
|
28
|
-
function
|
|
29
|
-
const data = require("
|
|
30
|
-
|
|
28
|
+
function _client2() {
|
|
29
|
+
const data = require("@nocobase/utils/client");
|
|
30
|
+
_client2 = function _client2() {
|
|
31
31
|
return data;
|
|
32
32
|
};
|
|
33
33
|
return data;
|
|
34
34
|
}
|
|
35
|
-
function
|
|
36
|
-
const data = require("
|
|
37
|
-
|
|
35
|
+
function _antd() {
|
|
36
|
+
const data = require("antd");
|
|
37
|
+
_antd = function _antd() {
|
|
38
38
|
return data;
|
|
39
39
|
};
|
|
40
40
|
return data;
|
|
@@ -310,7 +310,9 @@ const useAsyncDataSource = service => {
|
|
|
310
310
|
service(targetScope).then(_reactive().action.bound(data => {
|
|
311
311
|
field.dataSource = data;
|
|
312
312
|
field.loading = false;
|
|
313
|
-
}))
|
|
313
|
+
})).catch(err => {
|
|
314
|
+
(0, _client2().error)(err);
|
|
315
|
+
});
|
|
314
316
|
};
|
|
315
317
|
};
|
|
316
318
|
exports.useAsyncDataSource = useAsyncDataSource;
|
|
@@ -29,7 +29,8 @@ var _actionHooks = require("../action-hooks");
|
|
|
29
29
|
var _utils = require("../utils");
|
|
30
30
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
31
31
|
const EditCollectionAction = ({
|
|
32
|
-
item: record
|
|
32
|
+
item: record,
|
|
33
|
+
className
|
|
33
34
|
}) => {
|
|
34
35
|
return _react().default.createElement(_client().EditCollection, {
|
|
35
36
|
item: record,
|
|
@@ -40,17 +41,7 @@ const EditCollectionAction = ({
|
|
|
40
41
|
},
|
|
41
42
|
getContainer: _utils.getPopupContainer
|
|
42
43
|
}, _react().default.createElement(_icons().EditOutlined, {
|
|
43
|
-
className:
|
|
44
|
-
border-color: transparent;
|
|
45
|
-
color: rgb(78 89 105);
|
|
46
|
-
height: 20px;
|
|
47
|
-
width: 22px;
|
|
48
|
-
margin: 0px 5px 4px;
|
|
49
|
-
line-height: 25px;
|
|
50
|
-
&:hover {
|
|
51
|
-
background-color: rgb(229 230 235);
|
|
52
|
-
}
|
|
53
|
-
`
|
|
44
|
+
className: className
|
|
54
45
|
}));
|
|
55
46
|
};
|
|
56
47
|
exports.EditCollectionAction = EditCollectionAction;
|
|
@@ -48,7 +48,7 @@ function _react() {
|
|
|
48
48
|
return data;
|
|
49
49
|
}
|
|
50
50
|
var _actionHooks = require("../action-hooks");
|
|
51
|
-
var _style = require("../style");
|
|
51
|
+
var _style = _interopRequireDefault(require("../style"));
|
|
52
52
|
var _utils = require("../utils");
|
|
53
53
|
var _AddFieldAction = require("./AddFieldAction");
|
|
54
54
|
var _CollectionNodeProvder = require("./CollectionNodeProvder");
|
|
@@ -57,6 +57,7 @@ var _EditFieldAction = require("./EditFieldAction");
|
|
|
57
57
|
var _FieldSummary = require("./FieldSummary");
|
|
58
58
|
var _OverrideFieldAction = require("./OverrideFieldAction");
|
|
59
59
|
var _ViewFieldAction = require("./ViewFieldAction");
|
|
60
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
60
61
|
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); }
|
|
61
62
|
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; }
|
|
62
63
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
@@ -73,6 +74,8 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
73
74
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
74
75
|
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); }
|
|
75
76
|
const Entity = props => {
|
|
77
|
+
const _useStyles = (0, _style.default)(),
|
|
78
|
+
styles = _useStyles.styles;
|
|
76
79
|
const node = props.node,
|
|
77
80
|
setTargetNode = props.setTargetNode,
|
|
78
81
|
targetGraph = props.targetGraph;
|
|
@@ -123,13 +126,14 @@ const Entity = props => {
|
|
|
123
126
|
loadCollections
|
|
124
127
|
};
|
|
125
128
|
return _react().default.createElement("div", {
|
|
126
|
-
className:
|
|
129
|
+
className: styles.entityContainer,
|
|
127
130
|
style: {
|
|
128
131
|
boxShadow: attrs === null || attrs === void 0 ? void 0 : attrs.boxShadow,
|
|
129
132
|
border: select ? '2px dashed #f5a20a' : 0
|
|
130
133
|
}
|
|
131
134
|
}, category.map((v, index) => {
|
|
132
135
|
return _react().default.createElement(_antd().Badge.Ribbon, {
|
|
136
|
+
key: index,
|
|
133
137
|
color: v.color,
|
|
134
138
|
style: {
|
|
135
139
|
width: '103%',
|
|
@@ -140,15 +144,15 @@ const Entity = props => {
|
|
|
140
144
|
placement: "start"
|
|
141
145
|
});
|
|
142
146
|
}), _react().default.createElement("div", {
|
|
143
|
-
className:
|
|
147
|
+
className: styles.headClass,
|
|
144
148
|
style: {
|
|
145
149
|
background: attrs !== null && attrs !== void 0 && attrs.hightLight ? '#1890ff' : null,
|
|
146
150
|
paddingTop: category.length * 3
|
|
147
151
|
}
|
|
148
152
|
}, _react().default.createElement("span", {
|
|
149
|
-
className:
|
|
153
|
+
className: styles.tableNameClass
|
|
150
154
|
}, compile(title)), _react().default.createElement("div", {
|
|
151
|
-
className:
|
|
155
|
+
className: styles.tableBtnClass
|
|
152
156
|
}, _react().default.createElement(_client().SchemaComponentProvider, null, _react().default.createElement(_CollectionNodeProvder.CollectionNodeProvder, {
|
|
153
157
|
setTargetNode: setTargetNode,
|
|
154
158
|
node: node
|
|
@@ -185,7 +189,8 @@ const Entity = props => {
|
|
|
185
189
|
'x-component': 'EditCollectionAction',
|
|
186
190
|
'x-component-props': {
|
|
187
191
|
type: 'primary',
|
|
188
|
-
item: collectionData.current
|
|
192
|
+
item: collectionData.current,
|
|
193
|
+
className: 'btn-edit-in-head'
|
|
189
194
|
}
|
|
190
195
|
},
|
|
191
196
|
delete: {
|
|
@@ -195,16 +200,7 @@ const Entity = props => {
|
|
|
195
200
|
'x-component-props': {
|
|
196
201
|
component: _icons().DeleteOutlined,
|
|
197
202
|
icon: 'DeleteOutlined',
|
|
198
|
-
className:
|
|
199
|
-
background-color: rgb(255 236 232);
|
|
200
|
-
border-color: transparent;
|
|
201
|
-
color: #e31c1c;
|
|
202
|
-
height: 20px;
|
|
203
|
-
padding: 5px;
|
|
204
|
-
&:hover {
|
|
205
|
-
background-color: rgb(253 205 197);
|
|
206
|
-
}
|
|
207
|
-
`,
|
|
203
|
+
className: 'btn-del',
|
|
208
204
|
confirm: {
|
|
209
205
|
title: "{{t('Delete record')}}",
|
|
210
206
|
getContainer: _utils.getPopupContainer,
|
|
@@ -256,13 +252,15 @@ const PortsCom = _react().default.memo(({
|
|
|
256
252
|
return `${prefix || ''}${(0, _shared().uid)()}`;
|
|
257
253
|
};
|
|
258
254
|
const CollectionConten = data => {
|
|
255
|
+
const _useStyles2 = (0, _style.default)(),
|
|
256
|
+
styles = _useStyles2.styles;
|
|
259
257
|
const type = data.type,
|
|
260
258
|
name = data.name,
|
|
261
259
|
primaryKey = data.primaryKey,
|
|
262
260
|
allowNull = data.allowNull,
|
|
263
261
|
autoIncrement = data.autoIncrement;
|
|
264
262
|
return _react().default.createElement("div", {
|
|
265
|
-
className:
|
|
263
|
+
className: styles.collectionPopoverClass
|
|
266
264
|
}, _react().default.createElement("div", {
|
|
267
265
|
className: "field-content"
|
|
268
266
|
}, _react().default.createElement("div", null, _react().default.createElement("span", null, "name"), ": ", _react().default.createElement("span", {
|
|
@@ -368,17 +366,7 @@ const PortsCom = _react().default.memo(({
|
|
|
368
366
|
'x-component-props': {
|
|
369
367
|
component: _icons().DeleteOutlined,
|
|
370
368
|
icon: 'DeleteOutlined',
|
|
371
|
-
className:
|
|
372
|
-
background-color: rgb(255 236 232);
|
|
373
|
-
border-color: transparent;
|
|
374
|
-
color: #e31c1c;
|
|
375
|
-
height: 20px;
|
|
376
|
-
width: 20px;
|
|
377
|
-
padding: 5px;
|
|
378
|
-
&:hover {
|
|
379
|
-
background-color: rgb(253 205 197);
|
|
380
|
-
}
|
|
381
|
-
`,
|
|
369
|
+
className: 'btn-del',
|
|
382
370
|
confirm: {
|
|
383
371
|
title: "{{t('Delete record')}}",
|
|
384
372
|
getContainer: _utils.getPopupContainer,
|
package/lib/client/style.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
|
|
2
|
+
graphMinimap: import("antd-style").SerializedStyles;
|
|
3
|
+
addButtonClass: import("antd-style").SerializedStyles;
|
|
4
|
+
entityContainer: import("antd-style").SerializedStyles;
|
|
5
|
+
headClass: import("antd-style").SerializedStyles;
|
|
6
|
+
tableNameClass: import("antd-style").SerializedStyles;
|
|
7
|
+
tableBtnClass: import("antd-style").SerializedStyles;
|
|
8
|
+
collectionPopoverClass: import("antd-style").SerializedStyles;
|
|
9
|
+
collectionListClass: import("antd-style").SerializedStyles;
|
|
10
|
+
graphCollectionContainerClass: import("antd-style").SerializedStyles;
|
|
11
|
+
}>;
|
|
12
|
+
export default useStyles;
|