@nocobase/plugin-workflow 1.2.23-alpha → 1.2.25-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/index.js +11 -11
- package/dist/externalVersion.js +10 -10
- package/dist/node_modules/cron-parser/package.json +1 -1
- package/dist/node_modules/lru-cache/package.json +1 -1
- package/dist/server/triggers/CollectionTrigger.js +3 -2
- package/dist/server/triggers/ScheduleTrigger/DateFieldScheduleTrigger.js +1 -1
- package/package.json +3 -3
package/dist/client/index.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
(function(v,n){typeof exports=="object"&&typeof module!="undefined"?n(exports,require("react/jsx-runtime"),require("@nocobase/client"),require("@nocobase/utils/client"),require("react-router-dom"),require("react"),require("antd"),require("react-i18next"),require("@ant-design/icons"),require("@formily/core"),require("@formily/reactive"),require("@formily/react"),require("lodash"),require("@formily/shared"),require("dayjs"),require("@nocobase/evaluators/client"),require("@formily/antd-v5")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","@nocobase/client","@nocobase/utils/client","react-router-dom","react","antd","react-i18next","@ant-design/icons","@formily/core","@formily/reactive","@formily/react","lodash","@formily/shared","dayjs","@nocobase/evaluators/client","@formily/antd-v5"],n):(v=typeof globalThis!="undefined"?globalThis:v||self,n(v["@nocobase/plugin-workflow"]={},v.jsxRuntime,v["@nocobase/client"],v["@nocobase/utils"],v["react-router-dom"],v.react,v.antd,v["react-i18next"],v["@ant-design/icons"],v["@formily/core"],v["@formily/reactive"],v["@formily/react"],v.lodash,v["@formily/shared"],v.dayjs,v["@nocobase/evaluators"],v["@formily/antd-v5"]))})(this,function(v,n,l,J,te,b,y,Q,I,le,fo,L,
|
|
10
|
+
(function(v,n){typeof exports=="object"&&typeof module!="undefined"?n(exports,require("react/jsx-runtime"),require("@nocobase/client"),require("@nocobase/utils/client"),require("react-router-dom"),require("react"),require("antd"),require("react-i18next"),require("@ant-design/icons"),require("@formily/core"),require("@formily/reactive"),require("@formily/react"),require("lodash"),require("@formily/shared"),require("dayjs"),require("@nocobase/evaluators/client"),require("@formily/antd-v5")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","@nocobase/client","@nocobase/utils/client","react-router-dom","react","antd","react-i18next","@ant-design/icons","@formily/core","@formily/reactive","@formily/react","lodash","@formily/shared","dayjs","@nocobase/evaluators/client","@formily/antd-v5"],n):(v=typeof globalThis!="undefined"?globalThis:v||self,n(v["@nocobase/plugin-workflow"]={},v.jsxRuntime,v["@nocobase/client"],v["@nocobase/utils"],v["react-router-dom"],v.react,v.antd,v["react-i18next"],v["@ant-design/icons"],v["@formily/core"],v["@formily/reactive"],v["@formily/react"],v.lodash,v["@formily/shared"],v.dayjs,v["@nocobase/evaluators"],v["@formily/antd-v5"]))})(this,function(v,n,l,J,te,b,y,Q,I,le,fo,L,Se,ho,Yt,De,jo){"use strict";var Nr=Object.defineProperty,Er=Object.defineProperties;var $r=Object.getOwnPropertyDescriptors;var mo=Object.getOwnPropertySymbols;var Gt=Object.prototype.hasOwnProperty,qt=Object.prototype.propertyIsEnumerable;var Vo=(v,n,l)=>n in v?Nr(v,n,{enumerable:!0,configurable:!0,writable:!0,value:l}):v[n]=l,C=(v,n)=>{for(var l in n||(n={}))Gt.call(n,l)&&Vo(v,l,n[l]);if(mo)for(var l of mo(n))qt.call(n,l)&&Vo(v,l,n[l]);return v},A=(v,n)=>Er(v,$r(n));var Kt=v=>typeof v=="symbol"?v:v+"",Z=(v,n)=>{var l={};for(var J in v)Gt.call(v,J)&&n.indexOf(J)<0&&(l[J]=v[J]);if(v!=null&&mo)for(var J of mo(v))n.indexOf(J)<0&&qt.call(v,J)&&(l[J]=v[J]);return l};var w=(v,n,l)=>(Vo(v,typeof n!="symbol"?n+"":n,l),l);var U=(v,n,l)=>new Promise((J,te)=>{var b=I=>{try{Q(l.next(I))}catch(le){te(le)}},y=I=>{try{Q(l.throw(I))}catch(le){te(le)}},Q=I=>I.done?J(I.value):Promise.resolve(I.value).then(b,y);Q((l=l.apply(v,n)).next())});const _t=b.createContext(null),yo={didCatch:!1,error:null};class Zt extends b.Component{constructor(o){super(o),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=yo}static getDerivedStateFromError(o){return{didCatch:!0,error:o}}resetErrorBoundary(){const{error:o}=this.state;if(o!==null){for(var t,r,s=arguments.length,a=new Array(s),i=0;i<s;i++)a[i]=arguments[i];(t=(r=this.props).onReset)===null||t===void 0||t.call(r,{args:a,reason:"imperative-api"}),this.setState(yo)}}componentDidCatch(o,t){var r,s;(r=(s=this.props).onError)===null||r===void 0||r.call(s,o,t)}componentDidUpdate(o,t){const{didCatch:r}=this.state,{resetKeys:s}=this.props;if(r&&t.error!==null&&Qt(o.resetKeys,s)){var a,i;(a=(i=this.props).onReset)===null||a===void 0||a.call(i,{next:s,prev:o.resetKeys,reason:"keys"}),this.setState(yo)}}render(){const{children:o,fallbackRender:t,FallbackComponent:r,fallback:s}=this.props,{didCatch:a,error:i}=this.state;let c=o;if(a){const u={error:i,resetErrorBoundary:this.resetErrorBoundary};if(b.isValidElement(s))c=s;else if(typeof t=="function")c=t(u);else if(r)c=b.createElement(r,u);else throw i}return b.createElement(_t.Provider,{value:{didCatch:a,error:i,resetErrorBoundary:this.resetErrorBoundary}},c)}}function Qt(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return e.length!==o.length||e.some((t,r)=>!Object.is(t,o[r]))}const Ie=b.createContext({});function G(){return b.useContext(Ie)}const p="workflow";function T(e,o={}){return l.i18n.t(e,A(C({},o),{ns:p}))}function go(){return Q.useTranslation(p)}const ne=l.createStyles(({css:e,token:o})=>({workflowPageClass:e`
|
|
11
11
|
flex-grow: 1;
|
|
12
12
|
overflow: hidden;
|
|
13
13
|
display: flex;
|
|
@@ -408,7 +408,7 @@
|
|
|
408
408
|
}
|
|
409
409
|
`,noStatusButtonClass:e`
|
|
410
410
|
border-width: 2px;
|
|
411
|
-
`}));function Pe(e){const i=e,{status:o,statusMap:t}=i,r=Z(i,["status","statusMap"]),{styles:s}=tn();let a=null;if(typeof o!="undefined"&&(t!=null&&t[o])){const{icon:c,color:u}=t[o];a=n.jsx(y.Tag,{color:u,children:c})}return n.jsx(y.Button,A(C({},r),{shape:"circle",size:"small",className:on(a?s.statusButtonClass:s.noStatusButtonClass,e.className),children:a}))}const pe={QUEUEING:null,STARTED:0,RESOLVED:1,FAILED:-1,ERROR:-2,ABORTED:-3,CANCELED:-4,REJECTED:-5,RETRY_NEEDED:-6},He=[{value:pe.QUEUEING,label:`{{t("Queueing", { ns: "${p}" })}}`,color:"blue",icon:n.jsx(I.HourglassOutlined,{}),description:`{{t("Triggered but still waiting in queue to execute.", { ns: "${p}" })}}`},{value:pe.STARTED,label:`{{t("On going", { ns: "${p}" })}}`,color:"gold",icon:n.jsx(I.LoadingOutlined,{}),description:`{{t("Started and executing, maybe waiting for an async callback (manual, delay etc.).", { ns: "${p}" })}}`},{value:pe.RESOLVED,label:`{{t("Resolved", { ns: "${p}" })}}`,color:"green",icon:n.jsx(I.CheckOutlined,{}),description:`{{t("Successfully finished.", { ns: "${p}" })}}`},{value:pe.FAILED,label:`{{t("Failed", { ns: "${p}" })}}`,color:"red",icon:n.jsx(I.ExclamationOutlined,{}),description:`{{t("Failed to satisfy node configurations.", { ns: "${p}" })}}`},{value:pe.ERROR,label:`{{t("Error", { ns: "${p}" })}}`,color:"red",icon:n.jsx(I.CloseOutlined,{}),description:`{{t("Some node meets error.", { ns: "${p}" })}}`},{value:pe.ABORTED,label:`{{t("Aborted", { ns: "${p}" })}}`,color:"red",icon:n.jsx(I.MinusOutlined,{rotate:90}),description:`{{t("Running of some node was aborted by program flow.", { ns: "${p}" })}}`},{value:pe.CANCELED,label:`{{t("Canceled", { ns: "${p}" })}}`,color:"volcano",icon:n.jsx(I.MinusOutlined,{rotate:45}),description:`{{t("Manually canceled whole execution when waiting.", { ns: "${p}" })}}`},{value:pe.REJECTED,label:`{{t("Rejected", { ns: "${p}" })}}`,color:"volcano",icon:n.jsx(I.MinusOutlined,{}),description:`{{t("Rejected from a manual node.", { ns: "${p}" })}}`},{value:pe.RETRY_NEEDED,label:`{{t("Retry needed", { ns: "${p}" })}}`,color:"volcano",icon:n.jsx(I.RedoOutlined,{}),description:`{{t("General failed but should do another try.", { ns: "${p}" })}}`}],Ge=He.reduce((e,o)=>Object.assign(e,{[o.value]:o}),{}),ie={PENDING:0,RESOLVED:1,FAILED:-1,ERROR:-2,ABORTED:-3,CANCELED:-4,REJECTED:-5,RETRY_NEEDED:-6},vo=[{value:ie.PENDING,label:`{{t("Pending", { ns: "${p}" })}}`,color:"gold",icon:n.jsx(I.ClockCircleOutlined,{})},{value:ie.RESOLVED,label:`{{t("Resolved", { ns: "${p}" })}}`,color:"green",icon:n.jsx(I.CheckOutlined,{})},{value:ie.FAILED,label:`{{t("Failed", { ns: "${p}" })}}`,color:"red",icon:n.jsx(I.ExclamationOutlined,{})},{value:ie.ERROR,label:`{{t("Error", { ns: "${p}" })}}`,color:"red",icon:n.jsx(I.CloseOutlined,{})},{value:ie.ABORTED,label:`{{t("Aborted", { ns: "${p}" })}}`,color:"red",icon:n.jsx(I.MinusOutlined,{rotate:90})},{value:ie.CANCELED,label:`{{t("Canceled", { ns: "${p}" })}}`,color:"volcano",icon:n.jsx(I.MinusOutlined,{rotate:45})},{value:ie.REJECTED,label:`{{t("Rejected", { ns: "${p}" })}}`,color:"volcano",icon:n.jsx(I.MinusOutlined,{})},{value:ie.RETRY_NEEDED,label:`{{t("Retry needed", { ns: "${p}" })}}`,color:"volcano",icon:n.jsx(I.RedoOutlined,{})}],qe=vo.reduce((e,o)=>Object.assign(e,{[o.value]:o}),{});class ge{constructor(){w(this,"title");w(this,"type");w(this,"group");w(this,"description");w(this,"options");w(this,"fieldset");w(this,"view");w(this,"scope");w(this,"components");w(this,"end")}createDefaultConfig(){return{}}}function nn(){const e=L.useForm(),o=l.useAPIClient(),t=l.useActionContext(),{refresh:r}=l.useResourceActionContext(),s=ve(),{workflow:a}=G();return{run(){return U(this,null,function*(){var c,u;if(a.executed){y.message.error(T("Node in executed workflow cannot be modified"));return}yield e.submit(),yield(u=(c=o.resource("flow_nodes")).update)==null?void 0:u.call(c,{filterByTk:s.id,values:{config:e.values}}),e.setInitialValues(fo.toJS(e.values)),t.setFormValueChanged(!1),t.setVisible(!1),r()})}}}const xo=b.createContext({});function ve(){return b.useContext(xo)}function Me(e=[]){const o=ve();return e.some(t=>
|
|
411
|
+
`}));function Pe(e){const i=e,{status:o,statusMap:t}=i,r=Z(i,["status","statusMap"]),{styles:s}=tn();let a=null;if(typeof o!="undefined"&&(t!=null&&t[o])){const{icon:c,color:u}=t[o];a=n.jsx(y.Tag,{color:u,children:c})}return n.jsx(y.Button,A(C({},r),{shape:"circle",size:"small",className:on(a?s.statusButtonClass:s.noStatusButtonClass,e.className),children:a}))}const pe={QUEUEING:null,STARTED:0,RESOLVED:1,FAILED:-1,ERROR:-2,ABORTED:-3,CANCELED:-4,REJECTED:-5,RETRY_NEEDED:-6},He=[{value:pe.QUEUEING,label:`{{t("Queueing", { ns: "${p}" })}}`,color:"blue",icon:n.jsx(I.HourglassOutlined,{}),description:`{{t("Triggered but still waiting in queue to execute.", { ns: "${p}" })}}`},{value:pe.STARTED,label:`{{t("On going", { ns: "${p}" })}}`,color:"gold",icon:n.jsx(I.LoadingOutlined,{}),description:`{{t("Started and executing, maybe waiting for an async callback (manual, delay etc.).", { ns: "${p}" })}}`},{value:pe.RESOLVED,label:`{{t("Resolved", { ns: "${p}" })}}`,color:"green",icon:n.jsx(I.CheckOutlined,{}),description:`{{t("Successfully finished.", { ns: "${p}" })}}`},{value:pe.FAILED,label:`{{t("Failed", { ns: "${p}" })}}`,color:"red",icon:n.jsx(I.ExclamationOutlined,{}),description:`{{t("Failed to satisfy node configurations.", { ns: "${p}" })}}`},{value:pe.ERROR,label:`{{t("Error", { ns: "${p}" })}}`,color:"red",icon:n.jsx(I.CloseOutlined,{}),description:`{{t("Some node meets error.", { ns: "${p}" })}}`},{value:pe.ABORTED,label:`{{t("Aborted", { ns: "${p}" })}}`,color:"red",icon:n.jsx(I.MinusOutlined,{rotate:90}),description:`{{t("Running of some node was aborted by program flow.", { ns: "${p}" })}}`},{value:pe.CANCELED,label:`{{t("Canceled", { ns: "${p}" })}}`,color:"volcano",icon:n.jsx(I.MinusOutlined,{rotate:45}),description:`{{t("Manually canceled whole execution when waiting.", { ns: "${p}" })}}`},{value:pe.REJECTED,label:`{{t("Rejected", { ns: "${p}" })}}`,color:"volcano",icon:n.jsx(I.MinusOutlined,{}),description:`{{t("Rejected from a manual node.", { ns: "${p}" })}}`},{value:pe.RETRY_NEEDED,label:`{{t("Retry needed", { ns: "${p}" })}}`,color:"volcano",icon:n.jsx(I.RedoOutlined,{}),description:`{{t("General failed but should do another try.", { ns: "${p}" })}}`}],Ge=He.reduce((e,o)=>Object.assign(e,{[o.value]:o}),{}),ie={PENDING:0,RESOLVED:1,FAILED:-1,ERROR:-2,ABORTED:-3,CANCELED:-4,REJECTED:-5,RETRY_NEEDED:-6},vo=[{value:ie.PENDING,label:`{{t("Pending", { ns: "${p}" })}}`,color:"gold",icon:n.jsx(I.ClockCircleOutlined,{})},{value:ie.RESOLVED,label:`{{t("Resolved", { ns: "${p}" })}}`,color:"green",icon:n.jsx(I.CheckOutlined,{})},{value:ie.FAILED,label:`{{t("Failed", { ns: "${p}" })}}`,color:"red",icon:n.jsx(I.ExclamationOutlined,{})},{value:ie.ERROR,label:`{{t("Error", { ns: "${p}" })}}`,color:"red",icon:n.jsx(I.CloseOutlined,{})},{value:ie.ABORTED,label:`{{t("Aborted", { ns: "${p}" })}}`,color:"red",icon:n.jsx(I.MinusOutlined,{rotate:90})},{value:ie.CANCELED,label:`{{t("Canceled", { ns: "${p}" })}}`,color:"volcano",icon:n.jsx(I.MinusOutlined,{rotate:45})},{value:ie.REJECTED,label:`{{t("Rejected", { ns: "${p}" })}}`,color:"volcano",icon:n.jsx(I.MinusOutlined,{})},{value:ie.RETRY_NEEDED,label:`{{t("Retry needed", { ns: "${p}" })}}`,color:"volcano",icon:n.jsx(I.RedoOutlined,{})}],qe=vo.reduce((e,o)=>Object.assign(e,{[o.value]:o}),{});class ge{constructor(){w(this,"title");w(this,"type");w(this,"group");w(this,"description");w(this,"options");w(this,"fieldset");w(this,"view");w(this,"scope");w(this,"components");w(this,"end")}createDefaultConfig(){return{}}}function nn(){const e=L.useForm(),o=l.useAPIClient(),t=l.useActionContext(),{refresh:r}=l.useResourceActionContext(),s=ve(),{workflow:a}=G();return{run(){return U(this,null,function*(){var c,u;if(a.executed){y.message.error(T("Node in executed workflow cannot be modified"));return}yield e.submit(),yield(u=(c=o.resource("flow_nodes")).update)==null?void 0:u.call(c,{filterByTk:s.id,values:{config:e.values}}),e.setInitialValues(fo.toJS(e.values)),t.setFormValueChanged(!1),t.setVisible(!1),r()})}}}const xo=b.createContext({});function ve(){return b.useContext(xo)}function Me(e=[]){const o=ve();return e.some(t=>Se.get(o.config,t)!=null)}function Jo(e,o){const t=[];if(!e)return[];for(let r=e.upstream;r;r=r.upstream)(typeof o!="function"||o(r))&&t.push(r);return t}function Uo(e){const o=[];if(!e)return[];for(let t=e;t;t=t.upstream)t.upstream&&t.branchIndex!=null&&o.push(t.upstream);return o}function Ho({data:e}){var i;const{styles:o}=ne(),{getAriaLabel:t}=bo(e),r=l.usePlugin(de),{Component:s=ko,end:a}=(i=r.instructions.get(e.type))!=null?i:{};return n.jsx(xo.Provider,{value:e,children:n.jsxs("div",{className:l.cx(o.nodeBlockClass),children:[n.jsx(s,{data:e}),!a||typeof a=="function"&&!a(e)?n.jsx(Wo,{"aria-label":t(),upstream:e}):n.jsx("div",{className:"end-sign",children:n.jsx(I.CloseOutlined,{})})]})})}function wo(){var d;const{t:e}=Q.useTranslation(),o=l.useAPIClient(),{workflow:t,nodes:r,refresh:s}=(d=G())!=null?d:{},a=ve(),{modal:i}=y.App.useApp();if(!t)return null;const c=o.resource("flow_nodes");function u(){return U(this,null,function*(){function f(){return U(this,null,function*(){var m;yield(m=c.destroy)==null?void 0:m.call(c,{filterByTk:a.id}),s()})}const h=r.filter(m=>m===a?!1:J.parse(m.config).parameters.filter(({key:B})=>B.startsWith(`$jobsMapByNodeKey.${a.key}.`)||B===`$jobsMapByNodeKey.${a.key}`).length);if(h.length){i.error({title:T("Can not delete"),content:T("The result of this node has been referenced by other nodes ({{nodes}}), please remove the usage before deleting.",{nodes:h.map(m=>`#${m.id}`).join(", ")})});return}const g=!r.find(m=>m.upstream===a&&m.branchIndex!=null)?e("Are you sure you want to delete it?"):T("This node contains branches, deleting will also be preformed to them, are you sure?");i.confirm({title:e("Delete"),content:g,onOk:f})})}return t.executed?null:n.jsx(y.Button,{type:"text",shape:"circle",icon:n.jsx(I.DeleteOutlined,{}),onClick:u,className:"workflow-node-remove-button"})}function Co(){var a;const{execution:e,setViewJob:o}=G(),{jobs:t}=(a=ve())!=null?a:{},{styles:r}=ne();if(!e)return null;if(!t.length)return n.jsx(Pe,{className:r.nodeJobButtonClass,disabled:!0});function s({key:i}){const c=t.find(u=>u.id==i);o(c)}return t.length>1?n.jsx(y.Dropdown,{menu:{items:t.map(i=>({key:i.id,label:n.jsxs(n.Fragment,{children:[n.jsx(Pe,{statusMap:qe,status:i.status}),n.jsx("time",{children:J.str2moment(i.updatedAt).format("YYYY-MM-DD HH:mm:ss")})]})})),onClick:s,className:r.dropdownClass},children:n.jsx(Pe,{statusMap:qe,status:t[t.length-1].status,className:r.nodeJobButtonClass})}):n.jsx(Pe,{statusMap:qe,status:t[0].status,onClick:()=>o(t[0]),className:r.nodeJobButtonClass})}function rn(){return{form:L.useForm()}}function ko(e){var M;const{data:o,children:t}=e,r=l.useCompile(),s=l.useAPIClient(),{workflow:a,refresh:i}=(M=G())!=null?M:{},{styles:c}=ne(),d=l.usePlugin(de).instructions.get(o.type),f=a.executed?'{{t("View")}}':'{{t("Configure")}}',[h,x]=b.useState(o.title),[g,m]=b.useState(!1),[k,O]=b.useState(!1),B=b.useMemo(()=>{const N=Se.cloneDeep(o.config);return le.createForm({initialValues:N,disabled:a.executed})},[o,a]),S=b.useCallback(N=>{m(N),N||B.reset()},[B]),E=b.useCallback(function(N){return U(this,null,function*(){var D,H;const F=N||r(d==null?void 0:d.title);x(F),F!==o.title&&(yield(H=(D=s.resource("flow_nodes")).update)==null?void 0:H.call(D,{filterByTk:o.id,values:{title:F}}),i())})},[o,d]),W=b.useCallback(function(N){if(N.target===N.currentTarget){m(!0);return}const F=new Set(["workflow-node-meta","workflow-node-config-button","ant-input-disabled"]);for(let D=N.target;D&&D!==N.currentTarget&&D!==document.documentElement;D=D.parentNode)if(Array.from(D.classList).some(H=>F.has(H))){m(!0),N.stopPropagation();return}},[]);if(!d)return n.jsx("div",{className:l.cx(c.nodeClass,`workflow-node-type-${o.type}`),children:n.jsx(y.Tooltip,{title:T("Node with unknown type will cause error. Please delete it or check plugin which provide this type."),children:n.jsxs("div",{role:"button","aria-label":`_untyped-${h}`,className:l.cx(c.nodeCardClass,"invalid"),onClick:W,children:[n.jsxs("div",{className:l.cx(c.nodeMetaClass,"workflow-node-meta"),children:[n.jsx(y.Tag,{color:"error",children:T("Unknown node")}),n.jsx("span",{className:"workflow-node-id",children:o.id})]}),n.jsx(y.Input.TextArea,{value:h,disabled:!0,autoSize:!0}),n.jsx(wo,{}),n.jsx(Co,{})]})})});const $=r(d.title);return n.jsxs("div",{className:l.cx(c.nodeClass,`workflow-node-type-${o.type}`),children:[n.jsxs("div",{role:"button","aria-label":`${$}-${h}`,className:l.cx(c.nodeCardClass,{configuring:g}),onClick:W,children:[n.jsxs("div",{className:l.cx(c.nodeMetaClass,"workflow-node-meta"),children:[n.jsx(y.Tag,{children:$}),n.jsx("span",{className:"workflow-node-id",children:o.id})]}),n.jsx(y.Input.TextArea,{disabled:a.executed,value:h,onChange:N=>x(N.target.value),onBlur:N=>E(N.target.value),autoSize:!0}),n.jsx(wo,{}),n.jsx(Co,{}),n.jsx(l.ActionContextProvider,{value:{visible:g,setVisible:S,formValueChanged:k,setFormValueChanged:O},children:n.jsx(l.FormProvider,{form:B,children:n.jsx(l.SchemaComponent,{distributed:!1,scope:A(C({},d.scope),{useFormProviderProps:rn,useUpdateAction:nn}),components:d.components,schema:{type:"void",properties:A(C({},d.view?{view:d.view}:{}),{button:{type:"void","x-content":f,"x-component":y.Button,"x-component-props":{type:"link",className:"workflow-node-config-button"}},[o.id]:{type:"void",title:n.jsxs("div",{className:l.css`
|
|
412
412
|
display: flex;
|
|
413
413
|
justify-content: space-between;
|
|
414
414
|
|
|
@@ -438,7 +438,7 @@
|
|
|
438
438
|
`},properties:d.fieldset},actions:a.executed?null:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useUpdateAction }}"}}}}})}})}})})})]}),t]})}function Ke({from:e=null,entry:o=null,branchIndex:t=null,controller:r=null,className:s,end:a}){const{styles:i}=ne(),{getAriaLabel:c}=bo(e,t),u=[];for(let d=o;d;d=d.downstream)u.push(d);return n.jsxs("div",{className:l.cx("workflow-branch",i.branchClass,s),children:[n.jsx("div",{className:"workflow-branch-lines"}),r,n.jsx(Wo,{"aria-label":c(),upstream:e,branchIndex:t}),n.jsx("div",{className:"workflow-node-list",children:u.map(d=>n.jsx(Ho,{data:d},d.id))}),a?n.jsx("div",{className:"end-sign",children:n.jsx(I.CloseOutlined,{})}):null]})}function sn(){var a;const e=L.useForm(),o=l.useAPIClient(),{workflow:t}=(a=G())!=null?a:{},r=l.useActionContext(),{refresh:s}=l.useResourceActionContext();return{run(){return U(this,null,function*(){if(t.executed){y.message.error(T("Trigger in executed workflow cannot be modified"));return}yield e.submit(),yield o.resource("workflows").update({filterByTk:t.id,values:{config:e.values}}),r.setFormValueChanged(!1),r.setVisible(!1),s()})}}}class So{constructor(){w(this,"sync");w(this,"title");w(this,"description");w(this,"fieldset");w(this,"view");w(this,"scope");w(this,"components");w(this,"initializers");w(this,"isActionTriggerable")}}function ln(){const e=l.useCompile(),{workflow:o,execution:t}=G(),{styles:r}=ne(),s=Ao();return t?n.jsx(l.SchemaComponent,{schema:{type:"void",name:"execution","x-component":"Action","x-component-props":{title:n.jsx(I.InfoOutlined,{}),shape:"circle",size:"small",className:r.nodeJobButtonClass,type:"primary"},properties:{[t.id]:{type:"void","x-decorator":"Form","x-decorator-props":{initialValue:t},"x-component":"Action.Modal",title:n.jsxs("div",{className:l.cx(r.nodeTitleClass),children:[n.jsx(y.Tag,{children:e(s.title)}),n.jsx("strong",{children:o.title}),n.jsxs("span",{className:"workflow-node-id",children:["#",t.id]})]}),properties:{createdAt:{type:"string",title:`{{t("Triggered at", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"DatePicker","x-component-props":{showTime:!0},"x-read-pretty":!0},context:{type:"object",title:`{{t("Trigger variables", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"Input.JSON","x-component-props":{className:l.css`
|
|
439
439
|
padding: 1em;
|
|
440
440
|
background-color: #eee;
|
|
441
|
-
`},"x-read-pretty":!0}}}}}}):null}function an(){return{form:L.useForm()}}const cn=()=>{const e=l.useAPIClient(),{workflow:o,refresh:t}=G(),[r,s]=b.useState(""),[a,i]=b.useState(!1),[c,u]=b.useState(!1),{styles:d}=ne(),f=l.useCompile(),h=Ao();b.useEffect(()=>{var $,M;o&&s((M=($=o.triggerTitle)!=null?$:o.title)!=null?M:f(h==null?void 0:h.title))},[o,h]);const x=b.useMemo(()=>{const $=
|
|
441
|
+
`},"x-read-pretty":!0}}}}}}):null}function an(){return{form:L.useForm()}}const cn=()=>{const e=l.useAPIClient(),{workflow:o,refresh:t}=G(),[r,s]=b.useState(""),[a,i]=b.useState(!1),[c,u]=b.useState(!1),{styles:d}=ne(),f=l.useCompile(),h=Ao();b.useEffect(()=>{var $,M;o&&s((M=($=o.triggerTitle)!=null?$:o.title)!=null?M:f(h==null?void 0:h.title))},[o,h]);const x=b.useMemo(()=>{const $=Se.cloneDeep(o.config);return le.createForm({initialValues:$,disabled:o.executed})},[o]),g=b.useCallback($=>{i($),$||x.reset()},[x]),m=b.useCallback(function($){return U(this,null,function*(){const M=$||f(h==null?void 0:h.title);s(M),M!==o.triggerTitle&&(yield e.resource("workflows").update({filterByTk:o.id,values:{triggerTitle:M}}),t())})},[o,h]),k=b.useCallback(function($){var N;if($.target===$.currentTarget){i(!0);return}const M=new Set(["workflow-node-meta","workflow-node-config-button","ant-input-disabled"]);for(let F=$.target;F&&F!==$.currentTarget;F=F.parentNode)if(Array.from((N=F.classList)!=null?N:[]).some(D=>M.has(D))){i(!0),$.stopPropagation();return}},[]),O=o.executed?'{{t("View")}}':'{{t("Configure")}}',B=T("Trigger");if(!h)return n.jsx(y.Tooltip,{title:T("Workflow with unknown type will cause error. Please delete it or check plugin which provide this type."),children:n.jsxs("div",{role:"button","aria-label":`${B}-${r}`,className:l.cx(d.nodeCardClass,"invalid"),onClick:k,children:[n.jsx("div",{className:l.cx(d.nodeMetaClass,"workflow-node-meta"),children:n.jsx(y.Tag,{color:"error",children:T("Unknown trigger")})}),n.jsx("div",{className:"workflow-node-title",children:n.jsx(y.Input.TextArea,{value:r,disabled:!0,autoSize:!0})})]})});const{fieldset:S,scope:E,components:W}=h;return n.jsxs("div",{role:"button","aria-label":`${B}-${r}`,className:l.cx(d.nodeCardClass),onClick:k,children:[n.jsx("div",{className:l.cx(d.nodeMetaClass,"workflow-node-meta"),children:n.jsxs(y.Tag,{color:"gold",children:[n.jsx(I.ThunderboltOutlined,{}),n.jsx("span",{className:"type",children:f(h.title)})]})}),n.jsx("div",{className:"workflow-node-title",children:n.jsx(y.Input.TextArea,{value:r,onChange:$=>s($.target.value),onBlur:$=>m($.target.value),autoSize:!0,disabled:o.executed})}),n.jsx(ln,{}),n.jsx(l.ActionContextProvider,{value:{visible:a,setVisible:g,formValueChanged:c,setFormValueChanged:u},children:n.jsx(l.FormProvider,{form:x,children:n.jsx(l.SchemaComponent,{scope:A(C({},E),{useFormProviderProps:an}),components:W,schema:{name:`workflow-trigger-${o.id}`,type:"void",properties:{config:{type:"void","x-content":O,"x-component":y.Button,"x-component-props":{type:"link",className:"workflow-node-config-button"}},drawer:{type:"void",title:B,"x-component":"Action.Drawer","x-decorator":"FormV2","x-use-decorator-props":"useFormProviderProps",properties:A(C({},h.description?{description:{type:"void","x-component":Lo,"x-component-props":{label:T("Trigger type"),title:h.title,description:h.description}}}:{}),{fieldset:{type:"void","x-component":"fieldset","x-component-props":{className:l.css`
|
|
442
442
|
.ant-select.auto-width {
|
|
443
443
|
width: auto;
|
|
444
444
|
min-width: 6em;
|
|
@@ -456,13 +456,13 @@
|
|
|
456
456
|
`},"x-component":"CollectionFieldset"},_e={type:"object",title:'{{t("Filter")}}',"x-decorator":"FormItem","x-component":"Filter","x-use-component-props":()=>{const{values:e}=L.useForm(),[o,t]=l.parseCollectionName(e==null?void 0:e.collection);return{options:l.useCollectionFilterOptions(t,o),className:l.css`
|
|
457
457
|
position: relative;
|
|
458
458
|
width: 100%;
|
|
459
|
-
`}},"x-component-props":{dynamicComponent:"FilterDynamicComponent"}},Nn={type:"array",title:'{{t("Sort")}}',"x-decorator":"FormItem","x-component":"ArrayItems",items:{type:"object",properties:{space:{type:"void","x-component":"Space",properties:{sort:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.SortHandle"},field:{type:"string",enum:"{{useSortableFields()}}",required:!0,"x-decorator":"FormItem","x-component":"Select","x-component-props":{style:{width:260}}},direction:{type:"string","x-decorator":"FormItem","x-component":"Radio.Group","x-component-props":{optionType:"button"},enum:[{label:'{{t("ASC")}}',value:"asc"},{label:'{{t("DESC")}}',value:"desc"}]},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},properties:{add:{type:"void",title:'{{t("Add sort field")}}',"x-component":"ArrayItems.Addition"}}},En={type:"void",title:'{{t("Pagination")}}',"x-decorator":"SchemaComponentContext.Provider","x-decorator-props":{value:{designable:!1}},"x-component":"Grid",properties:{row:{type:"void","x-component":"Grid.Row",properties:{page:{type:"void","x-component":"Grid.Col",properties:{page:{type:"number",title:'{{t("Page number")}}',"x-decorator":"FormItem","x-component":"WorkflowVariableInput","x-component-props":{useTypedConstant:["number","null"]},default:1}}},pageSize:{type:"void","x-component":"Grid.Col",properties:{pageSize:{type:"number",title:'{{t("Page size")}}',"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{min:1,max:100},default:20}}}}}}},Ve={type:"array",title:`{{t("Preload associations", { ns: "${p}" })}}`,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: "${p}" })}}`,"x-decorator":"FormItem","x-component":"AppendsTreeSelect","x-component-props":{title:"Preload associations",multiple:!0,useCollection(){const{values:e}=L.useForm();return e==null?void 0:e.collection}},"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]},Se={label:"label",value:"value",children:"children"},ot={label:`{{t("Node result", { ns: "${p}" })}}`,value:"$jobsMapByNodeKey",useOptions(e){const{instructions:o}=l.usePlugin(de),t=ve(),r=Jo(t),s=[];return r.forEach(a=>{var u;const i=o.get(a.type),c=(u=i.useVariables)==null?void 0:u.call(i,a,e);c&&s.push(c)}),s}},tt={label:`{{t("Trigger variables", { ns: "${p}" })}}`,value:"$context",useOptions(e){var s,a;const{triggers:o}=l.usePlugin(de),{workflow:t}=G(),r=o.get(t.type);return(a=(s=r==null?void 0:r.useVariables)==null?void 0:s.call(r,t.config,e))!=null?a:null}},nt={label:`{{t("Scope variables", { ns: "${p}" })}}`,value:"$scopes",useOptions(e){const{fieldNames:o=Se,current:t}=e,{instructions:r}=l.usePlugin(de),s=ve(),a=t!=null?t:s,i=Uo(a),c=[];return i.forEach(u=>{var h,x;const d=r.get(u.type),f=(h=d.useScopeVariables)==null?void 0:h.call(d,u,e);f&&c.push({key:u.key,[o.value]:u.key,[o.label]:(x=u.title)!=null?x:`#${u.id}`,[o.children]:f})}),c}},rt={label:`{{t("System variables", { ns: "${p}" })}}`,value:"$system",useOptions({types:e,fieldNames:o=Se}){return[...!e||e.includes("date")?[{key:"now",[o.label]:T("System time"),[o.value]:"now"}]:[]]}},Ze={boolean:new Set(["checkbox"]),number:new Set(["integer","number","percent"]),string:new Set(["input","password","email","phone","select","radioGroup","text","markdown","richText","expression","time"]),date:new Set(["date","createdAt","updatedAt"])};function st(e,o){var t,r,s,a,i,c;return typeof o=="string"?(t=Ze[o])==null?void 0:t.has(e.interface):typeof o=="object"&&o.type==="reference"?No(e)?((r=o.options)==null?void 0:r.entity)&&(e.collectionName===((s=o.options)==null?void 0:s.collection)||((a=o.options)==null?void 0:a.collection)==="*"):e.isForeignKey?e.collectionName===((i=o.options)==null?void 0:i.collection)&&e.name==="id"||e.target===((c=o.options)==null?void 0:c.collection):!1:typeof o=="function"?o(e):!1}function No(e){return["belongsTo","hasOne","hasMany","belongsToMany"].includes(e.type)}function Eo(e,o){if(o==null)return null;const t=`${e.name}.`;return o.filter(r=>r.startsWith(t)).map(r=>r.replace(t,""))}function $o({fields:e,types:o,appends:t,depth:r=1,compile:s,getCollectionFields:a}){return e.filter(i=>{const c=o!=null&&o.length?o.some(u=>st(i,u)):!0;if(No(i)){if(t===null)return r?c||$o({fields:Do(i.target,{compile:s,getCollectionFields:a}),types:o,depth:r-1,appends:t,compile:s,getCollectionFields:a}):!1;const u=Eo(i,t),d=t.includes(i.name);return c?d:((u==null?void 0:u.length)||d)&&$o({fields:Do(i.target,{compile:s,getCollectionFields:a}),types:o,appends:u,compile:s,getCollectionFields:a}).length}else return c})}function Qe(e,o){var a,i;const t=l.useCompile(),r=(i=(a=e.useOptions)==null?void 0:a.call(e,o))==null?void 0:i.filter(Boolean),{fieldNames:s}=o;return{[s.label]:t(e.label),[s.value]:e.value,key:e[s.value],[s.children]:r,disabled:!r||!r.length}}function me(e={}){var s;const o=Object.assign({},Se,(s=e.fieldNames)!=null?s:{}),t=Object.assign(e,{fieldNames:o});return[Qe(nt,t),Qe(ot,t),Qe(tt,t),Qe(rt,t)]}function Do(e,{compile:o,getCollectionFields:t}){var d,f,h,x;const[r,s]=l.parseCollectionName(e),a=t(s,r),i=[],c=[];a.forEach(g=>{if(g.isForeignKey)i.push(g);else{const m=a.find(k=>k.name===g.foreignKey);m&&i.push(m),c.push(g)}});const u=ke.uniqBy(i,"name");for(let g=c.length-1;g>=0;g--){const m=c[g];if(m.type==="belongsTo"){const k=u.find(O=>O.name===m.foreignKey);k?c.splice(g,0,A(C(C({},m),k),{uiSchema:A(C({},m.uiSchema),{title:(d=k.uiSchema)!=null&&d.title?o((f=k.uiSchema)==null?void 0:f.title):k.name})})):c.splice(g,0,A(C({},m),{name:m.foreignKey,type:"bigInt",isForeignKey:!0,interface:m.interface,uiSchema:A(C({},m.uiSchema),{title:(h=m.uiSchema)!=null&&h.title?`${o((x=m.uiSchema)==null?void 0:x.title)} ID`:m.name})}))}else m.type==="context"&&m.collectionName==="users"&&c.splice(g,1)}return ke.uniqBy(c,"name").filter(g=>g.interface&&!g.hidden)}function $n(e){const o=Eo(e.field,e.appends),t=Ae(C({collection:`${e.field.dataSourceKey&&e.field.dataSourceKey!=="main"?`${e.field.dataSourceKey}:`:""}${e.field.target}`,types:e.types,appends:o,depth:e.depth-1},this));e.loadChildren=null,t.length?e.children=t:(e.isLeaf=!0,!e.types||e.types.some(s=>st(e.field,s))||(e.disabled=!0))}function Ae(e){const{fields:o,collection:t,types:r,appends:s=[],depth:a=1,compile:i,getCollectionFields:c,fieldNames:u=Se}=e,d=o!=null?o:Do(t,{compile:i,getCollectionFields:c}),f=$n.bind({compile:i,getCollectionFields:c,fieldNames:u});return $o({fields:d,types:r,depth:a,appends:s,compile:i,getCollectionFields:c}).map(x=>{var O;const g=i(((O=x.uiSchema)==null?void 0:O.title)||x.name),m=Eo(x,s),k=!No(x)||m&&!m.length&&!s.includes(x.name)||!1;return{[u.label]:g,key:x.name,[u.value]:x.name,isLeaf:k,loadChildren:k?null:f,field:x,depth:a,appends:s,types:r}})}function je(e){const o=l.useApp(),{collectionManager:t}=o.dataSourceManager.getDataSource(e);return b.useCallback(r=>t.getCollectionFields(r),[t])}function lt(t){var r=t,{variableOptions:e}=r,o=Z(r,["variableOptions"]);const s=me(e);return n.jsx(l.Variable.Input,C({scope:s},o))}function Io(t){var r=t,{variableOptions:e}=r,o=Z(r,["variableOptions"]);const s=me(e);return n.jsx(l.Variable.TextArea,C({scope:s},o))}function Dn(t){var r=t,{variableOptions:e}=r,o=Z(r,["variableOptions"]);const s=me(e);return n.jsx(l.Variable.RawTextArea,C({scope:s},o))}function In(t){var r=t,{variableOptions:e}=r,o=Z(r,["variableOptions"]);const s=me(e);return n.jsx(l.Variable.JSON,C({scope:s},o))}function Pn(){const e=l.useAPIClient(),o=L.useForm(),{field:t,__parent:r}=l.useBlockRequestContext(),{setVisible:s}=l.useActionContext(),a=te.useNavigate(),i=L.useFieldSchema(),c=L.useField(),u=l.useCompile(),{modal:d}=y.App.useApp(),f=l.useCollectValuesToSubmit(),h=c.componentProps.filterKeys||[];return{onClick(){return U(this,null,function*(){var B,S,E;const{onSuccess:g,skipValidator:m,triggerWorkflows:k}=(B=i==null?void 0:i["x-action-settings"])!=null?B:{};m||(yield o.submit());const O=yield f();c.data=t.data||{},c.data.loading=!0;try{const W=yield e.resource("workflows").trigger({values:O,filterKeys:h,triggerWorkflows:k!=null&&k.length?k.map($=>[$.workflowKey,$.context].filter(Boolean).join("!")).join(","):void 0});if(c.data.loading=!1,c.data.data=W,(E=(S=r==null?void 0:r.service)==null?void 0:S.refresh)==null||E.call(S),s==null||s(!1),!(g!=null&&g.successMessage))return;g!=null&&g.manualClose?d.success({title:u(g==null?void 0:g.successMessage),onOk:()=>U(this,null,function*(){yield o.reset(),g!=null&&g.redirecting&&(g!=null&&g.redirectTo)&&(J.isURL(g.redirectTo)?window.location.href=g.redirectTo:a(g.redirectTo))})}):y.message.success(u(g==null?void 0:g.successMessage))}catch(W){c.data.loading=!1}})}}}function Mn(){var g;const e=l.useCompile(),o=l.useAPIClient(),t=l.useRecord(),r=L.useField(),s=L.useFieldSchema(),{field:a,__parent:i}=l.useBlockRequestContext(),{setVisible:c,setSubmitted:u}=l.useActionContext(),{modal:d}=y.App.useApp(),f=te.useNavigate(),{onSuccess:h,triggerWorkflows:x}=(g=s==null?void 0:s["x-action-settings"])!=null?g:{};return{onClick(k,O){return U(this,null,function*(){r.data=a.data||{},r.data.loading=!0;try{if(yield o.resource("workflows").trigger({values:t,triggerWorkflows:x!=null&&x.length?x.map(B=>[B.workflowKey,B.context].filter(Boolean).join("!")).join(","):void 0}),O&&O(),c==null||c(!1),u==null||u(!0),!(h!=null&&h.successMessage))return;if(h!=null&&h.manualClose){let B;d.success({title:e(h==null?void 0:h.successMessage),onOk(){return U(this,null,function*(){h!=null&&h.redirecting&&(h!=null&&h.redirectTo)&&(J.isURL(h.redirectTo)?window.location.href=h.redirectTo:f(h.redirectTo))})}})}else y.message.success(e(h==null?void 0:h.successMessage))}catch(B){console.error(B)}finally{r.data.loading=!1}})}}}function Bn(){const{workflow:e}=G();return!!(e!=null&&e.executed)}function it(){const{workflow:e}=G();return!!(e!=null&&e.allExecuted)}const Fe={CREATED:1,UPDATED:2,SAVED:3,DELETED:4},Vn=[{label:`{{t("After record added", { ns: "${p}" })}}`,value:Fe.CREATED},{label:`{{t("After record updated", { ns: "${p}" })}}`,value:Fe.UPDATED},{label:`{{t("After record added or updated", { ns: "${p}" })}}`,value:Fe.SAVED},{label:`{{t("After record deleted", { ns: "${p}" })}}`,value:Fe.DELETED}];function jn(e,o){var u;const[t,r]=l.parseCollectionName(e.collection),s=l.useCompile(),a=je(t),i=[{collectionName:r,name:"data",type:"hasOne",target:r,uiSchema:{title:T("Trigger data")}}];return Ae(A(C({appends:["data",...((u=e.appends)==null?void 0:u.map(d=>`data.${d}`))||[]]},o),{fields:i,compile:s,getCollectionFields:a}))}class Wn extends So{constructor(){super(...arguments);w(this,"title",`{{t("Collection event", { ns: "${p}" })}}`);w(this,"description",`{{t('Triggered when data changes in the collection, such as after adding, updating, or deleting a record. Unlike "Post-action event", Collection event listens for data changes rather than HTTP requests. Unless you understand the exact meaning, it is recommended to use "Post-action event".', { ns: "${p}" })}}`);w(this,"fieldset",{collection:A(C({},ae),{"x-disabled":"{{ useWorkflowAnyExecuted() }}","x-component-props":{dataSourceFilter(t){return t.options.key==="main"||t.options.isDBInstance}},"x-reactions":[...ae["x-reactions"],{target:"changed",effects:["onFieldValueChange"],fulfill:{state:{value:[]}}},{target:"condition",effects:["onFieldValueChange"],fulfill:{state:{value:null}}},{target:"appends",effects:["onFieldValueChange"],fulfill:{state:{value:[]}}}]}),mode:{type:"number",title:`{{t("Trigger on", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"Select","x-component-props":{popupMatchSelectWidth:!1,placeholder:`{{t("Trigger on", { ns: "${p}" })}}`,className:"auto-width"},enum:Vn,required:!0,"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]},changed:{type:"array",title:`{{t("Changed fields", { ns: "${p}" })}}`,description:`{{t("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 or deleted, any field is considered to have been changed.", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"FieldsSelect","x-component-props":{mode:"multiple",placeholder:'{{t("Select field")}}',filter(t){return!t.hidden&&(t.uiSchema?!t.uiSchema["x-read-pretty"]:!0)&&!["linkTo","hasOne","hasMany","belongsToMany"].includes(t.type)}},"x-reactions":[{dependencies:["collection","mode"],fulfill:{state:{visible:`{{!!$deps[0] && ($deps[1] & ${Fe.UPDATED})}}`}}}]},condition:A(C({},_e),{title:`{{t("Only triggers when match conditions", { ns: "${p}" })}}`,"x-component-props":{},"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]}),appends:A(C({},Ve),{"x-reactions":[...Ve["x-reactions"],{dependencies:["mode"],fulfill:{state:{visible:`{{!($deps[0] & ${Fe.DELETED})}}`}}}]})});w(this,"scope",{useCollectionDataSource:l.useCollectionDataSource,useWorkflowAnyExecuted:it});w(this,"components",{FieldsSelect:To});w(this,"useVariables",jn)}useInitializers(t){return t.collection?{name:"triggerData",type:"item",key:"triggerData",title:`{{t("Trigger data", { ns: "${p}" })}}`,Component:Be,collection:t.collection,dataPath:"$context.data"}:null}}const we={STATIC:0,DATE_FIELD:1};function Ln(e){return!e.hidden&&(e.uiSchema?e.type==="date":!1)}function at({value:e,onChange:o}){const t=e!=null?e:{},{t:r}=Q.useTranslation(),[s,a]=b.useState(t.offset?t.offset/Math.abs(t.offset):0);return n.jsxs("fieldset",{className:l.css`
|
|
459
|
+
`}},"x-component-props":{dynamicComponent:"FilterDynamicComponent"}},Nn={type:"array",title:'{{t("Sort")}}',"x-decorator":"FormItem","x-component":"ArrayItems",items:{type:"object",properties:{space:{type:"void","x-component":"Space",properties:{sort:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.SortHandle"},field:{type:"string",enum:"{{useSortableFields()}}",required:!0,"x-decorator":"FormItem","x-component":"Select","x-component-props":{style:{width:260}}},direction:{type:"string","x-decorator":"FormItem","x-component":"Radio.Group","x-component-props":{optionType:"button"},enum:[{label:'{{t("ASC")}}',value:"asc"},{label:'{{t("DESC")}}',value:"desc"}]},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},properties:{add:{type:"void",title:'{{t("Add sort field")}}',"x-component":"ArrayItems.Addition"}}},En={type:"void",title:'{{t("Pagination")}}',"x-decorator":"SchemaComponentContext.Provider","x-decorator-props":{value:{designable:!1}},"x-component":"Grid",properties:{row:{type:"void","x-component":"Grid.Row",properties:{page:{type:"void","x-component":"Grid.Col",properties:{page:{type:"number",title:'{{t("Page number")}}',"x-decorator":"FormItem","x-component":"WorkflowVariableInput","x-component-props":{useTypedConstant:["number","null"]},default:1}}},pageSize:{type:"void","x-component":"Grid.Col",properties:{pageSize:{type:"number",title:'{{t("Page size")}}',"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{min:1,max:100},default:20}}}}}}},Ve={type:"array",title:`{{t("Preload associations", { ns: "${p}" })}}`,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: "${p}" })}}`,"x-decorator":"FormItem","x-component":"AppendsTreeSelect","x-component-props":{title:"Preload associations",multiple:!0,useCollection(){const{values:e}=L.useForm();return e==null?void 0:e.collection}},"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]},Ae={label:"label",value:"value",children:"children"},ot={label:`{{t("Node result", { ns: "${p}" })}}`,value:"$jobsMapByNodeKey",useOptions(e){const{instructions:o}=l.usePlugin(de),t=ve(),r=Jo(t),s=[];return r.forEach(a=>{var u;const i=o.get(a.type),c=(u=i.useVariables)==null?void 0:u.call(i,a,e);c&&s.push(c)}),s}},tt={label:`{{t("Trigger variables", { ns: "${p}" })}}`,value:"$context",useOptions(e){var s,a;const{triggers:o}=l.usePlugin(de),{workflow:t}=G(),r=o.get(t.type);return(a=(s=r==null?void 0:r.useVariables)==null?void 0:s.call(r,t.config,e))!=null?a:null}},nt={label:`{{t("Scope variables", { ns: "${p}" })}}`,value:"$scopes",useOptions(e){const{fieldNames:o=Ae,current:t}=e,{instructions:r}=l.usePlugin(de),s=ve(),a=t!=null?t:s,i=Uo(a),c=[];return i.forEach(u=>{var h,x;const d=r.get(u.type),f=(h=d.useScopeVariables)==null?void 0:h.call(d,u,e);f&&c.push({key:u.key,[o.value]:u.key,[o.label]:(x=u.title)!=null?x:`#${u.id}`,[o.children]:f})}),c}},rt={label:`{{t("System variables", { ns: "${p}" })}}`,value:"$system",useOptions({types:e,fieldNames:o=Ae}){return[...!e||e.includes("date")?[{key:"now",[o.label]:T("System time"),[o.value]:"now"}]:[]]}},Ze={boolean:new Set(["checkbox"]),number:new Set(["integer","number","percent"]),string:new Set(["input","password","email","phone","select","radioGroup","text","markdown","richText","expression","time"]),date:new Set(["date","createdAt","updatedAt"])};function st(e,o){var t,r,s,a,i,c;return typeof o=="string"?(t=Ze[o])==null?void 0:t.has(e.interface):typeof o=="object"&&o.type==="reference"?No(e)?((r=o.options)==null?void 0:r.entity)&&(e.collectionName===((s=o.options)==null?void 0:s.collection)||((a=o.options)==null?void 0:a.collection)==="*"):e.isForeignKey?e.collectionName===((i=o.options)==null?void 0:i.collection)&&e.name==="id"||e.target===((c=o.options)==null?void 0:c.collection):!1:typeof o=="function"?o(e):!1}function No(e){return["belongsTo","hasOne","hasMany","belongsToMany"].includes(e.type)}function Eo(e,o){if(o==null)return null;const t=`${e.name}.`;return o.filter(r=>r.startsWith(t)).map(r=>r.replace(t,""))}function $o({fields:e,types:o,appends:t,depth:r=1,compile:s,getCollectionFields:a}){return e.filter(i=>{const c=o!=null&&o.length?o.some(u=>st(i,u)):!0;if(No(i)){if(t===null)return r?c||$o({fields:Do(i.target,{compile:s,getCollectionFields:a}),types:o,depth:r-1,appends:t,compile:s,getCollectionFields:a}):!1;const u=Eo(i,t),d=t.includes(i.name);return c?d:((u==null?void 0:u.length)||d)&&$o({fields:Do(i.target,{compile:s,getCollectionFields:a}),types:o,appends:u,compile:s,getCollectionFields:a}).length}else return c})}function Qe(e,o){var a,i;const t=l.useCompile(),r=(i=(a=e.useOptions)==null?void 0:a.call(e,o))==null?void 0:i.filter(Boolean),{fieldNames:s}=o;return{[s.label]:t(e.label),[s.value]:e.value,key:e[s.value],[s.children]:r,disabled:!r||!r.length}}function me(e={}){var s;const o=Object.assign({},Ae,(s=e.fieldNames)!=null?s:{}),t=Object.assign(e,{fieldNames:o});return[Qe(nt,t),Qe(ot,t),Qe(tt,t),Qe(rt,t)]}function Do(e,{compile:o,getCollectionFields:t}){var d,f,h,x;const[r,s]=l.parseCollectionName(e),a=t(s,r),i=[],c=[];a.forEach(g=>{if(g.isForeignKey)i.push(g);else{const m=a.find(k=>k.name===g.foreignKey);m&&i.push(m),c.push(g)}});const u=Se.uniqBy(i,"name");for(let g=c.length-1;g>=0;g--){const m=c[g];if(m.type==="belongsTo"){const k=u.find(O=>O.name===m.foreignKey);k?c.splice(g,0,A(C(C({},m),k),{uiSchema:A(C({},m.uiSchema),{title:(d=k.uiSchema)!=null&&d.title?o((f=k.uiSchema)==null?void 0:f.title):k.name})})):c.splice(g,0,A(C({},m),{name:m.foreignKey,type:"bigInt",isForeignKey:!0,interface:m.interface,uiSchema:A(C({},m.uiSchema),{title:(h=m.uiSchema)!=null&&h.title?`${o((x=m.uiSchema)==null?void 0:x.title)} ID`:m.name})}))}else m.type==="context"&&m.collectionName==="users"&&c.splice(g,1)}return Se.uniqBy(c,"name").filter(g=>g.interface&&!g.hidden)}function $n(e){const o=Eo(e.field,e.appends),t=Fe(C({collection:`${e.field.dataSourceKey&&e.field.dataSourceKey!=="main"?`${e.field.dataSourceKey}:`:""}${e.field.target}`,types:e.types,appends:o,depth:e.depth-1},this));e.loadChildren=null,t.length?e.children=t:(e.isLeaf=!0,!e.types||e.types.some(s=>st(e.field,s))||(e.disabled=!0))}function Fe(e){const{fields:o,collection:t,types:r,appends:s=[],depth:a=1,compile:i,getCollectionFields:c,fieldNames:u=Ae}=e,d=o!=null?o:Do(t,{compile:i,getCollectionFields:c}),f=$n.bind({compile:i,getCollectionFields:c,fieldNames:u});return $o({fields:d,types:r,depth:a,appends:s,compile:i,getCollectionFields:c}).map(x=>{var O;const g=i(((O=x.uiSchema)==null?void 0:O.title)||x.name),m=Eo(x,s),k=!No(x)||m&&!m.length&&!s.includes(x.name)||!1;return{[u.label]:g,key:x.name,[u.value]:x.name,isLeaf:k,loadChildren:k?null:f,field:x,depth:a,appends:s,types:r}})}function je(e){const o=l.useApp(),{collectionManager:t}=o.dataSourceManager.getDataSource(e);return b.useCallback(r=>t.getCollectionFields(r),[t])}function lt(t){var r=t,{variableOptions:e}=r,o=Z(r,["variableOptions"]);const s=me(e);return n.jsx(l.Variable.Input,C({scope:s},o))}function Io(t){var r=t,{variableOptions:e}=r,o=Z(r,["variableOptions"]);const s=me(e);return n.jsx(l.Variable.TextArea,C({scope:s},o))}function Dn(t){var r=t,{variableOptions:e}=r,o=Z(r,["variableOptions"]);const s=me(e);return n.jsx(l.Variable.RawTextArea,C({scope:s},o))}function In(t){var r=t,{variableOptions:e}=r,o=Z(r,["variableOptions"]);const s=me(e);return n.jsx(l.Variable.JSON,C({scope:s},o))}function Pn(){const e=l.useAPIClient(),o=L.useForm(),{field:t,__parent:r}=l.useBlockRequestContext(),{setVisible:s}=l.useActionContext(),a=te.useNavigate(),i=L.useFieldSchema(),c=L.useField(),u=l.useCompile(),{modal:d}=y.App.useApp(),f=l.useCollectValuesToSubmit(),h=c.componentProps.filterKeys||[];return{onClick(){return U(this,null,function*(){var B,S,E;const{onSuccess:g,skipValidator:m,triggerWorkflows:k}=(B=i==null?void 0:i["x-action-settings"])!=null?B:{};m||(yield o.submit());const O=yield f();c.data=t.data||{},c.data.loading=!0;try{const W=yield e.resource("workflows").trigger({values:O,filterKeys:h,triggerWorkflows:k!=null&&k.length?k.map($=>[$.workflowKey,$.context].filter(Boolean).join("!")).join(","):void 0});if(c.data.loading=!1,c.data.data=W,(E=(S=r==null?void 0:r.service)==null?void 0:S.refresh)==null||E.call(S),s==null||s(!1),!(g!=null&&g.successMessage))return;g!=null&&g.manualClose?d.success({title:u(g==null?void 0:g.successMessage),onOk:()=>U(this,null,function*(){yield o.reset(),g!=null&&g.redirecting&&(g!=null&&g.redirectTo)&&(J.isURL(g.redirectTo)?window.location.href=g.redirectTo:a(g.redirectTo))})}):y.message.success(u(g==null?void 0:g.successMessage))}catch(W){c.data.loading=!1}})}}}function Mn(){var g;const e=l.useCompile(),o=l.useAPIClient(),t=l.useRecord(),r=L.useField(),s=L.useFieldSchema(),{field:a,__parent:i}=l.useBlockRequestContext(),{setVisible:c,setSubmitted:u}=l.useActionContext(),{modal:d}=y.App.useApp(),f=te.useNavigate(),{onSuccess:h,triggerWorkflows:x}=(g=s==null?void 0:s["x-action-settings"])!=null?g:{};return{onClick(k,O){return U(this,null,function*(){r.data=a.data||{},r.data.loading=!0;try{if(yield o.resource("workflows").trigger({values:t,triggerWorkflows:x!=null&&x.length?x.map(B=>[B.workflowKey,B.context].filter(Boolean).join("!")).join(","):void 0}),O&&O(),c==null||c(!1),u==null||u(!0),!(h!=null&&h.successMessage))return;if(h!=null&&h.manualClose){let B;d.success({title:e(h==null?void 0:h.successMessage),onOk(){return U(this,null,function*(){h!=null&&h.redirecting&&(h!=null&&h.redirectTo)&&(J.isURL(h.redirectTo)?window.location.href=h.redirectTo:f(h.redirectTo))})}})}else y.message.success(e(h==null?void 0:h.successMessage))}catch(B){console.error(B)}finally{r.data.loading=!1}})}}}function Bn(){const{workflow:e}=G();return!!(e!=null&&e.executed)}function it(){const{workflow:e}=G();return!!(e!=null&&e.allExecuted)}const we={CREATED:1,UPDATED:2,SAVED:3,DELETED:4},Vn=[{label:`{{t("After record added", { ns: "${p}" })}}`,value:we.CREATED},{label:`{{t("After record updated", { ns: "${p}" })}}`,value:we.UPDATED},{label:`{{t("After record added or updated", { ns: "${p}" })}}`,value:we.SAVED},{label:`{{t("After record deleted", { ns: "${p}" })}}`,value:we.DELETED}];function jn(e,o){var u;const[t,r]=l.parseCollectionName(e.collection),s=l.useCompile(),a=je(t),i=[{collectionName:r,name:"data",type:"hasOne",target:r,uiSchema:{title:T("Trigger data")}}];return Fe(A(C({appends:["data",...((u=e.appends)==null?void 0:u.map(d=>`data.${d}`))||[]]},o),{fields:i,compile:s,getCollectionFields:a}))}class Wn extends So{constructor(){super(...arguments);w(this,"title",`{{t("Collection event", { ns: "${p}" })}}`);w(this,"description",`{{t('Triggered when data changes in the collection, such as after adding, updating, or deleting a record. Unlike "Post-action event", Collection event listens for data changes rather than HTTP requests. Unless you understand the exact meaning, it is recommended to use "Post-action event".', { ns: "${p}" })}}`);w(this,"fieldset",{collection:A(C({},ae),{"x-disabled":"{{ useWorkflowAnyExecuted() }}","x-component-props":{dataSourceFilter(t){return t.options.key==="main"||t.options.isDBInstance}},"x-reactions":[...ae["x-reactions"],{target:"changed",effects:["onFieldValueChange"],fulfill:{state:{value:[]}}},{target:"condition",effects:["onFieldValueChange"],fulfill:{state:{value:null}}},{target:"appends",effects:["onFieldValueChange"],fulfill:{state:{value:[]}}}]}),mode:{type:"number",title:`{{t("Trigger on", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"Select","x-component-props":{popupMatchSelectWidth:!1,placeholder:`{{t("Trigger on", { ns: "${p}" })}}`,className:"auto-width"},enum:Vn,required:!0,"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]},changed:{type:"array",title:`{{t("Changed fields", { ns: "${p}" })}}`,description:`{{t("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 or deleted, any field is considered to have been changed.", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"FieldsSelect","x-component-props":{mode:"multiple",placeholder:'{{t("Select field")}}',filter(t){return!t.hidden&&(t.uiSchema?!t.uiSchema["x-read-pretty"]:!0)&&!["linkTo","hasOne","hasMany","belongsToMany"].includes(t.type)}},"x-reactions":[{dependencies:["collection","mode"],fulfill:{state:{visible:`{{!!$deps[0] && ($deps[1] & ${we.UPDATED})}}`}}}]},condition:A(C({},_e),{title:`{{t("Only triggers when match conditions", { ns: "${p}" })}}`,"x-component-props":{},"x-reactions":[{dependencies:["collection","mode"],fulfill:{state:{visible:`{{!!$deps[0] && !($deps[1] & ${we.DELETED})}}`}}}]}),appends:A(C({},Ve),{"x-reactions":[...Ve["x-reactions"],{dependencies:["mode"],fulfill:{state:{visible:`{{!($deps[0] & ${we.DELETED})}}`}}}]})});w(this,"scope",{useCollectionDataSource:l.useCollectionDataSource,useWorkflowAnyExecuted:it});w(this,"components",{FieldsSelect:To});w(this,"useVariables",jn)}useInitializers(t){return t.collection?{name:"triggerData",type:"item",key:"triggerData",title:`{{t("Trigger data", { ns: "${p}" })}}`,Component:Be,collection:t.collection,dataPath:"$context.data"}:null}}const Ce={STATIC:0,DATE_FIELD:1};function Ln(e){return!e.hidden&&(e.uiSchema?e.type==="date":!1)}function at({value:e,onChange:o}){const t=e!=null?e:{},{t:r}=Q.useTranslation(),[s,a]=b.useState(t.offset?t.offset/Math.abs(t.offset):0);return n.jsxs("fieldset",{className:l.css`
|
|
460
460
|
display: flex;
|
|
461
461
|
gap: 0.5em;
|
|
462
462
|
`,children:[n.jsx(To,{value:t.field,onChange:i=>o(A(C({},t),{field:i})),filter:Ln,placeholder:r("Select field"),className:"auto-width"}),t.field?n.jsx(y.Select,{value:s,onChange:i=>{a(i),o(A(C({},t),{offset:Math.abs(t.offset)*i}))},options:[{value:0,label:T("Exactly at")},{value:-1,label:r("Before")},{value:1,label:r("After")}],className:"auto-width"}):null,s?n.jsxs(n.Fragment,{children:[n.jsx(y.InputNumber,{value:Math.abs(t.offset),onChange:i=>o(A(C({},t),{offset:(i!=null?i:0)*s}))}),n.jsx(y.Select,{value:t.unit||864e5,onChange:i=>o(A(C({},t),{unit:i})),options:[{value:864e5,label:T("Days")},{value:36e5,label:T("Hours")},{value:6e4,label:T("Minutes")},{value:1e3,label:T("Seconds")}],className:"auto-width"})]}):null]})}function zn({value:e,onChange:o}){const{t}=go(),r=e!=null?typeof e=="object"&&!(e instanceof Date)?"field":"date":null;return n.jsxs("fieldset",{className:l.css`
|
|
463
463
|
display: flex;
|
|
464
464
|
gap: 0.5em;
|
|
465
|
-
`,children:[n.jsxs(y.Select,{value:r,onChange:s=>{o(s?s==="field"?{}:new Date:null)},className:"auto-width",children:[n.jsx(y.Select.Option,{value:null,children:t("No end")}),n.jsx(y.Select.Option,{value:"field",children:t("By field")}),n.jsx(y.Select.Option,{value:"date",children:t("By custom date")})]}),r==="field"?n.jsx(at,{value:e,onChange:o}):null,r==="date"?n.jsx(y.DatePicker,{showTime:!0,value:Yt(e),onChange:s=>{o(s?s.toDate():null)}}):null]})}var re=function(){return re=Object.assign||function(e){for(var o,t=1,r=arguments.length;t<r;t++)for(var s in o=arguments[t])Object.prototype.hasOwnProperty.call(o,s)&&(e[s]=o[s]);return e},re.apply(this,arguments)};function ct(e,o){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&o.indexOf(r)<0&&(t[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function"){var s=0;for(r=Object.getOwnPropertySymbols(e);s<r.length;s++)o.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(t[r[s]]=e[r[s]])}return t}function Xe(e,o,t){if(t||arguments.length===2)for(var r,s=0,a=o.length;s<a;s++)!r&&s in o||(r||(r=Array.prototype.slice.call(o,0,s)),r[s]=o[s]);return e.concat(r||Array.prototype.slice.call(o))}var Jn=[{name:"@yearly",value:"0 0 1 1 *"},{name:"@annually",value:"0 0 1 1 *"},{name:"@monthly",value:"0 0 1 * *"},{name:"@weekly",value:"0 0 * * 0"},{name:"@daily",value:"0 0 * * *"},{name:"@midnight",value:"0 0 * * *"},{name:"@hourly",value:"0 * * * *"}],Ce=[{type:"minutes",min:0,max:59,total:60},{type:"hours",min:0,max:23,total:24},{type:"month-days",min:1,max:31,total:31},{type:"months",min:1,max:12,total:12,alt:["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"]},{type:"week-days",min:0,max:6,total:7,alt:["SUN","MON","TUE","WED","THU","FRI","SAT"]}],V={everyText:"every",emptyMonths:"every month",emptyMonthDays:"every day of the month",emptyMonthDaysShort:"day of the month",emptyWeekDays:"every day of the week",emptyWeekDaysShort:"day of the week",emptyHours:"every hour",emptyMinutes:"every minute",emptyMinutesForHourPeriod:"every",yearOption:"year",monthOption:"month",weekOption:"week",dayOption:"day",hourOption:"hour",minuteOption:"minute",rebootOption:"reboot",prefixPeriod:"Every",prefixMonths:"in",prefixMonthDays:"on",prefixWeekDays:"on",prefixWeekDaysForMonthAndYearPeriod:"and",prefixHours:"at",prefixMinutes:":",prefixMinutesForHourPeriod:"at",suffixMinutesForHourPeriod:"minute(s)",errorInvalidCron:"Invalid cron expression",clearButtonText:"Clear",weekDays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],altWeekDays:["SUN","MON","TUE","WED","THU","FRI","SAT"],altMonths:["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"]};function dt(e,o){for(var t=[],r=e;r<=o;r++)t.push(r);return t}function Re(e){return e.sort(function(o,t){return o-t}),e}function ut(e){var o=[];return e.forEach(function(t){o.indexOf(t)<0&&o.push(t)}),o}function ce(e){return Object.entries(e).filter(function(o){var t=o[0],r=o[1];return t&&r}).map(function(o){return o[0]}).join(" ")}function pt(e,o){e&&e({type:"invalid_cron",description:o.errorInvalidCron||V.errorInvalidCron})}function eo(e){var o=parseInt(e,10),t=Number(e);return o===t?t:NaN}function mt(e,o,t,r,s,a,i,c,u,d,f,h,x,g){t&&t(void 0),o(!1);var m=!1;if(!e){if(r==="always"||a&&r==="for-default-value")return;m=!0}if(!m){if(c&&(c===!0||c.includes(e))){if(e==="@reboot")return void g("reboot");var k=Jn.find(function(S){return S.name===e});k&&(e=k.value)}try{var O=function(S){if(typeof S!="string")throw new Error("Invalid cron string");var E=S.replace(/\s+/g," ").trim().split(" ");if(E.length===5)return E.map(function(W,$){return function(M,N){if(M==="*"||M==="*/1")return[];var F=Re(ut(gt(function(H,K,ue){if(ue){H=H.toUpperCase();for(var P=0;P<ue.length;P++)H=H.replace(ue[P],"".concat(P+K))}return H}(M,N.min,N.alt).split(",").map(function(H){var K,ue=H.split("/");if(ue.length>2)throw new Error('Invalid value "'.concat(M,' for "').concat(N.type,'"'));var P=ue[0],j=ue[1];K=P==="*"?dt(N.min,N.max):function(q,Y,R){var ee=q.split("-");if(ee.length===1){var Le=eo(ee[0]);if(isNaN(Le))throw new Error('Invalid value "'.concat(Y,'" for ').concat(R.type));return[Le]}if(ee.length===2){var he=eo(ee[0]),Ee=eo(ee[1]);if(isNaN(he)||isNaN(Ee))throw new Error('Invalid value "'.concat(Y,'" for ').concat(R.type));if(Ee<he)throw new Error('Max range is less than min range in "'.concat(q,'" for ').concat(R.type));return dt(he,Ee)}throw new Error('Invalid value "'.concat(q,'" for ').concat(R.type))}(P,M,N);var z=function(q,Y){if(q!==void 0){var R=eo(q);if(isNaN(R)||R<1)throw new Error('Invalid interval step value "'.concat(q,'" for ').concat(Y.type));return R}}(j,N),se=function(q,Y){if(Y){var R=q[0];q=q.filter(function(ee){return ee%Y==R%Y||ee===R})}return q}(K,z);return se}).flat(),N))),D=bt(F,N);if(D!==void 0)throw new Error('Value "'.concat(D,'" out of range for ').concat(N.type));return F.length===N.total?[]:F}(W,Ce[$])});throw new Error("Invalid cron string format")}(e),B=function(S){return S[3].length>0?"year":S[2].length>0?"month":S[4].length>0?"week":S[1].length>0?"day":S[0].length>0?"hour":"minute"}(O);g(B),u(O[0]),d(O[1]),f(O[2]),h(O[3]),x(O[4])}catch(S){m=!0}}m&&(s.current=e,o(!0),pt(t,i))}function ft(e,o,t,r,s,a,i){if(e==="reboot")return"@reboot";var c=function(u,d){return u.map(function(f,h){var x=Ce[h];return ht(yt(f,x),x,d)})}([e!=="minute"&&a?a:[],e!=="minute"&&e!=="hour"&&s?s:[],e!=="year"&&e!=="month"||!t?[]:t,e==="year"&&o?o:[],e!=="year"&&e!=="month"&&e!=="week"||!r?[]:r],i);return c.join(" ")}function ht(e,o,t,r,s){var a="";if(function(c,u){return c.length===u.max-u.min+1}(e,o)||e.length===0)a="*";else{var i=function(c){if(c.length>2){var u=c[1]-c[0];if(u>1)return u}}(e);a=i&&function(c,u){for(var d=1;d<c.length;d++){var f=c[d-1];if(c[d]-f!==u)return!1}return!0}(e,i)?function(c,u,d){var f=vt(c),h=xt(c),x=c.length===(h-f)/d+1;return!!(f===u.min&&h+d>u.max&&x)}(e,o,i)?"*/".concat(i):"".concat(Oe(vt(e),o,t,r,s),"-").concat(Oe(xt(e),o,t,r,s),"/").concat(i):function(c){var u=[],d=null;return c.forEach(function(f,h,x){f!==x[h+1]-1?d!==null?(u.push([d,f]),d=null):u.push(f):d===null&&(d=f)}),u}(e).map(function(c){return Array.isArray(c)?"".concat(Oe(c[0],o,t,r,s),"-").concat(Oe(c[1],o,t,r,s)):Oe(c,o,t,r,s)}).join(",")}return a}function Oe(e,o,t,r,s){var a=e.toString(),i=o.type,c=o.alt,u=o.min,d=r&&(r===!0||r.includes(i)),f=s==="24-hour-clock"&&(i==="hours"||i==="minutes");if(t&&i==="week-days"||t&&i==="months"?a=c[e-u]:e<10&&(d||f)&&(a=a.padStart(2,"0")),i==="hours"&&s==="12-hour-clock"){var h=e>=12?"PM":"AM",x=e%12||12;x<10&&d&&(x=x.toString().padStart(2,"0")),a="".concat(x).concat(h)}return a}function yt(e,o){var t=Re(ut(gt(e,o)));if(t.length===0)return t;var r=bt(t,o);if(r!==void 0)throw new Error('Value "'.concat(r,'" out of range for ').concat(o.type));return t}function gt(e,o){return o.type==="week-days"&&(e=e.map(function(t){return t===7?0:t})),e}function bt(e,o){var t=e[0],r=e[e.length-1];return t<o.min?t:r>o.max?r:void 0}function vt(e){return e[0]}function xt(e){return e[e.length-1]}function We(e){var o=e.value,t=e.grid,r=t===void 0||t,s=e.optionsList,a=e.setValue,i=e.locale,c=e.className,u=e.humanizeLabels,d=e.disabled,f=e.readOnly,h=e.leadingZero,x=e.clockFormat,g=e.period,m=e.unit,k=e.periodicityOnDoubleClick,O=e.mode,B=ct(e,["value","grid","optionsList","setValue","locale","className","humanizeLabels","disabled","readOnly","leadingZero","clockFormat","period","unit","periodicityOnDoubleClick","mode"]),S=b.useMemo(function(){if(o&&Array.isArray(o))return o.map(function(P){return P.toString()})},[o]),E=b.useMemo(function(){return s?s.map(function(P,j){return{value:(m.min===0?j:j+1).toString(),label:P}}):Xe([],Array(m.total),!0).map(function(P,j){var z=m.min===0?j:j+1;return{value:z.toString(),label:Oe(z,m,u,h,x)}})},[s,h,u,x]),W=JSON.stringify(i),$=b.useCallback(function(P){var j=P.value;if(!o||o[0]!==Number(j))return n.jsx(n.Fragment,{});var z=ht(yt(o,m),m,u,h,x),se=z.match(/^\*\/([0-9]+),?/)||[];return n.jsx("div",{children:se[1]?"".concat(i.everyText||V.everyText," ").concat(se[1]):z})},[o,W,u,h,x]),M=b.useCallback(function(P){var j=Array.isArray(P)?Re(P):[P],z=j;o&&(z=O==="single"?[]:Xe([],o,!0),j.forEach(function(se){var q=Number(se);z=o.some(function(Y){return Y===q})?z.filter(function(Y){return Y!==q}):Re(Xe(Xe([],z,!0),[q],!1))})),z.length===m.total?a([]):a(z)},[a,o]),N=b.useCallback(function(P){if(P!==0&&P!==1){for(var j=m.total+m.min,z=[],se=m.min;se<j;se++)se%P==0&&z.push(se);var q=o&&z&&o.length===z.length&&o.every(function(R,ee){return R===z[ee]}),Y=z.length===E.length;a(Y||q?[]:z)}else a([])},[o,E,a]),F=b.useRef([]),D=b.useCallback(function(P){if(!f){var j=F.current;j.push({time:new Date().getTime(),value:Number(P)});var z=window.setTimeout(function(){k&&j.length>1&&j[j.length-1].time-j[j.length-2].time<300?j[j.length-1].value===j[j.length-2].value?N(Number(P)):M([j[j.length-2].value,j[j.length-1].value]):M(Number(P)),F.current=[]},300);return function(){window.clearTimeout(z)}}},[F,M,N,f,k]),H=b.useCallback(function(){f||a([])},[a,f]),K=b.useMemo(function(){var P;return ce(((P={"react-js-cron-select":!0,"react-js-cron-custom-select":!0})["".concat(c,"-select")]=!!c,P))},[c]),ue=b.useMemo(function(){var P;return ce(((P={"react-js-cron-select-dropdown":!0})["react-js-cron-select-dropdown-".concat(m.type)]=!0,P["react-js-cron-custom-select-dropdown"]=!0,P["react-js-cron-custom-select-dropdown-".concat(m.type)]=!0,P["react-js-cron-custom-select-dropdown-minutes-large"]=m.type==="minutes"&&g!=="hour"&&g!=="day",P["react-js-cron-custom-select-dropdown-minutes-medium"]=m.type==="minutes"&&(g==="day"||g==="hour"),P["react-js-cron-custom-select-dropdown-hours-twelve-hour-clock"]=m.type==="hours"&&x==="12-hour-clock",P["react-js-cron-custom-select-dropdown-grid"]=!!r,P["".concat(c,"-select-dropdown")]=!!c,P["".concat(c,"-select-dropdown-").concat(m.type)]=!!c,P))},[c,r,x,g]);return n.jsx(y.Select,re({mode:O!=="single"||k?"multiple":void 0,allowClear:!f,virtual:!1,open:!f&&void 0,value:S,onClear:H,tagRender:$,className:K,popupClassName:ue,options:E,showSearch:!1,showArrow:!f,menuItemSelectedIcon:null,dropdownMatchSelectWidth:!1,onSelect:D,onDeselect:D,disabled:d,dropdownAlign:m.type!=="minutes"&&m.type!=="hours"||g==="day"||g==="hour"?void 0:{points:["tr","br"]},"data-testid":"custom-select-".concat(m.type)},B))}function Un(e){var o=e.value,t=e.setValue,r=e.locale,s=e.className,a=e.disabled,i=e.readOnly,c=e.leadingZero,u=e.clockFormat,d=e.period,f=e.periodicityOnDoubleClick,h=e.mode,x=b.useMemo(function(){var g;return ce(((g={"react-js-cron-field":!0,"react-js-cron-hours":!0})["".concat(s,"-field")]=!!s,g["".concat(s,"-hours")]=!!s,g))},[s]);return n.jsxs("div",re({className:x},{children:[r.prefixHours!==""&&n.jsx("span",{children:r.prefixHours||V.prefixHours}),n.jsx(We,{placeholder:r.emptyHours||V.emptyHours,value:o,unit:Ce[1],setValue:t,locale:r,className:s,disabled:a,readOnly:i,leadingZero:c,clockFormat:u,period:d,periodicityOnDoubleClick:f,mode:h})]}))}function Hn(e){var o=e.value,t=e.setValue,r=e.locale,s=e.className,a=e.disabled,i=e.readOnly,c=e.leadingZero,u=e.clockFormat,d=e.period,f=e.periodicityOnDoubleClick,h=e.mode,x=b.useMemo(function(){var g;return ce(((g={"react-js-cron-field":!0,"react-js-cron-minutes":!0})["".concat(s,"-field")]=!!s,g["".concat(s,"-minutes")]=!!s,g))},[s]);return n.jsxs("div",re({className:x},{children:[d==="hour"?r.prefixMinutesForHourPeriod!==""&&n.jsx("span",{children:r.prefixMinutesForHourPeriod||V.prefixMinutesForHourPeriod}):r.prefixMinutes!==""&&n.jsx("span",{children:r.prefixMinutes||V.prefixMinutes}),n.jsx(We,{placeholder:d==="hour"?r.emptyMinutesForHourPeriod||V.emptyMinutesForHourPeriod:r.emptyMinutes||V.emptyMinutes,value:o,unit:Ce[0],setValue:t,locale:r,className:s,disabled:a,readOnly:i,leadingZero:c,clockFormat:u,period:d,periodicityOnDoubleClick:f,mode:h}),d==="hour"&&r.suffixMinutesForHourPeriod!==""&&n.jsx("span",{children:r.suffixMinutesForHourPeriod||V.suffixMinutesForHourPeriod})]}))}function Gn(e){var o=e.value,t=e.setValue,r=e.locale,s=e.className,a=e.weekDays,i=e.disabled,c=e.readOnly,u=e.leadingZero,d=e.period,f=e.periodicityOnDoubleClick,h=e.mode,x=!a||a.length===0,g=b.useMemo(function(){var O;return ce(((O={"react-js-cron-field":!0,"react-js-cron-month-days":!0,"react-js-cron-month-days-placeholder":!x})["".concat(s,"-field")]=!!s,O["".concat(s,"-month-days")]=!!s,O))},[s,x]),m=JSON.stringify(r),k=b.useMemo(function(){return x?r.emptyMonthDays||V.emptyMonthDays:r.emptyMonthDaysShort||V.emptyMonthDaysShort},[x,m]);return!c||o&&o.length>0||(!o||o.length===0)&&(!a||a.length===0)?n.jsxs("div",re({className:g},{children:[r.prefixMonthDays!==""&&n.jsx("span",{children:r.prefixMonthDays||V.prefixMonthDays}),n.jsx(We,{placeholder:k,value:o,setValue:t,unit:Ce[2],locale:r,className:s,disabled:i,readOnly:c,leadingZero:u,period:d,periodicityOnDoubleClick:f,mode:h})]})):null}function qn(e){var o=e.value,t=e.setValue,r=e.locale,s=e.className,a=e.humanizeLabels,i=e.disabled,c=e.readOnly,u=e.period,d=e.periodicityOnDoubleClick,f=e.mode,h=r.months||V.months,x=b.useMemo(function(){var g;return ce(((g={"react-js-cron-field":!0,"react-js-cron-months":!0})["".concat(s,"-field")]=!!s,g["".concat(s,"-months")]=!!s,g))},[s]);return n.jsxs("div",re({className:x},{children:[r.prefixMonths!==""&&n.jsx("span",{children:r.prefixMonths||V.prefixMonths}),n.jsx(We,{placeholder:r.emptyMonths||V.emptyMonths,optionsList:h,grid:!1,value:o,unit:re(re({},Ce[3]),{alt:r.altMonths||V.altMonths}),setValue:t,locale:r,className:s,humanizeLabels:a,disabled:i,readOnly:c,period:u,periodicityOnDoubleClick:d,mode:f})]}))}function Kn(e){var o=e.value,t=e.setValue,r=e.locale,s=e.className,a=e.disabled,i=e.readOnly,c=e.shortcuts,u=e.allowedPeriods,d=[];u.includes("year")&&d.push({value:"year",label:r.yearOption||V.yearOption}),u.includes("month")&&d.push({value:"month",label:r.monthOption||V.monthOption}),u.includes("week")&&d.push({value:"week",label:r.weekOption||V.weekOption}),u.includes("day")&&d.push({value:"day",label:r.dayOption||V.dayOption}),u.includes("hour")&&d.push({value:"hour",label:r.hourOption||V.hourOption}),u.includes("minute")&&d.push({value:"minute",label:r.minuteOption||V.minuteOption}),u.includes("reboot")&&c&&(c===!0||c.includes("@reboot"))&&d.push({value:"reboot",label:r.rebootOption||V.rebootOption});var f=b.useCallback(function(m){i||t(m)},[t,i]),h=b.useMemo(function(){var m;return ce(((m={"react-js-cron-field":!0,"react-js-cron-period":!0})["".concat(s,"-field")]=!!s,m["".concat(s,"-period")]=!!s,m))},[s]),x=b.useMemo(function(){var m;return ce(((m={"react-js-cron-select":!0,"react-js-cron-select-no-prefix":r.prefixPeriod===""})["".concat(s,"-select")]=!!s,m))},[s,r.prefixPeriod]),g=b.useMemo(function(){var m;return ce(((m={"react-js-cron-select-dropdown":!0,"react-js-cron-select-dropdown-period":!0})["".concat(s,"-select-dropdown")]=!!s,m["".concat(s,"-select-dropdown-period")]=!!s,m))},[s]);return n.jsxs("div",re({className:h},{children:[r.prefixPeriod!==""&&n.jsx("span",{children:r.prefixPeriod||V.prefixPeriod}),n.jsx(y.Select,{defaultValue:o,value:o,onChange:f,options:d,className:x,popupClassName:g,disabled:a,showArrow:!i,open:!i&&void 0,"data-testid":"select-period"},JSON.stringify(r))]}))}function Yn(e){var o=e.value,t=e.setValue,r=e.locale,s=e.className,a=e.humanizeLabels,i=e.monthDays,c=e.disabled,u=e.readOnly,d=e.period,f=e.periodicityOnDoubleClick,h=e.mode,x=r.weekDays||V.weekDays,g=d==="week"||!i||i.length===0,m=b.useMemo(function(){var E;return ce(((E={"react-js-cron-field":!0,"react-js-cron-week-days":!0,"react-js-cron-week-days-placeholder":!g})["".concat(s,"-field")]=!!s,E["".concat(s,"-week-days")]=!!s,E))},[s,g]),k=JSON.stringify(r),O=b.useMemo(function(){return g?r.emptyWeekDays||V.emptyWeekDays:r.emptyWeekDaysShort||V.emptyWeekDaysShort},[g,k]),B=d==="week"||!u||o&&o.length>0||(!o||o.length===0)&&(!i||i.length===0),S=!u||i&&i.length>0||(!i||i.length===0)&&(!o||o.length===0);return B?n.jsxs("div",re({className:m},{children:[r.prefixWeekDays!==""&&(d==="week"||!S)&&n.jsx("span",{children:r.prefixWeekDays||V.prefixWeekDays}),r.prefixWeekDaysForMonthAndYearPeriod!==""&&d!=="week"&&S&&n.jsx("span",{children:r.prefixWeekDaysForMonthAndYearPeriod||V.prefixWeekDaysForMonthAndYearPeriod}),n.jsx(We,{placeholder:O,optionsList:x,grid:!1,value:o,unit:re(re({},Ce[4]),{alt:r.altWeekDays||V.altWeekDays}),setValue:t,locale:r,className:s,humanizeLabels:a,disabled:c,readOnly:u,period:d,periodicityOnDoubleClick:f,mode:h})]})):null}function _n(e){var o=e.clearButton,t=o===void 0||o,r=e.clearButtonProps,s=r===void 0?{}:r,a=e.clearButtonAction,i=a===void 0?"fill-with-every":a,c=e.locale,u=c===void 0?V:c,d=e.value,f=d===void 0?"":d,h=e.setValue,x=e.displayError,g=x===void 0||x,m=e.onError,k=e.className,O=e.defaultPeriod,B=O===void 0?"day":O,S=e.allowEmpty,E=S===void 0?"for-default-value":S,W=e.humanizeLabels,$=W===void 0||W,M=e.humanizeValue,N=M!==void 0&&M,F=e.disabled,D=F!==void 0&&F,H=e.readOnly,K=H!==void 0&&H,ue=e.leadingZero,P=ue!==void 0&&ue,j=e.shortcuts,z=j===void 0?["@yearly","@annually","@monthly","@weekly","@daily","@midnight","@hourly"]:j,se=e.clockFormat,q=e.periodicityOnDoubleClick,Y=q===void 0||q,R=e.mode,ee=R===void 0?"multiple":R,Le=e.allowedDropdowns,he=Le===void 0?["period","months","month-days","week-days","hours","minutes"]:Le,Ee=e.allowedPeriods,Ar=Ee===void 0?["year","month","week","day","hour","minute","reboot"]:Ee,$e=b.useRef(f),Po=b.useRef(B),$t=b.useState(),be=$t[0],to=$t[1],Dt=b.useState(),ze=Dt[0],no=Dt[1],It=b.useState(),ro=It[0],so=It[1],Pt=b.useState(),Je=Pt[0],lo=Pt[1],Mt=b.useState(),io=Mt[0],ao=Mt[1],Bt=b.useState(),co=Bt[0],uo=Bt[1],Vt=b.useState(!1),Mo=Vt[0],Ue=Vt[1],jt=b.useState(!1),po=jt[0],Wt=jt[1],Fr=function(_){var ye=b.useRef(_);return b.useEffect(function(){ye.current=_},[_]),ye.current}(po),Lt=JSON.stringify(u);b.useEffect(function(){mt(f,Ue,m,E,$e,!0,u,z,uo,ao,no,so,lo,to)},[]),b.useEffect(function(){f!==$e.current&&mt(f,Ue,m,E,$e,!1,u,z,uo,ao,no,so,lo,to)},[f,$e,Lt,E,z]),b.useEffect(function(){if(!(be||co||ro||ze||Je||io)||po||Fr)po&&Wt(!1);else{var _=be||Po.current,ye=ft(_,ro,ze,Je,io,co,N);h(ye,{selectedPeriod:_}),$e.current=ye,m&&m(void 0),Ue(!1)}},[be,ze,ro,Je,io,co,N,po]);var zt=b.useCallback(function(){no(void 0),so(void 0),lo(void 0),ao(void 0),uo(void 0);var _="",ye=be!=="reboot"&&be?be:Po.current;ye!==be&&to(ye),i==="fill-with-every"&&(_=ft(ye,void 0,void 0,void 0,void 0,void 0)),h(_,{selectedPeriod:ye}),$e.current=_,Wt(!0),E==="never"&&i==="empty"?(Ue(!0),pt(m,u)):(m&&m(void 0),Ue(!1))},[be,h,m,i]),Or=b.useMemo(function(){var _;return ce(((_={"react-js-cron":!0,"react-js-cron-error":Mo&&g,"react-js-cron-disabled":D,"react-js-cron-read-only":K})["".concat(k)]=!!k,_["".concat(k,"-error")]=Mo&&g&&!!k,_["".concat(k,"-disabled")]=D&&!!k,_["".concat(k,"-read-only")]=K&&!!k,_))},[k,Mo,g,D,K]),Bo=s.className,Jt=ct(s,["className"]),Ut=b.useMemo(function(){var _;return ce(((_={"react-js-cron-clear-button":!0})["".concat(k,"-clear-button")]=!!k,_["".concat(Bo)]=!!Bo,_))},[k,Bo]),Tr=JSON.stringify(Jt),Ht=b.useMemo(function(){return t&&!K?n.jsx(y.Button,re({className:Ut,danger:!0,type:"primary",disabled:D},Jt,{onClick:zt},{children:u.clearButtonText||V.clearButtonText})):null},[t,K,Lt,Ut,D,Tr,zt]),oe=be||Po.current;return n.jsxs("div",re({className:Or},{children:[he.includes("period")&&n.jsx(Kn,{value:oe,setValue:to,locale:u,className:k,disabled:D,readOnly:K,shortcuts:z,allowedPeriods:Ar}),oe==="reboot"?Ht:n.jsxs(n.Fragment,{children:[oe==="year"&&he.includes("months")&&n.jsx(qn,{value:ro,setValue:so,locale:u,className:k,humanizeLabels:$,disabled:D,readOnly:K,period:oe,periodicityOnDoubleClick:Y,mode:ee}),(oe==="year"||oe==="month")&&he.includes("month-days")&&n.jsx(Gn,{value:ze,setValue:no,locale:u,className:k,weekDays:Je,disabled:D,readOnly:K,leadingZero:P,period:oe,periodicityOnDoubleClick:Y,mode:ee}),(oe==="year"||oe==="month"||oe==="week")&&he.includes("week-days")&&n.jsx(Yn,{value:Je,setValue:lo,locale:u,className:k,humanizeLabels:$,monthDays:ze,disabled:D,readOnly:K,period:oe,periodicityOnDoubleClick:Y,mode:ee}),n.jsxs("div",{children:[oe!=="minute"&&oe!=="hour"&&he.includes("hours")&&n.jsx(Un,{value:io,setValue:ao,locale:u,className:k,disabled:D,readOnly:K,leadingZero:P,clockFormat:se,period:oe,periodicityOnDoubleClick:Y,mode:ee}),oe!=="minute"&&he.includes("minutes")&&n.jsx(Hn,{value:co,setValue:uo,locale:u,period:oe,className:k,disabled:D,readOnly:K,leadingZero:P,clockFormat:se,periodicityOnDoubleClick:Y,mode:ee}),Ht]})]})]}))}const wt=[{value:"none",text:"No repeat"},{value:6e4,text:"By minute",unitText:"Minutes"},{value:36e5,text:"By hour",unitText:"Hours"},{value:864e5,text:"By day",unitText:"Days"},{value:6048e5,text:"By week",unitText:"Weeks"},{value:"cron",text:"Advanced"}];function Ct(e){return wt.filter(t=>typeof t.value=="number").reverse().find(t=>!(e%t.value))}function Zn(e){let o;switch(typeof e){case"number":return o=Ct(e),o?o.value:"none";case"string":return"cron"}return"none"}function Qn({value:e,onChange:o}){const{t}=go(),r=Ct(e);return n.jsx(y.InputNumber,{value:e/r.value,onChange:s=>o(s*r.value),min:1,addonBefore:t("Every"),addonAfter:t(r.unitText),className:"auto-width"})}function Xn({value:e=null,onChange:o}){const{t}=go(),r=Zn(e),s=b.useCallback(a=>{if(a==="none"){o(null);return}if(a==="cron"){o("0 * * * * *");return}o(a)},[o]);return n.jsxs("fieldset",{className:l.css`
|
|
465
|
+
`,children:[n.jsxs(y.Select,{value:r,onChange:s=>{o(s?s==="field"?{}:new Date:null)},className:"auto-width",children:[n.jsx(y.Select.Option,{value:null,children:t("No end")}),n.jsx(y.Select.Option,{value:"field",children:t("By field")}),n.jsx(y.Select.Option,{value:"date",children:t("By custom date")})]}),r==="field"?n.jsx(at,{value:e,onChange:o}):null,r==="date"?n.jsx(y.DatePicker,{showTime:!0,value:Yt(e),onChange:s=>{o(s?s.toDate():null)}}):null]})}var re=function(){return re=Object.assign||function(e){for(var o,t=1,r=arguments.length;t<r;t++)for(var s in o=arguments[t])Object.prototype.hasOwnProperty.call(o,s)&&(e[s]=o[s]);return e},re.apply(this,arguments)};function ct(e,o){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&o.indexOf(r)<0&&(t[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function"){var s=0;for(r=Object.getOwnPropertySymbols(e);s<r.length;s++)o.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(t[r[s]]=e[r[s]])}return t}function Xe(e,o,t){if(t||arguments.length===2)for(var r,s=0,a=o.length;s<a;s++)!r&&s in o||(r||(r=Array.prototype.slice.call(o,0,s)),r[s]=o[s]);return e.concat(r||Array.prototype.slice.call(o))}var Jn=[{name:"@yearly",value:"0 0 1 1 *"},{name:"@annually",value:"0 0 1 1 *"},{name:"@monthly",value:"0 0 1 * *"},{name:"@weekly",value:"0 0 * * 0"},{name:"@daily",value:"0 0 * * *"},{name:"@midnight",value:"0 0 * * *"},{name:"@hourly",value:"0 * * * *"}],ke=[{type:"minutes",min:0,max:59,total:60},{type:"hours",min:0,max:23,total:24},{type:"month-days",min:1,max:31,total:31},{type:"months",min:1,max:12,total:12,alt:["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"]},{type:"week-days",min:0,max:6,total:7,alt:["SUN","MON","TUE","WED","THU","FRI","SAT"]}],V={everyText:"every",emptyMonths:"every month",emptyMonthDays:"every day of the month",emptyMonthDaysShort:"day of the month",emptyWeekDays:"every day of the week",emptyWeekDaysShort:"day of the week",emptyHours:"every hour",emptyMinutes:"every minute",emptyMinutesForHourPeriod:"every",yearOption:"year",monthOption:"month",weekOption:"week",dayOption:"day",hourOption:"hour",minuteOption:"minute",rebootOption:"reboot",prefixPeriod:"Every",prefixMonths:"in",prefixMonthDays:"on",prefixWeekDays:"on",prefixWeekDaysForMonthAndYearPeriod:"and",prefixHours:"at",prefixMinutes:":",prefixMinutesForHourPeriod:"at",suffixMinutesForHourPeriod:"minute(s)",errorInvalidCron:"Invalid cron expression",clearButtonText:"Clear",weekDays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],altWeekDays:["SUN","MON","TUE","WED","THU","FRI","SAT"],altMonths:["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"]};function dt(e,o){for(var t=[],r=e;r<=o;r++)t.push(r);return t}function Re(e){return e.sort(function(o,t){return o-t}),e}function ut(e){var o=[];return e.forEach(function(t){o.indexOf(t)<0&&o.push(t)}),o}function ce(e){return Object.entries(e).filter(function(o){var t=o[0],r=o[1];return t&&r}).map(function(o){return o[0]}).join(" ")}function pt(e,o){e&&e({type:"invalid_cron",description:o.errorInvalidCron||V.errorInvalidCron})}function eo(e){var o=parseInt(e,10),t=Number(e);return o===t?t:NaN}function mt(e,o,t,r,s,a,i,c,u,d,f,h,x,g){t&&t(void 0),o(!1);var m=!1;if(!e){if(r==="always"||a&&r==="for-default-value")return;m=!0}if(!m){if(c&&(c===!0||c.includes(e))){if(e==="@reboot")return void g("reboot");var k=Jn.find(function(S){return S.name===e});k&&(e=k.value)}try{var O=function(S){if(typeof S!="string")throw new Error("Invalid cron string");var E=S.replace(/\s+/g," ").trim().split(" ");if(E.length===5)return E.map(function(W,$){return function(M,N){if(M==="*"||M==="*/1")return[];var F=Re(ut(gt(function(H,K,ue){if(ue){H=H.toUpperCase();for(var P=0;P<ue.length;P++)H=H.replace(ue[P],"".concat(P+K))}return H}(M,N.min,N.alt).split(",").map(function(H){var K,ue=H.split("/");if(ue.length>2)throw new Error('Invalid value "'.concat(M,' for "').concat(N.type,'"'));var P=ue[0],j=ue[1];K=P==="*"?dt(N.min,N.max):function(q,Y,R){var ee=q.split("-");if(ee.length===1){var Le=eo(ee[0]);if(isNaN(Le))throw new Error('Invalid value "'.concat(Y,'" for ').concat(R.type));return[Le]}if(ee.length===2){var he=eo(ee[0]),Ee=eo(ee[1]);if(isNaN(he)||isNaN(Ee))throw new Error('Invalid value "'.concat(Y,'" for ').concat(R.type));if(Ee<he)throw new Error('Max range is less than min range in "'.concat(q,'" for ').concat(R.type));return dt(he,Ee)}throw new Error('Invalid value "'.concat(q,'" for ').concat(R.type))}(P,M,N);var z=function(q,Y){if(q!==void 0){var R=eo(q);if(isNaN(R)||R<1)throw new Error('Invalid interval step value "'.concat(q,'" for ').concat(Y.type));return R}}(j,N),se=function(q,Y){if(Y){var R=q[0];q=q.filter(function(ee){return ee%Y==R%Y||ee===R})}return q}(K,z);return se}).flat(),N))),D=bt(F,N);if(D!==void 0)throw new Error('Value "'.concat(D,'" out of range for ').concat(N.type));return F.length===N.total?[]:F}(W,ke[$])});throw new Error("Invalid cron string format")}(e),B=function(S){return S[3].length>0?"year":S[2].length>0?"month":S[4].length>0?"week":S[1].length>0?"day":S[0].length>0?"hour":"minute"}(O);g(B),u(O[0]),d(O[1]),f(O[2]),h(O[3]),x(O[4])}catch(S){m=!0}}m&&(s.current=e,o(!0),pt(t,i))}function ft(e,o,t,r,s,a,i){if(e==="reboot")return"@reboot";var c=function(u,d){return u.map(function(f,h){var x=ke[h];return ht(yt(f,x),x,d)})}([e!=="minute"&&a?a:[],e!=="minute"&&e!=="hour"&&s?s:[],e!=="year"&&e!=="month"||!t?[]:t,e==="year"&&o?o:[],e!=="year"&&e!=="month"&&e!=="week"||!r?[]:r],i);return c.join(" ")}function ht(e,o,t,r,s){var a="";if(function(c,u){return c.length===u.max-u.min+1}(e,o)||e.length===0)a="*";else{var i=function(c){if(c.length>2){var u=c[1]-c[0];if(u>1)return u}}(e);a=i&&function(c,u){for(var d=1;d<c.length;d++){var f=c[d-1];if(c[d]-f!==u)return!1}return!0}(e,i)?function(c,u,d){var f=vt(c),h=xt(c),x=c.length===(h-f)/d+1;return!!(f===u.min&&h+d>u.max&&x)}(e,o,i)?"*/".concat(i):"".concat(Oe(vt(e),o,t,r,s),"-").concat(Oe(xt(e),o,t,r,s),"/").concat(i):function(c){var u=[],d=null;return c.forEach(function(f,h,x){f!==x[h+1]-1?d!==null?(u.push([d,f]),d=null):u.push(f):d===null&&(d=f)}),u}(e).map(function(c){return Array.isArray(c)?"".concat(Oe(c[0],o,t,r,s),"-").concat(Oe(c[1],o,t,r,s)):Oe(c,o,t,r,s)}).join(",")}return a}function Oe(e,o,t,r,s){var a=e.toString(),i=o.type,c=o.alt,u=o.min,d=r&&(r===!0||r.includes(i)),f=s==="24-hour-clock"&&(i==="hours"||i==="minutes");if(t&&i==="week-days"||t&&i==="months"?a=c[e-u]:e<10&&(d||f)&&(a=a.padStart(2,"0")),i==="hours"&&s==="12-hour-clock"){var h=e>=12?"PM":"AM",x=e%12||12;x<10&&d&&(x=x.toString().padStart(2,"0")),a="".concat(x).concat(h)}return a}function yt(e,o){var t=Re(ut(gt(e,o)));if(t.length===0)return t;var r=bt(t,o);if(r!==void 0)throw new Error('Value "'.concat(r,'" out of range for ').concat(o.type));return t}function gt(e,o){return o.type==="week-days"&&(e=e.map(function(t){return t===7?0:t})),e}function bt(e,o){var t=e[0],r=e[e.length-1];return t<o.min?t:r>o.max?r:void 0}function vt(e){return e[0]}function xt(e){return e[e.length-1]}function We(e){var o=e.value,t=e.grid,r=t===void 0||t,s=e.optionsList,a=e.setValue,i=e.locale,c=e.className,u=e.humanizeLabels,d=e.disabled,f=e.readOnly,h=e.leadingZero,x=e.clockFormat,g=e.period,m=e.unit,k=e.periodicityOnDoubleClick,O=e.mode,B=ct(e,["value","grid","optionsList","setValue","locale","className","humanizeLabels","disabled","readOnly","leadingZero","clockFormat","period","unit","periodicityOnDoubleClick","mode"]),S=b.useMemo(function(){if(o&&Array.isArray(o))return o.map(function(P){return P.toString()})},[o]),E=b.useMemo(function(){return s?s.map(function(P,j){return{value:(m.min===0?j:j+1).toString(),label:P}}):Xe([],Array(m.total),!0).map(function(P,j){var z=m.min===0?j:j+1;return{value:z.toString(),label:Oe(z,m,u,h,x)}})},[s,h,u,x]),W=JSON.stringify(i),$=b.useCallback(function(P){var j=P.value;if(!o||o[0]!==Number(j))return n.jsx(n.Fragment,{});var z=ht(yt(o,m),m,u,h,x),se=z.match(/^\*\/([0-9]+),?/)||[];return n.jsx("div",{children:se[1]?"".concat(i.everyText||V.everyText," ").concat(se[1]):z})},[o,W,u,h,x]),M=b.useCallback(function(P){var j=Array.isArray(P)?Re(P):[P],z=j;o&&(z=O==="single"?[]:Xe([],o,!0),j.forEach(function(se){var q=Number(se);z=o.some(function(Y){return Y===q})?z.filter(function(Y){return Y!==q}):Re(Xe(Xe([],z,!0),[q],!1))})),z.length===m.total?a([]):a(z)},[a,o]),N=b.useCallback(function(P){if(P!==0&&P!==1){for(var j=m.total+m.min,z=[],se=m.min;se<j;se++)se%P==0&&z.push(se);var q=o&&z&&o.length===z.length&&o.every(function(R,ee){return R===z[ee]}),Y=z.length===E.length;a(Y||q?[]:z)}else a([])},[o,E,a]),F=b.useRef([]),D=b.useCallback(function(P){if(!f){var j=F.current;j.push({time:new Date().getTime(),value:Number(P)});var z=window.setTimeout(function(){k&&j.length>1&&j[j.length-1].time-j[j.length-2].time<300?j[j.length-1].value===j[j.length-2].value?N(Number(P)):M([j[j.length-2].value,j[j.length-1].value]):M(Number(P)),F.current=[]},300);return function(){window.clearTimeout(z)}}},[F,M,N,f,k]),H=b.useCallback(function(){f||a([])},[a,f]),K=b.useMemo(function(){var P;return ce(((P={"react-js-cron-select":!0,"react-js-cron-custom-select":!0})["".concat(c,"-select")]=!!c,P))},[c]),ue=b.useMemo(function(){var P;return ce(((P={"react-js-cron-select-dropdown":!0})["react-js-cron-select-dropdown-".concat(m.type)]=!0,P["react-js-cron-custom-select-dropdown"]=!0,P["react-js-cron-custom-select-dropdown-".concat(m.type)]=!0,P["react-js-cron-custom-select-dropdown-minutes-large"]=m.type==="minutes"&&g!=="hour"&&g!=="day",P["react-js-cron-custom-select-dropdown-minutes-medium"]=m.type==="minutes"&&(g==="day"||g==="hour"),P["react-js-cron-custom-select-dropdown-hours-twelve-hour-clock"]=m.type==="hours"&&x==="12-hour-clock",P["react-js-cron-custom-select-dropdown-grid"]=!!r,P["".concat(c,"-select-dropdown")]=!!c,P["".concat(c,"-select-dropdown-").concat(m.type)]=!!c,P))},[c,r,x,g]);return n.jsx(y.Select,re({mode:O!=="single"||k?"multiple":void 0,allowClear:!f,virtual:!1,open:!f&&void 0,value:S,onClear:H,tagRender:$,className:K,popupClassName:ue,options:E,showSearch:!1,showArrow:!f,menuItemSelectedIcon:null,dropdownMatchSelectWidth:!1,onSelect:D,onDeselect:D,disabled:d,dropdownAlign:m.type!=="minutes"&&m.type!=="hours"||g==="day"||g==="hour"?void 0:{points:["tr","br"]},"data-testid":"custom-select-".concat(m.type)},B))}function Un(e){var o=e.value,t=e.setValue,r=e.locale,s=e.className,a=e.disabled,i=e.readOnly,c=e.leadingZero,u=e.clockFormat,d=e.period,f=e.periodicityOnDoubleClick,h=e.mode,x=b.useMemo(function(){var g;return ce(((g={"react-js-cron-field":!0,"react-js-cron-hours":!0})["".concat(s,"-field")]=!!s,g["".concat(s,"-hours")]=!!s,g))},[s]);return n.jsxs("div",re({className:x},{children:[r.prefixHours!==""&&n.jsx("span",{children:r.prefixHours||V.prefixHours}),n.jsx(We,{placeholder:r.emptyHours||V.emptyHours,value:o,unit:ke[1],setValue:t,locale:r,className:s,disabled:a,readOnly:i,leadingZero:c,clockFormat:u,period:d,periodicityOnDoubleClick:f,mode:h})]}))}function Hn(e){var o=e.value,t=e.setValue,r=e.locale,s=e.className,a=e.disabled,i=e.readOnly,c=e.leadingZero,u=e.clockFormat,d=e.period,f=e.periodicityOnDoubleClick,h=e.mode,x=b.useMemo(function(){var g;return ce(((g={"react-js-cron-field":!0,"react-js-cron-minutes":!0})["".concat(s,"-field")]=!!s,g["".concat(s,"-minutes")]=!!s,g))},[s]);return n.jsxs("div",re({className:x},{children:[d==="hour"?r.prefixMinutesForHourPeriod!==""&&n.jsx("span",{children:r.prefixMinutesForHourPeriod||V.prefixMinutesForHourPeriod}):r.prefixMinutes!==""&&n.jsx("span",{children:r.prefixMinutes||V.prefixMinutes}),n.jsx(We,{placeholder:d==="hour"?r.emptyMinutesForHourPeriod||V.emptyMinutesForHourPeriod:r.emptyMinutes||V.emptyMinutes,value:o,unit:ke[0],setValue:t,locale:r,className:s,disabled:a,readOnly:i,leadingZero:c,clockFormat:u,period:d,periodicityOnDoubleClick:f,mode:h}),d==="hour"&&r.suffixMinutesForHourPeriod!==""&&n.jsx("span",{children:r.suffixMinutesForHourPeriod||V.suffixMinutesForHourPeriod})]}))}function Gn(e){var o=e.value,t=e.setValue,r=e.locale,s=e.className,a=e.weekDays,i=e.disabled,c=e.readOnly,u=e.leadingZero,d=e.period,f=e.periodicityOnDoubleClick,h=e.mode,x=!a||a.length===0,g=b.useMemo(function(){var O;return ce(((O={"react-js-cron-field":!0,"react-js-cron-month-days":!0,"react-js-cron-month-days-placeholder":!x})["".concat(s,"-field")]=!!s,O["".concat(s,"-month-days")]=!!s,O))},[s,x]),m=JSON.stringify(r),k=b.useMemo(function(){return x?r.emptyMonthDays||V.emptyMonthDays:r.emptyMonthDaysShort||V.emptyMonthDaysShort},[x,m]);return!c||o&&o.length>0||(!o||o.length===0)&&(!a||a.length===0)?n.jsxs("div",re({className:g},{children:[r.prefixMonthDays!==""&&n.jsx("span",{children:r.prefixMonthDays||V.prefixMonthDays}),n.jsx(We,{placeholder:k,value:o,setValue:t,unit:ke[2],locale:r,className:s,disabled:i,readOnly:c,leadingZero:u,period:d,periodicityOnDoubleClick:f,mode:h})]})):null}function qn(e){var o=e.value,t=e.setValue,r=e.locale,s=e.className,a=e.humanizeLabels,i=e.disabled,c=e.readOnly,u=e.period,d=e.periodicityOnDoubleClick,f=e.mode,h=r.months||V.months,x=b.useMemo(function(){var g;return ce(((g={"react-js-cron-field":!0,"react-js-cron-months":!0})["".concat(s,"-field")]=!!s,g["".concat(s,"-months")]=!!s,g))},[s]);return n.jsxs("div",re({className:x},{children:[r.prefixMonths!==""&&n.jsx("span",{children:r.prefixMonths||V.prefixMonths}),n.jsx(We,{placeholder:r.emptyMonths||V.emptyMonths,optionsList:h,grid:!1,value:o,unit:re(re({},ke[3]),{alt:r.altMonths||V.altMonths}),setValue:t,locale:r,className:s,humanizeLabels:a,disabled:i,readOnly:c,period:u,periodicityOnDoubleClick:d,mode:f})]}))}function Kn(e){var o=e.value,t=e.setValue,r=e.locale,s=e.className,a=e.disabled,i=e.readOnly,c=e.shortcuts,u=e.allowedPeriods,d=[];u.includes("year")&&d.push({value:"year",label:r.yearOption||V.yearOption}),u.includes("month")&&d.push({value:"month",label:r.monthOption||V.monthOption}),u.includes("week")&&d.push({value:"week",label:r.weekOption||V.weekOption}),u.includes("day")&&d.push({value:"day",label:r.dayOption||V.dayOption}),u.includes("hour")&&d.push({value:"hour",label:r.hourOption||V.hourOption}),u.includes("minute")&&d.push({value:"minute",label:r.minuteOption||V.minuteOption}),u.includes("reboot")&&c&&(c===!0||c.includes("@reboot"))&&d.push({value:"reboot",label:r.rebootOption||V.rebootOption});var f=b.useCallback(function(m){i||t(m)},[t,i]),h=b.useMemo(function(){var m;return ce(((m={"react-js-cron-field":!0,"react-js-cron-period":!0})["".concat(s,"-field")]=!!s,m["".concat(s,"-period")]=!!s,m))},[s]),x=b.useMemo(function(){var m;return ce(((m={"react-js-cron-select":!0,"react-js-cron-select-no-prefix":r.prefixPeriod===""})["".concat(s,"-select")]=!!s,m))},[s,r.prefixPeriod]),g=b.useMemo(function(){var m;return ce(((m={"react-js-cron-select-dropdown":!0,"react-js-cron-select-dropdown-period":!0})["".concat(s,"-select-dropdown")]=!!s,m["".concat(s,"-select-dropdown-period")]=!!s,m))},[s]);return n.jsxs("div",re({className:h},{children:[r.prefixPeriod!==""&&n.jsx("span",{children:r.prefixPeriod||V.prefixPeriod}),n.jsx(y.Select,{defaultValue:o,value:o,onChange:f,options:d,className:x,popupClassName:g,disabled:a,showArrow:!i,open:!i&&void 0,"data-testid":"select-period"},JSON.stringify(r))]}))}function Yn(e){var o=e.value,t=e.setValue,r=e.locale,s=e.className,a=e.humanizeLabels,i=e.monthDays,c=e.disabled,u=e.readOnly,d=e.period,f=e.periodicityOnDoubleClick,h=e.mode,x=r.weekDays||V.weekDays,g=d==="week"||!i||i.length===0,m=b.useMemo(function(){var E;return ce(((E={"react-js-cron-field":!0,"react-js-cron-week-days":!0,"react-js-cron-week-days-placeholder":!g})["".concat(s,"-field")]=!!s,E["".concat(s,"-week-days")]=!!s,E))},[s,g]),k=JSON.stringify(r),O=b.useMemo(function(){return g?r.emptyWeekDays||V.emptyWeekDays:r.emptyWeekDaysShort||V.emptyWeekDaysShort},[g,k]),B=d==="week"||!u||o&&o.length>0||(!o||o.length===0)&&(!i||i.length===0),S=!u||i&&i.length>0||(!i||i.length===0)&&(!o||o.length===0);return B?n.jsxs("div",re({className:m},{children:[r.prefixWeekDays!==""&&(d==="week"||!S)&&n.jsx("span",{children:r.prefixWeekDays||V.prefixWeekDays}),r.prefixWeekDaysForMonthAndYearPeriod!==""&&d!=="week"&&S&&n.jsx("span",{children:r.prefixWeekDaysForMonthAndYearPeriod||V.prefixWeekDaysForMonthAndYearPeriod}),n.jsx(We,{placeholder:O,optionsList:x,grid:!1,value:o,unit:re(re({},ke[4]),{alt:r.altWeekDays||V.altWeekDays}),setValue:t,locale:r,className:s,humanizeLabels:a,disabled:c,readOnly:u,period:d,periodicityOnDoubleClick:f,mode:h})]})):null}function _n(e){var o=e.clearButton,t=o===void 0||o,r=e.clearButtonProps,s=r===void 0?{}:r,a=e.clearButtonAction,i=a===void 0?"fill-with-every":a,c=e.locale,u=c===void 0?V:c,d=e.value,f=d===void 0?"":d,h=e.setValue,x=e.displayError,g=x===void 0||x,m=e.onError,k=e.className,O=e.defaultPeriod,B=O===void 0?"day":O,S=e.allowEmpty,E=S===void 0?"for-default-value":S,W=e.humanizeLabels,$=W===void 0||W,M=e.humanizeValue,N=M!==void 0&&M,F=e.disabled,D=F!==void 0&&F,H=e.readOnly,K=H!==void 0&&H,ue=e.leadingZero,P=ue!==void 0&&ue,j=e.shortcuts,z=j===void 0?["@yearly","@annually","@monthly","@weekly","@daily","@midnight","@hourly"]:j,se=e.clockFormat,q=e.periodicityOnDoubleClick,Y=q===void 0||q,R=e.mode,ee=R===void 0?"multiple":R,Le=e.allowedDropdowns,he=Le===void 0?["period","months","month-days","week-days","hours","minutes"]:Le,Ee=e.allowedPeriods,Ar=Ee===void 0?["year","month","week","day","hour","minute","reboot"]:Ee,$e=b.useRef(f),Po=b.useRef(B),$t=b.useState(),be=$t[0],to=$t[1],Dt=b.useState(),ze=Dt[0],no=Dt[1],It=b.useState(),ro=It[0],so=It[1],Pt=b.useState(),Je=Pt[0],lo=Pt[1],Mt=b.useState(),io=Mt[0],ao=Mt[1],Bt=b.useState(),co=Bt[0],uo=Bt[1],Vt=b.useState(!1),Mo=Vt[0],Ue=Vt[1],jt=b.useState(!1),po=jt[0],Wt=jt[1],Fr=function(_){var ye=b.useRef(_);return b.useEffect(function(){ye.current=_},[_]),ye.current}(po),Lt=JSON.stringify(u);b.useEffect(function(){mt(f,Ue,m,E,$e,!0,u,z,uo,ao,no,so,lo,to)},[]),b.useEffect(function(){f!==$e.current&&mt(f,Ue,m,E,$e,!1,u,z,uo,ao,no,so,lo,to)},[f,$e,Lt,E,z]),b.useEffect(function(){if(!(be||co||ro||ze||Je||io)||po||Fr)po&&Wt(!1);else{var _=be||Po.current,ye=ft(_,ro,ze,Je,io,co,N);h(ye,{selectedPeriod:_}),$e.current=ye,m&&m(void 0),Ue(!1)}},[be,ze,ro,Je,io,co,N,po]);var zt=b.useCallback(function(){no(void 0),so(void 0),lo(void 0),ao(void 0),uo(void 0);var _="",ye=be!=="reboot"&&be?be:Po.current;ye!==be&&to(ye),i==="fill-with-every"&&(_=ft(ye,void 0,void 0,void 0,void 0,void 0)),h(_,{selectedPeriod:ye}),$e.current=_,Wt(!0),E==="never"&&i==="empty"?(Ue(!0),pt(m,u)):(m&&m(void 0),Ue(!1))},[be,h,m,i]),Or=b.useMemo(function(){var _;return ce(((_={"react-js-cron":!0,"react-js-cron-error":Mo&&g,"react-js-cron-disabled":D,"react-js-cron-read-only":K})["".concat(k)]=!!k,_["".concat(k,"-error")]=Mo&&g&&!!k,_["".concat(k,"-disabled")]=D&&!!k,_["".concat(k,"-read-only")]=K&&!!k,_))},[k,Mo,g,D,K]),Bo=s.className,Jt=ct(s,["className"]),Ut=b.useMemo(function(){var _;return ce(((_={"react-js-cron-clear-button":!0})["".concat(k,"-clear-button")]=!!k,_["".concat(Bo)]=!!Bo,_))},[k,Bo]),Tr=JSON.stringify(Jt),Ht=b.useMemo(function(){return t&&!K?n.jsx(y.Button,re({className:Ut,danger:!0,type:"primary",disabled:D},Jt,{onClick:zt},{children:u.clearButtonText||V.clearButtonText})):null},[t,K,Lt,Ut,D,Tr,zt]),oe=be||Po.current;return n.jsxs("div",re({className:Or},{children:[he.includes("period")&&n.jsx(Kn,{value:oe,setValue:to,locale:u,className:k,disabled:D,readOnly:K,shortcuts:z,allowedPeriods:Ar}),oe==="reboot"?Ht:n.jsxs(n.Fragment,{children:[oe==="year"&&he.includes("months")&&n.jsx(qn,{value:ro,setValue:so,locale:u,className:k,humanizeLabels:$,disabled:D,readOnly:K,period:oe,periodicityOnDoubleClick:Y,mode:ee}),(oe==="year"||oe==="month")&&he.includes("month-days")&&n.jsx(Gn,{value:ze,setValue:no,locale:u,className:k,weekDays:Je,disabled:D,readOnly:K,leadingZero:P,period:oe,periodicityOnDoubleClick:Y,mode:ee}),(oe==="year"||oe==="month"||oe==="week")&&he.includes("week-days")&&n.jsx(Yn,{value:Je,setValue:lo,locale:u,className:k,humanizeLabels:$,monthDays:ze,disabled:D,readOnly:K,period:oe,periodicityOnDoubleClick:Y,mode:ee}),n.jsxs("div",{children:[oe!=="minute"&&oe!=="hour"&&he.includes("hours")&&n.jsx(Un,{value:io,setValue:ao,locale:u,className:k,disabled:D,readOnly:K,leadingZero:P,clockFormat:se,period:oe,periodicityOnDoubleClick:Y,mode:ee}),oe!=="minute"&&he.includes("minutes")&&n.jsx(Hn,{value:co,setValue:uo,locale:u,period:oe,className:k,disabled:D,readOnly:K,leadingZero:P,clockFormat:se,periodicityOnDoubleClick:Y,mode:ee}),Ht]})]})]}))}const wt=[{value:"none",text:"No repeat"},{value:6e4,text:"By minute",unitText:"Minutes"},{value:36e5,text:"By hour",unitText:"Hours"},{value:864e5,text:"By day",unitText:"Days"},{value:6048e5,text:"By week",unitText:"Weeks"},{value:"cron",text:"Advanced"}];function Ct(e){return wt.filter(t=>typeof t.value=="number").reverse().find(t=>!(e%t.value))}function Zn(e){let o;switch(typeof e){case"number":return o=Ct(e),o?o.value:"none";case"string":return"cron"}return"none"}function Qn({value:e,onChange:o}){const{t}=go(),r=Ct(e);return n.jsx(y.InputNumber,{value:e/r.value,onChange:s=>o(s*r.value),min:1,addonBefore:t("Every"),addonAfter:t(r.unitText),className:"auto-width"})}function Xn({value:e=null,onChange:o}){const{t}=go(),r=Zn(e),s=b.useCallback(a=>{if(a==="none"){o(null);return}if(a==="cron"){o("0 * * * * *");return}o(a)},[o]);return n.jsxs("fieldset",{className:l.css`
|
|
466
466
|
display: flex;
|
|
467
467
|
flex-direction: ${r==="cron"?"column":"row"};
|
|
468
468
|
align-items: flex-start;
|
|
@@ -491,7 +491,7 @@
|
|
|
491
491
|
}
|
|
492
492
|
}
|
|
493
493
|
}
|
|
494
|
-
`,children:[n.jsx(y.Select,{value:r,onChange:s,className:"auto-width",children:wt.map(a=>n.jsx(y.Select.Option,{value:a.value,children:t(a.text)},a.value))}),typeof r=="number"?n.jsx(Qn,{value:e,onChange:o}):null,r==="cron"?n.jsx(_n,{value:e.trim().split(/\s+/).slice(1).join(" "),setValue:a=>o(`0 ${a}`),clearButton:!1,locale:window.cronLocale}):null]})}const Rn={[
|
|
494
|
+
`,children:[n.jsx(y.Select,{value:r,onChange:s,className:"auto-width",children:wt.map(a=>n.jsx(y.Select.Option,{value:a.value,children:t(a.text)},a.value))}),typeof r=="number"?n.jsx(Qn,{value:e,onChange:o}):null,r==="cron"?n.jsx(_n,{value:e.trim().split(/\s+/).slice(1).join(" "),setValue:a=>o(`0 ${a}`),clearButton:!1,locale:window.cronLocale}):null]})}const Rn={[Ce.STATIC]:{startsOn:{type:"datetime",title:`{{t("Starts on", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"DatePicker","x-component-props":{showTime:!0},required:!0},repeat:{type:"string",title:`{{t("Repeat mode", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"RepeatField","x-reactions":[{target:"endsOn",fulfill:{state:{visible:"{{!!$self.value}}"}}},{target:"limit",fulfill:{state:{visible:"{{!!$self.value}}"}}}]},endsOn:{type:"datetime",title:`{{t("Ends on", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"DatePicker","x-component-props":{showTime:!0}},limit:{type:"number",title:`{{t("Repeat limit", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{placeholder:`{{t("No limit", { ns: "${p}" })}}`,min:0}}},[Ce.DATE_FIELD]:{collection:A(C({},ae),{"x-component-props":{dataSourceFilter(e){return e.options.key==="main"||e.options.isDBInstance}},"x-reactions":[...ae["x-reactions"],{target:"startsOn",effects:["onFieldValueChange"],fulfill:{state:{visible:"{{!!$self.value}}",value:"{{Object.create({})}}"}}}]}),startsOn:{type:"object",title:`{{t("Starts on", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"OnField","x-reactions":[{target:"repeat",fulfill:{state:{visible:"{{!!$self.value}}"}}}],required:!0},repeat:{type:"string",title:`{{t("Repeat mode", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"RepeatField","x-reactions":[{target:"endsOn",fulfill:{state:{visible:"{{!!$self.value}}"}}},{target:"limit",fulfill:{state:{visible:"{{!!$self.value}}"}}}]},endsOn:{type:"object",title:`{{t("Ends on", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"EndsByField"},limit:{type:"number",title:`{{t("Repeat limit", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{placeholder:`{{t("No limit", { ns: "${p}" })}}`,min:0}},appends:A(C({},Ve),{"x-reactions":[{dependencies:["mode","collection"],fulfill:{state:{visible:`{{$deps[0] === ${Ce.DATE_FIELD} && $deps[1]}}`}}}]})}},er=[{value:Ce.STATIC,label:`{{t("Based on certain date", { ns: "${p}" })}}`},{value:Ce.DATE_FIELD,label:`{{t("Based on date field of collection", { ns: "${p}" })}}`}],or=()=>{const{values:e={},clearFormGraph:o}=L.useForm(),[t,r]=b.useState(e.mode);return L.useFormEffects(()=>{le.onFieldValueChange("mode",s=>{r(s.value),o("collection"),o("startsOn"),o("repeat"),o("endsOn"),o("limit")})}),n.jsxs(n.Fragment,{children:[n.jsx(l.SchemaComponent,{schema:{type:"number",title:`{{t("Trigger mode", { ns: "${p}" })}}`,name:"mode","x-decorator":"FormItem","x-component":"Radio.Group","x-component-props":{options:er},required:!0,default:Ce.STATIC}}),n.jsx(l.SchemaComponent,{schema:{type:"void",properties:{[`mode-${t}`]:{type:"void","x-component":"fieldset","x-component-props":{className:l.css`
|
|
495
495
|
.ant-input-number {
|
|
496
496
|
width: auto;
|
|
497
497
|
min-width: 6em;
|
|
@@ -500,7 +500,7 @@
|
|
|
500
500
|
.ant-picker {
|
|
501
501
|
width: auto;
|
|
502
502
|
}
|
|
503
|
-
`},properties:Rn[t]}}},components:{OnField:at,RepeatField:Xn,EndsByField:zn}})]})};function tr(e,o){var c;const[t,r]=l.parseCollectionName(e.collection),s=l.useCompile(),a=je(t),i=[];if((!(o!=null&&o.types)||o.types.includes("date"))&&i.push({key:"date",value:"date",label:T("Trigger time")}),e.mode===
|
|
503
|
+
`},properties:Rn[t]}}},components:{OnField:at,RepeatField:Xn,EndsByField:zn}})]})};function tr(e,o){var c;const[t,r]=l.parseCollectionName(e.collection),s=l.useCompile(),a=je(t),i=[];if((!(o!=null&&o.types)||o.types.includes("date"))&&i.push({key:"date",value:"date",label:T("Trigger time")}),e.mode===Ce.DATE_FIELD){const[u]=Fe(A(C({appends:["data",...((c=e.appends)==null?void 0:c.map(d=>`data.${d}`))||[]]},o),{fields:[{collectionName:e.collection,name:"data",type:"hasOne",target:e.collection,uiSchema:{title:T("Trigger data")}}],compile:s,getCollectionFields:a}));u&&i.push(u)}return i}class nr extends So{constructor(){super(...arguments);w(this,"sync",!1);w(this,"title",`{{t("Schedule event", { ns: "${p}" })}}`);w(this,"description",`{{t("Triggered according to preset time conditions. Suitable for one-time or periodic tasks, such as sending notifications and cleaning data on a schedule.", { ns: "${p}" })}}`);w(this,"fieldset",{config:{type:"void","x-component":"ScheduleConfig","x-component-props":{}}});w(this,"scope",{useCollectionDataSource:l.useCollectionDataSource});w(this,"components",{ScheduleConfig:or});w(this,"useVariables",tr)}useInitializers(t){return t.collection?{name:"triggerData",type:"item",title:`{{t("Trigger data", { ns: "${p}" })}}`,Component:Be,collection:t.collection,dataPath:"$context.data"}:null}}function Te(e){const a=e,{options:o=[],direction:t}=a,r=Z(a,["options","direction"]),s=l.useCompile();return n.jsx(y.Radio.Group,A(C({},r),{children:n.jsx(y.Space,{direction:t,children:o.map(i=>n.jsxs(y.Radio,{value:i.value,children:[n.jsx("span",{className:l.css`
|
|
504
504
|
& + .anticon {
|
|
505
505
|
margin-left: 0.25em;
|
|
506
506
|
}
|
|
@@ -513,7 +513,7 @@
|
|
|
513
513
|
& + a {
|
|
514
514
|
margin-left: 0.25em;
|
|
515
515
|
}
|
|
516
|
-
`,children:l.i18n.t("Syntax references")}),n.jsx("a",{href:o.link,target:"_blank",rel:"noreferrer",children:o.label})]}):null};class lr extends ge{constructor(){super(...arguments);w(this,"title",`{{t("Calculation", { ns: "${p}" })}}`);w(this,"type","calculation");w(this,"group","control");w(this,"description",`{{t("Calculate an expression based on a calculation engine and obtain a value as the result. Variables in the upstream nodes can be used in the expression.", { ns: "${p}" })}}`);w(this,"fieldset",{engine:{type:"string",title:`{{t("Calculation engine", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{options:De.getOptions()},required:!0,default:"math.js"},expression:{type:"string",title:`{{t("Calculation expression", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"WorkflowVariableTextArea","x-component-props":{changeOnSelect:!0},"x-validator"(t,r,{form:s}){const{values:a}=s,{evaluate:i}=De.evaluators.get(a.engine),c=t.trim().replace(/{{([^{}]+)}}/g," 1 ");try{return i(c),""}catch(u){return T("Expression syntax error")}},"x-reactions":[{dependencies:["engine"],fulfill:{schema:{description:"{{renderEngineReference($deps[0])}}"}}}],required:!0}});w(this,"scope",{renderEngineReference:St});w(this,"components",{WorkflowVariableTextArea:Io,RadioWithTooltip:Te,ValueBlock:Ne})}useVariables({key:t,title:r},{types:s,fieldNames:a=
|
|
516
|
+
`,children:l.i18n.t("Syntax references")}),n.jsx("a",{href:o.link,target:"_blank",rel:"noreferrer",children:o.label})]}):null};class lr extends ge{constructor(){super(...arguments);w(this,"title",`{{t("Calculation", { ns: "${p}" })}}`);w(this,"type","calculation");w(this,"group","control");w(this,"description",`{{t("Calculate an expression based on a calculation engine and obtain a value as the result. Variables in the upstream nodes can be used in the expression.", { ns: "${p}" })}}`);w(this,"fieldset",{engine:{type:"string",title:`{{t("Calculation engine", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{options:De.getOptions()},required:!0,default:"math.js"},expression:{type:"string",title:`{{t("Calculation expression", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"WorkflowVariableTextArea","x-component-props":{changeOnSelect:!0},"x-validator"(t,r,{form:s}){const{values:a}=s,{evaluate:i}=De.evaluators.get(a.engine),c=t.trim().replace(/{{([^{}]+)}}/g," 1 ");try{return i(c),""}catch(u){return T("Expression syntax error")}},"x-reactions":[{dependencies:["engine"],fulfill:{schema:{description:"{{renderEngineReference($deps[0])}}"}}}],required:!0}});w(this,"scope",{renderEngineReference:St});w(this,"components",{WorkflowVariableTextArea:Io,RadioWithTooltip:Te,ValueBlock:Ne})}useVariables({key:t,title:r},{types:s,fieldNames:a=Ae}){return s&&!s.some(i=>i in Ze||Object.values(Ze).some(c=>c.has(i)))?null:{value:t,label:r}}useInitializers(t){var r,s;return{name:(r=t.title)!=null?r:`#${t.id}`,type:"item",title:(s=t.title)!=null?s:`#${t.id}`,Component:Ne.Initializer,node:t,resultTitle:T("Calculation result")}}}const X=new J.Registry;X.register("equal",{name:"=",type:"boolean",group:"boolean"}),X.register("notEqual",{name:"≠",type:"boolean",group:"boolean"}),X.register("gt",{name:">",type:"boolean",group:"boolean"}),X.register("gte",{name:"≥",type:"boolean",group:"boolean"}),X.register("lt",{name:"<",type:"boolean",group:"boolean"}),X.register("lte",{name:"≤",type:"boolean",group:"boolean"}),X.register("add",{name:"+",type:"number",group:"number"}),X.register("minus",{name:"-",type:"number",group:"number"}),X.register("multiple",{name:"*",type:"number",group:"number"}),X.register("divide",{name:"/",type:"number",group:"number"}),X.register("mod",{name:"%",type:"number",group:"number"}),X.register("includes",{name:'{{t("contains")}}',type:"boolean",group:"string"}),X.register("notIncludes",{name:'{{t("does not contain")}}',type:"boolean",group:"string"}),X.register("startsWith",{name:'{{t("starts with")}}',type:"boolean",group:"string"}),X.register("notStartsWith",{name:'{{t("not starts with")}}',type:"boolean",group:"string"}),X.register("endsWith",{name:'{{t("ends with")}}',type:"boolean",group:"string"}),X.register("notEndsWith",{name:'{{t("not ends with")}}',type:"boolean",group:"string"}),X.register("concat",{name:`{{t("concat", { ns: "${p}" })}}`,type:"string",group:"string"});const ir=[{value:"boolean",title:'{{t("Comparision")}}'},{value:"number",title:`{{t("Arithmetic calculation", { ns: "${p}" })}}`},{value:"string",title:`{{t("String operation", { ns: "${p}" })}}`},{value:"date",title:`{{t("Date", { ns: "${p}" })}}`}];function At(e){return Array.from(X.getEntities()).filter(([o,t])=>t.group===e)}function ar({calculator:e,operands:o=[],onChange:t}){const r=l.useCompile(),s=me(),a=me(),i=b.useCallback(d=>t({calculator:e,operands:[d,o[1]]}),[e,t,o]),c=b.useCallback(d=>t({calculator:e,operands:[o[0],d]}),[e,t,o]),u=b.useCallback(d=>t({operands:o,calculator:d}),[t,o]);return n.jsxs("fieldset",{className:l.css`
|
|
517
517
|
display: flex;
|
|
518
518
|
gap: 0.5em;
|
|
519
519
|
align-items: center;
|
|
@@ -548,11 +548,11 @@
|
|
|
548
548
|
margin-right: 1em;
|
|
549
549
|
}
|
|
550
550
|
}
|
|
551
|
-
`,children:[n.jsx(y.Button,{type:"link",onClick:a,children:t("Add condition")}),n.jsx(y.Button,{type:"link",onClick:i,children:t("Add condition group")})]})]})}function dr({value:e,onChange:o}){const t=e&&Object.keys(e).length?e:{group:{type:"and",calculations:[]}};return n.jsx(Ft,{value:t.group,onChange:r=>o(A(C({},t),{group:r}))})}class ur extends ge{constructor(){super(...arguments);w(this,"title",`{{t("Condition", { ns: "${p}" })}}`);w(this,"type","condition");w(this,"group","control");w(this,"description",`{{t('Based on boolean result of the calculation to determine whether to "continue" or "exit" the process, or continue on different branches of "yes" and "no".', { ns: "${p}" })}}`);w(this,"fieldset",{rejectOnFalse:{type:"boolean",title:`{{t("Mode", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"Radio.Group","x-component-props":{disabled:!0},enum:[{value:!0,label:`{{t('Continue when "Yes"', { ns: "${p}" })}}`},{value:!1,label:`{{t('Branch into "Yes" and "No"', { ns: "${p}" })}}`}]},engine:{type:"string",title:`{{t("Calculation engine", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{options:[["basic",{label:`{{t("Basic", { ns: "${p}" })}}`}],...Array.from(De.evaluators.getEntities()).filter(([t])=>["math.js","formula.js"].includes(t))].reduce((t,[r,s])=>t.concat(C({value:r},s)),[])},required:!0,default:"basic"},calculation:{type:"string",title:`{{t("Condition", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"CalculationConfig","x-reactions":{dependencies:["engine"],fulfill:{state:{visible:'{{$deps[0] === "basic"}}'}}},required:!0},expression:{type:"string",title:`{{t("Condition expression", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"WorkflowVariableTextArea","x-component-props":{changeOnSelect:!0},"x-validator"(t,r,{form:s}){const{values:a}=s,{evaluate:i}=De.evaluators.get(a.engine),c=t.trim().replace(/{{([^{}]+)}}/g," 1 ");try{return i(c),""}catch(u){return T("Expression syntax error")}},"x-reactions":{dependencies:["engine"],fulfill:{state:{visible:'{{$deps[0] !== "basic"}}'},schema:{description:"{{renderEngineReference($deps[0])}}"}}},required:!0}});w(this,"options",[{label:`{{t('Continue when "Yes"', { ns: "${p}" })}}`,key:"rejectOnFalse",value:{rejectOnFalse:!0}},{label:`{{t('Branch into "Yes" and "No"', { ns: "${p}" })}}`,key:"branch",value:{rejectOnFalse:!1}}]);w(this,"scope",{renderEngineReference:St,useWorkflowVariableOptions:me});w(this,"components",{CalculationConfig:dr,WorkflowVariableTextArea:Io,RadioWithTooltip:Te})}Component({data:t}){const{t:r}=Q.useTranslation(),{nodes:s}=G(),{styles:a}=ne(),{id:i,config:{rejectOnFalse:c}}=t,u=s.find(f=>f.upstreamId===i&&f.branchIndex===1),d=s.find(f=>f.upstreamId===i&&f.branchIndex===0);return n.jsx(ko,{data:t,children:c?null:n.jsxs("div",{className:a.nodeSubtreeClass,children:[n.jsxs("div",{className:a.branchBlockClass,children:[n.jsx(Ke,{from:t,entry:d,branchIndex:0}),n.jsx(Ke,{from:t,entry:u,branchIndex:1})]}),n.jsxs("div",{className:a.conditionClass,children:[n.jsx("span",{style:{right:"4em"},children:r("No")}),n.jsx("span",{style:{left:"4em"},children:r("Yes")})]})]})})}}class pr extends ge{constructor(){super(...arguments);w(this,"title",`{{t("End process", { ns: "${p}" })}}`);w(this,"type","end");w(this,"group","control");w(this,"description",`{{t("End the process immediately, with set status.", { ns: "${p}" })}}`);w(this,"fieldset",{endStatus:{type:"number",title:`{{t("End status", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"Radio.Group",enum:[{label:`{{t("Succeeded", { ns: "${p}" })}}`,value:ie.RESOLVED},{label:`{{t("Failed", { ns: "${p}" })}}`,value:ie.FAILED}],required:!0,default:ie.RESOLVED}});w(this,"end",!0)}}function oo({value:e,onChange:o,renderSchemaComponent:t}){const r=me();return n.jsx(l.Variable.Input,{value:e,onChange:o,scope:r,children:t()})}function mr(e){const{execution:o,nodes:t}=G(),r=b.useMemo(()=>t.reduce((i,c)=>Object.assign(i,{[c.id]:c.key}),{}),[t]),s=b.useMemo(()=>{var i;return{$context:o==null?void 0:o.context,$jobsMapByNodeKey:((i=o==null?void 0:o.jobs)!=null?i:[]).reduce((c,u)=>Object.assign(c,{[r[u.nodeId]]:u.result}),{})}},[o==null?void 0:o.context,o==null?void 0:o.jobs,r]);return b.useMemo(()=>
|
|
551
|
+
`,children:[n.jsx(y.Button,{type:"link",onClick:a,children:t("Add condition")}),n.jsx(y.Button,{type:"link",onClick:i,children:t("Add condition group")})]})]})}function dr({value:e,onChange:o}){const t=e&&Object.keys(e).length?e:{group:{type:"and",calculations:[]}};return n.jsx(Ft,{value:t.group,onChange:r=>o(A(C({},t),{group:r}))})}class ur extends ge{constructor(){super(...arguments);w(this,"title",`{{t("Condition", { ns: "${p}" })}}`);w(this,"type","condition");w(this,"group","control");w(this,"description",`{{t('Based on boolean result of the calculation to determine whether to "continue" or "exit" the process, or continue on different branches of "yes" and "no".', { ns: "${p}" })}}`);w(this,"fieldset",{rejectOnFalse:{type:"boolean",title:`{{t("Mode", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"Radio.Group","x-component-props":{disabled:!0},enum:[{value:!0,label:`{{t('Continue when "Yes"', { ns: "${p}" })}}`},{value:!1,label:`{{t('Branch into "Yes" and "No"', { ns: "${p}" })}}`}]},engine:{type:"string",title:`{{t("Calculation engine", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{options:[["basic",{label:`{{t("Basic", { ns: "${p}" })}}`}],...Array.from(De.evaluators.getEntities()).filter(([t])=>["math.js","formula.js"].includes(t))].reduce((t,[r,s])=>t.concat(C({value:r},s)),[])},required:!0,default:"basic"},calculation:{type:"string",title:`{{t("Condition", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"CalculationConfig","x-reactions":{dependencies:["engine"],fulfill:{state:{visible:'{{$deps[0] === "basic"}}'}}},required:!0},expression:{type:"string",title:`{{t("Condition expression", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"WorkflowVariableTextArea","x-component-props":{changeOnSelect:!0},"x-validator"(t,r,{form:s}){const{values:a}=s,{evaluate:i}=De.evaluators.get(a.engine),c=t.trim().replace(/{{([^{}]+)}}/g," 1 ");try{return i(c),""}catch(u){return T("Expression syntax error")}},"x-reactions":{dependencies:["engine"],fulfill:{state:{visible:'{{$deps[0] !== "basic"}}'},schema:{description:"{{renderEngineReference($deps[0])}}"}}},required:!0}});w(this,"options",[{label:`{{t('Continue when "Yes"', { ns: "${p}" })}}`,key:"rejectOnFalse",value:{rejectOnFalse:!0}},{label:`{{t('Branch into "Yes" and "No"', { ns: "${p}" })}}`,key:"branch",value:{rejectOnFalse:!1}}]);w(this,"scope",{renderEngineReference:St,useWorkflowVariableOptions:me});w(this,"components",{CalculationConfig:dr,WorkflowVariableTextArea:Io,RadioWithTooltip:Te})}Component({data:t}){const{t:r}=Q.useTranslation(),{nodes:s}=G(),{styles:a}=ne(),{id:i,config:{rejectOnFalse:c}}=t,u=s.find(f=>f.upstreamId===i&&f.branchIndex===1),d=s.find(f=>f.upstreamId===i&&f.branchIndex===0);return n.jsx(ko,{data:t,children:c?null:n.jsxs("div",{className:a.nodeSubtreeClass,children:[n.jsxs("div",{className:a.branchBlockClass,children:[n.jsx(Ke,{from:t,entry:d,branchIndex:0}),n.jsx(Ke,{from:t,entry:u,branchIndex:1})]}),n.jsxs("div",{className:a.conditionClass,children:[n.jsx("span",{style:{right:"4em"},children:r("No")}),n.jsx("span",{style:{left:"4em"},children:r("Yes")})]})]})})}}class pr extends ge{constructor(){super(...arguments);w(this,"title",`{{t("End process", { ns: "${p}" })}}`);w(this,"type","end");w(this,"group","control");w(this,"description",`{{t("End the process immediately, with set status.", { ns: "${p}" })}}`);w(this,"fieldset",{endStatus:{type:"number",title:`{{t("End status", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"Radio.Group",enum:[{label:`{{t("Succeeded", { ns: "${p}" })}}`,value:ie.RESOLVED},{label:`{{t("Failed", { ns: "${p}" })}}`,value:ie.FAILED}],required:!0,default:ie.RESOLVED}});w(this,"end",!0)}}function oo({value:e,onChange:o,renderSchemaComponent:t}){const r=me();return n.jsx(l.Variable.Input,{value:e,onChange:o,scope:r,children:t()})}function mr(e){const{execution:o,nodes:t}=G(),r=b.useMemo(()=>t.reduce((i,c)=>Object.assign(i,{[c.id]:c.key}),{}),[t]),s=b.useMemo(()=>{var i;return{$context:o==null?void 0:o.context,$jobsMapByNodeKey:((i=o==null?void 0:o.jobs)!=null?i:[]).reduce((c,u)=>Object.assign(c,{[r[u.nodeId]]:u.result}),{})}},[o==null?void 0:o.context,o==null?void 0:o.jobs,r]);return b.useMemo(()=>Se.get(s,e),[s,e])}function fr({collection:e,dataPath:o,children:t}){const r=L.useField(),s=b.useRef(null),{getAssociationAppends:a}=l.useAssociationNames(),{appends:i,updateAssociationValues:c}=a(),u=mr(o);let d,f;if(typeof e=="string"){const B=l.parseCollectionName(e);d=B[0],f=B[1]}else f=e;const h=b.useMemo(()=>le.createForm({values:u,readPretty:!0}),[u]),x={appends:i},g={loading:!1,data:{data:u}},k=l.useAPIClient().resource(f),O=l.useBlockRequestContext();return n.jsx(l.CollectionProvider_deprecated,{dataSource:d,collection:f,children:n.jsx(l.RecordProvider,{record:u,parent:null,children:n.jsx(l.BlockRequestContext_deprecated.Provider,{value:{block:"form",field:r,service:g,resource:k,__parent:O},children:n.jsx(l.FormBlockContext.Provider,{value:{params:x,form:h,field:r,service:g,updateAssociationValues:c,formBlockRef:s},children:t})})})})}function hr(e){const a=e,{options:o=[],direction:t}=a,r=Z(a,["options","direction"]),s=l.useCompile();return n.jsx(y.Checkbox.Group,A(C({},r),{children:n.jsx(y.Space,{direction:t,children:o.map(i=>n.jsxs(y.Checkbox,{value:i.value,children:[n.jsx("span",{className:l.css`
|
|
552
552
|
& + .anticon {
|
|
553
553
|
margin-left: 0.25em;
|
|
554
554
|
}
|
|
555
|
-
`,children:s(i.label)}),i.tooltip&&n.jsx(y.Tooltip,{title:s(i.tooltip),children:n.jsx(I.QuestionCircleOutlined,{style:{color:"#666"}})})]},i.value))})}))}function yr({key:e,title:o,config:t},r){var d,f;const[s,a]=l.parseCollectionName(t.collection),i=l.useCompile(),c=je(s),[u]=
|
|
555
|
+
`,children:s(i.label)}),i.tooltip&&n.jsx(y.Tooltip,{title:s(i.tooltip),children:n.jsx(I.QuestionCircleOutlined,{style:{color:"#666"}})})]},i.value))})}))}function yr({key:e,title:o,config:t},r){var d,f;const[s,a]=l.parseCollectionName(t.collection),i=l.useCompile(),c=je(s),[u]=Fe(A(C({appends:[e,...((f=(d=t.params)==null?void 0:d.appends)==null?void 0:f.map(h=>`${e}.${h}`))||[]]},r),{fields:[{collectionName:a,name:e,type:"hasOne",target:a,uiSchema:{title:o}}],compile:i,getCollectionFields:c}));return u}class gr extends ge{constructor(){super(...arguments);w(this,"title",`{{t("Query record", { ns: "${p}" })}}`);w(this,"type","query");w(this,"group","collection");w(this,"description",`{{t("Query records from a collection. You can use variables from upstream nodes as query conditions.", { ns: "${p}" })}}`);w(this,"fieldset",{collection:A(C({},ae),{"x-disabled":'{{ useNodeSavedConfig(["collection"]) }}',"x-reactions":[...ae["x-reactions"],{target:"params",effects:["onFieldValueChange"],fulfill:{state:{visible:"{{!!$self.value}}",value:"{{Object.create({})}}"}}}]}),multiple:{type:"boolean",title:`{{t("Result type", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{options:[{label:`{{t("Single record", { ns: "${p}" })}}`,value:!1,tooltip:`{{t("The result will be an object of the first matching record only, or null if no matched record.", { ns: "${p}" })}}`},{label:`{{t("Multiple records", { ns: "${p}" })}}`,value:!0,tooltip:`{{t("The result will be an array containing matched records, or an empty one if no matching records. This can be used to be processed in a loop node.", { ns: "${p}" })}}`}]},required:!0,default:!1},params:{type:"object","x-component":"fieldset",properties:{filter:_e,sort:Nn,pagination:En,appends:Ve},"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{$deps[0] != null}}"}}}]},failOnEmpty:{type:"boolean","x-decorator":"FormItem","x-component":"Checkbox","x-content":`{{t("Exit when query result is null", { ns: "${p}" })}}`}});w(this,"scope",{useNodeSavedConfig:Me,useCollectionDataSource:l.useCollectionDataSource,useSortableFields(){const t=l.useCompile(),{values:r}=L.useForm(),[s,a]=l.parseCollectionName(r.collection),i=l.useApp(),{collectionManager:c}=i.dataSourceManager.getDataSource(s);return c.getCollectionFields(a).filter(d=>{if(!d.interface)return!1;const f=i.dataSourceManager.collectionFieldInterfaceManager.getFieldInterface(d.interface);return!!(f!=null&&f.sortable)}).map(d=>{var f,h;return{value:d.name,label:(f=d==null?void 0:d.uiSchema)!=null&&f.title?t((h=d==null?void 0:d.uiSchema)==null?void 0:h.title):d.name}})}});w(this,"components",{ArrayItems:jo.ArrayItems,FilterDynamicComponent:oo,SchemaComponentContext:l.SchemaComponentContext,WorkflowVariableInput:lt,RadioWithTooltip:Te});w(this,"useVariables",yr)}useInitializers(t){var r,s;return!t.config.collection||t.config.multiple?null:{name:(r=t.title)!=null?r:`#${t.id}`,type:"item",title:(s=t.title)!=null?s:`#${t.id}`,Component:Be,collection:t.config.collection,dataPath:`$jobsMapByNodeKey.${t.key}`}}}function br(e){const{getCollectionFields:o}=l.useCollectionManager_deprecated(),{path:t}=L.useField(),r=t.segments[t.segments.length-1],{values:s}=L.useForm(),[a,i]=l.parseCollectionName(s==null?void 0:s.collection),c=o(i,a),{type:u}=c.find(h=>h.name===r),d=Array.isArray(e.value)?e.value.join(","):e.value,f=b.useCallback(h=>{const x=h.target.value.trim(),g=["belongsTo","hasOne"].includes(u)?x||null:x.split(",").map(m=>m.trim()).filter(m=>m!=="");e.onChange(g)},[e.onChange,u]);return n.jsx(y.Input,A(C({},e),{value:d,onChange:f}))}const Ot=L.observer(({value:e,disabled:o,onChange:t,filter:r})=>{const{token:s}=l.useToken(),{t:a}=Q.useTranslation(),i=l.useCompile(),c=L.useForm(),{getCollectionFields:u}=l.useCollectionManager_deprecated(),d=me(),{values:f}=c,[h,x]=l.parseCollectionName(f==null?void 0:f.collection),g=u(x,h).filter(S=>S.uiSchema),m=r?g.filter(r.bind(f)):g,k=b.useMemo(()=>m.filter(S=>!e||!(S.name in e)),[m,e]),O=o||c.disabled,B=b.useMemo(()=>({onClick:({key:S})=>{t(A(C({},e),{[S]:null}))},style:{maxHeight:300,overflowY:"auto"},items:k.map(S=>{var E,W;return{key:S.name,label:i((W=(E=S.uiSchema)==null?void 0:E.title)!=null?W:S.name)}})}),[t,k,e]);return n.jsx("fieldset",{className:l.css`
|
|
556
556
|
margin-top: 0.5em;
|
|
557
557
|
|
|
558
558
|
> .ant-formily-item {
|
|
@@ -566,4 +566,4 @@
|
|
|
566
566
|
.ant-form-item-control-input-content {
|
|
567
567
|
display: flex;
|
|
568
568
|
}
|
|
569
|
-
`,children:[n.jsx(l.Variable.Input,{scope:d,value:e[S.name],changeOnSelect:!0,onChange:M=>{t(A(C({},e),{[S.name]:M}))},children:n.jsx(l.SchemaComponent,{schema:{type:"void",properties:{[S.name]:{"x-component":E,"x-validator"(){return""}}}}})}),O?null:n.jsx(y.Button,{"aria-label":"icon-close",type:"link",icon:n.jsx(I.CloseCircleOutlined,{}),onClick:()=>{var F;const D=e,{[F=S.name]:M}=D,N=Z(D,[Kt(F)]);t(N)}})]},S.name)}),k.length?n.jsx(y.Dropdown,{menu:B,children:n.jsx(y.Button,{icon:n.jsx(I.PlusOutlined,{}),children:a("Add field")})}):null]}):n.jsx("p",{style:{color:s.colorText},children:T("Please select collection first")})})},{displayName:"CollectionFieldSet"});function Tt(e,o){o(e),e!=null&&e.properties&&Object.values(e.properties).forEach(t=>{Tt(t,o)})}function Nt(){return{name:ho.uid(),type:"void","x-component":"Grid","x-initializer":"assignFieldValuesForm:configureFields"}}function Et(e){const{workflow:o}=G(),{setFormValueChanged:t}=l.useActionContext();l.useAPIClient();const r=me(),s=L.useForm(),{values:a,setValuesIn:i}=s,c=fo.toJS(a.params),[u,d]=l.parseCollectionName(a.collection),f=l.useSchemaOptionsContext(),[h,x]=b.useState(e.value&&Object.keys(e.value).length?e.value:Nt()),g=b.useMemo(()=>le.createForm({initialValues:c.values,disabled:o.executed,effects(){le.onFormValuesChange(k=>{i("params.values",fo.toJS(k.values)),t(!0)})}}),[o.executed]);L.useFormEffects(()=>{le.onFieldValueChange("collection",k=>U(this,null,function*(){g.clearFormGraph("*");const O=Nt();i("params.values",{}),x(O)}))});const m=b.useCallback(k=>{const[O]=Object.values(k.toJSON().properties);e.onChange(O);const B=new Set;Tt(O,E=>{var W;if(E["x-component"]==="AssignedField"&&(W=E["x-collection-field"])!=null&&W.startsWith(`${d}.`)){const[,$]=E["x-collection-field"].split(".");B.add($)}});const S={};Array.from(B).forEach(E=>{E in g.values&&(S[E]=g.values[E])}),i("params.values",S)},[d,e.onChange]);return n.jsx(y.Card,{children:n.jsx(l.CollectionManagerProvider,{dataSource:u,children:n.jsx(l.CollectionProvider,{name:d,children:n.jsx(l.FormProvider,{form:g,children:n.jsx(jo.FormLayout,{layout:"vertical",children:n.jsx(l.VariableScopeProvider,{scope:r,children:n.jsx(l.SchemaComponentProvider,{form:g,designable:!s.disabled,children:n.jsx(l.SchemaComponentOptions,A(C({},f),{children:n.jsx(l.SchemaComponent,{schema:h,onChange:m})}))})})})})})})})}function vr({key:e,title:o,config:t},r){var d,f;const[s,a]=l.parseCollectionName(t.collection),i=l.useCompile(),c=je(s),[u]=Ae(A(C({appends:[e,...((f=(d=t.params)==null?void 0:d.appends)==null?void 0:f.map(h=>`${e}.${h}`))||[]]},r),{fields:[{collectionName:a,name:e,type:"hasOne",target:a,uiSchema:{title:o}}],compile:i,getCollectionFields:c}));return u}class xr extends ge{constructor(){super(...arguments);w(this,"title",`{{t("Create record", { ns: "${p}" })}}`);w(this,"type","create");w(this,"group","collection");w(this,"description",`{{t("Add new record to a collection. You can use variables from upstream nodes to assign values to fields.", { ns: "${p}" })}}`);w(this,"fieldset",{collection:A(C({},ae),{"x-disabled":'{{ useNodeSavedConfig(["collection"]) }}',"x-reactions":[...ae["x-reactions"],{target:"params",effects:["onFieldValueChange"],fulfill:{state:{value:"{{Object.create({})}}"}}}]}),usingAssignFormSchema:{type:"boolean"},assignFormSchema:{type:"object",title:'{{t("Fields values")}}',"x-decorator":"FormItem","x-component":"AssignedFieldsFormSchemaConfig","x-reactions":[{dependencies:["collection","usingAssignFormSchema"],fulfill:{state:{display:'{{($deps[0] && $deps[1]) ? "visible" : "hidden"}}'}}}]},params:{type:"object",properties:{values:A(C({},et),{"x-reactions":[{dependencies:["collection","usingAssignFormSchema"],fulfill:{state:{display:'{{($deps[0] && !$deps[1]) ? "visible" : "hidden"}}'}}}]}),appends:Ve}}});w(this,"scope",{useCollectionDataSource:l.useCollectionDataSource,useNodeSavedConfig:Me});w(this,"components",{CollectionFieldset:Ot,AssignedFieldsFormSchemaConfig:Et});w(this,"useVariables",vr)}createDefaultConfig(){return{usingAssignFormSchema:!0,assignFormSchema:{}}}useInitializers(t){var r,s;return t.config.collection?{name:(r=t.title)!=null?r:`#${t.id}`,type:"item",title:(s=t.title)!=null?s:`#${t.id}`,Component:Be,collection:t.config.collection,dataPath:`$jobsMapByNodeKey.${t.key}`}:null}}class wr extends ge{constructor(){super(...arguments);w(this,"title",`{{t("Update record", { ns: "${p}" })}}`);w(this,"type","update");w(this,"group","collection");w(this,"description",`{{t("Update records of a collection. You can use variables from upstream nodes as query conditions and field values.", { ns: "${p}" })}}`);w(this,"fieldset",{collection:A(C({},ae),{"x-disabled":'{{ useNodeSavedConfig(["collection"]) }}',"x-reactions":[...ae["x-reactions"],{target:"params",fulfill:{state:{visible:"{{!!$self.value}}"}}},{target:"params.filter",effects:["onFieldValueChange"],fulfill:{state:{value:"{{Object.create({})}}"}}},{target:"params.values",effects:["onFieldValueChange"],fulfill:{state:{value:"{{Object.create({})}}"}}}]}),params:{type:"object",properties:{individualHooks:{type:"boolean",title:`{{t("Update mode", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{options:[{label:`{{t("Update in a batch", { ns: "${p}" })}}`,value:!1,tooltip:`{{t("Update all eligible data at one time, which has better performance when the amount of data is large. But the updated data will not trigger other workflows, and will not record audit logs.", { ns: "${p}" })}}`},{label:`{{t("Update one by one", { ns: "${p}" })}}`,value:!0,tooltip:`{{t("The updated data can trigger other workflows, and the audit log will also be recorded. But it is usually only applicable to several or dozens of pieces of data, otherwise there will be performance problems.", { ns: "${p}" })}}`}]},default:!1},filter:A(C({},_e),{title:`{{t("Only update records matching conditions", { ns: "${p}" })}}`,"x-validator"(t){return J.isValidFilter(t)?"":T("Please add at least one condition")}}),values:A(C({},et),{"x-reactions":[{dependencies:["collection","usingAssignFormSchema"],fulfill:{state:{display:'{{($deps[0] && !$deps[1]) ? "visible" : "hidden"}}'}}}]})}},usingAssignFormSchema:{type:"boolean"},assignFormSchema:{type:"object",title:'{{t("Fields values")}}',"x-decorator":"FormItem","x-component":"AssignedFieldsFormSchemaConfig","x-reactions":[{dependencies:["collection","usingAssignFormSchema"],fulfill:{state:{display:'{{($deps[0] && $deps[1]) ? "visible" : "hidden"}}'}}}]}});w(this,"scope",{useCollectionDataSource:l.useCollectionDataSource,useNodeSavedConfig:Me});w(this,"components",{FilterDynamicComponent:oo,CollectionFieldset:Ot,AssignedFieldsFormSchemaConfig:Et,RadioWithTooltip:Te})}createDefaultConfig(){return{usingAssignFormSchema:!0,assignFormSchema:{}}}}class Cr extends ge{constructor(){super(...arguments);w(this,"title",'{{t("Delete record")}}');w(this,"type","destroy");w(this,"group","collection");w(this,"description",`{{t("Delete records of a collection. Could use variables in workflow context as filter. All records match the filter will be deleted.", { ns: "${p}" })}}`);w(this,"fieldset",{collection:A(C({},ae),{"x-disabled":'{{ useNodeSavedConfig(["collection"]) }}',"x-reactions":[...ae["x-reactions"],{target:"params",fulfill:{state:{visible:"{{!!$self.value}}"}}},{target:"params",effects:["onFieldValueChange"],fulfill:{state:{value:"{{Object.create({})}}"}}}]}),params:{type:"object",properties:{filter:A(C({},_e),{"x-validator"(t){return J.isValidFilter(t)?"":T("Please add at least one condition")}})}}});w(this,"scope",{useNodeSavedConfig:Me,useCollectionDataSource:l.useCollectionDataSource});w(this,"components",{FilterDynamicComponent:oo})}}const kr=new l.SchemaSettings({name:"actionSettings:submitToWorkflow",items:[{name:"editButton",Component:l.ButtonEditor,useComponentProps(){const{buttonEditorProps:e}=l.useSchemaToolbar();return e}},{name:"secondConfirmation",Component:l.SecondConFirm},{name:"assignFieldValues",Component:l.AssignedFieldValues},{name:"skipRequiredValidation",Component:l.SkipValidation},{name:"afterSuccessfulSubmission",Component:l.AfterSuccess,useVisible(){var o;const e=L.useFieldSchema();return ho.isValid((o=e==null?void 0:e["x-action-settings"])==null?void 0:o.onSuccess)}},{name:"bindWorkflow",Component:l.WorkflowConfig},{name:"delete",sort:100,Component:l.RemoveButton,useComponentProps(){const{removeButtonProps:e}=l.useSchemaToolbar();return e}}]});function Sr({children:e,workflow:o,execution:t,nodes:r}){const s=l.usePlugin(de),a=s.triggers.get(o.type).components,i=r.reduce((c,{type:u})=>Object.assign(c,s.instructions.get(u).components),{});return n.jsx(Ie.Provider,{value:{workflow:o,nodes:r,execution:t},children:n.jsx(l.SchemaComponentOptions,{components:C(C({},a),i),children:e})})}class de extends l.Plugin{constructor(){super(...arguments);w(this,"triggers",new J.Registry);w(this,"instructions",new J.Registry);w(this,"getTriggersOptions",()=>Array.from(this.triggers.getEntities()).map(a=>{var[t,i]=a,c=i,{title:r}=c,s=Z(c,["title"]);return{value:t,label:r,color:"gold",options:s}}))}isWorkflowSync(t){var r,s;return(s=(r=this.triggers.get(t.type))==null?void 0:r.sync)!=null?s:t.sync}registerTrigger(t,r){if(typeof r=="function")this.triggers.register(t,new r);else if(r)this.triggers.register(t,r);else throw new TypeError("invalid trigger type to register")}registerInstruction(t,r){if(typeof r=="function")this.instructions.register(t,new r);else if(r instanceof ge)this.instructions.register(t,r);else throw new TypeError("invalid instruction type to register")}load(){return U(this,null,function*(){this.app.router.add("admin.workflow.workflows.id",{path:xe(":id"),element:n.jsx(Xo,{})}),this.app.router.add("admin.workflow.executions.id",{path:Ye(":id"),element:n.jsx(qo,{})}),this.app.addComponents({WorkflowPage:Xo,ExecutionPage:qo}),this.app.pluginSettingsManager.add(p,{icon:"PartitionOutlined",title:`{{t("Workflow", { ns: "${p}" })}}`,Component:Fn,aclSnippet:"pm.workflow.workflows"}),this.app.schemaSettingsManager.add(kr),this.registerTrigger("collection",Wn),this.registerTrigger("schedule",nr),this.registerInstruction("calculation",lr),this.registerInstruction("condition",ur),this.registerInstruction("end",pr),this.registerInstruction("query",gr),this.registerInstruction("create",xr),this.registerInstruction("update",wr),this.registerInstruction("destroy",Cr)})}}v.BaseTypeSets=Ze,v.Branch=Ke,v.CheckboxGroupWithTooltip=hr,v.CollectionBlockInitializer=Be,v.DetailsBlockProvider=fr,v.EXECUTION_STATUS=pe,v.ExecutionContextProvider=Sr,v.ExecutionStatusOptions=He,v.ExecutionStatusOptionsMap=Ge,v.FieldsSelect=To,v.FilterDynamicComponent=oo,v.FlowContext=Ie,v.Instruction=ge,v.JOB_STATUS=ie,v.JobButton=Co,v.JobStatusOptions=vo,v.JobStatusOptionsMap=qe,v.Node=Ho,v.NodeContext=xo,v.NodeDefaultView=ko,v.RadioWithTooltip=Te,v.RemoveButton=wo,v.SimpleDesigner=kt,v.Trigger=So,v.ValueBlock=Ne,v.WorkflowVariableInput=lt,v.WorkflowVariableJSON=In,v.WorkflowVariableRawTextArea=Dn,v.WorkflowVariableTextArea=Io,v.default=de,v.defaultFieldNames=Se,v.getCollectionFieldOptions=Ae,v.getWorkflowDetailPath=xe,v.getWorkflowExecutionsPath=Ye,v.linkNodes=Fo,v.nodesOptions=ot,v.scopeOptions=nt,v.systemOptions=rt,v.traverseSchema=Oo,v.triggerOptions=tt,v.useAvailableUpstreams=Jo,v.useFlowContext=G,v.useGetAriaLabelOfAddButton=bo,v.useGetCollectionFields=je,v.useNodeContext=ve,v.useNodeSavedConfig=Me,v.useRecordTriggerWorkflowsActionProps=Mn,v.useStyles=ne,v.useTrigger=Ao,v.useTriggerWorkflowsActionProps=Pn,v.useUpstreamScopes=Uo,v.useWorkflowAnyExecuted=it,v.useWorkflowExecuted=Bn,v.useWorkflowVariableOptions=me,Object.defineProperties(v,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
569
|
+
`,children:[n.jsx(l.Variable.Input,{scope:d,value:e[S.name],changeOnSelect:!0,onChange:M=>{t(A(C({},e),{[S.name]:M}))},children:n.jsx(l.SchemaComponent,{schema:{type:"void",properties:{[S.name]:{"x-component":E,"x-validator"(){return""}}}}})}),O?null:n.jsx(y.Button,{"aria-label":"icon-close",type:"link",icon:n.jsx(I.CloseCircleOutlined,{}),onClick:()=>{var F;const D=e,{[F=S.name]:M}=D,N=Z(D,[Kt(F)]);t(N)}})]},S.name)}),k.length?n.jsx(y.Dropdown,{menu:B,children:n.jsx(y.Button,{icon:n.jsx(I.PlusOutlined,{}),children:a("Add field")})}):null]}):n.jsx("p",{style:{color:s.colorText},children:T("Please select collection first")})})},{displayName:"CollectionFieldSet"});function Tt(e,o){o(e),e!=null&&e.properties&&Object.values(e.properties).forEach(t=>{Tt(t,o)})}function Nt(){return{name:ho.uid(),type:"void","x-component":"Grid","x-initializer":"assignFieldValuesForm:configureFields"}}function Et(e){const{workflow:o}=G(),{setFormValueChanged:t}=l.useActionContext();l.useAPIClient();const r=me(),s=L.useForm(),{values:a,setValuesIn:i}=s,c=fo.toJS(a.params),[u,d]=l.parseCollectionName(a.collection),f=l.useSchemaOptionsContext(),[h,x]=b.useState(e.value&&Object.keys(e.value).length?e.value:Nt()),g=b.useMemo(()=>le.createForm({initialValues:c.values,disabled:o.executed,effects(){le.onFormValuesChange(k=>{i("params.values",fo.toJS(k.values)),t(!0)})}}),[o.executed]);L.useFormEffects(()=>{le.onFieldValueChange("collection",k=>U(this,null,function*(){g.clearFormGraph("*");const O=Nt();i("params.values",{}),x(O)}))});const m=b.useCallback(k=>{const[O]=Object.values(k.toJSON().properties);e.onChange(O);const B=new Set;Tt(O,E=>{var W;if(E["x-component"]==="AssignedField"&&(W=E["x-collection-field"])!=null&&W.startsWith(`${d}.`)){const[,$]=E["x-collection-field"].split(".");B.add($)}});const S={};Array.from(B).forEach(E=>{E in g.values&&(S[E]=g.values[E])}),i("params.values",S)},[d,e.onChange]);return n.jsx(y.Card,{children:n.jsx(l.CollectionManagerProvider,{dataSource:u,children:n.jsx(l.CollectionProvider,{name:d,children:n.jsx(l.FormProvider,{form:g,children:n.jsx(jo.FormLayout,{layout:"vertical",children:n.jsx(l.VariableScopeProvider,{scope:r,children:n.jsx(l.SchemaComponentProvider,{form:g,designable:!s.disabled,children:n.jsx(l.SchemaComponentOptions,A(C({},f),{children:n.jsx(l.SchemaComponent,{schema:h,onChange:m})}))})})})})})})})}function vr({key:e,title:o,config:t},r){var d,f;const[s,a]=l.parseCollectionName(t.collection),i=l.useCompile(),c=je(s),[u]=Fe(A(C({appends:[e,...((f=(d=t.params)==null?void 0:d.appends)==null?void 0:f.map(h=>`${e}.${h}`))||[]]},r),{fields:[{collectionName:a,name:e,type:"hasOne",target:a,uiSchema:{title:o}}],compile:i,getCollectionFields:c}));return u}class xr extends ge{constructor(){super(...arguments);w(this,"title",`{{t("Create record", { ns: "${p}" })}}`);w(this,"type","create");w(this,"group","collection");w(this,"description",`{{t("Add new record to a collection. You can use variables from upstream nodes to assign values to fields.", { ns: "${p}" })}}`);w(this,"fieldset",{collection:A(C({},ae),{"x-disabled":'{{ useNodeSavedConfig(["collection"]) }}',"x-reactions":[...ae["x-reactions"],{target:"params",effects:["onFieldValueChange"],fulfill:{state:{value:"{{Object.create({})}}"}}}]}),usingAssignFormSchema:{type:"boolean"},assignFormSchema:{type:"object",title:'{{t("Fields values")}}',"x-decorator":"FormItem","x-component":"AssignedFieldsFormSchemaConfig","x-reactions":[{dependencies:["collection","usingAssignFormSchema"],fulfill:{state:{display:'{{($deps[0] && $deps[1]) ? "visible" : "hidden"}}'}}}]},params:{type:"object",properties:{values:A(C({},et),{"x-reactions":[{dependencies:["collection","usingAssignFormSchema"],fulfill:{state:{display:'{{($deps[0] && !$deps[1]) ? "visible" : "hidden"}}'}}}]}),appends:Ve}}});w(this,"scope",{useCollectionDataSource:l.useCollectionDataSource,useNodeSavedConfig:Me});w(this,"components",{CollectionFieldset:Ot,AssignedFieldsFormSchemaConfig:Et});w(this,"useVariables",vr)}createDefaultConfig(){return{usingAssignFormSchema:!0,assignFormSchema:{}}}useInitializers(t){var r,s;return t.config.collection?{name:(r=t.title)!=null?r:`#${t.id}`,type:"item",title:(s=t.title)!=null?s:`#${t.id}`,Component:Be,collection:t.config.collection,dataPath:`$jobsMapByNodeKey.${t.key}`}:null}}class wr extends ge{constructor(){super(...arguments);w(this,"title",`{{t("Update record", { ns: "${p}" })}}`);w(this,"type","update");w(this,"group","collection");w(this,"description",`{{t("Update records of a collection. You can use variables from upstream nodes as query conditions and field values.", { ns: "${p}" })}}`);w(this,"fieldset",{collection:A(C({},ae),{"x-disabled":'{{ useNodeSavedConfig(["collection"]) }}',"x-reactions":[...ae["x-reactions"],{target:"params",fulfill:{state:{visible:"{{!!$self.value}}"}}},{target:"params.filter",effects:["onFieldValueChange"],fulfill:{state:{value:"{{Object.create({})}}"}}},{target:"params.values",effects:["onFieldValueChange"],fulfill:{state:{value:"{{Object.create({})}}"}}}]}),params:{type:"object",properties:{individualHooks:{type:"boolean",title:`{{t("Update mode", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{options:[{label:`{{t("Update in a batch", { ns: "${p}" })}}`,value:!1,tooltip:`{{t("Update all eligible data at one time, which has better performance when the amount of data is large. But the updated data will not trigger other workflows, and will not record audit logs.", { ns: "${p}" })}}`},{label:`{{t("Update one by one", { ns: "${p}" })}}`,value:!0,tooltip:`{{t("The updated data can trigger other workflows, and the audit log will also be recorded. But it is usually only applicable to several or dozens of pieces of data, otherwise there will be performance problems.", { ns: "${p}" })}}`}]},default:!1},filter:A(C({},_e),{title:`{{t("Only update records matching conditions", { ns: "${p}" })}}`,"x-validator"(t){return J.isValidFilter(t)?"":T("Please add at least one condition")}}),values:A(C({},et),{"x-reactions":[{dependencies:["collection","usingAssignFormSchema"],fulfill:{state:{display:'{{($deps[0] && !$deps[1]) ? "visible" : "hidden"}}'}}}]})}},usingAssignFormSchema:{type:"boolean"},assignFormSchema:{type:"object",title:'{{t("Fields values")}}',"x-decorator":"FormItem","x-component":"AssignedFieldsFormSchemaConfig","x-reactions":[{dependencies:["collection","usingAssignFormSchema"],fulfill:{state:{display:'{{($deps[0] && $deps[1]) ? "visible" : "hidden"}}'}}}]}});w(this,"scope",{useCollectionDataSource:l.useCollectionDataSource,useNodeSavedConfig:Me});w(this,"components",{FilterDynamicComponent:oo,CollectionFieldset:Ot,AssignedFieldsFormSchemaConfig:Et,RadioWithTooltip:Te})}createDefaultConfig(){return{usingAssignFormSchema:!0,assignFormSchema:{}}}}class Cr extends ge{constructor(){super(...arguments);w(this,"title",'{{t("Delete record")}}');w(this,"type","destroy");w(this,"group","collection");w(this,"description",`{{t("Delete records of a collection. Could use variables in workflow context as filter. All records match the filter will be deleted.", { ns: "${p}" })}}`);w(this,"fieldset",{collection:A(C({},ae),{"x-disabled":'{{ useNodeSavedConfig(["collection"]) }}',"x-reactions":[...ae["x-reactions"],{target:"params",fulfill:{state:{visible:"{{!!$self.value}}"}}},{target:"params",effects:["onFieldValueChange"],fulfill:{state:{value:"{{Object.create({})}}"}}}]}),params:{type:"object",properties:{filter:A(C({},_e),{"x-validator"(t){return J.isValidFilter(t)?"":T("Please add at least one condition")}})}}});w(this,"scope",{useNodeSavedConfig:Me,useCollectionDataSource:l.useCollectionDataSource});w(this,"components",{FilterDynamicComponent:oo})}}const kr=new l.SchemaSettings({name:"actionSettings:submitToWorkflow",items:[{name:"editButton",Component:l.ButtonEditor,useComponentProps(){const{buttonEditorProps:e}=l.useSchemaToolbar();return e}},{name:"secondConfirmation",Component:l.SecondConFirm},{name:"assignFieldValues",Component:l.AssignedFieldValues},{name:"skipRequiredValidation",Component:l.SkipValidation},{name:"afterSuccessfulSubmission",Component:l.AfterSuccess,useVisible(){var o;const e=L.useFieldSchema();return ho.isValid((o=e==null?void 0:e["x-action-settings"])==null?void 0:o.onSuccess)}},{name:"bindWorkflow",Component:l.WorkflowConfig},{name:"delete",sort:100,Component:l.RemoveButton,useComponentProps(){const{removeButtonProps:e}=l.useSchemaToolbar();return e}}]});function Sr({children:e,workflow:o,execution:t,nodes:r}){const s=l.usePlugin(de),a=s.triggers.get(o.type).components,i=r.reduce((c,{type:u})=>Object.assign(c,s.instructions.get(u).components),{});return n.jsx(Ie.Provider,{value:{workflow:o,nodes:r,execution:t},children:n.jsx(l.SchemaComponentOptions,{components:C(C({},a),i),children:e})})}class de extends l.Plugin{constructor(){super(...arguments);w(this,"triggers",new J.Registry);w(this,"instructions",new J.Registry);w(this,"getTriggersOptions",()=>Array.from(this.triggers.getEntities()).map(a=>{var[t,i]=a,c=i,{title:r}=c,s=Z(c,["title"]);return{value:t,label:r,color:"gold",options:s}}))}isWorkflowSync(t){var r,s;return(s=(r=this.triggers.get(t.type))==null?void 0:r.sync)!=null?s:t.sync}registerTrigger(t,r){if(typeof r=="function")this.triggers.register(t,new r);else if(r)this.triggers.register(t,r);else throw new TypeError("invalid trigger type to register")}registerInstruction(t,r){if(typeof r=="function")this.instructions.register(t,new r);else if(r instanceof ge)this.instructions.register(t,r);else throw new TypeError("invalid instruction type to register")}load(){return U(this,null,function*(){this.app.router.add("admin.workflow.workflows.id",{path:xe(":id"),element:n.jsx(Xo,{})}),this.app.router.add("admin.workflow.executions.id",{path:Ye(":id"),element:n.jsx(qo,{})}),this.app.addComponents({WorkflowPage:Xo,ExecutionPage:qo}),this.app.pluginSettingsManager.add(p,{icon:"PartitionOutlined",title:`{{t("Workflow", { ns: "${p}" })}}`,Component:Fn,aclSnippet:"pm.workflow.workflows"}),this.app.schemaSettingsManager.add(kr),this.registerTrigger("collection",Wn),this.registerTrigger("schedule",nr),this.registerInstruction("calculation",lr),this.registerInstruction("condition",ur),this.registerInstruction("end",pr),this.registerInstruction("query",gr),this.registerInstruction("create",xr),this.registerInstruction("update",wr),this.registerInstruction("destroy",Cr)})}}v.BaseTypeSets=Ze,v.Branch=Ke,v.CheckboxGroupWithTooltip=hr,v.CollectionBlockInitializer=Be,v.DetailsBlockProvider=fr,v.EXECUTION_STATUS=pe,v.ExecutionContextProvider=Sr,v.ExecutionStatusOptions=He,v.ExecutionStatusOptionsMap=Ge,v.FieldsSelect=To,v.FilterDynamicComponent=oo,v.FlowContext=Ie,v.Instruction=ge,v.JOB_STATUS=ie,v.JobButton=Co,v.JobStatusOptions=vo,v.JobStatusOptionsMap=qe,v.Node=Ho,v.NodeContext=xo,v.NodeDefaultView=ko,v.RadioWithTooltip=Te,v.RemoveButton=wo,v.SimpleDesigner=kt,v.Trigger=So,v.ValueBlock=Ne,v.WorkflowVariableInput=lt,v.WorkflowVariableJSON=In,v.WorkflowVariableRawTextArea=Dn,v.WorkflowVariableTextArea=Io,v.default=de,v.defaultFieldNames=Ae,v.getCollectionFieldOptions=Fe,v.getWorkflowDetailPath=xe,v.getWorkflowExecutionsPath=Ye,v.linkNodes=Fo,v.nodesOptions=ot,v.scopeOptions=nt,v.systemOptions=rt,v.traverseSchema=Oo,v.triggerOptions=tt,v.useAvailableUpstreams=Jo,v.useFlowContext=G,v.useGetAriaLabelOfAddButton=bo,v.useGetCollectionFields=je,v.useNodeContext=ve,v.useNodeSavedConfig=Me,v.useRecordTriggerWorkflowsActionProps=Mn,v.useStyles=ne,v.useTrigger=Ao,v.useTriggerWorkflowsActionProps=Pn,v.useUpstreamScopes=Uo,v.useWorkflowAnyExecuted=it,v.useWorkflowExecuted=Bn,v.useWorkflowVariableOptions=me,Object.defineProperties(v,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/externalVersion.js
CHANGED
|
@@ -11,24 +11,24 @@ module.exports = {
|
|
|
11
11
|
"react": "18.2.0",
|
|
12
12
|
"antd": "5.12.8",
|
|
13
13
|
"@ant-design/icons": "5.2.6",
|
|
14
|
-
"@nocobase/client": "1.2.
|
|
14
|
+
"@nocobase/client": "1.2.25-alpha",
|
|
15
15
|
"react-router-dom": "6.21.0",
|
|
16
|
-
"@nocobase/utils": "1.2.
|
|
16
|
+
"@nocobase/utils": "1.2.25-alpha",
|
|
17
17
|
"react-i18next": "11.18.6",
|
|
18
18
|
"@formily/core": "2.3.0",
|
|
19
19
|
"@formily/react": "2.3.0",
|
|
20
20
|
"lodash": "4.17.21",
|
|
21
|
-
"@nocobase/database": "1.2.
|
|
22
|
-
"@nocobase/server": "1.2.
|
|
23
|
-
"@nocobase/logger": "1.2.
|
|
24
|
-
"@nocobase/evaluators": "1.2.
|
|
21
|
+
"@nocobase/database": "1.2.25-alpha",
|
|
22
|
+
"@nocobase/server": "1.2.25-alpha",
|
|
23
|
+
"@nocobase/logger": "1.2.25-alpha",
|
|
24
|
+
"@nocobase/evaluators": "1.2.25-alpha",
|
|
25
25
|
"@formily/antd-v5": "1.1.9",
|
|
26
26
|
"@formily/reactive": "2.3.0",
|
|
27
27
|
"@formily/shared": "2.3.0",
|
|
28
|
-
"@nocobase/actions": "1.2.
|
|
29
|
-
"@nocobase/data-source-manager": "1.2.
|
|
28
|
+
"@nocobase/actions": "1.2.25-alpha",
|
|
29
|
+
"@nocobase/data-source-manager": "1.2.25-alpha",
|
|
30
30
|
"sequelize": "6.35.2",
|
|
31
|
-
"@nocobase/plugin-workflow-test": "1.2.
|
|
32
|
-
"@nocobase/test": "1.2.
|
|
31
|
+
"@nocobase/plugin-workflow-test": "1.2.25-alpha",
|
|
32
|
+
"@nocobase/test": "1.2.25-alpha",
|
|
33
33
|
"dayjs": "1.11.10"
|
|
34
34
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"cron-parser","version":"4.4.0","description":"Node.js library for parsing crontab instructions","main":"lib/parser.js","types":"index.d.ts","typesVersions":{"<4.1":{"*":["types/ts3/*"]}},"directories":{"test":"test"},"scripts":{"test:tsd":"tsd","test:unit":"TZ=UTC tap ./test/*.js","test:cover":"TZ=UTC tap --coverage-report=html ./test/*.js","lint":"eslint .","lint:fix":"eslint --fix .","test":"npm run lint && npm run test:unit && npm run test:tsd"},"repository":{"type":"git","url":"https://github.com/harrisiirak/cron-parser.git"},"keywords":["cron","crontab","parser"],"author":"Harri Siirak","contributors":["Nicholas Clawson","Daniel Prentis <daniel@salsitasoft.com>","Renault John Lecoultre","Richard Astbury <richard.astbury@gmail.com>","Meaglin Wasabi <Meaglin.wasabi@gmail.com>","Mike Kusold <hello@mikekusold.com>","Alex Kit <alex.kit@atmajs.com>","Santiago Gimeno <santiago.gimeno@gmail.com>","Daniel <darc.tec@gmail.com>","Christian Steininger <christian.steininger.cs@gmail.com>","Mykola Piskovyi <m.piskovyi@gmail.com>","Brian Vaughn <brian.david.vaughn@gmail.com>","Nicholas Clawson <nickclaw@gmail.com>","Yasuhiroki <yasuhiroki.duck@gmail.com>","Nicholas Clawson <nickclaw@gmail.com>","Brendan Warkentin <faazshift@gmail.com>","Charlie Fish <fishcharlie.code@gmail.com>","Ian Graves <ian+diskimage@iangrav.es>","Andy Thompson <me@andytson.com>","Regev Brody <regevbr@gmail.com>"],"license":"MIT","dependencies":{"luxon":"^1.28.0"},"devDependencies":{"eslint":"^8.2.0","sinon":"^10.0.0","tap":"^16.0.1","tsd":"^0.19.0"},"engines":{"node":">=0.8"},"browser":{"fs":false},"tap":{"check-coverage":false},"tsd":{"directory":"test","compilerOptions":{"lib":["es2017","dom"]}},"_lastModified":"2024-07-
|
|
1
|
+
{"name":"cron-parser","version":"4.4.0","description":"Node.js library for parsing crontab instructions","main":"lib/parser.js","types":"index.d.ts","typesVersions":{"<4.1":{"*":["types/ts3/*"]}},"directories":{"test":"test"},"scripts":{"test:tsd":"tsd","test:unit":"TZ=UTC tap ./test/*.js","test:cover":"TZ=UTC tap --coverage-report=html ./test/*.js","lint":"eslint .","lint:fix":"eslint --fix .","test":"npm run lint && npm run test:unit && npm run test:tsd"},"repository":{"type":"git","url":"https://github.com/harrisiirak/cron-parser.git"},"keywords":["cron","crontab","parser"],"author":"Harri Siirak","contributors":["Nicholas Clawson","Daniel Prentis <daniel@salsitasoft.com>","Renault John Lecoultre","Richard Astbury <richard.astbury@gmail.com>","Meaglin Wasabi <Meaglin.wasabi@gmail.com>","Mike Kusold <hello@mikekusold.com>","Alex Kit <alex.kit@atmajs.com>","Santiago Gimeno <santiago.gimeno@gmail.com>","Daniel <darc.tec@gmail.com>","Christian Steininger <christian.steininger.cs@gmail.com>","Mykola Piskovyi <m.piskovyi@gmail.com>","Brian Vaughn <brian.david.vaughn@gmail.com>","Nicholas Clawson <nickclaw@gmail.com>","Yasuhiroki <yasuhiroki.duck@gmail.com>","Nicholas Clawson <nickclaw@gmail.com>","Brendan Warkentin <faazshift@gmail.com>","Charlie Fish <fishcharlie.code@gmail.com>","Ian Graves <ian+diskimage@iangrav.es>","Andy Thompson <me@andytson.com>","Regev Brody <regevbr@gmail.com>"],"license":"MIT","dependencies":{"luxon":"^1.28.0"},"devDependencies":{"eslint":"^8.2.0","sinon":"^10.0.0","tap":"^16.0.1","tsd":"^0.19.0"},"engines":{"node":">=0.8"},"browser":{"fs":false},"tap":{"check-coverage":false},"tsd":{"directory":"test","compilerOptions":{"lib":["es2017","dom"]}},"_lastModified":"2024-07-27T07:48:20.074Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"lru-cache","description":"A cache object that deletes the least-recently-used items.","version":"8.0.5","author":"Isaac Z. Schlueter <i@izs.me>","keywords":["mru","lru","cache"],"sideEffects":false,"scripts":{"build":"npm run prepare","preprepare":"rm -rf dist","prepare":"tsc -p tsconfig.json && tsc -p tsconfig-esm.json","postprepare":"bash fixup.sh","pretest":"npm run prepare","presnap":"npm run prepare","test":"c8 tap","snap":"c8 tap","preversion":"npm test","postversion":"npm publish","prepublishOnly":"git push origin --follow-tags","format":"prettier --write .","typedoc":"typedoc --tsconfig tsconfig-esm.json ./src/*.ts","benchmark-results-typedoc":"bash scripts/benchmark-results-typedoc.sh","prebenchmark":"npm run prepare","benchmark":"make -C benchmark","preprofile":"npm run prepare","profile":"make -C benchmark profile"},"main":"./dist/cjs/index-cjs.js","module":"./dist/mjs/index.js","types":"./dist/mjs/index.d.ts","exports":{"./min":{"import":{"types":"./dist/mjs/index.d.ts","default":"./dist/mjs/index.min.js"},"require":{"types":"./dist/cjs/index.d.ts","default":"./dist/cjs/index.min.js"}},".":{"import":{"types":"./dist/mjs/index.d.ts","default":"./dist/mjs/index.js"},"require":{"types":"./dist/cjs/index.d.ts","default":"./dist/cjs/index-cjs.js"}}},"repository":"git://github.com/isaacs/node-lru-cache.git","devDependencies":{"@size-limit/preset-small-lib":"^7.0.8","@types/node":"^17.0.31","@types/tap":"^15.0.6","benchmark":"^2.1.4","c8":"^7.11.2","clock-mock":"^1.0.6","esbuild":"^0.17.11","eslint-config-prettier":"^8.5.0","marked":"^4.2.12","mkdirp":"^2.1.5","prettier":"^2.6.2","size-limit":"^7.0.8","tap":"^16.3.4","ts-node":"^10.7.0","tslib":"^2.4.0","typedoc":"^0.23.24","typescript":"^4.6.4"},"license":"ISC","files":["dist"],"engines":{"node":">=16.14"},"prettier":{"semi":false,"printWidth":70,"tabWidth":2,"useTabs":false,"singleQuote":true,"jsxSingleQuote":false,"bracketSameLine":true,"arrowParens":"avoid","endOfLine":"lf"},"tap":{"coverage":false,"node-arg":["--expose-gc","--no-warnings","--loader","ts-node/esm"],"ts":false},"size-limit":[{"path":"./dist/mjs/index.js"}],"_lastModified":"2024-07-
|
|
1
|
+
{"name":"lru-cache","description":"A cache object that deletes the least-recently-used items.","version":"8.0.5","author":"Isaac Z. Schlueter <i@izs.me>","keywords":["mru","lru","cache"],"sideEffects":false,"scripts":{"build":"npm run prepare","preprepare":"rm -rf dist","prepare":"tsc -p tsconfig.json && tsc -p tsconfig-esm.json","postprepare":"bash fixup.sh","pretest":"npm run prepare","presnap":"npm run prepare","test":"c8 tap","snap":"c8 tap","preversion":"npm test","postversion":"npm publish","prepublishOnly":"git push origin --follow-tags","format":"prettier --write .","typedoc":"typedoc --tsconfig tsconfig-esm.json ./src/*.ts","benchmark-results-typedoc":"bash scripts/benchmark-results-typedoc.sh","prebenchmark":"npm run prepare","benchmark":"make -C benchmark","preprofile":"npm run prepare","profile":"make -C benchmark profile"},"main":"./dist/cjs/index-cjs.js","module":"./dist/mjs/index.js","types":"./dist/mjs/index.d.ts","exports":{"./min":{"import":{"types":"./dist/mjs/index.d.ts","default":"./dist/mjs/index.min.js"},"require":{"types":"./dist/cjs/index.d.ts","default":"./dist/cjs/index.min.js"}},".":{"import":{"types":"./dist/mjs/index.d.ts","default":"./dist/mjs/index.js"},"require":{"types":"./dist/cjs/index.d.ts","default":"./dist/cjs/index-cjs.js"}}},"repository":"git://github.com/isaacs/node-lru-cache.git","devDependencies":{"@size-limit/preset-small-lib":"^7.0.8","@types/node":"^17.0.31","@types/tap":"^15.0.6","benchmark":"^2.1.4","c8":"^7.11.2","clock-mock":"^1.0.6","esbuild":"^0.17.11","eslint-config-prettier":"^8.5.0","marked":"^4.2.12","mkdirp":"^2.1.5","prettier":"^2.6.2","size-limit":"^7.0.8","tap":"^16.3.4","ts-node":"^10.7.0","tslib":"^2.4.0","typedoc":"^0.23.24","typescript":"^4.6.4"},"license":"ISC","files":["dist"],"engines":{"node":">=16.14"},"prettier":{"semi":false,"printWidth":70,"tabWidth":2,"useTabs":false,"singleQuote":true,"jsxSingleQuote":false,"bracketSameLine":true,"arrowParens":"avoid","endOfLine":"lf"},"tap":{"coverage":false,"node-arg":["--expose-gc","--no-warnings","--loader","ts-node/esm"],"ts":false},"size-limit":[{"path":"./dist/mjs/index.js"}],"_lastModified":"2024-07-27T07:48:19.720Z"}
|
|
@@ -42,6 +42,7 @@ module.exports = __toCommonJS(CollectionTrigger_exports);
|
|
|
42
42
|
var import__ = __toESM(require("."));
|
|
43
43
|
var import_utils = require("../utils");
|
|
44
44
|
var import_data_source_manager = require("@nocobase/data-source-manager");
|
|
45
|
+
var import_utils2 = require("@nocobase/utils");
|
|
45
46
|
const MODE_BITMAP = {
|
|
46
47
|
CREATE: 1,
|
|
47
48
|
UPDATE: 2,
|
|
@@ -62,7 +63,7 @@ function getFieldRawName(collection, name) {
|
|
|
62
63
|
return name;
|
|
63
64
|
}
|
|
64
65
|
async function handler(workflow, data, options) {
|
|
65
|
-
var _a
|
|
66
|
+
var _a;
|
|
66
67
|
const { condition, changed, mode, appends } = workflow.config;
|
|
67
68
|
const [dataSourceName, collectionName] = (0, import_data_source_manager.parseCollectionName)(workflow.config.collection);
|
|
68
69
|
const collection = (_a = this.workflow.app.dataSourceManager) == null ? void 0 : _a.dataSources.get(dataSourceName).collectionManager.getCollection(collectionName);
|
|
@@ -73,7 +74,7 @@ async function handler(workflow, data, options) {
|
|
|
73
74
|
).every((name) => !data.changedWithAssociations(getFieldRawName(collection, name)))) {
|
|
74
75
|
return;
|
|
75
76
|
}
|
|
76
|
-
if (
|
|
77
|
+
if ((0, import_utils2.isValidFilter)(condition) && !(mode & MODE_BITMAP.DESTROY)) {
|
|
77
78
|
const count = await repository.count({
|
|
78
79
|
filter: {
|
|
79
80
|
$and: [condition, { [filterTargetKey]: data[filterTargetKey] }]
|
|
@@ -61,7 +61,7 @@ function getDataOptionTime(record, on, dir = 1) {
|
|
|
61
61
|
}
|
|
62
62
|
case "object": {
|
|
63
63
|
const { field, offset = 0, unit = 1e3 } = on;
|
|
64
|
-
if (!record.get(field)) {
|
|
64
|
+
if (!field || !record.get(field)) {
|
|
65
65
|
return null;
|
|
66
66
|
}
|
|
67
67
|
const second = new Date(record.get(field).getTime());
|
package/package.json
CHANGED
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
"displayName.zh-CN": "工作流",
|
|
5
5
|
"description": "A powerful BPM tool that provides foundational support for business automation, with the capability to extend unlimited triggers and nodes.",
|
|
6
6
|
"description.zh-CN": "一个强大的 BPM 工具,为业务自动化提供基础支持,并且可任意扩展更多的触发器和节点。",
|
|
7
|
-
"version": "1.2.
|
|
7
|
+
"version": "1.2.25-alpha",
|
|
8
8
|
"license": "AGPL-3.0",
|
|
9
9
|
"main": "./dist/server/index.js",
|
|
10
10
|
"homepage": "https://docs.nocobase.com/handbook/workflow",
|
|
11
11
|
"homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/workflow",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@nocobase/plugin-workflow-test": "1.2.
|
|
13
|
+
"@nocobase/plugin-workflow-test": "1.2.25-alpha"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@ant-design/icons": "5.x",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@nocobase/test": "1.x",
|
|
45
45
|
"@nocobase/utils": "1.x"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "72a6f9a73afc615b7f16fac6197ad44c29bf1e0f",
|
|
48
48
|
"keywords": [
|
|
49
49
|
"Workflow"
|
|
50
50
|
]
|