/**
 * This file is part of the NocoBase (R) project.
 * Copyright (c) 2020-2024 NocoBase Co., Ltd.
 * Authors: NocoBase Team.
 *
 * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
 * For more information, please refer to: https://www.nocobase.com/agreement.
 */

"use strict";(self.webpackChunk_nocobase_plugin_workflow_client_v2=self.webpackChunk_nocobase_plugin_workflow_client_v2||[]).push([["719"],{6242:function(e,n,t){t.r(n),t.d(n,{TriggerModeField:function(){return b},default:function(){return v},CollectionPresetConfig:function(){return p},SyncTransactionNotice:function(){return g},CollectionTriggerConfig:function(){return w}});var l=t(5477),a=t(2059),o=t(9155),r=t.n(o),c=t(2235),i=t(1801),u=t(7806),s=t(9488),d=[{label:'{{t("After record added", { ns: "'.concat(s.CU,'" })}}'),value:1},{label:'{{t("After record updated", { ns: "'.concat(s.CU,'" })}}'),value:2},{label:'{{t("After record added or updated", { ns: "'.concat(s.CU,'" })}}'),value:3},{label:'{{t("After record deleted", { ns: "'.concat(s.CU,'" })}}'),value:4}];function m(e,n){return(Number(e)&n)===n}function f(){var e,n,t=(e=["\n        .ant-select.auto-width {\n          width: auto;\n          min-width: 6em;\n        }\n      "],n||(n=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}})));return f=function(){return t},t}function h(e){return!e.hidden&&(!e.uiSchema||!e.uiSchema["x-read-pretty"])&&!["linkTo","hasOne","hasMany","belongsToMany"].includes(e.type)}function g(){var e=(0,s.kj)();return r().createElement(a.Alert,{type:"info",showIcon:!0,style:{marginBottom:"1em"},message:e("Synchronous collection event workflows run within the trigger transaction by default. Related data operations automatically use this transaction.")})}function b(){var e=(0,s.kj)(),n=a.Form.useWatch(["config","collection"]),t=(0,o.useMemo)(function(){return d.map(function(n){return{value:n.value,label:e(n.label)}})},[e]);return n?r().createElement(a.Form.Item,{name:["config","mode"],label:e("Trigger on"),rules:[{required:!0}]},r().createElement(a.Select,{popupMatchSelectWidth:!1,placeholder:e("Trigger on"),className:"auto-width",options:t})):null}function w(){var e=(0,s.kj)(),n=(0,c.Zt)(),t=a.Form.useWatch(["config","collection"]),o=Number(a.Form.useWatch(["config","mode"])||0),d=null==n?void 0:n.sync;return r().createElement("fieldset",{className:(0,l.css)(f())},r().createElement(a.Form.Item,{name:["config","collection"],label:e("Collection")},r().createElement(u.XJ,{disabled:!0})),r().createElement(b,null),t&&m(o,2)?r().createElement(a.Form.Item,{name:["config","changed"],label:e("Changed fields"),extra:e("Triggered only if one of the selected fields changes. If unselected, it means that it will be triggered when any field changes. When record is added, any field is considered to have been changed.")},r().createElement(u.WY,{mode:"multiple",placeholder:e("Select field"),filter:h})):null,t&&!m(o,4)?r().createElement(a.Form.Item,{name:["config","condition"],label:e("Only triggers when match conditions")},r().createElement(i.yr,{collection:t,rightAsVariable:!1})):null,t&&!m(o,4)?r().createElement(a.Form.Item,{name:["config","appends"],label:e("Preload associations"),extra:e("Please select the associated fields that need to be accessed in subsequent nodes. With more than two levels of to-many associations may cause performance issue, please use with caution.")},r().createElement(u.Kr,{collection:t})):null,d?r().createElement(g,null):null,d?r().createElement(a.Form.Item,{name:["config","rollbackOnFailure"],valuePropName:"checked",extra:e("Only available in synchronous mode. When enabled, if the workflow execution ends with a failed status, the data operation that triggered it will fail and be rolled back."),initialValue:!1},r().createElement(a.Checkbox,null,e("Rollback when workflow execution fails"))):null)}function p(){var e=(0,s.kj)();return r().createElement(a.Form.Item,{name:["config","collection"],label:e("Collection"),rules:[{required:!0}]},r().createElement(u.XJ,null))}var v=w}}]);