sodas-validation-ui 1.2.0 → 1.3.1
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/sodas-validation-ui.js +377 -322
- package/dist/sodas-validation-ui.umd.cjs +1 -1
- package/package.json +1 -1
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { jsx as e, jsxs as s, Fragment as k } from "react/jsx-runtime";
|
|
2
|
-
import { createContext as
|
|
3
|
-
import { Card as f, Button as
|
|
4
|
-
import { VALIDATION_TYPE as y, COMPARISION_OPERATOR as
|
|
2
|
+
import { createContext as Be, useState as T, useMemo as Ve, useContext as _e, useCallback as Q, useEffect as re, useRef as te } from "react";
|
|
3
|
+
import { Card as f, Button as M, Form as c, Nav as L, Modal as B, Popover as se, OverlayTrigger as De, Badge as Pe } from "react-bootstrap";
|
|
4
|
+
import { VALIDATION_TYPE as y, COMPARISION_OPERATOR as de, CUSTOM_CONDITION_TYPE as Te, OUTLIER_METHOD as Ce, EXPECTED_TYPE as z, DATETIME_FORMAT_TYPE as Ae, ColumnGroupedValidationRules as j, createRule as ce, ValidationTemplate as ye, SortOrder as qe } from "sodas-sdk";
|
|
5
5
|
const I = {
|
|
6
6
|
en: {
|
|
7
7
|
byType: "By Type",
|
|
8
8
|
byColumn: "By Column",
|
|
9
|
+
report: "Report",
|
|
9
10
|
append: "Append",
|
|
10
11
|
set: "Set",
|
|
11
12
|
column: "Column",
|
|
@@ -55,6 +56,7 @@ const I = {
|
|
|
55
56
|
ko: {
|
|
56
57
|
byType: "타입별",
|
|
57
58
|
byColumn: "컬럼별",
|
|
59
|
+
report: "레포트",
|
|
58
60
|
append: "추가",
|
|
59
61
|
set: "설정",
|
|
60
62
|
column: "컬럼",
|
|
@@ -102,47 +104,47 @@ const I = {
|
|
|
102
104
|
noFailureInfo: "실패 정보가 없습니다."
|
|
103
105
|
}
|
|
104
106
|
}, U = "ko";
|
|
105
|
-
function
|
|
107
|
+
function me(a, t = {}) {
|
|
106
108
|
return !a || typeof a != "string" ? a : Object.entries(t).reduce(
|
|
107
109
|
(i, [l, n]) => i.replace(new RegExp(`\\{\\{${l}\\}\\}`, "g"), String(n)),
|
|
108
110
|
a
|
|
109
111
|
);
|
|
110
112
|
}
|
|
111
|
-
function
|
|
113
|
+
function je(a = U) {
|
|
112
114
|
const t = I[a] || I[U] || I.en;
|
|
113
115
|
return (i, l) => {
|
|
114
116
|
const n = t[i] ?? I.en?.[i] ?? i;
|
|
115
|
-
return
|
|
117
|
+
return me(n, l);
|
|
116
118
|
};
|
|
117
119
|
}
|
|
118
|
-
const
|
|
120
|
+
const ue = Be({
|
|
119
121
|
locale: U,
|
|
120
122
|
setLocale: () => {
|
|
121
123
|
},
|
|
122
|
-
t:
|
|
124
|
+
t: je()
|
|
123
125
|
});
|
|
124
|
-
function
|
|
125
|
-
const [i, l] =
|
|
126
|
+
function ga({ children: a, locale: t = U }) {
|
|
127
|
+
const [i, l] = T(t), n = Ve(() => {
|
|
126
128
|
const o = I[i] || I[U] || I.en;
|
|
127
129
|
return {
|
|
128
130
|
locale: i,
|
|
129
131
|
setLocale: l,
|
|
130
|
-
t: (r,
|
|
131
|
-
const
|
|
132
|
-
return
|
|
132
|
+
t: (r, m) => {
|
|
133
|
+
const _ = o[r] ?? I.en?.[r] ?? r;
|
|
134
|
+
return me(_, m);
|
|
133
135
|
}
|
|
134
136
|
};
|
|
135
137
|
}, [i]);
|
|
136
|
-
return /* @__PURE__ */ e(
|
|
138
|
+
return /* @__PURE__ */ e(ue.Provider, { value: n, children: a });
|
|
137
139
|
}
|
|
138
|
-
function
|
|
139
|
-
const a =
|
|
140
|
+
function fa() {
|
|
141
|
+
const a = _e(ue);
|
|
140
142
|
if (!a)
|
|
141
143
|
throw new Error("useI18n must be used within I18nProvider");
|
|
142
144
|
return a;
|
|
143
145
|
}
|
|
144
|
-
function
|
|
145
|
-
const a =
|
|
146
|
+
function V() {
|
|
147
|
+
const a = _e(ue);
|
|
146
148
|
if (!a?.t) {
|
|
147
149
|
const t = I[U] || I.en;
|
|
148
150
|
return {
|
|
@@ -151,7 +153,7 @@ function B() {
|
|
|
151
153
|
},
|
|
152
154
|
t: (i, l) => {
|
|
153
155
|
const n = t[i] ?? I.en?.[i] ?? i;
|
|
154
|
-
return
|
|
156
|
+
return me(n, l);
|
|
155
157
|
}
|
|
156
158
|
};
|
|
157
159
|
}
|
|
@@ -174,7 +176,7 @@ const P = {
|
|
|
174
176
|
[y.ALLOWED_VALUES]: "Allowed Values",
|
|
175
177
|
[y.OUTLIER]: "Outlier",
|
|
176
178
|
[y.STATISTICAL]: "Statistical"
|
|
177
|
-
},
|
|
179
|
+
}, le = {
|
|
178
180
|
completeness: "Completeness",
|
|
179
181
|
data_type: "Data Type",
|
|
180
182
|
uniqueness: "Uniqueness",
|
|
@@ -185,7 +187,7 @@ const P = {
|
|
|
185
187
|
outlier: "Outlier",
|
|
186
188
|
statistical: "Statistical",
|
|
187
189
|
custom: "Custom"
|
|
188
|
-
},
|
|
190
|
+
}, Ne = Object.entries(de).map(([a, t]) => ({ value: t, label: a })), Ue = Object.entries(Te).map(([a, t]) => ({ value: t, label: a })), Fe = Object.entries(Ce).map(([a, t]) => ({ value: t, label: a })), Ge = Object.entries(z).map(([a, t]) => ({ value: t, label: a })), $e = Object.entries(Ae).map(([a, t]) => ({ value: t, label: a }));
|
|
189
191
|
function S({ label: a, value: t = "", type: i = "text", onChange: l, options: n, checkbox: o }) {
|
|
190
192
|
return n ? /* @__PURE__ */ s(c.Group, { className: "mb-0 sodas-validation-ui__field", children: [
|
|
191
193
|
/* @__PURE__ */ e(c.Label, { children: a }),
|
|
@@ -222,7 +224,7 @@ function S({ label: a, value: t = "", type: i = "text", onChange: l, options: n,
|
|
|
222
224
|
)
|
|
223
225
|
] });
|
|
224
226
|
}
|
|
225
|
-
function
|
|
227
|
+
function He({ rule: a, type: t, forceUpdate: i }) {
|
|
226
228
|
const l = (n, o) => {
|
|
227
229
|
typeof n == "function" && n.call(a, o), i();
|
|
228
230
|
};
|
|
@@ -296,7 +298,7 @@ function Ge({ rule: a, type: t, forceUpdate: i }) {
|
|
|
296
298
|
{
|
|
297
299
|
label: "Allowed values (comma-separated)",
|
|
298
300
|
value: o,
|
|
299
|
-
onChange: (r) => l(a.setAllowedValues, r.split(",").map((
|
|
301
|
+
onChange: (r) => l(a.setAllowedValues, r.split(",").map((m) => m.trim()).filter(Boolean))
|
|
300
302
|
}
|
|
301
303
|
);
|
|
302
304
|
}
|
|
@@ -318,7 +320,7 @@ function Ge({ rule: a, type: t, forceUpdate: i }) {
|
|
|
318
320
|
{
|
|
319
321
|
label: "Expected type",
|
|
320
322
|
value: n,
|
|
321
|
-
options:
|
|
323
|
+
options: Ge,
|
|
322
324
|
onChange: (o) => l(a.setExpectedType, o)
|
|
323
325
|
}
|
|
324
326
|
),
|
|
@@ -326,8 +328,8 @@ function Ge({ rule: a, type: t, forceUpdate: i }) {
|
|
|
326
328
|
S,
|
|
327
329
|
{
|
|
328
330
|
label: "Datetime format",
|
|
329
|
-
value: a.getDatetimeFormat ??
|
|
330
|
-
options:
|
|
331
|
+
value: a.getDatetimeFormat ?? Ae.YYYY_MM_DD_HH_MM_SS,
|
|
332
|
+
options: $e,
|
|
331
333
|
onChange: (o) => l(a.setDatetimeFormat, o)
|
|
332
334
|
}
|
|
333
335
|
)
|
|
@@ -339,8 +341,8 @@ function Ge({ rule: a, type: t, forceUpdate: i }) {
|
|
|
339
341
|
S,
|
|
340
342
|
{
|
|
341
343
|
label: "Method",
|
|
342
|
-
value: a.getMethod ??
|
|
343
|
-
options:
|
|
344
|
+
value: a.getMethod ?? Ce.Z_SCORE,
|
|
345
|
+
options: Fe,
|
|
344
346
|
onChange: (n) => l(a.setMethod, n)
|
|
345
347
|
}
|
|
346
348
|
),
|
|
@@ -377,8 +379,8 @@ function Ge({ rule: a, type: t, forceUpdate: i }) {
|
|
|
377
379
|
S,
|
|
378
380
|
{
|
|
379
381
|
label: "Comparison",
|
|
380
|
-
value: a.getComparision ??
|
|
381
|
-
options:
|
|
382
|
+
value: a.getComparision ?? de.EQUAL,
|
|
383
|
+
options: Ne,
|
|
382
384
|
onChange: (n) => l(a.setComparision, n)
|
|
383
385
|
}
|
|
384
386
|
)
|
|
@@ -390,8 +392,8 @@ function Ge({ rule: a, type: t, forceUpdate: i }) {
|
|
|
390
392
|
S,
|
|
391
393
|
{
|
|
392
394
|
label: "Condition type",
|
|
393
|
-
value: n.type ??
|
|
394
|
-
options:
|
|
395
|
+
value: n.type ?? Te.ALL,
|
|
396
|
+
options: Ue,
|
|
395
397
|
onChange: (o) => l(a.setCondition, {
|
|
396
398
|
...n,
|
|
397
399
|
type: o
|
|
@@ -414,8 +416,8 @@ function Ge({ rule: a, type: t, forceUpdate: i }) {
|
|
|
414
416
|
S,
|
|
415
417
|
{
|
|
416
418
|
label: "Comparison",
|
|
417
|
-
value: n.comparision ??
|
|
418
|
-
options:
|
|
419
|
+
value: n.comparision ?? de.EQUAL,
|
|
420
|
+
options: Ne,
|
|
419
421
|
onChange: (o) => l(a.setCondition, {
|
|
420
422
|
...n,
|
|
421
423
|
comparision: o
|
|
@@ -431,7 +433,7 @@ function Ge({ rule: a, type: t, forceUpdate: i }) {
|
|
|
431
433
|
function R(a, t, i) {
|
|
432
434
|
return a == null ? void 0 : a[t] ?? a[i];
|
|
433
435
|
}
|
|
434
|
-
function
|
|
436
|
+
function Ye({ rule: a, type: t }) {
|
|
435
437
|
switch (t ?? R(a, "getType", "type")) {
|
|
436
438
|
case y.UNIQUENESS:
|
|
437
439
|
case "uniqueness":
|
|
@@ -493,91 +495,91 @@ function He({ rule: a, type: t }) {
|
|
|
493
495
|
return null;
|
|
494
496
|
}
|
|
495
497
|
}
|
|
496
|
-
function
|
|
497
|
-
const { t: i } =
|
|
498
|
+
function ne({ rule: a, showColumn: t = !0 }) {
|
|
499
|
+
const { t: i } = V(), l = a?.getType ?? a?.type;
|
|
498
500
|
return /* @__PURE__ */ e("div", { className: "sodas-validation-ui__rule-display", children: /* @__PURE__ */ s("div", { className: "d-flex flex-wrap gap-2 align-items-end sodas-validation-ui__rule-fields-row", children: [
|
|
499
501
|
/* @__PURE__ */ s("div", { className: "d-flex flex-wrap gap-2 sodas-validation-ui__fields", children: [
|
|
500
502
|
t && /* @__PURE__ */ e(A, { label: i("column"), value: a?.getColumn ?? a?.column ?? "—" }),
|
|
501
503
|
/* @__PURE__ */ e(A, { label: i("name"), value: a?.getName ?? a?.name ?? "—" })
|
|
502
504
|
] }),
|
|
503
|
-
/* @__PURE__ */ e("div", { className: "d-flex flex-wrap gap-2 sodas-validation-ui__type-fields", children: /* @__PURE__ */ e(
|
|
505
|
+
/* @__PURE__ */ e("div", { className: "d-flex flex-wrap gap-2 sodas-validation-ui__type-fields", children: /* @__PURE__ */ e(Ye, { rule: a, type: l }) })
|
|
504
506
|
] }) });
|
|
505
507
|
}
|
|
506
|
-
function
|
|
507
|
-
const { t:
|
|
508
|
+
function Se({ rule: a, index: t, onRemove: i, onCommonChange: l, forceUpdate: n, showColumn: o = !0, showType: r = !0 }) {
|
|
509
|
+
const { t: m } = V(), _ = a.getType;
|
|
508
510
|
return /* @__PURE__ */ e(f, { className: "sodas-validation-ui__rule-card", children: /* @__PURE__ */ e(f.Body, { children: /* @__PURE__ */ s("div", { className: "d-flex flex-wrap gap-2 align-items-start sodas-validation-ui__rule-fields-row", children: [
|
|
509
|
-
r && /* @__PURE__ */ e(f.Title, { className: "mb-0 fs-6", children: P[
|
|
511
|
+
r && /* @__PURE__ */ e(f.Title, { className: "mb-0 fs-6", children: P[_] ?? _ }),
|
|
510
512
|
/* @__PURE__ */ s("div", { className: "d-flex flex-wrap gap-2 align-items-end flex-grow-1 min-w-0", children: [
|
|
511
513
|
/* @__PURE__ */ s("div", { className: "d-flex flex-wrap gap-2 sodas-validation-ui__fields", children: [
|
|
512
|
-
o && /* @__PURE__ */ e(S, { label:
|
|
513
|
-
/* @__PURE__ */ e(S, { label:
|
|
514
|
+
o && /* @__PURE__ */ e(S, { label: m("column"), value: a.getColumn, onChange: (p) => l(a, "column", p) }),
|
|
515
|
+
/* @__PURE__ */ e(S, { label: m("name"), value: a.getName, onChange: (p) => l(a, "name", p) })
|
|
514
516
|
] }),
|
|
515
|
-
/* @__PURE__ */ e("div", { className: "d-flex flex-wrap gap-2 sodas-validation-ui__type-fields", children: /* @__PURE__ */ e(
|
|
517
|
+
/* @__PURE__ */ e("div", { className: "d-flex flex-wrap gap-2 sodas-validation-ui__type-fields", children: /* @__PURE__ */ e(He, { rule: a, type: _, forceUpdate: n }) })
|
|
516
518
|
] }),
|
|
517
519
|
/* @__PURE__ */ e(
|
|
518
|
-
|
|
520
|
+
M,
|
|
519
521
|
{
|
|
520
522
|
variant: "danger",
|
|
521
523
|
size: "sm",
|
|
522
524
|
className: "flex-shrink-0",
|
|
523
525
|
onClick: i,
|
|
524
|
-
"aria-label": `${
|
|
525
|
-
children:
|
|
526
|
+
"aria-label": `${m("removeRule")} ${t + 1}`,
|
|
527
|
+
children: m("remove")
|
|
526
528
|
}
|
|
527
529
|
)
|
|
528
530
|
] }) }) });
|
|
529
531
|
}
|
|
530
|
-
function
|
|
532
|
+
function $(a, t) {
|
|
531
533
|
if (!Array.isArray(t)) return;
|
|
532
534
|
const i = a.toValidationRules();
|
|
533
535
|
t.length = 0, t.push(...i);
|
|
534
536
|
}
|
|
535
|
-
function
|
|
536
|
-
const [, a] =
|
|
537
|
+
function ze() {
|
|
538
|
+
const [, a] = T(0);
|
|
537
539
|
return Q(() => a((t) => t + 1), []);
|
|
538
540
|
}
|
|
539
|
-
function
|
|
540
|
-
const { t } =
|
|
541
|
+
function Qe({ validationRules: a }) {
|
|
542
|
+
const { t } = V(), [i, l] = T(
|
|
541
543
|
() => Array.isArray(a) ? j.fromValidationRules(a) : j.fromValidationRules([])
|
|
542
|
-
), n =
|
|
544
|
+
), n = ze(), [o, r] = T("");
|
|
543
545
|
if (!Array.isArray(a))
|
|
544
546
|
return /* @__PURE__ */ e("div", { className: "alert alert-danger sodas-validation-ui sodas-validation-ui--empty", children: t("validationRulesMustBeArray") });
|
|
545
|
-
const
|
|
547
|
+
const m = i.getColumnNames(), _ = (d) => {
|
|
546
548
|
const g = String(d).trim();
|
|
547
549
|
if (g === "") return;
|
|
548
|
-
const v =
|
|
550
|
+
const v = ce(y.COMPLETENESS);
|
|
549
551
|
v.setColumn(g), v.setName(t("defaultCompletenessRuleName", { columnName: g })), v.setMinCompleteness(1), l((E) => {
|
|
550
|
-
const
|
|
551
|
-
return
|
|
552
|
+
const h = j.fromValidationRules(E.toValidationRules());
|
|
553
|
+
return h.appendColumn(g, [v]), $(h, a), h;
|
|
552
554
|
}), r("");
|
|
553
555
|
}, p = (d) => {
|
|
554
556
|
l((g) => {
|
|
555
557
|
const v = j.fromValidationRules(g.toValidationRules()), E = v.getColumnNames();
|
|
556
|
-
return d >= 0 && d < E.length && (v.removeColumn(d),
|
|
558
|
+
return d >= 0 && d < E.length && (v.removeColumn(d), $(v, a)), v;
|
|
557
559
|
});
|
|
558
560
|
}, w = (d, g) => {
|
|
559
561
|
const v = String(g).trim();
|
|
560
562
|
v !== "" && l((E) => {
|
|
561
|
-
const
|
|
563
|
+
const h = j.fromValidationRules(E.toValidationRules()), O = h.getColumnNames();
|
|
562
564
|
if (d >= 0 && d < O.length)
|
|
563
565
|
try {
|
|
564
|
-
|
|
566
|
+
h.setColumnName(d, v), $(h, a);
|
|
565
567
|
} catch {
|
|
566
568
|
}
|
|
567
|
-
return
|
|
569
|
+
return h;
|
|
568
570
|
});
|
|
569
|
-
},
|
|
570
|
-
const v =
|
|
571
|
+
}, u = (d, g) => {
|
|
572
|
+
const v = ce(g);
|
|
571
573
|
v.setColumn(d), l((E) => {
|
|
572
|
-
const
|
|
573
|
-
return
|
|
574
|
+
const h = j.fromValidationRules(E.toValidationRules());
|
|
575
|
+
return h.getColumnNames().includes(d) ? h.getRules(d).push(v) : h.appendColumn(d, [v]), $(h, a), h;
|
|
574
576
|
});
|
|
575
577
|
}, N = (d, g) => {
|
|
576
578
|
l((v) => {
|
|
577
|
-
const E = j.fromValidationRules(v.toValidationRules()),
|
|
578
|
-
return O !== -1 && (
|
|
579
|
+
const E = j.fromValidationRules(v.toValidationRules()), h = E.getRules(d), O = h.indexOf(g);
|
|
580
|
+
return O !== -1 && (h.splice(O, 1), $(E, a)), E;
|
|
579
581
|
});
|
|
580
|
-
},
|
|
582
|
+
}, C = (d, g, v) => {
|
|
581
583
|
g === "column" ? d.setColumn(v) : g === "name" && d.setName(v), n();
|
|
582
584
|
};
|
|
583
585
|
return /* @__PURE__ */ s("div", { className: "sodas-validation-ui sodas-validation-ui--columned", children: [
|
|
@@ -592,42 +594,42 @@ function Ye({ validationRules: a }) {
|
|
|
592
594
|
value: o,
|
|
593
595
|
onChange: (d) => r(d.target.value),
|
|
594
596
|
onKeyDown: (d) => {
|
|
595
|
-
d.key === "Enter" && (d.preventDefault(),
|
|
597
|
+
d.key === "Enter" && (d.preventDefault(), _(o));
|
|
596
598
|
},
|
|
597
599
|
"aria-label": t("columnNameAria")
|
|
598
600
|
}
|
|
599
601
|
),
|
|
600
602
|
/* @__PURE__ */ e(
|
|
601
|
-
|
|
603
|
+
M,
|
|
602
604
|
{
|
|
603
605
|
variant: "primary",
|
|
604
606
|
size: "sm",
|
|
605
|
-
onClick: () =>
|
|
607
|
+
onClick: () => _(o),
|
|
606
608
|
disabled: !o.trim(),
|
|
607
609
|
"aria-label": t("addColumnSectionAria"),
|
|
608
610
|
children: t("addColumn")
|
|
609
611
|
}
|
|
610
612
|
)
|
|
611
613
|
] }),
|
|
612
|
-
/* @__PURE__ */ e("div", { className: "sodas-validation-ui__sections", children:
|
|
613
|
-
|
|
614
|
+
/* @__PURE__ */ e("div", { className: "sodas-validation-ui__sections", children: m.map((d, g) => /* @__PURE__ */ e(
|
|
615
|
+
Ke,
|
|
614
616
|
{
|
|
615
617
|
columnName: d,
|
|
616
618
|
columnIndex: g,
|
|
617
619
|
rules: i.getRules(d),
|
|
618
620
|
onRenameColumn: w,
|
|
619
621
|
onRemoveColumn: p,
|
|
620
|
-
onAddRule:
|
|
622
|
+
onAddRule: u,
|
|
621
623
|
onRemoveRule: N,
|
|
622
|
-
onCommonChange:
|
|
624
|
+
onCommonChange: C,
|
|
623
625
|
forceUpdate: n
|
|
624
626
|
},
|
|
625
627
|
g
|
|
626
628
|
)) }),
|
|
627
|
-
|
|
629
|
+
m.length === 0 && /* @__PURE__ */ e("p", { className: "text-muted small sodas-validation-ui__empty", children: t("noColumns") })
|
|
628
630
|
] });
|
|
629
631
|
}
|
|
630
|
-
function
|
|
632
|
+
function Ke({
|
|
631
633
|
columnName: a,
|
|
632
634
|
columnIndex: t,
|
|
633
635
|
rules: i,
|
|
@@ -635,19 +637,19 @@ function ze({
|
|
|
635
637
|
onRemoveColumn: n,
|
|
636
638
|
onAddRule: o,
|
|
637
639
|
onRemoveRule: r,
|
|
638
|
-
onCommonChange:
|
|
639
|
-
forceUpdate:
|
|
640
|
+
onCommonChange: m,
|
|
641
|
+
forceUpdate: _
|
|
640
642
|
}) {
|
|
641
|
-
const { t: p } =
|
|
642
|
-
|
|
643
|
-
|
|
643
|
+
const { t: p } = V(), [w, u] = T(""), [N, C] = T(a), [d, g] = T(!1);
|
|
644
|
+
re(() => {
|
|
645
|
+
C(a);
|
|
644
646
|
}, [a]);
|
|
645
647
|
const v = () => {
|
|
646
648
|
g(!1);
|
|
647
|
-
const
|
|
648
|
-
|
|
649
|
-
}, E = (
|
|
650
|
-
|
|
649
|
+
const h = N.trim();
|
|
650
|
+
h !== "" && h !== a ? l(t, h) : C(a);
|
|
651
|
+
}, E = (h) => {
|
|
652
|
+
h.key === "Enter" && h.target.blur();
|
|
651
653
|
};
|
|
652
654
|
return /* @__PURE__ */ s(f, { className: "mb-3 sodas-validation-ui__section sodas-validation-ui__section--column", children: [
|
|
653
655
|
/* @__PURE__ */ s(f.Header, { className: "d-flex justify-content-between align-items-start gap-2 flex-wrap", children: [
|
|
@@ -659,7 +661,7 @@ function ze({
|
|
|
659
661
|
size: "sm",
|
|
660
662
|
type: "text",
|
|
661
663
|
value: N,
|
|
662
|
-
onChange: (
|
|
664
|
+
onChange: (h) => C(h.target.value),
|
|
663
665
|
onBlur: v,
|
|
664
666
|
onKeyDown: E,
|
|
665
667
|
"aria-label": p("columnNameAria"),
|
|
@@ -679,7 +681,7 @@ function ze({
|
|
|
679
681
|
)
|
|
680
682
|
] }),
|
|
681
683
|
/* @__PURE__ */ e(
|
|
682
|
-
|
|
684
|
+
M,
|
|
683
685
|
{
|
|
684
686
|
variant: "danger",
|
|
685
687
|
size: "sm",
|
|
@@ -697,21 +699,21 @@ function ze({
|
|
|
697
699
|
{
|
|
698
700
|
className: "sodas-validation-ui__add-select",
|
|
699
701
|
value: w,
|
|
700
|
-
onChange: (
|
|
702
|
+
onChange: (h) => u(h.target.value),
|
|
701
703
|
"aria-label": p("validationRuleTypeAria"),
|
|
702
704
|
children: [
|
|
703
705
|
/* @__PURE__ */ e("option", { value: "", children: p("selectType") }),
|
|
704
|
-
Object.entries(P).map(([
|
|
706
|
+
Object.entries(P).map(([h, O]) => /* @__PURE__ */ e("option", { value: h, children: O }, h))
|
|
705
707
|
]
|
|
706
708
|
}
|
|
707
709
|
),
|
|
708
710
|
/* @__PURE__ */ e(
|
|
709
|
-
|
|
711
|
+
M,
|
|
710
712
|
{
|
|
711
713
|
variant: "primary",
|
|
712
714
|
size: "sm",
|
|
713
715
|
onClick: () => {
|
|
714
|
-
w && (o(a, w),
|
|
716
|
+
w && (o(a, w), u(""));
|
|
715
717
|
},
|
|
716
718
|
disabled: !w,
|
|
717
719
|
"aria-label": p("appendRuleAria"),
|
|
@@ -719,46 +721,46 @@ function ze({
|
|
|
719
721
|
}
|
|
720
722
|
)
|
|
721
723
|
] }),
|
|
722
|
-
/* @__PURE__ */ e("ul", { className: "list-unstyled mb-0 sodas-validation-ui__list", children: i.map((
|
|
723
|
-
|
|
724
|
+
/* @__PURE__ */ e("ul", { className: "list-unstyled mb-0 sodas-validation-ui__list", children: i.map((h, O) => /* @__PURE__ */ e("li", { className: "mb-2 sodas-validation-ui__rule", children: /* @__PURE__ */ e(
|
|
725
|
+
Se,
|
|
724
726
|
{
|
|
725
|
-
rule:
|
|
727
|
+
rule: h,
|
|
726
728
|
index: O,
|
|
727
|
-
onRemove: () => r(a,
|
|
728
|
-
onCommonChange:
|
|
729
|
-
forceUpdate:
|
|
729
|
+
onRemove: () => r(a, h),
|
|
730
|
+
onCommonChange: m,
|
|
731
|
+
forceUpdate: _,
|
|
730
732
|
showColumn: !1
|
|
731
733
|
}
|
|
732
734
|
) }, O)) })
|
|
733
735
|
] })
|
|
734
736
|
] });
|
|
735
737
|
}
|
|
736
|
-
function
|
|
737
|
-
const [, a] =
|
|
738
|
+
function We() {
|
|
739
|
+
const [, a] = T(0);
|
|
738
740
|
return Q(() => a((t) => t + 1), []);
|
|
739
741
|
}
|
|
740
|
-
function
|
|
741
|
-
const { t } =
|
|
742
|
+
function Ze({ validationRules: a }) {
|
|
743
|
+
const { t } = V(), i = We(), [l, n] = T(""), o = (u) => {
|
|
742
744
|
if (!Array.isArray(a)) return;
|
|
743
|
-
const N =
|
|
745
|
+
const N = ce(u);
|
|
744
746
|
a.push(N), i();
|
|
745
747
|
}, r = () => {
|
|
746
748
|
l && o(l);
|
|
747
|
-
},
|
|
748
|
-
Array.isArray(a) && (a.splice(
|
|
749
|
-
},
|
|
750
|
-
N === "column" ?
|
|
749
|
+
}, m = (u) => {
|
|
750
|
+
Array.isArray(a) && (a.splice(u, 1), i());
|
|
751
|
+
}, _ = (u, N, C) => {
|
|
752
|
+
N === "column" ? u.setColumn(C) : N === "name" && u.setName(C), i();
|
|
751
753
|
};
|
|
752
754
|
if (!Array.isArray(a))
|
|
753
755
|
return /* @__PURE__ */ e("div", { className: "alert alert-danger sodas-validation-ui sodas-validation-ui--empty", children: t("validationRulesMustBeArray") });
|
|
754
756
|
const p = /* @__PURE__ */ new Map();
|
|
755
|
-
a.forEach((
|
|
756
|
-
const
|
|
757
|
-
p.has(
|
|
757
|
+
a.forEach((u, N) => {
|
|
758
|
+
const C = u.getType;
|
|
759
|
+
p.has(C) || p.set(C, []), p.get(C).push({ rule: u, index: N });
|
|
758
760
|
});
|
|
759
761
|
const w = [];
|
|
760
|
-
return a.forEach((
|
|
761
|
-
const N =
|
|
762
|
+
return a.forEach((u) => {
|
|
763
|
+
const N = u.getType;
|
|
762
764
|
w.includes(N) || w.push(N);
|
|
763
765
|
}), /* @__PURE__ */ s("div", { className: "sodas-validation-ui sodas-validation-ui--type-based", children: [
|
|
764
766
|
/* @__PURE__ */ s("div", { className: "d-flex align-items-center gap-2 mb-3 sodas-validation-ui__toolbar", children: [
|
|
@@ -768,16 +770,16 @@ function Ke({ validationRules: a }) {
|
|
|
768
770
|
{
|
|
769
771
|
className: "sodas-validation-ui__add-select",
|
|
770
772
|
value: l,
|
|
771
|
-
onChange: (
|
|
773
|
+
onChange: (u) => n(u.target.value),
|
|
772
774
|
"aria-label": t("validationRuleTypeAria"),
|
|
773
775
|
children: [
|
|
774
776
|
/* @__PURE__ */ e("option", { value: "", children: t("selectType") }),
|
|
775
|
-
Object.entries(P).map(([
|
|
777
|
+
Object.entries(P).map(([u, N]) => /* @__PURE__ */ e("option", { value: u, children: N }, u))
|
|
776
778
|
]
|
|
777
779
|
}
|
|
778
780
|
),
|
|
779
781
|
/* @__PURE__ */ e(
|
|
780
|
-
|
|
782
|
+
M,
|
|
781
783
|
{
|
|
782
784
|
variant: "primary",
|
|
783
785
|
size: "sm",
|
|
@@ -788,66 +790,66 @@ function Ke({ validationRules: a }) {
|
|
|
788
790
|
}
|
|
789
791
|
)
|
|
790
792
|
] }),
|
|
791
|
-
/* @__PURE__ */ e("div", { className: "sodas-validation-ui__sections", children: w.map((
|
|
792
|
-
const N = p.get(
|
|
793
|
+
/* @__PURE__ */ e("div", { className: "sodas-validation-ui__sections", children: w.map((u) => {
|
|
794
|
+
const N = p.get(u) ?? [];
|
|
793
795
|
return /* @__PURE__ */ s("section", { className: "card mb-3 sodas-validation-ui__section", children: [
|
|
794
|
-
/* @__PURE__ */ e("div", { className: "card-header", children: /* @__PURE__ */ e("h5", { className: "mb-0 card-title", children: P[
|
|
795
|
-
/* @__PURE__ */ e("ul", { className: "list-unstyled mb-0 p-2 sodas-validation-ui__list", children: N.map(({ rule:
|
|
796
|
-
|
|
796
|
+
/* @__PURE__ */ e("div", { className: "card-header", children: /* @__PURE__ */ e("h5", { className: "mb-0 card-title", children: P[u] ?? u }) }),
|
|
797
|
+
/* @__PURE__ */ e("ul", { className: "list-unstyled mb-0 p-2 sodas-validation-ui__list", children: N.map(({ rule: C, index: d }) => /* @__PURE__ */ e("li", { className: "sodas-validation-ui__rule mb-2", children: /* @__PURE__ */ e(
|
|
798
|
+
Se,
|
|
797
799
|
{
|
|
798
|
-
rule:
|
|
800
|
+
rule: C,
|
|
799
801
|
index: d,
|
|
800
|
-
onRemove: () =>
|
|
801
|
-
onCommonChange:
|
|
802
|
+
onRemove: () => m(d),
|
|
803
|
+
onCommonChange: _,
|
|
802
804
|
forceUpdate: i,
|
|
803
805
|
showColumn: !0,
|
|
804
806
|
showType: !1
|
|
805
807
|
}
|
|
806
808
|
) }, d)) })
|
|
807
|
-
] },
|
|
809
|
+
] }, u);
|
|
808
810
|
}) }),
|
|
809
811
|
a.length === 0 && /* @__PURE__ */ e("p", { className: "text-muted small sodas-validation-ui__empty", children: t("noRules") })
|
|
810
812
|
] });
|
|
811
813
|
}
|
|
812
|
-
const
|
|
813
|
-
function
|
|
814
|
-
const { t } =
|
|
815
|
-
p(""),
|
|
816
|
-
},
|
|
817
|
-
b.preventDefault(),
|
|
814
|
+
const H = "type", X = "column", Xe = 10;
|
|
815
|
+
function we({ validationRules: a }) {
|
|
816
|
+
const { t } = V(), [i, l] = T(H), [n, o] = T(0), [r, m] = T(!1), [_, p] = T(""), [w, u] = T(""), [N, C] = T(null), [d, g] = T(!1), [v, E] = T(!1), [h, O] = T(""), [K, he] = T([]), [xe, pe] = T(0), [q, ve] = T(!1), [be, ie] = T(null), [D, W] = T(null), Z = te(!1), Re = () => {
|
|
817
|
+
p(""), u(""), C(null), m(!0);
|
|
818
|
+
}, Le = async (b) => {
|
|
819
|
+
b.preventDefault(), C(null), g(!0);
|
|
818
820
|
try {
|
|
819
|
-
const x = new
|
|
820
|
-
x.name =
|
|
821
|
+
const x = new ye();
|
|
822
|
+
x.name = _, x.description = w, x.validationRules = [...a], await x.createDBRecord(), m(!1);
|
|
821
823
|
} catch (x) {
|
|
822
|
-
|
|
824
|
+
C(x instanceof Error ? x.message : String(x));
|
|
823
825
|
} finally {
|
|
824
826
|
g(!1);
|
|
825
827
|
}
|
|
826
|
-
},
|
|
827
|
-
O(""),
|
|
828
|
+
}, Me = () => {
|
|
829
|
+
O(""), he([]), pe(0), ie(null), W(null), E(!0);
|
|
828
830
|
}, G = Q(
|
|
829
831
|
async (b = 1, x) => {
|
|
830
|
-
const
|
|
831
|
-
|
|
832
|
+
const Ie = x !== void 0 ? x : h.trim() || "";
|
|
833
|
+
ve(!0), ie(null);
|
|
832
834
|
try {
|
|
833
|
-
const F = await
|
|
835
|
+
const F = await ye.listDBRecords(
|
|
834
836
|
b,
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
837
|
+
Xe,
|
|
838
|
+
qe.DESC,
|
|
839
|
+
Ie || void 0
|
|
838
840
|
);
|
|
839
|
-
|
|
841
|
+
he(F.list ?? []), pe(F.total ?? 0), W(null);
|
|
840
842
|
} catch (F) {
|
|
841
|
-
|
|
843
|
+
ie(F instanceof Error ? F.message : String(F));
|
|
842
844
|
} finally {
|
|
843
|
-
|
|
845
|
+
ve(!1);
|
|
844
846
|
}
|
|
845
847
|
},
|
|
846
|
-
[
|
|
848
|
+
[h]
|
|
847
849
|
);
|
|
848
|
-
|
|
850
|
+
re(() => {
|
|
849
851
|
v && (Z.current = !0, G(1, ""));
|
|
850
|
-
}, [v]),
|
|
852
|
+
}, [v]), re(() => {
|
|
851
853
|
if (!v) {
|
|
852
854
|
Z.current = !1;
|
|
853
855
|
return;
|
|
@@ -858,12 +860,12 @@ function Ae({ validationRules: a }) {
|
|
|
858
860
|
}
|
|
859
861
|
const b = setTimeout(() => G(1), 300);
|
|
860
862
|
return () => clearTimeout(b);
|
|
861
|
-
}, [v,
|
|
862
|
-
const
|
|
863
|
+
}, [v, h, G]);
|
|
864
|
+
const Oe = () => {
|
|
863
865
|
if (!D) return;
|
|
864
866
|
const b = D.validationRules ?? [];
|
|
865
867
|
a.push(...b), o((x) => x + 1), E(!1);
|
|
866
|
-
},
|
|
868
|
+
}, ke = () => {
|
|
867
869
|
if (!D) return;
|
|
868
870
|
const b = D.validationRules ?? [];
|
|
869
871
|
a.splice(0, a.length, ...b), o((x) => x + 1), E(!1);
|
|
@@ -871,7 +873,7 @@ function Ae({ validationRules: a }) {
|
|
|
871
873
|
return Array.isArray(a) ? /* @__PURE__ */ s("div", { className: "sodas-validation-ui sodas-validation-ui--tabs", children: [
|
|
872
874
|
/* @__PURE__ */ s("div", { className: "d-flex flex-wrap align-items-center justify-content-between gap-2 border-bottom pb-2 mb-3", children: [
|
|
873
875
|
/* @__PURE__ */ s(
|
|
874
|
-
|
|
876
|
+
L,
|
|
875
877
|
{
|
|
876
878
|
variant: "tabs",
|
|
877
879
|
activeKey: i,
|
|
@@ -880,19 +882,19 @@ function Ae({ validationRules: a }) {
|
|
|
880
882
|
"aria-label": "Editor mode",
|
|
881
883
|
className: "flex-grow-1",
|
|
882
884
|
children: [
|
|
883
|
-
/* @__PURE__ */ e(
|
|
884
|
-
|
|
885
|
+
/* @__PURE__ */ e(L.Item, { children: /* @__PURE__ */ e(
|
|
886
|
+
L.Link,
|
|
885
887
|
{
|
|
886
|
-
eventKey:
|
|
888
|
+
eventKey: H,
|
|
887
889
|
role: "tab",
|
|
888
|
-
"aria-selected": i ===
|
|
890
|
+
"aria-selected": i === H,
|
|
889
891
|
"aria-controls": "validation-rules-editor-panel-type",
|
|
890
892
|
id: "validation-rules-editor-tab-type",
|
|
891
893
|
children: t("byType")
|
|
892
894
|
}
|
|
893
895
|
) }),
|
|
894
|
-
/* @__PURE__ */ e(
|
|
895
|
-
|
|
896
|
+
/* @__PURE__ */ e(L.Item, { children: /* @__PURE__ */ e(
|
|
897
|
+
L.Link,
|
|
896
898
|
{
|
|
897
899
|
eventKey: X,
|
|
898
900
|
role: "tab",
|
|
@@ -906,11 +908,11 @@ function Ae({ validationRules: a }) {
|
|
|
906
908
|
}
|
|
907
909
|
),
|
|
908
910
|
/* @__PURE__ */ e("div", { className: "d-flex align-items-center gap-2 flex-wrap ms-auto", children: /* @__PURE__ */ e(
|
|
909
|
-
|
|
911
|
+
M,
|
|
910
912
|
{
|
|
911
913
|
variant: "info",
|
|
912
914
|
size: "sm",
|
|
913
|
-
onClick:
|
|
915
|
+
onClick: Me,
|
|
914
916
|
"aria-label": t("loadFromTemplateAria"),
|
|
915
917
|
children: t("loadFromTemplate")
|
|
916
918
|
}
|
|
@@ -922,10 +924,10 @@ function Ae({ validationRules: a }) {
|
|
|
922
924
|
id: "validation-rules-editor-panel-type",
|
|
923
925
|
role: "tabpanel",
|
|
924
926
|
"aria-labelledby": "validation-rules-editor-tab-type",
|
|
925
|
-
hidden: i !==
|
|
927
|
+
hidden: i !== H,
|
|
926
928
|
className: "sodas-validation-ui__panel",
|
|
927
|
-
children: i ===
|
|
928
|
-
|
|
929
|
+
children: i === H && /* @__PURE__ */ e(
|
|
930
|
+
Ze,
|
|
929
931
|
{
|
|
930
932
|
validationRules: a
|
|
931
933
|
},
|
|
@@ -942,7 +944,7 @@ function Ae({ validationRules: a }) {
|
|
|
942
944
|
hidden: i !== X,
|
|
943
945
|
className: "sodas-validation-ui__panel",
|
|
944
946
|
children: i === X && /* @__PURE__ */ e(
|
|
945
|
-
|
|
947
|
+
Qe,
|
|
946
948
|
{
|
|
947
949
|
validationRules: a
|
|
948
950
|
},
|
|
@@ -951,25 +953,25 @@ function Ae({ validationRules: a }) {
|
|
|
951
953
|
}
|
|
952
954
|
),
|
|
953
955
|
/* @__PURE__ */ e("div", { className: "mt-3 pt-3 border-top d-flex justify-content-end", children: /* @__PURE__ */ e(
|
|
954
|
-
|
|
956
|
+
M,
|
|
955
957
|
{
|
|
956
958
|
variant: "primary",
|
|
957
|
-
onClick:
|
|
959
|
+
onClick: Re,
|
|
958
960
|
"aria-label": t("saveAsTemplateAria"),
|
|
959
961
|
children: t("templateSave")
|
|
960
962
|
}
|
|
961
963
|
) }),
|
|
962
964
|
/* @__PURE__ */ s(
|
|
963
|
-
|
|
965
|
+
B,
|
|
964
966
|
{
|
|
965
967
|
className: "sodas-validation-ui__modal",
|
|
966
968
|
show: r,
|
|
967
|
-
onHide: () => !d &&
|
|
969
|
+
onHide: () => !d && m(!1),
|
|
968
970
|
centered: !0,
|
|
969
971
|
children: [
|
|
970
|
-
/* @__PURE__ */ e(
|
|
971
|
-
/* @__PURE__ */ s(c, { onSubmit:
|
|
972
|
-
/* @__PURE__ */ s(
|
|
972
|
+
/* @__PURE__ */ e(B.Header, { closeButton: !0, children: /* @__PURE__ */ e(B.Title, { children: t("templateSave") }) }),
|
|
973
|
+
/* @__PURE__ */ s(c, { onSubmit: Le, children: [
|
|
974
|
+
/* @__PURE__ */ s(B.Body, { children: [
|
|
973
975
|
N && /* @__PURE__ */ e("div", { className: "alert alert-danger small mb-3", role: "alert", children: N }),
|
|
974
976
|
/* @__PURE__ */ s(c.Group, { className: "mb-3", children: [
|
|
975
977
|
/* @__PURE__ */ e(c.Label, { children: t("name") }),
|
|
@@ -977,7 +979,7 @@ function Ae({ validationRules: a }) {
|
|
|
977
979
|
c.Control,
|
|
978
980
|
{
|
|
979
981
|
type: "text",
|
|
980
|
-
value:
|
|
982
|
+
value: _,
|
|
981
983
|
onChange: (b) => p(b.target.value),
|
|
982
984
|
placeholder: t("templateName"),
|
|
983
985
|
"aria-label": t("templateName"),
|
|
@@ -993,31 +995,31 @@ function Ae({ validationRules: a }) {
|
|
|
993
995
|
as: "textarea",
|
|
994
996
|
rows: 3,
|
|
995
997
|
value: w,
|
|
996
|
-
onChange: (b) =>
|
|
998
|
+
onChange: (b) => u(b.target.value),
|
|
997
999
|
placeholder: t("templateDescription"),
|
|
998
1000
|
"aria-label": t("templateDescription")
|
|
999
1001
|
}
|
|
1000
1002
|
)
|
|
1001
1003
|
] })
|
|
1002
1004
|
] }),
|
|
1003
|
-
/* @__PURE__ */ s(
|
|
1005
|
+
/* @__PURE__ */ s(B.Footer, { children: [
|
|
1004
1006
|
/* @__PURE__ */ e(
|
|
1005
|
-
|
|
1007
|
+
M,
|
|
1006
1008
|
{
|
|
1007
1009
|
variant: "secondary",
|
|
1008
|
-
onClick: () =>
|
|
1010
|
+
onClick: () => m(!1),
|
|
1009
1011
|
disabled: d,
|
|
1010
1012
|
children: t("cancel")
|
|
1011
1013
|
}
|
|
1012
1014
|
),
|
|
1013
|
-
/* @__PURE__ */ e(
|
|
1015
|
+
/* @__PURE__ */ e(M, { variant: "primary", type: "submit", disabled: d, children: t(d ? "saving" : "save") })
|
|
1014
1016
|
] })
|
|
1015
1017
|
] })
|
|
1016
1018
|
]
|
|
1017
1019
|
}
|
|
1018
1020
|
),
|
|
1019
1021
|
/* @__PURE__ */ s(
|
|
1020
|
-
|
|
1022
|
+
B,
|
|
1021
1023
|
{
|
|
1022
1024
|
className: "sodas-validation-ui__modal",
|
|
1023
1025
|
show: v,
|
|
@@ -1025,15 +1027,15 @@ function Ae({ validationRules: a }) {
|
|
|
1025
1027
|
centered: !0,
|
|
1026
1028
|
size: "lg",
|
|
1027
1029
|
children: [
|
|
1028
|
-
/* @__PURE__ */ e(
|
|
1029
|
-
/* @__PURE__ */ s(
|
|
1030
|
-
|
|
1030
|
+
/* @__PURE__ */ e(B.Header, { closeButton: !0, children: /* @__PURE__ */ e(B.Title, { children: t("loadFromTemplate") }) }),
|
|
1031
|
+
/* @__PURE__ */ s(B.Body, { children: [
|
|
1032
|
+
be && /* @__PURE__ */ e("div", { className: "alert alert-danger small mb-3", role: "alert", children: be }),
|
|
1031
1033
|
/* @__PURE__ */ s("div", { className: "d-flex gap-2 mb-3", children: [
|
|
1032
1034
|
/* @__PURE__ */ e(
|
|
1033
1035
|
c.Control,
|
|
1034
1036
|
{
|
|
1035
1037
|
type: "text",
|
|
1036
|
-
value:
|
|
1038
|
+
value: h,
|
|
1037
1039
|
onChange: (b) => O(b.target.value),
|
|
1038
1040
|
placeholder: t("searchByTemplateName"),
|
|
1039
1041
|
"aria-label": t("templateNameSearchAria"),
|
|
@@ -1041,7 +1043,7 @@ function Ae({ validationRules: a }) {
|
|
|
1041
1043
|
}
|
|
1042
1044
|
),
|
|
1043
1045
|
/* @__PURE__ */ e(
|
|
1044
|
-
|
|
1046
|
+
M,
|
|
1045
1047
|
{
|
|
1046
1048
|
variant: "info",
|
|
1047
1049
|
onClick: () => G(1),
|
|
@@ -1051,7 +1053,7 @@ function Ae({ validationRules: a }) {
|
|
|
1051
1053
|
)
|
|
1052
1054
|
] }),
|
|
1053
1055
|
K.length > 0 && /* @__PURE__ */ s(k, { children: [
|
|
1054
|
-
/* @__PURE__ */ e("p", { className: "small text-muted mb-2", children: t("loadTemplateSelect", { count:
|
|
1056
|
+
/* @__PURE__ */ e("p", { className: "small text-muted mb-2", children: t("loadTemplateSelect", { count: xe }) }),
|
|
1055
1057
|
/* @__PURE__ */ e(
|
|
1056
1058
|
"div",
|
|
1057
1059
|
{
|
|
@@ -1080,9 +1082,9 @@ function Ae({ validationRules: a }) {
|
|
|
1080
1082
|
] }),
|
|
1081
1083
|
K.length === 0 && !q && v && /* @__PURE__ */ e("p", { className: "text-muted small mb-0", children: t("noTemplatesFound") })
|
|
1082
1084
|
] }),
|
|
1083
|
-
/* @__PURE__ */ s(
|
|
1085
|
+
/* @__PURE__ */ s(B.Footer, { children: [
|
|
1084
1086
|
/* @__PURE__ */ e(
|
|
1085
|
-
|
|
1087
|
+
M,
|
|
1086
1088
|
{
|
|
1087
1089
|
variant: "secondary",
|
|
1088
1090
|
onClick: () => E(!1),
|
|
@@ -1091,19 +1093,19 @@ function Ae({ validationRules: a }) {
|
|
|
1091
1093
|
}
|
|
1092
1094
|
),
|
|
1093
1095
|
/* @__PURE__ */ e(
|
|
1094
|
-
|
|
1096
|
+
M,
|
|
1095
1097
|
{
|
|
1096
1098
|
variant: "primary",
|
|
1097
|
-
onClick:
|
|
1099
|
+
onClick: Oe,
|
|
1098
1100
|
disabled: !D || q,
|
|
1099
1101
|
children: t("append")
|
|
1100
1102
|
}
|
|
1101
1103
|
),
|
|
1102
1104
|
/* @__PURE__ */ e(
|
|
1103
|
-
|
|
1105
|
+
M,
|
|
1104
1106
|
{
|
|
1105
1107
|
variant: "success",
|
|
1106
|
-
onClick:
|
|
1108
|
+
onClick: ke,
|
|
1107
1109
|
disabled: !D || q,
|
|
1108
1110
|
children: t("set")
|
|
1109
1111
|
}
|
|
@@ -1114,7 +1116,7 @@ function Ae({ validationRules: a }) {
|
|
|
1114
1116
|
)
|
|
1115
1117
|
] }) : /* @__PURE__ */ e("div", { className: "alert alert-danger sodas-validation-ui sodas-validation-ui--empty", children: "validationRules must be an array" });
|
|
1116
1118
|
}
|
|
1117
|
-
function
|
|
1119
|
+
function Je({ validationRules: a }) {
|
|
1118
1120
|
if (!Array.isArray(a))
|
|
1119
1121
|
return /* @__PURE__ */ e("div", { className: "alert alert-danger sodas-validation-ui sodas-validation-ui--empty", children: "validationRules must be an array" });
|
|
1120
1122
|
const t = /* @__PURE__ */ new Map(), i = [];
|
|
@@ -1130,7 +1132,7 @@ function Ze({ validationRules: a }) {
|
|
|
1130
1132
|
className: "mb-3 sodas-validation-ui__section sodas-validation-ui__section--column",
|
|
1131
1133
|
children: [
|
|
1132
1134
|
/* @__PURE__ */ e(f.Header, { children: /* @__PURE__ */ e("h5", { className: "mb-0 card-title", children: l }) }),
|
|
1133
|
-
/* @__PURE__ */ e(f.Body, { children: /* @__PURE__ */ e("ul", { className: "list-unstyled mb-0 sodas-validation-ui__list", children: n.map((o, r) => /* @__PURE__ */ e("li", { className: "mb-2 sodas-validation-ui__rule", children: /* @__PURE__ */ e(f, { className: "sodas-validation-ui__rule-card", children: /* @__PURE__ */ e(f.Body, { className: "py-2", children: /* @__PURE__ */ e(
|
|
1135
|
+
/* @__PURE__ */ e(f.Body, { children: /* @__PURE__ */ e("ul", { className: "list-unstyled mb-0 sodas-validation-ui__list", children: n.map((o, r) => /* @__PURE__ */ e("li", { className: "mb-2 sodas-validation-ui__rule", children: /* @__PURE__ */ e(f, { className: "sodas-validation-ui__rule-card", children: /* @__PURE__ */ e(f.Body, { className: "py-2", children: /* @__PURE__ */ e(ne, { rule: o, showColumn: !1 }) }) }) }, r)) }) })
|
|
1134
1136
|
]
|
|
1135
1137
|
},
|
|
1136
1138
|
l
|
|
@@ -1139,10 +1141,10 @@ function Ze({ validationRules: a }) {
|
|
|
1139
1141
|
a.length === 0 && /* @__PURE__ */ e("p", { className: "text-muted small sodas-validation-ui__empty", children: "No validation rules to display." })
|
|
1140
1142
|
] });
|
|
1141
1143
|
}
|
|
1142
|
-
function
|
|
1143
|
-
return P[a] ??
|
|
1144
|
+
function ea(a) {
|
|
1145
|
+
return P[a] ?? le[a] ?? a;
|
|
1144
1146
|
}
|
|
1145
|
-
function
|
|
1147
|
+
function aa({ validationRules: a }) {
|
|
1146
1148
|
if (!Array.isArray(a))
|
|
1147
1149
|
return /* @__PURE__ */ e("div", { className: "alert alert-danger sodas-validation-ui sodas-validation-ui--empty", children: "validationRules must be an array" });
|
|
1148
1150
|
const t = /* @__PURE__ */ new Map(), i = [];
|
|
@@ -1153,19 +1155,19 @@ function Je({ validationRules: a }) {
|
|
|
1153
1155
|
/* @__PURE__ */ e("div", { className: "sodas-validation-ui__sections", children: i.map((l) => {
|
|
1154
1156
|
const n = t.get(l) ?? [];
|
|
1155
1157
|
return /* @__PURE__ */ s("section", { className: "card mb-3 sodas-validation-ui__section", children: [
|
|
1156
|
-
/* @__PURE__ */ e("div", { className: "card-header", children: /* @__PURE__ */ e("h5", { className: "mb-0 card-title", children:
|
|
1157
|
-
/* @__PURE__ */ e("ul", { className: "list-unstyled mb-0 p-2 sodas-validation-ui__list", children: n.map((o, r) => /* @__PURE__ */ e("li", { className: "sodas-validation-ui__rule mb-2", children: /* @__PURE__ */ e(f, { className: "sodas-validation-ui__rule-card", children: /* @__PURE__ */ e(f.Body, { className: "py-2", children: /* @__PURE__ */ e(
|
|
1158
|
+
/* @__PURE__ */ e("div", { className: "card-header", children: /* @__PURE__ */ e("h5", { className: "mb-0 card-title", children: ea(l) }) }),
|
|
1159
|
+
/* @__PURE__ */ e("ul", { className: "list-unstyled mb-0 p-2 sodas-validation-ui__list", children: n.map((o, r) => /* @__PURE__ */ e("li", { className: "sodas-validation-ui__rule mb-2", children: /* @__PURE__ */ e(f, { className: "sodas-validation-ui__rule-card", children: /* @__PURE__ */ e(f.Body, { className: "py-2", children: /* @__PURE__ */ e(ne, { rule: o, showColumn: !0 }) }) }) }, r)) })
|
|
1158
1160
|
] }, l);
|
|
1159
1161
|
}) }),
|
|
1160
1162
|
a.length === 0 && /* @__PURE__ */ e("p", { className: "text-muted small sodas-validation-ui__empty", children: "No validation rules to display." })
|
|
1161
1163
|
] });
|
|
1162
1164
|
}
|
|
1163
1165
|
const Y = "type", J = "column";
|
|
1164
|
-
function
|
|
1165
|
-
const { t } =
|
|
1166
|
+
function _a({ validationRules: a }) {
|
|
1167
|
+
const { t } = V(), [i, l] = T(Y);
|
|
1166
1168
|
return Array.isArray(a) ? /* @__PURE__ */ s("div", { className: "sodas-validation-ui sodas-validation-ui--tabs sodas-validation-ui--viewer", children: [
|
|
1167
1169
|
/* @__PURE__ */ e("div", { className: "d-flex flex-wrap align-items-center border-bottom pb-2 mb-3", children: /* @__PURE__ */ s(
|
|
1168
|
-
|
|
1170
|
+
L,
|
|
1169
1171
|
{
|
|
1170
1172
|
variant: "tabs",
|
|
1171
1173
|
activeKey: i,
|
|
@@ -1174,8 +1176,8 @@ function ga({ validationRules: a }) {
|
|
|
1174
1176
|
"aria-label": "View mode",
|
|
1175
1177
|
className: "flex-grow-1",
|
|
1176
1178
|
children: [
|
|
1177
|
-
/* @__PURE__ */ e(
|
|
1178
|
-
|
|
1179
|
+
/* @__PURE__ */ e(L.Item, { children: /* @__PURE__ */ e(
|
|
1180
|
+
L.Link,
|
|
1179
1181
|
{
|
|
1180
1182
|
eventKey: Y,
|
|
1181
1183
|
role: "tab",
|
|
@@ -1185,8 +1187,8 @@ function ga({ validationRules: a }) {
|
|
|
1185
1187
|
children: t("byType")
|
|
1186
1188
|
}
|
|
1187
1189
|
) }),
|
|
1188
|
-
/* @__PURE__ */ e(
|
|
1189
|
-
|
|
1190
|
+
/* @__PURE__ */ e(L.Item, { children: /* @__PURE__ */ e(
|
|
1191
|
+
L.Link,
|
|
1190
1192
|
{
|
|
1191
1193
|
eventKey: J,
|
|
1192
1194
|
role: "tab",
|
|
@@ -1207,7 +1209,7 @@ function ga({ validationRules: a }) {
|
|
|
1207
1209
|
"aria-labelledby": "validation-rules-viewer-tab-type",
|
|
1208
1210
|
hidden: i !== Y,
|
|
1209
1211
|
className: "sodas-validation-ui__panel",
|
|
1210
|
-
children: i === Y && /* @__PURE__ */ e(
|
|
1212
|
+
children: i === Y && /* @__PURE__ */ e(aa, { validationRules: a })
|
|
1211
1213
|
}
|
|
1212
1214
|
),
|
|
1213
1215
|
/* @__PURE__ */ e(
|
|
@@ -1218,114 +1220,120 @@ function ga({ validationRules: a }) {
|
|
|
1218
1220
|
"aria-labelledby": "validation-rules-viewer-tab-column",
|
|
1219
1221
|
hidden: i !== J,
|
|
1220
1222
|
className: "sodas-validation-ui__panel",
|
|
1221
|
-
children: i === J && /* @__PURE__ */ e(
|
|
1223
|
+
children: i === J && /* @__PURE__ */ e(Je, { validationRules: a })
|
|
1222
1224
|
}
|
|
1223
1225
|
)
|
|
1224
1226
|
] }) : /* @__PURE__ */ e("div", { className: "alert alert-danger sodas-validation-ui sodas-validation-ui--empty", children: t("validationRulesMustBeArray") });
|
|
1225
1227
|
}
|
|
1226
|
-
function
|
|
1227
|
-
return P[a] ??
|
|
1228
|
+
function ta(a) {
|
|
1229
|
+
return P[a] ?? le[a] ?? a;
|
|
1228
1230
|
}
|
|
1229
|
-
function
|
|
1231
|
+
function la(a) {
|
|
1230
1232
|
const t = a?.rule ?? a, i = typeof a?.score == "number" ? a.score : 0, l = !!a?.pass, n = Array.isArray(a?.rejected_indexes) ? a.rejected_indexes : [], o = Array.isArray(a?.rejected_values) ? a.rejected_values : [];
|
|
1231
1233
|
return { rule: t, score: i, pass: l, rejected_indexes: n, rejected_values: o };
|
|
1232
1234
|
}
|
|
1233
|
-
function
|
|
1234
|
-
const { t: l } =
|
|
1235
|
-
index:
|
|
1236
|
-
value:
|
|
1237
|
-
})) : [], N = /* @__PURE__ */ s(
|
|
1238
|
-
/* @__PURE__ */ e(
|
|
1239
|
-
/* @__PURE__ */ e(
|
|
1235
|
+
function Ee({ item: a, showColumn: t = !0, showType: i = !0 }) {
|
|
1236
|
+
const { t: l } = V(), { rule: n, score: o, pass: r, rejected_indexes: m, rejected_values: _ } = la(a), p = n?.getType ?? n?.type, w = Math.min(m.length, _.length), u = w > 0 ? Array.from({ length: w }, (d, g) => ({
|
|
1237
|
+
index: m[g],
|
|
1238
|
+
value: _[g] ?? "—"
|
|
1239
|
+
})) : [], N = /* @__PURE__ */ s(se, { className: "sodas-validation-ui__rejected-popover", children: [
|
|
1240
|
+
/* @__PURE__ */ e(se.Header, { as: "h6", className: "small", children: l("rejectedTitle") }),
|
|
1241
|
+
/* @__PURE__ */ e(se.Body, { className: "small py-2", children: u.length > 0 ? /* @__PURE__ */ e("ul", { className: "list-unstyled mb-0", children: u.map(({ index: d, value: g }, v) => /* @__PURE__ */ e("li", { children: l("rejectedRowLabel", {
|
|
1240
1242
|
index: String(d),
|
|
1241
1243
|
value: String(g)
|
|
1242
1244
|
}) }, v)) }) : /* @__PURE__ */ e("p", { className: "text-muted mb-0", children: l("noFailureInfo") }) })
|
|
1243
|
-
] }),
|
|
1245
|
+
] }), C = /* @__PURE__ */ s("div", { className: "d-flex align-items-center gap-2 flex-shrink-0", children: [
|
|
1244
1246
|
/* @__PURE__ */ s("span", { className: "sodas-validation-ui__score", title: "Score", children: [
|
|
1245
1247
|
"Score: ",
|
|
1246
1248
|
/* @__PURE__ */ e("strong", { children: Number(o).toPrecision(3) })
|
|
1247
1249
|
] }),
|
|
1248
1250
|
/* @__PURE__ */ e(
|
|
1249
|
-
|
|
1251
|
+
De,
|
|
1250
1252
|
{
|
|
1251
1253
|
placement: "top",
|
|
1252
1254
|
overlay: N,
|
|
1253
1255
|
trigger: ["hover", "focus"],
|
|
1254
|
-
children: /* @__PURE__ */ e("span", { className: "d-inline-block sodas-validation-ui__pass-badge-wrap", tabIndex: 0, children: /* @__PURE__ */ e(
|
|
1256
|
+
children: /* @__PURE__ */ e("span", { className: "d-inline-block sodas-validation-ui__pass-badge-wrap", tabIndex: 0, children: /* @__PURE__ */ e(Pe, { bg: r ? "success" : "danger", className: "sodas-validation-ui__pass-badge", children: r ? "Pass" : "Fail" }) })
|
|
1255
1257
|
}
|
|
1256
1258
|
)
|
|
1257
1259
|
] });
|
|
1258
1260
|
return /* @__PURE__ */ e(f, { className: "sodas-validation-ui__rule-card sodas-validation-ui__quality-metadata-card", children: /* @__PURE__ */ e(f.Body, { children: /* @__PURE__ */ s("div", { className: "d-flex flex-wrap gap-2 align-items-start", children: [
|
|
1259
|
-
i && /* @__PURE__ */ e(f.Title, { className: "mb-0 fs-6", children:
|
|
1260
|
-
/* @__PURE__ */ e("div", { className: "flex-grow-1 min-w-0 sodas-validation-ui__rule-display-wrap", children: /* @__PURE__ */ e(
|
|
1261
|
-
|
|
1261
|
+
i && /* @__PURE__ */ e(f.Title, { className: "mb-0 fs-6", children: ta(p) }),
|
|
1262
|
+
/* @__PURE__ */ e("div", { className: "flex-grow-1 min-w-0 sodas-validation-ui__rule-display-wrap", children: /* @__PURE__ */ e(ne, { rule: n, showColumn: t }) }),
|
|
1263
|
+
C
|
|
1262
1264
|
] }) }) });
|
|
1263
1265
|
}
|
|
1264
|
-
function
|
|
1266
|
+
function na(a) {
|
|
1265
1267
|
return a?.rule ?? a;
|
|
1266
1268
|
}
|
|
1267
|
-
function
|
|
1268
|
-
return P[a] ?? te[a] ?? a;
|
|
1269
|
-
}
|
|
1270
|
-
function na({ qualityMetadata: a }) {
|
|
1269
|
+
function ia({ qualityMetadata: a }) {
|
|
1271
1270
|
if (!Array.isArray(a))
|
|
1272
1271
|
return /* @__PURE__ */ e("div", { className: "alert alert-danger sodas-validation-ui sodas-validation-ui--empty", children: "qualityMetadata must be an array" });
|
|
1273
1272
|
const t = /* @__PURE__ */ new Map(), i = [];
|
|
1274
1273
|
return a.forEach((l) => {
|
|
1275
|
-
const n =
|
|
1276
|
-
t.has(
|
|
1277
|
-
}), /* @__PURE__ */ s("div", { className: "sodas-validation-ui sodas-validation-ui--
|
|
1274
|
+
const n = na(l), r = (n?.getColumn ?? n?.column ?? "") || "(no column)";
|
|
1275
|
+
t.has(r) || (t.set(r, []), i.push(r)), t.get(r).push(l);
|
|
1276
|
+
}), /* @__PURE__ */ s("div", { className: "sodas-validation-ui sodas-validation-ui--columned sodas-validation-ui--quality-metadata", children: [
|
|
1278
1277
|
/* @__PURE__ */ e("div", { className: "sodas-validation-ui__sections", children: i.map((l) => {
|
|
1279
1278
|
const n = t.get(l) ?? [];
|
|
1280
|
-
return /* @__PURE__ */ s(
|
|
1281
|
-
/* @__PURE__ */ e(
|
|
1282
|
-
/* @__PURE__ */ e("ul", { className: "list-unstyled mb-0
|
|
1279
|
+
return /* @__PURE__ */ s(f, { className: "mb-3 sodas-validation-ui__section sodas-validation-ui__section--column", children: [
|
|
1280
|
+
/* @__PURE__ */ e(f.Header, { children: /* @__PURE__ */ e("h5", { className: "mb-0 card-title", children: l }) }),
|
|
1281
|
+
/* @__PURE__ */ e(f.Body, { children: /* @__PURE__ */ e("ul", { className: "list-unstyled mb-0 sodas-validation-ui__list", children: n.map((o, r) => /* @__PURE__ */ e("li", { className: "mb-2 sodas-validation-ui__rule", children: /* @__PURE__ */ e(Ee, { item: o, showColumn: !1 }) }, r)) }) })
|
|
1283
1282
|
] }, l);
|
|
1284
1283
|
}) }),
|
|
1285
1284
|
a.length === 0 && /* @__PURE__ */ e("p", { className: "text-muted small sodas-validation-ui__empty", children: "No quality metadata to display." })
|
|
1286
1285
|
] });
|
|
1287
1286
|
}
|
|
1288
|
-
function
|
|
1287
|
+
function sa(a) {
|
|
1289
1288
|
return a?.rule ?? a;
|
|
1290
1289
|
}
|
|
1291
|
-
function
|
|
1290
|
+
function oa(a) {
|
|
1291
|
+
return P[a] ?? le[a] ?? a;
|
|
1292
|
+
}
|
|
1293
|
+
function ra({ qualityMetadata: a }) {
|
|
1292
1294
|
if (!Array.isArray(a))
|
|
1293
1295
|
return /* @__PURE__ */ e("div", { className: "alert alert-danger sodas-validation-ui sodas-validation-ui--empty", children: "qualityMetadata must be an array" });
|
|
1294
1296
|
const t = /* @__PURE__ */ new Map(), i = [];
|
|
1295
1297
|
return a.forEach((l) => {
|
|
1296
|
-
const n =
|
|
1297
|
-
t.has(
|
|
1298
|
-
}), /* @__PURE__ */ s("div", { className: "sodas-validation-ui sodas-validation-ui--
|
|
1298
|
+
const n = sa(l), o = n?.getType ?? n?.type ?? "unknown";
|
|
1299
|
+
t.has(o) || (t.set(o, []), i.push(o)), t.get(o).push(l);
|
|
1300
|
+
}), /* @__PURE__ */ s("div", { className: "sodas-validation-ui sodas-validation-ui--type-based sodas-validation-ui--quality-metadata", children: [
|
|
1299
1301
|
/* @__PURE__ */ e("div", { className: "sodas-validation-ui__sections", children: i.map((l) => {
|
|
1300
1302
|
const n = t.get(l) ?? [];
|
|
1301
|
-
return /* @__PURE__ */ s(
|
|
1302
|
-
/* @__PURE__ */ e(
|
|
1303
|
-
/* @__PURE__ */ e(
|
|
1303
|
+
return /* @__PURE__ */ s("section", { className: "card mb-3 sodas-validation-ui__section", children: [
|
|
1304
|
+
/* @__PURE__ */ e("div", { className: "card-header", children: /* @__PURE__ */ e("h5", { className: "mb-0 card-title", children: oa(l) }) }),
|
|
1305
|
+
/* @__PURE__ */ e("ul", { className: "list-unstyled mb-0 p-2 sodas-validation-ui__list", children: n.map((o, r) => /* @__PURE__ */ e("li", { className: "sodas-validation-ui__rule mb-2", children: /* @__PURE__ */ e(Ee, { item: o, showColumn: !0, showType: !1 }) }, r)) })
|
|
1304
1306
|
] }, l);
|
|
1305
1307
|
}) }),
|
|
1306
1308
|
a.length === 0 && /* @__PURE__ */ e("p", { className: "text-muted small sodas-validation-ui__empty", children: "No quality metadata to display." })
|
|
1307
1309
|
] });
|
|
1308
1310
|
}
|
|
1309
|
-
const ee = "type",
|
|
1310
|
-
function
|
|
1311
|
+
const ee = "type", ge = "column", oe = "report", ae = "__uncategorized__";
|
|
1312
|
+
function da(a) {
|
|
1311
1313
|
const t = /* @__PURE__ */ new Map(), i = [];
|
|
1312
1314
|
return a.forEach((l) => {
|
|
1313
|
-
const n = l?.assessment_id ?? l?.assessmentId ??
|
|
1315
|
+
const n = l?.assessment_id ?? l?.assessmentId ?? ae;
|
|
1314
1316
|
if (!t.has(n)) {
|
|
1315
|
-
const o = l?.assessment_name ?? l?.assessmentName ?? (n ===
|
|
1317
|
+
const o = l?.assessment_name ?? l?.assessmentName ?? (n === ae ? "Other" : n);
|
|
1316
1318
|
t.set(n, { assessmentId: n, assessmentName: o, items: [] }), i.push(n);
|
|
1317
1319
|
}
|
|
1318
1320
|
t.get(n).items.push(l);
|
|
1319
1321
|
}), i.map((l) => t.get(l));
|
|
1320
1322
|
}
|
|
1321
|
-
function
|
|
1322
|
-
const
|
|
1323
|
+
function fe(a) {
|
|
1324
|
+
const t = a.map((o) => o?.score ?? o?.rule?.score).filter((o) => typeof o == "number");
|
|
1325
|
+
if (t.length === 0) return null;
|
|
1326
|
+
const i = t.reduce((o, r) => o + r, 0) / t.length, l = Math.max(...t), n = l <= 1 && l > 0 ? i * 100 : i;
|
|
1327
|
+
return Math.round(n * 10) / 10;
|
|
1328
|
+
}
|
|
1329
|
+
function Ta({ qualityMetadata: a }) {
|
|
1330
|
+
const { t } = V(), [i, l] = T(ee);
|
|
1323
1331
|
if (!Array.isArray(a))
|
|
1324
1332
|
return /* @__PURE__ */ e("div", { className: "alert alert-danger sodas-validation-ui sodas-validation-ui--empty", children: t("qualityMetadataMustBeArray") });
|
|
1325
|
-
const n =
|
|
1333
|
+
const n = da(a);
|
|
1326
1334
|
return /* @__PURE__ */ s("div", { className: "sodas-validation-ui sodas-validation-ui--tabs sodas-validation-ui--quality-metadata-viewer", children: [
|
|
1327
1335
|
/* @__PURE__ */ e("div", { className: "d-flex flex-wrap align-items-center border-bottom pb-2 mb-3", children: /* @__PURE__ */ s(
|
|
1328
|
-
|
|
1336
|
+
L,
|
|
1329
1337
|
{
|
|
1330
1338
|
variant: "tabs",
|
|
1331
1339
|
activeKey: i,
|
|
@@ -1334,39 +1342,86 @@ function fa({ qualityMetadata: a }) {
|
|
|
1334
1342
|
"aria-label": "View mode",
|
|
1335
1343
|
className: "flex-grow-1",
|
|
1336
1344
|
children: [
|
|
1337
|
-
/* @__PURE__ */ e(
|
|
1338
|
-
|
|
1339
|
-
]
|
|
1340
|
-
}
|
|
1341
|
-
) }),
|
|
1342
|
-
n.map(({ assessmentId: o, assessmentName: r, items: h }) => /* @__PURE__ */ s(
|
|
1343
|
-
"section",
|
|
1344
|
-
{
|
|
1345
|
-
className: "sodas-validation-ui__assessment-section mb-4",
|
|
1346
|
-
"aria-labelledby": `assessment-header-${o}`,
|
|
1347
|
-
children: [
|
|
1348
|
-
/* @__PURE__ */ e(
|
|
1349
|
-
"h4",
|
|
1345
|
+
/* @__PURE__ */ e(L.Item, { children: /* @__PURE__ */ e(
|
|
1346
|
+
L.Link,
|
|
1350
1347
|
{
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1348
|
+
eventKey: ee,
|
|
1349
|
+
role: "tab",
|
|
1350
|
+
"aria-selected": i === ee,
|
|
1351
|
+
children: t("byType")
|
|
1352
|
+
}
|
|
1353
|
+
) }),
|
|
1354
|
+
/* @__PURE__ */ e(L.Item, { children: /* @__PURE__ */ e(
|
|
1355
|
+
L.Link,
|
|
1356
|
+
{
|
|
1357
|
+
eventKey: ge,
|
|
1358
|
+
role: "tab",
|
|
1359
|
+
"aria-selected": i === ge,
|
|
1360
|
+
children: t("byColumn")
|
|
1361
|
+
}
|
|
1362
|
+
) }),
|
|
1363
|
+
/* @__PURE__ */ e(L.Item, { children: /* @__PURE__ */ e(
|
|
1364
|
+
L.Link,
|
|
1365
|
+
{
|
|
1366
|
+
eventKey: oe,
|
|
1367
|
+
role: "tab",
|
|
1368
|
+
"aria-selected": i === oe,
|
|
1369
|
+
children: t("report")
|
|
1354
1370
|
}
|
|
1355
|
-
)
|
|
1356
|
-
i === ee ? /* @__PURE__ */ e(na, { qualityMetadata: h }) : /* @__PURE__ */ e(sa, { qualityMetadata: h })
|
|
1371
|
+
) })
|
|
1357
1372
|
]
|
|
1358
|
-
}
|
|
1359
|
-
|
|
1360
|
-
)
|
|
1373
|
+
}
|
|
1374
|
+
) }),
|
|
1375
|
+
i === oe ? /* @__PURE__ */ e("div", { className: "sodas-validation-ui__report-list mt-3", children: n.map(({ assessmentId: o, assessmentName: r, items: m }) => {
|
|
1376
|
+
const _ = fe(m);
|
|
1377
|
+
return /* @__PURE__ */ s(
|
|
1378
|
+
"div",
|
|
1379
|
+
{
|
|
1380
|
+
className: "d-flex justify-content-between align-items-center py-2 px-3 mb-2 rounded bg-light sodas-validation-ui__report-row",
|
|
1381
|
+
children: [
|
|
1382
|
+
/* @__PURE__ */ e("span", { className: "sodas-validation-ui__report-name fw-medium", children: o === ae ? t("other") : r }),
|
|
1383
|
+
/* @__PURE__ */ e("span", { className: "sodas-validation-ui__report-score badge bg-primary fs-6", children: _ != null ? `${_} / 100` : "—" })
|
|
1384
|
+
]
|
|
1385
|
+
},
|
|
1386
|
+
o
|
|
1387
|
+
);
|
|
1388
|
+
}) }) : n.map(({ assessmentId: o, assessmentName: r, items: m }) => {
|
|
1389
|
+
const _ = fe(m);
|
|
1390
|
+
return /* @__PURE__ */ s(
|
|
1391
|
+
"section",
|
|
1392
|
+
{
|
|
1393
|
+
className: "sodas-validation-ui__assessment-section mb-4",
|
|
1394
|
+
"aria-labelledby": `assessment-header-${o}`,
|
|
1395
|
+
children: [
|
|
1396
|
+
/* @__PURE__ */ s("div", { className: "d-flex justify-content-between align-items-center mb-3", children: [
|
|
1397
|
+
/* @__PURE__ */ e(
|
|
1398
|
+
"h4",
|
|
1399
|
+
{
|
|
1400
|
+
id: `assessment-header-${o}`,
|
|
1401
|
+
className: "sodas-validation-ui__assessment-title mb-0",
|
|
1402
|
+
children: o === ae ? t("other") : r
|
|
1403
|
+
}
|
|
1404
|
+
),
|
|
1405
|
+
_ != null && /* @__PURE__ */ s("span", { className: "sodas-validation-ui__assessment-avg-score badge bg-primary fs-6", children: [
|
|
1406
|
+
_,
|
|
1407
|
+
" / 100"
|
|
1408
|
+
] })
|
|
1409
|
+
] }),
|
|
1410
|
+
i === ee ? /* @__PURE__ */ e(ra, { qualityMetadata: m }) : /* @__PURE__ */ e(ia, { qualityMetadata: m })
|
|
1411
|
+
]
|
|
1412
|
+
},
|
|
1413
|
+
o
|
|
1414
|
+
);
|
|
1415
|
+
}),
|
|
1361
1416
|
a.length === 0 && /* @__PURE__ */ e("p", { className: "text-muted small sodas-validation-ui__empty", children: t("noQualityMetadata") })
|
|
1362
1417
|
] });
|
|
1363
1418
|
}
|
|
1364
|
-
function
|
|
1365
|
-
const [, a] =
|
|
1419
|
+
function ca() {
|
|
1420
|
+
const [, a] = T(0);
|
|
1366
1421
|
return Q(() => a((t) => t + 1), []);
|
|
1367
1422
|
}
|
|
1368
|
-
function
|
|
1369
|
-
const t =
|
|
1423
|
+
function Ca({ template: a }) {
|
|
1424
|
+
const t = ca(), i = te(a);
|
|
1370
1425
|
if (i.current = a, a == null || typeof a != "object")
|
|
1371
1426
|
return /* @__PURE__ */ e("div", { className: "alert alert-danger template-editor template-editor--empty", children: "template must be an object" });
|
|
1372
1427
|
const l = i.current;
|
|
@@ -1375,7 +1430,7 @@ function _a({ template: a }) {
|
|
|
1375
1430
|
l.name = p.target.value, t();
|
|
1376
1431
|
}, o = (p) => {
|
|
1377
1432
|
l.description = p.target.value, t();
|
|
1378
|
-
}, r = l.name ?? "",
|
|
1433
|
+
}, r = l.name ?? "", m = l.description ?? "", _ = l.validationRules;
|
|
1379
1434
|
return /* @__PURE__ */ s("div", { className: "template-editor", children: [
|
|
1380
1435
|
/* @__PURE__ */ s(c, { className: "template-editor__meta mb-4", children: [
|
|
1381
1436
|
/* @__PURE__ */ s(c.Group, { className: "mb-3", children: [
|
|
@@ -1398,7 +1453,7 @@ function _a({ template: a }) {
|
|
|
1398
1453
|
{
|
|
1399
1454
|
as: "textarea",
|
|
1400
1455
|
rows: 3,
|
|
1401
|
-
value:
|
|
1456
|
+
value: m,
|
|
1402
1457
|
onChange: o,
|
|
1403
1458
|
placeholder: "Template description",
|
|
1404
1459
|
"aria-label": "Template description"
|
|
@@ -1408,33 +1463,33 @@ function _a({ template: a }) {
|
|
|
1408
1463
|
] }),
|
|
1409
1464
|
/* @__PURE__ */ s("div", { className: "template-editor__rules pt-3 border-top", children: [
|
|
1410
1465
|
/* @__PURE__ */ e("h5", { className: "mb-3", children: "Validation Rules" }),
|
|
1411
|
-
/* @__PURE__ */ e(
|
|
1466
|
+
/* @__PURE__ */ e(we, { validationRules: _ })
|
|
1412
1467
|
] })
|
|
1413
1468
|
] });
|
|
1414
1469
|
}
|
|
1415
|
-
function
|
|
1416
|
-
const [, a] =
|
|
1470
|
+
function ma() {
|
|
1471
|
+
const [, a] = T(0);
|
|
1417
1472
|
return Q(() => a((t) => t + 1), []);
|
|
1418
1473
|
}
|
|
1419
|
-
function
|
|
1420
|
-
const i =
|
|
1474
|
+
function Aa({ qualityRequirement: a, hook_names: t = [] }) {
|
|
1475
|
+
const i = ma(), l = te(a);
|
|
1421
1476
|
if (l.current = a, a == null || typeof a != "object")
|
|
1422
1477
|
return /* @__PURE__ */ e("div", { className: "alert alert-danger quality-requirement-editor quality-requirement-editor--empty", children: "qualityRequirement must be an object" });
|
|
1423
1478
|
const n = l.current;
|
|
1424
1479
|
Array.isArray(n.nodes) || (n.nodes = []);
|
|
1425
|
-
const o = (
|
|
1426
|
-
n.name =
|
|
1480
|
+
const o = (u) => {
|
|
1481
|
+
n.name = u.target.value, i();
|
|
1427
1482
|
}, r = () => {
|
|
1428
1483
|
n.nodes.push({
|
|
1429
1484
|
node_name: "",
|
|
1430
1485
|
hook: "",
|
|
1431
1486
|
validation_rules: []
|
|
1432
1487
|
}), i();
|
|
1433
|
-
},
|
|
1434
|
-
n.nodes.splice(
|
|
1435
|
-
},
|
|
1436
|
-
const d = n.nodes[
|
|
1437
|
-
d && (d[N] =
|
|
1488
|
+
}, m = (u) => {
|
|
1489
|
+
n.nodes.splice(u, 1), i();
|
|
1490
|
+
}, _ = (u, N, C) => {
|
|
1491
|
+
const d = n.nodes[u];
|
|
1492
|
+
d && (d[N] = C, i());
|
|
1438
1493
|
}, p = n.name ?? "", w = n.nodes;
|
|
1439
1494
|
return /* @__PURE__ */ s("div", { className: "quality-requirement-editor", children: [
|
|
1440
1495
|
/* @__PURE__ */ e(c, { className: "quality-requirement-editor__meta mb-4", children: /* @__PURE__ */ s(c.Group, { children: [
|
|
@@ -1455,7 +1510,7 @@ function Ta({ qualityRequirement: a, hook_names: t = [] }) {
|
|
|
1455
1510
|
/* @__PURE__ */ s("div", { className: "d-flex justify-content-between align-items-center mb-3", children: [
|
|
1456
1511
|
/* @__PURE__ */ e("h5", { className: "mb-0", children: "Nodes" }),
|
|
1457
1512
|
/* @__PURE__ */ e(
|
|
1458
|
-
|
|
1513
|
+
M,
|
|
1459
1514
|
{
|
|
1460
1515
|
variant: "primary",
|
|
1461
1516
|
size: "sm",
|
|
@@ -1466,21 +1521,21 @@ function Ta({ qualityRequirement: a, hook_names: t = [] }) {
|
|
|
1466
1521
|
)
|
|
1467
1522
|
] }),
|
|
1468
1523
|
w.length === 0 && /* @__PURE__ */ e("p", { className: "text-muted small quality-requirement-editor__empty-nodes", children: 'No nodes. Click "Add node" to add one.' }),
|
|
1469
|
-
/* @__PURE__ */ e("ul", { className: "list-unstyled mb-0 quality-requirement-editor__list", children: w.map((
|
|
1470
|
-
|
|
1524
|
+
/* @__PURE__ */ e("ul", { className: "list-unstyled mb-0 quality-requirement-editor__list", children: w.map((u, N) => /* @__PURE__ */ e("li", { className: "quality-requirement-editor__node mb-3", children: /* @__PURE__ */ e(
|
|
1525
|
+
ua,
|
|
1471
1526
|
{
|
|
1472
|
-
node:
|
|
1527
|
+
node: u,
|
|
1473
1528
|
index: N,
|
|
1474
1529
|
hookNames: t,
|
|
1475
|
-
onRemove: () =>
|
|
1476
|
-
onFieldChange: (
|
|
1530
|
+
onRemove: () => m(N),
|
|
1531
|
+
onFieldChange: (C, d) => _(N, C, d)
|
|
1477
1532
|
}
|
|
1478
1533
|
) }, N)) })
|
|
1479
1534
|
] })
|
|
1480
1535
|
] });
|
|
1481
1536
|
}
|
|
1482
|
-
function
|
|
1483
|
-
const o =
|
|
1537
|
+
function ua({ node: a, index: t, hookNames: i = [], onRemove: l, onFieldChange: n }) {
|
|
1538
|
+
const o = te(a);
|
|
1484
1539
|
o.current = a;
|
|
1485
1540
|
const r = o.current;
|
|
1486
1541
|
return Array.isArray(r.validation_rules) || (r.validation_rules = []), /* @__PURE__ */ s(f, { className: "quality-requirement-editor__node-card", children: [
|
|
@@ -1490,7 +1545,7 @@ function ca({ node: a, index: t, hookNames: i = [], onRemove: l, onFieldChange:
|
|
|
1490
1545
|
t + 1
|
|
1491
1546
|
] }),
|
|
1492
1547
|
/* @__PURE__ */ e(
|
|
1493
|
-
|
|
1548
|
+
M,
|
|
1494
1549
|
{
|
|
1495
1550
|
variant: "danger",
|
|
1496
1551
|
size: "sm",
|
|
@@ -1510,7 +1565,7 @@ function ca({ node: a, index: t, hookNames: i = [], onRemove: l, onFieldChange:
|
|
|
1510
1565
|
size: "sm",
|
|
1511
1566
|
type: "text",
|
|
1512
1567
|
value: r.node_name ?? "",
|
|
1513
|
-
onChange: (
|
|
1568
|
+
onChange: (m) => n("node_name", m.target.value),
|
|
1514
1569
|
placeholder: "node_name",
|
|
1515
1570
|
"aria-label": "Node name"
|
|
1516
1571
|
}
|
|
@@ -1523,11 +1578,11 @@ function ca({ node: a, index: t, hookNames: i = [], onRemove: l, onFieldChange:
|
|
|
1523
1578
|
{
|
|
1524
1579
|
size: "sm",
|
|
1525
1580
|
value: r.hook ?? "",
|
|
1526
|
-
onChange: (
|
|
1581
|
+
onChange: (m) => n("hook", m.target.value),
|
|
1527
1582
|
"aria-label": "Hook",
|
|
1528
1583
|
children: [
|
|
1529
1584
|
/* @__PURE__ */ e("option", { value: "", children: "선택" }),
|
|
1530
|
-
i.map((
|
|
1585
|
+
i.map((m) => /* @__PURE__ */ e("option", { value: m, children: m }, m))
|
|
1531
1586
|
]
|
|
1532
1587
|
}
|
|
1533
1588
|
)
|
|
@@ -1535,15 +1590,15 @@ function ca({ node: a, index: t, hookNames: i = [], onRemove: l, onFieldChange:
|
|
|
1535
1590
|
] }) }),
|
|
1536
1591
|
/* @__PURE__ */ s("div", { className: "quality-requirement-editor__node-rules pt-3 border-top", children: [
|
|
1537
1592
|
/* @__PURE__ */ e("h6", { className: "mb-2", children: "Validation rules" }),
|
|
1538
|
-
/* @__PURE__ */ e(
|
|
1593
|
+
/* @__PURE__ */ e(we, { validationRules: r.validation_rules })
|
|
1539
1594
|
] })
|
|
1540
1595
|
] })
|
|
1541
1596
|
] });
|
|
1542
1597
|
}
|
|
1543
|
-
function
|
|
1544
|
-
return P[a] ??
|
|
1598
|
+
function ha(a) {
|
|
1599
|
+
return P[a] ?? le[a] ?? a;
|
|
1545
1600
|
}
|
|
1546
|
-
function
|
|
1601
|
+
function Sa({ qualityRequirement: a }) {
|
|
1547
1602
|
if (a == null || typeof a != "object")
|
|
1548
1603
|
return /* @__PURE__ */ e("div", { className: "alert alert-danger sodas-validation-ui sodas-validation-ui--empty", children: "qualityRequirement must be an object" });
|
|
1549
1604
|
const t = a.name ?? "", i = Array.isArray(a.nodes) ? a.nodes : [];
|
|
@@ -1552,11 +1607,11 @@ function Ca({ qualityRequirement: a }) {
|
|
|
1552
1607
|
/* @__PURE__ */ s("div", { className: "pt-3 border-top", children: [
|
|
1553
1608
|
/* @__PURE__ */ e("h5", { className: "mb-3", children: "Nodes" }),
|
|
1554
1609
|
i.length === 0 && /* @__PURE__ */ e("p", { className: "text-muted small mb-0", children: "No nodes." }),
|
|
1555
|
-
/* @__PURE__ */ e("ul", { className: "list-unstyled mb-0", children: i.map((l, n) => /* @__PURE__ */ e("li", { className: "mb-3", children: /* @__PURE__ */ e(
|
|
1610
|
+
/* @__PURE__ */ e("ul", { className: "list-unstyled mb-0", children: i.map((l, n) => /* @__PURE__ */ e("li", { className: "mb-3", children: /* @__PURE__ */ e(pa, { node: l, index: n }) }, n)) })
|
|
1556
1611
|
] })
|
|
1557
1612
|
] });
|
|
1558
1613
|
}
|
|
1559
|
-
function
|
|
1614
|
+
function pa({ node: a, index: t }) {
|
|
1560
1615
|
const i = a?.node_name ?? "—", l = a?.hook ?? "—", n = Array.isArray(a?.validation_rules) ? a.validation_rules : [];
|
|
1561
1616
|
return /* @__PURE__ */ s(f, { className: "sodas-validation-ui__rule-card", children: [
|
|
1562
1617
|
/* @__PURE__ */ e(f.Header, { children: /* @__PURE__ */ s(f.Title, { className: "mb-0 fs-6", children: [
|
|
@@ -1571,29 +1626,29 @@ function ua({ node: a, index: t }) {
|
|
|
1571
1626
|
/* @__PURE__ */ s("div", { className: "pt-3 border-top", children: [
|
|
1572
1627
|
/* @__PURE__ */ e("h6", { className: "mb-2", children: "Validation rules" }),
|
|
1573
1628
|
n.length === 0 ? /* @__PURE__ */ e("p", { className: "text-muted small mb-0", children: "No validation rules." }) : /* @__PURE__ */ e("ul", { className: "list-unstyled mb-0 sodas-validation-ui__list", children: n.map((o, r) => /* @__PURE__ */ e("li", { className: "mb-2", children: /* @__PURE__ */ e(f, { className: "sodas-validation-ui__rule-card", children: /* @__PURE__ */ s(f.Body, { className: "py-2", children: [
|
|
1574
|
-
/* @__PURE__ */ e("div", { className: "mb-1", children: /* @__PURE__ */ e("span", { className: "fw-semibold small", children:
|
|
1575
|
-
/* @__PURE__ */ e(
|
|
1629
|
+
/* @__PURE__ */ e("div", { className: "mb-1", children: /* @__PURE__ */ e("span", { className: "fw-semibold small", children: ha(o?.getType ?? o?.type) }) }),
|
|
1630
|
+
/* @__PURE__ */ e(ne, { rule: o, showColumn: !0 })
|
|
1576
1631
|
] }) }) }, r)) })
|
|
1577
1632
|
] })
|
|
1578
1633
|
] })
|
|
1579
1634
|
] });
|
|
1580
1635
|
}
|
|
1581
1636
|
export {
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1637
|
+
ia as ColumnedQualityMetadataViewer,
|
|
1638
|
+
Qe as ColumnedValidationRulesEditor,
|
|
1639
|
+
Je as ColumnedValidationRulesViewer,
|
|
1640
|
+
ga as I18nProvider,
|
|
1641
|
+
Ta as QualityMetadataViewer,
|
|
1642
|
+
Aa as QualityRequirementEditor,
|
|
1643
|
+
Sa as QualityRequirementViewer,
|
|
1644
|
+
Ca as TemplateEditor,
|
|
1645
|
+
ra as TypeBasedQualityMetadataViewer,
|
|
1646
|
+
Ze as TypeBasedValidationRulesEditor,
|
|
1647
|
+
aa as TypeBasedValidationRulesViewer,
|
|
1648
|
+
we as ValidationRulesEditor,
|
|
1649
|
+
_a as ValidationRulesViewer,
|
|
1595
1650
|
U as defaultLocale,
|
|
1596
1651
|
I as translations,
|
|
1597
|
-
|
|
1598
|
-
|
|
1652
|
+
fa as useI18n,
|
|
1653
|
+
V as useI18nOptional
|
|
1599
1654
|
};
|