@nocobase/plugin-workflow-custom-action-trigger 2.1.0-beta.6 → 2.1.0-beta.8

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.
@@ -16,8 +16,8 @@
16
16
  */
17
17
  import React from 'react';
18
18
  import { SchemaInitializerItemType, useCollectionDataSource } from '@nocobase/client';
19
- import { Trigger, TriggerCollectionRecordSelect, WorkflowVariableWrapper, RadioWithTooltip, useWorkflowAnyExecuted } from '@nocobase/plugin-workflow/client';
20
- import { TriggerScopeProvider } from './components';
19
+ import { Trigger, TriggerCollectionRecordSelect, WorkflowVariableWrapper, WorkflowVariableJSON, RadioWithTooltip, useWorkflowAnyExecuted } from '@nocobase/plugin-workflow/client';
20
+ import { TriggerDataInput, TriggerScopeProvider } from './components';
21
21
  import { SubModelItem } from '@nocobase/flow-engine';
22
22
  declare function useVariables(config: any, options: any): import("@nocobase/plugin-workflow/client").VariableOption[];
23
23
  export default class extends Trigger {
@@ -31,6 +31,7 @@ export default class extends Trigger {
31
31
  'x-decorator': string;
32
32
  'x-component': string;
33
33
  'x-component-props': {
34
+ direction: string;
34
35
  options: {
35
36
  label: string;
36
37
  value: number;
@@ -104,7 +105,6 @@ export default class extends Trigger {
104
105
  'x-decorator': string;
105
106
  'x-component': string;
106
107
  default: any;
107
- required: boolean;
108
108
  };
109
109
  };
110
110
  };
@@ -169,8 +169,10 @@ export default class extends Trigger {
169
169
  };
170
170
  components: {
171
171
  TriggerScopeProvider: typeof TriggerScopeProvider;
172
+ TriggerDataInput: typeof TriggerDataInput;
172
173
  TriggerCollectionRecordSelect: typeof TriggerCollectionRecordSelect;
173
174
  WorkflowVariableWrapper: typeof WorkflowVariableWrapper;
175
+ WorkflowVariableJSON: typeof WorkflowVariableJSON;
174
176
  RadioWithTooltip: typeof RadioWithTooltip;
175
177
  };
176
178
  isActionTriggerable_deprecated: (config: any, context: any) => boolean;
@@ -8,4 +8,19 @@
8
8
  */
9
9
  import React from 'react';
10
10
  export declare function TriggerScopeProvider(props: any): any;
11
+ export declare function TriggerDataInput(props: any): React.JSX.Element;
11
12
  export declare function GlobalTriggerWorkflowAction(props: any): React.JSX.Element;
13
+ /**
14
+ * JSON input with flow-engine variable support.
15
+ * Inserts {{ ctx.xxx }} expressions; resolved via resolveExpressions at trigger time.
16
+ */
17
+ export declare function ContextDataJsonInput({ value, onChange, ...props }: {
18
+ [x: string]: any;
19
+ value: any;
20
+ onChange: any;
21
+ }): React.JSX.Element;
22
+ /**
23
+ * JSON input with variable reference support for global trigger context data (traditional/hook-based path).
24
+ * Variables (e.g. {{$user.id}}) are resolved at click time in the hook.
25
+ */
26
+ export declare function GlobalContextDataInput(props: any): React.JSX.Element;
@@ -23,3 +23,6 @@ export declare class CollectionGlobalTriggerWorkflowActionModel extends ActionMo
23
23
  static scene: import("@nocobase/client").ActionSceneType;
24
24
  defaultProps: ButtonProps;
25
25
  }
26
+ export declare class WorkbenchTriggerWorkflowActionModel extends ActionModel {
27
+ defaultProps: ButtonProps;
28
+ }
@@ -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("@nocobase/client"),require("react-router-dom"),require("@nocobase/plugin-workflow/client"),require("@formily/antd-v5"),require("react"),require("@nocobase/flow-engine"),require("@formily/react"),require("@nocobase/utils/client"),require("antd"),require("react-i18next")):"function"==typeof define&&define.amd?define("@nocobase/plugin-workflow-custom-action-trigger",["@nocobase/client","react-router-dom","@nocobase/plugin-workflow/client","@formily/antd-v5","react","@nocobase/flow-engine","@formily/react","@nocobase/utils/client","antd","react-i18next"],t):"object"==typeof exports?exports["@nocobase/plugin-workflow-custom-action-trigger"]=t(require("@nocobase/client"),require("react-router-dom"),require("@nocobase/plugin-workflow/client"),require("@formily/antd-v5"),require("react"),require("@nocobase/flow-engine"),require("@formily/react"),require("@nocobase/utils/client"),require("antd"),require("react-i18next")):e["@nocobase/plugin-workflow-custom-action-trigger"]=t(e["@nocobase/client"],e["react-router-dom"],e["@nocobase/plugin-workflow/client"],e["@formily/antd-v5"],e.react,e["@nocobase/flow-engine"],e["@formily/react"],e["@nocobase/utils/client"],e.antd,e["react-i18next"])}(self,function(e,t,r,o,n,i,c,a,l,s){return function(){"use strict";var u={632:function(e){e.exports=o},505:function(e){e.exports=c},772:function(t){t.exports=e},667:function(e){e.exports=i},433:function(e){e.exports=r},584:function(e){e.exports=a},721:function(e){e.exports=l},156:function(e){e.exports=n},238:function(e){e.exports=s},128:function(e){e.exports=t}},f={};function p(e){var t=f[e];if(void 0!==t)return t.exports;var r=f[e]={exports:{}};return u[e](r,r.exports,p),r.exports}p.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return p.d(t,{a:t}),t},p.d=function(e,t){for(var r in t)p.o(t,r)&&!p.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},p.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},p.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var g={};return!function(){p.r(g),p.d(g,{default:function(){return ex}});var e=p(772),t=p(667),r=p(433),o=p(156),n=p.n(o),i="@nocobase/plugin-workflow-custom-action-trigger",c="custom-action",a={GLOBAL:0,SINGLE_RECORD:1,MULTIPLE_RECORDS:2},l=[{label:"{{t('None', { ns: \"".concat(i,'" })}}'),value:a.GLOBAL,tooltip:"{{t('Could be used on non-record related action buttons. Such as buttons in workbench panel or in table blocks.', { ns: \"".concat(i,'" })}}')},{label:"{{t('Single collection record', { ns: \"".concat(i,'" })}}'),value:a.SINGLE_RECORD,tooltip:"{{t('Could only be used on single record related action buttons. Such as in form, detail block and table row of record.', { ns: \"".concat(i,'" })}}')},{label:"{{t('Multiple collection records', { ns: \"".concat(i,'" })}}'),value:a.MULTIPLE_RECORDS,tooltip:"{{t('Could only be used on multiple record related action buttons. Such as for batch action in table block. The data in trigger variable will be an array.', { ns: \"".concat(i,'" })}}')}];function s(e,t,r,o,n,i,c){try{var a=e[i](c),l=a.value}catch(e){r(e);return}a.done?t(l):Promise.resolve(l).then(o,n)}function u(e){return function(){var t=this,r=arguments;return new Promise(function(o,n){var i=e.apply(t,r);function c(e){s(i,o,n,c,a,"next",e)}function a(e){s(i,o,n,c,a,"throw",e)}c(void 0)})}}function f(e,t,r){return t=y(t),function(e,t){var r;if(t&&("object"==((r=t)&&"undefined"!=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}(e,S()?Reflect.construct(t,r||[],y(e).constructor):t.apply(e,r))}function d(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function m(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function b(){return(b=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e}).apply(this,arguments)}function y(e){return(y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function w(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&v(e,t)}function h(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),o.forEach(function(t){m(e,t,r[t])})}return e}function k(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r.push.apply(r,o)}return r})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function v(e,t){return(v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function S(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(S=function(){return!!e})()}function O(e,t){var r,o,n,i,c={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){var l=[i,a];if(r)throw TypeError("Generator is already executing.");for(;c;)try{if(r=1,o&&(n=2&l[0]?o.return:l[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,l[1])).done)return n;switch(o=0,n&&(l=[2&l[0],n.value]),l[0]){case 0:case 1:n=l;break;case 4:return c.label++,{value:l[1],done:!1};case 5:c.label++,o=l[1],l=[0];continue;case 7:l=c.ops.pop(),c.trys.pop();continue;default:if(!(n=(n=c.trys).length>0&&n[n.length-1])&&(6===l[0]||2===l[0])){c=0;continue}if(3===l[0]&&(!n||l[1]>n[0]&&l[1]<n[3])){c.label=l[1];break}if(6===l[0]&&c.label<n[1]){c.label=n[1],n=l;break}if(n&&c.label<n[2]){c.label=n[2],c.ops.push(l);break}n[2]&&c.ops.pop(),c.trys.pop();continue}l=t.call(e,c)}catch(e){l=[6,e],o=0}finally{r=n=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}var x=function(e){function r(){var e;return d(this,r),e=f(this,r,arguments),m(e,"defaultProps",{title:(0,t.tExpr)("Trigger workflow",{ns:i})}),e}return w(r,e),r}(e.FormActionModel);x.define({label:(0,t.tExpr)("Trigger workflow",{ns:i})}),x.registerFlow({key:"customFormTriggerWorkflowsActionSettings",on:"click",title:"{{t('Workflow', { ns: 'workflow' })}}",steps:{confirm:{use:"confirm"},triggerWorkflows:{title:"{{t('Bind workflows', { ns: 'workflow' })}}",uiSchema:(0,r.createTriggerWorkflowsSchema)({filter:{type:c},optionFilter:function(e){return e.config.type===a.SINGLE_RECORD}}),handler:function(e,t){return u(function(){var r,o;return O(this,function(n){switch(n.label){case 0:if(!(null==(r=t.group)?void 0:r.length))return e.message.error(e.t("Button is not configured properly, please contact the administrator.",{ns:i})),[2];if(!e.blockModel)return[2];n.label=1;case 1:var c;return n.trys.push([1,3,4,5]),e.model.setProps("loading",!0),[4,e.blockModel.submitHandler(e,{},(c=u(function(r,o){var n;return O(this,function(i){switch(i.label){case 0:return[4,e.blockModel.resource.runAction("trigger",{params:k(h({},null!=o?{filterByTk:o}:{}),{triggerWorkflows:(null==(n=t.group)?void 0:n.length)?t.group.map(function(e){return[e.workflowKey,e.context].filter(Boolean).join("!")}).join(","):void 0}),data:r})];case 1:return[2,i.sent()]}})}),function(e,t){return c.apply(this,arguments)}))];case 2:return n.sent(),e.message.success(e.t("Operation succeeded")),e.model.setProps("loading",!1),[3,5];case 3:return o=n.sent(),e.model.setProps("loading",!1),console.error("Error triggering workflows:",o),e.exit(),[3,5];case 4:return e.model.setProps("loading",!1),[7];case 5:return e.view&&e.view.close(),[2]}})})()}}}});var C=function(e){function r(){var e;return d(this,r),e=f(this,r,arguments),m(e,"defaultProps",{title:(0,t.tExpr)("Trigger workflow",{ns:i})}),e}return w(r,e),r}(e.ActionModel);m(C,"scene",e.ActionSceneEnum.record),C.define({label:(0,t.tExpr)("Trigger workflow",{ns:i})}),C.registerFlow({key:"customRecordTriggerWorkflowsActionSettings",on:"click",title:"{{t('Workflow', { ns: 'workflow' })}}",steps:{confirm:{use:"confirm"},triggerWorkflows:{title:"{{t('Bind workflows', { ns: 'workflow' })}}",uiSchema:(0,r.createTriggerWorkflowsSchema)({filter:{type:c},optionFilter:function(e){return e.config.type===a.SINGLE_RECORD}}),handler:function(e,t){return u(function(){var r,o,n,c,a;return O(this,function(l){switch(l.label){case 0:if(n=(o=e.blockModel).resource,c=o.collection,!n||!c)return[2];if(!(null==(r=t.group)?void 0:r.length))return e.message.error(e.t("Button is not configured properly, please contact the administrator.",{ns:i})),[2];l.label=1;case 1:return l.trys.push([1,3,,4]),[4,n.runAction("trigger",{params:{triggerWorkflows:(null==(a=t.group)?void 0:a.length)?t.group.map(function(e){return[e.workflowKey,e.context].filter(Boolean).join("!")}).join(","):void 0,filterByTk:function(e,t){if(!e||!t)return null;var r=t.filterTargetKey;return Array.isArray(r)?r.reduce(function(t,r){return t[r]=e[r],t},{}):e[r]}(e.record,c)}})];case 2:return l.sent(),e.message.success(e.t("Operation succeeded")),[3,4];case 3:return console.error("Error triggering workflows:",l.sent()),[3,4];case 4:return[2]}})})()}}}});var T=function(e){function t(){var e;return d(this,t),e=f(this,t,arguments),m(e,"defaultProps",{title:null}),e}return w(t,e),t}(e.CollectionActionModel);m(T,"scene",e.ActionSceneEnum.collection),T.define({label:"{{t('Trigger workflow', { ns: '".concat(i,"' })}}")}),T.registerFlow({key:"customCollectionTriggerWorkflowsActionSettings",title:"{{t('Workflow', { ns: 'workflow' })}}",steps:{setContextType:{hideInSettings:!0,preset:!0,title:"{{t('Context type', { ns: '".concat(i,"' })}}"),uiSchema:{type:{type:"number","x-decorator":"FormItem","x-component":"Radio.Group",enum:[{label:"{{t('None', { ns: '".concat(i,"' })}}"),value:a.GLOBAL},{label:"{{t('Multiple collection records', { ns: '".concat(i,"' })}}"),value:a.MULTIPLE_RECORDS}],required:!0}},handler:function(e,t){e.model.props.title||e.model.setProps("title",t.type?e.t("Trigger workflow",{ns:i}):e.t("Trigger global workflow",{ns:i}))}},triggerWorkflows:{title:"{{t('Bind workflows', { ns: 'workflow' })}}",uiSchema:(0,r.createTriggerWorkflowsSchema)({WorkflowSelectComponent:function(e){var i=b({},function(e){if(null==e)throw TypeError("Cannot destructure "+e);return e}(e)),c=(0,t.useFlowContext)().model,a=(0,o.useCallback)(function(e){var t=e.config,r=c.stepParams.customCollectionTriggerWorkflowsActionSettings.setContextType.type;return r&&t.type===r||!t.type},[c.stepParams.customCollectionTriggerWorkflowsActionSettings.setContextType]);return n().createElement(r.TriggerWorkflowSelect,k(h({},i),{optionFilter:a}))},filter:{type:c},usingContext:!1})}}}),T.registerFlow({key:"customCollectionTriggerWorkflowsActionEventSettings",on:"click",steps:{confirm:{use:"confirm"},trigger:{handler:function(e){return u(function(){var t,r,o,n,c,l;return O(this,function(s){switch(s.label){case 0:if(r=(t=e.model.stepParams.customCollectionTriggerWorkflowsActionSettings).setContextType.type,!(null==(n=(null!=(o=t.triggerWorkflows)?o:{}).group)?void 0:n.length))return e.message.error(e.t("Button is not configured properly, please contact the administrator.",{ns:i})),[2];if(r!==a.MULTIPLE_RECORDS)return[3,5];if(!(null==(c=e.blockModel)?void 0:c.resource))return e.message.error(e.t("No resource selected for deletion")),[2];if(0===(l=e.blockModel.resource).getSelectedRows().length)return e.message.warning(e.t("Please select at least one record.",{ns:i})),[2];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,l.runAction("trigger",{params:{triggerWorkflows:(null==n?void 0:n.length)?n.map(function(e){return[e.workflowKey,e.context].filter(Boolean).join("!")}).join(","):void 0,filterByTk:e.blockModel.collection.getFilterByTK(l.getSelectedRows())}})];case 2:return s.sent(),l.setSelectedRows([]),[3,4];case 3:return console.error("Error triggering workflows:",s.sent()),[2];case 4:return[3,11];case 5:if(r!==a.GLOBAL)return[3,10];s.label=6;case 6:return s.trys.push([6,8,,9]),[4,e.api.request({url:"workflows:trigger",method:"post",params:{triggerWorkflows:(null==n?void 0:n.length)?n.map(function(e){return[e.workflowKey,e.context].filter(Boolean).join("!")}).join(","):void 0}})];case 7:return s.sent(),[3,9];case 8:return console.error("Error triggering workflows:",s.sent()),[2];case 9:return[3,11];case 10:throw Error("Invalid context type");case 11:return e.message.success(e.t("Operation succeeded")),[2]}})})()}}}});var P=function(e){function r(){var e;return d(this,r),e=f(this,r,arguments),m(e,"defaultProps",{title:(0,t.tExpr)("Trigger global workflow",{ns:i})}),e}return w(r,e),r}(e.ActionModel);m(P,"scene",e.ActionSceneEnum.collection),P.define({label:(0,t.tExpr)("Trigger global workflow",{ns:i})}),P.registerFlow({key:"customCollectionGlobalTriggerWorkflowsActionSettings",on:"click",title:"{{t('Workflow', { ns: 'workflow' })}}",steps:{confirm:{use:"confirm"},triggerWorkflows:{title:"{{t('Custom action event', { ns: '".concat(i,"' })}}"),uiSchema:(0,r.createTriggerWorkflowsSchema)({filter:{type:c},optionFilter:function(e){return e.config.type===a.GLOBAL},usingContext:!1}),handler:function(e,t){return u(function(){var r;return O(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,e.api.request({url:"workflows:trigger",method:"post",params:{triggerWorkflows:(null==(r=t.group)?void 0:r.length)?t.group.map(function(e){return[e.workflowKey,e.context].filter(Boolean).join("!")}).join(","):void 0}})];case 1:return o.sent(),e.message.success(e.t("Workflow triggered on selected records successfully")),[3,3];case 2:return console.error("Error triggering workflows:",o.sent()),[3,3];case 3:return[2]}})})()}}}});var A=p(505);function j(t){var r,o,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.i18n.t(t,(r=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),o.forEach(function(t){var o;o=r[t],t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o})}return e}({},n),o=o={ns:i},Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r.push.apply(r,o)}return r})(Object(o)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))}),r))}var W=p(128),R=p(721),E=p(584);function B(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=Array(t);r<t;r++)o[r]=e[r];return o}function I(e,t,r,o,n,i,c){try{var a=e[i](c),l=a.value}catch(e){r(e);return}a.done?t(l):Promise.resolve(l).then(o,n)}function M(e){return function(){var t=this,r=arguments;return new Promise(function(o,n){var i=e.apply(t,r);function c(e){I(i,o,n,c,a,"next",e)}function a(e){I(i,o,n,c,a,"throw",e)}c(void 0)})}}function L(e,t){var r,o,n,i,c={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){var l=[i,a];if(r)throw TypeError("Generator is already executing.");for(;c;)try{if(r=1,o&&(n=2&l[0]?o.return:l[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,l[1])).done)return n;switch(o=0,n&&(l=[2&l[0],n.value]),l[0]){case 0:case 1:n=l;break;case 4:return c.label++,{value:l[1],done:!1};case 5:c.label++,o=l[1],l=[0];continue;case 7:l=c.ops.pop(),c.trys.pop();continue;default:if(!(n=(n=c.trys).length>0&&n[n.length-1])&&(6===l[0]||2===l[0])){c=0;continue}if(3===l[0]&&(!n||l[1]>n[0]&&l[1]<n[3])){c.label=l[1];break}if(6===l[0]&&c.label<n[1]){c.label=n[1],n=l;break}if(n&&c.label<n[2]){c.label=n[2],c.ops.push(l);break}n[2]&&c.ops.pop(),c.trys.pop();continue}l=t.call(e,c)}catch(e){l=[6,e],o=0}finally{r=n=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}function D(){var t=(0,e.useAPIClient)(),r=(0,e.useActionContext)().setVisible,o=(0,W.useNavigate)(),n=(0,A.useFieldSchema)(),i=(0,A.useField)(),c=(0,e.useCompile)(),a=R.App.useApp(),l=a.modal,s=a.message,u=(0,e.useLocalVariables)(),f=(0,e.useVariables)();return{onClick:function(a,p){return M(function(){var a,g,d,m,b,y,w,h,k,v,S,O;return L(this,function(x){switch(x.label){case 0:if(d=(g=null!=(a=null==n?void 0:n["x-action-settings"])?a:{}).onSuccess,m=g.triggerWorkflows,y=(b=d||{}).manualClose,w=b.redirecting,h=b.redirectTo,k=b.successMessage,v=b.actionAfterSuccess,!(null==m?void 0:m.length))return s.error(j("Button is not configured properly, please contact the administrator.")),[2];i.data=i.data||{},i.data.loading=!0,x.label=1;case 1:return x.trys.push([1,4,5,6]),[4,t.resource("workflows").trigger({triggerWorkflows:m.map(function(e){return[e.workflowKey,e.context].filter(Boolean).join("!")}).join(",")})];case 2:return S=x.sent(),i.data.data=S,null==p||p(),"previous"!==v&&(v||!0===w)||null==r||r(!1),[4,(0,e.getVariableValue)(h,{variables:f,localVariables:u})];case 3:if(O=x.sent(),!k)return(w&&!v||"redirect"===v)&&O&&((0,E.isURL)(O)?window.location.href=O:o(O)),[2];return y?l.success({title:c(k),onOk:M(function(){return L(this,function(e){return(w&&!v||"redirect"===v)&&O&&((0,E.isURL)(O)?window.location.href=O:o(O)),[2]})})}):(s.success(c(k)),(w&&!v||"redirect"===v)&&O&&((0,E.isURL)(d.redirectTo)?window.location.href=d.redirectTo:o(d.redirectTo))),[3,6];case 4:return console.error(x.sent()),[3,6];case 5:return i.data.loading=!1,[7];case 6:return[2]}})})()}}}function F(){var t=(0,e.useAPIClient)(),r=(0,e.useActionContext)().setVisible,o=(0,W.useNavigate)(),n=(0,A.useFieldSchema)(),i=(0,A.useField)(),c=(0,e.useCompile)(),a=R.App.useApp(),l=a.modal,s=a.message,u=(0,e.useCollection)(),f=(0,e.useBlockRequestContext)().field,p=(0,e.useLocalVariables)(),g=(0,e.useVariables)();return{onClick:function(a,d){return M(function(){var a,m,b,y,w,h,k,v,S,O,x,C,T,P,A,W;return L(this,function(R){switch(R.label){case 0:if(w=(y=null!=(b=null==n?void 0:n["x-action-settings"])?b:{}).onSuccess,h=y.triggerWorkflows,v=(k=w||{}).manualClose,S=k.redirecting,O=k.redirectTo,x=k.successMessage,C=k.actionAfterSuccess,!(null==h?void 0:h.length))return s.error(j("Button is not configured properly, please contact the administrator.")),[2];if(!(null==(m=f.data)||null==(a=m.selectedRowKeys)?void 0:a.length))return s.error(j("Please select at least one record.")),[2];i.data=i.data||{},i.data.loading=!0,R.label=1;case 1:return R.trys.push([1,4,5,6]),[4,t.resource(u.name,void 0,{"x-data-source":u.dataSource}).trigger({filterByTk:null==(T=f.data)?void 0:T.selectedRowKeys,triggerWorkflows:(null==h?void 0:h.length)?h.map(function(e){return[e.workflowKey,e.context].filter(Boolean).join("!")}).join(","):void 0})];case 2:return A=R.sent(),(null==(P=f.data)?void 0:P.clearSelectedRowKeys)&&f.data.clearSelectedRowKeys(),i.data.data=A,null==d||d(),"previous"!==C&&(C||!0===S)||null==r||r(!1),[4,(0,e.getVariableValue)(O,{variables:g,localVariables:p})];case 3:if(W=R.sent(),!x)return(S&&!C||"redirect"===C)&&W&&((0,E.isURL)(W)?window.location.href=W:o(W)),[2];return v?l.success({title:c(x),onOk:M(function(){return L(this,function(e){return(S&&!C||"redirect"===C)&&W&&((0,E.isURL)(W)?window.location.href=W:o(W)),[2]})})}):(s.success(c(x)),(S&&!C||"redirect"===C)&&W&&((0,E.isURL)(w.redirectTo)?window.location.href=w.redirectTo:o(w.redirectTo))),[3,6];case 4:return console.error(R.sent()),[3,6];case 5:return i.data.loading=!1,[7];case 6:return[2]}})})()}}}function z(){var t=(0,A.useForm)(),r=(0,e.useBlockRequestContext)(),o=(r.field,r.resource),n=(0,e.useActionContext)().setVisible,i=(0,e.useFilterByTk)(),c=(0,W.useNavigate)(),a=(0,A.useFieldSchema)(),l=(0,A.useField)(),s=(0,e.useCompile)(),u=R.App.useApp(),f=u.modal,p=u.message,g=(0,e.useCollectValuesToSubmit)(),d=(0,e.useLocalVariables)(),m=(0,e.useVariables)();return{onClick:function(r,u){return M(function(){var r,b,y,w,h,k,v,S,O,x,C,T,P,A;return L(this,function(W){switch(W.label){case 0:if(y=(b=null!=(r=null==a?void 0:a["x-action-settings"])?r:{}).onSuccess,w=b.skipValidator,h=b.triggerWorkflows,v=(k=y||{}).manualClose,S=k.redirecting,O=k.redirectTo,x=k.successMessage,C=k.actionAfterSuccess,!(null==h?void 0:h.length))return p.error(j("Button is not configured properly, please contact the administrator.")),[2];if(w)return[3,2];return[4,t.submit()];case 1:W.sent(),W.label=2;case 2:return[4,g()];case 3:T=W.sent(),l.data=l.data||{},l.data.loading=!0,W.label=4;case 4:return W.trys.push([4,7,8,9]),[4,o.trigger({values:T,filterByTk:i,triggerWorkflows:(null==h?void 0:h.length)?h.map(function(e){return[e.workflowKey,e.context].filter(Boolean).join("!")}).join(","):void 0})];case 5:return P=W.sent(),l.data.data=P,null==u||u(),"previous"!==C&&(C||!0===S)||null==n||n(!1),[4,(0,e.getVariableValue)(O,{variables:m,localVariables:d})];case 6:if(A=W.sent(),!x)return(S&&!C||"redirect"===C)&&A&&((0,E.isURL)(A)?window.location.href=A:c(A)),[2];return v?f.success({title:s(x),onOk:M(function(){return L(this,function(e){switch(e.label){case 0:return[4,t.reset()];case 1:return e.sent(),(S&&!C||"redirect"===C)&&A&&((0,E.isURL)(A)?window.location.href=A:c(A)),[2]}})})}):(p.success(s(x)),(S&&!C||"redirect"===C)&&A&&((0,E.isURL)(y.redirectTo)?window.location.href=y.redirectTo:c(y.redirectTo))),[3,9];case 7:return console.error(W.sent()),[3,9];case 8:return l.data.loading=!1,[7];case 9:return[2]}})})()}}}function q(){var t=(0,e.useCompile)(),r=(0,e.useFilterByTk)(),o=(0,e.useCollectionRecordData)(),n=(0,A.useField)(),i=(0,A.useFieldSchema)(),c=(0,e.useBlockRequestContext)(),a=(c.field,c.resource),l=(0,e.useActionContext)(),s=l.setVisible,u=l.setSubmitted,f=R.App.useApp(),p=f.modal,g=f.message,d=(0,W.useNavigate)(),m=(0,e.useLocalVariables)(),b=(0,e.useVariables)();return{onClick:function(c,l){return M(function(){var c,f,y,w,h,k,v,S,O,x,C;return L(this,function(T){switch(T.label){case 0:if(y=(f=null!=(c=null==i?void 0:i["x-action-settings"])?c:{}).onSuccess,w=f.triggerWorkflows,k=(h=y||{}).manualClose,v=h.redirecting,S=h.redirectTo,O=h.successMessage,x=h.actionAfterSuccess,!(null==w?void 0:w.length))return g.error(j("Button is not configured properly, please contact the administrator.")),[2];n.data=n.data||{},n.data.loading=!0,T.label=1;case 1:return T.trys.push([1,4,5,6]),[4,a.trigger({filterByTk:r,triggerWorkflows:(null==w?void 0:w.length)?w.map(function(e){return[e.workflowKey,e.context].filter(Boolean).join("!")}).join(","):void 0})];case 2:return T.sent(),l&&l(),"previous"!==x&&(x||!0===v)||null==s||s(!1),null==u||u(!0),[4,(0,e.getVariableValue)(S,{variables:b,localVariables:((function(e){if(Array.isArray(e))return B(e)})(m)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(m)||function(e,t){if(e){if("string"==typeof e)return B(e,void 0);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 B(e,t)}}(m)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).concat([{name:"$record",ctx:new Proxy(o,{})}])})];case 3:if(C=T.sent(),!O)return(v&&!x||"redirect"===x)&&C&&((0,E.isURL)(C)?window.location.href=C:d(C)),[2];return k?p.success({title:t(O),onOk:function(){return M(function(){return L(this,function(e){return(v&&!x||"redirect"===x)&&C&&((0,E.isURL)(C)?window.location.href=C:d(C)),[2]})})()}}):(g.success(t(O)),(v&&!x||"redirect"===x)&&C&&((0,E.isURL)(y.redirectTo)?window.location.href=y.redirectTo:d(y.redirectTo))),[3,6];case 4:return console.error(T.sent()),[3,6];case 5:return n.data.loading=!1,[7];case 6:return[2]}})})()}}}function _(e){var t=(0,r.useCurrentWorkflowContext)();return e.types.includes(t.config.type)?e.children:null}function V(t){var r,o,i=D().onClick;return n().createElement(e.Action,(r=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),o.forEach(function(t){var o;o=r[t],t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o})}return e}({},t),o=o={onClick:i},Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r.push.apply(r,o)}return r})(Object(o)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))}),r))}function N(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=Array(t);r<t;r++)o[r]=e[r];return o}function G(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 K(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),o.forEach(function(t){G(e,t,r[t])})}return e}function $(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r.push.apply(r,o)}return r})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function H(e,t){return(H=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function J(e){return function(e){if(Array.isArray(e))return N(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Q(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 Q(e,t){if(e){if("string"==typeof e)return N(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 N(e,t)}}function X(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(X=function(){return!!e})()}function Y(t,o){var n,i,c=(n=(0,e.parseCollectionName)(t.collection),function(e){if(Array.isArray(e))return e}(n)||function(e,t){var r,o,n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i=[],c=!0,a=!1;try{for(n=n.call(e);!(c=(r=n.next()).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){a=!0,o=e}finally{try{c||null==n.return||n.return()}finally{if(a)throw o}}return i}}(n,1)||Q(n,1)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0],a=(0,e.useCompile)(),l=(0,r.useGetDataSourceCollectionManager)(c),s=(0,r.useGetDataSourceCollectionManager)();if(t.global)return null;var u=(0,r.getCollectionFieldOptions)($(K({appends:["user"]},o),{fields:[{collectionName:"users",name:"user",type:"hasOne",target:"users",uiSchema:{title:j("User acted")}}],compile:a,collectionManager:s}));return J((0,r.getCollectionFieldOptions)($(K({appends:["data"].concat(J((null==(i=t.appends)?void 0:i.map(function(e){return"data.".concat(e)}))||[]))},o),{fields:[{collectionName:t.collection,name:"data",type:"hasOne",target:t.collection,uiSchema:{title:j("Trigger data")}}],compile:a,collectionManager:l}))).concat(J(u),[{label:j("Role of user acted"),value:"roleName"}])}var Z=function(t){var o;if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");function c(){var t,o,s;if(!(this instanceof c))throw TypeError("Cannot call a class as a function");return o=c,s=arguments,o=U(o),G(t=function(e,t){var r;if(t&&("object"==((r=t)&&"undefined"!=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,X()?Reflect.construct(o,s||[],U(this).constructor):o.apply(this,s)),"title",'{{t("Custom action event", { ns: "'.concat(i,'" })}}')),G(t,"description",'{{t(\'When the "Trigger Workflow" button is clicked, the event is triggered based on different context where the button is located. For complex data processing that cannot be handled simply by built-in operations (CRUD) of NocoBase, you can define a series of operations through a workflow and trigger it with the "Trigger Workflow" button.\', { ns: "'.concat(i,'" })}}')),G(t,"fieldset",{type:{type:"number",title:'{{t("Context type", { ns: "'.concat(i,'" })}}'),description:'{{t("", { ns: "'.concat(i,'" })}}'),"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{options:l},default:a.GLOBAL,"x-disabled":"{{ useWorkflowAnyExecuted() }}"},collection:G({type:"string",title:'{{t("Collection")}}',required:!0,"x-decorator":"FormItem","x-component":"DataSourceCollectionCascader","x-disabled":"{{ useWorkflowAnyExecuted() }}"},"x-reactions",[{target:"appends",effects:["onFieldValueChange"],fulfill:{state:{value:[]}}},{dependencies:["type"],fulfill:{state:{visible:"{{Boolean($deps[0])}}"}}}]),appends:{type:"array",title:'{{t("Associations to use", { ns: "'.concat(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:function(){var e=(0,A.useForm)().values;return null==e?void 0:e.collection}},"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]}}),G(t,"triggerFieldset",{data:{type:"void","x-component":"TriggerScopeProvider","x-component-props":{types:[a.SINGLE_RECORD]},properties:{data:{type:"object",title:'{{t("Trigger data", { ns: "'.concat(i,'" })}}'),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}}},filterByTk:{type:"void","x-component":"TriggerScopeProvider","x-component-props":{types:[a.MULTIPLE_RECORDS]},properties:{filterByTk:{type:"array",title:'{{t("Trigger data", { ns: "'.concat(i,'" })}}'),description:'{{t("Choose a record or primary key of a record in the collection to trigger.", { ns: "workflow" })}}',"x-decorator":"FormItem","x-component":"TriggerCollectionRecordSelect","x-component-props":{multiple:!0,objectValue:!1},default:[],required:!0}}},userId:{type:"number",title:'{{t("User acted", { ns: "'.concat(i,'" })}}'),"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,K({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(i,'" })}}'),"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,K({fieldNames:{label:"title",value:"name"},service:{resource:"roles"},manual:!1},t))}},default:null}}),G(t,"scope",{useWorkflowAnyExecuted:r.useWorkflowAnyExecuted,useCollectionDataSource:e.useCollectionDataSource}),G(t,"components",{TriggerScopeProvider:_,TriggerCollectionRecordSelect:r.TriggerCollectionRecordSelect,WorkflowVariableWrapper:r.WorkflowVariableWrapper,RadioWithTooltip:r.RadioWithTooltip}),G(t,"isActionTriggerable_deprecated",function(e,t){return"customize:triggerWorkflows"===t.buttonAction&&e.type===a.SINGLE_RECORD}),G(t,"useVariables",Y),t}return c.prototype=Object.create(t&&t.prototype,{constructor:{value:c,writable:!0,configurable:!0}}),t&&H(c,t),o=[{key:"validate",value:function(e){return!e.type||e.type===a.GLOBAL||[a.SINGLE_RECORD,a.MULTIPLE_RECORDS].includes(e.type)&&e.collection}},{key:"useInitializers",value:function(e){return e.global||!e.collection?null:{name:"triggerData",type:"item",key:"triggerData",title:'{{t("Trigger data", { ns: "workflow" })}}',Component:r.CollectionBlockInitializer,collection:e.collection,dataPath:"$context.data"}}},{key:"getCreateModelMenuItem",value:function(e){var t=e.config;return t.collection?{key:"triggerData",label:'{{t("Trigger data", { ns: "workflow" })}}',useModel:"NodeDetailsModel",createModelOptions:{use:"NodeDetailsModel",stepParams:{resourceSettings:{init:{dataSourceKey:"main",collectionName:t.collection,dataPath:"$context.data"}},cardSettings:{titleDescription:{title:'{{t("Trigger data", { ns: "workflow" })}}'}}},subModels:{grid:{use:"NodeDetailsGridModel",subType:"object"}}}}:null}}],function(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}(c.prototype,o),c}(r.Trigger),ee=p(632),et=p(238);function er(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function eo(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),o.forEach(function(t){er(e,t,r[t])})}return e}function en(){var t,r=(0,e.useDesignable)().dn,o=(0,et.useTranslation)().t,c=(0,A.useFieldSchema)(),l=(0,e.useCollection)(),s="customize:collectionTriggerWorkflows"===c["x-action"];return n().createElement(e.SchemaSettingsActionModalItem,{title:o("Bind workflows",{ns:"workflow"}),width:"30%",components:{Alert:R.Alert,ArrayTable:ee.ArrayTable,RemoteSelect:e.RemoteSelect},schema:{type:"void",title:o("Bind workflows",{ns:"workflow"}),properties:{description:{type:"void","x-component":"Alert","x-component-props":{message:s?'{{t(\'Only support custom action workflow with context type set to "Multiple records".\', { ns: "'.concat(i,'" })}}'):'{{t(\'Only support custom action workflow with context type set to "None".\', { ns: "'.concat(i,'" })}}'),style:{marginBottom:"1em"}}},group:{type:"array","x-component":"ArrayTable","x-decorator":"FormItem",items:{type:"object",properties:{sort:{type:"void","x-component":"ArrayTable.Column","x-component-props":{width:50,title:"",align:"center"},properties:{sort:{type:"void","x-component":"ArrayTable.SortHandle"}}},workflowKey:{type:"void","x-component":"ArrayTable.Column","x-component-props":{title:"{{t('Workflow', { ns: 'workflow' })}}"},properties:{workflowKey:{type:"string","x-decorator":"FormItem","x-component":"RemoteSelect","x-component-props":{manual:!1,placeholder:o("Select workflow",{ns:"workflow"}),fieldNames:{label:"title",value:"key"},dataSource:"main",service:{resource:"workflows",action:"list",params:{filter:eo({type:"custom-action",enabled:!0},s?{"config.type":a.MULTIPLE_RECORDS,"config.collection":(0,e.joinCollectionName)(l.dataSource,l.name)}:{$or:[{"config.type":a.GLOBAL},{"config.type":null}]})}}},required:!0}}},operations:{type:"void","x-component":"ArrayTable.Column","x-component-props":{width:32},properties:{remove:{type:"void","x-component":"ArrayTable.Remove"}}}}},properties:{add:{type:"void",title:o("Add workflow",{ns:"workflow"}),"x-component":"ArrayTable.Addition"}}}}},initialValues:{group:null==c||null==(t=c["x-action-settings"])?void 0:t.triggerWorkflows},onSubmit:function(e){var t,o=e.group;c["x-action-settings"]||(c["x-action-settings"]={}),c["x-action-settings"].triggerWorkflows=o,r.emit("patch",{schema:(er(t={},"x-uid",c["x-uid"]),er(t,"x-action-settings",c["x-action-settings"]),t)})}})}var ei=new e.SchemaSettings({name:"actionSettings:submitToWorkflow",items:[{name:"editButton",Component:e.ButtonEditor,useComponentProps:function(){return(0,e.useSchemaToolbar)().buttonEditorProps}},{name:"linkageRules",Component:e.SchemaSettingsLinkageRules,useComponentProps:function(){var t,r,o=(0,e.useCollection_deprecated)().name;return t=eo({},(0,e.useSchemaToolbar)().linkageRulesProps),r=r={collectionName:o},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r.push.apply(r,o)}return r})(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}),t}},{name:"secondConfirmation",Component:e.SecondConFirm},{name:"assignFieldValues",Component:e.AssignedFieldValues},{name:"skipRequiredValidation",Component:e.SkipValidation},{name:"afterSuccessfulSubmission",Component:e.AfterSuccess},{name:"refreshDataBlockRequest",Component:e.RefreshDataBlockRequest,useComponentProps:function(){return{isPopupAction:!1}}},{name:"bindWorkflow",Component:r.BindWorkflowConfig},e.SchemaSettingAccessControl,{name:"delete",sort:100,Component:e.RemoveButton,useComponentProps:function(){return(0,e.useSchemaToolbar)().removeButtonProps}}]}),ec=new e.SchemaSettings({name:"actionSettings:collectionTriggerWorkflow",items:[{name:"editButton",Component:e.ButtonEditor,useComponentProps:function(){return(0,e.useSchemaToolbar)().buttonEditorProps}},{name:"linkageRules",Component:e.SchemaSettingsLinkageRules,useComponentProps:function(){return eo({},(0,e.useSchemaToolbar)().linkageRulesProps)}},{name:"secondConfirmation",Component:e.SecondConFirm},{name:"afterSuccessfulSubmission",Component:e.AfterSuccess},{name:"refreshDataBlockRequest",Component:e.RefreshDataBlockRequest,useComponentProps:function(){return{isPopupAction:!1}}},{name:"bindWorkflow",Component:en},e.SchemaSettingAccessControl,{name:"delete",sort:100,Component:e.RemoveButton,useComponentProps:function(){return(0,e.useSchemaToolbar)().removeButtonProps}}]}),ea=new e.SchemaSettings({name:"actionSettings:globalTriggerWorkflow",items:[{name:"editButton",Component:e.ButtonEditor,useComponentProps:function(){return(0,e.useSchemaToolbar)().buttonEditorProps}},{name:"linkageRules",Component:e.SchemaSettingsLinkageRules,useComponentProps:function(){return eo({},(0,e.useSchemaToolbar)().linkageRulesProps)}},{name:"secondConfirmation",Component:e.SecondConFirm},{name:"afterSuccessfulSubmission",Component:e.AfterSuccess},{name:"bindWorkflow",Component:en},{name:"refreshDataBlockRequest",Component:e.RefreshDataBlockRequest,useComponentProps:function(){return{isPopupAction:!1}},useVisible:function(){return!!(0,(0,e.useDataBlockRequestGetter)().getDataBlockRequest)()}},e.SchemaSettingAccessControl,{name:"delete",sort:100,Component:e.RemoveButton,useComponentProps:function(){return(0,e.useSchemaToolbar)().removeButtonProps}}]});function el(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),o.forEach(function(t){var o;o=r[t],t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o})}return e}function es(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r.push.apply(r,o)}return r})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}var eu={name:"triggerWorkflow",title:'{{t("Trigger workflow", { ns: "'.concat(i,'" })}}'),Component:"CustomizeActionInitializer",schema:{title:'{{t("Trigger workflow", { ns: "'.concat(i,'" })}}'),"x-component":"Action","x-use-component-props":"useFormWorkflowCustomActionProps","x-settings":"actionSettings:submitToWorkflow","x-decorator":"ACLActionProvider","x-action-settings":{skipValidator:!1,onSuccess:{manualClose:!0,redirecting:!1,successMessage:'{{t("Submitted successfully")}}'},refreshDataBlockRequest:!0,triggerWorkflows:[]},"x-toolbar-props":{initializer:!1,showBorder:!1},"x-action":"customize:triggerWorkflows"},useVisible:function(){return"publicForm"!==((0,e.useDataBlockProps)()||{}).type}},ef={name:"triggerWorkflow",title:'{{t("Trigger workflow", { ns: "'.concat(i,'" })}}'),Component:"CustomizeActionInitializer",schema:{title:'{{t("Trigger workflow", { ns: "'.concat(i,'" })}}'),"x-component":"Action","x-use-component-props":"useRecordWorkflowCustomTriggerActionProps","x-settings":"actionSettings:submitToWorkflow","x-decorator":"ACLActionProvider","x-action-settings":{onSuccess:{manualClose:!0,redirecting:!1,successMessage:'{{t("Submitted successfully")}}'},refreshDataBlockRequest:!0,triggerWorkflows:[]},"x-toolbar-props":{initializer:!1,showBorder:!1},"x-action":"customize:triggerWorkflows"}},ep=es(el({},ef),{schema:es(el({},ef.schema),{"x-component":"Action.Link"})}),eg={name:"triggerWorkflow",title:'{{t("Trigger workflow", { ns: "'.concat(i,'" })}}'),Component:"CustomizeActionInitializer",schema:{title:'{{t("Trigger workflow", { ns: "'.concat(i,'" })}}'),"x-component":"Action","x-use-component-props":"useGlobalTriggerWorkflowCustomActionProps","x-settings":"actionSettings:globalTriggerWorkflow","x-decorator":"ACLActionProvider","x-action-settings":{onSuccess:{manualClose:!0,redirecting:!1,successMessage:'{{t("Submitted successfully")}}'},refreshDataBlockRequest:!0,triggerWorkflows:[]},"x-toolbar-props":{initializer:!1,showBorder:!1},"x-action":"customize:globalTriggerWorkflows"}};function ed(t){var o=(0,e.useSchemaInitializer)().insert,c=(0,et.useTranslation)().t;return n().createElement(e.ModalActionSchemaInitializerItem,{title:c("Trigger workflow",{ns:i}),components:{RadioWithTooltip:r.RadioWithTooltip},modalSchema:{title:'{{t("Trigger workflow", { ns: "'.concat(i,'" })}}'),properties:{type:{title:"{{t('Context type', { ns: \"".concat(i,'" })}}'),"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{options:l.filter(function(e){var t=e.value;return[a.GLOBAL,a.MULTIPLE_RECORDS].includes(t)})},required:!0}}},onSubmit:function(e){o(el({type:"void",title:"{{t('".concat(e.type?"Trigger workflow":"Trigger global workflow","', { ns: \"").concat(i,'" })}}'),"x-component":"Action","x-component-props":{},"x-action":e.type?"customize:collectionTriggerWorkflows":"customize:globalTriggerWorkflows","x-toolbar":"ActionSchemaToolbar","x-decorator":"ACLActionProvider","x-action-settings":{onSuccess:{manualClose:!1,redirecting:!1,successMessage:'{{t("Operation succeeded")}}'}}},e.type?{"x-use-component-props":"useCollectionTriggerWorkflowCustomActionProps","x-settings":"actionSettings:collectionTriggerWorkflow"}:{"x-use-component-props":"useGlobalTriggerWorkflowCustomActionProps","x-settings":"actionSettings:globalTriggerWorkflow"}))}})}function em(t){var r=(0,e.useSchemaInitializer)().insert,o=(0,et.useTranslation)().t;return n().createElement(e.ModalActionSchemaInitializerItem,{title:o("Trigger workflow",{ns:i}),modalSchema:{title:'{{t("Trigger workflow", { ns: "'.concat(i,'" })}}'),properties:{title:{title:"{{t('Title')}}","x-component":"Input","x-decorator":"FormItem",required:!0,default:'{{t("Trigger workflow", { ns: "'.concat(i,'" })}}')},icon:{title:"{{t('Icon')}}","x-component":"IconPicker","x-decorator":"FormItem",required:!0,default:"thunderboltoutlined"},iconColor:{title:"{{t('Color')}}","x-component":"ColorPicker","x-decorator":"FormItem",required:!0,default:"#1677FF"}}},onSubmit:function(e){r({type:"void",title:e.title,"x-component":"WorkbenchAction","x-decorator":"ACLActionProvider","x-component-props":{icon:e.icon,iconColor:e.iconColor,targetComponent:"GlobalTriggerWorkflowAction"},"x-action":"customize:globalTriggerWorkflows","x-toolbar":"ActionSchemaToolbar","x-settings":"actionSettings:globalTriggerWorkflow","x-action-settings":{onSuccess:{manualClose:!1,redirecting:!1,successMessage:'{{t("Operation succeeded")}}'}}})}})}function eb(e,t,r,o,n,i,c){try{var a=e[i](c),l=a.value}catch(e){r(e);return}a.done?t(l):Promise.resolve(l).then(o,n)}function ey(e){return function(){var t=this,r=arguments;return new Promise(function(o,n){var i=e.apply(t,r);function c(e){eb(i,o,n,c,a,"next",e)}function a(e){eb(i,o,n,c,a,"throw",e)}c(void 0)})}}function ew(e,t,r){return(ew=eS()?Reflect.construct:function(e,t,r){var o=[null];o.push.apply(o,t);var n=new(Function.bind.apply(e,o));return r&&ek(n,r.prototype),n}).apply(null,arguments)}function eh(e){return(eh=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ek(e,t){return(ek=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ev(e){var t="function"==typeof Map?new Map:void 0;return(ev=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 ew(e,arguments,eh(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),ek(r,e)})(e)}function eS(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eS=function(){return!!e})()}function eO(e,t){var r,o,n,i,c={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){var l=[i,a];if(r)throw TypeError("Generator is already executing.");for(;c;)try{if(r=1,o&&(n=2&l[0]?o.return:l[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,l[1])).done)return n;switch(o=0,n&&(l=[2&l[0],n.value]),l[0]){case 0:case 1:n=l;break;case 4:return c.label++,{value:l[1],done:!1};case 5:c.label++,o=l[1],l=[0];continue;case 7:l=c.ops.pop(),c.trys.pop();continue;default:if(!(n=(n=c.trys).length>0&&n[n.length-1])&&(6===l[0]||2===l[0])){c=0;continue}if(3===l[0]&&(!n||l[1]>n[0]&&l[1]<n[3])){c.label=l[1];break}if(6===l[0]&&c.label<n[1]){c.label=n[1],n=l;break}if(n&&c.label<n[2]){c.label=n[2],c.ops.push(l);break}n[2]&&c.ops.pop(),c.trys.pop();continue}l=t.call(e,c)}catch(e){l=[6,e],o=0}finally{r=n=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}var ex=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;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return e=r,t=arguments,e=eh(e),function(e,t){var r;if(t&&("object"==((r=t)&&"undefined"!=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,eS()?Reflect.construct(e,t||[],eh(this).constructor):e.apply(this,t))}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&ek(r,e),t=[{key:"beforeLoad",value:function(){var e=this;return ey(function(){return eO(this,function(t){return e.app.eventBus.addEventListener("plugin:kanban:loaded",function(){e.app.schemaInitializerManager.get("kanban:configureActions").add("customize.triggerWorkflow",eg)}),e.app.eventBus.addEventListener("plugin:calendar:loaded",function(){e.app.schemaInitializerManager.get("calendar:configureActions").add("customize.triggerWorkflow",eg)}),e.app.eventBus.addEventListener("plugin:gantt:loaded",function(){e.app.schemaInitializerManager.get("gantt:configureActions").add("customize.triggerWorkflow",eg),e.app.schemaInitializerManager.addItem("gantt:configureActions","customize.triggerWorkflow",{Component:ed})}),e.app.eventBus.addEventListener("plugin:block-workbench:loaded",function(){e.app.schemaInitializerManager.addItem("workbench:configureActions","customize.triggerWorkflow",{Component:em})}),[2]})})()}},{key:"load",value:function(){var e=this;return ey(function(){return eO(this,function(t){return e.app.pm.get("workflow").registerTrigger(c,Z),e.app.addScopes({useFormWorkflowCustomActionProps:z,useRecordWorkflowCustomTriggerActionProps:q,useCollectionTriggerWorkflowCustomActionProps:F,useGlobalTriggerWorkflowCustomActionProps:D}),e.app.addComponents({GlobalTriggerWorkflowAction:V}),e.app.schemaSettingsManager.add(ei),e.app.schemaSettingsManager.add(ec),e.app.schemaSettingsManager.add(ea),e.app.schemaInitializerManager.get("FormActionInitializers").add("customize.triggerWorkflow",eu),e.app.schemaInitializerManager.get("createForm:configureActions").add("customize.triggerWorkflow",eu),e.app.schemaInitializerManager.get("editForm:configureActions").add("customize.triggerWorkflow",eu),e.app.schemaInitializerManager.get("detailsWithPaging:configureActions").add("customize.triggerWorkflow",ef),e.app.schemaInitializerManager.get("details:configureActions").add("customize.triggerWorkflow",ef),e.app.schemaInitializerManager.get("table:configureItemActions").add("customize.triggerWorkflow",ep),e.app.schemaInitializerManager.get("gridCard:configureItemActions").add("customize.triggerWorkflow",ep),e.app.schemaInitializerManager.get("list:configureItemActions").add("customize.triggerWorkflow",ep),e.app.schemaInitializerManager.get("list:configureActions").add("customize.triggerWorkflow",eg),e.app.schemaInitializerManager.get("gridCard:configureActions").add("customize.triggerWorkflow",eg),e.app.schemaInitializerManager.addItem("table:configureActions","customize.triggerWorkflow",{Component:ed}),e.flowEngine.registerModels({FormTriggerWorkflowActionModel:x,RecordTriggerWorkflowActionModel:C,CollectionTriggerWorkflowActionModel:T}),[2]})})()}}],function(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}(r.prototype,t),r}(ev(e.Plugin))}(),g}()});
10
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@nocobase/client"),require("react-router-dom"),require("@nocobase/plugin-workflow/client"),require("@formily/antd-v5"),require("react"),require("@nocobase/flow-engine"),require("@emotion/css"),require("@formily/react"),require("@nocobase/utils/client"),require("antd"),require("react-i18next")):"function"==typeof define&&define.amd?define("@nocobase/plugin-workflow-custom-action-trigger",["@nocobase/client","react-router-dom","@nocobase/plugin-workflow/client","@formily/antd-v5","react","@nocobase/flow-engine","@emotion/css","@formily/react","@nocobase/utils/client","antd","react-i18next"],t):"object"==typeof exports?exports["@nocobase/plugin-workflow-custom-action-trigger"]=t(require("@nocobase/client"),require("react-router-dom"),require("@nocobase/plugin-workflow/client"),require("@formily/antd-v5"),require("react"),require("@nocobase/flow-engine"),require("@emotion/css"),require("@formily/react"),require("@nocobase/utils/client"),require("antd"),require("react-i18next")):e["@nocobase/plugin-workflow-custom-action-trigger"]=t(e["@nocobase/client"],e["react-router-dom"],e["@nocobase/plugin-workflow/client"],e["@formily/antd-v5"],e.react,e["@nocobase/flow-engine"],e["@emotion/css"],e["@formily/react"],e["@nocobase/utils/client"],e.antd,e["react-i18next"])}(self,function(e,t,r,o,n,i,c,a,l,s,u){return function(){"use strict";var f={964:function(e){e.exports=c},632:function(e){e.exports=o},505:function(e){e.exports=a},772:function(t){t.exports=e},667:function(e){e.exports=i},433:function(e){e.exports=r},584:function(e){e.exports=l},721:function(e){e.exports=s},156:function(e){e.exports=n},238:function(e){e.exports=u},128:function(e){e.exports=t}},p={};function g(e){var t=p[e];if(void 0!==t)return t.exports;var r=p[e]={exports:{}};return f[e](r,r.exports,g),r.exports}g.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return g.d(t,{a:t}),t},g.d=function(e,t){for(var r in t)g.o(t,r)&&!g.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},g.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},g.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var d={};return!function(){g.r(d),g.d(d,{default:function(){return eN}});var e=g(772),t=g(667),r=g(433),o=g(156),n=g.n(o),i="@nocobase/plugin-workflow-custom-action-trigger",c="custom-action",a={GLOBAL:0,SINGLE_RECORD:1,MULTIPLE_RECORDS:2},l=[{label:"{{t('Custom context', { ns: \"".concat(i,'" })}}'),value:a.GLOBAL,tooltip:"{{t('Could be used on non-record related action buttons. You can provide custom JSON as trigger data.', { ns: \"".concat(i,'" })}}')},{label:"{{t('Single collection record', { ns: \"".concat(i,'" })}}'),value:a.SINGLE_RECORD,tooltip:"{{t('Could only be used on single record related action buttons. Such as in form, detail block and table row of record.', { ns: \"".concat(i,'" })}}')},{label:"{{t('Multiple collection records', { ns: \"".concat(i,'" })}}'),value:a.MULTIPLE_RECORDS,tooltip:"{{t('Could only be used on multiple record related action buttons. Such as for batch action in table block. The data in trigger variable will be an array.', { ns: \"".concat(i,'" })}}')}],s=g(964),u=g(128),f=g(721),p=g(505),m=g(584);function b(t){var r,o,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.i18n.t(t,(r=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),o.forEach(function(t){var o;o=r[t],t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o})}return e}({},n),o=o={ns:i},Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r.push.apply(r,o)}return r})(Object(o)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))}),r))}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=Array(t);r<t;r++)o[r]=e[r];return o}function w(e,t,r,o,n,i,c){try{var a=e[i](c),l=a.value}catch(e){r(e);return}a.done?t(l):Promise.resolve(l).then(o,n)}function h(e){return function(){var t=this,r=arguments;return new Promise(function(o,n){var i=e.apply(t,r);function c(e){w(i,o,n,c,a,"next",e)}function a(e){w(i,o,n,c,a,"throw",e)}c(void 0)})}}function v(e,t){if(e){if("string"==typeof e)return y(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 y(e,t)}}function k(e,t){var r,o,n,i,c={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){var l=[i,a];if(r)throw TypeError("Generator is already executing.");for(;c;)try{if(r=1,o&&(n=2&l[0]?o.return:l[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,l[1])).done)return n;switch(o=0,n&&(l=[2&l[0],n.value]),l[0]){case 0:case 1:n=l;break;case 4:return c.label++,{value:l[1],done:!1};case 5:c.label++,o=l[1],l=[0];continue;case 7:l=c.ops.pop(),c.trys.pop();continue;default:if(!(n=(n=c.trys).length>0&&n[n.length-1])&&(6===l[0]||2===l[0])){c=0;continue}if(3===l[0]&&(!n||l[1]>n[0]&&l[1]<n[3])){c.label=l[1];break}if(6===l[0]&&c.label<n[1]){c.label=n[1],n=l;break}if(n&&c.label<n[2]){c.label=n[2],c.ops.push(l);break}n[2]&&c.ops.pop(),c.trys.pop();continue}l=t.call(e,c)}catch(e){l=[6,e],o=0}finally{r=n=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}var S=/\{\{.+?\}\}/;function x(e,t){return O.apply(this,arguments)}function O(){return(O=h(function(t,r){var o,n,i,c,a,l,s,u,f;return k(this,function(p){var g;switch(p.label){case 0:if("string"==typeof t)return[2,S.test(t)?(0,e.getVariableValue)(t,r):t];if(Array.isArray(t))return[2,Promise.all(t.map(function(e){return x(e,r)}))];if(null===t||(void 0===t?"undefined":t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t)!="object")return[3,9];o={},n=!0,i=!1,c=void 0,p.label=1;case 1:p.trys.push([1,6,7,8]),a=Object.entries(t)[Symbol.iterator](),p.label=2;case 2:if(n=(l=a.next()).done)return[3,5];return g=l.value,u=(s=function(e){if(Array.isArray(e))return e}(g)||function(e,t){var r,o,n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i=[],c=!0,a=!1;try{for(n=n.call(e);!(c=(r=n.next()).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){a=!0,o=e}finally{try{c||null==n.return||n.return()}finally{if(a)throw o}}return i}}(g,2)||v(g,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.")}())[0],[4,x(s[1],r)];case 3:o[u]=p.sent(),p.label=4;case 4:return n=!0,[3,2];case 5:return[3,8];case 6:return f=p.sent(),i=!0,c=f,[3,8];case 7:try{n||null==a.return||a.return()}finally{if(i)throw c}return[7];case 8:return[2,o];case 9:return[2,t]}})})).apply(this,arguments)}function C(){var t=(0,e.useAPIClient)(),r=(0,e.useActionContext)().setVisible,o=(0,u.useNavigate)(),n=(0,p.useFieldSchema)(),i=(0,p.useField)(),c=(0,e.useCompile)(),a=f.App.useApp(),l=a.modal,s=a.message,g=(0,e.useLocalVariables)(),d=(0,e.useVariables)();return{onClick:function(a,u){return h(function(){var a,f,p,y,w,v,S,O,C,T,P,A,j,W,R;return k(this,function(E){switch(E.label){case 0:if(p=(f=null!=(a=null==n?void 0:n["x-action-settings"])?a:{}).onSuccess,y=f.triggerWorkflows,w=f.contextData,S=(v=p||{}).manualClose,O=v.redirecting,C=v.redirectTo,T=v.successMessage,P=v.actionAfterSuccess,!(null==y?void 0:y.length))return s.error(b("Button is not configured properly, please contact the administrator.")),[2];i.data=i.data||{},i.data.loading=!0,E.label=1;case 1:if(E.trys.push([1,8,9,10]),A={variables:d,localVariables:g},!w)return[3,5];E.label=2;case 2:return E.trys.push([2,4,,5]),[4,x("string"==typeof w?JSON.parse(w):w,A)];case 3:return j=E.sent(),[3,5];case 4:return E.sent(),[3,5];case 5:return[4,t.resource("workflows").trigger({values:j,triggerWorkflows:y.map(function(e){return[e.workflowKey,e.context].filter(Boolean).join("!")}).join(",")})];case 6:return W=E.sent(),i.data.data=W,null==u||u(),"previous"!==P&&(P||!0===O)||null==r||r(!1),[4,(0,e.getVariableValue)(C,{variables:d,localVariables:g})];case 7:if(R=E.sent(),!T)return(O&&!P||"redirect"===P)&&R&&((0,m.isURL)(R)?window.location.href=R:o(R)),[2];return S?l.success({title:c(T),onOk:h(function(){return k(this,function(e){return(O&&!P||"redirect"===P)&&R&&((0,m.isURL)(R)?window.location.href=R:o(R)),[2]})})}):(s.success(c(T)),(O&&!P||"redirect"===P)&&R&&((0,m.isURL)(p.redirectTo)?window.location.href=p.redirectTo:o(p.redirectTo))),[3,10];case 8:return console.error(E.sent()),[3,10];case 9:return i.data.loading=!1,[7];case 10:return[2]}})})()}}}function T(){var t=(0,e.useAPIClient)(),r=(0,e.useActionContext)().setVisible,o=(0,u.useNavigate)(),n=(0,p.useFieldSchema)(),i=(0,p.useField)(),c=(0,e.useCompile)(),a=f.App.useApp(),l=a.modal,s=a.message,g=(0,e.useCollection)(),d=(0,e.useBlockRequestContext)().field,y=(0,e.useLocalVariables)(),w=(0,e.useVariables)();return{onClick:function(a,u){return h(function(){var a,f,p,v,S,x,O,C,T,P,A,j,W,R,E,I;return k(this,function(B){switch(B.label){case 0:if(S=(v=null!=(p=null==n?void 0:n["x-action-settings"])?p:{}).onSuccess,x=v.triggerWorkflows,C=(O=S||{}).manualClose,T=O.redirecting,P=O.redirectTo,A=O.successMessage,j=O.actionAfterSuccess,!(null==x?void 0:x.length))return s.error(b("Button is not configured properly, please contact the administrator.")),[2];if(!(null==(f=d.data)||null==(a=f.selectedRowKeys)?void 0:a.length))return s.error(b("Please select at least one record.")),[2];i.data=i.data||{},i.data.loading=!0,B.label=1;case 1:return B.trys.push([1,4,5,6]),[4,t.resource(g.name,void 0,{"x-data-source":g.dataSource}).trigger({filterByTk:null==(W=d.data)?void 0:W.selectedRowKeys,triggerWorkflows:(null==x?void 0:x.length)?x.map(function(e){return[e.workflowKey,e.context].filter(Boolean).join("!")}).join(","):void 0})];case 2:return E=B.sent(),(null==(R=d.data)?void 0:R.clearSelectedRowKeys)&&d.data.clearSelectedRowKeys(),i.data.data=E,null==u||u(),"previous"!==j&&(j||!0===T)||null==r||r(!1),[4,(0,e.getVariableValue)(P,{variables:w,localVariables:y})];case 3:if(I=B.sent(),!A)return(T&&!j||"redirect"===j)&&I&&((0,m.isURL)(I)?window.location.href=I:o(I)),[2];return C?l.success({title:c(A),onOk:h(function(){return k(this,function(e){return(T&&!j||"redirect"===j)&&I&&((0,m.isURL)(I)?window.location.href=I:o(I)),[2]})})}):(s.success(c(A)),(T&&!j||"redirect"===j)&&I&&((0,m.isURL)(S.redirectTo)?window.location.href=S.redirectTo:o(S.redirectTo))),[3,6];case 4:return console.error(B.sent()),[3,6];case 5:return i.data.loading=!1,[7];case 6:return[2]}})})()}}}function P(){var t=(0,p.useForm)(),r=(0,e.useBlockRequestContext)(),o=(r.field,r.resource),n=(0,e.useActionContext)().setVisible,i=(0,e.useFilterByTk)(),c=(0,u.useNavigate)(),a=(0,p.useFieldSchema)(),l=(0,p.useField)(),s=(0,e.useCompile)(),g=f.App.useApp(),d=g.modal,y=g.message,w=(0,e.useCollectValuesToSubmit)(),v=(0,e.useLocalVariables)(),S=(0,e.useVariables)();return{onClick:function(r,u){return h(function(){var r,f,p,g,x,O,C,T,P,A,j,W,R,E;return k(this,function(I){switch(I.label){case 0:if(p=(f=null!=(r=null==a?void 0:a["x-action-settings"])?r:{}).onSuccess,g=f.skipValidator,x=f.triggerWorkflows,C=(O=p||{}).manualClose,T=O.redirecting,P=O.redirectTo,A=O.successMessage,j=O.actionAfterSuccess,!(null==x?void 0:x.length))return y.error(b("Button is not configured properly, please contact the administrator.")),[2];if(g)return[3,2];return[4,t.submit()];case 1:I.sent(),I.label=2;case 2:return[4,w()];case 3:W=I.sent(),l.data=l.data||{},l.data.loading=!0,I.label=4;case 4:return I.trys.push([4,7,8,9]),[4,o.trigger({values:W,filterByTk:i,triggerWorkflows:(null==x?void 0:x.length)?x.map(function(e){return[e.workflowKey,e.context].filter(Boolean).join("!")}).join(","):void 0})];case 5:return R=I.sent(),l.data.data=R,null==u||u(),"previous"!==j&&(j||!0===T)||null==n||n(!1),[4,(0,e.getVariableValue)(P,{variables:S,localVariables:v})];case 6:if(E=I.sent(),!A)return(T&&!j||"redirect"===j)&&E&&((0,m.isURL)(E)?window.location.href=E:c(E)),[2];return C?d.success({title:s(A),onOk:h(function(){return k(this,function(e){switch(e.label){case 0:return[4,t.reset()];case 1:return e.sent(),(T&&!j||"redirect"===j)&&E&&((0,m.isURL)(E)?window.location.href=E:c(E)),[2]}})})}):(y.success(s(A)),(T&&!j||"redirect"===j)&&E&&((0,m.isURL)(p.redirectTo)?window.location.href=p.redirectTo:c(p.redirectTo))),[3,9];case 7:return console.error(I.sent()),[3,9];case 8:return l.data.loading=!1,[7];case 9:return[2]}})})()}}}function A(){var t=(0,e.useCompile)(),r=(0,e.useFilterByTk)(),o=(0,e.useCollectionRecordData)(),n=(0,p.useField)(),i=(0,p.useFieldSchema)(),c=(0,e.useBlockRequestContext)(),a=(c.field,c.resource),l=(0,e.useActionContext)(),s=l.setVisible,g=l.setSubmitted,d=f.App.useApp(),w=d.modal,S=d.message,x=(0,u.useNavigate)(),O=(0,e.useLocalVariables)(),C=(0,e.useVariables)();return{onClick:function(c,l){return h(function(){var c,u,f,p,d,T,P,A,j,W,R;return k(this,function(E){switch(E.label){case 0:if(f=(u=null!=(c=null==i?void 0:i["x-action-settings"])?c:{}).onSuccess,p=u.triggerWorkflows,T=(d=f||{}).manualClose,P=d.redirecting,A=d.redirectTo,j=d.successMessage,W=d.actionAfterSuccess,!(null==p?void 0:p.length))return S.error(b("Button is not configured properly, please contact the administrator.")),[2];n.data=n.data||{},n.data.loading=!0,E.label=1;case 1:return E.trys.push([1,4,5,6]),[4,a.trigger({filterByTk:r,triggerWorkflows:(null==p?void 0:p.length)?p.map(function(e){return[e.workflowKey,e.context].filter(Boolean).join("!")}).join(","):void 0})];case 2:return E.sent(),l&&l(),"previous"!==W&&(W||!0===P)||null==s||s(!1),null==g||g(!0),[4,(0,e.getVariableValue)(A,{variables:C,localVariables:((function(e){if(Array.isArray(e))return y(e)})(O)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(O)||v(O)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).concat([{name:"$record",ctx:new Proxy(o,{})}])})];case 3:if(R=E.sent(),!j)return(P&&!W||"redirect"===W)&&R&&((0,m.isURL)(R)?window.location.href=R:x(R)),[2];return T?w.success({title:t(j),onOk:function(){return h(function(){return k(this,function(e){return(P&&!W||"redirect"===W)&&R&&((0,m.isURL)(R)?window.location.href=R:x(R)),[2]})})()}}):(S.success(t(j)),(P&&!W||"redirect"===W)&&R&&((0,m.isURL)(f.redirectTo)?window.location.href=f.redirectTo:x(f.redirectTo))),[3,6];case 4:return console.error(E.sent()),[3,6];case 5:return n.data.loading=!1,[7];case 6:return[2]}})})()}}}function j(e,t,r,o,n,i,c){try{var a=e[i](c),l=a.value}catch(e){r(e);return}a.done?t(l):Promise.resolve(l).then(o,n)}function W(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),o.forEach(function(t){var o;o=r[t],t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o})}return e}function R(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r.push.apply(r,o)}return r})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function E(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function I(){var e=E(["\n position: relative;\n .ant-input {\n width: 100%;\n }\n "]);return I=function(){return e},e}function B(){var e=E(["\n position: absolute;\n right: 0;\n top: 0;\n "]);return B=function(){return e},e}function M(e){var t=(0,r.useCurrentWorkflowContext)();return e.types.includes(t.config.type)||e.types.includes(a.GLOBAL)&&!t.config.type?e.children:null}function D(e){return(0,r.useCurrentWorkflowContext)().config.type?n().createElement(r.TriggerCollectionRecordSelect,e):n().createElement(r.WorkflowVariableJSON,W({changeOnSelect:!0,autoSize:{minRows:6}},e))}function L(t){var r=C().onClick;return n().createElement(e.Action,R(W({},t),{onClick:r}))}function F(r){var i,c=r.value,a=r.onChange,l=function(e,t){if(null==e)return{};var r,o,n=function(e,t){if(null==e)return{};var r,o,n={},i=Object.keys(e);for(o=0;o<i.length;o++)r=i[o],t.indexOf(r)>=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)r=i[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}(r,["value","onChange"]),u=(0,o.useRef)(null),f=(0,t.useFlowContext)(),p=(0,o.useCallback)((i=function(){var e;return function(e,t){var r,o,n,i,c={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){var l=[i,a];if(r)throw TypeError("Generator is already executing.");for(;c;)try{if(r=1,o&&(n=2&l[0]?o.return:l[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,l[1])).done)return n;switch(o=0,n&&(l=[2&l[0],n.value]),l[0]){case 0:case 1:n=l;break;case 4:return c.label++,{value:l[1],done:!1};case 5:c.label++,o=l[1],l=[0];continue;case 7:l=c.ops.pop(),c.trys.pop();continue;default:if(!(n=(n=c.trys).length>0&&n[n.length-1])&&(6===l[0]||2===l[0])){c=0;continue}if(3===l[0]&&(!n||l[1]>n[0]&&l[1]<n[3])){c.label=l[1];break}if(6===l[0]&&c.label<n[1]){c.label=n[1],n=l;break}if(n&&c.label<n[2]){c.label=n[2],c.ops.push(l);break}n[2]&&c.ops.pop(),c.trys.pop();continue}l=t.call(e,c)}catch(e){l=[6,e],o=0}finally{r=n=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(t){return[2,(null==f||null==(e=f.getPropertyMetaTree)?void 0:e.call(f))||[]]})},function(){var e=this,t=arguments;return new Promise(function(r,o){var n=i.apply(e,t);function c(e){j(n,r,o,c,a,"next",e)}function a(e){j(n,r,o,c,a,"throw",e)}c(void 0)})}),[f]),g=(0,o.useCallback)(function(e){if(u.current){var t,r,o=u.current.querySelector("textarea");if(o){var n,i,c=null!=(t=o.selectionStart)?t:0,a=null!=(r=o.selectionEnd)?r:0,l=o.value.slice(0,c)+e+o.value.slice(a),s=c+e.length;null==(i=null==(n=Object.getOwnPropertyDescriptor(o.constructor.prototype,"value"))?void 0:n.set)||i.call(o,l),o.dispatchEvent(new Event("input",{bubbles:!0})),o.setSelectionRange(s,s),o.focus()}}},[]);return n().createElement("div",{ref:u,className:(0,s.css)(I())},n().createElement(e.Input.JSON,R(W({autoSize:{minRows:5}},l),{value:c,onChange:a})),n().createElement("div",{className:(0,s.css)(B())},n().createElement(t.FlowContextSelector,{metaTree:p,onChange:g})))}function z(t){var r=(0,e.useCurrentUserVariable)({noDisabled:!0}).currentUserSettings,i=(0,e.useCurrentRoleVariable)({noDisabled:!0}).currentRoleSettings,c=(0,e.useAPITokenVariable)({noDisabled:!0}).apiTokenSettings,a=(0,o.useMemo)(function(){return[r,i,c].filter(Boolean)},[r,i,c]);return n().createElement(e.Variable.JSON,W({changeOnSelect:!0,scope:a},t))}function V(e,t,r,o,n,i,c){try{var a=e[i](c),l=a.value}catch(e){r(e);return}a.done?t(l):Promise.resolve(l).then(o,n)}function q(e){return function(){var t=this,r=arguments;return new Promise(function(o,n){var i=e.apply(t,r);function c(e){V(i,o,n,c,a,"next",e)}function a(e){V(i,o,n,c,a,"throw",e)}c(void 0)})}}function _(e,t,r){return t=K(t),function(e,t){var r;if(t&&("object"==((r=t)&&"undefined"!=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}(e,Q()?Reflect.construct(t,r||[],K(e).constructor):t.apply(e,r))}function N(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function G(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(){return(U=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e}).apply(this,arguments)}function K(e){return(K=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function J(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Y(e,t)}function $(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),o.forEach(function(t){G(e,t,r[t])})}return e}function H(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r.push.apply(r,o)}return r})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function Y(e,t){return(Y=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Q(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Q=function(){return!!e})()}function X(e,t){var r,o,n,i,c={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){var l=[i,a];if(r)throw TypeError("Generator is already executing.");for(;c;)try{if(r=1,o&&(n=2&l[0]?o.return:l[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,l[1])).done)return n;switch(o=0,n&&(l=[2&l[0],n.value]),l[0]){case 0:case 1:n=l;break;case 4:return c.label++,{value:l[1],done:!1};case 5:c.label++,o=l[1],l=[0];continue;case 7:l=c.ops.pop(),c.trys.pop();continue;default:if(!(n=(n=c.trys).length>0&&n[n.length-1])&&(6===l[0]||2===l[0])){c=0;continue}if(3===l[0]&&(!n||l[1]>n[0]&&l[1]<n[3])){c.label=l[1];break}if(6===l[0]&&c.label<n[1]){c.label=n[1],n=l;break}if(n&&c.label<n[2]){c.label=n[2],c.ops.push(l);break}n[2]&&c.ops.pop(),c.trys.pop();continue}l=t.call(e,c)}catch(e){l=[6,e],o=0}finally{r=n=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}var Z=function(e){function r(){var e;return N(this,r),e=_(this,r,arguments),G(e,"defaultProps",{title:(0,t.tExpr)("Trigger workflow",{ns:i})}),e}return J(r,e),r}(e.FormActionModel);Z.define({label:(0,t.tExpr)("Trigger workflow",{ns:i})}),Z.registerFlow({key:"customFormTriggerWorkflowsActionSettings",on:"click",title:"{{t('Workflow', { ns: 'workflow' })}}",steps:{confirm:{use:"confirm"},triggerWorkflows:{title:"{{t('Bind workflows', { ns: 'workflow' })}}",uiSchema:(0,r.createTriggerWorkflowsSchema)({filter:{type:c},optionFilter:function(e){return e.config.type===a.SINGLE_RECORD}}),handler:function(e,t){return q(function(){var r,o;return X(this,function(n){switch(n.label){case 0:if(!(null==(r=t.group)?void 0:r.length))return e.message.error(e.t("Button is not configured properly, please contact the administrator.",{ns:i})),e.exit(),[2];if(!e.blockModel)return e.exit(),[2];n.label=1;case 1:var c;return n.trys.push([1,3,4,5]),e.model.setProps("loading",!0),[4,e.blockModel.submitHandler(e,{},(c=q(function(r,o){var n;return X(this,function(i){switch(i.label){case 0:return[4,e.blockModel.resource.runAction("trigger",{params:H($({},null!=o?{filterByTk:o}:{}),{triggerWorkflows:(null==(n=t.group)?void 0:n.length)?t.group.map(function(e){return[e.workflowKey,e.context].filter(Boolean).join("!")}).join(","):void 0}),data:r})];case 1:return[2,i.sent()]}})}),function(e,t){return c.apply(this,arguments)}))];case 2:return n.sent(),e.model.setProps("loading",!1),[3,5];case 3:return o=n.sent(),e.model.setProps("loading",!1),console.error("Error triggering workflows:",o),e.exit(),[3,5];case 4:return e.model.setProps("loading",!1),[7];case 5:return[2]}})})()}},afterSuccess:{use:"afterSuccess",defaultParams:{successMessage:(0,t.tExpr)("Operation succeeded")}}}});var ee=function(e){function r(){var e;return N(this,r),e=_(this,r,arguments),G(e,"defaultProps",{title:(0,t.tExpr)("Trigger workflow",{ns:i})}),e}return J(r,e),r}(e.ActionModel);G(ee,"scene",e.ActionSceneEnum.record),ee.define({label:(0,t.tExpr)("Trigger workflow",{ns:i})}),ee.registerFlow({key:"customRecordTriggerWorkflowsActionSettings",on:"click",title:"{{t('Workflow', { ns: 'workflow' })}}",steps:{confirm:{use:"confirm"},triggerWorkflows:{title:"{{t('Bind workflows', { ns: 'workflow' })}}",uiSchema:(0,r.createTriggerWorkflowsSchema)({filter:{type:c},optionFilter:function(e){return e.config.type===a.SINGLE_RECORD}}),handler:function(e,t){return q(function(){var r,o,n,c,a;return X(this,function(l){switch(l.label){case 0:if(n=(o=e.blockModel).resource,c=o.collection,!n||!c)return e.exit(),[2];if(!(null==(r=t.group)?void 0:r.length))return e.message.error(e.t("Button is not configured properly, please contact the administrator.",{ns:i})),e.exit(),[2];l.label=1;case 1:return l.trys.push([1,3,,4]),[4,n.runAction("trigger",{params:{triggerWorkflows:(null==(a=t.group)?void 0:a.length)?t.group.map(function(e){return[e.workflowKey,e.context].filter(Boolean).join("!")}).join(","):void 0,filterByTk:function(e,t){if(!e||!t)return null;var r=t.filterTargetKey;return Array.isArray(r)?r.reduce(function(t,r){return t[r]=e[r],t},{}):e[r]}(e.record,c)}})];case 2:return l.sent(),[3,4];case 3:return console.error("Error triggering workflows:",l.sent()),e.exit(),[3,4];case 4:return[2]}})})()}},afterSuccess:{use:"afterSuccess",defaultParams:{successMessage:(0,t.tExpr)("Operation succeeded"),actionAfterSuccess:"previous"}}}});var et=function(e){function t(){var e;return N(this,t),e=_(this,t,arguments),G(e,"defaultProps",{title:null}),e}return J(t,e),t}(e.CollectionActionModel);function er(e){var i=U({},function(e){if(null==e)throw TypeError("Cannot destructure "+e);return e}(e)),c=(0,t.useFlowContext)().model,a=(0,o.useCallback)(function(e){var t=e.config,r=c.stepParams.customCollectionTriggerWorkflowsActionSettings.setContextType.type;return r&&t.type===r||!t.type},[c.stepParams.customCollectionTriggerWorkflowsActionSettings.setContextType]);return n().createElement(r.TriggerWorkflowSelect,H($({},i),{optionFilter:a}))}G(et,"scene",e.ActionSceneEnum.collection),et.define({label:"{{t('Trigger workflow', { ns: '".concat(i,"' })}}")}),et.registerFlow({key:"customCollectionTriggerWorkflowsActionSettings",title:"{{t('Workflow', { ns: 'workflow' })}}",steps:{setContextType:{hideInSettings:!0,preset:!0,title:"{{t('Context type', { ns: '".concat(i,"' })}}"),uiSchema:{type:{type:"number","x-decorator":"FormItem","x-component":"Radio.Group",enum:[{label:"{{t('Custom context', { ns: '".concat(i,"' })}}"),value:a.GLOBAL},{label:"{{t('Multiple collection records', { ns: '".concat(i,"' })}}"),value:a.MULTIPLE_RECORDS}],required:!0}},handler:function(e,t){e.model.props.title||e.model.setProps("title",t.type?e.t("Trigger workflow",{ns:i}):e.t("Trigger global workflow",{ns:i}))}},triggerWorkflows:{title:"{{t('Bind workflows', { ns: 'workflow' })}}",uiSchema:function(e){var t,o,n=(0,r.createTriggerWorkflowsSchema)({WorkflowSelectComponent:er,filter:{type:c},usingContext:!1})(e);return(null!=(o=null==(t=e.model.stepParams.customCollectionTriggerWorkflowsActionSettings)?void 0:t.setContextType)?o:{}).type?n:H($({},n),{contextData:{type:"string",title:"{{t('Context data', { ns: '".concat(i,"' })}}"),"x-decorator":"FormItem","x-component":F}})}}}}),et.registerFlow({key:"customCollectionTriggerWorkflowsActionEventSettings",on:"click",steps:{confirm:{use:"confirm"},trigger:{handler:function(e){return q(function(){var r,o,n,c,l,s,u,f,p;return X(this,function(g){switch(g.label){case 0:if(o=(r=e.model.stepParams.customCollectionTriggerWorkflowsActionSettings).setContextType.type,l=(c=null!=(n=r.triggerWorkflows)?n:{}).group,s=c.contextData,!(null==l?void 0:l.length))return e.message.error(e.t("Button is not configured properly, please contact the administrator.",{ns:i})),e.exit(),[2];if(o!==a.MULTIPLE_RECORDS)return[3,5];if(!(null==(u=e.blockModel)?void 0:u.resource))return e.message.error(e.t("No resource selected for deletion")),e.exit(),[2];if(0===(f=e.blockModel.resource).getSelectedRows().length)return e.message.warning(e.t("Please select at least one record.",{ns:i})),e.exit(),[2];g.label=1;case 1:return g.trys.push([1,3,,4]),[4,f.runAction("trigger",{params:{triggerWorkflows:(null==l?void 0:l.length)?l.map(function(e){return[e.workflowKey,e.context].filter(Boolean).join("!")}).join(","):void 0,filterByTk:e.blockModel.collection.getFilterByTK(f.getSelectedRows())}})];case 2:return g.sent(),f.setSelectedRows([]),[3,4];case 3:return console.error("Error triggering workflows:",g.sent()),e.exit(),[2];case 4:return[3,14];case 5:if(o)return[3,13];if(!s)return[3,9];g.label=6;case 6:return g.trys.push([6,8,,9]),[4,(0,t.resolveExpressions)(s,e)];case 7:return p=g.sent(),[3,9];case 8:return g.sent(),[3,9];case 9:return g.trys.push([9,11,,12]),[4,e.api.request({url:"workflows:trigger",method:"post",params:{triggerWorkflows:(null==l?void 0:l.length)?l.map(function(e){return[e.workflowKey,e.context].filter(Boolean).join("!")}).join(","):void 0},data:{values:p}})];case 10:return g.sent(),[3,12];case 11:return console.error("Error triggering workflows:",g.sent()),e.exit(),[2];case 12:return[3,14];case 13:throw Error("Invalid context type");case 14:return[2]}})})()}},afterSuccess:{use:"afterSuccess",defaultParams:{successMessage:(0,t.tExpr)("Operation succeeded"),actionAfterSuccess:"previous"}}}});var eo=function(e){function r(){var e;return N(this,r),e=_(this,r,arguments),G(e,"defaultProps",{title:(0,t.tExpr)("Trigger global workflow",{ns:i})}),e}return J(r,e),r}(e.ActionModel);G(eo,"scene",e.ActionSceneEnum.collection);var en=function(e){function r(){var e;return N(this,r),e=_(this,r,arguments),G(e,"defaultProps",{title:(0,t.tExpr)("Trigger global workflow",{ns:i}),icon:"ThunderboltOutlined"}),e}return J(r,e),r}(e.ActionModel);function ei(e){return H($({},(0,r.createTriggerWorkflowsSchema)({filter:{type:c},optionFilter:function(e){return!e.config.type},usingContext:!1})(e)),{contextData:{type:"string",title:"{{t('Context data', { ns: '".concat(i,"' })}}"),"x-decorator":"FormItem","x-component":F}})}function ec(e,t){return ea.apply(this,arguments)}function ea(){return(ea=q(function(e,r){var o,n;return X(this,function(i){switch(i.label){case 0:if(!r.contextData)return[3,4];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,(0,t.resolveExpressions)(r.contextData,e)];case 2:return o=i.sent(),[3,4];case 3:return i.sent(),[3,4];case 4:return i.trys.push([4,6,,7]),[4,e.api.request({url:"workflows:trigger",method:"post",params:{triggerWorkflows:(null==(n=r.group)?void 0:n.length)?r.group.map(function(e){return[e.workflowKey,e.context].filter(Boolean).join("!")}).join(","):void 0},data:{values:o}})];case 5:return i.sent(),e.message.success(e.t("Operation succeeded")),[3,7];case 6:return console.error("Error triggering workflows:",i.sent()),[3,7];case 7:return[2]}})})).apply(this,arguments)}function el(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=Array(t);r<t;r++)o[r]=e[r];return o}eo.define({label:(0,t.tExpr)("Trigger global workflow",{ns:i})}),en.define({label:(0,t.tExpr)("Trigger global workflow",{ns:i})}),eo.registerFlow({key:"customCollectionGlobalTriggerWorkflowsActionSettings",on:"click",title:"{{t('Workflow', { ns: 'workflow' })}}",steps:{confirm:{use:"confirm"},triggerWorkflows:{title:"{{t('Bind workflows', { ns: 'workflow' })}}",uiSchema:ei,handler:ec},afterSuccess:{use:"afterSuccess",defaultParams:{successMessage:(0,t.tExpr)("Operation succeeded"),actionAfterSuccess:"previous"}}}}),en.registerFlow({key:"workbenchTriggerWorkflowsActionSettings",on:"click",title:"{{t('Workflow', { ns: 'workflow' })}}",steps:{confirm:{use:"confirm"},triggerWorkflows:{title:"{{t('Bind workflows', { ns: 'workflow' })}}",uiSchema:ei,handler:ec},afterSuccess:{use:"afterSuccess",defaultParams:{successMessage:(0,t.tExpr)("Operation succeeded"),actionAfterSuccess:"previous"}}}});function es(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function eu(e){return(eu=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ef(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),o.forEach(function(t){es(e,t,r[t])})}return e}function ep(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r.push.apply(r,o)}return r})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function eg(e,t){return(eg=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ed(e){return function(e){if(Array.isArray(e))return el(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||em(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 em(e,t){if(e){if("string"==typeof e)return el(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 el(e,t)}}function eb(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eb=function(){return!!e})()}function ey(t,o){var n,i,c=(0,e.useCompile)(),l=(0,r.useGetDataSourceCollectionManager)(),s=(n=t.collection?(0,e.parseCollectionName)(t.collection):[],function(e){if(Array.isArray(e))return e}(n)||function(e,t){var r,o,n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i=[],c=!0,a=!1;try{for(n=n.call(e);!(c=(r=n.next()).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){a=!0,o=e}finally{try{c||null==n.return||n.return()}finally{if(a)throw o}}return i}}(n,1)||em(n,1)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0],u=(0,r.useGetDataSourceCollectionManager)(s),f=(0,r.getCollectionFieldOptions)(ep(ef({appends:["user"]},o),{fields:[{collectionName:"users",name:"user",type:"hasOne",target:"users",uiSchema:{title:b("User acted")}}],compile:c,collectionManager:l}));return t.global||t.type===a.GLOBAL||!t.collection?[{label:b("Trigger data"),value:"data"}].concat(ed(f),[{label:b("Role of user acted"),value:"roleName"}]):ed((0,r.getCollectionFieldOptions)(ep(ef({appends:["data"].concat(ed((null==(i=t.appends)?void 0:i.map(function(e){return"data.".concat(e)}))||[]))},o),{fields:[{collectionName:t.collection,name:"data",type:"hasOne",target:t.collection,uiSchema:{title:b("Trigger data")}}],compile:c,collectionManager:u}))).concat(ed(f),[{label:b("Role of user acted"),value:"roleName"}])}var ew=function(t){var o;if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");function c(){var t,o,s;if(!(this instanceof c))throw TypeError("Cannot call a class as a function");return o=c,s=arguments,o=eu(o),es(t=function(e,t){var r;if(t&&("object"==((r=t)&&"undefined"!=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,eb()?Reflect.construct(o,s||[],eu(this).constructor):o.apply(this,s)),"title",'{{t("Custom action event", { ns: "'.concat(i,'" })}}')),es(t,"description",'{{t(\'When the "Trigger Workflow" button is clicked, the event is triggered based on different context where the button is located. For complex data processing that cannot be handled simply by built-in operations (CRUD) of NocoBase, you can define a series of operations through a workflow and trigger it with the "Trigger Workflow" button.\', { ns: "'.concat(i,'" })}}')),es(t,"fieldset",{type:{type:"number",title:'{{t("Context type", { ns: "'.concat(i,'" })}}'),description:'{{t("", { ns: "'.concat(i,'" })}}'),"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{direction:"vertical",options:l},default:a.GLOBAL,"x-disabled":"{{ useWorkflowAnyExecuted() }}"},collection:es({type:"string",title:'{{t("Collection")}}',required:!0,"x-decorator":"FormItem","x-component":"DataSourceCollectionCascader","x-disabled":"{{ useWorkflowAnyExecuted() }}"},"x-reactions",[{target:"appends",effects:["onFieldValueChange"],fulfill:{state:{value:[]}}},{dependencies:["type"],fulfill:{state:{visible:"{{Boolean($deps[0])}}"}}}]),appends:{type:"array",title:'{{t("Associations to use", { ns: "'.concat(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:function(){var e=(0,p.useForm)().values;return null==e?void 0:e.collection}},"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]}}),es(t,"triggerFieldset",{data:{type:"void","x-component":"TriggerScopeProvider","x-component-props":{types:[a.GLOBAL,a.SINGLE_RECORD]},properties:{data:{type:"object",title:'{{t("Trigger data", { ns: "'.concat(i,'" })}}'),description:'{{t("Use JSON as trigger data for custom data context, or choose a record in single record context.", { ns: "'.concat(i,'" })}}'),"x-decorator":"FormItem","x-component":"TriggerDataInput",default:null}}},filterByTk:{type:"void","x-component":"TriggerScopeProvider","x-component-props":{types:[a.MULTIPLE_RECORDS]},properties:{filterByTk:{type:"array",title:'{{t("Trigger data", { ns: "'.concat(i,'" })}}'),description:'{{t("Choose a record or primary key of a record in the collection to trigger.", { ns: "workflow" })}}',"x-decorator":"FormItem","x-component":"TriggerCollectionRecordSelect","x-component-props":{multiple:!0,objectValue:!1},default:[],required:!0}}},userId:{type:"number",title:'{{t("User acted", { ns: "'.concat(i,'" })}}'),"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,ef({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(i,'" })}}'),"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,ef({fieldNames:{label:"title",value:"name"},service:{resource:"roles"},manual:!1},t))}},default:null}}),es(t,"scope",{useWorkflowAnyExecuted:r.useWorkflowAnyExecuted,useCollectionDataSource:e.useCollectionDataSource}),es(t,"components",{TriggerScopeProvider:M,TriggerDataInput:D,TriggerCollectionRecordSelect:r.TriggerCollectionRecordSelect,WorkflowVariableWrapper:r.WorkflowVariableWrapper,WorkflowVariableJSON:r.WorkflowVariableJSON,RadioWithTooltip:r.RadioWithTooltip}),es(t,"isActionTriggerable_deprecated",function(e,t){return"customize:triggerWorkflows"===t.buttonAction&&e.type===a.SINGLE_RECORD}),es(t,"useVariables",ey),t}return c.prototype=Object.create(t&&t.prototype,{constructor:{value:c,writable:!0,configurable:!0}}),t&&eg(c,t),o=[{key:"validate",value:function(e){return!e.type||e.type===a.GLOBAL||[a.SINGLE_RECORD,a.MULTIPLE_RECORDS].includes(e.type)&&e.collection}},{key:"useInitializers",value:function(e){return e.global||!e.collection?null:{name:"triggerData",type:"item",key:"triggerData",title:'{{t("Trigger data", { ns: "workflow" })}}',Component:r.CollectionBlockInitializer,collection:e.collection,dataPath:"$context.data"}}},{key:"getCreateModelMenuItem",value:function(e){var t=e.config;return t.collection?{key:"triggerData",label:'{{t("Trigger data", { ns: "workflow" })}}',useModel:"NodeDetailsModel",createModelOptions:{use:"NodeDetailsModel",stepParams:{resourceSettings:{init:{dataSourceKey:"main",collectionName:t.collection,dataPath:"$context.data"}},cardSettings:{titleDescription:{title:'{{t("Trigger data", { ns: "workflow" })}}'}}},subModels:{grid:{use:"NodeDetailsGridModel",subType:"object"}}}}:null}}],function(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}(c.prototype,o),c}(r.Trigger),eh=g(632),ev=g(238);function ek(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function eS(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),o.forEach(function(t){ek(e,t,r[t])})}return e}function ex(){var t,r,o=(0,e.useDesignable)().dn,c=(0,ev.useTranslation)().t,l=(0,p.useFieldSchema)(),s=(0,e.useCollection)(),u="customize:collectionTriggerWorkflows"===l["x-action"];return n().createElement(e.SchemaSettingsActionModalItem,{title:c("Bind workflows",{ns:"workflow"}),width:"30%",components:{Alert:f.Alert,ArrayTable:eh.ArrayTable,RemoteSelect:e.RemoteSelect,GlobalContextDataInput:z},scope:{t:c},schema:{type:"void",title:c("Bind workflows",{ns:"workflow"}),properties:eS({description:{type:"void","x-component":"Alert","x-component-props":{message:u?'{{t(\'Only support custom action workflow with context type set to "Multiple records".\', { ns: "'.concat(i,'" })}}'):'{{t(\'Only support custom action workflow with context type set to "Custom context".\', { ns: "'.concat(i,'" })}}'),style:{marginBottom:"1em"}}},group:{type:"array","x-component":"ArrayTable","x-decorator":"FormItem",items:{type:"object",properties:{sort:{type:"void","x-component":"ArrayTable.Column","x-component-props":{width:50,title:"",align:"center"},properties:{sort:{type:"void","x-component":"ArrayTable.SortHandle"}}},workflowKey:{type:"void","x-component":"ArrayTable.Column","x-component-props":{title:"{{t('Workflow', { ns: 'workflow' })}}"},properties:{workflowKey:{type:"string","x-decorator":"FormItem","x-component":"RemoteSelect","x-component-props":{manual:!1,placeholder:c("Select workflow",{ns:"workflow"}),fieldNames:{label:"title",value:"key"},dataSource:"main",service:{resource:"workflows",action:"list",params:{filter:eS({type:"custom-action",enabled:!0},u?{"config.type":a.MULTIPLE_RECORDS,"config.collection":(0,e.joinCollectionName)(s.dataSource,s.name)}:{$or:[{"config.type":a.GLOBAL},{"config.type":null}]})}}},required:!0}}},operations:{type:"void","x-component":"ArrayTable.Column","x-component-props":{width:32},properties:{remove:{type:"void","x-component":"ArrayTable.Remove"}}}}},properties:{add:{type:"void",title:c("Add workflow",{ns:"workflow"}),"x-component":"ArrayTable.Addition"}}}},u?{}:{contextData:{type:"string",title:"{{t('Context data', { ns: \"".concat(i,'" })}}'),description:"{{t('Input JSON as context data passed into the workflow. Frontend variables are supported.', { ns: \"".concat(i,'" })}}'),"x-decorator":"FormItem","x-component":"GlobalContextDataInput","x-component-props":{autoSize:{minRows:5}}}})},initialValues:{group:null==l||null==(t=l["x-action-settings"])?void 0:t.triggerWorkflows,contextData:null==l||null==(r=l["x-action-settings"])?void 0:r.contextData},onSubmit:function(e){var t,r=e.group,n=e.contextData;l["x-action-settings"]||(l["x-action-settings"]={}),l["x-action-settings"].triggerWorkflows=r,l["x-action-settings"].contextData=n,o.emit("patch",{schema:(ek(t={},"x-uid",l["x-uid"]),ek(t,"x-action-settings",l["x-action-settings"]),t)})}})}var eO=new e.SchemaSettings({name:"actionSettings:submitToWorkflow",items:[{name:"editButton",Component:e.ButtonEditor,useComponentProps:function(){return(0,e.useSchemaToolbar)().buttonEditorProps}},{name:"linkageRules",Component:e.SchemaSettingsLinkageRules,useComponentProps:function(){var t,r,o=(0,e.useCollection_deprecated)().name;return t=eS({},(0,e.useSchemaToolbar)().linkageRulesProps),r=r={collectionName:o},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r.push.apply(r,o)}return r})(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}),t}},{name:"secondConfirmation",Component:e.SecondConFirm},{name:"assignFieldValues",Component:e.AssignedFieldValues},{name:"skipRequiredValidation",Component:e.SkipValidation},{name:"afterSuccessfulSubmission",Component:e.AfterSuccess},{name:"refreshDataBlockRequest",Component:e.RefreshDataBlockRequest,useComponentProps:function(){return{isPopupAction:!1}}},{name:"bindWorkflow",Component:r.BindWorkflowConfig},e.SchemaSettingAccessControl,{name:"delete",sort:100,Component:e.RemoveButton,useComponentProps:function(){return(0,e.useSchemaToolbar)().removeButtonProps}}]}),eC=new e.SchemaSettings({name:"actionSettings:collectionTriggerWorkflow",items:[{name:"editButton",Component:e.ButtonEditor,useComponentProps:function(){return(0,e.useSchemaToolbar)().buttonEditorProps}},{name:"linkageRules",Component:e.SchemaSettingsLinkageRules,useComponentProps:function(){return eS({},(0,e.useSchemaToolbar)().linkageRulesProps)}},{name:"secondConfirmation",Component:e.SecondConFirm},{name:"afterSuccessfulSubmission",Component:e.AfterSuccess},{name:"refreshDataBlockRequest",Component:e.RefreshDataBlockRequest,useComponentProps:function(){return{isPopupAction:!1}}},{name:"bindWorkflow",Component:ex},e.SchemaSettingAccessControl,{name:"delete",sort:100,Component:e.RemoveButton,useComponentProps:function(){return(0,e.useSchemaToolbar)().removeButtonProps}}]}),eT=new e.SchemaSettings({name:"actionSettings:globalTriggerWorkflow",items:[{name:"editButton",Component:e.ButtonEditor,useComponentProps:function(){return(0,e.useSchemaToolbar)().buttonEditorProps}},{name:"linkageRules",Component:e.SchemaSettingsLinkageRules,useComponentProps:function(){return eS({},(0,e.useSchemaToolbar)().linkageRulesProps)}},{name:"secondConfirmation",Component:e.SecondConFirm},{name:"afterSuccessfulSubmission",Component:e.AfterSuccess},{name:"bindWorkflow",Component:ex},{name:"refreshDataBlockRequest",Component:e.RefreshDataBlockRequest,useComponentProps:function(){return{isPopupAction:!1}},useVisible:function(){return!!(0,(0,e.useDataBlockRequestGetter)().getDataBlockRequest)()}},e.SchemaSettingAccessControl,{name:"delete",sort:100,Component:e.RemoveButton,useComponentProps:function(){return(0,e.useSchemaToolbar)().removeButtonProps}}]});function eP(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),o.forEach(function(t){var o;o=r[t],t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o})}return e}function eA(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r.push.apply(r,o)}return r})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}var ej={name:"triggerWorkflow",title:'{{t("Trigger workflow", { ns: "'.concat(i,'" })}}'),Component:"CustomizeActionInitializer",schema:{title:'{{t("Trigger workflow", { ns: "'.concat(i,'" })}}'),"x-component":"Action","x-use-component-props":"useFormWorkflowCustomActionProps","x-settings":"actionSettings:submitToWorkflow","x-decorator":"ACLActionProvider","x-action-settings":{skipValidator:!1,onSuccess:{manualClose:!0,redirecting:!1,successMessage:'{{t("Submitted successfully")}}'},refreshDataBlockRequest:!0,triggerWorkflows:[]},"x-toolbar-props":{initializer:!1,showBorder:!1},"x-action":"customize:triggerWorkflows"},useVisible:function(){return"publicForm"!==((0,e.useDataBlockProps)()||{}).type}},eW={name:"triggerWorkflow",title:'{{t("Trigger workflow", { ns: "'.concat(i,'" })}}'),Component:"CustomizeActionInitializer",schema:{title:'{{t("Trigger workflow", { ns: "'.concat(i,'" })}}'),"x-component":"Action","x-use-component-props":"useRecordWorkflowCustomTriggerActionProps","x-settings":"actionSettings:submitToWorkflow","x-decorator":"ACLActionProvider","x-action-settings":{onSuccess:{manualClose:!0,redirecting:!1,successMessage:'{{t("Submitted successfully")}}'},refreshDataBlockRequest:!0,triggerWorkflows:[]},"x-toolbar-props":{initializer:!1,showBorder:!1},"x-action":"customize:triggerWorkflows"}},eR=eA(eP({},eW),{schema:eA(eP({},eW.schema),{"x-component":"Action.Link"})}),eE={name:"triggerWorkflow",title:'{{t("Trigger workflow", { ns: "'.concat(i,'" })}}'),Component:"CustomizeActionInitializer",schema:{title:'{{t("Trigger workflow", { ns: "'.concat(i,'" })}}'),"x-component":"Action","x-use-component-props":"useGlobalTriggerWorkflowCustomActionProps","x-settings":"actionSettings:globalTriggerWorkflow","x-decorator":"ACLActionProvider","x-action-settings":{onSuccess:{manualClose:!0,redirecting:!1,successMessage:'{{t("Submitted successfully")}}'},refreshDataBlockRequest:!0,triggerWorkflows:[]},"x-toolbar-props":{initializer:!1,showBorder:!1},"x-action":"customize:globalTriggerWorkflows"}};function eI(t){var o=(0,e.useSchemaInitializer)().insert,c=(0,ev.useTranslation)().t;return n().createElement(e.ModalActionSchemaInitializerItem,{title:c("Trigger workflow",{ns:i}),components:{RadioWithTooltip:r.RadioWithTooltip},modalSchema:{title:'{{t("Trigger workflow", { ns: "'.concat(i,'" })}}'),properties:{type:{title:"{{t('Context type', { ns: \"".concat(i,'" })}}'),"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{options:l.filter(function(e){var t=e.value;return[a.GLOBAL,a.MULTIPLE_RECORDS].includes(t)})},required:!0}}},onSubmit:function(e){o(eP({type:"void",title:"{{t('".concat(e.type?"Trigger workflow":"Trigger global workflow","', { ns: \"").concat(i,'" })}}'),"x-component":"Action","x-component-props":{},"x-action":e.type?"customize:collectionTriggerWorkflows":"customize:globalTriggerWorkflows","x-toolbar":"ActionSchemaToolbar","x-decorator":"ACLActionProvider","x-action-settings":{onSuccess:{manualClose:!1,redirecting:!1,successMessage:'{{t("Operation succeeded")}}'}}},e.type?{"x-use-component-props":"useCollectionTriggerWorkflowCustomActionProps","x-settings":"actionSettings:collectionTriggerWorkflow"}:{"x-use-component-props":"useGlobalTriggerWorkflowCustomActionProps","x-settings":"actionSettings:globalTriggerWorkflow"}))}})}function eB(t){var r=(0,e.useSchemaInitializer)().insert,o=(0,ev.useTranslation)().t;return n().createElement(e.ModalActionSchemaInitializerItem,{title:o("Trigger workflow",{ns:i}),modalSchema:{title:'{{t("Trigger workflow", { ns: "'.concat(i,'" })}}'),properties:{title:{title:"{{t('Title')}}","x-component":"Input","x-decorator":"FormItem",required:!0,default:'{{t("Trigger workflow", { ns: "'.concat(i,'" })}}')},icon:{title:"{{t('Icon')}}","x-component":"IconPicker","x-decorator":"FormItem",required:!0,default:"thunderboltoutlined"},iconColor:{title:"{{t('Color')}}","x-component":"ColorPicker","x-decorator":"FormItem",required:!0,default:"#1677FF"}}},onSubmit:function(e){r({type:"void",title:e.title,"x-component":"WorkbenchAction","x-decorator":"ACLActionProvider","x-component-props":{icon:e.icon,iconColor:e.iconColor,targetComponent:"GlobalTriggerWorkflowAction"},"x-action":"customize:globalTriggerWorkflows","x-toolbar":"ActionSchemaToolbar","x-settings":"actionSettings:globalTriggerWorkflow","x-action-settings":{onSuccess:{manualClose:!1,redirecting:!1,successMessage:'{{t("Operation succeeded")}}'}}})}})}function eM(e,t,r,o,n,i,c){try{var a=e[i](c),l=a.value}catch(e){r(e);return}a.done?t(l):Promise.resolve(l).then(o,n)}function eD(e){return function(){var t=this,r=arguments;return new Promise(function(o,n){var i=e.apply(t,r);function c(e){eM(i,o,n,c,a,"next",e)}function a(e){eM(i,o,n,c,a,"throw",e)}c(void 0)})}}function eL(e,t,r){return(eL=eq()?Reflect.construct:function(e,t,r){var o=[null];o.push.apply(o,t);var n=new(Function.bind.apply(e,o));return r&&ez(n,r.prototype),n}).apply(null,arguments)}function eF(e){return(eF=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ez(e,t){return(ez=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function eV(e){var t="function"==typeof Map?new Map:void 0;return(eV=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 eL(e,arguments,eF(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),ez(r,e)})(e)}function eq(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eq=function(){return!!e})()}function e_(e,t){var r,o,n,i,c={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){var l=[i,a];if(r)throw TypeError("Generator is already executing.");for(;c;)try{if(r=1,o&&(n=2&l[0]?o.return:l[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,l[1])).done)return n;switch(o=0,n&&(l=[2&l[0],n.value]),l[0]){case 0:case 1:n=l;break;case 4:return c.label++,{value:l[1],done:!1};case 5:c.label++,o=l[1],l=[0];continue;case 7:l=c.ops.pop(),c.trys.pop();continue;default:if(!(n=(n=c.trys).length>0&&n[n.length-1])&&(6===l[0]||2===l[0])){c=0;continue}if(3===l[0]&&(!n||l[1]>n[0]&&l[1]<n[3])){c.label=l[1];break}if(6===l[0]&&c.label<n[1]){c.label=n[1],n=l;break}if(n&&c.label<n[2]){c.label=n[2],c.ops.push(l);break}n[2]&&c.ops.pop(),c.trys.pop();continue}l=t.call(e,c)}catch(e){l=[6,e],o=0}finally{r=n=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}var eN=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;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return e=r,t=arguments,e=eF(e),function(e,t){var r;if(t&&("object"==((r=t)&&"undefined"!=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,eq()?Reflect.construct(e,t||[],eF(this).constructor):e.apply(this,t))}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&ez(r,e),t=[{key:"beforeLoad",value:function(){var e=this;return eD(function(){return e_(this,function(t){return e.app.eventBus.addEventListener("plugin:kanban:loaded",function(){e.app.schemaInitializerManager.get("kanban:configureActions").add("customize.triggerWorkflow",eE)}),e.app.eventBus.addEventListener("plugin:calendar:loaded",function(){e.app.schemaInitializerManager.get("calendar:configureActions").add("customize.triggerWorkflow",eE)}),e.app.eventBus.addEventListener("plugin:gantt:loaded",function(){e.app.schemaInitializerManager.get("gantt:configureActions").add("customize.triggerWorkflow",eE),e.app.schemaInitializerManager.addItem("gantt:configureActions","customize.triggerWorkflow",{Component:eI})}),e.app.eventBus.addEventListener("plugin:block-workbench:loaded",function(){e.app.schemaInitializerManager.addItem("workbench:configureActions","customize.triggerWorkflow",{Component:eB});var t=e.flowEngine.getModelClass("ActionPanelGroupActionModel");t&&t.registerActionModels({WorkbenchTriggerWorkflowActionModel:en})}),[2]})})()}},{key:"load",value:function(){var e=this;return eD(function(){return e_(this,function(t){return e.app.pm.get("workflow").registerTrigger(c,ew),e.app.addScopes({useFormWorkflowCustomActionProps:P,useRecordWorkflowCustomTriggerActionProps:A,useCollectionTriggerWorkflowCustomActionProps:T,useGlobalTriggerWorkflowCustomActionProps:C}),e.app.addComponents({GlobalTriggerWorkflowAction:L}),e.app.schemaSettingsManager.add(eO),e.app.schemaSettingsManager.add(eC),e.app.schemaSettingsManager.add(eT),e.app.schemaInitializerManager.get("FormActionInitializers").add("customize.triggerWorkflow",ej),e.app.schemaInitializerManager.get("createForm:configureActions").add("customize.triggerWorkflow",ej),e.app.schemaInitializerManager.get("editForm:configureActions").add("customize.triggerWorkflow",ej),e.app.schemaInitializerManager.get("detailsWithPaging:configureActions").add("customize.triggerWorkflow",eW),e.app.schemaInitializerManager.get("details:configureActions").add("customize.triggerWorkflow",eW),e.app.schemaInitializerManager.get("table:configureItemActions").add("customize.triggerWorkflow",eR),e.app.schemaInitializerManager.get("gridCard:configureItemActions").add("customize.triggerWorkflow",eR),e.app.schemaInitializerManager.get("list:configureItemActions").add("customize.triggerWorkflow",eR),e.app.schemaInitializerManager.get("list:configureActions").add("customize.triggerWorkflow",eE),e.app.schemaInitializerManager.get("gridCard:configureActions").add("customize.triggerWorkflow",eE),e.app.schemaInitializerManager.addItem("table:configureActions","customize.triggerWorkflow",{Component:eI}),e.flowEngine.registerModels({FormTriggerWorkflowActionModel:Z,RecordTriggerWorkflowActionModel:ee,CollectionTriggerWorkflowActionModel:et,WorkbenchTriggerWorkflowActionModel:en}),[2]})})()}}],function(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}(r.prototype,t),r}(eV(e.Plugin))}(),d}()});
@@ -41,9 +41,9 @@ const CONTEXT_TYPE = {
41
41
  };
42
42
  const CONTEXT_TYPE_OPTIONS = [
43
43
  {
44
- label: `{{t('None', { ns: "${NAMESPACE}" })}}`,
44
+ label: `{{t('Custom context', { ns: "${NAMESPACE}" })}}`,
45
45
  value: CONTEXT_TYPE.GLOBAL,
46
- tooltip: `{{t('Could be used on non-record related action buttons. Such as buttons in workbench panel or in table blocks.', { ns: "${NAMESPACE}" })}}`
46
+ tooltip: `{{t('Could be used on non-record related action buttons. You can provide custom JSON as trigger data.', { ns: "${NAMESPACE}" })}}`
47
47
  },
48
48
  {
49
49
  label: `{{t('Single collection record', { ns: "${NAMESPACE}" })}}`,
@@ -10,19 +10,20 @@
10
10
  module.exports = {
11
11
  "react": "18.2.0",
12
12
  "@formily/react": "2.3.7",
13
- "@nocobase/client": "2.1.0-beta.6",
14
- "@nocobase/plugin-workflow": "2.1.0-beta.6",
15
- "@nocobase/flow-engine": "2.1.0-beta.6",
13
+ "@nocobase/client": "2.1.0-beta.8",
14
+ "@nocobase/plugin-workflow": "2.1.0-beta.8",
15
+ "@nocobase/flow-engine": "2.1.0-beta.8",
16
+ "@emotion/css": "11.13.0",
16
17
  "antd": "5.24.2",
17
18
  "react-router-dom": "6.30.1",
18
- "@nocobase/utils": "2.1.0-beta.6",
19
+ "@nocobase/utils": "2.1.0-beta.8",
19
20
  "react-i18next": "11.18.6",
20
21
  "@formily/antd-v5": "1.2.3",
21
- "@nocobase/plugin-error-handler": "2.1.0-beta.6",
22
- "@nocobase/data-source-manager": "2.1.0-beta.6",
23
- "@nocobase/server": "2.1.0-beta.6",
22
+ "@nocobase/plugin-error-handler": "2.1.0-beta.8",
23
+ "@nocobase/data-source-manager": "2.1.0-beta.8",
24
+ "@nocobase/server": "2.1.0-beta.8",
24
25
  "lodash": "4.17.21",
25
- "@nocobase/actions": "2.1.0-beta.6",
26
- "@nocobase/plugin-workflow-test": "2.1.0-beta.6",
27
- "@nocobase/test": "2.1.0-beta.6"
26
+ "@nocobase/actions": "2.1.0-beta.8",
27
+ "@nocobase/plugin-workflow-test": "2.1.0-beta.8",
28
+ "@nocobase/test": "2.1.0-beta.8"
28
29
  };
@@ -21,5 +21,9 @@
21
21
  "User acted": "User acted",
22
22
  "When the \"Trigger Workflow\" button is clicked, the event is triggered based on different context where the button is located. For complex data processing that cannot be handled simply by built-in operations (CRUD) of NocoBase, you can define a series of operations through a workflow and trigger it with the \"Trigger Workflow\" button.": "When the \"Trigger Workflow\" button is clicked, the event is triggered based on different context where the button is located. For complex data processing that cannot be handled simply by built-in operations (CRUD) of NocoBase, you can define a series of operations through a workflow and trigger it with the \"Trigger Workflow\" button.",
23
23
  "When the \"Trigger Workflow\" button is clicked, the event is triggered based on the single record where the button is located. Suitable for when the data processing is complex and cannot be simply processed by built-in operations (CRUD) of NocoBase, a series of operations can be defined through workflow and triggered through the \"Trigger Workflow\" button.": "When the \"Trigger Workflow\" button is clicked, the event is triggered based on the single record where the button is located. Suitable for when the data processing is complex and cannot be simply processed by built-in operations (CRUD) of NocoBase, a series of operations can be defined through workflow and triggered through the \"Trigger Workflow\" button.",
24
- "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\".": "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\"."
24
+ "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\".": "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\".",
25
+ "Custom context": "Custom context",
26
+ "Only support custom action workflow with context type set to \"Custom context\".": "Only support custom action workflow with context type set to \"Custom context\".",
27
+ "Context data": "Context data",
28
+ "Input JSON as context data passed into the workflow. Frontend variables are supported.": "Input JSON as context data passed into the workflow. Frontend variables are supported."
25
29
  }
@@ -3,23 +3,30 @@
3
3
  "Binding scope": "Binding scope",
4
4
  "Button is not configured properly, please contact the administrator.": "Button is not configured properly, please contact the administrator.",
5
5
  "Context type": "Context type",
6
+ "Could be used on non-record related action buttons. You can provide custom JSON as trigger data.": "Could be used on non-record related action buttons. You can provide custom JSON as trigger data.",
6
7
  "Could be used on non-record related action buttons. Such as buttons in workbench panel or in table blocks.": "Could be used on non-record related action buttons. Such as buttons in workbench panel or in table blocks.",
8
+ "Custom trigger data": "Custom trigger data",
7
9
  "Could only be used on multiple record related action buttons. Such as for batch action in table block. The data in trigger variable will be an array.": "Could only be used on multiple record related action buttons. Such as for batch action in table block. The data in trigger variable will be an array.",
8
10
  "Could only be used on single record related action buttons. Such as in form, detail block and table row of record.": "Could only be used on single record related action buttons. Such as in form, detail block and table row of record.",
9
11
  "Custom action event": "Custom action event",
12
+ "Custom context": "Custom context",
10
13
  "Different positions of the created trigger button can use different context types.": "Different positions of the created trigger button can use different context types.",
11
14
  "Multiple collection records": "Multiple collection records",
12
15
  "None": "None",
13
16
  "Only support custom action workflow with context type set to \"Multiple records\".": "Only support custom action workflow with context type set to \"Multiple records\".",
17
+ "Only support custom action workflow with context type set to \"Custom context\".": "Only support custom action workflow with context type set to \"Custom context\".",
14
18
  "Only support custom action workflow with context type set to \"None\".": "Only support custom action workflow with context type set to \"None\".",
15
19
  "Please select at least one record.": "Please select at least one record.",
16
20
  "Role of user acted": "Role of user acted",
17
21
  "Single collection record": "Single collection record",
18
22
  "Trigger data": "Trigger data",
23
+ "Use JSON as trigger data for custom data context, or choose a record in single record context.": "Use JSON as trigger data for custom data context, or choose a record in single record context.",
19
24
  "Trigger global workflow": "Trigger global workflow",
20
25
  "Trigger workflow": "Trigger workflow",
21
26
  "User acted": "User acted",
22
27
  "When the \"Trigger Workflow\" button is clicked, the event is triggered based on different context where the button is located. For complex data processing that cannot be handled simply by built-in operations (CRUD) of NocoBase, you can define a series of operations through a workflow and trigger it with the \"Trigger Workflow\" button.": "When the \"Trigger Workflow\" button is clicked, the event is triggered based on different context where the button is located. For complex data processing that cannot be handled simply by built-in operations (CRUD) of NocoBase, you can define a series of operations through a workflow and trigger it with the \"Trigger Workflow\" button.",
23
28
  "When the \"Trigger Workflow\" button is clicked, the event is triggered based on the single record where the button is located. Suitable for when the data processing is complex and cannot be simply processed by built-in operations (CRUD) of NocoBase, a series of operations can be defined through workflow and triggered through the \"Trigger Workflow\" button.": "When the \"Trigger Workflow\" button is clicked, the event is triggered based on the single record where the button is located. Suitable for when the data processing is complex and cannot be simply processed by built-in operations (CRUD) of NocoBase, a series of operations can be defined through workflow and triggered through the \"Trigger Workflow\" button.",
24
- "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\".": "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\"."
25
- }
29
+ "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\".": "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\".",
30
+ "Context data": "Context data",
31
+ "Input JSON as context data passed into the workflow. Frontend variables are supported.": "Input JSON as context data passed into the workflow. Frontend variables are supported."
32
+ }
@@ -21,5 +21,9 @@
21
21
  "User acted": "User acted",
22
22
  "When the \"Trigger Workflow\" button is clicked, the event is triggered based on different context where the button is located. For complex data processing that cannot be handled simply by built-in operations (CRUD) of NocoBase, you can define a series of operations through a workflow and trigger it with the \"Trigger Workflow\" button.": "When the \"Trigger Workflow\" button is clicked, the event is triggered based on different context where the button is located. For complex data processing that cannot be handled simply by built-in operations (CRUD) of NocoBase, you can define a series of operations through a workflow and trigger it with the \"Trigger Workflow\" button.",
23
23
  "When the \"Trigger Workflow\" button is clicked, the event is triggered based on the single record where the button is located. Suitable for when the data processing is complex and cannot be simply processed by built-in operations (CRUD) of NocoBase, a series of operations can be defined through workflow and triggered through the \"Trigger Workflow\" button.": "When the \"Trigger Workflow\" button is clicked, the event is triggered based on the single record where the button is located. Suitable for when the data processing is complex and cannot be simply processed by built-in operations (CRUD) of NocoBase, a series of operations can be defined through workflow and triggered through the \"Trigger Workflow\" button.",
24
- "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\".": "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\"."
24
+ "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\".": "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\".",
25
+ "Custom context": "Custom context",
26
+ "Only support custom action workflow with context type set to \"Custom context\".": "Only support custom action workflow with context type set to \"Custom context\".",
27
+ "Context data": "Context data",
28
+ "Input JSON as context data passed into the workflow. Frontend variables are supported.": "Input JSON as context data passed into the workflow. Frontend variables are supported."
25
29
  }
@@ -21,5 +21,9 @@
21
21
  "User acted": "User acted",
22
22
  "When the \"Trigger Workflow\" button is clicked, the event is triggered based on different context where the button is located. For complex data processing that cannot be handled simply by built-in operations (CRUD) of NocoBase, you can define a series of operations through a workflow and trigger it with the \"Trigger Workflow\" button.": "When the \"Trigger Workflow\" button is clicked, the event is triggered based on different context where the button is located. For complex data processing that cannot be handled simply by built-in operations (CRUD) of NocoBase, you can define a series of operations through a workflow and trigger it with the \"Trigger Workflow\" button.",
23
23
  "When the \"Trigger Workflow\" button is clicked, the event is triggered based on the single record where the button is located. Suitable for when the data processing is complex and cannot be simply processed by built-in operations (CRUD) of NocoBase, a series of operations can be defined through workflow and triggered through the \"Trigger Workflow\" button.": "When the \"Trigger Workflow\" button is clicked, the event is triggered based on the single record where the button is located. Suitable for when the data processing is complex and cannot be simply processed by built-in operations (CRUD) of NocoBase, a series of operations can be defined through workflow and triggered through the \"Trigger Workflow\" button.",
24
- "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\".": "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\"."
24
+ "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\".": "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\".",
25
+ "Custom context": "Custom context",
26
+ "Only support custom action workflow with context type set to \"Custom context\".": "Only support custom action workflow with context type set to \"Custom context\".",
27
+ "Context data": "Context data",
28
+ "Input JSON as context data passed into the workflow. Frontend variables are supported.": "Input JSON as context data passed into the workflow. Frontend variables are supported."
25
29
  }
@@ -21,5 +21,9 @@
21
21
  "User acted": "Cselekvő felhasználó",
22
22
  "When the \"Trigger Workflow\" button is clicked, the event is triggered based on different context where the button is located. For complex data processing that cannot be handled simply by built-in operations (CRUD) of NocoBase, you can define a series of operations through a workflow and trigger it with the \"Trigger Workflow\" button.": "Amikor a \"Munkafolyamat indítása\" gombra kattintanak, az esemény a gomb helyétől függő különböző kontextus alapján aktiválódik. Összetett adatfeldolgozáshoz, amely nem kezelhető egyszerűen a NocoBase beépített műveleteivel (CRUD), meghatározhat egy műveletsorozatot egy munkafolyamaton keresztül, és elindíthatja azt a \"Munkafolyamat indítása\" gombbal.",
23
23
  "When the \"Trigger Workflow\" button is clicked, the event is triggered based on the single record where the button is located. Suitable for when the data processing is complex and cannot be simply processed by built-in operations (CRUD) of NocoBase, a series of operations can be defined through workflow and triggered through the \"Trigger Workflow\" button.": "Amikor a \"Munkafolyamat indítása\" gombra kattintanak, az esemény a gomb helyén lévő egyetlen rekord alapján aktiválódik. Alkalmas olyan esetekre, amikor az adatfeldolgozás összetett és nem kezelhető egyszerűen a NocoBase beépített műveleteivel (CRUD), egy műveletsorozat határozható meg munkafolyamaton keresztül, és aktiválható a \"Munkafolyamat indítása\" gombbal.",
24
- "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\".": "A munkafolyamat közvetlenül aktiválódik a gomb megnyomásakor, adatmentés nélkül. Csak az \"Egyéni művelet esemény\"-hez való kötést támogatja."
24
+ "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\".": "A munkafolyamat közvetlenül aktiválódik a gomb megnyomásakor, adatmentés nélkül. Csak az \"Egyéni művelet esemény\"-hez való kötést támogatja.",
25
+ "Custom context": "Egyéni kontextus",
26
+ "Only support custom action workflow with context type set to \"Custom context\".": "Csak olyan egyéni művelet munkafolyamatot támogat, amelynek kontextustípusa \"Egyéni kontextus\".",
27
+ "Context data": "Kontextus adatok",
28
+ "Input JSON as context data passed into the workflow. Frontend variables are supported.": "Adjon meg JSON-t kontextus adatként, amelyet a munkafolyamatba adnak át. Előlap-változók támogatottak."
25
29
  }
@@ -21,5 +21,9 @@
21
21
  "User acted": "Pengguna yang bertindak",
22
22
  "When the \"Trigger Workflow\" button is clicked, the event is triggered based on different context where the button is located. For complex data processing that cannot be handled simply by built-in operations (CRUD) of NocoBase, you can define a series of operations through a workflow and trigger it with the \"Trigger Workflow\" button.": "Ketika tombol \"Picu Alur Kerja\" diklik, peristiwa dipicu berdasarkan konteks berbeda di mana tombol berada. Untuk pemrosesan data kompleks yang tidak dapat ditangani hanya dengan operasi bawaan (CRUD) NocoBase, Anda dapat mendefinisikan serangkaian operasi melalui alur kerja dan memicunya dengan tombol \"Picu Alur Kerja\".",
23
23
  "When the \"Trigger Workflow\" button is clicked, the event is triggered based on the single record where the button is located. Suitable for when the data processing is complex and cannot be simply processed by built-in operations (CRUD) of NocoBase, a series of operations can be defined through workflow and triggered through the \"Trigger Workflow\" button.": "Ketika tombol \"Picu Alur Kerja\" diklik, peristiwa dipicu berdasarkan catatan tunggal di mana tombol berada. Cocok untuk ketika pemrosesan data kompleks dan tidak dapat diproses hanya dengan operasi bawaan (CRUD) NocoBase, serangkaian operasi dapat didefinisikan melalui alur kerja dan dipicu melalui tombol \"Picu Alur Kerja\".",
24
- "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\".": "Alur kerja akan dipicu langsung setelah tombol diklik, tanpa menyimpan data. Hanya mendukung untuk diikat dengan \"Peristiwa tindakan kustom\"."
24
+ "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\".": "Alur kerja akan dipicu langsung setelah tombol diklik, tanpa menyimpan data. Hanya mendukung untuk diikat dengan \"Peristiwa tindakan kustom\".",
25
+ "Custom context": "Konteks kustom",
26
+ "Only support custom action workflow with context type set to \"Custom context\".": "Hanya mendukung alur kerja tindakan kustom dengan tipe konteks diatur ke \"Konteks kustom\".",
27
+ "Context data": "Data konteks",
28
+ "Input JSON as context data passed into the workflow. Frontend variables are supported.": "Masukkan JSON sebagai data konteks yang diteruskan ke alur kerja. Variabel frontend didukung."
25
29
  }
@@ -21,5 +21,9 @@
21
21
  "User acted": "User acted",
22
22
  "When the \"Trigger Workflow\" button is clicked, the event is triggered based on different context where the button is located. For complex data processing that cannot be handled simply by built-in operations (CRUD) of NocoBase, you can define a series of operations through a workflow and trigger it with the \"Trigger Workflow\" button.": "When the \"Trigger Workflow\" button is clicked, the event is triggered based on different context where the button is located. For complex data processing that cannot be handled simply by built-in operations (CRUD) of NocoBase, you can define a series of operations through a workflow and trigger it with the \"Trigger Workflow\" button.",
23
23
  "When the \"Trigger Workflow\" button is clicked, the event is triggered based on the single record where the button is located. Suitable for when the data processing is complex and cannot be simply processed by built-in operations (CRUD) of NocoBase, a series of operations can be defined through workflow and triggered through the \"Trigger Workflow\" button.": "When the \"Trigger Workflow\" button is clicked, the event is triggered based on the single record where the button is located. Suitable for when the data processing is complex and cannot be simply processed by built-in operations (CRUD) of NocoBase, a series of operations can be defined through workflow and triggered through the \"Trigger Workflow\" button.",
24
- "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\".": "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\"."
24
+ "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\".": "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\".",
25
+ "Custom context": "Custom context",
26
+ "Only support custom action workflow with context type set to \"Custom context\".": "Only support custom action workflow with context type set to \"Custom context\".",
27
+ "Context data": "Context data",
28
+ "Input JSON as context data passed into the workflow. Frontend variables are supported.": "Input JSON as context data passed into the workflow. Frontend variables are supported."
25
29
  }
@@ -21,5 +21,9 @@
21
21
  "User acted": "操作者",
22
22
  "When the \"Trigger Workflow\" button is clicked, the event is triggered based on different context where the button is located. For complex data processing that cannot be handled simply by built-in operations (CRUD) of NocoBase, you can define a series of operations through a workflow and trigger it with the \"Trigger Workflow\" button.": "「ワークフロートリガー」ボタンクリック時、ボタンの配置コンテキストに基づきイベントが発生します。NocoBaseの標準CRUD操作では処理困難な複雑なデータ処理を、ワークフローで定義し本ボタンで実行可能です。",
23
23
  "When the \"Trigger Workflow\" button is clicked, the event is triggered based on the single record where the button is located. Suitable for when the data processing is complex and cannot be simply processed by built-in operations (CRUD) of NocoBase, a series of operations can be defined through workflow and triggered through the \"Trigger Workflow\" button.": "「ワークフロートリガー」ボタンクリック時、該当単一レコードをコンテキストとしてイベントが発生します。NocoBaseの標準CRUD操作では処理困難な複雑なデータ処理を、ワークフローで定義し本ボタンで実行可能です。",
24
- "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\".": "ボタンクリック後、データ保存なしで直接ワークフローがトリガーされます。「カスタムアクションイベント」とのみ連携可能です。"
24
+ "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\".": "ボタンクリック後、データ保存なしで直接ワークフローがトリガーされます。「カスタムアクションイベント」とのみ連携可能です。",
25
+ "Custom context": "カスタムコンテキスト",
26
+ "Only support custom action workflow with context type set to \"Custom context\".": "コンテキストタイプ「カスタムコンテキスト」が設定されたカスタムアクションワークフローのみサポートされます。",
27
+ "Context data": "コンテキストデータ",
28
+ "Input JSON as context data passed into the workflow. Frontend variables are supported.": "ワークフローに渡されるコンテキストデータとしてJSONを入力してください。フロントエンド変数がサポートされています。"
25
29
  }
@@ -21,5 +21,9 @@
21
21
  "User acted": "작업한 사용자",
22
22
  "When the \"Trigger Workflow\" button is clicked, the event is triggered based on different context where the button is located. For complex data processing that cannot be handled simply by built-in operations (CRUD) of NocoBase, you can define a series of operations through a workflow and trigger it with the \"Trigger Workflow\" button.": "\"워크플로우 트리거\" 버튼을 클릭하면 버튼이 위치한 컨텍스트에 따라 이벤트가 트리거됩니다. NocoBase의 기본 동작(CRUD)만으로 처리할 수 없는 복잡한 데이터 처리가 필요한 경우, 워크플로우로 일련의 작업을 정의하고 해당 버튼으로 트리거할 수 있습니다.",
23
23
  "When the \"Trigger Workflow\" button is clicked, the event is triggered based on the single record where the button is located. Suitable for when the data processing is complex and cannot be simply processed by built-in operations (CRUD) of NocoBase, a series of operations can be defined through workflow and triggered through the \"Trigger Workflow\" button.": "\"워크플로우 트리거\" 버튼을 클릭하면 버튼이 위치한 단일 레코드를 기준으로 이벤트가 트리거됩니다. NocoBase의 기본 동작(CRUD)만으로 처리할 수 없는 복잡한 데이터 처리가 필요한 경우, 워크플로우로 일련의 작업을 정의하고 해당 버튼으로 트리거할 수 있습니다.",
24
- "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\".": "버튼 클릭 시 데이터 저장 없이 워크플로우가 바로 트리거됩니다. \"사용자 정의 작업 이벤트\"에만 바인딩할 수 있습니다."
24
+ "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\".": "버튼 클릭 시 데이터 저장 없이 워크플로우가 바로 트리거됩니다. \"사용자 정의 작업 이벤트\"에만 바인딩할 수 있습니다.",
25
+ "Custom context": "사용자 정의 컨텍스트",
26
+ "Only support custom action workflow with context type set to \"Custom context\".": "\"사용자 정의 컨텍스트\" 컨텍스트 유형으로 설정된 사용자 정의 작업 워크플로우만 지원합니다.",
27
+ "Context data": "컨텍스트 데이터",
28
+ "Input JSON as context data passed into the workflow. Frontend variables are supported.": "워크플로우에 전달될 컨텍스트 데이터로 JSON을 입력하세요. 프론트엔드 변수가 지원됩니다."
25
29
  }
@@ -21,5 +21,9 @@
21
21
  "User acted": "User acted",
22
22
  "When the \"Trigger Workflow\" button is clicked, the event is triggered based on different context where the button is located. For complex data processing that cannot be handled simply by built-in operations (CRUD) of NocoBase, you can define a series of operations through a workflow and trigger it with the \"Trigger Workflow\" button.": "When the \"Trigger Workflow\" button is clicked, the event is triggered based on different context where the button is located. For complex data processing that cannot be handled simply by built-in operations (CRUD) of NocoBase, you can define a series of operations through a workflow and trigger it with the \"Trigger Workflow\" button.",
23
23
  "When the \"Trigger Workflow\" button is clicked, the event is triggered based on the single record where the button is located. Suitable for when the data processing is complex and cannot be simply processed by built-in operations (CRUD) of NocoBase, a series of operations can be defined through workflow and triggered through the \"Trigger Workflow\" button.": "When the \"Trigger Workflow\" button is clicked, the event is triggered based on the single record where the button is located. Suitable for when the data processing is complex and cannot be simply processed by built-in operations (CRUD) of NocoBase, a series of operations can be defined through workflow and triggered through the \"Trigger Workflow\" button.",
24
- "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\".": "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\"."
24
+ "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\".": "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\".",
25
+ "Custom context": "Custom context",
26
+ "Only support custom action workflow with context type set to \"Custom context\".": "Only support custom action workflow with context type set to \"Custom context\".",
27
+ "Context data": "Context data",
28
+ "Input JSON as context data passed into the workflow. Frontend variables are supported.": "Input JSON as context data passed into the workflow. Frontend variables are supported."
25
29
  }
