@nocobase/plugin-workflow 0.9.4-alpha.2 → 0.10.0-alpha.3

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 (116) hide show
  1. package/lib/client/AddButton.d.ts +2 -2
  2. package/lib/client/AddButton.js +76 -65
  3. package/lib/client/Branch.d.ts +2 -2
  4. package/lib/client/CanvasContent.d.ts +2 -2
  5. package/lib/client/ExecutionCanvas.d.ts +2 -2
  6. package/lib/client/ExecutionCanvas.js +1 -1
  7. package/lib/client/ExecutionLink.d.ts +2 -1
  8. package/lib/client/ExecutionPage.d.ts +2 -1
  9. package/lib/client/ExecutionPage.js +14 -15
  10. package/lib/client/ExecutionResourceProvider.d.ts +2 -1
  11. package/lib/client/WorkflowCanvas.d.ts +2 -2
  12. package/lib/client/WorkflowCanvas.js +31 -31
  13. package/lib/client/WorkflowLink.d.ts +2 -1
  14. package/lib/client/WorkflowPage.d.ts +2 -1
  15. package/lib/client/WorkflowPage.js +11 -10
  16. package/lib/client/WorkflowProvider.d.ts +1 -1
  17. package/lib/client/WorkflowProvider.js +15 -15
  18. package/lib/client/components/CollectionBlockInitializer.d.ts +2 -7
  19. package/lib/client/components/CollectionBlockInitializer.js +49 -17
  20. package/lib/client/components/CollectionFieldset.d.ts +3 -2
  21. package/lib/client/components/CollectionFieldset.js +87 -74
  22. package/lib/client/components/Duration.d.ts +2 -2
  23. package/lib/client/components/DynamicExpression.d.ts +3 -1
  24. package/lib/client/components/DynamicExpression.js +2 -0
  25. package/lib/client/components/FieldsSelect.d.ts +1 -1
  26. package/lib/client/components/FieldsSelect.js +2 -0
  27. package/lib/client/components/FilterDynamicComponent.d.ts +2 -2
  28. package/lib/client/components/NodeDescription.d.ts +2 -2
  29. package/lib/client/components/OpenDrawer.d.ts +2 -2
  30. package/lib/client/components/OpenDrawer.js +1 -1
  31. package/lib/client/components/RadioWithTooltip.d.ts +2 -2
  32. package/lib/client/components/renderEngineReference.d.ts +2 -1
  33. package/lib/client/constants.d.ts +2 -1
  34. package/lib/client/locale/zh-CN.d.ts +8 -0
  35. package/lib/client/locale/zh-CN.js +8 -0
  36. package/lib/client/nodes/aggregate.d.ts +1 -1
  37. package/lib/client/nodes/calculation.d.ts +4 -3
  38. package/lib/client/nodes/condition.d.ts +6 -4
  39. package/lib/client/nodes/condition.js +3 -1
  40. package/lib/client/nodes/create.d.ts +3 -6
  41. package/lib/client/nodes/create.js +1 -4
  42. package/lib/client/nodes/index.d.ts +5 -5
  43. package/lib/client/nodes/index.js +9 -6
  44. package/lib/client/nodes/loop.d.ts +4 -1
  45. package/lib/client/nodes/loop.js +3 -1
  46. package/lib/client/nodes/manual/AssigneesSelect.d.ts +2 -2
  47. package/lib/client/nodes/manual/DetailsBlockProvider.d.ts +2 -0
  48. package/lib/client/nodes/manual/DetailsBlockProvider.js +106 -0
  49. package/lib/client/nodes/manual/FormBlockInitializer.d.ts +2 -0
  50. package/lib/client/nodes/manual/FormBlockInitializer.js +106 -0
  51. package/lib/client/nodes/manual/FormBlockProvider.d.ts +2 -0
  52. package/lib/client/nodes/manual/FormBlockProvider.js +113 -0
  53. package/lib/client/nodes/manual/ModeConfig.d.ts +2 -2
  54. package/lib/client/nodes/manual/SchemaConfig.d.ts +43 -3
  55. package/lib/client/nodes/manual/SchemaConfig.js +42 -79
  56. package/lib/client/nodes/manual/WorkflowTodo.d.ts +5 -8
  57. package/lib/client/nodes/manual/WorkflowTodo.js +111 -76
  58. package/lib/client/nodes/manual/WorkflowTodoBlockInitializer.d.ts +2 -2
  59. package/lib/client/nodes/manual/forms/create.d.ts +3 -0
  60. package/lib/client/nodes/manual/forms/create.js +104 -0
  61. package/lib/client/nodes/manual/forms/custom.d.ts +3 -0
  62. package/lib/client/nodes/manual/forms/{customForm.js → custom.js} +63 -45
  63. package/lib/client/nodes/manual/forms/update.d.ts +3 -0
  64. package/lib/client/nodes/manual/forms/update.js +161 -0
  65. package/lib/client/nodes/manual/index.d.ts +2 -5
  66. package/lib/client/nodes/manual/index.js +17 -16
  67. package/lib/client/nodes/manual/utils.d.ts +2 -0
  68. package/lib/client/nodes/manual/utils.js +31 -0
  69. package/lib/client/nodes/parallel.d.ts +4 -1
  70. package/lib/client/nodes/parallel.js +3 -1
  71. package/lib/client/nodes/query.d.ts +2 -5
  72. package/lib/client/nodes/query.js +2 -5
  73. package/lib/client/nodes/request.d.ts +1 -1
  74. package/lib/client/nodes/request.js +1 -11
  75. package/lib/client/nodes/update.d.ts +24 -1
  76. package/lib/client/nodes/update.js +76 -3
  77. package/lib/client/schemas/collection.js +1 -1
  78. package/lib/client/schemas/executions.d.ts +2 -0
  79. package/lib/client/style.js +4 -0
  80. package/lib/client/triggers/collection.d.ts +2 -5
  81. package/lib/client/triggers/collection.js +5 -8
  82. package/lib/client/triggers/index.d.ts +1 -2
  83. package/lib/client/triggers/index.js +10 -8
  84. package/lib/client/triggers/schedule/DateFieldsSelect.js +14 -12
  85. package/lib/client/triggers/schedule/EndsByField.d.ts +2 -2
  86. package/lib/client/triggers/schedule/OnField.d.ts +2 -2
  87. package/lib/client/triggers/schedule/RepeatField.d.ts +2 -2
  88. package/lib/client/triggers/schedule/ScheduleConfig.d.ts +2 -1
  89. package/lib/client/triggers/schedule/index.d.ts +3 -6
  90. package/lib/client/triggers/schedule/index.js +1 -4
  91. package/lib/server/Plugin.js +6 -3
  92. package/lib/server/Processor.d.ts +2 -2
  93. package/lib/server/Processor.js +22 -26
  94. package/lib/server/instructions/delay.js +1 -1
  95. package/lib/server/instructions/loop.d.ts +1 -1
  96. package/lib/server/instructions/loop.js +1 -1
  97. package/lib/server/instructions/manual/actions.js +42 -47
  98. package/lib/server/instructions/manual/forms/create.d.ts +5 -0
  99. package/lib/server/instructions/manual/forms/create.js +46 -0
  100. package/lib/server/instructions/manual/forms/index.d.ts +6 -0
  101. package/lib/server/instructions/manual/forms/index.js +15 -0
  102. package/lib/server/instructions/manual/forms/update.d.ts +6 -0
  103. package/lib/server/instructions/manual/forms/update.js +47 -0
  104. package/lib/server/instructions/manual/index.d.ts +3 -0
  105. package/lib/server/instructions/manual/index.js +16 -3
  106. package/lib/server/instructions/parallel.js +2 -2
  107. package/lib/server/instructions/request.js +3 -3
  108. package/lib/server/instructions/update.js +2 -3
  109. package/lib/server/migrations/20230612021134-manual-collection-block.d.ts +4 -0
  110. package/lib/server/migrations/20230612021134-manual-collection-block.js +155 -0
  111. package/package.json +16 -13
  112. package/lib/client/WorkflowShortcut.d.ts +0 -1
  113. package/lib/client/WorkflowShortcut.js +0 -48
  114. package/lib/client/components/CollectionFieldInitializers.d.ts +0 -2
  115. package/lib/client/components/CollectionFieldInitializers.js +0 -70
  116. package/lib/client/nodes/manual/forms/customForm.d.ts +0 -40
