@nocobase/client 0.7.0-alpha.2 → 0.7.0-alpha.20
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/esm/acl/Configuration/RoleConfigure.js +4 -4
- package/esm/acl/Configuration/RoleConfigure.js.map +1 -1
- package/esm/acl/Configuration/schemas/roles.js +1 -1
- package/esm/acl/Configuration/schemas/roles.js.map +1 -1
- package/esm/locale/index.d.ts +5 -0
- package/esm/locale/zh_CN.d.ts +5 -0
- package/esm/locale/zh_CN.js +5 -0
- package/esm/locale/zh_CN.js.map +1 -1
- package/esm/schema-component/antd/menu/Menu.js +1 -1
- package/esm/schema-component/antd/menu/Menu.js.map +1 -1
- package/esm/schema-initializer/buttons/BlockInitializers.d.ts +2 -11
- package/esm/schema-initializer/buttons/BlockInitializers.js +2 -0
- package/esm/schema-initializer/buttons/BlockInitializers.js.map +1 -1
- package/esm/workflow/calculators.js +2 -4
- package/esm/workflow/calculators.js.map +1 -1
- package/esm/workflow/nodes/calculation.d.ts +1 -1
- package/esm/workflow/nodes/calculation.js +9 -3
- package/esm/workflow/nodes/calculation.js.map +1 -1
- package/esm/workflow/nodes/condition.d.ts +3 -3
- package/esm/workflow/nodes/condition.js +15 -9
- package/esm/workflow/nodes/condition.js.map +1 -1
- package/esm/workflow/nodes/create.d.ts +3 -3
- package/esm/workflow/nodes/create.js +5 -5
- package/esm/workflow/nodes/create.js.map +1 -1
- package/esm/workflow/nodes/destroy.d.ts +2 -2
- package/esm/workflow/nodes/destroy.js +3 -3
- package/esm/workflow/nodes/destroy.js.map +1 -1
- package/esm/workflow/nodes/index.d.ts +1 -1
- package/esm/workflow/nodes/index.js +75 -56
- package/esm/workflow/nodes/index.js.map +1 -1
- package/esm/workflow/nodes/parallel.d.ts +2 -2
- package/esm/workflow/nodes/parallel.js +11 -5
- package/esm/workflow/nodes/parallel.js.map +1 -1
- package/esm/workflow/nodes/query.d.ts +3 -3
- package/esm/workflow/nodes/query.js +5 -5
- package/esm/workflow/nodes/query.js.map +1 -1
- package/esm/workflow/nodes/update.d.ts +2 -2
- package/esm/workflow/nodes/update.js +3 -3
- package/esm/workflow/nodes/update.js.map +1 -1
- package/esm/workflow/schemas/collection.js +10 -6
- package/esm/workflow/schemas/collection.js.map +1 -1
- package/esm/workflow/schemas/workflows.js +20 -12
- package/esm/workflow/schemas/workflows.js.map +1 -1
- package/esm/workflow/triggers/index.js +19 -9
- package/esm/workflow/triggers/index.js.map +1 -1
- package/esm/workflow/triggers/model.d.ts +18 -4
- package/esm/workflow/triggers/model.js +47 -9
- package/esm/workflow/triggers/model.js.map +1 -1
- package/lib/acl/Configuration/RoleConfigure.js +4 -4
- package/lib/acl/Configuration/RoleConfigure.js.map +1 -1
- package/lib/acl/Configuration/schemas/roles.js +1 -1
- package/lib/acl/Configuration/schemas/roles.js.map +1 -1
- package/lib/locale/index.d.ts +5 -0
- package/lib/locale/zh_CN.d.ts +5 -0
- package/lib/locale/zh_CN.js +5 -0
- package/lib/locale/zh_CN.js.map +1 -1
- package/lib/schema-component/antd/menu/Menu.js +1 -1
- package/lib/schema-component/antd/menu/Menu.js.map +1 -1
- package/lib/schema-initializer/buttons/BlockInitializers.d.ts +2 -11
- package/lib/schema-initializer/buttons/BlockInitializers.js +2 -0
- package/lib/schema-initializer/buttons/BlockInitializers.js.map +1 -1
- package/lib/workflow/calculators.js +2 -4
- package/lib/workflow/calculators.js.map +1 -1
- package/lib/workflow/nodes/calculation.d.ts +1 -1
- package/lib/workflow/nodes/calculation.js +9 -3
- package/lib/workflow/nodes/calculation.js.map +1 -1
- package/lib/workflow/nodes/condition.d.ts +3 -3
- package/lib/workflow/nodes/condition.js +13 -7
- package/lib/workflow/nodes/condition.js.map +1 -1
- package/lib/workflow/nodes/create.d.ts +3 -3
- package/lib/workflow/nodes/create.js +5 -5
- package/lib/workflow/nodes/create.js.map +1 -1
- package/lib/workflow/nodes/destroy.d.ts +2 -2
- package/lib/workflow/nodes/destroy.js +3 -3
- package/lib/workflow/nodes/destroy.js.map +1 -1
- package/lib/workflow/nodes/index.d.ts +1 -1
- package/lib/workflow/nodes/index.js +79 -60
- package/lib/workflow/nodes/index.js.map +1 -1
- package/lib/workflow/nodes/parallel.d.ts +2 -2
- package/lib/workflow/nodes/parallel.js +10 -4
- package/lib/workflow/nodes/parallel.js.map +1 -1
- package/lib/workflow/nodes/query.d.ts +3 -3
- package/lib/workflow/nodes/query.js +5 -5
- package/lib/workflow/nodes/query.js.map +1 -1
- package/lib/workflow/nodes/update.d.ts +2 -2
- package/lib/workflow/nodes/update.js +3 -3
- package/lib/workflow/nodes/update.js.map +1 -1
- package/lib/workflow/schemas/collection.js +10 -6
- package/lib/workflow/schemas/collection.js.map +1 -1
- package/lib/workflow/schemas/workflows.js +20 -12
- package/lib/workflow/schemas/workflows.js.map +1 -1
- package/lib/workflow/triggers/index.js +19 -9
- package/lib/workflow/triggers/index.js.map +1 -1
- package/lib/workflow/triggers/model.d.ts +18 -4
- package/lib/workflow/triggers/model.js +47 -9
- package/lib/workflow/triggers/model.js.map +1 -1
- package/package.json +4 -4
- package/src/acl/Configuration/RoleConfigure.tsx +4 -4
- package/src/acl/Configuration/schemas/roles.ts +1 -1
- package/src/locale/zh_CN.ts +5 -1
- package/src/schema-component/antd/menu/Menu.tsx +2 -1
- package/src/schema-initializer/buttons/BlockInitializers.tsx +2 -0
- package/src/workflow/calculators.tsx +2 -4
- package/src/workflow/nodes/calculation.tsx +4 -3
- package/src/workflow/nodes/condition.tsx +35 -12
- package/src/workflow/nodes/create.tsx +10 -7
- package/src/workflow/nodes/destroy.tsx +3 -3
- package/src/workflow/nodes/index.tsx +64 -59
- package/src/workflow/nodes/parallel.tsx +25 -5
- package/src/workflow/nodes/query.tsx +5 -5
- package/src/workflow/nodes/update.tsx +3 -3
- package/src/workflow/schemas/collection.ts +9 -7
- package/src/workflow/schemas/workflows.ts +20 -12
- package/src/workflow/triggers/index.tsx +11 -9
- package/src/workflow/triggers/model.tsx +48 -9
|
@@ -50,22 +50,22 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
52
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
53
|
-
import
|
|
53
|
+
import { CloseOutlined, DeleteOutlined } from '@ant-design/icons';
|
|
54
54
|
import { css, cx } from '@emotion/css';
|
|
55
|
-
import { Button, Modal, Tag } from 'antd';
|
|
56
|
-
import { DeleteOutlined, CloseOutlined } from '@ant-design/icons';
|
|
57
55
|
import { useForm } from '@formily/react';
|
|
58
56
|
import { Registry } from '@nocobase/utils';
|
|
57
|
+
import { Button, Modal, Tag } from 'antd';
|
|
58
|
+
import React, { useContext } from 'react';
|
|
59
59
|
import { SchemaComponent, useActionContext, useAPIClient, useCollection, useRequest, useResourceActionContext } from '../..';
|
|
60
|
+
import { nodeBlockClass, nodeCardClass, nodeClass, nodeHeaderClass, nodeTitleClass } from '../style';
|
|
60
61
|
import { AddButton, useFlowContext } from '../WorkflowCanvas';
|
|
61
|
-
import
|
|
62
|
-
import
|
|
62
|
+
import calculation from './calculation';
|
|
63
|
+
import condition from './condition';
|
|
63
64
|
import create from './create';
|
|
64
|
-
import update from './update';
|
|
65
65
|
import destroy from './destroy';
|
|
66
|
-
import condition from './condition';
|
|
67
66
|
import parallel from './parallel';
|
|
68
|
-
import
|
|
67
|
+
import query from './query';
|
|
68
|
+
import update from './update';
|
|
69
69
|
;
|
|
70
70
|
export var instructions = new Registry();
|
|
71
71
|
instructions.register('query', query);
|
|
@@ -75,7 +75,7 @@ instructions.register('destroy', destroy);
|
|
|
75
75
|
instructions.register('condition', condition);
|
|
76
76
|
instructions.register('parallel', parallel);
|
|
77
77
|
instructions.register('calculation', calculation);
|
|
78
|
-
function
|
|
78
|
+
function useUpdateAction() {
|
|
79
79
|
var form = useForm();
|
|
80
80
|
var api = useAPIClient();
|
|
81
81
|
var ctx = useActionContext();
|
|
@@ -86,13 +86,17 @@ function useUpdateConfigAction() {
|
|
|
86
86
|
return __awaiter(this, void 0, void 0, function () {
|
|
87
87
|
return __generator(this, function (_a) {
|
|
88
88
|
switch (_a.label) {
|
|
89
|
-
case 0: return [4 /*yield*/,
|
|
90
|
-
filterByTk: data.id,
|
|
91
|
-
values: {
|
|
92
|
-
config: __assign(__assign({}, data.config), form.values)
|
|
93
|
-
},
|
|
94
|
-
})];
|
|
89
|
+
case 0: return [4 /*yield*/, form.submit()];
|
|
95
90
|
case 1:
|
|
91
|
+
_a.sent();
|
|
92
|
+
return [4 /*yield*/, api.resource('flow_nodes', data.id).update({
|
|
93
|
+
filterByTk: data.id,
|
|
94
|
+
values: {
|
|
95
|
+
title: form.values.title,
|
|
96
|
+
config: form.values.config
|
|
97
|
+
}
|
|
98
|
+
})];
|
|
99
|
+
case 2:
|
|
96
100
|
_a.sent();
|
|
97
101
|
ctx.setVisible(false);
|
|
98
102
|
refresh();
|
|
@@ -161,55 +165,70 @@ export function NodeDefaultView(props) {
|
|
|
161
165
|
var instruction = instructions.get(data.type);
|
|
162
166
|
return (_jsx(NodeContext.Provider, __assign({ value: data }, { children: _jsxs("div", __assign({ className: cx(nodeClass, "workflow-node-type-" + data.type) }, { children: [_jsxs("div", __assign({ className: cx(nodeCardClass) }, { children: [_jsxs("div", __assign({ className: cx(nodeHeaderClass) }, { children: [_jsxs("h4", __assign({ className: cx(nodeTitleClass) }, { children: [_jsx(Tag, { children: instruction.title }, void 0), _jsx("strong", { children: data.title }, void 0), _jsxs("span", __assign({ className: "workflow-node-id" }, { children: ["#", data.id] }), void 0)] }), void 0), _jsx(RemoveButton, {}, void 0)] }), void 0), _jsx(SchemaComponent, { scope: instruction.scope, components: instruction.components, schema: {
|
|
163
167
|
type: 'void',
|
|
164
|
-
properties:
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
168
|
+
properties: {
|
|
169
|
+
view: instruction.view,
|
|
170
|
+
config: {
|
|
171
|
+
type: 'void',
|
|
172
|
+
title: '配置节点',
|
|
173
|
+
'x-component': 'Action.Link',
|
|
174
|
+
'x-component-props': {
|
|
175
|
+
type: 'primary',
|
|
176
|
+
},
|
|
177
|
+
properties: {
|
|
178
|
+
drawer: {
|
|
179
|
+
type: 'void',
|
|
180
|
+
title: '配置节点',
|
|
181
|
+
'x-component': 'Action.Drawer',
|
|
182
|
+
'x-decorator': 'Form',
|
|
183
|
+
'x-decorator-props': {
|
|
184
|
+
useValues: function (options) {
|
|
185
|
+
var d = useNodeContext();
|
|
186
|
+
return useRequest(function () {
|
|
187
|
+
return Promise.resolve({ data: d });
|
|
188
|
+
}, options);
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
properties: {
|
|
192
|
+
title: {
|
|
193
|
+
type: 'string',
|
|
194
|
+
name: 'title',
|
|
195
|
+
title: '节点名称',
|
|
196
|
+
'x-decorator': 'FormItem',
|
|
197
|
+
'x-component': 'Input',
|
|
186
198
|
},
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
199
|
+
config: {
|
|
200
|
+
type: 'void',
|
|
201
|
+
name: 'config',
|
|
202
|
+
'x-component': 'fieldset',
|
|
203
|
+
'x-component-props': {},
|
|
204
|
+
properties: instruction.fieldset
|
|
205
|
+
},
|
|
206
|
+
actions: {
|
|
207
|
+
type: 'void',
|
|
208
|
+
'x-component': 'Action.Drawer.Footer',
|
|
209
|
+
properties: {
|
|
210
|
+
cancel: {
|
|
211
|
+
title: '{{t("Cancel")}}',
|
|
212
|
+
'x-component': 'Action',
|
|
213
|
+
'x-component-props': {
|
|
214
|
+
useAction: '{{ cm.useCancelAction }}',
|
|
197
215
|
},
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
216
|
+
},
|
|
217
|
+
submit: {
|
|
218
|
+
title: '{{t("Submit")}}',
|
|
219
|
+
'x-component': 'Action',
|
|
220
|
+
'x-component-props': {
|
|
221
|
+
type: 'primary',
|
|
222
|
+
useAction: useUpdateAction,
|
|
205
223
|
},
|
|
206
224
|
},
|
|
207
|
-
}
|
|
225
|
+
},
|
|
226
|
+
}
|
|
208
227
|
}
|
|
209
228
|
}
|
|
210
229
|
}
|
|
211
230
|
}
|
|
212
|
-
|
|
231
|
+
}
|
|
213
232
|
} }, void 0)] }), void 0), children] }), void 0) }), void 0));
|
|
214
233
|
}
|
|
215
234
|
var templateObject_1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/workflow/nodes/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAW,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,wBAAwB,EAAE,MAAM,OAAO,CAAC;AAC7H,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,M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EAAE,QAAQ;oEACvB,mBAAmB,EAAE;wEACnB,SAAS,EAAE,0BAA0B;qEACtC;iEACF;gEACD,MAAM,EAAE;oEACN,KAAK,EAAE,iBAAiB;oEACxB,aAAa,EAAE,QAAQ;oEACvB,mBAAmB,EAAE;wEACnB,IAAI,EAAE,SAAS;wEACf,SAAS,EAAE,qBAAqB;qEACjC;iEACF;6DACF;yDACS,GACb;iDACF;6CACF;yCACF;qCACF;oCACH,CAAC,CAAC,EAAE,CAAC,CACN;6BACF,WACD,aACE,EACL,QAAQ,aACL,YACe,CACxB,CAAC;AACJ,CAAC","sourcesContent":["import React, { useContext } from 'react';\nimport { css, cx } from '@emotion/css';\nimport { Button, Modal, Tag } from 'antd';\nimport { DeleteOutlined, CloseOutlined } from '@ant-design/icons';\nimport { ISchema, useForm } from '@formily/react';\n\nimport { Registry } from '@nocobase/utils';\n\nimport { SchemaComponent, useActionContext, useAPIClient, useCollection, useRequest, useResourceActionContext } from '../..';\nimport { AddButton, useFlowContext } from '../WorkflowCanvas';\n\nimport { nodeClass, nodeCardClass, nodeHeaderClass, nodeTitleClass, nodeBlockClass } from '../style';\n\nimport query from './query';\nimport create from './create';\nimport update from './update';\nimport destroy from './destroy';\nimport condition from './condition';\nimport parallel from './parallel';\nimport calculation from './calculation';\n\n\n\nexport interface Instruction {\n title: string;\n type: string;\n group: string;\n options?: { label: string; value: any; key: string }[];\n fieldset: { [key: string]: ISchema };\n view?: ISchema;\n scope?: { [key: string]: any };\n components?: { [key: string]: any };\n render?(props): React.ReactElement;\n endding?: boolean;\n getter?(node: any): React.ReactElement;\n};\n\nexport const instructions = new Registry<Instruction>();\n\ninstructions.register('query', query);\ninstructions.register('create', create);\ninstructions.register('update', update);\ninstructions.register('destroy', destroy);\ninstructions.register('condition', condition);\ninstructions.register('parallel', parallel);\ninstructions.register('calculation', calculation);\n\nfunction useUpdateConfigAction() {\n const form = useForm();\n const api = useAPIClient();\n const ctx = useActionContext();\n const { refresh } = useResourceActionContext();\n const data = useNodeContext();\n return {\n async run() {\n await api.resource('flow_nodes', data.id).update({\n filterByTk: data.id,\n values: {\n config: {\n ...data.config,\n ...form.values\n }\n },\n });\n ctx.setVisible(false);\n refresh();\n },\n };\n};\n\nconst NodeContext = React.createContext(null);\n\nexport function useNodeContext() {\n return useContext(NodeContext);\n}\n\nexport function Node({ data }) {\n const instruction = instructions.get(data.type);\n\n return (\n <div className={cx(nodeBlockClass)}>\n {instruction.render\n ? instruction.render(data)\n : <NodeDefaultView data={data} />\n }\n {!instruction.endding\n ? <AddButton upstream={data} />\n : (\n <div\n className={css`\n flex-grow: 1;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n width: 1px;\n height: 6em;\n padding: 2em 0;\n background-color: #f0f2f5;\n\n .anticon{\n font-size: 1.5em;\n line-height: 100%;\n }\n `}\n >\n <CloseOutlined />\n </div>\n )\n }\n </div>\n );\n}\n\nexport function RemoveButton() {\n const { resource } = useCollection();\n const current = useNodeContext();\n const { nodes, onNodeRemoved } = useFlowContext();\n\n async function onRemove() {\n async function onOk() {\n const { data: { data: node } } = await resource.destroy({\n filterByTk: current.id\n });\n onNodeRemoved(node);\n }\n\n const hasBranches = !nodes.find(item => item.upstream === current && item.branchIndex != null);\n const message = hasBranches\n ? '确定删除该节点吗?'\n : '节点包含分支,将同时删除其所有分支下的子节点,确定继续?';\n\n Modal.confirm({\n title: '删除节点',\n content: message,\n onOk\n });\n }\n\n return (\n <Button\n type=\"text\"\n shape=\"circle\"\n icon={<DeleteOutlined />}\n onClick={onRemove}\n className=\"workflow-node-remove-button\"\n />\n );\n}\n\nexport function NodeDefaultView(props) {\n const { data, children } = props;\n const instruction = instructions.get(data.type);\n\n return (\n <NodeContext.Provider value={data}>\n <div className={cx(nodeClass, `workflow-node-type-${data.type}`)}>\n <div className={cx(nodeCardClass)}>\n <div className={cx(nodeHeaderClass)}>\n <h4 className={cx(nodeTitleClass)}>\n <Tag>{instruction.title}</Tag>\n <strong>{data.title}</strong>\n <span className=\"workflow-node-id\">#{data.id}</span>\n </h4>\n <RemoveButton />\n </div>\n <SchemaComponent\n scope={instruction.scope}\n components={instruction.components}\n schema={{\n type: 'void',\n properties: {\n view: instruction.view,\n ...(Object.keys(instruction.fieldset).length\n ? {\n config: {\n type: 'void',\n title: '配置节点',\n 'x-component': 'Action.Link',\n 'x-component-props': {\n type: 'primary',\n },\n properties: {\n drawer: {\n type: 'void',\n title: '配置节点',\n 'x-component': 'Action.Drawer',\n 'x-decorator': 'Form',\n 'x-decorator-props': {\n useValues(options) {\n const node = useNodeContext();\n return useRequest(() => {\n return Promise.resolve({ data: node.config });\n }, options);\n }\n },\n properties: {\n ...instruction.fieldset,\n actions: {\n type: 'void',\n 'x-component': 'Action.Drawer.Footer',\n properties: {\n cancel: {\n title: '{{t(\"Cancel\")}}',\n 'x-component': 'Action',\n 'x-component-props': {\n useAction: '{{ cm.useCancelAction }}',\n },\n },\n submit: {\n title: '{{t(\"Submit\")}}',\n 'x-component': 'Action',\n 'x-component-props': {\n type: 'primary',\n useAction: useUpdateConfigAction,\n },\n },\n },\n } as ISchema\n }\n }\n }\n }\n }\n : {})\n }\n }}\n />\n </div>\n {children}\n </div>\n </NodeContext.Provider>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/workflow/nodes/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAW,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,KAAK,EAAE,EA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C;iDACF;gDACD,UAAU,EAAE;oDACV,KAAK,EAAE;wDACL,IAAI,EAAE,QAAQ;wDACd,IAAI,EAAE,OAAO;wDACb,KAAK,EAAE,MAAM;wDACb,aAAa,EAAE,UAAU;wDACzB,aAAa,EAAE,OAAO;qDACvB;oDACD,MAAM,EAAE;wDACN,IAAI,EAAE,MAAM;wDACZ,IAAI,EAAE,QAAQ;wDACd,aAAa,EAAE,UAAU;wDACzB,mBAAmB,EAAE,EAAE;wDACvB,UAAU,EAAE,WAAW,CAAC,QAAQ;qDACjC;oDACD,OAAO,EAAE;wDACP,IAAI,EAAE,MAAM;wDACZ,aAAa,EAAE,sBAAsB;wDACrC,UAAU,EAAE;4DACV,MAAM,EAAE;gEACN,KAAK,EAAE,iBAAiB;gEACxB,aAAa,EAAE,QAAQ;gEACvB,mBAAmB,EAAE;oEACnB,SAAS,EAAE,0BAA0B;iEACtC;6DACF;4DACD,MAAM,EAAE;gEACN,KAAK,EAAE,iBAAiB;gEACxB,aAAa,EAAE,QAAQ;gEACvB,mBAAmB,EAAE;oEACnB,IAAI,EAAE,SAAS;oEACf,SAAS,EAAE,eAAe;iEAC3B;6DACF;yDACF;qDACS;iDACb;6CACF;yCACF;qCACF;iCACF;6BACF,WACD,aACE,EACL,QAAQ,aACL,YACe,CACxB,CAAC;AACJ,CAAC","sourcesContent":["import { CloseOutlined, DeleteOutlined } from '@ant-design/icons';\nimport { css, cx } from '@emotion/css';\nimport { ISchema, useForm } from '@formily/react';\nimport { Registry } from '@nocobase/utils';\nimport { Button, Modal, Tag } from 'antd';\nimport React, { useContext } from 'react';\nimport { SchemaComponent, useActionContext, useAPIClient, useCollection, useRequest, useResourceActionContext } from '../..';\nimport { nodeBlockClass, nodeCardClass, nodeClass, nodeHeaderClass, nodeTitleClass } from '../style';\nimport { AddButton, useFlowContext } from '../WorkflowCanvas';\n\nimport calculation from './calculation';\nimport condition from './condition';\nimport create from './create';\nimport destroy from './destroy';\nimport parallel from './parallel';\nimport query from './query';\nimport update from './update';\n\n\n\nexport interface Instruction {\n title: string;\n type: string;\n group: string;\n options?: { label: string; value: any; key: string }[];\n fieldset: { [key: string]: ISchema };\n view?: ISchema;\n scope?: { [key: string]: any };\n components?: { [key: string]: any };\n render?(props): React.ReactElement;\n endding?: boolean;\n getter?(node: any): React.ReactElement;\n};\n\nexport const instructions = new Registry<Instruction>();\n\ninstructions.register('query', query);\ninstructions.register('create', create);\ninstructions.register('update', update);\ninstructions.register('destroy', destroy);\ninstructions.register('condition', condition);\ninstructions.register('parallel', parallel);\ninstructions.register('calculation', calculation);\n\nfunction useUpdateAction() {\n const form = useForm();\n const api = useAPIClient();\n const ctx = useActionContext();\n const { refresh } = useResourceActionContext();\n const data = useNodeContext();\n return {\n async run() {\n await form.submit();\n await api.resource('flow_nodes', data.id).update({\n filterByTk: data.id,\n values: {\n title: form.values.title,\n config: form.values.config\n }\n });\n ctx.setVisible(false);\n refresh();\n },\n };\n};\n\nconst NodeContext = React.createContext(null);\n\nexport function useNodeContext() {\n return useContext(NodeContext);\n}\n\nexport function Node({ data }) {\n const instruction = instructions.get(data.type);\n\n return (\n <div className={cx(nodeBlockClass)}>\n {instruction.render\n ? instruction.render(data)\n : <NodeDefaultView data={data} />\n }\n {!instruction.endding\n ? <AddButton upstream={data} />\n : (\n <div\n className={css`\n flex-grow: 1;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n width: 1px;\n height: 6em;\n padding: 2em 0;\n background-color: #f0f2f5;\n\n .anticon{\n font-size: 1.5em;\n line-height: 100%;\n }\n `}\n >\n <CloseOutlined />\n </div>\n )\n }\n </div>\n );\n}\n\nexport function RemoveButton() {\n const { resource } = useCollection();\n const current = useNodeContext();\n const { nodes, onNodeRemoved } = useFlowContext();\n\n async function onRemove() {\n async function onOk() {\n const { data: { data: node } } = await resource.destroy({\n filterByTk: current.id\n });\n onNodeRemoved(node);\n }\n\n const hasBranches = !nodes.find(item => item.upstream === current && item.branchIndex != null);\n const message = hasBranches\n ? '确定删除该节点吗?'\n : '节点包含分支,将同时删除其所有分支下的子节点,确定继续?';\n\n Modal.confirm({\n title: '删除节点',\n content: message,\n onOk\n });\n }\n\n return (\n <Button\n type=\"text\"\n shape=\"circle\"\n icon={<DeleteOutlined />}\n onClick={onRemove}\n className=\"workflow-node-remove-button\"\n />\n );\n}\n\nexport function NodeDefaultView(props) {\n const { data, children } = props;\n const instruction = instructions.get(data.type);\n\n return (\n <NodeContext.Provider value={data}>\n <div className={cx(nodeClass, `workflow-node-type-${data.type}`)}>\n <div className={cx(nodeCardClass)}>\n <div className={cx(nodeHeaderClass)}>\n <h4 className={cx(nodeTitleClass)}>\n <Tag>{instruction.title}</Tag>\n <strong>{data.title}</strong>\n <span className=\"workflow-node-id\">#{data.id}</span>\n </h4>\n <RemoveButton />\n </div>\n <SchemaComponent\n scope={instruction.scope}\n components={instruction.components}\n schema={{\n type: 'void',\n properties: {\n view: instruction.view,\n config: {\n type: 'void',\n title: '配置节点',\n 'x-component': 'Action.Link',\n 'x-component-props': {\n type: 'primary',\n },\n properties: {\n drawer: {\n type: 'void',\n title: '配置节点',\n 'x-component': 'Action.Drawer',\n 'x-decorator': 'Form',\n 'x-decorator-props': {\n useValues(options) {\n const d = useNodeContext();\n return useRequest(() => {\n return Promise.resolve({ data: d });\n }, options);\n }\n },\n properties: {\n title: {\n type: 'string',\n name: 'title',\n title: '节点名称',\n 'x-decorator': 'FormItem',\n 'x-component': 'Input',\n },\n config: {\n type: 'void',\n name: 'config',\n 'x-component': 'fieldset',\n 'x-component-props': {},\n properties: instruction.fieldset\n },\n actions: {\n type: 'void',\n 'x-component': 'Action.Drawer.Footer',\n properties: {\n cancel: {\n title: '{{t(\"Cancel\")}}',\n 'x-component': 'Action',\n 'x-component-props': {\n useAction: '{{ cm.useCancelAction }}',\n },\n },\n submit: {\n title: '{{t(\"Submit\")}}',\n 'x-component': 'Action',\n 'x-component-props': {\n type: 'primary',\n useAction: useUpdateAction,\n },\n },\n },\n } as ISchema\n }\n }\n }\n }\n }\n }}\n />\n </div>\n {children}\n </div>\n </NodeContext.Provider>\n );\n}\n"]}
|
|
@@ -4,7 +4,7 @@ declare const _default: {
|
|
|
4
4
|
type: string;
|
|
5
5
|
group: string;
|
|
6
6
|
fieldset: {
|
|
7
|
-
mode: {
|
|
7
|
+
'config.mode': {
|
|
8
8
|
type: string;
|
|
9
9
|
name: string;
|
|
10
10
|
title: string;
|
|
@@ -13,7 +13,7 @@ declare const _default: {
|
|
|
13
13
|
'x-component-props': {};
|
|
14
14
|
enum: {
|
|
15
15
|
value: string;
|
|
16
|
-
label:
|
|
16
|
+
label: JSX.Element;
|
|
17
17
|
}[];
|
|
18
18
|
default: string;
|
|
19
19
|
};
|
|
@@ -32,7 +32,7 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
32
32
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
33
33
|
import { useState } from "react";
|
|
34
34
|
import { css, cx } from "@emotion/css";
|
|
35
|
-
import { PlusOutlined } from '@ant-design/icons';
|
|
35
|
+
import { PlusOutlined, QuestionCircleOutlined } from '@ant-design/icons';
|
|
36
36
|
import { NodeDefaultView } from ".";
|
|
37
37
|
import { Branch, useFlowContext } from "../WorkflowCanvas";
|
|
38
38
|
import { branchBlockClass, nodeSubtreeClass } from "../style";
|
|
@@ -43,16 +43,22 @@ export default {
|
|
|
43
43
|
type: 'parallel',
|
|
44
44
|
group: 'control',
|
|
45
45
|
fieldset: {
|
|
46
|
-
mode: {
|
|
46
|
+
'config.mode': {
|
|
47
47
|
type: 'string',
|
|
48
|
-
name: 'mode',
|
|
48
|
+
name: 'config.mode',
|
|
49
49
|
title: '模式',
|
|
50
50
|
'x-decorator': 'FormItem',
|
|
51
51
|
'x-component': 'Radio.Group',
|
|
52
52
|
'x-component-props': {},
|
|
53
53
|
enum: [
|
|
54
|
-
{
|
|
55
|
-
|
|
54
|
+
{
|
|
55
|
+
value: 'all',
|
|
56
|
+
label: (_jsxs(Tooltip, __assign({ title: "\u5168\u90E8\u5206\u652F\u90FD\u6210\u529F\u540E\u624D\u80FD\u7EE7\u7EED", placement: "bottom" }, { children: ["\u5168\u90E8\u6210\u529F ", _jsx(QuestionCircleOutlined, { style: { color: '#999' } }, void 0)] }), void 0))
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
value: 'any',
|
|
60
|
+
label: (_jsxs(Tooltip, __assign({ title: "\u4EFB\u610F\u5206\u652F\u6210\u529F\u540E\u5C31\u7EE7\u7EED", placement: "bottom" }, { children: ["\u4EFB\u610F\u6210\u529F ", _jsx(QuestionCircleOutlined, { style: { color: '#999' } }, void 0)] }), void 0))
|
|
61
|
+
},
|
|
56
62
|
// { value: 'race', label: '任意退出' },
|
|
57
63
|
],
|
|
58
64
|
default: 'all'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parallel.js","sourceRoot":"","sources":["../../../src/workflow/nodes/parallel.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAc,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"parallel.js","sourceRoot":"","sources":["../../../src/workflow/nodes/parallel.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAc,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAEzE,OAAO,EAAE,eAAe,EAAE,MAAM,GAAG,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,E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G,CAAC,GAAG,CAAC;oCACrB,CAAC,CAAC,CACA,uBAAK,SAAS,EAAE,GAAG,gUAAA,6PAQlB,oBACC,KAAC,MAAM,IACL,KAAK,EAAC,QAAQ,EACd,IAAI,EAAE,KAAC,YAAY,aAAG,EACtB,OAAO,EAAE,cAAM,OAAA,cAAc,CAAC,WAAW,GAAG,CAAC,CAAC,EAA/B,CAA+B,WAC9C,YACE,CACP;oCACD,CAAC,CAAC,IAAI,IAtBL,WAAQ,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAE,CAwBlC,CACH,EA3B2B,CA2B3B,CAAC,aACE,EACN,uBACE,SAAS,EAAE,GAAG,kJAAA,+EAGb,oBAED,KAAC,OAAO,aAAC,KAAK,EAAC,0BAAM,gBACnB,KAAC,MAAM,IACL,IAAI,EAAE,KAAC,YAAY,aAAG,EACtB,SAAS,EAAE,GAAG,yUAAA,sQAQb,MACD,OAAO,EAAE,cAAM,OAAA,cAAc,CAAC,WAAW,GAAG,CAAC,CAAC,EAA/B,CAA+B,WAC9C,YACM,YACN,aACF,YACU,CACnB,CAAA;IACH,CAAC;CACF,CAAC","sourcesContent":["import React, { useState } from \"react\";\nimport { css, cx } from \"@emotion/css\";\nimport { PlusOutlined, QuestionCircleOutlined } from '@ant-design/icons';\n\nimport { NodeDefaultView } from \".\";\nimport { Branch, useFlowContext } from \"../WorkflowCanvas\";\nimport { branchBlockClass, nodeSubtreeClass } from \"../style\";\nimport { Button, Tooltip } from \"antd\";\n// import { SchemaComponent } from \"../../schema-component\";\n\nexport default {\n title: '并行',\n type: 'parallel',\n group: 'control',\n fieldset: {\n 'config.mode': {\n type: 'string',\n name: 'config.mode',\n title: '模式',\n 'x-decorator': 'FormItem',\n 'x-component': 'Radio.Group',\n 'x-component-props': {\n },\n enum: [\n {\n value: 'all',\n label: (\n <Tooltip\n title=\"全部分支都成功后才能继续\"\n placement=\"bottom\"\n >\n 全部成功 <QuestionCircleOutlined style={{ color: '#999' }} />\n </Tooltip>\n )\n },\n {\n value: 'any',\n label: (\n <Tooltip\n title=\"任意分支成功后就继续\"\n placement=\"bottom\"\n >\n 任意成功 <QuestionCircleOutlined style={{ color: '#999' }} />\n </Tooltip>\n )\n },\n // { value: 'race', label: '任意退出' },\n ],\n default: 'all'\n }\n },\n view: {\n\n },\n render(data) {\n const { id, config: { mode } } = data;\n const { nodes } = useFlowContext();\n const branches = nodes.reduce((result, node) => {\n if (node.upstreamId === id && node.branchIndex != null) {\n return result.concat(node);\n }\n return result;\n }, []).sort((a, b) => a.branchIndex - b.branchIndex);\n const [branchCount, setBranchCount] = useState(Math.max(2, branches.length));\n\n const tempBranches = Array(Math.max(0, branchCount - branches.length)).fill(null);\n const lastBranchHead = branches[branches.length - 1];\n\n return (\n <NodeDefaultView data={data}>\n <div className={cx(nodeSubtreeClass)}>\n <div className={cx(branchBlockClass)}>\n {branches.map((branch) => (\n <Branch key={branch.id} from={data} entry={branch} branchIndex={branch.branchIndex} />\n ))}\n {tempBranches.map((_, i) => (\n <Branch\n key={`temp_${branches.length + i}`}\n from={data}\n branchIndex={(lastBranchHead ? lastBranchHead.branchIndex : 0) + i + 1}\n controller={\n branches.length + i > 1\n ? (\n <div className={css`\n padding-top: 2em;\n\n > button{\n .anticon{\n transform: rotate(45deg)\n }\n }\n `}>\n <Button\n shape=\"circle\"\n icon={<PlusOutlined />}\n onClick={() => setBranchCount(branchCount - 1)}\n />\n </div>\n )\n : null\n }\n />\n ))}\n </div>\n <div\n className={css`\n position: relative;\n height: 2em;\n `}\n >\n <Tooltip title=\"添加分支\">\n <Button\n icon={<PlusOutlined />}\n className={css`\n position: absolute;\n top: calc(50% - 1px);\n transform: translateX(-50%) rotate(45deg);\n\n .anticon{\n transform: rotate(-45deg);\n }\n `}\n onClick={() => setBranchCount(branchCount + 1)}\n />\n </Tooltip>\n </div>\n </div>\n </NodeDefaultView>\n )\n }\n};\n"]}
|
|
@@ -6,7 +6,7 @@ declare const _default: {
|
|
|
6
6
|
type: string;
|
|
7
7
|
group: string;
|
|
8
8
|
fieldset: {
|
|
9
|
-
collection: {
|
|
9
|
+
'config.collection': {
|
|
10
10
|
type: string;
|
|
11
11
|
title: string;
|
|
12
12
|
name: string;
|
|
@@ -15,7 +15,7 @@ declare const _default: {
|
|
|
15
15
|
'x-decorator': string;
|
|
16
16
|
'x-component': string;
|
|
17
17
|
};
|
|
18
|
-
multiple: {
|
|
18
|
+
'config.multiple': {
|
|
19
19
|
type: string;
|
|
20
20
|
title: string;
|
|
21
21
|
name: string;
|
|
@@ -25,7 +25,7 @@ declare const _default: {
|
|
|
25
25
|
disabled: boolean;
|
|
26
26
|
};
|
|
27
27
|
};
|
|
28
|
-
params: {
|
|
28
|
+
'config.params': {
|
|
29
29
|
type: string;
|
|
30
30
|
name: string;
|
|
31
31
|
title: string;
|
|
@@ -20,20 +20,20 @@ export default {
|
|
|
20
20
|
type: 'query',
|
|
21
21
|
group: 'model',
|
|
22
22
|
fieldset: {
|
|
23
|
-
collection: collection,
|
|
24
|
-
multiple: {
|
|
23
|
+
'config.collection': collection,
|
|
24
|
+
'config.multiple': {
|
|
25
25
|
type: 'boolean',
|
|
26
26
|
title: '多条数据',
|
|
27
|
-
name: 'multiple',
|
|
27
|
+
name: 'config.multiple',
|
|
28
28
|
'x-decorator': 'FormItem',
|
|
29
29
|
'x-component': 'Checkbox',
|
|
30
30
|
'x-component-props': {
|
|
31
31
|
disabled: true
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
|
-
params: {
|
|
34
|
+
'config.params': {
|
|
35
35
|
type: 'object',
|
|
36
|
-
name: 'params',
|
|
36
|
+
name: 'config.params',
|
|
37
37
|
title: '',
|
|
38
38
|
'x-decorator': 'FormItem',
|
|
39
39
|
properties: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.js","sourceRoot":"","sources":["../../../src/workflow/nodes/query.tsx"],"names":[],"mappings":";;;;;;;;;;;;AACA,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B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AAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,KAA7D,KAAK,CAAC,IAAI,CAAoE,CACnG,EAFe,CAEf,CAAC,YACK,CACV,CAAC;IACJ,CAAC;CACF,CAAC","sourcesContent":["import React from 'react';\nimport { Select } from 'antd';\n\nimport { useCollectionDataSource, useCollectionManager, useCompile } from '../..';\n\nimport { useFlowContext } from '../WorkflowCanvas';\nimport { BaseTypeSet, VariableComponent } from '../calculators';\nimport { collection, filter } from '../schemas/collection';\n\nexport default {\n title: '查询数据',\n type: 'query',\n group: 'model',\n fieldset: {\n 'config.collection': collection,\n 'config.multiple': {\n type: 'boolean',\n title: '多条数据',\n name: 'config.multiple',\n 'x-decorator': 'FormItem',\n 'x-component': 'Checkbox',\n 'x-component-props': {\n disabled: true\n }\n },\n 'config.params': {\n type: 'object',\n name: 'config.params',\n title: '',\n 'x-decorator': 'FormItem',\n properties: {\n filter\n }\n }\n },\n view: {\n\n },\n scope: {\n useCollectionDataSource\n },\n components: {\n VariableComponent\n },\n getter({ type, options, onChange }) {\n const compile = useCompile();\n const { collections = [] } = useCollectionManager();\n const { nodes } = useFlowContext();\n const { config } = nodes.find(n => n.id == options.nodeId);\n const collection = collections.find(item => item.name === config.collection) ?? { fields: [] };\n\n return (\n <Select value={options.path} placeholder=\"选择字段\" onChange={path => {\n onChange({ type, options: { ...options, path } });\n }}>\n {collection.fields\n .filter(field => BaseTypeSet.has(field.uiSchema?.type))\n .map(field => (\n <Select.Option key={field.name} value={field.name}>{compile(field.uiSchema.title)}</Select.Option>\n ))}\n </Select>\n );\n }\n};\n"]}
|
|
@@ -6,7 +6,7 @@ declare const _default: {
|
|
|
6
6
|
type: string;
|
|
7
7
|
group: string;
|
|
8
8
|
fieldset: {
|
|
9
|
-
collection: {
|
|
9
|
+
'config.collection': {
|
|
10
10
|
type: string;
|
|
11
11
|
title: string;
|
|
12
12
|
name: string;
|
|
@@ -15,7 +15,7 @@ declare const _default: {
|
|
|
15
15
|
'x-decorator': string;
|
|
16
16
|
'x-component': string;
|
|
17
17
|
};
|
|
18
|
-
params: {
|
|
18
|
+
'config.params': {
|
|
19
19
|
type: string;
|
|
20
20
|
name: string;
|
|
21
21
|
title: string;
|
|
@@ -6,10 +6,10 @@ export default {
|
|
|
6
6
|
type: 'update',
|
|
7
7
|
group: 'model',
|
|
8
8
|
fieldset: {
|
|
9
|
-
collection: collection,
|
|
10
|
-
params: {
|
|
9
|
+
'config.collection': collection,
|
|
10
|
+
'config.params': {
|
|
11
11
|
type: 'object',
|
|
12
|
-
name: 'params',
|
|
12
|
+
name: 'config.params',
|
|
13
13
|
title: '',
|
|
14
14
|
'x-decorator': 'FormItem',
|
|
15
15
|
properties: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../../src/workflow/nodes/update.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEnE,eAAe;IACb,KAAK,EAAE,MAAM;IACb,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,OAAO;IACd,QAAQ,EAAE;QACR,UAAU
|
|
1
|
+
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../../src/workflow/nodes/update.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEnE,eAAe;IACb,KAAK,EAAE,MAAM;IACb,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,OAAO;IACd,QAAQ,EAAE;QACR,mBAAmB,EAAE,UAAU;QAC/B,eAAe,EAAE;YACf,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,eAAe;YACrB,KAAK,EAAE,EAAE;YACT,aAAa,EAAE,UAAU;YACzB,UAAU,EAAE;gBACV,MAAM,QAAA;gBACN,MAAM,QAAA;aACP;SACF;KACF;IACD,IAAI,EAAE,EAEL;IACD,KAAK,EAAE;QACL,uBAAuB,yBAAA;KACxB;IACD,UAAU,EAAE;QACV,iBAAiB,mBAAA;QACjB,kBAAkB,oBAAA;KACnB;CACF,CAAC","sourcesContent":["import { useCollectionDataSource } from '../..';\nimport { CollectionFieldset, VariableComponent } from '../calculators';\nimport { collection, filter, values } from '../schemas/collection';\n\nexport default {\n title: '更新数据',\n type: 'update',\n group: 'model',\n fieldset: {\n 'config.collection': collection,\n 'config.params': {\n type: 'object',\n name: 'config.params',\n title: '',\n 'x-decorator': 'FormItem',\n properties: {\n filter,\n values\n }\n }\n },\n view: {\n\n },\n scope: {\n useCollectionDataSource\n },\n components: {\n VariableComponent,\n CollectionFieldset\n }\n};\n"]}
|
|
@@ -9,7 +9,7 @@ import { useCollectionFilterOptions } from "../../collection-manager/action-hook
|
|
|
9
9
|
export var collection = {
|
|
10
10
|
type: 'string',
|
|
11
11
|
title: '数据表',
|
|
12
|
-
name: 'collection',
|
|
12
|
+
name: 'config.collection',
|
|
13
13
|
required: true,
|
|
14
14
|
'x-reactions': ['{{useCollectionDataSource()}}'],
|
|
15
15
|
'x-decorator': 'FormItem',
|
|
@@ -18,7 +18,7 @@ export var collection = {
|
|
|
18
18
|
export var values = {
|
|
19
19
|
type: 'object',
|
|
20
20
|
title: '数据内容',
|
|
21
|
-
name: 'values',
|
|
21
|
+
name: 'config.params.values',
|
|
22
22
|
'x-decorator': 'FormItem',
|
|
23
23
|
'x-decorator-props': {
|
|
24
24
|
labelAlign: 'left',
|
|
@@ -27,9 +27,12 @@ export var values = {
|
|
|
27
27
|
'x-component': 'CollectionFieldset',
|
|
28
28
|
'x-component-props': {
|
|
29
29
|
useProps: function () {
|
|
30
|
+
var _a;
|
|
30
31
|
var getCollectionFields = useCollectionManager().getCollectionFields;
|
|
31
32
|
var form = useForm().values;
|
|
32
|
-
var fields = getCollectionFields(form.collection)
|
|
33
|
+
var fields = getCollectionFields((_a = form === null || form === void 0 ? void 0 : form.config) === null || _a === void 0 ? void 0 : _a.collection)
|
|
34
|
+
.filter(function (field) { return (!field.hidden
|
|
35
|
+
&& (field.uiSchema ? !field.uiSchema['x-read-pretty'] : false)); });
|
|
33
36
|
return { fields: fields };
|
|
34
37
|
}
|
|
35
38
|
}
|
|
@@ -37,7 +40,7 @@ export var values = {
|
|
|
37
40
|
export var filter = {
|
|
38
41
|
type: 'object',
|
|
39
42
|
title: '筛选条件',
|
|
40
|
-
name: 'filter',
|
|
43
|
+
name: 'config.params.filter',
|
|
41
44
|
'x-decorator': 'FormItem',
|
|
42
45
|
'x-decorator-props': {
|
|
43
46
|
labelAlign: 'left',
|
|
@@ -46,11 +49,12 @@ export var filter = {
|
|
|
46
49
|
'x-component': 'Filter',
|
|
47
50
|
'x-component-props': {
|
|
48
51
|
useProps: function () {
|
|
52
|
+
var _a;
|
|
49
53
|
var values = useForm().values;
|
|
50
|
-
var options = useCollectionFilterOptions(values.collection);
|
|
54
|
+
var options = useCollectionFilterOptions((_a = values.config) === null || _a === void 0 ? void 0 : _a.collection);
|
|
51
55
|
return {
|
|
52
56
|
options: options,
|
|
53
|
-
className: css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n position: relative;\n width: 100%;\n
|
|
57
|
+
className: css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n position: relative;\n width: 100%;\n "], ["\n position: relative;\n width: 100%;\n "])))
|
|
54
58
|
};
|
|
55
59
|
},
|
|
56
60
|
dynamicComponent: 'VariableComponent'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collection.js","sourceRoot":"","sources":["../../../src/workflow/schemas/collection.ts"],"names":[],"mappings":";;;;AAAA,OAAO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MAAM,GAAG,mBAAmB,CAAC,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,MAAM,0CAAE,UAAU,CAAC;iBACzD,MAAM,CAAC,UAAA,KAAK,IAAI,OAAA,CACf,CAAC,KAAK,CAAC,MAAM;mBACV,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAC/D,EAHgB,CAGhB,CAAC,CAAC;YACL,OAAO,EAAE,MAAM,QAAA,EAAE,CAAC;QACpB,CAAC;KACF;CACF,CAAC;AAEF,MAAM,CAAC,IAAM,MAAM,GAAG;IACpB,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,MAAM;IACb,IAAI,EAAE,sBAAsB;IAC5B,aAAa,EAAE,UAAU;IACzB,mBAAmB,EAAE;QACnB,UAAU,EAAE,MAAM;QAClB,SAAS,EAAE,GAAG,0GAAA,uCAEb,IAAA;KACF;IACD,aAAa,EAAE,QAAQ;IACvB,mBAAmB,EAAE;QACnB,QAAQ;;YACE,IAAA,MAAM,GAAK,OAAO,EAAE,OAAd,CAAe;YAC7B,IAAM,OAAO,GAAG,0BAA0B,CAAC,MAAA,MAAM,CAAC,MAAM,0CAAE,UAAU,CAAC,CAAC;YACtE,OAAO;gBACL,OAAO,SAAA;gBACP,SAAS,EAAE,GAAG,sIAAA,mEAGb,IAAA;aACF,CAAC;QACJ,CAAC;QACD,gBAAgB,EAAE,mBAAmB;KACtC;CACF,CAAC","sourcesContent":["import { css } from \"@emotion/css\";\nimport { useForm } from \"@formily/react\";\nimport { useCollectionManager } from \"../../collection-manager\";\nimport { useCollectionFilterOptions } from \"../../collection-manager/action-hooks\";\n\nexport const collection = {\n type: 'string',\n title: '数据表',\n name: 'config.collection',\n required: true,\n 'x-reactions': ['{{useCollectionDataSource()}}'],\n 'x-decorator': 'FormItem',\n 'x-component': 'Select',\n};\n\nexport const values = {\n type: 'object',\n title: '数据内容',\n name: 'config.params.values',\n 'x-decorator': 'FormItem',\n 'x-decorator-props': {\n labelAlign: 'left',\n className: css`\n flex-direction: column;\n `\n },\n 'x-component': 'CollectionFieldset',\n 'x-component-props': {\n useProps() {\n const { getCollectionFields } = useCollectionManager();\n const { values: form } = useForm();\n const fields = getCollectionFields(form?.config?.collection)\n .filter(field => (\n !field.hidden\n && (field.uiSchema ? !field.uiSchema['x-read-pretty'] : false)\n ));\n return { fields };\n }\n }\n};\n\nexport const filter = {\n type: 'object',\n title: '筛选条件',\n name: 'config.params.filter',\n 'x-decorator': 'FormItem',\n 'x-decorator-props': {\n labelAlign: 'left',\n className: css`\n flex-direction: column;\n `\n },\n 'x-component': 'Filter',\n 'x-component-props': {\n useProps() {\n const { values } = useForm();\n const options = useCollectionFilterOptions(values.config?.collection);\n return {\n options,\n className: css`\n position: relative;\n width: 100%;\n `\n };\n },\n dynamicComponent: 'VariableComponent'\n }\n};\n"]}
|
|
@@ -12,16 +12,6 @@ var collection = {
|
|
|
12
12
|
required: true,
|
|
13
13
|
},
|
|
14
14
|
},
|
|
15
|
-
// {
|
|
16
|
-
// type: 'string',
|
|
17
|
-
// name: 'description',
|
|
18
|
-
// interface: 'textarea',
|
|
19
|
-
// uiSchema: {
|
|
20
|
-
// title: '描述',
|
|
21
|
-
// type: 'string',
|
|
22
|
-
// 'x-component': 'TextArea',
|
|
23
|
-
// } as ISchema,
|
|
24
|
-
// },
|
|
25
15
|
{
|
|
26
16
|
type: 'string',
|
|
27
17
|
name: 'type',
|
|
@@ -34,6 +24,17 @@ var collection = {
|
|
|
34
24
|
enum: [
|
|
35
25
|
{ value: 'model', label: '数据变动' }
|
|
36
26
|
],
|
|
27
|
+
required: true,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
type: 'string',
|
|
32
|
+
name: 'description',
|
|
33
|
+
interface: 'textarea',
|
|
34
|
+
uiSchema: {
|
|
35
|
+
title: '描述',
|
|
36
|
+
type: 'string',
|
|
37
|
+
'x-component': 'Input.TextArea',
|
|
37
38
|
},
|
|
38
39
|
},
|
|
39
40
|
{
|
|
@@ -91,6 +92,13 @@ export var workflowSchema = {
|
|
|
91
92
|
type: 'void',
|
|
92
93
|
title: '删除',
|
|
93
94
|
'x-component': 'Action',
|
|
95
|
+
'x-component-props': {
|
|
96
|
+
useAction: '{{ cm.useBulkDestroyAction }}',
|
|
97
|
+
confirm: {
|
|
98
|
+
title: "{{t('Delete record')}}",
|
|
99
|
+
content: "{{t('Are you sure you want to delete it?')}}",
|
|
100
|
+
},
|
|
101
|
+
},
|
|
94
102
|
},
|
|
95
103
|
create: {
|
|
96
104
|
type: 'void',
|
|
@@ -110,11 +118,11 @@ export var workflowSchema = {
|
|
|
110
118
|
'x-component': 'CollectionField',
|
|
111
119
|
'x-decorator': 'FormItem',
|
|
112
120
|
},
|
|
113
|
-
|
|
121
|
+
type: {
|
|
114
122
|
'x-component': 'CollectionField',
|
|
115
123
|
'x-decorator': 'FormItem',
|
|
116
124
|
},
|
|
117
|
-
|
|
125
|
+
description: {
|
|
118
126
|
'x-component': 'CollectionField',
|
|
119
127
|
'x-decorator': 'FormItem',
|
|
120
128
|
},
|