@@ -21,5 +21,9 @@
21
21
  "User acted": "User acted",
22
22
  "When the \"Trigger Workflow\" button is clicked, the event is triggered based on different context where the button is located. For complex data processing that cannot be handled simply by built-in operations (CRUD) of NocoBase, you can define a series of operations through a workflow and trigger it with the \"Trigger Workflow\" button.": "When the \"Trigger Workflow\" button is clicked, the event is triggered based on different context where the button is located. For complex data processing that cannot be handled simply by built-in operations (CRUD) of NocoBase, you can define a series of operations through a workflow and trigger it with the \"Trigger Workflow\" button.",
23
23
  "When the \"Trigger Workflow\" button is clicked, the event is triggered based on the single record where the button is located. Suitable for when the data processing is complex and cannot be simply processed by built-in operations (CRUD) of NocoBase, a series of operations can be defined through workflow and triggered through the \"Trigger Workflow\" button.": "When the \"Trigger Workflow\" button is clicked, the event is triggered based on the single record where the button is located. Suitable for when the data processing is complex and cannot be simply processed by built-in operations (CRUD) of NocoBase, a series of operations can be defined through workflow and triggered through the \"Trigger Workflow\" button.",
24
- "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\".": "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\"."
24
+ "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\".": "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\".",
25
+ "Custom context": "Custom context",
26
+ "Only support custom action workflow with context type set to \"Custom context\".": "Only support custom action workflow with context type set to \"Custom context\".",
27
+ "Context data": "Context data",
28
+ "Input JSON as context data passed into the workflow. Frontend variables are supported.": "Input JSON as context data passed into the workflow. Frontend variables are supported."
25
29
  }
