@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.
Files changed (51) hide show
  1. package/client.d.ts +2 -3
  2. package/client.js +1 -30
  3. package/lib/client/GraphCollectionProvider.js +1 -14
  4. package/lib/client/GraphCollectionShortcut.js +2 -9
  5. package/lib/client/GraphDrawPage.js +53 -47
  6. package/lib/client/action-hooks.d.ts +14 -1
  7. package/lib/client/action-hooks.js +12 -11
  8. package/lib/client/components/EditCollectionAction.d.ts +2 -1
  9. package/lib/client/components/EditCollectionAction.js +3 -19
  10. package/lib/client/components/Entity.js +28 -47
  11. package/lib/client/components/FieldSummary.d.ts +1 -1
  12. package/lib/client/components/FieldSummary.js +9 -16
  13. package/lib/client/index.d.ts +5 -1
  14. package/lib/client/index.js +21 -6
  15. package/lib/client/style.d.ts +12 -9
  16. package/lib/client/style.js +211 -196
  17. package/lib/client/utils.d.ts +3 -3
  18. package/lib/client/utils.js +15 -11
  19. package/package.json +27 -6
  20. package/server.d.ts +2 -3
  21. package/server.js +1 -30
  22. package/src/client/GraphCollectionProvider.tsx +33 -0
  23. package/src/client/GraphCollectionShortcut.tsx +141 -0
  24. package/src/client/GraphDrawPage.tsx +1382 -0
  25. package/src/client/action-hooks.tsx +237 -0
  26. package/src/client/components/AddCollectionAction.tsx +28 -0
  27. package/src/client/components/AddFieldAction.tsx +37 -0
  28. package/src/client/components/CollectionNodeProvder.tsx +28 -0
  29. package/src/client/components/EditCollectionAction.tsx +21 -0
  30. package/src/client/components/EditFieldAction.tsx +30 -0
  31. package/src/client/components/Entity.tsx +495 -0
  32. package/src/client/components/FieldSummary.tsx +42 -0
  33. package/src/client/components/OverrideFieldAction.tsx +30 -0
  34. package/src/client/components/ViewFieldAction.tsx +12 -0
  35. package/src/client/components/ViewNode.tsx +22 -0
  36. package/src/client/index.tsx +10 -0
  37. package/src/client/locale/en-US.ts +15 -0
  38. package/src/client/locale/es-ES.ts +15 -0
  39. package/src/client/locale/index.ts +3 -0
  40. package/src/client/locale/ja-JP.ts +13 -0
  41. package/src/client/locale/pt-BR.ts +15 -0
  42. package/src/client/locale/zh-CN.ts +16 -0
  43. package/src/client/style.tsx +227 -0
  44. package/src/client/utils.tsx +548 -0
  45. package/src/index.ts +1 -0
  46. package/src/server/actions/.gitkeep +0 -0
  47. package/src/server/collections/.gitkeep +0 -0
  48. package/src/server/collections/graphPositions.ts +22 -0
  49. package/src/server/index.ts +13 -0
  50. package/src/server/models/.gitkeep +0 -0
  51. package/src/server/repositories/.gitkeep +0 -0
