bt-core-app 2.2.19 → 2.2.21
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/components/BT-Cron.vue.mjs +283 -235
- package/dist/composables/cron.d.ts +7 -1
- package/dist/composables/cron.mjs +186 -141
- package/dist/composables.mjs +205 -204
- package/dist/index-composables.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +247 -246
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -14,7 +14,11 @@ export declare const weekdayOptions: {
|
|
|
14
14
|
text: string;
|
|
15
15
|
value: string;
|
|
16
16
|
}[];
|
|
17
|
-
export
|
|
17
|
+
export declare const monthdayOptions: {
|
|
18
|
+
text: string;
|
|
19
|
+
value: string;
|
|
20
|
+
}[];
|
|
21
|
+
export type CronRegularity = 'Daily' | 'Weekly' | 'Monthly' | 'Yearly' | 'Custom';
|
|
18
22
|
export declare const regularityOptions: {
|
|
19
23
|
text: string;
|
|
20
24
|
value: string;
|
|
@@ -40,6 +44,7 @@ export interface StringCron {
|
|
|
40
44
|
export declare function useCronPredictor(): {
|
|
41
45
|
predictFuture: (options: PredictOptions) => string[];
|
|
42
46
|
};
|
|
47
|
+
export declare function getLeadTime(cronExp?: string): number;
|
|
43
48
|
export declare function useCron(options: UseCronOptions): {
|
|
44
49
|
applyRawExpression: () => void;
|
|
45
50
|
applyRegularity: (v: any) => void;
|
|
@@ -49,6 +54,7 @@ export declare function useCron(options: UseCronOptions): {
|
|
|
49
54
|
leadTimeLeft: import('vue').Ref<number, number>;
|
|
50
55
|
leadTimeRight: import('vue').Ref<number, number>;
|
|
51
56
|
months: import('vue').Ref<string[] | undefined, string[] | undefined>;
|
|
57
|
+
monthdays: import('vue').Ref<string[] | undefined, string[] | undefined>;
|
|
52
58
|
pack: () => string | undefined;
|
|
53
59
|
rawExpression: import('vue').WritableComputedRef<string | undefined, string | undefined>;
|
|
54
60
|
regularity: import('vue').WritableComputedRef<CronRegularity, CronRegularity>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { useAuth as
|
|
2
|
-
import { appendUrl as
|
|
3
|
-
import { ref as
|
|
1
|
+
import { useAuth as G } from "./auth.mjs";
|
|
2
|
+
import { appendUrl as M, isNullOrEmpty as K, isLengthyArray as L } from "./helpers.mjs";
|
|
3
|
+
import { ref as d, computed as $ } from "vue";
|
|
4
4
|
import "../bt-core/core/node_modules/@datasert/cronjs-matcher/dist/index.mjs";
|
|
5
|
-
import { __exports as
|
|
5
|
+
import { __exports as Q } from "../_virtual/index.mjs";
|
|
6
6
|
const w = [
|
|
7
7
|
{ text: "12:00 AM", value: "0.0" },
|
|
8
8
|
{ text: "12:15 AM", value: "0.15" },
|
|
@@ -100,7 +100,7 @@ const w = [
|
|
|
100
100
|
{ text: "11:15 PM", value: "23.15" },
|
|
101
101
|
{ text: "11:30 PM", value: "23.30" },
|
|
102
102
|
{ text: "11:45 PM", value: "23.45" }
|
|
103
|
-
],
|
|
103
|
+
], j = [
|
|
104
104
|
{ text: "Jan", value: "1" },
|
|
105
105
|
{ text: "Feb", value: "2" },
|
|
106
106
|
{ text: "Mar", value: "3" },
|
|
@@ -113,13 +113,13 @@ const w = [
|
|
|
113
113
|
{ text: "Oct", value: "10" },
|
|
114
114
|
{ text: "Nov", value: "11" },
|
|
115
115
|
{ text: "Dec", value: "12" }
|
|
116
|
-
],
|
|
116
|
+
], U = [
|
|
117
117
|
{ text: "1st", value: "1-7" },
|
|
118
118
|
{ text: "2nd", value: "8-14" },
|
|
119
119
|
{ text: "3rd", value: "15-21" },
|
|
120
120
|
{ text: "4th", value: "22-28" },
|
|
121
121
|
{ text: "5th", value: "29-31" }
|
|
122
|
-
],
|
|
122
|
+
], D = [
|
|
123
123
|
{ text: "Sun", value: "0" },
|
|
124
124
|
{ text: "Mon", value: "1" },
|
|
125
125
|
{ text: "Tue", value: "2" },
|
|
@@ -127,200 +127,245 @@ const w = [
|
|
|
127
127
|
{ text: "Thu", value: "4" },
|
|
128
128
|
{ text: "Fri", value: "5" },
|
|
129
129
|
{ text: "Sat", value: "6" }
|
|
130
|
-
],
|
|
130
|
+
], Z = [
|
|
131
|
+
{ text: "1st", value: "1" },
|
|
132
|
+
{ text: "2nd", value: "2" },
|
|
133
|
+
{ text: "3rd", value: "3" },
|
|
134
|
+
{ text: "4th", value: "4" },
|
|
135
|
+
{ text: "5th", value: "5" },
|
|
136
|
+
{ text: "6th", value: "6" },
|
|
137
|
+
{ text: "7th", value: "7" },
|
|
138
|
+
{ text: "8th", value: "8" },
|
|
139
|
+
{ text: "9th", value: "9" },
|
|
140
|
+
{ text: "10th", value: "10" },
|
|
141
|
+
{ text: "11th", value: "11" },
|
|
142
|
+
{ text: "12th", value: "12" },
|
|
143
|
+
{ text: "13th", value: "13" },
|
|
144
|
+
{ text: "14th", value: "14" },
|
|
145
|
+
{ text: "15th", value: "15" },
|
|
146
|
+
{ text: "16th", value: "16" },
|
|
147
|
+
{ text: "17th", value: "17" },
|
|
148
|
+
{ text: "18th", value: "18" },
|
|
149
|
+
{ text: "19th", value: "19" },
|
|
150
|
+
{ text: "20th", value: "20" },
|
|
151
|
+
{ text: "21th", value: "21" },
|
|
152
|
+
{ text: "22th", value: "22" },
|
|
153
|
+
{ text: "23th", value: "23" },
|
|
154
|
+
{ text: "24th", value: "24" },
|
|
155
|
+
{ text: "25th", value: "25" },
|
|
156
|
+
{ text: "26th", value: "26" },
|
|
157
|
+
{ text: "27th", value: "27" },
|
|
158
|
+
{ text: "28th", value: "28" },
|
|
159
|
+
{ text: "29th", value: "29" },
|
|
160
|
+
{ text: "30th", value: "30" },
|
|
161
|
+
{ text: "31th", value: "31" }
|
|
162
|
+
], ue = [
|
|
131
163
|
{ text: "Daily", value: "Daily" },
|
|
132
164
|
{ text: "Weekly", value: "Weekly" },
|
|
133
165
|
{ text: "Monthly", value: "Monthly" },
|
|
166
|
+
{ text: "Yearly", value: "Yearly" },
|
|
134
167
|
{ text: "Custom", value: "Custom" }
|
|
135
168
|
];
|
|
136
|
-
function
|
|
137
|
-
const { timeZone:
|
|
138
|
-
function
|
|
139
|
-
if (
|
|
169
|
+
function ae() {
|
|
170
|
+
const { timeZone: v } = G();
|
|
171
|
+
function S(r) {
|
|
172
|
+
if (r.cron == null)
|
|
140
173
|
return [];
|
|
141
|
-
const
|
|
142
|
-
return
|
|
174
|
+
const k = r.cron.split(/\s+/).slice(0, 5).join(" ");
|
|
175
|
+
return Q.getFutureMatches(k, { matchCount: r.futureCount, formatInTimezone: !1, timezone: v.value });
|
|
143
176
|
}
|
|
144
177
|
return {
|
|
145
|
-
predictFuture:
|
|
178
|
+
predictFuture: S
|
|
146
179
|
};
|
|
147
180
|
}
|
|
148
|
-
function
|
|
149
|
-
|
|
181
|
+
function ve(v) {
|
|
182
|
+
if (v == null)
|
|
183
|
+
return 0;
|
|
184
|
+
const S = v.split(/\s+/);
|
|
185
|
+
return S.length > 5 ? Number.parseInt(S[5].split("-")[0]) : 0;
|
|
186
|
+
}
|
|
187
|
+
function se(v) {
|
|
188
|
+
function S() {
|
|
150
189
|
let e = "0 0 * * 1";
|
|
151
|
-
return
|
|
190
|
+
return v.useLeadTimeLeft && (v.useLeadTimeRight ? e = M(e, `${E.value.toString()}-${Y.value.toString()}`, " ") : e = M(e, E.value.toString(), " ")), e;
|
|
152
191
|
}
|
|
153
|
-
const
|
|
154
|
-
let
|
|
155
|
-
const
|
|
192
|
+
const r = d();
|
|
193
|
+
let k = "";
|
|
194
|
+
const b = $({
|
|
156
195
|
get() {
|
|
157
|
-
return
|
|
196
|
+
return r.value;
|
|
158
197
|
},
|
|
159
198
|
set(e) {
|
|
160
|
-
|
|
199
|
+
k = e;
|
|
161
200
|
}
|
|
162
|
-
}),
|
|
201
|
+
}), P = d(0), T = d(0), A = d("Custom"), m = $({
|
|
163
202
|
get() {
|
|
164
|
-
return
|
|
203
|
+
return A.value;
|
|
165
204
|
},
|
|
166
205
|
set(e) {
|
|
167
|
-
|
|
206
|
+
A.value !== e && (A.value = e, O(e));
|
|
168
207
|
}
|
|
169
|
-
}),
|
|
170
|
-
function
|
|
171
|
-
|
|
208
|
+
}), F = $(() => v.useLeadTimeInHours ? P.value : P.value / 60), E = $(() => v.useLeadTimeInHours ? P.value * 60 : P.value), Y = $(() => v.useLeadTimeInHours ? T.value * 60 : T.value), y = d(), c = d(), p = d(), h = d(), C = d();
|
|
209
|
+
function J() {
|
|
210
|
+
I(k ?? b.value);
|
|
172
211
|
}
|
|
173
|
-
function
|
|
174
|
-
e == "Daily" ? (
|
|
212
|
+
function O(e) {
|
|
213
|
+
e == "Daily" ? (c.value = ["*"], p.value = ["*"], h.value = ["*"]) : e == "Weekly" ? (c.value = ["*"], p.value = ["*"], h.value = ["0"]) : e == "Monthly" ? (c.value = ["*"], p.value = [U[0].value], h.value = [D[0].value]) : e == "Yearly" && (c.value = ["1"], C.value = [Z[0].value], h.value = ["*"]);
|
|
175
214
|
}
|
|
176
|
-
function
|
|
177
|
-
var
|
|
215
|
+
function q(e, l) {
|
|
216
|
+
var i, s;
|
|
178
217
|
e ?? (e = "0");
|
|
179
|
-
const
|
|
180
|
-
|
|
181
|
-
const a = (
|
|
182
|
-
return
|
|
218
|
+
const u = D.findIndex((n) => n.value == e || n.text == e);
|
|
219
|
+
l ?? (l = 0);
|
|
220
|
+
const a = (u + l) % 7, x = Math.ceil(l / 7);
|
|
221
|
+
return x > 1 ? `${x} ${(i = D[a]) == null ? void 0 : i.text} Later` : (s = D[a]) == null ? void 0 : s.text;
|
|
183
222
|
}
|
|
184
|
-
function
|
|
185
|
-
if (
|
|
186
|
-
var
|
|
187
|
-
if (
|
|
188
|
-
var
|
|
189
|
-
return a == 0 ? "Same Day" : e == null ? `${a} Day${a == 1 ? "" : "s"} Later` :
|
|
223
|
+
function z(e) {
|
|
224
|
+
if (y.value != null) {
|
|
225
|
+
var l = w.find((x) => x.value == y.value);
|
|
226
|
+
if (l != null) {
|
|
227
|
+
var u = Number.parseFloat(l.value) + F.value, a = Math.floor(u / 24);
|
|
228
|
+
return a == 0 ? "Same Day" : e == null ? `${a} Day${a == 1 ? "" : "s"} Later` : q(e, a);
|
|
190
229
|
}
|
|
191
230
|
}
|
|
192
231
|
}
|
|
193
|
-
function
|
|
194
|
-
var
|
|
232
|
+
function B() {
|
|
233
|
+
var x, i;
|
|
195
234
|
var e = {
|
|
196
|
-
regularity:
|
|
235
|
+
regularity: m.value,
|
|
197
236
|
orderDays: [],
|
|
198
237
|
deliveryDays: []
|
|
199
238
|
};
|
|
200
|
-
if (
|
|
201
|
-
if (
|
|
202
|
-
var
|
|
203
|
-
if (
|
|
204
|
-
|
|
205
|
-
var
|
|
239
|
+
if (m.value == "Daily") {
|
|
240
|
+
if (y.value != null) {
|
|
241
|
+
var l = w.find((s) => s.value == y.value);
|
|
242
|
+
if (l != null) {
|
|
243
|
+
m.value == "Daily" && e.orderDays.push(l.text);
|
|
244
|
+
var u = Number.parseFloat(l.value) + F.value, a = Math.floor(u / 24);
|
|
206
245
|
a == 0 ? e.deliveryDays.push("Same Day") : e.deliveryDays.push(`${a} Day${a == 1 ? "" : "s"} Later`);
|
|
207
246
|
}
|
|
208
247
|
}
|
|
209
248
|
} else
|
|
210
|
-
|
|
211
|
-
var
|
|
212
|
-
|
|
213
|
-
}) :
|
|
214
|
-
var
|
|
215
|
-
|
|
249
|
+
m.value == "Weekly" ? (x = h.value) == null || x.forEach((s) => {
|
|
250
|
+
var n = D.find((o) => o.value == s);
|
|
251
|
+
n != null && (e.orderDays.push(n.text), e.deliveryDays.push(z(s) ?? ""));
|
|
252
|
+
}) : m.value == "Monthly" && ((i = c.value) == null || i.forEach((s) => {
|
|
253
|
+
var n = j.find((o) => o.value == s);
|
|
254
|
+
n != null && (e.orderDays.push(n.text), e.deliveryDays.push(z(void 0) ?? ""));
|
|
216
255
|
}));
|
|
217
256
|
return e;
|
|
218
257
|
}
|
|
219
|
-
function
|
|
258
|
+
function H() {
|
|
220
259
|
var e;
|
|
221
|
-
return (e =
|
|
260
|
+
return (e = r.value) == null ? void 0 : e.split(/\s+/);
|
|
222
261
|
}
|
|
223
|
-
function
|
|
224
|
-
if (
|
|
225
|
-
|
|
226
|
-
let
|
|
227
|
-
if (
|
|
228
|
-
|
|
262
|
+
function I(e) {
|
|
263
|
+
if (r.value != e) {
|
|
264
|
+
r.value = e;
|
|
265
|
+
let u = !1, a = !1, x = !1, i = !1, s = !1, n = !1;
|
|
266
|
+
if (K(r.value) || !L(H(), 4))
|
|
267
|
+
u = !0;
|
|
229
268
|
else {
|
|
230
|
-
const
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
else if (x == "*")
|
|
269
|
+
const o = H();
|
|
270
|
+
var l = `${o[1]}.${o[0]}`;
|
|
271
|
+
l.includes(",") || l.includes("-") || l.includes("/") ? u = !0 : w.some((t) => t.value == l) ? y.value = l : u = !0;
|
|
272
|
+
const N = o[2];
|
|
273
|
+
if (N.includes("/"))
|
|
274
|
+
u = !0;
|
|
275
|
+
else if (N == "*")
|
|
238
276
|
a = !0;
|
|
239
277
|
else {
|
|
240
278
|
a = !1;
|
|
241
|
-
const
|
|
242
|
-
|
|
279
|
+
const t = N.split(",");
|
|
280
|
+
t.some((f) => !U.some((g) => g.value == f)) ? n = !0 : p.value = t;
|
|
243
281
|
}
|
|
244
|
-
const
|
|
245
|
-
if (
|
|
246
|
-
|
|
247
|
-
else if (
|
|
248
|
-
|
|
282
|
+
const R = o[3];
|
|
283
|
+
if (R.includes("-") || R.includes("/"))
|
|
284
|
+
u = !0;
|
|
285
|
+
else if (R == "*")
|
|
286
|
+
i = !0;
|
|
249
287
|
else {
|
|
250
|
-
|
|
251
|
-
const
|
|
252
|
-
|
|
288
|
+
i = !1, s = !0;
|
|
289
|
+
const t = R.split(",");
|
|
290
|
+
t.some((f) => !j.some((g) => g.value == f)) ? u = !0 : c.value = t;
|
|
291
|
+
}
|
|
292
|
+
if (s && n) {
|
|
293
|
+
const t = N.split(",");
|
|
294
|
+
t.some((f) => !Z.some((g) => g.value == f)) ? u = !0 : C.value = t;
|
|
253
295
|
}
|
|
254
|
-
const
|
|
255
|
-
if (
|
|
256
|
-
|
|
257
|
-
else if (
|
|
258
|
-
|
|
296
|
+
const W = o[4];
|
|
297
|
+
if (W.includes("-") || W.includes("/"))
|
|
298
|
+
u = !0;
|
|
299
|
+
else if (W == "*")
|
|
300
|
+
x = !0, h.value = D.map((t) => t.value);
|
|
259
301
|
else {
|
|
260
|
-
|
|
261
|
-
const
|
|
262
|
-
|
|
302
|
+
x = !1;
|
|
303
|
+
const t = W.split(",");
|
|
304
|
+
t.some((f) => !D.some((g) => g.value == f)) ? u = !0 : h.value = t;
|
|
263
305
|
}
|
|
264
|
-
if (
|
|
265
|
-
const
|
|
266
|
-
if (
|
|
267
|
-
const
|
|
268
|
-
|
|
306
|
+
if (L(o, 5) && v.useLeadTimeLeft) {
|
|
307
|
+
const t = o[5].split("-");
|
|
308
|
+
if (v.useLeadTimeRight && t.length > 1) {
|
|
309
|
+
const f = Number.parseInt(t[1]);
|
|
310
|
+
T.value = v.useLeadTimeInHours ? Math.round(f / 60) : f;
|
|
269
311
|
}
|
|
270
|
-
if (
|
|
271
|
-
const
|
|
272
|
-
|
|
312
|
+
if (t.length > 0) {
|
|
313
|
+
const f = Number.parseInt(t[0]);
|
|
314
|
+
P.value = v.useLeadTimeInHours ? Math.round(f / 60) : f;
|
|
273
315
|
}
|
|
274
316
|
}
|
|
275
317
|
}
|
|
276
|
-
|
|
318
|
+
u ? m.value = "Custom" : s ? A.value = "Yearly" : i && a && x ? A.value = "Daily" : i && a ? A.value = "Weekly" : i ? A.value = "Monthly" : A.value = "Custom";
|
|
277
319
|
}
|
|
278
320
|
return {
|
|
279
|
-
applyRawExpression:
|
|
280
|
-
applyRegularity:
|
|
281
|
-
cronExpression:
|
|
282
|
-
hour:
|
|
283
|
-
leadTimeLeft:
|
|
284
|
-
leadTimeRight:
|
|
285
|
-
months:
|
|
286
|
-
pack:
|
|
287
|
-
rawExpression:
|
|
288
|
-
regularity:
|
|
289
|
-
unpack:
|
|
290
|
-
weekdays:
|
|
291
|
-
weeks:
|
|
321
|
+
applyRawExpression: J,
|
|
322
|
+
applyRegularity: O,
|
|
323
|
+
cronExpression: r,
|
|
324
|
+
hour: y,
|
|
325
|
+
leadTimeLeft: P,
|
|
326
|
+
leadTimeRight: T,
|
|
327
|
+
months: c,
|
|
328
|
+
pack: _,
|
|
329
|
+
rawExpression: b,
|
|
330
|
+
regularity: m,
|
|
331
|
+
unpack: I,
|
|
332
|
+
weekdays: h,
|
|
333
|
+
weeks: p
|
|
292
334
|
};
|
|
293
335
|
}
|
|
294
|
-
function
|
|
295
|
-
var
|
|
296
|
-
if (
|
|
297
|
-
return
|
|
298
|
-
let e = `${(
|
|
299
|
-
return C
|
|
336
|
+
function _() {
|
|
337
|
+
var l, u, a, x, i, s, n, o;
|
|
338
|
+
if (m.value == "Custom")
|
|
339
|
+
return r.value;
|
|
340
|
+
let e = `${(l = y.value) == null ? void 0 : l.split(".")[1]} ${(u = y.value) == null ? void 0 : u.split(".")[0]}`;
|
|
341
|
+
return m.value == "Yearly" ? (L(C.value) ? e = M(e, (a = C.value) == null ? void 0 : a.toString(), " ") : e = M(e, "*", " "), L(c.value) ? e = M(e, (x = c.value) == null ? void 0 : x.toString(), " ") : e = M(e, "*", " "), e = M(e, "*", " ")) : (L(p.value) ? e = M(e, (i = p.value) == null ? void 0 : i.toString(), " ") : e = M(e, "*", " "), L(c.value) ? e = M(e, (s = c.value) == null ? void 0 : s.toString(), " ") : e = M(e, "*", " "), ((n = h.value) == null ? void 0 : n.length) == 7 ? e = M(e, "*", " ") : e = M(e, (o = h.value) == null ? void 0 : o.toString(), " ")), e = M(e, `${E.value}-${Y.value}`, " "), r.value = e, r.value;
|
|
300
342
|
}
|
|
301
|
-
return
|
|
302
|
-
applyRawExpression:
|
|
303
|
-
applyRegularity:
|
|
304
|
-
cronExpression:
|
|
305
|
-
getRegularityAndOrderAndDeliveryDays:
|
|
306
|
-
hour:
|
|
307
|
-
leadTimeLeft:
|
|
308
|
-
leadTimeRight:
|
|
309
|
-
months:
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
343
|
+
return I(v.value ?? v.defaultExpression ?? S()), {
|
|
344
|
+
applyRawExpression: J,
|
|
345
|
+
applyRegularity: O,
|
|
346
|
+
cronExpression: r,
|
|
347
|
+
getRegularityAndOrderAndDeliveryDays: B,
|
|
348
|
+
hour: y,
|
|
349
|
+
leadTimeLeft: P,
|
|
350
|
+
leadTimeRight: T,
|
|
351
|
+
months: c,
|
|
352
|
+
monthdays: C,
|
|
353
|
+
pack: _,
|
|
354
|
+
rawExpression: b,
|
|
355
|
+
regularity: m,
|
|
356
|
+
unpack: I,
|
|
357
|
+
weekdays: h,
|
|
358
|
+
weeks: p
|
|
316
359
|
};
|
|
317
360
|
}
|
|
318
361
|
export {
|
|
362
|
+
ve as getLeadTime,
|
|
319
363
|
w as hourOptions,
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
364
|
+
j as monthOptions,
|
|
365
|
+
Z as monthdayOptions,
|
|
366
|
+
ue as regularityOptions,
|
|
367
|
+
se as useCron,
|
|
368
|
+
ae as useCronPredictor,
|
|
369
|
+
U as weekOptions,
|
|
370
|
+
D as weekdayOptions
|
|
326
371
|
};
|