@nocobase/plugin-workflow 0.9.0-alpha.1 → 0.9.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/README.md +9 -0
- package/README.zh-CN.md +9 -0
- package/lib/client/AddButton.d.ts +1 -1
- package/lib/client/AddButton.js +7 -2
- package/lib/client/Branch.d.ts +1 -1
- package/lib/client/ExecutionCanvas.js +5 -10
- package/lib/client/WorkflowCanvas.js +11 -40
- package/lib/client/WorkflowProvider.js +10 -1
- package/lib/client/components/CollectionBlockInitializer.d.ts +7 -0
- package/lib/client/components/CollectionBlockInitializer.js +81 -0
- package/lib/client/components/CollectionFieldInitializers.d.ts +2 -0
- package/lib/client/components/CollectionFieldInitializers.js +89 -0
- package/lib/client/components/CollectionFieldset.js +21 -25
- package/lib/client/components/FilterDynamicComponent.d.ts +6 -0
- package/lib/client/components/FilterDynamicComponent.js +43 -0
- package/lib/client/components/NullRender.d.ts +1 -0
- package/lib/client/components/NullRender.js +10 -0
- package/lib/client/components/RadioWithTooltip.d.ts +7 -0
- package/lib/client/components/RadioWithTooltip.js +94 -0
- package/lib/client/constants.d.ts +10 -8
- package/lib/client/constants.js +52 -14
- package/lib/client/index.d.ts +0 -1
- package/lib/client/index.js +1 -10
- package/lib/client/locale/en-US.d.ts +38 -13
- package/lib/client/locale/en-US.js +39 -14
- package/lib/client/locale/index.js +12 -29
- package/lib/client/locale/zh-CN.d.ts +47 -20
- package/lib/client/locale/zh-CN.js +48 -21
- package/lib/client/nodes/calculation.d.ts +40 -6
- package/lib/client/nodes/calculation.js +171 -19
- package/lib/client/nodes/condition.d.ts +67 -0
- package/lib/client/nodes/condition.js +287 -27
- package/lib/client/nodes/create.d.ts +8 -6
- package/lib/client/nodes/create.js +27 -33
- package/lib/client/nodes/delay.d.ts +2 -0
- package/lib/client/nodes/delay.js +8 -4
- package/lib/client/nodes/destroy.d.ts +2 -2
- package/lib/client/nodes/destroy.js +2 -2
- package/lib/client/nodes/index.d.ts +10 -2
- package/lib/client/nodes/index.js +73 -27
- package/lib/client/nodes/manual/AssigneesSelect.d.ts +6 -0
- package/lib/client/nodes/manual/AssigneesSelect.js +64 -0
- package/lib/client/nodes/manual/ModeConfig.d.ts +5 -0
- package/lib/client/nodes/manual/ModeConfig.js +160 -0
- package/lib/client/nodes/manual/SchemaConfig.d.ts +6 -0
- package/lib/client/nodes/manual/SchemaConfig.js +715 -0
- package/lib/client/nodes/manual/WorkflowTodo.d.ts +8 -0
- package/lib/client/nodes/manual/WorkflowTodo.js +691 -0
- package/lib/client/nodes/manual/WorkflowTodoBlockInitializer.d.ts +5 -0
- package/lib/client/nodes/manual/WorkflowTodoBlockInitializer.js +75 -0
- package/lib/client/nodes/manual/index.d.ts +64 -0
- package/lib/client/nodes/manual/index.js +146 -0
- package/lib/client/nodes/parallel.d.ts +11 -5
- package/lib/client/nodes/parallel.js +22 -34
- package/lib/client/nodes/query.d.ts +9 -14
- package/lib/client/nodes/query.js +38 -44
- package/lib/client/nodes/request.d.ts +75 -33
- package/lib/client/nodes/request.js +124 -63
- package/lib/client/nodes/update.d.ts +2 -2
- package/lib/client/nodes/update.js +2 -2
- package/lib/client/schemas/collection.js +1 -1
- package/lib/client/schemas/executions.js +1 -1
- package/lib/client/schemas/workflows.js +1 -1
- package/lib/client/style.js +0 -4
- package/lib/client/triggers/collection.d.ts +7 -3
- package/lib/client/triggers/collection.js +39 -48
- package/lib/client/triggers/index.d.ts +5 -2
- package/lib/client/triggers/index.js +34 -12
- package/lib/client/triggers/schedule/index.d.ts +7 -5
- package/lib/client/triggers/schedule/index.js +38 -79
- package/lib/client/utils.d.ts +1 -0
- package/lib/client/utils.js +38 -0
- package/lib/client/variable.d.ts +21 -0
- package/lib/client/variable.js +147 -0
- package/lib/server/Plugin.d.ts +3 -3
- package/lib/server/Plugin.js +12 -21
- package/lib/server/Processor.d.ts +9 -2
- package/lib/server/Processor.js +39 -43
- package/lib/server/actions/index.js +2 -4
- package/lib/server/actions/workflows.d.ts +1 -0
- package/lib/server/actions/workflows.js +80 -23
- package/lib/server/collections/executions.js +5 -7
- package/lib/server/collections/flow_nodes.js +6 -18
- package/lib/server/collections/jobs.js +3 -1
- package/lib/server/collections/workflows.js +8 -4
- package/lib/server/constants.d.ts +9 -3
- package/lib/server/constants.js +11 -5
- package/lib/server/functions/index.d.ts +4 -0
- package/lib/server/functions/index.js +38 -0
- package/lib/server/index.d.ts +0 -1
- package/lib/server/index.js +0 -14
- package/lib/server/instructions/calculation.d.ts +2 -7
- package/lib/server/instructions/calculation.js +32 -37
- package/lib/server/instructions/condition.d.ts +4 -4
- package/lib/server/instructions/condition.js +126 -54
- package/lib/server/instructions/index.js +1 -1
- package/lib/server/instructions/manual/actions.js +101 -0
- package/lib/server/{extensions/assignees/collections → instructions/manual/collecions}/jobs.d.ts +2 -0
- package/lib/server/{extensions/assignees/collections → instructions/manual/collecions}/jobs.js +2 -1
- package/lib/server/{extensions/assignees/collections → instructions/manual/collecions}/users_jobs.js +10 -10
- package/lib/server/instructions/manual/index.d.ts +25 -0
- package/lib/server/instructions/manual/index.js +200 -0
- package/lib/server/instructions/parallel.js +11 -7
- package/lib/server/instructions/request.d.ts +8 -4
- package/lib/server/instructions/request.js +60 -94
- package/lib/server/migrations/20230221032941-change-request-body-type.d.ts +5 -0
- package/lib/server/migrations/20230221032941-change-request-body-type.js +113 -0
- package/lib/server/migrations/20230221071831-calculation-expression.d.ts +4 -0
- package/lib/server/migrations/20230221071831-calculation-expression.js +143 -0
- package/lib/server/migrations/20230221121203-condition-calculation.d.ts +4 -0
- package/lib/server/migrations/20230221121203-condition-calculation.js +126 -0
- package/lib/server/migrations/20230221162902-jsonb-to-json.d.ts +4 -0
- package/lib/server/migrations/20230221162902-jsonb-to-json.js +81 -0
- package/lib/server/triggers/schedule.js +11 -3
- package/package.json +11 -10
- package/lib/client/calculators.d.ts +0 -89
- package/lib/client/calculators.js +0 -668
- package/lib/client/components/CollectionFieldSelect.d.ts +0 -2
- package/lib/client/components/CollectionFieldSelect.js +0 -106
- package/lib/client/components/EjsTextArea.d.ts +0 -2
- package/lib/client/components/EjsTextArea.js +0 -232
- package/lib/server/actions/jobs.d.ts +0 -2
- package/lib/server/actions/jobs.js +0 -39
- package/lib/server/calculators/index.d.ts +0 -40
- package/lib/server/calculators/index.js +0 -187
- package/lib/server/extensions/assignees/actions.js +0 -75
- package/lib/server/extensions/assignees/index.d.ts +0 -2
- package/lib/server/extensions/assignees/index.js +0 -273
- package/lib/server/extensions/index.d.ts +0 -3
- package/lib/server/extensions/index.js +0 -13
- package/lib/server/instructions/prompt.d.ts +0 -19
- package/lib/server/instructions/prompt.js +0 -131
- /package/lib/server/{extensions/assignees → instructions/manual}/actions.d.ts +0 -0
- /package/lib/server/{extensions/assignees/collections → instructions/manual/collecions}/users.d.ts +0 -0
- /package/lib/server/{extensions/assignees/collections → instructions/manual/collecions}/users.js +0 -0
- /package/lib/server/{extensions/assignees/collections → instructions/manual/collecions}/users_jobs.d.ts +0 -0
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ISchema } from '@formily/react';
|
|
3
3
|
import { Registry } from '@nocobase/utils/client';
|
|
4
|
+
import { SchemaInitializerItemOptions } from '@nocobase/client';
|
|
5
|
+
import { VariableOption } from '../variable';
|
|
4
6
|
export interface Instruction {
|
|
5
7
|
title: string;
|
|
6
8
|
type: string;
|
|
@@ -20,12 +22,18 @@ export interface Instruction {
|
|
|
20
22
|
components?: {
|
|
21
23
|
[key: string]: any;
|
|
22
24
|
};
|
|
23
|
-
render?(props: any): React.
|
|
25
|
+
render?(props: any): React.ReactNode;
|
|
24
26
|
endding?: boolean;
|
|
25
|
-
|
|
27
|
+
getOptions?(config: any, types?: any): VariableOption[] | null;
|
|
28
|
+
useInitializers?(node: any): SchemaInitializerItemOptions | null;
|
|
29
|
+
initializers?: {
|
|
30
|
+
[key: string]: any;
|
|
31
|
+
};
|
|
26
32
|
}
|
|
27
33
|
export declare const instructions: Registry<Instruction>;
|
|
34
|
+
export declare const NodeContext: React.Context<any>;
|
|
28
35
|
export declare function useNodeContext(): any;
|
|
36
|
+
export declare function useAvailableUpstreams(node: any): any[];
|
|
29
37
|
export declare function Node({ data }: {
|
|
30
38
|
data: any;
|
|
31
39
|
}): JSX.Element;
|
|
@@ -5,9 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.JobButton = JobButton;
|
|
7
7
|
exports.Node = Node;
|
|
8
|
+
exports.NodeContext = void 0;
|
|
8
9
|
exports.NodeDefaultView = NodeDefaultView;
|
|
9
10
|
exports.RemoveButton = RemoveButton;
|
|
10
11
|
exports.instructions = void 0;
|
|
12
|
+
exports.useAvailableUpstreams = useAvailableUpstreams;
|
|
11
13
|
exports.useNodeContext = useNodeContext;
|
|
12
14
|
|
|
13
15
|
function _react() {
|
|
@@ -114,6 +116,8 @@ var _parallel = _interopRequireDefault(require("./parallel"));
|
|
|
114
116
|
|
|
115
117
|
var _delay = _interopRequireDefault(require("./delay"));
|
|
116
118
|
|
|
119
|
+
var _manual = _interopRequireDefault(require("./manual"));
|
|
120
|
+
|
|
117
121
|
var _query = _interopRequireDefault(require("./query"));
|
|
118
122
|
|
|
119
123
|
var _create = _interopRequireDefault(require("./create"));
|
|
@@ -134,6 +138,12 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
134
138
|
|
|
135
139
|
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; }
|
|
136
140
|
|
|
141
|
+
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; }
|
|
142
|
+
|
|
143
|
+
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; }
|
|
144
|
+
|
|
145
|
+
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; }
|
|
146
|
+
|
|
137
147
|
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); } }
|
|
138
148
|
|
|
139
149
|
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); }); }; }
|
|
@@ -145,6 +155,7 @@ instructions.register('condition', _condition.default);
|
|
|
145
155
|
instructions.register('parallel', _parallel.default);
|
|
146
156
|
instructions.register('calculation', _calculation.default);
|
|
147
157
|
instructions.register('delay', _delay.default);
|
|
158
|
+
instructions.register('manual', _manual.default);
|
|
148
159
|
instructions.register('query', _query.default);
|
|
149
160
|
instructions.register('create', _create.default);
|
|
150
161
|
instructions.register('update', _update.default);
|
|
@@ -167,15 +178,22 @@ function useUpdateAction() {
|
|
|
167
178
|
return {
|
|
168
179
|
run() {
|
|
169
180
|
return _asyncToGenerator(function* () {
|
|
181
|
+
var _api$resource$update, _api$resource;
|
|
182
|
+
|
|
170
183
|
if (workflow.executed) {
|
|
171
184
|
_antd().message.error((0, _locale.lang)('Node in executed workflow cannot be modified'));
|
|
172
185
|
|
|
173
186
|
return;
|
|
174
187
|
} // TODO: how to do validation separately for each field? especially disabled for dynamic fields?
|
|
175
|
-
// await form.submit();
|
|
176
188
|
|
|
177
189
|
|
|
178
|
-
|
|
190
|
+
try {
|
|
191
|
+
yield form.submit();
|
|
192
|
+
} catch (err) {
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
yield (_api$resource$update = (_api$resource = api.resource('flow_nodes', data.id)).update) === null || _api$resource$update === void 0 ? void 0 : _api$resource$update.call(_api$resource, {
|
|
179
197
|
filterByTk: data.id,
|
|
180
198
|
values: {
|
|
181
199
|
title: form.values.title,
|
|
@@ -192,12 +210,24 @@ function useUpdateAction() {
|
|
|
192
210
|
|
|
193
211
|
;
|
|
194
212
|
|
|
195
|
-
const NodeContext = _react().default.createContext(
|
|
213
|
+
const NodeContext = _react().default.createContext({});
|
|
214
|
+
|
|
215
|
+
exports.NodeContext = NodeContext;
|
|
196
216
|
|
|
197
217
|
function useNodeContext() {
|
|
198
218
|
return (0, _react().useContext)(NodeContext);
|
|
199
219
|
}
|
|
200
220
|
|
|
221
|
+
function useAvailableUpstreams(node) {
|
|
222
|
+
const stack = [];
|
|
223
|
+
|
|
224
|
+
for (let current = node.upstream; current; current = current.upstream) {
|
|
225
|
+
stack.push(current);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
return stack;
|
|
229
|
+
}
|
|
230
|
+
|
|
201
231
|
function Node({
|
|
202
232
|
data
|
|
203
233
|
}) {
|
|
@@ -263,7 +293,9 @@ function RemoveButton() {
|
|
|
263
293
|
|
|
264
294
|
function _onOk() {
|
|
265
295
|
_onOk = _asyncToGenerator(function* () {
|
|
266
|
-
|
|
296
|
+
var _resource$destroy;
|
|
297
|
+
|
|
298
|
+
const _yield$resource$destr = yield (_resource$destroy = resource.destroy) === null || _resource$destroy === void 0 ? void 0 : _resource$destroy.call(resource, {
|
|
267
299
|
filterByTk: current.id
|
|
268
300
|
}),
|
|
269
301
|
node = _yield$resource$destr.data.data;
|
|
@@ -353,21 +385,26 @@ function JobButton() {
|
|
|
353
385
|
schema: {
|
|
354
386
|
type: 'void',
|
|
355
387
|
properties: {
|
|
356
|
-
job: {
|
|
388
|
+
[`${job.id}-button`]: {
|
|
357
389
|
type: 'void',
|
|
358
390
|
'x-component': 'Action',
|
|
359
391
|
'x-component-props': {
|
|
360
|
-
title:
|
|
392
|
+
title: _react().default.createElement(_antd().Tag, {
|
|
393
|
+
color: color
|
|
394
|
+
}, icon),
|
|
361
395
|
shape: 'circle',
|
|
362
396
|
className: ['workflow-node-job-button', (0, _css().css)`
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
397
|
+
.ant-tag{
|
|
398
|
+
padding: 0;
|
|
399
|
+
width: 100%;
|
|
400
|
+
line-height: 18px;
|
|
401
|
+
margin-right: 0;
|
|
402
|
+
border-radius: 50%;
|
|
366
403
|
}
|
|
367
404
|
`]
|
|
368
405
|
},
|
|
369
406
|
properties: {
|
|
370
|
-
[job.id]: {
|
|
407
|
+
[`${job.id}-modal`]: {
|
|
371
408
|
type: 'void',
|
|
372
409
|
'x-decorator': 'Form',
|
|
373
410
|
'x-decorator-props': {
|
|
@@ -453,8 +490,9 @@ function NodeDefaultView(props) {
|
|
|
453
490
|
components: instruction.components,
|
|
454
491
|
schema: {
|
|
455
492
|
type: 'void',
|
|
456
|
-
properties: {
|
|
457
|
-
view: instruction.view
|
|
493
|
+
properties: _objectSpread(_objectSpread({}, instruction.view ? {
|
|
494
|
+
view: instruction.view
|
|
495
|
+
} : {}), {}, {
|
|
458
496
|
config: {
|
|
459
497
|
type: 'void',
|
|
460
498
|
title: detailText,
|
|
@@ -463,12 +501,14 @@ function NodeDefaultView(props) {
|
|
|
463
501
|
type: 'primary'
|
|
464
502
|
},
|
|
465
503
|
properties: {
|
|
466
|
-
[instruction.type]: {
|
|
504
|
+
[`${instruction.type}_${data.id}`]: {
|
|
467
505
|
type: 'void',
|
|
468
506
|
title: instruction.title,
|
|
469
507
|
'x-component': 'Action.Drawer',
|
|
470
508
|
'x-decorator': 'Form',
|
|
471
509
|
'x-decorator-props': {
|
|
510
|
+
disabled: workflow.executed,
|
|
511
|
+
|
|
472
512
|
useValues(options) {
|
|
473
513
|
const d = useNodeContext();
|
|
474
514
|
return (0, _client2().useRequest)(() => {
|
|
@@ -479,7 +519,21 @@ function NodeDefaultView(props) {
|
|
|
479
519
|
}
|
|
480
520
|
|
|
481
521
|
},
|
|
482
|
-
properties: {
|
|
522
|
+
properties: _objectSpread(_objectSpread({}, workflow.executed ? {
|
|
523
|
+
alert: {
|
|
524
|
+
'x-component': _antd().Alert,
|
|
525
|
+
'x-component-props': {
|
|
526
|
+
type: 'warning',
|
|
527
|
+
showIcon: true,
|
|
528
|
+
message: `{{t("Node in executed workflow cannot be modified", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
529
|
+
className: (0, _css().css)`
|
|
530
|
+
width: 100%;
|
|
531
|
+
font-size: 85%;
|
|
532
|
+
margin-bottom: 2em;
|
|
533
|
+
`
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
} : {}), {}, {
|
|
483
537
|
title: {
|
|
484
538
|
type: 'string',
|
|
485
539
|
name: 'title',
|
|
@@ -492,8 +546,8 @@ function NodeDefaultView(props) {
|
|
|
492
546
|
name: 'config',
|
|
493
547
|
'x-component': 'fieldset',
|
|
494
548
|
'x-component-props': {
|
|
495
|
-
disabled: workflow.executed,
|
|
496
549
|
className: (0, _css().css)`
|
|
550
|
+
.ant-input,
|
|
497
551
|
.ant-select,
|
|
498
552
|
.ant-cascader-picker,
|
|
499
553
|
.ant-picker,
|
|
@@ -506,18 +560,10 @@ function NodeDefaultView(props) {
|
|
|
506
560
|
},
|
|
507
561
|
properties: instruction.fieldset
|
|
508
562
|
},
|
|
509
|
-
actions: {
|
|
563
|
+
actions: workflow.executed ? null : {
|
|
510
564
|
type: 'void',
|
|
511
565
|
'x-component': 'Action.Drawer.Footer',
|
|
512
|
-
properties:
|
|
513
|
-
close: {
|
|
514
|
-
title: '{{t("Close")}}',
|
|
515
|
-
'x-component': 'Action',
|
|
516
|
-
'x-component-props': {
|
|
517
|
-
useAction: '{{ cm.useCancelAction }}'
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
} : {
|
|
566
|
+
properties: {
|
|
521
567
|
cancel: {
|
|
522
568
|
title: '{{t("Cancel")}}',
|
|
523
569
|
'x-component': 'Action',
|
|
@@ -535,11 +581,11 @@ function NodeDefaultView(props) {
|
|
|
535
581
|
}
|
|
536
582
|
}
|
|
537
583
|
}
|
|
538
|
-
}
|
|
584
|
+
})
|
|
539
585
|
}
|
|
540
586
|
}
|
|
541
587
|
}
|
|
542
|
-
}
|
|
588
|
+
})
|
|
543
589
|
}
|
|
544
590
|
})), children);
|
|
545
591
|
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.AssigneesSelect = AssigneesSelect;
|
|
7
|
+
|
|
8
|
+
function _client() {
|
|
9
|
+
const data = require("@nocobase/client");
|
|
10
|
+
|
|
11
|
+
_client = function _client() {
|
|
12
|
+
return data;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
return data;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function _react() {
|
|
19
|
+
const data = _interopRequireDefault(require("react"));
|
|
20
|
+
|
|
21
|
+
_react = function _react() {
|
|
22
|
+
return data;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
return data;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
var _variable = require("../../variable");
|
|
29
|
+
|
|
30
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
31
|
+
|
|
32
|
+
function AssigneesSelect({
|
|
33
|
+
multiple = false,
|
|
34
|
+
value = [],
|
|
35
|
+
onChange: _onChange
|
|
36
|
+
}) {
|
|
37
|
+
const scope = (0, _variable.useWorkflowVariableOptions)();
|
|
38
|
+
console.log(value);
|
|
39
|
+
return _react().default.createElement(_client().Variable.Input, {
|
|
40
|
+
scope: scope,
|
|
41
|
+
types: [{
|
|
42
|
+
type: 'reference',
|
|
43
|
+
options: {
|
|
44
|
+
collection: 'users'
|
|
45
|
+
}
|
|
46
|
+
}],
|
|
47
|
+
value: value[0],
|
|
48
|
+
onChange: next => {
|
|
49
|
+
_onChange([next]);
|
|
50
|
+
}
|
|
51
|
+
}, _react().default.createElement(_client().RemoteSelect, {
|
|
52
|
+
fieldNames: {
|
|
53
|
+
label: 'nickname',
|
|
54
|
+
value: 'id'
|
|
55
|
+
},
|
|
56
|
+
service: {
|
|
57
|
+
resource: 'users'
|
|
58
|
+
},
|
|
59
|
+
value: value[0],
|
|
60
|
+
onChange: v => {
|
|
61
|
+
_onChange([v]);
|
|
62
|
+
}
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ModeConfig = ModeConfig;
|
|
7
|
+
|
|
8
|
+
function _react() {
|
|
9
|
+
const data = _interopRequireDefault(require("react"));
|
|
10
|
+
|
|
11
|
+
_react = function _react() {
|
|
12
|
+
return data;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
return data;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function _antd() {
|
|
19
|
+
const data = require("@formily/antd");
|
|
20
|
+
|
|
21
|
+
_antd = function _antd() {
|
|
22
|
+
return data;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
return data;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function _antd2() {
|
|
29
|
+
const data = require("antd");
|
|
30
|
+
|
|
31
|
+
_antd2 = function _antd2() {
|
|
32
|
+
return data;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
return data;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function _icons() {
|
|
39
|
+
const data = require("@ant-design/icons");
|
|
40
|
+
|
|
41
|
+
_icons = function _icons() {
|
|
42
|
+
return data;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
return data;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function _css() {
|
|
49
|
+
const data = require("@emotion/css");
|
|
50
|
+
|
|
51
|
+
_css = function _css() {
|
|
52
|
+
return data;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
return data;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function _client() {
|
|
59
|
+
const data = require("@nocobase/client");
|
|
60
|
+
|
|
61
|
+
_client = function _client() {
|
|
62
|
+
return data;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
return data;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
var _locale = require("../../locale");
|
|
69
|
+
|
|
70
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
71
|
+
|
|
72
|
+
function parseMode(v) {
|
|
73
|
+
if (!v) {
|
|
74
|
+
return 'single';
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (v >= 1) {
|
|
78
|
+
return 'all';
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (v <= -1) {
|
|
82
|
+
return 'any';
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const dir = Math.sign(v);
|
|
86
|
+
|
|
87
|
+
if (dir > 0) {
|
|
88
|
+
return '';
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function ModeConfig({
|
|
93
|
+
value,
|
|
94
|
+
onChange: _onChange
|
|
95
|
+
}) {
|
|
96
|
+
const mode = parseMode(value);
|
|
97
|
+
return _react().default.createElement("fieldset", {
|
|
98
|
+
className: (0, _css().css)`
|
|
99
|
+
.ant-radio-group{
|
|
100
|
+
.anticon{
|
|
101
|
+
margin-left: .5em;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
`
|
|
105
|
+
}, _react().default.createElement(_antd2().Form.Item, null, _react().default.createElement(_antd2().Radio.Group, {
|
|
106
|
+
value: Boolean(value),
|
|
107
|
+
onChange: ({
|
|
108
|
+
target: {
|
|
109
|
+
value: v
|
|
110
|
+
}
|
|
111
|
+
}) => {
|
|
112
|
+
console.log(v);
|
|
113
|
+
|
|
114
|
+
_onChange(Number(v));
|
|
115
|
+
}
|
|
116
|
+
}, _react().default.createElement(_antd2().Radio, {
|
|
117
|
+
value: true
|
|
118
|
+
}, _react().default.createElement(_antd2().Tooltip, {
|
|
119
|
+
title: (0, _locale.lang)('Each user has own task'),
|
|
120
|
+
placement: "bottom"
|
|
121
|
+
}, _react().default.createElement("span", null, (0, _locale.lang)('Separately')), _react().default.createElement(_icons().QuestionCircleOutlined, {
|
|
122
|
+
style: {
|
|
123
|
+
color: '#999'
|
|
124
|
+
}
|
|
125
|
+
}))), _react().default.createElement(_antd2().Radio, {
|
|
126
|
+
value: false
|
|
127
|
+
}, _react().default.createElement(_antd2().Tooltip, {
|
|
128
|
+
title: (0, _locale.lang)('Everyone shares one task'),
|
|
129
|
+
placement: "bottom"
|
|
130
|
+
}, _react().default.createElement("span", null, (0, _locale.lang)('Collaboratively')), _react().default.createElement(_icons().QuestionCircleOutlined, {
|
|
131
|
+
style: {
|
|
132
|
+
color: '#999'
|
|
133
|
+
}
|
|
134
|
+
}))))), value ? _react().default.createElement("fieldset", null, _react().default.createElement(_antd().FormLayout, {
|
|
135
|
+
layout: "vertical"
|
|
136
|
+
}, _react().default.createElement(_client().FormItem, {
|
|
137
|
+
label: (0, _locale.lang)('Negotiation')
|
|
138
|
+
}, _react().default.createElement(_antd2().Radio.Group, {
|
|
139
|
+
value: value,
|
|
140
|
+
onChange: _onChange
|
|
141
|
+
}, _react().default.createElement(_antd2().Radio, {
|
|
142
|
+
value: 1
|
|
143
|
+
}, _react().default.createElement(_antd2().Tooltip, {
|
|
144
|
+
title: (0, _locale.lang)('Everyone should pass'),
|
|
145
|
+
placement: "bottom"
|
|
146
|
+
}, _react().default.createElement("span", null, (0, _locale.lang)('All pass')), _react().default.createElement(_icons().QuestionCircleOutlined, {
|
|
147
|
+
style: {
|
|
148
|
+
color: '#999'
|
|
149
|
+
}
|
|
150
|
+
}))), _react().default.createElement(_antd2().Radio, {
|
|
151
|
+
value: -1
|
|
152
|
+
}, _react().default.createElement(_antd2().Tooltip, {
|
|
153
|
+
title: (0, _locale.lang)('Anyone pass'),
|
|
154
|
+
placement: "bottom"
|
|
155
|
+
}, _react().default.createElement("span", null, (0, _locale.lang)('Any pass')), _react().default.createElement(_icons().QuestionCircleOutlined, {
|
|
156
|
+
style: {
|
|
157
|
+
color: '#999'
|
|
158
|
+
}
|
|
159
|
+
}))))))) : null);
|
|
160
|
+
}
|