@@ -0,0 +1,155 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = 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 _utils() {
15
+ const data = require("@nocobase/utils");
16
+ _utils = function _utils() {
17
+ return data;
18
+ };
19
+ return data;
20
+ }
21
+ const _excluded = ["schema"];
22
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
23
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
24
+ 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); } }
25
+ 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); }); }; }
26
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
27
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
28
+ 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; }
29
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
30
+ 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); }
31
+ function findSchema(root, filter, onlyLeaf = false) {
32
+ const result = [];
33
+ if (!root) {
34
+ return result;
35
+ }
36
+ if (filter(root) && (!onlyLeaf || !root.properties)) {
37
+ result.push(root);
38
+ return result;
39
+ }
40
+ if (root.properties) {
41
+ Object.keys(root.properties).forEach(key => {
42
+ result.push(...findSchema(root.properties[key], filter));
43
+ });
44
+ }
45
+ return result;
46
+ }
47
+ function migrateSchema(schema = {}) {
48
+ const root = {
49
+ properties: schema
50
+ };
51
+ const collectionBlocks = findSchema(root, item => {
52
+ return item['x-component'] === 'CardItem' && item['x-designer'] === 'SimpleDesigner' && item['x-decorator'] === 'CollectionProvider';
53
+ });
54
+ collectionBlocks.forEach(block => {
55
+ const id = (0, _utils().uid)();
56
+ const grid = block.properties.grid;
57
+ delete block.properties.grid;
58
+ const fields = findSchema(grid, item => {
59
+ return item['x-decorator'] === 'FormItem';
60
+ });
61
+ fields.forEach(field => {
62
+ Object.assign(field, {
63
+ 'x-component': 'CollectionField',
64
+ 'x-collection-field': `${block['x-decorator-props'].collection}.${field['x-collection-field']}`
65
+ });
66
+ });
67
+ Object.assign(block, {
68
+ 'x-decorator': 'DetailsBlockProvider',
69
+ 'x-decorator-props': _objectSpread(_objectSpread({}, block['x-decorator-props']), {}, {
70
+ dataSource: grid['x-context-datasource']
71
+ }),
72
+ properties: {
73
+ [id]: {
74
+ type: 'void',
75
+ name: id,
76
+ 'x-component': 'FormV2',
77
+ 'x-component-props': {
78
+ useProps: '{{useDetailsBlockProps}}'
79
+ },
80
+ properties: {
81
+ grid: {
82
+ type: 'void',
83
+ name: 'grid',
84
+ 'x-component': 'Grid',
85
+ 'x-initializer': 'ReadPrettyFormItemInitializers',
86
+ properties: grid.properties
87
+ }
88
+ }
89
+ }
90
+ }
91
+ });
92
+ });
93
+ const customForms = findSchema(root, item => {
94
+ return item['x-decorator'] === 'FormCollectionProvider';
95
+ });
96
+ customForms.forEach(item => {
97
+ Object.assign(item, {
98
+ 'x-decorator': 'CustomFormBlockProvider'
99
+ });
100
+ });
101
+ const customFormFields = findSchema(root, item => {
102
+ return item['x-interface-options'];
103
+ });
104
+ customFormFields.forEach(field => {
105
+ const options = field['x-interface-options'];
106
+ delete field['x-interface-options'];
107
+ Object.assign(field, {
108
+ 'x-component-props': {
109
+ field: options
110
+ }
111
+ });
112
+ });
113
+ return schema;
114
+ }
115
+ class _default extends _server().Migration {
116
+ up() {
117
+ var _this = this;
118
+ return _asyncToGenerator(function* () {
119
+ const match = yield _this.app.version.satisfies('<0.9.4-alpha.3');
120
+ if (!match) {
121
+ return;
122
+ }
123
+ const db = _this.context.db;
124
+ const NodeRepo = db.getRepository('flow_nodes');
125
+ yield db.sequelize.transaction( /*#__PURE__*/function () {
126
+ var _ref = _asyncToGenerator(function* (transaction) {
127
+ const nodes = yield NodeRepo.find({
128
+ filter: {
129
+ type: 'manual'
130
+ },
131
+ transaction
132
+ });
133
+ console.log('%d nodes need to be migrated.', nodes.length);
134
+ yield nodes.reduce((promise, node) => promise.then(() => {
135
+ const _node$config = node.config,
136
+ schema = _node$config.schema,
137
+ config = _objectWithoutProperties(_node$config, _excluded);
138
+ node.set('config', _objectSpread(_objectSpread({}, config), {}, {
139
+ schema: _objectSpread({}, migrateSchema(schema))
140
+ }));
141
+ node.changed('config', true);
142
+ return node.save({
143
+ silent: true,
144
+ transaction
145
+ });
146
+ }), Promise.resolve());
147
+ });
148
+ return function (_x) {
149
+ return _ref.apply(this, arguments);
150
+ };
151
+ }());
152
+ })();
153
+ }
154
+ }
155
+ exports.default = _default;
package/package.json CHANGED
@@ -1,19 +1,22 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-workflow",
3
- "version": "0.9.4-alpha.2",
4
- "description": "",
3
+ "displayName": "workflow",
4
+ "displayName.zh-CN": "工作流",
5
+ "description": " a powerful workflow plugin designed to support business process management and automation. .",
6
+ "description.zh-CN": "工作流插件,为业务流程管理和自动化提供支持。",
7
+ "version": "0.10.0-alpha.3",
5
8
  "license": "AGPL-3.0",
