@coding-flow/flow-design 0.0.40 → 0.0.41

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.
Files changed (41) hide show
  1. package/dist/api/script.d.ts +4 -0
  2. package/dist/api/script.js +10 -0
  3. package/dist/components/design-editor/node-components/condition/index.js +42 -32
  4. package/dist/components/design-editor/node-components/node-hint/index.js +16 -8
  5. package/dist/components/design-editor/node-components/strategy/error-trigger.js +40 -29
  6. package/dist/components/design-editor/node-components/strategy/node-title.js +40 -32
  7. package/dist/components/design-editor/node-components/strategy/operator-load.js +40 -29
  8. package/dist/components/design-editor/node-components/strategy/router.js +40 -30
  9. package/dist/components/design-editor/node-components/strategy/sub-process.js +40 -30
  10. package/dist/components/design-editor/node-components/strategy/trigger.js +40 -29
  11. package/dist/components/design-editor/nodes/condition-branch/form-meta.js +1 -1
  12. package/dist/components/design-editor/nodes/start/form-meta.js +8 -1
  13. package/dist/components/design-panel/tabs/base/index.js +4 -1
  14. package/dist/components/design-panel/tabs/base/operator.d.ts +1 -0
  15. package/dist/components/design-panel/tabs/base/operator.js +1 -0
  16. package/dist/components/groovy-code/index.d.ts +5 -0
  17. package/dist/components/groovy-code/index.js +29 -155
  18. package/dist/plugins/trigger-view-type.d.ts +2 -0
  19. package/dist/script-components/components/advanced-script-editor.d.ts +1 -23
  20. package/dist/script-components/components/advanced-script-editor.js +22 -60
  21. package/dist/script-components/components/groovy-script-loader.d.ts +12 -0
  22. package/dist/script-components/components/groovy-script-loader.js +39 -0
  23. package/dist/script-components/components/groovy-script-modal.d.ts +11 -1
  24. package/dist/script-components/components/groovy-script-modal.js +3 -1
  25. package/dist/script-components/modal/condition-config-modal.d.ts +3 -1
  26. package/dist/script-components/modal/condition-config-modal.js +2 -1
  27. package/dist/script-components/modal/error-trigger-config-modal.d.ts +3 -1
  28. package/dist/script-components/modal/error-trigger-config-modal.js +2 -1
  29. package/dist/script-components/modal/node-title-config-modal.d.ts +3 -1
  30. package/dist/script-components/modal/node-title-config-modal.js +2 -1
  31. package/dist/script-components/modal/operator-create-config-modal.d.ts +3 -1
  32. package/dist/script-components/modal/operator-create-config-modal.js +3 -2
  33. package/dist/script-components/modal/operator-load-config-modal.d.ts +3 -1
  34. package/dist/script-components/modal/operator-load-config-modal.js +2 -1
  35. package/dist/script-components/modal/router-config-modal.d.ts +3 -1
  36. package/dist/script-components/modal/router-config-modal.js +2 -1
  37. package/dist/script-components/modal/sub-process-config-modal.d.ts +3 -1
  38. package/dist/script-components/modal/sub-process-config-modal.js +2 -1
  39. package/dist/script-components/modal/trigger-config-modal.d.ts +3 -1
  40. package/dist/script-components/modal/trigger-config-modal.js +3 -2
  41. package/package.json +8 -13
