@nocobase/plugin-graph-collection-manager 0.10.1-alpha.1 → 0.11.1-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 +53 -47
- package/lib/client/action-hooks.d.ts +14 -1
- package/lib/client/action-hooks.js +12 -11
- package/lib/client/components/EditCollectionAction.d.ts +2 -1
- package/lib/client/components/EditCollectionAction.js +3 -19
- package/lib/client/components/Entity.js +28 -47
- 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.d.ts +12 -9
- package/lib/client/style.js +211 -196
- package/lib/client/utils.d.ts +3 -3
- 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 +1382 -0
- package/src/client/action-hooks.tsx +237 -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 +21 -0
- package/src/client/components/EditFieldAction.tsx +30 -0
- package/src/client/components/Entity.tsx +495 -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 +227 -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
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { DeleteOutlined } from '@ant-design/icons';
|
|
2
|
+
import { uid } from '@formily/shared';
|
|
3
|
+
import { css, SchemaComponent, useActionContext, useRequest } from '@nocobase/client';
|
|
4
|
+
import React, { useEffect } from 'react';
|
|
5
|
+
import { useCreateActionAndRefreshCM } from './action-hooks';
|
|
6
|
+
import { GraphDrawPage } from './GraphDrawPage';
|
|
7
|
+
|
|
8
|
+
const useCollectionValues = (options) => {
|
|
9
|
+
const { visible } = useActionContext();
|
|
10
|
+
const result = useRequest(
|
|
11
|
+
() =>
|
|
12
|
+
Promise.resolve({
|
|
13
|
+
data: {
|
|
14
|
+
name: `t_${uid()}`,
|
|
15
|
+
createdBy: true,
|
|
16
|
+
updatedBy: true,
|
|
17
|
+
sortable: true,
|
|
18
|
+
logging: true,
|
|
19
|
+
fields: [
|
|
20
|
+
{
|
|
21
|
+
name: 'id',
|
|
22
|
+
type: 'integer',
|
|
23
|
+
autoIncrement: true,
|
|
24
|
+
primaryKey: true,
|
|
25
|
+
allowNull: false,
|
|
26
|
+
uiSchema: { type: 'number', title: '{{t("ID")}}', 'x-component': 'InputNumber', 'x-read-pretty': true },
|
|
27
|
+
interface: 'id',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
interface: 'createdAt',
|
|
31
|
+
type: 'date',
|
|
32
|
+
field: 'createdAt',
|
|
33
|
+
name: 'createdAt',
|
|
34
|
+
uiSchema: {
|
|
35
|
+
type: 'datetime',
|
|
36
|
+
title: '{{t("Created at")}}',
|
|
37
|
+
'x-component': 'DatePicker',
|
|
38
|
+
'x-component-props': {},
|
|
39
|
+
'x-read-pretty': true,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
interface: 'createdBy',
|
|
44
|
+
type: 'belongsTo',
|
|
45
|
+
target: 'users',
|
|
46
|
+
foreignKey: 'createdById',
|
|
47
|
+
name: 'createdBy',
|
|
48
|
+
uiSchema: {
|
|
49
|
+
type: 'object',
|
|
50
|
+
title: '{{t("Created by")}}',
|
|
51
|
+
'x-component': 'RecordPicker',
|
|
52
|
+
'x-component-props': {
|
|
53
|
+
fieldNames: {
|
|
54
|
+
value: 'id',
|
|
55
|
+
label: 'nickname',
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
'x-read-pretty': true,
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
type: 'date',
|
|
63
|
+
field: 'updatedAt',
|
|
64
|
+
name: 'updatedAt',
|
|
65
|
+
interface: 'updatedAt',
|
|
66
|
+
uiSchema: {
|
|
67
|
+
type: 'string',
|
|
68
|
+
title: '{{t("Last updated at")}}',
|
|
69
|
+
'x-component': 'DatePicker',
|
|
70
|
+
'x-component-props': {},
|
|
71
|
+
'x-read-pretty': true,
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
type: 'belongsTo',
|
|
76
|
+
target: 'users',
|
|
77
|
+
foreignKey: 'updatedById',
|
|
78
|
+
name: 'updatedBy',
|
|
79
|
+
interface: 'updatedBy',
|
|
80
|
+
uiSchema: {
|
|
81
|
+
type: 'object',
|
|
82
|
+
title: '{{t("Last updated by")}}',
|
|
83
|
+
'x-component': 'RecordPicker',
|
|
84
|
+
'x-component-props': {
|
|
85
|
+
fieldNames: {
|
|
86
|
+
value: 'id',
|
|
87
|
+
label: 'nickname',
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
'x-read-pretty': true,
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
],
|
|
94
|
+
},
|
|
95
|
+
}),
|
|
96
|
+
{
|
|
97
|
+
...options,
|
|
98
|
+
manual: true,
|
|
99
|
+
},
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
useEffect(() => {
|
|
103
|
+
if (visible) {
|
|
104
|
+
result.run();
|
|
105
|
+
}
|
|
106
|
+
}, [visible]);
|
|
107
|
+
|
|
108
|
+
return result;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
export const GraphCollectionPane = () => {
|
|
112
|
+
return (
|
|
113
|
+
<div
|
|
114
|
+
className={css`
|
|
115
|
+
height: calc(100vh - 160px);
|
|
116
|
+
overflow: auto;
|
|
117
|
+
margin: calc(var(--nb-spacing) * -1);
|
|
118
|
+
position: relative;
|
|
119
|
+
`}
|
|
120
|
+
id="graph_container"
|
|
121
|
+
>
|
|
122
|
+
<SchemaComponent
|
|
123
|
+
schema={{
|
|
124
|
+
type: 'void',
|
|
125
|
+
'x-component': 'div',
|
|
126
|
+
properties: {
|
|
127
|
+
editor: {
|
|
128
|
+
type: 'void',
|
|
129
|
+
'x-component': 'GraphDrawPage',
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
}}
|
|
133
|
+
components={{
|
|
134
|
+
GraphDrawPage,
|
|
135
|
+
DeleteOutlined,
|
|
136
|
+
}}
|
|
137
|
+
scope={{ useCollectionValues, useCreateActionAndRefreshCM }}
|
|
138
|
+
/>
|
|
139
|
+
</div>
|
|
140
|
+
);
|
|
141
|
+
};
|