6
9
  "main": "./lib/index.js",
7
10
  "types": "./lib/index.d.ts",
8
11
  "dependencies": {
9
- "@nocobase/actions": "0.9.4-alpha.2",
10
- "@nocobase/client": "0.9.4-alpha.2",
11
- "@nocobase/database": "0.9.4-alpha.2",
12
- "@nocobase/evaluators": "0.9.4-alpha.2",
13
- "@nocobase/logger": "0.9.4-alpha.2",
14
- "@nocobase/resourcer": "0.9.4-alpha.2",
15
- "@nocobase/server": "0.9.4-alpha.2",
16
- "@nocobase/utils": "0.9.4-alpha.2",
12
+ "@nocobase/actions": "0.10.0-alpha.3",
13
+ "@nocobase/client": "0.10.0-alpha.3",
14
+ "@nocobase/database": "0.10.0-alpha.3",
15
+ "@nocobase/evaluators": "0.10.0-alpha.3",
16
+ "@nocobase/logger": "0.10.0-alpha.3",
17
+ "@nocobase/resourcer": "0.10.0-alpha.3",
18
+ "@nocobase/server": "0.10.0-alpha.3",
19
+ "@nocobase/utils": "0.10.0-alpha.3",
17
20
  "antd": "^4.24.8",
18
21
  "axios": "^0.27.2",
19
22
  "classnames": "^2.3.1",
@@ -23,9 +26,9 @@
23
26
  "react-js-cron": "^3.1.0"
24
27
  },
