@coding-flow/flow-design 0.0.19 → 0.0.21
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/dist/components/design-panel/presenters/index.d.ts +2 -1
- package/dist/components/design-panel/presenters/index.js +10 -0
- package/dist/components/design-panel/tabs/form/import-form-plugin-view.d.ts +3 -0
- package/dist/components/design-panel/tabs/form/import-form-plugin-view.js +12 -0
- package/dist/components/design-panel/tabs/form/index.js +20 -3
- package/dist/components/design-panel/tabs/form/table.d.ts +2 -0
- package/dist/components/design-panel/tabs/form/table.js +17 -8
- package/dist/plugins/import-form-view-type.d.ts +10 -0
- package/dist/plugins/import-form-view-type.js +2 -0
- package/dist/plugins/index.d.ts +1 -0
- package/dist/plugins/index.js +2 -1
- package/package.json +7 -7
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DesignPanelApi, State, TabPanelType } from "../types";
|
|
2
2
|
import { Dispatch } from "@coding-flow/flow-core";
|
|
3
|
-
import { FormActionContext } from "@coding-flow/flow-types";
|
|
3
|
+
import { FlowForm, FormActionContext } from "@coding-flow/flow-types";
|
|
4
4
|
import { NodeManger } from "../manager/node";
|
|
5
5
|
export declare class Presenter {
|
|
6
6
|
private state;
|
|
@@ -23,6 +23,7 @@ export declare class Presenter {
|
|
|
23
23
|
removeWorkflowSubForm(code: string): void;
|
|
24
24
|
addWorkflowSubForm(values: any): void;
|
|
25
25
|
updateWorkflowFormField(code: string, values: any): void;
|
|
26
|
+
importWorkflowForm(selectedForm: FlowForm): void;
|
|
26
27
|
save(versionName?: string): Promise<void>;
|
|
27
28
|
getNodeManager(): NodeManger;
|
|
28
29
|
createNode(form: string, type: string): Promise<any>;
|
|
@@ -94,6 +94,16 @@ class Presenter {
|
|
|
94
94
|
const form = workflowFormManager.updateFieldValue(code, values);
|
|
95
95
|
this.updateWorkflowForm(form);
|
|
96
96
|
}
|
|
97
|
+
importWorkflowForm(selectedForm) {
|
|
98
|
+
const updatedForm = {
|
|
99
|
+
...this.state.workflow.form,
|
|
100
|
+
name: selectedForm.name,
|
|
101
|
+
code: selectedForm.code,
|
|
102
|
+
fields: selectedForm.fields || [],
|
|
103
|
+
subForms: selectedForm.subForms || []
|
|
104
|
+
};
|
|
105
|
+
this.updateWorkflowForm(updatedForm);
|
|
106
|
+
}
|
|
97
107
|
async save(versionName) {
|
|
98
108
|
const values = this.formActionContext.save();
|
|
99
109
|
this.updateWorkflow(values);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { IMPORT_FORM_VIEW_KEY } from "../../../../plugins/import-form-view-type.js";
|
|
4
|
+
import { ViewBindPlugin } from "@coding-flow/flow-core";
|
|
5
|
+
const ImportFormPluginView = (props)=>{
|
|
6
|
+
const CustomViewComponent = ViewBindPlugin.getInstance().get(IMPORT_FORM_VIEW_KEY);
|
|
7
|
+
if (!CustomViewComponent) return null;
|
|
8
|
+
return /*#__PURE__*/ jsx(CustomViewComponent, {
|
|
9
|
+
...props
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
export { ImportFormPluginView };
|
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import "react";
|
|
2
|
+
import { useState } from "react";
|
|
3
3
|
import { Panel } from "@coding-flow/flow-pc-ui";
|
|
4
4
|
import { Empty, Tabs } from "antd";
|
|
5
|
+
import { ViewBindPlugin } from "@coding-flow/flow-core";
|
|
6
|
+
import { IMPORT_FORM_VIEW_KEY } from "../../../../plugins/import-form-view-type.js";
|
|
5
7
|
import { useDesignContext } from "../../hooks/use-design-context.js";
|
|
6
8
|
import { FormTable } from "./table.js";
|
|
9
|
+
import { ImportFormPluginView } from "./import-form-plugin-view.js";
|
|
7
10
|
const TabForm = ()=>{
|
|
8
|
-
const { state } = useDesignContext();
|
|
11
|
+
const { state, context } = useDesignContext();
|
|
12
|
+
const presenter = context.getPresenter();
|
|
13
|
+
const [importFormOpen, setImportFormOpen] = useState(false);
|
|
9
14
|
const mainCode = state.workflow.form.code;
|
|
10
15
|
const mainName = state.workflow.form.name;
|
|
11
16
|
const subForms = state.workflow.form.subForms || [];
|
|
17
|
+
const hasImportFormView = !!ViewBindPlugin.getInstance().get(IMPORT_FORM_VIEW_KEY);
|
|
12
18
|
const items = subForms.map((item)=>{
|
|
13
19
|
const title = `子表:${item.name}`;
|
|
14
20
|
return {
|
|
@@ -24,18 +30,29 @@ const TabForm = ()=>{
|
|
|
24
30
|
if (!mainCode) return /*#__PURE__*/ jsx(Empty, {
|
|
25
31
|
description: "请先在基本信息中添加表单的定义配置."
|
|
26
32
|
});
|
|
33
|
+
const handleImportForm = (form)=>{
|
|
34
|
+
presenter.importWorkflowForm(form);
|
|
35
|
+
setImportFormOpen(false);
|
|
36
|
+
};
|
|
27
37
|
return /*#__PURE__*/ jsxs(Panel, {
|
|
28
38
|
children: [
|
|
29
39
|
/*#__PURE__*/ jsx(FormTable, {
|
|
30
40
|
name: `主表:${mainName}`,
|
|
31
41
|
code: mainCode,
|
|
32
|
-
mainForm: true
|
|
42
|
+
mainForm: true,
|
|
43
|
+
hasImportForm: hasImportFormView,
|
|
44
|
+
onImportClick: ()=>setImportFormOpen(true)
|
|
33
45
|
}),
|
|
34
46
|
/*#__PURE__*/ jsx(Tabs, {
|
|
35
47
|
style: {
|
|
36
48
|
marginTop: 20
|
|
37
49
|
},
|
|
38
50
|
items: items
|
|
51
|
+
}),
|
|
52
|
+
/*#__PURE__*/ jsx(ImportFormPluginView, {
|
|
53
|
+
open: importFormOpen,
|
|
54
|
+
onSelect: handleImportForm,
|
|
55
|
+
onCancel: ()=>setImportFormOpen(false)
|
|
39
56
|
})
|
|
40
57
|
]
|
|
41
58
|
});
|
|
@@ -5,7 +5,7 @@ import { Button, Flex, Form, Popconfirm, Space } from "antd";
|
|
|
5
5
|
import { FormTypeContext, dataTypeOptions } from "@coding-flow/flow-types";
|
|
6
6
|
import { useDesignContext } from "../../hooks/use-design-context.js";
|
|
7
7
|
import { WorkflowFormManager } from "../../manager/form.js";
|
|
8
|
-
import { DeleteOutlined, FolderAddOutlined, PlusOutlined } from "@ant-design/icons";
|
|
8
|
+
import { CloudUploadOutlined, DeleteOutlined, FolderAddOutlined, PlusOutlined } from "@ant-design/icons";
|
|
9
9
|
import { FormFieldModal } from "./model.js";
|
|
10
10
|
import { SubFormModal } from "./sub-form.js";
|
|
11
11
|
const FormTable = (props)=>{
|
|
@@ -109,13 +109,22 @@ const FormTable = (props)=>{
|
|
|
109
109
|
}),
|
|
110
110
|
/*#__PURE__*/ jsxs(Space, {
|
|
111
111
|
children: [
|
|
112
|
-
props.mainForm && /*#__PURE__*/
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
112
|
+
props.mainForm && /*#__PURE__*/ jsxs(Fragment, {
|
|
113
|
+
children: [
|
|
114
|
+
props.hasImportForm && /*#__PURE__*/ jsx(Button, {
|
|
115
|
+
icon: /*#__PURE__*/ jsx(CloudUploadOutlined, {}),
|
|
116
|
+
onClick: props.onImportClick,
|
|
117
|
+
children: "导入表单"
|
|
118
|
+
}),
|
|
119
|
+
/*#__PURE__*/ jsx(Button, {
|
|
120
|
+
icon: /*#__PURE__*/ jsx(FolderAddOutlined, {}),
|
|
121
|
+
onClick: ()=>{
|
|
122
|
+
subForm.resetFields();
|
|
123
|
+
setSubFormVisible(true);
|
|
124
|
+
},
|
|
125
|
+
children: "添加子表"
|
|
126
|
+
})
|
|
127
|
+
]
|
|
119
128
|
}),
|
|
120
129
|
!props.mainForm && /*#__PURE__*/ jsx(Popconfirm, {
|
|
121
130
|
title: "确认要删除子表吗?",
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FlowForm } from "@coding-flow/flow-types";
|
|
2
|
+
export declare const IMPORT_FORM_VIEW_KEY = "ImportFormViewPlugin";
|
|
3
|
+
export interface ImportFormViewPlugin {
|
|
4
|
+
/** 是否显示 */
|
|
5
|
+
open: boolean;
|
|
6
|
+
/** 确认回调 */
|
|
7
|
+
onSelect: (form: FlowForm) => void;
|
|
8
|
+
/** 取消回调 */
|
|
9
|
+
onCancel: () => void;
|
|
10
|
+
}
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export { type ActionCustomViewPlugin, VIEW_KEY as ActionCustomViewPluginKey } fr
|
|
|
2
2
|
export { type ActionRejectViewPlugin, VIEW_KEY as ActionRejectViewPluginKey } from "./action-reject-view-type";
|
|
3
3
|
export { type ConditionViewPlugin, VIEW_KEY as ConditionViewPluginKey } from "./condition-view-type";
|
|
4
4
|
export { type ErrorTriggerViewPlugin, VIEW_KEY as ErrorTriggerViewPluginKey } from "./error-trigger-view-type";
|
|
5
|
+
export { type ImportFormViewPlugin, IMPORT_FORM_VIEW_KEY } from "./import-form-view-type";
|
|
5
6
|
export { type NodeTitleViewPlugin, VIEW_KEY as NodeTitleViewPluginKey } from "./node-title-view-type";
|
|
6
7
|
export { type OperatorCreateViewPlugin, VIEW_KEY as OperatorCreateViewPluginKey } from "./operator-create-view-type";
|
|
7
8
|
export { type OperatorLoadViewPlugin, VIEW_KEY as OperatorLoadViewPluginKey } from "./operator-load-view-type";
|
package/dist/plugins/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import { VIEW_KEY } from "./action-custom-view-type.js";
|
|
|
2
2
|
import { VIEW_KEY as external_action_reject_view_type_js_VIEW_KEY } from "./action-reject-view-type.js";
|
|
3
3
|
import { VIEW_KEY as external_condition_view_type_js_VIEW_KEY } from "./condition-view-type.js";
|
|
4
4
|
import { VIEW_KEY as external_error_trigger_view_type_js_VIEW_KEY } from "./error-trigger-view-type.js";
|
|
5
|
+
import { IMPORT_FORM_VIEW_KEY } from "./import-form-view-type.js";
|
|
5
6
|
import { VIEW_KEY as external_node_title_view_type_js_VIEW_KEY } from "./node-title-view-type.js";
|
|
6
7
|
import { VIEW_KEY as external_operator_create_view_type_js_VIEW_KEY } from "./operator-create-view-type.js";
|
|
7
8
|
import { VIEW_KEY as external_operator_load_view_type_js_VIEW_KEY } from "./operator-load-view-type.js";
|
|
@@ -9,4 +10,4 @@ import { VIEW_KEY as external_router_view_type_js_VIEW_KEY } from "./router-view
|
|
|
9
10
|
import { VIEW_KEY as external_sub_process_view_type_js_VIEW_KEY } from "./sub-process-view-type.js";
|
|
10
11
|
import { VIEW_KEY as external_trigger_view_type_js_VIEW_KEY } from "./trigger-view-type.js";
|
|
11
12
|
export * from "./design-view-plugin-action.js";
|
|
12
|
-
export { VIEW_KEY as ActionCustomViewPluginKey, external_action_reject_view_type_js_VIEW_KEY as ActionRejectViewPluginKey, external_condition_view_type_js_VIEW_KEY as ConditionViewPluginKey, external_error_trigger_view_type_js_VIEW_KEY as ErrorTriggerViewPluginKey, external_node_title_view_type_js_VIEW_KEY as NodeTitleViewPluginKey, external_operator_create_view_type_js_VIEW_KEY as OperatorCreateViewPluginKey, external_operator_load_view_type_js_VIEW_KEY as OperatorLoadViewPluginKey, external_router_view_type_js_VIEW_KEY as RouterViewPluginKey, external_sub_process_view_type_js_VIEW_KEY as SubProcessViewPluginKey, external_trigger_view_type_js_VIEW_KEY as TriggerViewPluginKey };
|
|
13
|
+
export { VIEW_KEY as ActionCustomViewPluginKey, external_action_reject_view_type_js_VIEW_KEY as ActionRejectViewPluginKey, external_condition_view_type_js_VIEW_KEY as ConditionViewPluginKey, external_error_trigger_view_type_js_VIEW_KEY as ErrorTriggerViewPluginKey, IMPORT_FORM_VIEW_KEY, external_node_title_view_type_js_VIEW_KEY as NodeTitleViewPluginKey, external_operator_create_view_type_js_VIEW_KEY as OperatorCreateViewPluginKey, external_operator_load_view_type_js_VIEW_KEY as OperatorLoadViewPluginKey, external_router_view_type_js_VIEW_KEY as RouterViewPluginKey, external_sub_process_view_type_js_VIEW_KEY as SubProcessViewPluginKey, external_trigger_view_type_js_VIEW_KEY as TriggerViewPluginKey };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coding-flow/flow-design",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.21",
|
|
4
4
|
"description": "flow-engine design components ",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -54,16 +54,16 @@
|
|
|
54
54
|
"nanoid": "^5.1.6",
|
|
55
55
|
"react-redux": "^9.2.0",
|
|
56
56
|
"styled-components": "^5.3.11",
|
|
57
|
-
"@coding-flow/flow-core": "0.0.
|
|
58
|
-
"@coding-flow/flow-
|
|
59
|
-
"@coding-flow/flow-
|
|
60
|
-
"@coding-flow/flow-
|
|
57
|
+
"@coding-flow/flow-core": "0.0.21",
|
|
58
|
+
"@coding-flow/flow-pc-ui": "0.0.21",
|
|
59
|
+
"@coding-flow/flow-types": "0.0.21",
|
|
60
|
+
"@coding-flow/flow-icons": "0.0.21"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@types/lodash-es": "^4.17.12",
|
|
64
64
|
"@types/styled-components": "^5.1.36",
|
|
65
|
-
"@coding-flow/flow-core": "0.0.
|
|
66
|
-
"@coding-flow/flow-types": "0.0.
|
|
65
|
+
"@coding-flow/flow-core": "0.0.21",
|
|
66
|
+
"@coding-flow/flow-types": "0.0.21"
|
|
67
67
|
},
|
|
68
68
|
"scripts": {
|
|
69
69
|
"build": "rslib build",
|