@nocobase/plugin-workflow 0.21.0-alpha.2 → 0.21.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/client/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(g,r){typeof exports=="object"&&typeof module!="undefined"?r(exports,require("react/jsx-runtime"),require("@nocobase/client"),require("@nocobase/utils/client"),require("react-router-dom"),require("react"),require("antd"),require("@ant-design/icons"),require("react-i18next"),require("@formily/core"),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","@ant-design/icons","react-i18next","@formily/core","@formily/react","lodash","@formily/shared","dayjs","@nocobase/evaluators/client","@formily/antd-v5"],r):(g=typeof globalThis!="undefined"?globalThis:g||self,r(g["@nocobase/plugin-workflow"]={},g.jsxRuntime,g["@nocobase/client"],g["@nocobase/utils"],g["react-router-dom"],g.react,g.antd,g["@ant-design/icons"],g["react-i18next"],g["@formily/core"],g["@formily/react"],g.lodash,g["@formily/shared"],g.dayjs,g["@nocobase/evaluators"],g["@formily/antd-v5"]))})(this,function(g,r,i,H,oe,b,y,M,_,he,j,ut,Dt,Wo,De,Lo){"use strict";var hr=Object.defineProperty,yr=Object.defineProperties;var gr=Object.getOwnPropertyDescriptors;var ct=Object.getOwnPropertySymbols;var Bo=Object.prototype.hasOwnProperty,Vo=Object.prototype.propertyIsEnumerable;var Nt=(g,r,i)=>r in g?hr(g,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):g[r]=i,C=(g,r)=>{for(var i in r||(r={}))Bo.call(r,i)&&Nt(g,i,r[i]);if(ct)for(var i of ct(r))Vo.call(r,i)&&Nt(g,i,r[i]);return g},T=(g,r)=>yr(g,gr(r));var jo=g=>typeof g=="symbol"?g:g+"",Q=(g,r)=>{var i={};for(var H in g)Bo.call(g,H)&&r.indexOf(H)<0&&(i[H]=g[H]);if(g!=null&&ct)for(var H of ct(g))r.indexOf(H)<0&&Vo.call(g,H)&&(i[H]=g[H]);return i};var w=(g,r,i)=>(Nt(g,typeof r!="symbol"?r+"":r,i),i);var Y=(g,r,i)=>new Promise((H,oe)=>{var b=_=>{try{M(i.next(_))}catch(he){oe(he)}},y=_=>{try{M(i.throw(_))}catch(he){oe(he)}},M=_=>_.done?H(_.value):Promise.resolve(_.value).then(b,y);M((i=i.apply(g,r)).next())});const Ee=b.createContext({});function q(){return b.useContext(Ee)}const p="workflow";function E(e,t={}){return i.i18n.t(e,T(C({},t),{ns:p}))}function dt(){return _.useTranslation(p)}const ne=i.createStyles(({css:e,token:t})=>({workflowPageClass:e`
|
|
2
2
|
flex-grow: 1;
|
|
3
3
|
overflow: hidden;
|
|
4
4
|
display: flex;
|
|
@@ -350,12 +350,12 @@
|
|
|
350
350
|
border-radius: 50%;
|
|
351
351
|
background-color: ${t.colorText};
|
|
352
352
|
color: ${t.colorBgContainer};
|
|
353
|
-
`}));function Et(e){var v;const{upstream:t,branchIndex:o=null}=e,n=i.usePlugin(ce),s=i.useCompile(),a=i.useAPIClient(),{workflow:l,refresh:c}=(v=q())!=null?v:{},u=Array.from(n.instructions.getValues()),{styles:d}=ne(),
|
|
353
|
+
`}));function Et(e){var v;const{upstream:t,branchIndex:o=null}=e,n=i.usePlugin(ce),s=i.useCompile(),a=i.useAPIClient(),{workflow:l,refresh:c}=(v=q())!=null?v:{},u=Array.from(n.instructions.getValues()),{styles:d}=ne(),f=b.useMemo(()=>[{key:"control",label:`{{t("Control", { ns: "${p}" })}}`},{key:"collection",label:`{{t("Collection operations", { ns: "${p}" })}}`},{key:"manual",label:`{{t("Manual", { ns: "${p}" })}}`},{key:"extended",label:`{{t("Extended types", { ns: "${p}" })}}`}].map(m=>{const k=u.filter(S=>S.group===m.key&&(S.isAvailable?S.isAvailable({engine:n,workflow:l,upstream:t,branchIndex:o}):!0));return T(C({},m),{type:"group",children:k.map(S=>({role:"button","aria-label":S.type,key:S.type,label:S.title,type:S.options?"subMenu":null,children:S.options?S.options.map(N=>({role:"button","aria-label":N.key,key:N.key,label:N.label})):null}))})}).filter(m=>m.children.length),[o,n,u,t,l]),h=b.useCallback(k=>Y(this,[k],function*({keyPath:m}){var z,U,F;const S=m.pop(),N={},[A]=m,P=n.instructions.get(S);if(A){const{value:$}=(U=(z=P.options)==null?void 0:z.find(O=>O.key===A))!=null?U:{};Object.assign(N,typeof $=="function"?$():$)}l&&(yield a.resource("workflows.nodes",l.id).create({values:{type:S,upstreamId:(F=t==null?void 0:t.id)!=null?F:null,branchIndex:o,title:s(P.title),config:N}}),c())}),[a,o,n.instructions,c,t==null?void 0:t.id,l]),x=b.useMemo(()=>({onClick:h,items:s(f)}),[f,h]);return l?r.jsx("div",{className:d.addButtonClass,children:r.jsx(y.Dropdown,{trigger:["click"],menu:x,disabled:l.executed,overlayClassName:i.css`
|
|
354
354
|
.ant-dropdown-menu-root {
|
|
355
355
|
max-height: 30em;
|
|
356
356
|
overflow-y: auto;
|
|
357
357
|
}
|
|
358
|
-
`,children:r.jsx(
|
|
358
|
+
`,children:r.jsx(y.Button,{"aria-label":e["aria-label"]||"add-button",shape:"circle",icon:r.jsx(M.PlusOutlined,{})})})}):null}const pt=(e,t)=>({getAriaLabel:b.useCallback(n=>["add-button",e==null?void 0:e.type,e==null?void 0:e.title,t!=null?String(t):"",n].filter(Boolean).join("-"),[t,e==null?void 0:e.title,e==null?void 0:e.type])}),zo=i.createStyles(({css:e,token:t})=>({container:e`
|
|
359
359
|
margin-bottom: 1.5em;
|
|
360
360
|
padding: 1em;
|
|
361
361
|
background-color: ${t.colorFillAlter};
|
|
@@ -380,7 +380,7 @@
|
|
|
380
380
|
p {
|
|
381
381
|
color: ${t.colorTextDescription};
|
|
382
382
|
}
|
|
383
|
-
`}));function $t(e){const{label:t,title:o,description:n}=e,{styles:s}=zo();return r.jsxs("div",{className:i.cx(s.container,e.className),children:[r.jsxs("dl",{children:[r.jsx("dt",{children:t}),r.jsx("dd",{children:r.jsx(
|
|
383
|
+
`}));function $t(e){const{label:t,title:o,description:n}=e,{styles:s}=zo();return r.jsxs("div",{className:i.cx(s.container,e.className),children:[r.jsxs("dl",{children:[r.jsx("dt",{children:t}),r.jsx("dd",{children:r.jsx(y.Tag,{style:{background:"none"},children:o})})]}),n?r.jsx("p",{children:n}):null]})}function Ho(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Mt={exports:{}};/*!
|
|
384
384
|
Copyright (c) 2018 Jed Watson.
|
|
385
385
|
Licensed under the MIT License (MIT), see
|
|
386
386
|
http://jedwatson.github.io/classnames
|
|
@@ -396,7 +396,7 @@
|
|
|
396
396
|
}
|
|
397
397
|
`,noStatusButtonClass:e`
|
|
398
398
|
border-width: 2px;
|
|
399
|
-
`}));function $e(e){var n;const{styles:t}=_o();let o=null;if(typeof e.status!="undefined"&&((n=e.statusMap)!=null&&n[e.status])){const{icon:s,color:a}=e.statusMap[e.status];o=r.jsx(
|
|
399
|
+
`}));function $e(e){var n;const{styles:t}=_o();let o=null;if(typeof e.status!="undefined"&&((n=e.statusMap)!=null&&n[e.status])){const{icon:s,color:a}=e.statusMap[e.status];o=r.jsx(y.Tag,{color:a,children:s})}return r.jsx(y.Button,T(C({},e),{shape:"circle",size:"small",className:Uo(o?t.statusButtonClass:t.noStatusButtonClass,e.className),children:o}))}const de={QUEUEING:null,STARTED:0,RESOLVED:1,FAILED:-1,ERROR:-2,ABORTED:-3,CANCELED:-4,REJECTED:-5,RETRY_NEEDED:-6},ze=[{value:de.QUEUEING,label:`{{t("Queueing", { ns: "${p}" })}}`,color:"blue",icon:r.jsx(M.HourglassOutlined,{}),description:`{{t("Triggered but still waiting in queue to execute.", { ns: "${p}" })}}`},{value:de.STARTED,label:`{{t("On going", { ns: "${p}" })}}`,color:"gold",icon:r.jsx(M.LoadingOutlined,{}),description:`{{t("Started and executing, maybe waiting for an async callback (manual, delay etc.).", { ns: "${p}" })}}`},{value:de.RESOLVED,label:`{{t("Resolved", { ns: "${p}" })}}`,color:"green",icon:r.jsx(M.CheckOutlined,{}),description:`{{t("Successfully finished.", { ns: "${p}" })}}`},{value:de.FAILED,label:`{{t("Failed", { ns: "${p}" })}}`,color:"red",icon:r.jsx(M.ExclamationOutlined,{}),description:`{{t("Failed to satisfy node configurations.", { ns: "${p}" })}}`},{value:de.ERROR,label:`{{t("Error", { ns: "${p}" })}}`,color:"red",icon:r.jsx(M.CloseOutlined,{}),description:`{{t("Some node meets error.", { ns: "${p}" })}}`},{value:de.ABORTED,label:`{{t("Aborted", { ns: "${p}" })}}`,color:"red",icon:r.jsx(M.MinusOutlined,{rotate:90}),description:`{{t("Running of some node was aborted by program flow.", { ns: "${p}" })}}`},{value:de.CANCELED,label:`{{t("Canceled", { ns: "${p}" })}}`,color:"volcano",icon:r.jsx(M.MinusOutlined,{rotate:45}),description:`{{t("Manually canceled whole execution when waiting.", { ns: "${p}" })}}`},{value:de.REJECTED,label:`{{t("Rejected", { ns: "${p}" })}}`,color:"volcano",icon:r.jsx(M.MinusOutlined,{}),description:`{{t("Rejected from a manual node.", { ns: "${p}" })}}`},{value:de.RETRY_NEEDED,label:`{{t("Retry needed", { ns: "${p}" })}}`,color:"volcano",icon:r.jsx(M.RedoOutlined,{}),description:`{{t("General failed but should do another try.", { ns: "${p}" })}}`}],He=ze.reduce((e,t)=>Object.assign(e,{[t.value]:t}),{}),ie={PENDING:0,RESOLVED:1,FAILED:-1,ERROR:-2,ABORTED:-3,CANCELED:-4,REJECTED:-5,RETRY_NEEDED:-6},mt=[{value:ie.PENDING,label:`{{t("Pending", { ns: "${p}" })}}`,color:"gold",icon:r.jsx(M.ClockCircleOutlined,{})},{value:ie.RESOLVED,label:`{{t("Resolved", { ns: "${p}" })}}`,color:"green",icon:r.jsx(M.CheckOutlined,{})},{value:ie.FAILED,label:`{{t("Failed", { ns: "${p}" })}}`,color:"red",icon:r.jsx(M.ExclamationOutlined,{})},{value:ie.ERROR,label:`{{t("Error", { ns: "${p}" })}}`,color:"red",icon:r.jsx(M.CloseOutlined,{})},{value:ie.ABORTED,label:`{{t("Aborted", { ns: "${p}" })}}`,color:"red",icon:r.jsx(M.MinusOutlined,{rotate:90})},{value:ie.CANCELED,label:`{{t("Canceled", { ns: "${p}" })}}`,color:"volcano",icon:r.jsx(M.MinusOutlined,{rotate:45})},{value:ie.REJECTED,label:`{{t("Rejected", { ns: "${p}" })}}`,color:"volcano",icon:r.jsx(M.MinusOutlined,{})},{value:ie.RETRY_NEEDED,label:`{{t("Retry needed", { ns: "${p}" })}}`,color:"volcano",icon:r.jsx(M.RedoOutlined,{})}],Je=mt.reduce((e,t)=>Object.assign(e,{[t.value]:t}),{});class ye{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")}}function Go(){const e=j.useForm(),t=i.useAPIClient(),o=i.useActionContext(),{refresh:n}=i.useResourceActionContext(),s=Ce(),{workflow:a}=q();return{run(){return Y(this,null,function*(){var c,u;if(a.executed){y.message.error(E("Node in executed workflow cannot be modified"));return}yield e.submit(),yield(u=(c=t.resource("flow_nodes")).update)==null?void 0:u.call(c,{filterByTk:s.id,values:{config:e.values}}),o.setFormValueChanged(!1),o.setVisible(!1),n()})}}}const ft=b.createContext({});function Ce(){return b.useContext(ft)}function It(e,t){const o=[];if(!e)return[];for(let n=e.upstream;n;n=n.upstream)(typeof t!="function"||t(n))&&o.push(n);return o}function Pt(e){const t=[];if(!e)return[];for(let o=e;o;o=o.upstream)o.upstream&&o.branchIndex!=null&&t.push(o.upstream);return t}function Bt({data:e}){const{styles:t}=ne(),{getAriaLabel:o}=pt(e),n=i.usePlugin(ce),{Component:s=ht,end:a}=n.instructions.get(e.type);return r.jsx(ft.Provider,{value:e,children:r.jsxs("div",{className:i.cx(t.nodeBlockClass),children:[r.jsx(s,{data:e}),!a||typeof a=="function"&&!a(e)?r.jsx(Et,{"aria-label":o(),upstream:e}):r.jsx("div",{className:"end-sign",children:r.jsx(M.CloseOutlined,{})})]})})}function Vt(){var d;const{t:e}=_.useTranslation(),t=i.useAPIClient(),{workflow:o,nodes:n,refresh:s}=(d=q())!=null?d:{},a=Ce(),{modal:l}=y.App.useApp();if(!o)return null;const c=t.resource("flow_nodes");function u(){return Y(this,null,function*(){function f(){return Y(this,null,function*(){var m;yield(m=c.destroy)==null?void 0:m.call(c,{filterByTk:a.id}),s()})}const h=n.filter(m=>m===a?!1:H.parse(m.config).parameters.filter(({key:N})=>N.startsWith(`$jobsMapByNodeKey.${a.key}.`)||N===`$jobsMapByNodeKey.${a.key}`).length);if(h.length){l.error({title:E("Can not delete"),content:E("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 v=!n.find(m=>m.upstream===a&&m.branchIndex!=null)?e("Are you sure you want to delete it?"):E("This node contains branches, deleting will also be preformed to them, are you sure?");l.confirm({title:e("Delete"),content:v,onOk:f})})}return o.executed?null:r.jsx(y.Button,{type:"text",shape:"circle",icon:r.jsx(M.DeleteOutlined,{}),onClick:u,className:"workflow-node-remove-button"})}function jt(){var a;const{execution:e,setViewJob:t}=q(),{jobs:o}=(a=Ce())!=null?a:{},{styles:n}=ne();if(!e)return null;if(!o.length)return r.jsx($e,{className:n.nodeJobButtonClass,disabled:!0});function s({key:l}){const c=o.find(u=>u.id==l);t(c)}return o.length>1?r.jsx(y.Dropdown,{menu:{items:o.map(l=>({key:l.id,label:r.jsxs(r.Fragment,{children:[r.jsx($e,{statusMap:Je,status:l.status}),r.jsx("time",{children:H.str2moment(l.updatedAt).format("YYYY-MM-DD HH:mm:ss")})]})})),onClick:s,className:n.dropdownClass},children:r.jsx($e,{statusMap:Je,status:o[o.length-1].status,className:n.nodeJobButtonClass})}):r.jsx($e,{statusMap:Je,status:o[0].status,onClick:()=>t(o[0]),className:n.nodeJobButtonClass})}function Yo(){return{form:j.useForm()}}function ht(e){var F,$;const{data:t,children:o}=e,n=i.useCompile(),s=i.useAPIClient(),{workflow:a,refresh:l}=(F=q())!=null?F:{},{styles:c}=ne(),d=i.usePlugin(ce).instructions.get(t.type),f=a.executed?'{{t("View")}}':'{{t("Configure")}}',h=n(d.title),[x,v]=b.useState(($=t.title)!=null?$:h),[m,k]=b.useState(!1),[S,N]=b.useState(!1),A=b.useMemo(()=>{const O=ut.cloneDeep(t.config);return he.createForm({initialValues:O,disabled:a.executed})},[t,a]),P=b.useCallback(O=>{k(O),O||A.reset()},[A]),z=b.useCallback(function(O){return Y(this,null,function*(){var L,J;const I=O||h;v(I),I!==t.title&&(yield(J=(L=s.resource("flow_nodes")).update)==null?void 0:J.call(L,{filterByTk:t.id,values:{title:I}}),l())})},[t]),U=b.useCallback(function(O){if(O.target===O.currentTarget){k(!0);return}const I=new Set(["workflow-node-meta","workflow-node-config-button","ant-input-disabled"]);for(let L=O.target;L&&L!==O.currentTarget&&L!==document.documentElement;L=L.parentNode)if(Array.from(L.classList).some(J=>I.has(J))){k(!0),O.stopPropagation();return}},[]);return r.jsxs("div",{className:i.cx(c.nodeClass,`workflow-node-type-${t.type}`),children:[r.jsxs("div",{role:"button","aria-label":`${h}-${x}`,className:i.cx(c.nodeCardClass,{configuring:m}),onClick:U,children:[r.jsxs("div",{className:i.cx(c.nodeMetaClass,"workflow-node-meta"),children:[r.jsx(y.Tag,{children:h}),r.jsx("span",{className:"workflow-node-id",children:t.id})]}),r.jsx(y.Input.TextArea,{disabled:a.executed,value:x,onChange:O=>v(O.target.value),onBlur:O=>z(O.target.value),autoSize:!0}),r.jsx(Vt,{}),r.jsx(jt,{}),r.jsx(i.ActionContextProvider,{value:{visible:m,setVisible:P,formValueChanged:S,setFormValueChanged:N},children:r.jsx(i.FormProvider,{form:A,children:r.jsx(i.SchemaComponent,{distributed:!1,scope:T(C({},d.scope),{useFormProviderProps:Yo}),components:d.components,schema:{type:"void",properties:T(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"}},[t.id]:{type:"void",title:r.jsxs("div",{className:i.css`
|
|
400
400
|
display: flex;
|
|
401
401
|
justify-content: space-between;
|
|
402
402
|
|
|
@@ -411,7 +411,7 @@
|
|
|
411
411
|
code {
|
|
412
412
|
font-weight: normal;
|
|
413
413
|
}
|
|
414
|
-
`,children:[r.jsx("strong",{children:t.title}),r.jsx(
|
|
414
|
+
`,children:[r.jsx("strong",{children:t.title}),r.jsx(y.Tooltip,{title:E("Variable key of node"),children:r.jsx(y.Tag,{children:r.jsx("code",{children:t.key})})})]}),"x-decorator":"FormV2","x-use-decorator-props":"useFormProviderProps","x-component":"Action.Drawer",properties:T(C({},d.description?{description:{type:"void","x-component":$t,"x-component-props":{label:E("Node type"),title:d.title,description:d.description}}}:{}),{fieldset:{type:"void","x-component":"fieldset","x-component-props":{className:i.css`
|
|
415
415
|
.ant-input,
|
|
416
416
|
.ant-select,
|
|
417
417
|
.ant-cascader-picker,
|
|
@@ -423,34 +423,34 @@
|
|
|
423
423
|
min-width: 6em;
|
|
424
424
|
}
|
|
425
425
|
}
|
|
426
|
-
`},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:Go}}}}})}})}})})})]}),o]})}function Ue({from:e=null,entry:t=null,branchIndex:o=null,controller:n=null,className:s,end:a}){const{styles:l}=ne(),{getAriaLabel:c}=pt(e,o),u=[];for(let d=t;d;d=d.downstream)u.push(d);return r.jsxs("div",{className:i.cx("workflow-branch",l.branchClass,s),children:[r.jsx("div",{className:"workflow-branch-lines"}),n,r.jsx(Et,{"aria-label":c(),upstream:e,branchIndex:o}),r.jsx("div",{className:"workflow-node-list",children:u.map(d=>r.jsx(Bt,{data:d},d.id))}),a?r.jsx("div",{className:"end-sign",children:r.jsx(M.CloseOutlined,{})}):null]})}function qo(){var a;const e=j.useForm(),t=i.useAPIClient(),{workflow:o}=(a=q())!=null?a:{},n=i.useActionContext(),{refresh:s}=i.useResourceActionContext();return{run(){return Y(this,null,function*(){if(o.executed){
|
|
426
|
+
`},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:Go}}}}})}})}})})})]}),o]})}function Ue({from:e=null,entry:t=null,branchIndex:o=null,controller:n=null,className:s,end:a}){const{styles:l}=ne(),{getAriaLabel:c}=pt(e,o),u=[];for(let d=t;d;d=d.downstream)u.push(d);return r.jsxs("div",{className:i.cx("workflow-branch",l.branchClass,s),children:[r.jsx("div",{className:"workflow-branch-lines"}),n,r.jsx(Et,{"aria-label":c(),upstream:e,branchIndex:o}),r.jsx("div",{className:"workflow-node-list",children:u.map(d=>r.jsx(Bt,{data:d},d.id))}),a?r.jsx("div",{className:"end-sign",children:r.jsx(M.CloseOutlined,{})}):null]})}function qo(){var a;const e=j.useForm(),t=i.useAPIClient(),{workflow:o}=(a=q())!=null?a:{},n=i.useActionContext(),{refresh:s}=i.useResourceActionContext();return{run(){return Y(this,null,function*(){if(o.executed){y.message.error(E("Trigger in executed workflow cannot be modified"));return}yield e.submit(),yield t.resource("workflows").update({filterByTk:o.id,values:{config:e.values}}),n.setFormValueChanged(!1),n.setVisible(!1),s()})}}}class yt{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 Ko(){const e=i.useCompile(),{workflow:t,execution:o}=q(),{styles:n}=ne(),s=gt();return o?r.jsx(i.SchemaComponent,{schema:{type:"void",name:"execution","x-component":"Action","x-component-props":{title:r.jsx(M.InfoOutlined,{}),shape:"circle",size:"small",className:n.nodeJobButtonClass,type:"primary"},properties:{[o.id]:{type:"void","x-decorator":"Form","x-decorator-props":{initialValue:o},"x-component":"Action.Modal",title:r.jsxs("div",{className:i.cx(n.nodeTitleClass),children:[r.jsx(y.Tag,{children:e(s.title)}),r.jsx("strong",{children:t.title}),r.jsxs("span",{className:"workflow-node-id",children:["#",o.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:i.css`
|
|
427
427
|
padding: 1em;
|
|
428
428
|
background-color: #eee;
|
|
429
|
-
`},"x-read-pretty":!0}}}}}}):null}function Zo(){return{form:j.useForm()}}const Qo=()=>{const e=i.useAPIClient(),{workflow:t,refresh:o}=q(),[n,s]=
|
|
429
|
+
`},"x-read-pretty":!0}}}}}}):null}function Zo(){return{form:j.useForm()}}const Qo=()=>{const e=i.useAPIClient(),{workflow:t,refresh:o}=q(),[n,s]=b.useState(""),[a,l]=b.useState(!1),[c,u]=b.useState(!1),{styles:d}=ne(),f=i.useCompile(),h=gt(),x=f(h.title),{fieldset:v,scope:m,components:k}=h,S=t.executed?'{{t("View")}}':'{{t("Configure")}}',N=E("Trigger");b.useEffect(()=>{var F,$;t&&s(($=(F=t.triggerTitle)!=null?F:t.title)!=null?$:x)},[t]);const A=b.useMemo(()=>{const F=ut.cloneDeep(t.config);return he.createForm({initialValues:F,disabled:t.executed})},[t]),P=b.useCallback(F=>{l(F),F||A.reset()},[A]),z=b.useCallback(function(F){return Y(this,null,function*(){const $=F||x;s($),$!==t.triggerTitle&&(yield e.resource("workflows").update({filterByTk:t.id,values:{triggerTitle:$}}),o())})},[t]),U=b.useCallback(function(F){var O;if(F.target===F.currentTarget){l(!0);return}const $=new Set(["workflow-node-meta","workflow-node-config-button","ant-input-disabled"]);for(let I=F.target;I&&I!==F.currentTarget;I=I.parentNode)if(Array.from((O=I.classList)!=null?O:[]).some(L=>$.has(L))){l(!0),F.stopPropagation();return}},[]);return r.jsxs("div",{role:"button","aria-label":`${N}-${n}`,className:i.cx(d.nodeCardClass),onClick:U,children:[r.jsx("div",{className:i.cx(d.nodeMetaClass,"workflow-node-meta"),children:r.jsx(y.Tag,{color:"gold",children:N})}),r.jsx("div",{children:r.jsx(y.Input.TextArea,{value:n,onChange:F=>s(F.target.value),onBlur:F=>z(F.target.value),autoSize:!0})}),r.jsx(Ko,{}),r.jsx(i.ActionContextProvider,{value:{visible:a,setVisible:P,formValueChanged:c,setFormValueChanged:u},children:r.jsx(i.FormProvider,{form:A,children:r.jsx(i.SchemaComponent,{scope:T(C({},m),{useFormProviderProps:Zo}),components:k,schema:{name:`workflow-trigger-${t.id}`,type:"void",properties:{config:{type:"void","x-content":S,"x-component":y.Button,"x-component-props":{type:"link",className:"workflow-node-config-button"}},drawer:{type:"void",title:N,"x-component":"Action.Drawer","x-decorator":"FormV2","x-use-decorator-props":"useFormProviderProps",properties:T(C({},h.description?{description:{type:"void","x-component":$t,"x-component-props":{label:E("Trigger type"),title:h.title,description:h.description}}}:{}),{fieldset:{type:"void","x-component":"fieldset","x-component-props":{className:i.css`
|
|
430
430
|
.ant-select.auto-width {
|
|
431
431
|
width: auto;
|
|
432
432
|
min-width: 6em;
|
|
433
433
|
}
|
|
434
|
-
`},properties:v},actions:C({},t.executed?{}:{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:qo}}}})})}}}})})})]})};function gt(){const e=i.usePlugin(ce),{workflow:t}=q();return e.triggers.get(t.type)}function Wt({entry:e}){const{styles:t}=ne(),{workflow:o}=q(),[n,s]=
|
|
434
|
+
`},properties:v},actions:C({},t.executed?{}:{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:qo}}}})})}}}})})})]})};function gt(){const e=i.usePlugin(ce),{workflow:t}=q();return e.triggers.get(t.type)}function Wt({entry:e}){const{styles:t}=ne(),{workflow:o}=q(),[n,s]=b.useState(100);return r.jsxs("div",{className:"workflow-canvas-wrapper",children:[r.jsx("div",{className:"workflow-canvas",style:{zoom:n/100},children:r.jsx("div",{className:i.cx(t.branchBlockClass,i.css`
|
|
435
435
|
margin-top: 0 !important;
|
|
436
|
-
`),children:r.jsxs("div",{className:t.branchClass,children:[o!=null&&o.executed?r.jsx(
|
|
436
|
+
`),children:r.jsxs("div",{className:t.branchClass,children:[o!=null&&o.executed?r.jsx(y.Alert,{type:"warning",message:E("Executed workflow cannot be modified"),showIcon:!0,className:i.css`
|
|
437
437
|
margin-bottom: 1em;
|
|
438
438
|
`}):null,r.jsx(Qo,{}),r.jsx("div",{className:i.cx(t.branchBlockClass,i.css`
|
|
439
439
|
margin-top: 0 !important;
|
|
440
|
-
`),children:r.jsx(Ue,{entry:e})}),r.jsx("div",{className:t.terminalClass,children:E("End")})]})})}),r.jsx("div",{className:"workflow-canvas-zoomer",children:r.jsx(h.Slider,{vertical:!0,reverse:!0,defaultValue:100,step:10,min:10,value:n,onChange:s})})]})}function bt(e){const t=new Map;e.forEach(o=>t.set(o.id,o));for(const o of t.values())o.upstreamId&&(o.upstream=t.get(o.upstreamId)),o.downstreamId&&(o.downstream=t.get(o.downstreamId))}function vt(e,t){t(e),e.properties&&Object.keys(e.properties).forEach(o=>{vt(e.properties[o],t)})}function ve(e){return`/admin/workflow/workflows/${e}`}function _e(e){return`/admin/workflow/executions/${e}`}function Xo(e,t=[]){const o=new Map;e.forEach(n=>{n.jobs=[],o.set(n.id,n)}),t.forEach(n=>{const s=o.get(n.nodeId);s.jobs.push(n),n.node={id:s.id,key:s.key,title:s.title,type:s.type}}),e.forEach(n=>{n.jobs=n.jobs.sort((s,a)=>s.id-a.id)})}function Ro(){const{instructions:e}=i.usePlugin(ce),t=i.useCompile(),{viewJob:o,setViewJob:n}=q(),{styles:s}=ne(),{node:a={}}=o!=null?o:{},l=e.get(a.type);return r.jsx(i.ActionContextProvider,{value:{visible:!!o,setVisible:n},children:r.jsx(i.SchemaComponent,{schema:{type:"void",properties:{[`${o==null?void 0:o.id}-${o==null?void 0:o.updatedAt}-modal`]:{type:"void","x-decorator":"Form","x-decorator-props":{initialValue:o},"x-component":"Action.Modal",title:r.jsxs("div",{className:s.nodeTitleClass,children:[r.jsx(h.Tag,{children:t(l==null?void 0:l.title)}),r.jsx("strong",{children:a.title}),r.jsxs("span",{className:"workflow-node-id",children:["#",a.id]})]}),properties:{status:{type:"number",title:`{{t("Status", { ns: "${m}" })}}`,"x-decorator":"FormItem","x-component":"Select",enum:mt,"x-read-pretty":!0},updatedAt:{type:"string",title:`{{t("Executed at", { ns: "${m}" })}}`,"x-decorator":"FormItem","x-component":"DatePicker","x-component-props":{showTime:!0},"x-read-pretty":!0},result:{type:"object",title:`{{t("Node result", { ns: "${m}" })}}`,"x-decorator":"FormItem","x-component":"Input.JSON","x-component-props":{className:s.nodeJobResultClass},"x-read-pretty":!0}}}}}})})}function en(e){const{execution:t}=q(),o=i.useAPIClient(),n=oe.useNavigate(),{styles:s}=ne(),[a,l]=g.useState([]),[c,u]=g.useState([]);g.useEffect(()=>{t&&o.resource("executions").list({filter:{key:t.key,id:{$lt:t.id}},sort:"-createdAt",pageSize:10,fields:["id","status","createdAt"]}).then(({data:p})=>{l(p.data)}).catch(()=>{})},[t]),g.useEffect(()=>{t&&o.resource("executions").list({filter:{key:t.key,id:{$gt:t.id}},sort:"createdAt",pageSize:10,fields:["id","status","createdAt"]}).then(({data:p})=>{u(p.data.reverse())}).catch(()=>{})},[t]);const d=g.useCallback(({key:p})=>{p!=t.id&&n(_e(p))},[t]);return t?r.jsx(h.Dropdown,{menu:{onClick:d,defaultSelectedKeys:[`${t.id}`],className:i.cx(s.dropdownClass,s.executionsDropdownRowClass),items:[...c,t,...a].map(p=>({key:p.id,label:r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"id",children:`#${p.id}`}),r.jsx("time",{children:H.str2moment(p.createdAt).format("YYYY-MM-DD HH:mm:ss")})]}),icon:r.jsx("span",{children:r.jsx($e,{statusMap:He,status:p.status})})}))},children:r.jsxs(h.Space,{children:[r.jsx("strong",{children:`#${t.id}`}),r.jsx(M.DownOutlined,{})]})}):null}function tn(){var A;const{t:e}=_.useTranslation(),t=i.useCompile(),{data:o,loading:n,refresh:s}=i.useResourceActionContext(),{setTitle:a}=i.useDocumentTitle(),[l,c]=g.useState(null),u=i.useApp(),d=i.useAPIClient();g.useEffect(()=>{var $;const{workflow:F}=($=o==null?void 0:o.data)!=null?$:{};a==null||a(`${F!=null&&F.title?`${F.title} - `:""}${E("Execution history")}`)},[o==null?void 0:o.data]);const p=g.useCallback(()=>{h.Modal.confirm({title:E("Cancel the execution"),icon:r.jsx(M.ExclamationCircleFilled,{}),content:E("Are you sure you want to cancel the execution?"),onOk:()=>{d.resource("executions").cancel({filterByTk:o==null?void 0:o.data.id}).then(()=>{h.message.success(e("Operation succeeded")),s()}).catch(F=>{console.error(F.data.error)})}})},[o==null?void 0:o.data]);if(!(o!=null&&o.data))return n?r.jsx(h.Spin,{}):r.jsx(h.Result,{status:"404",title:"Not found"});const P=(A=o==null?void 0:o.data)!=null?A:{},{jobs:b=[],workflow:z={}}=P,U=z,{nodes:x=[],revisions:v=[]}=U,f=Q(U,["nodes","revisions"]),k=Q(P,["jobs","workflow"]);bt(x),Xo(x,b);const S=x.find(F=>!F.upstream),N=He[k.status];return r.jsxs(Ee.Provider,{value:{workflow:f.type?f:null,nodes:x,execution:k,viewJob:l,setViewJob:c},children:[r.jsxs("div",{className:"workflow-toolbar",children:[r.jsx("header",{children:r.jsx(h.Breadcrumb,{items:[{title:r.jsx(oe.Link,{to:u.pluginSettingsManager.getRoutePath("workflow"),children:E("Workflow")})},{title:r.jsx(oe.Link,{to:ve(f.id),children:f.title})},{title:r.jsx(en,{})}]})}),r.jsxs("aside",{children:[r.jsx(h.Tag,{color:N.color,children:t(N.label)}),k.status?null:r.jsx(h.Tooltip,{title:E("Cancel the execution"),children:r.jsx(h.Button,{type:"link",danger:!0,onClick:p,shape:"circle",size:"small",icon:r.jsx(M.StopOutlined,{})})}),r.jsx("time",{children:H.str2moment(k.updatedAt).format("YYYY-MM-DD HH:mm:ss")})]})]}),r.jsx(Wt,{entry:S}),r.jsx(Ro,{})]})}const Lt=()=>{const e=oe.useParams(),{styles:t}=ne();return r.jsx("div",{className:i.cx(t.workflowPageClass),children:r.jsx(i.SchemaComponent,{schema:{type:"void",properties:{[`execution_${e.id}`]:{type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:{name:"executions",fields:[]},resourceName:"executions",request:{resource:"executions",action:"get",params:{filter:e,appends:["jobs","workflow","workflow.nodes"]}}},"x-component":"ExecutionCanvas"}}},components:{ExecutionCanvas:tn}})})},zt=()=>{const{t:e}=_.useTranslation(),{id:t}=i.useRecord(),{setVisible:o}=i.useActionContext();return r.jsx(oe.Link,{to:_e(t),onClick:()=>o(!1),children:e("View")})},on={name:"execution-executions",fields:[{interface:"id",type:"bigInt",name:"id",uiSchema:{type:"number",title:'{{t("ID")}}',"x-component":"Input","x-component-props":{},"x-read-pretty":!0}},{interface:"createdAt",type:"datetime",name:"createdAt",uiSchema:{type:"datetime",title:`{{t("Triggered at", { ns: "${m}" })}}`,"x-component":"DatePicker","x-component-props":{},"x-read-pretty":!0}},{interface:"m2o",type:"belongsTo",name:"workflowId",uiSchema:{type:"number",title:`{{t("Version", { ns: "${m}" })}}`,"x-component"({value:e}){const{setVisible:t}=i.useActionContext();return r.jsx(oe.Link,{to:ve(e),onClick:()=>t(!1),children:`#${e}`})}}},{type:"number",name:"status",interface:"select",uiSchema:{title:`{{t("Status", { ns: "${m}" })}}`,type:"string","x-component":"Select","x-decorator":"FormItem",enum:ze}}]},Ht={type:"void",name:"executionHistoryDrawer",title:`{{t("Execution history", { ns: "${m}" })}}`,"x-component":"Action.Drawer",properties:{content:{type:"void","x-decorator":"ExecutionResourceProvider","x-decorator-props":{collection:on,resourceName:"executions",request:{resource:"executions",action:"list",params:{appends:["workflow.id","workflow.title"],pageSize:20,sort:["-createdAt"],filter:{}}}},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{clear:{type:"void",title:'{{t("Clear")}}',"x-component":"Action","x-component-props":{useAction(){const{t:e}=_.useTranslation(),{refresh:t,defaultRequest:o}=i.useResourceActionContext(),{resource:n}=i.useResourceContext(),{setVisible:s}=i.useActionContext();return{run(){return Y(this,null,function*(){var l;yield n.destroy({filter:(l=o.params)==null?void 0:l.filter}),h.message.success(e("Operation succeeded")),t(),s(!1)})}}},confirm:{title:`{{t("Clear all executions", { ns: "${m}" })}}`,content:`{{t("Clear executions will not reset executed count, and started executions will not be deleted, are you sure you want to delete them all?", { ns: "${m}" })}}`}}}}},table:{type:"void","x-component":"Table.Void","x-component-props":{rowKey:"id",useDataSource:"{{ cm.useDataSourceFromRAC }}"},properties:{id:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{id:{type:"number","x-component":"CollectionField","x-read-pretty":!0}}},createdAt:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{createdAt:{type:"datetime","x-component":"CollectionField","x-component-props":{showTime:!0},"x-read-pretty":!0}}},workflowId:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{workflowId:{type:"number","x-component":"CollectionField","x-read-pretty":!0}}},status:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",title:`{{t("Status", { ns: "${m}" })}}`,properties:{status:{type:"number","x-decorator":"ExecutionStatusColumn","x-component":"CollectionField","x-read-pretty":!0}}},actions:{type:"void",title:'{{ t("Actions") }}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{link:{type:"void","x-component":"ExecutionLink"}}}}}}}}}}};function Jt(e){var a;const o=i.useCompile()(e.label),n=g.useCallback(l=>{l.preventDefault(),l.stopPropagation()},[]),{color:s}=(a=He[e.value])!=null?a:{};return r.jsx(h.Tag,{color:s,onMouseDown:n,closable:e.closable,onClose:e.onClose,children:o})}function nn(e){const t=i.useCompile();return r.jsxs(r.Fragment,{children:[r.jsx(Jt,C({},e)),e.description?r.jsx("span",{children:t(e.description)}):null]})}function rn(t){var e=Q(t,[]);const o=e.multiple?"multiple":null;return r.jsx(h.Select,T(C({role:"button","data-testid":`select-${o||"single"}`},e),{mode:o,optionLabelProp:"label",tagRender:Jt,children:ze.filter(n=>!!n.value&&n.value!==de.ABORTED).map(n=>r.jsx(h.Select.Option,T(C({},n),{children:r.jsx(nn,C({},n))}),n.value))}))}function Ut(e){const{t}=_.useTranslation(),{refresh:o}=i.useResourceActionContext(),{resource:n}=i.useResourceContext(),s=i.useRecord(),a=g.useCallback(()=>{h.Modal.confirm({title:E("Cancel the execution"),icon:r.jsx(M.ExclamationCircleFilled,{}),content:E("Are you sure you want to cancel the execution?"),onOk:()=>{n.cancel({filterByTk:s.id}).then(()=>{h.message.success(t("Operation succeeded")),o()}).catch(l=>{console.error(l.data.error)})}})},[s]);return r.jsxs("div",{className:i.css`
|
|
440
|
+
`),children:r.jsx(Ue,{entry:e})}),r.jsx("div",{className:t.terminalClass,children:E("End")})]})})}),r.jsx("div",{className:"workflow-canvas-zoomer",children:r.jsx(y.Slider,{vertical:!0,reverse:!0,defaultValue:100,step:10,min:10,value:n,onChange:s})})]})}function bt(e){const t=new Map;e.forEach(o=>t.set(o.id,o));for(const o of t.values())o.upstreamId&&(o.upstream=t.get(o.upstreamId)),o.downstreamId&&(o.downstream=t.get(o.downstreamId))}function vt(e,t){t(e),e.properties&&Object.keys(e.properties).forEach(o=>{vt(e.properties[o],t)})}function ve(e){return`/admin/workflow/workflows/${e}`}function _e(e){return`/admin/workflow/executions/${e}`}function Xo(e,t=[]){const o=new Map;e.forEach(n=>{n.jobs=[],o.set(n.id,n)}),t.forEach(n=>{const s=o.get(n.nodeId);s.jobs.push(n),n.node={id:s.id,key:s.key,title:s.title,type:s.type}}),e.forEach(n=>{n.jobs=n.jobs.sort((s,a)=>s.id-a.id)})}function Ro(){const{instructions:e}=i.usePlugin(ce),t=i.useCompile(),{viewJob:o,setViewJob:n}=q(),{styles:s}=ne(),{node:a={}}=o!=null?o:{},l=e.get(a.type);return r.jsx(i.ActionContextProvider,{value:{visible:!!o,setVisible:n},children:r.jsx(i.SchemaComponent,{schema:{type:"void",properties:{[`${o==null?void 0:o.id}-${o==null?void 0:o.updatedAt}-modal`]:{type:"void","x-decorator":"Form","x-decorator-props":{initialValue:o},"x-component":"Action.Modal",title:r.jsxs("div",{className:s.nodeTitleClass,children:[r.jsx(y.Tag,{children:t(l==null?void 0:l.title)}),r.jsx("strong",{children:a.title}),r.jsxs("span",{className:"workflow-node-id",children:["#",a.id]})]}),properties:{status:{type:"number",title:`{{t("Status", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"Select",enum:mt,"x-read-pretty":!0},updatedAt:{type:"string",title:`{{t("Executed at", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"DatePicker","x-component-props":{showTime:!0},"x-read-pretty":!0},result:{type:"object",title:`{{t("Node result", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-component":"Input.JSON","x-component-props":{className:s.nodeJobResultClass},"x-read-pretty":!0}}}}}})})}function en(e){const{execution:t}=q(),o=i.useAPIClient(),n=oe.useNavigate(),{styles:s}=ne(),[a,l]=b.useState([]),[c,u]=b.useState([]);b.useEffect(()=>{t&&o.resource("executions").list({filter:{key:t.key,id:{$lt:t.id}},sort:"-createdAt",pageSize:10,fields:["id","status","createdAt"]}).then(({data:f})=>{l(f.data)}).catch(()=>{})},[t]),b.useEffect(()=>{t&&o.resource("executions").list({filter:{key:t.key,id:{$gt:t.id}},sort:"createdAt",pageSize:10,fields:["id","status","createdAt"]}).then(({data:f})=>{u(f.data.reverse())}).catch(()=>{})},[t]);const d=b.useCallback(({key:f})=>{f!=t.id&&n(_e(f))},[t]);return t?r.jsx(y.Dropdown,{menu:{onClick:d,defaultSelectedKeys:[`${t.id}`],className:i.cx(s.dropdownClass,s.executionsDropdownRowClass),items:[...c,t,...a].map(f=>({key:f.id,label:r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"id",children:`#${f.id}`}),r.jsx("time",{children:H.str2moment(f.createdAt).format("YYYY-MM-DD HH:mm:ss")})]}),icon:r.jsx("span",{children:r.jsx($e,{statusMap:He,status:f.status})})}))},children:r.jsxs(y.Space,{children:[r.jsx("strong",{children:`#${t.id}`}),r.jsx(M.DownOutlined,{})]})}):null}function tn(){var A;const{t:e}=_.useTranslation(),t=i.useCompile(),{data:o,loading:n,refresh:s}=i.useResourceActionContext(),{setTitle:a}=i.useDocumentTitle(),[l,c]=b.useState(null),u=i.useApp(),d=i.useAPIClient();b.useEffect(()=>{var $;const{workflow:F}=($=o==null?void 0:o.data)!=null?$:{};a==null||a(`${F!=null&&F.title?`${F.title} - `:""}${E("Execution history")}`)},[o==null?void 0:o.data]);const f=b.useCallback(()=>{y.Modal.confirm({title:E("Cancel the execution"),icon:r.jsx(M.ExclamationCircleFilled,{}),content:E("Are you sure you want to cancel the execution?"),onOk:()=>{d.resource("executions").cancel({filterByTk:o==null?void 0:o.data.id}).then(()=>{y.message.success(e("Operation succeeded")),s()}).catch(F=>{console.error(F.data.error)})}})},[o==null?void 0:o.data]);if(!(o!=null&&o.data))return n?r.jsx(y.Spin,{}):r.jsx(y.Result,{status:"404",title:"Not found"});const P=(A=o==null?void 0:o.data)!=null?A:{},{jobs:h=[],workflow:z={}}=P,U=z,{nodes:x=[],revisions:v=[]}=U,m=Q(U,["nodes","revisions"]),k=Q(P,["jobs","workflow"]);bt(x),Xo(x,h);const S=x.find(F=>!F.upstream),N=He[k.status];return r.jsxs(Ee.Provider,{value:{workflow:m.type?m:null,nodes:x,execution:k,viewJob:l,setViewJob:c},children:[r.jsxs("div",{className:"workflow-toolbar",children:[r.jsx("header",{children:r.jsx(y.Breadcrumb,{items:[{title:r.jsx(oe.Link,{to:u.pluginSettingsManager.getRoutePath("workflow"),children:E("Workflow")})},{title:r.jsx(oe.Link,{to:ve(m.id),children:m.title})},{title:r.jsx(en,{})}]})}),r.jsxs("aside",{children:[r.jsx(y.Tag,{color:N.color,children:t(N.label)}),k.status?null:r.jsx(y.Tooltip,{title:E("Cancel the execution"),children:r.jsx(y.Button,{type:"link",danger:!0,onClick:f,shape:"circle",size:"small",icon:r.jsx(M.StopOutlined,{})})}),r.jsx("time",{children:H.str2moment(k.updatedAt).format("YYYY-MM-DD HH:mm:ss")})]})]}),r.jsx(Wt,{entry:S}),r.jsx(Ro,{})]})}const Lt=()=>{const e=oe.useParams(),{styles:t}=ne();return r.jsx("div",{className:i.cx(t.workflowPageClass),children:r.jsx(i.SchemaComponent,{schema:{type:"void",properties:{[`execution_${e.id}`]:{type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:{name:"executions",fields:[]},resourceName:"executions",request:{resource:"executions",action:"get",params:{filter:e,appends:["jobs","workflow","workflow.nodes"]}}},"x-component":"ExecutionCanvas"}}},components:{ExecutionCanvas:tn}})})},zt=()=>{const{t:e}=_.useTranslation(),{id:t}=i.useRecord(),{setVisible:o}=i.useActionContext();return r.jsx(oe.Link,{to:_e(t),onClick:()=>o(!1),children:e("View")})},on={name:"execution-executions",fields:[{interface:"id",type:"bigInt",name:"id",uiSchema:{type:"number",title:'{{t("ID")}}',"x-component":"Input","x-component-props":{},"x-read-pretty":!0}},{interface:"createdAt",type:"datetime",name:"createdAt",uiSchema:{type:"datetime",title:`{{t("Triggered at", { ns: "${p}" })}}`,"x-component":"DatePicker","x-component-props":{},"x-read-pretty":!0}},{interface:"m2o",type:"belongsTo",name:"workflowId",uiSchema:{type:"number",title:`{{t("Version", { ns: "${p}" })}}`,"x-component"({value:e}){const{setVisible:t}=i.useActionContext();return r.jsx(oe.Link,{to:ve(e),onClick:()=>t(!1),children:`#${e}`})}}},{type:"number",name:"status",interface:"select",uiSchema:{title:`{{t("Status", { ns: "${p}" })}}`,type:"string","x-component":"Select","x-decorator":"FormItem",enum:ze}}]},Ht={type:"void",name:"executionHistoryDrawer",title:`{{t("Execution history", { ns: "${p}" })}}`,"x-component":"Action.Drawer",properties:{content:{type:"void","x-decorator":"ExecutionResourceProvider","x-decorator-props":{collection:on,resourceName:"executions",request:{resource:"executions",action:"list",params:{appends:["workflow.id","workflow.title"],pageSize:20,sort:["-createdAt"],filter:{}}}},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{clear:{type:"void",title:'{{t("Clear")}}',"x-component":"Action","x-component-props":{useAction(){const{t:e}=_.useTranslation(),{refresh:t,defaultRequest:o}=i.useResourceActionContext(),{resource:n}=i.useResourceContext(),{setVisible:s}=i.useActionContext();return{run(){return Y(this,null,function*(){var l;yield n.destroy({filter:(l=o.params)==null?void 0:l.filter}),y.message.success(e("Operation succeeded")),t(),s(!1)})}}},confirm:{title:`{{t("Clear all executions", { ns: "${p}" })}}`,content:`{{t("Clear executions will not reset executed count, and started executions will not be deleted, are you sure you want to delete them all?", { ns: "${p}" })}}`}}}}},table:{type:"void","x-component":"Table.Void","x-component-props":{rowKey:"id",useDataSource:"{{ cm.useDataSourceFromRAC }}"},properties:{id:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{id:{type:"number","x-component":"CollectionField","x-read-pretty":!0}}},createdAt:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{createdAt:{type:"datetime","x-component":"CollectionField","x-component-props":{showTime:!0},"x-read-pretty":!0}}},workflowId:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{workflowId:{type:"number","x-component":"CollectionField","x-read-pretty":!0}}},status:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",title:`{{t("Status", { ns: "${p}" })}}`,properties:{status:{type:"number","x-decorator":"ExecutionStatusColumn","x-component":"CollectionField","x-read-pretty":!0}}},actions:{type:"void",title:'{{ t("Actions") }}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{link:{type:"void","x-component":"ExecutionLink"}}}}}}}}}}};function Jt(e){var a;const o=i.useCompile()(e.label),n=b.useCallback(l=>{l.preventDefault(),l.stopPropagation()},[]),{color:s}=(a=He[e.value])!=null?a:{};return r.jsx(y.Tag,{color:s,onMouseDown:n,closable:e.closable,onClose:e.onClose,children:o})}function nn(e){const t=i.useCompile();return r.jsxs(r.Fragment,{children:[r.jsx(Jt,C({},e)),e.description?r.jsx("span",{children:t(e.description)}):null]})}function rn(t){var e=Q(t,[]);const o=e.multiple?"multiple":null;return r.jsx(y.Select,T(C({role:"button","data-testid":`select-${o||"single"}`},e),{mode:o,optionLabelProp:"label",tagRender:Jt,children:ze.filter(n=>!!n.value&&n.value!==de.ABORTED).map(n=>r.jsx(y.Select.Option,T(C({},n),{children:r.jsx(nn,C({},n))}),n.value))}))}function Ut(e){const{t}=_.useTranslation(),{refresh:o}=i.useResourceActionContext(),{resource:n}=i.useResourceContext(),s=i.useRecord(),a=b.useCallback(()=>{y.Modal.confirm({title:E("Cancel the execution"),icon:r.jsx(M.ExclamationCircleFilled,{}),content:E("Are you sure you want to cancel the execution?"),onOk:()=>{n.cancel({filterByTk:s.id}).then(()=>{y.message.success(t("Operation succeeded")),o()}).catch(l=>{console.error(l.data.error)})}})},[s]);return r.jsxs("div",{className:i.css`
|
|
441
441
|
display: flex;
|
|
442
|
-
`,children:[e.children,s.status?null:r.jsx(h.Tooltip,{title:E("Cancel the execution"),children:r.jsx(h.Button,{type:"link",danger:!0,onClick:a,shape:"circle",size:"small",icon:r.jsx(M.StopOutlined,{})})})]})}function sn(n){var s=n,{request:e,filter:t={}}=s,o=Q(s,["request","filter"]);var c;const{workflow:a}=q(),l=T(C({},o),{request:T(C({},e),{params:T(C({},e==null?void 0:e.params),{filter:T(C({},(c=e==null?void 0:e.params)==null?void 0:c.filter),{key:a.key})})})});return r.jsx(i.ResourceActionProvider,C({},l))}function ln(){var F;const e=oe.useNavigate(),{t}=_.useTranslation(),o=i.useApp(),{data:n,refresh:s,loading:a}=i.useResourceActionContext(),{resource:l}=i.useResourceContext(),{setTitle:c}=i.useDocumentTitle(),[u,d]=g.useState(!1),{styles:p}=ne(),{modal:b}=h.App.useApp();if(g.useEffect(()=>{var I;const{title:O}=(I=n==null?void 0:n.data)!=null?I:{};c==null||c(`${E("Workflow")}${O?`: ${O}`:""}`)},[n==null?void 0:n.data]),!(n!=null&&n.data))return a?r.jsx(h.Spin,{}):r.jsx(h.Result,{status:"404",title:"Not found"});const $=(F=n==null?void 0:n.data)!=null?F:{},{nodes:x=[],revisions:v=[]}=$,f=Q($,["nodes","revisions"]);bt(x);const k=x.find(O=>!O.upstream);function S({key:O}){O!=f.id&&e(ve(O))}function N(O){return Y(this,null,function*(){yield l.update({filterByTk:f.id,values:{enabled:O}}),s()})}function A(){return Y(this,null,function*(){const{data:{data:O}}=yield l.revision({filterByTk:f.id,filter:{key:f.key}});h.message.success(t("Operation succeeded")),e(`/admin/workflow/workflows/${O.id}`)})}function P(){return Y(this,null,function*(){const O=f.current?E("Delete a main version will cause all other revisions to be deleted too."):"";b.confirm({title:t("Are you sure you want to delete it?"),content:O,onOk(){return Y(this,null,function*(){var L;yield l.destroy({filterByTk:f.id}),h.message.success(t("Operation succeeded")),e(f.current?o.pluginSettingsManager.getRoutePath("workflow"):ve((L=v.find(J=>J.current))==null?void 0:L.id))})}})})}function z(I){return Y(this,arguments,function*({key:O}){switch(O){case"history":d(!0);return;case"revision":return A();case"delete":return P()}})}const U=f.executed&&!v.find(O=>!O.executed&&new Date(O.createdAt)>new Date(f.createdAt));return r.jsxs(Ee.Provider,{value:{workflow:f,nodes:x,refresh:s},children:[r.jsxs("div",{className:"workflow-toolbar",children:[r.jsx("header",{children:r.jsx(h.Breadcrumb,{items:[{title:r.jsx(oe.Link,{to:o.pluginSettingsManager.getRoutePath("workflow"),children:E("Workflow")})},{title:r.jsx("strong",{children:f.title})}]})}),r.jsxs("aside",{children:[r.jsx("div",{className:"workflow-versions",children:r.jsx(h.Dropdown,{trigger:["click"],menu:{onClick:S,defaultSelectedKeys:[`${f.id}`],className:i.cx(p.dropdownClass,p.workflowVersionDropdownClass),items:v.sort((O,I)=>I.id-O.id).map((O,I)=>({role:"button","aria-label":`version-${I}`,key:`${O.id}`,icon:O.current?r.jsx(M.RightOutlined,{}):null,className:i.cx({executed:O.executed,unexecuted:!O.executed,enabled:O.enabled}),label:r.jsxs(r.Fragment,{children:[r.jsx("strong",{children:`#${O.id}`}),r.jsx("time",{children:H.str2moment(O.createdAt).format("YYYY-MM-DD HH:mm:ss")})]})}))},children:r.jsxs(h.Button,{type:"text","aria-label":"version",children:[r.jsx("label",{children:E("Version")}),r.jsx("span",{children:f!=null&&f.id?`#${f.id}`:null}),r.jsx(M.DownOutlined,{})]})})}),r.jsx(h.Switch,{checked:f.enabled,onChange:N,checkedChildren:E("On"),unCheckedChildren:E("Off")}),r.jsx(h.Dropdown,{menu:{items:[{role:"button","aria-label":"history",key:"history",label:E("Execution history"),disabled:!f.allExecuted},{role:"button","aria-label":"revision",key:"revision",label:E("Copy to new version"),disabled:!U},{role:"button","aria-label":"delete",key:"delete",label:t("Delete")}],onClick:z},children:r.jsx(h.Button,{"aria-label":"more",type:"text",icon:r.jsx(M.EllipsisOutlined,{})})}),r.jsx(i.ActionContextProvider,{value:{visible:u,setVisible:d},children:r.jsx(i.SchemaComponent,{schema:Ht,components:{ExecutionResourceProvider:sn,ExecutionLink:zt,ExecutionStatusColumn:Ut}})})]})]}),r.jsx(Wt,{entry:k})]})}const _t=()=>{const e=oe.useParams(),{styles:t}=ne();return r.jsx("div",{className:i.cx(t.workflowPageClass),children:r.jsx(i.SchemaComponent,{schema:{type:"void",properties:{[`provider_${e.id}`]:{type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:{name:"workflows",fields:[]},resourceName:"workflows",request:{resource:"workflows",action:"get",params:{filter:{id:e.id},appends:["nodes","revisions.id","revisions.createdAt","revisions.current","revisions.executed","revisions.enabled"]}}},"x-component":"WorkflowCanvas"}}},components:{WorkflowCanvas:ln}})})},an=n=>{var s=n,{request:e,filter:t={}}=s,o=Q(s,["request","filter"]);var c;const a=i.useRecord(),l=T(C({},o),{request:T(C({},e),{params:T(C({},e==null?void 0:e.params),{filter:T(C({},(c=e==null?void 0:e.params)==null?void 0:c.filter),{key:a.key})})})});return r.jsx(i.ResourceActionProvider,C({},l))},cn=()=>{const{t:e}=_.useTranslation(),{id:t}=i.useRecord(),{setVisible:o}=i.useActionContext(),{getAriaLabel:n}=i.useGetAriaLabelOfAction("Configure");return r.jsx(oe.Link,{"aria-label":n(),to:ve(t),onClick:()=>o(!1),children:e("Configure")})};function un(n){var s=n,{component:e="div",children:t}=s,o=Q(s,["component","children"]);const[a,l]=g.useState(!1),c=j.useFieldSchema();return r.jsxs(i.ActionContextProvider,{value:{visible:a,setVisible:l,fieldSchema:c},children:[g.createElement(e,T(C({},o),{onClick(){l(!0)}}),t),r.jsx(i.SchemaComponent,{schema:c,onlyRenderProperties:!0})]})}function dn({data:e}){const{label:t,color:o,options:n}=e,s=i.useCompile();return r.jsxs(h.Space,{direction:"vertical",children:[r.jsx(h.Tag,{color:o,children:s(t)}),r.jsx(h.Typography.Text,{type:"secondary",style:{whiteSpace:"normal"},children:s(n.description)})]})}const Gt={name:"workflows",fields:[{type:"string",name:"title",interface:"input",uiSchema:{title:'{{t("Name")}}',type:"string","x-component":"Input",required:!0}},{type:"string",name:"type",interface:"select",uiSchema:{title:`{{t("Trigger type", { ns: "${m}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Select","x-component-props":{options:"{{getTriggersOptions()}}",optionRender:dn,popupMatchSelectWidth:!0,listHeight:300},required:!0}},{type:"string",name:"description",interface:"textarea",uiSchema:{title:'{{t("Description")}}',type:"string","x-component":"Input.TextArea"}},{type:"boolean",name:"enabled",interface:"radioGroup",uiSchema:{title:`{{t("Status", { ns: "${m}" })}}`,type:"string",enum:[{label:`{{t("On", { ns: "${m}" })}}`,value:!0,color:"#52c41a"},{label:`{{t("Off", { ns: "${m}" })}}`,value:!1}],"x-component":"Radio.Group","x-decorator":"FormItem",default:!1}},{type:"number",name:"allExecuted",interface:"integer",uiSchema:{title:`{{t("Executed", { ns: "${m}" })}}`,type:"number","x-component":"InputNumber","x-decorator":"FormItem"}},{type:"object",name:"options"}]},pe={title:{"x-component":"CollectionField","x-decorator":"FormItem"},type:{"x-component":"CollectionField","x-decorator":"FormItem"},sync:{type:"boolean",title:`{{ t("Execute mode", { ns: "${m}" }) }}`,description:`{{ t("Execute workflow asynchronously or synchronously based on trigger type, and could not be changed after created.", { ns: "${m}" }) }}`,"x-decorator":"FormItem","x-component":"SyncOptionSelect","x-component-props":{options:[{label:`{{ t("Asynchronously", { ns: "${m}" }) }}`,value:!1,tooltip:`{{ t("Will be executed in the background as a queued task.", { ns: "${m}" }) }}`},{label:`{{ t("Synchronously", { ns: "${m}" }) }}`,value:!0,tooltip:`{{ t("For user actions that require immediate feedback. Can not use asynchronous nodes in such mode, and it is not recommended to perform time-consuming operations under synchronous mode.", { ns: "${m}" }) }}`}]}},enabled:{"x-component":"CollectionField","x-decorator":"FormItem"},description:{"x-component":"CollectionField","x-decorator":"FormItem"},options:{type:"object","x-component":"fieldset",properties:{deleteExecutionOnStatus:{type:"array",title:`{{ t("Auto delete history when execution is on end status", { ns: "${m}" }) }}`,"x-decorator":"FormItem","x-component":"ExecutionStatusSelect","x-component-props":{multiple:!0}}}}},pn={type:"void",properties:{provider:{type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:Gt,resourceName:"workflows",request:{resource:"workflows",action:"list",params:{filter:{current:!0},sort:["-createdAt"],except:["config"]}}},"x-component":"CollectionProvider_deprecated","x-component-props":{collection:Gt},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{filter:{type:"void",title:'{{ t("Filter") }}',default:{$and:[{title:{$includes:""}}]},"x-action":"filter","x-component":"Filter.Action","x-use-component-props":"cm.useFilterActionProps","x-component-props":{icon:"FilterOutlined"},"x-align":"left"},delete:{type:"void",title:'{{t("Delete")}}',"x-component":"Action","x-component-props":{icon:"DeleteOutlined",useAction:"{{ cm.useBulkDestroyAction }}",confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"}}},create:{type:"void",title:'{{t("Add new")}}',"x-component":"Action","x-component-props":{type:"primary",icon:"PlusOutlined"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{initialValue:{current:!0}},title:'{{t("Add new")}}',properties:{title:pe.title,type:pe.type,sync:pe.sync,description:pe.description,options:pe.options,footer:{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:"{{ cm.useCreateAction }}"}}}}}}}}}},table:{type:"void","x-component":"Table.Void","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"},useDataSource:"{{ cm.useDataSourceFromRAC }}"},properties:{title:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{title:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},type:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{type:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},enabled:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{enabled:{type:"boolean","x-component":"CollectionField","x-read-pretty":!0,default:!1}}},allExecuted:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{allExecuted:{type:"number","x-decorator":"OpenDrawer","x-decorator-props":{component:function(t){const o=i.useRecord();return g.createElement("a",C({"aria-label":`executed-${o.title}`},t))}},"x-component":"CollectionField","x-read-pretty":!0,properties:{drawer:Ht}}}},actions:{type:"void",title:'{{ t("Actions") }}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{configure:{type:"void","x-component":"WorkflowLink"},update:{type:"void",title:'{{ t("Edit") }}',"x-component":"Action.Link","x-component-props":{type:"primary"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues:"{{ cm.useValuesFromRecord }}"},title:'{{ t("Edit") }}',properties:{title:pe.title,enabled:pe.enabled,sync:pe.sync,description:pe.description,options:pe.options,footer:{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:"{{ cm.useUpdateAction }}"}}}}}}}},revision:{type:"void",title:`{{t("Duplicate", { ns: "${m}" })}}`,"x-component":"Action.Link","x-component-props":{openSize:"small"},properties:{modal:{type:"void",title:`{{t("Duplicate to new workflow", { ns: "${m}" })}}`,"x-decorator":"FormV2","x-component":"Action.Modal",properties:{title:{type:"string",title:'{{t("Title")}}',"x-decorator":"FormItem","x-component":"Input"},footer:{type:"void","x-component":"Action.Modal.Footer",properties:{submit:{type:"void",title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction(){const{t:e}=_.useTranslation(),{refresh:t}=i.useResourceActionContext(),{resource:o,targetKey:n}=i.useResourceContext(),{setVisible:s}=i.useActionContext(),{[n]:a}=i.useRecord(),{values:l}=j.useForm();return{run(){return Y(this,null,function*(){yield o.revision({filterByTk:a,values:l}),h.message.success(e("Operation succeeded")),t(),s(!1)})}}}}},cancel:{type:"void",title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}}}}}}}},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action.Link","x-component-props":{confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"},useAction:"{{ cm.useDestroyActionAndRefreshCM }}"}}}}}}}}}}}};function mn(e){const t=j.useField(),o=i.useRecord(),n=i.usePlugin(ce);return j.useFormEffects(s=>{he.onFieldChange("type",a=>{let l=o.id||!a.value;if(a.value){const c=n.triggers.get(a.value);c.sync!=null?(l=!0,t.setValue(c.sync)):t.setInitialValue(!1)}t.setPattern(l?"disabled":"editable")})}),g.useEffect(()=>{if(o.id){t.setPattern("disabled");const s=n.triggers.get(o.type);s.sync!=null?t.setValue(s.sync):t.setInitialValue(!1)}},[o.id,t,n.triggers]),r.jsx(Be,C({},e))}function fn(){const e=g.useContext(i.SchemaComponentContext),{getTriggersOptions:t}=i.usePlugin(ce);return r.jsx(h.Card,{bordered:!1,children:r.jsx(i.SchemaComponentContext.Provider,{value:T(C({},e),{designable:!1}),children:r.jsx(i.SchemaComponent,{schema:pn,components:{WorkflowLink:cn,ExecutionResourceProvider:an,ExecutionLink:zt,OpenDrawer:un,ExecutionStatusSelect:rn,SyncOptionSelect:mn,ExecutionStatusColumn:Ut},scope:{getTriggersOptions:t}})})})}function hn(n){var s=n,{collection:e,dataPath:t}=s,o=Q(s,["collection","dataPath"]);const{insert:a}=i.useSchemaInitializer(),{getTemplateSchemaByMode:l}=i.useSchemaTemplateManager(),{getCollection:c}=i.useCollectionManager_deprecated(),u=i.useRecordCollectionDataSourceItems("FormItem");let d;if(typeof e=="string"){const[b,x]=i.parseCollectionName(e);d=c(x,b)}else d=e;function p(x){return Y(this,arguments,function*({item:b}){const v=b.template?yield l(b):null,f={type:"void",name:Dt.uid(),title:d.title,"x-decorator":"DetailsBlockProvider","x-decorator-props":{collection:e,dataPath:t},"x-component":"CardItem","x-component-props":{title:o.title},"x-designer":"SimpleDesigner",properties:{grid:{type:"void","x-component":"FormV2","x-use-component-props":"useDetailsBlockProps","x-read-pretty":!0,properties:{grid:v||{type:"void","x-component":"Grid","x-initializer":"details:configureFields",properties:{}}}}}};vt(f,k=>{k["x-uid"]&&delete k["x-uid"]}),a(f)})}return r.jsx(i.SchemaInitializerItem,T(C({},o),{onClick:p,items:u}))}function Me(e){var a;const t=i.useSchemaInitializerItem(),o=(a=e==null?void 0:e.collection)!=null?a:t.collection;let n,s;if(typeof o=="string"){const l=i.parseCollectionName(o);n=l[0],s=l[1]}else s=o;return r.jsx(i.CollectionProvider_deprecated,{dataSource:n,collection:s,children:r.jsx(hn,C(C({},t),e))})}function yn(){return!0}const xt=j.observer(e=>{const d=e,{filter:t=yn}=d,o=Q(d,["filter"]),n=i.useCompile(),{getCollectionFields:s}=i.useCollectionManager_deprecated(),{values:a}=j.useForm(),[l,c]=i.parseCollectionName(a==null?void 0:a.collection),u=s(c,l);return r.jsx(h.Select,T(C({popupMatchSelectWidth:!1},o),{options:u.filter(t).map(p=>{var b;return{label:n((b=p.uiSchema)==null?void 0:b.title),value:p.name}})}))},{displayName:"FieldsSelect"}),le={type:"string",title:'{{t("Collection")}}',required:!0,"x-reactions":[],"x-decorator":"FormItem","x-component":"DataSourceCollectionCascader"},Yt={type:"object",title:'{{t("Fields values")}}',description:`{{t("Unassigned fields will be set to default values, and those without default values will be set to null.", { ns: "${m}" })}}`,"x-decorator":"FormItem","x-decorator-props":{labelAlign:"left",className:i.css`
|
|
442
|
+
`,children:[e.children,s.status?null:r.jsx(y.Tooltip,{title:E("Cancel the execution"),children:r.jsx(y.Button,{type:"link",danger:!0,onClick:a,shape:"circle",size:"small",icon:r.jsx(M.StopOutlined,{})})})]})}function sn(n){var s=n,{request:e,filter:t={}}=s,o=Q(s,["request","filter"]);var c;const{workflow:a}=q(),l=T(C({},o),{request:T(C({},e),{params:T(C({},e==null?void 0:e.params),{filter:T(C({},(c=e==null?void 0:e.params)==null?void 0:c.filter),{key:a.key})})})});return r.jsx(i.ResourceActionProvider,C({},l))}function ln(){var F;const e=oe.useNavigate(),{t}=_.useTranslation(),o=i.useApp(),{data:n,refresh:s,loading:a}=i.useResourceActionContext(),{resource:l}=i.useResourceContext(),{setTitle:c}=i.useDocumentTitle(),[u,d]=b.useState(!1),{styles:f}=ne(),{modal:h}=y.App.useApp();if(b.useEffect(()=>{var I;const{title:O}=(I=n==null?void 0:n.data)!=null?I:{};c==null||c(`${E("Workflow")}${O?`: ${O}`:""}`)},[n==null?void 0:n.data]),!(n!=null&&n.data))return a?r.jsx(y.Spin,{}):r.jsx(y.Result,{status:"404",title:"Not found"});const $=(F=n==null?void 0:n.data)!=null?F:{},{nodes:x=[],revisions:v=[]}=$,m=Q($,["nodes","revisions"]);bt(x);const k=x.find(O=>!O.upstream);function S({key:O}){O!=m.id&&e(ve(O))}function N(O){return Y(this,null,function*(){yield l.update({filterByTk:m.id,values:{enabled:O}}),s()})}function A(){return Y(this,null,function*(){const{data:{data:O}}=yield l.revision({filterByTk:m.id,filter:{key:m.key}});y.message.success(t("Operation succeeded")),e(`/admin/workflow/workflows/${O.id}`)})}function P(){return Y(this,null,function*(){const O=m.current?E("Delete a main version will cause all other revisions to be deleted too."):"";h.confirm({title:t("Are you sure you want to delete it?"),content:O,onOk(){return Y(this,null,function*(){var L;yield l.destroy({filterByTk:m.id}),y.message.success(t("Operation succeeded")),e(m.current?o.pluginSettingsManager.getRoutePath("workflow"):ve((L=v.find(J=>J.current))==null?void 0:L.id))})}})})}function z(I){return Y(this,arguments,function*({key:O}){switch(O){case"history":d(!0);return;case"revision":return A();case"delete":return P()}})}const U=m.executed&&!v.find(O=>!O.executed&&new Date(O.createdAt)>new Date(m.createdAt));return r.jsxs(Ee.Provider,{value:{workflow:m,nodes:x,refresh:s},children:[r.jsxs("div",{className:"workflow-toolbar",children:[r.jsx("header",{children:r.jsx(y.Breadcrumb,{items:[{title:r.jsx(oe.Link,{to:o.pluginSettingsManager.getRoutePath("workflow"),children:E("Workflow")})},{title:r.jsx("strong",{children:m.title})}]})}),r.jsxs("aside",{children:[r.jsx("div",{className:"workflow-versions",children:r.jsx(y.Dropdown,{trigger:["click"],menu:{onClick:S,defaultSelectedKeys:[`${m.id}`],className:i.cx(f.dropdownClass,f.workflowVersionDropdownClass),items:v.sort((O,I)=>I.id-O.id).map((O,I)=>({role:"button","aria-label":`version-${I}`,key:`${O.id}`,icon:O.current?r.jsx(M.RightOutlined,{}):null,className:i.cx({executed:O.executed,unexecuted:!O.executed,enabled:O.enabled}),label:r.jsxs(r.Fragment,{children:[r.jsx("strong",{children:`#${O.id}`}),r.jsx("time",{children:H.str2moment(O.createdAt).format("YYYY-MM-DD HH:mm:ss")})]})}))},children:r.jsxs(y.Button,{type:"text","aria-label":"version",children:[r.jsx("label",{children:E("Version")}),r.jsx("span",{children:m!=null&&m.id?`#${m.id}`:null}),r.jsx(M.DownOutlined,{})]})})}),r.jsx(y.Switch,{checked:m.enabled,onChange:N,checkedChildren:E("On"),unCheckedChildren:E("Off")}),r.jsx(y.Dropdown,{menu:{items:[{role:"button","aria-label":"history",key:"history",label:E("Execution history"),disabled:!m.allExecuted},{role:"button","aria-label":"revision",key:"revision",label:E("Copy to new version"),disabled:!U},{role:"button","aria-label":"delete",key:"delete",label:t("Delete")}],onClick:z},children:r.jsx(y.Button,{"aria-label":"more",type:"text",icon:r.jsx(M.EllipsisOutlined,{})})}),r.jsx(i.ActionContextProvider,{value:{visible:u,setVisible:d},children:r.jsx(i.SchemaComponent,{schema:Ht,components:{ExecutionResourceProvider:sn,ExecutionLink:zt,ExecutionStatusColumn:Ut}})})]})]}),r.jsx(Wt,{entry:k})]})}const _t=()=>{const e=oe.useParams(),{styles:t}=ne();return r.jsx("div",{className:i.cx(t.workflowPageClass),children:r.jsx(i.SchemaComponent,{schema:{type:"void",properties:{[`provider_${e.id}`]:{type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:{name:"workflows",fields:[]},resourceName:"workflows",request:{resource:"workflows",action:"get",params:{filter:{id:e.id},appends:["nodes","revisions.id","revisions.createdAt","revisions.current","revisions.executed","revisions.enabled"]}}},"x-component":"WorkflowCanvas"}}},components:{WorkflowCanvas:ln}})})},an=n=>{var s=n,{request:e,filter:t={}}=s,o=Q(s,["request","filter"]);var c;const a=i.useRecord(),l=T(C({},o),{request:T(C({},e),{params:T(C({},e==null?void 0:e.params),{filter:T(C({},(c=e==null?void 0:e.params)==null?void 0:c.filter),{key:a.key})})})});return r.jsx(i.ResourceActionProvider,C({},l))},cn=()=>{const{t:e}=_.useTranslation(),{id:t}=i.useRecord(),{setVisible:o}=i.useActionContext(),{getAriaLabel:n}=i.useGetAriaLabelOfAction("Configure");return r.jsx(oe.Link,{"aria-label":n(),to:ve(t),onClick:()=>o(!1),children:e("Configure")})};function un(n){var s=n,{component:e="div",children:t}=s,o=Q(s,["component","children"]);const[a,l]=b.useState(!1),c=j.useFieldSchema();return r.jsxs(i.ActionContextProvider,{value:{visible:a,setVisible:l,fieldSchema:c},children:[b.createElement(e,T(C({},o),{onClick(){l(!0)}}),t),r.jsx(i.SchemaComponent,{schema:c,onlyRenderProperties:!0})]})}function dn({data:e}){const{label:t,color:o,options:n}=e,s=i.useCompile();return r.jsxs(y.Space,{direction:"vertical",children:[r.jsx(y.Tag,{color:o,children:s(t)}),r.jsx(y.Typography.Text,{type:"secondary",style:{whiteSpace:"normal"},children:s(n.description)})]})}const Gt={name:"workflows",fields:[{type:"string",name:"title",interface:"input",uiSchema:{title:'{{t("Name")}}',type:"string","x-component":"Input",required:!0}},{type:"string",name:"type",interface:"select",uiSchema:{title:`{{t("Trigger type", { ns: "${p}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Select","x-component-props":{options:"{{getTriggersOptions()}}",optionRender:dn,popupMatchSelectWidth:!0,listHeight:300},required:!0}},{type:"string",name:"description",interface:"textarea",uiSchema:{title:'{{t("Description")}}',type:"string","x-component":"Input.TextArea"}},{type:"boolean",name:"enabled",interface:"radioGroup",uiSchema:{title:`{{t("Status", { ns: "${p}" })}}`,type:"string",enum:[{label:`{{t("On", { ns: "${p}" })}}`,value:!0,color:"#52c41a"},{label:`{{t("Off", { ns: "${p}" })}}`,value:!1}],"x-component":"Radio.Group","x-decorator":"FormItem",default:!1}},{type:"number",name:"allExecuted",interface:"integer",uiSchema:{title:`{{t("Executed", { ns: "${p}" })}}`,type:"number","x-component":"InputNumber","x-decorator":"FormItem"}},{type:"object",name:"options"}]},pe={title:{"x-component":"CollectionField","x-decorator":"FormItem"},type:{"x-component":"CollectionField","x-decorator":"FormItem"},sync:{type:"boolean",title:`{{ t("Execute mode", { ns: "${p}" }) }}`,description:`{{ t("Execute workflow asynchronously or synchronously based on trigger type, and could not be changed after created.", { ns: "${p}" }) }}`,"x-decorator":"FormItem","x-component":"SyncOptionSelect","x-component-props":{options:[{label:`{{ t("Asynchronously", { ns: "${p}" }) }}`,value:!1,tooltip:`{{ t("Will be executed in the background as a queued task.", { ns: "${p}" }) }}`},{label:`{{ t("Synchronously", { ns: "${p}" }) }}`,value:!0,tooltip:`{{ t("For user actions that require immediate feedback. Can not use asynchronous nodes in such mode, and it is not recommended to perform time-consuming operations under synchronous mode.", { ns: "${p}" }) }}`}]}},enabled:{"x-component":"CollectionField","x-decorator":"FormItem"},description:{"x-component":"CollectionField","x-decorator":"FormItem"},options:{type:"object","x-component":"fieldset",properties:{deleteExecutionOnStatus:{type:"array",title:`{{ t("Auto delete history when execution is on end status", { ns: "${p}" }) }}`,"x-decorator":"FormItem","x-component":"ExecutionStatusSelect","x-component-props":{multiple:!0}}}}},pn={type:"void",properties:{provider:{type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:Gt,resourceName:"workflows",request:{resource:"workflows",action:"list",params:{filter:{current:!0},sort:["-createdAt"],except:["config"]}}},"x-component":"CollectionProvider_deprecated","x-component-props":{collection:Gt},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{filter:{type:"void",title:'{{ t("Filter") }}',default:{$and:[{title:{$includes:""}}]},"x-action":"filter","x-component":"Filter.Action","x-use-component-props":"cm.useFilterActionProps","x-component-props":{icon:"FilterOutlined"},"x-align":"left"},delete:{type:"void",title:'{{t("Delete")}}',"x-component":"Action","x-component-props":{icon:"DeleteOutlined",useAction:"{{ cm.useBulkDestroyAction }}",confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"}}},create:{type:"void",title:'{{t("Add new")}}',"x-component":"Action","x-component-props":{type:"primary",icon:"PlusOutlined"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{initialValue:{current:!0}},title:'{{t("Add new")}}',properties:{title:pe.title,type:pe.type,sync:pe.sync,description:pe.description,options:pe.options,footer:{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:"{{ cm.useCreateAction }}"}}}}}}}}}},table:{type:"void","x-component":"Table.Void","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"},useDataSource:"{{ cm.useDataSourceFromRAC }}"},properties:{title:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{title:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},type:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{type:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},enabled:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{enabled:{type:"boolean","x-component":"CollectionField","x-read-pretty":!0,default:!1}}},allExecuted:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{allExecuted:{type:"number","x-decorator":"OpenDrawer","x-decorator-props":{component:function(t){const o=i.useRecord();return b.createElement("a",C({"aria-label":`executed-${o.title}`},t))}},"x-component":"CollectionField","x-read-pretty":!0,properties:{drawer:Ht}}}},actions:{type:"void",title:'{{ t("Actions") }}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{configure:{type:"void","x-component":"WorkflowLink"},update:{type:"void",title:'{{ t("Edit") }}',"x-component":"Action.Link","x-component-props":{type:"primary"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues:"{{ cm.useValuesFromRecord }}"},title:'{{ t("Edit") }}',properties:{title:pe.title,enabled:pe.enabled,sync:pe.sync,description:pe.description,options:pe.options,footer:{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:"{{ cm.useUpdateAction }}"}}}}}}}},revision:{type:"void",title:`{{t("Duplicate", { ns: "${p}" })}}`,"x-component":"Action.Link","x-component-props":{openSize:"small"},properties:{modal:{type:"void",title:`{{t("Duplicate to new workflow", { ns: "${p}" })}}`,"x-decorator":"FormV2","x-component":"Action.Modal",properties:{title:{type:"string",title:'{{t("Title")}}',"x-decorator":"FormItem","x-component":"Input"},footer:{type:"void","x-component":"Action.Modal.Footer",properties:{submit:{type:"void",title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction(){const{t:e}=_.useTranslation(),{refresh:t}=i.useResourceActionContext(),{resource:o,targetKey:n}=i.useResourceContext(),{setVisible:s}=i.useActionContext(),{[n]:a}=i.useRecord(),{values:l}=j.useForm();return{run(){return Y(this,null,function*(){yield o.revision({filterByTk:a,values:l}),y.message.success(e("Operation succeeded")),t(),s(!1)})}}}}},cancel:{type:"void",title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}}}}}}}},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action.Link","x-component-props":{confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"},useAction:"{{ cm.useDestroyActionAndRefreshCM }}"}}}}}}}}}}}};function mn(e){const t=j.useField(),o=i.useRecord(),n=i.usePlugin(ce);return j.useFormEffects(s=>{he.onFieldChange("type",a=>{let l=o.id||!a.value;if(a.value){const c=n.triggers.get(a.value);c.sync!=null?(l=!0,t.setValue(c.sync)):t.setInitialValue(!1)}t.setPattern(l?"disabled":"editable")})}),b.useEffect(()=>{if(o.id){t.setPattern("disabled");const s=n.triggers.get(o.type);s.sync!=null?t.setValue(s.sync):t.setInitialValue(!1)}},[o.id,t,n.triggers]),r.jsx(Be,C({},e))}function fn(){const e=b.useContext(i.SchemaComponentContext),{getTriggersOptions:t}=i.usePlugin(ce);return r.jsx(y.Card,{bordered:!1,children:r.jsx(i.SchemaComponentContext.Provider,{value:T(C({},e),{designable:!1}),children:r.jsx(i.SchemaComponent,{schema:pn,components:{WorkflowLink:cn,ExecutionResourceProvider:an,ExecutionLink:zt,OpenDrawer:un,ExecutionStatusSelect:rn,SyncOptionSelect:mn,ExecutionStatusColumn:Ut},scope:{getTriggersOptions:t}})})})}function hn(n){var s=n,{collection:e,dataPath:t}=s,o=Q(s,["collection","dataPath"]);const{insert:a}=i.useSchemaInitializer(),{getTemplateSchemaByMode:l}=i.useSchemaTemplateManager(),{getCollection:c}=i.useCollectionManager_deprecated(),u=i.useRecordCollectionDataSourceItems("FormItem");let d;if(typeof e=="string"){const[h,x]=i.parseCollectionName(e);d=c(x,h)}else d=e;function f(x){return Y(this,arguments,function*({item:h}){const v=h.template?yield l(h):null,m={type:"void",name:Dt.uid(),title:d.title,"x-decorator":"DetailsBlockProvider","x-decorator-props":{collection:e,dataPath:t},"x-component":"CardItem","x-component-props":{title:o.title},"x-designer":"SimpleDesigner",properties:{grid:{type:"void","x-component":"FormV2","x-use-component-props":"useDetailsBlockProps","x-read-pretty":!0,properties:{grid:v||{type:"void","x-component":"Grid","x-initializer":"details:configureFields",properties:{}}}}}};vt(m,k=>{k["x-uid"]&&delete k["x-uid"]}),a(m)})}return r.jsx(i.SchemaInitializerItem,T(C({},o),{onClick:f,items:u}))}function Me(e){var a;const t=i.useSchemaInitializerItem(),o=(a=e==null?void 0:e.collection)!=null?a:t.collection;let n,s;if(typeof o=="string"){const l=i.parseCollectionName(o);n=l[0],s=l[1]}else s=o;return r.jsx(i.CollectionProvider_deprecated,{dataSource:n,collection:s,children:r.jsx(hn,C(C({},t),e))})}function yn(){return!0}const xt=j.observer(e=>{const d=e,{filter:t=yn}=d,o=Q(d,["filter"]),n=i.useCompile(),{getCollectionFields:s}=i.useCollectionManager_deprecated(),{values:a}=j.useForm(),[l,c]=i.parseCollectionName(a==null?void 0:a.collection),u=s(c,l);return r.jsx(y.Select,T(C({popupMatchSelectWidth:!1},o),{options:u.filter(t).map(f=>{var h;return{label:n((h=f.uiSchema)==null?void 0:h.title),value:f.name}})}))},{displayName:"FieldsSelect"}),le={type:"string",title:'{{t("Collection")}}',required:!0,"x-reactions":[],"x-decorator":"FormItem","x-component":"DataSourceCollectionCascader"},Yt={type:"object",title:'{{t("Fields values")}}',description:`{{t("Unassigned fields will be set to default values, and those without default values will be set to null.", { ns: "${p}" })}}`,"x-decorator":"FormItem","x-decorator-props":{labelAlign:"left",className:i.css`
|
|
443
443
|
flex-direction: column;
|
|
444
444
|
`},"x-component":"CollectionFieldset"},Ge={type:"object",title:'{{t("Filter")}}',"x-decorator":"FormItem","x-component":"Filter","x-use-component-props":()=>{const{values:e}=j.useForm(),[t,o]=i.parseCollectionName(e==null?void 0:e.collection);return{options:i.useCollectionFilterOptions(o,t),className:i.css`
|
|
445
445
|
position: relative;
|
|
446
446
|
width: 100%;
|
|
447
|
-
`}},"x-component-props":{dynamicComponent:"FilterDynamicComponent"}},gn={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"}}},bn={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}}}}}}},Ie={type:"array",title:`{{t("Preload associations", { ns: "${m}" })}}`,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: "${m}" })}}`,"x-decorator":"FormItem","x-component":"AppendsTreeSelect","x-component-props":{title:"Preload associations",multiple:!0,useCollection(){const{values:e}=j.useForm();return e==null?void 0:e.collection}},"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]},ke={label:"label",value:"value",children:"children"},qt={label:`{{t("Node result", { ns: "${m}" })}}`,value:"$jobsMapByNodeKey",useOptions(e){const{instructions:t}=i.usePlugin(ce),o=Ce(),n=It(o),s=[];return n.forEach(a=>{var u;const l=t.get(a.type),c=(u=l.useVariables)==null?void 0:u.call(l,a,e);c&&s.push(c)}),s}},Kt={label:`{{t("Trigger variables", { ns: "${m}" })}}`,value:"$context",useOptions(e){var s,a;const{triggers:t}=i.usePlugin(ce),{workflow:o}=q(),n=t.get(o.type);return(a=(s=n==null?void 0:n.useVariables)==null?void 0:s.call(n,o.config,e))!=null?a:null}},Zt={label:`{{t("Scope variables", { ns: "${m}" })}}`,value:"$scopes",useOptions(e){const{fieldNames:t=ke,current:o}=e,{instructions:n}=i.usePlugin(ce),s=Ce(),a=o!=null?o:s,l=Pt(a),c=[];return l.forEach(u=>{var b,x;const d=n.get(u.type),p=(b=d.useScopeVariables)==null?void 0:b.call(d,u,e);p&&c.push({key:u.key,[t.value]:u.key,[t.label]:(x=u.title)!=null?x:`#${u.id}`,[t.children]:p})}),c}},Qt={label:`{{t("System variables", { ns: "${m}" })}}`,value:"$system",useOptions({types:e,fieldNames:t=ke}){return[...!e||e.includes("date")?[{key:"now",[t.label]:E("System time"),[t.value]:"now"}]:[]]}},Ye={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 Xt(e,t){var o,n,s,a,l,c;return typeof t=="string"?(o=Ye[t])==null?void 0:o.has(e.interface):typeof t=="object"&&t.type==="reference"?wt(e)?((n=t.options)==null?void 0:n.entity)&&(e.collectionName===((s=t.options)==null?void 0:s.collection)||((a=t.options)==null?void 0:a.collection)==="*"):e.isForeignKey?e.collectionName===((l=t.options)==null?void 0:l.collection)&&e.name==="id"||e.target===((c=t.options)==null?void 0:c.collection):!1:typeof t=="function"?t(e):!1}function wt(e){return["belongsTo","hasOne","hasMany","belongsToMany"].includes(e.type)}function Ct(e,t){if(t==null)return null;const o=`${e.name}.`;return t.filter(n=>n.startsWith(o)).map(n=>n.replace(o,""))}function kt({fields:e,types:t,appends:o,depth:n=1,compile:s,getCollectionFields:a}){return e.filter(l=>{const c=t!=null&&t.length?t.some(u=>Xt(l,u)):!0;if(wt(l)){if(o===null)return n?c||kt({fields:St(l.target,{compile:s,getCollectionFields:a}),types:t,depth:n-1,appends:o,compile:s,getCollectionFields:a}):!1;const u=Ct(l,o),d=o.includes(l.name);return c?d:((u==null?void 0:u.length)||d)&&kt({fields:St(l.target,{compile:s,getCollectionFields:a}),types:t,appends:u,compile:s,getCollectionFields:a}).length}else return c})}function qe(e,t){var a,l;const o=i.useCompile(),n=(l=(a=e.useOptions)==null?void 0:a.call(e,t))==null?void 0:l.filter(Boolean),{fieldNames:s}=t;return{[s.label]:o(e.label),[s.value]:e.value,key:e[s.value],[s.children]:n,disabled:!n||!n.length}}function ge(e={}){var s;const t=Object.assign({},ke,(s=e.fieldNames)!=null?s:{}),o=Object.assign(e,{fieldNames:t});return[qe(Zt,o),qe(qt,o),qe(Kt,o),qe(Qt,o)]}function St(e,{compile:t,getCollectionFields:o}){var u,d,p,b,x,v,f;const[n,s]=i.parseCollectionName(e),a=o(s,n),l=[],c=[];a.forEach(k=>{k.isForeignKey?l.push(k):c.push(k)});for(let k=c.length-1;k>=0;k--){const S=c[k];if(S.type==="belongsTo"){const N=l.find(A=>A.name===S.foreignKey);N?c.splice(k,0,T(C(C({},S),N),{uiSchema:T(C({},S.uiSchema),{title:(u=S.uiSchema)!=null&&u.title?`${t((d=S.uiSchema)==null?void 0:d.title)} ID`:N.name})})):c.splice(k,0,T(C({},S),{name:S.foreignKey,type:"bigInt",isForeignKey:!0,interface:S.interface,uiSchema:T(C({},S.uiSchema),{title:(p=S.uiSchema)!=null&&p.title?`${t((b=S.uiSchema)==null?void 0:b.title)} ID`:S.name})}))}else if(S.type==="context"&&S.collectionName==="users"){const N=(x=c.find(A=>A.type==="belongsTo"&&A.target==="users"&&A.foreignKey===S.name))!=null?x:{};c.splice(k,0,T(C({},S),{type:S.dataType,interface:N.interface,uiSchema:T(C({},N.uiSchema),{title:(v=N.uiSchema)!=null&&v.title?`${t((f=N.uiSchema)==null?void 0:f.title)} ID`:S.name})}))}}return c.filter(k=>k.interface&&!k.hidden)}function vn(e){const t=Ct(e.field,e.appends),o=Se(C({collection:`${e.field.dataSourceKey&&e.field.dataSourceKey!=="main"?`${e.field.dataSourceKey}:`:""}${e.field.target}`,types:e.types,appends:t,depth:e.depth-1},this));e.loadChildren=null,o.length?e.children=o:(e.isLeaf=!0,!e.types||e.types.some(s=>Xt(e.field,s))||(e.disabled=!0))}function Se(e){const{fields:t,collection:o,types:n,appends:s=[],depth:a=1,compile:l,getCollectionFields:c,fieldNames:u=ke}=e,d=t!=null?t:St(o,{compile:l,getCollectionFields:c}),p=vn.bind({compile:l,getCollectionFields:c,fieldNames:u});return kt({fields:d,types:n,depth:a,appends:s,compile:l,getCollectionFields:c}).map(x=>{var S;const v=l(((S=x.uiSchema)==null?void 0:S.title)||x.name),f=Ct(x,s),k=!wt(x)||f&&!f.length&&!s.includes(x.name)||!1;return{[u.label]:v,key:x.name,[u.value]:x.name,isLeaf:k,loadChildren:k?null:p,field:x,depth:a,appends:s,types:n}})}function Rt(o){var n=o,{variableOptions:e}=n,t=Q(n,["variableOptions"]);const s=ge(e);return r.jsx(i.Variable.Input,C({scope:s},t))}function At(o){var n=o,{variableOptions:e}=n,t=Q(n,["variableOptions"]);const s=ge(e);return r.jsx(i.Variable.TextArea,C({scope:s},t))}function xn(o){var n=o,{variableOptions:e}=n,t=Q(n,["variableOptions"]);const s=ge(e);return r.jsx(i.Variable.RawTextArea,C({scope:s},t))}function wn(o){var n=o,{variableOptions:e}=n,t=Q(n,["variableOptions"]);const s=ge(e);return r.jsx(i.Variable.JSON,C({scope:s},t))}function Cn(){const e=i.useAPIClient(),t=j.useForm(),{field:o,__parent:n}=i.useBlockRequestContext(),{setVisible:s}=i.useActionContext(),a=oe.useNavigate(),l=j.useFieldSchema(),c=j.useField(),u=i.useCompile(),{modal:d}=h.App.useApp(),p=i.useCollectValuesToSubmit(),b=c.componentProps.filterKeys||[];return{onClick(){return Y(this,null,function*(){var N,A,P;const{onSuccess:v,skipValidator:f,triggerWorkflows:k}=(N=l==null?void 0:l["x-action-settings"])!=null?N:{};f||(yield t.submit());const S=yield p();c.data=o.data||{},c.data.loading=!0;try{const z=yield e.resource("workflows").trigger({values:S,filterKeys:b,triggerWorkflows:k!=null&&k.length?k.map(U=>[U.workflowKey,U.context].filter(Boolean).join("!")).join(","):void 0});if(c.data.loading=!1,c.data.data=z,(P=(A=n==null?void 0:n.service)==null?void 0:A.refresh)==null||P.call(A),s==null||s(!1),!(v!=null&&v.successMessage))return;v!=null&&v.manualClose?d.success({title:u(v==null?void 0:v.successMessage),onOk:()=>Y(this,null,function*(){yield t.reset(),v!=null&&v.redirecting&&(v!=null&&v.redirectTo)&&(H.isURL(v.redirectTo)?window.location.href=v.redirectTo:a(v.redirectTo))})}):h.message.success(u(v==null?void 0:v.successMessage))}catch(z){c.data.loading=!1}})}}}function kn(){var x;const e=i.useCompile(),t=i.useAPIClient(),o=i.useRecord(),n=j.useField(),s=j.useFieldSchema(),{field:a,__parent:l}=i.useBlockRequestContext(),{setVisible:c}=i.useActionContext(),{modal:u}=h.App.useApp(),d=oe.useNavigate(),{onSuccess:p,triggerWorkflows:b}=(x=s==null?void 0:s["x-action-settings"])!=null?x:{};return{onClick(){return Y(this,null,function*(){var f,k;n.data=a.data||{},n.data.loading=!0;try{if(yield t.resource("workflows").trigger({values:o,triggerWorkflows:b!=null&&b.length?b.map(S=>[S.workflowKey,S.context].filter(Boolean).join("!")).join(","):void 0}),(k=(f=l==null?void 0:l.service)==null?void 0:f.refresh)==null||k.call(f),c==null||c(!1),!(p!=null&&p.successMessage))return;if(p!=null&&p.manualClose){let S;u.success({title:e(p==null?void 0:p.successMessage),onOk(){return Y(this,null,function*(){p!=null&&p.redirecting&&(p!=null&&p.redirectTo)&&(H.isURL(p.redirectTo)?window.location.href=p.redirectTo:d(p.redirectTo))})}})}else h.message.success(e(p==null?void 0:p.successMessage))}catch(S){console.error(S)}finally{n.data.loading=!1}})}}}function Sn(){const{workflow:e}=q();return!!(e!=null&&e.executed)}function eo(){const{workflow:e}=q();return!!(e!=null&&e.allExecuted)}const Ae={CREATED:1,UPDATED:2,SAVED:3,DELETED:4},An=[{label:`{{t("After record added", { ns: "${m}" })}}`,value:Ae.CREATED},{label:`{{t("After record updated", { ns: "${m}" })}}`,value:Ae.UPDATED},{label:`{{t("After record added or updated", { ns: "${m}" })}}`,value:Ae.SAVED},{label:`{{t("After record deleted", { ns: "${m}" })}}`,value:Ae.DELETED}];class On extends yt{constructor(){super(...arguments);w(this,"title",`{{t("Collection event", { ns: "${m}" })}}`);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: "${m}" })}}`);w(this,"fieldset",{collection:T(C({},le),{"x-disabled":"{{ useWorkflowAnyExecuted() }}","x-component-props":{dataSourceFilter(o){return o.options.key==="main"||o.options.isDBInstance}},"x-reactions":[...le["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: "${m}" })}}`,"x-decorator":"FormItem","x-component":"Select","x-component-props":{popupMatchSelectWidth:!1,placeholder:`{{t("Trigger on", { ns: "${m}" })}}`,className:"auto-width"},enum:An,required:!0,"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]},changed:{type:"array",title:`{{t("Changed fields", { ns: "${m}" })}}`,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: "${m}" })}}`,"x-decorator":"FormItem","x-component":"FieldsSelect","x-component-props":{mode:"multiple",placeholder:'{{t("Select field")}}',filter(o){return!o.hidden&&(o.uiSchema?!o.uiSchema["x-read-pretty"]:!0)&&!["linkTo","hasOne","hasMany","belongsToMany"].includes(o.type)}},"x-reactions":[{dependencies:["collection","mode"],fulfill:{state:{visible:`{{!!$deps[0] && ($deps[1] & ${Ae.UPDATED})}}`}}}]},condition:T(C({},Ge),{title:`{{t("Only triggers when match conditions", { ns: "${m}" })}}`,"x-component-props":{},"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]}),appends:T(C({},Ie),{"x-reactions":[...Ie["x-reactions"],{dependencies:["mode"],fulfill:{state:{visible:`{{!($deps[0] & ${Ae.DELETED})}}`}}}]})});w(this,"scope",{useCollectionDataSource:i.useCollectionDataSource,useWorkflowAnyExecuted:eo});w(this,"components",{FieldsSelect:xt})}useVariables(o,n){var u;const s=i.useCompile(),{getCollectionFields:a}=i.useCollectionManager_deprecated(),l=[{collectionName:o.collection,name:"data",type:"hasOne",target:o.collection,uiSchema:{title:E("Trigger data")}}];return Se(T(C({appends:["data",...((u=o.appends)==null?void 0:u.map(d=>`data.${d}`))||[]]},n),{fields:l,compile:s,getCollectionFields:a}))}useInitializers(o){return o.collection?{name:"triggerData",type:"item",key:"triggerData",title:`{{t("Trigger data", { ns: "${m}" })}}`,Component:Me,collection:o.collection,dataPath:"$context.data"}:null}}const xe={STATIC:0,DATE_FIELD:1};function Tn(e){return!e.hidden&&(e.uiSchema?e.type==="date":!1)}function to({value:e,onChange:t}){const o=e!=null?e:{},{t:n}=_.useTranslation(),[s,a]=g.useState(o.offset?o.offset/Math.abs(o.offset):0);return r.jsxs("fieldset",{className:i.css`
|
|
447
|
+
`}},"x-component-props":{dynamicComponent:"FilterDynamicComponent"}},gn={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"}}},bn={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}}}}}}},Ie={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}=j.useForm();return e==null?void 0:e.collection}},"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]},ke={label:"label",value:"value",children:"children"},qt={label:`{{t("Node result", { ns: "${p}" })}}`,value:"$jobsMapByNodeKey",useOptions(e){const{instructions:t}=i.usePlugin(ce),o=Ce(),n=It(o),s=[];return n.forEach(a=>{var u;const l=t.get(a.type),c=(u=l.useVariables)==null?void 0:u.call(l,a,e);c&&s.push(c)}),s}},Kt={label:`{{t("Trigger variables", { ns: "${p}" })}}`,value:"$context",useOptions(e){var s,a;const{triggers:t}=i.usePlugin(ce),{workflow:o}=q(),n=t.get(o.type);return(a=(s=n==null?void 0:n.useVariables)==null?void 0:s.call(n,o.config,e))!=null?a:null}},Zt={label:`{{t("Scope variables", { ns: "${p}" })}}`,value:"$scopes",useOptions(e){const{fieldNames:t=ke,current:o}=e,{instructions:n}=i.usePlugin(ce),s=Ce(),a=o!=null?o:s,l=Pt(a),c=[];return l.forEach(u=>{var h,x;const d=n.get(u.type),f=(h=d.useScopeVariables)==null?void 0:h.call(d,u,e);f&&c.push({key:u.key,[t.value]:u.key,[t.label]:(x=u.title)!=null?x:`#${u.id}`,[t.children]:f})}),c}},Qt={label:`{{t("System variables", { ns: "${p}" })}}`,value:"$system",useOptions({types:e,fieldNames:t=ke}){return[...!e||e.includes("date")?[{key:"now",[t.label]:E("System time"),[t.value]:"now"}]:[]]}},Ye={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 Xt(e,t){var o,n,s,a,l,c;return typeof t=="string"?(o=Ye[t])==null?void 0:o.has(e.interface):typeof t=="object"&&t.type==="reference"?wt(e)?((n=t.options)==null?void 0:n.entity)&&(e.collectionName===((s=t.options)==null?void 0:s.collection)||((a=t.options)==null?void 0:a.collection)==="*"):e.isForeignKey?e.collectionName===((l=t.options)==null?void 0:l.collection)&&e.name==="id"||e.target===((c=t.options)==null?void 0:c.collection):!1:typeof t=="function"?t(e):!1}function wt(e){return["belongsTo","hasOne","hasMany","belongsToMany"].includes(e.type)}function Ct(e,t){if(t==null)return null;const o=`${e.name}.`;return t.filter(n=>n.startsWith(o)).map(n=>n.replace(o,""))}function kt({fields:e,types:t,appends:o,depth:n=1,compile:s,getCollectionFields:a}){return e.filter(l=>{const c=t!=null&&t.length?t.some(u=>Xt(l,u)):!0;if(wt(l)){if(o===null)return n?c||kt({fields:St(l.target,{compile:s,getCollectionFields:a}),types:t,depth:n-1,appends:o,compile:s,getCollectionFields:a}):!1;const u=Ct(l,o),d=o.includes(l.name);return c?d:((u==null?void 0:u.length)||d)&&kt({fields:St(l.target,{compile:s,getCollectionFields:a}),types:t,appends:u,compile:s,getCollectionFields:a}).length}else return c})}function qe(e,t){var a,l;const o=i.useCompile(),n=(l=(a=e.useOptions)==null?void 0:a.call(e,t))==null?void 0:l.filter(Boolean),{fieldNames:s}=t;return{[s.label]:o(e.label),[s.value]:e.value,key:e[s.value],[s.children]:n,disabled:!n||!n.length}}function ge(e={}){var s;const t=Object.assign({},ke,(s=e.fieldNames)!=null?s:{}),o=Object.assign(e,{fieldNames:t});return[qe(Zt,o),qe(qt,o),qe(Kt,o),qe(Qt,o)]}function St(e,{compile:t,getCollectionFields:o}){var u,d,f,h,x,v,m;const[n,s]=i.parseCollectionName(e),a=o(s,n),l=[],c=[];a.forEach(k=>{k.isForeignKey?l.push(k):c.push(k)});for(let k=c.length-1;k>=0;k--){const S=c[k];if(S.type==="belongsTo"){const N=l.find(A=>A.name===S.foreignKey);N?c.splice(k,0,T(C(C({},S),N),{uiSchema:T(C({},S.uiSchema),{title:(u=S.uiSchema)!=null&&u.title?`${t((d=S.uiSchema)==null?void 0:d.title)} ID`:N.name})})):c.splice(k,0,T(C({},S),{name:S.foreignKey,type:"bigInt",isForeignKey:!0,interface:S.interface,uiSchema:T(C({},S.uiSchema),{title:(f=S.uiSchema)!=null&&f.title?`${t((h=S.uiSchema)==null?void 0:h.title)} ID`:S.name})}))}else if(S.type==="context"&&S.collectionName==="users"){const N=(x=c.find(A=>A.type==="belongsTo"&&A.target==="users"&&A.foreignKey===S.name))!=null?x:{};c.splice(k,0,T(C({},S),{type:S.dataType,interface:N.interface,uiSchema:T(C({},N.uiSchema),{title:(v=N.uiSchema)!=null&&v.title?`${t((m=N.uiSchema)==null?void 0:m.title)} ID`:S.name})}))}}return c.filter(k=>k.interface&&!k.hidden)}function vn(e){const t=Ct(e.field,e.appends),o=Se(C({collection:`${e.field.dataSourceKey&&e.field.dataSourceKey!=="main"?`${e.field.dataSourceKey}:`:""}${e.field.target}`,types:e.types,appends:t,depth:e.depth-1},this));e.loadChildren=null,o.length?e.children=o:(e.isLeaf=!0,!e.types||e.types.some(s=>Xt(e.field,s))||(e.disabled=!0))}function Se(e){const{fields:t,collection:o,types:n,appends:s=[],depth:a=1,compile:l,getCollectionFields:c,fieldNames:u=ke}=e,d=t!=null?t:St(o,{compile:l,getCollectionFields:c}),f=vn.bind({compile:l,getCollectionFields:c,fieldNames:u});return kt({fields:d,types:n,depth:a,appends:s,compile:l,getCollectionFields:c}).map(x=>{var S;const v=l(((S=x.uiSchema)==null?void 0:S.title)||x.name),m=Ct(x,s),k=!wt(x)||m&&!m.length&&!s.includes(x.name)||!1;return{[u.label]:v,key:x.name,[u.value]:x.name,isLeaf:k,loadChildren:k?null:f,field:x,depth:a,appends:s,types:n}})}function Rt(o){var n=o,{variableOptions:e}=n,t=Q(n,["variableOptions"]);const s=ge(e);return r.jsx(i.Variable.Input,C({scope:s},t))}function At(o){var n=o,{variableOptions:e}=n,t=Q(n,["variableOptions"]);const s=ge(e);return r.jsx(i.Variable.TextArea,C({scope:s},t))}function xn(o){var n=o,{variableOptions:e}=n,t=Q(n,["variableOptions"]);const s=ge(e);return r.jsx(i.Variable.RawTextArea,C({scope:s},t))}function wn(o){var n=o,{variableOptions:e}=n,t=Q(n,["variableOptions"]);const s=ge(e);return r.jsx(i.Variable.JSON,C({scope:s},t))}function Cn(){const e=i.useAPIClient(),t=j.useForm(),{field:o,__parent:n}=i.useBlockRequestContext(),{setVisible:s}=i.useActionContext(),a=oe.useNavigate(),l=j.useFieldSchema(),c=j.useField(),u=i.useCompile(),{modal:d}=y.App.useApp(),f=i.useCollectValuesToSubmit(),h=c.componentProps.filterKeys||[];return{onClick(){return Y(this,null,function*(){var N,A,P;const{onSuccess:v,skipValidator:m,triggerWorkflows:k}=(N=l==null?void 0:l["x-action-settings"])!=null?N:{};m||(yield t.submit());const S=yield f();c.data=o.data||{},c.data.loading=!0;try{const z=yield e.resource("workflows").trigger({values:S,filterKeys:h,triggerWorkflows:k!=null&&k.length?k.map(U=>[U.workflowKey,U.context].filter(Boolean).join("!")).join(","):void 0});if(c.data.loading=!1,c.data.data=z,(P=(A=n==null?void 0:n.service)==null?void 0:A.refresh)==null||P.call(A),s==null||s(!1),!(v!=null&&v.successMessage))return;v!=null&&v.manualClose?d.success({title:u(v==null?void 0:v.successMessage),onOk:()=>Y(this,null,function*(){yield t.reset(),v!=null&&v.redirecting&&(v!=null&&v.redirectTo)&&(H.isURL(v.redirectTo)?window.location.href=v.redirectTo:a(v.redirectTo))})}):y.message.success(u(v==null?void 0:v.successMessage))}catch(z){c.data.loading=!1}})}}}function kn(){var v;const e=i.useCompile(),t=i.useAPIClient(),o=i.useRecord(),n=j.useField(),s=j.useFieldSchema(),{field:a,__parent:l}=i.useBlockRequestContext(),{setVisible:c,setSubmitted:u}=i.useActionContext(),{modal:d}=y.App.useApp(),f=oe.useNavigate(),{onSuccess:h,triggerWorkflows:x}=(v=s==null?void 0:s["x-action-settings"])!=null?v:{};return{onClick(k,S){return Y(this,null,function*(){n.data=a.data||{},n.data.loading=!0;try{if(yield t.resource("workflows").trigger({values:o,triggerWorkflows:x!=null&&x.length?x.map(N=>[N.workflowKey,N.context].filter(Boolean).join("!")).join(","):void 0}),S&&S(),c==null||c(!1),u==null||u(!0),!(h!=null&&h.successMessage))return;if(h!=null&&h.manualClose){let N;d.success({title:e(h==null?void 0:h.successMessage),onOk(){return Y(this,null,function*(){h!=null&&h.redirecting&&(h!=null&&h.redirectTo)&&(H.isURL(h.redirectTo)?window.location.href=h.redirectTo:f(h.redirectTo))})}})}else y.message.success(e(h==null?void 0:h.successMessage))}catch(N){console.error(N)}finally{n.data.loading=!1}})}}}function Sn(){const{workflow:e}=q();return!!(e!=null&&e.executed)}function eo(){const{workflow:e}=q();return!!(e!=null&&e.allExecuted)}const Ae={CREATED:1,UPDATED:2,SAVED:3,DELETED:4},An=[{label:`{{t("After record added", { ns: "${p}" })}}`,value:Ae.CREATED},{label:`{{t("After record updated", { ns: "${p}" })}}`,value:Ae.UPDATED},{label:`{{t("After record added or updated", { ns: "${p}" })}}`,value:Ae.SAVED},{label:`{{t("After record deleted", { ns: "${p}" })}}`,value:Ae.DELETED}];class On extends yt{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:T(C({},le),{"x-disabled":"{{ useWorkflowAnyExecuted() }}","x-component-props":{dataSourceFilter(o){return o.options.key==="main"||o.options.isDBInstance}},"x-reactions":[...le["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:An,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(o){return!o.hidden&&(o.uiSchema?!o.uiSchema["x-read-pretty"]:!0)&&!["linkTo","hasOne","hasMany","belongsToMany"].includes(o.type)}},"x-reactions":[{dependencies:["collection","mode"],fulfill:{state:{visible:`{{!!$deps[0] && ($deps[1] & ${Ae.UPDATED})}}`}}}]},condition:T(C({},Ge),{title:`{{t("Only triggers when match conditions", { ns: "${p}" })}}`,"x-component-props":{},"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]}),appends:T(C({},Ie),{"x-reactions":[...Ie["x-reactions"],{dependencies:["mode"],fulfill:{state:{visible:`{{!($deps[0] & ${Ae.DELETED})}}`}}}]})});w(this,"scope",{useCollectionDataSource:i.useCollectionDataSource,useWorkflowAnyExecuted:eo});w(this,"components",{FieldsSelect:xt})}useVariables(o,n){var u;const s=i.useCompile(),{getCollectionFields:a}=i.useCollectionManager_deprecated(),l=[{collectionName:o.collection,name:"data",type:"hasOne",target:o.collection,uiSchema:{title:E("Trigger data")}}];return Se(T(C({appends:["data",...((u=o.appends)==null?void 0:u.map(d=>`data.${d}`))||[]]},n),{fields:l,compile:s,getCollectionFields:a}))}useInitializers(o){return o.collection?{name:"triggerData",type:"item",key:"triggerData",title:`{{t("Trigger data", { ns: "${p}" })}}`,Component:Me,collection:o.collection,dataPath:"$context.data"}:null}}const xe={STATIC:0,DATE_FIELD:1};function Tn(e){return!e.hidden&&(e.uiSchema?e.type==="date":!1)}function to({value:e,onChange:t}){const o=e!=null?e:{},{t:n}=_.useTranslation(),[s,a]=b.useState(o.offset?o.offset/Math.abs(o.offset):0);return r.jsxs("fieldset",{className:i.css`
|
|
448
448
|
display: flex;
|
|
449
449
|
gap: 0.5em;
|
|
450
|
-
`,children:[r.jsx(xt,{value:o.field,onChange:l=>t(T(C({},o),{field:l})),filter:Tn,placeholder:n("Select field"),className:"auto-width"}),o.field?r.jsx(
|
|
450
|
+
`,children:[r.jsx(xt,{value:o.field,onChange:l=>t(T(C({},o),{field:l})),filter:Tn,placeholder:n("Select field"),className:"auto-width"}),o.field?r.jsx(y.Select,{value:s,onChange:l=>{a(l),t(T(C({},o),{offset:Math.abs(o.offset)*l}))},options:[{value:0,label:E("Exactly at")},{value:-1,label:n("Before")},{value:1,label:n("After")}],className:"auto-width"}):null,s?r.jsxs(r.Fragment,{children:[r.jsx(y.InputNumber,{value:Math.abs(o.offset),onChange:l=>t(T(C({},o),{offset:(l!=null?l:0)*s}))}),r.jsx(y.Select,{value:o.unit||864e5,onChange:l=>t(T(C({},o),{unit:l})),options:[{value:864e5,label:E("Days")},{value:36e5,label:E("Hours")},{value:6e4,label:E("Minutes")},{value:1e3,label:E("Seconds")}],className:"auto-width"})]}):null]})}function Fn({value:e,onChange:t}){const{t:o}=dt(),n=e!=null?typeof e=="object"&&!(e instanceof Date)?"field":"date":null;return r.jsxs("fieldset",{className:i.css`
|
|
451
451
|
display: flex;
|
|
452
452
|
gap: 0.5em;
|
|
453
|
-
`,children:[r.jsxs(h.Select,{value:n,onChange:s=>{t(s?s==="field"?{}:new Date:null)},className:"auto-width",children:[r.jsx(h.Select.Option,{value:null,children:o("No end")}),r.jsx(h.Select.Option,{value:"field",children:o("By field")}),r.jsx(h.Select.Option,{value:"date",children:o("By custom date")})]}),n==="field"?r.jsx(to,{value:e,onChange:t}):null,n==="date"?r.jsx(h.DatePicker,{showTime:!0,value:Wo(e),onChange:s=>{t(s?s.toDate():null)}}):null]})}var re=function(){return re=Object.assign||function(e){for(var t,o=1,n=arguments.length;o<n;o++)for(var s in t=arguments[o])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e},re.apply(this,arguments)};function oo(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function"){var s=0;for(n=Object.getOwnPropertySymbols(e);s<n.length;s++)t.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(e,n[s])&&(o[n[s]]=e[n[s]])}return o}function Ke(e,t,o){if(o||arguments.length===2)for(var n,s=0,a=t.length;s<a;s++)!n&&s in t||(n||(n=Array.prototype.slice.call(t,0,s)),n[s]=t[s]);return e.concat(n||Array.prototype.slice.call(t))}var Nn=[{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 * * * *"}],we=[{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"]}],B={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 no(e,t){for(var o=[],n=e;n<=t;n++)o.push(n);return o}function Ze(e){return e.sort(function(t,o){return t-o}),e}function ro(e){var t=[];return e.forEach(function(o){t.indexOf(o)<0&&t.push(o)}),t}function ae(e){return Object.entries(e).filter(function(t){var o=t[0],n=t[1];return o&&n}).map(function(t){return t[0]}).join(" ")}function so(e,t){e&&e({type:"invalid_cron",description:t.errorInvalidCron||B.errorInvalidCron})}function Qe(e){var t=parseInt(e,10),o=Number(e);return t===o?o:NaN}function io(e,t,o,n,s,a,l,c,u,d,p,b,x,v){o&&o(void 0),t(!1);var f=!1;if(!e){if(n==="always"||a&&n==="for-default-value")return;f=!0}if(!f){if(c&&(c===!0||c.includes(e))){if(e==="@reboot")return void v("reboot");var k=Nn.find(function(A){return A.name===e});k&&(e=k.value)}try{var S=function(A){if(typeof A!="string")throw new Error("Invalid cron string");var P=A.replace(/\s+/g," ").trim().split(" ");if(P.length===5)return P.map(function(z,U){return function(F,$){if(F==="*"||F==="*/1")return[];var O=Ze(ro(uo(function(L,J,ue){if(ue){L=L.toUpperCase();for(var D=0;D<ue.length;D++)L=L.replace(ue[D],"".concat(D+J))}return L}(F,$.min,$.alt).split(",").map(function(L){var J,ue=L.split("/");if(ue.length>2)throw new Error('Invalid value "'.concat(F,' for "').concat($.type,'"'));var D=ue[0],V=ue[1];J=D==="*"?no($.min,$.max):function(G,K,R){var ee=G.split("-");if(ee.length===1){var Ve=Qe(ee[0]);if(isNaN(Ve))throw new Error('Invalid value "'.concat(K,'" for ').concat(R.type));return[Ve]}if(ee.length===2){var me=Qe(ee[0]),Fe=Qe(ee[1]);if(isNaN(me)||isNaN(Fe))throw new Error('Invalid value "'.concat(K,'" for ').concat(R.type));if(Fe<me)throw new Error('Max range is less than min range in "'.concat(G,'" for ').concat(R.type));return no(me,Fe)}throw new Error('Invalid value "'.concat(G,'" for ').concat(R.type))}(D,F,$);var W=function(G,K){if(G!==void 0){var R=Qe(G);if(isNaN(R)||R<1)throw new Error('Invalid interval step value "'.concat(G,'" for ').concat(K.type));return R}}(V,$),se=function(G,K){if(K){var R=G[0];G=G.filter(function(ee){return ee%K==R%K||ee===R})}return G}(J,W);return se}).flat(),$))),I=po(O,$);if(I!==void 0)throw new Error('Value "'.concat(I,'" out of range for ').concat($.type));return O.length===$.total?[]:O}(z,we[U])});throw new Error("Invalid cron string format")}(e),N=function(A){return A[3].length>0?"year":A[2].length>0?"month":A[4].length>0?"week":A[1].length>0?"day":A[0].length>0?"hour":"minute"}(S);v(N),u(S[0]),d(S[1]),p(S[2]),b(S[3]),x(S[4])}catch(A){f=!0}}f&&(s.current=e,t(!0),so(o,l))}function lo(e,t,o,n,s,a,l){if(e==="reboot")return"@reboot";var c=function(u,d){return u.map(function(p,b){var x=we[b];return ao(co(p,x),x,d)})}([e!=="minute"&&a?a:[],e!=="minute"&&e!=="hour"&&s?s:[],e!=="year"&&e!=="month"||!o?[]:o,e==="year"&&t?t:[],e!=="year"&&e!=="month"&&e!=="week"||!n?[]:n],l);return c.join(" ")}function ao(e,t,o,n,s){var a="";if(function(c,u){return c.length===u.max-u.min+1}(e,t)||e.length===0)a="*";else{var l=function(c){if(c.length>2){var u=c[1]-c[0];if(u>1)return u}}(e);a=l&&function(c,u){for(var d=1;d<c.length;d++){var p=c[d-1];if(c[d]-p!==u)return!1}return!0}(e,l)?function(c,u,d){var p=mo(c),b=fo(c),x=c.length===(b-p)/d+1;return!!(p===u.min&&b+d>u.max&&x)}(e,t,l)?"*/".concat(l):"".concat(Oe(mo(e),t,o,n,s),"-").concat(Oe(fo(e),t,o,n,s),"/").concat(l):function(c){var u=[],d=null;return c.forEach(function(p,b,x){p!==x[b+1]-1?d!==null?(u.push([d,p]),d=null):u.push(p):d===null&&(d=p)}),u}(e).map(function(c){return Array.isArray(c)?"".concat(Oe(c[0],t,o,n,s),"-").concat(Oe(c[1],t,o,n,s)):Oe(c,t,o,n,s)}).join(",")}return a}function Oe(e,t,o,n,s){var a=e.toString(),l=t.type,c=t.alt,u=t.min,d=n&&(n===!0||n.includes(l)),p=s==="24-hour-clock"&&(l==="hours"||l==="minutes");if(o&&l==="week-days"||o&&l==="months"?a=c[e-u]:e<10&&(d||p)&&(a=a.padStart(2,"0")),l==="hours"&&s==="12-hour-clock"){var b=e>=12?"PM":"AM",x=e%12||12;x<10&&d&&(x=x.toString().padStart(2,"0")),a="".concat(x).concat(b)}return a}function co(e,t){var o=Ze(ro(uo(e,t)));if(o.length===0)return o;var n=po(o,t);if(n!==void 0)throw new Error('Value "'.concat(n,'" out of range for ').concat(t.type));return o}function uo(e,t){return t.type==="week-days"&&(e=e.map(function(o){return o===7?0:o})),e}function po(e,t){var o=e[0],n=e[e.length-1];return o<t.min?o:n>t.max?n:void 0}function mo(e){return e[0]}function fo(e){return e[e.length-1]}function Pe(e){var t=e.value,o=e.grid,n=o===void 0||o,s=e.optionsList,a=e.setValue,l=e.locale,c=e.className,u=e.humanizeLabels,d=e.disabled,p=e.readOnly,b=e.leadingZero,x=e.clockFormat,v=e.period,f=e.unit,k=e.periodicityOnDoubleClick,S=e.mode,N=oo(e,["value","grid","optionsList","setValue","locale","className","humanizeLabels","disabled","readOnly","leadingZero","clockFormat","period","unit","periodicityOnDoubleClick","mode"]),A=g.useMemo(function(){if(t&&Array.isArray(t))return t.map(function(D){return D.toString()})},[t]),P=g.useMemo(function(){return s?s.map(function(D,V){return{value:(f.min===0?V:V+1).toString(),label:D}}):Ke([],Array(f.total),!0).map(function(D,V){var W=f.min===0?V:V+1;return{value:W.toString(),label:Oe(W,f,u,b,x)}})},[s,b,u,x]),z=JSON.stringify(l),U=g.useCallback(function(D){var V=D.value;if(!t||t[0]!==Number(V))return r.jsx(r.Fragment,{});var W=ao(co(t,f),f,u,b,x),se=W.match(/^\*\/([0-9]+),?/)||[];return r.jsx("div",{children:se[1]?"".concat(l.everyText||B.everyText," ").concat(se[1]):W})},[t,z,u,b,x]),F=g.useCallback(function(D){var V=Array.isArray(D)?Ze(D):[D],W=V;t&&(W=S==="single"?[]:Ke([],t,!0),V.forEach(function(se){var G=Number(se);W=t.some(function(K){return K===G})?W.filter(function(K){return K!==G}):Ze(Ke(Ke([],W,!0),[G],!1))})),W.length===f.total?a([]):a(W)},[a,t]),$=g.useCallback(function(D){if(D!==0&&D!==1){for(var V=f.total+f.min,W=[],se=f.min;se<V;se++)se%D==0&&W.push(se);var G=t&&W&&t.length===W.length&&t.every(function(R,ee){return R===W[ee]}),K=W.length===P.length;a(K||G?[]:W)}else a([])},[t,P,a]),O=g.useRef([]),I=g.useCallback(function(D){if(!p){var V=O.current;V.push({time:new Date().getTime(),value:Number(D)});var W=window.setTimeout(function(){k&&V.length>1&&V[V.length-1].time-V[V.length-2].time<300?V[V.length-1].value===V[V.length-2].value?$(Number(D)):F([V[V.length-2].value,V[V.length-1].value]):F(Number(D)),O.current=[]},300);return function(){window.clearTimeout(W)}}},[O,F,$,p,k]),L=g.useCallback(function(){p||a([])},[a,p]),J=g.useMemo(function(){var D;return ae(((D={"react-js-cron-select":!0,"react-js-cron-custom-select":!0})["".concat(c,"-select")]=!!c,D))},[c]),ue=g.useMemo(function(){var D;return ae(((D={"react-js-cron-select-dropdown":!0})["react-js-cron-select-dropdown-".concat(f.type)]=!0,D["react-js-cron-custom-select-dropdown"]=!0,D["react-js-cron-custom-select-dropdown-".concat(f.type)]=!0,D["react-js-cron-custom-select-dropdown-minutes-large"]=f.type==="minutes"&&v!=="hour"&&v!=="day",D["react-js-cron-custom-select-dropdown-minutes-medium"]=f.type==="minutes"&&(v==="day"||v==="hour"),D["react-js-cron-custom-select-dropdown-hours-twelve-hour-clock"]=f.type==="hours"&&x==="12-hour-clock",D["react-js-cron-custom-select-dropdown-grid"]=!!n,D["".concat(c,"-select-dropdown")]=!!c,D["".concat(c,"-select-dropdown-").concat(f.type)]=!!c,D))},[c,n,x,v]);return r.jsx(h.Select,re({mode:S!=="single"||k?"multiple":void 0,allowClear:!p,virtual:!1,open:!p&&void 0,value:A,onClear:L,tagRender:U,className:J,popupClassName:ue,options:P,showSearch:!1,showArrow:!p,menuItemSelectedIcon:null,dropdownMatchSelectWidth:!1,onSelect:I,onDeselect:I,disabled:d,dropdownAlign:f.type!=="minutes"&&f.type!=="hours"||v==="day"||v==="hour"?void 0:{points:["tr","br"]},"data-testid":"custom-select-".concat(f.type)},N))}function Dn(e){var t=e.value,o=e.setValue,n=e.locale,s=e.className,a=e.disabled,l=e.readOnly,c=e.leadingZero,u=e.clockFormat,d=e.period,p=e.periodicityOnDoubleClick,b=e.mode,x=g.useMemo(function(){var v;return ae(((v={"react-js-cron-field":!0,"react-js-cron-hours":!0})["".concat(s,"-field")]=!!s,v["".concat(s,"-hours")]=!!s,v))},[s]);return r.jsxs("div",re({className:x},{children:[n.prefixHours!==""&&r.jsx("span",{children:n.prefixHours||B.prefixHours}),r.jsx(Pe,{placeholder:n.emptyHours||B.emptyHours,value:t,unit:we[1],setValue:o,locale:n,className:s,disabled:a,readOnly:l,leadingZero:c,clockFormat:u,period:d,periodicityOnDoubleClick:p,mode:b})]}))}function En(e){var t=e.value,o=e.setValue,n=e.locale,s=e.className,a=e.disabled,l=e.readOnly,c=e.leadingZero,u=e.clockFormat,d=e.period,p=e.periodicityOnDoubleClick,b=e.mode,x=g.useMemo(function(){var v;return ae(((v={"react-js-cron-field":!0,"react-js-cron-minutes":!0})["".concat(s,"-field")]=!!s,v["".concat(s,"-minutes")]=!!s,v))},[s]);return r.jsxs("div",re({className:x},{children:[d==="hour"?n.prefixMinutesForHourPeriod!==""&&r.jsx("span",{children:n.prefixMinutesForHourPeriod||B.prefixMinutesForHourPeriod}):n.prefixMinutes!==""&&r.jsx("span",{children:n.prefixMinutes||B.prefixMinutes}),r.jsx(Pe,{placeholder:d==="hour"?n.emptyMinutesForHourPeriod||B.emptyMinutesForHourPeriod:n.emptyMinutes||B.emptyMinutes,value:t,unit:we[0],setValue:o,locale:n,className:s,disabled:a,readOnly:l,leadingZero:c,clockFormat:u,period:d,periodicityOnDoubleClick:p,mode:b}),d==="hour"&&n.suffixMinutesForHourPeriod!==""&&r.jsx("span",{children:n.suffixMinutesForHourPeriod||B.suffixMinutesForHourPeriod})]}))}function $n(e){var t=e.value,o=e.setValue,n=e.locale,s=e.className,a=e.weekDays,l=e.disabled,c=e.readOnly,u=e.leadingZero,d=e.period,p=e.periodicityOnDoubleClick,b=e.mode,x=!a||a.length===0,v=g.useMemo(function(){var S;return ae(((S={"react-js-cron-field":!0,"react-js-cron-month-days":!0,"react-js-cron-month-days-placeholder":!x})["".concat(s,"-field")]=!!s,S["".concat(s,"-month-days")]=!!s,S))},[s,x]),f=JSON.stringify(n),k=g.useMemo(function(){return x?n.emptyMonthDays||B.emptyMonthDays:n.emptyMonthDaysShort||B.emptyMonthDaysShort},[x,f]);return!c||t&&t.length>0||(!t||t.length===0)&&(!a||a.length===0)?r.jsxs("div",re({className:v},{children:[n.prefixMonthDays!==""&&r.jsx("span",{children:n.prefixMonthDays||B.prefixMonthDays}),r.jsx(Pe,{placeholder:k,value:t,setValue:o,unit:we[2],locale:n,className:s,disabled:l,readOnly:c,leadingZero:u,period:d,periodicityOnDoubleClick:p,mode:b})]})):null}function Mn(e){var t=e.value,o=e.setValue,n=e.locale,s=e.className,a=e.humanizeLabels,l=e.disabled,c=e.readOnly,u=e.period,d=e.periodicityOnDoubleClick,p=e.mode,b=n.months||B.months,x=g.useMemo(function(){var v;return ae(((v={"react-js-cron-field":!0,"react-js-cron-months":!0})["".concat(s,"-field")]=!!s,v["".concat(s,"-months")]=!!s,v))},[s]);return r.jsxs("div",re({className:x},{children:[n.prefixMonths!==""&&r.jsx("span",{children:n.prefixMonths||B.prefixMonths}),r.jsx(Pe,{placeholder:n.emptyMonths||B.emptyMonths,optionsList:b,grid:!1,value:t,unit:re(re({},we[3]),{alt:n.altMonths||B.altMonths}),setValue:o,locale:n,className:s,humanizeLabels:a,disabled:l,readOnly:c,period:u,periodicityOnDoubleClick:d,mode:p})]}))}function In(e){var t=e.value,o=e.setValue,n=e.locale,s=e.className,a=e.disabled,l=e.readOnly,c=e.shortcuts,u=e.allowedPeriods,d=[];u.includes("year")&&d.push({value:"year",label:n.yearOption||B.yearOption}),u.includes("month")&&d.push({value:"month",label:n.monthOption||B.monthOption}),u.includes("week")&&d.push({value:"week",label:n.weekOption||B.weekOption}),u.includes("day")&&d.push({value:"day",label:n.dayOption||B.dayOption}),u.includes("hour")&&d.push({value:"hour",label:n.hourOption||B.hourOption}),u.includes("minute")&&d.push({value:"minute",label:n.minuteOption||B.minuteOption}),u.includes("reboot")&&c&&(c===!0||c.includes("@reboot"))&&d.push({value:"reboot",label:n.rebootOption||B.rebootOption});var p=g.useCallback(function(f){l||o(f)},[o,l]),b=g.useMemo(function(){var f;return ae(((f={"react-js-cron-field":!0,"react-js-cron-period":!0})["".concat(s,"-field")]=!!s,f["".concat(s,"-period")]=!!s,f))},[s]),x=g.useMemo(function(){var f;return ae(((f={"react-js-cron-select":!0,"react-js-cron-select-no-prefix":n.prefixPeriod===""})["".concat(s,"-select")]=!!s,f))},[s,n.prefixPeriod]),v=g.useMemo(function(){var f;return ae(((f={"react-js-cron-select-dropdown":!0,"react-js-cron-select-dropdown-period":!0})["".concat(s,"-select-dropdown")]=!!s,f["".concat(s,"-select-dropdown-period")]=!!s,f))},[s]);return r.jsxs("div",re({className:b},{children:[n.prefixPeriod!==""&&r.jsx("span",{children:n.prefixPeriod||B.prefixPeriod}),r.jsx(h.Select,{defaultValue:t,value:t,onChange:p,options:d,className:x,popupClassName:v,disabled:a,showArrow:!l,open:!l&&void 0,"data-testid":"select-period"},JSON.stringify(n))]}))}function Pn(e){var t=e.value,o=e.setValue,n=e.locale,s=e.className,a=e.humanizeLabels,l=e.monthDays,c=e.disabled,u=e.readOnly,d=e.period,p=e.periodicityOnDoubleClick,b=e.mode,x=n.weekDays||B.weekDays,v=d==="week"||!l||l.length===0,f=g.useMemo(function(){var P;return ae(((P={"react-js-cron-field":!0,"react-js-cron-week-days":!0,"react-js-cron-week-days-placeholder":!v})["".concat(s,"-field")]=!!s,P["".concat(s,"-week-days")]=!!s,P))},[s,v]),k=JSON.stringify(n),S=g.useMemo(function(){return v?n.emptyWeekDays||B.emptyWeekDays:n.emptyWeekDaysShort||B.emptyWeekDaysShort},[v,k]),N=d==="week"||!u||t&&t.length>0||(!t||t.length===0)&&(!l||l.length===0),A=!u||l&&l.length>0||(!l||l.length===0)&&(!t||t.length===0);return N?r.jsxs("div",re({className:f},{children:[n.prefixWeekDays!==""&&(d==="week"||!A)&&r.jsx("span",{children:n.prefixWeekDays||B.prefixWeekDays}),n.prefixWeekDaysForMonthAndYearPeriod!==""&&d!=="week"&&A&&r.jsx("span",{children:n.prefixWeekDaysForMonthAndYearPeriod||B.prefixWeekDaysForMonthAndYearPeriod}),r.jsx(Pe,{placeholder:S,optionsList:x,grid:!1,value:t,unit:re(re({},we[4]),{alt:n.altWeekDays||B.altWeekDays}),setValue:o,locale:n,className:s,humanizeLabels:a,disabled:c,readOnly:u,period:d,periodicityOnDoubleClick:p,mode:b})]})):null}function Bn(e){var t=e.clearButton,o=t===void 0||t,n=e.clearButtonProps,s=n===void 0?{}:n,a=e.clearButtonAction,l=a===void 0?"fill-with-every":a,c=e.locale,u=c===void 0?B:c,d=e.value,p=d===void 0?"":d,b=e.setValue,x=e.displayError,v=x===void 0||x,f=e.onError,k=e.className,S=e.defaultPeriod,N=S===void 0?"day":S,A=e.allowEmpty,P=A===void 0?"for-default-value":A,z=e.humanizeLabels,U=z===void 0||z,F=e.humanizeValue,$=F!==void 0&&F,O=e.disabled,I=O!==void 0&&O,L=e.readOnly,J=L!==void 0&&L,ue=e.leadingZero,D=ue!==void 0&&ue,V=e.shortcuts,W=V===void 0?["@yearly","@annually","@monthly","@weekly","@daily","@midnight","@hourly"]:V,se=e.clockFormat,G=e.periodicityOnDoubleClick,K=G===void 0||G,R=e.mode,ee=R===void 0?"multiple":R,Ve=e.allowedDropdowns,me=Ve===void 0?["period","months","month-days","week-days","hours","minutes"]:Ve,Fe=e.allowedPeriods,dr=Fe===void 0?["year","month","week","day","hour","minute","reboot"]:Fe,Ne=g.useRef(p),Ot=g.useRef(N),Co=g.useState(),be=Co[0],Re=Co[1],ko=g.useState(),je=ko[0],et=ko[1],So=g.useState(),tt=So[0],ot=So[1],Ao=g.useState(),We=Ao[0],nt=Ao[1],Oo=g.useState(),rt=Oo[0],st=Oo[1],To=g.useState(),it=To[0],lt=To[1],Fo=g.useState(!1),Tt=Fo[0],Le=Fo[1],No=g.useState(!1),at=No[0],Do=No[1],pr=function(Z){var fe=g.useRef(Z);return g.useEffect(function(){fe.current=Z},[Z]),fe.current}(at),Eo=JSON.stringify(u);g.useEffect(function(){io(p,Le,f,P,Ne,!0,u,W,lt,st,et,ot,nt,Re)},[]),g.useEffect(function(){p!==Ne.current&&io(p,Le,f,P,Ne,!1,u,W,lt,st,et,ot,nt,Re)},[p,Ne,Eo,P,W]),g.useEffect(function(){if(!(be||it||tt||je||We||rt)||at||pr)at&&Do(!1);else{var Z=be||Ot.current,fe=lo(Z,tt,je,We,rt,it,$);b(fe,{selectedPeriod:Z}),Ne.current=fe,f&&f(void 0),Le(!1)}},[be,je,tt,We,rt,it,$,at]);var $o=g.useCallback(function(){et(void 0),ot(void 0),nt(void 0),st(void 0),lt(void 0);var Z="",fe=be!=="reboot"&&be?be:Ot.current;fe!==be&&Re(fe),l==="fill-with-every"&&(Z=lo(fe,void 0,void 0,void 0,void 0,void 0)),b(Z,{selectedPeriod:fe}),Ne.current=Z,Do(!0),P==="never"&&l==="empty"?(Le(!0),so(f,u)):(f&&f(void 0),Le(!1))},[be,b,f,l]),mr=g.useMemo(function(){var Z;return ae(((Z={"react-js-cron":!0,"react-js-cron-error":Tt&&v,"react-js-cron-disabled":I,"react-js-cron-read-only":J})["".concat(k)]=!!k,Z["".concat(k,"-error")]=Tt&&v&&!!k,Z["".concat(k,"-disabled")]=I&&!!k,Z["".concat(k,"-read-only")]=J&&!!k,Z))},[k,Tt,v,I,J]),Ft=s.className,Mo=oo(s,["className"]),Io=g.useMemo(function(){var Z;return ae(((Z={"react-js-cron-clear-button":!0})["".concat(k,"-clear-button")]=!!k,Z["".concat(Ft)]=!!Ft,Z))},[k,Ft]),fr=JSON.stringify(Mo),Po=g.useMemo(function(){return o&&!J?r.jsx(h.Button,re({className:Io,danger:!0,type:"primary",disabled:I},Mo,{onClick:$o},{children:u.clearButtonText||B.clearButtonText})):null},[o,J,Eo,Io,I,fr,$o]),te=be||Ot.current;return r.jsxs("div",re({className:mr},{children:[me.includes("period")&&r.jsx(In,{value:te,setValue:Re,locale:u,className:k,disabled:I,readOnly:J,shortcuts:W,allowedPeriods:dr}),te==="reboot"?Po:r.jsxs(r.Fragment,{children:[te==="year"&&me.includes("months")&&r.jsx(Mn,{value:tt,setValue:ot,locale:u,className:k,humanizeLabels:U,disabled:I,readOnly:J,period:te,periodicityOnDoubleClick:K,mode:ee}),(te==="year"||te==="month")&&me.includes("month-days")&&r.jsx($n,{value:je,setValue:et,locale:u,className:k,weekDays:We,disabled:I,readOnly:J,leadingZero:D,period:te,periodicityOnDoubleClick:K,mode:ee}),(te==="year"||te==="month"||te==="week")&&me.includes("week-days")&&r.jsx(Pn,{value:We,setValue:nt,locale:u,className:k,humanizeLabels:U,monthDays:je,disabled:I,readOnly:J,period:te,periodicityOnDoubleClick:K,mode:ee}),r.jsxs("div",{children:[te!=="minute"&&te!=="hour"&&me.includes("hours")&&r.jsx(Dn,{value:rt,setValue:st,locale:u,className:k,disabled:I,readOnly:J,leadingZero:D,clockFormat:se,period:te,periodicityOnDoubleClick:K,mode:ee}),te!=="minute"&&me.includes("minutes")&&r.jsx(En,{value:it,setValue:lt,locale:u,period:te,className:k,disabled:I,readOnly:J,leadingZero:D,clockFormat:se,periodicityOnDoubleClick:K,mode:ee}),Po]})]})]}))}const Vn={"zh-CN":{everyText:"每",emptyMonths:"每月",emptyMonthDays:"每日(月)",emptyMonthDaysShort:"每日",emptyWeekDays:"每天(周)",emptyWeekDaysShort:"每天(周)",emptyHours:"每小时",emptyMinutes:"每分钟",emptyMinutesForHourPeriod:"每",yearOption:"年",monthOption:"月",weekOption:"周",dayOption:"天",hourOption:"小时",minuteOption:"分钟",rebootOption:"重启",prefixPeriod:"每",prefixMonths:"的",prefixMonthDays:"的",prefixWeekDays:"的",prefixWeekDaysForMonthAndYearPeriod:"或者",prefixHours:"的",prefixMinutes:":",prefixMinutesForHourPeriod:"的",suffixMinutesForHourPeriod:"分钟",errorInvalidCron:"不符合 cron 规则的表达式",clearButtonText:"清空",weekDays:["周日","周一","周二","周三","周四","周五","周六"],months:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],altWeekDays:["周日","周一","周二","周三","周四","周五","周六"],altMonths:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]}},ho=[{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 yo(e){return ho.filter(o=>typeof o.value=="number").reverse().find(o=>!(e%o.value))}function jn(e){let t;switch(typeof e){case"number":return t=yo(e),t?t.value:"none";case"string":return"cron"}return"none"}function Wn({value:e,onChange:t}){const{t:o}=dt(),n=yo(e);return r.jsx(h.InputNumber,{value:e/n.value,onChange:s=>t(s*n.value),min:1,addonBefore:o("Every"),addonAfter:o(n.unitText),className:"auto-width"})}function Ln({value:e=null,onChange:t}){const{t:o}=dt(),n=jn(e);function s(l){if(l==="none"){t(null);return}if(l==="cron"){t("0 * * * * *");return}t(l)}const a=Vn[localStorage.getItem("NOCOBASE_LOCALE")||"en-US"];return r.jsxs("fieldset",{className:i.css`
|
|
453
|
+
`,children:[r.jsxs(y.Select,{value:n,onChange:s=>{t(s?s==="field"?{}:new Date:null)},className:"auto-width",children:[r.jsx(y.Select.Option,{value:null,children:o("No end")}),r.jsx(y.Select.Option,{value:"field",children:o("By field")}),r.jsx(y.Select.Option,{value:"date",children:o("By custom date")})]}),n==="field"?r.jsx(to,{value:e,onChange:t}):null,n==="date"?r.jsx(y.DatePicker,{showTime:!0,value:Wo(e),onChange:s=>{t(s?s.toDate():null)}}):null]})}var re=function(){return re=Object.assign||function(e){for(var t,o=1,n=arguments.length;o<n;o++)for(var s in t=arguments[o])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e},re.apply(this,arguments)};function oo(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function"){var s=0;for(n=Object.getOwnPropertySymbols(e);s<n.length;s++)t.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(e,n[s])&&(o[n[s]]=e[n[s]])}return o}function Ke(e,t,o){if(o||arguments.length===2)for(var n,s=0,a=t.length;s<a;s++)!n&&s in t||(n||(n=Array.prototype.slice.call(t,0,s)),n[s]=t[s]);return e.concat(n||Array.prototype.slice.call(t))}var Nn=[{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 * * * *"}],we=[{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"]}],B={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 no(e,t){for(var o=[],n=e;n<=t;n++)o.push(n);return o}function Ze(e){return e.sort(function(t,o){return t-o}),e}function ro(e){var t=[];return e.forEach(function(o){t.indexOf(o)<0&&t.push(o)}),t}function ae(e){return Object.entries(e).filter(function(t){var o=t[0],n=t[1];return o&&n}).map(function(t){return t[0]}).join(" ")}function so(e,t){e&&e({type:"invalid_cron",description:t.errorInvalidCron||B.errorInvalidCron})}function Qe(e){var t=parseInt(e,10),o=Number(e);return t===o?o:NaN}function io(e,t,o,n,s,a,l,c,u,d,f,h,x,v){o&&o(void 0),t(!1);var m=!1;if(!e){if(n==="always"||a&&n==="for-default-value")return;m=!0}if(!m){if(c&&(c===!0||c.includes(e))){if(e==="@reboot")return void v("reboot");var k=Nn.find(function(A){return A.name===e});k&&(e=k.value)}try{var S=function(A){if(typeof A!="string")throw new Error("Invalid cron string");var P=A.replace(/\s+/g," ").trim().split(" ");if(P.length===5)return P.map(function(z,U){return function(F,$){if(F==="*"||F==="*/1")return[];var O=Ze(ro(uo(function(L,J,ue){if(ue){L=L.toUpperCase();for(var D=0;D<ue.length;D++)L=L.replace(ue[D],"".concat(D+J))}return L}(F,$.min,$.alt).split(",").map(function(L){var J,ue=L.split("/");if(ue.length>2)throw new Error('Invalid value "'.concat(F,' for "').concat($.type,'"'));var D=ue[0],V=ue[1];J=D==="*"?no($.min,$.max):function(G,K,R){var ee=G.split("-");if(ee.length===1){var Ve=Qe(ee[0]);if(isNaN(Ve))throw new Error('Invalid value "'.concat(K,'" for ').concat(R.type));return[Ve]}if(ee.length===2){var me=Qe(ee[0]),Fe=Qe(ee[1]);if(isNaN(me)||isNaN(Fe))throw new Error('Invalid value "'.concat(K,'" for ').concat(R.type));if(Fe<me)throw new Error('Max range is less than min range in "'.concat(G,'" for ').concat(R.type));return no(me,Fe)}throw new Error('Invalid value "'.concat(G,'" for ').concat(R.type))}(D,F,$);var W=function(G,K){if(G!==void 0){var R=Qe(G);if(isNaN(R)||R<1)throw new Error('Invalid interval step value "'.concat(G,'" for ').concat(K.type));return R}}(V,$),se=function(G,K){if(K){var R=G[0];G=G.filter(function(ee){return ee%K==R%K||ee===R})}return G}(J,W);return se}).flat(),$))),I=po(O,$);if(I!==void 0)throw new Error('Value "'.concat(I,'" out of range for ').concat($.type));return O.length===$.total?[]:O}(z,we[U])});throw new Error("Invalid cron string format")}(e),N=function(A){return A[3].length>0?"year":A[2].length>0?"month":A[4].length>0?"week":A[1].length>0?"day":A[0].length>0?"hour":"minute"}(S);v(N),u(S[0]),d(S[1]),f(S[2]),h(S[3]),x(S[4])}catch(A){m=!0}}m&&(s.current=e,t(!0),so(o,l))}function lo(e,t,o,n,s,a,l){if(e==="reboot")return"@reboot";var c=function(u,d){return u.map(function(f,h){var x=we[h];return ao(co(f,x),x,d)})}([e!=="minute"&&a?a:[],e!=="minute"&&e!=="hour"&&s?s:[],e!=="year"&&e!=="month"||!o?[]:o,e==="year"&&t?t:[],e!=="year"&&e!=="month"&&e!=="week"||!n?[]:n],l);return c.join(" ")}function ao(e,t,o,n,s){var a="";if(function(c,u){return c.length===u.max-u.min+1}(e,t)||e.length===0)a="*";else{var l=function(c){if(c.length>2){var u=c[1]-c[0];if(u>1)return u}}(e);a=l&&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,l)?function(c,u,d){var f=mo(c),h=fo(c),x=c.length===(h-f)/d+1;return!!(f===u.min&&h+d>u.max&&x)}(e,t,l)?"*/".concat(l):"".concat(Oe(mo(e),t,o,n,s),"-").concat(Oe(fo(e),t,o,n,s),"/").concat(l):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],t,o,n,s),"-").concat(Oe(c[1],t,o,n,s)):Oe(c,t,o,n,s)}).join(",")}return a}function Oe(e,t,o,n,s){var a=e.toString(),l=t.type,c=t.alt,u=t.min,d=n&&(n===!0||n.includes(l)),f=s==="24-hour-clock"&&(l==="hours"||l==="minutes");if(o&&l==="week-days"||o&&l==="months"?a=c[e-u]:e<10&&(d||f)&&(a=a.padStart(2,"0")),l==="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 co(e,t){var o=Ze(ro(uo(e,t)));if(o.length===0)return o;var n=po(o,t);if(n!==void 0)throw new Error('Value "'.concat(n,'" out of range for ').concat(t.type));return o}function uo(e,t){return t.type==="week-days"&&(e=e.map(function(o){return o===7?0:o})),e}function po(e,t){var o=e[0],n=e[e.length-1];return o<t.min?o:n>t.max?n:void 0}function mo(e){return e[0]}function fo(e){return e[e.length-1]}function Pe(e){var t=e.value,o=e.grid,n=o===void 0||o,s=e.optionsList,a=e.setValue,l=e.locale,c=e.className,u=e.humanizeLabels,d=e.disabled,f=e.readOnly,h=e.leadingZero,x=e.clockFormat,v=e.period,m=e.unit,k=e.periodicityOnDoubleClick,S=e.mode,N=oo(e,["value","grid","optionsList","setValue","locale","className","humanizeLabels","disabled","readOnly","leadingZero","clockFormat","period","unit","periodicityOnDoubleClick","mode"]),A=b.useMemo(function(){if(t&&Array.isArray(t))return t.map(function(D){return D.toString()})},[t]),P=b.useMemo(function(){return s?s.map(function(D,V){return{value:(m.min===0?V:V+1).toString(),label:D}}):Ke([],Array(m.total),!0).map(function(D,V){var W=m.min===0?V:V+1;return{value:W.toString(),label:Oe(W,m,u,h,x)}})},[s,h,u,x]),z=JSON.stringify(l),U=b.useCallback(function(D){var V=D.value;if(!t||t[0]!==Number(V))return r.jsx(r.Fragment,{});var W=ao(co(t,m),m,u,h,x),se=W.match(/^\*\/([0-9]+),?/)||[];return r.jsx("div",{children:se[1]?"".concat(l.everyText||B.everyText," ").concat(se[1]):W})},[t,z,u,h,x]),F=b.useCallback(function(D){var V=Array.isArray(D)?Ze(D):[D],W=V;t&&(W=S==="single"?[]:Ke([],t,!0),V.forEach(function(se){var G=Number(se);W=t.some(function(K){return K===G})?W.filter(function(K){return K!==G}):Ze(Ke(Ke([],W,!0),[G],!1))})),W.length===m.total?a([]):a(W)},[a,t]),$=b.useCallback(function(D){if(D!==0&&D!==1){for(var V=m.total+m.min,W=[],se=m.min;se<V;se++)se%D==0&&W.push(se);var G=t&&W&&t.length===W.length&&t.every(function(R,ee){return R===W[ee]}),K=W.length===P.length;a(K||G?[]:W)}else a([])},[t,P,a]),O=b.useRef([]),I=b.useCallback(function(D){if(!f){var V=O.current;V.push({time:new Date().getTime(),value:Number(D)});var W=window.setTimeout(function(){k&&V.length>1&&V[V.length-1].time-V[V.length-2].time<300?V[V.length-1].value===V[V.length-2].value?$(Number(D)):F([V[V.length-2].value,V[V.length-1].value]):F(Number(D)),O.current=[]},300);return function(){window.clearTimeout(W)}}},[O,F,$,f,k]),L=b.useCallback(function(){f||a([])},[a,f]),J=b.useMemo(function(){var D;return ae(((D={"react-js-cron-select":!0,"react-js-cron-custom-select":!0})["".concat(c,"-select")]=!!c,D))},[c]),ue=b.useMemo(function(){var D;return ae(((D={"react-js-cron-select-dropdown":!0})["react-js-cron-select-dropdown-".concat(m.type)]=!0,D["react-js-cron-custom-select-dropdown"]=!0,D["react-js-cron-custom-select-dropdown-".concat(m.type)]=!0,D["react-js-cron-custom-select-dropdown-minutes-large"]=m.type==="minutes"&&v!=="hour"&&v!=="day",D["react-js-cron-custom-select-dropdown-minutes-medium"]=m.type==="minutes"&&(v==="day"||v==="hour"),D["react-js-cron-custom-select-dropdown-hours-twelve-hour-clock"]=m.type==="hours"&&x==="12-hour-clock",D["react-js-cron-custom-select-dropdown-grid"]=!!n,D["".concat(c,"-select-dropdown")]=!!c,D["".concat(c,"-select-dropdown-").concat(m.type)]=!!c,D))},[c,n,x,v]);return r.jsx(y.Select,re({mode:S!=="single"||k?"multiple":void 0,allowClear:!f,virtual:!1,open:!f&&void 0,value:A,onClear:L,tagRender:U,className:J,popupClassName:ue,options:P,showSearch:!1,showArrow:!f,menuItemSelectedIcon:null,dropdownMatchSelectWidth:!1,onSelect:I,onDeselect:I,disabled:d,dropdownAlign:m.type!=="minutes"&&m.type!=="hours"||v==="day"||v==="hour"?void 0:{points:["tr","br"]},"data-testid":"custom-select-".concat(m.type)},N))}function Dn(e){var t=e.value,o=e.setValue,n=e.locale,s=e.className,a=e.disabled,l=e.readOnly,c=e.leadingZero,u=e.clockFormat,d=e.period,f=e.periodicityOnDoubleClick,h=e.mode,x=b.useMemo(function(){var v;return ae(((v={"react-js-cron-field":!0,"react-js-cron-hours":!0})["".concat(s,"-field")]=!!s,v["".concat(s,"-hours")]=!!s,v))},[s]);return r.jsxs("div",re({className:x},{children:[n.prefixHours!==""&&r.jsx("span",{children:n.prefixHours||B.prefixHours}),r.jsx(Pe,{placeholder:n.emptyHours||B.emptyHours,value:t,unit:we[1],setValue:o,locale:n,className:s,disabled:a,readOnly:l,leadingZero:c,clockFormat:u,period:d,periodicityOnDoubleClick:f,mode:h})]}))}function En(e){var t=e.value,o=e.setValue,n=e.locale,s=e.className,a=e.disabled,l=e.readOnly,c=e.leadingZero,u=e.clockFormat,d=e.period,f=e.periodicityOnDoubleClick,h=e.mode,x=b.useMemo(function(){var v;return ae(((v={"react-js-cron-field":!0,"react-js-cron-minutes":!0})["".concat(s,"-field")]=!!s,v["".concat(s,"-minutes")]=!!s,v))},[s]);return r.jsxs("div",re({className:x},{children:[d==="hour"?n.prefixMinutesForHourPeriod!==""&&r.jsx("span",{children:n.prefixMinutesForHourPeriod||B.prefixMinutesForHourPeriod}):n.prefixMinutes!==""&&r.jsx("span",{children:n.prefixMinutes||B.prefixMinutes}),r.jsx(Pe,{placeholder:d==="hour"?n.emptyMinutesForHourPeriod||B.emptyMinutesForHourPeriod:n.emptyMinutes||B.emptyMinutes,value:t,unit:we[0],setValue:o,locale:n,className:s,disabled:a,readOnly:l,leadingZero:c,clockFormat:u,period:d,periodicityOnDoubleClick:f,mode:h}),d==="hour"&&n.suffixMinutesForHourPeriod!==""&&r.jsx("span",{children:n.suffixMinutesForHourPeriod||B.suffixMinutesForHourPeriod})]}))}function $n(e){var t=e.value,o=e.setValue,n=e.locale,s=e.className,a=e.weekDays,l=e.disabled,c=e.readOnly,u=e.leadingZero,d=e.period,f=e.periodicityOnDoubleClick,h=e.mode,x=!a||a.length===0,v=b.useMemo(function(){var S;return ae(((S={"react-js-cron-field":!0,"react-js-cron-month-days":!0,"react-js-cron-month-days-placeholder":!x})["".concat(s,"-field")]=!!s,S["".concat(s,"-month-days")]=!!s,S))},[s,x]),m=JSON.stringify(n),k=b.useMemo(function(){return x?n.emptyMonthDays||B.emptyMonthDays:n.emptyMonthDaysShort||B.emptyMonthDaysShort},[x,m]);return!c||t&&t.length>0||(!t||t.length===0)&&(!a||a.length===0)?r.jsxs("div",re({className:v},{children:[n.prefixMonthDays!==""&&r.jsx("span",{children:n.prefixMonthDays||B.prefixMonthDays}),r.jsx(Pe,{placeholder:k,value:t,setValue:o,unit:we[2],locale:n,className:s,disabled:l,readOnly:c,leadingZero:u,period:d,periodicityOnDoubleClick:f,mode:h})]})):null}function Mn(e){var t=e.value,o=e.setValue,n=e.locale,s=e.className,a=e.humanizeLabels,l=e.disabled,c=e.readOnly,u=e.period,d=e.periodicityOnDoubleClick,f=e.mode,h=n.months||B.months,x=b.useMemo(function(){var v;return ae(((v={"react-js-cron-field":!0,"react-js-cron-months":!0})["".concat(s,"-field")]=!!s,v["".concat(s,"-months")]=!!s,v))},[s]);return r.jsxs("div",re({className:x},{children:[n.prefixMonths!==""&&r.jsx("span",{children:n.prefixMonths||B.prefixMonths}),r.jsx(Pe,{placeholder:n.emptyMonths||B.emptyMonths,optionsList:h,grid:!1,value:t,unit:re(re({},we[3]),{alt:n.altMonths||B.altMonths}),setValue:o,locale:n,className:s,humanizeLabels:a,disabled:l,readOnly:c,period:u,periodicityOnDoubleClick:d,mode:f})]}))}function In(e){var t=e.value,o=e.setValue,n=e.locale,s=e.className,a=e.disabled,l=e.readOnly,c=e.shortcuts,u=e.allowedPeriods,d=[];u.includes("year")&&d.push({value:"year",label:n.yearOption||B.yearOption}),u.includes("month")&&d.push({value:"month",label:n.monthOption||B.monthOption}),u.includes("week")&&d.push({value:"week",label:n.weekOption||B.weekOption}),u.includes("day")&&d.push({value:"day",label:n.dayOption||B.dayOption}),u.includes("hour")&&d.push({value:"hour",label:n.hourOption||B.hourOption}),u.includes("minute")&&d.push({value:"minute",label:n.minuteOption||B.minuteOption}),u.includes("reboot")&&c&&(c===!0||c.includes("@reboot"))&&d.push({value:"reboot",label:n.rebootOption||B.rebootOption});var f=b.useCallback(function(m){l||o(m)},[o,l]),h=b.useMemo(function(){var m;return ae(((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 ae(((m={"react-js-cron-select":!0,"react-js-cron-select-no-prefix":n.prefixPeriod===""})["".concat(s,"-select")]=!!s,m))},[s,n.prefixPeriod]),v=b.useMemo(function(){var m;return ae(((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 r.jsxs("div",re({className:h},{children:[n.prefixPeriod!==""&&r.jsx("span",{children:n.prefixPeriod||B.prefixPeriod}),r.jsx(y.Select,{defaultValue:t,value:t,onChange:f,options:d,className:x,popupClassName:v,disabled:a,showArrow:!l,open:!l&&void 0,"data-testid":"select-period"},JSON.stringify(n))]}))}function Pn(e){var t=e.value,o=e.setValue,n=e.locale,s=e.className,a=e.humanizeLabels,l=e.monthDays,c=e.disabled,u=e.readOnly,d=e.period,f=e.periodicityOnDoubleClick,h=e.mode,x=n.weekDays||B.weekDays,v=d==="week"||!l||l.length===0,m=b.useMemo(function(){var P;return ae(((P={"react-js-cron-field":!0,"react-js-cron-week-days":!0,"react-js-cron-week-days-placeholder":!v})["".concat(s,"-field")]=!!s,P["".concat(s,"-week-days")]=!!s,P))},[s,v]),k=JSON.stringify(n),S=b.useMemo(function(){return v?n.emptyWeekDays||B.emptyWeekDays:n.emptyWeekDaysShort||B.emptyWeekDaysShort},[v,k]),N=d==="week"||!u||t&&t.length>0||(!t||t.length===0)&&(!l||l.length===0),A=!u||l&&l.length>0||(!l||l.length===0)&&(!t||t.length===0);return N?r.jsxs("div",re({className:m},{children:[n.prefixWeekDays!==""&&(d==="week"||!A)&&r.jsx("span",{children:n.prefixWeekDays||B.prefixWeekDays}),n.prefixWeekDaysForMonthAndYearPeriod!==""&&d!=="week"&&A&&r.jsx("span",{children:n.prefixWeekDaysForMonthAndYearPeriod||B.prefixWeekDaysForMonthAndYearPeriod}),r.jsx(Pe,{placeholder:S,optionsList:x,grid:!1,value:t,unit:re(re({},we[4]),{alt:n.altWeekDays||B.altWeekDays}),setValue:o,locale:n,className:s,humanizeLabels:a,disabled:c,readOnly:u,period:d,periodicityOnDoubleClick:f,mode:h})]})):null}function Bn(e){var t=e.clearButton,o=t===void 0||t,n=e.clearButtonProps,s=n===void 0?{}:n,a=e.clearButtonAction,l=a===void 0?"fill-with-every":a,c=e.locale,u=c===void 0?B:c,d=e.value,f=d===void 0?"":d,h=e.setValue,x=e.displayError,v=x===void 0||x,m=e.onError,k=e.className,S=e.defaultPeriod,N=S===void 0?"day":S,A=e.allowEmpty,P=A===void 0?"for-default-value":A,z=e.humanizeLabels,U=z===void 0||z,F=e.humanizeValue,$=F!==void 0&&F,O=e.disabled,I=O!==void 0&&O,L=e.readOnly,J=L!==void 0&&L,ue=e.leadingZero,D=ue!==void 0&&ue,V=e.shortcuts,W=V===void 0?["@yearly","@annually","@monthly","@weekly","@daily","@midnight","@hourly"]:V,se=e.clockFormat,G=e.periodicityOnDoubleClick,K=G===void 0||G,R=e.mode,ee=R===void 0?"multiple":R,Ve=e.allowedDropdowns,me=Ve===void 0?["period","months","month-days","week-days","hours","minutes"]:Ve,Fe=e.allowedPeriods,dr=Fe===void 0?["year","month","week","day","hour","minute","reboot"]:Fe,Ne=b.useRef(f),Ot=b.useRef(N),Co=b.useState(),be=Co[0],Re=Co[1],ko=b.useState(),je=ko[0],et=ko[1],So=b.useState(),tt=So[0],ot=So[1],Ao=b.useState(),We=Ao[0],nt=Ao[1],Oo=b.useState(),rt=Oo[0],st=Oo[1],To=b.useState(),it=To[0],lt=To[1],Fo=b.useState(!1),Tt=Fo[0],Le=Fo[1],No=b.useState(!1),at=No[0],Do=No[1],pr=function(Z){var fe=b.useRef(Z);return b.useEffect(function(){fe.current=Z},[Z]),fe.current}(at),Eo=JSON.stringify(u);b.useEffect(function(){io(f,Le,m,P,Ne,!0,u,W,lt,st,et,ot,nt,Re)},[]),b.useEffect(function(){f!==Ne.current&&io(f,Le,m,P,Ne,!1,u,W,lt,st,et,ot,nt,Re)},[f,Ne,Eo,P,W]),b.useEffect(function(){if(!(be||it||tt||je||We||rt)||at||pr)at&&Do(!1);else{var Z=be||Ot.current,fe=lo(Z,tt,je,We,rt,it,$);h(fe,{selectedPeriod:Z}),Ne.current=fe,m&&m(void 0),Le(!1)}},[be,je,tt,We,rt,it,$,at]);var $o=b.useCallback(function(){et(void 0),ot(void 0),nt(void 0),st(void 0),lt(void 0);var Z="",fe=be!=="reboot"&&be?be:Ot.current;fe!==be&&Re(fe),l==="fill-with-every"&&(Z=lo(fe,void 0,void 0,void 0,void 0,void 0)),h(Z,{selectedPeriod:fe}),Ne.current=Z,Do(!0),P==="never"&&l==="empty"?(Le(!0),so(m,u)):(m&&m(void 0),Le(!1))},[be,h,m,l]),mr=b.useMemo(function(){var Z;return ae(((Z={"react-js-cron":!0,"react-js-cron-error":Tt&&v,"react-js-cron-disabled":I,"react-js-cron-read-only":J})["".concat(k)]=!!k,Z["".concat(k,"-error")]=Tt&&v&&!!k,Z["".concat(k,"-disabled")]=I&&!!k,Z["".concat(k,"-read-only")]=J&&!!k,Z))},[k,Tt,v,I,J]),Ft=s.className,Mo=oo(s,["className"]),Io=b.useMemo(function(){var Z;return ae(((Z={"react-js-cron-clear-button":!0})["".concat(k,"-clear-button")]=!!k,Z["".concat(Ft)]=!!Ft,Z))},[k,Ft]),fr=JSON.stringify(Mo),Po=b.useMemo(function(){return o&&!J?r.jsx(y.Button,re({className:Io,danger:!0,type:"primary",disabled:I},Mo,{onClick:$o},{children:u.clearButtonText||B.clearButtonText})):null},[o,J,Eo,Io,I,fr,$o]),te=be||Ot.current;return r.jsxs("div",re({className:mr},{children:[me.includes("period")&&r.jsx(In,{value:te,setValue:Re,locale:u,className:k,disabled:I,readOnly:J,shortcuts:W,allowedPeriods:dr}),te==="reboot"?Po:r.jsxs(r.Fragment,{children:[te==="year"&&me.includes("months")&&r.jsx(Mn,{value:tt,setValue:ot,locale:u,className:k,humanizeLabels:U,disabled:I,readOnly:J,period:te,periodicityOnDoubleClick:K,mode:ee}),(te==="year"||te==="month")&&me.includes("month-days")&&r.jsx($n,{value:je,setValue:et,locale:u,className:k,weekDays:We,disabled:I,readOnly:J,leadingZero:D,period:te,periodicityOnDoubleClick:K,mode:ee}),(te==="year"||te==="month"||te==="week")&&me.includes("week-days")&&r.jsx(Pn,{value:We,setValue:nt,locale:u,className:k,humanizeLabels:U,monthDays:je,disabled:I,readOnly:J,period:te,periodicityOnDoubleClick:K,mode:ee}),r.jsxs("div",{children:[te!=="minute"&&te!=="hour"&&me.includes("hours")&&r.jsx(Dn,{value:rt,setValue:st,locale:u,className:k,disabled:I,readOnly:J,leadingZero:D,clockFormat:se,period:te,periodicityOnDoubleClick:K,mode:ee}),te!=="minute"&&me.includes("minutes")&&r.jsx(En,{value:it,setValue:lt,locale:u,period:te,className:k,disabled:I,readOnly:J,leadingZero:D,clockFormat:se,periodicityOnDoubleClick:K,mode:ee}),Po]})]})]}))}const Vn={"zh-CN":{everyText:"每",emptyMonths:"每月",emptyMonthDays:"每日(月)",emptyMonthDaysShort:"每日",emptyWeekDays:"每天(周)",emptyWeekDaysShort:"每天(周)",emptyHours:"每小时",emptyMinutes:"每分钟",emptyMinutesForHourPeriod:"每",yearOption:"年",monthOption:"月",weekOption:"周",dayOption:"天",hourOption:"小时",minuteOption:"分钟",rebootOption:"重启",prefixPeriod:"每",prefixMonths:"的",prefixMonthDays:"的",prefixWeekDays:"的",prefixWeekDaysForMonthAndYearPeriod:"或者",prefixHours:"的",prefixMinutes:":",prefixMinutesForHourPeriod:"的",suffixMinutesForHourPeriod:"分钟",errorInvalidCron:"不符合 cron 规则的表达式",clearButtonText:"清空",weekDays:["周日","周一","周二","周三","周四","周五","周六"],months:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],altWeekDays:["周日","周一","周二","周三","周四","周五","周六"],altMonths:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]}},ho=[{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 yo(e){return ho.filter(o=>typeof o.value=="number").reverse().find(o=>!(e%o.value))}function jn(e){let t;switch(typeof e){case"number":return t=yo(e),t?t.value:"none";case"string":return"cron"}return"none"}function Wn({value:e,onChange:t}){const{t:o}=dt(),n=yo(e);return r.jsx(y.InputNumber,{value:e/n.value,onChange:s=>t(s*n.value),min:1,addonBefore:o("Every"),addonAfter:o(n.unitText),className:"auto-width"})}function Ln({value:e=null,onChange:t}){const{t:o}=dt(),n=jn(e);function s(l){if(l==="none"){t(null);return}if(l==="cron"){t("0 * * * * *");return}t(l)}const a=Vn[localStorage.getItem("NOCOBASE_LOCALE")||"en-US"];return r.jsxs("fieldset",{className:i.css`
|
|
454
454
|
display: flex;
|
|
455
455
|
flex-direction: ${n==="cron"?"column":"row"};
|
|
456
456
|
align-items: flex-start;
|
|
@@ -479,7 +479,7 @@
|
|
|
479
479
|
}
|
|
480
480
|
}
|
|
481
481
|
}
|
|
482
|
-
`,children:[r.jsx(
|
|
482
|
+
`,children:[r.jsx(y.Select,{value:n,onChange:s,className:"auto-width",children:ho.map(l=>r.jsx(y.Select.Option,{value:l.value,children:o(l.text)},l.value))}),typeof n=="number"?r.jsx(Wn,{value:e,onChange:t}):null,n==="cron"?r.jsx(Bn,{value:e.trim().split(/\s+/).slice(1).join(" "),setValue:l=>t(`0 ${l}`),clearButton:!1,locale:a}):null]})}const zn={[xe.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}}},[xe.DATE_FIELD]:{collection:T(C({},le),{"x-component-props":{dataSourceFilter(e){return e.options.key==="main"||e.options.isDBInstance}},"x-reactions":[...le["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:T(C({},Ie),{"x-reactions":[{dependencies:["mode","collection"],fulfill:{state:{visible:`{{$deps[0] === ${xe.DATE_FIELD} && $deps[1]}}`}}}]})}},Hn=[{value:xe.STATIC,label:`{{t("Based on certain date", { ns: "${p}" })}}`},{value:xe.DATE_FIELD,label:`{{t("Based on date field of collection", { ns: "${p}" })}}`}],Jn=()=>{const{values:e={},clearFormGraph:t}=j.useForm(),[o,n]=b.useState(e.mode);return j.useFormEffects(()=>{he.onFieldValueChange("mode",s=>{n(s.value),t("collection"),t("startsOn"),t("repeat"),t("endsOn"),t("limit")})}),r.jsxs(r.Fragment,{children:[r.jsx(i.SchemaComponent,{schema:{type:"number",title:`{{t("Trigger mode", { ns: "${p}" })}}`,name:"mode","x-decorator":"FormItem","x-component":"Radio.Group","x-component-props":{options:Hn},required:!0,default:xe.STATIC}}),r.jsx(i.SchemaComponent,{schema:{type:"void",properties:{[`mode-${o}`]:{type:"void","x-component":"fieldset","x-component-props":{className:i.css`
|
|
483
483
|
.ant-input-number {
|
|
484
484
|
width: auto;
|
|
485
485
|
min-width: 6em;
|
|
@@ -488,11 +488,11 @@
|
|
|
488
488
|
.ant-picker {
|
|
489
489
|
width: auto;
|
|
490
490
|
}
|
|
491
|
-
`},properties:zn[o]}}},components:{OnField:to,RepeatField:Ln,EndsByField:Fn}})]})};class Un extends yt{constructor(){super(...arguments);w(this,"sync",!1);w(this,"title",`{{t("Schedule event", { ns: "${
|
|
491
|
+
`},properties:zn[o]}}},components:{OnField:to,RepeatField:Ln,EndsByField:Fn}})]})};class Un extends yt{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:i.useCollectionDataSource});w(this,"components",{ScheduleConfig:Jn})}useVariables(o,n){var c;const s=i.useCompile(),{getCollectionFields:a}=i.useCollectionManager_deprecated(),l=[];if((!(n!=null&&n.types)||n.types.includes("date"))&&l.push({key:"date",value:"date",label:E("Trigger time")}),o.mode===xe.DATE_FIELD){const[u]=Se(T(C({appends:["data",...((c=o.appends)==null?void 0:c.map(d=>`data.${d}`))||[]]},n),{fields:[{collectionName:o.collection,name:"data",type:"hasOne",target:o.collection,uiSchema:{title:E("Trigger data")}}],compile:s,getCollectionFields:a}));u&&l.push(u)}return l}useInitializers(o){return o.collection?{name:"triggerData",type:"item",title:`{{t("Trigger data", { ns: "${p}" })}}`,Component:Me,collection:o.collection,dataPath:"$context.data"}:null}}function Be(e){const a=e,{options:t=[],direction:o}=a,n=Q(a,["options","direction"]),s=i.useCompile();return r.jsx(y.Radio.Group,T(C({},n),{children:r.jsx(y.Space,{direction:o,children:t.map(l=>r.jsxs(y.Radio,{value:l.value,children:[r.jsx("span",{className:i.css`
|
|
492
492
|
& + .anticon {
|
|
493
493
|
margin-left: 0.25em;
|
|
494
494
|
}
|
|
495
|
-
`,children:s(l.label)}),l.tooltip&&r.jsx(
|
|
495
|
+
`,children:s(l.label)}),l.tooltip&&r.jsx(y.Tooltip,{title:s(l.tooltip),children:r.jsx(M.QuestionCircleOutlined,{style:{color:"#666"}})})]},l.value))})}))}function go(){const e=j.useFieldSchema(),t=i.useCompile();return r.jsxs(i.GeneralSchemaDesigner,{title:t(e.title),children:[r.jsx(i.SchemaSettingsBlockTitleItem,{}),r.jsx(i.SchemaSettingsDivider,{}),r.jsx(i.SchemaSettingsRemove,{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}})]})}const Te=()=>null;function _n(){const a=i.useSchemaInitializerItem(),{node:t,resultTitle:o}=a,n=Q(a,["node","resultTitle"]),{insert:s}=i.useSchemaInitializer();return r.jsx(i.SchemaInitializerItem,T(C({},n),{onClick:()=>{var l;s({type:"void",name:t.id,title:t.title,"x-component":"CardItem","x-component-props":{title:(l=t.title)!=null?l:`#${t.id}`},"x-designer":"ValueBlock.Designer",properties:{result:{type:"void",title:o,"x-component":"ValueBlock.Result","x-component-props":{dataSource:`{{$jobsMapByNodeKey.${t.key}}}`}}}})}}))}function Gn({dataSource:e}){var s;const t=j.useFieldSchema(),{execution:o}=q();if(!o)return t.title;const n=H.parse(e)({$jobsMapByNodeKey:((s=o.jobs)!=null?s:[]).reduce((a,l)=>Object.assign(a,{[l.nodeKey]:l.result}),{})});return r.jsx("pre",{className:i.css`
|
|
496
496
|
margin: 0;
|
|
497
497
|
`,children:JSON.stringify(n,null,2)})}Te.Initializer=_n,Te.Result=Gn,Te.Designer=go;const bo=e=>{const t=De.evaluators.get(e);return t&&t.link?r.jsxs(r.Fragment,{children:[r.jsx("span",{className:i.css`
|
|
498
498
|
&:after {
|
|
@@ -501,16 +501,16 @@
|
|
|
501
501
|
& + a {
|
|
502
502
|
margin-left: 0.25em;
|
|
503
503
|
}
|
|
504
|
-
`,children:i.i18n.t("Syntax references")}),r.jsx("a",{href:t.link,target:"_blank",rel:"noreferrer",children:t.label})]}):null};class Yn extends ye{constructor(){super(...arguments);w(this,"title",`{{t("Calculation", { ns: "${
|
|
504
|
+
`,children:i.i18n.t("Syntax references")}),r.jsx("a",{href:t.link,target:"_blank",rel:"noreferrer",children:t.label})]}):null};class Yn extends ye{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"(o,n,{form:s}){const{values:a}=s,{evaluate:l}=De.evaluators.get(a.engine),c=o.trim().replace(/{{([^{}]+)}}/g," 1 ");try{return l(c),""}catch(u){return E("Expression syntax error")}},"x-reactions":[{dependencies:["engine"],fulfill:{schema:{description:"{{renderEngineReference($deps[0])}}"}}}],required:!0}});w(this,"scope",{renderEngineReference:bo});w(this,"components",{WorkflowVariableTextArea:At,RadioWithTooltip:Be,ValueBlock:Te})}useVariables({key:o,title:n},{types:s,fieldNames:a=ke}){return s&&!s.some(l=>l in Ye||Object.values(Ye).some(c=>c.has(l)))?null:{[a.value]:o,[a.label]:n}}useInitializers(o){var n,s;return{name:(n=o.title)!=null?n:`#${o.id}`,type:"item",title:(s=o.title)!=null?s:`#${o.id}`,Component:Te.Initializer,node:o,resultTitle:E("Calculation result")}}}const X=new H.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 qn=[{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 vo(e){return Array.from(X.getEntities()).filter(([t,o])=>o.group===e)}function Kn({calculator:e,operands:t=[],onChange:o}){const n=i.useCompile(),s=ge();return r.jsxs("fieldset",{className:i.css`
|
|
505
505
|
display: flex;
|
|
506
506
|
gap: 0.5em;
|
|
507
507
|
align-items: center;
|
|
508
508
|
flex-wrap: wrap;
|
|
509
|
-
`,children:[r.jsx(i.Variable.Input,{value:t[0],onChange:a=>o({calculator:e,operands:[a,t[1]]}),scope:s,useTypedConstant:!0}),r.jsx(
|
|
509
|
+
`,children:[r.jsx(i.Variable.Input,{value:t[0],onChange:a=>o({calculator:e,operands:[a,t[1]]}),scope:s,useTypedConstant:!0}),r.jsx(y.Select,{role:"button","aria-label":"select-operator-calc",value:e,onChange:a=>o({operands:t,calculator:a}),placeholder:E("Operator"),popupMatchSelectWidth:!1,className:"auto-width",children:qn.filter(a=>!!vo(a.value).length).map(a=>r.jsx(y.Select.OptGroup,{label:n(a.title),children:vo(a.value).map(([l,{name:c}])=>r.jsx(y.Select.Option,{value:l,children:n(c)},l))},a.value))}),r.jsx(i.Variable.Input,{value:t[1],onChange:a=>o({calculator:e,operands:[t[0],a]}),scope:s,useTypedConstant:!0})]})}function Zn({value:e,onChange:t,onRemove:o}){if(!e)return null;const{calculator:n,operands:s=[]}=e;return r.jsxs("div",{className:i.css`
|
|
510
510
|
display: flex;
|
|
511
511
|
position: relative;
|
|
512
512
|
margin: 0.5em 0;
|
|
513
|
-
`,children:[e.group?r.jsx(xo,{value:e.group,onChange:a=>t(T(C({},e),{group:a}))}):r.jsx(Kn,{operands:s,calculator:n,onChange:t}),r.jsx(
|
|
513
|
+
`,children:[e.group?r.jsx(xo,{value:e.group,onChange:a=>t(T(C({},e),{group:a}))}):r.jsx(Kn,{operands:s,calculator:n,onChange:t}),r.jsx(y.Button,{"aria-label":"icon-close",onClick:o,type:"link",icon:r.jsx(M.CloseCircleOutlined,{})})]})}function xo({value:e,onChange:t}){const{t:o}=_.useTranslation(),{type:n="and",calculations:s=[]}=e;function a(){t(T(C({},e),{calculations:[...s,{not:!1,calculator:"equal"}]}))}function l(){t(T(C({},e),{calculations:[...s,{not:!1,group:{type:"and",calculations:[]}}]}))}function c(d){s.splice(d,1),t(T(C({},e),{calculations:[...s]}))}function u(d,f){s.splice(d,1,f),t(T(C({},e),{calculations:[...s]}))}return r.jsxs("div",{className:i.cx("node-type-condition-group",i.css`
|
|
514
514
|
position: relative;
|
|
515
515
|
width: 100%;
|
|
516
516
|
.node-type-condition-group {
|
|
@@ -529,14 +529,14 @@
|
|
|
529
529
|
width: auto;
|
|
530
530
|
min-width: 6em;
|
|
531
531
|
}
|
|
532
|
-
`,children:r.jsxs(_.Trans,{children:["Meet ",r.jsxs(
|
|
532
|
+
`,children:r.jsxs(_.Trans,{children:["Meet ",r.jsxs(y.Select,{role:"button","data-testid":"filter-select-all-or-any",value:n,onChange:d=>t(T(C({},e),{type:d})),children:[r.jsx(y.Select.Option,{value:"and",children:"All"}),r.jsx(y.Select.Option,{value:"or",children:"Any"})]})," conditions in the group"]})}),r.jsx("div",{className:"calculation-items",children:s.map((d,f)=>r.jsx(Zn,{value:d,onChange:u.bind(this,f),onRemove:()=>c(f)},`${d.calculator}_${f}`))}),r.jsxs("div",{className:i.css`
|
|
533
533
|
button {
|
|
534
534
|
padding: 0;
|
|
535
535
|
&:not(:last-child) {
|
|
536
536
|
margin-right: 1em;
|
|
537
537
|
}
|
|
538
538
|
}
|
|
539
|
-
`,children:[r.jsx(
|
|
539
|
+
`,children:[r.jsx(y.Button,{type:"link",onClick:a,children:o("Add condition")}),r.jsx(y.Button,{type:"link",onClick:l,children:o("Add condition group")})]})]})}function Qn({value:e,onChange:t}){const o=e&&Object.keys(e).length?e:{group:{type:"and",calculations:[]}};return r.jsx(xo,{value:o.group,onChange:n=>t(T(C({},o),{group:n}))})}class Xn extends ye{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(([o])=>["math.js","formula.js"].includes(o))].reduce((o,[n,s])=>o.concat(C({value:n},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-validator"(o,n,{form:s}){const{values:a}=s,{evaluate:l}=De.evaluators.get(a.engine),c=o.trim().replace(/{{([^{}]+)}}/g," 1 ");try{return l(c),""}catch(u){return E("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:bo,useWorkflowVariableOptions:ge});w(this,"components",{CalculationConfig:Qn,WorkflowVariableTextArea:At,RadioWithTooltip:Be})}Component({data:o}){const{t:n}=_.useTranslation(),{nodes:s}=q(),{styles:a}=ne(),{id:l,config:{rejectOnFalse:c}}=o,u=s.find(f=>f.upstreamId===l&&f.branchIndex===1),d=s.find(f=>f.upstreamId===l&&f.branchIndex===0);return r.jsx(ht,{data:o,children:c?null:r.jsxs("div",{className:a.nodeSubtreeClass,children:[r.jsxs("div",{className:a.branchBlockClass,children:[r.jsx(Ue,{from:o,entry:d,branchIndex:0}),r.jsx(Ue,{from:o,entry:u,branchIndex:1})]}),r.jsxs("div",{className:a.conditionClass,children:[r.jsx("span",{style:{right:"4em"},children:n("No")}),r.jsx("span",{style:{left:"4em"},children:n("Yes")})]})]})})}}class Rn extends ye{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 Xe({value:e,onChange:t,renderSchemaComponent:o}){const n=ge();return r.jsx(i.Variable.Input,{value:e,onChange:t,scope:n,children:o()})}class er extends ye{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:T(C({},le),{"x-reactions":[...le["x-reactions"],{target:"params",effects:["onFieldValueChange"],fulfill:{state:{visible:"{{!!$self.value}}",value:"{{Object.create({})}}"}}}]}),multiple:{type:"boolean","x-decorator":"FormItem","x-component":"Checkbox","x-content":`{{t("Allow multiple records as result", { ns: "${p}" })}}`,description:`{{t("If checked, when there are multiple records in the query result, an array will be returned as the result, which can be operated on one by one using a loop node. Otherwise, only one record will be returned.", { ns: "${p}" })}}`},params:{type:"object","x-component":"fieldset",properties:{filter:Ge,sort:gn,pagination:bn,appends:Ie},"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",{useCollectionDataSource:i.useCollectionDataSource,useSortableFields(){const o=i.useCompile(),{getCollectionFields:n,getInterface:s}=i.useCollectionManager_deprecated(),{values:a}=j.useForm();return n(a.collection).filter(c=>{if(!c.interface)return!1;const u=s(c.interface);return!!(u!=null&&u.sortable)}).map(c=>{var u,d;return{value:c.name,label:(u=c==null?void 0:c.uiSchema)!=null&&u.title?o((d=c==null?void 0:c.uiSchema)==null?void 0:d.title):c.name}})}});w(this,"components",{ArrayItems:Lo.ArrayItems,FilterDynamicComponent:Xe,SchemaComponentContext:i.SchemaComponentContext,WorkflowVariableInput:Rt})}useVariables({key:o,title:n,config:s},a){var d,f;const l=i.useCompile(),{getCollectionFields:c}=i.useCollectionManager_deprecated(),[u]=Se(T(C({appends:[o,...((f=(d=s.params)==null?void 0:d.appends)==null?void 0:f.map(h=>`${o}.${h}`))||[]]},a),{fields:[{collectionName:s.collection,name:o,type:"hasOne",target:s.collection,uiSchema:{title:n}}],compile:l,getCollectionFields:c}));return u}useInitializers(o){var n,s;return!o.config.collection||o.config.multiple?null:{name:(n=o.title)!=null?n:`#${o.id}`,type:"item",title:(s=o.title)!=null?s:`#${o.id}`,Component:Me,collection:o.config.collection,dataPath:`$jobsMapByNodeKey.${o.key}`}}}function tr(e){const{getCollectionFields:t}=i.useCollectionManager_deprecated(),{path:o}=j.useField(),n=o.segments[o.segments.length-1],{values:s}=j.useForm(),[a,l]=i.parseCollectionName(s==null?void 0:s.collection),c=t(l,a),{type:u}=c.find(h=>h.name===n),d=Array.isArray(e.value)?e.value.join(","):e.value;function f(h){const x=h.target.value.trim();e.onChange(["belongsTo","hasOne"].includes(u)?x:x.split(/[,\s]+/))}return r.jsx(y.Input,T(C({},e),{value:d,onChange:f}))}const wo=j.observer(({value:e,disabled:t,onChange:o,filter:n})=>{const{token:s}=i.useToken(),{t:a}=_.useTranslation(),l=i.useCompile(),c=j.useForm(),{getCollectionFields:u}=i.useCollectionManager_deprecated(),d=ge(),{values:f}=c,[h,x]=i.parseCollectionName(f==null?void 0:f.collection),v=u(x,h).filter(A=>A.uiSchema),m=n?v.filter(n.bind(f)):v,k=b.useMemo(()=>m.filter(A=>!e||!(A.name in e)),[m,e]),S=t||c.disabled,N=b.useMemo(()=>({onClick:({key:A})=>{o(T(C({},e),{[A]:null}))},style:{maxHeight:300,overflowY:"auto"},items:k.map(A=>{var P,z;return{key:A.name,label:l((z=(P=A.uiSchema)==null?void 0:P.title)!=null?z:A.name)}})}),[o,k,e]);return r.jsx("fieldset",{className:i.css`
|
|
540
540
|
margin-top: 0.5em;
|
|
541
541
|
|
|
542
542
|
> .ant-formily-item {
|
|
@@ -546,12 +546,12 @@
|
|
|
546
546
|
line-height: 32px;
|
|
547
547
|
}
|
|
548
548
|
}
|
|
549
|
-
`,children:
|
|
549
|
+
`,children:m.length?r.jsxs(i.CollectionProvider_deprecated,{name:x,dataSource:h,children:[m.filter(A=>e&&A.name in e).map(A=>{var z,U;const P=["belongsTo","hasOne","hasMany","belongsToMany"].includes(A.type)?tr:i.CollectionField;return r.jsxs(y.Form.Item,{label:l((U=(z=A.uiSchema)==null?void 0:z.title)!=null?U:A.name),labelAlign:"left",className:i.css`
|
|
550
550
|
.ant-form-item-control-input-content {
|
|
551
551
|
display: flex;
|
|
552
552
|
}
|
|
553
|
-
`,children:[r.jsx(i.Variable.Input,{scope:d,value:e[A.name],changeOnSelect:!0,onChange:F=>{o(T(C({},e),{[A.name]:F}))},children:r.jsx(i.SchemaComponent,{schema:{type:"void",properties:{[A.name]:{"x-component":P,"x-validator"(){return""}}}}})}),S?null:r.jsx(
|
|
553
|
+
`,children:[r.jsx(i.Variable.Input,{scope:d,value:e[A.name],changeOnSelect:!0,onChange:F=>{o(T(C({},e),{[A.name]:F}))},children:r.jsx(i.SchemaComponent,{schema:{type:"void",properties:{[A.name]:{"x-component":P,"x-validator"(){return""}}}}})}),S?null:r.jsx(y.Button,{"aria-label":"icon-close",type:"link",icon:r.jsx(M.CloseCircleOutlined,{}),onClick:()=>{var O;const I=e,{[O=A.name]:F}=I,$=Q(I,[jo(O)]);o($)}})]},A.name)}),k.length?r.jsx(y.Dropdown,{menu:N,children:r.jsx(y.Button,{icon:r.jsx(M.PlusOutlined,{}),children:a("Add field")})}):null]}):r.jsx("p",{style:{color:s.colorText},children:E("Please select collection first")})})},{displayName:"CollectionFieldSet"});class or extends ye{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:T(C({},le),{"x-reactions":[...le["x-reactions"],{target:"params",effects:["onFieldValueChange"],fulfill:{state:{visible:"{{!!$self.value}}",value:"{{Object.create({})}}"}}}]}),params:{type:"object",properties:{values:Yt,appends:Ie}}});w(this,"scope",{useCollectionDataSource:i.useCollectionDataSource});w(this,"components",{CollectionFieldset:wo})}useVariables({key:o,title:n,config:s},a){var d,f;const l=i.useCompile(),{getCollectionFields:c}=i.useCollectionManager_deprecated(),[u]=Se(T(C({appends:[o,...((f=(d=s.params)==null?void 0:d.appends)==null?void 0:f.map(h=>`${o}.${h}`))||[]]},a),{fields:[{collectionName:s.collection,name:o,type:"hasOne",target:s.collection,uiSchema:{title:n}}],compile:l,getCollectionFields:c}));return u}useInitializers(o){var n,s;return o.config.collection?{name:(n=o.title)!=null?n:`#${o.id}`,type:"item",title:(s=o.title)!=null?s:`#${o.id}`,Component:Me,collection:o.config.collection,dataPath:`$jobsMapByNodeKey.${o.key}`}:null}}function nr(o){var n=o,{onChange:e}=n,t=Q(n,["onChange"]);const{getCollectionFields:s}=i.useCollectionManager_deprecated(),a=j.useForm(),{collection:l}=a.values,c=s(l),u=j.useField();function d({target:f}){const h=u.query(".values").take();if(!h)return;const x=c.reduce((v,m)=>(m.name in h.value&&(f.value||!["hasOne","hasMany","belongsToMany"].includes(m.type))&&(v[m.name]=h.value[m.name]),v),{});a.setValuesIn("params.values",x),e(f.value)}return r.jsx(Be,T(C({},t),{onChange:d}))}class rr extends ye{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:T(C({},le),{"x-reactions":[...le["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":"IndividualHooksRadioWithTooltip","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:T(C({},Ge),{title:`{{t("Only update records matching conditions", { ns: "${p}" })}}`,"x-validator"(o){return H.isValidFilter(o)?"":E("Please add at least one condition")}}),values:T(C({},Yt),{"x-component-props":{filter(o){var n;return((n=this.params)==null?void 0:n.individualHooks)||!["hasOne","hasMany","belongsToMany"].includes(o.type)}}})}}});w(this,"scope",{useCollectionDataSource:i.useCollectionDataSource});w(this,"components",{FilterDynamicComponent:Xe,CollectionFieldset:wo,IndividualHooksRadioWithTooltip:nr})}}class sr extends ye{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:T(C({},le),{"x-reactions":[...le["x-reactions"],{target:"params",fulfill:{state:{visible:"{{!!$self.value}}"}}},{target:"params",effects:["onFieldValueChange"],fulfill:{state:{value:"{{Object.create({})}}"}}}]}),params:{type:"object",properties:{filter:T(C({},Ge),{"x-validator"(o){return H.isValidFilter(o)?"":E("Please add at least one condition")}})}}});w(this,"scope",{useCollectionDataSource:i.useCollectionDataSource});w(this,"components",{FilterDynamicComponent:Xe})}}const ir=new i.SchemaSettings({name:"actionSettings:submitToWorkflow",items:[{name:"editButton",Component:i.ButtonEditor,useComponentProps(){const{buttonEditorProps:e}=i.useSchemaToolbar();return e}},{name:"secondConfirmation",Component:i.SecondConFirm},{name:"assignFieldValues",Component:i.AssignedFieldValues},{name:"skipRequiredValidation",Component:i.SkipValidation},{name:"afterSuccessfulSubmission",Component:i.AfterSuccess,useVisible(){var t;const e=j.useFieldSchema();return Dt.isValid((t=e==null?void 0:e["x-action-settings"])==null?void 0:t.onSuccess)}},{name:"bindWorkflow",Component:i.WorkflowConfig},{name:"delete",sort:100,Component:i.RemoveButton,useComponentProps(){const{removeButtonProps:e}=i.useSchemaToolbar();return e}}]});function lr(e){const{execution:t,nodes:o}=q(),n=b.useMemo(()=>o.reduce((l,c)=>Object.assign(l,{[c.id]:c.key}),{}),[o]),s=b.useMemo(()=>{var l;return{$context:t==null?void 0:t.context,$jobsMapByNodeKey:((l=t==null?void 0:t.jobs)!=null?l:[]).reduce((c,u)=>Object.assign(c,{[n[u.nodeId]]:u.result}),{})}},[t==null?void 0:t.context,t==null?void 0:t.jobs,n]);return b.useMemo(()=>ut.get(s,e),[s,e])}function ar({collection:e,dataPath:t,children:o}){const n=j.useField(),s=b.useRef(null),{getAssociationAppends:a}=i.useAssociationNames(),{appends:l,updateAssociationValues:c}=a(),u=lr(t);let d,f;if(typeof e=="string"){const N=i.parseCollectionName(e);d=N[0],f=N[1]}else f=e;const h=b.useMemo(()=>he.createForm({values:u,readPretty:!0}),[u]),x={appends:l},v={loading:!1,data:{data:u}},k=i.useAPIClient().resource(f),S=i.useBlockRequestContext();return r.jsx(i.CollectionProvider_deprecated,{dataSource:d,collection:f,children:r.jsx(i.RecordProvider,{record:u,parent:null,children:r.jsx(i.BlockRequestContext_deprecated.Provider,{value:{block:"form",field:n,service:v,resource:k,__parent:S},children:r.jsx(i.FormBlockContext.Provider,{value:{params:x,form:h,field:n,service:v,updateAssociationValues:c,formBlockRef:s},children:o})})})})}function cr(e){const a=e,{options:t=[],direction:o}=a,n=Q(a,["options","direction"]),s=i.useCompile();return r.jsx(y.Checkbox.Group,T(C({},n),{children:r.jsx(y.Space,{direction:o,children:t.map(l=>r.jsxs(y.Checkbox,{value:l.value,children:[r.jsx("span",{className:i.css`
|
|
554
554
|
& + .anticon {
|
|
555
555
|
margin-left: 0.25em;
|
|
556
556
|
}
|
|
557
|
-
`,children:s(l.label)}),l.tooltip&&r.jsx(
|
|
557
|
+
`,children:s(l.label)}),l.tooltip&&r.jsx(y.Tooltip,{title:s(l.tooltip),children:r.jsx(M.QuestionCircleOutlined,{style:{color:"#666"}})})]},l.value))})}))}function ur({children:e,workflow:t,execution:o,nodes:n}){const s=i.usePlugin(ce),a=s.triggers.get(t.type).components,l=n.reduce((c,{type:u})=>Object.assign(c,s.instructions.get(u).components),{});return r.jsx(Ee.Provider,{value:{workflow:t,nodes:n,execution:o},children:r.jsx(i.SchemaComponentOptions,{components:C(C({},a),l),children:e})})}class ce extends i.Plugin{constructor(){super(...arguments);w(this,"triggers",new H.Registry);w(this,"instructions",new H.Registry);w(this,"getTriggersOptions",()=>Array.from(this.triggers.getEntities()).map(a=>{var[o,l]=a,c=l,{title:n}=c,s=Q(c,["title"]);return{value:o,label:n,color:"gold",options:s}}))}isWorkflowSync(o){var n;return(n=this.triggers.get(o.type).sync)!=null?n:o.sync}registerTrigger(o,n){if(typeof n=="function")this.triggers.register(o,new n);else if(n)this.triggers.register(o,n);else throw new TypeError("invalid trigger type to register")}registerInstruction(o,n){if(typeof n=="function")this.instructions.register(o,new n);else if(n instanceof ye)this.instructions.register(o,n);else throw new TypeError("invalid instruction type to register")}load(){return Y(this,null,function*(){this.addRoutes(),this.addComponents(),this.app.pluginSettingsManager.add(p,{icon:"PartitionOutlined",title:`{{t("Workflow", { ns: "${p}" })}}`,Component:fn,aclSnippet:"pm.workflow.workflows"}),this.app.schemaSettingsManager.add(ir),this.registerTrigger("collection",On),this.registerTrigger("schedule",Un),this.registerInstruction("calculation",Yn),this.registerInstruction("condition",Xn),this.registerInstruction("end",Rn),this.registerInstruction("query",er),this.registerInstruction("create",or),this.registerInstruction("update",rr),this.registerInstruction("destroy",sr)})}addComponents(){this.app.addComponents({WorkflowPage:_t,ExecutionPage:Lt})}addRoutes(){this.app.router.add("admin.workflow.workflows.id",{path:ve(":id"),element:r.jsx(_t,{})}),this.app.router.add("admin.workflow.executions.id",{path:_e(":id"),element:r.jsx(Lt,{})})}}g.BaseTypeSets=Ye,g.Branch=Ue,g.CheckboxGroupWithTooltip=cr,g.CollectionBlockInitializer=Me,g.DetailsBlockProvider=ar,g.EXECUTION_STATUS=de,g.ExecutionContextProvider=ur,g.ExecutionStatusOptions=ze,g.ExecutionStatusOptionsMap=He,g.FieldsSelect=xt,g.FilterDynamicComponent=Xe,g.FlowContext=Ee,g.Instruction=ye,g.JOB_STATUS=ie,g.JobButton=jt,g.JobStatusOptions=mt,g.JobStatusOptionsMap=Je,g.Node=Bt,g.NodeContext=ft,g.NodeDefaultView=ht,g.RadioWithTooltip=Be,g.RemoveButton=Vt,g.SimpleDesigner=go,g.Trigger=yt,g.ValueBlock=Te,g.WorkflowVariableInput=Rt,g.WorkflowVariableJSON=wn,g.WorkflowVariableRawTextArea=xn,g.WorkflowVariableTextArea=At,g.default=ce,g.defaultFieldNames=ke,g.getCollectionFieldOptions=Se,g.getWorkflowDetailPath=ve,g.getWorkflowExecutionsPath=_e,g.linkNodes=bt,g.nodesOptions=qt,g.scopeOptions=Zt,g.systemOptions=Qt,g.traverseSchema=vt,g.triggerOptions=Kt,g.useAvailableUpstreams=It,g.useFlowContext=q,g.useGetAriaLabelOfAddButton=pt,g.useNodeContext=Ce,g.useRecordTriggerWorkflowsActionProps=kn,g.useStyles=ne,g.useTrigger=gt,g.useTriggerWorkflowsActionProps=Cn,g.useUpstreamScopes=Pt,g.useWorkflowAnyExecuted=eo,g.useWorkflowExecuted=Sn,g.useWorkflowVariableOptions=ge,Object.defineProperties(g,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/externalVersion.js
CHANGED
|
@@ -2,23 +2,23 @@ module.exports = {
|
|
|
2
2
|
"react": "18.2.0",
|
|
3
3
|
"antd": "5.12.8",
|
|
4
4
|
"@ant-design/icons": "5.2.6",
|
|
5
|
-
"@nocobase/client": "0.21.0-alpha.
|
|
5
|
+
"@nocobase/client": "0.21.0-alpha.3",
|
|
6
6
|
"react-router-dom": "6.21.0",
|
|
7
|
-
"@nocobase/utils": "0.21.0-alpha.
|
|
7
|
+
"@nocobase/utils": "0.21.0-alpha.3",
|
|
8
8
|
"react-i18next": "11.18.6",
|
|
9
9
|
"@formily/core": "2.3.0",
|
|
10
10
|
"@formily/react": "2.3.0",
|
|
11
|
-
"@nocobase/database": "0.21.0-alpha.
|
|
12
|
-
"@nocobase/server": "0.21.0-alpha.
|
|
13
|
-
"@nocobase/logger": "0.21.0-alpha.
|
|
14
|
-
"@nocobase/evaluators": "0.21.0-alpha.
|
|
11
|
+
"@nocobase/database": "0.21.0-alpha.3",
|
|
12
|
+
"@nocobase/server": "0.21.0-alpha.3",
|
|
13
|
+
"@nocobase/logger": "0.21.0-alpha.3",
|
|
14
|
+
"@nocobase/evaluators": "0.21.0-alpha.3",
|
|
15
15
|
"@formily/shared": "2.3.0",
|
|
16
16
|
"lodash": "4.17.21",
|
|
17
17
|
"@formily/antd-v5": "1.1.9",
|
|
18
|
-
"@nocobase/actions": "0.21.0-alpha.
|
|
19
|
-
"@nocobase/data-source-manager": "0.21.0-alpha.
|
|
18
|
+
"@nocobase/actions": "0.21.0-alpha.3",
|
|
19
|
+
"@nocobase/data-source-manager": "0.21.0-alpha.3",
|
|
20
20
|
"sequelize": "6.35.2",
|
|
21
|
-
"@nocobase/plugin-workflow-test": "0.21.0-alpha.
|
|
22
|
-
"@nocobase/test": "0.21.0-alpha.
|
|
21
|
+
"@nocobase/plugin-workflow-test": "0.21.0-alpha.3",
|
|
22
|
+
"@nocobase/test": "0.21.0-alpha.3",
|
|
23
23
|
"dayjs": "1.11.10"
|
|
24
24
|
};
|
|
@@ -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-04-
|
|
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-04-06T05:16:07.629Z"}
|
|
@@ -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-04-
|
|
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-04-06T05:16:07.306Z"}
|
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": "0.21.0-alpha.
|
|
7
|
+
"version": "0.21.0-alpha.3",
|
|
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": "0.21.0-alpha.
|
|
13
|
+
"@nocobase/plugin-workflow-test": "0.21.0-alpha.3"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@ant-design/icons": "5.x",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@nocobase/test": "0.x",
|
|
46
46
|
"@nocobase/utils": "0.x"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "f7276aff14063a2cf825191a0c83aeacde05a912",
|
|
49
49
|
"keywords": [
|
|
50
50
|
"Workflow"
|
|
51
51
|
]
|