@nocobase/plugin-workflow-loop 2.1.11 → 2.2.0-alpha.2
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/client-v2.d.ts +2 -0
- package/client-v2.js +1 -0
- package/dist/client/504.74c0bfdbddec6583.js +10 -0
- package/dist/client/LoopInstruction.d.ts +2 -92
- package/dist/client/index.js +1 -1
- package/dist/client-v2/504.597de6053e4ef634.js +10 -0
- package/dist/client-v2/index.d.ts +9 -0
- package/dist/client-v2/index.js +10 -0
- package/dist/client-v2/locale.d.ts +11 -0
- package/dist/client-v2/nodes/components/loop.d.ts +14 -0
- package/dist/client-v2/nodes/loop.d.ts +62 -0
- package/dist/client-v2/plugin.d.ts +13 -0
- package/dist/externalVersion.js +9 -8
- package/dist/node_modules/joi/package.json +1 -1
- package/package.json +3 -2
package/client-v2.d.ts
ADDED
package/client-v2.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./dist/client-v2/index.js');
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
"use strict";(self.webpackChunk_nocobase_plugin_workflow_loop=self.webpackChunk_nocobase_plugin_workflow_loop||[]).push([["504"],{675:function(e,n,t){t.d(n,{LoopCanvasComponent:function(){return S},LoopFieldset:function(){return j}});var r=t(155),o=t.n(r),l=t(477),a=t(375),i=t(59),c=t(197),u=t(694),s=t(488),f=t(806);function m(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=Array(n);t<n;t++)r[t]=e[t];return r}function d(e,n,t,r,o,l,a){try{var i=e[l](a),c=i.value}catch(e){t(e);return}i.done?n(c):Promise.resolve(c).then(r,o)}function p(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.forEach(function(n){var r;r=t[n],n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r})}return e}function b(e,n){return n=null!=n?n:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):(function(e){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n.push.apply(n,t)}return n})(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}),e}function h(e,n){return n||(n=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}function v(e){return function(e){if(Array.isArray(e))return m(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e){if(e){if("string"==typeof e)return m(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return m(e,void 0)}}(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(e){return e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function g(){var e=h(["\n margin-top: ","px;\n "]);return g=function(){return e},e}function w(){var e=h(["\n padding-left: 4em;\n "]);return w=function(){return e},e}var k=["string",["number",{step:1,min:0,precision:0}]];function E(){var e=(0,s.kj)(),n=(0,u.useFlowEngine)(),t=(0,c.useNodeContext)(),o=(0,c.useWorkflowVariableOptions)(),l=(0,f.Lc)(t);return(0,r.useMemo)(function(){if(!(null==t?void 0:t.key)||!(null==l?void 0:l.length))return o;var r,a,i={name:t.key,title:null!=(r=t.title)?r:"#".concat(t.id),type:"",paths:[f.JI,t.key],children:function e(n,t){return n.map(function(n){var r,o,l=n.children,a=b(p({},n),{paths:v(t).concat(v(null!=(r=n.paths)?r:[String(null!=(o=n.name)?o:"")]))});return Array.isArray(l)?a.children=e(l,t):"function"==typeof l&&(a.children=function(){var n;return(n=function(){return function(e,n){var t,r,o,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(a,"next",{value:c(0)}),i(a,"throw",{value:c(1)}),i(a,"return",{value:c(2)}),"function"==typeof Symbol&&i(a,Symbol.iterator,{value:function(){return this}}),a;function c(i){return function(c){var u=[i,c];if(t)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(l=0)),l;)try{if(t=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return l.label++,{value:u[1],done:!1};case 5:l.label++,r=u[1],u=[0];continue;case 7:u=l.ops.pop(),l.trys.pop();continue;default:if(!(o=(o=l.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){l=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){l.label=u[1];break}if(6===u[0]&&l.label<o[1]){l.label=o[1],o=u;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(u);break}o[2]&&l.ops.pop(),l.trys.pop();continue}u=n.call(e,l)}catch(e){u=[6,e],r=0}finally{t=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(n){switch(n.label){case 0:return[4,l()];case 1:return[2,e(n.sent(),t)]}})},function(){var e=this,t=arguments;return new Promise(function(r,o){var l=n.apply(e,t);function a(e){d(l,r,o,a,i,"next",e)}function i(e){d(l,r,o,a,i,"throw",e)}a(void 0)})})()}),a})}(l,[f.JI,t.key])},c=o.find(function(e){return e.name===f.JI}),u=o.filter(function(e){return e.name!==f.JI});if(!c)return[{name:f.JI,title:n.context.t("Scope variables",{ns:["workflow","client"],nsMode:"fallback"}),type:"",paths:[f.JI],children:[i]}].concat(v(u));var s=[i].concat(v((Array.isArray(c.children)?c.children:[]).filter(function(e){return String(e.name)!==String(t.key)})));return[b(p({},c),{children:s,title:null!=(a=c.title)?a:e("Scope variables")})].concat(v(u))},[n.context,l,null==t?void 0:t.id,null==t?void 0:t.key,null==t?void 0:t.title,e,o])}function O(e){var n=e.value,t=e.onChange,a=(0,s.kj)(),u=i.theme.useToken().token,m=(0,r.useMemo)(function(){return(0,l.css)(g(),u.marginSM)},[u.marginSM]),d=!!n,h=n&&(void 0===n?"undefined":y(n))==="object"?n:(0,f.Nw)();return o().createElement(o().Fragment,null,o().createElement(i.Checkbox,{checked:d,onChange:function(e){null==t||t(!!e.target.checked&&(0,f.Nw)())}},a("Enable loop condition")),d?o().createElement(i.Card,{className:m,size:"small"},o().createElement(i.Form.Item,{label:a("Condition"),style:{marginBottom:u.marginSM}},o().createElement(c.CalculationConfig,{value:h.calculation,onChange:function(e){return null==t?void 0:t(b(p({},h),{calculation:e}))},useVariableHook:E})),o().createElement(i.Form.Item,{label:a("When to check"),style:{marginBottom:u.marginSM}},o().createElement(c.RadioWithTooltip,{value:h.checkpoint,onChange:function(e){return null==t?void 0:t(b(p({},h),{checkpoint:e.target.value}))},options:[{label:a("Before each starts"),value:0},{label:a("After each ends"),value:1}]})),o().createElement(i.Form.Item,{label:a("When condition is not met on item")},o().createElement(c.RadioWithTooltip,{value:h.continueOnFalse,onChange:function(e){return null==t?void 0:t(b(p({},h),{continueOnFalse:e.target.value}))},options:[{label:a("Exit loop"),value:!1},{label:a("Continue on next item"),value:!0}]}))):null)}function j(){var e,n,t,l=(0,s.kj)(),a=i.Form.useWatch(["config","target"]);return e=i.Form.useFormInstance(),n=i.Form.useWatch(["config","target"],e),t=(0,r.useRef)(n),(0,r.useEffect)(function(){if(void 0===t.current){t.current=n;return}if(t.current!==n){var r=e.getFieldValue(["config","condition"]);r&&(void 0===r?"undefined":y(r))==="object"&&e.setFieldValue(["config","condition"],b(p({},r),{calculation:void 0,expression:""})),t.current=n}},[e,n]),o().createElement(o().Fragment,null,o().createElement(i.Form.Item,{name:["config","target"],label:l("Loop target"),extra:l("A single number will be treated as a loop count, a single string will be treated as an array of characters, and other non-array values will be converted to arrays. The loop node ends when the loop count is reached, or when the array loop is completed. You can also add condition nodes to the loop to terminate it."),rules:[{required:!0}],initialValue:1},o().createElement(c.WorkflowTypedVariableInput,{nullable:!1,types:k})),a?o().createElement(i.Form.Item,{name:["config","condition"],initialValue:!1},o().createElement(O,null)):null,o().createElement(i.Form.Item,{name:["config","exit"],label:l("When node inside loop failed"),initialValue:0},o().createElement(c.RadioWithTooltip,{direction:"vertical",options:[{label:l("Exit workflow"),value:0},{label:l("Exit loop and continue workflow"),value:1},{label:l("Continue loop on next item"),value:2}]})))}function S(e){var n,t,r=e.data,i=(null!=(n=(0,c.useFlowContext)())?n:{}).nodes,u=(0,c.useStyles)().styles,s=(null!=i?i:[]).find(function(e){return e.upstreamId===r.id&&null!=e.branchIndex});return o().createElement(c.NodeDefaultView,{data:r},o().createElement("div",{className:u.nodeSubtreeClass},o().createElement("div",{className:(0,l.cx)(u.branchBlockClass,(0,l.css)(w()))},o().createElement(c.Branch,{from:r,entry:s,branchIndex:null!=(t=null==s?void 0:s.branchIndex)?t:0}),o().createElement("div",{className:u.branchClass,style:{minWidth:"4em"}},o().createElement("div",{className:"workflow-branch-lines"}),o().createElement("div",{className:u.loopLineClass},o().createElement(a.ArrowUpOutlined,null))))))}}}]);
|
|
@@ -6,96 +6,6 @@
|
|
|
6
6
|
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
declare function LoopCondition({ value, onChange }: {
|
|
12
|
-
value: any;
|
|
13
|
-
onChange: any;
|
|
14
|
-
}): React.JSX.Element;
|
|
15
|
-
declare function useScopeVariables(node: any, options: any): VariableOption[];
|
|
16
|
-
declare function LoopVariableTextArea({ variableOptions, ...props }: {
|
|
17
|
-
[x: string]: any;
|
|
18
|
-
variableOptions: any;
|
|
19
|
-
}): JSX.Element;
|
|
20
|
-
export default class extends Instruction {
|
|
21
|
-
title: string;
|
|
22
|
-
type: string;
|
|
23
|
-
group: string;
|
|
24
|
-
description: string;
|
|
25
|
-
icon: React.JSX.Element;
|
|
26
|
-
fieldset: {
|
|
27
|
-
target: {
|
|
28
|
-
type: string;
|
|
29
|
-
title: string;
|
|
30
|
-
description: string;
|
|
31
|
-
'x-decorator': string;
|
|
32
|
-
'x-component': string;
|
|
33
|
-
'x-component-props': {
|
|
34
|
-
changeOnSelect: boolean;
|
|
35
|
-
nullable: boolean;
|
|
36
|
-
useTypedConstant: (string | (string | {
|
|
37
|
-
step: number;
|
|
38
|
-
min: number;
|
|
39
|
-
precision: number;
|
|
40
|
-
})[])[];
|
|
41
|
-
className: string;
|
|
42
|
-
};
|
|
43
|
-
required: boolean;
|
|
44
|
-
default: number;
|
|
45
|
-
'x-reactions': {
|
|
46
|
-
target: string;
|
|
47
|
-
effects: string[];
|
|
48
|
-
fulfill: {
|
|
49
|
-
state: {
|
|
50
|
-
value: string;
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
|
-
}[];
|
|
54
|
-
};
|
|
55
|
-
condition: {
|
|
56
|
-
type: string;
|
|
57
|
-
'x-decorator': string;
|
|
58
|
-
'x-component': string;
|
|
59
|
-
'x-reactions': {
|
|
60
|
-
dependencies: string[];
|
|
61
|
-
fulfill: {
|
|
62
|
-
state: {
|
|
63
|
-
visible: string;
|
|
64
|
-
};
|
|
65
|
-
};
|
|
66
|
-
}[];
|
|
67
|
-
default: boolean;
|
|
68
|
-
};
|
|
69
|
-
exit: {
|
|
70
|
-
type: string;
|
|
71
|
-
title: string;
|
|
72
|
-
'x-decorator': string;
|
|
73
|
-
'x-component': string;
|
|
74
|
-
'x-component-props': {
|
|
75
|
-
direction: string;
|
|
76
|
-
options: {
|
|
77
|
-
label: string;
|
|
78
|
-
value: number;
|
|
79
|
-
}[];
|
|
80
|
-
};
|
|
81
|
-
default: number;
|
|
82
|
-
};
|
|
83
|
-
};
|
|
84
|
-
branching: boolean;
|
|
85
|
-
scope: {
|
|
86
|
-
renderEngineReference: (key: string) => React.JSX.Element;
|
|
87
|
-
};
|
|
88
|
-
components: {
|
|
89
|
-
LoopCondition: typeof LoopCondition;
|
|
90
|
-
WorkflowVariableInput: typeof WorkflowVariableInput;
|
|
91
|
-
WorkflowVariableTextArea: typeof WorkflowVariableTextArea;
|
|
92
|
-
LoopVariableTextArea: typeof LoopVariableTextArea;
|
|
93
|
-
RadioWithTooltip: typeof RadioWithTooltip;
|
|
94
|
-
CalculationConfig: typeof CalculationConfig;
|
|
95
|
-
};
|
|
96
|
-
Component({ data }: {
|
|
97
|
-
data: any;
|
|
98
|
-
}): React.JSX.Element;
|
|
99
|
-
useScopeVariables: typeof useScopeVariables;
|
|
9
|
+
import V2LoopInstruction from '../client-v2/nodes/loop';
|
|
10
|
+
export default class extends V2LoopInstruction {
|
|
100
11
|
}
|
|
101
|
-
export {};
|
package/dist/client/index.js
CHANGED
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react-i18next"),require("@formily/antd-v5"),require("react"),require("antd"),require("@nocobase/client"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/plugin-workflow/client")):"function"==typeof define&&define.amd?define("@nocobase/plugin-workflow-loop",["react-i18next","@formily/antd-v5","react","antd","@nocobase/client","@formily/react","@ant-design/icons","@nocobase/plugin-workflow/client"],t):"object"==typeof exports?exports["@nocobase/plugin-workflow-loop"]=t(require("react-i18next"),require("@formily/antd-v5"),require("react"),require("antd"),require("@nocobase/client"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/plugin-workflow/client")):e["@nocobase/plugin-workflow-loop"]=t(e["react-i18next"],e["@formily/antd-v5"],e.react,e.antd,e["@nocobase/client"],e["@formily/react"],e["@ant-design/icons"],e["@nocobase/plugin-workflow/client"])}(self,function(e,t,n,r,o,i,a,l){return function(){"use strict";var c={375:function(e){e.exports=a},418:function(e){e.exports=t},230:function(e){e.exports=i},342:function(e){e.exports=o},990:function(e){e.exports=l},59:function(e){e.exports=r},155:function(e){e.exports=n},953:function(t){t.exports=e}},u={};function s(e){var t=u[e];if(void 0!==t)return t.exports;var n=u[e]={exports:{}};return c[e](n,n.exports,s),n.exports}s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,{a:t}),t},s.d=function(e,t){for(var n in t)s.o(t,n)&&!s.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.g.importScripts&&(f=s.g.location+"");var f,p=s.g.document;if(!f&&p&&(p.currentScript&&"SCRIPT"===p.currentScript.tagName.toUpperCase()&&(f=p.currentScript.src),!f)){var b=p.getElementsByTagName("script");if(b.length)for(var d=b.length-1;d>-1&&(!f||!/^http(s?):/.test(f));)f=b[d--].src}if(!f)throw Error("Automatic publicPath is not supported in this browser");s.p=f.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/");var y={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src){var n=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"");n.indexOf("/static/plugins/@nocobase/plugin-workflow-loop/dist/client/")>=0&&(e=n.replace(/\/[^\/]+$/,"/"))}if(!e){var r=window.__webpack_public_path__||"";r&&("/"!==r.charAt(r.length-1)&&(r+="/"),e=r+"static/plugins/@nocobase/plugin-workflow-loop/dist/client/")}if(!e){var o=window.__nocobase_modern_client_prefix__||"v",i="/"+(o=String(o).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var a=window.location.pathname||"/",l=a.indexOf(i);e=l>=0?a.slice(0,l+1):"/"}e&&(e=e.replace(RegExp("/"+o+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-workflow-loop/dist/client/"}s.p=e}(),!function(){s.r(y),s.d(y,{default:function(){return N}});var e=s(342),t=s(155),n=s.n(t),r=s(375),o=s(59),i=s(418),a=s(230),l=s(990),c=s(953),u="workflow-loop";function f(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(0,(t=n,(0,c.useTranslation)(u,t)).t)(e)}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function b(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function h(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){b(e,t,n[t])})}return e}function m(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function v(e,t){return(v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function g(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function w(e){return e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function O(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(O=function(){return!!e})()}function x(){var e=g(["\n padding-left: 4em;\n "]);return x=function(){return e},e}function j(){var e=g(["\n width: 100%;\n\n .variable {\n flex: 1;\n }\n\n .ant-input.null-value {\n width: 100%;\n }\n "]);return j=function(){return e},e}function k(e){var r=e.value,a=e.onChange,s=(0,c.useTranslation)().t,f=(0,t.useCallback)(function(e){a(m(h({},r),{checkpoint:e.target.value}))},[r,a]),p=(0,t.useCallback)(function(e){a(m(h({},r),{continueOnFalse:e.target.value}))},[r,a]),b=(0,t.useCallback)(function(e){a(m(h({},r),{calculation:e}))},[r,a]);return n().createElement(n().Fragment,null,n().createElement(o.Checkbox,{checked:!!r,onChange:function(e){a(!!e.target.checked&&{checkpoint:0,continueOnFalse:!1,calculation:{group:{type:"and",calculations:[]}}})}},s("Enable loop condition",{ns:u})),r?n().createElement(o.Card,null,n().createElement(i.FormLayout,{layout:"vertical"},n().createElement(i.FormItem,{label:s("Condition",{ns:u})},n().createElement(l.CalculationConfig,{value:r.calculation,onChange:b,useVariableHook:_})),n().createElement(i.FormItem,{label:s("When to check",{ns:u})},n().createElement(l.RadioWithTooltip,{value:r.checkpoint,onChange:f,options:[{label:s("Before each starts",{ns:u}),value:0},{label:s("After each ends",{ns:u}),value:1}]})),n().createElement(i.FormItem,{label:s("When condition is not met on item",{ns:u})},n().createElement(l.RadioWithTooltip,{value:r.continueOnFalse,onChange:p,options:[{label:s("Exit loop",{ns:u}),value:!1},{label:s("Continue on next item",{ns:u}),value:!0}]})))):null)}function E(t,n){var r,o,i,a,c=(0,e.useCompile)(),u=f("Loop target"),s=f("Loop index (starts from 0)"),p=f("Loop sequence (starts from 1)"),d=f("Loop length"),y=t.config.target;if(null==y)return null;var v=n.fieldNames,g=void 0===v?l.defaultFieldNames:v,O=n.scope,x=(b(r={key:"item"},g.value,"item"),b(r,g.label,u),r);if("string"==typeof y&&y.startsWith("{{")&&y.endsWith("}}")){var j=y.slice(2,-2).split(".").map(function(e){return e.trim()});x=Object.assign({},function(e,t){for(var n=e,r=null,o=0;o<t.length;o++){var i=function(e){var o=t[e],i=n.find(function(e){return e.value===o});if(!i)return{v:null};r=i,!i.isLeaf&&i.loadChildren&&i.loadChildren(i),i.children&&(n=i.children)}(o);if("object"===w(i))return i.v}return r}(null!=O?O:[l.scopeOptions,l.nodesOptions,l.triggerOptions].map(function(e){var r,o=e.useOptions(m(h({},n),{current:t})).filter(Boolean);return b(r={},g.label,c(e.label)),b(r,g.value,e.value),b(r,"key",e.value),b(r,g.children,o),b(r,"disabled",o&&!o.length),r}),j),x)}return[x,(b(o={key:"index"},g.value,"index"),b(o,g.label,s),o),(b(i={key:"sequence"},g.value,"sequence"),b(i,g.label,p),i),(b(a={key:"length"},g.value,"length"),b(a,g.label,d),a)]}function _(){var e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=(0,a.useForm)().values,o=(0,l.useNodeContext)(),i=m(h({},o),{config:m(h({},o.config),{target:r.target})}),c=(0,l.useWorkflowVariableOptions)(n),u=E(i,m(h({},n),{scope:c.filter(function(e){return["$scopes","$jobsMapByNodeKey","$context"].includes(e.key)})})),s=n.fieldNames,f=void 0===s?l.defaultFieldNames:s;if(!u)return c;var d=c.find(function(e){return"$scopes"===e[f.value]});return d&&(d[f.children]||(d[f.children]=[]),d[f.children].unshift((b(t={key:o.key},f.value,o.key),b(t,f.label,null!=(e=o.title)?e:"#".concat(o.id)),b(t,f.children,u),t)),d.disabled=!1),function(e){if(Array.isArray(e))return p(e)}(c)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(c)||function(e){if(e){if("string"==typeof e)return p(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return p(e,void 0)}}(c)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function C(t){var r=t.variableOptions,o=function(e,t){if(null==e)return{};var n,r,o,i={};if("u">typeof Reflect&&Reflect.ownKeys){for(o=0,n=Reflect.ownKeys(Object(e));o<n.length;o++)r=n[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r]);return i}if(i=function(e,t){if(null==e)return{};var n,r,o={},i=Object.getOwnPropertyNames(e);for(r=0;r<i.length;r++)n=i[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n]);return o}(e,t),Object.getOwnPropertySymbols)for(o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)r=n[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r]);return i}(t,["variableOptions"]),i=_(r);return n().createElement(e.Variable.TextArea,h({scope:i},o))}var S=function(t){var o;if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");function i(){var t,o,a;if(!(this instanceof i))throw TypeError("Cannot call a class as a function");return o=i,a=arguments,o=d(o),b(t=function(e,t){if(t&&("object"===w(t)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,O()?Reflect.construct(o,a||[],d(this).constructor):o.apply(this,a)),"title",'{{t("Loop", { ns: "'.concat(u,'" })}}')),b(t,"type","loop"),b(t,"group","control"),b(t,"description",'{{t("By using a loop node, you can perform the same operation on multiple sets of data. The source of these sets can be either multiple records from a query node or multiple associated records of a single record. Loop node can also be used for iterating a certain number of times or for looping through each character in a string. However, excessive looping may cause performance issues, so use with caution.", { ns: "'.concat(u,'" })}}')),b(t,"icon",n().createElement(r.RollbackOutlined,{style:{}})),b(t,"fieldset",{target:{type:"string",title:'{{t("Loop target", { ns: "'.concat(u,'" })}}'),description:'{{t("A single number will be treated as a loop count, a single string will be treated as an array of characters, and other non-array values will be converted to arrays. The loop node ends when the loop count is reached, or when the array loop is completed. You can also add condition nodes to the loop to terminate it.", { ns: "'.concat(u,'" })}}'),"x-decorator":"FormItem","x-component":"WorkflowVariableInput","x-component-props":{changeOnSelect:!0,nullable:!1,useTypedConstant:["string",["number",{step:1,min:0,precision:0}]],className:(0,e.css)(j())},required:!0,default:1,"x-reactions":[{target:"calculation",effects:["onFieldValueChange"],fulfill:{state:{value:null}}},{target:"expression",effects:["onFieldValueChange"],fulfill:{state:{value:""}}}]},condition:{type:"boolean","x-decorator":"FormItem","x-component":"LoopCondition","x-reactions":[{dependencies:["target"],fulfill:{state:{visible:"{{Boolean($deps[0])}}"}}}],default:!1},exit:{type:"number",title:'{{t("When node inside loop failed", { ns: "'.concat(u,'" })}}'),"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{direction:"vertical",options:[{label:'{{t("Exit workflow", { ns: "'.concat(u,'" })}}'),value:0},{label:'{{t("Exit loop and continue workflow", { ns: "'.concat(u,'" })}}'),value:1},{label:'{{t("Continue loop on next item", { ns: "'.concat(u,'" })}}'),value:2}]},default:0}}),b(t,"branching",!0),b(t,"scope",{renderEngineReference:l.renderEngineReference}),b(t,"components",{LoopCondition:k,WorkflowVariableInput:l.WorkflowVariableInput,WorkflowVariableTextArea:l.WorkflowVariableTextArea,LoopVariableTextArea:C,RadioWithTooltip:l.RadioWithTooltip,CalculationConfig:l.CalculationConfig}),b(t,"useScopeVariables",E),t}return i.prototype=Object.create(t&&t.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),t&&v(i,t),o=[{key:"Component",value:function(t){var o,i=t.data,a=(0,l.useFlowContext)().nodes,c=(0,l.useStyles)().styles,u=a.find(function(e){return e.upstreamId===i.id&&null!=e.branchIndex});return n().createElement(l.NodeDefaultView,{data:i},n().createElement("div",{className:c.nodeSubtreeClass},n().createElement("div",{className:(0,e.cx)(c.branchBlockClass,(0,e.css)(x()))},n().createElement(l.Branch,{from:i,entry:u,branchIndex:null!=(o=null==u?void 0:u.branchIndex)?o:0}),n().createElement("div",{className:c.branchClass,style:{minWidth:"4em"}},n().createElement("div",{className:"workflow-branch-lines"}),n().createElement("div",{className:c.loopLineClass},n().createElement(r.ArrowUpOutlined,null))))))}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(i.prototype,o),i}(l.Instruction);function P(e,t,n,r,o,i,a){try{var l=e[i](a),c=l.value}catch(e){n(e);return}l.done?t(c):Promise.resolve(c).then(r,o)}function T(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){P(i,r,o,a,l,"next",e)}function l(e){P(i,r,o,a,l,"throw",e)}a(void 0)})}}function I(e,t,n){return(I=A()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&F(o,n.prototype),o}).apply(null,arguments)}function q(e){return(q=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function F(e,t){return(F=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function R(e){var t="function"==typeof Map?new Map:void 0;return(R=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return I(e,arguments,q(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),F(n,e)})(e)}function A(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(A=function(){return!!e})()}function W(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(a,"next",{value:c(0)}),l(a,"throw",{value:c(1)}),l(a,"return",{value:c(2)}),"function"==typeof Symbol&&l(a,Symbol.iterator,{value:function(){return this}}),a;function c(l){return function(c){var u=[l,c];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}var N=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return e=n,t=arguments,e=q(e),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,A()?Reflect.construct(e,t||[],q(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&F(n,e),t=[{key:"afterAdd",value:function(){return T(function(){return W(this,function(e){return[2]})})()}},{key:"beforeLoad",value:function(){return T(function(){return W(this,function(e){return[2]})})()}},{key:"load",value:function(){return T(function(){return W(this,function(e){return this.app.pm.get("workflow").registerInstruction("loop",S),[2]})}).call(this)}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,t),n}(R(e.Plugin))}(),y}()});
|
|
10
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@emotion/css"),require("react"),require("antd"),require("@nocobase/plugin-workflow/client-v2"),require("@nocobase/client"),require("@ant-design/icons"),require("@nocobase/flow-engine")):"function"==typeof define&&define.amd?define("@nocobase/plugin-workflow-loop",["@emotion/css","react","antd","@nocobase/plugin-workflow/client-v2","@nocobase/client","@ant-design/icons","@nocobase/flow-engine"],t):"object"==typeof exports?exports["@nocobase/plugin-workflow-loop"]=t(require("@emotion/css"),require("react"),require("antd"),require("@nocobase/plugin-workflow/client-v2"),require("@nocobase/client"),require("@ant-design/icons"),require("@nocobase/flow-engine")):e["@nocobase/plugin-workflow-loop"]=t(e["@emotion/css"],e.react,e.antd,e["@nocobase/plugin-workflow/client-v2"],e["@nocobase/client"],e["@ant-design/icons"],e["@nocobase/flow-engine"])}(self,function(e,t,n,r,o,i,u){return function(){"use strict";var c,a,l,f={806:function(e,t,n){n.d(t,{Ay:function(){return P},JI:function(){return O},Lc:function(){return S},Nw:function(){return _}});var r=n(155),o=n.n(r),i=n(375),u=n(197),c=n(694),a=n(488);function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function f(e,t,n,r,o,i,u){try{var c=e[i](u),a=c.value}catch(e){n(e);return}c.done?t(a):Promise.resolve(a).then(r,o)}function s(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function u(e){f(i,r,o,u,c,"next",e)}function c(e){f(i,r,o,u,c,"throw",e)}u(void 0)})}}function p(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function b(e){return(b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function y(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){p(e,t,n[t])})}return e}function d(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function h(e,t){return(h=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function v(e){return function(e){if(Array.isArray(e))return l(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e){if(e){if("string"==typeof e)return l(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return l(e,void 0)}}(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function g(e){return e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function m(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(m=function(){return!!e})()}function w(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(u,"next",{value:a(0)}),c(u,"throw",{value:a(1)}),c(u,"return",{value:a(2)}),"function"==typeof Symbol&&c(u,Symbol.iterator,{value:function(){return this}}),u;function a(c){return function(a){var l=[c,a];if(n)throw TypeError("Generator is already executing.");for(;u&&(u=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}var O="$scopes",j={type:"and",calculations:[]};function _(){return{checkpoint:0,continueOnFalse:!1,calculation:{group:{type:j.type,calculations:[]}}}}function k(e,t,n){var r,o=e.children,i=Array.isArray(e.paths)?e.paths.slice(t.length):[String(null!=(r=e.name)?r:"")],u=d(y({},e),{paths:v(n).concat(v(i))});return Array.isArray(o)?u.children=o.map(function(e){return k(e,t,n)}):"function"==typeof o&&(u.children=function(){return s(function(){return w(this,function(e){switch(e.label){case 0:return[4,o()];case 1:return[2,e.sent().map(function(e){return k(e,t,n)})]}})})()}),u}function S(e){var t,n,r,o,i,l,f=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},p=(0,a.kj)(),b=(0,u.useWorkflowVariableOptions)(d(y({},f),{includeScopes:!1}));return(null==(l=e.config)?void 0:l.target)==null?null:[(o=(r=function(e){if("string"!=typeof e)return null;var t=e.trim().match(/^\{\{\s*([^{}]+?)\s*\}\}$/);return(null==t?void 0:t[1])?t[1].split(".").map(function(e){return e.trim()}).filter(Boolean):null}(null==(n=e.config)?void 0:n.target))?function(e,t){var n=e,r=null,o=!0,i=!1,u=void 0;try{for(var c,a=t[Symbol.iterator]();!(o=(c=a.next()).done);o=!0){var l=function(){var e,t=c.value;if(!Array.isArray(n)||!(r=null!=(e=n.find(function(e){return String(e.name)===t}))?e:null))return{v:null};n=Array.isArray(r.children)?r.children:void 0}();if("object"===g(l))return l.v}}catch(e){i=!0,u=e}finally{try{o||null==a.return||a.return()}finally{if(i)throw u}}return r}(b,r):null,i={name:"item",title:p("Loop target"),type:null!=(t=null==o?void 0:o.type)?t:"",interface:null==o?void 0:o.interface,paths:["item"]},r&&(Array.isArray(null==o?void 0:o.children)?i.children=o.children.map(function(e){return k(e,r,["item"])}):i.children=function(){return s(function(){var e,t;return w(this,function(n){switch(n.label){case 0:return[4,s(function(){var e,t,n,o,i,u,a,l,f,s;return w(this,function(p){switch(p.label){case 0:e=b,t=null,n=!0,o=!1,i=void 0,p.label=1;case 1:p.trys.push([1,6,7,8]),u=function(){var n,r;return w(this,function(o){switch(o.label){case 0:if(n=l.value,!Array.isArray(e)||!(t=null!=(r=e.find(function(e){return String(e.name)===n}))?r:null))return[2,{v:null}];return[4,(0,c.loadMetaTreeChildren)(t)];case 1:return e=o.sent(),[2]}})},a=r[Symbol.iterator](),p.label=2;case 2:if(n=(l=a.next()).done)return[3,5];return[5,function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(u())];case 3:if("object"===g(f=p.sent()))return[2,f.v];p.label=4;case 4:return n=!0,[3,2];case 5:return[3,8];case 6:return s=p.sent(),o=!0,i=s,[3,8];case 7:try{n||null==a.return||a.return()}finally{if(o)throw i}return[7];case 8:return[2,t]}})})()];case 1:if(!(e=n.sent()))return[3,3];return[4,(0,c.loadMetaTreeChildren)(e)];case 2:return t=n.sent(),[3,4];case 3:t=[],n.label=4;case 4:return[2,t.map(function(e){return k(e,r,["item"])})]}})})()}),i),{name:"index",title:p("Loop index (starts from 0)"),type:"number",paths:["index"]},{name:"sequence",title:p("Loop sequence (starts from 1)"),type:"number",paths:["sequence"]},{name:"length",title:p("Loop length"),type:"number",paths:["length"]}]}var P=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t,u;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return t=r,u=arguments,t=b(t),p(e=function(e,t){if(t&&("object"===g(t)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,m()?Reflect.construct(t,u||[],b(this).constructor):t.apply(this,u)),"type","loop"),p(e,"title",(0,a.MZ)("Loop")),p(e,"group","control"),p(e,"description",(0,a.MZ)("By using a loop node, you can perform the same operation on multiple sets of data. The source of these sets can be either multiple records from a query node or multiple associated records of a single record. Loop node can also be used for iterating a certain number of times or for looping through each character in a string. However, excessive looping may cause performance issues, so use with caution.")),p(e,"icon",o().createElement(i.RollbackOutlined,null)),p(e,"branching",!0),p(e,"FieldsetLoader",function(){return n.e("504").then(n.bind(n,675)).then(function(e){return{default:e.LoopFieldset}})}),p(e,"ComponentLoader",function(){return n.e("504").then(n.bind(n,675)).then(function(e){return{default:e.LoopCanvasComponent}})}),p(e,"useScopeVariables",S),e}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&h(r,e),t=[{key:"createDefaultConfig",value:function(){return{target:1,condition:!1,exit:0}}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(r.prototype,t),r}(u.Instruction)},488:function(e,t,n){n.d(t,{MZ:function(){return c},kj:function(){return u}});var r=n(694);function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}var i="workflow-loop";function u(){var e=(0,r.useFlowEngine)();return function(t,n){return e.context.t(t,o({ns:[i,"client"],nsMode:"fallback"},n))}}function c(e,t){return(0,r.tExpr)(e,o({ns:[i,"client"],nsMode:"fallback"},t))}},375:function(e){e.exports=i},477:function(t){t.exports=e},342:function(e){e.exports=o},694:function(e){e.exports=u},197:function(e){e.exports=r},59:function(e){e.exports=n},155:function(e){e.exports=t}},s={};function p(e){var t=s[e];if(void 0!==t)return t.exports;var n=s[e]={exports:{}};return f[e](n,n.exports,p),n.exports}p.m=f,p.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return p.d(t,{a:t}),t},p.d=function(e,t){for(var n in t)p.o(t,n)&&!p.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},p.f={},p.e=function(e){return Promise.all(Object.keys(p.f).reduce(function(t,n){return p.f[n](e,t),t},[]))},p.u=function(e){return""+e+".74c0bfdbddec6583.js"},p.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),p.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},b={},p.l=function(e,t,n,r){if(b[e])return void b[e].push(t);if(void 0!==n)for(var o,i,u=document.getElementsByTagName("script"),c=0;c<u.length;c++){var a=u[c];if(a.getAttribute("src")==e||a.getAttribute("data-rspack")=="@nocobase/plugin-workflow-loop:"+n){o=a;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,p.nc&&o.setAttribute("nonce",p.nc),o.setAttribute("data-rspack","@nocobase/plugin-workflow-loop:"+n),o.src=e),b[e]=[t];var l=function(t,n){o.onerror=o.onload=null,clearTimeout(f);var r=b[e];if(delete b[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},f=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),i&&document.head.appendChild(o)},p.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},p.g.importScripts&&(y=p.g.location+"");var b,y,d=p.g.document;if(!y&&d&&(d.currentScript&&"SCRIPT"===d.currentScript.tagName.toUpperCase()&&(y=d.currentScript.src),!y)){var h=d.getElementsByTagName("script");if(h.length)for(var v=h.length-1;v>-1&&(!y||!/^http(s?):/.test(y));)y=h[v--].src}if(!y)throw Error("Automatic publicPath is not supported in this browser");p.p=y.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),c={889:0},p.f.j=function(e,t){var n=p.o(c,e)?c[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=c[e]=[t,r]});t.push(n[2]=r);var o=p.p+p.u(e),i=Error();p.l(o,function(t){if(p.o(c,e)&&(0!==(n=c[e])&&(c[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",i.name="ChunkLoadError",i.type=r,i.request=o,n[1](i)}},"chunk-"+e,e)}},a=function(e,t){var n,r,o=t[0],i=t[1],u=t[2],a=0;if(o.some(function(e){return 0!==c[e]})){for(n in i)p.o(i,n)&&(p.m[n]=i[n]);u&&u(p)}for(e&&e(t);a<o.length;a++)r=o[a],p.o(c,r)&&c[r]&&c[r][0](),c[r]=0},(l=self.webpackChunk_nocobase_plugin_workflow_loop=self.webpackChunk_nocobase_plugin_workflow_loop||[]).forEach(a.bind(null,0)),l.push=a.bind(null,l.push.bind(l));var g={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src){var n=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"");n.indexOf("/static/plugins/@nocobase/plugin-workflow-loop/dist/client/")>=0&&(e=n.replace(/\/[^\/]+$/,"/"))}if(!e){var r=window.__webpack_public_path__||"";r&&("/"!==r.charAt(r.length-1)&&(r+="/"),e=r+"static/plugins/@nocobase/plugin-workflow-loop/dist/client/")}if(!e){var o=window.__nocobase_modern_client_prefix__||"v",i="/"+(o=String(o).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var u=window.location.pathname||"/",c=u.indexOf(i);e=c>=0?u.slice(0,c+1):"/"}e&&(e=e.replace(RegExp("/"+o+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-workflow-loop/dist/client/"}p.p=e}(),!function(){p.r(g),p.d(g,{default:function(){return y}});var e=p(342);function t(e){return(t=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function n(e,t){return(n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function r(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(r=function(){return!!e})()}var o=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function o(){var e,n;if(!(this instanceof o))throw TypeError("Cannot call a class as a function");return e=o,n=arguments,e=t(e),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,r()?Reflect.construct(e,n||[],t(this).constructor):e.apply(this,n))}return o.prototype=Object.create(e&&e.prototype,{constructor:{value:o,writable:!0,configurable:!0}}),e&&n(o,e),o}(p(806).Ay);function i(e,t,n,r,o,i,u){try{var c=e[i](u),a=c.value}catch(e){n(e);return}c.done?t(a):Promise.resolve(a).then(r,o)}function u(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var u=e.apply(t,n);function c(e){i(u,r,o,c,a,"next",e)}function a(e){i(u,r,o,c,a,"throw",e)}c(void 0)})}}function c(e,t,n){return(c=s()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&l(o,n.prototype),o}).apply(null,arguments)}function a(e){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function f(e){var t="function"==typeof Map?new Map:void 0;return(f=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return c(e,arguments,a(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),l(n,e)})(e)}function s(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(s=function(){return!!e})()}function b(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(u,"next",{value:a(0)}),c(u,"throw",{value:a(1)}),c(u,"return",{value:a(2)}),"function"==typeof Symbol&&c(u,Symbol.iterator,{value:function(){return this}}),u;function a(c){return function(a){var l=[c,a];if(n)throw TypeError("Generator is already executing.");for(;u&&(u=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}var y=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return e=n,t=arguments,e=a(e),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,s()?Reflect.construct(e,t||[],a(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&l(n,e),t=[{key:"afterAdd",value:function(){return u(function(){return b(this,function(e){return[2]})})()}},{key:"beforeLoad",value:function(){return u(function(){return b(this,function(e){return[2]})})()}},{key:"load",value:function(){return u(function(){return b(this,function(e){return this.app.pm.get("workflow").registerInstruction("loop",o),[2]})}).call(this)}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,t),n}(f(e.Plugin))}(),g}()});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
"use strict";(self.webpackChunk_nocobase_plugin_workflow_loop_client_v2=self.webpackChunk_nocobase_plugin_workflow_loop_client_v2||[]).push([["504"],{675:function(e,n,t){t.d(n,{LoopCanvasComponent:function(){return S},LoopFieldset:function(){return j}});var r=t(155),o=t.n(r),l=t(477),a=t(375),i=t(59),c=t(197),u=t(694),s=t(488),f=t(806);function m(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=Array(n);t<n;t++)r[t]=e[t];return r}function d(e,n,t,r,o,l,a){try{var i=e[l](a),c=i.value}catch(e){t(e);return}i.done?n(c):Promise.resolve(c).then(r,o)}function p(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.forEach(function(n){var r;r=t[n],n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r})}return e}function b(e,n){return n=null!=n?n:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):(function(e){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n.push.apply(n,t)}return n})(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}),e}function h(e,n){return n||(n=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}function v(e){return function(e){if(Array.isArray(e))return m(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e){if(e){if("string"==typeof e)return m(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return m(e,void 0)}}(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(e){return e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function g(){var e=h(["\n margin-top: ","px;\n "]);return g=function(){return e},e}function w(){var e=h(["\n padding-left: 4em;\n "]);return w=function(){return e},e}var k=["string",["number",{step:1,min:0,precision:0}]];function E(){var e=(0,s.kj)(),n=(0,u.useFlowEngine)(),t=(0,c.useNodeContext)(),o=(0,c.useWorkflowVariableOptions)(),l=(0,f.Lc)(t);return(0,r.useMemo)(function(){if(!(null==t?void 0:t.key)||!(null==l?void 0:l.length))return o;var r,a,i={name:t.key,title:null!=(r=t.title)?r:"#".concat(t.id),type:"",paths:[f.JI,t.key],children:function e(n,t){return n.map(function(n){var r,o,l=n.children,a=b(p({},n),{paths:v(t).concat(v(null!=(r=n.paths)?r:[String(null!=(o=n.name)?o:"")]))});return Array.isArray(l)?a.children=e(l,t):"function"==typeof l&&(a.children=function(){var n;return(n=function(){return function(e,n){var t,r,o,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(a,"next",{value:c(0)}),i(a,"throw",{value:c(1)}),i(a,"return",{value:c(2)}),"function"==typeof Symbol&&i(a,Symbol.iterator,{value:function(){return this}}),a;function c(i){return function(c){var u=[i,c];if(t)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(l=0)),l;)try{if(t=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return l.label++,{value:u[1],done:!1};case 5:l.label++,r=u[1],u=[0];continue;case 7:u=l.ops.pop(),l.trys.pop();continue;default:if(!(o=(o=l.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){l=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){l.label=u[1];break}if(6===u[0]&&l.label<o[1]){l.label=o[1],o=u;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(u);break}o[2]&&l.ops.pop(),l.trys.pop();continue}u=n.call(e,l)}catch(e){u=[6,e],r=0}finally{t=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(n){switch(n.label){case 0:return[4,l()];case 1:return[2,e(n.sent(),t)]}})},function(){var e=this,t=arguments;return new Promise(function(r,o){var l=n.apply(e,t);function a(e){d(l,r,o,a,i,"next",e)}function i(e){d(l,r,o,a,i,"throw",e)}a(void 0)})})()}),a})}(l,[f.JI,t.key])},c=o.find(function(e){return e.name===f.JI}),u=o.filter(function(e){return e.name!==f.JI});if(!c)return[{name:f.JI,title:n.context.t("Scope variables",{ns:["workflow","client"],nsMode:"fallback"}),type:"",paths:[f.JI],children:[i]}].concat(v(u));var s=[i].concat(v((Array.isArray(c.children)?c.children:[]).filter(function(e){return String(e.name)!==String(t.key)})));return[b(p({},c),{children:s,title:null!=(a=c.title)?a:e("Scope variables")})].concat(v(u))},[n.context,l,null==t?void 0:t.id,null==t?void 0:t.key,null==t?void 0:t.title,e,o])}function O(e){var n=e.value,t=e.onChange,a=(0,s.kj)(),u=i.theme.useToken().token,m=(0,r.useMemo)(function(){return(0,l.css)(g(),u.marginSM)},[u.marginSM]),d=!!n,h=n&&(void 0===n?"undefined":y(n))==="object"?n:(0,f.Nw)();return o().createElement(o().Fragment,null,o().createElement(i.Checkbox,{checked:d,onChange:function(e){null==t||t(!!e.target.checked&&(0,f.Nw)())}},a("Enable loop condition")),d?o().createElement(i.Card,{className:m,size:"small"},o().createElement(i.Form.Item,{label:a("Condition"),style:{marginBottom:u.marginSM}},o().createElement(c.CalculationConfig,{value:h.calculation,onChange:function(e){return null==t?void 0:t(b(p({},h),{calculation:e}))},useVariableHook:E})),o().createElement(i.Form.Item,{label:a("When to check"),style:{marginBottom:u.marginSM}},o().createElement(c.RadioWithTooltip,{value:h.checkpoint,onChange:function(e){return null==t?void 0:t(b(p({},h),{checkpoint:e.target.value}))},options:[{label:a("Before each starts"),value:0},{label:a("After each ends"),value:1}]})),o().createElement(i.Form.Item,{label:a("When condition is not met on item")},o().createElement(c.RadioWithTooltip,{value:h.continueOnFalse,onChange:function(e){return null==t?void 0:t(b(p({},h),{continueOnFalse:e.target.value}))},options:[{label:a("Exit loop"),value:!1},{label:a("Continue on next item"),value:!0}]}))):null)}function j(){var e,n,t,l=(0,s.kj)(),a=i.Form.useWatch(["config","target"]);return e=i.Form.useFormInstance(),n=i.Form.useWatch(["config","target"],e),t=(0,r.useRef)(n),(0,r.useEffect)(function(){if(void 0===t.current){t.current=n;return}if(t.current!==n){var r=e.getFieldValue(["config","condition"]);r&&(void 0===r?"undefined":y(r))==="object"&&e.setFieldValue(["config","condition"],b(p({},r),{calculation:void 0,expression:""})),t.current=n}},[e,n]),o().createElement(o().Fragment,null,o().createElement(i.Form.Item,{name:["config","target"],label:l("Loop target"),extra:l("A single number will be treated as a loop count, a single string will be treated as an array of characters, and other non-array values will be converted to arrays. The loop node ends when the loop count is reached, or when the array loop is completed. You can also add condition nodes to the loop to terminate it."),rules:[{required:!0}],initialValue:1},o().createElement(c.WorkflowTypedVariableInput,{nullable:!1,types:k})),a?o().createElement(i.Form.Item,{name:["config","condition"],initialValue:!1},o().createElement(O,null)):null,o().createElement(i.Form.Item,{name:["config","exit"],label:l("When node inside loop failed"),initialValue:0},o().createElement(c.RadioWithTooltip,{direction:"vertical",options:[{label:l("Exit workflow"),value:0},{label:l("Exit loop and continue workflow"),value:1},{label:l("Continue loop on next item"),value:2}]})))}function S(e){var n,t,r=e.data,i=(null!=(n=(0,c.useFlowContext)())?n:{}).nodes,u=(0,c.useStyles)().styles,s=(null!=i?i:[]).find(function(e){return e.upstreamId===r.id&&null!=e.branchIndex});return o().createElement(c.NodeDefaultView,{data:r},o().createElement("div",{className:u.nodeSubtreeClass},o().createElement("div",{className:(0,l.cx)(u.branchBlockClass,(0,l.css)(w()))},o().createElement(c.Branch,{from:r,entry:s,branchIndex:null!=(t=null==s?void 0:s.branchIndex)?t:0}),o().createElement("div",{className:u.branchClass,style:{minWidth:"4em"}},o().createElement("div",{className:"workflow-branch-lines"}),o().createElement("div",{className:u.loopLineClass},o().createElement(a.ArrowUpOutlined,null))))))}}}]);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
export { default } from './plugin';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@emotion/css"),require("@nocobase/client-v2"),require("react"),require("antd"),require("@nocobase/plugin-workflow/client-v2"),require("@ant-design/icons"),require("@nocobase/flow-engine")):"function"==typeof define&&define.amd?define("@nocobase/plugin-workflow-loop/client-v2",["@emotion/css","@nocobase/client-v2","react","antd","@nocobase/plugin-workflow/client-v2","@ant-design/icons","@nocobase/flow-engine"],t):"object"==typeof exports?exports["@nocobase/plugin-workflow-loop/client-v2"]=t(require("@emotion/css"),require("@nocobase/client-v2"),require("react"),require("antd"),require("@nocobase/plugin-workflow/client-v2"),require("@ant-design/icons"),require("@nocobase/flow-engine")):e["@nocobase/plugin-workflow-loop/client-v2"]=t(e["@emotion/css"],e["@nocobase/client-v2"],e.react,e.antd,e["@nocobase/plugin-workflow/client-v2"],e["@ant-design/icons"],e["@nocobase/flow-engine"])}(self,function(e,t,n,r,o,i,u){return function(){"use strict";var c,a,l,f={806:function(e,t,n){n.d(t,{Ay:function(){return x},JI:function(){return O},Lc:function(){return S},Nw:function(){return _}});var r=n(155),o=n.n(r),i=n(375),u=n(197),c=n(694),a=n(488);function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function f(e,t,n,r,o,i,u){try{var c=e[i](u),a=c.value}catch(e){n(e);return}c.done?t(a):Promise.resolve(a).then(r,o)}function s(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function u(e){f(i,r,o,u,c,"next",e)}function c(e){f(i,r,o,u,c,"throw",e)}u(void 0)})}}function p(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function b(e){return(b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function y(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){p(e,t,n[t])})}return e}function d(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function v(e,t){return(v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function h(e){return function(e){if(Array.isArray(e))return l(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e){if(e){if("string"==typeof e)return l(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return l(e,void 0)}}(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function g(e){return e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function m(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(m=function(){return!!e})()}function w(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(u,"next",{value:a(0)}),c(u,"throw",{value:a(1)}),c(u,"return",{value:a(2)}),"function"==typeof Symbol&&c(u,Symbol.iterator,{value:function(){return this}}),u;function a(c){return function(a){var l=[c,a];if(n)throw TypeError("Generator is already executing.");for(;u&&(u=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}var O="$scopes",j={type:"and",calculations:[]};function _(){return{checkpoint:0,continueOnFalse:!1,calculation:{group:{type:j.type,calculations:[]}}}}function k(e,t,n){var r,o=e.children,i=Array.isArray(e.paths)?e.paths.slice(t.length):[String(null!=(r=e.name)?r:"")],u=d(y({},e),{paths:h(n).concat(h(i))});return Array.isArray(o)?u.children=o.map(function(e){return k(e,t,n)}):"function"==typeof o&&(u.children=function(){return s(function(){return w(this,function(e){switch(e.label){case 0:return[4,o()];case 1:return[2,e.sent().map(function(e){return k(e,t,n)})]}})})()}),u}function S(e){var t,n,r,o,i,l,f=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},p=(0,a.kj)(),b=(0,u.useWorkflowVariableOptions)(d(y({},f),{includeScopes:!1}));return(null==(l=e.config)?void 0:l.target)==null?null:[(o=(r=function(e){if("string"!=typeof e)return null;var t=e.trim().match(/^\{\{\s*([^{}]+?)\s*\}\}$/);return(null==t?void 0:t[1])?t[1].split(".").map(function(e){return e.trim()}).filter(Boolean):null}(null==(n=e.config)?void 0:n.target))?function(e,t){var n=e,r=null,o=!0,i=!1,u=void 0;try{for(var c,a=t[Symbol.iterator]();!(o=(c=a.next()).done);o=!0){var l=function(){var e,t=c.value;if(!Array.isArray(n)||!(r=null!=(e=n.find(function(e){return String(e.name)===t}))?e:null))return{v:null};n=Array.isArray(r.children)?r.children:void 0}();if("object"===g(l))return l.v}}catch(e){i=!0,u=e}finally{try{o||null==a.return||a.return()}finally{if(i)throw u}}return r}(b,r):null,i={name:"item",title:p("Loop target"),type:null!=(t=null==o?void 0:o.type)?t:"",interface:null==o?void 0:o.interface,paths:["item"]},r&&(Array.isArray(null==o?void 0:o.children)?i.children=o.children.map(function(e){return k(e,r,["item"])}):i.children=function(){return s(function(){var e,t;return w(this,function(n){switch(n.label){case 0:return[4,s(function(){var e,t,n,o,i,u,a,l,f,s;return w(this,function(p){switch(p.label){case 0:e=b,t=null,n=!0,o=!1,i=void 0,p.label=1;case 1:p.trys.push([1,6,7,8]),u=function(){var n,r;return w(this,function(o){switch(o.label){case 0:if(n=l.value,!Array.isArray(e)||!(t=null!=(r=e.find(function(e){return String(e.name)===n}))?r:null))return[2,{v:null}];return[4,(0,c.loadMetaTreeChildren)(t)];case 1:return e=o.sent(),[2]}})},a=r[Symbol.iterator](),p.label=2;case 2:if(n=(l=a.next()).done)return[3,5];return[5,function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(u())];case 3:if("object"===g(f=p.sent()))return[2,f.v];p.label=4;case 4:return n=!0,[3,2];case 5:return[3,8];case 6:return s=p.sent(),o=!0,i=s,[3,8];case 7:try{n||null==a.return||a.return()}finally{if(o)throw i}return[7];case 8:return[2,t]}})})()];case 1:if(!(e=n.sent()))return[3,3];return[4,(0,c.loadMetaTreeChildren)(e)];case 2:return t=n.sent(),[3,4];case 3:t=[],n.label=4;case 4:return[2,t.map(function(e){return k(e,r,["item"])})]}})})()}),i),{name:"index",title:p("Loop index (starts from 0)"),type:"number",paths:["index"]},{name:"sequence",title:p("Loop sequence (starts from 1)"),type:"number",paths:["sequence"]},{name:"length",title:p("Loop length"),type:"number",paths:["length"]}]}var x=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t,u;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return t=r,u=arguments,t=b(t),p(e=function(e,t){if(t&&("object"===g(t)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,m()?Reflect.construct(t,u||[],b(this).constructor):t.apply(this,u)),"type","loop"),p(e,"title",(0,a.MZ)("Loop")),p(e,"group","control"),p(e,"description",(0,a.MZ)("By using a loop node, you can perform the same operation on multiple sets of data. The source of these sets can be either multiple records from a query node or multiple associated records of a single record. Loop node can also be used for iterating a certain number of times or for looping through each character in a string. However, excessive looping may cause performance issues, so use with caution.")),p(e,"icon",o().createElement(i.RollbackOutlined,null)),p(e,"branching",!0),p(e,"FieldsetLoader",function(){return n.e("504").then(n.bind(n,675)).then(function(e){return{default:e.LoopFieldset}})}),p(e,"ComponentLoader",function(){return n.e("504").then(n.bind(n,675)).then(function(e){return{default:e.LoopCanvasComponent}})}),p(e,"useScopeVariables",S),e}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&v(r,e),t=[{key:"createDefaultConfig",value:function(){return{target:1,condition:!1,exit:0}}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(r.prototype,t),r}(u.Instruction)},488:function(e,t,n){n.d(t,{MZ:function(){return c},kj:function(){return u}});var r=n(694);function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}var i="workflow-loop";function u(){var e=(0,r.useFlowEngine)();return function(t,n){return e.context.t(t,o({ns:[i,"client"],nsMode:"fallback"},n))}}function c(e,t){return(0,r.tExpr)(e,o({ns:[i,"client"],nsMode:"fallback"},t))}},375:function(e){e.exports=i},477:function(t){t.exports=e},485:function(e){e.exports=t},694:function(e){e.exports=u},197:function(e){e.exports=o},59:function(e){e.exports=r},155:function(e){e.exports=n}},s={};function p(e){var t=s[e];if(void 0!==t)return t.exports;var n=s[e]={exports:{}};return f[e](n,n.exports,p),n.exports}p.m=f,p.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return p.d(t,{a:t}),t},p.d=function(e,t){for(var n in t)p.o(t,n)&&!p.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},p.f={},p.e=function(e){return Promise.all(Object.keys(p.f).reduce(function(t,n){return p.f[n](e,t),t},[]))},p.u=function(e){return""+e+".597de6053e4ef634.js"},p.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),p.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},b={},p.l=function(e,t,n,r){if(b[e])return void b[e].push(t);if(void 0!==n)for(var o,i,u=document.getElementsByTagName("script"),c=0;c<u.length;c++){var a=u[c];if(a.getAttribute("src")==e||a.getAttribute("data-rspack")=="@nocobase/plugin-workflow-loop/client-v2:"+n){o=a;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,p.nc&&o.setAttribute("nonce",p.nc),o.setAttribute("data-rspack","@nocobase/plugin-workflow-loop/client-v2:"+n),o.src=e),b[e]=[t];var l=function(t,n){o.onerror=o.onload=null,clearTimeout(f);var r=b[e];if(delete b[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},f=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),i&&document.head.appendChild(o)},p.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},p.g.importScripts&&(y=p.g.location+"");var b,y,d=p.g.document;if(!y&&d&&(d.currentScript&&"SCRIPT"===d.currentScript.tagName.toUpperCase()&&(y=d.currentScript.src),!y)){var v=d.getElementsByTagName("script");if(v.length)for(var h=v.length-1;h>-1&&(!y||!/^http(s?):/.test(y));)y=v[h--].src}if(!y)throw Error("Automatic publicPath is not supported in this browser");p.p=y.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),c={889:0},p.f.j=function(e,t){var n=p.o(c,e)?c[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=c[e]=[t,r]});t.push(n[2]=r);var o=p.p+p.u(e),i=Error();p.l(o,function(t){if(p.o(c,e)&&(0!==(n=c[e])&&(c[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",i.name="ChunkLoadError",i.type=r,i.request=o,n[1](i)}},"chunk-"+e,e)}},a=function(e,t){var n,r,o=t[0],i=t[1],u=t[2],a=0;if(o.some(function(e){return 0!==c[e]})){for(n in i)p.o(i,n)&&(p.m[n]=i[n]);u&&u(p)}for(e&&e(t);a<o.length;a++)r=o[a],p.o(c,r)&&c[r]&&c[r][0](),c[r]=0},(l=self.webpackChunk_nocobase_plugin_workflow_loop_client_v2=self.webpackChunk_nocobase_plugin_workflow_loop_client_v2||[]).forEach(a.bind(null,0)),l.push=a.bind(null,l.push.bind(l));var g={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src){var n=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"");n.indexOf("/static/plugins/@nocobase/plugin-workflow-loop/dist/client-v2/")>=0&&(e=n.replace(/\/[^\/]+$/,"/"))}if(!e){var r=window.__webpack_public_path__||"";r&&("/"!==r.charAt(r.length-1)&&(r+="/"),e=r+"static/plugins/@nocobase/plugin-workflow-loop/dist/client-v2/")}if(!e){var o=window.__nocobase_modern_client_prefix__||"v",i="/"+(o=String(o).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var u=window.location.pathname||"/",c=u.indexOf(i);e=c>=0?u.slice(0,c+1):"/"}e&&(e=e.replace(RegExp("/"+o+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-workflow-loop/dist/client-v2/"}p.p=e}(),!function(){p.r(g),p.d(g,{default:function(){return a}});var e=p(485),t=p(806);function n(e,t,n,r,o,i,u){try{var c=e[i](u),a=c.value}catch(e){n(e);return}c.done?t(a):Promise.resolve(a).then(r,o)}function r(e,t,n){return(r=c()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&i(o,n.prototype),o}).apply(null,arguments)}function o(e){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function u(e){var t="function"==typeof Map?new Map:void 0;return(u=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return r(e,arguments,o(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),i(n,e)})(e)}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}var a=function(e){var r;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function u(){var e,t;if(!(this instanceof u))throw TypeError("Cannot call a class as a function");return e=u,t=arguments,e=o(e),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,c()?Reflect.construct(e,t||[],o(this).constructor):e.apply(this,t))}return u.prototype=Object.create(e&&e.prototype,{constructor:{value:u,writable:!0,configurable:!0}}),e&&i(u,e),r=[{key:"load",value:function(){var e;return(e=function(){var e,n;return function(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(u,"next",{value:a(0)}),c(u,"throw",{value:a(1)}),c(u,"return",{value:a(2)}),"function"==typeof Symbol&&c(u,Symbol.iterator,{value:function(){return this}}),u;function a(c){return function(a){var l=[c,a];if(n)throw TypeError("Generator is already executing.");for(;u&&(u=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(r){return null==(n=this.app.pm.get("workflow"))||null==(e=n.registerInstruction)||e.call(n,"loop",t.Ay),[2]})},function(){var t=this,r=arguments;return new Promise(function(o,i){var u=e.apply(t,r);function c(e){n(u,o,i,c,a,"next",e)}function a(e){n(u,o,i,c,a,"throw",e)}c(void 0)})}).call(this)}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(u.prototype,r),u}(u(e.Plugin))}(),g}()});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
export declare const NAMESPACE = "workflow-loop";
|
|
10
|
+
export declare function useT(): (key: string, options?: Record<string, unknown>) => string;
|
|
11
|
+
export declare function tExpr(key: string, options?: Record<string, unknown>): string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
export declare function LoopFieldset(): React.JSX.Element;
|
|
11
|
+
export declare function LoopCanvasComponent({ data }: {
|
|
12
|
+
data: any;
|
|
13
|
+
}): React.JSX.Element;
|
|
14
|
+
export default LoopFieldset;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import type { MetaTreeNode } from '@nocobase/flow-engine';
|
|
11
|
+
import { Instruction, type UseVariableOptions } from '@nocobase/plugin-workflow/client-v2';
|
|
12
|
+
type LoopNodeLike = {
|
|
13
|
+
id: string | number;
|
|
14
|
+
key: string;
|
|
15
|
+
title?: string;
|
|
16
|
+
config?: {
|
|
17
|
+
target?: unknown;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
declare const LOOP_SCOPE_ROOT = "$scopes";
|
|
21
|
+
declare const LOOP_DEFAULT_CONDITION: {
|
|
22
|
+
checkpoint: 0;
|
|
23
|
+
continueOnFalse: boolean;
|
|
24
|
+
calculation: {
|
|
25
|
+
group: {
|
|
26
|
+
type: string;
|
|
27
|
+
calculations: any[];
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
declare function createDefaultLoopCondition(): {
|
|
32
|
+
checkpoint: 0;
|
|
33
|
+
continueOnFalse: boolean;
|
|
34
|
+
calculation: {
|
|
35
|
+
group: {
|
|
36
|
+
type: string;
|
|
37
|
+
calculations: any[];
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
export declare function useLoopScopeVariables(node: LoopNodeLike, options?: UseVariableOptions): MetaTreeNode[] | null;
|
|
42
|
+
export { createDefaultLoopCondition, LOOP_DEFAULT_CONDITION, LOOP_SCOPE_ROOT };
|
|
43
|
+
export default class LoopInstruction extends Instruction {
|
|
44
|
+
type: string;
|
|
45
|
+
title: string;
|
|
46
|
+
group: string;
|
|
47
|
+
description: string;
|
|
48
|
+
icon: React.JSX.Element;
|
|
49
|
+
branching: boolean;
|
|
50
|
+
FieldsetLoader: () => Promise<{
|
|
51
|
+
default: typeof import("./components/loop").LoopFieldset;
|
|
52
|
+
}>;
|
|
53
|
+
ComponentLoader: () => Promise<{
|
|
54
|
+
default: typeof import("./components/loop").LoopCanvasComponent;
|
|
55
|
+
}>;
|
|
56
|
+
createDefaultConfig(): {
|
|
57
|
+
target: number;
|
|
58
|
+
condition: boolean;
|
|
59
|
+
exit: number;
|
|
60
|
+
};
|
|
61
|
+
useScopeVariables: typeof useLoopScopeVariables;
|
|
62
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import { Application, Plugin } from '@nocobase/client-v2';
|
|
10
|
+
export declare class PluginWorkflowLoopClientV2 extends Plugin<Record<string, never>, Application> {
|
|
11
|
+
load(): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
export default PluginWorkflowLoopClientV2;
|
package/dist/externalVersion.js
CHANGED
|
@@ -8,14 +8,15 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
|
+
"@nocobase/client": "2.2.0-alpha.2",
|
|
12
|
+
"@nocobase/plugin-workflow": "2.2.0-alpha.2",
|
|
13
|
+
"@nocobase/flow-engine": "2.2.0-alpha.2",
|
|
14
|
+
"@nocobase/client-v2": "2.2.0-alpha.2",
|
|
15
|
+
"react-i18next": "11.18.6",
|
|
16
|
+
"@nocobase/evaluators": "2.2.0-alpha.2",
|
|
17
|
+
"@nocobase/server": "2.2.0-alpha.2",
|
|
11
18
|
"react": "18.2.0",
|
|
12
19
|
"@ant-design/icons": "5.6.1",
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"@formily/react": "2.3.7",
|
|
16
|
-
"@nocobase/client": "2.1.11",
|
|
17
|
-
"@nocobase/plugin-workflow": "2.1.11",
|
|
18
|
-
"react-i18next": "11.18.6",
|
|
19
|
-
"@nocobase/evaluators": "2.1.11",
|
|
20
|
-
"@nocobase/server": "2.1.11"
|
|
20
|
+
"@emotion/css": "11.13.0",
|
|
21
|
+
"antd": "5.24.2"
|
|
21
22
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"joi","description":"Object schema validation","version":"17.13.3","repository":"git://github.com/hapijs/joi","main":"lib/index.js","types":"lib/index.d.ts","browser":"dist/joi-browser.min.js","files":["lib/**/*","dist/*"],"keywords":["schema","validation"],"dependencies":{"@hapi/hoek":"^9.3.0","@hapi/topo":"^5.1.0","@sideway/address":"^4.1.5","@sideway/formula":"^3.0.1","@sideway/pinpoint":"^2.0.0"},"devDependencies":{"@hapi/bourne":"2.x.x","@hapi/code":"8.x.x","@hapi/joi-legacy-test":"npm:@hapi/joi@15.x.x","@hapi/lab":"^25.1.3","@types/node":"^14.18.63","typescript":"4.3.x"},"scripts":{"prepublishOnly":"cd browser && npm install && npm run build","test":"lab -t 100 -a @hapi/code -L -Y","test-cov-html":"lab -r html -o coverage.html -a @hapi/code"},"license":"BSD-3-Clause","_lastModified":"2026-06-
|
|
1
|
+
{"name":"joi","description":"Object schema validation","version":"17.13.3","repository":"git://github.com/hapijs/joi","main":"lib/index.js","types":"lib/index.d.ts","browser":"dist/joi-browser.min.js","files":["lib/**/*","dist/*"],"keywords":["schema","validation"],"dependencies":{"@hapi/hoek":"^9.3.0","@hapi/topo":"^5.1.0","@sideway/address":"^4.1.5","@sideway/formula":"^3.0.1","@sideway/pinpoint":"^2.0.0"},"devDependencies":{"@hapi/bourne":"2.x.x","@hapi/code":"8.x.x","@hapi/joi-legacy-test":"npm:@hapi/joi@15.x.x","@hapi/lab":"^25.1.3","@types/node":"^14.18.63","typescript":"4.3.x"},"scripts":{"prepublishOnly":"cd browser && npm install && npm run build","test":"lab -t 100 -a @hapi/code -L -Y","test-cov-html":"lab -r html -o coverage.html -a @hapi/code"},"license":"BSD-3-Clause","_lastModified":"2026-06-26T03:51:46.018Z"}
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"description": "Used to repeat the sub-process processing of each value in an array, and can also be used for fixed times of sub-process processing.",
|
|
7
7
|
"description.zh-CN": "用于对一个数组中的每个值进行重复的子流程处理,也可用于固定次数的重复子流程处理。",
|
|
8
8
|
"description.ru-RU": "Используется для повторения обработки каждого значения в массиве, а также может использоваться для фиксированного количества повторений подпроцесса.",
|
|
9
|
-
"version": "2.
|
|
9
|
+
"version": "2.2.0-alpha.2",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"main": "./dist/server/index.js",
|
|
12
12
|
"homepage": "https://docs.nocobase.com/handbook/workflow-loop",
|
|
@@ -20,13 +20,14 @@
|
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
22
|
"@nocobase/client": "2.x",
|
|
23
|
+
"@nocobase/client-v2": "2.x",
|
|
23
24
|
"@nocobase/database": "2.x",
|
|
24
25
|
"@nocobase/evaluators": "2.x",
|
|
25
26
|
"@nocobase/plugin-workflow": ">=0.17.0-alpha.3",
|
|
26
27
|
"@nocobase/server": "2.x",
|
|
27
28
|
"@nocobase/test": "2.x"
|
|
28
29
|
},
|
|
29
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "9dd5224bb8f6c1ac12d766b9f175bdc29bddd845",
|
|
30
31
|
"keywords": [
|
|
31
32
|
"Workflow"
|
|
32
33
|
]
|