@nocobase/plugin-workflow-loop 1.2.13-alpha → 1.3.0-alpha.20240710084543
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/package.json +2 -2
- package/dist/client/LoopInstruction.d.ts +0 -38
- package/dist/client/index.d.ts +0 -14
- package/dist/client/index.js +0 -22
- package/dist/externalVersion.js +0 -17
- package/dist/index.d.ts +0 -10
- package/dist/index.js +0 -48
- package/dist/locale/en-US.json +0 -9
- package/dist/locale/index.d.ts +0 -11
- package/dist/locale/index.js +0 -48
- package/dist/locale/ko_KR.json +0 -10
- package/dist/locale/zh-CN.json +0 -8
- package/dist/server/LoopInstruction.d.ts +0 -21
- package/dist/server/LoopInstruction.js +0 -104
- package/dist/server/Plugin.d.ts +0 -12
- package/dist/server/Plugin.js +0 -50
- package/dist/server/index.d.ts +0 -9
- package/dist/server/index.js +0 -42
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"displayName.zh-CN": "工作流:循环节点",
|
|
5
5
|
"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.",
|
|
6
6
|
"description.zh-CN": "用于对一个数组中的每个值进行重复的子流程处理,也可用于固定次数的重复子流程处理。",
|
|
7
|
-
"version": "1.
|
|
7
|
+
"version": "1.3.0-alpha.20240710084543",
|
|
8
8
|
"license": "AGPL-3.0",
|
|
9
9
|
"main": "./dist/server/index.js",
|
|
10
10
|
"homepage": "https://docs.nocobase.com/handbook/workflow-loop",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"@nocobase/server": "1.x",
|
|
22
22
|
"@nocobase/test": "1.x"
|
|
23
23
|
},
|
|
24
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "07a8b596fc64a9779a194cb9b0dc2ca7570ed9d4",
|
|
25
25
|
"keywords": [
|
|
26
26
|
"Workflow"
|
|
27
27
|
]
|
|
@@ -1,38 +0,0 @@
|
|
|
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 { VariableOption, WorkflowVariableInput, Instruction } from '@nocobase/plugin-workflow/client';
|
|
11
|
-
export default class extends Instruction {
|
|
12
|
-
title: string;
|
|
13
|
-
type: string;
|
|
14
|
-
group: string;
|
|
15
|
-
description: string;
|
|
16
|
-
fieldset: {
|
|
17
|
-
target: {
|
|
18
|
-
type: string;
|
|
19
|
-
title: string;
|
|
20
|
-
description: string;
|
|
21
|
-
'x-decorator': string;
|
|
22
|
-
'x-component': string;
|
|
23
|
-
'x-component-props': {
|
|
24
|
-
changeOnSelect: boolean;
|
|
25
|
-
useTypedConstant: string[];
|
|
26
|
-
className: string;
|
|
27
|
-
};
|
|
28
|
-
required: boolean;
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
components: {
|
|
32
|
-
WorkflowVariableInput: typeof WorkflowVariableInput;
|
|
33
|
-
};
|
|
34
|
-
Component({ data }: {
|
|
35
|
-
data: any;
|
|
36
|
-
}): React.JSX.Element;
|
|
37
|
-
useScopeVariables(node: any, options: any): VariableOption[];
|
|
38
|
-
}
|
package/dist/client/index.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
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 { Plugin } from '@nocobase/client';
|
|
10
|
-
export default class extends Plugin {
|
|
11
|
-
afterAdd(): Promise<void>;
|
|
12
|
-
beforeLoad(): Promise<void>;
|
|
13
|
-
load(): Promise<void>;
|
|
14
|
-
}
|
package/dist/client/index.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
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(n,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("@nocobase/client"),require("react/jsx-runtime"),require("@ant-design/icons"),require("@nocobase/plugin-workflow/client"),require("react-i18next")):typeof define=="function"&&define.amd?define(["exports","@nocobase/client","react/jsx-runtime","@ant-design/icons","@nocobase/plugin-workflow/client","react-i18next"],e):(n=typeof globalThis!="undefined"?globalThis:n||self,e(n["@nocobase/plugin-workflow-loop"]={},n["@nocobase/client"],n.jsxRuntime,n["@ant-design/icons"],n["@nocobase/plugin-workflow"],n["react-i18next"]))})(this,function(n,e,o,v,t,k){"use strict";var V=Object.defineProperty,W=Object.defineProperties;var P=Object.getOwnPropertyDescriptors;var O=Object.getOwnPropertySymbols;var F=Object.prototype.hasOwnProperty,M=Object.prototype.propertyIsEnumerable;var I=(n,e,o)=>e in n?V(n,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[e]=o,N=(n,e)=>{for(var o in e||(e={}))F.call(e,o)&&I(n,o,e[o]);if(O)for(var o of O(e))M.call(e,o)&&I(n,o,e[o]);return n},T=(n,e)=>W(n,P(e));var h=(n,e,o)=>(I(n,typeof e!="symbol"?e+"":e,o),o);var y=(n,e,o)=>new Promise((v,t)=>{var k=i=>{try{d(o.next(i))}catch(w){t(w)}},u=i=>{try{d(o.throw(i))}catch(w){t(w)}},d=i=>i.done?v(i.value):Promise.resolve(i.value).then(k,u);d((o=o.apply(n,e)).next())});const u="workflow-loop";function d(p,g={}){const{t:r}=i(g);return r(p)}function i(p){return k.useTranslation(u,p)}function w(p,g){let r=p,f=null;for(let a=0;a<g.length;a++){const c=g[a],s=r.find(m=>m.value===c);if(!s)return null;f=s,!s.isLeaf&&s.loadChildren&&s.loadChildren(s),s.children&&(r=s.children)}return f}class j extends t.Instruction{constructor(){super(...arguments);h(this,"title",`{{t("Loop", { ns: "${u}" })}}`);h(this,"type","loop");h(this,"group","control");h(this,"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: "${u}" })}}`);h(this,"fieldset",{target:{type:"string",title:`{{t("Loop target", { ns: "${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: "${u}" })}}`,"x-decorator":"FormItem","x-component":"WorkflowVariableInput","x-component-props":{changeOnSelect:!0,useTypedConstant:["string","number","null"],className:e.css`
|
|
11
|
-
width: 100%;
|
|
12
|
-
|
|
13
|
-
.variable {
|
|
14
|
-
flex: 1;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.ant-input.null-value {
|
|
18
|
-
width: 100%;
|
|
19
|
-
}
|
|
20
|
-
`},required:!0}});h(this,"components",{WorkflowVariableInput:t.WorkflowVariableInput})}Component({data:r}){var s;const{nodes:f}=t.useFlowContext(),{styles:a}=t.useStyles(),c=f.find(m=>m.upstreamId===r.id&&m.branchIndex!=null);return o.jsx(t.NodeDefaultView,{data:r,children:o.jsx("div",{className:a.nodeSubtreeClass,children:o.jsxs("div",{className:e.cx(a.branchBlockClass,e.css`
|
|
21
|
-
padding-left: 20em;
|
|
22
|
-
`),children:[o.jsx(t.Branch,{from:r,entry:c,branchIndex:(s=c==null?void 0:c.branchIndex)!=null?s:0}),o.jsxs("div",{className:a.branchClass,children:[o.jsx("div",{className:"workflow-branch-lines"}),o.jsx("div",{className:e.cx(a.addButtonClass,a.loopLineClass),children:o.jsx(v.ArrowUpOutlined,{})})]})]})})})}useScopeVariables(r,f){const a=e.useCompile(),c=d("Loop target"),s=d("Loop index"),m=d("Loop length"),{target:x}=r.config;if(!x)return null;const{fieldNames:l=t.defaultFieldNames}=f;let L={key:"item",[l.value]:"item",[l.label]:c};if(typeof x=="string"&&x.startsWith("{{")&&x.endsWith("}}")){const S=x.slice(2,-2).split(".").map(b=>b.trim()),A=[t.scopeOptions,t.nodesOptions,t.triggerOptions].map(b=>{const C=b.useOptions(T(N({},f),{current:r})).filter(Boolean);return{[l.label]:a(b.label),[l.value]:b.value,key:b.value,[l.children]:C,disabled:C&&!C.length}}),B=w(A,S);L=Object.assign({},B,L)}return[L,{key:"index",[l.value]:"index",[l.label]:s},{key:"length",[l.value]:"length",[l.label]:m}]}}class q extends e.Plugin{afterAdd(){return y(this,null,function*(){})}beforeLoad(){return y(this,null,function*(){})}load(){return y(this,null,function*(){this.app.pm.get("workflow").registerInstruction("loop",j)})}}n.default=q,Object.defineProperties(n,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/externalVersion.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
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
|
-
module.exports = {
|
|
11
|
-
"react": "18.2.0",
|
|
12
|
-
"@ant-design/icons": "5.2.6",
|
|
13
|
-
"@nocobase/client": "1.2.13-alpha",
|
|
14
|
-
"@nocobase/plugin-workflow": "1.2.13-alpha",
|
|
15
|
-
"react-i18next": "11.18.6",
|
|
16
|
-
"@nocobase/server": "1.2.13-alpha"
|
|
17
|
-
};
|
package/dist/index.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
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 * from './server';
|
|
10
|
-
export { default } from './server';
|
package/dist/index.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
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
|
-
var __create = Object.create;
|
|
11
|
-
var __defProp = Object.defineProperty;
|
|
12
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
15
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16
|
-
var __export = (target, all) => {
|
|
17
|
-
for (var name in all)
|
|
18
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
19
|
-
};
|
|
20
|
-
var __copyProps = (to, from, except, desc) => {
|
|
21
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
22
|
-
for (let key of __getOwnPropNames(from))
|
|
23
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
24
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
25
|
-
}
|
|
26
|
-
return to;
|
|
27
|
-
};
|
|
28
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
29
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
30
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
31
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
32
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
33
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
34
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
35
|
-
mod
|
|
36
|
-
));
|
|
37
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
38
|
-
var src_exports = {};
|
|
39
|
-
__export(src_exports, {
|
|
40
|
-
default: () => import_server.default
|
|
41
|
-
});
|
|
42
|
-
module.exports = __toCommonJS(src_exports);
|
|
43
|
-
__reExport(src_exports, require("./server"), module.exports);
|
|
44
|
-
var import_server = __toESM(require("./server"));
|
|
45
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
46
|
-
0 && (module.exports = {
|
|
47
|
-
...require("./server")
|
|
48
|
-
});
|
package/dist/locale/en-US.json
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"Loop": "Loop",
|
|
3
|
-
"Loop target": "Loop target",
|
|
4
|
-
"Loop index": "Loop index",
|
|
5
|
-
"Loop length": "Loop length",
|
|
6
|
-
"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.": "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.",
|
|
7
|
-
"Scope variables": "Scope variables",
|
|
8
|
-
"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.": "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."
|
|
9
|
-
}
|
package/dist/locale/index.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
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 useLang(key: string, options?: {}): string;
|
|
11
|
-
export declare function usePluginTranslation(options: any): import("react-i18next").UseTranslationResponse<"workflow-loop", undefined>;
|
package/dist/locale/index.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
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
|
-
var __defProp = Object.defineProperty;
|
|
11
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
-
var __export = (target, all) => {
|
|
15
|
-
for (var name in all)
|
|
16
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
-
};
|
|
18
|
-
var __copyProps = (to, from, except, desc) => {
|
|
19
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
-
for (let key of __getOwnPropNames(from))
|
|
21
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
-
}
|
|
24
|
-
return to;
|
|
25
|
-
};
|
|
26
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
-
var locale_exports = {};
|
|
28
|
-
__export(locale_exports, {
|
|
29
|
-
NAMESPACE: () => NAMESPACE,
|
|
30
|
-
useLang: () => useLang,
|
|
31
|
-
usePluginTranslation: () => usePluginTranslation
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(locale_exports);
|
|
34
|
-
var import_react_i18next = require("react-i18next");
|
|
35
|
-
const NAMESPACE = "workflow-loop";
|
|
36
|
-
function useLang(key, options = {}) {
|
|
37
|
-
const { t } = usePluginTranslation(options);
|
|
38
|
-
return t(key);
|
|
39
|
-
}
|
|
40
|
-
function usePluginTranslation(options) {
|
|
41
|
-
return (0, import_react_i18next.useTranslation)(NAMESPACE, options);
|
|
42
|
-
}
|
|
43
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
-
0 && (module.exports = {
|
|
45
|
-
NAMESPACE,
|
|
46
|
-
useLang,
|
|
47
|
-
usePluginTranslation
|
|
48
|
-
});
|
package/dist/locale/ko_KR.json
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"Loop": "루프",
|
|
3
|
-
"Loop target": "루프 대상",
|
|
4
|
-
"Loop index": "현재 인덱스",
|
|
5
|
-
"Loop length": "루프 길이",
|
|
6
|
-
"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.":
|
|
7
|
-
"루프 노드를 사용하면 여러 데이터 세트에 동일한 작업을 수행할 수 있습니다. 이러한 세트의 소스는 쿼리 노드에서 가져온 여러 레코드이거나 단일 레코드의 여러 관련 레코드일 수 있습니다. 루프 노드는 특정 횟수만큼 반복하거나 문자열의 각 문자를 반복하는 데에도 사용할 수 있습니다. 그러나 과도한 루핑은 성능 문제를 일으킬 수 있으므로 주의해서 사용하십시오.",
|
|
8
|
-
"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.":
|
|
9
|
-
"단일 숫자는 루프 카운트로 처리되고, 단일 문자열은 문자 배열로 처리되며, 다른 배열이 아닌 값은 배열로 변환됩니다. 루프 노드는 루프 카운트에 도달하거나 배열 루프가 완료되었을 때 종료됩니다. 루프를 종료하려면 루프에 조건 노드를 추가할 수도 있습니다."
|
|
10
|
-
}
|
package/dist/locale/zh-CN.json
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"Loop": "循环",
|
|
3
|
-
"Loop target": "循环对象",
|
|
4
|
-
"Loop index": "当前索引",
|
|
5
|
-
"Loop length": "循环长度",
|
|
6
|
-
"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.": "使用循环节点可以对多条数据进行同样的操作,多条数据的来源可以是查询节点的多条结果,或者一条数据的多条关系数据。也可以用于一定次数的循环,或者对字符串中每一个字符的循环处理。循环次数过高可能引起性能问题,请谨慎使用。",
|
|
7
|
-
"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.": "单一数字值将被视为循环次数,单一字符串值将被视为字符数组,其他非数组值将被转换为数组。达到循环次数,或者将数组循环完成后,循环节点结束。你也可以在循环中添加条件节点,以终止循环。"
|
|
8
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
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 { Processor, Instruction, FlowNodeModel, JobModel } from '@nocobase/plugin-workflow';
|
|
10
|
-
export default class extends Instruction {
|
|
11
|
-
run(node: FlowNodeModel, prevJob: JobModel, processor: Processor): Promise<{
|
|
12
|
-
status: 1;
|
|
13
|
-
result: number;
|
|
14
|
-
}>;
|
|
15
|
-
resume(node: FlowNodeModel, branchJob: any, processor: Processor): Promise<any>;
|
|
16
|
-
getScope(node: any, index: any, processor: any): {
|
|
17
|
-
item: any;
|
|
18
|
-
index: any;
|
|
19
|
-
length: number;
|
|
20
|
-
};
|
|
21
|
-
}
|
|
@@ -1,104 +0,0 @@
|
|
|
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
|
-
var __defProp = Object.defineProperty;
|
|
11
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
-
var __export = (target, all) => {
|
|
15
|
-
for (var name in all)
|
|
16
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
-
};
|
|
18
|
-
var __copyProps = (to, from, except, desc) => {
|
|
19
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
-
for (let key of __getOwnPropNames(from))
|
|
21
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
-
}
|
|
24
|
-
return to;
|
|
25
|
-
};
|
|
26
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
-
var LoopInstruction_exports = {};
|
|
28
|
-
__export(LoopInstruction_exports, {
|
|
29
|
-
default: () => LoopInstruction_default
|
|
30
|
-
});
|
|
31
|
-
module.exports = __toCommonJS(LoopInstruction_exports);
|
|
32
|
-
var import_plugin_workflow = require("@nocobase/plugin-workflow");
|
|
33
|
-
function getTargetLength(target) {
|
|
34
|
-
let length = 0;
|
|
35
|
-
if (typeof target === "number") {
|
|
36
|
-
if (target < 0) {
|
|
37
|
-
throw new Error("Loop target in number type must be greater than 0");
|
|
38
|
-
}
|
|
39
|
-
length = Math.floor(target);
|
|
40
|
-
} else {
|
|
41
|
-
const targets = (Array.isArray(target) ? target : [target]).filter((t) => t != null);
|
|
42
|
-
length = targets.length;
|
|
43
|
-
}
|
|
44
|
-
return length;
|
|
45
|
-
}
|
|
46
|
-
class LoopInstruction_default extends import_plugin_workflow.Instruction {
|
|
47
|
-
async run(node, prevJob, processor) {
|
|
48
|
-
const [branch] = processor.getBranches(node);
|
|
49
|
-
const target = processor.getParsedValue(node.config.target, node.id);
|
|
50
|
-
const length = getTargetLength(target);
|
|
51
|
-
if (!branch || !length) {
|
|
52
|
-
return {
|
|
53
|
-
status: import_plugin_workflow.JOB_STATUS.RESOLVED,
|
|
54
|
-
result: 0
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
const job = await processor.saveJob({
|
|
58
|
-
status: import_plugin_workflow.JOB_STATUS.PENDING,
|
|
59
|
-
// save loop index
|
|
60
|
-
result: 0,
|
|
61
|
-
nodeId: node.id,
|
|
62
|
-
nodeKey: node.key,
|
|
63
|
-
upstreamId: (prevJob == null ? void 0 : prevJob.id) ?? null
|
|
64
|
-
});
|
|
65
|
-
await processor.run(branch, job);
|
|
66
|
-
return null;
|
|
67
|
-
}
|
|
68
|
-
async resume(node, branchJob, processor) {
|
|
69
|
-
const job = processor.findBranchParentJob(branchJob, node);
|
|
70
|
-
const loop = processor.nodesMap.get(job.nodeId);
|
|
71
|
-
const [branch] = processor.getBranches(node);
|
|
72
|
-
const { result, status } = job;
|
|
73
|
-
if (status !== import_plugin_workflow.JOB_STATUS.PENDING) {
|
|
74
|
-
return processor.exit();
|
|
75
|
-
}
|
|
76
|
-
const nextIndex = result + 1;
|
|
77
|
-
const target = processor.getParsedValue(loop.config.target, node.id);
|
|
78
|
-
if (branchJob.status > import_plugin_workflow.JOB_STATUS.PENDING) {
|
|
79
|
-
job.set({ result: nextIndex });
|
|
80
|
-
const length = getTargetLength(target);
|
|
81
|
-
if (nextIndex < length) {
|
|
82
|
-
await processor.saveJob(job);
|
|
83
|
-
await processor.run(branch, job);
|
|
84
|
-
return null;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
job.set({
|
|
88
|
-
status: branchJob.status
|
|
89
|
-
});
|
|
90
|
-
return job;
|
|
91
|
-
}
|
|
92
|
-
getScope(node, index, processor) {
|
|
93
|
-
const target = processor.getParsedValue(node.config.target, node.id);
|
|
94
|
-
const targets = (Array.isArray(target) ? target : [target]).filter((t) => t != null);
|
|
95
|
-
const length = getTargetLength(target);
|
|
96
|
-
const item = typeof target === "number" ? index : targets[index];
|
|
97
|
-
const result = {
|
|
98
|
-
item,
|
|
99
|
-
index,
|
|
100
|
-
length
|
|
101
|
-
};
|
|
102
|
-
return result;
|
|
103
|
-
}
|
|
104
|
-
}
|
package/dist/server/Plugin.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
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 { Plugin } from '@nocobase/server';
|
|
10
|
-
export default class extends Plugin {
|
|
11
|
-
load(): Promise<void>;
|
|
12
|
-
}
|
package/dist/server/Plugin.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
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
|
-
var __create = Object.create;
|
|
11
|
-
var __defProp = Object.defineProperty;
|
|
12
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
15
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16
|
-
var __export = (target, all) => {
|
|
17
|
-
for (var name in all)
|
|
18
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
19
|
-
};
|
|
20
|
-
var __copyProps = (to, from, except, desc) => {
|
|
21
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
22
|
-
for (let key of __getOwnPropNames(from))
|
|
23
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
24
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
25
|
-
}
|
|
26
|
-
return to;
|
|
27
|
-
};
|
|
28
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
29
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
30
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
31
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
32
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
33
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
34
|
-
mod
|
|
35
|
-
));
|
|
36
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
37
|
-
var Plugin_exports = {};
|
|
38
|
-
__export(Plugin_exports, {
|
|
39
|
-
default: () => Plugin_default
|
|
40
|
-
});
|
|
41
|
-
module.exports = __toCommonJS(Plugin_exports);
|
|
42
|
-
var import_server = require("@nocobase/server");
|
|
43
|
-
var import_plugin_workflow = __toESM(require("@nocobase/plugin-workflow"));
|
|
44
|
-
var import_LoopInstruction = __toESM(require("./LoopInstruction"));
|
|
45
|
-
class Plugin_default extends import_server.Plugin {
|
|
46
|
-
async load() {
|
|
47
|
-
const workflowPlugin = this.app.getPlugin(import_plugin_workflow.default);
|
|
48
|
-
workflowPlugin.registerInstruction("loop", import_LoopInstruction.default);
|
|
49
|
-
}
|
|
50
|
-
}
|
package/dist/server/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
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';
|
package/dist/server/index.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
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
|
-
var __create = Object.create;
|
|
11
|
-
var __defProp = Object.defineProperty;
|
|
12
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
15
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16
|
-
var __export = (target, all) => {
|
|
17
|
-
for (var name in all)
|
|
18
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
19
|
-
};
|
|
20
|
-
var __copyProps = (to, from, except, desc) => {
|
|
21
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
22
|
-
for (let key of __getOwnPropNames(from))
|
|
23
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
24
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
25
|
-
}
|
|
26
|
-
return to;
|
|
27
|
-
};
|
|
28
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
29
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
30
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
31
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
32
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
33
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
34
|
-
mod
|
|
35
|
-
));
|
|
36
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
37
|
-
var server_exports = {};
|
|
38
|
-
__export(server_exports, {
|
|
39
|
-
default: () => import_Plugin.default
|
|
40
|
-
});
|
|
41
|
-
module.exports = __toCommonJS(server_exports);
|
|
42
|
-
var import_Plugin = __toESM(require("./Plugin"));
|