@web-utils/component 3.8.2 → 3.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/vue-cron/index.mjs +116 -96
- package/web-types.json +1 -1
package/package.json
CHANGED
package/vue-cron/index.mjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
var W = (n, e, t) => new Promise((s, a) => {
|
|
2
|
-
var
|
|
2
|
+
var i = (o) => {
|
|
3
3
|
try {
|
|
4
4
|
c(t.next(o));
|
|
5
5
|
} catch (l) {
|
|
6
6
|
a(l);
|
|
7
7
|
}
|
|
8
|
-
},
|
|
8
|
+
}, r = (o) => {
|
|
9
9
|
try {
|
|
10
10
|
c(t.throw(o));
|
|
11
11
|
} catch (l) {
|
|
12
12
|
a(l);
|
|
13
13
|
}
|
|
14
|
-
}, c = (o) => o.done ? s(o.value) : Promise.resolve(o.value).then(
|
|
14
|
+
}, c = (o) => o.done ? s(o.value) : Promise.resolve(o.value).then(i, r);
|
|
15
15
|
c((t = t.apply(n, e)).next());
|
|
16
16
|
});
|
|
17
17
|
import { formatDate as H } from "@web-utils/integrations/dayjs";
|
|
@@ -114,26 +114,26 @@ function C(n) {
|
|
|
114
114
|
function E(n, e, t) {
|
|
115
115
|
const s = [];
|
|
116
116
|
for (let a of n) {
|
|
117
|
-
let
|
|
118
|
-
a.step > 1 && a.step > (
|
|
117
|
+
let i;
|
|
118
|
+
a.step > 1 && a.step > (i = a.rangeLength(e, t)) && s.push({
|
|
119
119
|
type: S.IncrementLargerThanRange,
|
|
120
|
-
message: `Increment (${a.step}) is larger than range (${
|
|
120
|
+
message: `Increment (${a.step}) is larger than range (${i}) for expression '${a.itemString}'`
|
|
121
121
|
});
|
|
122
122
|
}
|
|
123
123
|
return s;
|
|
124
124
|
}
|
|
125
|
-
class
|
|
125
|
+
class f {
|
|
126
126
|
constructor(e) {
|
|
127
127
|
this.field = e;
|
|
128
128
|
}
|
|
129
129
|
parse() {
|
|
130
|
-
return this.field.split(",").map((e) =>
|
|
130
|
+
return this.field.split(",").map((e) => y.parse(e, this.first, this.last, !0));
|
|
131
131
|
}
|
|
132
132
|
get items() {
|
|
133
133
|
return this._items || (this._items = this.parse()), this._items;
|
|
134
134
|
}
|
|
135
135
|
get values() {
|
|
136
|
-
return
|
|
136
|
+
return f.getValues(this.items, this.first, this.last);
|
|
137
137
|
}
|
|
138
138
|
get warnings() {
|
|
139
139
|
return E(this.items, this.first, this.last);
|
|
@@ -142,18 +142,18 @@ class y {
|
|
|
142
142
|
return Array.from(new Set(b(e, (a) => a.values(t, s)))).sort(w);
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
|
-
class
|
|
145
|
+
class y {
|
|
146
146
|
constructor(e) {
|
|
147
147
|
this.itemString = e, this.step = 1;
|
|
148
148
|
}
|
|
149
149
|
rangeLength(e, t) {
|
|
150
|
-
var s, a,
|
|
151
|
-
const c = (a = (s = this.range) === null || s === void 0 ? void 0 : s.from) !== null && a !== void 0 ? a : e, o = (
|
|
150
|
+
var s, a, i, r;
|
|
151
|
+
const c = (a = (s = this.range) === null || s === void 0 ? void 0 : s.from) !== null && a !== void 0 ? a : e, o = (r = (i = this.range) === null || i === void 0 ? void 0 : i.to) !== null && r !== void 0 ? r : t;
|
|
152
152
|
return o < c ? t - c + (o - e) + 1 : o - c;
|
|
153
153
|
}
|
|
154
154
|
values(e, t) {
|
|
155
155
|
const s = this.range ? this.range.from : e, a = this.rangeLength(e, t);
|
|
156
|
-
return Array(Math.floor(a / this.step) + 1).fill(0).map((
|
|
156
|
+
return Array(Math.floor(a / this.step) + 1).fill(0).map((i, r) => e + (s - e + this.step * r) % (t - e + 1));
|
|
157
157
|
}
|
|
158
158
|
get any() {
|
|
159
159
|
return this.range === void 0 && this.step === 1;
|
|
@@ -161,23 +161,23 @@ class f {
|
|
|
161
161
|
get single() {
|
|
162
162
|
return !!this.range && this.range.from === this.range.to;
|
|
163
163
|
}
|
|
164
|
-
static parse(e, t, s, a = !1,
|
|
165
|
-
var
|
|
166
|
-
const c = new
|
|
164
|
+
static parse(e, t, s, a = !1, i) {
|
|
165
|
+
var r;
|
|
166
|
+
const c = new y(e), [o, l, d, m, p] = (r = e.match(/^(?:(\*)|([0-9]+)|([0-9]+-[0-9]+))(?:\/([1-9][0-9]*))?$/)) !== null && r !== void 0 ? r : [];
|
|
167
167
|
if (!o)
|
|
168
168
|
throw new Error("Field item invalid format");
|
|
169
169
|
if (p && (c.step = parseInt(p, 10)), d) {
|
|
170
170
|
let u = parseInt(d, 10);
|
|
171
|
-
if (u =
|
|
171
|
+
if (u = i ? i(u) : u, u < t || u > s)
|
|
172
172
|
throw new Error("Field item out of valid value range");
|
|
173
173
|
c.range = {
|
|
174
174
|
from: u,
|
|
175
175
|
to: p ? void 0 : u
|
|
176
176
|
};
|
|
177
|
-
} else if (
|
|
178
|
-
const [u, k] =
|
|
177
|
+
} else if (m) {
|
|
178
|
+
const [u, k] = m.split("-").map((N) => {
|
|
179
179
|
const I = parseInt(N, 10);
|
|
180
|
-
return
|
|
180
|
+
return i ? i(I) : I;
|
|
181
181
|
});
|
|
182
182
|
if (u < t || u > s || k < t || k > s || k < u && !a)
|
|
183
183
|
throw new Error("Field item range invalid, either value out of valid range or start greater than end in non wraparound field");
|
|
@@ -189,13 +189,13 @@ class f {
|
|
|
189
189
|
return c;
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
|
-
|
|
193
|
-
class O extends
|
|
192
|
+
y.asterisk = new y("*");
|
|
193
|
+
class O extends f {
|
|
194
194
|
constructor() {
|
|
195
195
|
super(...arguments), this.first = 0, this.last = 59;
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
|
-
class P extends
|
|
198
|
+
class P extends f {
|
|
199
199
|
constructor() {
|
|
200
200
|
super(...arguments), this.first = 0, this.last = 23;
|
|
201
201
|
}
|
|
@@ -203,23 +203,23 @@ class P extends y {
|
|
|
203
203
|
class V {
|
|
204
204
|
constructor(e, t) {
|
|
205
205
|
this.lastDay = !1, this.lastWeekday = !1, this.daysItems = [], this.nearestWeekdayItems = [], this.daysOfWeekItems = [], this.lastDaysOfWeekItems = [], this.nthDaysOfWeekItems = [];
|
|
206
|
-
for (let
|
|
207
|
-
|
|
208
|
-
const s = t.replace(B, (
|
|
209
|
-
for (let
|
|
210
|
-
const
|
|
211
|
-
if (
|
|
212
|
-
this.lastDaysOfWeekItems.push(a(
|
|
213
|
-
else if (
|
|
214
|
-
const c =
|
|
206
|
+
for (let i of e.split(",").map((r) => r === "?" ? "*" : r))
|
|
207
|
+
i === "l" ? this.lastDay = !0 : i === "lw" ? this.lastWeekday = !0 : i.endsWith("w") ? this.nearestWeekdayItems.push(y.parse(i.slice(0, -1), 1, 31)) : this.daysItems.push(y.parse(i, 1, 31));
|
|
208
|
+
const s = t.replace(B, (i) => M.indexOf(i) + ""), a = (i) => y.parse(i, 0, 6, !0, (r) => r === 7 ? 0 : r);
|
|
209
|
+
for (let i of s.split(",").map((r) => r === "?" ? "*" : r)) {
|
|
210
|
+
const r = i.lastIndexOf("#");
|
|
211
|
+
if (i.endsWith("l"))
|
|
212
|
+
this.lastDaysOfWeekItems.push(a(i.slice(0, -1)));
|
|
213
|
+
else if (r !== -1) {
|
|
214
|
+
const c = i.slice(r + 1);
|
|
215
215
|
if (!/^[1-5]$/.test(c))
|
|
216
216
|
throw new Error("Field item nth of month (#) invalid");
|
|
217
217
|
this.nthDaysOfWeekItems.push({
|
|
218
|
-
item: a(
|
|
218
|
+
item: a(i.slice(0, r)),
|
|
219
219
|
nth: parseInt(c, 10)
|
|
220
220
|
});
|
|
221
221
|
} else
|
|
222
|
-
this.daysOfWeekItems.push(a(
|
|
222
|
+
this.daysOfWeekItems.push(a(i));
|
|
223
223
|
}
|
|
224
224
|
}
|
|
225
225
|
get values() {
|
|
@@ -245,30 +245,30 @@ class D {
|
|
|
245
245
|
this.lastDay = !1, this.lastWeekday = !1, this.days = [], this.nearestWeekday = [], this.daysOfWeek = [], this.lastDaysOfWeek = [], this.nthDaysOfWeek = [];
|
|
246
246
|
}
|
|
247
247
|
static fromField(e) {
|
|
248
|
-
const t = new D(), s = (
|
|
249
|
-
t.lastDay = e.lastDay, t.lastWeekday = e.lastWeekday, t.days =
|
|
248
|
+
const t = new D(), s = (i) => i.filter((r) => !r.any);
|
|
249
|
+
t.lastDay = e.lastDay, t.lastWeekday = e.lastWeekday, t.days = f.getValues(e.allDays ? [y.asterisk] : s(e.daysItems), 1, 31), t.nearestWeekday = f.getValues(e.nearestWeekdayItems, 1, 31), t.daysOfWeek = f.getValues(s(e.daysOfWeekItems), 0, 6), t.lastDaysOfWeek = f.getValues(e.lastDaysOfWeekItems, 0, 6);
|
|
250
250
|
const a = /* @__PURE__ */ new Set();
|
|
251
|
-
for (let
|
|
252
|
-
for (let
|
|
253
|
-
let c =
|
|
254
|
-
a.has(c) || (a.add(c), t.nthDaysOfWeek.push([
|
|
251
|
+
for (let i of e.nthDaysOfWeekItems)
|
|
252
|
+
for (let r of i.item.values(0, 6)) {
|
|
253
|
+
let c = r * 10 + i.nth;
|
|
254
|
+
a.has(c) || (a.add(c), t.nthDaysOfWeek.push([r, i.nth]));
|
|
255
255
|
}
|
|
256
256
|
return t;
|
|
257
257
|
}
|
|
258
258
|
getDays(e, t) {
|
|
259
|
-
const s = new Set(this.days), a = new Date(e, t, 0).getDate(),
|
|
259
|
+
const s = new Set(this.days), a = new Date(e, t, 0).getDate(), i = new Date(e, t - 1, 1).getDay(), r = (c) => {
|
|
260
260
|
c > a && (c = a);
|
|
261
|
-
const o = (c +
|
|
261
|
+
const o = (c + i - 1) % 7;
|
|
262
262
|
let l = c + (o === 0 ? 1 : o === 6 ? -1 : 0);
|
|
263
263
|
return l + (l < 1 ? 3 : l > a ? -3 : 0);
|
|
264
264
|
};
|
|
265
|
-
this.lastDay && s.add(a), this.lastWeekday && s.add(
|
|
265
|
+
this.lastDay && s.add(a), this.lastWeekday && s.add(r(a));
|
|
266
266
|
for (const c of this.nearestWeekday)
|
|
267
|
-
s.add(
|
|
267
|
+
s.add(r(c));
|
|
268
268
|
if (this.daysOfWeek.length || this.lastDaysOfWeek.length || this.nthDaysOfWeek.length) {
|
|
269
269
|
const c = Array(7).fill(0).map(() => []);
|
|
270
270
|
for (let o = 1; o < 36; o++)
|
|
271
|
-
c[(o +
|
|
271
|
+
c[(o + i - 1) % 7].push(o);
|
|
272
272
|
for (const o of this.daysOfWeek)
|
|
273
273
|
for (const l of c[o])
|
|
274
274
|
s.add(l);
|
|
@@ -284,17 +284,17 @@ class D {
|
|
|
284
284
|
return Array.from(s).filter((c) => c <= a).sort(w);
|
|
285
285
|
}
|
|
286
286
|
}
|
|
287
|
-
class j extends
|
|
287
|
+
class j extends f {
|
|
288
288
|
constructor(e) {
|
|
289
289
|
super(e.replace(U, (t) => R.indexOf(t) + 1 + "")), this.first = 1, this.last = 12;
|
|
290
290
|
}
|
|
291
291
|
}
|
|
292
|
-
class G extends
|
|
292
|
+
class G extends f {
|
|
293
293
|
constructor(e) {
|
|
294
294
|
super(e), this.first = 1970, this.last = 2099, this.items;
|
|
295
295
|
}
|
|
296
296
|
parse() {
|
|
297
|
-
return this.field.split(",").map((e) =>
|
|
297
|
+
return this.field.split(",").map((e) => y.parse(e, 0, g));
|
|
298
298
|
}
|
|
299
299
|
get warnings() {
|
|
300
300
|
return E(this.items, this.first, g);
|
|
@@ -302,14 +302,14 @@ class G extends y {
|
|
|
302
302
|
nextYear(e) {
|
|
303
303
|
var t;
|
|
304
304
|
return (t = this.items.reduce((s, a) => {
|
|
305
|
-
var
|
|
305
|
+
var i, r, c, o;
|
|
306
306
|
if (a.any)
|
|
307
307
|
s.push(e);
|
|
308
308
|
else if (a.single) {
|
|
309
309
|
const l = a.range.from;
|
|
310
310
|
l >= e && s.push(l);
|
|
311
311
|
} else {
|
|
312
|
-
const l = (
|
|
312
|
+
const l = (r = (i = a.range) === null || i === void 0 ? void 0 : i.from) !== null && r !== void 0 ? r : this.first;
|
|
313
313
|
if (l > e)
|
|
314
314
|
s.push(l);
|
|
315
315
|
else {
|
|
@@ -321,25 +321,25 @@ class G extends y {
|
|
|
321
321
|
}, []).sort(w)[0]) !== null && t !== void 0 ? t : null;
|
|
322
322
|
}
|
|
323
323
|
}
|
|
324
|
-
class
|
|
325
|
-
constructor(e, t = 1, s = 1, a = 0,
|
|
326
|
-
this.year = e, this.month = t, this.day = s, this.hour = a, this.minute =
|
|
324
|
+
class h {
|
|
325
|
+
constructor(e, t = 1, s = 1, a = 0, i = 0, r = 0) {
|
|
326
|
+
this.year = e, this.month = t, this.day = s, this.hour = a, this.minute = i, this.second = r;
|
|
327
327
|
}
|
|
328
328
|
static fromDate(e, t) {
|
|
329
|
-
return t ? t.nativeDateToCronosDate(e) : new
|
|
329
|
+
return t ? t.nativeDateToCronosDate(e) : new h(e.getFullYear(), e.getMonth() + 1, e.getDate(), e.getHours(), e.getMinutes(), e.getSeconds());
|
|
330
330
|
}
|
|
331
331
|
toDate(e) {
|
|
332
332
|
return e ? e.cronosDateToNativeDate(this) : new Date(this.year, this.month - 1, this.day, this.hour, this.minute, this.second);
|
|
333
333
|
}
|
|
334
334
|
static fromUTCTimestamp(e) {
|
|
335
335
|
const t = new Date(e);
|
|
336
|
-
return new
|
|
336
|
+
return new h(t.getUTCFullYear(), t.getUTCMonth() + 1, t.getUTCDate(), t.getUTCHours(), t.getUTCMinutes(), t.getUTCSeconds());
|
|
337
337
|
}
|
|
338
338
|
toUTCTimestamp() {
|
|
339
339
|
return Date.UTC(this.year, this.month - 1, this.day, this.hour, this.minute, this.second);
|
|
340
340
|
}
|
|
341
|
-
copyWith({ year: e = this.year, month: t = this.month, day: s = this.day, hour: a = this.hour, minute:
|
|
342
|
-
return new
|
|
341
|
+
copyWith({ year: e = this.year, month: t = this.month, day: s = this.day, hour: a = this.hour, minute: i = this.minute, second: r = this.second } = {}) {
|
|
342
|
+
return new h(e, t, s, a, i, r);
|
|
343
343
|
}
|
|
344
344
|
}
|
|
345
345
|
const _ = /* @__PURE__ */ new Map();
|
|
@@ -387,48 +387,48 @@ class z {
|
|
|
387
387
|
offset(e) {
|
|
388
388
|
if (!this.dateTimeFormat)
|
|
389
389
|
return this.fixedOffset || 0;
|
|
390
|
-
const t = new Date(e), { year: s, month: a, day:
|
|
390
|
+
const t = new Date(e), { year: s, month: a, day: i, hour: r, minute: c, second: o } = this.nativeDateToCronosDate(t), l = Date.UTC(s, a - 1, i, r, c, o), d = e - e % 1e3;
|
|
391
391
|
return (l - d) / 6e4;
|
|
392
392
|
}
|
|
393
393
|
nativeDateToCronosDate(e) {
|
|
394
|
-
return this.dateTimeFormat ? this.dateTimeFormat.formatToParts ? Q(this.dateTimeFormat, e) : q(this.dateTimeFormat, e) :
|
|
394
|
+
return this.dateTimeFormat ? this.dateTimeFormat.formatToParts ? Q(this.dateTimeFormat, e) : q(this.dateTimeFormat, e) : h.fromUTCTimestamp(e.getTime() + (this.fixedOffset || 0) * 6e4);
|
|
395
395
|
}
|
|
396
396
|
cronosDateToNativeDate(e) {
|
|
397
397
|
if (!this.dateTimeFormat)
|
|
398
398
|
return new Date(e.toUTCTimestamp() - (this.fixedOffset || 0) * 6e4);
|
|
399
399
|
const t = (e.month > 3 || e.month < 11 ? this.summerOffset : this.winterOffset) || 0, s = e.toUTCTimestamp();
|
|
400
400
|
let a = s - t * 6e4;
|
|
401
|
-
const r = this.offset(a);
|
|
402
|
-
if (t === r)
|
|
403
|
-
return new Date(a);
|
|
404
|
-
a -= (r - t) * 6e4;
|
|
405
401
|
const i = this.offset(a);
|
|
406
|
-
|
|
402
|
+
if (t === i)
|
|
403
|
+
return new Date(a);
|
|
404
|
+
a -= (i - t) * 6e4;
|
|
405
|
+
const r = this.offset(a);
|
|
406
|
+
return i === r ? new Date(a) : new Date(s - Math.min(i, r) * 6e4);
|
|
407
407
|
}
|
|
408
408
|
}
|
|
409
409
|
function q(n, e) {
|
|
410
|
-
const t = n.format(e).replace(/\u200E/g, ""), s = t.match(/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/), [, a,
|
|
411
|
-
return new
|
|
410
|
+
const t = n.format(e).replace(/\u200E/g, ""), s = t.match(/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/), [, a, i, r, c, o, l] = (s != null ? s : []).map((d) => parseInt(d, 10));
|
|
411
|
+
return new h(r, a, i, c % 24, o, l);
|
|
412
412
|
}
|
|
413
413
|
function Q(n, e) {
|
|
414
414
|
const t = n.formatToParts(e);
|
|
415
|
-
return new
|
|
415
|
+
return new h(parseInt(t[4].value, 10), parseInt(t[0].value, 10), parseInt(t[2].value, 10), parseInt(t[6].value, 10) % 24, parseInt(t[8].value, 10), parseInt(t[10].value, 10));
|
|
416
416
|
}
|
|
417
417
|
const v = 60 * 60 * 1e3, x = (n, e) => e.findIndex((t) => t >= n);
|
|
418
418
|
class $ {
|
|
419
|
-
constructor(e, t, s, a,
|
|
420
|
-
this.cronString = e, this.seconds = t, this.minutes = s, this.hours = a, this.days =
|
|
419
|
+
constructor(e, t, s, a, i, r, c) {
|
|
420
|
+
this.cronString = e, this.seconds = t, this.minutes = s, this.hours = a, this.days = i, this.months = r, this.years = c, this.skipRepeatedHour = !0, this.missingHour = "insert", this._warnings = null;
|
|
421
421
|
}
|
|
422
422
|
static parse(e, t = {}) {
|
|
423
423
|
var s;
|
|
424
424
|
const a = C(e);
|
|
425
425
|
if (t.strict) {
|
|
426
|
-
let
|
|
427
|
-
if (typeof t.strict == "object" && (
|
|
428
|
-
throw new Error(`Strict mode: Parsing failed with ${
|
|
426
|
+
let r = b(a, (c) => c.warnings);
|
|
427
|
+
if (typeof t.strict == "object" && (r = r.filter((c) => !!t.strict[c.type])), r.length > 0)
|
|
428
|
+
throw new Error(`Strict mode: Parsing failed with ${r.length} warnings`);
|
|
429
429
|
}
|
|
430
|
-
const
|
|
431
|
-
return
|
|
430
|
+
const i = new $(e, a[0].values, a[1].values, a[2].values, a[3].values, a[4].values, a[5]);
|
|
431
|
+
return i.timezone = t.timezone instanceof z ? t.timezone : t.timezone !== void 0 ? new z(t.timezone) : void 0, i.skipRepeatedHour = t.skipRepeatedHour !== void 0 ? t.skipRepeatedHour : i.skipRepeatedHour, i.missingHour = (s = t.missingHour) !== null && s !== void 0 ? s : i.missingHour, i;
|
|
432
432
|
}
|
|
433
433
|
get warnings() {
|
|
434
434
|
if (!this._warnings) {
|
|
@@ -443,15 +443,15 @@ class $ {
|
|
|
443
443
|
tz: (t = (e = this.timezone) === null || e === void 0 ? void 0 : e.toString()) !== null && t !== void 0 ? t : "Local",
|
|
444
444
|
skipRepeatedHour: s && this.skipRepeatedHour.toString(),
|
|
445
445
|
missingHour: s && this.missingHour
|
|
446
|
-
}).map(([
|
|
446
|
+
}).map(([i, r]) => r && i + ": " + r).filter((i) => i).join(", ");
|
|
447
447
|
return `${this.cronString} (${a})`;
|
|
448
448
|
}
|
|
449
449
|
nextDate(e = /* @__PURE__ */ new Date()) {
|
|
450
450
|
var t;
|
|
451
|
-
const s =
|
|
451
|
+
const s = h.fromDate(e, this.timezone);
|
|
452
452
|
if (((t = this.timezone) === null || t === void 0 ? void 0 : t.fixedOffset) !== void 0)
|
|
453
453
|
return this._next(s).date;
|
|
454
|
-
const a = e.getTime(),
|
|
454
|
+
const a = e.getTime(), i = s.toUTCTimestamp(), r = h.fromDate(new Date(a - v), this.timezone).toUTCTimestamp(), c = h.fromDate(new Date(a + v), this.timezone).toUTCTimestamp(), o = c - i === 0, l = i - r === 0, d = i - r === v * 2;
|
|
455
455
|
if (this.skipRepeatedHour && l)
|
|
456
456
|
return this._next(s.copyWith({ minute: 59, second: 60 }), !1).date;
|
|
457
457
|
if (this.missingHour === "offset" && d) {
|
|
@@ -459,8 +459,8 @@ class $ {
|
|
|
459
459
|
if (!u || u.getTime() > a)
|
|
460
460
|
return u;
|
|
461
461
|
}
|
|
462
|
-
let { date:
|
|
463
|
-
return this.missingHour !== "offset" && p &&
|
|
462
|
+
let { date: m, cronosDate: p } = this._next(s);
|
|
463
|
+
return this.missingHour !== "offset" && p && m && p.copyWith({ hour: p.hour + 1 }).toDate(this.timezone).getTime() === m.getTime() ? this.missingHour === "insert" ? p.copyWith({ minute: 0, second: 0 }).toDate(this.timezone) : this._next(p.copyWith({ minute: 59, second: 59 })).date : (this.skipRepeatedHour || (o && (!m || m.getTime() > a + v) && (m = this._next(s.copyWith({ minute: 0, second: 0 }), !1).date), m && m < e && (m = new Date(m.getTime() + v))), m);
|
|
464
464
|
}
|
|
465
465
|
_next(e, t = !0) {
|
|
466
466
|
const s = this._nextYear(t ? e.copyWith({ second: e.second + 1 }) : e);
|
|
@@ -472,11 +472,11 @@ class $ {
|
|
|
472
472
|
nextNDates(e = /* @__PURE__ */ new Date(), t = 5) {
|
|
473
473
|
const s = [];
|
|
474
474
|
let a = e;
|
|
475
|
-
for (let
|
|
476
|
-
const
|
|
477
|
-
if (!
|
|
475
|
+
for (let i = 0; i < t; i++) {
|
|
476
|
+
const r = this.nextDate(a);
|
|
477
|
+
if (!r)
|
|
478
478
|
break;
|
|
479
|
-
a =
|
|
479
|
+
a = r, s.push(r);
|
|
480
480
|
}
|
|
481
481
|
return s;
|
|
482
482
|
}
|
|
@@ -485,7 +485,7 @@ class $ {
|
|
|
485
485
|
for (; !s; ) {
|
|
486
486
|
if (t = this.years.nextYear(t), t === null)
|
|
487
487
|
return null;
|
|
488
|
-
s = this._nextMonth(t === e.year ? e : new
|
|
488
|
+
s = this._nextMonth(t === e.year ? e : new h(t)), t++;
|
|
489
489
|
}
|
|
490
490
|
return s;
|
|
491
491
|
}
|
|
@@ -495,7 +495,7 @@ class $ {
|
|
|
495
495
|
const a = this.months[t];
|
|
496
496
|
if (a === void 0)
|
|
497
497
|
return null;
|
|
498
|
-
s = this._nextDay(a === e.month ? e : new
|
|
498
|
+
s = this._nextDay(a === e.month ? e : new h(e.year, a)), t++;
|
|
499
499
|
}
|
|
500
500
|
return s;
|
|
501
501
|
}
|
|
@@ -503,10 +503,10 @@ class $ {
|
|
|
503
503
|
const t = this.days.getDays(e.year, e.month);
|
|
504
504
|
let s = x(e.day, t), a = null;
|
|
505
505
|
for (; !a; ) {
|
|
506
|
-
const
|
|
507
|
-
if (
|
|
506
|
+
const i = t[s];
|
|
507
|
+
if (i === void 0)
|
|
508
508
|
return null;
|
|
509
|
-
a = this._nextHour(
|
|
509
|
+
a = this._nextHour(i === e.day ? e : new h(e.year, e.month, i)), s++;
|
|
510
510
|
}
|
|
511
511
|
return a;
|
|
512
512
|
}
|
|
@@ -516,7 +516,7 @@ class $ {
|
|
|
516
516
|
const a = this.hours[t];
|
|
517
517
|
if (a === void 0)
|
|
518
518
|
return null;
|
|
519
|
-
s = this._nextMinute(a === e.hour ? e : new
|
|
519
|
+
s = this._nextMinute(a === e.hour ? e : new h(e.year, e.month, e.day, a)), t++;
|
|
520
520
|
}
|
|
521
521
|
return s;
|
|
522
522
|
}
|
|
@@ -526,7 +526,7 @@ class $ {
|
|
|
526
526
|
const a = this.minutes[t];
|
|
527
527
|
if (a === void 0)
|
|
528
528
|
return null;
|
|
529
|
-
s = this._nextSecond(a === e.minute ? e : new
|
|
529
|
+
s = this._nextSecond(a === e.minute ? e : new h(e.year, e.month, e.day, e.hour, a)), t++;
|
|
530
530
|
}
|
|
531
531
|
return s;
|
|
532
532
|
}
|
|
@@ -882,7 +882,7 @@ const Z = {
|
|
|
882
882
|
return W(this, null, function* () {
|
|
883
883
|
const n = `${this.secondsText} ${this.minutesText} ${this.hoursText} ${this.daysText} ${this.monthsText} ${this.weeksText} ${this.yearsText}`;
|
|
884
884
|
try {
|
|
885
|
-
this.runsParser ? this.runs = yield this.runsParser(n) : this.runs = $.parse(n
|
|
885
|
+
this.runsParser ? this.runs = yield this.runsParser(n) : this.runs = $.parse(n).nextNDates(/* @__PURE__ */ new Date(), 5).map((e) => H(e));
|
|
886
886
|
} catch (e) {
|
|
887
887
|
console.error(e), this.runs = [e.message];
|
|
888
888
|
}
|
|
@@ -991,6 +991,26 @@ const Z = {
|
|
|
991
991
|
resolveComma(n, e, t = "3") {
|
|
992
992
|
n.cronEvery = t, n.specificSpecific = e.split(",");
|
|
993
993
|
},
|
|
994
|
+
setSecond(n) {
|
|
995
|
+
var e;
|
|
996
|
+
n === "3" ? (e = this.second.specificSpecific) != null && e.length || (this.second.specificSpecific = [0]) : this.second.specificSpecific = [];
|
|
997
|
+
},
|
|
998
|
+
setMinute(n) {
|
|
999
|
+
var e;
|
|
1000
|
+
n === "3" ? (e = this.minute.specificSpecific) != null && e.length || (this.minute.specificSpecific = [0]) : this.minute.specificSpecific = [];
|
|
1001
|
+
},
|
|
1002
|
+
setHour(n) {
|
|
1003
|
+
var e;
|
|
1004
|
+
n === "3" ? (e = this.hour.specificSpecific) != null && e.length || (this.hour.specificSpecific = [0]) : this.hour.specificSpecific = [];
|
|
1005
|
+
},
|
|
1006
|
+
setMonth(n) {
|
|
1007
|
+
var e;
|
|
1008
|
+
n === "3" ? (e = this.month.specificSpecific) != null && e.length || (this.month.specificSpecific = [1]) : this.month.specificSpecific = [];
|
|
1009
|
+
},
|
|
1010
|
+
setYear(n) {
|
|
1011
|
+
var e;
|
|
1012
|
+
n === "3" ? (e = this.year.specificSpecific) != null && e.length || (this.year.specificSpecific = [(/* @__PURE__ */ new Date()).getFullYear()]) : this.year.specificSpecific = [];
|
|
1013
|
+
},
|
|
994
1014
|
setDay(n) {
|
|
995
1015
|
var e;
|
|
996
1016
|
this.week.cronEvery = "", n === "5" ? (e = this.day.specificSpecific) != null && e.length || (this.day.specificSpecific = [1]) : this.day.specificSpecific = [];
|
|
@@ -1005,7 +1025,7 @@ var J = function() {
|
|
|
1005
1025
|
var e = this, t = e._self._c;
|
|
1006
1026
|
return t("div", { staticClass: "vue-cron" }, [t("ElTabs", { attrs: { type: "border-card" } }, [t("ElTabPane", { scopedSlots: e._u([{ key: "label", fn: function() {
|
|
1007
1027
|
return [t("span", [t("i", { staticClass: "el-icon-date" }), e._v(" " + e._s(e.text.Seconds.name))])];
|
|
1008
|
-
}, proxy: !0 }]) }, [t("ElRadioGroup", { staticClass: "tabBody", model: { value: e.second.cronEvery, callback: function(s) {
|
|
1028
|
+
}, proxy: !0 }]) }, [t("ElRadioGroup", { staticClass: "tabBody", on: { input: e.setSecond }, model: { value: e.second.cronEvery, callback: function(s) {
|
|
1009
1029
|
e.$set(e.second, "cronEvery", s);
|
|
1010
1030
|
}, expression: "second.cronEvery" } }, [t("ElRadio", { attrs: { label: "1" } }, [e._v(e._s(e.text.Seconds.every))]), t("ElRadio", { attrs: { label: "4" } }, [e._v(" " + e._s(e.text.Seconds.cycle[0]) + " "), t("ElInputNumber", { attrs: { size: "small", min: 0, max: 60 }, model: { value: e.second.rangeStart, callback: function(s) {
|
|
1011
1031
|
e.$set(e.second, "rangeStart", s);
|
|
@@ -1021,7 +1041,7 @@ var J = function() {
|
|
|
1021
1041
|
return t("ElOption", { key: s, attrs: { value: s - 1 } }, [e._v(e._s(s - 1))]);
|
|
1022
1042
|
}), 1)], 1)], 1)], 1), t("ElTabPane", { scopedSlots: e._u([{ key: "label", fn: function() {
|
|
1023
1043
|
return [t("span", [t("i", { staticClass: "el-icon-date" }), e._v(" " + e._s(e.text.Minutes.name))])];
|
|
1024
|
-
}, proxy: !0 }]) }, [t("ElRadioGroup", { staticClass: "tabBody", model: { value: e.minute.cronEvery, callback: function(s) {
|
|
1044
|
+
}, proxy: !0 }]) }, [t("ElRadioGroup", { staticClass: "tabBody", on: { input: e.setMinute }, model: { value: e.minute.cronEvery, callback: function(s) {
|
|
1025
1045
|
e.$set(e.minute, "cronEvery", s);
|
|
1026
1046
|
}, expression: "minute.cronEvery" } }, [t("ElRadio", { attrs: { label: "1" } }, [e._v(e._s(e.text.Minutes.every))]), t("ElRadio", { attrs: { label: "4" } }, [e._v(" " + e._s(e.text.Minutes.cycle[0]) + " "), t("ElInputNumber", { attrs: { size: "small", min: 0, max: 60 }, model: { value: e.minute.rangeStart, callback: function(s) {
|
|
1027
1047
|
e.$set(e.minute, "rangeStart", s);
|
|
@@ -1037,7 +1057,7 @@ var J = function() {
|
|
|
1037
1057
|
return t("ElOption", { key: s, attrs: { value: s - 1 } }, [e._v(e._s(s - 1))]);
|
|
1038
1058
|
}), 1)], 1)], 1)], 1), t("ElTabPane", { scopedSlots: e._u([{ key: "label", fn: function() {
|
|
1039
1059
|
return [t("span", [t("i", { staticClass: "el-icon-date" }), e._v(" " + e._s(e.text.Hours.name))])];
|
|
1040
|
-
}, proxy: !0 }]) }, [t("ElRadioGroup", { staticClass: "tabBody", model: { value: e.hour.cronEvery, callback: function(s) {
|
|
1060
|
+
}, proxy: !0 }]) }, [t("ElRadioGroup", { staticClass: "tabBody", on: { input: e.setHour }, model: { value: e.hour.cronEvery, callback: function(s) {
|
|
1041
1061
|
e.$set(e.hour, "cronEvery", s);
|
|
1042
1062
|
}, expression: "hour.cronEvery" } }, [t("ElRadio", { attrs: { label: "1" }, model: { value: e.hour.cronEvery, callback: function(s) {
|
|
1043
1063
|
e.$set(e.hour, "cronEvery", s);
|
|
@@ -1091,7 +1111,7 @@ var J = function() {
|
|
|
1091
1111
|
e.$set(e.day, "cronDaysNearestWeekday", s);
|
|
1092
1112
|
}, expression: "day.cronDaysNearestWeekday" } }), e._v(" " + e._s(e.text.Day.nearestWorkday[1]) + " ")], 1)], 1)], 1), t("ElTabPane", { scopedSlots: e._u([{ key: "label", fn: function() {
|
|
1093
1113
|
return [t("span", [t("i", { staticClass: "el-icon-date" }), e._v(" " + e._s(e.text.Month.name))])];
|
|
1094
|
-
}, proxy: !0 }]) }, [t("ElRadioGroup", { staticClass: "tabBody", model: { value: e.month.cronEvery, callback: function(s) {
|
|
1114
|
+
}, proxy: !0 }]) }, [t("ElRadioGroup", { staticClass: "tabBody", on: { input: e.setMonth }, model: { value: e.month.cronEvery, callback: function(s) {
|
|
1095
1115
|
e.$set(e.month, "cronEvery", s);
|
|
1096
1116
|
}, expression: "month.cronEvery" } }, [t("ElRadio", { attrs: { label: "1" }, model: { value: e.month.cronEvery, callback: function(s) {
|
|
1097
1117
|
e.$set(e.month, "cronEvery", s);
|
|
@@ -1139,7 +1159,7 @@ var J = function() {
|
|
|
1139
1159
|
return t("ElOption", { key: s.value, attrs: { label: s.label, value: s.value } });
|
|
1140
1160
|
}), 1)], 1)], 1)], 1), t("ElTabPane", { scopedSlots: e._u([{ key: "label", fn: function() {
|
|
1141
1161
|
return [t("span", [t("i", { staticClass: "el-icon-date" }), e._v(" " + e._s(e.text.Year.name))])];
|
|
1142
|
-
}, proxy: !0 }]) }, [t("ElRadioGroup", { staticClass: "tabBody", model: { value: e.year.cronEvery, callback: function(s) {
|
|
1162
|
+
}, proxy: !0 }]) }, [t("ElRadioGroup", { staticClass: "tabBody", on: { input: e.setYear }, model: { value: e.year.cronEvery, callback: function(s) {
|
|
1143
1163
|
e.$set(e.year, "cronEvery", s);
|
|
1144
1164
|
}, expression: "year.cronEvery" } }, [t("ElRadio", { attrs: { label: "1" }, model: { value: e.year.cronEvery, callback: function(s) {
|
|
1145
1165
|
e.$set(e.year, "cronEvery", s);
|