@nocobase/plugin-workflow-dynamic-calculation 0.19.0-alpha.5 → 0.19.0-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/client/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(o,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("@nocobase/client"),require("react/jsx-runtime"),require("react-i18next"),require("@nocobase/plugin-workflow/client"),require("@formily/core"),require("@formily/react"),require("antd"),require("react")):typeof define=="function"&&define.amd?define(["exports","@nocobase/client","react/jsx-runtime","react-i18next","@nocobase/plugin-workflow/client","@formily/core","@formily/react","antd","react"],e):(o=typeof globalThis!="undefined"?globalThis:o||self,e(o["@nocobase/plugin-workflow-dynamic-calculation"]={},o["@nocobase/client"],o.jsxRuntime,o["react-i18next"],o["@nocobase/plugin-workflow"],o["@formily/core"],o["@formily/react"],o.antd,o.react))})(this,function(o,e,n,C,r,g,u,x,c){"use strict";var z=Object.defineProperty,L=Object.defineProperties;var U=Object.getOwnPropertyDescriptors;var k=Object.getOwnPropertySymbols;var _=Object.prototype.hasOwnProperty,G=Object.prototype.propertyIsEnumerable;var v=(o,e,n)=>e in o?z(o,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[e]=n,m=(o,e)=>{for(var n in e||(e={}))_.call(e,n)&&v(o,n,e[n]);if(k)for(var n of k(e))G.call(e,n)&&v(o,n,e[n]);return o},y=(o,e)=>L(o,U(e));var f=(o,e,n)=>(v(o,typeof e!="symbol"?e+"":e,n),n);var w=(o,e,n)=>new Promise((C,r)=>{var g=c=>{try{x(n.next(c))}catch(a){r(a)}},u=c=>{try{x(n.throw(c))}catch(a){r(a)}},x=c=>c.done?C(c.value):Promise.resolve(c.value).then(g,u);x((n=n.apply(o,e)).next())});const a="workflow-dynamic-calculation";function F(s,i={}){const{t}=I(i);return t(s)}function I(s){return C.useTranslation(a,s)}const{defaultProps:T}=e.interfacesProperties,P={name:"expression",type:"string",group:"advanced",order:1,title:`{{t("Expression", { ns: "${a}" })}}`,description:`{{t("Used to store expressions for use in workflows so that different expressions can be called for different data.", { ns: "${a}" })}}`,sortable:!0,default:{type:"text",uiSchema:{"x-component":"DynamicExpression"}},properties:m({},T)};function E(s){const i=e.useCollectionManager();return n.jsx(e.CollectionManagerContext.Provider,{value:y(m({},i),{interfaces:y(m({},i.interfaces),{expression:P})}),children:s.children})}function M(s){var t;return["belongsTo","hasOne"].includes(s.type)?((t=this.getCollection(s.collectionName))==null?void 0:t.template)==="expression"?!0:this.getCollectionFields(s.target).some(l=>l.interface==="expression"):!1}function q({value:s,onChange:i}){const{getCollectionFields:t,getCollection:l}=e.useCollectionManager(),d=r.useWorkflowVariableOptions({types:[M.bind({getCollectionFields:t,getCollection:l})]});return n.jsx(e.Variable.Input,{value:s,onChange:i,scope:d})}class j extends r.Instruction{constructor(){super(...arguments);f(this,"title",`{{t("Dynamic Calculation", { ns: "${a}" })}}`);f(this,"type","dynamic-calculation");f(this,"group","extended");f(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: "${a}" })}}`);f(this,"fieldset",{expression:{type:"string",title:`{{t("Calculation expression", { ns: "${a}" })}}`,"x-decorator":"FormItem","x-component":"DynamicExpression",required:!0},scope:{type:"string",title:`{{t("Variable datasource", { ns: "${a}" })}}`,"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]}}"}}}}});f(this,"components",{DynamicExpression:q,WorkflowVariableInput:r.WorkflowVariableInput,ValueBlock:r.ValueBlock})}useVariables({key:t,title:l},{types:d,fieldNames:p=r.defaultFieldNames}){return d&&!d.some(h=>h in r.BaseTypeSets||Object.values(r.BaseTypeSets).some(b=>b.has(h)))?null:{[p.value]:t,[p.label]:l}}useInitializers(t){var l;return{name:`#${t.id}`,type:"item",title:(l=t.title)!=null?l:`#${t.id}`,Component:r.ValueBlock.Initializer,node:t,resultTitle:F("Calculation result")}}}const D=u.observer(s=>{const{onChange:i}=s,t=u.useField(),l=u.useForm(),p=[...t.path.segments.slice(0,-1),"sourceCollection"].join("."),[h,b]=c.useState(l.getValuesIn(p)),B=e.useCompile(),{getCollectionFields:W}=e.useCollectionManager();u.useFormEffects(()=>{g.onFormInitialValuesChange(V=>{b(V.getValuesIn(p))}),g.onFieldInputValueChange(p,V=>{b(V.value),i(null)})});const N=r.getCollectionFieldOptions({collection:h,compile:B,getCollectionFields:W});return n.jsx(e.Variable.TextArea,y(m({},s),{scope:N}))},{displayName:"InternalExpression"});function O(s){const{t:i}=C.useTranslation(),t=e.useRecord(),l=e.useCompile(),{getCollectionFields:d}=e.useCollectionManager(),p=c.useMemo(()=>r.getCollectionFieldOptions({collection:t.sourceCollection,compile:l,getCollectionFields:d}),[t.sourceCollection,t.sourceCollection]);return s.value?n.jsx(e.Variable.TextArea,y(m({},s),{scope:p})):n.jsx(x.Tag,{children:i("Unconfigured",{ns:a})})}const S=u.connect(D,u.mapReadPretty(O));class A extends e.Plugin{afterAdd(){return w(this,null,function*(){})}beforeLoad(){return w(this,null,function*(){})}load(){return w(this,null,function*(){this.app.addProvider(E),this.app.addComponents({DynamicExpression:S});const i=this.app.pm.get("workflow"),t=new j;i.instructions.register(t.type,t)})}}o.default=A,Object.defineProperties(o,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/externalVersion.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
"react": "18.2.0",
|
|
3
|
-
"@nocobase/client": "0.19.0-alpha.
|
|
4
|
-
"@nocobase/plugin-workflow": "0.19.0-alpha.
|
|
3
|
+
"@nocobase/client": "0.19.0-alpha.7",
|
|
4
|
+
"@nocobase/plugin-workflow": "0.19.0-alpha.7",
|
|
5
5
|
"@formily/core": "2.3.0",
|
|
6
6
|
"@formily/react": "2.3.0",
|
|
7
7
|
"antd": "5.12.8",
|
|
8
8
|
"react-i18next": "11.18.6",
|
|
9
|
-
"@nocobase/utils": "0.19.0-alpha.
|
|
10
|
-
"@nocobase/evaluators": "0.19.0-alpha.
|
|
11
|
-
"@nocobase/server": "0.19.0-alpha.
|
|
12
|
-
"@nocobase/database": "0.19.0-alpha.
|
|
9
|
+
"@nocobase/utils": "0.19.0-alpha.7",
|
|
10
|
+
"@nocobase/evaluators": "0.19.0-alpha.7",
|
|
11
|
+
"@nocobase/server": "0.19.0-alpha.7",
|
|
12
|
+
"@nocobase/database": "0.19.0-alpha.7"
|
|
13
13
|
};
|
package/dist/locale/zh-CN.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
+
"Expression": "表达式",
|
|
2
3
|
"Dynamic Calculation": "动态表达式计算",
|
|
3
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.": "基于计算引擎计算表达式并获取值作为结果。可以在表达式中使用上游节点的变量。表达式是从表达式表中动态获取的。",
|
|
4
5
|
"Select dynamic expression": "选择动态表达式",
|
|
5
6
|
"Select the dynamic expression queried from the upstream node. You need to query it from an expression collection.": "从上游节点中选择查询出来的动态表达式。你需要从动态表达式类型的数据表中查询。",
|
|
6
7
|
"Variable datasource": "变量数据源",
|
|
7
8
|
"Dynamic expression": "动态表达式",
|
|
8
|
-
"
|
|
9
|
+
"Used to store expressions for use in workflows so that different expressions can be called for different data.": "用于存储表达式,在工作流中使用,以便针对不同的数据调用不同的表达式。",
|
|
9
10
|
"Unconfigured": "未配置",
|
|
10
11
|
"Calculation result": "运算结果"
|
|
11
12
|
}
|
package/package.json
CHANGED
|
@@ -4,9 +4,11 @@
|
|
|
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": "0.19.0-alpha.
|
|
7
|
+
"version": "0.19.0-alpha.7",
|
|
8
8
|
"license": "AGPL-3.0",
|
|
9
9
|
"main": "./dist/server/index.js",
|
|
10
|
+
"homepage": "https://docs.nocobase.com/plugins/workflow-dynamic-calculation",
|
|
11
|
+
"homepage.zh-CN": "https://docs-cn.nocobase.com/plugins/workflow-dynamic-calculation",
|
|
10
12
|
"devDependencies": {
|
|
11
13
|
"@ant-design/icons": "5.x",
|
|
12
14
|
"@formily/antd-v5": "1.x",
|
|
@@ -28,5 +30,8 @@
|
|
|
28
30
|
"@nocobase/test": "0.x",
|
|
29
31
|
"@nocobase/utils": "0.x"
|
|
30
32
|
},
|
|
31
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "cbbfd4de14b8f73417e613af6927d2fbbdbd2b41",
|
|
34
|
+
"keywords": [
|
|
35
|
+
"Workflow"
|
|
36
|
+
]
|
|
32
37
|
}
|
|
@@ -10,7 +10,7 @@ export default {
|
|
|
10
10
|
group: 'advanced',
|
|
11
11
|
order: 1,
|
|
12
12
|
title: `{{t("Expression", { ns: "${NAMESPACE}" })}}`,
|
|
13
|
-
description: `{{t("
|
|
13
|
+
description: `{{t("Used to store expressions for use in workflows so that different expressions can be called for different data.", { ns: "${NAMESPACE}" })}}`,
|
|
14
14
|
sortable: true,
|
|
15
15
|
default: {
|
|
16
16
|
type: 'text',
|
package/src/locale/zh-CN.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
+
"Expression": "表达式",
|
|
2
3
|
"Dynamic Calculation": "动态表达式计算",
|
|
3
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.": "基于计算引擎计算表达式并获取值作为结果。可以在表达式中使用上游节点的变量。表达式是从表达式表中动态获取的。",
|
|
4
5
|
"Select dynamic expression": "选择动态表达式",
|
|
5
6
|
"Select the dynamic expression queried from the upstream node. You need to query it from an expression collection.": "从上游节点中选择查询出来的动态表达式。你需要从动态表达式类型的数据表中查询。",
|
|
6
7
|
"Variable datasource": "变量数据源",
|
|
7
8
|
"Dynamic expression": "动态表达式",
|
|
8
|
-
"
|
|
9
|
+
"Used to store expressions for use in workflows so that different expressions can be called for different data.": "用于存储表达式,在工作流中使用,以便针对不同的数据调用不同的表达式。",
|
|
9
10
|
"Unconfigured": "未配置",
|
|
10
11
|
"Calculation result": "运算结果"
|
|
11
12
|
}
|