@nocobase/plugin-graph-collection-manager 0.11.1-alpha.4 → 0.12.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 -1
- package/dist/client/index.js +65917 -0
- package/{lib → dist}/client/utils.d.ts +4 -3
- package/{lib → dist}/index.d.ts +1 -0
- package/dist/index.js +18 -0
- package/dist/locale/en-US.js +19 -0
- package/dist/locale/es-ES.js +19 -0
- package/dist/locale/fr-FR.js +19 -0
- package/dist/locale/ja-JP.js +17 -0
- package/dist/locale/pt-BR.js +19 -0
- package/dist/locale/zh-CN.js +20 -0
- package/dist/server/collections/graphPositions.js +26 -0
- package/dist/server/index.js +23 -0
- package/package.json +17 -28
- package/server.d.ts +2 -3
- package/server.js +1 -1
- package/lib/client/GraphCollectionProvider.js +0 -51
- package/lib/client/GraphCollectionShortcut.js +0 -169
- package/lib/client/GraphDrawPage.js +0 -1546
- package/lib/client/action-hooks.js +0 -318
- package/lib/client/components/AddCollectionAction.js +0 -58
- package/lib/client/components/AddFieldAction.js +0 -69
- package/lib/client/components/CollectionNodeProvder.js +0 -34
- package/lib/client/components/EditCollectionAction.js +0 -47
- package/lib/client/components/EditFieldAction.js +0 -63
- package/lib/client/components/Entity.js +0 -529
- package/lib/client/components/FieldSummary.js +0 -69
- package/lib/client/components/OverrideFieldAction.js +0 -64
- package/lib/client/components/ViewFieldAction.js +0 -45
- package/lib/client/components/ViewNode.js +0 -33
- package/lib/client/index.js +0 -27
- package/lib/client/locale/index.js +0 -4
- package/lib/client/style.js +0 -233
- package/lib/client/utils.js +0 -540
- package/lib/index.js +0 -13
- package/lib/locale/en-US.js +0 -22
- package/lib/locale/es-ES.js +0 -22
- package/lib/locale/fr-FR.js +0 -22
- package/lib/locale/ja-JP.js +0 -20
- package/lib/locale/pt-BR.js +0 -22
- package/lib/locale/zh-CN.js +0 -23
- package/lib/server/collections/graphPositions.js +0 -30
- package/lib/server/index.js +0 -37
- package/src/client/GraphCollectionProvider.tsx +0 -33
- package/src/client/GraphCollectionShortcut.tsx +0 -141
- package/src/client/GraphDrawPage.tsx +0 -1382
- package/src/client/action-hooks.tsx +0 -237
- package/src/client/components/AddCollectionAction.tsx +0 -28
- package/src/client/components/AddFieldAction.tsx +0 -37
- package/src/client/components/CollectionNodeProvder.tsx +0 -28
- package/src/client/components/EditCollectionAction.tsx +0 -21
- package/src/client/components/EditFieldAction.tsx +0 -30
- package/src/client/components/Entity.tsx +0 -495
- package/src/client/components/FieldSummary.tsx +0 -42
- package/src/client/components/OverrideFieldAction.tsx +0 -30
- package/src/client/components/ViewFieldAction.tsx +0 -12
- package/src/client/components/ViewNode.tsx +0 -22
- package/src/client/index.tsx +0 -10
- package/src/client/locale/index.ts +0 -3
- package/src/client/style.tsx +0 -227
- package/src/client/utils.tsx +0 -548
- package/src/index.ts +0 -1
- package/src/locale/en-US.ts +0 -15
- package/src/locale/es-ES.ts +0 -15
- package/src/locale/fr-FR.ts +0 -15
- package/src/locale/ja-JP.ts +0 -13
- package/src/locale/pt-BR.ts +0 -15
- package/src/locale/zh-CN.ts +0 -16
- package/src/server/actions/.gitkeep +0 -0
- package/src/server/collections/.gitkeep +0 -0
- package/src/server/collections/graphPositions.ts +0 -22
- package/src/server/index.ts +0 -13
- package/src/server/models/.gitkeep +0 -0
- package/src/server/repositories/.gitkeep +0 -0
- /package/{lib → dist}/client/GraphCollectionProvider.d.ts +0 -0
- /package/{lib → dist}/client/GraphCollectionShortcut.d.ts +0 -0
- /package/{lib → dist}/client/GraphDrawPage.d.ts +0 -0
- /package/{lib → dist}/client/action-hooks.d.ts +0 -0
- /package/{lib → dist}/client/components/AddCollectionAction.d.ts +0 -0
- /package/{lib → dist}/client/components/AddFieldAction.d.ts +0 -0
- /package/{lib → dist}/client/components/CollectionNodeProvder.d.ts +0 -0
- /package/{lib → dist}/client/components/EditCollectionAction.d.ts +0 -0
- /package/{lib → dist}/client/components/EditFieldAction.d.ts +0 -0
- /package/{lib → dist}/client/components/Entity.d.ts +0 -0
- /package/{lib → dist}/client/components/FieldSummary.d.ts +0 -0
- /package/{lib → dist}/client/components/OverrideFieldAction.d.ts +0 -0
- /package/{lib → dist}/client/components/ViewFieldAction.d.ts +0 -0
- /package/{lib → dist}/client/components/ViewNode.d.ts +0 -0
- /package/{lib → dist}/client/index.d.ts +0 -0
- /package/{lib → dist}/client/locale/index.d.ts +0 -0
- /package/{lib → dist}/client/style.d.ts +0 -0
- /package/{lib → dist}/locale/en-US.d.ts +0 -0
- /package/{lib → dist}/locale/es-ES.d.ts +0 -0
- /package/{lib → dist}/locale/fr-FR.d.ts +0 -0
- /package/{lib → dist}/locale/ja-JP.d.ts +0 -0
- /package/{lib → dist}/locale/pt-BR.d.ts +0 -0
- /package/{lib → dist}/locale/zh-CN.d.ts +0 -0
- /package/{lib → dist}/server/collections/graphPositions.d.ts +0 -0
- /package/{lib → dist}/server/index.d.ts +0 -0
|
@@ -1,495 +0,0 @@
|
|
|
1
|
-
import { DeleteOutlined, DownOutlined, EditOutlined, UpOutlined } from '@ant-design/icons';
|
|
2
|
-
import '@antv/x6-react-shape';
|
|
3
|
-
import { uid } from '@formily/shared';
|
|
4
|
-
import {
|
|
5
|
-
Action,
|
|
6
|
-
Checkbox,
|
|
7
|
-
CollectionCategroriesContext,
|
|
8
|
-
CollectionField,
|
|
9
|
-
CollectionProvider,
|
|
10
|
-
Form,
|
|
11
|
-
FormItem,
|
|
12
|
-
Formula,
|
|
13
|
-
Grid,
|
|
14
|
-
Input,
|
|
15
|
-
InputNumber,
|
|
16
|
-
Radio,
|
|
17
|
-
ResourceActionProvider,
|
|
18
|
-
SchemaComponent,
|
|
19
|
-
SchemaComponentProvider,
|
|
20
|
-
Select,
|
|
21
|
-
collection,
|
|
22
|
-
css,
|
|
23
|
-
useCollectionManager,
|
|
24
|
-
useCompile,
|
|
25
|
-
useCurrentAppInfo,
|
|
26
|
-
useRecord,
|
|
27
|
-
} from '@nocobase/client';
|
|
28
|
-
import { lodash } from '@nocobase/utils/client';
|
|
29
|
-
import { Badge, Dropdown, Popover, Tag } from 'antd';
|
|
30
|
-
import React, { useContext, useRef, useState } from 'react';
|
|
31
|
-
import {
|
|
32
|
-
useAsyncDataSource,
|
|
33
|
-
useCancelAction,
|
|
34
|
-
useDestroyActionAndRefreshCM,
|
|
35
|
-
useDestroyFieldActionAndRefreshCM,
|
|
36
|
-
useUpdateCollectionActionAndRefreshCM,
|
|
37
|
-
useValuesFromRecord,
|
|
38
|
-
} from '../action-hooks';
|
|
39
|
-
import useStyles from '../style';
|
|
40
|
-
import { getPopupContainer, useGCMTranslation } from '../utils';
|
|
41
|
-
import { AddFieldAction } from './AddFieldAction';
|
|
42
|
-
import { CollectionNodeProvder } from './CollectionNodeProvder';
|
|
43
|
-
import { EditCollectionAction } from './EditCollectionAction';
|
|
44
|
-
import { EditFieldAction } from './EditFieldAction';
|
|
45
|
-
import { FieldSummary } from './FieldSummary';
|
|
46
|
-
import { OverrideFieldAction } from './OverrideFieldAction';
|
|
47
|
-
import { ViewFieldAction } from './ViewFieldAction';
|
|
48
|
-
|
|
49
|
-
const Entity: React.FC<{
|
|
50
|
-
node?: Node | any;
|
|
51
|
-
setTargetNode: Function | any;
|
|
52
|
-
targetGraph: any;
|
|
53
|
-
}> = (props) => {
|
|
54
|
-
const { styles } = useStyles();
|
|
55
|
-
const { node, setTargetNode, targetGraph } = props;
|
|
56
|
-
const {
|
|
57
|
-
store: {
|
|
58
|
-
data: { title, name, item, attrs, select },
|
|
59
|
-
},
|
|
60
|
-
id,
|
|
61
|
-
} = node;
|
|
62
|
-
const database = useCurrentAppInfo();
|
|
63
|
-
const collectionData = useRef();
|
|
64
|
-
const categoryData = useContext(CollectionCategroriesContext);
|
|
65
|
-
collectionData.current = { ...item, title, inherits: item.inherits && new Proxy(item.inherits, {}) };
|
|
66
|
-
const { category } = item;
|
|
67
|
-
const compile = useCompile();
|
|
68
|
-
const loadCollections = async (field: any) => {
|
|
69
|
-
return targetGraph.collections?.map((collection: any) => ({
|
|
70
|
-
label: compile(collection.title),
|
|
71
|
-
value: collection.name,
|
|
72
|
-
}));
|
|
73
|
-
};
|
|
74
|
-
const loadCategories = async () => {
|
|
75
|
-
return categoryData?.data.map((item: any) => ({
|
|
76
|
-
label: compile(item.name),
|
|
77
|
-
value: item.id,
|
|
78
|
-
}));
|
|
79
|
-
};
|
|
80
|
-
const portsProps = {
|
|
81
|
-
targetGraph,
|
|
82
|
-
collectionData,
|
|
83
|
-
setTargetNode,
|
|
84
|
-
node,
|
|
85
|
-
loadCollections,
|
|
86
|
-
};
|
|
87
|
-
return (
|
|
88
|
-
<div
|
|
89
|
-
className={styles.entityContainer}
|
|
90
|
-
style={{ boxShadow: attrs?.boxShadow, border: select ? '2px dashed #f5a20a' : 0 }}
|
|
91
|
-
>
|
|
92
|
-
{category.map((v, index) => {
|
|
93
|
-
return (
|
|
94
|
-
<Badge.Ribbon
|
|
95
|
-
key={index}
|
|
96
|
-
color={v.color}
|
|
97
|
-
style={{ width: '103%', height: '3px', marginTop: index * 5 - 8, borderRadius: 0 }}
|
|
98
|
-
placement="start"
|
|
99
|
-
/>
|
|
100
|
-
);
|
|
101
|
-
})}
|
|
102
|
-
<div
|
|
103
|
-
className={styles.headClass}
|
|
104
|
-
style={{ background: attrs?.hightLight ? '#1890ff' : null, paddingTop: category.length * 3 }}
|
|
105
|
-
>
|
|
106
|
-
<span className={styles.tableNameClass}>{compile(title)}</span>
|
|
107
|
-
|
|
108
|
-
<div className={styles.tableBtnClass}>
|
|
109
|
-
<SchemaComponentProvider>
|
|
110
|
-
<CollectionNodeProvder setTargetNode={setTargetNode} node={node}>
|
|
111
|
-
<CollectionProvider collection={collection}>
|
|
112
|
-
<SchemaComponent
|
|
113
|
-
scope={{
|
|
114
|
-
useUpdateCollectionActionAndRefreshCM,
|
|
115
|
-
useCancelAction,
|
|
116
|
-
loadCollections,
|
|
117
|
-
loadCategories,
|
|
118
|
-
useAsyncDataSource,
|
|
119
|
-
Action,
|
|
120
|
-
DeleteOutlined,
|
|
121
|
-
enableInherits: database?.dialect === 'postgres',
|
|
122
|
-
}}
|
|
123
|
-
components={{
|
|
124
|
-
Action,
|
|
125
|
-
EditOutlined,
|
|
126
|
-
FormItem,
|
|
127
|
-
CollectionField,
|
|
128
|
-
Input,
|
|
129
|
-
Form,
|
|
130
|
-
Select,
|
|
131
|
-
EditCollectionAction,
|
|
132
|
-
Checkbox,
|
|
133
|
-
}}
|
|
134
|
-
schema={{
|
|
135
|
-
type: 'object',
|
|
136
|
-
properties: {
|
|
137
|
-
update: {
|
|
138
|
-
type: 'void',
|
|
139
|
-
title: '{{ t("Edit") }}',
|
|
140
|
-
'x-component': 'EditCollectionAction',
|
|
141
|
-
'x-component-props': {
|
|
142
|
-
type: 'primary',
|
|
143
|
-
item: collectionData.current,
|
|
144
|
-
className: 'btn-edit-in-head',
|
|
145
|
-
},
|
|
146
|
-
},
|
|
147
|
-
delete: {
|
|
148
|
-
type: 'void',
|
|
149
|
-
'x-action': 'destroy',
|
|
150
|
-
'x-component': 'Action',
|
|
151
|
-
'x-component-props': {
|
|
152
|
-
component: DeleteOutlined,
|
|
153
|
-
icon: 'DeleteOutlined',
|
|
154
|
-
className: 'btn-del',
|
|
155
|
-
|
|
156
|
-
confirm: {
|
|
157
|
-
title: "{{t('Delete record')}}",
|
|
158
|
-
getContainer: getPopupContainer,
|
|
159
|
-
collectionConten: "{{t('Are you sure you want to delete it?')}}",
|
|
160
|
-
},
|
|
161
|
-
useAction: () => useDestroyActionAndRefreshCM({ name, id }),
|
|
162
|
-
},
|
|
163
|
-
},
|
|
164
|
-
},
|
|
165
|
-
}}
|
|
166
|
-
/>
|
|
167
|
-
</CollectionProvider>
|
|
168
|
-
</CollectionNodeProvder>
|
|
169
|
-
</SchemaComponentProvider>
|
|
170
|
-
</div>
|
|
171
|
-
</div>
|
|
172
|
-
|
|
173
|
-
<PortsCom {...portsProps} />
|
|
174
|
-
</div>
|
|
175
|
-
);
|
|
176
|
-
};
|
|
177
|
-
|
|
178
|
-
const PortsCom = React.memo<any>(({ targetGraph, collectionData, setTargetNode, node, loadCollections }) => {
|
|
179
|
-
const {
|
|
180
|
-
store: {
|
|
181
|
-
data: { title, name, item, ports, data, sourcePort, associated, targetPort },
|
|
182
|
-
},
|
|
183
|
-
} = node;
|
|
184
|
-
const [collapse, setCollapse] = useState(false);
|
|
185
|
-
const { t } = useGCMTranslation();
|
|
186
|
-
const compile = useCompile();
|
|
187
|
-
const database = useCurrentAppInfo();
|
|
188
|
-
const portsData = lodash.groupBy(ports.items, (v) => {
|
|
189
|
-
if (
|
|
190
|
-
v.isForeignKey ||
|
|
191
|
-
v.primaryKey ||
|
|
192
|
-
['obo', 'oho', 'o2o', 'o2m', 'm2o', 'm2m', 'linkTo', 'id'].includes(v.interface)
|
|
193
|
-
) {
|
|
194
|
-
return 'initPorts';
|
|
195
|
-
} else {
|
|
196
|
-
return 'morePorts';
|
|
197
|
-
}
|
|
198
|
-
});
|
|
199
|
-
const useNewId = (prefix) => {
|
|
200
|
-
return `${prefix || ''}${uid()}`;
|
|
201
|
-
};
|
|
202
|
-
const CollectionConten = (data) => {
|
|
203
|
-
const { styles } = useStyles();
|
|
204
|
-
const { type, name, primaryKey, allowNull, autoIncrement } = data;
|
|
205
|
-
|
|
206
|
-
return (
|
|
207
|
-
<div className={styles.collectionPopoverClass}>
|
|
208
|
-
<div className="field-content">
|
|
209
|
-
<div>
|
|
210
|
-
<span>name</span>: <span className="field-type">{name}</span>
|
|
211
|
-
</div>
|
|
212
|
-
<div>
|
|
213
|
-
<span>type</span>: <span className="field-type">{type}</span>
|
|
214
|
-
</div>
|
|
215
|
-
</div>
|
|
216
|
-
<p>
|
|
217
|
-
{primaryKey && <Tag color="green">PRIMARY</Tag>}
|
|
218
|
-
{allowNull && <Tag color="geekblue">ALLOWNULL</Tag>}
|
|
219
|
-
{autoIncrement && <Tag color="purple">AUTOINCREMENT</Tag>}
|
|
220
|
-
</p>
|
|
221
|
-
</div>
|
|
222
|
-
);
|
|
223
|
-
};
|
|
224
|
-
const typeColor = (v) => {
|
|
225
|
-
if (v.isForeignKey || v.primaryKey || v.interface === 'id') {
|
|
226
|
-
return 'red';
|
|
227
|
-
} else if (['obo', 'oho', 'o2o', 'o2m', 'm2o', 'm2m', 'linkTo'].includes(v.interface)) {
|
|
228
|
-
return 'orange';
|
|
229
|
-
}
|
|
230
|
-
};
|
|
231
|
-
|
|
232
|
-
const OperationButton = ({ property }) => {
|
|
233
|
-
const isInheritField = !(property.collectionName !== name);
|
|
234
|
-
return (
|
|
235
|
-
<div className="field-operator">
|
|
236
|
-
<SchemaComponentProvider
|
|
237
|
-
components={{
|
|
238
|
-
FormItem,
|
|
239
|
-
CollectionField,
|
|
240
|
-
Input,
|
|
241
|
-
Form,
|
|
242
|
-
ResourceActionProvider,
|
|
243
|
-
Select: (props) => (
|
|
244
|
-
<Select popupMatchSelectWidth={false} {...props} getPopupContainer={getPopupContainer} />
|
|
245
|
-
),
|
|
246
|
-
Checkbox,
|
|
247
|
-
Radio,
|
|
248
|
-
InputNumber,
|
|
249
|
-
Grid,
|
|
250
|
-
FieldSummary,
|
|
251
|
-
Action,
|
|
252
|
-
EditOutlined,
|
|
253
|
-
DeleteOutlined,
|
|
254
|
-
AddFieldAction,
|
|
255
|
-
OverrideFieldAction,
|
|
256
|
-
ViewFieldAction,
|
|
257
|
-
Dropdown,
|
|
258
|
-
Formula,
|
|
259
|
-
}}
|
|
260
|
-
scope={{
|
|
261
|
-
useAsyncDataSource,
|
|
262
|
-
loadCollections,
|
|
263
|
-
useCancelAction,
|
|
264
|
-
useNewId,
|
|
265
|
-
useCurrentFields,
|
|
266
|
-
useValuesFromRecord,
|
|
267
|
-
useUpdateCollectionActionAndRefreshCM,
|
|
268
|
-
isInheritField,
|
|
269
|
-
}}
|
|
270
|
-
>
|
|
271
|
-
<CollectionNodeProvder
|
|
272
|
-
record={collectionData.current}
|
|
273
|
-
setTargetNode={setTargetNode}
|
|
274
|
-
node={node}
|
|
275
|
-
handelOpenPorts={() => handelOpenPorts(true)}
|
|
276
|
-
>
|
|
277
|
-
<SchemaComponent
|
|
278
|
-
scope={useCancelAction}
|
|
279
|
-
schema={{
|
|
280
|
-
type: 'object',
|
|
281
|
-
properties: {
|
|
282
|
-
create: {
|
|
283
|
-
type: 'void',
|
|
284
|
-
'x-action': 'create',
|
|
285
|
-
'x-component': 'AddFieldAction',
|
|
286
|
-
'x-visible': '{{isInheritField}}',
|
|
287
|
-
'x-component-props': {
|
|
288
|
-
item: {
|
|
289
|
-
...property,
|
|
290
|
-
title,
|
|
291
|
-
},
|
|
292
|
-
database,
|
|
293
|
-
},
|
|
294
|
-
},
|
|
295
|
-
update: {
|
|
296
|
-
type: 'void',
|
|
297
|
-
'x-action': 'update',
|
|
298
|
-
'x-component': EditFieldAction,
|
|
299
|
-
'x-visible': '{{isInheritField}}',
|
|
300
|
-
'x-component-props': {
|
|
301
|
-
item: {
|
|
302
|
-
...property,
|
|
303
|
-
title,
|
|
304
|
-
__parent: collectionData.current,
|
|
305
|
-
},
|
|
306
|
-
},
|
|
307
|
-
},
|
|
308
|
-
delete: {
|
|
309
|
-
type: 'void',
|
|
310
|
-
'x-action': 'destroy',
|
|
311
|
-
'x-component': 'Action',
|
|
312
|
-
'x-visible': '{{isInheritField}}',
|
|
313
|
-
'x-component-props': {
|
|
314
|
-
component: DeleteOutlined,
|
|
315
|
-
icon: 'DeleteOutlined',
|
|
316
|
-
className: 'btn-del',
|
|
317
|
-
confirm: {
|
|
318
|
-
title: "{{t('Delete record')}}",
|
|
319
|
-
getContainer: getPopupContainer,
|
|
320
|
-
collectionConten: "{{t('Are you sure you want to delete it?')}}",
|
|
321
|
-
},
|
|
322
|
-
useAction: () =>
|
|
323
|
-
useDestroyFieldActionAndRefreshCM({
|
|
324
|
-
collectionName: property.collectionName,
|
|
325
|
-
name: property.name,
|
|
326
|
-
}),
|
|
327
|
-
},
|
|
328
|
-
},
|
|
329
|
-
override: {
|
|
330
|
-
type: 'void',
|
|
331
|
-
'x-action': 'create',
|
|
332
|
-
'x-visible': '{{!isInheritField}}',
|
|
333
|
-
'x-component': 'OverrideFieldAction',
|
|
334
|
-
'x-component-props': {
|
|
335
|
-
icon: 'ReconciliationOutlined',
|
|
336
|
-
item: {
|
|
337
|
-
...property,
|
|
338
|
-
title,
|
|
339
|
-
__parent: collectionData.current,
|
|
340
|
-
targetCollection: name,
|
|
341
|
-
},
|
|
342
|
-
},
|
|
343
|
-
},
|
|
344
|
-
view: {
|
|
345
|
-
type: 'void',
|
|
346
|
-
'x-action': 'view',
|
|
347
|
-
'x-visible': '{{!isInheritField}}',
|
|
348
|
-
'x-component': 'ViewFieldAction',
|
|
349
|
-
'x-component-props': {
|
|
350
|
-
icon: 'ReconciliationOutlined',
|
|
351
|
-
item: {
|
|
352
|
-
...property,
|
|
353
|
-
title,
|
|
354
|
-
__parent: collectionData.current,
|
|
355
|
-
},
|
|
356
|
-
},
|
|
357
|
-
},
|
|
358
|
-
},
|
|
359
|
-
}}
|
|
360
|
-
/>
|
|
361
|
-
</CollectionNodeProvder>
|
|
362
|
-
</SchemaComponentProvider>
|
|
363
|
-
</div>
|
|
364
|
-
);
|
|
365
|
-
};
|
|
366
|
-
const { getInterface } = useCollectionManager();
|
|
367
|
-
// 获取当前字段列表
|
|
368
|
-
const useCurrentFields = () => {
|
|
369
|
-
const record = useRecord();
|
|
370
|
-
const { getCollectionFields } = useCollectionManager();
|
|
371
|
-
const fields = getCollectionFields(record.collectionName || record.name) as any[];
|
|
372
|
-
return fields;
|
|
373
|
-
};
|
|
374
|
-
const handelOpenPorts = (isCollapse?) => {
|
|
375
|
-
targetGraph.getCellById(item.name)?.toFront();
|
|
376
|
-
setCollapse(isCollapse);
|
|
377
|
-
const collapseNodes = targetGraph.collapseNodes || [];
|
|
378
|
-
collapseNodes.push({
|
|
379
|
-
[item.name]: isCollapse,
|
|
380
|
-
});
|
|
381
|
-
targetGraph.collapseNodes = collapseNodes;
|
|
382
|
-
targetGraph.getCellById(item.name).setData({ collapse: true });
|
|
383
|
-
};
|
|
384
|
-
const isCollapse = collapse && data?.collapse;
|
|
385
|
-
return (
|
|
386
|
-
<div className="body">
|
|
387
|
-
{portsData['initPorts']?.map((property) => {
|
|
388
|
-
return (
|
|
389
|
-
property.uiSchema && (
|
|
390
|
-
<Popover
|
|
391
|
-
content={CollectionConten(property)}
|
|
392
|
-
getPopupContainer={getPopupContainer}
|
|
393
|
-
mouseLeaveDelay={0}
|
|
394
|
-
zIndex={100}
|
|
395
|
-
title={
|
|
396
|
-
<div>
|
|
397
|
-
{compile(property.uiSchema?.title)}
|
|
398
|
-
<span style={{ color: '#ffa940', float: 'right' }}>
|
|
399
|
-
{compile(getInterface(property.interface)?.title)}
|
|
400
|
-
</span>
|
|
401
|
-
</div>
|
|
402
|
-
}
|
|
403
|
-
key={property.id}
|
|
404
|
-
placement="right"
|
|
405
|
-
>
|
|
406
|
-
<div
|
|
407
|
-
className="body-item"
|
|
408
|
-
key={property.id}
|
|
409
|
-
id={property.id}
|
|
410
|
-
style={{
|
|
411
|
-
background:
|
|
412
|
-
targetPort || sourcePort === property.id || associated?.includes(property.name) ? '#e6f7ff' : null,
|
|
413
|
-
}}
|
|
414
|
-
>
|
|
415
|
-
<div className="name">
|
|
416
|
-
<Badge color={typeColor(property)} />
|
|
417
|
-
{compile(property.uiSchema?.title)}
|
|
418
|
-
</div>
|
|
419
|
-
<div className={`type field_type`}>{compile(getInterface(property.interface)?.title)}</div>
|
|
420
|
-
<OperationButton property={property} />
|
|
421
|
-
</div>
|
|
422
|
-
</Popover>
|
|
423
|
-
)
|
|
424
|
-
);
|
|
425
|
-
})}
|
|
426
|
-
<div className="morePorts">
|
|
427
|
-
{isCollapse &&
|
|
428
|
-
portsData['morePorts']?.map((property) => {
|
|
429
|
-
return (
|
|
430
|
-
property.uiSchema && (
|
|
431
|
-
<Popover
|
|
432
|
-
content={CollectionConten(property)}
|
|
433
|
-
getPopupContainer={getPopupContainer}
|
|
434
|
-
mouseLeaveDelay={0}
|
|
435
|
-
zIndex={100}
|
|
436
|
-
title={
|
|
437
|
-
<div>
|
|
438
|
-
{compile(property.uiSchema?.title)}
|
|
439
|
-
<span style={{ color: '#ffa940', float: 'right' }}>
|
|
440
|
-
{compile(getInterface(property.interface)?.title)}
|
|
441
|
-
</span>
|
|
442
|
-
</div>
|
|
443
|
-
}
|
|
444
|
-
key={property.id}
|
|
445
|
-
placement="right"
|
|
446
|
-
>
|
|
447
|
-
<div
|
|
448
|
-
className="body-item"
|
|
449
|
-
key={property.id}
|
|
450
|
-
id={property.id}
|
|
451
|
-
style={{
|
|
452
|
-
background:
|
|
453
|
-
targetPort || sourcePort === property.id || associated?.includes(property.name)
|
|
454
|
-
? '#e6f7ff'
|
|
455
|
-
: null,
|
|
456
|
-
}}
|
|
457
|
-
>
|
|
458
|
-
<div className="name">
|
|
459
|
-
<Badge color="green" />
|
|
460
|
-
{compile(property.uiSchema?.title)}
|
|
461
|
-
</div>
|
|
462
|
-
<div className={`type field_type`}>{compile(getInterface(property.interface)?.title)}</div>
|
|
463
|
-
<OperationButton property={property} />
|
|
464
|
-
</div>
|
|
465
|
-
</Popover>
|
|
466
|
-
)
|
|
467
|
-
);
|
|
468
|
-
})}
|
|
469
|
-
</div>
|
|
470
|
-
<a
|
|
471
|
-
className={css`
|
|
472
|
-
display: block;
|
|
473
|
-
color: #958f8f;
|
|
474
|
-
padding: 10px 5px;
|
|
475
|
-
&:hover {
|
|
476
|
-
color: rgb(99 90 88);
|
|
477
|
-
}
|
|
478
|
-
`}
|
|
479
|
-
onClick={() => handelOpenPorts(!isCollapse)}
|
|
480
|
-
>
|
|
481
|
-
{isCollapse
|
|
482
|
-
? [
|
|
483
|
-
<UpOutlined style={{ margin: '0px 8px 0px 5px' }} key="icon" />,
|
|
484
|
-
<span key="associate">{t('Association Fields')}</span>,
|
|
485
|
-
]
|
|
486
|
-
: [
|
|
487
|
-
<DownOutlined style={{ margin: '0px 8px 0px 5px' }} key="icon" />,
|
|
488
|
-
<span key="all">{t('All Fields')}</span>,
|
|
489
|
-
]}
|
|
490
|
-
</a>
|
|
491
|
-
</div>
|
|
492
|
-
);
|
|
493
|
-
});
|
|
494
|
-
|
|
495
|
-
export default Entity;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { observer } from '@formily/react';
|
|
2
|
-
import { css, useCollectionManager, useCompile } from '@nocobase/client';
|
|
3
|
-
import { Tag } from 'antd';
|
|
4
|
-
import React from 'react';
|
|
5
|
-
import { useTranslation } from 'react-i18next';
|
|
6
|
-
|
|
7
|
-
export const FieldSummary = observer(
|
|
8
|
-
(props: any) => {
|
|
9
|
-
const { schemaKey } = props;
|
|
10
|
-
const { getInterface } = useCollectionManager();
|
|
11
|
-
const compile = useCompile();
|
|
12
|
-
const { t } = useTranslation();
|
|
13
|
-
const schema = getInterface(schemaKey);
|
|
14
|
-
|
|
15
|
-
if (!schema) return null;
|
|
16
|
-
|
|
17
|
-
return (
|
|
18
|
-
<div
|
|
19
|
-
className={css`
|
|
20
|
-
background: #f6f6f6;
|
|
21
|
-
margin-bottom: 24px;
|
|
22
|
-
padding: 16px;
|
|
23
|
-
`}
|
|
24
|
-
>
|
|
25
|
-
<div className={css``}>
|
|
26
|
-
{t('Field interface')}: <Tag>{compile(schema.title)}</Tag>
|
|
27
|
-
</div>
|
|
28
|
-
{schema.description ? (
|
|
29
|
-
<div
|
|
30
|
-
className={css`
|
|
31
|
-
margin-top: 8px;
|
|
32
|
-
color: rgba(0, 0, 0, 0.45);
|
|
33
|
-
`}
|
|
34
|
-
>
|
|
35
|
-
{compile(schema.description)}
|
|
36
|
-
</div>
|
|
37
|
-
) : null}
|
|
38
|
-
</div>
|
|
39
|
-
);
|
|
40
|
-
},
|
|
41
|
-
{ displayName: 'FieldSummary' },
|
|
42
|
-
);
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { CopyOutlined } from '@ant-design/icons';
|
|
2
|
-
import { OverridingFieldAction as OverridingCollectionFieldAction } from '@nocobase/client';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { useCancelAction, useCreateAction } from '../action-hooks';
|
|
5
|
-
import { getPopupContainer } from '../utils';
|
|
6
|
-
|
|
7
|
-
const useOverridingCollectionField = (record) => {
|
|
8
|
-
const collectionName = record.targetCollection;
|
|
9
|
-
const { run } = useCreateAction(collectionName);
|
|
10
|
-
return {
|
|
11
|
-
async run() {
|
|
12
|
-
await run();
|
|
13
|
-
},
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export const OverrideFieldAction = ({ item: record }) => {
|
|
18
|
-
return (
|
|
19
|
-
<OverridingCollectionFieldAction
|
|
20
|
-
item={{ ...record }}
|
|
21
|
-
scope={{
|
|
22
|
-
useCancelAction,
|
|
23
|
-
useOverridingCollectionField: () => useOverridingCollectionField(record),
|
|
24
|
-
}}
|
|
25
|
-
getContainer={getPopupContainer}
|
|
26
|
-
>
|
|
27
|
-
<CopyOutlined className="btn-override" />
|
|
28
|
-
</OverridingCollectionFieldAction>
|
|
29
|
-
);
|
|
30
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { EyeOutlined } from '@ant-design/icons';
|
|
2
|
-
import { ViewFieldAction as ViewCollectionFieldAction } from '@nocobase/client';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { getPopupContainer } from '../utils';
|
|
5
|
-
|
|
6
|
-
export const ViewFieldAction = ({ item: record }) => {
|
|
7
|
-
return (
|
|
8
|
-
<ViewCollectionFieldAction item={{ ...record }} getContainer={getPopupContainer}>
|
|
9
|
-
<EyeOutlined className="btn-view" />
|
|
10
|
-
</ViewCollectionFieldAction>
|
|
11
|
-
);
|
|
12
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { NodeView } from '@antv/x6';
|
|
2
|
-
|
|
3
|
-
export class SimpleNodeView extends NodeView {
|
|
4
|
-
protected renderMarkup() {
|
|
5
|
-
return this.renderJSONMarkup({
|
|
6
|
-
tagName: 'rect',
|
|
7
|
-
selector: 'body',
|
|
8
|
-
});
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
update() {
|
|
12
|
-
const attrs = this.cell.getAttrs();
|
|
13
|
-
const fill = attrs.hightLight ? '#1890ff' : 'gray';
|
|
14
|
-
super.update({
|
|
15
|
-
body: {
|
|
16
|
-
refWidth: '50px',
|
|
17
|
-
refHeight: '100px',
|
|
18
|
-
fill: fill,
|
|
19
|
-
},
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
}
|
package/src/client/index.tsx
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Plugin } from '@nocobase/client';
|
|
2
|
-
import { GraphCollectionProvider } from './GraphCollectionProvider';
|
|
3
|
-
|
|
4
|
-
export class GraphCollectionPlugin extends Plugin {
|
|
5
|
-
async load() {
|
|
6
|
-
this.app.use(GraphCollectionProvider);
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export default GraphCollectionPlugin;
|