@@ -21,5 +21,9 @@
21
21
  "User acted": "Пользователь, выполнивший действие",
22
22
  "When the \"Trigger Workflow\" button is clicked, the event is triggered based on different context where the button is located. For complex data processing that cannot be handled simply by built-in operations (CRUD) of NocoBase, you can define a series of operations through a workflow and trigger it with the \"Trigger Workflow\" button.": "При нажатии кнопки \"Событие пользователя\" событие запускается на основе контекста, где находится кнопка. Для сложной обработки данных, которую невозможно выполнить стандартными операциями (CRUD) NocoBase, можно определить серию операций через рабочий процесс и запустить их с помощью кнопки \"Событие пользователя\".",
23
23
  "When the \"Trigger Workflow\" button is clicked, the event is triggered based on the single record where the button is located. Suitable for when the data processing is complex and cannot be simply processed by built-in operations (CRUD) of NocoBase, a series of operations can be defined through workflow and triggered through the \"Trigger Workflow\" button.": "При нажатии кнопки \"Событие пользователя\" событие запускается на основе одной записи, где находится кнопка. Подходит для случаев, когда обработка данных сложна и не может быть выполнена стандартными операциями (CRUD) NocoBase. Серия операций может быть определена через рабочий процесс и запущена с помощью кнопки \"Событие пользователя\".",
