@nocobase/plugin-workflow 1.4.24 → 1.4.25

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.
@@ -520,7 +520,7 @@
520
520
  `,children:[n.jsx(Ct,{value:o.field,onChange:i=>t(A(C({},o),{field:i})),filter:ur,placeholder:r("Select field"),className:"auto-width"}),o.field?n.jsx(g.Select,{value:s,onChange:i=>{a(i),t(A(C({},o),{offset:Math.abs(o.offset)*i}))},options:[{value:0,label:O("Exactly at")},{value:-1,label:r("Before")},{value:1,label:r("After")}],className:"auto-width"}):null,s?n.jsxs(n.Fragment,{children:[n.jsx(g.InputNumber,{value:Math.abs(o.offset),onChange:i=>t(A(C({},o),{offset:(i!=null?i:0)*s}))}),n.jsx(g.Select,{value:o.unit||864e5,onChange:i=>t(A(C({},o),{unit:i})),options:[{value:864e5,label:O("Days")},{value:36e5,label:O("Hours")},{value:6e4,label:O("Minutes")},{value:1e3,label:O("Seconds")}],className:"auto-width"})]}):null]})}function pr({value:e,onChange:t}){const{t:o}=xt(),r=e!=null?typeof e=="object"&&!(e instanceof Date)?"field":"date":null;return n.jsxs("fieldset",{className:l.css`
521
521
  display: flex;
522
522
  gap: 0.5em;
