@nocobase/plugin-graph-collection-manager 0.9.0-alpha.2 → 0.9.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/README.md ADDED
@@ -0,0 +1,11 @@
1
+ # graph-collection-manager
2
+
3
+ English | [中文](./README.zh-CN.md)
4
+
5
+ ## 安装激活
6
+
7
+ ```bash
8
+ yarn pm enable graph-collection-manager
9
+ ```
10
+
11
+ ## 使用方法
@@ -0,0 +1,11 @@
1
+ # graph-collection-manager
2
+
3
+ [English](./README.md) | 中文
4
+
5
+ ## 安装激活
6
+
7
+ ```bash
8
+ yarn pm enable graph-collection-manager
9
+ ```
10
+
11
+ ## 使用方法
@@ -633,7 +633,6 @@ const GraphDrawPage = _react2().default.memo(() => {
633
633
  const refreshGM = /*#__PURE__*/function () {
634
634
  var _ref4 = _asyncToGenerator(function* () {
635
635
  const data = yield refreshCM();
636
- console.log(data);
637
636
  targetGraph.collections = data;
638
637
  targetGraph.updatePositionAction = useUpdatePositionAction;
639
638
  const currentNodes = targetGraph.getNodes();
@@ -750,7 +749,7 @@ const GraphDrawPage = _react2().default.memo(() => {
750
749
  inherit: true,
751
750
  scope: scope,
752
751
  components: components
753
- }, _react2().default.createElement(_client().CollectionManagerProvider, {
752
+ }, _react2().default.createElement(_client().CollectionCategroriesProvider, null, _react2().default.createElement(_client().CollectionManagerProvider, {
754
753
  collections: (_targetGraph2 = targetGraph) === null || _targetGraph2 === void 0 ? void 0 : _targetGraph2.collections,
755
754
  refreshCM: refreshGM,
756
755
  interfaces: ctx.interfaces
@@ -762,7 +761,7 @@ const GraphDrawPage = _react2().default.memo(() => {
762
761
  node: node,
763
762
  setTargetNode: setTargetNode,
764
763
  targetGraph: targetGraph
765
- }))))));
764
+ })))))));
766
765
  },
767
766
  ports: {
768
767
  groups: {
@@ -136,10 +136,12 @@ const Entity = props => {
136
136
  id = node.id;
137
137
  const database = (0, _client().useCurrentAppInfo)();
138
138
  const collectionData = (0, _react().useRef)();
139
+ const categoryData = (0, _react().useContext)(_client().CollectionCategroriesContext);
139
140
  collectionData.current = _objectSpread(_objectSpread({}, item), {}, {
140
141
  title,
141
142
  inherits: item.inherits && new Proxy(item.inherits, {})
142
143
  });
144
+ const category = item.category;
143
145
  const compile = (0, _client().useCompile)();
144
146
 
145
147
  const loadCollections = /*#__PURE__*/function () {
@@ -157,6 +159,19 @@ const Entity = props => {
157
159
  };
158
160
  }();
159
161
 
162
+ const loadCategories = /*#__PURE__*/function () {
163
+ var _ref2 = _asyncToGenerator(function* () {
164
+ return categoryData.data.map(item => ({
165
+ label: compile(item.name),
166
+ value: item.id
167
+ }));
168
+ });
169
+
170
+ return function loadCategories() {
171
+ return _ref2.apply(this, arguments);
172
+ };
173
+ }();
174
+
160
175
  const portsProps = {
161
176
  targetGraph,
162
177
  collectionData,
@@ -170,10 +185,22 @@ const Entity = props => {
170
185
  boxShadow: attrs === null || attrs === void 0 ? void 0 : attrs.boxShadow,
171
186
  border: select ? '2px dashed #f5a20a' : 0
172
187
  }
173
- }, _react().default.createElement("div", {
188
+ }, category.map((v, index) => {
189
+ return _react().default.createElement(_antd().Badge.Ribbon, {
190
+ color: v.color,
191
+ style: {
192
+ width: '103%',
193
+ height: '3px',
194
+ marginTop: index * 5 - 8,
195
+ borderRadius: 0
196
+ },
197
+ placement: "start"
198
+ });
199
+ }), _react().default.createElement("div", {
174
200
  className: _style.headClass,
175
201
  style: {
176
- background: (attrs === null || attrs === void 0 ? void 0 : attrs.hightLight) ? '#1890ff' : null
202
+ background: (attrs === null || attrs === void 0 ? void 0 : attrs.hightLight) ? '#1890ff' : null,
203
+ paddingTop: category.length * 3
177
204
  }
178
205
  }, _react().default.createElement("span", {
179
206
  className: _style.tableNameClass
@@ -189,6 +216,7 @@ const Entity = props => {
189
216
  useUpdateCollectionActionAndRefreshCM: _actionHooks.useUpdateCollectionActionAndRefreshCM,
190
217
  useCancelAction: _actionHooks.useCancelAction,
191
218
  loadCollections,
219
+ loadCategories,
192
220
  useAsyncDataSource: _actionHooks.useAsyncDataSource,
193
221
  Action: _client().Action,
194
222
  DeleteOutlined: _icons().DeleteOutlined,
@@ -143,7 +143,7 @@ const entityContainer = (0, _css().css)`
143
143
  `;
144
144
  exports.entityContainer = entityContainer;
145
145
  const headClass = (0, _css().css)`
146
- height: 40px;
146
+ height: 50px;
147
147
  font-size: 14px;
148
148
  font-weight: 500;
149
149
  display: flex;
@@ -16,6 +16,8 @@ function _database() {
16
16
  }
17
17
 
18
18
  var _default = (0, _database().defineCollection)({
19
+ namespace: 'graph-collection-manager',
20
+ duplicator: 'required',
19
21
  name: 'graphPositions',
20
22
  fields: [{
21
23
  type: 'string',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-graph-collection-manager",
3
- "version": "0.9.0-alpha.2",
3
+ "version": "0.9.1-alpha.1",
4
4
  "description": "",
5
5
  "license": "AGPL-3.0",
6
6
  "main": "./lib/index.js",
@@ -11,8 +11,8 @@
11
11
  "dagre": "^0.8.5"
12
12
  },
13
13
  "devDependencies": {
14
- "@nocobase/client": "0.9.0-alpha.2",
15
- "@nocobase/test": "0.9.0-alpha.2"
14
+ "@nocobase/client": "0.9.1-alpha.1",
15
+ "@nocobase/test": "0.9.1-alpha.1"
16
16
  },
17
- "gitHead": "b8f76ad38e60e677c5bb4aab0a4cdb28d98a0f49"
17
+ "gitHead": "56cb184b00dc383b853015d525bf6e79dea92169"
18
18
  }