@nocobase/client 0.7.0-alpha.82 → 0.7.0-alpha.83
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/es/block-provider/hooks/index.d.ts +3 -0
- package/es/block-provider/hooks/index.js +233 -168
- package/es/collection-manager/Configuration/AddFieldAction.js +27 -9
- package/es/collection-manager/Configuration/EditFieldAction.js +25 -8
- package/es/locale/en_US.d.ts +10 -0
- package/es/locale/en_US.js +11 -1
- package/es/locale/index.d.ts +44 -0
- package/es/locale/zh_CN.d.ts +34 -0
- package/es/locale/zh_CN.js +35 -1
- package/es/schema-component/antd/action/Action.Designer.js +33 -13
- package/es/schema-component/antd/action/utils.d.ts +2 -0
- package/es/schema-component/antd/action/utils.js +60 -0
- package/es/schema-component/antd/date-picker/util.d.ts +2 -1
- package/es/schema-component/antd/date-picker/util.js +4 -2
- package/es/schema-initializer/buttons/FormActionInitializers.d.ts +84 -0
- package/es/schema-initializer/buttons/FormActionInitializers.js +63 -0
- package/es/schema-initializer/buttons/ReadPrettyFormActionInitializers.d.ts +26 -0
- package/es/schema-initializer/buttons/ReadPrettyFormActionInitializers.js +21 -0
- package/es/schema-initializer/buttons/TableActionColumnInitializers.js +21 -0
- package/es/schema-settings/SchemaSettings.js +48 -16
- package/es/workflow/triggers/collection.js +1 -0
- package/es/workflow/triggers/index.js +2 -0
- package/es/workflow/triggers/schedule.d.ts +25 -0
- package/es/workflow/triggers/schedule.js +531 -0
- package/lib/block-provider/hooks/index.d.ts +3 -0
- package/lib/block-provider/hooks/index.js +238 -169
- package/lib/collection-manager/Configuration/AddFieldAction.js +27 -9
- package/lib/collection-manager/Configuration/EditFieldAction.js +25 -8
- package/lib/locale/en_US.d.ts +10 -0
- package/lib/locale/en_US.js +11 -1
- package/lib/locale/index.d.ts +44 -0
- package/lib/locale/zh_CN.d.ts +34 -0
- package/lib/locale/zh_CN.js +35 -1
- package/lib/schema-component/antd/action/Action.Designer.js +34 -13
- package/lib/schema-component/antd/action/utils.d.ts +2 -0
- package/lib/schema-component/antd/action/utils.js +67 -0
- package/lib/schema-component/antd/date-picker/util.d.ts +2 -1
- package/lib/schema-component/antd/date-picker/util.js +6 -1
- package/lib/schema-initializer/buttons/FormActionInitializers.d.ts +84 -0
- package/lib/schema-initializer/buttons/FormActionInitializers.js +63 -0
- package/lib/schema-initializer/buttons/ReadPrettyFormActionInitializers.d.ts +26 -0
- package/lib/schema-initializer/buttons/ReadPrettyFormActionInitializers.js +21 -0
- package/lib/schema-initializer/buttons/TableActionColumnInitializers.js +21 -0
- package/lib/schema-settings/SchemaSettings.js +49 -16
- package/lib/workflow/triggers/collection.js +1 -0
- package/lib/workflow/triggers/index.js +3 -0
- package/lib/workflow/triggers/schedule.d.ts +25 -0
- package/lib/workflow/triggers/schedule.js +554 -0
- package/package.json +4 -4
- package/src/block-provider/hooks/index.ts +106 -69
- package/src/collection-manager/Configuration/AddFieldAction.tsx +18 -0
- package/src/collection-manager/Configuration/EditFieldAction.tsx +19 -0
- package/src/locale/en_US.ts +11 -1
- package/src/locale/zh_CN.ts +39 -1
- package/src/schema-component/antd/action/Action.Designer.tsx +33 -1
- package/src/schema-component/antd/action/utils.ts +68 -0
- package/src/schema-component/antd/date-picker/util.ts +4 -3
- package/src/schema-initializer/SchemaInitializer.tsx +2 -2
- package/src/schema-initializer/buttons/FormActionInitializers.tsx +66 -0
- package/src/schema-initializer/buttons/ReadPrettyFormActionInitializers.tsx +22 -0
- package/src/schema-initializer/buttons/TableActionColumnInitializers.tsx +22 -0
- package/src/schema-settings/SchemaSettings.tsx +40 -29
- package/src/workflow/triggers/collection.tsx +1 -1
- package/src/workflow/triggers/index.tsx +2 -0
- package/src/workflow/triggers/schedule.tsx +422 -0
|
@@ -0,0 +1,531 @@
|
|
|
1
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
2
|
+
|
|
3
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
4
|
+
|
|
5
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
6
|
+
|
|
7
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
8
|
+
|
|
9
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
10
|
+
|
|
11
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
12
|
+
|
|
13
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
14
|
+
|
|
15
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
16
|
+
|
|
17
|
+
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."); }
|
|
18
|
+
|
|
19
|
+
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); }
|
|
20
|
+
|
|
21
|
+
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; }
|
|
22
|
+
|
|
23
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
24
|
+
|
|
25
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
26
|
+
|
|
27
|
+
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; }
|
|
28
|
+
|
|
29
|
+
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; }
|
|
30
|
+
|
|
31
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
32
|
+
|
|
33
|
+
import React, { useState } from 'react';
|
|
34
|
+
import { InputNumber, Select } from 'antd';
|
|
35
|
+
import { observer, useForm, useFormEffects } from '@formily/react';
|
|
36
|
+
import { useCollectionDataSource, useCollectionManager } from '../../collection-manager';
|
|
37
|
+
import { SchemaComponent, useCompile, DatePicker } from '../../schema-component';
|
|
38
|
+
import { useFlowContext } from '../WorkflowCanvas';
|
|
39
|
+
import { BaseTypeSet } from '../calculators';
|
|
40
|
+
import { collection } from '../schemas/collection';
|
|
41
|
+
import { useTranslation } from 'react-i18next';
|
|
42
|
+
import { onFieldValueChange } from '@formily/core';
|
|
43
|
+
import { css } from '@emotion/css';
|
|
44
|
+
var DateFieldsSelect = observer(function (props) {
|
|
45
|
+
var _values$config;
|
|
46
|
+
|
|
47
|
+
var compile = useCompile();
|
|
48
|
+
|
|
49
|
+
var _useCollectionManager = useCollectionManager(),
|
|
50
|
+
getCollectionFields = _useCollectionManager.getCollectionFields;
|
|
51
|
+
|
|
52
|
+
var _useForm = useForm(),
|
|
53
|
+
values = _useForm.values;
|
|
54
|
+
|
|
55
|
+
var fields = getCollectionFields(values === null || values === void 0 ? void 0 : (_values$config = values.config) === null || _values$config === void 0 ? void 0 : _values$config.collection);
|
|
56
|
+
return /*#__PURE__*/React.createElement(Select, _objectSpread({}, props), fields.filter(function (field) {
|
|
57
|
+
return !field.hidden && (field.uiSchema ? field.type === 'date' : false);
|
|
58
|
+
}).map(function (field) {
|
|
59
|
+
var _field$uiSchema;
|
|
60
|
+
|
|
61
|
+
return /*#__PURE__*/React.createElement(Select.Option, {
|
|
62
|
+
key: field.name,
|
|
63
|
+
value: field.name
|
|
64
|
+
}, compile((_field$uiSchema = field.uiSchema) === null || _field$uiSchema === void 0 ? void 0 : _field$uiSchema.title));
|
|
65
|
+
}));
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
var OnField = function OnField(_ref) {
|
|
69
|
+
var value = _ref.value,
|
|
70
|
+
_onChange = _ref.onChange;
|
|
71
|
+
|
|
72
|
+
var _useTranslation = useTranslation(),
|
|
73
|
+
t = _useTranslation.t;
|
|
74
|
+
|
|
75
|
+
var _useState = useState(value.offset ? value.offset / Math.abs(value.offset) : 0),
|
|
76
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
77
|
+
dir = _useState2[0],
|
|
78
|
+
setDir = _useState2[1];
|
|
79
|
+
|
|
80
|
+
return /*#__PURE__*/React.createElement("fieldset", {
|
|
81
|
+
className: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n gap: .5em;\n "])))
|
|
82
|
+
}, /*#__PURE__*/React.createElement(DateFieldsSelect, {
|
|
83
|
+
value: value.field,
|
|
84
|
+
onChange: function onChange(field) {
|
|
85
|
+
return _onChange(_objectSpread(_objectSpread({}, value), {}, {
|
|
86
|
+
field: field
|
|
87
|
+
}));
|
|
88
|
+
}
|
|
89
|
+
}), value.field ? /*#__PURE__*/React.createElement(Select, {
|
|
90
|
+
value: dir,
|
|
91
|
+
onChange: function onChange(v) {
|
|
92
|
+
setDir(v);
|
|
93
|
+
|
|
94
|
+
_onChange(_objectSpread(_objectSpread({}, value), {}, {
|
|
95
|
+
offset: Math.abs(value.offset) * v
|
|
96
|
+
}));
|
|
97
|
+
}
|
|
98
|
+
}, /*#__PURE__*/React.createElement(Select.Option, {
|
|
99
|
+
value: 0
|
|
100
|
+
}, t('Exactly at')), /*#__PURE__*/React.createElement(Select.Option, {
|
|
101
|
+
value: -1
|
|
102
|
+
}, t('Before')), /*#__PURE__*/React.createElement(Select.Option, {
|
|
103
|
+
value: 1
|
|
104
|
+
}, t('After'))) : null, dir ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(InputNumber, {
|
|
105
|
+
value: Math.abs(value.offset),
|
|
106
|
+
onChange: function onChange(v) {
|
|
107
|
+
return _onChange(_objectSpread(_objectSpread({}, value), {}, {
|
|
108
|
+
offset: v * dir
|
|
109
|
+
}));
|
|
110
|
+
}
|
|
111
|
+
}), /*#__PURE__*/React.createElement(Select, {
|
|
112
|
+
value: value.unit || 86400000,
|
|
113
|
+
onChange: function onChange(unit) {
|
|
114
|
+
return _onChange(_objectSpread(_objectSpread({}, value), {}, {
|
|
115
|
+
unit: unit
|
|
116
|
+
}));
|
|
117
|
+
}
|
|
118
|
+
}, /*#__PURE__*/React.createElement(Select.Option, {
|
|
119
|
+
value: 86400000
|
|
120
|
+
}, t('Days')), /*#__PURE__*/React.createElement(Select.Option, {
|
|
121
|
+
value: 3600000
|
|
122
|
+
}, t('Hours')), /*#__PURE__*/React.createElement(Select.Option, {
|
|
123
|
+
value: 60000
|
|
124
|
+
}, t('Minutes')), /*#__PURE__*/React.createElement(Select.Option, {
|
|
125
|
+
value: 1000
|
|
126
|
+
}, t('Seconds')))) : null);
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
function EndsByField(_ref2) {
|
|
130
|
+
var value = _ref2.value,
|
|
131
|
+
_onChange2 = _ref2.onChange;
|
|
132
|
+
|
|
133
|
+
var _useTranslation2 = useTranslation(),
|
|
134
|
+
t = _useTranslation2.t;
|
|
135
|
+
|
|
136
|
+
var _useState3 = useState(_typeof(value) === 'object' && !(value instanceof Date) ? 'field' : 'date'),
|
|
137
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
138
|
+
type = _useState4[0],
|
|
139
|
+
setType = _useState4[1];
|
|
140
|
+
|
|
141
|
+
return /*#__PURE__*/React.createElement("fieldset", {
|
|
142
|
+
className: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n gap: .5em;\n "])))
|
|
143
|
+
}, /*#__PURE__*/React.createElement(Select, {
|
|
144
|
+
value: type,
|
|
145
|
+
onChange: function onChange(t) {
|
|
146
|
+
_onChange2(t === 'field' ? {} : null);
|
|
147
|
+
|
|
148
|
+
setType(t);
|
|
149
|
+
}
|
|
150
|
+
}, /*#__PURE__*/React.createElement(Select.Option, {
|
|
151
|
+
value: 'field'
|
|
152
|
+
}, t('By field')), /*#__PURE__*/React.createElement(Select.Option, {
|
|
153
|
+
value: 'date'
|
|
154
|
+
}, t('By custom date'))), type === 'field' ? /*#__PURE__*/React.createElement(OnField, {
|
|
155
|
+
value: value,
|
|
156
|
+
onChange: _onChange2
|
|
157
|
+
}) : /*#__PURE__*/React.createElement(DatePicker, {
|
|
158
|
+
showTime: true,
|
|
159
|
+
value: value,
|
|
160
|
+
onChange: _onChange2
|
|
161
|
+
}));
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function parseCronRule(cron) {
|
|
165
|
+
var _rules$index$;
|
|
166
|
+
|
|
167
|
+
if (!cron) {
|
|
168
|
+
return {
|
|
169
|
+
mode: 0
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
var rules = cron.split(/\s+/).slice(1).map(function (v) {
|
|
174
|
+
return v.split('/');
|
|
175
|
+
});
|
|
176
|
+
var index = rules.findIndex(function (rule) {
|
|
177
|
+
return rule[0] === '*';
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
if (index === -1) {
|
|
181
|
+
return {
|
|
182
|
+
mode: 0
|
|
183
|
+
};
|
|
184
|
+
} // fix days of week
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
if (index === 3 && rules[4][0] === '*') {
|
|
188
|
+
index = 4;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
return {
|
|
192
|
+
mode: index + 1,
|
|
193
|
+
step: (_rules$index$ = rules[index][1]) !== null && _rules$index$ !== void 0 ? _rules$index$ : 1
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
var CronUnits = [{
|
|
198
|
+
value: 1,
|
|
199
|
+
option: 'By minute',
|
|
200
|
+
unitText: 'Minutes'
|
|
201
|
+
}, {
|
|
202
|
+
value: 2,
|
|
203
|
+
option: 'By hour',
|
|
204
|
+
unitText: 'Hours'
|
|
205
|
+
}, {
|
|
206
|
+
value: 3,
|
|
207
|
+
option: 'By date',
|
|
208
|
+
unitText: 'Days',
|
|
209
|
+
conflict: true,
|
|
210
|
+
startFrom: 1
|
|
211
|
+
}, {
|
|
212
|
+
value: 4,
|
|
213
|
+
option: 'By month',
|
|
214
|
+
unitText: 'Months',
|
|
215
|
+
startFrom: 1
|
|
216
|
+
}, {
|
|
217
|
+
value: 5,
|
|
218
|
+
option: 'By day of week',
|
|
219
|
+
unitText: 'Days',
|
|
220
|
+
conflict: true
|
|
221
|
+
}];
|
|
222
|
+
|
|
223
|
+
function getChangedCron(_ref3) {
|
|
224
|
+
var mode = _ref3.mode,
|
|
225
|
+
step = _ref3.step;
|
|
226
|
+
var m = mode - 1;
|
|
227
|
+
var left = [0].concat(_toConsumableArray(Array(m).fill(null).map(function (_, i) {
|
|
228
|
+
var _CronUnits$i$startFro;
|
|
229
|
+
|
|
230
|
+
if (CronUnits[m].conflict && CronUnits[i].conflict) {
|
|
231
|
+
return '?';
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
return i === 3 ? '*' : (_CronUnits$i$startFro = CronUnits[i].startFrom) !== null && _CronUnits$i$startFro !== void 0 ? _CronUnits$i$startFro : 0;
|
|
235
|
+
}))).join(' ');
|
|
236
|
+
var right = Array(5 - mode).fill(null).map(function (_, i) {
|
|
237
|
+
if (CronUnits[m].conflict && CronUnits[mode + i].conflict || mode === 4) {
|
|
238
|
+
return '?';
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
return '*';
|
|
242
|
+
}).join(' ');
|
|
243
|
+
return "".concat(left, " ").concat(!step || step == 1 ? '*' : "*/".concat(step)).concat(right ? " ".concat(right) : '');
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
var CronField = function CronField(_ref4) {
|
|
247
|
+
var _ref4$value = _ref4.value,
|
|
248
|
+
value = _ref4$value === void 0 ? '' : _ref4$value,
|
|
249
|
+
_onChange3 = _ref4.onChange;
|
|
250
|
+
|
|
251
|
+
var _useTranslation3 = useTranslation(),
|
|
252
|
+
t = _useTranslation3.t;
|
|
253
|
+
|
|
254
|
+
var cron = parseCronRule(value);
|
|
255
|
+
var unit = CronUnits[cron.mode - 1];
|
|
256
|
+
return /*#__PURE__*/React.createElement("fieldset", {
|
|
257
|
+
className: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: flex;\n gap: .5em;\n "])))
|
|
258
|
+
}, /*#__PURE__*/React.createElement(Select, {
|
|
259
|
+
value: cron.mode,
|
|
260
|
+
onChange: function onChange(v) {
|
|
261
|
+
return _onChange3(v ? getChangedCron({
|
|
262
|
+
step: cron.step,
|
|
263
|
+
mode: v
|
|
264
|
+
}) : '');
|
|
265
|
+
}
|
|
266
|
+
}, /*#__PURE__*/React.createElement(Select.Option, {
|
|
267
|
+
value: 0
|
|
268
|
+
}, t('No repeat')), CronUnits.map(function (item) {
|
|
269
|
+
return /*#__PURE__*/React.createElement(Select.Option, {
|
|
270
|
+
key: item.value,
|
|
271
|
+
value: item.value
|
|
272
|
+
}, t(item.option));
|
|
273
|
+
})), cron.mode ? /*#__PURE__*/React.createElement(InputNumber, {
|
|
274
|
+
value: cron.step,
|
|
275
|
+
onChange: function onChange(v) {
|
|
276
|
+
return _onChange3(getChangedCron({
|
|
277
|
+
step: v,
|
|
278
|
+
mode: cron.mode
|
|
279
|
+
}));
|
|
280
|
+
},
|
|
281
|
+
min: 1,
|
|
282
|
+
addonBefore: t('Every'),
|
|
283
|
+
addonAfter: t(unit.unitText)
|
|
284
|
+
}) : null);
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
var ModeFieldsets = {
|
|
288
|
+
0: {
|
|
289
|
+
startsOn: {
|
|
290
|
+
type: 'datetime',
|
|
291
|
+
name: 'startsOn',
|
|
292
|
+
title: '{{t("Starts on")}}',
|
|
293
|
+
'x-decorator': 'FormItem',
|
|
294
|
+
'x-component': 'DatePicker',
|
|
295
|
+
'x-component-props': {
|
|
296
|
+
showTime: true
|
|
297
|
+
},
|
|
298
|
+
required: true
|
|
299
|
+
},
|
|
300
|
+
cron: {
|
|
301
|
+
type: 'string',
|
|
302
|
+
name: 'cron',
|
|
303
|
+
title: '{{t("Repeat mode")}}',
|
|
304
|
+
'x-decorator': 'FormItem',
|
|
305
|
+
'x-component': 'CronField',
|
|
306
|
+
'x-reactions': [{
|
|
307
|
+
target: 'config.endsOn',
|
|
308
|
+
fulfill: {
|
|
309
|
+
state: {
|
|
310
|
+
visible: '{{!!$self.value}}'
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}, {
|
|
314
|
+
target: 'config.limit',
|
|
315
|
+
fulfill: {
|
|
316
|
+
state: {
|
|
317
|
+
visible: '{{!!$self.value}}'
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}]
|
|
321
|
+
},
|
|
322
|
+
endsOn: {
|
|
323
|
+
type: 'datetime',
|
|
324
|
+
name: 'endsOn',
|
|
325
|
+
title: '{{t("Ends on")}}',
|
|
326
|
+
'x-decorator': 'FormItem',
|
|
327
|
+
'x-component': 'DatePicker',
|
|
328
|
+
'x-component-props': {
|
|
329
|
+
showTime: true
|
|
330
|
+
}
|
|
331
|
+
},
|
|
332
|
+
limit: {
|
|
333
|
+
type: 'number',
|
|
334
|
+
name: 'limit',
|
|
335
|
+
title: '{{t("Repeat limit")}}',
|
|
336
|
+
'x-decorator': 'FormItem',
|
|
337
|
+
'x-component': 'InputNumber',
|
|
338
|
+
'x-component-props': {
|
|
339
|
+
placeholder: '{{t("No limit")}}',
|
|
340
|
+
min: 0
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
},
|
|
344
|
+
1: {
|
|
345
|
+
collection: _objectSpread(_objectSpread({}, collection), {}, {
|
|
346
|
+
'x-reactions': [].concat(_toConsumableArray(collection['x-reactions']), [{
|
|
347
|
+
// only full path works
|
|
348
|
+
target: 'config.startsOn',
|
|
349
|
+
fulfill: {
|
|
350
|
+
state: {
|
|
351
|
+
visible: '{{!!$self.value}}'
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
}])
|
|
355
|
+
}),
|
|
356
|
+
startsOn: {
|
|
357
|
+
type: 'object',
|
|
358
|
+
title: '{{t("Starts on")}}',
|
|
359
|
+
'x-decorator': 'FormItem',
|
|
360
|
+
'x-component': 'OnField',
|
|
361
|
+
required: true
|
|
362
|
+
},
|
|
363
|
+
cron: {
|
|
364
|
+
type: 'string',
|
|
365
|
+
name: 'cron',
|
|
366
|
+
title: '{{t("Repeat mode")}}',
|
|
367
|
+
'x-decorator': 'FormItem',
|
|
368
|
+
'x-component': 'CronField',
|
|
369
|
+
'x-reactions': [{
|
|
370
|
+
target: 'config.endsOn',
|
|
371
|
+
fulfill: {
|
|
372
|
+
state: {
|
|
373
|
+
visible: '{{!!$self.value}}'
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
}, {
|
|
377
|
+
target: 'config.limit',
|
|
378
|
+
fulfill: {
|
|
379
|
+
state: {
|
|
380
|
+
visible: '{{!!$self.value}}'
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
}]
|
|
384
|
+
},
|
|
385
|
+
endsOn: {
|
|
386
|
+
type: 'object',
|
|
387
|
+
title: '{{t("Ends on")}}',
|
|
388
|
+
'x-decorator': 'FormItem',
|
|
389
|
+
'x-component': 'EndsByField'
|
|
390
|
+
},
|
|
391
|
+
limit: {
|
|
392
|
+
type: 'number',
|
|
393
|
+
name: 'limit',
|
|
394
|
+
title: '{{t("Repeat limit")}}',
|
|
395
|
+
'x-decorator': 'FormItem',
|
|
396
|
+
'x-component': 'InputNumber',
|
|
397
|
+
'x-component-props': {
|
|
398
|
+
placeholder: '{{t("No limit")}}',
|
|
399
|
+
min: 0
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
var ScheduleConfig = function ScheduleConfig() {
|
|
406
|
+
var _useForm2 = useForm(),
|
|
407
|
+
_useForm2$values = _useForm2.values,
|
|
408
|
+
values = _useForm2$values === void 0 ? {} : _useForm2$values,
|
|
409
|
+
clearFormGraph = _useForm2.clearFormGraph;
|
|
410
|
+
|
|
411
|
+
var _values$config2 = values.config,
|
|
412
|
+
config = _values$config2 === void 0 ? {} : _values$config2;
|
|
413
|
+
|
|
414
|
+
var _useState5 = useState(config.mode),
|
|
415
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
416
|
+
mode = _useState6[0],
|
|
417
|
+
setMode = _useState6[1];
|
|
418
|
+
|
|
419
|
+
useFormEffects(function () {
|
|
420
|
+
onFieldValueChange('config.mode', function (field) {
|
|
421
|
+
setMode(field.value);
|
|
422
|
+
clearFormGraph('config.collection');
|
|
423
|
+
clearFormGraph('config.startsOn');
|
|
424
|
+
clearFormGraph('config.cron');
|
|
425
|
+
clearFormGraph('config.endsOn');
|
|
426
|
+
});
|
|
427
|
+
});
|
|
428
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SchemaComponent, {
|
|
429
|
+
schema: {
|
|
430
|
+
type: 'number',
|
|
431
|
+
title: '{{t("Trigger mode")}}',
|
|
432
|
+
name: 'mode',
|
|
433
|
+
'x-decorator': 'FormItem',
|
|
434
|
+
'x-component': 'Radio.Group',
|
|
435
|
+
'x-component-props': {
|
|
436
|
+
options: [{
|
|
437
|
+
value: 0,
|
|
438
|
+
label: '{{t("Based on certain date")}}'
|
|
439
|
+
}, {
|
|
440
|
+
value: 1,
|
|
441
|
+
label: '{{t("Based on date field of collection")}}'
|
|
442
|
+
}]
|
|
443
|
+
},
|
|
444
|
+
required: true
|
|
445
|
+
}
|
|
446
|
+
}), /*#__PURE__*/React.createElement(SchemaComponent, {
|
|
447
|
+
schema: {
|
|
448
|
+
type: 'void',
|
|
449
|
+
properties: _defineProperty({}, "mode-".concat(mode), {
|
|
450
|
+
type: 'void',
|
|
451
|
+
'x-component': 'fieldset',
|
|
452
|
+
'x-component-props': {
|
|
453
|
+
className: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n .ant-select{\n width: auto;\n min-width: 4em;\n }\n\n .ant-input-number{\n width: 4em;\n }\n\n .ant-picker{\n width: auto;\n }\n "])))
|
|
454
|
+
},
|
|
455
|
+
properties: ModeFieldsets[mode]
|
|
456
|
+
})
|
|
457
|
+
},
|
|
458
|
+
components: {
|
|
459
|
+
DateFieldsSelect: DateFieldsSelect,
|
|
460
|
+
OnField: OnField,
|
|
461
|
+
CronField: CronField,
|
|
462
|
+
EndsByField: EndsByField
|
|
463
|
+
}
|
|
464
|
+
}));
|
|
465
|
+
};
|
|
466
|
+
|
|
467
|
+
export default {
|
|
468
|
+
title: '{{t("Schedule event")}}',
|
|
469
|
+
type: 'schedule',
|
|
470
|
+
fieldset: {
|
|
471
|
+
config: {
|
|
472
|
+
type: 'object',
|
|
473
|
+
name: 'config',
|
|
474
|
+
'x-component': 'ScheduleConfig',
|
|
475
|
+
'x-component-props': {}
|
|
476
|
+
}
|
|
477
|
+
},
|
|
478
|
+
scope: {
|
|
479
|
+
useCollectionDataSource: useCollectionDataSource
|
|
480
|
+
},
|
|
481
|
+
components: {
|
|
482
|
+
// FieldsSelect
|
|
483
|
+
ScheduleConfig: ScheduleConfig
|
|
484
|
+
},
|
|
485
|
+
getter: function getter(_ref5) {
|
|
486
|
+
var _collections$find, _options$path;
|
|
487
|
+
|
|
488
|
+
var type = _ref5.type,
|
|
489
|
+
options = _ref5.options,
|
|
490
|
+
_onChange4 = _ref5.onChange;
|
|
491
|
+
|
|
492
|
+
var _useTranslation4 = useTranslation(),
|
|
493
|
+
t = _useTranslation4.t;
|
|
494
|
+
|
|
495
|
+
var compile = useCompile();
|
|
496
|
+
|
|
497
|
+
var _useCollectionManager2 = useCollectionManager(),
|
|
498
|
+
_useCollectionManager3 = _useCollectionManager2.collections,
|
|
499
|
+
collections = _useCollectionManager3 === void 0 ? [] : _useCollectionManager3;
|
|
500
|
+
|
|
501
|
+
var _useFlowContext = useFlowContext(),
|
|
502
|
+
workflow = _useFlowContext.workflow;
|
|
503
|
+
|
|
504
|
+
var collection = (_collections$find = collections.find(function (item) {
|
|
505
|
+
return item.name === workflow.config.collection;
|
|
506
|
+
})) !== null && _collections$find !== void 0 ? _collections$find : {
|
|
507
|
+
fields: []
|
|
508
|
+
};
|
|
509
|
+
return /*#__PURE__*/React.createElement(Select, {
|
|
510
|
+
placeholder: t('Fields'),
|
|
511
|
+
value: options === null || options === void 0 ? void 0 : (_options$path = options.path) === null || _options$path === void 0 ? void 0 : _options$path.replace(/^data\./, ''),
|
|
512
|
+
onChange: function onChange(path) {
|
|
513
|
+
_onChange4({
|
|
514
|
+
type: type,
|
|
515
|
+
options: _objectSpread(_objectSpread({}, options), {}, {
|
|
516
|
+
path: "data.".concat(path)
|
|
517
|
+
})
|
|
518
|
+
});
|
|
519
|
+
}
|
|
520
|
+
}, collection.fields.filter(function (field) {
|
|
521
|
+
var _field$uiSchema2;
|
|
522
|
+
|
|
523
|
+
return BaseTypeSet.has(field === null || field === void 0 ? void 0 : (_field$uiSchema2 = field.uiSchema) === null || _field$uiSchema2 === void 0 ? void 0 : _field$uiSchema2.type);
|
|
524
|
+
}).map(function (field) {
|
|
525
|
+
return /*#__PURE__*/React.createElement(Select.Option, {
|
|
526
|
+
key: field.name,
|
|
527
|
+
value: field.name
|
|
528
|
+
}, compile(field.uiSchema.title));
|
|
529
|
+
}));
|
|
530
|
+
}
|
|
531
|
+
};
|
|
@@ -7,6 +7,9 @@ export declare const useCreateActionProps: () => {
|
|
|
7
7
|
export declare const useCustomizeUpdateActionProps: () => {
|
|
8
8
|
onClick(): Promise<void>;
|
|
9
9
|
};
|
|
10
|
+
export declare const useCustomizeRequestActionProps: () => {
|
|
11
|
+
onClick(): Promise<void>;
|
|
12
|
+
};
|
|
10
13
|
export declare const useUpdateActionProps: () => {
|
|
11
14
|
onClick(): Promise<void>;
|
|
12
15
|
};
|