@nocobase/plugin-workflow 0.9.1-alpha.2 → 0.9.2-alpha.2
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/AddButton.js +17 -64
- package/lib/client/Branch.js +0 -13
- package/lib/client/ExecutionCanvas.js +16 -63
- package/lib/client/ExecutionLink.js +3 -21
- package/lib/client/ExecutionPage.js +1 -19
- package/lib/client/ExecutionResourceProvider.js +6 -23
- package/lib/client/FlowContext.js +0 -8
- package/lib/client/WorkflowCanvas.js +56 -127
- package/lib/client/WorkflowLink.js +3 -21
- package/lib/client/WorkflowPage.js +1 -19
- package/lib/client/WorkflowProvider.js +24 -47
- package/lib/client/WorkflowShortcut.js +0 -16
- package/lib/client/components/CollectionBlockInitializer.js +12 -22
- package/lib/client/components/CollectionFieldInitializers.js +5 -24
- package/lib/client/components/CollectionFieldset.js +31 -79
- package/lib/client/components/Duration.js +0 -14
- package/lib/client/components/DynamicExpression.d.ts +4 -0
- package/lib/client/components/DynamicExpression.js +102 -0
- package/lib/client/components/FieldsSelect.d.ts +2 -0
- package/lib/client/components/FieldsSelect.js +66 -0
- package/lib/client/components/FilterDynamicComponent.js +1 -10
- package/lib/client/components/NullRender.js +0 -1
- package/lib/client/components/OpenDrawer.js +10 -35
- package/lib/client/components/RadioWithTooltip.js +5 -27
- package/lib/client/components/renderEngineReference.d.ts +1 -0
- package/lib/client/components/renderEngineReference.js +55 -0
- package/lib/client/constants.js +0 -9
- package/lib/client/index.js +0 -6
- package/lib/client/interfaces/expression.d.ts +3 -0
- package/lib/client/interfaces/expression.js +37 -0
- package/lib/client/locale/index.js +5 -15
- package/lib/client/locale/pt-BR.d.ts +130 -0
- package/lib/client/locale/pt-BR.js +136 -0
- package/lib/client/locale/zh-CN.d.ts +16 -1
- package/lib/client/locale/zh-CN.js +17 -2
- package/lib/client/nodes/calculation.d.ts +54 -3
- package/lib/client/nodes/calculation.js +136 -63
- package/lib/client/nodes/condition.d.ts +1 -1
- package/lib/client/nodes/condition.js +21 -76
- package/lib/client/nodes/create.d.ts +35 -9
- package/lib/client/nodes/create.js +13 -19
- package/lib/client/nodes/delay.d.ts +1 -3
- package/lib/client/nodes/delay.js +3 -10
- package/lib/client/nodes/destroy.d.ts +1 -6
- package/lib/client/nodes/destroy.js +12 -9
- package/lib/client/nodes/index.d.ts +2 -2
- package/lib/client/nodes/index.js +45 -147
- package/lib/client/nodes/manual/AssigneesSelect.js +6 -17
- package/lib/client/nodes/manual/ModeConfig.js +0 -27
- package/lib/client/nodes/manual/SchemaConfig.js +87 -449
- package/lib/client/nodes/manual/WorkflowTodo.js +99 -163
- package/lib/client/nodes/manual/WorkflowTodoBlockInitializer.js +4 -20
- package/lib/client/nodes/manual/forms/customForm.d.ts +40 -0
- package/lib/client/nodes/manual/forms/customForm.js +411 -0
- package/lib/client/nodes/manual/index.d.ts +12 -1
- package/lib/client/nodes/manual/index.js +54 -41
- package/lib/client/nodes/parallel.js +7 -41
- package/lib/client/nodes/query.d.ts +28 -7
- package/lib/client/nodes/query.js +15 -22
- package/lib/client/nodes/request.d.ts +2 -3
- package/lib/client/nodes/request.js +5 -22
- package/lib/client/nodes/update.d.ts +1 -6
- package/lib/client/nodes/update.js +8 -16
- package/lib/client/schemas/collection.d.ts +20 -4
- package/lib/client/schemas/collection.js +26 -22
- package/lib/client/schemas/executions.js +3 -18
- package/lib/client/schemas/workflows.js +10 -33
- package/lib/client/style.js +24 -21
- package/lib/client/triggers/collection.d.ts +24 -20
- package/lib/client/triggers/collection.js +34 -123
- package/lib/client/triggers/index.d.ts +2 -5
- package/lib/client/triggers/index.js +34 -105
- package/lib/client/triggers/schedule/DateFieldsSelect.js +6 -29
- package/lib/client/triggers/schedule/EndsByField.js +1 -18
- package/lib/client/triggers/schedule/OnField.js +10 -38
- package/lib/client/triggers/schedule/RepeatField.js +4 -32
- package/lib/client/triggers/schedule/ScheduleConfig.js +10 -51
- package/lib/client/triggers/schedule/index.d.ts +21 -0
- package/lib/client/triggers/schedule/index.js +21 -22
- package/lib/client/triggers/schedule/locale/Cron.zh-CN.js +8 -4
- package/lib/client/utils.d.ts +1 -0
- package/lib/client/utils.js +31 -10
- package/lib/client/variable.d.ts +7 -6
- package/lib/client/variable.js +132 -71
- package/lib/index.js +0 -2
- package/lib/server/Plugin.d.ts +7 -7
- package/lib/server/Plugin.js +76 -111
- package/lib/server/Processor.d.ts +2 -0
- package/lib/server/Processor.js +62 -125
- package/lib/server/actions/index.js +3 -10
- package/lib/server/actions/nodes.js +34 -87
- package/lib/server/actions/workflows.js +46 -96
- package/lib/server/collections/executions.js +1 -1
- package/lib/server/collections/flow_nodes.js +7 -4
- package/lib/server/collections/jobs.js +1 -1
- package/lib/server/collections/workflows.js +3 -4
- package/lib/server/fields/expression-field.d.ts +8 -0
- package/lib/server/fields/expression-field.js +26 -0
- package/lib/server/fields/index.d.ts +1 -0
- package/lib/server/fields/index.js +12 -0
- package/lib/server/functions/index.js +3 -14
- package/lib/server/index.js +0 -6
- package/lib/server/instructions/calculation.js +22 -17
- package/lib/server/instructions/condition.js +8 -52
- package/lib/server/instructions/create.js +31 -15
- package/lib/server/instructions/delay.js +4 -32
- package/lib/server/instructions/destroy.js +6 -12
- package/lib/server/instructions/index.js +6 -23
- package/lib/server/instructions/manual/actions.js +22 -31
- package/lib/server/instructions/manual/collecions/users_jobs.js +1 -1
- package/lib/server/instructions/manual/index.d.ts +13 -12
- package/lib/server/instructions/manual/index.js +9 -47
- package/lib/server/instructions/parallel.js +9 -36
- package/lib/server/instructions/query.js +17 -15
- package/lib/server/instructions/request.js +7 -30
- package/lib/server/instructions/update.js +8 -14
- package/lib/server/migrations/20221129153547-calculation-variables.js +3 -27
- package/lib/server/migrations/20230221032941-change-request-body-type.js +3 -26
- package/lib/server/migrations/20230221071831-calculation-expression.js +1 -33
- package/lib/server/migrations/20230221121203-condition-calculation.js +5 -28
- package/lib/server/migrations/20230221162902-jsonb-to-json.js +3 -18
- package/lib/server/migrations/20230411034722-manual-multi-form.d.ts +4 -0
- package/lib/server/migrations/20230411034722-manual-multi-form.js +303 -0
- package/lib/server/models/Execution.js +0 -5
- package/lib/server/models/FlowNode.js +0 -5
- package/lib/server/models/Job.js +0 -5
- package/lib/server/models/Workflow.js +0 -5
- package/lib/server/triggers/collection.js +39 -61
- package/lib/server/triggers/index.js +3 -22
- package/lib/server/triggers/schedule.js +72 -194
- package/package.json +14 -11
|
@@ -4,51 +4,36 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.WorkflowShortcut = void 0;
|
|
7
|
-
|
|
8
7
|
function _react() {
|
|
9
8
|
const data = _interopRequireDefault(require("react"));
|
|
10
|
-
|
|
11
9
|
_react = function _react() {
|
|
12
10
|
return data;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return data;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
function _icons() {
|
|
19
15
|
const data = require("@ant-design/icons");
|
|
20
|
-
|
|
21
16
|
_icons = function _icons() {
|
|
22
17
|
return data;
|
|
23
18
|
};
|
|
24
|
-
|
|
25
19
|
return data;
|
|
26
20
|
}
|
|
27
|
-
|
|
28
21
|
function _reactRouterDom() {
|
|
29
22
|
const data = require("react-router-dom");
|
|
30
|
-
|
|
31
23
|
_reactRouterDom = function _reactRouterDom() {
|
|
32
24
|
return data;
|
|
33
25
|
};
|
|
34
|
-
|
|
35
26
|
return data;
|
|
36
27
|
}
|
|
37
|
-
|
|
38
28
|
function _client() {
|
|
39
29
|
const data = require("@nocobase/client");
|
|
40
|
-
|
|
41
30
|
_client = function _client() {
|
|
42
31
|
return data;
|
|
43
32
|
};
|
|
44
|
-
|
|
45
33
|
return data;
|
|
46
34
|
}
|
|
47
|
-
|
|
48
35
|
var _locale = require("./locale");
|
|
49
|
-
|
|
50
36
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
51
|
-
|
|
52
37
|
const WorkflowShortcut = () => {
|
|
53
38
|
const history = (0, _reactRouterDom().useHistory)();
|
|
54
39
|
return _react().default.createElement(_client().PluginManager.Toolbar.Item, {
|
|
@@ -60,5 +45,4 @@ const WorkflowShortcut = () => {
|
|
|
60
45
|
}
|
|
61
46
|
});
|
|
62
47
|
};
|
|
63
|
-
|
|
64
48
|
exports.WorkflowShortcut = WorkflowShortcut;
|
|
@@ -4,50 +4,36 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.CollectionBlockInitializer = CollectionBlockInitializer;
|
|
7
|
-
|
|
8
7
|
function _react() {
|
|
9
8
|
const data = _interopRequireDefault(require("react"));
|
|
10
|
-
|
|
11
9
|
_react = function _react() {
|
|
12
10
|
return data;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return data;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
function _client() {
|
|
19
15
|
const data = require("@nocobase/client");
|
|
20
|
-
|
|
21
16
|
_client = function _client() {
|
|
22
17
|
return data;
|
|
23
18
|
};
|
|
24
|
-
|
|
25
19
|
return data;
|
|
26
20
|
}
|
|
27
|
-
|
|
28
21
|
const _excluded = ["insert", "collection", "dataSource"];
|
|
29
|
-
|
|
30
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
31
|
-
|
|
32
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; }
|
|
33
|
-
|
|
34
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; }
|
|
35
|
-
|
|
36
|
-
function
|
|
37
|
-
|
|
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; }
|
|
26
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
27
|
+
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); }
|
|
38
28
|
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; }
|
|
39
|
-
|
|
40
29
|
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; }
|
|
41
|
-
|
|
42
30
|
function CollectionBlockInitializer(_ref) {
|
|
43
31
|
let insert = _ref.insert,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
32
|
+
collection = _ref.collection,
|
|
33
|
+
dataSource = _ref.dataSource,
|
|
34
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
48
35
|
const _useCollectionManager = (0, _client().useCollectionManager)(),
|
|
49
|
-
|
|
50
|
-
|
|
36
|
+
getCollection = _useCollectionManager.getCollection;
|
|
51
37
|
const resovledCollection = getCollection(collection);
|
|
52
38
|
return _react().default.createElement(_client().SchemaInitializer.Item, _objectSpread(_objectSpread({}, props), {}, {
|
|
53
39
|
onClick: () => {
|
|
@@ -60,9 +46,13 @@ function CollectionBlockInitializer(_ref) {
|
|
|
60
46
|
collection
|
|
61
47
|
},
|
|
62
48
|
'x-component': 'CardItem',
|
|
63
|
-
'x-component-props': {
|
|
49
|
+
'x-component-props': {
|
|
50
|
+
// title: props.title
|
|
64
51
|
},
|
|
65
52
|
'x-designer': 'SimpleDesigner',
|
|
53
|
+
'x-designer-props': {
|
|
54
|
+
type: 'record'
|
|
55
|
+
},
|
|
66
56
|
properties: {
|
|
67
57
|
grid: {
|
|
68
58
|
type: 'void',
|
|
@@ -4,57 +4,40 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.CollectionFieldInitializers = CollectionFieldInitializers;
|
|
7
|
-
|
|
8
7
|
function _react() {
|
|
9
8
|
const data = _interopRequireDefault(require("react"));
|
|
10
|
-
|
|
11
9
|
_react = function _react() {
|
|
12
10
|
return data;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return data;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
function _lodash() {
|
|
19
15
|
const data = require("lodash");
|
|
20
|
-
|
|
21
16
|
_lodash = function _lodash() {
|
|
22
17
|
return data;
|
|
23
18
|
};
|
|
24
|
-
|
|
25
19
|
return data;
|
|
26
20
|
}
|
|
27
|
-
|
|
28
21
|
function _client() {
|
|
29
22
|
const data = require("@nocobase/client");
|
|
30
|
-
|
|
31
23
|
_client = function _client() {
|
|
32
24
|
return data;
|
|
33
25
|
};
|
|
34
|
-
|
|
35
26
|
return data;
|
|
36
27
|
}
|
|
37
|
-
|
|
38
28
|
const _excluded = ["field"];
|
|
39
|
-
|
|
40
29
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
41
|
-
|
|
42
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; }
|
|
43
|
-
|
|
44
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; }
|
|
45
|
-
|
|
46
|
-
function
|
|
47
|
-
|
|
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); }
|
|
48
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; }
|
|
49
|
-
|
|
50
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; }
|
|
51
|
-
|
|
52
37
|
function CollectionFieldInitializer(_ref) {
|
|
53
38
|
var _uiSchema$title;
|
|
54
|
-
|
|
55
39
|
let field = _ref.field,
|
|
56
|
-
|
|
57
|
-
|
|
40
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
58
41
|
const uiSchema = (0, _lodash().cloneDeep)(field.uiSchema);
|
|
59
42
|
delete uiSchema['x-uid'];
|
|
60
43
|
return _react().default.createElement(_client().InitializerWithSwitch, _objectSpread(_objectSpread({}, props), {}, {
|
|
@@ -69,11 +52,9 @@ function CollectionFieldInitializer(_ref) {
|
|
|
69
52
|
type: "x-collection-field"
|
|
70
53
|
}));
|
|
71
54
|
}
|
|
72
|
-
|
|
73
55
|
function CollectionFieldInitializers(props) {
|
|
74
56
|
const _useCollection = (0, _client().useCollection)(),
|
|
75
|
-
|
|
76
|
-
|
|
57
|
+
fields = _useCollection.fields;
|
|
77
58
|
const items = fields.filter(field => !['belongsTo', 'hasOne', 'hasMany', 'belongsToMany'].includes(field.type) && field.uiSchema).map(field => ({
|
|
78
59
|
key: field.name,
|
|
79
60
|
type: 'item',
|
|
@@ -4,148 +4,104 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
function _react() {
|
|
9
8
|
const data = _interopRequireDefault(require("react"));
|
|
10
|
-
|
|
11
9
|
_react = function _react() {
|
|
12
10
|
return data;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return data;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
function _react2() {
|
|
19
15
|
const data = require("@formily/react");
|
|
20
|
-
|
|
21
16
|
_react2 = function _react2() {
|
|
22
17
|
return data;
|
|
23
18
|
};
|
|
24
|
-
|
|
25
19
|
return data;
|
|
26
20
|
}
|
|
27
|
-
|
|
28
21
|
function _antd() {
|
|
29
22
|
const data = require("antd");
|
|
30
|
-
|
|
31
23
|
_antd = function _antd() {
|
|
32
24
|
return data;
|
|
33
25
|
};
|
|
34
|
-
|
|
35
26
|
return data;
|
|
36
27
|
}
|
|
37
|
-
|
|
38
28
|
function _icons() {
|
|
39
29
|
const data = require("@ant-design/icons");
|
|
40
|
-
|
|
41
30
|
_icons = function _icons() {
|
|
42
31
|
return data;
|
|
43
32
|
};
|
|
44
|
-
|
|
45
33
|
return data;
|
|
46
34
|
}
|
|
47
|
-
|
|
48
35
|
function _reactI18next() {
|
|
49
36
|
const data = require("react-i18next");
|
|
50
|
-
|
|
51
37
|
_reactI18next = function _reactI18next() {
|
|
52
38
|
return data;
|
|
53
39
|
};
|
|
54
|
-
|
|
55
40
|
return data;
|
|
56
41
|
}
|
|
57
|
-
|
|
58
42
|
function _css() {
|
|
59
43
|
const data = require("@emotion/css");
|
|
60
|
-
|
|
61
44
|
_css = function _css() {
|
|
62
45
|
return data;
|
|
63
46
|
};
|
|
64
|
-
|
|
65
47
|
return data;
|
|
66
48
|
}
|
|
67
|
-
|
|
68
49
|
function _client() {
|
|
69
50
|
const data = require("@nocobase/client");
|
|
70
|
-
|
|
71
51
|
_client = function _client() {
|
|
72
52
|
return data;
|
|
73
53
|
};
|
|
74
|
-
|
|
75
54
|
return data;
|
|
76
55
|
}
|
|
77
|
-
|
|
78
56
|
var _locale = require("../locale");
|
|
79
|
-
|
|
80
57
|
var _variable = require("../variable");
|
|
81
|
-
|
|
82
58
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
83
|
-
|
|
84
59
|
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; }
|
|
85
|
-
|
|
86
60
|
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; }
|
|
87
|
-
|
|
88
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
89
|
-
|
|
90
|
-
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); }
|
|
91
|
-
|
|
92
61
|
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; }
|
|
93
|
-
|
|
94
62
|
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; }
|
|
95
|
-
|
|
96
|
-
function
|
|
97
|
-
|
|
63
|
+
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; }
|
|
64
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
65
|
+
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); }
|
|
98
66
|
function AssociationInput(props) {
|
|
99
67
|
const _useCollectionManager = (0, _client().useCollectionManager)(),
|
|
100
|
-
|
|
101
|
-
|
|
68
|
+
getCollectionFields = _useCollectionManager.getCollectionFields;
|
|
102
69
|
const _useField = (0, _react2().useField)(),
|
|
103
|
-
|
|
104
|
-
|
|
70
|
+
path = _useField.path;
|
|
105
71
|
const fieldName = path.segments[path.segments.length - 1];
|
|
106
|
-
|
|
107
72
|
const _useForm = (0, _react2().useForm)(),
|
|
108
|
-
|
|
109
|
-
|
|
73
|
+
config = _useForm.values;
|
|
110
74
|
const fields = getCollectionFields(config === null || config === void 0 ? void 0 : config.collection);
|
|
111
|
-
|
|
112
75
|
const _fields$find = fields.find(item => item.name === fieldName),
|
|
113
|
-
|
|
114
|
-
|
|
76
|
+
type = _fields$find.type;
|
|
115
77
|
const value = Array.isArray(props.value) ? props.value.join(',') : props.value;
|
|
116
|
-
|
|
117
78
|
function onChange(ev) {
|
|
118
79
|
const trimed = ev.target.value.trim();
|
|
119
80
|
props.onChange(['belongsTo', 'hasOne'].includes(type) ? trimed : trimed.split(/[,\s]+/));
|
|
120
81
|
}
|
|
121
|
-
|
|
122
82
|
return _react().default.createElement(_antd().Input, _objectSpread(_objectSpread({}, props), {}, {
|
|
123
83
|
value: value,
|
|
124
84
|
onChange: onChange
|
|
125
85
|
}));
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
|
|
86
|
+
}
|
|
87
|
+
// NOTE: observer for watching useProps
|
|
129
88
|
var _default = (0, _react2().observer)(({
|
|
130
89
|
value,
|
|
131
90
|
disabled,
|
|
132
91
|
onChange: _onChange
|
|
133
92
|
}) => {
|
|
134
93
|
const _useTranslation = (0, _reactI18next().useTranslation)(),
|
|
135
|
-
|
|
136
|
-
|
|
94
|
+
t = _useTranslation.t;
|
|
137
95
|
const compile = (0, _client().useCompile)();
|
|
138
96
|
const form = (0, _react2().useForm)();
|
|
139
|
-
|
|
140
97
|
const _useCollectionManager2 = (0, _client().useCollectionManager)(),
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
98
|
+
getCollection = _useCollectionManager2.getCollection,
|
|
99
|
+
getCollectionFields = _useCollectionManager2.getCollectionFields;
|
|
144
100
|
const _useForm2 = (0, _react2().useForm)(),
|
|
145
|
-
|
|
146
|
-
|
|
101
|
+
config = _useForm2.values;
|
|
147
102
|
const collectionName = config === null || config === void 0 ? void 0 : config.collection;
|
|
148
|
-
const fields = getCollectionFields(collectionName).filter(field => !field.hidden && (field.uiSchema ? !field.uiSchema['x-read-pretty'] : false)
|
|
103
|
+
const fields = getCollectionFields(collectionName).filter(field => !field.hidden && (field.uiSchema ? !field.uiSchema['x-read-pretty'] : false)
|
|
104
|
+
// TODO: should use some field option but not type to control this
|
|
149
105
|
&& !['formula'].includes(field.type));
|
|
150
106
|
const unassignedFields = fields.filter(field => !(field.name in value));
|
|
151
107
|
const scope = (0, _variable.useWorkflowVariableOptions)();
|
|
@@ -166,11 +122,10 @@ var _default = (0, _react2().observer)(({
|
|
|
166
122
|
collection: getCollection(collectionName)
|
|
167
123
|
}, fields.filter(field => field.name in value).map(field => {
|
|
168
124
|
var _field$uiSchema$title, _field$uiSchema;
|
|
169
|
-
|
|
170
125
|
// constant for associations to use Input, others to use CollectionField
|
|
171
126
|
// dynamic values only support belongsTo/hasOne association, other association type should disable
|
|
172
|
-
const ConstantCompoent = ['belongsTo', 'hasOne', 'hasMany', 'belongsToMany'].includes(field.type) ? AssociationInput : _client().CollectionField;
|
|
173
|
-
|
|
127
|
+
const ConstantCompoent = ['belongsTo', 'hasOne', 'hasMany', 'belongsToMany'].includes(field.type) ? AssociationInput : _client().CollectionField;
|
|
128
|
+
// TODO: try to use <ObjectField> to replace this map
|
|
174
129
|
return _react().default.createElement(_antd().Form.Item, {
|
|
175
130
|
key: field.name,
|
|
176
131
|
label: compile((_field$uiSchema$title = (_field$uiSchema = field.uiSchema) === null || _field$uiSchema === void 0 ? void 0 : _field$uiSchema.title) !== null && _field$uiSchema$title !== void 0 ? _field$uiSchema$title : field.name),
|
|
@@ -181,7 +136,7 @@ var _default = (0, _react2().observer)(({
|
|
|
181
136
|
}
|
|
182
137
|
`
|
|
183
138
|
}, _react().default.createElement(_client().Variable.Input, {
|
|
184
|
-
scope:
|
|
139
|
+
scope: scope,
|
|
185
140
|
value: value[field.name],
|
|
186
141
|
onChange: next => {
|
|
187
142
|
_onChange(_objectSpread(_objectSpread({}, value), {}, {
|
|
@@ -194,11 +149,9 @@ var _default = (0, _react2().observer)(({
|
|
|
194
149
|
properties: {
|
|
195
150
|
[field.name]: {
|
|
196
151
|
'x-component': ConstantCompoent,
|
|
197
|
-
|
|
198
152
|
['x-validator']() {
|
|
199
153
|
return '';
|
|
200
154
|
}
|
|
201
|
-
|
|
202
155
|
}
|
|
203
156
|
}
|
|
204
157
|
}
|
|
@@ -207,33 +160,32 @@ var _default = (0, _react2().observer)(({
|
|
|
207
160
|
icon: _react().default.createElement(_icons().CloseCircleOutlined, null),
|
|
208
161
|
onClick: () => {
|
|
209
162
|
const _field$name = field.name,
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
163
|
+
_ = value[_field$name],
|
|
164
|
+
rest = _objectWithoutProperties(value, [_field$name].map(_toPropertyKey));
|
|
213
165
|
_onChange(rest);
|
|
214
166
|
}
|
|
215
167
|
}) : null);
|
|
216
168
|
}), unassignedFields.length ? _react().default.createElement(_antd().Dropdown, {
|
|
217
169
|
overlay: _react().default.createElement(_antd().Menu, {
|
|
170
|
+
items: unassignedFields.map(field => {
|
|
171
|
+
var _field$uiSchema$title2, _field$uiSchema2;
|
|
172
|
+
return {
|
|
173
|
+
key: field.name,
|
|
174
|
+
label: compile((_field$uiSchema$title2 = (_field$uiSchema2 = field.uiSchema) === null || _field$uiSchema2 === void 0 ? void 0 : _field$uiSchema2.title) !== null && _field$uiSchema$title2 !== void 0 ? _field$uiSchema$title2 : field.name)
|
|
175
|
+
};
|
|
176
|
+
}),
|
|
218
177
|
onClick: ({
|
|
219
178
|
key
|
|
220
179
|
}) => _onChange(_objectSpread(_objectSpread({}, value), {}, {
|
|
221
180
|
[key]: null
|
|
222
181
|
})),
|
|
223
182
|
className: (0, _css().css)`
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
}
|
|
228
|
-
var _field$uiSchema$title2, _field$uiSchema2;
|
|
229
|
-
|
|
230
|
-
return _react().default.createElement(_antd().Menu.Item, {
|
|
231
|
-
key: field.name
|
|
232
|
-
}, compile((_field$uiSchema$title2 = (_field$uiSchema2 = field.uiSchema) === null || _field$uiSchema2 === void 0 ? void 0 : _field$uiSchema2.title) !== null && _field$uiSchema$title2 !== void 0 ? _field$uiSchema$title2 : field.name));
|
|
233
|
-
}))
|
|
183
|
+
max-height: 300px;
|
|
184
|
+
overflow-y: auto;
|
|
185
|
+
`
|
|
186
|
+
})
|
|
234
187
|
}, _react().default.createElement(_antd().Button, {
|
|
235
188
|
icon: _react().default.createElement(_icons().PlusOutlined, null)
|
|
236
189
|
}, t('Add field'))) : null) : _react().default.createElement("p", null, (0, _locale.lang)('Please select collection first')));
|
|
237
190
|
});
|
|
238
|
-
|
|
239
191
|
exports.default = _default;
|
|
@@ -4,41 +4,29 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = _default;
|
|
7
|
-
|
|
8
7
|
function _react() {
|
|
9
8
|
const data = _interopRequireDefault(require("react"));
|
|
10
|
-
|
|
11
9
|
_react = function _react() {
|
|
12
10
|
return data;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return data;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
function _antd() {
|
|
19
15
|
const data = require("antd");
|
|
20
|
-
|
|
21
16
|
_antd = function _antd() {
|
|
22
17
|
return data;
|
|
23
18
|
};
|
|
24
|
-
|
|
25
19
|
return data;
|
|
26
20
|
}
|
|
27
|
-
|
|
28
21
|
function _css() {
|
|
29
22
|
const data = require("@emotion/css");
|
|
30
|
-
|
|
31
23
|
_css = function _css() {
|
|
32
24
|
return data;
|
|
33
25
|
};
|
|
34
|
-
|
|
35
26
|
return data;
|
|
36
27
|
}
|
|
37
|
-
|
|
38
28
|
var _locale = require("../locale");
|
|
39
|
-
|
|
40
29
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
41
|
-
|
|
42
30
|
const UnitOptions = [{
|
|
43
31
|
value: 1000,
|
|
44
32
|
label: 'Seconds'
|
|
@@ -55,11 +43,9 @@ const UnitOptions = [{
|
|
|
55
43
|
value: 604800000,
|
|
56
44
|
label: 'Weeks'
|
|
57
45
|
}];
|
|
58
|
-
|
|
59
46
|
function getNumberOption(v) {
|
|
60
47
|
return UnitOptions.slice().reverse().find(item => !(v % item.value));
|
|
61
48
|
}
|
|
62
|
-
|
|
63
49
|
function _default({
|
|
64
50
|
value = 60000,
|
|
65
51
|
onChange: _onChange
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.DynamicExpression = void 0;
|
|
7
|
+
function _react() {
|
|
8
|
+
const data = _interopRequireWildcard(require("react"));
|
|
9
|
+
_react = function _react() {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
function _core() {
|
|
15
|
+
const data = require("@formily/core");
|
|
16
|
+
_core = function _core() {
|
|
17
|
+
return data;
|
|
18
|
+
};
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
21
|
+
function _react2() {
|
|
22
|
+
const data = require("@formily/react");
|
|
23
|
+
_react2 = function _react2() {
|
|
24
|
+
return data;
|
|
25
|
+
};
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
28
|
+
function _antd() {
|
|
29
|
+
const data = require("antd");
|
|
30
|
+
_antd = function _antd() {
|
|
31
|
+
return data;
|
|
32
|
+
};
|
|
33
|
+
return data;
|
|
34
|
+
}
|
|
35
|
+
function _reactI18next() {
|
|
36
|
+
const data = require("react-i18next");
|
|
37
|
+
_reactI18next = function _reactI18next() {
|
|
38
|
+
return data;
|
|
39
|
+
};
|
|
40
|
+
return data;
|
|
41
|
+
}
|
|
42
|
+
function _client() {
|
|
43
|
+
const data = require("@nocobase/client");
|
|
44
|
+
_client = function _client() {
|
|
45
|
+
return data;
|
|
46
|
+
};
|
|
47
|
+
return data;
|
|
48
|
+
}
|
|
49
|
+
var _locale = require("../locale");
|
|
50
|
+
var _variable = require("../variable");
|
|
51
|
+
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); }
|
|
52
|
+
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; }
|
|
53
|
+
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; }
|
|
54
|
+
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; }
|
|
55
|
+
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; }
|
|
56
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
57
|
+
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); }
|
|
58
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
59
|
+
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."); }
|
|
60
|
+
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); }
|
|
61
|
+
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; }
|
|
62
|
+
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; } }
|
|
63
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
64
|
+
const InternalExpression = (0, _react2().observer)(props => {
|
|
65
|
+
const onChange = props.onChange;
|
|
66
|
+
const _useForm = (0, _react2().useForm)(),
|
|
67
|
+
values = _useForm.values;
|
|
68
|
+
const _useState = (0, _react().useState)(values === null || values === void 0 ? void 0 : values.sourceCollection),
|
|
69
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
70
|
+
collection = _useState2[0],
|
|
71
|
+
setCollection = _useState2[1];
|
|
72
|
+
(0, _react2().useFormEffects)(() => {
|
|
73
|
+
(0, _core().onFormInitialValuesChange)(form => {
|
|
74
|
+
setCollection(form.values.sourceCollection);
|
|
75
|
+
});
|
|
76
|
+
(0, _core().onFieldInputValueChange)('sourceCollection', f => {
|
|
77
|
+
setCollection(f.value);
|
|
78
|
+
onChange(null);
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
const options = (0, _variable.useCollectionFieldOptions)({
|
|
82
|
+
collection
|
|
83
|
+
});
|
|
84
|
+
return _react().default.createElement(_client().Variable.TextArea, _objectSpread(_objectSpread({}, props), {}, {
|
|
85
|
+
scope: options
|
|
86
|
+
}));
|
|
87
|
+
});
|
|
88
|
+
function Result(props) {
|
|
89
|
+
const _useTranslation = (0, _reactI18next().useTranslation)(),
|
|
90
|
+
t = _useTranslation.t;
|
|
91
|
+
const values = (0, _client().useRecord)();
|
|
92
|
+
const options = (0, _react().useMemo)(() => (0, _variable.useCollectionFieldOptions)({
|
|
93
|
+
collection: values.sourceCollection
|
|
94
|
+
}), [values.sourceCollection, values.sourceCollection]);
|
|
95
|
+
return props.value ? _react().default.createElement(_client().Variable.TextArea, _objectSpread(_objectSpread({}, props), {}, {
|
|
96
|
+
scope: options
|
|
97
|
+
})) : _react().default.createElement(_antd().Tag, null, t('Unconfigured', {
|
|
98
|
+
ns: _locale.NAMESPACE
|
|
99
|
+
}));
|
|
100
|
+
}
|
|
101
|
+
const DynamicExpression = (0, _react2().connect)(InternalExpression, (0, _react2().mapReadPretty)(Result));
|
|
102
|
+
exports.DynamicExpression = DynamicExpression;
|