24
- "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\".": "Рабочий процесс будет запущен сразу после нажатия кнопки без сохранения данных. Поддерживается только привязка к событию \"Событие пользователя\"."
24
+ "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\".": "Рабочий процесс будет запущен сразу после нажатия кнопки без сохранения данных. Поддерживается только привязка к событию \"Событие пользователя\".",
25
+ "Custom context": "Пользовательский контекст",
26
+ "Only support custom action workflow with context type set to \"Custom context\".": "Поддерживается только пользовательский рабочий процесс с типом контекста, установленным как \"Пользовательский контекст\".",
27
+ "Context data": "Данные контекста",
28
+ "Input JSON as context data passed into the workflow. Frontend variables are supported.": "Введите JSON как данные контекста, передаваемые в рабочий процесс. Поддерживаются переменные интерфейса."
25
29
  }
@@ -21,5 +21,9 @@
21
21
  "User acted": "User acted",
22
22
  "When the \"Trigger Workflow\" button is clicked, the event is triggered based on different context where the button is located. For complex data processing that cannot be handled simply by built-in operations (CRUD) of NocoBase, you can define a series of operations through a workflow and trigger it with the \"Trigger Workflow\" button.": "When the \"Trigger Workflow\" button is clicked, the event is triggered based on different context where the button is located. For complex data processing that cannot be handled simply by built-in operations (CRUD) of NocoBase, you can define a series of operations through a workflow and trigger it with the \"Trigger Workflow\" button.",