@@ -0,0 +1,4 @@
1
+ export declare const compile: (body: any) => Promise<import("@coding-flow/flow-core").Response>;
2
+ export declare const save: (body: any) => Promise<import("@coding-flow/flow-core").Response>;
3
+ export declare const getScript: (key: string) => Promise<import("@coding-flow/flow-core").Response>;
4
+ export declare const getMetadata: (key: string) => Promise<import("@coding-flow/flow-core").Response>;
@@ -0,0 +1,10 @@
1
+ import { httpClient } from "./index.js";
2
+ const compile = (body)=>httpClient.post("/api/groovy-script/compile", body);
3
+ const save = (body)=>httpClient.post("/api/groovy-script/save", body);
4
+ const getScript = (key)=>httpClient.get("/api/groovy-script/getScript", {
5
+ key
6
+ });
7
+ const getMetadata = (key)=>httpClient.get("/api/groovy-script/getMetadata", {
8
+ key
9
+ });
10
+ export { compile, getMetadata, getScript, save };
@@ -6,10 +6,46 @@ import { GroovyScriptPreview } from "../../../../script-components/components/gr
6
6
  import { EditOutlined } from "@ant-design/icons";
7
7
  import { ConditionConfigModal } from "../../../../script-components/modal/condition-config-modal.js";
8
8
  import { useScriptVariables } from "../../hooks/use-script-variables.js";
