@nocobase/plugin-graph-collection-manager 0.11.1-alpha.5 → 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.
Files changed (100) hide show
  1. package/client.d.ts +2 -3
  2. package/client.js +1 -1
  3. package/dist/client/index.js +65917 -0
  4. package/{lib → dist}/client/utils.d.ts +4 -3
  5. package/{lib → dist}/index.d.ts +1 -0
  6. package/dist/index.js +18 -0
  7. package/dist/locale/en-US.js +19 -0
  8. package/dist/locale/es-ES.js +19 -0
  9. package/dist/locale/fr-FR.js +19 -0
  10. package/dist/locale/ja-JP.js +17 -0
  11. package/dist/locale/pt-BR.js +19 -0
  12. package/dist/locale/zh-CN.js +20 -0
  13. package/dist/server/collections/graphPositions.js +26 -0
  14. package/dist/server/index.js +23 -0
  15. package/package.json +17 -28
  16. package/server.d.ts +2 -3
  17. package/server.js +1 -1
  18. package/lib/client/GraphCollectionProvider.js +0 -51
  19. package/lib/client/GraphCollectionShortcut.js +0 -169
  20. package/lib/client/GraphDrawPage.js +0 -1546
  21. package/lib/client/action-hooks.js +0 -318
  22. package/lib/client/components/AddCollectionAction.js +0 -58
  23. package/lib/client/components/AddFieldAction.js +0 -69
  24. package/lib/client/components/CollectionNodeProvder.js +0 -34
  25. package/lib/client/components/EditCollectionAction.js +0 -47
  26. package/lib/client/components/EditFieldAction.js +0 -63
  27. package/lib/client/components/Entity.js +0 -529
  28. package/lib/client/components/FieldSummary.js +0 -69
  29. package/lib/client/components/OverrideFieldAction.js +0 -64
  30. package/lib/client/components/ViewFieldAction.js +0 -45
  31. package/lib/client/components/ViewNode.js +0 -33
  32. package/lib/client/index.js +0 -27
  33. package/lib/client/locale/index.js +0 -4
  34. package/lib/client/style.js +0 -233
  35. package/lib/client/utils.js +0 -540
  36. package/lib/index.js +0 -13
  37. package/lib/locale/en-US.js +0 -22
  38. package/lib/locale/es-ES.js +0 -22
  39. package/lib/locale/fr-FR.js +0 -22
  40. package/lib/locale/ja-JP.js +0 -20
  41. package/lib/locale/pt-BR.js +0 -22
  42. package/lib/locale/zh-CN.js +0 -23
  43. package/lib/server/collections/graphPositions.js +0 -30
  44. package/lib/server/index.js +0 -37
  45. package/src/client/GraphCollectionProvider.tsx +0 -33
  46. package/src/client/GraphCollectionShortcut.tsx +0 -141
  47. package/src/client/GraphDrawPage.tsx +0 -1382
  48. package/src/client/action-hooks.tsx +0 -237
  49. package/src/client/components/AddCollectionAction.tsx +0 -28
  50. package/src/client/components/AddFieldAction.tsx +0 -37
  51. package/src/client/components/CollectionNodeProvder.tsx +0 -28
  52. package/src/client/components/EditCollectionAction.tsx +0 -21
  53. package/src/client/components/EditFieldAction.tsx +0 -30
  54. package/src/client/components/Entity.tsx +0 -495
  55. package/src/client/components/FieldSummary.tsx +0 -42
  56. package/src/client/components/OverrideFieldAction.tsx +0 -30
  57. package/src/client/components/ViewFieldAction.tsx +0 -12
  58. package/src/client/components/ViewNode.tsx +0 -22
  59. package/src/client/index.tsx +0 -10
  60. package/src/client/locale/index.ts +0 -3
  61. package/src/client/style.tsx +0 -227
  62. package/src/client/utils.tsx +0 -548
  63. package/src/index.ts +0 -1
  64. package/src/locale/en-US.ts +0 -15
  65. package/src/locale/es-ES.ts +0 -15
  66. package/src/locale/fr-FR.ts +0 -15
  67. package/src/locale/ja-JP.ts +0 -13
  68. package/src/locale/pt-BR.ts +0 -15
  69. package/src/locale/zh-CN.ts +0 -16
  70. package/src/server/actions/.gitkeep +0 -0
  71. package/src/server/collections/.gitkeep +0 -0
  72. package/src/server/collections/graphPositions.ts +0 -22
  73. package/src/server/index.ts +0 -13
  74. package/src/server/models/.gitkeep +0 -0
  75. package/src/server/repositories/.gitkeep +0 -0
  76. /package/{lib → dist}/client/GraphCollectionProvider.d.ts +0 -0
  77. /package/{lib → dist}/client/GraphCollectionShortcut.d.ts +0 -0
  78. /package/{lib → dist}/client/GraphDrawPage.d.ts +0 -0
  79. /package/{lib → dist}/client/action-hooks.d.ts +0 -0
  80. /package/{lib → dist}/client/components/AddCollectionAction.d.ts +0 -0
  81. /package/{lib → dist}/client/components/AddFieldAction.d.ts +0 -0
  82. /package/{lib → dist}/client/components/CollectionNodeProvder.d.ts +0 -0
  83. /package/{lib → dist}/client/components/EditCollectionAction.d.ts +0 -0
  84. /package/{lib → dist}/client/components/EditFieldAction.d.ts +0 -0
  85. /package/{lib → dist}/client/components/Entity.d.ts +0 -0
  86. /package/{lib → dist}/client/components/FieldSummary.d.ts +0 -0
  87. /package/{lib → dist}/client/components/OverrideFieldAction.d.ts +0 -0
  88. /package/{lib → dist}/client/components/ViewFieldAction.d.ts +0 -0
  89. /package/{lib → dist}/client/components/ViewNode.d.ts +0 -0
  90. /package/{lib → dist}/client/index.d.ts +0 -0
  91. /package/{lib → dist}/client/locale/index.d.ts +0 -0
  92. /package/{lib → dist}/client/style.d.ts +0 -0
  93. /package/{lib → dist}/locale/en-US.d.ts +0 -0
  94. /package/{lib → dist}/locale/es-ES.d.ts +0 -0
  95. /package/{lib → dist}/locale/fr-FR.d.ts +0 -0
  96. /package/{lib → dist}/locale/ja-JP.d.ts +0 -0
  97. /package/{lib → dist}/locale/pt-BR.d.ts +0 -0
  98. /package/{lib → dist}/locale/zh-CN.d.ts +0 -0
  99. /package/{lib → dist}/server/collections/graphPositions.d.ts +0 -0
  100. /package/{lib → dist}/server/index.d.ts +0 -0
