@nocobase/plugin-workflow-action-trigger 2.2.0-alpha.1 → 2.2.0-alpha.3

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 ADDED
@@ -0,0 +1,2 @@
1
+ export * from './dist/client-v2';
2
+ export { default } from './dist/client-v2';
package/client-v2.js ADDED
@@ -0,0 +1,3 @@
1
+ 'use strict';
2
+
3
+ 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_action_trigger=self.webpackChunk_nocobase_plugin_workflow_action_trigger||[]).push([["157"],{316:function(e,t,n){n.r(t),n.d(t,{ActionTriggerPresetConfig:function(){return u},default:function(){return s}});var l=n(197),o=n(59),r=n(155),a=n.n(r),c=n(538),i=n(488);function u(){var e=(0,i.kj)();return a().createElement(o.Form.Item,{name:["config","collection"],label:e("Collection"),rules:[{required:!0}]},a().createElement(l.CollectionCascader,null))}function s(){var e=(0,i.kj)(),t=o.Form.useFormInstance(),n=o.Form.useWatch(["config","collection"]),u=o.Form.useWatch(["config","global"]),s=(0,r.useRef)(n),m=(0,r.useRef)(!1);(0,r.useEffect)(function(){if(!m.current){m.current=!0,s.current=n;return}s.current!==n&&t.setFieldValue(["config","appends"],[]),s.current=n},[n,t]);var f=(0,r.useMemo)(function(){return[{label:e("Create record action"),value:c.V.CREATE},{label:e("Update record action"),value:c.V.UPDATE}]},[e]);return a().createElement("fieldset",null,a().createElement(o.Form.Item,{name:["config","collection"],label:e("Collection"),tooltip:e("The collection to which the triggered data belongs."),rules:[{required:!0}]},a().createElement(l.CollectionCascader,{disabled:!0})),n?a().createElement(o.Form.Item,{name:["config","global"],label:e("Trigger mode"),initialValue:!1},a().createElement(o.Radio.Group,null,a().createElement(o.Space,{direction:"vertical"},a().createElement(o.Radio,{value:!1},e("Local mode, triggered after the completion of actions bound to this workflow")),a().createElement(o.Radio,{value:!0},e("Global mode, triggered after the completion of the following actions"))))):null,n&&u?a().createElement(o.Form.Item,{name:["config","actions"],label:e("Select actions"),rules:[{required:!0}]},a().createElement(o.Checkbox.Group,null,a().createElement(o.Space,{direction:"vertical"},f.map(function(e){return a().createElement(o.Checkbox,{key:e.value,value:e.value},e.label)})))):null,n?a().createElement(o.Form.Item,{name:["config","appends"],label:e("Associations to use"),extra:e("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"})},a().createElement(l.AppendsSelect,{collection:n})):null)}}}]);
@@ -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_action_trigger=self.webpackChunk_nocobase_plugin_workflow_action_trigger||[]).push([["773"],{828:function(e,r,t){t.r(r),t.d(r,{default:function(){return m}});var n=t(485),a=t(694),o=t(197),l=t(59),u=t(155),i=t.n(u),c=t(488);function s(e,r,t,n,a,o,l){try{var u=e[o](l),i=u.value}catch(e){t(e);return}u.done?r(i):Promise.resolve(i).then(n,a)}function f(e){return function(){var r=this,t=arguments;return new Promise(function(n,a){var o=e.apply(r,t);function l(e){s(o,n,a,l,u,"next",e)}function u(e){s(o,n,a,l,u,"throw",e)}l(void 0)})}}function p(e,r){var t,n,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(l,"next",{value:i(0)}),u(l,"throw",{value:i(1)}),u(l,"return",{value:i(2)}),"function"==typeof Symbol&&u(l,Symbol.iterator,{value:function(){return this}}),l;function i(u){return function(i){var c=[u,i];if(t)throw TypeError("Generator is already executing.");for(;l&&(l=0,c[0]&&(o=0)),o;)try{if(t=1,n&&(a=2&c[0]?n.return:c[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,c[1])).done)return a;switch(n=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,n=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(6===c[0]&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=r.call(e,o)}catch(e){c=[6,e],n=0}finally{t=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}function m(){var e=(0,c.kj)(),r=(0,a.useFlowEngine)(),t=(0,u.useMemo)(function(){return{types:[function(e){return e.isForeignKey||"context"===e.type?"users"===e.target:"users"===e.collectionName&&"id"===e.name}]}},[]),s=(0,u.useMemo)(function(){return{types:[function(e){return e.isForeignKey?"roles"===e.target:"roles"===e.collectionName&&"name"===e.name}]}},[]);return i().createElement(i().Fragment,null,i().createElement(l.Form.Item,{name:"data",label:e("Trigger data",{ns:"workflow"}),extra:e("Choose a record or primary key of a record in the collection to trigger.",{ns:"workflow"}),rules:[{required:!0}]},i().createElement(o.TriggerCollectionRecordSelect,null)),i().createElement(l.Form.Item,{name:"userId",label:e("User acted"),initialValue:null,rules:[{required:!0}]},i().createElement(o.WorkflowVariableWrapper,{variableOptions:t,render:function(e){var t=e.value,a=e.onChange;return i().createElement(n.RemoteSelect,{value:t,onChange:a,request:function(){return f(function(){var e,t,n;return p(this,function(a){switch(a.label){case 0:return[4,r.context.api.resource("users").list({pageSize:200})];case 1:return[2,null!=(e=null==(n=a.sent())||null==(t=n.data)?void 0:t.data)?e:[]]}})})()},mapOptions:function(e){var r;return{label:null!=(r=e.nickname)?r:e.id,value:e.id}},cacheKey:"workflow-action-trigger:users"})}})),i().createElement(l.Form.Item,{name:"roleName",label:e("Role of user acted"),initialValue:null},i().createElement(o.WorkflowVariableWrapper,{variableOptions:s,render:function(t){var a=t.value,o=t.onChange;return i().createElement(n.RemoteSelect,{value:a,onChange:o,request:function(){return f(function(){var e,t,n;return p(this,function(a){switch(a.label){case 0:return[4,r.context.api.resource("roles").list({pageSize:200})];case 1:return[2,null!=(e=null==(n=a.sent())||null==(t=n.data)?void 0:t.data)?e:[]]}})})()},mapOptions:function(r){return{label:r.title?e(r.title):r.name,value:r.name}},cacheKey:"workflow-action-trigger:roles"})}})))}}}]);
@@ -6,14 +6,22 @@
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 { SchemaInitializerItemType, useCollectionDataSource } from '@nocobase/client';
10
- import { Trigger, useWorkflowAnyExecuted, CheckboxGroupWithTooltip, RadioWithTooltip, TriggerCollectionRecordSelect, WorkflowVariableWrapper } from '@nocobase/plugin-workflow/client';
9
+ import { useCollectionDataSource } from '@nocobase/client';
10
+ import type { SchemaInitializerItemType } from '@nocobase/client';
11
+ import { CheckboxGroupWithTooltip, RadioWithTooltip, TriggerCollectionRecordSelect, useWorkflowAnyExecuted, WorkflowVariableWrapper } from '@nocobase/plugin-workflow/client';
11
12
  import React from 'react';
12
- import { SubModelItem } from '@nocobase/flow-engine';
13
- declare function useVariables(config: any, options: any): import("@nocobase/plugin-workflow/client").VariableOption[];
14
- export default class extends Trigger {
15
- title: string;
16
- description: string;
13
+ import V2ActionTrigger from '../client-v2/ActionTrigger';
14
+ type WorkflowField = {
15
+ isForeignKey?: boolean;
16
+ type?: string;
17
+ target?: string;
18
+ collectionName?: string;
19
+ name?: string;
20
+ };
21
+ type LegacyActionTriggerConfig = {
22
+ collection?: string;
23
+ };
24
+ export default class ActionTrigger extends V2ActionTrigger {
17
25
  presetFieldset: {
18
26
  collection: {
19
27
  type: string;
@@ -73,10 +81,13 @@ export default class extends Trigger {
73
81
  'x-component': string;
74
82
  'x-component-props': {
75
83
  direction: string;
76
- options: {
84
+ options: ({
77
85
  label: string;
78
- value: string;
79
- }[];
86
+ value: "create";
87
+ } | {
88
+ label: string;
89
+ value: "update";
90
+ })[];
80
91
  };
81
92
  required: boolean;
82
93
  'x-reactions': {
@@ -127,9 +138,9 @@ export default class extends Trigger {
127
138
  nullable: boolean;
128
139
  changeOnSelect: boolean;
129
140
  variableOptions: {
130
- types: ((field: any) => boolean)[];
141
+ types: ((field: WorkflowField) => boolean)[];
131
142
  };
132
- render(props: any): React.JSX.Element;
143
+ render(props: Record<string, unknown>): React.JSX.Element;
133
144
  };
134
145
  default: any;
135
146
  required: boolean;
@@ -143,14 +154,13 @@ export default class extends Trigger {
143
154
  nullable: boolean;
144
155
  changeOnSelect: boolean;
145
156
  variableOptions: {
146
- types: ((field: any) => boolean)[];
157
+ types: ((field: WorkflowField) => boolean)[];
147
158
  };
148
- render(props: any): React.JSX.Element;
159
+ render(props: Record<string, unknown>): React.JSX.Element;
149
160
  };
150
161
  default: any;
151
162
  };
152
163
  };
153
- validate(values: any): any;
154
164
  scope: {
155
165
  useCollectionDataSource: typeof useCollectionDataSource;
156
166
  useWorkflowAnyExecuted: typeof useWorkflowAnyExecuted;
@@ -161,15 +171,6 @@ export default class extends Trigger {
161
171
  TriggerCollectionRecordSelect: typeof TriggerCollectionRecordSelect;
162
172
  WorkflowVariableWrapper: typeof WorkflowVariableWrapper;
163
173
  };
164
- isActionTriggerable_deprecated: (config: any, context: any) => boolean;
165
- actionTriggerableScope: (config: any, scope: any) => boolean;
166
- useVariables: typeof useVariables;
167
- useInitializers(config: any): SchemaInitializerItemType | null;
168
- /**
169
- * 2.0
170
- */
171
- getCreateModelMenuItem({ config }: {
172
- config: any;
173
- }): SubModelItem | null;
174
+ useInitializers(config: LegacyActionTriggerConfig): SchemaInitializerItemType | null;
174
175
  }
175
176
  export {};
@@ -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("react"),require("@nocobase/client"),require("@formily/react"),require("@nocobase/plugin-workflow/client")):"function"==typeof define&&define.amd?define("@nocobase/plugin-workflow-action-trigger",["react-i18next","react","@nocobase/client","@formily/react","@nocobase/plugin-workflow/client"],t):"object"==typeof exports?exports["@nocobase/plugin-workflow-action-trigger"]=t(require("react-i18next"),require("react"),require("@nocobase/client"),require("@formily/react"),require("@nocobase/plugin-workflow/client")):e["@nocobase/plugin-workflow-action-trigger"]=t(e["react-i18next"],e.react,e["@nocobase/client"],e["@formily/react"],e["@nocobase/plugin-workflow/client"])}(self,function(e,t,o,r,n){return function(){"use strict";var i={230:function(e){e.exports=r},342:function(e){e.exports=o},990:function(e){e.exports=n},155:function(e){e.exports=t},953:function(t){t.exports=e}},c={};function a(e){var t=c[e];if(void 0!==t)return t.exports;var o=c[e]={exports:{}};return i[e](o,o.exports,a),o.exports}a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,{a:t}),t},a.d=function(e,t){for(var o in t)a.o(t,o)&&!a.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.g.importScripts&&(l=a.g.location+"");var l,u=a.g.document;if(!l&&u&&(u.currentScript&&"SCRIPT"===u.currentScript.tagName.toUpperCase()&&(l=u.currentScript.src),!l)){var s=u.getElementsByTagName("script");if(s.length)for(var p=s.length-1;p>-1&&(!l||!/^http(s?):/.test(l));)l=s[p--].src}if(!l)throw Error("Automatic publicPath is not supported in this browser");a.p=l.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/");var f={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src&&(e=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")),!e){var o=window.__webpack_public_path__||"";o&&("/"!==o.charAt(o.length-1)&&(o+="/"),e=o+"static/plugins/@nocobase/plugin-workflow-action-trigger/dist/client/")}if(!e){var r=window.__nocobase_modern_client_prefix__||"v",n="/"+(r=String(r).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var i=window.location.pathname||"/",c=i.indexOf(n);e=c>=0?i.slice(0,c+1):"/"}e&&(e=e.replace(RegExp("/"+r+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-workflow-action-trigger/dist/client/"}a.p=e}(),!function(){a.r(f),a.d(f,{default:function(){return _}});var e=a(342),t=a(990),o=a(230),r=a(953),n="workflow-action-trigger";function i(e){var t,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(0,(t=o,(0,r.useTranslation)(n,t)).t)(e)}var c=a(155),l=a.n(c);function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,r=Array(t);o<t;o++)r[o]=e[o];return r}function s(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function p(e){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{},r=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(o).filter(function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable}))),r.forEach(function(t){s(e,t,o[t])})}return e}function b(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 o=Object.getOwnPropertySymbols(e);t.push.apply(t,o)}return t})(Object(t)).forEach(function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(t,o))}),e}function g(e,t){return(g=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function y(e){return function(e){if(Array.isArray(e))return u(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||m(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 m(e,t){if(e){if("string"==typeof e)return u(e,t);var o=Object.prototype.toString.call(e).slice(8,-1);if("Object"===o&&e.constructor&&(o=e.constructor.name),"Map"===o||"Set"===o)return Array.from(o);if("Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return u(e,t)}}function h(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(h=function(){return!!e})()}function v(o,r){var n,c,a=function(e){if(Array.isArray(e))return e}(n=(0,e.parseCollectionName)(o.collection))||function(e){var t,o,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n=[],i=!0,c=!1;try{for(r=r.call(e);!(i=(t=r.next()).done)&&(n.push(t.value),2!==n.length);i=!0);}catch(e){c=!0,o=e}finally{try{i||null==r.return||r.return()}finally{if(c)throw o}}return n}}(n)||m(n,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),l=a[0],u=a[1],s=(0,e.useCompile)(),p=(0,t.useGetDataSourceCollectionManager)(l),f=(0,t.useGetDataSourceCollectionManager)(),g=i("Trigger data"),h=i("User acted"),v=i("Role of user acted");return y((0,t.getCollectionFieldOptions)(b(d({appends:["data"].concat(y((null==(c=o.appends)?void 0:c.map(function(e){return"data.".concat(e)}))||[]))},r),{fields:[{collectionName:u,name:"data",type:"hasOne",target:u,uiSchema:{title:g}}],compile:s,collectionManager:p}))).concat(y((0,t.getCollectionFieldOptions)(b(d({appends:["user"]},r),{fields:[{collectionName:"users",name:"user",type:"hasOne",target:"users",uiSchema:{title:h}},{name:"roleName",uiSchema:{title:v}}],compile:s,collectionManager:f}))))}var w=function(r){var i;if("function"!=typeof r&&null!==r)throw TypeError("Super expression must either be null or a function");function c(){var r,i,a;if(!(this instanceof c))throw TypeError("Cannot call a class as a function");return i=c,a=arguments,i=p(i),s(r=function(e,t){var o;if(t&&("object"==((o=t)&&"u">typeof Symbol&&o.constructor===Symbol?"symbol":typeof o)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,h()?Reflect.construct(i,a||[],p(this).constructor):i.apply(this,a)),"title",'{{t("Post-action event", { ns: "'.concat(n,'" })}}')),s(r,"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: \"".concat(n,'" })}}')),s(r,"presetFieldset",{collection:{type:"string",title:'{{t("Collection", { ns: "'.concat(n,'" })}}'),required:!0,"x-decorator":"FormItem","x-component":"DataSourceCollectionCascader"}}),s(r,"fieldset",{collection:{type:"string",required:!0,"x-decorator":"FormItem","x-decorator-props":{tooltip:'{{t("The collection to which the triggered data belongs.", { ns: "'.concat(n,'" })}}')},"x-component":"DataSourceCollectionCascader","x-disabled":!0,title:'{{t("Collection", { ns: "'.concat(n,'" })}}'),"x-reactions":[{target:"appends",effects:["onFieldValueChange"],fulfill:{state:{value:[]}}}]},global:{type:"boolean",title:'{{t("Trigger mode", { ns: "'.concat(n,'" })}}'),"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: "'.concat(n,'" })}}'),value:!1},{label:'{{t("Global mode, triggered after the completion of the following actions", { ns: "'.concat(n,'" })}}'),value:!0}]},default:!1,"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]},actions:{type:"number",title:'{{t("Select actions", { ns: "'.concat(n,'" })}}'),"x-decorator":"FormItem","x-component":"CheckboxGroupWithTooltip","x-component-props":{direction:"vertical",options:[{label:'{{t("Create record action", { ns: "'.concat(n,'" })}}'),value:"create"},{label:'{{t("Update record action", { ns: "'.concat(n,'" })}}'),value:"update"}]},required:!0,"x-reactions":[{dependencies:["collection","global"],fulfill:{state:{visible:"{{!!$deps[0] && !!$deps[1]}}"}}}]},appends:{type:"array",title:'{{t("Associations to use", { ns: "'.concat(n,'" })}}'),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:function(){var e=(0,o.useForm)().values;return null==e?void 0:e.collection}},"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]}}),s(r,"triggerFieldset",{data:{type:"object",title:'{{t("Trigger data", { ns: "workflow" })}}',description:'{{t("Choose a record or primary key of a record in the collection to trigger.", { ns: "workflow" })}}',"x-decorator":"FormItem","x-component":"TriggerCollectionRecordSelect",default:null,required:!0},userId:{type:"number",title:'{{t("User acted", { ns: "'.concat(n,'" })}}'),"x-decorator":"FormItem","x-component":"WorkflowVariableWrapper","x-component-props":{nullable:!1,changeOnSelect:!0,variableOptions:{types:[function(e){return e.isForeignKey||"context"===e.type?"users"===e.target:"users"===e.collectionName&&"id"===e.name}]},render:function(t){return l().createElement(e.RemoteSelect,d({fieldNames:{label:"nickname",value:"id"},service:{resource:"users"},manual:!1},t))}},default:null,required:!0},roleName:{type:"string",title:'{{t("Role of user acted", { ns: "'.concat(n,'" })}}'),"x-decorator":"FormItem","x-component":"WorkflowVariableWrapper","x-component-props":{nullable:!1,changeOnSelect:!0,variableOptions:{types:[function(e){return e.isForeignKey?"roles"===e.target:"roles"===e.collectionName&&"name"===e.name}]},render:function(t){return l().createElement(e.RemoteSelect,d({fieldNames:{label:"title",value:"name"},service:{resource:"roles"},manual:!1},t))}},default:null}}),s(r,"scope",{useCollectionDataSource:e.useCollectionDataSource,useWorkflowAnyExecuted:t.useWorkflowAnyExecuted}),s(r,"components",{RadioWithTooltip:t.RadioWithTooltip,CheckboxGroupWithTooltip:t.CheckboxGroupWithTooltip,TriggerCollectionRecordSelect:t.TriggerCollectionRecordSelect,WorkflowVariableWrapper:t.WorkflowVariableWrapper}),s(r,"isActionTriggerable_deprecated",function(e,t){return!e.global&&["submit","customize:save","customize:update"].includes(t.buttonAction)}),s(r,"actionTriggerableScope",function(e,t){return!e.global&&["form"].includes(t)}),s(r,"useVariables",v),r}return c.prototype=Object.create(r&&r.prototype,{constructor:{value:c,writable:!0,configurable:!0}}),r&&g(c,r),i=[{key:"validate",value:function(e){return e.collection}},{key:"useInitializers",value:function(e){return e.collection?{name:"triggerData",type:"item",key:"triggerData",title:'{{t("Trigger data", { ns: "'.concat(n,'" })}}'),Component:t.CollectionBlockInitializer,collection:e.collection,dataPath:"$context.data"}:null}},{key:"getCreateModelMenuItem",value:function(e){var t=e.config;return(null==t?void 0:t.collection)?{key:"triggerData",label:'{{t("Trigger data", { ns: "'.concat(n,'" })}}'),useModel:"NodeDetailsModel",createModelOptions:{use:"NodeDetailsModel",stepParams:{resourceSettings:{init:{dataSourceKey:"main",collectionName:t.collection,dataPath:"$context.data"}},cardSettings:{titleDescription:{title:'{{t("Trigger data", { ns: "'.concat(n,'" })}}')}}},subModels:{grid:{use:"NodeDetailsGridModel",subType:"object"}}}}:null}}],function(e,t){for(var o=0;o<t.length;o++){var r=t[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(c.prototype,i),c}(t.Trigger);function O(e,t,o,r,n,i,c){try{var a=e[i](c),l=a.value}catch(e){o(e);return}a.done?t(l):Promise.resolve(l).then(r,n)}function x(e,t,o){return(x=T()?Reflect.construct:function(e,t,o){var r=[null];r.push.apply(r,t);var n=new(Function.bind.apply(e,r));return o&&j(n,o.prototype),n}).apply(null,arguments)}function S(e){return(S=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function j(e,t){return(j=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function k(e){var t="function"==typeof Map?new Map:void 0;return(k=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,o)}function o(){return x(e,arguments,S(this).constructor)}return o.prototype=Object.create(e.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),j(o,e)})(e)}function T(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(T=function(){return!!e})()}var _=function(e){var o;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return e=r,t=arguments,e=S(e),function(e,t){var o;if(t&&("object"==((o=t)&&"u">typeof Symbol&&o.constructor===Symbol?"symbol":typeof o)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,T()?Reflect.construct(e,t||[],S(this).constructor):e.apply(this,t))}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&j(r,e),o=[{key:"load",value:function(){var e;return(e=function(){return function(e,t){var o,r,n,i={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(c,"next",{value:l(0)}),a(c,"throw",{value:l(1)}),a(c,"return",{value:l(2)}),"function"==typeof Symbol&&a(c,Symbol.iterator,{value:function(){return this}}),c;function l(a){return function(l){var u=[a,l];if(o)throw TypeError("Generator is already executing.");for(;c&&(c=0,u[0]&&(i=0)),i;)try{if(o=1,r&&(n=2&u[0]?r.return:u[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,u[1])).done)return n;switch(r=0,n&&(u=[2&u[0],n.value]),u[0]){case 0:case 1:n=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(!(n=(n=i.trys).length>0&&n[n.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!n||u[1]>n[0]&&u[1]<n[3])){i.label=u[1];break}if(6===u[0]&&i.label<n[1]){i.label=n[1],n=u;break}if(n&&i.label<n[2]){i.label=n[2],i.ops.push(u);break}n[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}catch(e){u=[6,e],r=0}finally{o=n=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(e){return this.app.pm.get("workflow").registerTrigger("action",w),this.app.addScopes({useTriggerWorkflowsActionProps:t.useTriggerWorkflowsActionProps,useRecordTriggerWorkflowsActionProps:t.useRecordTriggerWorkflowsActionProps}),[2]})},function(){var t=this,o=arguments;return new Promise(function(r,n){var i=e.apply(t,o);function c(e){O(i,r,n,c,a,"next",e)}function a(e){O(i,r,n,c,a,"throw",e)}c(void 0)})}).call(this)}}],function(e,t){for(var o=0;o<t.length;o++){var r=t[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(r.prototype,o),r}(k(e.Plugin))}(),f}()});
10
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react-i18next"),require("@nocobase/client-v2"),require("react"),require("antd"),require("@nocobase/plugin-workflow/client-v2"),require("@nocobase/client"),require("@formily/react"),require("@nocobase/plugin-workflow/client"),require("@nocobase/flow-engine")):"function"==typeof define&&define.amd?define("@nocobase/plugin-workflow-action-trigger",["react-i18next","@nocobase/client-v2","react","antd","@nocobase/plugin-workflow/client-v2","@nocobase/client","@formily/react","@nocobase/plugin-workflow/client","@nocobase/flow-engine"],t):"object"==typeof exports?exports["@nocobase/plugin-workflow-action-trigger"]=t(require("react-i18next"),require("@nocobase/client-v2"),require("react"),require("antd"),require("@nocobase/plugin-workflow/client-v2"),require("@nocobase/client"),require("@formily/react"),require("@nocobase/plugin-workflow/client"),require("@nocobase/flow-engine")):e["@nocobase/plugin-workflow-action-trigger"]=t(e["react-i18next"],e["@nocobase/client-v2"],e.react,e.antd,e["@nocobase/plugin-workflow/client-v2"],e["@nocobase/client"],e["@formily/react"],e["@nocobase/plugin-workflow/client"],e["@nocobase/flow-engine"])}(self,function(e,t,o,r,n,i,c,a,l){return function(){"use strict";var u,s,f,p={538:function(e,t,o){o.d(t,{A:function(){return m},V:function(){return g}});var r=o(694),n=o(197),i=o(488);function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,r=Array(t);o<t;o++)r[o]=e[o];return r}function a(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function u(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{},r=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(o).filter(function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable}))),r.forEach(function(t){a(e,t,o[t])})}return e}function s(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 o=Object.getOwnPropertySymbols(e);t.push.apply(t,o)}return t})(Object(t)).forEach(function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(t,o))}),e}function f(e,t){return(f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function p(e){return function(e){if(Array.isArray(e))return c(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||d(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 d(e,t){if(e){if("string"==typeof e)return c(e,t);var o=Object.prototype.toString.call(e).slice(8,-1);if("Object"===o&&e.constructor&&(o=e.constructor.name),"Map"===o||"Set"===o)return Array.from(o);if("Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return c(e,t)}}function b(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(b=function(){return!!e})()}var g={CREATE:"create",UPDATE:"update",UPSERT:"updateOrCreate",DESTROY:"destroy"};function y(e,t){var o,c,a=(0,r.useFlowEngine)(),l=(0,i.kj)(),f=function(e){if(Array.isArray(e))return e}(o=(0,n.parseCollectionName)(e.collection))||function(e){var t,o,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n=[],i=!0,c=!1;try{for(r=r.call(e);!(i=(t=r.next()).done)&&(n.push(t.value),2!==n.length);i=!0);}catch(e){c=!0,o=e}finally{try{i||null==r.return||r.return()}finally{if(c)throw o}}return n}}(o)||d(o,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),b=f[0],g=f[1],y=(0,n.getCollectionManagerAdapter)(a.context.dataSourceManager,b),m=(0,n.getCollectionManagerAdapter)(a.context.dataSourceManager);return p((0,n.getCollectionFieldOptions)(s(u({appends:["data"].concat(p((null==(c=e.appends)?void 0:c.map(function(e){return"data.".concat(e)}))||[]))},t),{fields:[{collectionName:g,name:"data",type:"hasOne",target:g,uiSchema:{title:l("Trigger data")}}],compile:l,collectionManager:y}))).concat(p((0,n.getCollectionFieldOptions)(s(u({appends:["user"]},t),{fields:[{collectionName:"users",name:"user",type:"hasOne",target:"users",uiSchema:{title:l("User acted")}},{name:"roleName",uiSchema:{title:l("Role of user acted")}}],compile:l,collectionManager:m}))))}var m=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,n;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return t=r,n=arguments,t=l(t),a(e=function(e,t){var o;if(t&&("object"==((o=t)&&"u">typeof Symbol&&o.constructor===Symbol?"symbol":typeof o)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,b()?Reflect.construct(t,n||[],l(this).constructor):t.apply(this,n)),"title",'{{t("Post-action event", { ns: "'.concat(i.CU,'" })}}')),a(e,"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: \"".concat(i.CU,'" })}}')),a(e,"PresetFieldsetLoader",function(){return o.e("157").then(o.bind(o,316)).then(function(e){return{default:e.ActionTriggerPresetConfig}})}),a(e,"FieldsetLoader",function(){return o.e("157").then(o.bind(o,316))}),a(e,"TriggerFieldsetLoader",function(){return o.e("773").then(o.bind(o,828))}),a(e,"isActionTriggerable_deprecated",function(e,t){return!e.global&&["submit","customize:save","customize:update"].includes(t.buttonAction||"")}),a(e,"actionTriggerableScope",function(e,t){return!e.global&&["form"].includes(t)}),a(e,"useVariables",y),e}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&f(r,e),t=[{key:"validate",value:function(e){return!!e.collection}},{key:"getCreateModelMenuItem",value:function(e){var t=e.config;return(null==t?void 0:t.collection)?{key:"triggerData",label:'{{t("Trigger data", { ns: "'.concat(i.CU,'" })}}'),useModel:"NodeDetailsModel",createModelOptions:{use:"NodeDetailsModel",stepParams:{resourceSettings:{init:{dataSourceKey:"main",collectionName:t.collection,dataPath:"$context.data"}},cardSettings:{titleDescription:{title:'{{t("Trigger data", { ns: "'.concat(i.CU,'" })}}')}}},subModels:{grid:{use:"NodeDetailsGridModel",subType:"object"}}}}:null}},{key:"useTempAssociationSource",value:function(e,t){return(null==e?void 0:e.collection)&&(null==t?void 0:t.id)?{collection:e.collection,nodeId:t.id,nodeKey:"workflow",nodeType:"workflow"}:null}}],function(e,t){for(var o=0;o<t.length;o++){var r=t[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(r.prototype,t),r}(n.Trigger)},488:function(e,t,o){o.d(t,{CU:function(){return n},kj:function(){return i}});var r=o(694),n="workflow-action-trigger";function i(){var e=(0,r.useFlowEngine)();return function(t,o){return e.context.t(t,function(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{},r=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(o).filter(function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable}))),r.forEach(function(t){var r;r=o[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({ns:[n,"@nocobase/plugin-workflow-action-trigger","client"],nsMode:"fallback"},o))}}},230:function(e){e.exports=c},342:function(e){e.exports=i},485:function(e){e.exports=t},694:function(e){e.exports=l},990:function(e){e.exports=a},197:function(e){e.exports=n},59:function(e){e.exports=r},155:function(e){e.exports=o},953:function(t){t.exports=e}},d={};function b(e){var t=d[e];if(void 0!==t)return t.exports;var o=d[e]={exports:{}};return p[e](o,o.exports,b),o.exports}b.m=p,b.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return b.d(t,{a:t}),t},b.d=function(e,t){for(var o in t)b.o(t,o)&&!b.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},b.f={},b.e=function(e){return Promise.all(Object.keys(b.f).reduce(function(t,o){return b.f[o](e,t),t},[]))},b.u=function(e){return""+e+"."+({157:"c7ece32585dad922",773:"19e78394038a00db"})[e]+".js"},b.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),b.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},g={},b.l=function(e,t,o,r){if(g[e])return void g[e].push(t);if(void 0!==o)for(var n,i,c=document.getElementsByTagName("script"),a=0;a<c.length;a++){var l=c[a];if(l.getAttribute("src")==e||l.getAttribute("data-rspack")=="@nocobase/plugin-workflow-action-trigger:"+o){n=l;break}}n||(i=!0,(n=document.createElement("script")).timeout=120,b.nc&&n.setAttribute("nonce",b.nc),n.setAttribute("data-rspack","@nocobase/plugin-workflow-action-trigger:"+o),n.src=e),g[e]=[t];var u=function(t,o){n.onerror=n.onload=null,clearTimeout(s);var r=g[e];if(delete g[e],n.parentNode&&n.parentNode.removeChild(n),r&&r.forEach(function(e){return e(o)}),t)return t(o)},s=setTimeout(u.bind(null,void 0,{type:"timeout",target:n}),12e4);n.onerror=u.bind(null,n.onerror),n.onload=u.bind(null,n.onload),i&&document.head.appendChild(n)},b.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},b.g.importScripts&&(y=b.g.location+"");var g,y,m=b.g.document;if(!y&&m&&(m.currentScript&&"SCRIPT"===m.currentScript.tagName.toUpperCase()&&(y=m.currentScript.src),!y)){var h=m.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");b.p=y.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),u={889:0},b.f.j=function(e,t){var o=b.o(u,e)?u[e]:void 0;if(0!==o)if(o)t.push(o[2]);else{var r=new Promise(function(t,r){o=u[e]=[t,r]});t.push(o[2]=r);var n=b.p+b.u(e),i=Error();b.l(n,function(t){if(b.o(u,e)&&(0!==(o=u[e])&&(u[e]=void 0),o)){var r=t&&("load"===t.type?"missing":t.type),n=t&&t.target&&t.target.src;i.message="Loading chunk "+e+" failed.\n("+r+": "+n+")",i.name="ChunkLoadError",i.type=r,i.request=n,o[1](i)}},"chunk-"+e,e)}},s=function(e,t){var o,r,n=t[0],i=t[1],c=t[2],a=0;if(n.some(function(e){return 0!==u[e]})){for(o in i)b.o(i,o)&&(b.m[o]=i[o]);c&&c(b)}for(e&&e(t);a<n.length;a++)r=n[a],b.o(u,r)&&u[r]&&u[r][0](),u[r]=0},(f=self.webpackChunk_nocobase_plugin_workflow_action_trigger=self.webpackChunk_nocobase_plugin_workflow_action_trigger||[]).forEach(s.bind(null,0)),f.push=s.bind(null,f.push.bind(f));var w={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src){var o=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"");o.indexOf("/static/plugins/@nocobase/plugin-workflow-action-trigger/dist/client/")>=0&&(e=o.replace(/\/[^\/]+$/,"/"))}if(!e){var r=window.__webpack_public_path__||"";r&&("/"!==r.charAt(r.length-1)&&(r+="/"),e=r+"static/plugins/@nocobase/plugin-workflow-action-trigger/dist/client/")}if(!e){var n=window.__nocobase_modern_client_prefix__||"v",i="/"+(n=String(n).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var c=window.location.pathname||"/",a=c.indexOf(i);e=a>=0?c.slice(0,a+1):"/"}e&&(e=e.replace(RegExp("/"+n+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-workflow-action-trigger/dist/client/"}b.p=e}(),!function(){b.r(w),b.d(w,{default:function(){return O}});var e=b(342),t=b(990),o=b(230),r=b(155),n=b.n(r),i=b(538);b(953);var c="workflow-action-trigger";function a(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function u(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{},r=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(o).filter(function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable}))),r.forEach(function(t){a(e,t,o[t])})}return e}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function f(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(f=function(){return!!e})()}var p=function(r){var p;if("function"!=typeof r&&null!==r)throw TypeError("Super expression must either be null or a function");function d(){var r,s,p;if(!(this instanceof d))throw TypeError("Cannot call a class as a function");return s=d,p=arguments,s=l(s),a(r=function(e,t){var o;if(t&&("object"==((o=t)&&"u">typeof Symbol&&o.constructor===Symbol?"symbol":typeof o)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,f()?Reflect.construct(s,p||[],l(this).constructor):s.apply(this,p)),"presetFieldset",{collection:{type:"string",title:'{{t("Collection", { ns: "'.concat(c,'" })}}'),required:!0,"x-decorator":"FormItem","x-component":"DataSourceCollectionCascader"}}),a(r,"fieldset",{collection:{type:"string",required:!0,"x-decorator":"FormItem","x-decorator-props":{tooltip:'{{t("The collection to which the triggered data belongs.", { ns: "'.concat(c,'" })}}')},"x-component":"DataSourceCollectionCascader","x-disabled":!0,title:'{{t("Collection", { ns: "'.concat(c,'" })}}'),"x-reactions":[{target:"appends",effects:["onFieldValueChange"],fulfill:{state:{value:[]}}}]},global:{type:"boolean",title:'{{t("Trigger mode", { ns: "'.concat(c,'" })}}'),"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: "'.concat(c,'" })}}'),value:!1},{label:'{{t("Global mode, triggered after the completion of the following actions", { ns: "'.concat(c,'" })}}'),value:!0}]},default:!1,"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]},actions:{type:"number",title:'{{t("Select actions", { ns: "'.concat(c,'" })}}'),"x-decorator":"FormItem","x-component":"CheckboxGroupWithTooltip","x-component-props":{direction:"vertical",options:[{label:'{{t("Create record action", { ns: "'.concat(c,'" })}}'),value:i.V.CREATE},{label:'{{t("Update record action", { ns: "'.concat(c,'" })}}'),value:i.V.UPDATE}]},required:!0,"x-reactions":[{dependencies:["collection","global"],fulfill:{state:{visible:"{{!!$deps[0] && !!$deps[1]}}"}}}]},appends:{type:"array",title:'{{t("Associations to use", { ns: "'.concat(c,'" })}}'),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:function(){var e=(0,o.useForm)().values;return null==e?void 0:e.collection}},"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]}}),a(r,"triggerFieldset",{data:{type:"object",title:'{{t("Trigger data", { ns: "workflow" })}}',description:'{{t("Choose a record or primary key of a record in the collection to trigger.", { ns: "workflow" })}}',"x-decorator":"FormItem","x-component":"TriggerCollectionRecordSelect",default:null,required:!0},userId:{type:"number",title:'{{t("User acted", { ns: "'.concat(c,'" })}}'),"x-decorator":"FormItem","x-component":"WorkflowVariableWrapper","x-component-props":{nullable:!1,changeOnSelect:!0,variableOptions:{types:[function(e){return e.isForeignKey||"context"===e.type?"users"===e.target:"users"===e.collectionName&&"id"===e.name}]},render:function(t){return n().createElement(e.RemoteSelect,u({fieldNames:{label:"nickname",value:"id"},service:{resource:"users"},manual:!1},t))}},default:null,required:!0},roleName:{type:"string",title:'{{t("Role of user acted", { ns: "'.concat(c,'" })}}'),"x-decorator":"FormItem","x-component":"WorkflowVariableWrapper","x-component-props":{nullable:!1,changeOnSelect:!0,variableOptions:{types:[function(e){return e.isForeignKey?"roles"===e.target:"roles"===e.collectionName&&"name"===e.name}]},render:function(t){return n().createElement(e.RemoteSelect,u({fieldNames:{label:"title",value:"name"},service:{resource:"roles"},manual:!1},t))}},default:null}}),a(r,"scope",{useCollectionDataSource:e.useCollectionDataSource,useWorkflowAnyExecuted:t.useWorkflowAnyExecuted}),a(r,"components",{RadioWithTooltip:t.RadioWithTooltip,CheckboxGroupWithTooltip:t.CheckboxGroupWithTooltip,TriggerCollectionRecordSelect:t.TriggerCollectionRecordSelect,WorkflowVariableWrapper:t.WorkflowVariableWrapper}),r}return d.prototype=Object.create(r&&r.prototype,{constructor:{value:d,writable:!0,configurable:!0}}),r&&s(d,r),p=[{key:"useInitializers",value:function(e){return e.collection?{name:"triggerData",type:"item",key:"triggerData",title:'{{t("Trigger data", { ns: "'.concat(c,'" })}}'),Component:t.CollectionBlockInitializer,collection:e.collection,dataPath:"$context.data"}:null}}],function(e,t){for(var o=0;o<t.length;o++){var r=t[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(d.prototype,p),d}(i.A);function d(e,t,o,r,n,i,c){try{var a=e[i](c),l=a.value}catch(e){o(e);return}a.done?t(l):Promise.resolve(l).then(r,n)}function g(e,t,o){return(g=v()?Reflect.construct:function(e,t,o){var r=[null];r.push.apply(r,t);var n=new(Function.bind.apply(e,r));return o&&m(n,o.prototype),n}).apply(null,arguments)}function y(e){return(y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function m(e,t){return(m=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function h(e){var t="function"==typeof Map?new Map:void 0;return(h=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,o)}function o(){return g(e,arguments,y(this).constructor)}return o.prototype=Object.create(e.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),m(o,e)})(e)}function v(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(v=function(){return!!e})()}var O=function(e){var o;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return e=r,t=arguments,e=y(e),function(e,t){var o;if(t&&("object"==((o=t)&&"u">typeof Symbol&&o.constructor===Symbol?"symbol":typeof o)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,v()?Reflect.construct(e,t||[],y(this).constructor):e.apply(this,t))}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&m(r,e),o=[{key:"load",value:function(){var e;return(e=function(){return function(e,t){var o,r,n,i={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(c,"next",{value:l(0)}),a(c,"throw",{value:l(1)}),a(c,"return",{value:l(2)}),"function"==typeof Symbol&&a(c,Symbol.iterator,{value:function(){return this}}),c;function l(a){return function(l){var u=[a,l];if(o)throw TypeError("Generator is already executing.");for(;c&&(c=0,u[0]&&(i=0)),i;)try{if(o=1,r&&(n=2&u[0]?r.return:u[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,u[1])).done)return n;switch(r=0,n&&(u=[2&u[0],n.value]),u[0]){case 0:case 1:n=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(!(n=(n=i.trys).length>0&&n[n.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!n||u[1]>n[0]&&u[1]<n[3])){i.label=u[1];break}if(6===u[0]&&i.label<n[1]){i.label=n[1],n=u;break}if(n&&i.label<n[2]){i.label=n[2],i.ops.push(u);break}n[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}catch(e){u=[6,e],r=0}finally{o=n=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(e){return this.app.pm.get("workflow").registerTrigger("action",p),this.app.addScopes({useTriggerWorkflowsActionProps:t.useTriggerWorkflowsActionProps,useRecordTriggerWorkflowsActionProps:t.useRecordTriggerWorkflowsActionProps}),[2]})},function(){var t=this,o=arguments;return new Promise(function(r,n){var i=e.apply(t,o);function c(e){d(i,r,n,c,a,"next",e)}function a(e){d(i,r,n,c,a,"throw",e)}c(void 0)})}).call(this)}}],function(e,t){for(var o=0;o<t.length;o++){var r=t[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(r.prototype,o),r}(h(e.Plugin))}(),w}()});
@@ -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_action_trigger_client_v2=self.webpackChunk_nocobase_plugin_workflow_action_trigger_client_v2||[]).push([["157"],{316:function(e,t,n){n.r(t),n.d(t,{ActionTriggerPresetConfig:function(){return u},default:function(){return s}});var l=n(197),o=n(59),r=n(155),a=n.n(r),c=n(538),i=n(488);function u(){var e=(0,i.kj)();return a().createElement(o.Form.Item,{name:["config","collection"],label:e("Collection"),rules:[{required:!0}]},a().createElement(l.CollectionCascader,null))}function s(){var e=(0,i.kj)(),t=o.Form.useFormInstance(),n=o.Form.useWatch(["config","collection"]),u=o.Form.useWatch(["config","global"]),s=(0,r.useRef)(n),m=(0,r.useRef)(!1);(0,r.useEffect)(function(){if(!m.current){m.current=!0,s.current=n;return}s.current!==n&&t.setFieldValue(["config","appends"],[]),s.current=n},[n,t]);var f=(0,r.useMemo)(function(){return[{label:e("Create record action"),value:c.V.CREATE},{label:e("Update record action"),value:c.V.UPDATE}]},[e]);return a().createElement("fieldset",null,a().createElement(o.Form.Item,{name:["config","collection"],label:e("Collection"),tooltip:e("The collection to which the triggered data belongs."),rules:[{required:!0}]},a().createElement(l.CollectionCascader,{disabled:!0})),n?a().createElement(o.Form.Item,{name:["config","global"],label:e("Trigger mode"),initialValue:!1},a().createElement(o.Radio.Group,null,a().createElement(o.Space,{direction:"vertical"},a().createElement(o.Radio,{value:!1},e("Local mode, triggered after the completion of actions bound to this workflow")),a().createElement(o.Radio,{value:!0},e("Global mode, triggered after the completion of the following actions"))))):null,n&&u?a().createElement(o.Form.Item,{name:["config","actions"],label:e("Select actions"),rules:[{required:!0}]},a().createElement(o.Checkbox.Group,null,a().createElement(o.Space,{direction:"vertical"},f.map(function(e){return a().createElement(o.Checkbox,{key:e.value,value:e.value},e.label)})))):null,n?a().createElement(o.Form.Item,{name:["config","appends"],label:e("Associations to use"),extra:e("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"})},a().createElement(l.AppendsSelect,{collection:n})):null)}}}]);
@@ -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_action_trigger_client_v2=self.webpackChunk_nocobase_plugin_workflow_action_trigger_client_v2||[]).push([["773"],{828:function(e,r,t){t.r(r),t.d(r,{default:function(){return m}});var n=t(485),a=t(694),o=t(197),l=t(59),u=t(155),i=t.n(u),c=t(488);function s(e,r,t,n,a,o,l){try{var u=e[o](l),i=u.value}catch(e){t(e);return}u.done?r(i):Promise.resolve(i).then(n,a)}function f(e){return function(){var r=this,t=arguments;return new Promise(function(n,a){var o=e.apply(r,t);function l(e){s(o,n,a,l,u,"next",e)}function u(e){s(o,n,a,l,u,"throw",e)}l(void 0)})}}function p(e,r){var t,n,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(l,"next",{value:i(0)}),u(l,"throw",{value:i(1)}),u(l,"return",{value:i(2)}),"function"==typeof Symbol&&u(l,Symbol.iterator,{value:function(){return this}}),l;function i(u){return function(i){var c=[u,i];if(t)throw TypeError("Generator is already executing.");for(;l&&(l=0,c[0]&&(o=0)),o;)try{if(t=1,n&&(a=2&c[0]?n.return:c[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,c[1])).done)return a;switch(n=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,n=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(6===c[0]&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=r.call(e,o)}catch(e){c=[6,e],n=0}finally{t=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}function m(){var e=(0,c.kj)(),r=(0,a.useFlowEngine)(),t=(0,u.useMemo)(function(){return{types:[function(e){return e.isForeignKey||"context"===e.type?"users"===e.target:"users"===e.collectionName&&"id"===e.name}]}},[]),s=(0,u.useMemo)(function(){return{types:[function(e){return e.isForeignKey?"roles"===e.target:"roles"===e.collectionName&&"name"===e.name}]}},[]);return i().createElement(i().Fragment,null,i().createElement(l.Form.Item,{name:"data",label:e("Trigger data",{ns:"workflow"}),extra:e("Choose a record or primary key of a record in the collection to trigger.",{ns:"workflow"}),rules:[{required:!0}]},i().createElement(o.TriggerCollectionRecordSelect,null)),i().createElement(l.Form.Item,{name:"userId",label:e("User acted"),initialValue:null,rules:[{required:!0}]},i().createElement(o.WorkflowVariableWrapper,{variableOptions:t,render:function(e){var t=e.value,a=e.onChange;return i().createElement(n.RemoteSelect,{value:t,onChange:a,request:function(){return f(function(){var e,t,n;return p(this,function(a){switch(a.label){case 0:return[4,r.context.api.resource("users").list({pageSize:200})];case 1:return[2,null!=(e=null==(n=a.sent())||null==(t=n.data)?void 0:t.data)?e:[]]}})})()},mapOptions:function(e){var r;return{label:null!=(r=e.nickname)?r:e.id,value:e.id}},cacheKey:"workflow-action-trigger:users"})}})),i().createElement(l.Form.Item,{name:"roleName",label:e("Role of user acted"),initialValue:null},i().createElement(o.WorkflowVariableWrapper,{variableOptions:s,render:function(t){var a=t.value,o=t.onChange;return i().createElement(n.RemoteSelect,{value:a,onChange:o,request:function(){return f(function(){var e,t,n;return p(this,function(a){switch(a.label){case 0:return[4,r.context.api.resource("roles").list({pageSize:200})];case 1:return[2,null!=(e=null==(n=a.sent())||null==(t=n.data)?void 0:t.data)?e:[]]}})})()},mapOptions:function(r){return{label:r.title?e(r.title):r.name,value:r.name}},cacheKey:"workflow-action-trigger:roles"})}})))}}}]);
@@ -0,0 +1,42 @@
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 { type SubModelItem } from '@nocobase/flow-engine';
10
+ import { Trigger, type TriggerLoaderOf, type UseVariableOptions, type VariableOption } from '@nocobase/plugin-workflow/client-v2';
11
+ export declare const COLLECTION_TRIGGER_ACTION: {
12
+ readonly CREATE: "create";
13
+ readonly UPDATE: "update";
14
+ readonly UPSERT: "updateOrCreate";
15
+ readonly DESTROY: "destroy";
16
+ };
17
+ declare function useActionTriggerVariables(config: Record<string, unknown>, options?: UseVariableOptions): VariableOption[];
18
+ export default class ActionTrigger extends Trigger {
19
+ title: string;
20
+ description: string;
21
+ PresetFieldsetLoader: TriggerLoaderOf;
22
+ FieldsetLoader: TriggerLoaderOf;
23
+ TriggerFieldsetLoader: TriggerLoaderOf;
24
+ validate(config: Record<string, unknown>): boolean;
25
+ isActionTriggerable_deprecated: (config: Record<string, unknown>, context: {
26
+ buttonAction?: string;
27
+ }) => boolean;
28
+ actionTriggerableScope: (config: Record<string, unknown>, scope: string) => boolean;
29
+ useVariables: typeof useActionTriggerVariables;
30
+ getCreateModelMenuItem({ config }: {
31
+ config: Record<string, unknown>;
32
+ }): SubModelItem | null;
33
+ useTempAssociationSource(config: Record<string, unknown>, workflow?: {
34
+ id?: string | number;
35
+ }): {
36
+ collection: string;
37
+ nodeId: string | number;
38
+ nodeKey: string;
39
+ nodeType: "workflow";
40
+ };
41
+ }
42
+ export {};
@@ -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
+ import React from 'react';
10
+ export declare function ActionTriggerPresetConfig(): React.JSX.Element;
11
+ export default function ActionTriggerConfig(): React.JSX.Element;
@@ -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
+ import React from 'react';
10
+ export default function TriggerActionConfig(): React.JSX.Element;
@@ -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
+ export { default } from './plugin';
10
+ export { default as ActionTrigger } from './ActionTrigger';
@@ -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("@nocobase/client-v2"),require("react"),require("antd"),require("@nocobase/plugin-workflow/client-v2"),require("@nocobase/flow-engine")):"function"==typeof define&&define.amd?define("@nocobase/plugin-workflow-action-trigger/client-v2",["@nocobase/client-v2","react","antd","@nocobase/plugin-workflow/client-v2","@nocobase/flow-engine"],t):"object"==typeof exports?exports["@nocobase/plugin-workflow-action-trigger/client-v2"]=t(require("@nocobase/client-v2"),require("react"),require("antd"),require("@nocobase/plugin-workflow/client-v2"),require("@nocobase/flow-engine")):e["@nocobase/plugin-workflow-action-trigger/client-v2"]=t(e["@nocobase/client-v2"],e.react,e.antd,e["@nocobase/plugin-workflow/client-v2"],e["@nocobase/flow-engine"])}(self,function(e,t,r,n,o){return function(){"use strict";var i,c,a,u={538:function(e,t,r){r.d(t,{A:function(){return v},V:function(){return g}});var n=r(694),o=r(197),i=r(488);function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function l(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){a(e,t,r[t])})}return e}function f(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 r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function p(e){return function(e){if(Array.isArray(e))return c(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||b(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 b(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return c(e,t)}}function d(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(d=function(){return!!e})()}var g={CREATE:"create",UPDATE:"update",UPSERT:"updateOrCreate",DESTROY:"destroy"};function y(e,t){var r,c,a=(0,n.useFlowEngine)(),u=(0,i.kj)(),s=function(e){if(Array.isArray(e))return e}(r=(0,o.parseCollectionName)(e.collection))||function(e){var t,r,n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o=[],i=!0,c=!1;try{for(n=n.call(e);!(i=(t=n.next()).done)&&(o.push(t.value),2!==o.length);i=!0);}catch(e){c=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(c)throw r}}return o}}(r)||b(r,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),d=s[0],g=s[1],y=(0,o.getCollectionManagerAdapter)(a.context.dataSourceManager,d),v=(0,o.getCollectionManagerAdapter)(a.context.dataSourceManager);return p((0,o.getCollectionFieldOptions)(f(l({appends:["data"].concat(p((null==(c=e.appends)?void 0:c.map(function(e){return"data.".concat(e)}))||[]))},t),{fields:[{collectionName:g,name:"data",type:"hasOne",target:g,uiSchema:{title:u("Trigger data")}}],compile:u,collectionManager:y}))).concat(p((0,o.getCollectionFieldOptions)(f(l({appends:["user"]},t),{fields:[{collectionName:"users",name:"user",type:"hasOne",target:"users",uiSchema:{title:u("User acted")}},{name:"roleName",uiSchema:{title:u("Role of user acted")}}],compile:u,collectionManager:v}))))}var v=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,o;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return t=n,o=arguments,t=u(t),a(e=function(e,t){var r;if(t&&("object"==((r=t)&&"u">typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,d()?Reflect.construct(t,o||[],u(this).constructor):t.apply(this,o)),"title",'{{t("Post-action event", { ns: "'.concat(i.CU,'" })}}')),a(e,"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: \"".concat(i.CU,'" })}}')),a(e,"PresetFieldsetLoader",function(){return r.e("157").then(r.bind(r,316)).then(function(e){return{default:e.ActionTriggerPresetConfig}})}),a(e,"FieldsetLoader",function(){return r.e("157").then(r.bind(r,316))}),a(e,"TriggerFieldsetLoader",function(){return r.e("773").then(r.bind(r,828))}),a(e,"isActionTriggerable_deprecated",function(e,t){return!e.global&&["submit","customize:save","customize:update"].includes(t.buttonAction||"")}),a(e,"actionTriggerableScope",function(e,t){return!e.global&&["form"].includes(t)}),a(e,"useVariables",y),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&s(n,e),t=[{key:"validate",value:function(e){return!!e.collection}},{key:"getCreateModelMenuItem",value:function(e){var t=e.config;return(null==t?void 0:t.collection)?{key:"triggerData",label:'{{t("Trigger data", { ns: "'.concat(i.CU,'" })}}'),useModel:"NodeDetailsModel",createModelOptions:{use:"NodeDetailsModel",stepParams:{resourceSettings:{init:{dataSourceKey:"main",collectionName:t.collection,dataPath:"$context.data"}},cardSettings:{titleDescription:{title:'{{t("Trigger data", { ns: "'.concat(i.CU,'" })}}')}}},subModels:{grid:{use:"NodeDetailsGridModel",subType:"object"}}}}:null}},{key:"useTempAssociationSource",value:function(e,t){return(null==e?void 0:e.collection)&&(null==t?void 0:t.id)?{collection:e.collection,nodeId:t.id,nodeKey:"workflow",nodeType:"workflow"}:null}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(n.prototype,t),n}(o.Trigger)},488:function(e,t,r){r.d(t,{CU:function(){return o},kj:function(){return i}});var n=r(694),o="workflow-action-trigger";function i(){var e=(0,n.useFlowEngine)();return function(t,r){return e.context.t(t,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}({ns:[o,"@nocobase/plugin-workflow-action-trigger","client"],nsMode:"fallback"},r))}}},485:function(t){t.exports=e},694:function(e){e.exports=o},197:function(e){e.exports=n},59:function(e){e.exports=r},155:function(e){e.exports=t}},l={};function f(e){var t=l[e];if(void 0!==t)return t.exports;var r=l[e]={exports:{}};return u[e](r,r.exports,f),r.exports}f.m=u,f.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(t,{a:t}),t},f.d=function(e,t){for(var r in t)f.o(t,r)&&!f.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},f.f={},f.e=function(e){return Promise.all(Object.keys(f.f).reduce(function(t,r){return f.f[r](e,t),t},[]))},f.u=function(e){return""+e+"."+({157:"99e753b72c7165c9",773:"0e6933fabf037ccd"})[e]+".js"},f.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),f.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s={},f.l=function(e,t,r,n){if(s[e])return void s[e].push(t);if(void 0!==r)for(var o,i,c=document.getElementsByTagName("script"),a=0;a<c.length;a++){var u=c[a];if(u.getAttribute("src")==e||u.getAttribute("data-rspack")=="@nocobase/plugin-workflow-action-trigger/client-v2:"+r){o=u;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,f.nc&&o.setAttribute("nonce",f.nc),o.setAttribute("data-rspack","@nocobase/plugin-workflow-action-trigger/client-v2:"+r),o.src=e),s[e]=[t];var l=function(t,r){o.onerror=o.onload=null,clearTimeout(p);var n=s[e];if(delete s[e],o.parentNode&&o.parentNode.removeChild(o),n&&n.forEach(function(e){return e(r)}),t)return t(r)},p=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)},f.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.g.importScripts&&(p=f.g.location+"");var s,p,b=f.g.document;if(!p&&b&&(b.currentScript&&"SCRIPT"===b.currentScript.tagName.toUpperCase()&&(p=b.currentScript.src),!p)){var d=b.getElementsByTagName("script");if(d.length)for(var g=d.length-1;g>-1&&(!p||!/^http(s?):/.test(p));)p=d[g--].src}if(!p)throw Error("Automatic publicPath is not supported in this browser");f.p=p.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),i={889:0},f.f.j=function(e,t){var r=f.o(i,e)?i[e]:void 0;if(0!==r)if(r)t.push(r[2]);else{var n=new Promise(function(t,n){r=i[e]=[t,n]});t.push(r[2]=n);var o=f.p+f.u(e),c=Error();f.l(o,function(t){if(f.o(i,e)&&(0!==(r=i[e])&&(i[e]=void 0),r)){var n=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;c.message="Loading chunk "+e+" failed.\n("+n+": "+o+")",c.name="ChunkLoadError",c.type=n,c.request=o,r[1](c)}},"chunk-"+e,e)}},c=function(e,t){var r,n,o=t[0],c=t[1],a=t[2],u=0;if(o.some(function(e){return 0!==i[e]})){for(r in c)f.o(c,r)&&(f.m[r]=c[r]);a&&a(f)}for(e&&e(t);u<o.length;u++)n=o[u],f.o(i,n)&&i[n]&&i[n][0](),i[n]=0},(a=self.webpackChunk_nocobase_plugin_workflow_action_trigger_client_v2=self.webpackChunk_nocobase_plugin_workflow_action_trigger_client_v2||[]).forEach(c.bind(null,0)),a.push=c.bind(null,a.push.bind(a));var y={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src){var r=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"");r.indexOf("/static/plugins/@nocobase/plugin-workflow-action-trigger/dist/client-v2/")>=0&&(e=r.replace(/\/[^\/]+$/,"/"))}if(!e){var n=window.__webpack_public_path__||"";n&&("/"!==n.charAt(n.length-1)&&(n+="/"),e=n+"static/plugins/@nocobase/plugin-workflow-action-trigger/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 c=window.location.pathname||"/",a=c.indexOf(i);e=a>=0?c.slice(0,a+1):"/"}e&&(e=e.replace(RegExp("/"+o+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-workflow-action-trigger/dist/client-v2/"}f.p=e}(),!function(){f.r(y),f.d(y,{ActionTrigger:function(){return t.A},default:function(){return u}});var e=f(485),t=f(538);function r(e,t,r,n,o,i,c){try{var a=e[i](c),u=a.value}catch(e){r(e);return}a.done?t(u):Promise.resolve(u).then(n,o)}function n(e,t,r){return(n=a()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&i(o,r.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 c(e){var t="function"==typeof Map?new Map:void 0;return(c=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,r)}function r(){return n(e,arguments,o(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),i(r,e)})(e)}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}var u=function(e){var n;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function c(){var e,t;if(!(this instanceof c))throw TypeError("Cannot call a class as a function");return e=c,t=arguments,e=o(e),function(e,t){var r;if(t&&("object"==((r=t)&&"u">typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"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||[],o(this).constructor):e.apply(this,t))}return c.prototype=Object.create(e&&e.prototype,{constructor:{value:c,writable:!0,configurable:!0}}),e&&i(c,e),n=[{key:"load",value:function(){var e;return(e=function(){return function(e,t){var r,n,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(c,"next",{value:u(0)}),a(c,"throw",{value:u(1)}),a(c,"return",{value:u(2)}),"function"==typeof Symbol&&a(c,Symbol.iterator,{value:function(){return this}}),c;function u(a){return function(u){var l=[a,u];if(r)throw TypeError("Generator is already executing.");for(;c&&(c=0,l[0]&&(i=0)),i;)try{if(r=1,n&&(o=2&l[0]?n.return:l[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,l[1])).done)return o;switch(n=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++,n=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],n=0}finally{r=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(e){return this.app.pm.get("workflow").registerTrigger("action",t.A),[2]})},function(){var t=this,n=arguments;return new Promise(function(o,i){var c=e.apply(t,n);function a(e){r(c,o,i,a,u,"next",e)}function u(e){r(c,o,i,a,u,"throw",e)}a(void 0)})}).call(this)}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(c.prototype,n),c}(c(e.Plugin))}(),y}()});
@@ -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-action-trigger";
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,12 @@
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 default class PluginWorkflowActionTriggerClientV2 extends Plugin<unknown, Application> {
11
+ load(): Promise<void>;
12
+ }
@@ -9,19 +9,21 @@
9
9
 
10
10
  module.exports = {
11
11
  "@formily/react": "2.3.7",
12
- "@nocobase/client": "2.2.0-alpha.1",
13
- "@nocobase/plugin-workflow": "2.2.0-alpha.1",
12
+ "@nocobase/client": "2.2.0-alpha.3",
13
+ "@nocobase/plugin-workflow": "2.2.0-alpha.3",
14
14
  "react": "18.2.0",
15
- "@nocobase/flow-engine": "2.2.0-alpha.1",
15
+ "@nocobase/flow-engine": "2.2.0-alpha.3",
16
+ "antd": "5.24.2",
17
+ "@nocobase/client-v2": "2.2.0-alpha.3",
16
18
  "react-i18next": "11.18.6",
17
19
  "lodash": "4.18.1",
18
20
  "sequelize": "6.35.2",
19
- "@nocobase/database": "2.2.0-alpha.1",
20
- "@nocobase/server": "2.2.0-alpha.1",
21
- "@nocobase/actions": "2.2.0-alpha.1",
22
- "@nocobase/plugin-error-handler": "2.2.0-alpha.1",
23
- "@nocobase/data-source-manager": "2.2.0-alpha.1",
24
- "@nocobase/plugin-workflow-test": "2.2.0-alpha.1",
25
- "@nocobase/test": "2.2.0-alpha.1",
26
- "@nocobase/utils": "2.2.0-alpha.1"
21
+ "@nocobase/database": "2.2.0-alpha.3",
22
+ "@nocobase/server": "2.2.0-alpha.3",
23
+ "@nocobase/actions": "2.2.0-alpha.3",
24
+ "@nocobase/plugin-error-handler": "2.2.0-alpha.3",
25
+ "@nocobase/data-source-manager": "2.2.0-alpha.3",
26
+ "@nocobase/plugin-workflow-test": "2.2.0-alpha.3",
27
+ "@nocobase/test": "2.2.0-alpha.3",
28
+ "@nocobase/utils": "2.2.0-alpha.3"
27
29
  };
@@ -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-10T18:13:23.185Z"}
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-27T03:57:19.804Z"}
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "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.",
7
7
  "description.ru-RU": "Срабатывает после завершения запроса, инициированного кнопкой действия или API, например после добавления, обновления, удаления данных или «отправки в рабочий процесс». Подходит для обработки данных, отправки уведомлений и т.д. после выполнения действий.",
8
8
  "description.zh-CN": "通过操作按钮或 API 发起请求并在执行完成后触发,比如新增、更新、删除数据或者“提交至工作流”之后。适用于在操作完成后进行数据处理、发送通知等。",
9
- "version": "2.2.0-alpha.1",
9
+ "version": "2.2.0-alpha.3",
10
10
  "license": "Apache-2.0",
11
11
  "main": "./dist/server/index.js",
12
12
  "homepage": "https://docs.nocobase.com/plugins/workflow-action-trigger",
@@ -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/plugin-error-handler": "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": "303663aba6c6eefa27e6a6435b4c0352074ec40f",
30
+ "gitHead": "e3ec19361fd7981af9fe2a7f24ad335025cbefcd",
30
31
  "keywords": [
31
32
  "Workflow"
32
33
  ]