@@ -3,216 +3,231 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.tableNameClass = exports.tableBtnClass = exports.nodeSubtreeClass = exports.headClass = exports.graphCollectionContainerClass = exports.entityContainer = exports.collectionListClass = exports.collectiionPopoverClass = exports.addButtonClass = void 0;
7
- function _css() {
8
- const data = require("@emotion/css");
9
- _css = function _css() {
6
+ exports.default = void 0;
7
+ function _client() {
8
+ const data = require("@nocobase/client");
9
+ _client = function _client() {
10
10
  return data;
11
11
  };
12
12
  return data;
13
13
  }
14
- const nodeSubtreeClass = (0, _css().css)`
15
- display: flex;
16
- flex-direction: column-reverse;
17
- align-items: center;
18
- `;
19
- exports.nodeSubtreeClass = nodeSubtreeClass;
20
- const addButtonClass = (0, _css().css)`
21
- flex-shrink: 0;
22
- padding: 2em 0;
23
- `;
24
- exports.addButtonClass = addButtonClass;
25
- const entityContainer = (0, _css().css)`
26
- width: 250px;
27
- height: 100%;
28
- border-radius: 2px;
29
- background-color: #fff;
30
- border: 0;
31
- &:hover {
32
- box-shadow: 0 1px 2px -2px rgb(0 0 0 / 16%), 0 3px 6px 0 rgb(0 0 0 / 12%), 0 5px 12px 4px rgb(0 0 0 / 9%);
33
- }
34
- .body {
35
- width: 100%;
36
- height: 100%;
37
- background-color: #fff;
38
- cursor: pointer;
39
- .morePorts {
40
- max-height: 300px;
41
- overflow: auto;
42
- }
43
- .body-item {
44
- display: inline-table;
45
- width: 100%;
46
- max-width: 250px;
47
- height: 40px;
48
- font-size: 14px;
49
- color: rgba(0, 0, 0, 0.85);
50
- height: 40px;
51
- border-top: 1px solid #f0f0f0;
52
- text-overflow: ellipsis;
53
- display: flex;
54
- flex-direction: row;
55
- align-items: center;
56
- justify-content: space-between;
57
-
58
- .field-operator {
59
- display: none;
14
+ const useStyles = (0, _client().createStyles)(({
15
+ token,
16
+ css
17
+ }) => {
18
+ return {
19
+ // 右下角的小画布
20
+ graphMinimap: css`
21
+ .x6-widget-minimap {
22
+ background-color: ${token.colorBgContainer};
23
+ }
24
+ `,
25
+ addButtonClass: css`
26
+ flex-shrink: 0;
27
+ padding: 2em 0;
28
+ `,
29
+ entityContainer: css`
30
+ .btn-del {
31
+ border-color: transparent;
32
+ background-color: ${token.colorErrorBg};
33
+ color: ${token.colorErrorText};
34
+ height: 20px;
35
+ width: 20px;
36
+ &:hover {
37
+ background-color: ${token.colorErrorBgHover};
38
+ }
60
39
  }
40
+ .btn-add {
41
+ background: ${token.colorSuccessBg};
42
+ border-color: transparent;
43
+ color: ${token.colorSuccessText};
44
+ width: 20px;
45
+ &:hover {
46
+ background-color: ${token.colorSuccessBgHover};
47
+ }
48
+ }
49
+ .btn-edit {
50
+ color: ${token.colorText};
51
+ display: flex;
52
+ &:hover {
53
+ background: ${token.colorBgTextHover};
54
+ }
55
+ }
56
+ .btn-edit-in-head {
57
+ border-color: transparent;
58
+ color: ${token.colorText};
59
+ height: 20px;
60
+ width: 22px;
61
+ margin: 0px 5px 4px;
62
+ line-height: 25px;
63
+ &:hover {
64
+ background: ${token.colorBgTextHover};
65
+ }
66
+ }
67
+ width: 250px;
68
+ height: 100%;
69
+ border-radius: ${token.borderRadiusLG}px;
70
+ background-color: ${token.colorBgContainer};
71
+ border: 0;
72
+ overflow: hidden;
61
73
  &:hover {
62
- .field-operator {
74
+ box-shadow: ${token.boxShadowTertiary};
75
+ }
76
+ .body {
77
+ width: 100%;
78
+ height: 100%;
79
+ background-color: ${token.colorBgContainer};
80
+ cursor: pointer;
81
+ .morePorts {
82
+ max-height: 300px;
83
+ overflow: auto;
84
+ }
85
+ .body-item {
86
+ display: inline-table;
87
+ width: 100%;
88
+ max-width: 250px;
89
+ height: 40px;
90
+ font-size: 14px;
91
+ color: ${token.colorText};
92
+ border-top: 1px solid ${token.colorBorderSecondary};
93
+ text-overflow: ellipsis;
63
94
  display: flex;
64
- flex-direction: row-reverse;
65
- height: 32px;
66
- line-height: 32px;
67
- z-index: 999;
68
- cursor: pointer;
69
- text-align: right;
70
- background: #fff;
71
- padding-right: 3px;
72
- span {
73
- margin: 3px;
74
- margin-left: 4px;
75
- padding: 3px;
76
- height: 20px;
77
- width: 20px;
95
+ flex-direction: row;
96
+ align-items: center;
97
+ justify-content: space-between;
98
+
99
+ .field-operator {
100
+ display: none;
78
101
  }
79
- .btn-del {
80
- border-color: transparent;
81
- color: rgb(78 89 105);
82
- height: 20px;
83
- width: 20px;
84
- &:hover {
85
- background-color: rgb(229 230 235);
102
+ &:hover {
103
+ .field-operator {
104
+ display: flex;
105
+ flex-direction: row-reverse;
106
+ height: 32px;
107
+ line-height: 32px;
108
+ z-index: 999;
109
+ cursor: pointer;
110
+ text-align: right;
111
+ background: ${token.colorBgContainer};
112
+ padding-right: 3px;
113
+ span {
114
+ margin: 3px;
115
+ margin-left: 4px;
116
+ padding: 3px;
117
+ height: 20px;
118
+ width: 20px;
119
+ }
120
+ .btn-override {
121
+ border-color: transparent;
122
+ width: 20px;
123
+ color: ${token.colorText};
124
+ &:hover {
125
+ background-color: ${token.colorBgTextHover};
126
+ }
127
+ }
128
+ .btn-view {
129
+ border-color: transparent;
130
+ color: ${token.colorText};
131
+ width: 20px;
132
+ }
133
+ .btn-view:hover {
134
+ background: ${token.colorBgTextHover};
135
+ }
86
136
  }
87
- }
88
- .btn-add {
89
- background: rgb(232 255 234);
90
- border-color: transparent;
91
- color: rgb(0, 180, 42);
92
- width: 20px;
93
- }
94
- .btn-edit {
95
- color: rgba(0, 0, 0, 0.85);
96
- display: flex;
97
- }
98
- .btn-edit:hover {
99
- background: rgb(229 230 235);
100
- }
101
- .btn-override {
102
- border-color: transparent;
103
- width: 20px;
104
- color: rgba(0, 0, 0, 0.85);
105
- &:hover {
106
- background-color: rgb(229 230 235);
137
+ .field_type {
138
+ display: none;
107
139
  }
108
140
  }
109
- .btn-view {
110
- border-color: transparent;
111
- color: rgba(0, 0, 0, 0.85);
112
- width: 20px;
141
+
142
+ .name {
143
+ text-overflow: ellipsis;
144
+ white-space: nowrap;
145
+ overflow: hidden;
146
+ margin-left: 8px;
113
147
  }
114
- .btn-view:hover {
115
- background: rgb(229 230 235);
148
+
149
+ .type {
150
+ color: ${token.colorTextTertiary};
151
+ margin-right: 8px;
152
+ text-overflow: ellipsis;
153
+ white-space: nowrap;
154
+ overflow: hidden;
116
155
  }
117
156
  }
118
- .field_type {
119
- display: none;
120
- }
121
157
  }
122
-
123
- .name {
124
- text-overflow: ellipsis;
125
- white-space: nowrap;
126
- overflow: hidden;
127
- margin-left: 8px;
158
+ `,
159
+ headClass: css`
160
+ height: 50px;
161
+ font-size: 14px;
162
+ font-weight: 500;
163
+ display: flex;
164
+ flex-direction: row;
165
+ justify-content: space-between;
166
+ align-items: center;
167
+ background: ${token.colorFillAlter};
168
+ color: ${token.colorTextHeading};
169
+ padding: 0 8px;
170
+ `,
171
+ tableNameClass: css`
172
+ max-width: 80%;
173
+ overflow: hidden;
174
+ text-overflow: ellipsis;
175
+ white-space: nowrap;
176
+ font-weight: 500;
177
+ `,
178
+ tableBtnClass: css`
179
+ display: flex;
180
+ span {
181
+ cursor: pointer;
128
182
  }
129
-
130
- .type {
131
- color: rgba(0, 0, 0, 0.45);
132
- margin-right: 8px;
133
- text-overflow: ellipsis;
134
- white-space: nowrap;
135
- overflow: hidden;
136
- }
137
- }
138
- }
139
- `;
140
- exports.entityContainer = entityContainer;
141
- const headClass = (0, _css().css)`
142
- height: 50px;
143
- font-size: 14px;
144
- font-weight: 500;
145
- display: flex;
146
- flex-direction: row;
147
- justify-content: space-between;
148
- align-items: center;
149
- background: #fafafa;
150
- color: rgb(29 33 41);
151
- padding: 0 8px;
152
- border-radius: 3px;
153
- `;
154
- exports.headClass = headClass;
155
- const tableNameClass = (0, _css().css)`
156
- max-width: 80%;
157
- overflow: hidden;
158
- text-overflow: ellipsis;
159
- white-space: nowrap;
160
- font-weight: 500;
161
- `;
162
- exports.tableNameClass = tableNameClass;
163
- const tableBtnClass = (0, _css().css)`
164
- display: flex;
165
- span {
166
- cursor: pointer;
167
- }
168
- `;
169
- exports.tableBtnClass = tableBtnClass;
170
- const collectiionPopoverClass = (0, _css().css)`
171
- div.field-content {
172
- font-size: 14px;
173
- color: rgb(134 144 156);
174
- opacity: 0.8;
175
- display: block;
176
- .field-type {
177
- color: #333;
183
+ `,
184
+ collectionPopoverClass: css`
185
+ div.field-content {
186
+ font-size: 14px;
187
+ color: ${token.colorTextSecondary};
188
+ opacity: 0.8;
189
+ display: block;
190
+ .field-type {
191
+ color: ${token.colorText};
192
+ float: right;
193
+ }
194
+ }
195
+ `,
196
+ collectionListClass: css`
178
197
  float: right;
179
- }
180
- }
181
- `;
182
- exports.collectiionPopoverClass = collectiionPopoverClass;
183
- const collectionListClass = (0, _css().css)`
184
- float: right;
185
- position: fixed;
186
- margin-top: 24px;
187
- right: 24px;
188
- z-index: 1000;
189
- .trigger {
190
- float: right;
191
- margin: 2px 4px;
192
- font-size: 16px;
193
- }
194
- .ant-input {
195
- margin: 4px;
196
- }
197
- .ant-menu-inline {
198
- border-top: 1px solid #f0f0f0;
199
- }
200
- .ant-layout-sider {
201
- margin-top: 24px;
202
- }
203
- .ant-menu-item {
204
- height: 32px;
205
- }
206
- .ant-btn {
207
- border: 0;
208
- }
209
- `;
210
- exports.collectionListClass = collectionListClass;
211
- const graphCollectionContainerClass = (0, _css().css)`
212
- overflow: hidden;
213
- .x6-graph-scroller {
214
- height: calc(100vh) !important;
215
- width: calc(100vw) !important;
216
- }
217
- `;
218
- exports.graphCollectionContainerClass = graphCollectionContainerClass;
198
+ position: fixed;
199
+ margin-top: 24px;
200
+ right: 24px;
201
+ z-index: 1000;
202
+ .trigger {
203
+ float: right;
204
+ margin: 2px 4px;
205
+ font-size: 16px;
206
+ }
207
+ .ant-input {
208
+ margin: 4px;
209
+ }
210
+ .ant-menu-inline {
211
+ border-top: 1px solid ${token.colorBorderSecondary};
212
+ }
213
+ .ant-layout-sider {
214
+ margin-top: 24px;
215
+ }
216
+ .ant-menu-item {
217
+ height: 32px;
218
+ }
219
+ .ant-btn {
220
+ border: 0;
221
+ }
222
+ `,
223
+ graphCollectionContainerClass: css`
224
+ overflow: hidden;
225
+ .x6-graph-scroller {
226
+ height: calc(100vh) !important;
227
+ width: calc(100vw) !important;
228
+ }
229
+ `
230
+ };
231
+ });
232
+ var _default = useStyles;
233
+ exports.default = _default;
@@ -1,12 +1,12 @@
1
1
  export declare const useGCMTranslation: () => import("react-i18next").UseTranslationResponse<"graph-collection-manager", undefined>;
2
- export declare const getInheritCollections: (collections: any, name: any) => any[];
2
+ export declare const getInheritCollections: (collections: any, name: any) => any;
3
3
  export declare const getChildrenCollections: (collections: any, name: any) => any[];
4
4
  export declare const formatData: (data: any) => {
5
5
  nodesData: any;
6
- edgesData: any[];
6
+ edgesData: any;
7
7
  inheritEdges: any[];
8
8
  };
9
- export declare const formatPortData: (ports: any) => import("lodash").Dictionary<any[]>;
9
+ export declare const formatPortData: (ports: any) => any;
10
10
  export declare const formatInheritEdgeData: (collections: any) => any[];
11
11
  export declare const getDiffNode: (newNodes: any, oldNodes: any) => any[];
12
12
  export declare const getDiffEdge: (newEdges: any, oldEdges: any) => any[];
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.useGCMTranslation = exports.getPopupContainer = exports.getInheritCollections = exports.getDiffNode = exports.getDiffEdge = exports.getChildrenCollections = exports.formatPortData = exports.formatInheritEdgeData = exports.formatData = void 0;
7
- function _lodash() {
8
- const data = require("lodash");
9
- _lodash = function _lodash() {
7
+ function _client() {
8
+ const data = require("@nocobase/utils/client");
9
+ _client = function _client() {
10
10
  return data;
11
11
  };
12
12
  return data;
@@ -23,6 +23,10 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
23
23
  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; }
24
24
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
25
25
  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); }
26
+ const groupBy = _client().lodash.groupBy,
27
+ reduce = _client().lodash.reduce,
28
+ uniq = _client().lodash.uniq,
29
+ uniqBy = _client().lodash.uniqBy;
26
30
  const shape = {
27
31
  ER: 'er-rect',
28
32
  EDGE: 'edge'
@@ -45,7 +49,7 @@ const getInheritCollections = (collections, name) => {
45
49
  }
46
50
  }
47
51
  }
48
- return (0, _lodash().uniq)(parents);
52
+ return uniq(parents);
49
53
  };
50
54
  return getParents(name);
51
55
  };
@@ -74,7 +78,7 @@ const formatData = data => {
74
78
  const ports = [];
75
79
  const totalFields = [...item.fields];
76
80
  const inheritCollections = getInheritCollections(data, item.name);
77
- const inheritedFields = (0, _lodash().reduce)(inheritCollections, (result, value) => {
81
+ const inheritedFields = reduce(inheritCollections, (result, value) => {
78
82
  var _data$find;
79
83
  const arr = result;
80
84
  const parentFields = (_data$find = data.find(k => k.name === value)) === null || _data$find === void 0 ? void 0 : _data$find.fields.map(v => {
@@ -84,7 +88,7 @@ const formatData = data => {
84
88
  });
85
89
  return arr.concat(parentFields);
86
90
  }, []);
87
- (0, _lodash().uniqBy)(totalFields.concat(inheritedFields), 'name').forEach(field => {
91
+ uniqBy(totalFields.concat(inheritedFields), 'name').forEach(field => {
88
92
  field.uiSchema && ports.push(_objectSpread({
89
93
  id: field.key,
90
94
  group: 'list'
@@ -114,7 +118,7 @@ const formatData = data => {
114
118
  };
115
119
  exports.formatData = formatData;
116
120
  const formatPortData = ports => {
117
- const portsData = (0, _lodash().groupBy)(ports, v => {
121
+ const portsData = groupBy(ports, v => {
118
122
  if (v.isForeignKey || v.primaryKey || ['obo', 'oho', 'o2o', 'o2m', 'm2o', 'm2m', 'linkTo', 'id'].includes(v.interface)) {
119
123
  return 'initPorts';
120
124
  } else {
@@ -168,7 +172,7 @@ const formatInheritEdgeData = collections => {
168
172
  ref: 'labelText',
169
173
  refWidth: '100%',
170
174
  refHeight: '100%',
171
- fill: '#f0f2f5'
175
+ fill: 'var(--nb-box-bg)'
172
176
  }
173
177
  },
174
178
  position: {
@@ -258,7 +262,7 @@ const formatEdgeData = (data, targetTables, tableData) => {
258
262
  refWidth: '100%',
259
263
  refHeight: '100%',
260
264
  stroke: '#ddd',
261
- fill: '#f0f2f5',
265
+ fill: 'var(--nb-box-bg)',
262
266
  strokeWidth: 1,
263
267
  rx: 10,
264
268
  ry: 10
@@ -297,7 +301,7 @@ const formatEdgeData = (data, targetTables, tableData) => {
297
301
  refWidth: '100%',
298
302
  refHeight: '100%',
299
303
  stroke: '#ddd',
300
- fill: '#f0f2f5',
304
+ fill: 'var(--nb-box-bg)',
301
305
  rx: 10,
302
306
  ry: 10,
303
307
  strokeWidth: 1
@@ -425,7 +429,7 @@ const formatEdgeData = (data, targetTables, tableData) => {
425
429
  }
426
430
  }
427
431
  }
428
- return (0, _lodash().uniqBy)(edges, 'id');
432
+ return uniqBy(edges, 'id');
429
433
  };
430
434
  const getRelationship = relatioship => {
431
435
  switch (relatioship) {
package/package.json CHANGED
@@ -4,18 +4,39 @@
4
4
  "displayName.zh-CN": "数据库可视化管理",
5
5
  "description": "database collection manage",
6
6
  "description.zh-CN": "数据库管理。",
7
- "version": "0.10.1-alpha.1",
7
+ "version": "0.11.1-alpha.1",
8
8
  "license": "AGPL-3.0",
9
- "main": "./lib/index.js",
10
- "types": "./lib/index.d.ts",
9
+ "main": "./lib/server/index.js",
10
+ "files": [
11
+ "lib",
12
+ "src",
13
+ "README.md",
14
+ "README.zh-CN.md",
15
+ "CHANGELOG.md",
16
+ "server.js",
17
+ "server.d.ts",
18
+ "client.js",
19
+ "client.d.ts"
20
+ ],
11
21
  "dependencies": {
12
22
  "@antv/x6": "^1.9.0",
13
23
  "@antv/x6-react-shape": "^1.6.2",
24
+ "ahooks": "^3.7.2",
14
25
  "dagre": "^0.8.5"
15
26
  },
16
27
  "devDependencies": {
17
- "@nocobase/client": "0.10.1-alpha.1",
18
- "@nocobase/test": "0.10.1-alpha.1"
28
+ "@ant-design/icons": "^5.1.4",
29
+ "@formily/react": "2.2.26",
30
+ "@formily/reactive": "2.2.26",
31
+ "@formily/shared": "2.2.26",
32
+ "@nocobase/client": "0.11.1-alpha.1",
33
+ "@nocobase/database": "0.11.1-alpha.1",
34
+ "@nocobase/server": "0.11.1-alpha.1",
35
+ "@nocobase/test": "0.11.1-alpha.1",
36
+ "@nocobase/utils": "0.11.1-alpha.1",
37
+ "antd": "^5.6.4",
38
+ "react": "^18.2.0",
39
+ "react-i18next": "^11.15.1"
19
40
  },
20
- "gitHead": "8f415f5e0ee2e72d681f9ab16af5911b52c374a9"
41
+ "gitHead": "9ed1dba520bc5f3a7cb1255ea8d92ccbefc11bc8"
21
42
  }
package/server.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- // @ts-nocheck
2
- export * from './lib/server';
3
- export { default } from './lib/server';
1
+ export * from './src/server';
2
+ export { default } from './src/server';
4
3
 
package/server.js CHANGED
@@ -1,30 +1 @@
1
- "use strict";
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/server"));
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/server/index.js');
@@ -0,0 +1,33 @@
1
+ import { PluginManagerContext, SettingsCenterContext, SettingsCenterProvider } from '@nocobase/client';
2
+ import React, { useContext } from 'react';
3
+ import { GraphCollectionPane } from './GraphCollectionShortcut';
4
+ import { useGCMTranslation } from './utils';
5
+
6
+ export const GraphCollectionProvider = React.memo((props) => {
7
+ const ctx = useContext(PluginManagerContext);
8
+ // i18n.addResources('en-US', 'graphPositions', enUS);
9
+ // i18n.addResources('ja-JP', 'graphPositions', jaJP);
10
+ // i18n.addResources('zh-CN', 'graphPositions', zhCN);
11
+ const { t } = useGCMTranslation();
12
+ const items = useContext(SettingsCenterContext);
13
+
14
+ items['collection-manager']['tabs']['graph'] = {
15
+ title: t('Graphical interface'),
16
+ component: GraphCollectionPane,
17
+ };
18
+
19
+ return (
20
+ <SettingsCenterProvider settings={items}>
21
+ <PluginManagerContext.Provider
22
+ value={{
23
+ components: {
24
+ ...ctx?.components,
25
+ },
26
+ }}
27
+ >
28
+ {props.children}
29
+ </PluginManagerContext.Provider>
30
+ </SettingsCenterProvider>
31
+ );
32
+ });
33
+ GraphCollectionProvider.displayName = 'GraphCollectionProvider';