23
23
  "When the \"Trigger Workflow\" button is clicked, the event is triggered based on the single record where the button is located. Suitable for when the data processing is complex and cannot be simply processed by built-in operations (CRUD) of NocoBase, a series of operations can be defined through workflow and triggered through the \"Trigger Workflow\" button.": "When the \"Trigger Workflow\" button is clicked, the event is triggered based on the single record where the button is located. Suitable for when the data processing is complex and cannot be simply processed by built-in operations (CRUD) of NocoBase, a series of operations can be defined through workflow and triggered through the \"Trigger Workflow\" button.",
24
- "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\".": "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\"."
24
+ "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\".": "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\".",
25
+ "Custom context": "Custom context",
26
+ "Only support custom action workflow with context type set to \"Custom context\".": "Only support custom action workflow with context type set to \"Custom context\".",
27
+ "Context data": "Context data",
28
+ "Input JSON as context data passed into the workflow. Frontend variables are supported.": "Input JSON as context data passed into the workflow. Frontend variables are supported."
25
29
  }
@@ -21,5 +21,9 @@
21
21
  "User acted": "User acted",
22
22
  "When the \"Trigger Workflow\" button is clicked, the event is triggered based on different context where the button is located. For complex data processing that cannot be handled simply by built-in operations (CRUD) of NocoBase, you can define a series of operations through a workflow and trigger it with the \"Trigger Workflow\" button.": "When the \"Trigger Workflow\" button is clicked, the event is triggered based on different context where the button is located. For complex data processing that cannot be handled simply by built-in operations (CRUD) of NocoBase, you can define a series of operations through a workflow and trigger it with the \"Trigger Workflow\" button.",
