@tachybase/module-cron 1.3.18 → 1.3.19
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/cron-jobs-table/CronJobsTable.schema.d.ts +2 -3
- package/dist/client/index.js +3 -3
- package/dist/externalVersion.js +7 -7
- package/dist/node_modules/cron-parser/LICENSE +1 -1
- package/dist/node_modules/cron-parser/lib/date.js +252 -0
- package/dist/node_modules/cron-parser/lib/expression.js +1002 -0
- package/dist/node_modules/cron-parser/lib/field_compactor.js +70 -0
- package/dist/node_modules/cron-parser/lib/field_stringify.js +58 -0
- package/dist/node_modules/cron-parser/lib/parser.js +1 -0
- package/dist/node_modules/cron-parser/package.json +1 -1
- package/dist/node_modules/cron-parser/types/common.d.ts +131 -0
- package/dist/node_modules/cron-parser/types/index.d.ts +45 -0
- package/dist/node_modules/cron-parser/types/ts3/index.d.ts +28 -0
- package/dist/server/service/StaticScheduleTrigger.d.ts +1 -1
- package/package.json +10 -10
- package/dist/node_modules/cron-parser/dist/CronDate.js +0 -497
- package/dist/node_modules/cron-parser/dist/CronExpression.js +0 -376
- package/dist/node_modules/cron-parser/dist/CronExpressionParser.js +0 -384
- package/dist/node_modules/cron-parser/dist/CronFieldCollection.js +0 -371
- package/dist/node_modules/cron-parser/dist/CronFileParser.js +0 -109
- package/dist/node_modules/cron-parser/dist/fields/CronDayOfMonth.js +0 -44
- package/dist/node_modules/cron-parser/dist/fields/CronDayOfWeek.js +0 -51
- package/dist/node_modules/cron-parser/dist/fields/CronField.js +0 -183
- package/dist/node_modules/cron-parser/dist/fields/CronHour.js +0 -40
- package/dist/node_modules/cron-parser/dist/fields/CronMinute.js +0 -40
- package/dist/node_modules/cron-parser/dist/fields/CronMonth.js +0 -44
- package/dist/node_modules/cron-parser/dist/fields/CronSecond.js +0 -40
- package/dist/node_modules/cron-parser/dist/fields/index.js +0 -24
- package/dist/node_modules/cron-parser/dist/fields/types.js +0 -2
- package/dist/node_modules/cron-parser/dist/index.js +0 -1
- package/dist/node_modules/cron-parser/dist/types/CronDate.d.ts +0 -273
- package/dist/node_modules/cron-parser/dist/types/CronExpression.d.ts +0 -110
- package/dist/node_modules/cron-parser/dist/types/CronExpressionParser.d.ts +0 -70
- package/dist/node_modules/cron-parser/dist/types/CronFieldCollection.d.ts +0 -153
- package/dist/node_modules/cron-parser/dist/types/CronFileParser.d.ts +0 -30
- package/dist/node_modules/cron-parser/dist/types/fields/CronDayOfMonth.d.ts +0 -25
- package/dist/node_modules/cron-parser/dist/types/fields/CronDayOfWeek.d.ts +0 -30
- package/dist/node_modules/cron-parser/dist/types/fields/CronField.d.ts +0 -114
- package/dist/node_modules/cron-parser/dist/types/fields/CronHour.d.ts +0 -23
- package/dist/node_modules/cron-parser/dist/types/fields/CronMinute.d.ts +0 -23
- package/dist/node_modules/cron-parser/dist/types/fields/CronMonth.d.ts +0 -24
- package/dist/node_modules/cron-parser/dist/types/fields/CronSecond.d.ts +0 -23
- package/dist/node_modules/cron-parser/dist/types/fields/index.d.ts +0 -8
- package/dist/node_modules/cron-parser/dist/types/fields/types.d.ts +0 -18
- package/dist/node_modules/cron-parser/dist/types/index.d.ts +0 -8
- package/dist/node_modules/cron-parser/dist/types/utils/random.d.ts +0 -10
- package/dist/node_modules/cron-parser/dist/utils/random.js +0 -38
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { OpenMode } from '@tachybase/client';
|
|
2
1
|
import { ISchema } from '@tachybase/schema';
|
|
3
2
|
export declare const table: {
|
|
4
3
|
type: string;
|
|
@@ -47,7 +46,7 @@ export declare const table: {
|
|
|
47
46
|
'x-component': string;
|
|
48
47
|
'x-decorator': string;
|
|
49
48
|
'x-component-props': {
|
|
50
|
-
openMode:
|
|
49
|
+
openMode: string;
|
|
51
50
|
type: string;
|
|
52
51
|
component: string;
|
|
53
52
|
icon: string;
|
|
@@ -684,7 +683,7 @@ export declare const schema: {
|
|
|
684
683
|
'x-component': string;
|
|
685
684
|
'x-decorator': string;
|
|
686
685
|
'x-component-props': {
|
|
687
|
-
openMode:
|
|
686
|
+
openMode: string;
|
|
688
687
|
type: string;
|
|
689
688
|
component: string;
|
|
690
689
|
icon: string;
|
package/dist/client/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
(function(v,d){typeof exports=="object"&&typeof module!="undefined"?d(exports,require("@tachybase/client"),require("react/jsx-runtime"),require("@tachybase/module-workflow/client"),require("@tachybase/utils/client"),require("antd"),require("react"),require("@tachybase/schema")):typeof define=="function"&&define.amd?define(["exports","@tachybase/client","react/jsx-runtime","@tachybase/module-workflow/client","@tachybase/utils/client","antd","react","@tachybase/schema"],d):(v=typeof globalThis!="undefined"?globalThis:v||self,d(v["@tachybase/module-cron"]={},v["@tachybase/client"],v.jsxRuntime,v["@tachybase/module-workflow"],v["@tachybase/utils"],v.antd,v.react,v["@tachybase/schema"]))})(this,function(v,d,a,T,me,U,m,R){"use strict";var Zo=Object.defineProperty,qo=Object.defineProperties;var Uo=Object.getOwnPropertyDescriptors;var
|
|
1
|
+
(function(v,d){typeof exports=="object"&&typeof module!="undefined"?d(exports,require("@tachybase/client"),require("react/jsx-runtime"),require("@tachybase/module-workflow/client"),require("@tachybase/utils/client"),require("antd"),require("react"),require("@tachybase/schema")):typeof define=="function"&&define.amd?define(["exports","@tachybase/client","react/jsx-runtime","@tachybase/module-workflow/client","@tachybase/utils/client","antd","react","@tachybase/schema"],d):(v=typeof globalThis!="undefined"?globalThis:v||self,d(v["@tachybase/module-cron"]={},v["@tachybase/client"],v.jsxRuntime,v["@tachybase/module-workflow"],v["@tachybase/utils"],v.antd,v.react,v["@tachybase/schema"]))})(this,function(v,d,a,T,me,U,m,R){"use strict";var Zo=Object.defineProperty,qo=Object.defineProperties;var Uo=Object.getOwnPropertyDescriptors;var Me=Object.getOwnPropertySymbols;var mo=Object.prototype.hasOwnProperty,yo=Object.prototype.propertyIsEnumerable;var po=(v,d,a)=>d in v?Zo(v,d,{enumerable:!0,configurable:!0,writable:!0,value:a}):v[d]=a,L=(v,d)=>{for(var a in d||(d={}))mo.call(d,a)&&po(v,a,d[a]);if(Me)for(var a of Me(d))yo.call(d,a)&&po(v,a,d[a]);return v},G=(v,d)=>qo(v,Uo(d));var Pe=(v,d)=>{var a={};for(var T in v)mo.call(v,T)&&d.indexOf(T)<0&&(a[T]=v[T]);if(v!=null&&Me)for(var T of Me(v))d.indexOf(T)<0&&yo.call(v,T)&&(a[T]=v[T]);return a};var de=(v,d,a)=>new Promise((T,me)=>{var U=O=>{try{R(a.next(O))}catch(ie){me(ie)}},m=O=>{try{R(a.throw(O))}catch(ie){me(ie)}},R=O=>O.done?T(O.value):Promise.resolve(O.value).then(U,m);R((a=a.apply(v,d)).next())});const O="cron",ie="cronJobs";var Ee=(e=>(e[e.STATIC=0]="STATIC",e[e.DATE_FIELD=1]="DATE_FIELD",e))(Ee||{});const fo={dumpRules:{group:"required"},name:ie,shared:!0,createdAt:!0,updatedAt:!0,createdBy:!0,updatedBy:!0,model:"CronJobModel",fields:[{type:"bigInt",name:"id",primaryKey:!0,autoIncrement:!0},{type:"string",name:"name",required:!0,uiSchema:{title:'{{ t("Name") }}',type:"string","x-component":"Input",required:!0}},{type:"string",name:"description",uiSchema:{title:'{{ t("Description") }}',type:"string","x-component":"Input.TextArea"}},{type:"date",name:"startsOn",required:!0,uiSchema:{title:`{{t("Starts on", { ns: "${O}" })}}`,type:"datetime","x-component":"DatePicker","x-component-props":{showTime:!0},required:!0}},{type:"integer",name:"mode",required:!0,defaultValue:Ee.STATIC},{type:"date",name:"endsOn",uiSchema:{title:`{{t("Ends on", { ns: "${O}" })}}`,type:"datetime","x-component":"DatePicker","x-component-props":{showTime:!0}}},{type:"date",name:"lastTime",uiSchema:{title:`{{t("Last time", { ns: "${O}" })}}`,type:"datetime","x-component":"DatePicker","x-component-props":{showTime:!0}}},{type:"virtual",name:"nextTime",uiSchema:{title:`{{t("Next time", { ns: "${O}" })}}`,type:"datetime","x-component":"DatePicker","x-component-props":{showTime:!0}}},{type:"string",name:"repeat",required:!0,uiSchema:{title:`{{t("Repeat mode", { ns: "${O}" })}}`,type:"string","x-component":"RepeatField"}},{type:"integer",name:"limit",uiSchema:{title:`{{t("Current limit", { ns: "${O}" })}}`,type:"number","x-component":"InputNumber"}},{type:"integer",name:"allExecuted",uiSchema:{title:`{{t("Executed", { ns: "${O}" })}}`,type:"string"},defaultValue:0},{type:"integer",name:"successExecuted",defaultValue:0,uiSchema:{title:`{{t("Success executed", { ns: "${O}" })}}`,type:"string","x-component":"InputNumber"}},{type:"integer",name:"limitExecuted",defaultValue:0,uiSchema:{title:`{{t("Current times", { ns: "${O}" })}}`,type:"string","x-component":"InputNumber"}},{type:"boolean",name:"enabled",uiSchema:{title:'{{ t("Enabled") }}',type:"boolean","x-component":"Radio.Group",enum:[{label:'{{ t("On") }}',value:!0,color:"#52c41a"},{label:'{{ t("Off") }}',value:!1}]},defaultValue:!1},{name:"workflowKey",type:"string",interface:"select",uiSchema:{title:'{{ t("Workflow") }}',type:"string","x-component":"WorkflowSelect","x-component-props":{buttonAction:"customize:triggerWorkflows",noCollection:!0,label:"title",value:"key"}}}]},ye=()=>{const{i18n:e}=d.useApp();return{t:(r,o={})=>e.t(r,L({ns:O},o))}},ho=e=>d.tval(e,{ns:O});function ee(e){return d.i18n.t(e,{ns:O})}function xo(){return!0}const vo=R.observer(e=>{const s=e,{filter:t=xo}=s,r=Pe(s,["filter"]),o=d.useCompile(),{getCollectionFields:n}=d.useCollectionManager_deprecated(),{values:u}=R.useForm(),[i,c]=d.parseCollectionName(u==null?void 0:u.collection),l=n(c,i);return a.jsx(d.Select,G(L({popupMatchSelectWidth:!1},r),{options:l.filter(t).map(y=>{var b;return{label:o((b=y.uiSchema)==null?void 0:b.title),value:y.name}})}))},{displayName:"FieldsSelect"});function bo(e){return!e.hidden&&(e.uiSchema?e.type==="date":!1)}function je({value:e,onChange:t}){const r=e!=null?e:{},{t:o}=ye(),[n,u]=m.useState(r.offset?r.offset/Math.abs(r.offset):0);return a.jsxs("fieldset",{className:d.css`
|
|
2
2
|
display: flex;
|
|
3
3
|
gap: 0.5em;
|
|
4
4
|
`,children:[a.jsx(vo,{value:r.field,onChange:i=>t(G(L({},r),{field:i})),filter:bo,placeholder:o("Select field"),className:"auto-width"}),r.field?a.jsx(d.Select,{value:n,onChange:i=>{u(i),t(G(L({},r),{offset:Math.abs(r.offset)*i}))},options:[{value:0,label:ee("Exactly at")},{value:-1,label:o("Before")},{value:1,label:o("After")}],className:"auto-width"}):null,n?a.jsxs(a.Fragment,{children:[a.jsx(d.InputNumber,{value:Math.abs(r.offset),onChange:i=>t(G(L({},r),{offset:(i!=null?i:0)*n}))}),a.jsx(d.Select,{value:r.unit||864e5,onChange:i=>t(G(L({},r),{unit:i})),options:[{value:864e5,label:ee("Days")},{value:36e5,label:ee("Hours")},{value:6e4,label:ee("Minutes")},{value:1e3,label:ee("Seconds")}],className:"auto-width"})]}):null]})}function go({value:e,onChange:t}){const{t:r}=ye(),o=e!=null?typeof e=="object"&&!(e instanceof Date)?"field":"date":null;return a.jsxs("fieldset",{className:d.css`
|
|
5
5
|
display: flex;
|
|
6
6
|
gap: 0.5em;
|
|
7
|
-
`,children:[a.jsx(U.Select,{value:o,onChange:n=>{t(n?n==="field"?{}:new Date:null)},className:"auto-width",options:[{value:null,label:r("No end")},{value:"date",label:r("By custom date")}]}),o==="field"?a.jsx(je,{value:e,onChange:t}):null,o==="date"?a.jsx(U.DatePicker,{showTime:!0,value:me.dayjs(e),onChange:n=>{t(n?n.toDate():null)}}):null]})}var I=function(){return I=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},I.apply(this,arguments)};function Ve(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function"){var n=0;for(o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]])}return r}function fe(e,t,r){if(r||arguments.length===2)for(var o,n=0,u=t.length;n<u;n++)!o&&n in t||(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))}var wo=[{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 * * * *"}],Q=[{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"]}],g={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 Be(e,t){for(var r=[],o=e;o<=t;o++)r.push(o);return r}function he(e){return e.sort(function(t,r){return t-r}),e}function Ie(e){var t=[];return e.forEach(function(r){t.indexOf(r)<0&&t.push(r)}),t}function H(e){return Object.entries(e).filter(function(t){var r=t[0],o=t[1];return r&&o}).map(function(t){return t[0]}).join(" ")}function Je(e,t){e&&e({type:"invalid_cron",description:t.errorInvalidCron||g.errorInvalidCron})}function xe(e){var t=parseInt(e,10),r=Number(e);return t===r?r:NaN}function We(e,t,r,o,n,u,i,c,l,s,y,b,h,x){r&&r(void 0),t(!1);var p=!1;if(!e){if(o==="always"||u&&o==="for-default-value")return;p=!0}if(!p){if(c&&(c===!0||c.includes(e))){if(e==="@reboot")return void x("reboot");var k=wo.find(function(N){return N.name===e});k&&(e=k.value)}try{var A=function(N){if(typeof N!="string")throw new Error("Invalid cron string");var J=N.replace(/\s+/g," ").trim().split(" ");if(J.length===5)return J.map(function(te,ne){return function(z,P){if(z==="*"||z==="*/1")return[];var K=he(Ie(Ze(function(Z,F,q){if(q){Z=Z.toUpperCase();for(var f=0;f<q.length;f++)Z=Z.replace(q[f],"".concat(f+F))}return Z}(z,P.min,P.alt).split(",").map(function(Z){var F,q=Z.split("/");if(q.length>2)throw new Error('Invalid value "'.concat(z,' for "').concat(P.type,'"'));var f=q[0],w=q[1];F=f==="*"?Be(P.min,P.max):function(S,D,j){var V=S.split("-");if(V.length===1){var ce=xe(V[0]);if(isNaN(ce))throw new Error('Invalid value "'.concat(D,'" for ').concat(j.type));return[ce]}if(V.length===2){var Y=xe(V[0]),re=xe(V[1]);if(isNaN(Y)||isNaN(re))throw new Error('Invalid value "'.concat(D,'" for ').concat(j.type));if(re<Y)throw new Error('Max range is less than min range in "'.concat(S,'" for ').concat(j.type));return Be(Y,re)}throw new Error('Invalid value "'.concat(S,'" for ').concat(j.type))}(f,z,P);var C=function(S,D){if(S!==void 0){var j=xe(S);if(isNaN(j)||j<1)throw new Error('Invalid interval step value "'.concat(S,'" for ').concat(D.type));return j}}(w,P),W=function(S,D){if(D){var j=S[0];S=S.filter(function(V){return V%D==j%D||V===j})}return S}(F,C);return W}).flat(),P))),E=qe(K,P);if(E!==void 0)throw new Error('Value "'.concat(E,'" out of range for ').concat(P.type));return K.length===P.total?[]:K}(te,Q[ne])});throw new Error("Invalid cron string format")}(e),X=function(N){return N[3].length>0?"year":N[2].length>0?"month":N[4].length>0?"week":N[1].length>0?"day":N[0].length>0?"hour":"minute"}(A);x(X),l(A[0]),s(A[1]),y(A[2]),b(A[3]),h(A[4])}catch(N){p=!0}}p&&(n.current=e,t(!0),Je(r,i))}function Le(e,t,r,o,n,u,i){if(e==="reboot")return"@reboot";var c=function(l,s){return l.map(function(y,b){var h=Q[b];return He(ze(y,h),h,s)})}([e!=="minute"&&u?u:[],e!=="minute"&&e!=="hour"&&n?n:[],e!=="year"&&e!=="month"||!r?[]:r,e==="year"&&t?t:[],e!=="year"&&e!=="month"&&e!=="week"||!o?[]:o],i);return c.join(" ")}function He(e,t,r,o,n){var u="";if(function(c,l){return c.length===l.max-l.min+1}(e,t)||e.length===0)u="*";else{var i=function(c){if(c.length>2){var l=c[1]-c[0];if(l>1)return l}}(e);u=i&&function(c,l){for(var s=1;s<c.length;s++){var y=c[s-1];if(c[s]-y!==l)return!1}return!0}(e,i)?function(c,l,s){var y=Ue(c),b=Ke(c),h=c.length===(b-y)/s+1;return!!(y===l.min&&b+s>l.max&&h)}(e,t,i)?"*/".concat(i):"".concat(oe(Ue(e),t,r,o,n),"-").concat(oe(Ke(e),t,r,o,n),"/").concat(i):function(c){var l=[],s=null;return c.forEach(function(y,b,h){y!==h[b+1]-1?s!==null?(l.push([s,y]),s=null):l.push(y):s===null&&(s=y)}),l}(e).map(function(c){return Array.isArray(c)?"".concat(oe(c[0],t,r,o,n),"-").concat(oe(c[1],t,r,o,n)):oe(c,t,r,o,n)}).join(",")}return u}function oe(e,t,r,o,n){var u=e.toString(),i=t.type,c=t.alt,l=t.min,s=o&&(o===!0||o.includes(i)),y=n==="24-hour-clock"&&(i==="hours"||i==="minutes");if(r&&i==="week-days"||r&&i==="months"?u=c[e-l]:e<10&&(s||y)&&(u=u.padStart(2,"0")),i==="hours"&&n==="12-hour-clock"){var b=e>=12?"PM":"AM",h=e%12||12;h<10&&s&&(h=h.toString().padStart(2,"0")),u="".concat(h).concat(b)}return u}function ze(e,t){var r=he(Ie(Ze(e,t)));if(r.length===0)return r;var o=qe(r,t);if(o!==void 0)throw new Error('Value "'.concat(o,'" out of range for ').concat(t.type));return r}function Ze(e,t){return t.type==="week-days"&&(e=e.map(function(r){return r===7?0:r})),e}function qe(e,t){var r=e[0],o=e[e.length-1];return r<t.min?r:o>t.max?o:void 0}function Ue(e){return e[0]}function Ke(e){return e[e.length-1]}function le(e){var t=e.value,r=e.grid,o=r===void 0||r,n=e.optionsList,u=e.setValue,i=e.locale,c=e.className,l=e.humanizeLabels,s=e.disabled,y=e.readOnly,b=e.leadingZero,h=e.clockFormat,x=e.period,p=e.unit,k=e.periodicityOnDoubleClick,A=e.mode,X=Ve(e,["value","grid","optionsList","setValue","locale","className","humanizeLabels","disabled","readOnly","leadingZero","clockFormat","period","unit","periodicityOnDoubleClick","mode"]),N=m.useMemo(function(){if(t&&Array.isArray(t))return t.map(function(f){return f.toString()})},[t]),J=m.useMemo(function(){return n?n.map(function(f,w){return{value:(p.min===0?w:w+1).toString(),label:f}}):fe([],Array(p.total),!0).map(function(f,w){var C=p.min===0?w:w+1;return{value:C.toString(),label:oe(C,p,l,b,h)}})},[n,b,l,h]),te=JSON.stringify(i),ne=m.useCallback(function(f){var w=f.value;if(!t||t[0]!==Number(w))return a.jsx(a.Fragment,{});var C=He(ze(t,p),p,l,b,h),W=C.match(/^\*\/([0-9]+),?/)||[];return a.jsx("div",{children:W[1]?"".concat(i.everyText||g.everyText," ").concat(W[1]):C})},[t,te,l,b,h]),z=m.useCallback(function(f){var w=Array.isArray(f)?he(f):[f],C=w;t&&(C=A==="single"?[]:fe([],t,!0),w.forEach(function(W){var S=Number(W);C=t.some(function(D){return D===S})?C.filter(function(D){return D!==S}):he(fe(fe([],C,!0),[S],!1))})),C.length===p.total?u([]):u(C)},[u,t]),P=m.useCallback(function(f){if(f!==0&&f!==1){for(var w=p.total+p.min,C=[],W=p.min;W<w;W++)W%f==0&&C.push(W);var S=t&&C&&t.length===C.length&&t.every(function(j,V){return j===C[V]}),D=C.length===J.length;u(D||S?[]:C)}else u([])},[t,J,u]),K=m.useRef([]),E=m.useCallback(function(f){if(!y){var w=K.current;w.push({time:new Date().getTime(),value:Number(f)});var C=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?P(Number(f)):z([w[w.length-2].value,w[w.length-1].value]):z(Number(f)),K.current=[]},300);return function(){window.clearTimeout(C)}}},[K,z,P,y,k]),Z=m.useCallback(function(){y||u([])},[u,y]),F=m.useMemo(function(){var f;return H(((f={"react-js-cron-select":!0,"react-js-cron-custom-select":!0})["".concat(c,"-select")]=!!c,f))},[c]),q=m.useMemo(function(){var f;return H(((f={"react-js-cron-select-dropdown":!0})["react-js-cron-select-dropdown-".concat(p.type)]=!0,f["react-js-cron-custom-select-dropdown"]=!0,f["react-js-cron-custom-select-dropdown-".concat(p.type)]=!0,f["react-js-cron-custom-select-dropdown-minutes-large"]=p.type==="minutes"&&x!=="hour"&&x!=="day",f["react-js-cron-custom-select-dropdown-minutes-medium"]=p.type==="minutes"&&(x==="day"||x==="hour"),f["react-js-cron-custom-select-dropdown-hours-twelve-hour-clock"]=p.type==="hours"&&h==="12-hour-clock",f["react-js-cron-custom-select-dropdown-grid"]=!!o,f["".concat(c,"-select-dropdown")]=!!c,f["".concat(c,"-select-dropdown-").concat(p.type)]=!!c,f))},[c,o,h,x]);return a.jsx(U.Select,I({mode:A!=="single"||k?"multiple":void 0,allowClear:!y,virtual:!1,open:!y&&void 0,value:N,onClear:Z,tagRender:ne,className:F,popupClassName:q,options:J,showSearch:!1,showArrow:!y,menuItemSelectedIcon:null,dropdownMatchSelectWidth:!1,onSelect:E,onDeselect:E,disabled:s,dropdownAlign:p.type!=="minutes"&&p.type!=="hours"||x==="day"||x==="hour"?void 0:{points:["tr","br"]},"data-testid":"custom-select-".concat(p.type)},X))}function ko(e){var t=e.value,r=e.setValue,o=e.locale,n=e.className,u=e.disabled,i=e.readOnly,c=e.leadingZero,l=e.clockFormat,s=e.period,y=e.periodicityOnDoubleClick,b=e.mode,h=m.useMemo(function(){var x;return H(((x={"react-js-cron-field":!0,"react-js-cron-hours":!0})["".concat(n,"-field")]=!!n,x["".concat(n,"-hours")]=!!n,x))},[n]);return a.jsxs("div",I({className:h},{children:[o.prefixHours!==""&&a.jsx("span",{children:o.prefixHours||g.prefixHours}),a.jsx(le,{placeholder:o.emptyHours||g.emptyHours,value:t,unit:Q[1],setValue:r,locale:o,className:n,disabled:u,readOnly:i,leadingZero:c,clockFormat:l,period:s,periodicityOnDoubleClick:y,mode:b})]}))}function Co(e){var t=e.value,r=e.setValue,o=e.locale,n=e.className,u=e.disabled,i=e.readOnly,c=e.leadingZero,l=e.clockFormat,s=e.period,y=e.periodicityOnDoubleClick,b=e.mode,h=m.useMemo(function(){var x;return H(((x={"react-js-cron-field":!0,"react-js-cron-minutes":!0})["".concat(n,"-field")]=!!n,x["".concat(n,"-minutes")]=!!n,x))},[n]);return a.jsxs("div",I({className:h},{children:[s==="hour"?o.prefixMinutesForHourPeriod!==""&&a.jsx("span",{children:o.prefixMinutesForHourPeriod||g.prefixMinutesForHourPeriod}):o.prefixMinutes!==""&&a.jsx("span",{children:o.prefixMinutes||g.prefixMinutes}),a.jsx(le,{placeholder:s==="hour"?o.emptyMinutesForHourPeriod||g.emptyMinutesForHourPeriod:o.emptyMinutes||g.emptyMinutes,value:t,unit:Q[0],setValue:r,locale:o,className:n,disabled:u,readOnly:i,leadingZero:c,clockFormat:l,period:s,periodicityOnDoubleClick:y,mode:b}),s==="hour"&&o.suffixMinutesForHourPeriod!==""&&a.jsx("span",{children:o.suffixMinutesForHourPeriod||g.suffixMinutesForHourPeriod})]}))}function Oo(e){var t=e.value,r=e.setValue,o=e.locale,n=e.className,u=e.weekDays,i=e.disabled,c=e.readOnly,l=e.leadingZero,s=e.period,y=e.periodicityOnDoubleClick,b=e.mode,h=!u||u.length===0,x=m.useMemo(function(){var A;return H(((A={"react-js-cron-field":!0,"react-js-cron-month-days":!0,"react-js-cron-month-days-placeholder":!h})["".concat(n,"-field")]=!!n,A["".concat(n,"-month-days")]=!!n,A))},[n,h]),p=JSON.stringify(o),k=m.useMemo(function(){return h?o.emptyMonthDays||g.emptyMonthDays:o.emptyMonthDaysShort||g.emptyMonthDaysShort},[h,p]);return!c||t&&t.length>0||(!t||t.length===0)&&(!u||u.length===0)?a.jsxs("div",I({className:x},{children:[o.prefixMonthDays!==""&&a.jsx("span",{children:o.prefixMonthDays||g.prefixMonthDays}),a.jsx(le,{placeholder:k,value:t,setValue:r,unit:Q[2],locale:o,className:n,disabled:i,readOnly:c,leadingZero:l,period:s,periodicityOnDoubleClick:y,mode:b})]})):null}function So(e){var t=e.value,r=e.setValue,o=e.locale,n=e.className,u=e.humanizeLabels,i=e.disabled,c=e.readOnly,l=e.period,s=e.periodicityOnDoubleClick,y=e.mode,b=o.months||g.months,h=m.useMemo(function(){var x;return H(((x={"react-js-cron-field":!0,"react-js-cron-months":!0})["".concat(n,"-field")]=!!n,x["".concat(n,"-months")]=!!n,x))},[n]);return a.jsxs("div",I({className:h},{children:[o.prefixMonths!==""&&a.jsx("span",{children:o.prefixMonths||g.prefixMonths}),a.jsx(le,{placeholder:o.emptyMonths||g.emptyMonths,optionsList:b,grid:!1,value:t,unit:I(I({},Q[3]),{alt:o.altMonths||g.altMonths}),setValue:r,locale:o,className:n,humanizeLabels:u,disabled:i,readOnly:c,period:l,periodicityOnDoubleClick:s,mode:y})]}))}function Do(e){var t=e.value,r=e.setValue,o=e.locale,n=e.className,u=e.disabled,i=e.readOnly,c=e.shortcuts,l=e.allowedPeriods,s=[];l.includes("year")&&s.push({value:"year",label:o.yearOption||g.yearOption}),l.includes("month")&&s.push({value:"month",label:o.monthOption||g.monthOption}),l.includes("week")&&s.push({value:"week",label:o.weekOption||g.weekOption}),l.includes("day")&&s.push({value:"day",label:o.dayOption||g.dayOption}),l.includes("hour")&&s.push({value:"hour",label:o.hourOption||g.hourOption}),l.includes("minute")&&s.push({value:"minute",label:o.minuteOption||g.minuteOption}),l.includes("reboot")&&c&&(c===!0||c.includes("@reboot"))&&s.push({value:"reboot",label:o.rebootOption||g.rebootOption});var y=m.useCallback(function(p){i||r(p)},[r,i]),b=m.useMemo(function(){var p;return H(((p={"react-js-cron-field":!0,"react-js-cron-period":!0})["".concat(n,"-field")]=!!n,p["".concat(n,"-period")]=!!n,p))},[n]),h=m.useMemo(function(){var p;return H(((p={"react-js-cron-select":!0,"react-js-cron-select-no-prefix":o.prefixPeriod===""})["".concat(n,"-select")]=!!n,p))},[n,o.prefixPeriod]),x=m.useMemo(function(){var p;return H(((p={"react-js-cron-select-dropdown":!0,"react-js-cron-select-dropdown-period":!0})["".concat(n,"-select-dropdown")]=!!n,p["".concat(n,"-select-dropdown-period")]=!!n,p))},[n]);return a.jsxs("div",I({className:b},{children:[o.prefixPeriod!==""&&a.jsx("span",{children:o.prefixPeriod||g.prefixPeriod}),a.jsx(U.Select,{defaultValue:t,value:t,onChange:y,options:s,className:h,popupClassName:x,disabled:u,showArrow:!i,open:!i&&void 0,"data-testid":"select-period"},JSON.stringify(o))]}))}function Mo(e){var t=e.value,r=e.setValue,o=e.locale,n=e.className,u=e.humanizeLabels,i=e.monthDays,c=e.disabled,l=e.readOnly,s=e.period,y=e.periodicityOnDoubleClick,b=e.mode,h=o.weekDays||g.weekDays,x=s==="week"||!i||i.length===0,p=m.useMemo(function(){var J;return H(((J={"react-js-cron-field":!0,"react-js-cron-week-days":!0,"react-js-cron-week-days-placeholder":!x})["".concat(n,"-field")]=!!n,J["".concat(n,"-week-days")]=!!n,J))},[n,x]),k=JSON.stringify(o),A=m.useMemo(function(){return x?o.emptyWeekDays||g.emptyWeekDays:o.emptyWeekDaysShort||g.emptyWeekDaysShort},[x,k]),X=s==="week"||!l||t&&t.length>0||(!t||t.length===0)&&(!i||i.length===0),N=!l||i&&i.length>0||(!i||i.length===0)&&(!t||t.length===0);return X?a.jsxs("div",I({className:p},{children:[o.prefixWeekDays!==""&&(s==="week"||!N)&&a.jsx("span",{children:o.prefixWeekDays||g.prefixWeekDays}),o.prefixWeekDaysForMonthAndYearPeriod!==""&&s!=="week"&&N&&a.jsx("span",{children:o.prefixWeekDaysForMonthAndYearPeriod||g.prefixWeekDaysForMonthAndYearPeriod}),a.jsx(le,{placeholder:A,optionsList:h,grid:!1,value:t,unit:I(I({},Q[4]),{alt:o.altWeekDays||g.altWeekDays}),setValue:r,locale:o,className:n,humanizeLabels:u,disabled:c,readOnly:l,period:s,periodicityOnDoubleClick:y,mode:b})]})):null}function No(e){var t=e.clearButton,r=t===void 0||t,o=e.clearButtonProps,n=o===void 0?{}:o,u=e.clearButtonAction,i=u===void 0?"fill-with-every":u,c=e.locale,l=c===void 0?g:c,s=e.value,y=s===void 0?"":s,b=e.setValue,h=e.displayError,x=h===void 0||h,p=e.onError,k=e.className,A=e.defaultPeriod,X=A===void 0?"day":A,N=e.allowEmpty,J=N===void 0?"for-default-value":N,te=e.humanizeLabels,ne=te===void 0||te,z=e.humanizeValue,P=z!==void 0&&z,K=e.disabled,E=K!==void 0&&K,Z=e.readOnly,F=Z!==void 0&&Z,q=e.leadingZero,f=q!==void 0&&q,w=e.shortcuts,C=w===void 0?["@yearly","@annually","@monthly","@weekly","@daily","@midnight","@hourly"]:w,W=e.clockFormat,S=e.periodicityOnDoubleClick,D=S===void 0||S,j=e.mode,V=j===void 0?"multiple":j,ce=e.allowedDropdowns,Y=ce===void 0?["period","months","month-days","week-days","hours","minutes"]:ce,re=e.allowedPeriods,Wo=re===void 0?["year","month","week","day","hour","minute","reboot"]:re,ae=m.useRef(y),Ae=m.useRef(X),Qe=m.useState(),$=Qe[0],ve=Qe[1],Xe=m.useState(),se=Xe[0],be=Xe[1],Re=m.useState(),ge=Re[0],we=Re[1],eo=m.useState(),ue=eo[0],ke=eo[1],oo=m.useState(),Ce=oo[0],Oe=oo[1],to=m.useState(),Se=to[0],De=to[1],no=m.useState(!1),Fe=no[0],pe=no[1],ro=m.useState(!1),Me=ro[0],ao=ro[1],Lo=function(M){var _=m.useRef(M);return m.useEffect(function(){_.current=M},[M]),_.current}(Me),io=JSON.stringify(l);m.useEffect(function(){We(y,pe,p,J,ae,!0,l,C,De,Oe,be,we,ke,ve)},[]),m.useEffect(function(){y!==ae.current&&We(y,pe,p,J,ae,!1,l,C,De,Oe,be,we,ke,ve)},[y,ae,io,J,C]),m.useEffect(function(){if(!($||Se||ge||se||ue||Ce)||Me||Lo)Me&&ao(!1);else{var M=$||Ae.current,_=Le(M,ge,se,ue,Ce,Se,P);b(_,{selectedPeriod:M}),ae.current=_,p&&p(void 0),pe(!1)}},[$,se,ge,ue,Ce,Se,P,Me]);var lo=m.useCallback(function(){be(void 0),we(void 0),ke(void 0),Oe(void 0),De(void 0);var M="",_=$!=="reboot"&&$?$:Ae.current;_!==$&&ve(_),i==="fill-with-every"&&(M=Le(_,void 0,void 0,void 0,void 0,void 0)),b(M,{selectedPeriod:_}),ae.current=M,ao(!0),J==="never"&&i==="empty"?(pe(!0),Je(p,l)):(p&&p(void 0),pe(!1))},[$,b,p,i]),Ho=m.useMemo(function(){var M;return H(((M={"react-js-cron":!0,"react-js-cron-error":Fe&&x,"react-js-cron-disabled":E,"react-js-cron-read-only":F})["".concat(k)]=!!k,M["".concat(k,"-error")]=Fe&&x&&!!k,M["".concat(k,"-disabled")]=E&&!!k,M["".concat(k,"-read-only")]=F&&!!k,M))},[k,Fe,x,E,F]),Te=n.className,co=Ve(n,["className"]),so=m.useMemo(function(){var M;return H(((M={"react-js-cron-clear-button":!0})["".concat(k,"-clear-button")]=!!k,M["".concat(Te)]=!!Te,M))},[k,Te]),zo=JSON.stringify(co),uo=m.useMemo(function(){return r&&!F?a.jsx(U.Button,I({className:so,danger:!0,type:"primary",disabled:E},co,{onClick:lo},{children:l.clearButtonText||g.clearButtonText})):null},[r,F,io,so,E,zo,lo]),B=$||Ae.current;return a.jsxs("div",I({className:Ho},{children:[Y.includes("period")&&a.jsx(Do,{value:B,setValue:ve,locale:l,className:k,disabled:E,readOnly:F,shortcuts:C,allowedPeriods:Wo}),B==="reboot"?uo:a.jsxs(a.Fragment,{children:[B==="year"&&Y.includes("months")&&a.jsx(So,{value:ge,setValue:we,locale:l,className:k,humanizeLabels:ne,disabled:E,readOnly:F,period:B,periodicityOnDoubleClick:D,mode:V}),(B==="year"||B==="month")&&Y.includes("month-days")&&a.jsx(Oo,{value:se,setValue:be,locale:l,className:k,weekDays:ue,disabled:E,readOnly:F,leadingZero:f,period:B,periodicityOnDoubleClick:D,mode:V}),(B==="year"||B==="month"||B==="week")&&Y.includes("week-days")&&a.jsx(Mo,{value:ue,setValue:ke,locale:l,className:k,humanizeLabels:ne,monthDays:se,disabled:E,readOnly:F,period:B,periodicityOnDoubleClick:D,mode:V}),a.jsxs("div",{children:[B!=="minute"&&B!=="hour"&&Y.includes("hours")&&a.jsx(ko,{value:Ce,setValue:Oe,locale:l,className:k,disabled:E,readOnly:F,leadingZero:f,clockFormat:W,period:B,periodicityOnDoubleClick:D,mode:V}),B!=="minute"&&Y.includes("minutes")&&a.jsx(Co,{value:Se,setValue:De,locale:l,period:B,className:k,disabled:E,readOnly:F,leadingZero:f,clockFormat:W,periodicityOnDoubleClick:D,mode:V}),uo]})]})]}))}const Ao={"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:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]}},Ye=[{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 _e(e){return Ye.filter(r=>!isNaN(+r.value)).reverse().find(r=>!(e%r.value))}function Fo(e){if(!e)return"none";if(e&&!isNaN(+e)){const t=_e(e);return t?t.value:"none"}if(typeof e=="string")return"cron"}function To({value:e,onChange:t}){const{t:r}=ye(),o=_e(e);return a.jsx(U.InputNumber,{value:e/o.value,onChange:n=>t(n*o.value),min:1,addonBefore:r("Every"),addonAfter:r(o.unitText),className:"auto-width"})}function Po({value:e=null,onChange:t}){const{t:r}=ye(),o=Fo(e),n=m.useCallback(i=>{if(i==="none"){t(null);return}if(i==="cron"){t("0 * * * * *");return}t(i)},[t]),u=Ao[localStorage.getItem("TACHYBASE_LOCALE")||"en-US"];return a.jsxs("fieldset",{className:d.css`
|
|
7
|
+
`,children:[a.jsx(U.Select,{value:o,onChange:n=>{t(n?n==="field"?{}:new Date:null)},className:"auto-width",options:[{value:null,label:r("No end")},{value:"date",label:r("By custom date")}]}),o==="field"?a.jsx(je,{value:e,onChange:t}):null,o==="date"?a.jsx(U.DatePicker,{showTime:!0,value:me.dayjs(e),onChange:n=>{t(n?n.toDate():null)}}):null]})}var I=function(){return I=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},I.apply(this,arguments)};function Ve(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function"){var n=0;for(o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]])}return r}function fe(e,t,r){if(r||arguments.length===2)for(var o,n=0,u=t.length;n<u;n++)!o&&n in t||(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))}var wo=[{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 * * * *"}],Q=[{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"]}],g={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 Be(e,t){for(var r=[],o=e;o<=t;o++)r.push(o);return r}function he(e){return e.sort(function(t,r){return t-r}),e}function Ie(e){var t=[];return e.forEach(function(r){t.indexOf(r)<0&&t.push(r)}),t}function H(e){return Object.entries(e).filter(function(t){var r=t[0],o=t[1];return r&&o}).map(function(t){return t[0]}).join(" ")}function Je(e,t){e&&e({type:"invalid_cron",description:t.errorInvalidCron||g.errorInvalidCron})}function xe(e){var t=parseInt(e,10),r=Number(e);return t===r?r:NaN}function We(e,t,r,o,n,u,i,c,l,s,y,b,h,x){r&&r(void 0),t(!1);var p=!1;if(!e){if(o==="always"||u&&o==="for-default-value")return;p=!0}if(!p){if(c&&(c===!0||c.includes(e))){if(e==="@reboot")return void x("reboot");var k=wo.find(function(M){return M.name===e});k&&(e=k.value)}try{var A=function(M){if(typeof M!="string")throw new Error("Invalid cron string");var J=M.replace(/\s+/g," ").trim().split(" ");if(J.length===5)return J.map(function(te,ne){return function(z,P){if(z==="*"||z==="*/1")return[];var K=he(Ie(Ze(function(Z,F,q){if(q){Z=Z.toUpperCase();for(var f=0;f<q.length;f++)Z=Z.replace(q[f],"".concat(f+F))}return Z}(z,P.min,P.alt).split(",").map(function(Z){var F,q=Z.split("/");if(q.length>2)throw new Error('Invalid value "'.concat(z,' for "').concat(P.type,'"'));var f=q[0],w=q[1];F=f==="*"?Be(P.min,P.max):function(S,D,j){var V=S.split("-");if(V.length===1){var ce=xe(V[0]);if(isNaN(ce))throw new Error('Invalid value "'.concat(D,'" for ').concat(j.type));return[ce]}if(V.length===2){var Y=xe(V[0]),re=xe(V[1]);if(isNaN(Y)||isNaN(re))throw new Error('Invalid value "'.concat(D,'" for ').concat(j.type));if(re<Y)throw new Error('Max range is less than min range in "'.concat(S,'" for ').concat(j.type));return Be(Y,re)}throw new Error('Invalid value "'.concat(S,'" for ').concat(j.type))}(f,z,P);var C=function(S,D){if(S!==void 0){var j=xe(S);if(isNaN(j)||j<1)throw new Error('Invalid interval step value "'.concat(S,'" for ').concat(D.type));return j}}(w,P),W=function(S,D){if(D){var j=S[0];S=S.filter(function(V){return V%D==j%D||V===j})}return S}(F,C);return W}).flat(),P))),E=qe(K,P);if(E!==void 0)throw new Error('Value "'.concat(E,'" out of range for ').concat(P.type));return K.length===P.total?[]:K}(te,Q[ne])});throw new Error("Invalid cron string format")}(e),X=function(M){return M[3].length>0?"year":M[2].length>0?"month":M[4].length>0?"week":M[1].length>0?"day":M[0].length>0?"hour":"minute"}(A);x(X),l(A[0]),s(A[1]),y(A[2]),b(A[3]),h(A[4])}catch(M){p=!0}}p&&(n.current=e,t(!0),Je(r,i))}function Le(e,t,r,o,n,u,i){if(e==="reboot")return"@reboot";var c=function(l,s){return l.map(function(y,b){var h=Q[b];return He(ze(y,h),h,s)})}([e!=="minute"&&u?u:[],e!=="minute"&&e!=="hour"&&n?n:[],e!=="year"&&e!=="month"||!r?[]:r,e==="year"&&t?t:[],e!=="year"&&e!=="month"&&e!=="week"||!o?[]:o],i);return c.join(" ")}function He(e,t,r,o,n){var u="";if(function(c,l){return c.length===l.max-l.min+1}(e,t)||e.length===0)u="*";else{var i=function(c){if(c.length>2){var l=c[1]-c[0];if(l>1)return l}}(e);u=i&&function(c,l){for(var s=1;s<c.length;s++){var y=c[s-1];if(c[s]-y!==l)return!1}return!0}(e,i)?function(c,l,s){var y=Ue(c),b=Ke(c),h=c.length===(b-y)/s+1;return!!(y===l.min&&b+s>l.max&&h)}(e,t,i)?"*/".concat(i):"".concat(oe(Ue(e),t,r,o,n),"-").concat(oe(Ke(e),t,r,o,n),"/").concat(i):function(c){var l=[],s=null;return c.forEach(function(y,b,h){y!==h[b+1]-1?s!==null?(l.push([s,y]),s=null):l.push(y):s===null&&(s=y)}),l}(e).map(function(c){return Array.isArray(c)?"".concat(oe(c[0],t,r,o,n),"-").concat(oe(c[1],t,r,o,n)):oe(c,t,r,o,n)}).join(",")}return u}function oe(e,t,r,o,n){var u=e.toString(),i=t.type,c=t.alt,l=t.min,s=o&&(o===!0||o.includes(i)),y=n==="24-hour-clock"&&(i==="hours"||i==="minutes");if(r&&i==="week-days"||r&&i==="months"?u=c[e-l]:e<10&&(s||y)&&(u=u.padStart(2,"0")),i==="hours"&&n==="12-hour-clock"){var b=e>=12?"PM":"AM",h=e%12||12;h<10&&s&&(h=h.toString().padStart(2,"0")),u="".concat(h).concat(b)}return u}function ze(e,t){var r=he(Ie(Ze(e,t)));if(r.length===0)return r;var o=qe(r,t);if(o!==void 0)throw new Error('Value "'.concat(o,'" out of range for ').concat(t.type));return r}function Ze(e,t){return t.type==="week-days"&&(e=e.map(function(r){return r===7?0:r})),e}function qe(e,t){var r=e[0],o=e[e.length-1];return r<t.min?r:o>t.max?o:void 0}function Ue(e){return e[0]}function Ke(e){return e[e.length-1]}function le(e){var t=e.value,r=e.grid,o=r===void 0||r,n=e.optionsList,u=e.setValue,i=e.locale,c=e.className,l=e.humanizeLabels,s=e.disabled,y=e.readOnly,b=e.leadingZero,h=e.clockFormat,x=e.period,p=e.unit,k=e.periodicityOnDoubleClick,A=e.mode,X=Ve(e,["value","grid","optionsList","setValue","locale","className","humanizeLabels","disabled","readOnly","leadingZero","clockFormat","period","unit","periodicityOnDoubleClick","mode"]),M=m.useMemo(function(){if(t&&Array.isArray(t))return t.map(function(f){return f.toString()})},[t]),J=m.useMemo(function(){return n?n.map(function(f,w){return{value:(p.min===0?w:w+1).toString(),label:f}}):fe([],Array(p.total),!0).map(function(f,w){var C=p.min===0?w:w+1;return{value:C.toString(),label:oe(C,p,l,b,h)}})},[n,b,l,h]),te=JSON.stringify(i),ne=m.useCallback(function(f){var w=f.value;if(!t||t[0]!==Number(w))return a.jsx(a.Fragment,{});var C=He(ze(t,p),p,l,b,h),W=C.match(/^\*\/([0-9]+),?/)||[];return a.jsx("div",{children:W[1]?"".concat(i.everyText||g.everyText," ").concat(W[1]):C})},[t,te,l,b,h]),z=m.useCallback(function(f){var w=Array.isArray(f)?he(f):[f],C=w;t&&(C=A==="single"?[]:fe([],t,!0),w.forEach(function(W){var S=Number(W);C=t.some(function(D){return D===S})?C.filter(function(D){return D!==S}):he(fe(fe([],C,!0),[S],!1))})),C.length===p.total?u([]):u(C)},[u,t]),P=m.useCallback(function(f){if(f!==0&&f!==1){for(var w=p.total+p.min,C=[],W=p.min;W<w;W++)W%f==0&&C.push(W);var S=t&&C&&t.length===C.length&&t.every(function(j,V){return j===C[V]}),D=C.length===J.length;u(D||S?[]:C)}else u([])},[t,J,u]),K=m.useRef([]),E=m.useCallback(function(f){if(!y){var w=K.current;w.push({time:new Date().getTime(),value:Number(f)});var C=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?P(Number(f)):z([w[w.length-2].value,w[w.length-1].value]):z(Number(f)),K.current=[]},300);return function(){window.clearTimeout(C)}}},[K,z,P,y,k]),Z=m.useCallback(function(){y||u([])},[u,y]),F=m.useMemo(function(){var f;return H(((f={"react-js-cron-select":!0,"react-js-cron-custom-select":!0})["".concat(c,"-select")]=!!c,f))},[c]),q=m.useMemo(function(){var f;return H(((f={"react-js-cron-select-dropdown":!0})["react-js-cron-select-dropdown-".concat(p.type)]=!0,f["react-js-cron-custom-select-dropdown"]=!0,f["react-js-cron-custom-select-dropdown-".concat(p.type)]=!0,f["react-js-cron-custom-select-dropdown-minutes-large"]=p.type==="minutes"&&x!=="hour"&&x!=="day",f["react-js-cron-custom-select-dropdown-minutes-medium"]=p.type==="minutes"&&(x==="day"||x==="hour"),f["react-js-cron-custom-select-dropdown-hours-twelve-hour-clock"]=p.type==="hours"&&h==="12-hour-clock",f["react-js-cron-custom-select-dropdown-grid"]=!!o,f["".concat(c,"-select-dropdown")]=!!c,f["".concat(c,"-select-dropdown-").concat(p.type)]=!!c,f))},[c,o,h,x]);return a.jsx(U.Select,I({mode:A!=="single"||k?"multiple":void 0,allowClear:!y,virtual:!1,open:!y&&void 0,value:M,onClear:Z,tagRender:ne,className:F,popupClassName:q,options:J,showSearch:!1,showArrow:!y,menuItemSelectedIcon:null,dropdownMatchSelectWidth:!1,onSelect:E,onDeselect:E,disabled:s,dropdownAlign:p.type!=="minutes"&&p.type!=="hours"||x==="day"||x==="hour"?void 0:{points:["tr","br"]},"data-testid":"custom-select-".concat(p.type)},X))}function ko(e){var t=e.value,r=e.setValue,o=e.locale,n=e.className,u=e.disabled,i=e.readOnly,c=e.leadingZero,l=e.clockFormat,s=e.period,y=e.periodicityOnDoubleClick,b=e.mode,h=m.useMemo(function(){var x;return H(((x={"react-js-cron-field":!0,"react-js-cron-hours":!0})["".concat(n,"-field")]=!!n,x["".concat(n,"-hours")]=!!n,x))},[n]);return a.jsxs("div",I({className:h},{children:[o.prefixHours!==""&&a.jsx("span",{children:o.prefixHours||g.prefixHours}),a.jsx(le,{placeholder:o.emptyHours||g.emptyHours,value:t,unit:Q[1],setValue:r,locale:o,className:n,disabled:u,readOnly:i,leadingZero:c,clockFormat:l,period:s,periodicityOnDoubleClick:y,mode:b})]}))}function Co(e){var t=e.value,r=e.setValue,o=e.locale,n=e.className,u=e.disabled,i=e.readOnly,c=e.leadingZero,l=e.clockFormat,s=e.period,y=e.periodicityOnDoubleClick,b=e.mode,h=m.useMemo(function(){var x;return H(((x={"react-js-cron-field":!0,"react-js-cron-minutes":!0})["".concat(n,"-field")]=!!n,x["".concat(n,"-minutes")]=!!n,x))},[n]);return a.jsxs("div",I({className:h},{children:[s==="hour"?o.prefixMinutesForHourPeriod!==""&&a.jsx("span",{children:o.prefixMinutesForHourPeriod||g.prefixMinutesForHourPeriod}):o.prefixMinutes!==""&&a.jsx("span",{children:o.prefixMinutes||g.prefixMinutes}),a.jsx(le,{placeholder:s==="hour"?o.emptyMinutesForHourPeriod||g.emptyMinutesForHourPeriod:o.emptyMinutes||g.emptyMinutes,value:t,unit:Q[0],setValue:r,locale:o,className:n,disabled:u,readOnly:i,leadingZero:c,clockFormat:l,period:s,periodicityOnDoubleClick:y,mode:b}),s==="hour"&&o.suffixMinutesForHourPeriod!==""&&a.jsx("span",{children:o.suffixMinutesForHourPeriod||g.suffixMinutesForHourPeriod})]}))}function Oo(e){var t=e.value,r=e.setValue,o=e.locale,n=e.className,u=e.weekDays,i=e.disabled,c=e.readOnly,l=e.leadingZero,s=e.period,y=e.periodicityOnDoubleClick,b=e.mode,h=!u||u.length===0,x=m.useMemo(function(){var A;return H(((A={"react-js-cron-field":!0,"react-js-cron-month-days":!0,"react-js-cron-month-days-placeholder":!h})["".concat(n,"-field")]=!!n,A["".concat(n,"-month-days")]=!!n,A))},[n,h]),p=JSON.stringify(o),k=m.useMemo(function(){return h?o.emptyMonthDays||g.emptyMonthDays:o.emptyMonthDaysShort||g.emptyMonthDaysShort},[h,p]);return!c||t&&t.length>0||(!t||t.length===0)&&(!u||u.length===0)?a.jsxs("div",I({className:x},{children:[o.prefixMonthDays!==""&&a.jsx("span",{children:o.prefixMonthDays||g.prefixMonthDays}),a.jsx(le,{placeholder:k,value:t,setValue:r,unit:Q[2],locale:o,className:n,disabled:i,readOnly:c,leadingZero:l,period:s,periodicityOnDoubleClick:y,mode:b})]})):null}function So(e){var t=e.value,r=e.setValue,o=e.locale,n=e.className,u=e.humanizeLabels,i=e.disabled,c=e.readOnly,l=e.period,s=e.periodicityOnDoubleClick,y=e.mode,b=o.months||g.months,h=m.useMemo(function(){var x;return H(((x={"react-js-cron-field":!0,"react-js-cron-months":!0})["".concat(n,"-field")]=!!n,x["".concat(n,"-months")]=!!n,x))},[n]);return a.jsxs("div",I({className:h},{children:[o.prefixMonths!==""&&a.jsx("span",{children:o.prefixMonths||g.prefixMonths}),a.jsx(le,{placeholder:o.emptyMonths||g.emptyMonths,optionsList:b,grid:!1,value:t,unit:I(I({},Q[3]),{alt:o.altMonths||g.altMonths}),setValue:r,locale:o,className:n,humanizeLabels:u,disabled:i,readOnly:c,period:l,periodicityOnDoubleClick:s,mode:y})]}))}function Do(e){var t=e.value,r=e.setValue,o=e.locale,n=e.className,u=e.disabled,i=e.readOnly,c=e.shortcuts,l=e.allowedPeriods,s=[];l.includes("year")&&s.push({value:"year",label:o.yearOption||g.yearOption}),l.includes("month")&&s.push({value:"month",label:o.monthOption||g.monthOption}),l.includes("week")&&s.push({value:"week",label:o.weekOption||g.weekOption}),l.includes("day")&&s.push({value:"day",label:o.dayOption||g.dayOption}),l.includes("hour")&&s.push({value:"hour",label:o.hourOption||g.hourOption}),l.includes("minute")&&s.push({value:"minute",label:o.minuteOption||g.minuteOption}),l.includes("reboot")&&c&&(c===!0||c.includes("@reboot"))&&s.push({value:"reboot",label:o.rebootOption||g.rebootOption});var y=m.useCallback(function(p){i||r(p)},[r,i]),b=m.useMemo(function(){var p;return H(((p={"react-js-cron-field":!0,"react-js-cron-period":!0})["".concat(n,"-field")]=!!n,p["".concat(n,"-period")]=!!n,p))},[n]),h=m.useMemo(function(){var p;return H(((p={"react-js-cron-select":!0,"react-js-cron-select-no-prefix":o.prefixPeriod===""})["".concat(n,"-select")]=!!n,p))},[n,o.prefixPeriod]),x=m.useMemo(function(){var p;return H(((p={"react-js-cron-select-dropdown":!0,"react-js-cron-select-dropdown-period":!0})["".concat(n,"-select-dropdown")]=!!n,p["".concat(n,"-select-dropdown-period")]=!!n,p))},[n]);return a.jsxs("div",I({className:b},{children:[o.prefixPeriod!==""&&a.jsx("span",{children:o.prefixPeriod||g.prefixPeriod}),a.jsx(U.Select,{defaultValue:t,value:t,onChange:y,options:s,className:h,popupClassName:x,disabled:u,showArrow:!i,open:!i&&void 0,"data-testid":"select-period"},JSON.stringify(o))]}))}function No(e){var t=e.value,r=e.setValue,o=e.locale,n=e.className,u=e.humanizeLabels,i=e.monthDays,c=e.disabled,l=e.readOnly,s=e.period,y=e.periodicityOnDoubleClick,b=e.mode,h=o.weekDays||g.weekDays,x=s==="week"||!i||i.length===0,p=m.useMemo(function(){var J;return H(((J={"react-js-cron-field":!0,"react-js-cron-week-days":!0,"react-js-cron-week-days-placeholder":!x})["".concat(n,"-field")]=!!n,J["".concat(n,"-week-days")]=!!n,J))},[n,x]),k=JSON.stringify(o),A=m.useMemo(function(){return x?o.emptyWeekDays||g.emptyWeekDays:o.emptyWeekDaysShort||g.emptyWeekDaysShort},[x,k]),X=s==="week"||!l||t&&t.length>0||(!t||t.length===0)&&(!i||i.length===0),M=!l||i&&i.length>0||(!i||i.length===0)&&(!t||t.length===0);return X?a.jsxs("div",I({className:p},{children:[o.prefixWeekDays!==""&&(s==="week"||!M)&&a.jsx("span",{children:o.prefixWeekDays||g.prefixWeekDays}),o.prefixWeekDaysForMonthAndYearPeriod!==""&&s!=="week"&&M&&a.jsx("span",{children:o.prefixWeekDaysForMonthAndYearPeriod||g.prefixWeekDaysForMonthAndYearPeriod}),a.jsx(le,{placeholder:A,optionsList:h,grid:!1,value:t,unit:I(I({},Q[4]),{alt:o.altWeekDays||g.altWeekDays}),setValue:r,locale:o,className:n,humanizeLabels:u,disabled:c,readOnly:l,period:s,periodicityOnDoubleClick:y,mode:b})]})):null}function Mo(e){var t=e.clearButton,r=t===void 0||t,o=e.clearButtonProps,n=o===void 0?{}:o,u=e.clearButtonAction,i=u===void 0?"fill-with-every":u,c=e.locale,l=c===void 0?g:c,s=e.value,y=s===void 0?"":s,b=e.setValue,h=e.displayError,x=h===void 0||h,p=e.onError,k=e.className,A=e.defaultPeriod,X=A===void 0?"day":A,M=e.allowEmpty,J=M===void 0?"for-default-value":M,te=e.humanizeLabels,ne=te===void 0||te,z=e.humanizeValue,P=z!==void 0&&z,K=e.disabled,E=K!==void 0&&K,Z=e.readOnly,F=Z!==void 0&&Z,q=e.leadingZero,f=q!==void 0&&q,w=e.shortcuts,C=w===void 0?["@yearly","@annually","@monthly","@weekly","@daily","@midnight","@hourly"]:w,W=e.clockFormat,S=e.periodicityOnDoubleClick,D=S===void 0||S,j=e.mode,V=j===void 0?"multiple":j,ce=e.allowedDropdowns,Y=ce===void 0?["period","months","month-days","week-days","hours","minutes"]:ce,re=e.allowedPeriods,Wo=re===void 0?["year","month","week","day","hour","minute","reboot"]:re,ae=m.useRef(y),Ae=m.useRef(X),Qe=m.useState(),_=Qe[0],ve=Qe[1],Xe=m.useState(),se=Xe[0],be=Xe[1],Re=m.useState(),ge=Re[0],we=Re[1],eo=m.useState(),ue=eo[0],ke=eo[1],oo=m.useState(),Ce=oo[0],Oe=oo[1],to=m.useState(),Se=to[0],De=to[1],no=m.useState(!1),Fe=no[0],pe=no[1],ro=m.useState(!1),Ne=ro[0],ao=ro[1],Lo=function(N){var $=m.useRef(N);return m.useEffect(function(){$.current=N},[N]),$.current}(Ne),io=JSON.stringify(l);m.useEffect(function(){We(y,pe,p,J,ae,!0,l,C,De,Oe,be,we,ke,ve)},[]),m.useEffect(function(){y!==ae.current&&We(y,pe,p,J,ae,!1,l,C,De,Oe,be,we,ke,ve)},[y,ae,io,J,C]),m.useEffect(function(){if(!(_||Se||ge||se||ue||Ce)||Ne||Lo)Ne&&ao(!1);else{var N=_||Ae.current,$=Le(N,ge,se,ue,Ce,Se,P);b($,{selectedPeriod:N}),ae.current=$,p&&p(void 0),pe(!1)}},[_,se,ge,ue,Ce,Se,P,Ne]);var lo=m.useCallback(function(){be(void 0),we(void 0),ke(void 0),Oe(void 0),De(void 0);var N="",$=_!=="reboot"&&_?_:Ae.current;$!==_&&ve($),i==="fill-with-every"&&(N=Le($,void 0,void 0,void 0,void 0,void 0)),b(N,{selectedPeriod:$}),ae.current=N,ao(!0),J==="never"&&i==="empty"?(pe(!0),Je(p,l)):(p&&p(void 0),pe(!1))},[_,b,p,i]),Ho=m.useMemo(function(){var N;return H(((N={"react-js-cron":!0,"react-js-cron-error":Fe&&x,"react-js-cron-disabled":E,"react-js-cron-read-only":F})["".concat(k)]=!!k,N["".concat(k,"-error")]=Fe&&x&&!!k,N["".concat(k,"-disabled")]=E&&!!k,N["".concat(k,"-read-only")]=F&&!!k,N))},[k,Fe,x,E,F]),Te=n.className,co=Ve(n,["className"]),so=m.useMemo(function(){var N;return H(((N={"react-js-cron-clear-button":!0})["".concat(k,"-clear-button")]=!!k,N["".concat(Te)]=!!Te,N))},[k,Te]),zo=JSON.stringify(co),uo=m.useMemo(function(){return r&&!F?a.jsx(U.Button,I({className:so,danger:!0,type:"primary",disabled:E},co,{onClick:lo},{children:l.clearButtonText||g.clearButtonText})):null},[r,F,io,so,E,zo,lo]),B=_||Ae.current;return a.jsxs("div",I({className:Ho},{children:[Y.includes("period")&&a.jsx(Do,{value:B,setValue:ve,locale:l,className:k,disabled:E,readOnly:F,shortcuts:C,allowedPeriods:Wo}),B==="reboot"?uo:a.jsxs(a.Fragment,{children:[B==="year"&&Y.includes("months")&&a.jsx(So,{value:ge,setValue:we,locale:l,className:k,humanizeLabels:ne,disabled:E,readOnly:F,period:B,periodicityOnDoubleClick:D,mode:V}),(B==="year"||B==="month")&&Y.includes("month-days")&&a.jsx(Oo,{value:se,setValue:be,locale:l,className:k,weekDays:ue,disabled:E,readOnly:F,leadingZero:f,period:B,periodicityOnDoubleClick:D,mode:V}),(B==="year"||B==="month"||B==="week")&&Y.includes("week-days")&&a.jsx(No,{value:ue,setValue:ke,locale:l,className:k,humanizeLabels:ne,monthDays:se,disabled:E,readOnly:F,period:B,periodicityOnDoubleClick:D,mode:V}),a.jsxs("div",{children:[B!=="minute"&&B!=="hour"&&Y.includes("hours")&&a.jsx(ko,{value:Ce,setValue:Oe,locale:l,className:k,disabled:E,readOnly:F,leadingZero:f,clockFormat:W,period:B,periodicityOnDoubleClick:D,mode:V}),B!=="minute"&&Y.includes("minutes")&&a.jsx(Co,{value:Se,setValue:De,locale:l,period:B,className:k,disabled:E,readOnly:F,leadingZero:f,clockFormat:W,periodicityOnDoubleClick:D,mode:V}),uo]})]})]}))}const Ao={"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:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]}},Ye=[{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 $e(e){return Ye.filter(r=>!isNaN(+r.value)).reverse().find(r=>!(e%r.value))}function Fo(e){if(!e)return"none";if(e&&!isNaN(+e)){const t=$e(e);return t?t.value:"none"}if(typeof e=="string")return"cron"}function To({value:e,onChange:t}){const{t:r}=ye(),o=$e(e);return a.jsx(U.InputNumber,{value:e/o.value,onChange:n=>t(n*o.value),min:1,addonBefore:r("Every"),addonAfter:r(o.unitText),className:"auto-width"})}function Po({value:e=null,onChange:t}){const{t:r}=ye(),o=Fo(e),n=m.useCallback(i=>{if(i==="none"){t(null);return}if(i==="cron"){t("0 * * * * *");return}t(i)},[t]),u=Ao[localStorage.getItem("TACHYBASE_LOCALE")||"en-US"];return a.jsxs("fieldset",{className:d.css`
|
|
8
8
|
display: flex;
|
|
9
9
|
flex-direction: ${o==="cron"?"column":"row"};
|
|
10
10
|
align-items: flex-start;
|
|
@@ -33,4 +33,4 @@
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
`,children:[a.jsx(U.Select,{value:o,onChange:n,className:"auto-width",options:Ye.map(i=>({value:i.value,label:r(i.text)}))}),o&&!isNaN(+o)?a.jsx(To,{value:e,onChange:t}):null,o==="cron"?a.jsx(
|
|
36
|
+
`,children:[a.jsx(U.Select,{value:o,onChange:n,className:"auto-width",options:Ye.map(i=>({value:i.value,label:r(i.text)}))}),o&&!isNaN(+o)?a.jsx(To,{value:e,onChange:t}):null,o==="cron"?a.jsx(Mo,{value:e.trim().split(/\s+/).slice(1).join(" "),setValue:i=>t(`0 ${i}`),clearButton:!1,locale:u}):null]})}const _e={name:{type:"string","x-component":"CollectionField","x-decorator":"FormItem","x-collection-field":"cronJobs.name","x-component-props":{}},enabled:{type:"boolean","x-component":"CollectionField","x-decorator":"FormItem","x-collection-field":"cronJobs.enabled","x-component-props":{}},description:{type:"string","x-component":"CollectionField","x-decorator":"FormItem","x-collection-field":"cronJobs.description","x-component-props":{}},workflowKey:{type:"string","x-component":"CollectionField","x-decorator":"FormItem","x-collection-field":"cronJobs.workflowKey"},startsOn:{type:"DateTime","x-component":"CollectionField","x-decorator":"FormItem","x-collection-field":"cronJobs.startsOn","x-component-props":{}},repeat:{type:"string","x-component":"CollectionField","x-decorator":"FormItem","x-collection-field":"cronJobs.repeat","x-component-props":{},"x-reactions":[{target:"endsOn",fulfill:{state:{visible:"{{!!$self.value}}"}}},{target:"limit",fulfill:{state:{visible:"{{!!$self.value}}"}}}]},endsOn:{type:"DateTime","x-component":"EndsByField","x-decorator":"FormItem","x-collection-field":"cronJobs.endsOn","x-component-props":{}},limit:{type:"number","x-component":"CollectionField","x-decorator":"FormItem","x-collection-field":"cronJobs.limit","x-component-props":{}}},Eo={type:"void","x-acl-action-props":{skipScopeCheck:!0},"x-acl-action":"cronJobs:create","x-decorator":"FormBlockProvider","x-use-decorator-props":"useCreateFormBlockDecoratorProps","x-decorator-props":{dataSource:"main",collection:"cronJobs"},"x-component":"CardItem",properties:{form:{type:"void","x-component":"FormV2","x-use-component-props":"useCreateFormBlockProps",properties:L({actionBar:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:"var(--tb-spacing)"}},properties:{submit:{title:'{{t("Submit")}}',"x-action":"submit","x-component":"Action","x-use-component-props":"useCreateActionProps","x-component-props":{type:"primary",htmlType:"submit"},type:"void"}}}},_e)}}},jo={type:"void","x-action":"create","x-acl-action":"create",title:"{{t('Add new')}}","x-component":"Action","x-decorator":"ACLActionProvider","x-component-props":{openMode:"drawer",type:"primary",component:"CreateRecordAction",icon:"PlusOutlined"},"x-align":"right","x-acl-action-props":{skipScopeCheck:!0},properties:{drawer:{type:"void",title:'{{ t("Add record") }}',"x-component":"Action.Container","x-component-props":{className:"tb-action-popup"},properties:{form:Eo}}}},Vo={type:"void",title:'{{ t("Edit") }}',"x-action":"update","x-component":"Action.Link","x-component-props":{openMode:"drawer",icon:"EditOutlined"},"x-decorator":"ACLActionProvider",properties:{drawer:{type:"void",title:'{{ t("Edit record") }}',"x-component":"Action.Container","x-component-props":{className:"tb-action-popup"},properties:{card:{type:"void","x-acl-action-props":{skipScopeCheck:!1},"x-acl-action":"cronJobs:update","x-decorator":"FormBlockProvider","x-use-decorator-props":"useEditFormBlockDecoratorProps","x-decorator-props":{action:"get",dataSource:"main",collection:"cronJobs"},"x-component":"CardItem",properties:{form:{type:"void","x-component":"FormV2","x-use-component-props":"useEditFormBlockProps",properties:L({actionBar:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:"var(--tb-spacing)"}},properties:{submit:{title:'{{ t("Submit") }}',"x-action":"submit","x-component":"Action","x-use-component-props":"useUpdateActionProps","x-component-props":{type:"primary",htmlType:"submit"},"x-action-settings":{triggerWorkflows:[],onSuccess:{manualClose:!1,redirecting:!1,successMessage:'{{t("Updated successfully")}}'},isDeltaChanged:!1},type:"void"}}}},_e)}}}}}}},Bo={type:"void",properties:{table:{type:"void","x-decorator":"TableBlockProvider","x-acl-action":"cronJobs:list","x-use-decorator-props":"useTableBlockDecoratorProps","x-decorator-props":{collection:"cronJobs",dataSource:"main",action:"list",params:{pageSize:20},rowKey:"id",showIndex:!0,dragSort:!1},"x-component":"CardItem","x-filter-targets":[],properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:"var(--tb-spacing)"}},properties:{refresh:{type:"void",title:'{{ t("Refresh") }}',"x-action":"refresh","x-component":"Action","x-settings":"actionSettings:refresh","x-component-props":{icon:"ReloadOutlined"},"x-use-component-props":"useRefreshActionProps"},create:jo}},table:{type:"array","x-component":"TableV2","x-use-component-props":"useTableBlockProps","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"}},properties:{name:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{name:{"x-collection-field":"cronJobs.name","x-component":"CollectionField","x-component-props":{ellipsis:!0},"x-read-pretty":!0,"x-decorator":null,"x-decorator-props":{labelStyle:{display:"none"}}}}},enabled:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{enabled:{"x-collection-field":"cronJobs.enabled","x-component":"CollectionField","x-component-props":{ellipsis:!0},"x-read-pretty":!0,"x-decorator":null,"x-decorator-props":{labelStyle:{display:"none"}}}}},workflowKeyColumn:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:20},properties:{workflowKey:{"x-collection-field":"cronJobs.workflowKey","x-component":"CollectionField","x-read-pretty":!0,"x-decorator":"OpenDrawer","x-decorator-props":{component:function({children:t,onClick:r}){const o=d.useCollectionRecordData();return a.jsxs(U.Space,{size:"small",children:[t,o.workflowKey?a.jsxs(U.Button,{type:"link",onClick:r,style:{padding:0,marginLeft:"-4px"},children:["(",ee("View executions"),")"]}):null]})}},properties:{drawer:T.executionSchema}}}},lastTime:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:20},properties:{lastTime:{"x-collection-field":"cronJobs.lastTime","x-component":"CollectionField","x-component-props":{ellipsis:!0},"x-read-pretty":!0,"x-decorator":null,"x-decorator-props":{labelStyle:{display:"none"}}}}},nextTime:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{nextTime:{"x-collection-field":"cronJobs.nextTime","x-component":"CollectionField","x-component-props":{ellipsis:!0},"x-read-pretty":!0,"x-decorator":null,"x-decorator-props":{labelStyle:{display:"none"}}}}},allExecuted:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:20},properties:{allExecuted:{"x-collection-field":"cronJobs.allExecuted","x-component":"CollectionField","x-component-props":{ellipsis:!0},"x-read-pretty":!0,"x-decorator":null,"x-decorator-props":{labelStyle:{display:"none"}}}}},limit:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:20},properties:{limit:{"x-collection-field":"cronJobs.limit","x-component":"CollectionField","x-component-props":{ellipsis:!0},"x-read-pretty":!0,"x-decorator":null,"x-decorator-props":{labelStyle:{display:"none"}}}}},limitExecuted:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column","x-component-props":{width:20},properties:{limitExecuted:{"x-collection-field":"cronJobs.limitExecuted","x-component":"CollectionField","x-component-props":{ellipsis:!0},"x-read-pretty":!0,"x-decorator":null,"x-decorator-props":{labelStyle:{display:"none"}}}}},actions:{type:"void",title:'{{ t("Actions") }}',"x-action-column":"actions","x-decorator":"TableV2.Column.ActionBar","x-component":"TableV2.Column","x-component-props":{width:100,fixed:"right"},properties:{actions:{type:"void","x-component":"Space",properties:{editAction:Vo,delete:{type:"void",title:"Delete","x-action":"destroy","x-component":"Action.Link","x-component-props":{confirm:{title:"Delete",content:"Are you sure you want to delete it?"}},"x-decorator":"ACLActionProvider","x-use-component-props":"useDestroyActionProps"},clear:{type:"void",title:ho("Clear current times"),"x-action":"clearLimit","x-component":"Action.Link","x-component-props":{confirm:{title:"Clear",content:"Are you sure you want to clear current times?"}},"x-decorator":"ACLActionProvider","x-use-component-props":()=>{const{refresh:e}=d.useDataBlockRequest(),t=d.useDataBlockResource(),r=d.useRecord();return{onClick(){return de(this,null,function*(){yield t.clearLimitExecuted({id:r.id}),e()})}}}}}}}}}}}}}},Io=o=>{var n=o,{params:e,filter:t={}}=n,r=Pe(n,["params","filter"]);const u=d.useCollectionRecordData(),i=G(L({},r),{params:G(L({},e),{filter:G(L({},e==null?void 0:e.filter),{key:u.workflowKey})})});return a.jsx(d.TableBlockProvider,L({},i))},Jo=()=>a.jsx(d.ExtendCollectionsProvider,{collections:[fo],children:a.jsx(d.SchemaComponent,{schema:Bo,name:"cron-jobs-table",components:{OnField:je,RepeatField:Po,EndsByField:go,ExecutionResourceProvider:Io,ExecutionLink:T.ExecutionLink,ExecutionStatusColumn:T.ExecutionStatusColumn,OpenDrawer:T.OpenDrawer},scope:{ExecutionRetryAction:T.ExecutionRetryAction}})});class Ge extends d.Plugin{afterAdd(){return de(this,null,function*(){})}beforeLoad(){return de(this,null,function*(){})}load(){return de(this,null,function*(){this.app.systemSettingsManager.add("system-services."+O,{title:this.t("Cron job"),icon:"ScheduleOutlined",Component:Jo,sort:-15,aclSnippet:"pm.system-services.cron"})})}}v.ModuleCronJobClient=Ge,v.default=Ge,Object.defineProperties(v,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/externalVersion.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
"@tachybase/client": "1.3.
|
|
3
|
-
"@tachybase/database": "1.3.
|
|
4
|
-
"@tachybase/server": "1.3.
|
|
2
|
+
"@tachybase/client": "1.3.19",
|
|
3
|
+
"@tachybase/database": "1.3.19",
|
|
4
|
+
"@tachybase/server": "1.3.19",
|
|
5
5
|
"react": "18.3.1",
|
|
6
|
-
"@tachybase/utils": "1.3.
|
|
6
|
+
"@tachybase/utils": "1.3.19",
|
|
7
7
|
"antd": "5.22.5",
|
|
8
|
-
"@tachybase/schema": "1.3.
|
|
9
|
-
"@tachybase/module-workflow": "1.3.
|
|
10
|
-
"@tachybase/actions": "1.3.
|
|
8
|
+
"@tachybase/schema": "1.3.19",
|
|
9
|
+
"@tachybase/module-workflow": "1.3.19",
|
|
10
|
+
"@tachybase/actions": "1.3.19"
|
|
11
11
|
};
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var luxon = require('luxon');
|
|
4
|
+
|
|
5
|
+
CronDate.prototype.addYear = function() {
|
|
6
|
+
this._date = this._date.plus({ years: 1 });
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
CronDate.prototype.addMonth = function() {
|
|
10
|
+
this._date = this._date.plus({ months: 1 }).startOf('month');
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
CronDate.prototype.addDay = function() {
|
|
14
|
+
this._date = this._date.plus({ days: 1 }).startOf('day');
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
CronDate.prototype.addHour = function() {
|
|
18
|
+
var prev = this._date;
|
|
19
|
+
this._date = this._date.plus({ hours: 1 }).startOf('hour');
|
|
20
|
+
if (this._date <= prev) {
|
|
21
|
+
this._date = this._date.plus({ hours: 1 });
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
CronDate.prototype.addMinute = function() {
|
|
26
|
+
var prev = this._date;
|
|
27
|
+
this._date = this._date.plus({ minutes: 1 }).startOf('minute');
|
|
28
|
+
if (this._date < prev) {
|
|
29
|
+
this._date = this._date.plus({ hours: 1 });
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
CronDate.prototype.addSecond = function() {
|
|
34
|
+
var prev = this._date;
|
|
35
|
+
this._date = this._date.plus({ seconds: 1 }).startOf('second');
|
|
36
|
+
if (this._date < prev) {
|
|
37
|
+
this._date = this._date.plus({ hours: 1 });
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
CronDate.prototype.subtractYear = function() {
|
|
42
|
+
this._date = this._date.minus({ years: 1 });
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
CronDate.prototype.subtractMonth = function() {
|
|
46
|
+
this._date = this._date
|
|
47
|
+
.minus({ months: 1 })
|
|
48
|
+
.endOf('month')
|
|
49
|
+
.startOf('second');
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
CronDate.prototype.subtractDay = function() {
|
|
53
|
+
this._date = this._date
|
|
54
|
+
.minus({ days: 1 })
|
|
55
|
+
.endOf('day')
|
|
56
|
+
.startOf('second');
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
CronDate.prototype.subtractHour = function() {
|
|
60
|
+
var prev = this._date;
|
|
61
|
+
this._date = this._date
|
|
62
|
+
.minus({ hours: 1 })
|
|
63
|
+
.endOf('hour')
|
|
64
|
+
.startOf('second');
|
|
65
|
+
if (this._date >= prev) {
|
|
66
|
+
this._date = this._date.minus({ hours: 1 });
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
CronDate.prototype.subtractMinute = function() {
|
|
71
|
+
var prev = this._date;
|
|
72
|
+
this._date = this._date.minus({ minutes: 1 })
|
|
73
|
+
.endOf('minute')
|
|
74
|
+
.startOf('second');
|
|
75
|
+
if (this._date > prev) {
|
|
76
|
+
this._date = this._date.minus({ hours: 1 });
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
CronDate.prototype.subtractSecond = function() {
|
|
81
|
+
var prev = this._date;
|
|
82
|
+
this._date = this._date
|
|
83
|
+
.minus({ seconds: 1 })
|
|
84
|
+
.startOf('second');
|
|
85
|
+
if (this._date > prev) {
|
|
86
|
+
this._date = this._date.minus({ hours: 1 });
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
CronDate.prototype.getDate = function() {
|
|
91
|
+
return this._date.day;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
CronDate.prototype.getFullYear = function() {
|
|
95
|
+
return this._date.year;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
CronDate.prototype.getDay = function() {
|
|
99
|
+
var weekday = this._date.weekday;
|
|
100
|
+
return weekday == 7 ? 0 : weekday;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
CronDate.prototype.getMonth = function() {
|
|
104
|
+
return this._date.month - 1;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
CronDate.prototype.getHours = function() {
|
|
108
|
+
return this._date.hour;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
CronDate.prototype.getMinutes = function() {
|
|
112
|
+
return this._date.minute;
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
CronDate.prototype.getSeconds = function() {
|
|
116
|
+
return this._date.second;
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
CronDate.prototype.getMilliseconds = function() {
|
|
120
|
+
return this._date.millisecond;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
CronDate.prototype.getTime = function() {
|
|
124
|
+
return this._date.valueOf();
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
CronDate.prototype.getUTCDate = function() {
|
|
128
|
+
return this._getUTC().day;
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
CronDate.prototype.getUTCFullYear = function() {
|
|
132
|
+
return this._getUTC().year;
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
CronDate.prototype.getUTCDay = function() {
|
|
136
|
+
var weekday = this._getUTC().weekday;
|
|
137
|
+
return weekday == 7 ? 0 : weekday;
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
CronDate.prototype.getUTCMonth = function() {
|
|
141
|
+
return this._getUTC().month - 1;
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
CronDate.prototype.getUTCHours = function() {
|
|
145
|
+
return this._getUTC().hour;
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
CronDate.prototype.getUTCMinutes = function() {
|
|
149
|
+
return this._getUTC().minute;
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
CronDate.prototype.getUTCSeconds = function() {
|
|
153
|
+
return this._getUTC().second;
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
CronDate.prototype.toISOString = function() {
|
|
157
|
+
return this._date.toUTC().toISO();
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
CronDate.prototype.toJSON = function() {
|
|
161
|
+
return this._date.toJSON();
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
CronDate.prototype.setDate = function(d) {
|
|
165
|
+
this._date = this._date.set({ day: d });
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
CronDate.prototype.setFullYear = function(y) {
|
|
169
|
+
this._date = this._date.set({ year: y });
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
CronDate.prototype.setDay = function(d) {
|
|
173
|
+
this._date = this._date.set({ weekday: d });
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
CronDate.prototype.setMonth = function(m) {
|
|
177
|
+
this._date = this._date.set({ month: m + 1 });
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
CronDate.prototype.setHours = function(h) {
|
|
181
|
+
this._date = this._date.set({ hour: h });
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
CronDate.prototype.setMinutes = function(m) {
|
|
185
|
+
this._date = this._date.set({ minute: m });
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
CronDate.prototype.setSeconds = function(s) {
|
|
189
|
+
this._date = this._date.set({ second: s });
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
CronDate.prototype.setMilliseconds = function(s) {
|
|
193
|
+
this._date = this._date.set({ millisecond: s });
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
CronDate.prototype._getUTC = function() {
|
|
197
|
+
return this._date.toUTC();
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
CronDate.prototype.toString = function() {
|
|
201
|
+
return this.toDate().toString();
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
CronDate.prototype.toDate = function() {
|
|
205
|
+
return this._date.toJSDate();
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
CronDate.prototype.isLastDayOfMonth = function() {
|
|
209
|
+
//next day
|
|
210
|
+
var newDate = this._date.plus({ days: 1 }).startOf('day');
|
|
211
|
+
return this._date.month !== newDate.month;
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Returns true when the current weekday is the last occurrence of this weekday
|
|
216
|
+
* for the present month.
|
|
217
|
+
*/
|
|
218
|
+
CronDate.prototype.isLastWeekdayOfMonth = function() {
|
|
219
|
+
// Check this by adding 7 days to the current date and seeing if it's
|
|
220
|
+
// a different month
|
|
221
|
+
var newDate = this._date.plus({ days: 7 }).startOf('day');
|
|
222
|
+
return this._date.month !== newDate.month;
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
function CronDate (timestamp, tz) {
|
|
226
|
+
var dateOpts = { zone: tz };
|
|
227
|
+
if (!timestamp) {
|
|
228
|
+
this._date = luxon.DateTime.local();
|
|
229
|
+
} else if (timestamp instanceof CronDate) {
|
|
230
|
+
this._date = timestamp._date;
|
|
231
|
+
} else if (timestamp instanceof Date) {
|
|
232
|
+
this._date = luxon.DateTime.fromJSDate(timestamp, dateOpts);
|
|
233
|
+
} else if (typeof timestamp === 'number') {
|
|
234
|
+
this._date = luxon.DateTime.fromMillis(timestamp, dateOpts);
|
|
235
|
+
} else if (typeof timestamp === 'string') {
|
|
236
|
+
this._date = luxon.DateTime.fromISO(timestamp, dateOpts);
|
|
237
|
+
this._date.isValid || (this._date = luxon.DateTime.fromRFC2822(timestamp, dateOpts));
|
|
238
|
+
this._date.isValid || (this._date = luxon.DateTime.fromSQL(timestamp, dateOpts));
|
|
239
|
+
// RFC2822-like format without the required timezone offset (used in tests)
|
|
240
|
+
this._date.isValid || (this._date = luxon.DateTime.fromFormat(timestamp, 'EEE, d MMM yyyy HH:mm:ss', dateOpts));
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
if (!this._date || !this._date.isValid) {
|
|
244
|
+
throw new Error('CronDate: unhandled timestamp: ' + JSON.stringify(timestamp));
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
if (tz && tz !== this._date.zoneName) {
|
|
248
|
+
this._date = this._date.setZone(tz);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
module.exports = CronDate;
|