25
28
  "devDependencies": {
26
- "@nocobase/plugin-formula-field": "0.9.4-alpha.2",
27
- "@nocobase/test": "0.9.4-alpha.2",
29
+ "@nocobase/plugin-formula-field": "0.10.0-alpha.3",
30
+ "@nocobase/test": "0.10.0-alpha.3",
28
31
  "@types/ejs": "^3.1.1"
29
32
  },
30
- "gitHead": "2bc19a85bf9425aa220b6c467315c8087f333a7e"
33
+ "gitHead": "1f0b27fc9ab2398cd41c308a6b01a986e025cd20"
31
34
  }
@@ -1 +0,0 @@
1
- export declare const WorkflowShortcut: () => JSX.Element;
@@ -1,48 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.WorkflowShortcut = void 0;
7
- function _react() {
8
- const data = _interopRequireDefault(require("react"));
9
- _react = function _react() {
10
- return data;
11
- };
12
- return data;
13
- }
14
- function _icons() {
15
- const data = require("@ant-design/icons");
16
- _icons = function _icons() {
17
- return data;
18
- };
19
- return data;
20
- }
21
- function _reactRouterDom() {
22
- const data = require("react-router-dom");
23
- _reactRouterDom = function _reactRouterDom() {
24
- return data;
25
- };
26
- return data;
27
- }
28
- function _client() {
29
- const data = require("@nocobase/client");
30
- _client = function _client() {
31
- return data;
32
- };
33
- return data;
34
- }
35
- var _locale = require("./locale");
36
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
37
- const WorkflowShortcut = () => {
38
- const history = (0, _reactRouterDom().useHistory)();
39
- return _react().default.createElement(_client().PluginManager.Toolbar.Item, {
40
- key: "workflow",
41
- icon: _react().default.createElement(_icons().PartitionOutlined, null),
42
- title: (0, _locale.lang)('Workflow'),
43
- onClick: () => {
44
- history.push('/admin/settings/workflow/workflows');
45
- }
46
- });
47
- };
48
- exports.WorkflowShortcut = WorkflowShortcut;
@@ -1,2 +0,0 @@
1
- /// <reference types="react" />
2
- export declare function CollectionFieldInitializers(props: any): JSX.Element;
@@ -1,70 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.CollectionFieldInitializers = CollectionFieldInitializers;
7
- function _react() {
8
- const data = _interopRequireDefault(require("react"));
9
- _react = function _react() {
10
- return data;
11
- };
12
- return data;
13
- }
14
- function _lodash() {
15
- const data = require("lodash");
16
- _lodash = function _lodash() {
17
- return data;
18
- };
19
- return data;
20
- }
21
- function _client() {
22
- const data = require("@nocobase/client");
23
- _client = function _client() {
24
- return data;
25
- };
26
- return data;
27
- }
28
- const _excluded = ["field"];
29
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
30
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
31
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
32
- 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; }
33
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
34
- 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); }
35
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
36
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
37
- function CollectionFieldInitializer(_ref) {
38
- var _uiSchema$title;
39
- let field = _ref.field,
40
- props = _objectWithoutProperties(_ref, _excluded);
41
- const uiSchema = (0, _lodash().cloneDeep)(field.uiSchema);
42
- delete uiSchema['x-uid'];
43
- return _react().default.createElement(_client().InitializerWithSwitch, _objectSpread(_objectSpread({}, props), {}, {
44
- schema: _objectSpread(_objectSpread({}, uiSchema), {}, {
45
- name: field.name,
46
- title: (_uiSchema$title = uiSchema.title) !== null && _uiSchema$title !== void 0 ? _uiSchema$title : field.name,
47
- 'x-decorator': 'FormItem',
48
- 'x-read-pretty': true,
49
- 'x-designer': 'FormItem.Designer',
50
- 'x-collection-field': field.name
51
- }),
52
- type: "x-collection-field"
53
- }));
54
- }
55
- function CollectionFieldInitializers(props) {
56
- const _useCollection = (0, _client().useCollection)(),
57
- fields = _useCollection.fields;
58
- const items = fields.filter(field => !['belongsTo', 'hasOne', 'hasMany', 'belongsToMany'].includes(field.type) && field.uiSchema).map(field => ({
59
- key: field.name,
60
- type: 'item',
61
- title: field.uiSchema.title,
62
- component: CollectionFieldInitializer,
63
- field
64
- }));
65
- return _react().default.createElement(_client().SchemaInitializer.Button, _objectSpread(_objectSpread({}, props), {}, {
66
- items: items,
67
- title: "{{t('Configure fields')}}",
68
- wrap: _client().gridRowColWrap
69
- }));
70
- }
@@ -1,40 +0,0 @@
1
- import React from 'react';
2
- declare function FormCollectionProvider(props: any): JSX.Element;
3
- declare function CustomFormBlockInitializer({ insert, ...props }: {
4
- [x: string]: any;
5
- insert: any;
6
- }): JSX.Element;
7
- declare function AddCustomFormField(props: any): JSX.Element;
8
- declare function useFormBlockProps(): {
9
- form: import("@formily/core").Form<any>;
10
- };
11
- declare const _default: {
12
- title: string;
13
- config: {
14
- initializer: {
15
- key: string;
16
- type: string;
17
- title: string;
18
- component: typeof CustomFormBlockInitializer;
19
- };
20
- initializers: {
21
- AddCustomFormField: typeof AddCustomFormField;
22
- };
23
- components: {
24
- FormCollectionProvider: typeof FormCollectionProvider;
25
- };
26
- };
27
- block: {
28
- scope: {
29
- useFormBlockProps: typeof useFormBlockProps;
30
- };
31
- components: {
32
- FormCollectionProvider: React.FC<{
33
- allowNull?: boolean;
34
- name?: string;
35
- collection?: import("@nocobase/client").CollectionOptions;
36
- }>;
37
- };
38
- };
39
- };
40
- export default _default;