23
23
  "When the \"Trigger Workflow\" button is clicked, the event is triggered based on the single record where the button is located. Suitable for when the data processing is complex and cannot be simply processed by built-in operations (CRUD) of NocoBase, a series of operations can be defined through workflow and triggered through the \"Trigger Workflow\" button.": "When the \"Trigger Workflow\" button is clicked, the event is triggered based on the single record where the button is located. Suitable for when the data processing is complex and cannot be simply processed by built-in operations (CRUD) of NocoBase, a series of operations can be defined through workflow and triggered through the \"Trigger Workflow\" button.",
24
- "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\".": "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\"."
24
+ "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\".": "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\".",
25
+ "Custom context": "Custom context",
26
+ "Only support custom action workflow with context type set to \"Custom context\".": "Only support custom action workflow with context type set to \"Custom context\".",
27
+ "Context data": "Context data",
28
+ "Input JSON as context data passed into the workflow. Frontend variables are supported.": "Input JSON as context data passed into the workflow. Frontend variables are supported."
25
29
  }
@@ -21,5 +21,9 @@
21
21
  "User acted": "User acted",
22
22
  "When the \"Trigger Workflow\" button is clicked, the event is triggered based on different context where the button is located. For complex data processing that cannot be handled simply by built-in operations (CRUD) of NocoBase, you can define a series of operations through a workflow and trigger it with the \"Trigger Workflow\" button.": "When the \"Trigger Workflow\" button is clicked, the event is triggered based on different context where the button is located. For complex data processing that cannot be handled simply by built-in operations (CRUD) of NocoBase, you can define a series of operations through a workflow and trigger it with the \"Trigger Workflow\" button.",