9
- const ConditionScript = ()=>{
10
- const [form] = Form.useForm();
9
+ import { GroovyScriptLoader } from "../../../../script-components/components/groovy-script-loader.js";
10
+ const ConditionConfigContent = (props)=>{
11
11
  const [visible, setVisible] = react.useState(false);
12
12
  const scriptVariables = useScriptVariables();
13
+ const value = props.value || '';
14
+ return /*#__PURE__*/ jsxs(Space.Compact, {
15
+ style: {
16
+ width: '100%'
17
+ },
18
+ children: [
19
+ /*#__PURE__*/ jsx(GroovyScriptPreview, {
20
+ script: value
21
+ }),
22
+ /*#__PURE__*/ jsx(Button, {
23
+ icon: /*#__PURE__*/ jsx(EditOutlined, {}),
24
+ onClick: ()=>{
25
+ setVisible(true);
26
+ },
27
+ style: {
28
+ borderRadius: '0 6px 6px 0'
29
+ },
30
+ children: "编辑"
31
+ }),
32
+ /*#__PURE__*/ jsx(ConditionConfigModal, {
33
+ open: visible,
34
+ onCancel: ()=>{
35
+ setVisible(false);
36
+ },
37
+ onConfirm: (value)=>{
38
+ props.onChange?.(value);
39
+ },
40
+ scriptKey: props.scriptKey,
41
+ script: value,
42
+ variables: scriptVariables
43
+ })
44
+ ]
45
+ });
46
+ };
47
+ const ConditionScript = ()=>{
48
+ const [form] = Form.useForm();
13
49
  return /*#__PURE__*/ jsx(Form, {
14
50
  form: form,
15
51
  style: {
@@ -21,36 +57,10 @@ const ConditionScript = ()=>{
21
57
  name: "script",
22
58
  children: /*#__PURE__*/ jsx(Field, {
23
59
  name: "script",
24
- render: ({ field: { value, onChange } })=>/*#__PURE__*/ jsxs(Space.Compact, {
25
- style: {
26
- width: '100%'
27
- },
28
- children: [
29
- /*#__PURE__*/ jsx(GroovyScriptPreview, {
30
- script: value
31
- }),
32
- /*#__PURE__*/ jsx(Button, {
33
- icon: /*#__PURE__*/ jsx(EditOutlined, {}),
34
- onClick: ()=>{
35
- setVisible(true);
36
- },
37
- style: {
38
- borderRadius: '0 6px 6px 0'
39
- },
40
- children: "编辑"
41
- }),
42
- /*#__PURE__*/ jsx(ConditionConfigModal, {
43
- open: visible,
44
- onCancel: ()=>{
45
- setVisible(false);
46
- },
47
- onConfirm: (value)=>{
48
- onChange(value);
49
- },
50
- script: value,
51
- variables: scriptVariables
52
- })
53
- ]
60
+ render: ({ field: { value, onChange } })=>/*#__PURE__*/ jsx(GroovyScriptLoader, {
61
+ content: ConditionConfigContent,
62
+ value: value,
63
+ onChange: onChange
54
64
  })
55
65
  })
56
66
  })
@@ -3,18 +3,26 @@ import "react";
3
3
  import { GroovyScriptConvertorUtil } from "@coding-flow/flow-core";
4
4
  import { Field } from "@flowgram.ai/fixed-layout-editor";
5
5
  import { Text } from "@coding-flow/flow-pc-ui";
6
+ import { GroovyScriptLoader } from "../../../../script-components/components/groovy-script-loader.js";
6
7
  const DEFAULT_SELECT_TYPE_LABEL_MAP = {
7
8
  INITIATOR_SELECT: '发起人设定',
8
9
  APPROVER_SELECT: '审批人设定'
9
10
  };
11
+ const ScriptContent = (props)=>{
12
+ const value = props.value || '';
13
+ return /*#__PURE__*/ jsx(Text, {
14
+ suffixCount: 100,
15
+ children: GroovyScriptConvertorUtil.getScriptTitle(value)
16
+ }, value);
17
+ };
10
18
  const NodeHint = (props)=>{
11
19
  const labelMap = props.selectTypeLabelMap || DEFAULT_SELECT_TYPE_LABEL_MAP;
12
20
  if (!props.selectTypeFieldName) return /*#__PURE__*/ jsx(Field, {
13
21
  name: props.fieldName,
14
- render: ({ field: { value } })=>/*#__PURE__*/ jsx(Text, {
15
- suffixCount: 100,
16
- children: GroovyScriptConvertorUtil.getScriptTitle(value)
17
- }, value)
22
+ render: ({ field: { value } })=>/*#__PURE__*/ jsx(GroovyScriptLoader, {
23
+ content: ScriptContent,
24
+ value: value
25
+ })
18
26
  });
19
27
  return /*#__PURE__*/ jsx(Field, {
20
28
  name: props.selectTypeFieldName,
@@ -25,10 +33,10 @@ const NodeHint = (props)=>{
25
33
  }, selectType);
26
34
  return /*#__PURE__*/ jsx(Field, {
27
35
  name: props.fieldName,
28
- render: ({ field: { value } })=>/*#__PURE__*/ jsx(Text, {
29
- suffixCount: 100,
30
- children: GroovyScriptConvertorUtil.getScriptTitle(value)
31
- }, value)
36
+ render: ({ field: { value } })=>/*#__PURE__*/ jsx(GroovyScriptLoader, {
37
+ content: ScriptContent,
38
+ value: value
39
+ })
32
40
  });
33
41
  }
34
42
  });
@@ -5,6 +5,42 @@ import { Field } from "@flowgram.ai/fixed-layout-editor";
5
5
  import { GroovyScriptPreview } from "../../../../script-components/components/groovy-script-preview.js";
6
6
  import { EditOutlined } from "@ant-design/icons";
7
7
  import { ErrorTriggerConfigModal } from "../../../../script-components/modal/error-trigger-config-modal.js";
8
+ import { GroovyScriptLoader } from "../../../../script-components/components/groovy-script-loader.js";
9
+ const ErrorTriggerConfigContent = (props)=>{
10
+ const [visible, setVisible] = react.useState(false);
11
+ const value = props.value || '';
12
+ return /*#__PURE__*/ jsxs(Space.Compact, {
13
+ style: {
14
+ width: '100%'
15
+ },
16
+ children: [
17
+ /*#__PURE__*/ jsx(GroovyScriptPreview, {
18
+ script: value
19
+ }),
20
+ /*#__PURE__*/ jsx(Button, {
21
+ icon: /*#__PURE__*/ jsx(EditOutlined, {}),
22
+ onClick: ()=>{
23
+ setVisible(true);
24
+ },
25
+ style: {
26
+ borderRadius: '0 6px 6px 0'
27
+ },
28
+ children: "编辑"
29
+ }),
30
+ /*#__PURE__*/ jsx(ErrorTriggerConfigModal, {
31
+ open: visible,
32
+ onCancel: ()=>{
33
+ setVisible(false);
34
+ },
35
+ onConfirm: (value)=>{
36
+ props.onChange?.(value);
37
+ },
38
+ script: value,
39
+ scriptKey: props.scriptKey
40
+ })
41
+ ]
42
+ });
43
+ };
8
44
  const ErrorTriggerStrategy = ()=>{
9
45
  const [form] = Form.useForm();
10
46
  const [visible, setVisible] = react.useState(false);
@@ -23,35 +59,10 @@ const ErrorTriggerStrategy = ()=>{
23
59
  tooltip: "在没有匹配到操作人时触发的脚本配置",
24
60
  children: /*#__PURE__*/ jsx(Field, {
25
61
  name: "ErrorTriggerStrategy.script",
26
- render: ({ field: { value, onChange } })=>/*#__PURE__*/ jsxs(Space.Compact, {
27
- style: {
28
- width: '100%'
29
- },
30
- children: [
31
- /*#__PURE__*/ jsx(GroovyScriptPreview, {
32
- script: value
33
- }),
34
- /*#__PURE__*/ jsx(Button, {
35
- icon: /*#__PURE__*/ jsx(EditOutlined, {}),
36
- onClick: ()=>{
37
- setVisible(true);
38
- },
39
- style: {
40
- borderRadius: '0 6px 6px 0'
41
- },
42
- children: "编辑"
43
- }),
44
- /*#__PURE__*/ jsx(ErrorTriggerConfigModal, {
45
- open: visible,
46
- onCancel: ()=>{
47
- setVisible(false);
48
- },
49
- onConfirm: (value)=>{
50
- onChange(value);
51
- },
52
- script: value
53
- })
54
- ]
62
+ render: ({ field: { value, onChange } })=>/*#__PURE__*/ jsx(GroovyScriptLoader, {
63
+ content: ErrorTriggerConfigContent,
64
+ value: value,
65
+ onChange: onChange
55
66
  })
56
67
  })
57
68
  })
@@ -6,10 +6,43 @@ import { Field } from "@flowgram.ai/fixed-layout-editor";
6
6
  import { GroovyScriptPreview } from "../../../../script-components/components/groovy-script-preview.js";
7
7
  import { NodeTitleConfigModal } from "../../../../script-components/modal/node-title-config-modal.js";
8
8
  import { useScriptVariables } from "../../hooks/use-script-variables.js";
9
- const NodeTitleStrategy = ()=>{
10
- const [showConfigModal, setShowConfigModal] = react.useState(false);
9
+ import { GroovyScriptLoader } from "../../../../script-components/components/groovy-script-loader.js";
10
+ const NodeTitleConfigContent = (props)=>{
11
+ const [visible, setVisible] = react.useState(false);
11
12
  const scriptVariables = useScriptVariables();
12
- return /*#__PURE__*/ jsx(Fragment, {
13
+ const value = props.value || '';
14
+ return /*#__PURE__*/ jsxs(Space.Compact, {
15
+ style: {
16
+ width: '100%'
17
+ },
18
+ children: [
19
+ /*#__PURE__*/ jsx(GroovyScriptPreview, {
20
+ script: value
21
+ }),
22
+ /*#__PURE__*/ jsx(Button, {
23
+ icon: /*#__PURE__*/ jsx(EditOutlined, {}),
24
+ onClick: ()=>{
25
+ setVisible(true);
26
+ },
27
+ style: {
28
+ borderRadius: '0 6px 6px 0'
29
+ },
30
+ children: "编辑"
31
+ }),
32
+ /*#__PURE__*/ jsx(NodeTitleConfigModal, {
33
+ open: visible,
34
+ script: value,
35
+ variables: scriptVariables,
36
+ onCancel: ()=>setVisible(false),
37
+ onConfirm: (script)=>{
38
+ props.onChange?.(script);
39
+ },
40
+ scriptKey: props.scriptKey
41
+ })
42
+ ]
43
+ });
44
+ };
45
+ const NodeTitleStrategy = ()=>/*#__PURE__*/ jsx(Fragment, {
13
46
  children: /*#__PURE__*/ jsx(Form, {
14
47
  style: {
15
48
  width: '100%'
@@ -21,39 +54,14 @@ const NodeTitleStrategy = ()=>{
21
54
  name: "NodeTitleStrategy.script",
22
55
  render: (props)=>{
23
56
  const { value, onChange } = props.field;
24
- return /*#__PURE__*/ jsxs(Space.Compact, {
25
- style: {
26
- width: '100%'
27
- },
28
- children: [
29
- /*#__PURE__*/ jsx(GroovyScriptPreview, {
30
- script: value
31
- }),
32
- /*#__PURE__*/ jsx(Button, {
33
- icon: /*#__PURE__*/ jsx(EditOutlined, {}),
34
- onClick: ()=>{
35
- setShowConfigModal(true);
36
- },
37
- style: {
38
- borderRadius: '0 6px 6px 0'
39
- },
40
- children: "编辑"
41
- }),
42
- /*#__PURE__*/ jsx(NodeTitleConfigModal, {
43
- open: showConfigModal,
44
- script: value,
45
- variables: scriptVariables,
46
- onCancel: ()=>setShowConfigModal(false),
47
- onConfirm: (script)=>{
48
- onChange(script);
49
- }
50
- })
51
- ]
57
+ return /*#__PURE__*/ jsx(GroovyScriptLoader, {
58
+ content: NodeTitleConfigContent,
59
+ value: value,
60
+ onChange: onChange
52
61
  });
53
62
  }
54
63
  })
55
64
  })
56
65
  })
57
66
  });
58
- };
59
67
  export { NodeTitleStrategy };
@@ -5,6 +5,7 @@ import { Field } from "@flowgram.ai/fixed-layout-editor";
5
5
  import { EditOutlined } from "@ant-design/icons";
6
6
  import { GroovyScriptPreview } from "../../../../script-components/components/groovy-script-preview.js";
7
7
  import { OperatorLoadConfigModal } from "../../../../script-components/modal/operator-load-config-modal.js";
8
+ import { GroovyScriptLoader } from "../../../../script-components/components/groovy-script-loader.js";
8
9
  const SELECT_TYPE_OPTIONS = [
9
10
  {
10
11
  label: '脚本指定',
@@ -19,6 +20,41 @@ const SELECT_TYPE_OPTIONS = [
19
20
  value: 'APPROVER_SELECT'
20
21
  }
21
22
  ];
23
+ const OperatorLoadScriptContent = (props)=>{
24
+ const [visible, setVisible] = react.useState(false);
25
+ const value = props.value || '';
26
+ return /*#__PURE__*/ jsxs(Space.Compact, {
27
+ style: {
28
+ width: '100%'
29
+ },
30
+ children: [
31
+ /*#__PURE__*/ jsx(GroovyScriptPreview, {
32
+ script: value
33
+ }),
34
+ /*#__PURE__*/ jsx(Button, {
35
+ icon: /*#__PURE__*/ jsx(EditOutlined, {}),
36
+ onClick: ()=>{
37
+ setVisible(true);
38
+ },
39
+ style: {
40
+ borderRadius: '0 6px 6px 0'
41
+ },
42
+ children: "编辑"
43
+ }),
44
+ /*#__PURE__*/ jsx(OperatorLoadConfigModal, {
45
+ script: value,
46
+ open: visible,
47
+ onCancel: ()=>{
48
+ setVisible(false);
49
+ },
50
+ onConfirm: (value)=>{
51
+ props.onChange?.(value);
52
+ },
53
+ scriptKey: props.scriptKey
54
+ })
55
+ ]
56
+ });
57
+ };
22
58
  const OperatorLoadStrategy = ()=>{
23
59
  const [form] = Form.useForm();
24
60
  const [visible, setVisible] = react.useState(false);
@@ -58,35 +94,10 @@ const OperatorLoadStrategy = ()=>{
58
94
  tooltip: isRangeMode ? "设定可选人员范围,留空表示不限范围(可选任意人)" : "设定流程的审批人",
59
95
  children: /*#__PURE__*/ jsx(Field, {
60
96
  name: "OperatorLoadStrategy.script",
61
- render: ({ field: { value, onChange } })=>/*#__PURE__*/ jsxs(Space.Compact, {
62
- style: {
63
- width: '100%'
64
- },
65
- children: [
66
- /*#__PURE__*/ jsx(GroovyScriptPreview, {
67
- script: value
68
- }),
69
- /*#__PURE__*/ jsx(Button, {
70
- icon: /*#__PURE__*/ jsx(EditOutlined, {}),
71
- onClick: ()=>{
72
- setVisible(true);
73
- },
74
- style: {
75
- borderRadius: '0 6px 6px 0'
76
- },
77
- children: "编辑"
78
- }),
79
- /*#__PURE__*/ jsx(OperatorLoadConfigModal, {
80
- script: value,
81
- open: visible,
82
- onCancel: ()=>{
83
- setVisible(false);
84
- },
85
- onConfirm: (value)=>{
86
- onChange(value);
87
- }
88
- })
89
- ]
97
+ render: ({ field: { value, onChange } })=>/*#__PURE__*/ jsx(GroovyScriptLoader, {
98
+ content: OperatorLoadScriptContent,
99
+ value: value,
100
+ onChange: onChange
90
101
  })
91
102
  })
92
103
  });
@@ -5,9 +5,44 @@ import { Field } from "@flowgram.ai/fixed-layout-editor";
5
5
  import { GroovyScriptPreview } from "../../../../script-components/components/groovy-script-preview.js";
6
6
  import { EditOutlined } from "@ant-design/icons";
7
7
  import { RouterConfigModal } from "../../../../script-components/modal/router-config-modal.js";
8
+ import { GroovyScriptLoader } from "../../../../script-components/components/groovy-script-loader.js";
9
+ const RouterConfigContent = (props)=>{
10
+ const [visible, setVisible] = react.useState(false);
11
+ const value = props.value || '';
12
+ return /*#__PURE__*/ jsxs(Space.Compact, {
13
+ style: {
14
+ width: '100%'
15
+ },
16
+ children: [
17
+ /*#__PURE__*/ jsx(GroovyScriptPreview, {
18
+ script: value
19
+ }),
20
+ /*#__PURE__*/ jsx(Button, {
21
+ icon: /*#__PURE__*/ jsx(EditOutlined, {}),
22
+ onClick: ()=>{
23
+ setVisible(true);
24
+ },
25
+ style: {
26
+ borderRadius: '0 6px 6px 0'
27
+ },
28
+ children: "编辑"
29
+ }),
30
+ /*#__PURE__*/ jsx(RouterConfigModal, {
31
+ open: visible,
32
+ script: value,
33
+ onCancel: ()=>{
34
+ setVisible(false);
35
+ },
36
+ onConfirm: (value)=>{
37
+ props.onChange?.(value);
38
+ },
39
+ scriptKey: props.scriptKey
40
+ })
41
+ ]
42
+ });
43
+ };
8
44
  const RouterStrategy = ()=>{
9
45
  const [form] = Form.useForm();
10
- const [visible, setVisible] = react.useState(false);
11
46
  return /*#__PURE__*/ jsx(Form, {
12
47
  form: form,
13
48
  style: {
@@ -22,35 +57,10 @@ const RouterStrategy = ()=>{
22
57
  ],
23
58
  children: /*#__PURE__*/ jsx(Field, {
24
59
  name: "RouterStrategy.script",
25
- render: ({ field: { value, onChange } })=>/*#__PURE__*/ jsxs(Space.Compact, {
26
- style: {
27
- width: '100%'
28
- },
29
- children: [
30
- /*#__PURE__*/ jsx(GroovyScriptPreview, {
31
- script: value
32
- }),
33
- /*#__PURE__*/ jsx(Button, {
34
- icon: /*#__PURE__*/ jsx(EditOutlined, {}),
35
- onClick: ()=>{
36
- setVisible(true);
37
- },
38
- style: {
39
- borderRadius: '0 6px 6px 0'
40
- },
41
- children: "编辑"
42
- }),
43
- /*#__PURE__*/ jsx(RouterConfigModal, {
44
- open: visible,
45
- script: value,
46
- onCancel: ()=>{
47
- setVisible(false);
48
- },
49
- onConfirm: (value)=>{
50
- onChange(value);
51
- }
52
- })
53
- ]
60
+ render: ({ field: { value, onChange } })=>/*#__PURE__*/ jsx(GroovyScriptLoader, {
61
+ content: RouterConfigContent,
62
+ value: value,
63
+ onChange: onChange
54
64
  })
55
65
  })
56
66
  })
@@ -5,9 +5,44 @@ import { Field } from "@flowgram.ai/fixed-layout-editor";
5
5
  import { GroovyScriptPreview } from "../../../../script-components/components/groovy-script-preview.js";
6
6
  import { EditOutlined } from "@ant-design/icons";
7
7
  import { SubProcessConfigModal } from "../../../../script-components/modal/sub-process-config-modal.js";
8
+ import { GroovyScriptLoader } from "../../../../script-components/components/groovy-script-loader.js";
9
+ const SubProcessScriptContent = (props)=>{
10
+ const [visible, setVisible] = react.useState(false);
11
+ const value = props.value || '';
12
+ return /*#__PURE__*/ jsxs(Space.Compact, {
13
+ style: {
14
+ width: '100%'
15
+ },
16
+ children: [
17
+ /*#__PURE__*/ jsx(GroovyScriptPreview, {
18
+ script: value
19
+ }),
20
+ /*#__PURE__*/ jsx(Button, {
21
+ icon: /*#__PURE__*/ jsx(EditOutlined, {}),
22
+ onClick: ()=>{
23
+ setVisible(true);
24
+ },
25
+ style: {
26
+ borderRadius: '0 6px 6px 0'
27
+ },
28
+ children: "编辑"
29
+ }),
30
+ /*#__PURE__*/ jsx(SubProcessConfigModal, {
31
+ open: visible,
32
+ onCancel: ()=>{
33
+ setVisible(false);
34
+ },
35
+ onConfirm: (value)=>{
36
+ props.onChange?.(value);
37
+ },
38
+ script: value,
39
+ scriptKey: props.scriptKey
40
+ })
41
+ ]
42
+ });
43
+ };
8
44
  const SubProcessStrategy = ()=>{
9
45
  const [form] = Form.useForm();
10
- const [visible, setVisible] = react.useState(false);
11
46
  return /*#__PURE__*/ jsxs(Form, {
12
47
  form: form,
13
48
  style: {
@@ -23,35 +58,10 @@ const SubProcessStrategy = ()=>{
23
58
  ],
24
59
  children: /*#__PURE__*/ jsx(Field, {
25
60
  name: "SubProcessStrategy.script",
26
- render: ({ field: { value, onChange } })=>/*#__PURE__*/ jsxs(Space.Compact, {
27
- style: {
28
- width: '100%'
29
- },
30
- children: [
31
- /*#__PURE__*/ jsx(GroovyScriptPreview, {
32
- script: value
33
- }),
34
- /*#__PURE__*/ jsx(Button, {
35
- icon: /*#__PURE__*/ jsx(EditOutlined, {}),
36
- onClick: ()=>{
37
- setVisible(true);
38
- },
39
- style: {
40
- borderRadius: '0 6px 6px 0'
41
- },
42
- children: "编辑"
43
- }),
44
- /*#__PURE__*/ jsx(SubProcessConfigModal, {
45
- open: visible,
46
- onCancel: ()=>{
47
- setVisible(false);
48
- },
49
- onConfirm: (value)=>{
50
- onChange(value);
51
- },
52
- script: value
53
- })
54
- ]
61
+ render: ({ field: { value, onChange } })=>/*#__PURE__*/ jsx(GroovyScriptLoader, {
62
+ content: SubProcessScriptContent,
63
+ value: value,
64
+ onChange: onChange
55
65
  })
56
66
  })
57
67
  }),
@@ -5,6 +5,42 @@ import { Field } from "@flowgram.ai/fixed-layout-editor";
5
5
  import { GroovyScriptPreview } from "../../../../script-components/components/groovy-script-preview.js";
6
6
  import { EditOutlined } from "@ant-design/icons";
7
7
  import { TriggerConfigModal } from "../../../../script-components/modal/trigger-config-modal.js";
8
+ import { GroovyScriptLoader } from "../../../../script-components/components/groovy-script-loader.js";
9
+ const TriggerConfigContent = (props)=>{
10
+ const [visible, setVisible] = react.useState(false);
11
+ const value = props.value || '';
12
+ return /*#__PURE__*/ jsxs(Space.Compact, {
13
+ style: {
14
+ width: '100%'
15
+ },
16
+ children: [
17
+ /*#__PURE__*/ jsx(GroovyScriptPreview, {
18
+ script: value
19
+ }),
20
+ /*#__PURE__*/ jsx(Button, {
21
+ icon: /*#__PURE__*/ jsx(EditOutlined, {}),
22
+ onClick: ()=>{
23
+ setVisible(true);
24
+ },
25
+ style: {
26
+ borderRadius: '0 6px 6px 0'
27
+ },
28
+ children: "编辑"
29
+ }),
30
+ /*#__PURE__*/ jsx(TriggerConfigModal, {
31
+ open: visible,
32
+ onCancel: ()=>{
33
+ setVisible(false);
34
+ },
35
+ onConfirm: (value)=>{
36
+ props.onChange?.(value);
37
+ },
38
+ script: value,
39
+ scriptKey: props.scriptKey
40
+ })
41
+ ]
42
+ });
43
+ };
8
44
  const TriggerStrategy = ()=>{
9
45
  const [form] = Form.useForm();
10
46
  const [visible, setVisible] = react.useState(false);
@@ -22,35 +58,10 @@ const TriggerStrategy = ()=>{
22
58
  ],
23
59
  children: /*#__PURE__*/ jsx(Field, {
24
60
  name: "TriggerStrategy.script",
25
- render: ({ field: { value, onChange } })=>/*#__PURE__*/ jsxs(Space.Compact, {
26
- style: {
27
- width: '100%'
28
- },
29
- children: [
30
- /*#__PURE__*/ jsx(GroovyScriptPreview, {
31
- script: value
32
- }),
33
- /*#__PURE__*/ jsx(Button, {
34
- icon: /*#__PURE__*/ jsx(EditOutlined, {}),
35
- onClick: ()=>{
36
- setVisible(true);
37
- },
38
- style: {
39
- borderRadius: '0 6px 6px 0'
40
- },
41
- children: "编辑"
42
- }),
43
- /*#__PURE__*/ jsx(TriggerConfigModal, {
44
- open: visible,
45
- onCancel: ()=>{
46
- setVisible(false);
47
- },
48
- onConfirm: (value)=>{
49
- onChange(value);
50
- },
51
- script: value
52
- })
53
- ]
61
+ render: ({ field: { value, onChange } })=>/*#__PURE__*/ jsx(GroovyScriptLoader, {
62
+ content: TriggerConfigContent,
63
+ value: value,
64
+ onChange: onChange
54
65
  })
55
66
  })
56
67
  })