bt-core-app 2.2.19 → 2.2.20
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/composables/cron.d.ts +1 -0
- package/dist/composables/cron.mjs +64 -57
- 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
|
@@ -40,6 +40,7 @@ export interface StringCron {
|
|
|
40
40
|
export declare function useCronPredictor(): {
|
|
41
41
|
predictFuture: (options: PredictOptions) => string[];
|
|
42
42
|
};
|
|
43
|
+
export declare function getLeadTime(cronExp?: string): number;
|
|
43
44
|
export declare function useCron(options: UseCronOptions): {
|
|
44
45
|
applyRawExpression: () => void;
|
|
45
46
|
applyRegularity: (v: any) => void;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useAuth as Z } from "./auth.mjs";
|
|
2
|
-
import { appendUrl as A, isNullOrEmpty as q, isLengthyArray as
|
|
3
|
-
import { ref as P, computed as
|
|
2
|
+
import { appendUrl as A, isNullOrEmpty as q, isLengthyArray as I } from "./helpers.mjs";
|
|
3
|
+
import { ref as P, computed as T } from "vue";
|
|
4
4
|
import "../bt-core/core/node_modules/@datasert/cronjs-matcher/dist/index.mjs";
|
|
5
5
|
import { __exports as B } from "../_virtual/index.mjs";
|
|
6
|
-
const
|
|
6
|
+
const b = [
|
|
7
7
|
{ text: "12:00 AM", value: "0.0" },
|
|
8
8
|
{ text: "12:15 AM", value: "0.15" },
|
|
9
9
|
{ text: "12:30 AM", value: "0.30" },
|
|
@@ -134,64 +134,70 @@ const w = [
|
|
|
134
134
|
{ text: "Custom", value: "Custom" }
|
|
135
135
|
];
|
|
136
136
|
function ee() {
|
|
137
|
-
const { timeZone:
|
|
138
|
-
function
|
|
137
|
+
const { timeZone: r } = Z();
|
|
138
|
+
function D(s) {
|
|
139
139
|
if (s.cron == null)
|
|
140
140
|
return [];
|
|
141
|
-
const
|
|
142
|
-
return B.getFutureMatches(
|
|
141
|
+
const k = s.cron.split(/\s+/).slice(0, 5).join(" ");
|
|
142
|
+
return B.getFutureMatches(k, { matchCount: s.futureCount, formatInTimezone: !1, timezone: r.value });
|
|
143
143
|
}
|
|
144
144
|
return {
|
|
145
|
-
predictFuture:
|
|
145
|
+
predictFuture: D
|
|
146
146
|
};
|
|
147
147
|
}
|
|
148
|
-
function te(
|
|
149
|
-
|
|
148
|
+
function te(r) {
|
|
149
|
+
if (r == null)
|
|
150
|
+
return 0;
|
|
151
|
+
const D = r.split(/\s+/);
|
|
152
|
+
return D.length > 5 ? Number.parseInt(D[5].split("-")[0]) : 0;
|
|
153
|
+
}
|
|
154
|
+
function le(r) {
|
|
155
|
+
function D() {
|
|
150
156
|
let e = "0 0 * * 1";
|
|
151
|
-
return
|
|
157
|
+
return r.useLeadTimeLeft && (r.useLeadTimeRight ? e = A(e, `${R.value.toString()}-${E.value.toString()}`, " ") : e = A(e, R.value.toString(), " ")), e;
|
|
152
158
|
}
|
|
153
159
|
const s = P();
|
|
154
|
-
let
|
|
155
|
-
const
|
|
160
|
+
let k = "";
|
|
161
|
+
const N = T({
|
|
156
162
|
get() {
|
|
157
163
|
return s.value;
|
|
158
164
|
},
|
|
159
165
|
set(e) {
|
|
160
|
-
|
|
166
|
+
k = e;
|
|
161
167
|
}
|
|
162
|
-
}), p = P(0),
|
|
168
|
+
}), p = P(0), S = P(0), h = P("Custom"), f = T({
|
|
163
169
|
get() {
|
|
164
170
|
return h.value;
|
|
165
171
|
},
|
|
166
172
|
set(e) {
|
|
167
173
|
h.value !== e && (h.value = e, W(e));
|
|
168
174
|
}
|
|
169
|
-
}),
|
|
170
|
-
function
|
|
171
|
-
|
|
175
|
+
}), w = T(() => r.useLeadTimeInHours ? p.value : p.value / 60), R = T(() => r.useLeadTimeInHours ? p.value * 60 : p.value), E = T(() => r.useLeadTimeInHours ? S.value * 60 : S.value), c = P(), m = P(), d = P(), M = P();
|
|
176
|
+
function O() {
|
|
177
|
+
C(k ?? N.value);
|
|
172
178
|
}
|
|
173
179
|
function W(e) {
|
|
174
180
|
e == "Daily" ? (m.value = ["*"], d.value = ["*"], M.value = ["*"]) : e == "Weekly" ? (console.log("weeklying"), m.value = ["*"], d.value = ["*"], M.value = ["0"]) : e == "Monthly" && (m.value = ["*"], d.value = [_[0].value], M.value = [g[0].value]);
|
|
175
181
|
}
|
|
176
182
|
function j(e, u) {
|
|
177
|
-
var
|
|
183
|
+
var i, l;
|
|
178
184
|
e ?? (e = "0");
|
|
179
185
|
const t = g.findIndex((x) => x.value == e || x.text == e);
|
|
180
186
|
u ?? (u = 0);
|
|
181
|
-
const a = (t + u) % 7,
|
|
182
|
-
return
|
|
187
|
+
const a = (t + u) % 7, n = Math.ceil(u / 7);
|
|
188
|
+
return n > 1 ? `${n} ${(i = g[a]) == null ? void 0 : i.text} Later` : (l = g[a]) == null ? void 0 : l.text;
|
|
183
189
|
}
|
|
184
190
|
function F(e) {
|
|
185
191
|
if (c.value != null) {
|
|
186
|
-
var u =
|
|
192
|
+
var u = b.find((n) => n.value == c.value);
|
|
187
193
|
if (u != null) {
|
|
188
|
-
var t = Number.parseFloat(u.value) +
|
|
194
|
+
var t = Number.parseFloat(u.value) + w.value, a = Math.floor(t / 24);
|
|
189
195
|
return a == 0 ? "Same Day" : e == null ? `${a} Day${a == 1 ? "" : "s"} Later` : j(e, a);
|
|
190
196
|
}
|
|
191
197
|
}
|
|
192
198
|
}
|
|
193
199
|
function U() {
|
|
194
|
-
var
|
|
200
|
+
var n, i;
|
|
195
201
|
var e = {
|
|
196
202
|
regularity: f.value,
|
|
197
203
|
orderDays: [],
|
|
@@ -199,18 +205,18 @@ function te(i) {
|
|
|
199
205
|
};
|
|
200
206
|
if (f.value == "Daily") {
|
|
201
207
|
if (c.value != null) {
|
|
202
|
-
var u =
|
|
208
|
+
var u = b.find((l) => l.value == c.value);
|
|
203
209
|
if (u != null) {
|
|
204
210
|
f.value == "Daily" && e.orderDays.push(u.text);
|
|
205
|
-
var t = Number.parseFloat(u.value) +
|
|
211
|
+
var t = Number.parseFloat(u.value) + w.value, a = Math.floor(t / 24);
|
|
206
212
|
a == 0 ? e.deliveryDays.push("Same Day") : e.deliveryDays.push(`${a} Day${a == 1 ? "" : "s"} Later`);
|
|
207
213
|
}
|
|
208
214
|
}
|
|
209
215
|
} else
|
|
210
|
-
f.value == "Weekly" ? (
|
|
216
|
+
f.value == "Weekly" ? (n = M.value) == null || n.forEach((l) => {
|
|
211
217
|
var x = g.find((y) => y.value == l);
|
|
212
218
|
x != null && (e.orderDays.push(x.text), e.deliveryDays.push(F(l) ?? ""));
|
|
213
|
-
}) : f.value == "Monthly" && ((
|
|
219
|
+
}) : f.value == "Monthly" && ((i = m.value) == null || i.forEach((l) => {
|
|
214
220
|
var x = H.find((y) => y.value == l);
|
|
215
221
|
x != null && (e.orderDays.push(x.text), e.deliveryDays.push(F(void 0) ?? ""));
|
|
216
222
|
}));
|
|
@@ -220,17 +226,17 @@ function te(i) {
|
|
|
220
226
|
var e;
|
|
221
227
|
return (e = s.value) == null ? void 0 : e.split(/\s+/);
|
|
222
228
|
}
|
|
223
|
-
function
|
|
229
|
+
function C(e) {
|
|
224
230
|
if (s.value != e) {
|
|
225
231
|
s.value = e;
|
|
226
|
-
let t = !1, a = !1,
|
|
227
|
-
if (q(s.value) || !
|
|
232
|
+
let t = !1, a = !1, n = !1, i = !1;
|
|
233
|
+
if (q(s.value) || !I(J(), 4))
|
|
228
234
|
t = !0;
|
|
229
235
|
else {
|
|
230
236
|
const l = J();
|
|
231
237
|
t = !1;
|
|
232
238
|
var u = `${l[1]}.${l[0]}`;
|
|
233
|
-
u.includes(",") || u.includes("-") || u.includes("/") ? t = !0 :
|
|
239
|
+
u.includes(",") || u.includes("-") || u.includes("/") ? t = !0 : b.some((v) => v.value == u) ? c.value = u : t = !0;
|
|
234
240
|
const x = l[2];
|
|
235
241
|
if (x.includes("/"))
|
|
236
242
|
t = !0;
|
|
@@ -239,87 +245,88 @@ function te(i) {
|
|
|
239
245
|
else {
|
|
240
246
|
a = !1;
|
|
241
247
|
const v = x.split(",");
|
|
242
|
-
v.some((o) => !_.some((
|
|
248
|
+
v.some((o) => !_.some((L) => L.value == o)) ? t = !0 : d.value = v;
|
|
243
249
|
}
|
|
244
250
|
const y = l[3];
|
|
245
251
|
if (y.includes("-") || y.includes("/"))
|
|
246
252
|
t = !0;
|
|
247
253
|
else if (y == "*")
|
|
248
|
-
|
|
254
|
+
i = !0;
|
|
249
255
|
else {
|
|
250
|
-
|
|
256
|
+
i = !1;
|
|
251
257
|
const v = y.split(",");
|
|
252
|
-
v.some((o) => !H.some((
|
|
258
|
+
v.some((o) => !H.some((L) => L.value == o)) ? t = !0 : m.value = v;
|
|
253
259
|
}
|
|
254
260
|
const $ = l[4];
|
|
255
261
|
if ($.includes("-") || $.includes("/"))
|
|
256
262
|
t = !0;
|
|
257
263
|
else if ($ == "*")
|
|
258
|
-
|
|
264
|
+
n = !0, M.value = g.map((v) => v.value);
|
|
259
265
|
else {
|
|
260
|
-
|
|
266
|
+
n = !1;
|
|
261
267
|
const v = $.split(",");
|
|
262
|
-
v.some((o) => !g.some((
|
|
268
|
+
v.some((o) => !g.some((L) => L.value == o)) ? t = !0 : M.value = v;
|
|
263
269
|
}
|
|
264
|
-
if (
|
|
270
|
+
if (I(l, 5) && r.useLeadTimeLeft) {
|
|
265
271
|
const v = l[5].split("-");
|
|
266
|
-
if (
|
|
272
|
+
if (r.useLeadTimeRight && v.length > 1) {
|
|
267
273
|
const o = Number.parseInt(v[1]);
|
|
268
|
-
|
|
274
|
+
S.value = r.useLeadTimeInHours ? Math.round(o / 60) : o;
|
|
269
275
|
}
|
|
270
276
|
if (v.length > 0) {
|
|
271
277
|
const o = Number.parseInt(v[0]);
|
|
272
|
-
p.value =
|
|
278
|
+
p.value = r.useLeadTimeInHours ? Math.round(o / 60) : o;
|
|
273
279
|
}
|
|
274
280
|
}
|
|
275
281
|
}
|
|
276
|
-
t ? f.value = "Custom" :
|
|
282
|
+
t ? f.value = "Custom" : i && a && n ? h.value = "Daily" : i && a ? h.value = "Weekly" : i ? h.value = "Monthly" : h.value = "Custom";
|
|
277
283
|
}
|
|
278
284
|
return {
|
|
279
|
-
applyRawExpression:
|
|
285
|
+
applyRawExpression: O,
|
|
280
286
|
applyRegularity: W,
|
|
281
287
|
cronExpression: s,
|
|
282
288
|
hour: c,
|
|
283
289
|
leadTimeLeft: p,
|
|
284
|
-
leadTimeRight:
|
|
290
|
+
leadTimeRight: S,
|
|
285
291
|
months: m,
|
|
286
292
|
pack: z,
|
|
287
|
-
rawExpression:
|
|
293
|
+
rawExpression: N,
|
|
288
294
|
regularity: f,
|
|
289
|
-
unpack:
|
|
295
|
+
unpack: C,
|
|
290
296
|
weekdays: M,
|
|
291
297
|
weeks: d
|
|
292
298
|
};
|
|
293
299
|
}
|
|
294
300
|
function z() {
|
|
295
|
-
var u, t, a,
|
|
301
|
+
var u, t, a, n, i, l;
|
|
296
302
|
if (f.value == "Custom")
|
|
297
303
|
return s.value;
|
|
298
304
|
let e = `${(u = c.value) == null ? void 0 : u.split(".")[1]} ${(t = c.value) == null ? void 0 : t.split(".")[0]}`;
|
|
299
|
-
return
|
|
305
|
+
return I(d.value) ? e = A(e, (a = d.value) == null ? void 0 : a.toString(), " ") : e = A(e, "*", " "), I(m.value) ? e = A(e, (n = m.value) == null ? void 0 : n.toString(), " ") : e = A(e, "*", " "), ((i = M.value) == null ? void 0 : i.length) == 7 ? e = A(e, "*", " ") : e = A(e, (l = M.value) == null ? void 0 : l.toString(), " "), e = A(e, `${R.value}-${E.value}`, " "), s.value = e, s.value;
|
|
300
306
|
}
|
|
301
|
-
return
|
|
302
|
-
applyRawExpression:
|
|
307
|
+
return C(r.value ?? r.defaultExpression ?? D()), {
|
|
308
|
+
applyRawExpression: O,
|
|
303
309
|
applyRegularity: W,
|
|
304
310
|
cronExpression: s,
|
|
305
311
|
getRegularityAndOrderAndDeliveryDays: U,
|
|
306
312
|
hour: c,
|
|
307
313
|
leadTimeLeft: p,
|
|
308
|
-
leadTimeRight:
|
|
314
|
+
leadTimeRight: S,
|
|
309
315
|
months: m,
|
|
310
316
|
pack: z,
|
|
311
|
-
rawExpression:
|
|
317
|
+
rawExpression: N,
|
|
312
318
|
regularity: f,
|
|
313
|
-
unpack:
|
|
319
|
+
unpack: C,
|
|
314
320
|
weekdays: M,
|
|
315
321
|
weeks: d
|
|
316
322
|
};
|
|
317
323
|
}
|
|
318
324
|
export {
|
|
319
|
-
|
|
325
|
+
te as getLeadTime,
|
|
326
|
+
b as hourOptions,
|
|
320
327
|
H as monthOptions,
|
|
321
328
|
Y as regularityOptions,
|
|
322
|
-
|
|
329
|
+
le as useCron,
|
|
323
330
|
ee as useCronPredictor,
|
|
324
331
|
_ as weekOptions,
|
|
325
332
|
g as weekdayOptions
|