@jfdevelops/react-multi-step-form 1.0.0-alpha.7 → 1.0.0-alpha.8
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/index.cjs +12 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +170 -174
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx as Ae, jsxs as
|
|
2
|
-
import
|
|
3
|
-
function
|
|
1
|
+
import { jsx as Ae, jsxs as oe } from "react/jsx-runtime";
|
|
2
|
+
import R from "react";
|
|
3
|
+
function M(o, e, t) {
|
|
4
4
|
const r = [], s = new Set(o), n = t ? t.format(o.map((u) => `${u}`)) : `[${o.join(", ")}]`;
|
|
5
5
|
for (let u = 0; u < e.length; u++) {
|
|
6
6
|
const b = e[u];
|
|
@@ -12,37 +12,37 @@ function U(o, e, t) {
|
|
|
12
12
|
`Array must contain at least one valid element from ${n}`
|
|
13
13
|
), r.length > 0 ? { status: "error", errors: r } : { status: "success" };
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function U(o, e) {
|
|
16
16
|
const t = (r, s) => `❌ ${s + 1}. ${r}`;
|
|
17
17
|
return o.map((r, s) => t(r, s)).join(`
|
|
18
18
|
`);
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function ie(o) {
|
|
21
21
|
return Object.keys(o);
|
|
22
22
|
}
|
|
23
23
|
function Te(o, ...e) {
|
|
24
24
|
return () => String.raw({ raw: o }, ...e);
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function _(o, e, t = Error) {
|
|
27
27
|
if (!o) {
|
|
28
28
|
const r = typeof e == "function" ? e() : Te`${e}`();
|
|
29
29
|
throw new t(r);
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
function
|
|
33
|
-
|
|
32
|
+
function q(o) {
|
|
33
|
+
_(o.includes("step"), "Can't extract a valid step number since");
|
|
34
34
|
const e = o.replace("step", "");
|
|
35
|
-
return
|
|
35
|
+
return _(/^\d+$/.test(e), `Invalid step format: "${o}"`), Number.parseInt(e, 10);
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function Q(o) {
|
|
38
38
|
return function(e) {
|
|
39
39
|
const { step: t } = e, r = `step${t}`, s = o[r];
|
|
40
40
|
return { step: t, data: s };
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
|
-
function
|
|
43
|
+
function G(o, e) {
|
|
44
44
|
return e.reduce((t, r) => {
|
|
45
|
-
const s =
|
|
45
|
+
const s = q(r), { data: n } = Q(o)({
|
|
46
46
|
step: s
|
|
47
47
|
});
|
|
48
48
|
for (const [a, u] of Object.entries(n))
|
|
@@ -62,53 +62,49 @@ function N(o, e) {
|
|
|
62
62
|
for (const a of r)
|
|
63
63
|
n = {
|
|
64
64
|
...n,
|
|
65
|
-
[a]:
|
|
66
|
-
step:
|
|
65
|
+
[a]: Q(o)({
|
|
66
|
+
step: q(a)
|
|
67
67
|
})
|
|
68
68
|
};
|
|
69
|
-
return
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
K(o)({
|
|
73
|
-
step: M(a)
|
|
74
|
-
})
|
|
75
|
-
])
|
|
69
|
+
return G(
|
|
70
|
+
o,
|
|
71
|
+
r
|
|
76
72
|
);
|
|
77
73
|
}
|
|
78
74
|
if (Array.isArray(e))
|
|
79
|
-
return
|
|
75
|
+
return _(
|
|
80
76
|
e.every((n) => r.includes(n)),
|
|
81
77
|
() => {
|
|
82
|
-
const n =
|
|
78
|
+
const n = M(
|
|
83
79
|
e,
|
|
84
|
-
r.map((a) =>
|
|
80
|
+
r.map((a) => q(a)),
|
|
85
81
|
t
|
|
86
82
|
);
|
|
87
83
|
return n.status === "error" ? `${s()}. See errors:
|
|
88
|
-
${
|
|
84
|
+
${U(
|
|
89
85
|
n.errors
|
|
90
86
|
)}` : s();
|
|
91
87
|
}
|
|
92
|
-
),
|
|
88
|
+
), G(
|
|
93
89
|
o,
|
|
94
90
|
e
|
|
95
91
|
);
|
|
96
92
|
if (typeof e == "object") {
|
|
97
93
|
const n = Object.keys(e);
|
|
98
|
-
return
|
|
94
|
+
return _(
|
|
99
95
|
n.every((a) => r.includes(a)),
|
|
100
96
|
() => {
|
|
101
|
-
const a =
|
|
97
|
+
const a = M(
|
|
102
98
|
n,
|
|
103
99
|
r,
|
|
104
100
|
t
|
|
105
101
|
);
|
|
106
102
|
return a.status === "error" ? `${s()}. See errors:
|
|
107
|
-
${
|
|
103
|
+
${U(
|
|
108
104
|
a.errors
|
|
109
105
|
)}` : s();
|
|
110
106
|
}
|
|
111
|
-
),
|
|
107
|
+
), G(
|
|
112
108
|
o,
|
|
113
109
|
n
|
|
114
110
|
);
|
|
@@ -118,20 +114,20 @@ function N(o, e) {
|
|
|
118
114
|
function je(o, e) {
|
|
119
115
|
return typeof o == "function" ? o(e) : o;
|
|
120
116
|
}
|
|
121
|
-
const
|
|
122
|
-
class
|
|
117
|
+
const P = "MultiStepFormSchema";
|
|
118
|
+
class ee {
|
|
123
119
|
debug;
|
|
124
|
-
prefix =
|
|
120
|
+
prefix = P;
|
|
125
121
|
includeTimestamp = !1;
|
|
126
122
|
throwOnError = !1;
|
|
127
123
|
constructor(e) {
|
|
128
124
|
if (this.debug = e?.debug ?? !1, this.debug && e?.debug) {
|
|
129
125
|
const {
|
|
130
126
|
includeTimestamp: t = !1,
|
|
131
|
-
prefix: r =
|
|
127
|
+
prefix: r = P,
|
|
132
128
|
throwOnError: s = !1
|
|
133
129
|
} = e;
|
|
134
|
-
this.includeTimestamp = t, this.prefix = typeof r == "string" ? r : r(
|
|
130
|
+
this.includeTimestamp = t, this.prefix = typeof r == "string" ? r : r(P), this.throwOnError = s;
|
|
135
131
|
}
|
|
136
132
|
}
|
|
137
133
|
wrapValue(e, t) {
|
|
@@ -199,9 +195,9 @@ var C;
|
|
|
199
195
|
function t(i, l, d) {
|
|
200
196
|
const c = l.split(".");
|
|
201
197
|
let h = i;
|
|
202
|
-
for (let
|
|
203
|
-
const $ = c[
|
|
204
|
-
|
|
198
|
+
for (let w = 0; w < c.length; w++) {
|
|
199
|
+
const $ = c[w];
|
|
200
|
+
w === c.length - 1 ? h[$] !== void 0 && typeof h[$] == "object" && typeof d == "object" && d !== null ? Object.assign(h[$], d) : h[$] = d : ((typeof h[$] != "object" || h[$] === null) && (h[$] = {}), h = h[$]);
|
|
205
201
|
}
|
|
206
202
|
return h;
|
|
207
203
|
}
|
|
@@ -215,8 +211,8 @@ var C;
|
|
|
215
211
|
return e(i, d[0]);
|
|
216
212
|
const c = {};
|
|
217
213
|
for (const h of d) {
|
|
218
|
-
const
|
|
219
|
-
t(c, h,
|
|
214
|
+
const w = e(i, h);
|
|
215
|
+
t(c, h, w);
|
|
220
216
|
}
|
|
221
217
|
return c;
|
|
222
218
|
}
|
|
@@ -226,8 +222,8 @@ var C;
|
|
|
226
222
|
function d(c, h = "") {
|
|
227
223
|
if (c == null || typeof c != "object" || Array.isArray(c))
|
|
228
224
|
return;
|
|
229
|
-
const
|
|
230
|
-
for (const $ of
|
|
225
|
+
const w = Object.keys(c);
|
|
226
|
+
for (const $ of w) {
|
|
231
227
|
const T = h ? `${h}.${$}` : $;
|
|
232
228
|
l.push(T);
|
|
233
229
|
const j = c[$];
|
|
@@ -259,13 +255,13 @@ var C;
|
|
|
259
255
|
return i;
|
|
260
256
|
const d = u(l);
|
|
261
257
|
let c = i, h;
|
|
262
|
-
for (const
|
|
258
|
+
for (const w of d) {
|
|
263
259
|
if (!c) break;
|
|
264
260
|
if (typeof c == "function") {
|
|
265
261
|
h = c;
|
|
266
262
|
break;
|
|
267
263
|
}
|
|
268
|
-
if (c = c[
|
|
264
|
+
if (c = c[w], typeof c == "function") {
|
|
269
265
|
h = c;
|
|
270
266
|
break;
|
|
271
267
|
}
|
|
@@ -359,26 +355,26 @@ var C;
|
|
|
359
355
|
}
|
|
360
356
|
return c;
|
|
361
357
|
}
|
|
362
|
-
const
|
|
358
|
+
const w = d || "(root)";
|
|
363
359
|
return typeof i != typeof l ? c.push({
|
|
364
|
-
path:
|
|
365
|
-
expected: S(i,
|
|
360
|
+
path: w,
|
|
361
|
+
expected: S(i, w, h.transformExpected),
|
|
366
362
|
actual: l,
|
|
367
363
|
reason: "type-mismatch"
|
|
368
364
|
}) : h.includeValueMismatch && c.push({
|
|
369
|
-
path:
|
|
370
|
-
expected: S(i,
|
|
365
|
+
path: w,
|
|
366
|
+
expected: S(i, w, h.transformExpected),
|
|
371
367
|
actual: l,
|
|
372
368
|
reason: "value-mismatch"
|
|
373
369
|
}), c;
|
|
374
370
|
}
|
|
375
371
|
function v(i, l, d, c) {
|
|
376
|
-
const h = s(i, ...l),
|
|
377
|
-
return f(h, d, $,
|
|
372
|
+
const h = s(i, ...l), w = [], $ = l.length === 1 ? l[0] : "";
|
|
373
|
+
return f(h, d, $, w, {
|
|
378
374
|
transformExpected: c?.transformExpected
|
|
379
375
|
}), {
|
|
380
|
-
ok:
|
|
381
|
-
mismatches:
|
|
376
|
+
ok: w.length === 0,
|
|
377
|
+
mismatches: w
|
|
382
378
|
};
|
|
383
379
|
}
|
|
384
380
|
o.equalsAtPaths = v;
|
|
@@ -429,17 +425,17 @@ var C;
|
|
|
429
425
|
o.printMismatches = E;
|
|
430
426
|
function O(i, l, d) {
|
|
431
427
|
const c = l.split(".");
|
|
432
|
-
function h(
|
|
433
|
-
const T = c[$], j = Array.isArray(
|
|
428
|
+
function h(w, $) {
|
|
429
|
+
const T = c[$], j = Array.isArray(w) ? [...w] : { ...w };
|
|
434
430
|
if ($ === c.length - 1) {
|
|
435
|
-
let
|
|
436
|
-
return
|
|
437
|
-
...
|
|
431
|
+
let K = w && typeof w == "object" ? j : {};
|
|
432
|
+
return K = {
|
|
433
|
+
...K,
|
|
438
434
|
[T]: d
|
|
439
|
-
},
|
|
435
|
+
}, K;
|
|
440
436
|
}
|
|
441
|
-
const k =
|
|
442
|
-
let V =
|
|
437
|
+
const k = w && typeof w == "object" ? w[T] : void 0, F = h(k ?? {}, $ + 1);
|
|
438
|
+
let V = w && typeof w == "object" ? j : {};
|
|
443
439
|
return V = {
|
|
444
440
|
...V,
|
|
445
441
|
[T]: F
|
|
@@ -452,12 +448,12 @@ var C;
|
|
|
452
448
|
if (c.length === 0) return i;
|
|
453
449
|
let h = i;
|
|
454
450
|
if (c.length === 1) {
|
|
455
|
-
const
|
|
456
|
-
return h = O(h,
|
|
451
|
+
const w = c[0];
|
|
452
|
+
return h = O(h, w, d), h;
|
|
457
453
|
}
|
|
458
|
-
for (const
|
|
459
|
-
const $ = e(d,
|
|
460
|
-
h = O(h,
|
|
454
|
+
for (const w of c) {
|
|
455
|
+
const $ = e(d, w);
|
|
456
|
+
h = O(h, w, $);
|
|
461
457
|
}
|
|
462
458
|
return h;
|
|
463
459
|
}
|
|
@@ -476,7 +472,7 @@ function ge(o, e) {
|
|
|
476
472
|
function Se(o, e) {
|
|
477
473
|
return Object.keys(o).includes(e);
|
|
478
474
|
}
|
|
479
|
-
class
|
|
475
|
+
class te {
|
|
480
476
|
#e;
|
|
481
477
|
#t;
|
|
482
478
|
get value() {
|
|
@@ -490,23 +486,23 @@ class ee {
|
|
|
490
486
|
this.#t(this.enrichValues(e));
|
|
491
487
|
}
|
|
492
488
|
createStepUpdaterFnImpl(e) {
|
|
493
|
-
const { targetStep: t, updater: r, ctxData: s, fields: n = "all", debug: a } = e, u = new
|
|
489
|
+
const { targetStep: t, updater: r, ctxData: s, fields: n = "all", debug: a } = e, u = new ee({
|
|
494
490
|
debug: a,
|
|
495
491
|
prefix: (m) => `${m}:update${t}`
|
|
496
492
|
});
|
|
497
|
-
u.info(`${t} will be updated`),
|
|
493
|
+
u.info(`${t} will be updated`), _(
|
|
498
494
|
Se(this.value, t),
|
|
499
495
|
`[update]: The target step ${t} isn't a valid step. Please select a valid step`
|
|
500
496
|
);
|
|
501
497
|
const { [t]: b, ...S } = this.value;
|
|
502
498
|
let p = { ...this.value }, f = N(p, [t]);
|
|
503
499
|
if (s) {
|
|
504
|
-
|
|
500
|
+
_(
|
|
505
501
|
typeof s == "function",
|
|
506
502
|
'[update]: "ctxData" must be a function'
|
|
507
503
|
), u.info('Custom "ctx" will be used');
|
|
508
504
|
const m = s({ ctx: S });
|
|
509
|
-
|
|
505
|
+
_(
|
|
510
506
|
typeof m == "object" && Object.keys(m).length > 0,
|
|
511
507
|
'[update]: "ctxData" must return an object with keys'
|
|
512
508
|
), u.info(
|
|
@@ -527,12 +523,12 @@ class ee {
|
|
|
527
523
|
update: this.createHelperFnInputUpdate([t])
|
|
528
524
|
});
|
|
529
525
|
if (u.info(`The updated data is ${JSON.stringify(v, null, 2)}`), !n) {
|
|
530
|
-
|
|
526
|
+
_(
|
|
531
527
|
typeof v == "object",
|
|
532
528
|
'[update]: "updater" must be an object or a function that returns an object'
|
|
533
529
|
);
|
|
534
530
|
const m = Object.keys(this.value), g = Object.keys(v);
|
|
535
|
-
|
|
531
|
+
_(g.length === m.length, () => {
|
|
536
532
|
const i = m.filter(
|
|
537
533
|
(d) => !g.includes(d)
|
|
538
534
|
);
|
|
@@ -548,7 +544,7 @@ class ee {
|
|
|
548
544
|
E,
|
|
549
545
|
v
|
|
550
546
|
);
|
|
551
|
-
|
|
547
|
+
_(
|
|
552
548
|
A && O.length === 0,
|
|
553
549
|
`[update]: found value mismatches in ${C.printMismatches({
|
|
554
550
|
mismatches: O,
|
|
@@ -562,18 +558,18 @@ class ee {
|
|
|
562
558
|
}
|
|
563
559
|
const y = C.createDeep(b);
|
|
564
560
|
if (Array.isArray(n)) {
|
|
565
|
-
const m =
|
|
566
|
-
|
|
561
|
+
const m = M(y, n);
|
|
562
|
+
_(
|
|
567
563
|
m.status === "success",
|
|
568
564
|
`[update]: Found errors with the provided fields
|
|
569
|
-
${m.status === "error" ?
|
|
565
|
+
${m.status === "error" ? U(m.errors) : ""}`
|
|
570
566
|
);
|
|
571
567
|
const { mismatches: g, ok: E } = C.equalsAtPaths(
|
|
572
568
|
b,
|
|
573
569
|
n,
|
|
574
570
|
v
|
|
575
571
|
);
|
|
576
|
-
|
|
572
|
+
_(
|
|
577
573
|
E && g.length === 0,
|
|
578
574
|
`[update]: found value mismatches in ${C.printMismatches({
|
|
579
575
|
ok: E,
|
|
@@ -591,21 +587,21 @@ ${m.status === "error" ? R(m.errors) : ""}`
|
|
|
591
587
|
return;
|
|
592
588
|
}
|
|
593
589
|
if (typeof n == "object" && Object.keys(n).length > 0) {
|
|
594
|
-
const m = C.createDeep(n), g =
|
|
590
|
+
const m = C.createDeep(n), g = M(
|
|
595
591
|
y,
|
|
596
592
|
m
|
|
597
593
|
);
|
|
598
|
-
|
|
594
|
+
_(
|
|
599
595
|
g.status === "success",
|
|
600
596
|
`[update]: Found errors with the provided fields
|
|
601
|
-
${g.status === "error" ?
|
|
597
|
+
${g.status === "error" ? U(g.errors) : ""}`
|
|
602
598
|
);
|
|
603
599
|
const { mismatches: E, ok: O } = C.equalsAtPaths(
|
|
604
600
|
b,
|
|
605
601
|
m,
|
|
606
602
|
v
|
|
607
603
|
);
|
|
608
|
-
|
|
604
|
+
_(
|
|
609
605
|
O && E.length === 0,
|
|
610
606
|
`[update]: found value mismatches in ${C.printMismatches({
|
|
611
607
|
ok: O,
|
|
@@ -641,7 +637,7 @@ ${g.status === "error" ? R(g.errors) : ""}`
|
|
|
641
637
|
}
|
|
642
638
|
createHelperFnInputUpdate(e) {
|
|
643
639
|
if (x.isAll(e)) {
|
|
644
|
-
const r =
|
|
640
|
+
const r = ie(this.value).reduce((n, a) => (n[a] = this.createStepUpdaterFn(a), n), {});
|
|
645
641
|
return Object.assign(
|
|
646
642
|
this.update,
|
|
647
643
|
r
|
|
@@ -656,7 +652,7 @@ ${g.status === "error" ? R(g.errors) : ""}`
|
|
|
656
652
|
);
|
|
657
653
|
}
|
|
658
654
|
if (x.isObject(e, t)) {
|
|
659
|
-
const r =
|
|
655
|
+
const r = ie(e).reduce((n, a) => (n[a] = this.createStepUpdaterFn(a), n), {});
|
|
660
656
|
return Object.assign(
|
|
661
657
|
this.update,
|
|
662
658
|
r
|
|
@@ -680,7 +676,7 @@ ${g.status === "error" ? R(g.errors) : ""}`
|
|
|
680
676
|
if (typeof t == "object")
|
|
681
677
|
return (a) => {
|
|
682
678
|
if ("validator" in t) {
|
|
683
|
-
|
|
679
|
+
_(
|
|
684
680
|
typeof a == "object",
|
|
685
681
|
"An input is expected since you provided a validator"
|
|
686
682
|
), ge(
|
|
@@ -757,7 +753,7 @@ const Ce = [
|
|
|
757
753
|
"screaming-snake",
|
|
758
754
|
"flat",
|
|
759
755
|
"kebab"
|
|
760
|
-
],
|
|
756
|
+
], re = "title";
|
|
761
757
|
function ke(o, e) {
|
|
762
758
|
const t = o.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[-_]+/g, " ").trim().split(/\s+/).map((r) => r.toLowerCase());
|
|
763
759
|
switch (e) {
|
|
@@ -788,7 +784,7 @@ function ke(o, e) {
|
|
|
788
784
|
function Y(o) {
|
|
789
785
|
return typeof o != "string" ? !1 : Ce.includes(o);
|
|
790
786
|
}
|
|
791
|
-
function be(o, e =
|
|
787
|
+
function be(o, e = re) {
|
|
792
788
|
return Y(o) ? o : e;
|
|
793
789
|
}
|
|
794
790
|
const Fe = [
|
|
@@ -805,7 +801,7 @@ const Fe = [
|
|
|
805
801
|
function Ve(o) {
|
|
806
802
|
return typeof o == "string" && Fe.includes(o);
|
|
807
803
|
}
|
|
808
|
-
const
|
|
804
|
+
const H = '"window" in undefined. No storage is available', ne = "MultiStepForm";
|
|
809
805
|
class ve {
|
|
810
806
|
key;
|
|
811
807
|
store;
|
|
@@ -815,12 +811,12 @@ class ve {
|
|
|
815
811
|
throwWhenUndefined;
|
|
816
812
|
constructor(e) {
|
|
817
813
|
const { key: t, data: r, store: s, throwWhenUndefined: n = !1 } = e;
|
|
818
|
-
this.log = new
|
|
819
|
-
prefix:
|
|
820
|
-
}), this.key = t, this.data = r, this.throwWhenUndefined = n, s ? (this.store = s, this.shouldRunActions = !0, typeof window > "u" && (this.shouldRunActions = !1, this.log.warn(
|
|
814
|
+
this.log = new ee({
|
|
815
|
+
prefix: ne
|
|
816
|
+
}), this.key = t, this.data = r, this.throwWhenUndefined = n, s ? (this.store = s, this.shouldRunActions = !0, typeof window > "u" && (this.shouldRunActions = !1, this.log.warn(H))) : typeof window < "u" ? (this.store = window.localStorage, this.shouldRunActions = !0) : (this.shouldRunActions = !1, this.log.warn(H));
|
|
821
817
|
}
|
|
822
818
|
throwOnEmptyStore() {
|
|
823
|
-
this.throwWhenUndefined &&
|
|
819
|
+
this.throwWhenUndefined && _(this.store, () => this.shouldRunActions ? H : "No storage available");
|
|
824
820
|
}
|
|
825
821
|
resolveValue(e) {
|
|
826
822
|
if (typeof e == "object")
|
|
@@ -875,7 +871,7 @@ const xe = [
|
|
|
875
871
|
"number",
|
|
876
872
|
"array.string",
|
|
877
873
|
"array.string.untyped"
|
|
878
|
-
],
|
|
874
|
+
], _e = /^step\d+$/i;
|
|
879
875
|
function ue(o, e) {
|
|
880
876
|
if (typeof o != "object" || o === null) return !1;
|
|
881
877
|
for (const t of Object.keys(e)) {
|
|
@@ -891,10 +887,10 @@ function ce(o, e, t) {
|
|
|
891
887
|
function Le(o) {
|
|
892
888
|
const e = {}, { fields: t, defaultCasing: r, validateFields: s } = o;
|
|
893
889
|
for (const [n, a] of Object.entries(t)) {
|
|
894
|
-
|
|
890
|
+
_(
|
|
895
891
|
typeof n == "string",
|
|
896
892
|
`Each key for the "fields" option must be a string. Key ${n} was a ${typeof n}`
|
|
897
|
-
),
|
|
893
|
+
), _(
|
|
898
894
|
typeof a == "object",
|
|
899
895
|
`The value for key ${n} must be an object. Was ${typeof a}`
|
|
900
896
|
);
|
|
@@ -923,16 +919,16 @@ function Le(o) {
|
|
|
923
919
|
s,
|
|
924
920
|
e
|
|
925
921
|
);
|
|
926
|
-
|
|
922
|
+
_(
|
|
927
923
|
typeof n == "object",
|
|
928
924
|
`The result of the validated fields must be an object, was (${typeof n}). This is probably an internal error, so open up an issue about it`
|
|
929
|
-
),
|
|
925
|
+
), _(
|
|
930
926
|
!!n,
|
|
931
927
|
"The result of the validated fields must be defined. This is probably an internal error, so open up an issue about it"
|
|
932
928
|
);
|
|
933
929
|
for (const [a, u] of Object.entries(n)) {
|
|
934
930
|
const b = t[a];
|
|
935
|
-
|
|
931
|
+
_(
|
|
936
932
|
b,
|
|
937
933
|
`No field found in the fields config for "${a}"`
|
|
938
934
|
);
|
|
@@ -952,43 +948,43 @@ function Le(o) {
|
|
|
952
948
|
}
|
|
953
949
|
return e;
|
|
954
950
|
}
|
|
955
|
-
function
|
|
951
|
+
function we(o) {
|
|
956
952
|
const e = {};
|
|
957
|
-
|
|
953
|
+
_(!!o, "The steps config must be defined", TypeError), _(
|
|
958
954
|
typeof o == "object",
|
|
959
955
|
`The steps config must be an object, was (${typeof o})`,
|
|
960
956
|
TypeError
|
|
961
957
|
);
|
|
962
958
|
for (const [t, r] of Object.entries(o)) {
|
|
963
|
-
|
|
959
|
+
_(
|
|
964
960
|
typeof t == "string",
|
|
965
961
|
`Each key for the step config must be a string. Key "${t}" was ${typeof t} `,
|
|
966
962
|
TypeError
|
|
967
|
-
),
|
|
968
|
-
|
|
963
|
+
), _(
|
|
964
|
+
_e.test(t),
|
|
969
965
|
`The key "${t}" isn't formatted properly. Each key in the step config must be the following format: "step{number}"`
|
|
970
966
|
);
|
|
971
967
|
const s = t, {
|
|
972
968
|
fields: n,
|
|
973
969
|
title: a,
|
|
974
|
-
nameTransformCasing: u =
|
|
970
|
+
nameTransformCasing: u = re,
|
|
975
971
|
description: b,
|
|
976
972
|
validateFields: S
|
|
977
973
|
} = r, p = s.toString().replace("step", "");
|
|
978
|
-
|
|
974
|
+
_(
|
|
979
975
|
n,
|
|
980
976
|
`Missing fields for step ${p} (${String(s)})`,
|
|
981
977
|
TypeError
|
|
982
|
-
),
|
|
978
|
+
), _(
|
|
983
979
|
typeof n == "object",
|
|
984
980
|
"Fields must be an object",
|
|
985
981
|
TypeError
|
|
986
|
-
),
|
|
982
|
+
), _(
|
|
987
983
|
Object.keys(n).length > 0,
|
|
988
984
|
`The fields config for step ${p} (${String(
|
|
989
985
|
s
|
|
990
986
|
)}) is empty. Please add a field`
|
|
991
|
-
),
|
|
987
|
+
), _(
|
|
992
988
|
typeof n == "object",
|
|
993
989
|
`The "fields" property must be an object. Was ${typeof n}`
|
|
994
990
|
);
|
|
@@ -1008,7 +1004,7 @@ function _e(o) {
|
|
|
1008
1004
|
}
|
|
1009
1005
|
return e;
|
|
1010
1006
|
}
|
|
1011
|
-
let
|
|
1007
|
+
let se = class extends Ee {
|
|
1012
1008
|
/**
|
|
1013
1009
|
* The original config before any validation or transformations have been applied.
|
|
1014
1010
|
*/
|
|
@@ -1030,12 +1026,12 @@ let ne = class extends Ee {
|
|
|
1030
1026
|
const { steps: t, nameTransformCasing: r, storage: s } = e;
|
|
1031
1027
|
this.defaultNameTransformationCasing = be(
|
|
1032
1028
|
r
|
|
1033
|
-
), this.original = t, this.value =
|
|
1029
|
+
), this.original = t, this.value = we(this.original), this.storage = new ve({
|
|
1034
1030
|
data: this.value,
|
|
1035
|
-
key: s?.key ??
|
|
1031
|
+
key: s?.key ?? ne,
|
|
1036
1032
|
store: s?.store,
|
|
1037
1033
|
throwWhenUndefined: s?.throwWhenUndefined ?? !1
|
|
1038
|
-
}), this.#e = new
|
|
1034
|
+
}), this.#e = new te({
|
|
1039
1035
|
getValue: () => this.value,
|
|
1040
1036
|
setValue: (n) => this.handlePostUpdate(n)
|
|
1041
1037
|
}), this.value = this.#e.enrichValues(this.value), this.stepNumbers = Object.keys(this.value).map(
|
|
@@ -1045,7 +1041,7 @@ let ne = class extends Ee {
|
|
|
1045
1041
|
last: this.lastStep.step,
|
|
1046
1042
|
value: this.stepNumbers,
|
|
1047
1043
|
as: (n) => {
|
|
1048
|
-
if (
|
|
1044
|
+
if (_(
|
|
1049
1045
|
typeof n == "string",
|
|
1050
1046
|
`The type of the target transformation type must be a string, was ${typeof n}`
|
|
1051
1047
|
), n === "string")
|
|
@@ -1064,6 +1060,12 @@ let ne = class extends Ee {
|
|
|
1064
1060
|
isValidStepKey: (n) => Se(this.value, n)
|
|
1065
1061
|
}, this.sync();
|
|
1066
1062
|
}
|
|
1063
|
+
/**
|
|
1064
|
+
* @internal
|
|
1065
|
+
*/
|
|
1066
|
+
__getStorage() {
|
|
1067
|
+
return this.storage;
|
|
1068
|
+
}
|
|
1067
1069
|
getSnapshot() {
|
|
1068
1070
|
return this;
|
|
1069
1071
|
}
|
|
@@ -1071,7 +1073,7 @@ let ne = class extends Ee {
|
|
|
1071
1073
|
* Syncs the values from storage to {@linkcode value}.
|
|
1072
1074
|
*/
|
|
1073
1075
|
sync() {
|
|
1074
|
-
const e = this.
|
|
1076
|
+
const e = this.__getStorage().get();
|
|
1075
1077
|
if (e) {
|
|
1076
1078
|
const t = this.#e.enrichValues(e);
|
|
1077
1079
|
this.value = { ...t };
|
|
@@ -1092,7 +1094,7 @@ let ne = class extends Ee {
|
|
|
1092
1094
|
* @returns The step data for the target step.
|
|
1093
1095
|
*/
|
|
1094
1096
|
get(e) {
|
|
1095
|
-
return
|
|
1097
|
+
return Q(this.value)(e);
|
|
1096
1098
|
}
|
|
1097
1099
|
/**
|
|
1098
1100
|
* Gets the data for the first step.
|
|
@@ -1111,7 +1113,7 @@ let ne = class extends Ee {
|
|
|
1111
1113
|
return this.get({ step: e });
|
|
1112
1114
|
}
|
|
1113
1115
|
handlePostUpdate(e) {
|
|
1114
|
-
this.value = { ...e }, this.
|
|
1116
|
+
this.value = { ...e }, this.__getStorage().add(this.value), this.sync(), this.notify();
|
|
1115
1117
|
}
|
|
1116
1118
|
update(e) {
|
|
1117
1119
|
this.#e.update(e);
|
|
@@ -1162,11 +1164,11 @@ let ne = class extends Ee {
|
|
|
1162
1164
|
const { steps: t, nameTransformCasing: r, storage: s } = e;
|
|
1163
1165
|
this.defaultNameTransformationCasing = be(
|
|
1164
1166
|
r
|
|
1165
|
-
), this.stepSchema = new
|
|
1167
|
+
), this.stepSchema = new se({
|
|
1166
1168
|
steps: t,
|
|
1167
1169
|
nameTransformCasing: this.defaultNameTransformationCasing
|
|
1168
1170
|
}), this.storage = new ve({
|
|
1169
|
-
key: s?.key ??
|
|
1171
|
+
key: s?.key ?? ne,
|
|
1170
1172
|
data: this.stepSchema.value,
|
|
1171
1173
|
store: s?.store,
|
|
1172
1174
|
throwWhenUndefined: s?.throwWhenUndefined ?? !1
|
|
@@ -1238,12 +1240,12 @@ var X;
|
|
|
1238
1240
|
o.DEFAULT_FORM_INSTANCE_ALIAS = "form";
|
|
1239
1241
|
})(X || (X = {}));
|
|
1240
1242
|
function De(o, e) {
|
|
1241
|
-
|
|
1243
|
+
_(
|
|
1242
1244
|
e in o,
|
|
1243
1245
|
`The target step ${e} is not a valid step key`
|
|
1244
1246
|
);
|
|
1245
1247
|
const t = o[e];
|
|
1246
|
-
|
|
1248
|
+
_("fields" in t, `No "fields" were found for ${e}`);
|
|
1247
1249
|
let r = {};
|
|
1248
1250
|
for (const [s, n] of Object.entries(
|
|
1249
1251
|
t.fields
|
|
@@ -1254,13 +1256,13 @@ function De(o, e) {
|
|
|
1254
1256
|
};
|
|
1255
1257
|
return r;
|
|
1256
1258
|
}
|
|
1257
|
-
class Me extends
|
|
1259
|
+
class Me extends se {
|
|
1258
1260
|
// @ts-ignore type doesn't match `MultiStepFormSchemaBase.value`
|
|
1259
1261
|
value;
|
|
1260
1262
|
#e;
|
|
1261
1263
|
constructor(e) {
|
|
1262
1264
|
const { form: t, ...r } = e;
|
|
1263
|
-
super(r), this.value =
|
|
1265
|
+
super(r), this.value = we(this.original), this.#e = new te({
|
|
1264
1266
|
getValue: () => this.value,
|
|
1265
1267
|
setValue: (s) => this.handlePostUpdate(s)
|
|
1266
1268
|
}), this.sync(), this.value = this.#e.enrichValues(this.value, (s) => {
|
|
@@ -1313,25 +1315,25 @@ Original error: ${i}`,
|
|
|
1313
1315
|
else
|
|
1314
1316
|
u[E] = O;
|
|
1315
1317
|
const { defaultId: b, form: S } = t, { ctx: p } = r, [f] = e;
|
|
1316
|
-
|
|
1318
|
+
_(
|
|
1317
1319
|
this.steps.isValidStepKey(f),
|
|
1318
1320
|
`[createComponent]: the target step ${f} is invalid. Note, this error shouldn't appear as the target step should always be valid. If you see this error, please open an issue.`
|
|
1319
1321
|
);
|
|
1320
1322
|
const v = Number.parseInt(f.replace("step", ""));
|
|
1321
|
-
|
|
1323
|
+
_(
|
|
1322
1324
|
!Number.isNaN(v),
|
|
1323
1325
|
`[${f}:"createComponent"]: an error occurred while extracting the number`
|
|
1324
1326
|
);
|
|
1325
1327
|
const y = this.value[f];
|
|
1326
|
-
|
|
1328
|
+
_(
|
|
1327
1329
|
"fields" in y,
|
|
1328
1330
|
`[${f}:createComponent]: unable to find the "fields" for the current step`
|
|
1329
|
-
),
|
|
1331
|
+
), _(
|
|
1330
1332
|
typeof y.fields == "object",
|
|
1331
1333
|
`[${f}:createComponent]: the "fields" property must be an object, was ${typeof y.fields}`
|
|
1332
1334
|
);
|
|
1333
1335
|
const m = Ie((E) => {
|
|
1334
|
-
|
|
1336
|
+
_(typeof E == "string", () => {
|
|
1335
1337
|
const h = new Intl.ListFormat("en", {
|
|
1336
1338
|
style: "long",
|
|
1337
1339
|
type: "disjunction"
|
|
@@ -1339,10 +1341,10 @@ Original error: ${i}`,
|
|
|
1339
1341
|
return `[${f}:Field]: the "name" prop must be a string and a valid field for ${f}. Available fields include ${h.format(
|
|
1340
1342
|
Object.keys(y.fields)
|
|
1341
1343
|
)}`;
|
|
1342
|
-
}),
|
|
1344
|
+
}), _(
|
|
1343
1345
|
E in y.fields,
|
|
1344
1346
|
`[${f}:Field]: the field "${E}" doesn't exist for the current step`
|
|
1345
|
-
),
|
|
1347
|
+
), _(
|
|
1346
1348
|
"update" in y,
|
|
1347
1349
|
`[${f}:Field]: No "update" function was found`
|
|
1348
1350
|
);
|
|
@@ -1399,7 +1401,7 @@ Original error: ${i}`,
|
|
|
1399
1401
|
return m ? { ctx: { ...r, ...m } } : { ctx: r };
|
|
1400
1402
|
}
|
|
1401
1403
|
function y() {
|
|
1402
|
-
return
|
|
1404
|
+
return _(
|
|
1403
1405
|
typeof p == "function",
|
|
1404
1406
|
"The first argument must be a function"
|
|
1405
1407
|
), s(
|
|
@@ -1409,7 +1411,7 @@ Original error: ${i}`,
|
|
|
1409
1411
|
)(p);
|
|
1410
1412
|
}
|
|
1411
1413
|
if (typeof p == "object") {
|
|
1412
|
-
const { useFormInstance: m, ctxData: g, debug: E } = p, O = new
|
|
1414
|
+
const { useFormInstance: m, ctxData: g, debug: E } = p, O = new ee({
|
|
1413
1415
|
debug: E,
|
|
1414
1416
|
prefix(l) {
|
|
1415
1417
|
return `${l}-${u}-createComponent`;
|
|
@@ -1417,28 +1419,28 @@ Original error: ${i}`,
|
|
|
1417
1419
|
});
|
|
1418
1420
|
O.info("First argument is an object");
|
|
1419
1421
|
const { [u]: A, ...i } = a;
|
|
1420
|
-
if (
|
|
1422
|
+
if (_(
|
|
1421
1423
|
typeof f == "function",
|
|
1422
1424
|
"The second argument must be a function"
|
|
1423
1425
|
), m) {
|
|
1424
1426
|
const {
|
|
1425
1427
|
render: l,
|
|
1426
1428
|
alias: d = X.DEFAULT_FORM_INSTANCE_ALIAS
|
|
1427
|
-
} = m, [c] = e, h = n(c),
|
|
1429
|
+
} = m, [c] = e, h = n(c), w = g ? {
|
|
1428
1430
|
...r,
|
|
1429
1431
|
...g({ ctx: i })
|
|
1430
|
-
} : r, $ = { ctx:
|
|
1432
|
+
} : r, $ = { ctx: w, defaultValues: h };
|
|
1431
1433
|
return s(
|
|
1432
1434
|
e,
|
|
1433
1435
|
t,
|
|
1434
|
-
|
|
1436
|
+
w,
|
|
1435
1437
|
{
|
|
1436
1438
|
[d]: () => l($)
|
|
1437
1439
|
}
|
|
1438
1440
|
)(f);
|
|
1439
1441
|
}
|
|
1440
1442
|
if (g) {
|
|
1441
|
-
O.info('Option "ctxData" is defined'),
|
|
1443
|
+
O.info('Option "ctxData" is defined'), _(
|
|
1442
1444
|
typeof g == "function",
|
|
1443
1445
|
'Option "ctxData" must be a function'
|
|
1444
1446
|
);
|
|
@@ -1482,21 +1484,15 @@ Original error: ${i}`,
|
|
|
1482
1484
|
}
|
|
1483
1485
|
}
|
|
1484
1486
|
class Ue extends Ne {
|
|
1487
|
+
// @ts-ignore
|
|
1485
1488
|
stepSchema;
|
|
1486
1489
|
#e;
|
|
1487
1490
|
constructor(e) {
|
|
1488
|
-
const { nameTransformCasing: t =
|
|
1489
|
-
super({
|
|
1490
|
-
nameTransformCasing: t,
|
|
1491
|
-
storage: r,
|
|
1492
|
-
...s
|
|
1493
|
-
}), this.stepSchema = new Me({
|
|
1494
|
-
nameTransformCasing: t,
|
|
1495
|
-
...s
|
|
1496
|
-
}), this.#e = new ee({
|
|
1491
|
+
const { nameTransformCasing: t = re, storage: r, ...s } = e, n = { nameTransformCasing: t, storage: r, ...s };
|
|
1492
|
+
super(n), this.stepSchema = new Me(n), this.#e = new te({
|
|
1497
1493
|
getValue: () => this.stepSchema.value,
|
|
1498
|
-
setValue: (
|
|
1499
|
-
this.stepSchema.value = { ...
|
|
1494
|
+
setValue: (a) => {
|
|
1495
|
+
this.stepSchema.value = { ...a }, this.storage.add(a), this.notify();
|
|
1500
1496
|
}
|
|
1501
1497
|
});
|
|
1502
1498
|
}
|
|
@@ -1517,7 +1513,7 @@ class Ue extends Ne {
|
|
|
1517
1513
|
function Ye(o) {
|
|
1518
1514
|
return new Ue(o);
|
|
1519
1515
|
}
|
|
1520
|
-
var I = { exports: {} },
|
|
1516
|
+
var I = { exports: {} }, W = {}, D = { exports: {} }, B = {};
|
|
1521
1517
|
/**
|
|
1522
1518
|
* @license React
|
|
1523
1519
|
* use-sync-external-store-shim.production.js
|
|
@@ -1529,9 +1525,9 @@ var I = { exports: {} }, B = {}, D = { exports: {} }, J = {};
|
|
|
1529
1525
|
*/
|
|
1530
1526
|
var le;
|
|
1531
1527
|
function Re() {
|
|
1532
|
-
if (le) return
|
|
1528
|
+
if (le) return B;
|
|
1533
1529
|
le = 1;
|
|
1534
|
-
var o =
|
|
1530
|
+
var o = R;
|
|
1535
1531
|
function e(f, v) {
|
|
1536
1532
|
return f === v && (f !== 0 || 1 / f === 1 / v) || f !== f && v !== v;
|
|
1537
1533
|
}
|
|
@@ -1566,9 +1562,9 @@ function Re() {
|
|
|
1566
1562
|
return v();
|
|
1567
1563
|
}
|
|
1568
1564
|
var p = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? S : u;
|
|
1569
|
-
return
|
|
1565
|
+
return B.useSyncExternalStore = o.useSyncExternalStore !== void 0 ? o.useSyncExternalStore : p, B;
|
|
1570
1566
|
}
|
|
1571
|
-
var
|
|
1567
|
+
var J = {};
|
|
1572
1568
|
/**
|
|
1573
1569
|
* @license React
|
|
1574
1570
|
* use-sync-external-store-shim.development.js
|
|
@@ -1627,9 +1623,9 @@ function Ke() {
|
|
|
1627
1623
|
return m();
|
|
1628
1624
|
}
|
|
1629
1625
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
1630
|
-
var s =
|
|
1631
|
-
|
|
1632
|
-
})()),
|
|
1626
|
+
var s = R, n = typeof Object.is == "function" ? Object.is : o, a = s.useState, u = s.useEffect, b = s.useLayoutEffect, S = s.useDebugValue, p = !1, f = !1, v = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? r : e;
|
|
1627
|
+
J.useSyncExternalStore = s.useSyncExternalStore !== void 0 ? s.useSyncExternalStore : v, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
1628
|
+
})()), J;
|
|
1633
1629
|
}
|
|
1634
1630
|
var pe;
|
|
1635
1631
|
function Oe() {
|
|
@@ -1646,14 +1642,14 @@ function Oe() {
|
|
|
1646
1642
|
*/
|
|
1647
1643
|
var de;
|
|
1648
1644
|
function Ge() {
|
|
1649
|
-
if (de) return
|
|
1645
|
+
if (de) return W;
|
|
1650
1646
|
de = 1;
|
|
1651
|
-
var o =
|
|
1647
|
+
var o = R, e = Oe();
|
|
1652
1648
|
function t(S, p) {
|
|
1653
1649
|
return S === p && (S !== 0 || 1 / S === 1 / p) || S !== S && p !== p;
|
|
1654
1650
|
}
|
|
1655
1651
|
var r = typeof Object.is == "function" ? Object.is : t, s = e.useSyncExternalStore, n = o.useRef, a = o.useEffect, u = o.useMemo, b = o.useDebugValue;
|
|
1656
|
-
return
|
|
1652
|
+
return W.useSyncExternalStoreWithSelector = function(S, p, f, v, y) {
|
|
1657
1653
|
var m = n(null);
|
|
1658
1654
|
if (m.current === null) {
|
|
1659
1655
|
var g = { hasValue: !1, value: null };
|
|
@@ -1671,8 +1667,8 @@ function Ge() {
|
|
|
1671
1667
|
return l = c;
|
|
1672
1668
|
}
|
|
1673
1669
|
if (h = l, r(i, c)) return h;
|
|
1674
|
-
var
|
|
1675
|
-
return y !== void 0 && y(h,
|
|
1670
|
+
var w = v(c);
|
|
1671
|
+
return y !== void 0 && y(h, w) ? (i = c, h) : (i = c, l = w);
|
|
1676
1672
|
}
|
|
1677
1673
|
var A = !1, i, l, d = f === void 0 ? null : f;
|
|
1678
1674
|
return [
|
|
@@ -1693,9 +1689,9 @@ function Ge() {
|
|
|
1693
1689
|
},
|
|
1694
1690
|
[E]
|
|
1695
1691
|
), b(E), E;
|
|
1696
|
-
},
|
|
1692
|
+
}, W;
|
|
1697
1693
|
}
|
|
1698
|
-
var
|
|
1694
|
+
var z = {};
|
|
1699
1695
|
/**
|
|
1700
1696
|
* @license React
|
|
1701
1697
|
* use-sync-external-store-shim/with-selector.development.js
|
|
@@ -1712,8 +1708,8 @@ function Pe() {
|
|
|
1712
1708
|
return S === p && (S !== 0 || 1 / S === 1 / p) || S !== S && p !== p;
|
|
1713
1709
|
}
|
|
1714
1710
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
1715
|
-
var e =
|
|
1716
|
-
|
|
1711
|
+
var e = R, t = Oe(), r = typeof Object.is == "function" ? Object.is : o, s = t.useSyncExternalStore, n = e.useRef, a = e.useEffect, u = e.useMemo, b = e.useDebugValue;
|
|
1712
|
+
z.useSyncExternalStoreWithSelector = function(S, p, f, v, y) {
|
|
1717
1713
|
var m = n(null);
|
|
1718
1714
|
if (m.current === null) {
|
|
1719
1715
|
var g = { hasValue: !1, value: null };
|
|
@@ -1732,8 +1728,8 @@ function Pe() {
|
|
|
1732
1728
|
}
|
|
1733
1729
|
if (h = l, r(i, c))
|
|
1734
1730
|
return h;
|
|
1735
|
-
var
|
|
1736
|
-
return y !== void 0 && y(h,
|
|
1731
|
+
var w = v(c);
|
|
1732
|
+
return y !== void 0 && y(h, w) ? (i = c, h) : (i = c, l = w);
|
|
1737
1733
|
}
|
|
1738
1734
|
var A = !1, i, l, d = f === void 0 ? null : f;
|
|
1739
1735
|
return [
|
|
@@ -1755,7 +1751,7 @@ function Pe() {
|
|
|
1755
1751
|
[E]
|
|
1756
1752
|
), b(E), E;
|
|
1757
1753
|
}, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
1758
|
-
})()),
|
|
1754
|
+
})()), z;
|
|
1759
1755
|
}
|
|
1760
1756
|
var me;
|
|
1761
1757
|
function He() {
|
|
@@ -1763,7 +1759,7 @@ function He() {
|
|
|
1763
1759
|
}
|
|
1764
1760
|
var We = He();
|
|
1765
1761
|
function Z(o, e) {
|
|
1766
|
-
|
|
1762
|
+
_(
|
|
1767
1763
|
typeof e == "string",
|
|
1768
1764
|
`The target step must be a string, was ${typeof e}`
|
|
1769
1765
|
);
|
|
@@ -1771,12 +1767,12 @@ function Z(o, e) {
|
|
|
1771
1767
|
type: "disjunction",
|
|
1772
1768
|
style: "long"
|
|
1773
1769
|
}).format(t("array.string.untyped"));
|
|
1774
|
-
|
|
1775
|
-
|
|
1770
|
+
_(
|
|
1771
|
+
_e.test(e),
|
|
1776
1772
|
`The target step must match the following format: "step{number}". Available steps are ${n}`
|
|
1777
1773
|
);
|
|
1778
1774
|
const a = Number.parseInt(e.replace("step", ""));
|
|
1779
|
-
return
|
|
1775
|
+
return _(
|
|
1780
1776
|
r(a),
|
|
1781
1777
|
`The step number "${a}" is not a valid step number. Valid step numbers include ${n}`,
|
|
1782
1778
|
TypeError
|
|
@@ -1816,14 +1812,14 @@ function Ze(o) {
|
|
|
1816
1812
|
function t(u) {
|
|
1817
1813
|
const { targetStep: b, notFoundMessage: S, isDataGuaranteed: p } = u, f = e({
|
|
1818
1814
|
targetStep: b
|
|
1819
|
-
}), v = S ? a({ targetStep: b }, S) : (y) => /* @__PURE__ */
|
|
1815
|
+
}), v = S ? a({ targetStep: b }, S) : (y) => /* @__PURE__ */ oe("div", { ...y, children: [
|
|
1820
1816
|
"No data found for step ",
|
|
1821
1817
|
String(b)
|
|
1822
1818
|
] });
|
|
1823
1819
|
return p ? {
|
|
1824
1820
|
data: f,
|
|
1825
1821
|
NoCurrentData: v
|
|
1826
|
-
} :
|
|
1822
|
+
} : se.hasData(f) ? {
|
|
1827
1823
|
data: f,
|
|
1828
1824
|
hasData: !0,
|
|
1829
1825
|
NoCurrentData: v
|
|
@@ -1844,7 +1840,7 @@ function Ze(o) {
|
|
|
1844
1840
|
} = u, y = Z(o, S), m = y / f * p, g = v ? n(
|
|
1845
1841
|
{ targetStep: S, maxProgressValue: p, totalSteps: f },
|
|
1846
1842
|
v
|
|
1847
|
-
) : (E) => /* @__PURE__ */
|
|
1843
|
+
) : (E) => /* @__PURE__ */ oe("div", { ...E, children: [
|
|
1848
1844
|
"Step ",
|
|
1849
1845
|
y,
|
|
1850
1846
|
"/",
|