523
- `,children:[n.jsxs(g.Select,{value:r,onChange:s=>{t(s?s==="field"?{}:new Date:null)},className:"auto-width",children:[n.jsx(g.Select.Option,{value:null,children:o("No end")}),n.jsx(g.Select.Option,{value:"field",children:o("By field")}),n.jsx(g.Select.Option,{value:"date",children:o("By custom date")})]}),r==="field"?n.jsx(go,{value:e,onChange:t}):null,r==="date"?n.jsx(g.DatePicker,{showTime:!0,value:en(e),onChange:s=>{t(s?s.toDate():null)}}):null]})}var re=function(){return re=Object.assign||function(e){for(var t,o=1,r=arguments.length;o<r;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 bo(e,t){var o={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function"){var s=0;for(r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(o[r[s]]=e[r[s]])}return o}function nt(e,t,o){if(o||arguments.length===2)for(var r,s=0,a=t.length;s<a;s++)!r&&s in t||(r||(r=Array.prototype.slice.call(t,0,s)),r[s]=t[s]);return e.concat(r||Array.prototype.slice.call(t))}var mr=[{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 * * * *"}],Fe=[{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"]}],j={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 xo(e,t){for(var o=[],r=e;r<=t;r++)o.push(r);return o}function rt(e){return e.sort(function(t,o){return t-o}),e}function vo(e){var t=[];return e.forEach(function(o){t.indexOf(o)<0&&t.push(o)}),t}function ue(e){return Object.entries(e).filter(function(t){var o=t[0],r=t[1];return o&&r}).map(function(t){return t[0]}).join(" ")}function wo(e,t){e&&e({type:"invalid_cron",description:t.errorInvalidCron||j.errorInvalidCron})}function st(e){var t=parseInt(e,10),o=Number(e);return t===o?o:NaN}function Co(e,t,o,r,s,a,i,c,u,d,m,h,v,b){o&&o(void 0),t(!1);var f=!1;if(!e){if(r==="always"||a&&r==="for-default-value")return;f=!0}if(!f){if(c&&(c===!0||c.includes(e))){if(e==="@reboot")return void b("reboot");var k=mr.find(function(S){return S.name===e});k&&(e=k.value)}try{var F=function(S){if(typeof S!="string")throw new Error("Invalid cron string");var E=S.replace(/\s+/g," ").trim().split(" ");if(E.length===5)return E.map(function(L,D){return function(I,$){if(I==="*"||I==="*/1")return[];var N=rt(vo(Fo(function(G,U,pe){if(pe){G=G.toUpperCase();for(var P=0;P<pe.length;P++)G=G.replace(pe[P],"".concat(P+U))}return G}(I,$.min,$.alt).split(",").map(function(G){var U,pe=G.split("/");if(pe.length>2)throw new Error('Invalid value "'.concat(I,' for "').concat($.type,'"'));var P=pe[0],W=pe[1];U=P==="*"?xo($.min,$.max):function(q,_,R){var ee=q.split("-");if(ee.length===1){var Je=st(ee[0]);if(isNaN(Je))throw new Error('Invalid value "'.concat(_,'" for ').concat(R.type));return[Je]}if(ee.length===2){var ye=st(ee[0]),De=st(ee[1]);if(isNaN(ye)||isNaN(De))throw new Error('Invalid value "'.concat(_,'" for ').concat(R.type));if(De<ye)throw new Error('Max range is less than min range in "'.concat(q,'" for ').concat(R.type));return xo(ye,De)}throw new Error('Invalid value "'.concat(q,'" for ').concat(R.type))}(P,I,$);var z=function(q,_){if(q!==void 0){var R=st(q);if(isNaN(R)||R<1)throw new Error('Invalid interval step value "'.concat(q,'" for ').concat(_.type));return R}}(W,$),ae=function(q,_){if(_){var R=q[0];q=q.filter(function(ee){return ee%_==R%_||ee===R})}return q}(U,z);return ae}).flat(),$))),B=To(N,$);if(B!==void 0)throw new Error('Value "'.concat(B,'" out of range for ').concat($.type));return N.length===$.total?[]:N}(L,Fe[D])});throw new Error("Invalid cron string format")}(e),M=function(S){return S[3].length>0?"year":S[2].length>0?"month":S[4].length>0?"week":S[1].length>0?"day":S[0].length>0?"hour":"minute"}(F);b(M),u(F[0]),d(F[1]),m(F[2]),h(F[3]),v(F[4])}catch(S){f=!0}}f&&(s.current=e,t(!0),wo(o,i))}function ko(e,t,o,r,s,a,i){if(e==="reboot")return"@reboot";var c=function(u,d){return u.map(function(m,h){var v=Fe[h];return So(Ao(m,v),v,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"||!r?[]:r],i);return c.join(" ")}function So(e,t,o,r,s){var a="";if(function(c,u){return c.length===u.max-u.min+1}(e,t)||e.length===0)a="*";else{var i=function(c){if(c.length>2){var u=c[1]-c[0];if(u>1)return u}}(e);a=i&&function(c,u){for(var d=1;d<c.length;d++){var m=c[d-1];if(c[d]-m!==u)return!1}return!0}(e,i)?function(c,u,d){var m=No(c),h=Oo(c),v=c.length===(h-m)/d+1;return!!(m===u.min&&h+d>u.max&&v)}(e,t,i)?"*/".concat(i):"".concat(Oe(No(e),t,o,r,s),"-").concat(Oe(Oo(e),t,o,r,s),"/").concat(i):function(c){var u=[],d=null;return c.forEach(function(m,h,v){m!==v[h+1]-1?d!==null?(u.push([d,m]),d=null):u.push(m):d===null&&(d=m)}),u}(e).map(function(c){return Array.isArray(c)?"".concat(Oe(c[0],t,o,r,s),"-").concat(Oe(c[1],t,o,r,s)):Oe(c,t,o,r,s)}).join(",")}return a}function Oe(e,t,o,r,s){var a=e.toString(),i=t.type,c=t.alt,u=t.min,d=r&&(r===!0||r.includes(i)),m=s==="24-hour-clock"&&(i==="hours"||i==="minutes");if(o&&i==="week-days"||o&&i==="months"?a=c[e-u]:e<10&&(d||m)&&(a=a.padStart(2,"0")),i==="hours"&&s==="12-hour-clock"){var h=e>=12?"PM":"AM",v=e%12||12;v<10&&d&&(v=v.toString().padStart(2,"0")),a="".concat(v).concat(h)}return a}function Ao(e,t){var o=rt(vo(Fo(e,t)));if(o.length===0)return o;var r=To(o,t);if(r!==void 0)throw new Error('Value "'.concat(r,'" out of range for ').concat(t.type));return o}function Fo(e,t){return t.type==="week-days"&&(e=e.map(function(o){return o===7?0:o})),e}function To(e,t){var o=e[0],r=e[e.length-1];return o<t.min?o:r>t.max?r:void 0}function No(e){return e[0]}function Oo(e){return e[e.length-1]}function ze(e){var t=e.value,o=e.grid,r=o===void 0||o,s=e.optionsList,a=e.setValue,i=e.locale,c=e.className,u=e.humanizeLabels,d=e.disabled,m=e.readOnly,h=e.leadingZero,v=e.clockFormat,b=e.period,f=e.unit,k=e.periodicityOnDoubleClick,F=e.mode,M=bo(e,["value","grid","optionsList","setValue","locale","className","humanizeLabels","disabled","readOnly","leadingZero","clockFormat","period","unit","periodicityOnDoubleClick","mode"]),S=y.useMemo(function(){if(t&&Array.isArray(t))return t.map(function(P){return P.toString()})},[t]),E=y.useMemo(function(){return s?s.map(function(P,W){return{value:(f.min===0?W:W+1).toString(),label:P}}):nt([],Array(f.total),!0).map(function(P,W){var z=f.min===0?W:W+1;return{value:z.toString(),label:Oe(z,f,u,h,v)}})},[s,h,u,v]),L=JSON.stringify(i),D=y.useCallback(function(P){var W=P.value;if(!t||t[0]!==Number(W))return n.jsx(n.Fragment,{});var z=So(Ao(t,f),f,u,h,v),ae=z.match(/^\*\/([0-9]+),?/)||[];return n.jsx("div",{children:ae[1]?"".concat(i.everyText||j.everyText," ").concat(ae[1]):z})},[t,L,u,h,v]),I=y.useCallback(function(P){var W=Array.isArray(P)?rt(P):[P],z=W;t&&(z=F==="single"?[]:nt([],t,!0),W.forEach(function(ae){var q=Number(ae);z=t.some(function(_){return _===q})?z.filter(function(_){return _!==q}):rt(nt(nt([],z,!0),[q],!1))})),z.length===f.total?a([]):a(z)},[a,t]),$=y.useCallback(function(P){if(P!==0&&P!==1){for(var W=f.total+f.min,z=[],ae=f.min;ae<W;ae++)ae%P==0&&z.push(ae);var q=t&&z&&t.length===z.length&&t.every(function(R,ee){return R===z[ee]}),_=z.length===E.length;a(_||q?[]:z)}else a([])},[t,E,a]),N=y.useRef([]),B=y.useCallback(function(P){if(!m){var W=N.current;W.push({time:new Date().getTime(),value:Number(P)});var z=window.setTimeout(function(){k&&W.length>1&&W[W.length-1].time-W[W.length-2].time<300?W[W.length-1].value===W[W.length-2].value?$(Number(P)):I([W[W.length-2].value,W[W.length-1].value]):I(Number(P)),N.current=[]},300);return function(){window.clearTimeout(z)}}},[N,I,$,m,k]),G=y.useCallback(function(){m||a([])},[a,m]),U=y.useMemo(function(){var P;return ue(((P={"react-js-cron-select":!0,"react-js-cron-custom-select":!0})["".concat(c,"-select")]=!!c,P))},[c]),pe=y.useMemo(function(){var P;return ue(((P={"react-js-cron-select-dropdown":!0})["react-js-cron-select-dropdown-".concat(f.type)]=!0,P["react-js-cron-custom-select-dropdown"]=!0,P["react-js-cron-custom-select-dropdown-".concat(f.type)]=!0,P["react-js-cron-custom-select-dropdown-minutes-large"]=f.type==="minutes"&&b!=="hour"&&b!=="day",P["react-js-cron-custom-select-dropdown-minutes-medium"]=f.type==="minutes"&&(b==="day"||b==="hour"),P["react-js-cron-custom-select-dropdown-hours-twelve-hour-clock"]=f.type==="hours"&&v==="12-hour-clock",P["react-js-cron-custom-select-dropdown-grid"]=!!r,P["".concat(c,"-select-dropdown")]=!!c,P["".concat(c,"-select-dropdown-").concat(f.type)]=!!c,P))},[c,r,v,b]);return n.jsx(g.Select,re({mode:F!=="single"||k?"multiple":void 0,allowClear:!m,virtual:!1,open:!m&&void 0,value:S,onClear:G,tagRender:D,className:U,popupClassName:pe,options:E,showSearch:!1,showArrow:!m,menuItemSelectedIcon:null,dropdownMatchSelectWidth:!1,onSelect:B,onDeselect:B,disabled:d,dropdownAlign:f.type!=="minutes"&&f.type!=="hours"||b==="day"||b==="hour"?void 0:{points:["tr","br"]},"data-testid":"custom-select-".concat(f.type)},M))}function fr(e){var t=e.value,o=e.setValue,r=e.locale,s=e.className,a=e.disabled,i=e.readOnly,c=e.leadingZero,u=e.clockFormat,d=e.period,m=e.periodicityOnDoubleClick,h=e.mode,v=y.useMemo(function(){var b;return ue(((b={"react-js-cron-field":!0,"react-js-cron-hours":!0})["".concat(s,"-field")]=!!s,b["".concat(s,"-hours")]=!!s,b))},[s]);return n.jsxs("div",re({className:v},{children:[r.prefixHours!==""&&n.jsx("span",{children:r.prefixHours||j.prefixHours}),n.jsx(ze,{placeholder:r.emptyHours||j.emptyHours,value:t,unit:Fe[1],setValue:o,locale:r,className:s,disabled:a,readOnly:i,leadingZero:c,clockFormat:u,period:d,periodicityOnDoubleClick:m,mode:h})]}))}function hr(e){var t=e.value,o=e.setValue,r=e.locale,s=e.className,a=e.disabled,i=e.readOnly,c=e.leadingZero,u=e.clockFormat,d=e.period,m=e.periodicityOnDoubleClick,h=e.mode,v=y.useMemo(function(){var b;return ue(((b={"react-js-cron-field":!0,"react-js-cron-minutes":!0})["".concat(s,"-field")]=!!s,b["".concat(s,"-minutes")]=!!s,b))},[s]);return n.jsxs("div",re({className:v},{children:[d==="hour"?r.prefixMinutesForHourPeriod!==""&&n.jsx("span",{children:r.prefixMinutesForHourPeriod||j.prefixMinutesForHourPeriod}):r.prefixMinutes!==""&&n.jsx("span",{children:r.prefixMinutes||j.prefixMinutes}),n.jsx(ze,{placeholder:d==="hour"?r.emptyMinutesForHourPeriod||j.emptyMinutesForHourPeriod:r.emptyMinutes||j.emptyMinutes,value:t,unit:Fe[0],setValue:o,locale:r,className:s,disabled:a,readOnly:i,leadingZero:c,clockFormat:u,period:d,periodicityOnDoubleClick:m,mode:h}),d==="hour"&&r.suffixMinutesForHourPeriod!==""&&n.jsx("span",{children:r.suffixMinutesForHourPeriod||j.suffixMinutesForHourPeriod})]}))}function yr(e){var t=e.value,o=e.setValue,r=e.locale,s=e.className,a=e.weekDays,i=e.disabled,c=e.readOnly,u=e.leadingZero,d=e.period,m=e.periodicityOnDoubleClick,h=e.mode,v=!a||a.length===0,b=y.useMemo(function(){var F;return ue(((F={"react-js-cron-field":!0,"react-js-cron-month-days":!0,"react-js-cron-month-days-placeholder":!v})["".concat(s,"-field")]=!!s,F["".concat(s,"-month-days")]=!!s,F))},[s,v]),f=JSON.stringify(r),k=y.useMemo(function(){return v?r.emptyMonthDays||j.emptyMonthDays:r.emptyMonthDaysShort||j.emptyMonthDaysShort},[v,f]);return!c||t&&t.length>0||(!t||t.length===0)&&(!a||a.length===0)?n.jsxs("div",re({className:b},{children:[r.prefixMonthDays!==""&&n.jsx("span",{children:r.prefixMonthDays||j.prefixMonthDays}),n.jsx(ze,{placeholder:k,value:t,setValue:o,unit:Fe[2],locale:r,className:s,disabled:i,readOnly:c,leadingZero:u,period:d,periodicityOnDoubleClick:m,mode:h})]})):null}function gr(e){var t=e.value,o=e.setValue,r=e.locale,s=e.className,a=e.humanizeLabels,i=e.disabled,c=e.readOnly,u=e.period,d=e.periodicityOnDoubleClick,m=e.mode,h=r.months||j.months,v=y.useMemo(function(){var b;return ue(((b={"react-js-cron-field":!0,"react-js-cron-months":!0})["".concat(s,"-field")]=!!s,b["".concat(s,"-months")]=!!s,b))},[s]);return n.jsxs("div",re({className:v},{children:[r.prefixMonths!==""&&n.jsx("span",{children:r.prefixMonths||j.prefixMonths}),n.jsx(ze,{placeholder:r.emptyMonths||j.emptyMonths,optionsList:h,grid:!1,value:t,unit:re(re({},Fe[3]),{alt:r.altMonths||j.altMonths}),setValue:o,locale:r,className:s,humanizeLabels:a,disabled:i,readOnly:c,period:u,periodicityOnDoubleClick:d,mode:m})]}))}function br(e){var t=e.value,o=e.setValue,r=e.locale,s=e.className,a=e.disabled,i=e.readOnly,c=e.shortcuts,u=e.allowedPeriods,d=[];u.includes("year")&&d.push({value:"year",label:r.yearOption||j.yearOption}),u.includes("month")&&d.push({value:"month",label:r.monthOption||j.monthOption}),u.includes("week")&&d.push({value:"week",label:r.weekOption||j.weekOption}),u.includes("day")&&d.push({value:"day",label:r.dayOption||j.dayOption}),u.includes("hour")&&d.push({value:"hour",label:r.hourOption||j.hourOption}),u.includes("minute")&&d.push({value:"minute",label:r.minuteOption||j.minuteOption}),u.includes("reboot")&&c&&(c===!0||c.includes("@reboot"))&&d.push({value:"reboot",label:r.rebootOption||j.rebootOption});var m=y.useCallback(function(f){i||o(f)},[o,i]),h=y.useMemo(function(){var f;return ue(((f={"react-js-cron-field":!0,"react-js-cron-period":!0})["".concat(s,"-field")]=!!s,f["".concat(s,"-period")]=!!s,f))},[s]),v=y.useMemo(function(){var f;return ue(((f={"react-js-cron-select":!0,"react-js-cron-select-no-prefix":r.prefixPeriod===""})["".concat(s,"-select")]=!!s,f))},[s,r.prefixPeriod]),b=y.useMemo(function(){var f;return ue(((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 n.jsxs("div",re({className:h},{children:[r.prefixPeriod!==""&&n.jsx("span",{children:r.prefixPeriod||j.prefixPeriod}),n.jsx(g.Select,{defaultValue:t,value:t,onChange:m,options:d,className:v,popupClassName:b,disabled:a,showArrow:!i,open:!i&&void 0,"data-testid":"select-period"},JSON.stringify(r))]}))}function xr(e){var t=e.value,o=e.setValue,r=e.locale,s=e.className,a=e.humanizeLabels,i=e.monthDays,c=e.disabled,u=e.readOnly,d=e.period,m=e.periodicityOnDoubleClick,h=e.mode,v=r.weekDays||j.weekDays,b=d==="week"||!i||i.length===0,f=y.useMemo(function(){var E;return ue(((E={"react-js-cron-field":!0,"react-js-cron-week-days":!0,"react-js-cron-week-days-placeholder":!b})["".concat(s,"-field")]=!!s,E["".concat(s,"-week-days")]=!!s,E))},[s,b]),k=JSON.stringify(r),F=y.useMemo(function(){return b?r.emptyWeekDays||j.emptyWeekDays:r.emptyWeekDaysShort||j.emptyWeekDaysShort},[b,k]),M=d==="week"||!u||t&&t.length>0||(!t||t.length===0)&&(!i||i.length===0),S=!u||i&&i.length>0||(!i||i.length===0)&&(!t||t.length===0);return M?n.jsxs("div",re({className:f},{children:[r.prefixWeekDays!==""&&(d==="week"||!S)&&n.jsx("span",{children:r.prefixWeekDays||j.prefixWeekDays}),r.prefixWeekDaysForMonthAndYearPeriod!==""&&d!=="week"&&S&&n.jsx("span",{children:r.prefixWeekDaysForMonthAndYearPeriod||j.prefixWeekDaysForMonthAndYearPeriod}),n.jsx(ze,{placeholder:F,optionsList:v,grid:!1,value:t,unit:re(re({},Fe[4]),{alt:r.altWeekDays||j.altWeekDays}),setValue:o,locale:r,className:s,humanizeLabels:a,disabled:c,readOnly:u,period:d,periodicityOnDoubleClick:m,mode:h})]})):null}function vr(e){var t=e.clearButton,o=t===void 0||t,r=e.clearButtonProps,s=r===void 0?{}:r,a=e.clearButtonAction,i=a===void 0?"fill-with-every":a,c=e.locale,u=c===void 0?j:c,d=e.value,m=d===void 0?"":d,h=e.setValue,v=e.displayError,b=v===void 0||v,f=e.onError,k=e.className,F=e.defaultPeriod,M=F===void 0?"day":F,S=e.allowEmpty,E=S===void 0?"for-default-value":S,L=e.humanizeLabels,D=L===void 0||L,I=e.humanizeValue,$=I!==void 0&&I,N=e.disabled,B=N!==void 0&&N,G=e.readOnly,U=G!==void 0&&G,pe=e.leadingZero,P=pe!==void 0&&pe,W=e.shortcuts,z=W===void 0?["@yearly","@annually","@monthly","@weekly","@daily","@midnight","@hourly"]:W,ae=e.clockFormat,q=e.periodicityOnDoubleClick,_=q===void 0||q,R=e.mode,ee=R===void 0?"multiple":R,Je=e.allowedDropdowns,ye=Je===void 0?["period","months","month-days","week-days","hours","minutes"]:Je,De=e.allowedPeriods,zr=De===void 0?["year","month","week","day","hour","minute","reboot"]:De,Ee=y.useRef(m),Vt=y.useRef(M),Vo=y.useState(),ve=Vo[0],lt=Vo[1],jo=y.useState(),Ue=jo[0],at=jo[1],Wo=y.useState(),it=Wo[0],ct=Wo[1],Lo=y.useState(),He=Lo[0],dt=Lo[1],zo=y.useState(),ut=zo[0],pt=zo[1],Jo=y.useState(),mt=Jo[0],ft=Jo[1],Uo=y.useState(!1),jt=Uo[0],Ge=Uo[1],Ho=y.useState(!1),ht=Ho[0],Go=Ho[1],Jr=function(K){var ge=y.useRef(K);return y.useEffect(function(){ge.current=K},[K]),ge.current}(ht),qo=JSON.stringify(u);y.useEffect(function(){Co(m,Ge,f,E,Ee,!0,u,z,ft,pt,at,ct,dt,lt)},[]),y.useEffect(function(){m!==Ee.current&&Co(m,Ge,f,E,Ee,!1,u,z,ft,pt,at,ct,dt,lt)},[m,Ee,qo,E,z]),y.useEffect(function(){if(!(ve||mt||it||Ue||He||ut)||ht||Jr)ht&&Go(!1);else{var K=ve||Vt.current,ge=ko(K,it,Ue,He,ut,mt,$);h(ge,{selectedPeriod:K}),Ee.current=ge,f&&f(void 0),Ge(!1)}},[ve,Ue,it,He,ut,mt,$,ht]);var Yo=y.useCallback(function(){at(void 0),ct(void 0),dt(void 0),pt(void 0),ft(void 0);var K="",ge=ve!=="reboot"&&ve?ve:Vt.current;ge!==ve&&lt(ge),i==="fill-with-every"&&(K=ko(ge,void 0,void 0,void 0,void 0,void 0)),h(K,{selectedPeriod:ge}),Ee.current=K,Go(!0),E==="never"&&i==="empty"?(Ge(!0),wo(f,u)):(f&&f(void 0),Ge(!1))},[ve,h,f,i]),Ur=y.useMemo(function(){var K;return ue(((K={"react-js-cron":!0,"react-js-cron-error":jt&&b,"react-js-cron-disabled":B,"react-js-cron-read-only":U})["".concat(k)]=!!k,K["".concat(k,"-error")]=jt&&b&&!!k,K["".concat(k,"-disabled")]=B&&!!k,K["".concat(k,"-read-only")]=U&&!!k,K))},[k,jt,b,B,U]),Wt=s.className,_o=bo(s,["className"]),Ko=y.useMemo(function(){var K;return ue(((K={"react-js-cron-clear-button":!0})["".concat(k,"-clear-button")]=!!k,K["".concat(Wt)]=!!Wt,K))},[k,Wt]),Hr=JSON.stringify(_o),Zo=y.useMemo(function(){return o&&!U?n.jsx(g.Button,re({className:Ko,danger:!0,type:"primary",disabled:B},_o,{onClick:Yo},{children:u.clearButtonText||j.clearButtonText})):null},[o,U,qo,Ko,B,Hr,Yo]),te=ve||Vt.current;return n.jsxs("div",re({className:Ur},{children:[ye.includes("period")&&n.jsx(br,{value:te,setValue:lt,locale:u,className:k,disabled:B,readOnly:U,shortcuts:z,allowedPeriods:zr}),te==="reboot"?Zo:n.jsxs(n.Fragment,{children:[te==="year"&&ye.includes("months")&&n.jsx(gr,{value:it,setValue:ct,locale:u,className:k,humanizeLabels:D,disabled:B,readOnly:U,period:te,periodicityOnDoubleClick:_,mode:ee}),(te==="year"||te==="month")&&ye.includes("month-days")&&n.jsx(yr,{value:Ue,setValue:at,locale:u,className:k,weekDays:He,disabled:B,readOnly:U,leadingZero:P,period:te,periodicityOnDoubleClick:_,mode:ee}),(te==="year"||te==="month"||te==="week")&&ye.includes("week-days")&&n.jsx(xr,{value:He,setValue:dt,locale:u,className:k,humanizeLabels:D,monthDays:Ue,disabled:B,readOnly:U,period:te,periodicityOnDoubleClick:_,mode:ee}),n.jsxs("div",{children:[te!=="minute"&&te!=="hour"&&ye.includes("hours")&&n.jsx(fr,{value:ut,setValue:pt,locale:u,className:k,disabled:B,readOnly:U,leadingZero:P,clockFormat:ae,period:te,periodicityOnDoubleClick:_,mode:ee}),te!=="minute"&&ye.includes("minutes")&&n.jsx(hr,{value:mt,setValue:ft,locale:u,period:te,className:k,disabled:B,readOnly:U,leadingZero:P,clockFormat:ae,periodicityOnDoubleClick:_,mode:ee}),Zo]})]})]}))}const Do=[{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 Eo(e){return Do.filter(o=>typeof o.value=="number").reverse().find(o=>!(e%o.value))}function wr(e){let t;switch(typeof e){case"number":return t=Eo(e),t?t.value:"none";case"string":return"cron"}return"none"}function Cr({value:e,onChange:t}){const{t:o}=xt(),r=Eo(e);return n.jsx(g.InputNumber,{value:e/r.value,onChange:s=>t(s*r.value),min:1,addonBefore:o("Every"),addonAfter:o(r.unitText),className:"auto-width"})}function kr({value:e=null,onChange:t}){const{t:o}=xt(),r=wr(e),s=y.useCallback(a=>{if(a==="none"){t(null);return}if(a==="cron"){t("0 * * * * *");return}t(a)},[t]);return n.jsxs("fieldset",{className:l.css`
523
+ `,children:[n.jsxs(g.Select,{value:r,onChange:s=>{t(s?s==="field"?{}:new Date:null)},className:"auto-width",children:[n.jsx(g.Select.Option,{value:null,children:o("No end")}),n.jsx(g.Select.Option,{value:"field",children:o("By field")}),n.jsx(g.Select.Option,{value:"date",children:o("By custom date")})]}),r==="field"?n.jsx(go,{value:e,onChange:t}):null,r==="date"?n.jsx(g.DatePicker,{showTime:!0,value:en(e),onChange:s=>{t(s?s.toDate():null)}}):null]})}var re=function(){return re=Object.assign||function(e){for(var t,o=1,r=arguments.length;o<r;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 bo(e,t){var o={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function"){var s=0;for(r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(o[r[s]]=e[r[s]])}return o}function nt(e,t,o){if(o||arguments.length===2)for(var r,s=0,a=t.length;s<a;s++)!r&&s in t||(r||(r=Array.prototype.slice.call(t,0,s)),r[s]=t[s]);return e.concat(r||Array.prototype.slice.call(t))}var mr=[{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 * * * *"}],Fe=[{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"]}],j={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 xo(e,t){for(var o=[],r=e;r<=t;r++)o.push(r);return o}function rt(e){return e.sort(function(t,o){return t-o}),e}function vo(e){var t=[];return e.forEach(function(o){t.indexOf(o)<0&&t.push(o)}),t}function ue(e){return Object.entries(e).filter(function(t){var o=t[0],r=t[1];return o&&r}).map(function(t){return t[0]}).join(" ")}function wo(e,t){e&&e({type:"invalid_cron",description:t.errorInvalidCron||j.errorInvalidCron})}function st(e){var t=parseInt(e,10),o=Number(e);return t===o?o:NaN}function Co(e,t,o,r,s,a,i,c,u,d,m,h,v,b){o&&o(void 0),t(!1);var f=!1;if(!e){if(r==="always"||a&&r==="for-default-value")return;f=!0}if(!f){if(c&&(c===!0||c.includes(e))){if(e==="@reboot")return void b("reboot");var k=mr.find(function(S){return S.name===e});k&&(e=k.value)}try{var F=function(S){if(typeof S!="string")throw new Error("Invalid cron string");var E=S.replace(/\s+/g," ").trim().split(" ");if(E.length===5)return E.map(function(L,D){return function(I,$){if(I==="*"||I==="*/1")return[];var N=rt(vo(Fo(function(G,U,pe){if(pe){G=G.toUpperCase();for(var P=0;P<pe.length;P++)G=G.replace(pe[P],"".concat(P+U))}return G}(I,$.min,$.alt).split(",").map(function(G){var U,pe=G.split("/");if(pe.length>2)throw new Error('Invalid value "'.concat(I,' for "').concat($.type,'"'));var P=pe[0],W=pe[1];U=P==="*"?xo($.min,$.max):function(q,_,R){var ee=q.split("-");if(ee.length===1){var Je=st(ee[0]);if(isNaN(Je))throw new Error('Invalid value "'.concat(_,'" for ').concat(R.type));return[Je]}if(ee.length===2){var ye=st(ee[0]),De=st(ee[1]);if(isNaN(ye)||isNaN(De))throw new Error('Invalid value "'.concat(_,'" for ').concat(R.type));if(De<ye)throw new Error('Max range is less than min range in "'.concat(q,'" for ').concat(R.type));return xo(ye,De)}throw new Error('Invalid value "'.concat(q,'" for ').concat(R.type))}(P,I,$);var z=function(q,_){if(q!==void 0){var R=st(q);if(isNaN(R)||R<1)throw new Error('Invalid interval step value "'.concat(q,'" for ').concat(_.type));return R}}(W,$),ae=function(q,_){if(_){var R=q[0];q=q.filter(function(ee){return ee%_==R%_||ee===R})}return q}(U,z);return ae}).flat(),$))),B=To(N,$);if(B!==void 0)throw new Error('Value "'.concat(B,'" out of range for ').concat($.type));return N.length===$.total?[]:N}(L,Fe[D])});throw new Error("Invalid cron string format")}(e),M=function(S){return S[3].length>0?"year":S[2].length>0?"month":S[4].length>0?"week":S[1].length>0?"day":S[0].length>0?"hour":"minute"}(F);b(M),u(F[0]),d(F[1]),m(F[2]),h(F[3]),v(F[4])}catch(S){f=!0}}f&&(s.current=e,t(!0),wo(o,i))}function ko(e,t,o,r,s,a,i){if(e==="reboot")return"@reboot";var c=function(u,d){return u.map(function(m,h){var v=Fe[h];return So(Ao(m,v),v,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"||!r?[]:r],i);return c.join(" ")}function So(e,t,o,r,s){var a="";if(function(c,u){return c.length===u.max-u.min+1}(e,t)||e.length===0)a="*";else{var i=function(c){if(c.length>2){var u=c[1]-c[0];if(u>1)return u}}(e);a=i&&function(c,u){for(var d=1;d<c.length;d++){var m=c[d-1];if(c[d]-m!==u)return!1}return!0}(e,i)?function(c,u,d){var m=No(c),h=Oo(c),v=c.length===(h-m)/d+1;return!!(m===u.min&&h+d>u.max&&v)}(e,t,i)?"*/".concat(i):"".concat(Oe(No(e),t,o,r,s),"-").concat(Oe(Oo(e),t,o,r,s),"/").concat(i):function(c){var u=[],d=null;return c.forEach(function(m,h,v){m!==v[h+1]-1?d!==null?(u.push([d,m]),d=null):u.push(m):d===null&&(d=m)}),u}(e).map(function(c){return Array.isArray(c)?"".concat(Oe(c[0],t,o,r,s),"-").concat(Oe(c[1],t,o,r,s)):Oe(c,t,o,r,s)}).join(",")}return a}function Oe(e,t,o,r,s){var a=e.toString(),i=t.type,c=t.alt,u=t.min,d=r&&(r===!0||r.includes(i)),m=s==="24-hour-clock"&&(i==="hours"||i==="minutes");if(o&&i==="week-days"||o&&i==="months"?a=c[e-u]:e<10&&(d||m)&&(a=a.padStart(2,"0")),i==="hours"&&s==="12-hour-clock"){var h=e>=12?"PM":"AM",v=e%12||12;v<10&&d&&(v=v.toString().padStart(2,"0")),a="".concat(v).concat(h)}return a}function Ao(e,t){var o=rt(vo(Fo(e,t)));if(o.length===0)return o;var r=To(o,t);if(r!==void 0)throw new Error('Value "'.concat(r,'" out of range for ').concat(t.type));return o}function Fo(e,t){return t.type==="week-days"&&(e=e.map(function(o){return o===7?0:o})),e}function To(e,t){var o=e[0],r=e[e.length-1];return o<t.min?o:r>t.max?r:void 0}function No(e){return e[0]}function Oo(e){return e[e.length-1]}function ze(e){var t=e.value,o=e.grid,r=o===void 0||o,s=e.optionsList,a=e.setValue,i=e.locale,c=e.className,u=e.humanizeLabels,d=e.disabled,m=e.readOnly,h=e.leadingZero,v=e.clockFormat,b=e.period,f=e.unit,k=e.periodicityOnDoubleClick,F=e.mode,M=bo(e,["value","grid","optionsList","setValue","locale","className","humanizeLabels","disabled","readOnly","leadingZero","clockFormat","period","unit","periodicityOnDoubleClick","mode"]),S=y.useMemo(function(){if(t&&Array.isArray(t))return t.map(function(P){return P.toString()})},[t]),E=y.useMemo(function(){return s?s.map(function(P,W){return{value:(f.min===0?W:W+1).toString(),label:P}}):nt([],Array(f.total),!0).map(function(P,W){var z=f.min===0?W:W+1;return{value:z.toString(),label:Oe(z,f,u,h,v)}})},[s,h,u,v]),L=JSON.stringify(i),D=y.useCallback(function(P){var W=P.value;if(!t||t[0]!==Number(W))return n.jsx(n.Fragment,{});var z=So(Ao(t,f),f,u,h,v),ae=z.match(/^\*\/([0-9]+),?/)||[];return n.jsx("div",{children:ae[1]?"".concat(i.everyText||j.everyText," ").concat(ae[1]):z})},[t,L,u,h,v]),I=y.useCallback(function(P){var W=Array.isArray(P)?rt(P):[P],z=W;t&&(z=F==="single"?[]:nt([],t,!0),W.forEach(function(ae){var q=Number(ae);z=t.some(function(_){return _===q})?z.filter(function(_){return _!==q}):rt(nt(nt([],z,!0),[q],!1))})),z.length===f.total?a([]):a(z)},[a,t]),$=y.useCallback(function(P){if(P!==0&&P!==1){for(var W=f.total+f.min,z=[],ae=f.min;ae<W;ae++)ae%P==0&&z.push(ae);var q=t&&z&&t.length===z.length&&t.every(function(R,ee){return R===z[ee]}),_=z.length===E.length;a(_||q?[]:z)}else a([])},[t,E,a]),N=y.useRef([]),B=y.useCallback(function(P){if(!m){var W=N.current;W.push({time:new Date().getTime(),value:Number(P)});var z=window.setTimeout(function(){k&&W.length>1&&W[W.length-1].time-W[W.length-2].time<300?W[W.length-1].value===W[W.length-2].value?$(Number(P)):I([W[W.length-2].value,W[W.length-1].value]):I(Number(P)),N.current=[]},300);return function(){window.clearTimeout(z)}}},[N,I,$,m,k]),G=y.useCallback(function(){m||a([])},[a,m]),U=y.useMemo(function(){var P;return ue(((P={"react-js-cron-select":!0,"react-js-cron-custom-select":!0})["".concat(c,"-select")]=!!c,P))},[c]),pe=y.useMemo(function(){var P;return ue(((P={"react-js-cron-select-dropdown":!0})["react-js-cron-select-dropdown-".concat(f.type)]=!0,P["react-js-cron-custom-select-dropdown"]=!0,P["react-js-cron-custom-select-dropdown-".concat(f.type)]=!0,P["react-js-cron-custom-select-dropdown-minutes-large"]=f.type==="minutes"&&b!=="hour"&&b!=="day",P["react-js-cron-custom-select-dropdown-minutes-medium"]=f.type==="minutes"&&(b==="day"||b==="hour"),P["react-js-cron-custom-select-dropdown-hours-twelve-hour-clock"]=f.type==="hours"&&v==="12-hour-clock",P["react-js-cron-custom-select-dropdown-grid"]=!!r,P["".concat(c,"-select-dropdown")]=!!c,P["".concat(c,"-select-dropdown-").concat(f.type)]=!!c,P))},[c,r,v,b]);return n.jsx(g.Select,re({mode:F!=="single"||k?"multiple":void 0,allowClear:!m,virtual:!1,open:!m&&void 0,value:S,onClear:G,tagRender:D,className:U,popupClassName:pe,options:E,showSearch:!1,showArrow:!m,menuItemSelectedIcon:null,dropdownMatchSelectWidth:!1,onSelect:B,onDeselect:B,disabled:d,dropdownAlign:f.type!=="minutes"&&f.type!=="hours"||b==="day"||b==="hour"?void 0:{points:["tr","br"]},"data-testid":"custom-select-".concat(f.type)},M))}function fr(e){var t=e.value,o=e.setValue,r=e.locale,s=e.className,a=e.disabled,i=e.readOnly,c=e.leadingZero,u=e.clockFormat,d=e.period,m=e.periodicityOnDoubleClick,h=e.mode,v=y.useMemo(function(){var b;return ue(((b={"react-js-cron-field":!0,"react-js-cron-hours":!0})["".concat(s,"-field")]=!!s,b["".concat(s,"-hours")]=!!s,b))},[s]);return n.jsxs("div",re({className:v},{children:[r.prefixHours!==""&&n.jsx("span",{children:r.prefixHours||j.prefixHours}),n.jsx(ze,{placeholder:r.emptyHours||j.emptyHours,value:t,unit:Fe[1],setValue:o,locale:r,className:s,disabled:a,readOnly:i,leadingZero:c,clockFormat:u,period:d,periodicityOnDoubleClick:m,mode:h})]}))}function hr(e){var t=e.value,o=e.setValue,r=e.locale,s=e.className,a=e.disabled,i=e.readOnly,c=e.leadingZero,u=e.clockFormat,d=e.period,m=e.periodicityOnDoubleClick,h=e.mode,v=y.useMemo(function(){var b;return ue(((b={"react-js-cron-field":!0,"react-js-cron-minutes":!0})["".concat(s,"-field")]=!!s,b["".concat(s,"-minutes")]=!!s,b))},[s]);return n.jsxs("div",re({className:v},{children:[d==="hour"?r.prefixMinutesForHourPeriod!==""&&n.jsx("span",{children:r.prefixMinutesForHourPeriod||j.prefixMinutesForHourPeriod}):r.prefixMinutes!==""&&n.jsx("span",{children:r.prefixMinutes||j.prefixMinutes}),n.jsx(ze,{placeholder:d==="hour"?r.emptyMinutesForHourPeriod||j.emptyMinutesForHourPeriod:r.emptyMinutes||j.emptyMinutes,value:t,unit:Fe[0],setValue:o,locale:r,className:s,disabled:a,readOnly:i,leadingZero:c,clockFormat:u,period:d,periodicityOnDoubleClick:m,mode:h}),d==="hour"&&r.suffixMinutesForHourPeriod!==""&&n.jsx("span",{children:r.suffixMinutesForHourPeriod||j.suffixMinutesForHourPeriod})]}))}function yr(e){var t=e.value,o=e.setValue,r=e.locale,s=e.className,a=e.weekDays,i=e.disabled,c=e.readOnly,u=e.leadingZero,d=e.period,m=e.periodicityOnDoubleClick,h=e.mode,v=!a||a.length===0,b=y.useMemo(function(){var F;return ue(((F={"react-js-cron-field":!0,"react-js-cron-month-days":!0,"react-js-cron-month-days-placeholder":!v})["".concat(s,"-field")]=!!s,F["".concat(s,"-month-days")]=!!s,F))},[s,v]),f=JSON.stringify(r),k=y.useMemo(function(){return v?r.emptyMonthDays||j.emptyMonthDays:r.emptyMonthDaysShort||j.emptyMonthDaysShort},[v,f]);return!c||t&&t.length>0||(!t||t.length===0)&&(!a||a.length===0)?n.jsxs("div",re({className:b},{children:[r.prefixMonthDays!==""&&n.jsx("span",{children:r.prefixMonthDays||j.prefixMonthDays}),n.jsx(ze,{placeholder:k,value:t,setValue:o,unit:Fe[2],locale:r,className:s,disabled:i,readOnly:c,leadingZero:u,period:d,periodicityOnDoubleClick:m,mode:h})]})):null}function gr(e){var t=e.value,o=e.setValue,r=e.locale,s=e.className,a=e.humanizeLabels,i=e.disabled,c=e.readOnly,u=e.period,d=e.periodicityOnDoubleClick,m=e.mode,h=r.months||j.months,v=y.useMemo(function(){var b;return ue(((b={"react-js-cron-field":!0,"react-js-cron-months":!0})["".concat(s,"-field")]=!!s,b["".concat(s,"-months")]=!!s,b))},[s]);return n.jsxs("div",re({className:v},{children:[r.prefixMonths!==""&&n.jsx("span",{children:r.prefixMonths||j.prefixMonths}),n.jsx(ze,{placeholder:r.emptyMonths||j.emptyMonths,optionsList:h,grid:!1,value:t,unit:re(re({},Fe[3]),{alt:r.altMonths||j.altMonths}),setValue:o,locale:r,className:s,humanizeLabels:a,disabled:i,readOnly:c,period:u,periodicityOnDoubleClick:d,mode:m})]}))}function br(e){var t=e.value,o=e.setValue,r=e.locale,s=e.className,a=e.disabled,i=e.readOnly,c=e.shortcuts,u=e.allowedPeriods,d=[];u.includes("year")&&d.push({value:"year",label:r.yearOption||j.yearOption}),u.includes("month")&&d.push({value:"month",label:r.monthOption||j.monthOption}),u.includes("week")&&d.push({value:"week",label:r.weekOption||j.weekOption}),u.includes("day")&&d.push({value:"day",label:r.dayOption||j.dayOption}),u.includes("hour")&&d.push({value:"hour",label:r.hourOption||j.hourOption}),u.includes("minute")&&d.push({value:"minute",label:r.minuteOption||j.minuteOption}),u.includes("reboot")&&c&&(c===!0||c.includes("@reboot"))&&d.push({value:"reboot",label:r.rebootOption||j.rebootOption});var m=y.useCallback(function(f){i||o(f)},[o,i]),h=y.useMemo(function(){var f;return ue(((f={"react-js-cron-field":!0,"react-js-cron-period":!0})["".concat(s,"-field")]=!!s,f["".concat(s,"-period")]=!!s,f))},[s]),v=y.useMemo(function(){var f;return ue(((f={"react-js-cron-select":!0,"react-js-cron-select-no-prefix":r.prefixPeriod===""})["".concat(s,"-select")]=!!s,f))},[s,r.prefixPeriod]),b=y.useMemo(function(){var f;return ue(((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 n.jsxs("div",re({className:h},{children:[r.prefixPeriod!==""&&n.jsx("span",{children:r.prefixPeriod||j.prefixPeriod}),n.jsx(g.Select,{defaultValue:t,value:t,onChange:m,options:d,className:v,popupClassName:b,disabled:a,showArrow:!i,open:!i&&void 0,"data-testid":"select-period"},JSON.stringify(r))]}))}function xr(e){var t=e.value,o=e.setValue,r=e.locale,s=e.className,a=e.humanizeLabels,i=e.monthDays,c=e.disabled,u=e.readOnly,d=e.period,m=e.periodicityOnDoubleClick,h=e.mode,v=r.weekDays||j.weekDays,b=d==="week"||!i||i.length===0,f=y.useMemo(function(){var E;return ue(((E={"react-js-cron-field":!0,"react-js-cron-week-days":!0,"react-js-cron-week-days-placeholder":!b})["".concat(s,"-field")]=!!s,E["".concat(s,"-week-days")]=!!s,E))},[s,b]),k=JSON.stringify(r),F=y.useMemo(function(){return b?r.emptyWeekDays||j.emptyWeekDays:r.emptyWeekDaysShort||j.emptyWeekDaysShort},[b,k]),M=d==="week"||!u||t&&t.length>0||(!t||t.length===0)&&(!i||i.length===0),S=!u||i&&i.length>0||(!i||i.length===0)&&(!t||t.length===0);return M?n.jsxs("div",re({className:f},{children:[r.prefixWeekDays!==""&&(d==="week"||!S)&&n.jsx("span",{children:r.prefixWeekDays||j.prefixWeekDays}),r.prefixWeekDaysForMonthAndYearPeriod!==""&&d!=="week"&&S&&n.jsx("span",{children:r.prefixWeekDaysForMonthAndYearPeriod||j.prefixWeekDaysForMonthAndYearPeriod}),n.jsx(ze,{placeholder:F,optionsList:v,grid:!1,value:t,unit:re(re({},Fe[4]),{alt:r.altWeekDays||j.altWeekDays}),setValue:o,locale:r,className:s,humanizeLabels:a,disabled:c,readOnly:u,period:d,periodicityOnDoubleClick:m,mode:h})]})):null}function vr(e){var t=e.clearButton,o=t===void 0||t,r=e.clearButtonProps,s=r===void 0?{}:r,a=e.clearButtonAction,i=a===void 0?"fill-with-every":a,c=e.locale,u=c===void 0?j:c,d=e.value,m=d===void 0?"":d,h=e.setValue,v=e.displayError,b=v===void 0||v,f=e.onError,k=e.className,F=e.defaultPeriod,M=F===void 0?"day":F,S=e.allowEmpty,E=S===void 0?"for-default-value":S,L=e.humanizeLabels,D=L===void 0||L,I=e.humanizeValue,$=I!==void 0&&I,N=e.disabled,B=N!==void 0&&N,G=e.readOnly,U=G!==void 0&&G,pe=e.leadingZero,P=pe!==void 0&&pe,W=e.shortcuts,z=W===void 0?["@yearly","@annually","@monthly","@weekly","@daily","@midnight","@hourly"]:W,ae=e.clockFormat,q=e.periodicityOnDoubleClick,_=q===void 0||q,R=e.mode,ee=R===void 0?"multiple":R,Je=e.allowedDropdowns,ye=Je===void 0?["period","months","month-days","week-days","hours","minutes"]:Je,De=e.allowedPeriods,zr=De===void 0?["year","month","week","day","hour","minute","reboot"]:De,Ee=y.useRef(m),Vt=y.useRef(M),Vo=y.useState(),ve=Vo[0],lt=Vo[1],jo=y.useState(),Ue=jo[0],at=jo[1],Wo=y.useState(),it=Wo[0],ct=Wo[1],Lo=y.useState(),He=Lo[0],dt=Lo[1],zo=y.useState(),ut=zo[0],pt=zo[1],Jo=y.useState(),mt=Jo[0],ft=Jo[1],Uo=y.useState(!1),jt=Uo[0],Ge=Uo[1],Ho=y.useState(!1),ht=Ho[0],Go=Ho[1],Jr=function(K){var ge=y.useRef(K);return y.useEffect(function(){ge.current=K},[K]),ge.current}(ht),qo=JSON.stringify(u);y.useEffect(function(){Co(m,Ge,f,E,Ee,!0,u,z,ft,pt,at,ct,dt,lt)},[]),y.useEffect(function(){m!==Ee.current&&Co(m,Ge,f,E,Ee,!1,u,z,ft,pt,at,ct,dt,lt)},[m,Ee,qo,E,z]),y.useEffect(function(){if(!(ve||mt||it||Ue||He||ut)||ht||Jr)ht&&Go(!1);else{var K=ve||Vt.current,ge=ko(K,it,Ue,He,ut,mt,$);h(ge,{selectedPeriod:K}),Ee.current=ge,f&&f(void 0),Ge(!1)}},[ve,Ue,it,He,ut,mt,$,ht]);var Yo=y.useCallback(function(){at(void 0),ct(void 0),dt(void 0),pt(void 0),ft(void 0);var K="",ge=ve!=="reboot"&&ve?ve:Vt.current;ge!==ve&&lt(ge),i==="fill-with-every"&&(K=ko(ge,void 0,void 0,void 0,void 0,void 0)),h(K,{selectedPeriod:ge}),Ee.current=K,Go(!0),E==="never"&&i==="empty"?(Ge(!0),wo(f,u)):(f&&f(void 0),Ge(!1))},[ve,h,f,i]),Ur=y.useMemo(function(){var K;return ue(((K={"react-js-cron":!0,"react-js-cron-error":jt&&b,"react-js-cron-disabled":B,"react-js-cron-read-only":U})["".concat(k)]=!!k,K["".concat(k,"-error")]=jt&&b&&!!k,K["".concat(k,"-disabled")]=B&&!!k,K["".concat(k,"-read-only")]=U&&!!k,K))},[k,jt,b,B,U]),Wt=s.className,_o=bo(s,["className"]),Ko=y.useMemo(function(){var K;return ue(((K={"react-js-cron-clear-button":!0})["".concat(k,"-clear-button")]=!!k,K["".concat(Wt)]=!!Wt,K))},[k,Wt]),Hr=JSON.stringify(_o),Zo=y.useMemo(function(){return o&&!U?n.jsx(g.Button,re({className:Ko,danger:!0,type:"primary",disabled:B},_o,{onClick:Yo},{children:u.clearButtonText||j.clearButtonText})):null},[o,U,qo,Ko,B,Hr,Yo]),te=ve||Vt.current;return n.jsxs("div",re({className:Ur},{children:[ye.includes("period")&&n.jsx(br,{value:te,setValue:lt,locale:u,className:k,disabled:B,readOnly:U,shortcuts:z,allowedPeriods:zr}),te==="reboot"?Zo:n.jsxs(n.Fragment,{children:[te==="year"&&ye.includes("months")&&n.jsx(gr,{value:it,setValue:ct,locale:u,className:k,humanizeLabels:D,disabled:B,readOnly:U,period:te,periodicityOnDoubleClick:_,mode:ee}),(te==="year"||te==="month")&&ye.includes("month-days")&&n.jsx(yr,{value:Ue,setValue:at,locale:u,className:k,weekDays:He,disabled:B,readOnly:U,leadingZero:P,period:te,periodicityOnDoubleClick:_,mode:ee}),(te==="year"||te==="month"||te==="week")&&ye.includes("week-days")&&n.jsx(xr,{value:He,setValue:dt,locale:u,className:k,humanizeLabels:D,monthDays:Ue,disabled:B,readOnly:U,period:te,periodicityOnDoubleClick:_,mode:ee}),n.jsxs("div",{children:[te!=="minute"&&te!=="hour"&&ye.includes("hours")&&n.jsx(fr,{value:ut,setValue:pt,locale:u,className:k,disabled:B,readOnly:U,leadingZero:P,clockFormat:ae,period:te,periodicityOnDoubleClick:_,mode:ee}),te!=="minute"&&ye.includes("minutes")&&n.jsx(hr,{value:mt,setValue:ft,locale:u,period:te,className:k,disabled:B,readOnly:U,leadingZero:P,clockFormat:ae,periodicityOnDoubleClick:_,mode:ee}),Zo]})]})]}))}const Do=[{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 Eo(e){return Do.filter(o=>typeof o.value=="number").reverse().find(o=>!(e%o.value))}function wr(e){let t;switch(typeof e){case"number":return t=Eo(e),t?t.value:"none";case"string":return"cron"}return"none"}function Cr({value:e,onChange:t}){const{t:o}=xt(),r=Eo(e);return n.jsx(g.InputNumber,{value:e/r.value,onChange:s=>{s&&t(s*r.value)},min:1,addonBefore:o("Every"),addonAfter:o(r.unitText),className:"auto-width"})}function kr({value:e=null,onChange:t}){const{t:o}=xt(),r=wr(e),s=y.useCallback(a=>{if(a==="none"){t(null);return}if(a==="cron"){t("0 * * * * *");return}t(typeof r=="number"?Math.round(e/r*a):a)},[t,r,e]);return n.jsxs("fieldset",{className:l.css`
524
524
  display: flex;