23
23
  "When the \"Trigger Workflow\" button is clicked, the event is triggered based on the single record where the button is located. Suitable for when the data processing is complex and cannot be simply processed by built-in operations (CRUD) of NocoBase, a series of operations can be defined through workflow and triggered through the \"Trigger Workflow\" button.": "When the \"Trigger Workflow\" button is clicked, the event is triggered based on the single record where the button is located. Suitable for when the data processing is complex and cannot be simply processed by built-in operations (CRUD) of NocoBase, a series of operations can be defined through workflow and triggered through the \"Trigger Workflow\" button.",
24
- "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\".": "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\"."
24
+ "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\".": "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\".",
25
+ "Custom context": "Custom context",
26
+ "Only support custom action workflow with context type set to \"Custom context\".": "Only support custom action workflow with context type set to \"Custom context\".",
27
+ "Context data": "Context data",
28
+ "Input JSON as context data passed into the workflow. Frontend variables are supported.": "Input JSON as context data passed into the workflow. Frontend variables are supported."
25
29
  }
@@ -3,7 +3,10 @@
3
3
  "Binding scope": "绑定范围",
4
4
  "Button is not configured properly, please contact the administrator.": "按钮未正确配置,请联系管理员。",
5
5
  "Context type": "上下文类型",
6
+ "Could be used on non-record related action buttons. You can provide custom JSON as trigger data.": "可用于非数据行相关的操作按钮。你可以提供自定义 JSON 作为触发数据。",
6
7
  "Could be used on non-record related action buttons. Such as buttons in workbench panel or in table blocks.": "可用于非数据行相关的操作按钮。例如工作台面板或表格区块中的按钮。",
