@nocobase/plugin-workflow-action-trigger 1.2.25-alpha → 1.2.26-alpha

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.
@@ -7,4 +7,4 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
 
10
- (function(o,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("@nocobase/client"),require("@nocobase/plugin-workflow/client"),require("@formily/react"),require("react-i18next")):typeof define=="function"&&define.amd?define(["exports","@nocobase/client","@nocobase/plugin-workflow/client","@formily/react","react-i18next"],t):(o=typeof globalThis!="undefined"?globalThis:o||self,t(o["@nocobase/plugin-workflow-action-trigger"]={},o["@nocobase/client"],o["@nocobase/plugin-workflow"],o["@formily/react"],o["react-i18next"]))})(this,function(o,t,e,f,p){"use strict";var v=Object.defineProperty,W=Object.defineProperties;var R=Object.getOwnPropertyDescriptors;var w=Object.getOwnPropertySymbols;var I=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable;var m=(o,t,e)=>t in o?v(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e,b=(o,t)=>{for(var e in t||(t={}))I.call(t,e)&&m(o,e,t[e]);if(w)for(var e of w(t))O.call(t,e)&&m(o,e,t[e]);return o},h=(o,t)=>W(o,R(t));var a=(o,t,e)=>(m(o,typeof t!="symbol"?t+"":t,e),e);var C=(o,t,e)=>new Promise((f,p)=>{var i=r=>{try{u(e.next(r))}catch(d){p(d)}},c=r=>{try{u(e.throw(r))}catch(d){p(d)}},u=r=>r.done?f(r.value):Promise.resolve(r.value).then(i,c);u((e=e.apply(o,t)).next())});const i="workflow-action-trigger";function c(s,l={}){const{t:n}=u(l);return n(s)}function u(s){return p.useTranslation(i,s)}const r={CREATE:"create",UPDATE:"update",UPSERT:"updateOrCreate",DESTROY:"destroy"};function d(s,l){var x;const[n,g]=t.parseCollectionName(s.collection),T=t.useCompile(),A=e.useGetCollectionFields(n),S=e.useGetCollectionFields(),E=c("Trigger data"),F=c("User submitted action"),P=c("Role of user submitted action");return[...e.getCollectionFieldOptions(h(b({appends:["data",...((x=s.appends)==null?void 0:x.map($=>`data.${$}`))||[]]},l),{fields:[{collectionName:g,name:"data",type:"hasOne",target:g,uiSchema:{title:E}}],compile:T,getCollectionFields:A})),...e.getCollectionFieldOptions(h(b({appends:["user"]},l),{fields:[{collectionName:"users",name:"user",type:"hasOne",target:"users",uiSchema:{title:F}},{name:"roleName",uiSchema:{title:P}}],compile:T,getCollectionFields:S}))]}class k extends e.Trigger{constructor(){super(...arguments);a(this,"title",`{{t("Post-action event", { ns: "${i}" })}}`);a(this,"description",`{{t('Triggered after the completion of a request initiated through an action button or API, such as after adding, updating, or deleting data. Suitable for data processing, sending notifications, etc., after actions are completed.', { ns: "${i}" })}}`);a(this,"fieldset",{collection:{type:"string",required:!0,"x-decorator":"FormItem","x-decorator-props":{tooltip:`{{t("The collection to which the triggered data belongs.", { ns: "${i}" })}}`},"x-component":"DataSourceCollectionCascader","x-disabled":"{{ useWorkflowAnyExecuted() }}",title:`{{t("Collection", { ns: "${i}" })}}`,"x-reactions":[{target:"appends",effects:["onFieldValueChange"],fulfill:{state:{value:[]}}}]},global:{type:"boolean",title:`{{t("Trigger mode", { ns: "${i}" })}}`,"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{direction:"vertical",options:[{label:`{{t("Local mode, triggered after the completion of actions bound to this workflow", { ns: "${i}" })}}`,value:!1},{label:`{{t("Global mode, triggered after the completion of the following actions", { ns: "${i}" })}}`,value:!0}]},default:!1,"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]},actions:{type:"number",title:`{{t("Select actions", { ns: "${i}" })}}`,"x-decorator":"FormItem","x-component":"CheckboxGroupWithTooltip","x-component-props":{direction:"vertical",options:[{label:`{{t("Create record action", { ns: "${i}" })}}`,value:r.CREATE},{label:`{{t("Update record action", { ns: "${i}" })}}`,value:r.UPDATE}]},required:!0,"x-reactions":[{dependencies:["collection","global"],fulfill:{state:{visible:"{{!!$deps[0] && !!$deps[1]}}"}}}]},appends:{type:"array",title:`{{t("Associations to use", { ns: "${i}" })}}`,description:'{{t("Please select the associated fields that need to be accessed in subsequent nodes. With more than two levels of to-many associations may cause performance issue, please use with caution.", { ns: "workflow" })}}',"x-decorator":"FormItem","x-component":"AppendsTreeSelect","x-component-props":{multiple:!0,useCollection(){const{values:n}=f.useForm();return n==null?void 0:n.collection}},"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]}});a(this,"scope",{useCollectionDataSource:t.useCollectionDataSource,useWorkflowAnyExecuted:e.useWorkflowAnyExecuted});a(this,"components",{RadioWithTooltip:e.RadioWithTooltip,CheckboxGroupWithTooltip:e.CheckboxGroupWithTooltip});a(this,"isActionTriggerable",(n,g)=>!n.global&&["submit","customize:save","customize:update"].includes(g.buttonAction));a(this,"useVariables",d)}useInitializers(n){return n.collection?{name:"triggerData",type:"item",key:"triggerData",title:`{{t("Trigger data", { ns: "${i}" })}}`,Component:e.CollectionBlockInitializer,collection:n.collection,dataPath:"$context.data"}:null}}class y extends t.Plugin{load(){return C(this,null,function*(){this.app.pm.get("workflow").registerTrigger("action",k),this.app.addScopes({useTriggerWorkflowsActionProps:e.useTriggerWorkflowsActionProps,useRecordTriggerWorkflowsActionProps:e.useRecordTriggerWorkflowsActionProps})})}}o.default=y,Object.defineProperties(o,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
10
+ (function(o,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("@nocobase/client"),require("@nocobase/plugin-workflow/client"),require("@formily/react"),require("react-i18next")):typeof define=="function"&&define.amd?define(["exports","@nocobase/client","@nocobase/plugin-workflow/client","@formily/react","react-i18next"],t):(o=typeof globalThis!="undefined"?globalThis:o||self,t(o["@nocobase/plugin-workflow-action-trigger"]={},o["@nocobase/client"],o["@nocobase/plugin-workflow"],o["@formily/react"],o["react-i18next"]))})(this,function(o,t,e,f,p){"use strict";var v=Object.defineProperty,W=Object.defineProperties;var R=Object.getOwnPropertyDescriptors;var w=Object.getOwnPropertySymbols;var I=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable;var m=(o,t,e)=>t in o?v(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e,b=(o,t)=>{for(var e in t||(t={}))I.call(t,e)&&m(o,e,t[e]);if(w)for(var e of w(t))O.call(t,e)&&m(o,e,t[e]);return o},h=(o,t)=>W(o,R(t));var a=(o,t,e)=>(m(o,typeof t!="symbol"?t+"":t,e),e);var C=(o,t,e)=>new Promise((f,p)=>{var i=r=>{try{u(e.next(r))}catch(d){p(d)}},c=r=>{try{u(e.throw(r))}catch(d){p(d)}},u=r=>r.done?f(r.value):Promise.resolve(r.value).then(i,c);u((e=e.apply(o,t)).next())});const i="workflow-action-trigger";function c(s,l={}){const{t:n}=u(l);return n(s)}function u(s){return p.useTranslation(i,s)}const r={CREATE:"create",UPDATE:"update",UPSERT:"updateOrCreate",DESTROY:"destroy"};function d(s,l){var x;const[n,g]=t.parseCollectionName(s.collection),T=t.useCompile(),A=e.useGetCollectionFields(n),S=e.useGetCollectionFields(),E=c("Trigger data"),F=c("User submitted action"),P=c("Role of user submitted action");return[...e.getCollectionFieldOptions(h(b({appends:["data",...((x=s.appends)==null?void 0:x.map($=>`data.${$}`))||[]]},l),{fields:[{collectionName:g,name:"data",type:"hasOne",target:g,uiSchema:{title:E}}],compile:T,getCollectionFields:A})),...e.getCollectionFieldOptions(h(b({appends:["user"]},l),{fields:[{collectionName:"users",name:"user",type:"hasOne",target:"users",uiSchema:{title:F}},{name:"roleName",uiSchema:{title:P}}],compile:T,getCollectionFields:S}))]}class k extends e.Trigger{constructor(){super(...arguments);a(this,"title",`{{t("Post-action event", { ns: "${i}" })}}`);a(this,"description",`{{t('Triggered after the completion of a request initiated through an action button or API, such as after adding or updating data. Suitable for data processing, sending notifications, etc., after actions are completed.', { ns: "${i}" })}}`);a(this,"fieldset",{collection:{type:"string",required:!0,"x-decorator":"FormItem","x-decorator-props":{tooltip:`{{t("The collection to which the triggered data belongs.", { ns: "${i}" })}}`},"x-component":"DataSourceCollectionCascader","x-disabled":"{{ useWorkflowAnyExecuted() }}",title:`{{t("Collection", { ns: "${i}" })}}`,"x-reactions":[{target:"appends",effects:["onFieldValueChange"],fulfill:{state:{value:[]}}}]},global:{type:"boolean",title:`{{t("Trigger mode", { ns: "${i}" })}}`,"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{direction:"vertical",options:[{label:`{{t("Local mode, triggered after the completion of actions bound to this workflow", { ns: "${i}" })}}`,value:!1},{label:`{{t("Global mode, triggered after the completion of the following actions", { ns: "${i}" })}}`,value:!0}]},default:!1,"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]},actions:{type:"number",title:`{{t("Select actions", { ns: "${i}" })}}`,"x-decorator":"FormItem","x-component":"CheckboxGroupWithTooltip","x-component-props":{direction:"vertical",options:[{label:`{{t("Create record action", { ns: "${i}" })}}`,value:r.CREATE},{label:`{{t("Update record action", { ns: "${i}" })}}`,value:r.UPDATE}]},required:!0,"x-reactions":[{dependencies:["collection","global"],fulfill:{state:{visible:"{{!!$deps[0] && !!$deps[1]}}"}}}]},appends:{type:"array",title:`{{t("Associations to use", { ns: "${i}" })}}`,description:'{{t("Please select the associated fields that need to be accessed in subsequent nodes. With more than two levels of to-many associations may cause performance issue, please use with caution.", { ns: "workflow" })}}',"x-decorator":"FormItem","x-component":"AppendsTreeSelect","x-component-props":{multiple:!0,useCollection(){const{values:n}=f.useForm();return n==null?void 0:n.collection}},"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]}});a(this,"scope",{useCollectionDataSource:t.useCollectionDataSource,useWorkflowAnyExecuted:e.useWorkflowAnyExecuted});a(this,"components",{RadioWithTooltip:e.RadioWithTooltip,CheckboxGroupWithTooltip:e.CheckboxGroupWithTooltip});a(this,"isActionTriggerable",(n,g)=>!n.global&&["submit","customize:save","customize:update"].includes(g.buttonAction));a(this,"useVariables",d)}useInitializers(n){return n.collection?{name:"triggerData",type:"item",key:"triggerData",title:`{{t("Trigger data", { ns: "${i}" })}}`,Component:e.CollectionBlockInitializer,collection:n.collection,dataPath:"$context.data"}:null}}class y extends t.Plugin{load(){return C(this,null,function*(){this.app.pm.get("workflow").registerTrigger("action",k),this.app.addScopes({useTriggerWorkflowsActionProps:e.useTriggerWorkflowsActionProps,useRecordTriggerWorkflowsActionProps:e.useRecordTriggerWorkflowsActionProps})})}}o.default=y,Object.defineProperties(o,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -9,16 +9,16 @@
9
9
 
10
10
  module.exports = {
11
11
  "@formily/react": "2.3.0",
12
- "@nocobase/client": "1.2.25-alpha",
13
- "@nocobase/plugin-workflow": "1.2.25-alpha",
12
+ "@nocobase/client": "1.2.26-alpha",
13
+ "@nocobase/plugin-workflow": "1.2.26-alpha",
14
14
  "react-i18next": "11.18.6",
15
15
  "lodash": "4.17.21",
16
16
  "sequelize": "6.35.2",
17
- "@nocobase/database": "1.2.25-alpha",
18
- "@nocobase/server": "1.2.25-alpha",
19
- "@nocobase/actions": "1.2.25-alpha",
20
- "@nocobase/data-source-manager": "1.2.25-alpha",
21
- "@nocobase/plugin-workflow-test": "1.2.25-alpha",
22
- "@nocobase/test": "1.2.25-alpha",
23
- "@nocobase/utils": "1.2.25-alpha"
17
+ "@nocobase/database": "1.2.26-alpha",
18
+ "@nocobase/server": "1.2.26-alpha",
19
+ "@nocobase/actions": "1.2.26-alpha",
20
+ "@nocobase/data-source-manager": "1.2.26-alpha",
21
+ "@nocobase/plugin-workflow-test": "1.2.26-alpha",
22
+ "@nocobase/test": "1.2.26-alpha",
23
+ "@nocobase/utils": "1.2.26-alpha"
24
24
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "Post-action event": "操作后事件",
3
- "Triggered after the completion of a request initiated through an action button or API, such as after adding, updating, or deleting data. Suitable for data processing, sending notifications, etc., after actions are completed.":
4
- "通过操作按钮或 API 发起请求时,在请求执行成功后触发该事件,比如新增、更新、删除操作之后。适用于在操作完成后进行数据处理、发送通知等。",
3
+ "Triggered after the completion of a request initiated through an action button or API, such as after adding or updating data. Suitable for data processing, sending notifications, etc., after actions are completed.":
4
+ "通过操作按钮或 API 发起请求时,在请求执行成功后触发该事件,比如新增、更新操作之后。适用于在操作完成后进行数据处理、发送通知等。",
5
5
  "Collection": "数据表",
6
6
  "The collection to which the triggered data belongs.": "触发数据所属的数据表。",
7
7
  "Trigger mode": "触发模式",
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "displayName.zh-CN": "工作流:操作后事件",
5
5
  "description": "Triggered after the completion of a request initiated through an action button or API, such as after adding, updating, deleting data, or \"submit to workflow\". Suitable for data processing, sending notifications, etc., after actions are completed.",
6
6
  "description.zh-CN": "通过操作按钮或 API 发起请求并在执行完成后触发,比如新增、更新、删除数据或者“提交至工作流”之后。适用于在操作完成后进行数据处理、发送通知等。",
7
- "version": "1.2.25-alpha",
7
+ "version": "1.2.26-alpha",
8
8
  "license": "AGPL-3.0",
9
9
  "main": "./dist/server/index.js",
10
10
  "homepage": "https://docs.nocobase.com/plugins/workflow-action-trigger",
@@ -21,7 +21,7 @@
21
21
  "@nocobase/server": "1.x",
22
22
  "@nocobase/test": "1.x"
23
23
  },
24
- "gitHead": "72a6f9a73afc615b7f16fac6197ad44c29bf1e0f",
24
+ "gitHead": "a463b25b4f7de08f71f43a22cb6171f0a58aa66a",
25
25
  "keywords": [
26
26
  "Workflow"
27
27
  ]