525
525
  flex-direction: ${r==="cron"?"column":"row"};
526
526
  align-items: flex-start;
@@ -11,8 +11,8 @@ module.exports = {
11
11
  "react": "18.2.0",
12
12
  "@formily/core": "2.3.0",
13
13
  "@formily/react": "2.3.0",
14
- "@nocobase/client": "1.4.24",
15
- "@nocobase/utils": "1.4.24",
14
+ "@nocobase/client": "1.4.25",
15
+ "@nocobase/utils": "1.4.25",
16
16
  "antd": "5.12.8",
17
17
  "@ant-design/icons": "5.2.6",
18
18
  "react-router-dom": "6.21.0",
@@ -20,15 +20,15 @@ module.exports = {
20
20
  "@formily/shared": "2.3.2",
21
21
  "lodash": "4.17.21",
22
22
  "sequelize": "6.35.2",
23
- "@nocobase/database": "1.4.24",
24
- "@nocobase/server": "1.4.24",
25
- "@nocobase/logger": "1.4.24",
26
- "@nocobase/evaluators": "1.4.24",
23
+ "@nocobase/database": "1.4.25",
24
+ "@nocobase/server": "1.4.25",
25
+ "@nocobase/logger": "1.4.25",
26
+ "@nocobase/evaluators": "1.4.25",
27
27
  "@formily/antd-v5": "1.1.9",
28
28
  "@formily/reactive": "2.3.0",
29
- "@nocobase/actions": "1.4.24",
29
+ "@nocobase/actions": "1.4.25",
30
30
  "dayjs": "1.11.10",
31
- "@nocobase/data-source-manager": "1.4.24",
32
- "@nocobase/plugin-workflow-test": "1.4.24",
33
- "@nocobase/test": "1.4.24"
31
+ "@nocobase/data-source-manager": "1.4.25",
32
+ "@nocobase/plugin-workflow-test": "1.4.25",
33
+ "@nocobase/test": "1.4.25"
34
34
  };
@@ -1 +1 @@
1
- {"name":"cron-parser","version":"4.4.0","description":"Node.js library for parsing crontab instructions","main":"lib/parser.js","types":"index.d.ts","typesVersions":{"<4.1":{"*":["types/ts3/*"]}},"directories":{"test":"test"},"scripts":{"test:tsd":"tsd","test:unit":"TZ=UTC tap ./test/*.js","test:cover":"TZ=UTC tap --coverage-report=html ./test/*.js","lint":"eslint .","lint:fix":"eslint --fix .","test":"npm run lint && npm run test:unit && npm run test:tsd"},"repository":{"type":"git","url":"https://github.com/harrisiirak/cron-parser.git"},"keywords":["cron","crontab","parser"],"author":"Harri Siirak","contributors":["Nicholas Clawson","Daniel Prentis <daniel@salsitasoft.com>","Renault John Lecoultre","Richard Astbury <richard.astbury@gmail.com>","Meaglin Wasabi <Meaglin.wasabi@gmail.com>","Mike Kusold <hello@mikekusold.com>","Alex Kit <alex.kit@atmajs.com>","Santiago Gimeno <santiago.gimeno@gmail.com>","Daniel <darc.tec@gmail.com>","Christian Steininger <christian.steininger.cs@gmail.com>","Mykola Piskovyi <m.piskovyi@gmail.com>","Brian Vaughn <brian.david.vaughn@gmail.com>","Nicholas Clawson <nickclaw@gmail.com>","Yasuhiroki <yasuhiroki.duck@gmail.com>","Nicholas Clawson <nickclaw@gmail.com>","Brendan Warkentin <faazshift@gmail.com>","Charlie Fish <fishcharlie.code@gmail.com>","Ian Graves <ian+diskimage@iangrav.es>","Andy Thompson <me@andytson.com>","Regev Brody <regevbr@gmail.com>"],"license":"MIT","dependencies":{"luxon":"^1.28.0"},"devDependencies":{"eslint":"^8.2.0","sinon":"^10.0.0","tap":"^16.0.1","tsd":"^0.19.0"},"engines":{"node":">=0.8"},"browser":{"fs":false},"tap":{"check-coverage":false},"tsd":{"directory":"test","compilerOptions":{"lib":["es2017","dom"]}},"_lastModified":"2025-01-14T12:52:57.008Z"}
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":"2025-01-15T21:55:28.338Z"}
@@ -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":"2025-01-14T12:52:56.601Z"}
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":"2025-01-15T21:55:28.002Z"}
package/package.json CHANGED
@@ -4,13 +4,13 @@
4
4
  "displayName.zh-CN": "工作流",
5
5
  "description": "A powerful BPM tool that provides foundational support for business automation, with the capability to extend unlimited triggers and nodes.",
6
6
  "description.zh-CN": "一个强大的 BPM 工具,为业务自动化提供基础支持,并且可任意扩展更多的触发器和节点。",
7
- "version": "1.4.24",
7
+ "version": "1.4.25",
8
8
  "license": "AGPL-3.0",
9
9
  "main": "./dist/server/index.js",
10
10
  "homepage": "https://docs.nocobase.com/handbook/workflow",
11
11
  "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/workflow",
12
12
  "dependencies": {
13
- "@nocobase/plugin-workflow-test": "1.4.24"
13
+ "@nocobase/plugin-workflow-test": "1.4.25"
14
14
  },
15
15
  "devDependencies": {
16
16
  "@ant-design/icons": "5.x",
@@ -44,7 +44,7 @@
44
44
  "@nocobase/test": "1.x",
45
45
  "@nocobase/utils": "1.x"
46
46
  },
47
- "gitHead": "dd08bdca511a3b91a77345f90b522509bbb8738c",
47
+ "gitHead": "1a03757687ce47568c604a4b9bd648c151bbd6e2",
48
48
  "keywords": [
49
49
  "Workflow"
50
50
  ]