@nocobase/plugin-workflow-dynamic-calculation 1.2.12-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 CHANGED
@@ -4,7 +4,7 @@
4
4
  "displayName.zh-CN": "工作流:动态表达式计算节点",
5
5
  "description": "Useful plugin for doing dynamic calculation based on expression collection records in workflow.",
6
6
  "description.zh-CN": "用于在工作流中进行基于数据行的动态表达式计算。",
7
- "version": "1.2.12-alpha",
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-dynamic-calculation",
@@ -30,7 +30,7 @@
30
30
  "@nocobase/test": "1.x",
31
31
  "@nocobase/utils": "1.x"
32
32
  },
33
- "gitHead": "553231d4882496cb7f1f17fa7541899ce82a27ab",
33
+ "gitHead": "07a8b596fc64a9779a194cb9b0dc2ca7570ed9d4",
34
34
  "keywords": [
35
35
  "Workflow",
36
36
  "Collections"
@@ -1,81 +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 { SchemaInitializerItemType } from '@nocobase/client';
11
- import { Instruction, WorkflowVariableInput } from '@nocobase/plugin-workflow/client';
12
- declare function DynamicExpression({ value, onChange }: {
13
- value: any;
14
- onChange: any;
15
- }): React.JSX.Element;
16
- export default class extends Instruction {
17
- title: string;
18
- type: string;
19
- group: string;
20
- description: string;
21
- fieldset: {
22
- expression: {
23
- type: string;
24
- title: string;
25
- 'x-decorator': string;
26
- 'x-component': string;
27
- required: boolean;
28
- };
29
- scope: {
30
- type: string;
31
- title: string;
32
- 'x-decorator': string;
33
- 'x-component': string;
34
- 'x-component-props': {
35
- changeOnSelect: boolean;
36
- variableOptions: {
37
- types: {
38
- type: string;
39
- options: {
40
- collection: string;
41
- entity: boolean;
42
- };
43
- }[];
44
- };
45
- };
46
- 'x-reactions': {
47
- dependencies: string[];
48
- fulfill: {
49
- state: {
50
- visible: string;
51
- };
52
- };
53
- };
54
- };
55
- };
56
- components: {
57
- DynamicExpression: typeof DynamicExpression;
58
- WorkflowVariableInput: typeof WorkflowVariableInput;
59
- ValueBlock: (() => JSX.Element) & {
60
- Initializer: () => JSX.Element;
61
- Result: (props: any) => JSX.Element;
62
- Designer: () => JSX.Element;
63
- };
64
- };
65
- useVariables({ key, title }: {
66
- key: any;
67
- title: any;
68
- }, { types, fieldNames }: {
69
- types: any;
70
- fieldNames?: {
71
- readonly label: "label";
72
- readonly value: "value";
73
- readonly children: "children";
74
- };
75
- }): {
76
- value: any;
77
- label: any;
78
- };
79
- useInitializers(node: any): SchemaInitializerItemType;
80
- }
81
- export {};
@@ -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 React from 'react';
10
- export declare const DynamicExpression: React.ForwardRefExoticComponent<Omit<Partial<Omit<{
11
- children?: React.ReactNode;
12
- }, string | number | symbol> & Omit<any, "ref"> & {
13
- children?: React.ReactNode;
14
- }>, "ref"> & React.RefAttributes<unknown>>;
@@ -1,62 +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 { CollectionTemplate } from '@nocobase/client';
10
- export declare class ExpressionCollectionTemplate extends CollectionTemplate {
11
- name: string;
12
- title: string;
13
- order: number;
14
- color: string;
15
- default: {
16
- createdBy: boolean;
17
- updatedBy: boolean;
18
- createdAt: boolean;
19
- updatedAt: boolean;
20
- fields: ({
21
- name: string;
22
- type: string;
23
- interface: string;
24
- uiSchema: {
25
- type: string;
26
- title: string;
27
- 'x-component': string;
28
- enum: any;
29
- default: string;
30
- 'x-component-props'?: undefined;
31
- };
32
- } | {
33
- name: string;
34
- type: string;
35
- interface: string;
36
- uiSchema: {
37
- type: string;
38
- title: string;
39
- 'x-component': string;
40
- 'x-component-props': {};
41
- enum?: undefined;
42
- default?: undefined;
43
- };
44
- } | {
45
- name: string;
46
- type: string;
47
- interface: string;
48
- uiSchema: {
49
- type: string;
50
- title: string;
51
- 'x-component': string;
52
- enum?: undefined;
53
- default?: undefined;
54
- 'x-component-props'?: undefined;
55
- };
56
- })[];
57
- };
58
- availableFieldInterfaces: {
59
- include: any[];
60
- };
61
- configurableProperties: Record<import("@nocobase/client/es/collection-manager/templates/properties").DefaultConfigurableKeys, any>;
62
- }
@@ -1,44 +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 { CollectionFieldInterface } from '@nocobase/client';
10
- export declare class ExpressionFieldInterface extends CollectionFieldInterface {
11
- name: string;
12
- type: string;
13
- group: string;
14
- order: number;
15
- title: string;
16
- description: string;
17
- sortable: boolean;
18
- default: {
19
- type: string;
20
- uiSchema: {
21
- 'x-component': string;
22
- };
23
- };
24
- properties: {
25
- 'uiSchema.title': {
26
- type: string;
27
- title: string;
28
- required: boolean;
29
- 'x-decorator': string;
30
- 'x-component': string;
31
- };
32
- name: {
33
- type: string;
34
- title: string;
35
- required: boolean;
36
- 'x-disabled': string;
37
- 'x-decorator': string;
38
- 'x-component': string;
39
- 'x-validator': string;
40
- description: string;
41
- };
42
- };
43
- hidden: boolean;
44
- }
@@ -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
- }
@@ -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
-
10
- (function(t,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("@nocobase/client"),require("react/jsx-runtime"),require("@nocobase/plugin-workflow/client"),require("react-i18next"),require("@formily/core"),require("@formily/react"),require("antd"),require("react"),require("@nocobase/evaluators/client")):typeof define=="function"&&define.amd?define(["exports","@nocobase/client","react/jsx-runtime","@nocobase/plugin-workflow/client","react-i18next","@formily/core","@formily/react","antd","react","@nocobase/evaluators/client"],e):(t=typeof globalThis!="undefined"?globalThis:t||self,e(t["@nocobase/plugin-workflow-dynamic-calculation"]={},t["@nocobase/client"],t.jsxRuntime,t["@nocobase/plugin-workflow"],t["react-i18next"],t["@formily/core"],t["@formily/react"],t.antd,t.react,t["@nocobase/evaluators"]))})(this,function(t,e,o,a,m,g,u,x,c,y){"use strict";var z=Object.defineProperty,G=Object.defineProperties;var L=Object.getOwnPropertyDescriptors;var T=Object.getOwnPropertySymbols;var R=Object.prototype.hasOwnProperty,U=Object.prototype.propertyIsEnumerable;var I=(t,e,o)=>e in t?z(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,h=(t,e)=>{for(var o in e||(e={}))R.call(e,o)&&I(t,o,e[o]);if(T)for(var o of T(e))U.call(e,o)&&I(t,o,e[o]);return t},E=(t,e)=>G(t,L(e));var n=(t,e,o)=>(I(t,typeof e!="symbol"?e+"":e,o),o);var w=(t,e,o)=>new Promise((a,m)=>{var g=c=>{try{x(o.next(c))}catch(y){m(y)}},u=c=>{try{x(o.throw(c))}catch(y){m(y)}},x=c=>c.done?a(c.value):Promise.resolve(c.value).then(g,u);x((o=o.apply(t,e)).next())});const p="workflow-dynamic-calculation";function V(i,r={}){const{t:s}=v(r);return s(i)}function v(i){return m.useTranslation(p,i)}function k(i){var s;return["belongsTo","hasOne"].includes(i.type)?((s=this.getCollection(i.collectionName))==null?void 0:s.template)==="expression"?!0:this.getCollectionFields(i.target).some(l=>l.interface==="expression"):!1}function S({value:i,onChange:r}){const{getCollectionFields:s,getCollection:l}=e.useCollectionManager_deprecated(),f=a.useWorkflowVariableOptions({types:[k.bind({getCollectionFields:s,getCollection:l})]});return o.jsx(e.Variable.Input,{value:i,onChange:r,scope:f})}class P extends a.Instruction{constructor(){super(...arguments);n(this,"title",`{{t("Dynamic Calculation", { ns: "${p}" })}}`);n(this,"type","dynamic-calculation");n(this,"group","extended");n(this,"description",`{{t("Calculate an expression based on a calculation engine and obtain a value as the result. Variables in the upstream nodes can be used in the expression. The expression is dynamic one from an expression collections.", { ns: "${p}" })}}`);n(this,"fieldset",{expression:{type:"string",title:`{{t("Calculation expression", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"DynamicExpression",required:!0},scope:{type:"string",title:`{{t("Variable datasource", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"WorkflowVariableInput","x-component-props":{changeOnSelect:!0,variableOptions:{types:[{type:"reference",options:{collection:"*",entity:!0}}]}},"x-reactions":{dependencies:["expression"],fulfill:{state:{visible:"{{$deps[0]}}"}}}}});n(this,"components",{DynamicExpression:S,WorkflowVariableInput:a.WorkflowVariableInput,ValueBlock:a.ValueBlock})}useVariables({key:s,title:l},{types:f,fieldNames:d=a.defaultFieldNames}){return f&&!f.some(C=>C in a.BaseTypeSets||Object.values(a.BaseTypeSets).some(b=>b.has(C)))?null:{[d.value]:s,[d.label]:l}}useInitializers(s){var l;return{name:`#${s.id}`,type:"item",title:(l=s.title)!=null?l:`#${s.id}`,Component:a.ValueBlock.Initializer,node:s,resultTitle:V("Calculation result")}}}const q=u.observer(i=>{const{onChange:r}=i,s=u.useField(),l=u.useForm(),d=[...s.path.segments.slice(0,-1),"sourceCollection"].join("."),[C,b]=c.useState(l.getValuesIn(d)),_=e.useCompile(),{getCollectionFields:W}=e.useCollectionManager_deprecated();u.useFormEffects(()=>{g.onFormInitialValuesChange(F=>{b(F.getValuesIn(d))}),g.onFieldInputValueChange(d,F=>{b(F.value),r(null)})});const N=a.getCollectionFieldOptions({collection:C,compile:_,getCollectionFields:W});return o.jsx(e.Variable.TextArea,E(h({},i),{scope:N}))},{displayName:"InternalExpression"});function M(i){const{t:r}=m.useTranslation(),s=e.useRecord(),l=e.useCompile(),{getCollectionFields:f}=e.useCollectionManager_deprecated(),d=c.useMemo(()=>a.getCollectionFieldOptions({collection:s.sourceCollection,compile:l,getCollectionFields:f}),[s.sourceCollection,s.sourceCollection]);return i.value?o.jsx(e.Variable.TextArea,E(h({},i),{scope:d})):o.jsx(x.Tag,{children:r("Unconfigured",{ns:p})})}const j=u.connect(q,u.mapReadPretty(M)),{defaultProps:D}=e.interfacesProperties;class O extends e.CollectionFieldInterface{constructor(){super(...arguments);n(this,"name","expression");n(this,"type","string");n(this,"group","advanced");n(this,"order",1);n(this,"title",`{{t("Expression", { ns: "${p}" })}}`);n(this,"description",`{{t("Used to store expressions for use in workflows so that different expressions can be called for different data.", { ns: "${p}" })}}`);n(this,"sortable",!0);n(this,"default",{type:"text",uiSchema:{"x-component":"DynamicExpression"}});n(this,"properties",h({},D));n(this,"hidden",!0)}}class A extends e.CollectionTemplate{constructor(){super(...arguments);n(this,"name","expression");n(this,"title",'{{t("Expression collection")}}');n(this,"order",4);n(this,"color","orange");n(this,"default",{createdBy:!0,updatedBy:!0,createdAt:!0,updatedAt:!0,fields:[{name:"engine",type:"string",interface:"radioGroup",uiSchema:{type:"string",title:'{{t("Calculation engine")}}',"x-component":"Radio.Group",enum:y.getOptions(),default:"formula.js"}},{name:"sourceCollection",type:"string",interface:"select",uiSchema:{type:"string",title:'{{t("Collection")}}',"x-component":"CollectionSelect","x-component-props":{}}},{name:"expression",type:"text",interface:"expression",uiSchema:{type:"string",title:'{{t("Expression")}}',"x-component":"DynamicExpression"}}]});n(this,"availableFieldInterfaces",{include:[]});n(this,"configurableProperties",e.getConfigurableProperties("title","name","inherits","category","description","presetFields"))}}class B extends e.Plugin{afterAdd(){return w(this,null,function*(){})}beforeLoad(){return w(this,null,function*(){})}load(){return w(this,null,function*(){this.app.dataSourceManager.addFieldInterfaces([O]),this.app.addComponents({DynamicExpression:j}),this.dataSourceManager.addCollectionTemplates([A]);const r=this.app.pm.get("workflow"),s=new P;r.instructions.register(s.type,s)})}}t.default=B,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -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
- module.exports = {
11
- "react": "18.2.0",
12
- "@nocobase/client": "1.2.12-alpha",
13
- "@nocobase/plugin-workflow": "1.2.12-alpha",
14
- "@formily/core": "2.3.0",
15
- "@formily/react": "2.3.0",
16
- "antd": "5.12.8",
17
- "react-i18next": "11.18.6",
18
- "@nocobase/evaluators": "1.2.12-alpha",
19
- "@nocobase/utils": "1.2.12-alpha",
20
- "@nocobase/server": "1.2.12-alpha",
21
- "@nocobase/database": "1.2.12-alpha"
22
- };
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
- });
@@ -1,11 +0,0 @@
1
- {
2
- "Dynamic Calculation": "Dynamic Calculation",
3
- "Calculate an expression based on a calculation engine and obtain a value as the result. Variables in the upstream nodes can be used in the expression. The expression is dynamic one from an expression collections.": "Calculate an expression based on a calculation engine and obtain a value as the result. Variables in the upstream nodes can be used in the expression. The expression is dynamic one from an expression collections.",
4
- "Select dynamic expression": "Select dynamic expression",
5
- "Select the dynamic expression queried from the upstream node. You need to query it from an expression collection.": "Select the dynamic expression queried from the upstream node. You need to query it from an expression collection.",
6
- "Variable datasource": "Variable datasource",
7
- "Dynamic expression": "Dynamic expression",
8
- "An expression for calculation in each rows": "An expression for calculation in each rows",
9
- "Unconfigured": "Unconfigured",
10
- "Calculation result": "Calculation result"
11
- }
@@ -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-dynamic-calculation";
10
- export declare function useLang(key: string, options?: {}): string;
11
- export declare function usePluginTranslation(options: any): import("react-i18next").UseTranslationResponse<"workflow-dynamic-calculation", undefined>;
@@ -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-dynamic-calculation";
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
- });
@@ -1,13 +0,0 @@
1
- {
2
- "Dynamic Calculation": "동적 표현식 계산",
3
- "Calculate an expression based on a calculation engine and obtain a value as the result. Variables in the upstream nodes can be used in the expression. The expression is dynamic one from an expression collections.":
4
- "계산 엔진을 기반으로 한 식을 계산하고 결과값을 얻습니다. 상류 노드의 변수를 식에 사용할 수 있습니다. 식은 표현식 컬렉션에서 동적으로 가져온 것입니다.",
5
- "Select dynamic expression": "동적 표현식 선택",
6
- "Select the dynamic expression queried from the upstream node. You need to query it from an expression collection.":
7
- "상류 노드에서 조회한 동적 표현식을 선택하세요. 표현식 컬렉션에서 조회해야 합니다.",
8
- "Variable datasource": "변수 데이터 소스",
9
- "Dynamic expression": "동적 표현식",
10
- "An expression for calculation in each rows": "각 행의 계산을 위한 식",
11
- "Unconfigured": "구성되지 않음",
12
- "Calculation result": "계산 결과"
13
- }
@@ -1,12 +0,0 @@
1
- {
2
- "Expression": "表达式",
3
- "Dynamic Calculation": "动态表达式计算",
4
- "Calculate an expression based on a calculation engine and obtain a value as the result. Variables in the upstream nodes can be used in the expression. The expression is dynamic one from an expression collections.": "基于计算引擎计算表达式并获取值作为结果。可以在表达式中使用上游节点的变量。表达式是从表达式表中动态获取的。",
5
- "Select dynamic expression": "选择动态表达式",
6
- "Select the dynamic expression queried from the upstream node. You need to query it from an expression collection.": "从上游节点中选择查询出来的动态表达式。你需要从动态表达式类型的数据表中查询。",
7
- "Variable datasource": "变量数据源",
8
- "Dynamic expression": "动态表达式",
9
- "Used to store expressions for use in workflows so that different expressions can be called for different data.": "用于存储表达式,在工作流中使用,以便针对不同的数据调用不同的表达式。",
10
- "Unconfigured": "未配置",
11
- "Calculation result": "运算结果"
12
- }
@@ -1,18 +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 { FlowNodeModel, Instruction, Processor } from '@nocobase/plugin-workflow';
10
- export declare class DynamicCalculation extends Instruction {
11
- run(node: FlowNodeModel, prevJob: any, processor: Processor): Promise<{
12
- result: any;
13
- status: 1;
14
- } | {
15
- result: any;
16
- status: -2;
17
- }>;
18
- }
@@ -1,71 +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 DynamicCalculation_exports = {};
38
- __export(DynamicCalculation_exports, {
39
- DynamicCalculation: () => DynamicCalculation
40
- });
41
- module.exports = __toCommonJS(DynamicCalculation_exports);
42
- var import_utils = require("@nocobase/utils");
43
- var import_plugin_workflow = require("@nocobase/plugin-workflow");
44
- var import_evaluators = __toESM(require("@nocobase/evaluators"));
45
- class DynamicCalculation extends import_plugin_workflow.Instruction {
46
- async run(node, prevJob, processor) {
47
- let { engine = "math.js", expression = "" } = node.config;
48
- let scope = processor.getScope(node.id);
49
- const parsed = (0, import_utils.parse)(expression)(scope) ?? {};
50
- engine = parsed.engine;
51
- expression = parsed.expression;
52
- scope = (0, import_utils.parse)(node.config.scope ?? "")(scope) ?? {};
53
- const evaluator = import_evaluators.default.get(engine);
54
- try {
55
- const result = evaluator && expression ? evaluator(expression, scope) : null;
56
- return {
57
- result,
58
- status: import_plugin_workflow.JOB_STATUS.RESOLVED
59
- };
60
- } catch (e) {
61
- return {
62
- result: e.toString(),
63
- status: import_plugin_workflow.JOB_STATUS.ERROR
64
- };
65
- }
66
- }
67
- }
68
- // Annotate the CommonJS export names for ESM import in node:
69
- 0 && (module.exports = {
70
- DynamicCalculation
71
- });
@@ -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
- }
@@ -1,54 +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_expression_field = require("./expression-field");
45
- var import_DynamicCalculation = require("./DynamicCalculation");
46
- class Plugin_default extends import_server.Plugin {
47
- async load() {
48
- this.db.registerFieldTypes({
49
- expression: import_expression_field.ExpressionField
50
- });
51
- const workflowPlugin = this.app.getPlugin(import_plugin_workflow.default);
52
- workflowPlugin.registerInstruction("dynamic-calculation", import_DynamicCalculation.DynamicCalculation);
53
- }
54
- }
@@ -1,15 +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 { BaseFieldOptions, DataTypes, Field } from '@nocobase/database';
10
- export interface ExpressionFieldOptions extends BaseFieldOptions {
11
- type: 'expression';
12
- }
13
- export declare class ExpressionField extends Field {
14
- get dataType(): DataTypes.TextDataTypeConstructor;
15
- }
@@ -1,41 +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 expression_field_exports = {};
28
- __export(expression_field_exports, {
29
- ExpressionField: () => ExpressionField
30
- });
31
- module.exports = __toCommonJS(expression_field_exports);
32
- var import_database = require("@nocobase/database");
33
- class ExpressionField extends import_database.Field {
34
- get dataType() {
35
- return import_database.DataTypes.TEXT;
36
- }
37
- }
38
- // Annotate the CommonJS export names for ESM import in node:
39
- 0 && (module.exports = {
40
- ExpressionField
41
- });
@@ -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';
@@ -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"));