@@ -1,30 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- function _database() {
8
- const data = require("@nocobase/database");
9
- _database = function _database() {
10
- return data;
11
- };
12
- return data;
13
- }
14
- var _default = (0, _database().defineCollection)({
15
- namespace: 'graph-collection-manager.graphCollectionPositions',
16
- duplicator: 'required',
17
- name: 'graphPositions',
18
- fields: [{
19
- type: 'string',
20
- name: 'collectionName',
21
- unique: true
22
- }, {
23
- type: 'double',
24
- name: 'x'
25
- }, {
26
- type: 'double',
27
- name: 'y'
28
- }]
29
- });
30
- exports.default = _default;
@@ -1,37 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = exports.GraphCollectionManagerPlugin = void 0;
7
- function _server() {
8
- const data = require("@nocobase/server");
9
- _server = function _server() {
10
- return data;
11
- };
12
- return data;
13
- }
14
- function _path() {
15
- const data = _interopRequireDefault(require("path"));
16
- _path = function _path() {
17
- return data;
18
- };
19
- return data;
20
- }
21
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
23
- function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
24
- class GraphCollectionManagerPlugin extends _server().Plugin {
25
- load() {
26
- var _this = this;
27
- return _asyncToGenerator(function* () {
28
- yield _this.db.import({
29
- directory: _path().default.resolve(__dirname, 'collections')
30
- });
31
- _this.app.acl.allow('graphPositions', '*');
32
- })();
33
- }
34
- }
35
- exports.GraphCollectionManagerPlugin = GraphCollectionManagerPlugin;
36
- var _default = GraphCollectionManagerPlugin;
37
- exports.default = _default;
@@ -1,33 +0,0 @@
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';
@@ -1,141 +0,0 @@
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
- };