@nocobase/plugin-workflow 0.10.0-alpha.5 → 0.10.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/lib/client/components/DynamicExpression.js +14 -4
- package/lib/client/nodes/aggregate.d.ts +8 -2
- package/lib/client/nodes/aggregate.js +11 -8
- package/lib/client/nodes/calculation.d.ts +10 -15
- package/lib/client/nodes/calculation.js +56 -29
- package/lib/client/nodes/condition.d.ts +1 -3
- package/lib/client/nodes/condition.js +7 -4
- package/lib/client/nodes/create.d.ts +4 -2
- package/lib/client/nodes/create.js +34 -7
- package/lib/client/nodes/index.d.ts +2 -2
- package/lib/client/nodes/loop.d.ts +2 -0
- package/lib/client/nodes/loop.js +14 -2
- package/lib/client/nodes/manual/WorkflowTodo.js +5 -3
- package/lib/client/nodes/manual/index.d.ts +11 -5
- package/lib/client/nodes/manual/index.js +21 -10
- package/lib/client/nodes/query.d.ts +4 -2
- package/lib/client/nodes/query.js +34 -7
- package/lib/client/nodes/request.d.ts +10 -6
- package/lib/client/nodes/request.js +34 -6
- package/lib/client/triggers/collection.js +20 -6
- package/lib/client/triggers/index.js +1 -0
- package/lib/client/triggers/schedule/index.d.ts +1 -3
- package/lib/client/triggers/schedule/index.js +21 -11
- package/lib/client/variable.d.ts +1 -2
- package/lib/client/variable.js +106 -41
- package/package.json +12 -12
|
@@ -69,6 +69,9 @@ const InternalExpression = (0, _react().observer)(props => {
|
|
|
69
69
|
_useState2 = _slicedToArray(_useState, 2),
|
|
70
70
|
collection = _useState2[0],
|
|
71
71
|
setCollection = _useState2[1];
|
|
72
|
+
const compile = (0, _client().useCompile)();
|
|
73
|
+
const _useCollectionManager = (0, _client().useCollectionManager)(),
|
|
74
|
+
getCollectionFields = _useCollectionManager.getCollectionFields;
|
|
72
75
|
(0, _react().useFormEffects)(() => {
|
|
73
76
|
(0, _core().onFormInitialValuesChange)(form => {
|
|
74
77
|
setCollection(form.values.sourceCollection);
|
|
@@ -78,8 +81,10 @@ const InternalExpression = (0, _react().observer)(props => {
|
|
|
78
81
|
onChange(null);
|
|
79
82
|
});
|
|
80
83
|
});
|
|
81
|
-
const options = (0, _variable.
|
|
82
|
-
collection
|
|
84
|
+
const options = (0, _variable.getCollectionFieldOptions)({
|
|
85
|
+
collection,
|
|
86
|
+
compile,
|
|
87
|
+
getCollectionFields
|
|
83
88
|
});
|
|
84
89
|
return _react2().default.createElement(_client().Variable.TextArea, _objectSpread(_objectSpread({}, props), {}, {
|
|
85
90
|
scope: options
|
|
@@ -91,8 +96,13 @@ function Result(props) {
|
|
|
91
96
|
const _useTranslation = (0, _reactI18next().useTranslation)(),
|
|
92
97
|
t = _useTranslation.t;
|
|
93
98
|
const values = (0, _client().useRecord)();
|
|
94
|
-
const
|
|
95
|
-
|
|
99
|
+
const compile = (0, _client().useCompile)();
|
|
100
|
+
const _useCollectionManager2 = (0, _client().useCollectionManager)(),
|
|
101
|
+
getCollectionFields = _useCollectionManager2.getCollectionFields;
|
|
102
|
+
const options = (0, _react2().useMemo)(() => (0, _variable.getCollectionFieldOptions)({
|
|
103
|
+
collection: values.sourceCollection,
|
|
104
|
+
compile,
|
|
105
|
+
getCollectionFields
|
|
96
106
|
}), [values.sourceCollection, values.sourceCollection]);
|
|
97
107
|
return props.value ? _react2().default.createElement(_client().Variable.TextArea, _objectSpread(_objectSpread({}, props), {}, {
|
|
98
108
|
scope: options
|
|
@@ -178,9 +178,15 @@ declare const _default: {
|
|
|
178
178
|
};
|
|
179
179
|
AssociatedConfig: typeof AssociatedConfig;
|
|
180
180
|
};
|
|
181
|
-
useVariables(
|
|
181
|
+
useVariables({ id, title }: {
|
|
182
|
+
id: any;
|
|
183
|
+
title: any;
|
|
184
|
+
}, { types }: {
|
|
182
185
|
types: any;
|
|
183
|
-
}):
|
|
186
|
+
}): {
|
|
187
|
+
value: string;
|
|
188
|
+
label: any;
|
|
189
|
+
};
|
|
184
190
|
useInitializers(node: any): SchemaInitializerItemOptions | null;
|
|
185
191
|
};
|
|
186
192
|
export default _default;
|
|
@@ -38,7 +38,6 @@ var _FilterDynamicComponent = require("../components/FilterDynamicComponent");
|
|
|
38
38
|
var _variable = require("../variable");
|
|
39
39
|
var _FieldsSelect = require("../components/FieldsSelect");
|
|
40
40
|
var _ValueBlock = require("../components/ValueBlock");
|
|
41
|
-
var _ = require(".");
|
|
42
41
|
const _excluded = ["value", "onChange"];
|
|
43
42
|
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); }
|
|
44
43
|
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; }
|
|
@@ -49,8 +48,9 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typ
|
|
|
49
48
|
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); }
|
|
50
49
|
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; }
|
|
51
50
|
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; }
|
|
52
|
-
function matchToManyField(field,
|
|
53
|
-
|
|
51
|
+
function matchToManyField(field, appends) {
|
|
52
|
+
const fieldPrefix = `${field.name}.`;
|
|
53
|
+
return ['hasMany', 'belongsToMany'].includes(field.type) && (appends.includes(field.name) || appends.some(item => item.startsWith(fieldPrefix)));
|
|
54
54
|
}
|
|
55
55
|
function AssociatedConfig(_ref) {
|
|
56
56
|
let value = _ref.value,
|
|
@@ -61,7 +61,6 @@ function AssociatedConfig(_ref) {
|
|
|
61
61
|
const compile = (0, _client().useCompile)();
|
|
62
62
|
const _useCollectionManager = (0, _client().useCollectionManager)(),
|
|
63
63
|
getCollection = _useCollectionManager.getCollection;
|
|
64
|
-
const current = (0, _.useNodeContext)();
|
|
65
64
|
const options = [_variable.nodesOptions, _variable.triggerOptions].map(item => {
|
|
66
65
|
var _item$useOptions;
|
|
67
66
|
const children = (_item$useOptions = item.useOptions({
|
|
@@ -322,15 +321,19 @@ var _default = {
|
|
|
322
321
|
ValueBlock: _ValueBlock.ValueBlock,
|
|
323
322
|
AssociatedConfig
|
|
324
323
|
},
|
|
325
|
-
useVariables(
|
|
324
|
+
useVariables({
|
|
325
|
+
id,
|
|
326
|
+
title
|
|
327
|
+
}, {
|
|
326
328
|
types
|
|
327
329
|
}) {
|
|
328
330
|
if (types && !types.some(type => type in _variable.BaseTypeSets || Object.values(_variable.BaseTypeSets).some(set => set.has(type)))) {
|
|
329
331
|
return null;
|
|
330
332
|
}
|
|
331
|
-
return
|
|
332
|
-
|
|
333
|
-
|
|
333
|
+
return {
|
|
334
|
+
value: `${id}`,
|
|
335
|
+
label: title
|
|
336
|
+
};
|
|
334
337
|
},
|
|
335
338
|
useInitializers(node) {
|
|
336
339
|
var _node$title;
|
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
import { SchemaInitializerItemOptions } from '@nocobase/client';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { RadioWithTooltip } from '../components/RadioWithTooltip';
|
|
4
|
-
import { useWorkflowVariableOptions } from '../variable';
|
|
5
|
-
declare function useWorkflowVariableEntityOptions(): {
|
|
6
|
-
label: any;
|
|
7
|
-
value: any;
|
|
8
|
-
key: any;
|
|
9
|
-
children: any;
|
|
10
|
-
disabled: boolean;
|
|
11
|
-
}[];
|
|
12
4
|
declare const _default: {
|
|
13
5
|
title: string;
|
|
14
6
|
type: string;
|
|
@@ -44,9 +36,6 @@ declare const _default: {
|
|
|
44
36
|
title: string;
|
|
45
37
|
'x-decorator': string;
|
|
46
38
|
'x-component': string;
|
|
47
|
-
'x-component-props': {
|
|
48
|
-
scope: string;
|
|
49
|
-
};
|
|
50
39
|
"x-validator"(value: any, rules: any, { form }: {
|
|
51
40
|
form: any;
|
|
52
41
|
}): string;
|
|
@@ -75,7 +64,7 @@ declare const _default: {
|
|
|
75
64
|
'x-decorator': string;
|
|
76
65
|
'x-component': string;
|
|
77
66
|
'x-component-props': {
|
|
78
|
-
|
|
67
|
+
changeOnSelect: boolean;
|
|
79
68
|
};
|
|
80
69
|
'x-reactions': {
|
|
81
70
|
dependencies: string[];
|
|
@@ -89,11 +78,11 @@ declare const _default: {
|
|
|
89
78
|
};
|
|
90
79
|
view: {};
|
|
91
80
|
scope: {
|
|
92
|
-
useWorkflowVariableOptions: typeof useWorkflowVariableOptions;
|
|
93
|
-
useWorkflowVariableEntityOptions: typeof useWorkflowVariableEntityOptions;
|
|
94
81
|
renderEngineReference: (key: string) => React.JSX.Element;
|
|
95
82
|
};
|
|
96
83
|
components: {
|
|
84
|
+
CalculationExpression(props: any): React.JSX.Element;
|
|
85
|
+
ScopeSelect(props: any): React.JSX.Element;
|
|
97
86
|
CalculationResult({ dataSource }: {
|
|
98
87
|
dataSource: any;
|
|
99
88
|
}): string | React.JSX.Element;
|
|
@@ -103,7 +92,13 @@ declare const _default: {
|
|
|
103
92
|
onChange: any;
|
|
104
93
|
}) => React.JSX.Element;
|
|
105
94
|
};
|
|
106
|
-
useVariables(
|
|
95
|
+
useVariables({ id, title }: {
|
|
96
|
+
id: any;
|
|
97
|
+
title: any;
|
|
98
|
+
}, options: any): {
|
|
99
|
+
value: any;
|
|
100
|
+
label: any;
|
|
101
|
+
};
|
|
107
102
|
useInitializers(node: any): SchemaInitializerItemOptions;
|
|
108
103
|
};
|
|
109
104
|
export default _default;
|
|
@@ -67,13 +67,20 @@ var _locale = require("../locale");
|
|
|
67
67
|
var _variable = require("../variable");
|
|
68
68
|
var _ValueBlock = require("../components/ValueBlock");
|
|
69
69
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
70
|
+
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; }
|
|
71
|
+
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; }
|
|
72
|
+
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; }
|
|
73
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
74
|
+
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); }
|
|
70
75
|
function useDynamicExpressionCollectionFieldMatcher(field) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
if (field.type !== 'belongsTo') {
|
|
76
|
+
var _this$getCollection;
|
|
77
|
+
if (!['belongsTo', 'hasOne'].includes(field.type)) {
|
|
74
78
|
return false;
|
|
75
79
|
}
|
|
76
|
-
|
|
80
|
+
if (((_this$getCollection = this.getCollection(field.collectionName)) === null || _this$getCollection === void 0 ? void 0 : _this$getCollection.template) === 'expression') {
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
const fields = this.getCollectionFields(field.target);
|
|
77
84
|
return fields.some(f => f.interface === 'expression');
|
|
78
85
|
}
|
|
79
86
|
const DynamicConfig = ({
|
|
@@ -82,8 +89,14 @@ const DynamicConfig = ({
|
|
|
82
89
|
}) => {
|
|
83
90
|
const _useTranslation = (0, _reactI18next().useTranslation)(),
|
|
84
91
|
t = _useTranslation.t;
|
|
92
|
+
const _useCollectionManager = (0, _client().useCollectionManager)(),
|
|
93
|
+
getCollectionFields = _useCollectionManager.getCollectionFields,
|
|
94
|
+
getCollection = _useCollectionManager.getCollection;
|
|
85
95
|
const scope = (0, _variable.useWorkflowVariableOptions)({
|
|
86
|
-
types: [useDynamicExpressionCollectionFieldMatcher
|
|
96
|
+
types: [useDynamicExpressionCollectionFieldMatcher.bind({
|
|
97
|
+
getCollectionFields,
|
|
98
|
+
getCollection
|
|
99
|
+
})]
|
|
87
100
|
});
|
|
88
101
|
return _react().default.createElement(_antd().FormLayout, {
|
|
89
102
|
layout: "vertical"
|
|
@@ -118,17 +131,6 @@ const DynamicConfig = ({
|
|
|
118
131
|
scope: scope
|
|
119
132
|
})) : null);
|
|
120
133
|
};
|
|
121
|
-
function useWorkflowVariableEntityOptions() {
|
|
122
|
-
return (0, _variable.useWorkflowVariableOptions)({
|
|
123
|
-
types: [{
|
|
124
|
-
type: 'reference',
|
|
125
|
-
options: {
|
|
126
|
-
collection: '*',
|
|
127
|
-
entity: true
|
|
128
|
-
}
|
|
129
|
-
}]
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
134
|
var _default = {
|
|
133
135
|
title: `{{t("Calculation", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
134
136
|
type: 'calculation',
|
|
@@ -164,10 +166,13 @@ var _default = {
|
|
|
164
166
|
type: 'string',
|
|
165
167
|
title: `{{t("Calculation expression", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
166
168
|
'x-decorator': 'FormItem',
|
|
167
|
-
'x-component': '
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
169
|
+
'x-component': 'CalculationExpression',
|
|
170
|
+
// NOTE: can not use Variable.Input and scope directly as below,
|
|
171
|
+
// because the scope will be cached.
|
|
172
|
+
// 'x-component': 'Variable.Input',
|
|
173
|
+
// 'x-component-props': {
|
|
174
|
+
// scope: '{{useWorkflowVariableOptions()}}',
|
|
175
|
+
// },
|
|
171
176
|
['x-validator'](value, rules, {
|
|
172
177
|
form
|
|
173
178
|
}) {
|
|
@@ -203,15 +208,15 @@ var _default = {
|
|
|
203
208
|
type: 'string',
|
|
204
209
|
title: `{{t("Variable datasource", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
205
210
|
'x-decorator': 'FormItem',
|
|
206
|
-
'x-component': '
|
|
211
|
+
'x-component': 'ScopeSelect',
|
|
207
212
|
'x-component-props': {
|
|
208
|
-
|
|
213
|
+
changeOnSelect: true
|
|
209
214
|
},
|
|
210
215
|
'x-reactions': {
|
|
211
216
|
dependencies: ['dynamic'],
|
|
212
217
|
fulfill: {
|
|
213
218
|
state: {
|
|
214
|
-
visible: '{{$deps[0]
|
|
219
|
+
visible: '{{$deps[0]}}'
|
|
215
220
|
}
|
|
216
221
|
}
|
|
217
222
|
}
|
|
@@ -219,11 +224,29 @@ var _default = {
|
|
|
219
224
|
},
|
|
220
225
|
view: {},
|
|
221
226
|
scope: {
|
|
222
|
-
useWorkflowVariableOptions: _variable.useWorkflowVariableOptions,
|
|
223
|
-
useWorkflowVariableEntityOptions,
|
|
224
227
|
renderEngineReference: _renderEngineReference.renderEngineReference
|
|
225
228
|
},
|
|
226
229
|
components: {
|
|
230
|
+
CalculationExpression(props) {
|
|
231
|
+
const scope = (0, _variable.useWorkflowVariableOptions)();
|
|
232
|
+
return _react().default.createElement(_client().Variable.TextArea, _objectSpread({
|
|
233
|
+
scope: scope
|
|
234
|
+
}, props));
|
|
235
|
+
},
|
|
236
|
+
ScopeSelect(props) {
|
|
237
|
+
const scope = (0, _variable.useWorkflowVariableOptions)({
|
|
238
|
+
types: [{
|
|
239
|
+
type: 'reference',
|
|
240
|
+
options: {
|
|
241
|
+
collection: '*',
|
|
242
|
+
entity: true
|
|
243
|
+
}
|
|
244
|
+
}]
|
|
245
|
+
});
|
|
246
|
+
return _react().default.createElement(_client().Variable.Input, _objectSpread({
|
|
247
|
+
scope: scope
|
|
248
|
+
}, props));
|
|
249
|
+
},
|
|
227
250
|
CalculationResult({
|
|
228
251
|
dataSource
|
|
229
252
|
}) {
|
|
@@ -247,15 +270,19 @@ var _default = {
|
|
|
247
270
|
RadioWithTooltip: _RadioWithTooltip.RadioWithTooltip,
|
|
248
271
|
DynamicConfig
|
|
249
272
|
},
|
|
250
|
-
useVariables(
|
|
273
|
+
useVariables({
|
|
274
|
+
id,
|
|
275
|
+
title
|
|
276
|
+
}, options) {
|
|
251
277
|
const _ref = options !== null && options !== void 0 ? options : {},
|
|
252
278
|
types = _ref.types;
|
|
253
279
|
if (types && !types.some(type => type in _variable.BaseTypeSets || Object.values(_variable.BaseTypeSets).some(set => set.has(type)))) {
|
|
254
280
|
return null;
|
|
255
281
|
}
|
|
256
|
-
return
|
|
257
|
-
|
|
258
|
-
|
|
282
|
+
return {
|
|
283
|
+
value: id,
|
|
284
|
+
label: title
|
|
285
|
+
};
|
|
259
286
|
},
|
|
260
287
|
useInitializers(node) {
|
|
261
288
|
var _node$title;
|
|
@@ -64,9 +64,6 @@ declare const _default: {
|
|
|
64
64
|
title: string;
|
|
65
65
|
'x-decorator': string;
|
|
66
66
|
'x-component': string;
|
|
67
|
-
'x-component-props': {
|
|
68
|
-
scope: string;
|
|
69
|
-
};
|
|
70
67
|
"x-validator"(value: any, rules: any, { form }: {
|
|
71
68
|
form: any;
|
|
72
69
|
}): string;
|
|
@@ -101,6 +98,7 @@ declare const _default: {
|
|
|
101
98
|
};
|
|
102
99
|
components: {
|
|
103
100
|
CalculationConfig: typeof CalculationConfig;
|
|
101
|
+
CalculationExpression(props: any): React.JSX.Element;
|
|
104
102
|
RadioWithTooltip: typeof RadioWithTooltip;
|
|
105
103
|
};
|
|
106
104
|
};
|
|
@@ -432,10 +432,7 @@ var _default = {
|
|
|
432
432
|
type: 'string',
|
|
433
433
|
title: `{{t("Condition expression", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
434
434
|
'x-decorator': 'FormItem',
|
|
435
|
-
'x-component': '
|
|
436
|
-
'x-component-props': {
|
|
437
|
-
scope: '{{useWorkflowVariableOptions}}'
|
|
438
|
-
},
|
|
435
|
+
'x-component': 'CalculationExpression',
|
|
439
436
|
['x-validator'](value, rules, {
|
|
440
437
|
form
|
|
441
438
|
}) {
|
|
@@ -540,6 +537,12 @@ var _default = {
|
|
|
540
537
|
},
|
|
541
538
|
components: {
|
|
542
539
|
CalculationConfig,
|
|
540
|
+
CalculationExpression(props) {
|
|
541
|
+
const scope = (0, _variable.useWorkflowVariableOptions)();
|
|
542
|
+
return _react().default.createElement(_client().Variable.TextArea, _objectSpread({
|
|
543
|
+
scope: scope
|
|
544
|
+
}, props));
|
|
545
|
+
},
|
|
543
546
|
RadioWithTooltip: _RadioWithTooltip.RadioWithTooltip
|
|
544
547
|
}
|
|
545
548
|
};
|
|
@@ -61,9 +61,11 @@ declare const _default: {
|
|
|
61
61
|
CollectionFieldset: import("react").MemoExoticComponent<import("@formily/reactive-react").ReactFC<Pick<any, string | number | symbol>>>;
|
|
62
62
|
FieldsSelect: import("react").MemoExoticComponent<import("@formily/reactive-react").ReactFC<Pick<any, string | number | symbol>>>;
|
|
63
63
|
};
|
|
64
|
-
useVariables({ config }: {
|
|
64
|
+
useVariables({ id, title, config }: {
|
|
65
|
+
id: any;
|
|
66
|
+
title: any;
|
|
65
67
|
config: any;
|
|
66
|
-
}, options: any): import("../variable").VariableOption
|
|
68
|
+
}, options: any): import("../variable").VariableOption;
|
|
67
69
|
useInitializers(node: any): SchemaInitializerItemOptions | null;
|
|
68
70
|
initializers: {};
|
|
69
71
|
};
|
|
@@ -23,6 +23,12 @@ 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
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
27
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
28
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
29
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
30
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
31
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
26
32
|
var _default = {
|
|
27
33
|
title: `{{t("Create record", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
28
34
|
type: 'create',
|
|
@@ -57,15 +63,36 @@ var _default = {
|
|
|
57
63
|
FieldsSelect: _FieldsSelect.FieldsSelect
|
|
58
64
|
},
|
|
59
65
|
useVariables({
|
|
66
|
+
id,
|
|
67
|
+
title,
|
|
60
68
|
config
|
|
61
69
|
}, options) {
|
|
62
|
-
var
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
70
|
+
var _config$params, _config$params$append;
|
|
71
|
+
const compile = (0, _client().useCompile)();
|
|
72
|
+
const _useCollectionManager = (0, _client().useCollectionManager)(),
|
|
73
|
+
getCollectionFields = _useCollectionManager.getCollectionFields;
|
|
74
|
+
// const depth = config?.params?.appends?.length
|
|
75
|
+
// ? config?.params?.appends.reduce((max, item) => Math.max(max, item.split('.').length), 1)
|
|
76
|
+
// : 0;
|
|
77
|
+
const name = `${id}`;
|
|
78
|
+
const _getCollectionFieldOp = (0, _variable.getCollectionFieldOptions)(_objectSpread(_objectSpread({}, options), {}, {
|
|
79
|
+
fields: [{
|
|
80
|
+
collectionName: config.collection,
|
|
81
|
+
name,
|
|
82
|
+
type: 'hasOne',
|
|
83
|
+
target: config.collection,
|
|
84
|
+
uiSchema: {
|
|
85
|
+
title
|
|
86
|
+
}
|
|
87
|
+
}],
|
|
88
|
+
// depth: options?.depth ?? depth,
|
|
89
|
+
appends: [name, ...(((_config$params = config.params) === null || _config$params === void 0 ? void 0 : (_config$params$append = _config$params.appends) === null || _config$params$append === void 0 ? void 0 : _config$params$append.map(item => `${name}.${item}`)) || [])],
|
|
90
|
+
compile,
|
|
91
|
+
getCollectionFields
|
|
92
|
+
})),
|
|
93
|
+
_getCollectionFieldOp2 = _slicedToArray(_getCollectionFieldOp, 1),
|
|
94
|
+
result = _getCollectionFieldOp2[0];
|
|
95
|
+
return result;
|
|
69
96
|
},
|
|
70
97
|
useInitializers(node) {
|
|
71
98
|
var _node$title;
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { ISchema } from '@formily/react';
|
|
3
3
|
import { Registry } from '@nocobase/utils/client';
|
|
4
4
|
import { SchemaInitializerItemOptions } from '@nocobase/client';
|
|
5
|
-
import { VariableOptions } from '../variable';
|
|
5
|
+
import { VariableOption, VariableOptions } from '../variable';
|
|
6
6
|
export interface Instruction {
|
|
7
7
|
title: string;
|
|
8
8
|
type: string;
|
|
@@ -25,7 +25,7 @@ export interface Instruction {
|
|
|
25
25
|
};
|
|
26
26
|
component?(props: any): JSX.Element;
|
|
27
27
|
endding?: boolean;
|
|
28
|
-
useVariables?(node: any, options?: any):
|
|
28
|
+
useVariables?(node: any, options?: any): VariableOption;
|
|
29
29
|
useScopeVariables?(node: any, options?: any): VariableOptions;
|
|
30
30
|
useInitializers?(node: any): SchemaInitializerItemOptions | null;
|
|
31
31
|
initializers?: {
|
package/lib/client/nodes/loop.js
CHANGED
|
@@ -66,8 +66,20 @@ var _default = {
|
|
|
66
66
|
'x-decorator': 'FormItem',
|
|
67
67
|
'x-component': 'Variable.Input',
|
|
68
68
|
'x-component-props': {
|
|
69
|
-
scope: '{{useWorkflowVariableOptions}}',
|
|
70
|
-
|
|
69
|
+
scope: '{{useWorkflowVariableOptions()}}',
|
|
70
|
+
changeOnSelect: true,
|
|
71
|
+
useTypedConstant: ['string', 'number', 'null'],
|
|
72
|
+
className: (0, _css().css)`
|
|
73
|
+
width: 100%;
|
|
74
|
+
|
|
75
|
+
.variable {
|
|
76
|
+
flex: 1;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.ant-input.null-value {
|
|
80
|
+
width: 100%;
|
|
81
|
+
}
|
|
82
|
+
`
|
|
71
83
|
},
|
|
72
84
|
required: true
|
|
73
85
|
}
|
|
@@ -628,6 +628,7 @@ function Drawer() {
|
|
|
628
628
|
}));
|
|
629
629
|
}
|
|
630
630
|
function Decorator({
|
|
631
|
+
params = {},
|
|
631
632
|
children
|
|
632
633
|
}) {
|
|
633
634
|
const _useCollectionManager = (0, _client().useCollectionManager)(),
|
|
@@ -637,12 +638,13 @@ function Decorator({
|
|
|
637
638
|
collection: 'users_jobs',
|
|
638
639
|
resource: 'users_jobs',
|
|
639
640
|
action: 'list',
|
|
640
|
-
params: {
|
|
641
|
+
params: _objectSpread(_objectSpread({
|
|
641
642
|
pageSize: 20,
|
|
642
|
-
sort: ['-createdAt']
|
|
643
|
+
sort: ['-createdAt']
|
|
644
|
+
}, params), {}, {
|
|
643
645
|
appends: ['user', 'node', 'workflow'],
|
|
644
646
|
except: ['node.config', 'workflow.config']
|
|
645
|
-
},
|
|
647
|
+
}),
|
|
646
648
|
rowKey: 'id',
|
|
647
649
|
showIndex: true,
|
|
648
650
|
dragSort: false
|
|
@@ -58,17 +58,23 @@ declare const _default: {
|
|
|
58
58
|
ModeConfig: typeof ModeConfig;
|
|
59
59
|
AssigneesSelect: typeof AssigneesSelect;
|
|
60
60
|
};
|
|
61
|
-
useVariables({ config }: {
|
|
61
|
+
useVariables({ id, title, config }: {
|
|
62
|
+
id: any;
|
|
63
|
+
title: any;
|
|
62
64
|
config: any;
|
|
63
65
|
}, { types }: {
|
|
64
66
|
types: any;
|
|
65
67
|
}): {
|
|
66
|
-
key: string;
|
|
67
68
|
value: string;
|
|
68
69
|
label: any;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
children: {
|
|
71
|
+
key: string;
|
|
72
|
+
value: string;
|
|
73
|
+
label: any;
|
|
74
|
+
title: any;
|
|
75
|
+
children: import("../../variable").VariableOption[];
|
|
76
|
+
}[];
|
|
77
|
+
};
|
|
72
78
|
useInitializers(node: any): SchemaInitializerItemOptions | null;
|
|
73
79
|
initializers: {};
|
|
74
80
|
};
|
|
@@ -94,11 +94,16 @@ var _default = {
|
|
|
94
94
|
AssigneesSelect: _AssigneesSelect.AssigneesSelect
|
|
95
95
|
},
|
|
96
96
|
useVariables({
|
|
97
|
+
id,
|
|
98
|
+
title,
|
|
97
99
|
config
|
|
98
100
|
}, {
|
|
99
101
|
types
|
|
100
102
|
}) {
|
|
101
103
|
var _config$forms;
|
|
104
|
+
const compile = (0, _client().useCompile)();
|
|
105
|
+
const _useCollectionManager = (0, _client().useCollectionManager)(),
|
|
106
|
+
getCollectionFields = _useCollectionManager.getCollectionFields;
|
|
102
107
|
const formKeys = Object.keys((_config$forms = config.forms) !== null && _config$forms !== void 0 ? _config$forms : {});
|
|
103
108
|
if (!formKeys.length) {
|
|
104
109
|
return null;
|
|
@@ -106,26 +111,32 @@ var _default = {
|
|
|
106
111
|
const options = formKeys.map(formKey => {
|
|
107
112
|
var _form$collection;
|
|
108
113
|
const form = config.forms[formKey];
|
|
109
|
-
|
|
110
|
-
const options = (0, _variable.useCollectionFieldOptions)({
|
|
114
|
+
const fieldsOptions = (0, _variable.getCollectionFieldOptions)({
|
|
111
115
|
fields: (_form$collection = form.collection) === null || _form$collection === void 0 ? void 0 : _form$collection.fields,
|
|
112
116
|
collection: form.collection,
|
|
113
|
-
types
|
|
117
|
+
types,
|
|
118
|
+
compile,
|
|
119
|
+
getCollectionFields
|
|
114
120
|
});
|
|
115
|
-
|
|
121
|
+
const label = compile(form.title) || formKey;
|
|
122
|
+
return fieldsOptions.length ? {
|
|
116
123
|
key: formKey,
|
|
117
124
|
value: formKey,
|
|
118
|
-
label
|
|
119
|
-
title:
|
|
120
|
-
children:
|
|
125
|
+
label,
|
|
126
|
+
title: label,
|
|
127
|
+
children: fieldsOptions
|
|
121
128
|
} : null;
|
|
122
129
|
}).filter(Boolean);
|
|
123
|
-
return options.length ?
|
|
130
|
+
return options.length ? {
|
|
131
|
+
value: `${id}`,
|
|
132
|
+
label: title,
|
|
133
|
+
children: options
|
|
134
|
+
} : null;
|
|
124
135
|
},
|
|
125
136
|
useInitializers(node) {
|
|
126
137
|
var _node$config$forms;
|
|
127
|
-
const
|
|
128
|
-
getCollection =
|
|
138
|
+
const _useCollectionManager2 = (0, _client().useCollectionManager)(),
|
|
139
|
+
getCollection = _useCollectionManager2.getCollection;
|
|
129
140
|
const formKeys = Object.keys((_node$config$forms = node.config.forms) !== null && _node$config$forms !== void 0 ? _node$config$forms : {});
|
|
130
141
|
if (!formKeys.length || node.config.mode) {
|
|
131
142
|
return null;
|
|
@@ -77,9 +77,11 @@ declare const _default: {
|
|
|
77
77
|
FilterDynamicComponent: typeof FilterDynamicComponent;
|
|
78
78
|
FieldsSelect: import("react").MemoExoticComponent<import("@formily/reactive-react").ReactFC<Pick<any, string | number | symbol>>>;
|
|
79
79
|
};
|
|
80
|
-
useVariables({ config }: {
|
|
80
|
+
useVariables({ id, title, config }: {
|
|
81
|
+
id: any;
|
|
82
|
+
title: any;
|
|
81
83
|
config: any;
|
|
82
|
-
}, options: any): import("../variable").VariableOption
|
|
84
|
+
}, options: any): import("../variable").VariableOption;
|
|
83
85
|
useInitializers(node: any): SchemaInitializerItemOptions | null;
|
|
84
86
|
initializers: {};
|
|
85
87
|
};
|
|
@@ -22,6 +22,12 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
22
22
|
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; }
|
|
23
23
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
24
24
|
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); }
|
|
25
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
26
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
27
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
28
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
29
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
30
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
25
31
|
var _default = {
|
|
26
32
|
title: `{{t("Query record", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
27
33
|
type: 'query',
|
|
@@ -59,15 +65,36 @@ var _default = {
|
|
|
59
65
|
FieldsSelect: _FieldsSelect.FieldsSelect
|
|
60
66
|
},
|
|
61
67
|
useVariables({
|
|
68
|
+
id,
|
|
69
|
+
title,
|
|
62
70
|
config
|
|
63
71
|
}, options) {
|
|
64
|
-
var
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
72
|
+
var _config$params, _config$params$append;
|
|
73
|
+
const compile = (0, _client().useCompile)();
|
|
74
|
+
const _useCollectionManager = (0, _client().useCollectionManager)(),
|
|
75
|
+
getCollectionFields = _useCollectionManager.getCollectionFields;
|
|
76
|
+
// const depth = config?.params?.appends?.length
|
|
77
|
+
// ? config?.params?.appends.reduce((max, item) => Math.max(max, item.split('.').length), 1)
|
|
78
|
+
// : 0;
|
|
79
|
+
const name = `${id}`;
|
|
80
|
+
const _getCollectionFieldOp = (0, _variable.getCollectionFieldOptions)(_objectSpread(_objectSpread({}, options), {}, {
|
|
81
|
+
fields: [{
|
|
82
|
+
collectionName: config.collection,
|
|
83
|
+
name,
|
|
84
|
+
type: 'hasOne',
|
|
85
|
+
target: config.collection,
|
|
86
|
+
uiSchema: {
|
|
87
|
+
title
|
|
88
|
+
}
|
|
89
|
+
}],
|
|
90
|
+
// depth: options?.depth ?? depth,
|
|
91
|
+
appends: [name, ...(((_config$params = config.params) === null || _config$params === void 0 ? void 0 : (_config$params$append = _config$params.appends) === null || _config$params$append === void 0 ? void 0 : _config$params$append.map(item => `${name}.${item}`)) || [])],
|
|
92
|
+
compile,
|
|
93
|
+
getCollectionFields
|
|
94
|
+
})),
|
|
95
|
+
_getCollectionFieldOp2 = _slicedToArray(_getCollectionFieldOp, 1),
|
|
96
|
+
result = _getCollectionFieldOp2[0];
|
|
97
|
+
return result;
|
|
71
98
|
},
|
|
72
99
|
useInitializers(node) {
|
|
73
100
|
var _node$title;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { useWorkflowVariableOptions } from '../variable';
|
|
2
3
|
declare const _default: {
|
|
3
4
|
title: string;
|
|
@@ -59,7 +60,7 @@ declare const _default: {
|
|
|
59
60
|
'x-decorator': string;
|
|
60
61
|
'x-component': string;
|
|
61
62
|
'x-component-props': {
|
|
62
|
-
scope:
|
|
63
|
+
scope: string;
|
|
63
64
|
useTypedConstant: boolean;
|
|
64
65
|
};
|
|
65
66
|
};
|
|
@@ -105,7 +106,7 @@ declare const _default: {
|
|
|
105
106
|
'x-decorator': string;
|
|
106
107
|
'x-component': string;
|
|
107
108
|
'x-component-props': {
|
|
108
|
-
scope:
|
|
109
|
+
scope: string;
|
|
109
110
|
useTypedConstant: boolean;
|
|
110
111
|
};
|
|
111
112
|
};
|
|
@@ -133,7 +134,7 @@ declare const _default: {
|
|
|
133
134
|
'x-decorator-props': {};
|
|
134
135
|
'x-component': string;
|
|
135
136
|
'x-component-props': {
|
|
136
|
-
|
|
137
|
+
changeOnSelect: boolean;
|
|
137
138
|
autoSize: {
|
|
138
139
|
minRows: number;
|
|
139
140
|
};
|
|
@@ -163,13 +164,16 @@ declare const _default: {
|
|
|
163
164
|
};
|
|
164
165
|
};
|
|
165
166
|
view: {};
|
|
166
|
-
scope: {
|
|
167
|
+
scope: {
|
|
168
|
+
useWorkflowVariableOptions: typeof useWorkflowVariableOptions;
|
|
169
|
+
};
|
|
167
170
|
components: {
|
|
168
|
-
ArrayItems:
|
|
169
|
-
Item?:
|
|
171
|
+
ArrayItems: React.FC<React.PropsWithChildren<React.HTMLAttributes<HTMLDivElement> & import("@formily/antd").IArrayBaseProps>> & import("@formily/antd").ArrayBaseMixins & {
|
|
172
|
+
Item?: React.FC<React.HTMLAttributes<HTMLDivElement> & {
|
|
170
173
|
type?: "divide" | "card";
|
|
171
174
|
}>;
|
|
172
175
|
};
|
|
176
|
+
RequestBody(props: any): React.JSX.Element;
|
|
173
177
|
};
|
|
174
178
|
};
|
|
175
179
|
export default _default;
|
|
@@ -4,6 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
+
function _react() {
|
|
8
|
+
const data = _interopRequireDefault(require("react"));
|
|
9
|
+
_react = function _react() {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
7
14
|
function _antd() {
|
|
8
15
|
const data = require("@formily/antd");
|
|
9
16
|
_antd = function _antd() {
|
|
@@ -11,8 +18,21 @@ function _antd() {
|
|
|
11
18
|
};
|
|
12
19
|
return data;
|
|
13
20
|
}
|
|
21
|
+
function _client() {
|
|
22
|
+
const data = require("@nocobase/client");
|
|
23
|
+
_client = function _client() {
|
|
24
|
+
return data;
|
|
25
|
+
};
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
14
28
|
var _locale = require("../locale");
|
|
15
29
|
var _variable = require("../variable");
|
|
30
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
31
|
+
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; }
|
|
32
|
+
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; }
|
|
33
|
+
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; }
|
|
34
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
35
|
+
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); }
|
|
16
36
|
var _default = {
|
|
17
37
|
title: `{{t("HTTP request", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
18
38
|
type: 'request',
|
|
@@ -85,7 +105,7 @@ var _default = {
|
|
|
85
105
|
'x-decorator': 'FormItem',
|
|
86
106
|
'x-component': 'Variable.Input',
|
|
87
107
|
'x-component-props': {
|
|
88
|
-
scope:
|
|
108
|
+
scope: '{{useWorkflowVariableOptions()}}',
|
|
89
109
|
useTypedConstant: true
|
|
90
110
|
}
|
|
91
111
|
},
|
|
@@ -131,7 +151,7 @@ var _default = {
|
|
|
131
151
|
'x-decorator': 'FormItem',
|
|
132
152
|
'x-component': 'Variable.Input',
|
|
133
153
|
'x-component-props': {
|
|
134
|
-
scope:
|
|
154
|
+
scope: '{{useWorkflowVariableOptions()}}',
|
|
135
155
|
useTypedConstant: true
|
|
136
156
|
}
|
|
137
157
|
},
|
|
@@ -157,9 +177,9 @@ var _default = {
|
|
|
157
177
|
title: `{{t("Body", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
158
178
|
'x-decorator': 'FormItem',
|
|
159
179
|
'x-decorator-props': {},
|
|
160
|
-
'x-component': '
|
|
180
|
+
'x-component': 'RequestBody',
|
|
161
181
|
'x-component-props': {
|
|
162
|
-
|
|
182
|
+
changeOnSelect: true,
|
|
163
183
|
autoSize: {
|
|
164
184
|
minRows: 10
|
|
165
185
|
},
|
|
@@ -189,9 +209,17 @@ var _default = {
|
|
|
189
209
|
}
|
|
190
210
|
},
|
|
191
211
|
view: {},
|
|
192
|
-
scope: {
|
|
212
|
+
scope: {
|
|
213
|
+
useWorkflowVariableOptions: _variable.useWorkflowVariableOptions
|
|
214
|
+
},
|
|
193
215
|
components: {
|
|
194
|
-
ArrayItems: _antd().ArrayItems
|
|
216
|
+
ArrayItems: _antd().ArrayItems,
|
|
217
|
+
RequestBody(props) {
|
|
218
|
+
const scope = (0, _variable.useWorkflowVariableOptions)();
|
|
219
|
+
return _react().default.createElement(_client().Variable.JSON, _objectSpread({
|
|
220
|
+
scope: scope
|
|
221
|
+
}, props));
|
|
222
|
+
}
|
|
195
223
|
}
|
|
196
224
|
};
|
|
197
225
|
exports.default = _default;
|
|
@@ -61,6 +61,14 @@ var _default = {
|
|
|
61
61
|
value: null
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
+
}, {
|
|
65
|
+
target: 'appends',
|
|
66
|
+
effects: ['onFieldValueChange'],
|
|
67
|
+
fulfill: {
|
|
68
|
+
state: {
|
|
69
|
+
value: []
|
|
70
|
+
}
|
|
71
|
+
}
|
|
64
72
|
}]
|
|
65
73
|
}),
|
|
66
74
|
mode: {
|
|
@@ -134,21 +142,27 @@ var _default = {
|
|
|
134
142
|
FieldsSelect: _FieldsSelect.FieldsSelect
|
|
135
143
|
},
|
|
136
144
|
useVariables(config, options) {
|
|
137
|
-
var
|
|
138
|
-
const
|
|
139
|
-
|
|
145
|
+
var _config$appends;
|
|
146
|
+
const compile = (0, _client().useCompile)();
|
|
147
|
+
const _useCollectionManager = (0, _client().useCollectionManager)(),
|
|
148
|
+
getCollectionFields = _useCollectionManager.getCollectionFields;
|
|
140
149
|
const rootFields = [{
|
|
141
150
|
collectionName: config.collection,
|
|
142
151
|
name: 'data',
|
|
143
152
|
type: 'hasOne',
|
|
144
153
|
target: config.collection,
|
|
145
154
|
uiSchema: {
|
|
146
|
-
title:
|
|
155
|
+
title: (0, _locale.lang)('Trigger data')
|
|
147
156
|
}
|
|
148
157
|
}];
|
|
149
|
-
const
|
|
158
|
+
// const depth = config.appends?.length
|
|
159
|
+
// ? config.appends.reduce((max, item) => Math.max(max, item.split('.').length), 1) + 1
|
|
160
|
+
// : 1;
|
|
161
|
+
const result = (0, _variable.getCollectionFieldOptions)(_objectSpread(_objectSpread({}, options), {}, {
|
|
150
162
|
fields: rootFields,
|
|
151
|
-
|
|
163
|
+
appends: ['data', ...(((_config$appends = config.appends) === null || _config$appends === void 0 ? void 0 : _config$appends.map(item => `data.${item}`)) || [])],
|
|
164
|
+
compile,
|
|
165
|
+
getCollectionFields
|
|
152
166
|
}));
|
|
153
167
|
return result;
|
|
154
168
|
},
|
|
@@ -201,6 +201,7 @@ const TriggerConfig = () => {
|
|
|
201
201
|
}
|
|
202
202
|
}, [workflow]);
|
|
203
203
|
const form = (0, _react().useMemo)(() => (0, _core().createForm)({
|
|
204
|
+
initialValues: workflow === null || workflow === void 0 ? void 0 : workflow.config,
|
|
204
205
|
values: workflow === null || workflow === void 0 ? void 0 : workflow.config,
|
|
205
206
|
disabled: workflow === null || workflow === void 0 ? void 0 : workflow.executed
|
|
206
207
|
}), [workflow]);
|
|
@@ -16,9 +16,7 @@ declare const _default: {
|
|
|
16
16
|
ScheduleConfig: () => import("react").JSX.Element;
|
|
17
17
|
FieldsSelect: import("react").MemoExoticComponent<import("@formily/reactive-react").ReactFC<Pick<any, string | number | symbol>>>;
|
|
18
18
|
};
|
|
19
|
-
useVariables(config: any,
|
|
20
|
-
types: any;
|
|
21
|
-
}): any[];
|
|
19
|
+
useVariables(config: any, opts: any): any[];
|
|
22
20
|
useInitializers(config: any): SchemaInitializerItemOptions | null;
|
|
23
21
|
initializers: {};
|
|
24
22
|
};
|
|
@@ -17,6 +17,11 @@ var _locale = require("../../locale");
|
|
|
17
17
|
var _CollectionBlockInitializer = require("../../components/CollectionBlockInitializer");
|
|
18
18
|
var _variable = require("../../variable");
|
|
19
19
|
var _FieldsSelect = require("../../components/FieldsSelect");
|
|
20
|
+
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; }
|
|
21
|
+
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; }
|
|
22
|
+
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; }
|
|
23
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
24
|
+
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); }
|
|
20
25
|
var _default = {
|
|
21
26
|
title: `{{t("Schedule event", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
22
27
|
type: 'schedule',
|
|
@@ -34,28 +39,33 @@ var _default = {
|
|
|
34
39
|
ScheduleConfig: _ScheduleConfig.ScheduleConfig,
|
|
35
40
|
FieldsSelect: _FieldsSelect.FieldsSelect
|
|
36
41
|
},
|
|
37
|
-
useVariables(config, {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
+
useVariables(config, opts) {
|
|
43
|
+
var _config$appends;
|
|
44
|
+
const compile = (0, _client().useCompile)();
|
|
45
|
+
const _useCollectionManager = (0, _client().useCollectionManager)(),
|
|
46
|
+
getCollectionFields = _useCollectionManager.getCollectionFields;
|
|
42
47
|
const options = [];
|
|
43
|
-
if (!types || types.includes('date')) {
|
|
48
|
+
if (!(opts === null || opts === void 0 ? void 0 : opts.types) || opts.types.includes('date')) {
|
|
44
49
|
options.push({
|
|
45
50
|
key: 'date',
|
|
46
51
|
value: 'date',
|
|
47
|
-
label:
|
|
52
|
+
label: (0, _locale.lang)('Trigger time')
|
|
48
53
|
});
|
|
49
54
|
}
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
55
|
+
const depth = ((_config$appends = config.appends) === null || _config$appends === void 0 ? void 0 : _config$appends.length) ? config.appends.reduce((max, item) => Math.max(max, item.split('.').length), 1) + 1 : 1;
|
|
56
|
+
const fieldOptions = (0, _variable.getCollectionFieldOptions)(_objectSpread(_objectSpread({
|
|
57
|
+
depth
|
|
58
|
+
}, opts), {}, {
|
|
59
|
+
collection: config.collection,
|
|
60
|
+
compile,
|
|
61
|
+
getCollectionFields
|
|
62
|
+
}));
|
|
53
63
|
if (config.mode === _constants.SCHEDULE_MODE.COLLECTION_FIELD) {
|
|
54
64
|
if (fieldOptions.length) {
|
|
55
65
|
options.push({
|
|
56
66
|
key: 'data',
|
|
57
67
|
value: 'data',
|
|
58
|
-
label:
|
|
68
|
+
label: (0, _locale.lang)('Trigger data'),
|
|
59
69
|
children: fieldOptions
|
|
60
70
|
});
|
|
61
71
|
}
|
package/lib/client/variable.d.ts
CHANGED
|
@@ -37,7 +37,6 @@ export declare const BaseTypeSets: {
|
|
|
37
37
|
string: Set<string>;
|
|
38
38
|
date: Set<string>;
|
|
39
39
|
};
|
|
40
|
-
export declare function filterTypedFields(fields: any, types: any, depth?: number): any;
|
|
41
40
|
export declare function useWorkflowVariableOptions(options?: {}): {
|
|
42
41
|
label: any;
|
|
43
42
|
value: any;
|
|
@@ -45,4 +44,4 @@ export declare function useWorkflowVariableOptions(options?: {}): {
|
|
|
45
44
|
children: any;
|
|
46
45
|
disabled: boolean;
|
|
47
46
|
}[];
|
|
48
|
-
export declare function
|
|
47
|
+
export declare function getCollectionFieldOptions(options: any): VariableOption[];
|
package/lib/client/variable.js
CHANGED
|
@@ -4,9 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.BaseTypeSets = void 0;
|
|
7
|
-
exports.
|
|
7
|
+
exports.getCollectionFieldOptions = getCollectionFieldOptions;
|
|
8
8
|
exports.triggerOptions = exports.systemOptions = exports.scopeOptions = exports.nodesOptions = void 0;
|
|
9
|
-
exports.useCollectionFieldOptions = useCollectionFieldOptions;
|
|
10
9
|
exports.useWorkflowVariableOptions = useWorkflowVariableOptions;
|
|
11
10
|
function _client() {
|
|
12
11
|
const data = require("@nocobase/client");
|
|
@@ -19,6 +18,8 @@ var _FlowContext = require("./FlowContext");
|
|
|
19
18
|
var _locale = require("./locale");
|
|
20
19
|
var _nodes = require("./nodes");
|
|
21
20
|
var _triggers = require("./triggers");
|
|
21
|
+
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); } }
|
|
22
|
+
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); }); }; }
|
|
22
23
|
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; }
|
|
23
24
|
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; }
|
|
24
25
|
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; }
|
|
@@ -34,15 +35,9 @@ const nodesOptions = {
|
|
|
34
35
|
upstreams.forEach(node => {
|
|
35
36
|
var _instruction$useVaria;
|
|
36
37
|
const instruction = _nodes.instructions.get(node.type);
|
|
37
|
-
const
|
|
38
|
-
if (
|
|
39
|
-
|
|
40
|
-
result.push({
|
|
41
|
-
key: node.id.toString(),
|
|
42
|
-
value: node.id.toString(),
|
|
43
|
-
label: (_node$title = node.title) !== null && _node$title !== void 0 ? _node$title : `#${node.id}`,
|
|
44
|
-
children: subOptions
|
|
45
|
-
});
|
|
38
|
+
const subOption = (_instruction$useVaria = instruction.useVariables) === null || _instruction$useVaria === void 0 ? void 0 : _instruction$useVaria.call(instruction, node, options);
|
|
39
|
+
if (subOption) {
|
|
40
|
+
result.push(subOption);
|
|
46
41
|
}
|
|
47
42
|
});
|
|
48
43
|
return result;
|
|
@@ -73,11 +68,11 @@ const scopeOptions = {
|
|
|
73
68
|
const instruction = _nodes.instructions.get(node.type);
|
|
74
69
|
const subOptions = (_instruction$useScope = instruction.useScopeVariables) === null || _instruction$useScope === void 0 ? void 0 : _instruction$useScope.call(instruction, node, options);
|
|
75
70
|
if (subOptions) {
|
|
76
|
-
var _node$
|
|
71
|
+
var _node$title;
|
|
77
72
|
result.push({
|
|
78
73
|
key: node.id.toString(),
|
|
79
74
|
value: node.id.toString(),
|
|
80
|
-
label: (_node$
|
|
75
|
+
label: (_node$title = node.title) !== null && _node$title !== void 0 ? _node$title : `#${node.id}`,
|
|
81
76
|
children: subOptions
|
|
82
77
|
});
|
|
83
78
|
}
|
|
@@ -95,7 +90,7 @@ const systemOptions = {
|
|
|
95
90
|
return [...(!types || types.includes('date') ? [{
|
|
96
91
|
key: 'now',
|
|
97
92
|
value: 'now',
|
|
98
|
-
label:
|
|
93
|
+
label: (0, _locale.lang)('System time')
|
|
99
94
|
}] : [])];
|
|
100
95
|
}
|
|
101
96
|
};
|
|
@@ -110,7 +105,7 @@ const BaseTypeSets = {
|
|
|
110
105
|
// { type: 'reference', options: { collection: 'attachments', multiple: false } }
|
|
111
106
|
// { type: 'reference', options: { collection: 'myExpressions', entity: false } }
|
|
112
107
|
exports.BaseTypeSets = BaseTypeSets;
|
|
113
|
-
function matchFieldType(field, type,
|
|
108
|
+
function matchFieldType(field, type, appends) {
|
|
114
109
|
const inputType = typeof type;
|
|
115
110
|
if (inputType === 'string') {
|
|
116
111
|
var _BaseTypeSets$type;
|
|
@@ -128,42 +123,67 @@ function matchFieldType(field, type, depth) {
|
|
|
128
123
|
}
|
|
129
124
|
}
|
|
130
125
|
if (inputType === 'function') {
|
|
131
|
-
return type(field,
|
|
126
|
+
return type(field, appends);
|
|
132
127
|
}
|
|
133
128
|
return false;
|
|
134
129
|
}
|
|
135
130
|
function isAssociationField(field) {
|
|
136
131
|
return ['belongsTo', 'hasOne', 'hasMany', 'belongsToMany'].includes(field.type);
|
|
137
132
|
}
|
|
138
|
-
function
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
133
|
+
function getNextAppends(field, appends) {
|
|
134
|
+
const fieldPrefix = `${field.name}.`;
|
|
135
|
+
return appends.filter(item => item.startsWith(fieldPrefix)).map(item => item.replace(fieldPrefix, ''));
|
|
136
|
+
}
|
|
137
|
+
function filterTypedFields({
|
|
138
|
+
fields,
|
|
139
|
+
types,
|
|
140
|
+
appends,
|
|
141
|
+
compile,
|
|
142
|
+
getCollectionFields
|
|
143
|
+
}) {
|
|
142
144
|
return fields.filter(field => {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
+
const match = (types === null || types === void 0 ? void 0 : types.length) ? types.some(type => matchFieldType(field, type, appends)) : true;
|
|
146
|
+
if (isAssociationField(field)) {
|
|
147
|
+
const nextAppends = getNextAppends(field, appends);
|
|
148
|
+
const included = appends.includes(field.name);
|
|
149
|
+
if (match) {
|
|
150
|
+
return included;
|
|
151
|
+
} else {
|
|
152
|
+
return (nextAppends.length || included) && filterTypedFields({
|
|
153
|
+
fields: getNormalizedFields(field.target, {
|
|
154
|
+
compile,
|
|
155
|
+
getCollectionFields
|
|
156
|
+
}),
|
|
157
|
+
types,
|
|
158
|
+
// depth: depth - 1,
|
|
159
|
+
appends: nextAppends,
|
|
160
|
+
compile,
|
|
161
|
+
getCollectionFields
|
|
162
|
+
}).length;
|
|
163
|
+
}
|
|
164
|
+
} else {
|
|
165
|
+
return match;
|
|
145
166
|
}
|
|
146
|
-
return types.some(type => matchFieldType(field, type, depth));
|
|
147
167
|
});
|
|
148
168
|
}
|
|
149
169
|
function useWorkflowVariableOptions(options = {}) {
|
|
150
170
|
const compile = (0, _client().useCompile)();
|
|
151
171
|
const result = [scopeOptions, nodesOptions, triggerOptions, systemOptions].map(item => {
|
|
152
|
-
const opts =
|
|
172
|
+
const opts = item.useOptions(options).filter(Boolean);
|
|
153
173
|
return {
|
|
154
174
|
label: compile(item.label),
|
|
155
175
|
value: item.value,
|
|
156
176
|
key: item.value,
|
|
157
|
-
children:
|
|
177
|
+
children: opts,
|
|
158
178
|
disabled: opts && !opts.length
|
|
159
179
|
};
|
|
160
180
|
});
|
|
161
181
|
return result;
|
|
162
182
|
}
|
|
163
|
-
function
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
183
|
+
function getNormalizedFields(collectionName, {
|
|
184
|
+
compile,
|
|
185
|
+
getCollectionFields
|
|
186
|
+
}) {
|
|
167
187
|
const fields = getCollectionFields(collectionName);
|
|
168
188
|
const foreignKeyFields = [];
|
|
169
189
|
const otherFields = [];
|
|
@@ -211,28 +231,73 @@ function useNormalizedFields(collectionName) {
|
|
|
211
231
|
}
|
|
212
232
|
return otherFields.filter(field => field.interface && !field.hidden);
|
|
213
233
|
}
|
|
214
|
-
function
|
|
234
|
+
function loadChildren(_x) {
|
|
235
|
+
return _loadChildren.apply(this, arguments);
|
|
236
|
+
}
|
|
237
|
+
function _loadChildren() {
|
|
238
|
+
_loadChildren = _asyncToGenerator(function* (option) {
|
|
239
|
+
const result = getCollectionFieldOptions({
|
|
240
|
+
collection: option.field.target,
|
|
241
|
+
types: option.types,
|
|
242
|
+
appends: getNextAppends(option.field, option.appends),
|
|
243
|
+
sourceKey: option.field.key,
|
|
244
|
+
compile: this.compile,
|
|
245
|
+
getCollectionFields: this.getCollectionFields
|
|
246
|
+
});
|
|
247
|
+
if (result.length) {
|
|
248
|
+
option.children = result;
|
|
249
|
+
} else {
|
|
250
|
+
var _option$types;
|
|
251
|
+
option.isLeaf = true;
|
|
252
|
+
option.loadChildren = null;
|
|
253
|
+
const matchingType = (_option$types = option.types) === null || _option$types === void 0 ? void 0 : _option$types.some(type => matchFieldType(option.field, type, 0));
|
|
254
|
+
if (!matchingType) {
|
|
255
|
+
option.disabled = true;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
return _loadChildren.apply(this, arguments);
|
|
260
|
+
}
|
|
261
|
+
function getCollectionFieldOptions(options) {
|
|
215
262
|
const fields = options.fields,
|
|
216
263
|
collection = options.collection,
|
|
217
264
|
types = options.types,
|
|
218
|
-
_options$
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
265
|
+
_options$appends = options.appends,
|
|
266
|
+
appends = _options$appends === void 0 ? [] : _options$appends,
|
|
267
|
+
compile = options.compile,
|
|
268
|
+
getCollectionFields = options.getCollectionFields;
|
|
269
|
+
const normalizedFields = getNormalizedFields(collection, {
|
|
270
|
+
compile,
|
|
271
|
+
getCollectionFields
|
|
272
|
+
});
|
|
222
273
|
const computedFields = fields !== null && fields !== void 0 ? fields : normalizedFields;
|
|
223
|
-
const
|
|
274
|
+
const boundLoadChildren = loadChildren.bind({
|
|
275
|
+
compile,
|
|
276
|
+
getCollectionFields
|
|
277
|
+
});
|
|
278
|
+
const result = filterTypedFields({
|
|
279
|
+
fields: computedFields,
|
|
280
|
+
types,
|
|
281
|
+
// depth,
|
|
282
|
+
appends,
|
|
283
|
+
compile,
|
|
284
|
+
getCollectionFields
|
|
285
|
+
}).map(field => {
|
|
224
286
|
var _field$uiSchema5;
|
|
225
287
|
const label = compile(((_field$uiSchema5 = field.uiSchema) === null || _field$uiSchema5 === void 0 ? void 0 : _field$uiSchema5.title) || field.name);
|
|
288
|
+
const nextAppends = getNextAppends(field, appends);
|
|
289
|
+
// TODO: no matching fields in next appends should consider isLeaf as true
|
|
290
|
+
const isLeaf = !isAssociationField(field) || !nextAppends.length && !appends.includes(field.name);
|
|
226
291
|
return {
|
|
227
292
|
label,
|
|
228
293
|
key: field.name,
|
|
229
294
|
value: field.name,
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
295
|
+
isLeaf,
|
|
296
|
+
loadChildren: isLeaf ? null : boundLoadChildren,
|
|
297
|
+
field,
|
|
298
|
+
// depth,
|
|
299
|
+
appends,
|
|
300
|
+
types
|
|
236
301
|
};
|
|
237
302
|
});
|
|
238
303
|
return result;
|
package/package.json
CHANGED
|
@@ -4,19 +4,19 @@
|
|
|
4
4
|
"displayName.zh-CN": "工作流",
|
|
5
5
|
"description": " a powerful workflow plugin designed to support business process management and automation. .",
|
|
6
6
|
"description.zh-CN": "工作流插件,为业务流程管理和自动化提供支持。",
|
|
7
|
-
"version": "0.10.
|
|
7
|
+
"version": "0.10.1-alpha.1",
|
|
8
8
|
"license": "AGPL-3.0",
|
|
9
9
|
"main": "./lib/index.js",
|
|
10
10
|
"types": "./lib/index.d.ts",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@nocobase/actions": "0.10.
|
|
13
|
-
"@nocobase/client": "0.10.
|
|
14
|
-
"@nocobase/database": "0.10.
|
|
15
|
-
"@nocobase/evaluators": "0.10.
|
|
16
|
-
"@nocobase/logger": "0.10.
|
|
17
|
-
"@nocobase/resourcer": "0.10.
|
|
18
|
-
"@nocobase/server": "0.10.
|
|
19
|
-
"@nocobase/utils": "0.10.
|
|
12
|
+
"@nocobase/actions": "0.10.1-alpha.1",
|
|
13
|
+
"@nocobase/client": "0.10.1-alpha.1",
|
|
14
|
+
"@nocobase/database": "0.10.1-alpha.1",
|
|
15
|
+
"@nocobase/evaluators": "0.10.1-alpha.1",
|
|
16
|
+
"@nocobase/logger": "0.10.1-alpha.1",
|
|
17
|
+
"@nocobase/resourcer": "0.10.1-alpha.1",
|
|
18
|
+
"@nocobase/server": "0.10.1-alpha.1",
|
|
19
|
+
"@nocobase/utils": "0.10.1-alpha.1",
|
|
20
20
|
"antd": "^4.24.8",
|
|
21
21
|
"axios": "^0.27.2",
|
|
22
22
|
"classnames": "^2.3.1",
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
"react-js-cron": "^3.1.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@nocobase/plugin-formula-field": "0.10.
|
|
30
|
-
"@nocobase/test": "0.10.
|
|
29
|
+
"@nocobase/plugin-formula-field": "0.10.1-alpha.1",
|
|
30
|
+
"@nocobase/test": "0.10.1-alpha.1",
|
|
31
31
|
"@types/ejs": "^3.1.1"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "8f415f5e0ee2e72d681f9ab16af5911b52c374a9"
|
|
34
34
|
}
|