8
+ "Custom trigger data": "自定义触发数据",
9
+ "Custom context": "自定义上下文",
7
10
  "Could only be used on multiple record related action buttons. Such as for batch action in table block. The data in trigger variable will be an array.": "仅支持用于多行数据相关的操作按钮。例如在表格区块中的批量操作。触发器变量中的数据将是数组。",
8
11
  "Could only be used on single record related action buttons. Such as in form, detail block and table row of record.": "仅支持用于单行数据相关的操作按钮。例如在表单、详情区块和数据行中。",
9
12
  "Custom action event": "自定义操作事件",
@@ -11,15 +14,19 @@
11
14
  "Multiple collection records": "多行数据",
12
15
  "None": "无上下文",
13
16
  "Only support custom action workflow with context type set to \"Multiple records\".": "仅支持上下文类型设置为“多行数据”的自定义操作工作流。",
17
+ "Only support custom action workflow with context type set to \"Custom context\".": "仅支持上下文类型设置为“自定义上下文”的自定义操作工作流。",
14
18
  "Only support custom action workflow with context type set to \"None\".": "仅支持上下文类型设置为“无上下文”的自定义操作工作流。",
15
19
  "Please select at least one record.": "请至少选择一条记录。",
16
20
  "Role of user acted": "操作者角色",
17
21
  "Single collection record": "单行数据",
18
22
  "Trigger data": "触发器数据",
23
+ "Use JSON as trigger data for custom data context, or choose a record in single record context.": "在自定义数据上下文中使用 JSON 作为触发数据,或在单行数据上下文中选择一条记录。",
19
24
  "Trigger global workflow": "触发全局工作流",
20
25
  "Trigger workflow": "触发工作流",
21
26
  "User acted": "操作者",
22
27
  "When the \"Trigger Workflow\" button is clicked, the event is triggered based on different context where the button is located. For complex data processing that cannot be handled simply by built-in operations (CRUD) of NocoBase, you can define a series of operations through a workflow and trigger it with the \"Trigger Workflow\" button.": "点击“触发工作流”按钮时,基于按钮所在位置的不同上下文触发该事件。适用于对数据的处理过程较复杂,不能被 NocoBase 内置的操作(增删改查)简单处理时,可通过工作流来定义一系列操作,并通过“触发工作流”按钮触发。",
23
- "When the \"Trigger Workflow\" button is clicked, the event is triggered based on the single record where the button is located. Suitable for when the data processing is complex and cannot be simply processed by built-in operations (CRUD) of NocoBase, a series of operations can be defined through workflow and triggered through the \"Trigger Workflow\" button.": "When the \"Trigger Workflow\" button is clicked, the event is triggered based on the single record where the button is located. Suitable for when the data processing is complex and cannot be simply processed by built-in operations (CRUD) of NocoBase, a series of operations can be defined through workflow and triggered through the \"Trigger Workflow\" button.",
24
- "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\".": "点击按钮后将直接触发工作流,不会保存数据。仅支持绑定“自定义操作事件”。"
25
- }
28
+ "When the \"Trigger Workflow\" button is clicked, the event is triggered based on the single record where the button is located. Suitable for when the data processing is complex and cannot be simply processed by built-in operations (CRUD) of NocoBase, a series of operations can be defined through workflow and triggered through the \"Trigger Workflow\" button.": "点击“触发工作流”按钮时,基于按钮所在的单条记录触发该事件。适用于对数据的处理过程较复杂,不能被 NocoBase 内置的操作(增删改查)简单处理时,可通过工作流来定义一系列操作,并通过“触发工作流”按钮触发。",
29
+ "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\".": "点击按钮后将直接触发工作流,不会保存数据。仅支持绑定“自定义操作事件”。",
30
+ "Context data": "上下文数据",
31
+ "Input JSON as context data passed into the workflow. Frontend variables are supported.": "输入 JSON 作为传入工作流的上下文数据,支持前端变量。"
32
+ }
@@ -21,5 +21,9 @@
21
21
  "User acted": "User acted",
22
22
  "When the \"Trigger Workflow\" button is clicked, the event is triggered based on different context where the button is located. For complex data processing that cannot be handled simply by built-in operations (CRUD) of NocoBase, you can define a series of operations through a workflow and trigger it with the \"Trigger Workflow\" button.": "When the \"Trigger Workflow\" button is clicked, the event is triggered based on different context where the button is located. For complex data processing that cannot be handled simply by built-in operations (CRUD) of NocoBase, you can define a series of operations through a workflow and trigger it with the \"Trigger Workflow\" button.",
23
23
  "When the \"Trigger Workflow\" button is clicked, the event is triggered based on the single record where the button is located. Suitable for when the data processing is complex and cannot be simply processed by built-in operations (CRUD) of NocoBase, a series of operations can be defined through workflow and triggered through the \"Trigger Workflow\" button.": "When the \"Trigger Workflow\" button is clicked, the event is triggered based on the single record where the button is located. Suitable for when the data processing is complex and cannot be simply processed by built-in operations (CRUD) of NocoBase, a series of operations can be defined through workflow and triggered through the \"Trigger Workflow\" button.",
24
- "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\".": "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\"."
24
+ "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\".": "Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with \"Custom action event\".",
25
+ "Custom context": "自訂上下文",
26
+ "Only support custom action workflow with context type set to \"Custom context\".": "僅支援上下文類型設定為「自訂上下文」的自訂操作工作流程。",
27
+ "Context data": "上下文資料",
28
+ "Input JSON as context data passed into the workflow. Frontend variables are supported.": "輸入 JSON 作為傳入工作流程的上下文資料,支援前端變數。"
25
29
  }
@@ -191,6 +191,10 @@ class CustomActionTrigger extends import_plugin_workflow.Trigger {
191
191
  context,
192
192
  next
193
193
  }) {
194
+ if (!syncGroup.length && !asyncGroup.length) {
195
+ context.logger.warn("No workflow triggered");
196
+ return context.throw(500, "No action done, please contact the administrator");
197
+ }
194
198
  for (const event of syncGroup) {
195
199
  const processor = await this.workflow.trigger(event[0], event[1], { httpContext: context });
196
200
  if (!processor) {
@@ -241,9 +245,13 @@ class CustomActionTrigger extends import_plugin_workflow.Trigger {
241
245
  }
242
246
  async execute(workflow, values, options) {
243
247
  var _a;
248
+ const { userId } = values;
249
+ if (userId == null) {
250
+ throw new Error("user is not provided");
251
+ }
244
252
  const UserRepo = this.workflow.app.db.getRepository("users");
245
253
  const actor = await UserRepo.findOne({
246
- filterByTk: values.userId,
254
+ filterByTk: typeof userId === "object" ? userId["id"] : userId,
247
255
  appends: ["roles"]
248
256
  });
249
257
  if (!actor) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-workflow-custom-action-trigger",
3
- "version": "2.1.0-beta.6",
3
+ "version": "2.1.0-beta.8",
4
4
  "displayName": "Workflow: Custom action event",
5
5
  "displayName.zh-CN": "工作流:自定义操作事件",
6
6
  "description": "Triggers after click a custom action button.",
@@ -27,6 +27,6 @@
27
27
  ],
28
28
  "editionLevel": 0
29
29
  },
30
- "gitHead": "439e45f32ee5f34d771e7f4751ef57eb7d4a82a8",
30
+ "gitHead": "5099d561c5467292414c1e77ad6bad3730d97344",
31
31
  "license": "Apache-2.0"
32
32
  }