sodas-validation-ui 0.7.0 → 0.8.0
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 +319 -316
- package/dist/sodas-validation-ui.umd.cjs +1 -1
- package/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsx as a, jsxs as i, Fragment as
|
|
1
|
+
import { jsx as a, jsxs as i, Fragment as S } from "react/jsx-runtime";
|
|
2
2
|
import { useState as E, useCallback as D, useEffect as Z, useRef as B } from "react";
|
|
3
|
-
import { Card as
|
|
3
|
+
import { Card as f, Button as O, Form as c, Nav as R, Badge as J } from "react-bootstrap";
|
|
4
4
|
import { VALIDATION_TYPE as p, COMPARISION_OPERATOR as F, CUSTOM_CONDITION_TYPE as z, OUTLIER_METHOD as Y, EXPECTED_TYPE as k, DATETIME_FORMAT_TYPE as H, createRule as Q, ColumnGroupedValidationRules as L } from "sodas-sdk";
|
|
5
|
-
function
|
|
5
|
+
function _({ label: e, value: t = "" }) {
|
|
6
6
|
return /* @__PURE__ */ i("div", { className: "mb-0 sodas-validation-ui__field sodas-validation-ui__field--readonly", children: [
|
|
7
|
-
/* @__PURE__ */ a(
|
|
7
|
+
/* @__PURE__ */ a(c.Label, { className: "text-muted small mb-0", children: e }),
|
|
8
8
|
/* @__PURE__ */ a("div", { className: "sodas-validation-ui__field-value", children: t })
|
|
9
9
|
] });
|
|
10
10
|
}
|
|
@@ -31,238 +31,238 @@ const M = {
|
|
|
31
31
|
statistical: "Statistical",
|
|
32
32
|
custom: "Custom"
|
|
33
33
|
}, G = Object.entries(F).map(([e, t]) => ({ value: t, label: e })), ee = Object.entries(z).map(([e, t]) => ({ value: t, label: e })), ae = Object.entries(Y).map(([e, t]) => ({ value: t, label: e })), te = Object.entries(k).map(([e, t]) => ({ value: t, label: e })), le = Object.entries(H).map(([e, t]) => ({ value: t, label: e }));
|
|
34
|
-
function
|
|
35
|
-
return
|
|
36
|
-
/* @__PURE__ */ a(
|
|
34
|
+
function C({ label: e, value: t = "", type: s = "text", onChange: n, options: l, checkbox: o }) {
|
|
35
|
+
return l ? /* @__PURE__ */ i(c.Group, { className: "mb-0 sodas-validation-ui__field", children: [
|
|
36
|
+
/* @__PURE__ */ a(c.Label, { children: e }),
|
|
37
37
|
/* @__PURE__ */ a(
|
|
38
|
-
|
|
38
|
+
c.Select,
|
|
39
39
|
{
|
|
40
40
|
size: "sm",
|
|
41
41
|
value: t,
|
|
42
|
-
onChange: (r) =>
|
|
42
|
+
onChange: (r) => n(r.target.value),
|
|
43
43
|
"aria-label": e,
|
|
44
|
-
children:
|
|
44
|
+
children: l.map((r) => /* @__PURE__ */ a("option", { value: r.value, children: r.label }, r.value))
|
|
45
45
|
}
|
|
46
46
|
)
|
|
47
|
-
] }) : s === "checkbox" || o ? /* @__PURE__ */ a(
|
|
48
|
-
|
|
47
|
+
] }) : s === "checkbox" || o ? /* @__PURE__ */ a(c.Group, { className: "mb-0 sodas-validation-ui__field sodas-validation-ui__field--checkbox", children: /* @__PURE__ */ a(
|
|
48
|
+
c.Check,
|
|
49
49
|
{
|
|
50
50
|
type: "checkbox",
|
|
51
51
|
label: e,
|
|
52
52
|
checked: !!t,
|
|
53
|
-
onChange: (r) =>
|
|
53
|
+
onChange: (r) => n(r.target.checked),
|
|
54
54
|
"aria-label": e
|
|
55
55
|
}
|
|
56
|
-
) }) : /* @__PURE__ */ i(
|
|
57
|
-
/* @__PURE__ */ a(
|
|
56
|
+
) }) : /* @__PURE__ */ i(c.Group, { className: "mb-0 sodas-validation-ui__field", children: [
|
|
57
|
+
/* @__PURE__ */ a(c.Label, { children: e }),
|
|
58
58
|
/* @__PURE__ */ a(
|
|
59
|
-
|
|
59
|
+
c.Control,
|
|
60
60
|
{
|
|
61
61
|
size: "sm",
|
|
62
62
|
type: s,
|
|
63
63
|
value: t,
|
|
64
|
-
onChange: (r) =>
|
|
64
|
+
onChange: (r) => n(r.target.value),
|
|
65
65
|
"aria-label": e
|
|
66
66
|
}
|
|
67
67
|
)
|
|
68
68
|
] });
|
|
69
69
|
}
|
|
70
70
|
function ne({ rule: e, type: t, forceUpdate: s }) {
|
|
71
|
-
const
|
|
72
|
-
typeof
|
|
71
|
+
const n = (l, o) => {
|
|
72
|
+
typeof l == "function" && l.call(e, o), s();
|
|
73
73
|
};
|
|
74
74
|
switch (t) {
|
|
75
75
|
case p.UNIQUENESS:
|
|
76
76
|
return /* @__PURE__ */ a(
|
|
77
|
-
|
|
77
|
+
C,
|
|
78
78
|
{
|
|
79
79
|
label: "Unique",
|
|
80
80
|
type: "checkbox",
|
|
81
81
|
value: e.getUnique,
|
|
82
|
-
onChange: (
|
|
82
|
+
onChange: (l) => n(e.setUnique, !!l),
|
|
83
83
|
checkbox: !0
|
|
84
84
|
}
|
|
85
85
|
);
|
|
86
86
|
case p.PATTERN:
|
|
87
87
|
return /* @__PURE__ */ a(
|
|
88
|
-
|
|
88
|
+
C,
|
|
89
89
|
{
|
|
90
90
|
label: "Pattern",
|
|
91
91
|
value: e.getPattern ?? "",
|
|
92
|
-
onChange: (
|
|
92
|
+
onChange: (l) => n(e.setPattern, l)
|
|
93
93
|
}
|
|
94
94
|
);
|
|
95
95
|
case p.RANGE:
|
|
96
|
-
return /* @__PURE__ */ i(
|
|
96
|
+
return /* @__PURE__ */ i(S, { children: [
|
|
97
97
|
/* @__PURE__ */ a(
|
|
98
|
-
|
|
98
|
+
C,
|
|
99
99
|
{
|
|
100
100
|
label: "Min value",
|
|
101
101
|
type: "number",
|
|
102
102
|
value: String(e.getMinValue ?? 0),
|
|
103
|
-
onChange: (
|
|
103
|
+
onChange: (l) => n(e.setMinValue, Number(l) || 0)
|
|
104
104
|
}
|
|
105
105
|
),
|
|
106
106
|
/* @__PURE__ */ a(
|
|
107
|
-
|
|
107
|
+
C,
|
|
108
108
|
{
|
|
109
109
|
label: "Max value",
|
|
110
110
|
type: "number",
|
|
111
111
|
value: String(e.getMaxValue ?? 0),
|
|
112
|
-
onChange: (
|
|
112
|
+
onChange: (l) => n(e.setMaxValue, Number(l) || 0)
|
|
113
113
|
}
|
|
114
114
|
)
|
|
115
115
|
] });
|
|
116
116
|
case p.LENGTH:
|
|
117
|
-
return /* @__PURE__ */ i(
|
|
117
|
+
return /* @__PURE__ */ i(S, { children: [
|
|
118
118
|
/* @__PURE__ */ a(
|
|
119
|
-
|
|
119
|
+
C,
|
|
120
120
|
{
|
|
121
121
|
label: "Min length",
|
|
122
122
|
type: "number",
|
|
123
123
|
value: String(e.getMinLength ?? 0),
|
|
124
|
-
onChange: (
|
|
124
|
+
onChange: (l) => n(e.setMinLength, Number(l) || 0)
|
|
125
125
|
}
|
|
126
126
|
),
|
|
127
127
|
/* @__PURE__ */ a(
|
|
128
|
-
|
|
128
|
+
C,
|
|
129
129
|
{
|
|
130
130
|
label: "Max length",
|
|
131
131
|
type: "number",
|
|
132
132
|
value: String(e.getMaxLength ?? 0),
|
|
133
|
-
onChange: (
|
|
133
|
+
onChange: (l) => n(e.setMaxLength, Number(l) || 0)
|
|
134
134
|
}
|
|
135
135
|
)
|
|
136
136
|
] });
|
|
137
137
|
case p.ALLOWED_VALUES: {
|
|
138
|
-
const
|
|
138
|
+
const l = e.getAllowedValues ?? [], o = Array.isArray(l) ? l.join(", ") : "";
|
|
139
139
|
return /* @__PURE__ */ a(
|
|
140
|
-
|
|
140
|
+
C,
|
|
141
141
|
{
|
|
142
142
|
label: "Allowed values (comma-separated)",
|
|
143
143
|
value: o,
|
|
144
|
-
onChange: (r) =>
|
|
144
|
+
onChange: (r) => n(e.setAllowedValues, r.split(",").map((b) => b.trim()).filter(Boolean))
|
|
145
145
|
}
|
|
146
146
|
);
|
|
147
147
|
}
|
|
148
148
|
case p.COMPLETENESS:
|
|
149
149
|
return /* @__PURE__ */ a(
|
|
150
|
-
|
|
150
|
+
C,
|
|
151
151
|
{
|
|
152
152
|
label: "Min completeness",
|
|
153
153
|
type: "number",
|
|
154
154
|
value: String(e.getMinCompleteness ?? 0),
|
|
155
|
-
onChange: (
|
|
155
|
+
onChange: (l) => n(e.setMinCompleteness, Number(l) || 0)
|
|
156
156
|
}
|
|
157
157
|
);
|
|
158
158
|
case p.DATA_TYPE: {
|
|
159
|
-
const
|
|
160
|
-
return /* @__PURE__ */ i(
|
|
159
|
+
const l = e.getExpectedType ?? k.STRING;
|
|
160
|
+
return /* @__PURE__ */ i(S, { children: [
|
|
161
161
|
/* @__PURE__ */ a(
|
|
162
|
-
|
|
162
|
+
C,
|
|
163
163
|
{
|
|
164
164
|
label: "Expected type",
|
|
165
|
-
value:
|
|
165
|
+
value: l,
|
|
166
166
|
options: te,
|
|
167
|
-
onChange: (o) =>
|
|
167
|
+
onChange: (o) => n(e.setExpectedType, o)
|
|
168
168
|
}
|
|
169
169
|
),
|
|
170
|
-
|
|
171
|
-
|
|
170
|
+
l === k.DATETIME && /* @__PURE__ */ a(
|
|
171
|
+
C,
|
|
172
172
|
{
|
|
173
173
|
label: "Datetime format",
|
|
174
174
|
value: e.getDatetimeFormat ?? H.YYYY_MM_DD_HH_MM_SS,
|
|
175
175
|
options: le,
|
|
176
|
-
onChange: (o) =>
|
|
176
|
+
onChange: (o) => n(e.setDatetimeFormat, o)
|
|
177
177
|
}
|
|
178
178
|
)
|
|
179
179
|
] });
|
|
180
180
|
}
|
|
181
181
|
case p.OUTLIER:
|
|
182
|
-
return /* @__PURE__ */ i(
|
|
182
|
+
return /* @__PURE__ */ i(S, { children: [
|
|
183
183
|
/* @__PURE__ */ a(
|
|
184
|
-
|
|
184
|
+
C,
|
|
185
185
|
{
|
|
186
186
|
label: "Method",
|
|
187
187
|
value: e.getMethod ?? Y.Z_SCORE,
|
|
188
188
|
options: ae,
|
|
189
|
-
onChange: (
|
|
189
|
+
onChange: (l) => n(e.setMethod, l)
|
|
190
190
|
}
|
|
191
191
|
),
|
|
192
192
|
/* @__PURE__ */ a(
|
|
193
|
-
|
|
193
|
+
C,
|
|
194
194
|
{
|
|
195
195
|
label: "Threshold",
|
|
196
196
|
type: "number",
|
|
197
197
|
value: String(e.getThreshold ?? 0),
|
|
198
|
-
onChange: (
|
|
198
|
+
onChange: (l) => n(e.setThreshold, Number(l) || 0)
|
|
199
199
|
}
|
|
200
200
|
)
|
|
201
201
|
] });
|
|
202
202
|
case p.STATISTICAL:
|
|
203
|
-
return /* @__PURE__ */ i(
|
|
203
|
+
return /* @__PURE__ */ i(S, { children: [
|
|
204
204
|
/* @__PURE__ */ a(
|
|
205
|
-
|
|
205
|
+
C,
|
|
206
206
|
{
|
|
207
207
|
label: "Check",
|
|
208
208
|
value: e.getCheck ?? "",
|
|
209
|
-
onChange: (
|
|
209
|
+
onChange: (l) => n(e.setCheck, l)
|
|
210
210
|
}
|
|
211
211
|
),
|
|
212
212
|
/* @__PURE__ */ a(
|
|
213
|
-
|
|
213
|
+
C,
|
|
214
214
|
{
|
|
215
215
|
label: "Threshold",
|
|
216
216
|
type: "number",
|
|
217
217
|
value: String(e.getThreshold ?? 0),
|
|
218
|
-
onChange: (
|
|
218
|
+
onChange: (l) => n(e.setThreshold, Number(l) || 0)
|
|
219
219
|
}
|
|
220
220
|
),
|
|
221
221
|
/* @__PURE__ */ a(
|
|
222
|
-
|
|
222
|
+
C,
|
|
223
223
|
{
|
|
224
224
|
label: "Comparison",
|
|
225
225
|
value: e.getComparision ?? F.EQUAL,
|
|
226
226
|
options: G,
|
|
227
|
-
onChange: (
|
|
227
|
+
onChange: (l) => n(e.setComparision, l)
|
|
228
228
|
}
|
|
229
229
|
)
|
|
230
230
|
] });
|
|
231
231
|
case p.CUSTOM: {
|
|
232
|
-
const
|
|
233
|
-
return /* @__PURE__ */ i(
|
|
232
|
+
const l = e.getCondition ?? {};
|
|
233
|
+
return /* @__PURE__ */ i(S, { children: [
|
|
234
234
|
/* @__PURE__ */ a(
|
|
235
|
-
|
|
235
|
+
C,
|
|
236
236
|
{
|
|
237
237
|
label: "Condition type",
|
|
238
|
-
value:
|
|
238
|
+
value: l.type ?? z.ALL,
|
|
239
239
|
options: ee,
|
|
240
|
-
onChange: (o) =>
|
|
241
|
-
...
|
|
240
|
+
onChange: (o) => n(e.setCondition, {
|
|
241
|
+
...l,
|
|
242
242
|
type: o
|
|
243
243
|
})
|
|
244
244
|
}
|
|
245
245
|
),
|
|
246
246
|
/* @__PURE__ */ a(
|
|
247
|
-
|
|
247
|
+
C,
|
|
248
248
|
{
|
|
249
249
|
label: "Threshold (threholder)",
|
|
250
250
|
type: "number",
|
|
251
|
-
value: String(
|
|
252
|
-
onChange: (o) =>
|
|
253
|
-
...
|
|
251
|
+
value: String(l.threholder ?? 0),
|
|
252
|
+
onChange: (o) => n(e.setCondition, {
|
|
253
|
+
...l,
|
|
254
254
|
threholder: Number(o) || 0
|
|
255
255
|
})
|
|
256
256
|
}
|
|
257
257
|
),
|
|
258
258
|
/* @__PURE__ */ a(
|
|
259
|
-
|
|
259
|
+
C,
|
|
260
260
|
{
|
|
261
261
|
label: "Comparison",
|
|
262
|
-
value:
|
|
262
|
+
value: l.comparision ?? F.EQUAL,
|
|
263
263
|
options: G,
|
|
264
|
-
onChange: (o) =>
|
|
265
|
-
...
|
|
264
|
+
onChange: (o) => n(e.setCondition, {
|
|
265
|
+
...l,
|
|
266
266
|
comparision: o
|
|
267
267
|
})
|
|
268
268
|
}
|
|
@@ -280,58 +280,58 @@ function ie({ rule: e, type: t }) {
|
|
|
280
280
|
switch (t ?? T(e, "getType", "type")) {
|
|
281
281
|
case p.UNIQUENESS:
|
|
282
282
|
case "uniqueness":
|
|
283
|
-
return /* @__PURE__ */ a(
|
|
283
|
+
return /* @__PURE__ */ a(_, { label: "Unique", value: T(e, "getUnique", "unique") ? "Yes" : "No" });
|
|
284
284
|
case p.PATTERN:
|
|
285
285
|
case "pattern":
|
|
286
|
-
return /* @__PURE__ */ a(
|
|
286
|
+
return /* @__PURE__ */ a(_, { label: "Pattern", value: T(e, "getPattern", "pattern") ?? "—" });
|
|
287
287
|
case p.RANGE:
|
|
288
288
|
case "range":
|
|
289
|
-
return /* @__PURE__ */ i(
|
|
290
|
-
/* @__PURE__ */ a(
|
|
291
|
-
/* @__PURE__ */ a(
|
|
289
|
+
return /* @__PURE__ */ i(S, { children: [
|
|
290
|
+
/* @__PURE__ */ a(_, { label: "Min value", value: String(T(e, "getMinValue", "min_value") ?? "—") }),
|
|
291
|
+
/* @__PURE__ */ a(_, { label: "Max value", value: String(T(e, "getMaxValue", "max_value") ?? "—") })
|
|
292
292
|
] });
|
|
293
293
|
case p.LENGTH:
|
|
294
294
|
case "length":
|
|
295
|
-
return /* @__PURE__ */ i(
|
|
296
|
-
/* @__PURE__ */ a(
|
|
297
|
-
/* @__PURE__ */ a(
|
|
295
|
+
return /* @__PURE__ */ i(S, { children: [
|
|
296
|
+
/* @__PURE__ */ a(_, { label: "Min length", value: String(T(e, "getMinLength", "min_length") ?? "—") }),
|
|
297
|
+
/* @__PURE__ */ a(_, { label: "Max length", value: String(T(e, "getMaxLength", "max_length") ?? "—") })
|
|
298
298
|
] });
|
|
299
299
|
case p.ALLOWED_VALUES:
|
|
300
300
|
case "allowed_values": {
|
|
301
|
-
const
|
|
302
|
-
return /* @__PURE__ */ a(
|
|
301
|
+
const n = T(e, "getAllowedValues", "allowed_values") ?? [], l = Array.isArray(n) ? n.join(", ") : "—";
|
|
302
|
+
return /* @__PURE__ */ a(_, { label: "Allowed values", value: l });
|
|
303
303
|
}
|
|
304
304
|
case p.COMPLETENESS:
|
|
305
305
|
case "completeness":
|
|
306
|
-
return /* @__PURE__ */ a(
|
|
306
|
+
return /* @__PURE__ */ a(_, { label: "Min completeness", value: String(T(e, "getMinCompleteness", "min_completeness") ?? "—") });
|
|
307
307
|
case p.DATA_TYPE:
|
|
308
308
|
case "data_type": {
|
|
309
|
-
const
|
|
310
|
-
return /* @__PURE__ */ i(
|
|
311
|
-
/* @__PURE__ */ a(
|
|
312
|
-
o !== null && /* @__PURE__ */ a(
|
|
309
|
+
const n = T(e, "getExpectedType", "expected_type") ?? k.STRING ?? "string", o = n === (k?.DATETIME ?? "datetime") ? T(e, "getDatetimeFormat", "datetime_format") ?? "—" : null;
|
|
310
|
+
return /* @__PURE__ */ i(S, { children: [
|
|
311
|
+
/* @__PURE__ */ a(_, { label: "Expected type", value: n }),
|
|
312
|
+
o !== null && /* @__PURE__ */ a(_, { label: "Datetime format", value: o })
|
|
313
313
|
] });
|
|
314
314
|
}
|
|
315
315
|
case p.OUTLIER:
|
|
316
316
|
case "outlier":
|
|
317
|
-
return /* @__PURE__ */ i(
|
|
318
|
-
/* @__PURE__ */ a(
|
|
319
|
-
/* @__PURE__ */ a(
|
|
317
|
+
return /* @__PURE__ */ i(S, { children: [
|
|
318
|
+
/* @__PURE__ */ a(_, { label: "Method", value: T(e, "getMethod", "method") ?? "—" }),
|
|
319
|
+
/* @__PURE__ */ a(_, { label: "Threshold", value: String(T(e, "getThreshold", "threshold") ?? "—") })
|
|
320
320
|
] });
|
|
321
321
|
case p.STATISTICAL:
|
|
322
322
|
case "statistical":
|
|
323
|
-
return /* @__PURE__ */ i(
|
|
324
|
-
/* @__PURE__ */ a(
|
|
325
|
-
/* @__PURE__ */ a(
|
|
326
|
-
/* @__PURE__ */ a(
|
|
323
|
+
return /* @__PURE__ */ i(S, { children: [
|
|
324
|
+
/* @__PURE__ */ a(_, { label: "Check", value: T(e, "getCheck", "check") ?? "—" }),
|
|
325
|
+
/* @__PURE__ */ a(_, { label: "Threshold", value: String(T(e, "getThreshold", "threshold") ?? "—") }),
|
|
326
|
+
/* @__PURE__ */ a(_, { label: "Comparison", value: T(e, "getComparision", "comparision") ?? "—" })
|
|
327
327
|
] });
|
|
328
328
|
case p.CUSTOM:
|
|
329
329
|
case "custom": {
|
|
330
|
-
const
|
|
331
|
-
return /* @__PURE__ */ i(
|
|
332
|
-
/* @__PURE__ */ a(
|
|
333
|
-
/* @__PURE__ */ a(
|
|
334
|
-
/* @__PURE__ */ a(
|
|
330
|
+
const n = T(e, "getCondition", "condition") ?? {};
|
|
331
|
+
return /* @__PURE__ */ i(S, { children: [
|
|
332
|
+
/* @__PURE__ */ a(_, { label: "Condition type", value: n.type ?? "—" }),
|
|
333
|
+
/* @__PURE__ */ a(_, { label: "Threshold", value: String(n.threholder ?? "—") }),
|
|
334
|
+
/* @__PURE__ */ a(_, { label: "Comparison", value: n.comparision ?? "—" })
|
|
335
335
|
] });
|
|
336
336
|
}
|
|
337
337
|
default:
|
|
@@ -342,17 +342,17 @@ function $({ rule: e, showColumn: t = !0 }) {
|
|
|
342
342
|
const s = e?.getType ?? e?.type;
|
|
343
343
|
return /* @__PURE__ */ a("div", { className: "sodas-validation-ui__rule-display", children: /* @__PURE__ */ i("div", { className: "d-flex flex-wrap gap-2 align-items-end sodas-validation-ui__rule-fields-row", children: [
|
|
344
344
|
/* @__PURE__ */ i("div", { className: "d-flex flex-wrap gap-2 sodas-validation-ui__fields", children: [
|
|
345
|
-
t && /* @__PURE__ */ a(
|
|
346
|
-
/* @__PURE__ */ a(
|
|
345
|
+
t && /* @__PURE__ */ a(_, { label: "Column", value: e?.getColumn ?? e?.column ?? "—" }),
|
|
346
|
+
/* @__PURE__ */ a(_, { label: "Name", value: e?.getName ?? e?.name ?? "—" })
|
|
347
347
|
] }),
|
|
348
348
|
/* @__PURE__ */ a("div", { className: "d-flex flex-wrap gap-2 sodas-validation-ui__type-fields", children: /* @__PURE__ */ a(ie, { rule: e, type: s }) })
|
|
349
349
|
] }) });
|
|
350
350
|
}
|
|
351
|
-
function K({ rule: e, index: t, onRemove: s, onCommonChange:
|
|
351
|
+
function K({ rule: e, index: t, onRemove: s, onCommonChange: n, forceUpdate: l, showColumn: o = !0 }) {
|
|
352
352
|
const r = e.getType;
|
|
353
|
-
return /* @__PURE__ */ a(
|
|
353
|
+
return /* @__PURE__ */ a(f, { className: "sodas-validation-ui__rule-card", children: /* @__PURE__ */ i(f.Body, { children: [
|
|
354
354
|
/* @__PURE__ */ i("div", { className: "d-flex justify-content-between align-items-center mb-2", children: [
|
|
355
|
-
/* @__PURE__ */ a(
|
|
355
|
+
/* @__PURE__ */ a(f.Title, { className: "mb-0 fs-6", children: M[r] ?? r }),
|
|
356
356
|
/* @__PURE__ */ a(
|
|
357
357
|
O,
|
|
358
358
|
{
|
|
@@ -366,10 +366,10 @@ function K({ rule: e, index: t, onRemove: s, onCommonChange: l, forceUpdate: n,
|
|
|
366
366
|
] }),
|
|
367
367
|
/* @__PURE__ */ i("div", { className: "d-flex flex-wrap gap-2 align-items-end sodas-validation-ui__rule-fields-row", children: [
|
|
368
368
|
/* @__PURE__ */ i("div", { className: "d-flex flex-wrap gap-2 sodas-validation-ui__fields", children: [
|
|
369
|
-
o && /* @__PURE__ */ a(
|
|
370
|
-
/* @__PURE__ */ a(
|
|
369
|
+
o && /* @__PURE__ */ a(C, { label: "Column", value: e.getColumn, onChange: (b) => n(e, "column", b) }),
|
|
370
|
+
/* @__PURE__ */ a(C, { label: "Name", value: e.getName, onChange: (b) => n(e, "name", b) })
|
|
371
371
|
] }),
|
|
372
|
-
/* @__PURE__ */ a("div", { className: "d-flex flex-wrap gap-2 sodas-validation-ui__type-fields", children: /* @__PURE__ */ a(ne, { rule: e, type: r, forceUpdate:
|
|
372
|
+
/* @__PURE__ */ a("div", { className: "d-flex flex-wrap gap-2 sodas-validation-ui__type-fields", children: /* @__PURE__ */ a(ne, { rule: e, type: r, forceUpdate: l }) })
|
|
373
373
|
] })
|
|
374
374
|
] }) });
|
|
375
375
|
}
|
|
@@ -378,41 +378,41 @@ function se() {
|
|
|
378
378
|
return D(() => e((t) => t + 1), []);
|
|
379
379
|
}
|
|
380
380
|
function oe({ validationRules: e }) {
|
|
381
|
-
const t = se(), [s,
|
|
381
|
+
const t = se(), [s, n] = E(""), l = (m) => {
|
|
382
382
|
if (!Array.isArray(e)) return;
|
|
383
|
-
const u = Q(
|
|
383
|
+
const u = Q(m);
|
|
384
384
|
e.push(u), t();
|
|
385
385
|
}, o = () => {
|
|
386
|
-
s &&
|
|
387
|
-
}, r = (
|
|
388
|
-
Array.isArray(e) && (e.splice(
|
|
389
|
-
},
|
|
390
|
-
u === "column" ?
|
|
386
|
+
s && l(s);
|
|
387
|
+
}, r = (m) => {
|
|
388
|
+
Array.isArray(e) && (e.splice(m, 1), t());
|
|
389
|
+
}, b = (m, u, g) => {
|
|
390
|
+
u === "column" ? m.setColumn(g) : u === "name" && m.setName(g), t();
|
|
391
391
|
};
|
|
392
392
|
if (!Array.isArray(e))
|
|
393
393
|
return /* @__PURE__ */ a("div", { className: "alert alert-danger sodas-validation-ui sodas-validation-ui--empty", children: "validationRules must be an array" });
|
|
394
394
|
const A = /* @__PURE__ */ new Map();
|
|
395
|
-
e.forEach((
|
|
396
|
-
const
|
|
397
|
-
A.has(
|
|
395
|
+
e.forEach((m, u) => {
|
|
396
|
+
const g = m.getType;
|
|
397
|
+
A.has(g) || A.set(g, []), A.get(g).push({ rule: m, index: u });
|
|
398
398
|
});
|
|
399
|
-
const
|
|
400
|
-
return e.forEach((
|
|
401
|
-
const u =
|
|
402
|
-
|
|
399
|
+
const y = [];
|
|
400
|
+
return e.forEach((m) => {
|
|
401
|
+
const u = m.getType;
|
|
402
|
+
y.includes(u) || y.push(u);
|
|
403
403
|
}), /* @__PURE__ */ i("div", { className: "sodas-validation-ui sodas-validation-ui--type-based", children: [
|
|
404
404
|
/* @__PURE__ */ i("div", { className: "d-flex align-items-center gap-2 flex-wrap mb-3 sodas-validation-ui__toolbar", children: [
|
|
405
|
-
/* @__PURE__ */ a(
|
|
405
|
+
/* @__PURE__ */ a(c.Label, { className: "mb-0 fw-semibold", children: "Add rule:" }),
|
|
406
406
|
/* @__PURE__ */ i(
|
|
407
|
-
|
|
407
|
+
c.Select,
|
|
408
408
|
{
|
|
409
409
|
className: "sodas-validation-ui__add-select",
|
|
410
410
|
value: s,
|
|
411
|
-
onChange: (
|
|
411
|
+
onChange: (m) => n(m.target.value),
|
|
412
412
|
"aria-label": "Validation rule type",
|
|
413
413
|
children: [
|
|
414
414
|
/* @__PURE__ */ a("option", { value: "", children: "-- Select type --" }),
|
|
415
|
-
Object.entries(M).map(([
|
|
415
|
+
Object.entries(M).map(([m, u]) => /* @__PURE__ */ a("option", { value: m, children: u }, m))
|
|
416
416
|
]
|
|
417
417
|
}
|
|
418
418
|
),
|
|
@@ -428,22 +428,22 @@ function oe({ validationRules: e }) {
|
|
|
428
428
|
}
|
|
429
429
|
)
|
|
430
430
|
] }),
|
|
431
|
-
/* @__PURE__ */ a("div", { className: "sodas-validation-ui__sections", children:
|
|
432
|
-
const u = A.get(
|
|
431
|
+
/* @__PURE__ */ a("div", { className: "sodas-validation-ui__sections", children: y.map((m) => {
|
|
432
|
+
const u = A.get(m) ?? [];
|
|
433
433
|
return /* @__PURE__ */ i("section", { className: "card mb-3 sodas-validation-ui__section", children: [
|
|
434
|
-
/* @__PURE__ */ a("div", { className: "card-header", children: /* @__PURE__ */ a("h5", { className: "mb-0 card-title", children: M[
|
|
435
|
-
/* @__PURE__ */ a("ul", { className: "list-unstyled mb-0 p-2 sodas-validation-ui__list", children: u.map(({ rule:
|
|
434
|
+
/* @__PURE__ */ a("div", { className: "card-header", children: /* @__PURE__ */ a("h5", { className: "mb-0 card-title", children: M[m] ?? m }) }),
|
|
435
|
+
/* @__PURE__ */ a("ul", { className: "list-unstyled mb-0 p-2 sodas-validation-ui__list", children: u.map(({ rule: g, index: d }) => /* @__PURE__ */ a("li", { className: "sodas-validation-ui__rule mb-2", children: /* @__PURE__ */ a(
|
|
436
436
|
K,
|
|
437
437
|
{
|
|
438
|
-
rule:
|
|
439
|
-
index:
|
|
440
|
-
onRemove: () => r(
|
|
441
|
-
onCommonChange:
|
|
438
|
+
rule: g,
|
|
439
|
+
index: d,
|
|
440
|
+
onRemove: () => r(d),
|
|
441
|
+
onCommonChange: b,
|
|
442
442
|
forceUpdate: t,
|
|
443
443
|
showColumn: !0
|
|
444
444
|
}
|
|
445
|
-
) },
|
|
446
|
-
] },
|
|
445
|
+
) }, d)) })
|
|
446
|
+
] }, m);
|
|
447
447
|
}) }),
|
|
448
448
|
e.length === 0 && /* @__PURE__ */ a("p", { className: "text-muted small sodas-validation-ui__empty", children: "No rules. Select a type and click Append to add one." })
|
|
449
449
|
] });
|
|
@@ -460,44 +460,44 @@ function re() {
|
|
|
460
460
|
function de({ validationRules: e }) {
|
|
461
461
|
const [t, s] = E(
|
|
462
462
|
() => Array.isArray(e) ? L.fromValidationRules(e) : L.fromValidationRules([])
|
|
463
|
-
),
|
|
463
|
+
), n = re(), [l, o] = E(0);
|
|
464
464
|
if (!Array.isArray(e))
|
|
465
465
|
return /* @__PURE__ */ a("div", { className: "alert alert-danger sodas-validation-ui sodas-validation-ui--empty", children: "validationRules must be an array" });
|
|
466
|
-
const r = t.getColumnNames(),
|
|
467
|
-
const
|
|
468
|
-
o((
|
|
469
|
-
const
|
|
470
|
-
return
|
|
466
|
+
const r = t.getColumnNames(), b = () => {
|
|
467
|
+
const d = `New Column ${l + 1}`;
|
|
468
|
+
o((v) => v + 1), s((v) => {
|
|
469
|
+
const N = L.fromValidationRules(v.toValidationRules());
|
|
470
|
+
return N.appendColumn(d, []), V(N, e), N;
|
|
471
471
|
});
|
|
472
|
-
}, A = (
|
|
473
|
-
s((
|
|
474
|
-
const
|
|
475
|
-
return
|
|
472
|
+
}, A = (d) => {
|
|
473
|
+
s((v) => {
|
|
474
|
+
const N = L.fromValidationRules(v.toValidationRules()), x = N.getColumnNames();
|
|
475
|
+
return d >= 0 && d < x.length && (N.removeColumn(d), V(N, e)), N;
|
|
476
476
|
});
|
|
477
|
-
},
|
|
478
|
-
const
|
|
479
|
-
|
|
480
|
-
const h = L.fromValidationRules(
|
|
481
|
-
if (
|
|
477
|
+
}, y = (d, v) => {
|
|
478
|
+
const N = String(v).trim();
|
|
479
|
+
N !== "" && s((x) => {
|
|
480
|
+
const h = L.fromValidationRules(x.toValidationRules()), w = h.getColumnNames();
|
|
481
|
+
if (d >= 0 && d < w.length)
|
|
482
482
|
try {
|
|
483
|
-
h.setColumnName(
|
|
483
|
+
h.setColumnName(d, N), V(h, e);
|
|
484
484
|
} catch {
|
|
485
485
|
}
|
|
486
486
|
return h;
|
|
487
487
|
});
|
|
488
|
-
},
|
|
489
|
-
const
|
|
490
|
-
|
|
491
|
-
const h = L.fromValidationRules(
|
|
492
|
-
return h.getColumnNames().includes(
|
|
488
|
+
}, m = (d, v) => {
|
|
489
|
+
const N = Q(v);
|
|
490
|
+
N.setColumn(d), s((x) => {
|
|
491
|
+
const h = L.fromValidationRules(x.toValidationRules());
|
|
492
|
+
return h.getColumnNames().includes(d) ? h.getRules(d).push(N) : h.appendColumn(d, [N]), V(h, e), h;
|
|
493
493
|
});
|
|
494
|
-
}, u = (
|
|
495
|
-
s((
|
|
496
|
-
const
|
|
497
|
-
return w !== -1 && (h.splice(w, 1), V(
|
|
494
|
+
}, u = (d, v) => {
|
|
495
|
+
s((N) => {
|
|
496
|
+
const x = L.fromValidationRules(N.toValidationRules()), h = x.getRules(d), w = h.indexOf(v);
|
|
497
|
+
return w !== -1 && (h.splice(w, 1), V(x, e)), x;
|
|
498
498
|
});
|
|
499
|
-
},
|
|
500
|
-
|
|
499
|
+
}, g = (d, v, N) => {
|
|
500
|
+
v === "column" ? d.setColumn(N) : v === "name" && d.setName(N), n();
|
|
501
501
|
};
|
|
502
502
|
return /* @__PURE__ */ i("div", { className: "sodas-validation-ui sodas-validation-ui--columned", children: [
|
|
503
503
|
/* @__PURE__ */ a("div", { className: "d-flex mb-3 sodas-validation-ui__toolbar", children: /* @__PURE__ */ a(
|
|
@@ -505,25 +505,25 @@ function de({ validationRules: e }) {
|
|
|
505
505
|
{
|
|
506
506
|
variant: "primary",
|
|
507
507
|
size: "sm",
|
|
508
|
-
onClick:
|
|
508
|
+
onClick: b,
|
|
509
509
|
"aria-label": "Add column section",
|
|
510
510
|
children: "Add column"
|
|
511
511
|
}
|
|
512
512
|
) }),
|
|
513
|
-
/* @__PURE__ */ a("div", { className: "sodas-validation-ui__sections", children: r.map((
|
|
513
|
+
/* @__PURE__ */ a("div", { className: "sodas-validation-ui__sections", children: r.map((d, v) => /* @__PURE__ */ a(
|
|
514
514
|
ce,
|
|
515
515
|
{
|
|
516
|
-
columnName:
|
|
517
|
-
columnIndex:
|
|
518
|
-
rules: t.getRules(
|
|
519
|
-
onRenameColumn:
|
|
516
|
+
columnName: d,
|
|
517
|
+
columnIndex: v,
|
|
518
|
+
rules: t.getRules(d),
|
|
519
|
+
onRenameColumn: y,
|
|
520
520
|
onRemoveColumn: A,
|
|
521
|
-
onAddRule:
|
|
521
|
+
onAddRule: m,
|
|
522
522
|
onRemoveRule: u,
|
|
523
|
-
onCommonChange:
|
|
524
|
-
forceUpdate:
|
|
523
|
+
onCommonChange: g,
|
|
524
|
+
forceUpdate: n
|
|
525
525
|
},
|
|
526
|
-
|
|
526
|
+
v
|
|
527
527
|
)) }),
|
|
528
528
|
r.length === 0 && /* @__PURE__ */ a("p", { className: "text-muted small sodas-validation-ui__empty", children: 'No columns. Click "Add column" to add a column section.' })
|
|
529
529
|
] });
|
|
@@ -532,37 +532,37 @@ function ce({
|
|
|
532
532
|
columnName: e,
|
|
533
533
|
columnIndex: t,
|
|
534
534
|
rules: s,
|
|
535
|
-
onRenameColumn:
|
|
536
|
-
onRemoveColumn:
|
|
535
|
+
onRenameColumn: n,
|
|
536
|
+
onRemoveColumn: l,
|
|
537
537
|
onAddRule: o,
|
|
538
538
|
onRemoveRule: r,
|
|
539
|
-
onCommonChange:
|
|
539
|
+
onCommonChange: b,
|
|
540
540
|
forceUpdate: A
|
|
541
541
|
}) {
|
|
542
|
-
const [
|
|
542
|
+
const [y, m] = E(""), [u, g] = E(e), [d, v] = E(!1);
|
|
543
543
|
Z(() => {
|
|
544
|
-
|
|
544
|
+
g(e);
|
|
545
545
|
}, [e]);
|
|
546
|
-
const
|
|
547
|
-
|
|
546
|
+
const N = () => {
|
|
547
|
+
v(!1);
|
|
548
548
|
const h = u.trim();
|
|
549
|
-
h !== "" && h !== e ?
|
|
550
|
-
},
|
|
549
|
+
h !== "" && h !== e ? n(t, h) : g(e);
|
|
550
|
+
}, x = (h) => {
|
|
551
551
|
h.key === "Enter" && h.target.blur();
|
|
552
552
|
};
|
|
553
|
-
return /* @__PURE__ */ i(
|
|
554
|
-
/* @__PURE__ */ i(
|
|
553
|
+
return /* @__PURE__ */ i(f, { className: "mb-3 sodas-validation-ui__section sodas-validation-ui__section--column", children: [
|
|
554
|
+
/* @__PURE__ */ i(f.Header, { className: "d-flex justify-content-between align-items-start gap-2 flex-wrap", children: [
|
|
555
555
|
/* @__PURE__ */ i("div", { className: "flex-grow-1 min-w-0", children: [
|
|
556
|
-
/* @__PURE__ */ a(
|
|
557
|
-
|
|
558
|
-
|
|
556
|
+
/* @__PURE__ */ a(c.Label, { className: "small fw-semibold text-muted mb-1", children: "Column Name" }),
|
|
557
|
+
d ? /* @__PURE__ */ a(
|
|
558
|
+
c.Control,
|
|
559
559
|
{
|
|
560
560
|
size: "sm",
|
|
561
561
|
type: "text",
|
|
562
562
|
value: u,
|
|
563
|
-
onChange: (h) =>
|
|
564
|
-
onBlur:
|
|
565
|
-
onKeyDown:
|
|
563
|
+
onChange: (h) => g(h.target.value),
|
|
564
|
+
onBlur: N,
|
|
565
|
+
onKeyDown: x,
|
|
566
566
|
"aria-label": "Column name",
|
|
567
567
|
autoFocus: !0
|
|
568
568
|
}
|
|
@@ -570,8 +570,8 @@ function ce({
|
|
|
570
570
|
"h5",
|
|
571
571
|
{
|
|
572
572
|
className: "mb-0 card-title cursor-pointer rounded p-1 sodas-validation-ui__section-title-editable",
|
|
573
|
-
onClick: () =>
|
|
574
|
-
onFocus: () =>
|
|
573
|
+
onClick: () => v(!0),
|
|
574
|
+
onFocus: () => v(!0),
|
|
575
575
|
tabIndex: 0,
|
|
576
576
|
role: "button",
|
|
577
577
|
"aria-label": "Edit column name",
|
|
@@ -584,21 +584,21 @@ function ce({
|
|
|
584
584
|
{
|
|
585
585
|
variant: "danger",
|
|
586
586
|
size: "sm",
|
|
587
|
-
onClick: () =>
|
|
587
|
+
onClick: () => l(t),
|
|
588
588
|
"aria-label": `Remove column ${e}`,
|
|
589
589
|
children: "Remove column"
|
|
590
590
|
}
|
|
591
591
|
)
|
|
592
592
|
] }),
|
|
593
|
-
/* @__PURE__ */ i(
|
|
593
|
+
/* @__PURE__ */ i(f.Body, { children: [
|
|
594
594
|
/* @__PURE__ */ i("div", { className: "d-flex align-items-center gap-2 flex-wrap mb-2 sodas-validation-ui__toolbar--inline", children: [
|
|
595
|
-
/* @__PURE__ */ a(
|
|
595
|
+
/* @__PURE__ */ a(c.Label, { className: "mb-0 fw-semibold", children: "Add rule:" }),
|
|
596
596
|
/* @__PURE__ */ i(
|
|
597
|
-
|
|
597
|
+
c.Select,
|
|
598
598
|
{
|
|
599
599
|
className: "sodas-validation-ui__add-select",
|
|
600
|
-
value:
|
|
601
|
-
onChange: (h) =>
|
|
600
|
+
value: y,
|
|
601
|
+
onChange: (h) => m(h.target.value),
|
|
602
602
|
"aria-label": "Validation rule type",
|
|
603
603
|
children: [
|
|
604
604
|
/* @__PURE__ */ a("option", { value: "", children: "-- Select type --" }),
|
|
@@ -612,9 +612,9 @@ function ce({
|
|
|
612
612
|
variant: "primary",
|
|
613
613
|
size: "sm",
|
|
614
614
|
onClick: () => {
|
|
615
|
-
|
|
615
|
+
y && (o(e, y), m(""));
|
|
616
616
|
},
|
|
617
|
-
disabled: !
|
|
617
|
+
disabled: !y,
|
|
618
618
|
"aria-label": "Append rule",
|
|
619
619
|
children: "Append"
|
|
620
620
|
}
|
|
@@ -626,7 +626,7 @@ function ce({
|
|
|
626
626
|
rule: h,
|
|
627
627
|
index: w,
|
|
628
628
|
onRemove: () => r(e, h),
|
|
629
|
-
onCommonChange:
|
|
629
|
+
onCommonChange: b,
|
|
630
630
|
forceUpdate: A,
|
|
631
631
|
showColumn: !1
|
|
632
632
|
}
|
|
@@ -636,12 +636,12 @@ function ce({
|
|
|
636
636
|
}
|
|
637
637
|
const I = "type", P = "column";
|
|
638
638
|
function W({ validationRules: e }) {
|
|
639
|
-
const [t, s] = E(I), [
|
|
640
|
-
const
|
|
641
|
-
if (
|
|
639
|
+
const [t, s] = E(I), [n, l] = E(0), [o, r] = E(null), b = B(null), A = async (y) => {
|
|
640
|
+
const m = y.target.files?.[0];
|
|
641
|
+
if (y.target.value = "", r(null), !!m)
|
|
642
642
|
try {
|
|
643
|
-
const
|
|
644
|
-
|
|
643
|
+
const g = (await L.fromCSVFileBrowser(m)).toValidationRules(), d = e;
|
|
644
|
+
d.splice(0, d.length, ...g), l((v) => v + 1);
|
|
645
645
|
} catch (u) {
|
|
646
646
|
r(u instanceof Error ? u.message : String(u));
|
|
647
647
|
}
|
|
@@ -653,7 +653,7 @@ function W({ validationRules: e }) {
|
|
|
653
653
|
{
|
|
654
654
|
variant: "tabs",
|
|
655
655
|
activeKey: t,
|
|
656
|
-
onSelect: (
|
|
656
|
+
onSelect: (y) => y && s(y),
|
|
657
657
|
role: "tablist",
|
|
658
658
|
"aria-label": "Editor mode",
|
|
659
659
|
className: "flex-grow-1",
|
|
@@ -687,7 +687,7 @@ function W({ validationRules: e }) {
|
|
|
687
687
|
/* @__PURE__ */ a(
|
|
688
688
|
"input",
|
|
689
689
|
{
|
|
690
|
-
ref:
|
|
690
|
+
ref: b,
|
|
691
691
|
type: "file",
|
|
692
692
|
accept: ".csv,text/csv",
|
|
693
693
|
"aria-label": "Initialize from CSV file",
|
|
@@ -700,7 +700,7 @@ function W({ validationRules: e }) {
|
|
|
700
700
|
{
|
|
701
701
|
variant: "secondary",
|
|
702
702
|
size: "sm",
|
|
703
|
-
onClick: () =>
|
|
703
|
+
onClick: () => b.current?.click(),
|
|
704
704
|
"aria-label": "Initialize from CSV file",
|
|
705
705
|
children: "Initialize from CSV"
|
|
706
706
|
}
|
|
@@ -716,7 +716,7 @@ function W({ validationRules: e }) {
|
|
|
716
716
|
"aria-labelledby": "validation-rules-editor-tab-type",
|
|
717
717
|
hidden: t !== I,
|
|
718
718
|
className: "sodas-validation-ui__panel",
|
|
719
|
-
children: t === I && /* @__PURE__ */ a(oe, { validationRules: e },
|
|
719
|
+
children: t === I && /* @__PURE__ */ a(oe, { validationRules: e }, n)
|
|
720
720
|
}
|
|
721
721
|
),
|
|
722
722
|
/* @__PURE__ */ a(
|
|
@@ -727,7 +727,7 @@ function W({ validationRules: e }) {
|
|
|
727
727
|
"aria-labelledby": "validation-rules-editor-tab-column",
|
|
728
728
|
hidden: t !== P,
|
|
729
729
|
className: "sodas-validation-ui__panel",
|
|
730
|
-
children: t === P && /* @__PURE__ */ a(de, { validationRules: e },
|
|
730
|
+
children: t === P && /* @__PURE__ */ a(de, { validationRules: e }, n)
|
|
731
731
|
}
|
|
732
732
|
)
|
|
733
733
|
] }) : /* @__PURE__ */ a("div", { className: "alert alert-danger sodas-validation-ui sodas-validation-ui--empty", children: "validationRules must be an array" });
|
|
@@ -736,20 +736,20 @@ function me(e) {
|
|
|
736
736
|
return M[e] ?? j[e] ?? e;
|
|
737
737
|
}
|
|
738
738
|
function ue(e) {
|
|
739
|
-
const t = e?.rule ?? e, s = typeof e?.score == "number" ? e.score : 0,
|
|
740
|
-
return { rule: t, score: s, pass:
|
|
739
|
+
const t = e?.rule ?? e, s = typeof e?.score == "number" ? e.score : 0, n = !!e?.pass;
|
|
740
|
+
return { rule: t, score: s, pass: n };
|
|
741
741
|
}
|
|
742
742
|
function X({ item: e, showColumn: t = !0 }) {
|
|
743
|
-
const { rule: s, score:
|
|
744
|
-
return /* @__PURE__ */ a(
|
|
743
|
+
const { rule: s, score: n, pass: l } = ue(e), o = s?.getType ?? s?.type;
|
|
744
|
+
return /* @__PURE__ */ a(f, { className: "sodas-validation-ui__rule-card sodas-validation-ui__quality-metadata-card", children: /* @__PURE__ */ i(f.Body, { children: [
|
|
745
745
|
/* @__PURE__ */ i("div", { className: "d-flex justify-content-between align-items-center flex-wrap gap-2 mb-2", children: [
|
|
746
|
-
/* @__PURE__ */ a(
|
|
746
|
+
/* @__PURE__ */ a(f.Title, { className: "mb-0 fs-6", children: me(o) }),
|
|
747
747
|
/* @__PURE__ */ i("div", { className: "d-flex align-items-center gap-2", children: [
|
|
748
748
|
/* @__PURE__ */ i("span", { className: "sodas-validation-ui__score", title: "Score", children: [
|
|
749
749
|
"Score: ",
|
|
750
|
-
/* @__PURE__ */ a("strong", { children: Number(
|
|
750
|
+
/* @__PURE__ */ a("strong", { children: Number(n).toPrecision(3) })
|
|
751
751
|
] }),
|
|
752
|
-
/* @__PURE__ */ a(J, { bg:
|
|
752
|
+
/* @__PURE__ */ a(J, { bg: l ? "success" : "danger", className: "sodas-validation-ui__pass-badge", children: l ? "Pass" : "Fail" })
|
|
753
753
|
] })
|
|
754
754
|
] }),
|
|
755
755
|
/* @__PURE__ */ a($, { rule: s, showColumn: t })
|
|
@@ -765,16 +765,16 @@ function ve({ qualityMetadata: e }) {
|
|
|
765
765
|
if (!Array.isArray(e))
|
|
766
766
|
return /* @__PURE__ */ a("div", { className: "alert alert-danger sodas-validation-ui sodas-validation-ui--empty", children: "qualityMetadata must be an array" });
|
|
767
767
|
const t = /* @__PURE__ */ new Map(), s = [];
|
|
768
|
-
return e.forEach((
|
|
769
|
-
const
|
|
770
|
-
t.has(o) || (t.set(o, []), s.push(o)), t.get(o).push(
|
|
768
|
+
return e.forEach((n) => {
|
|
769
|
+
const l = he(n), o = l?.getType ?? l?.type ?? "unknown";
|
|
770
|
+
t.has(o) || (t.set(o, []), s.push(o)), t.get(o).push(n);
|
|
771
771
|
}), /* @__PURE__ */ i("div", { className: "sodas-validation-ui sodas-validation-ui--type-based sodas-validation-ui--quality-metadata", children: [
|
|
772
|
-
/* @__PURE__ */ a("div", { className: "sodas-validation-ui__sections", children: s.map((
|
|
773
|
-
const
|
|
772
|
+
/* @__PURE__ */ a("div", { className: "sodas-validation-ui__sections", children: s.map((n) => {
|
|
773
|
+
const l = t.get(n) ?? [];
|
|
774
774
|
return /* @__PURE__ */ i("section", { className: "card mb-3 sodas-validation-ui__section", children: [
|
|
775
|
-
/* @__PURE__ */ a("div", { className: "card-header", children: /* @__PURE__ */ a("h5", { className: "mb-0 card-title", children: pe(
|
|
776
|
-
/* @__PURE__ */ a("ul", { className: "list-unstyled mb-0 p-2 sodas-validation-ui__list", children:
|
|
777
|
-
] },
|
|
775
|
+
/* @__PURE__ */ a("div", { className: "card-header", children: /* @__PURE__ */ a("h5", { className: "mb-0 card-title", children: pe(n) }) }),
|
|
776
|
+
/* @__PURE__ */ a("ul", { className: "list-unstyled mb-0 p-2 sodas-validation-ui__list", children: l.map((o, r) => /* @__PURE__ */ a("li", { className: "sodas-validation-ui__rule mb-2", children: /* @__PURE__ */ a(X, { item: o, showColumn: !0 }) }, r)) })
|
|
777
|
+
] }, n);
|
|
778
778
|
}) }),
|
|
779
779
|
e.length === 0 && /* @__PURE__ */ a("p", { className: "text-muted small sodas-validation-ui__empty", children: "No quality metadata to display." })
|
|
780
780
|
] });
|
|
@@ -782,20 +782,20 @@ function ve({ qualityMetadata: e }) {
|
|
|
782
782
|
function be(e) {
|
|
783
783
|
return e?.rule ?? e;
|
|
784
784
|
}
|
|
785
|
-
function
|
|
785
|
+
function ge({ qualityMetadata: e }) {
|
|
786
786
|
if (!Array.isArray(e))
|
|
787
787
|
return /* @__PURE__ */ a("div", { className: "alert alert-danger sodas-validation-ui sodas-validation-ui--empty", children: "qualityMetadata must be an array" });
|
|
788
788
|
const t = /* @__PURE__ */ new Map(), s = [];
|
|
789
|
-
return e.forEach((
|
|
790
|
-
const
|
|
791
|
-
t.has(r) || (t.set(r, []), s.push(r)), t.get(r).push(
|
|
789
|
+
return e.forEach((n) => {
|
|
790
|
+
const l = be(n), r = (l?.getColumn ?? l?.column ?? "") || "(no column)";
|
|
791
|
+
t.has(r) || (t.set(r, []), s.push(r)), t.get(r).push(n);
|
|
792
792
|
}), /* @__PURE__ */ i("div", { className: "sodas-validation-ui sodas-validation-ui--columned sodas-validation-ui--quality-metadata", children: [
|
|
793
|
-
/* @__PURE__ */ a("div", { className: "sodas-validation-ui__sections", children: s.map((
|
|
794
|
-
const
|
|
795
|
-
return /* @__PURE__ */ i(
|
|
796
|
-
/* @__PURE__ */ a(
|
|
797
|
-
/* @__PURE__ */ a(
|
|
798
|
-
] },
|
|
793
|
+
/* @__PURE__ */ a("div", { className: "sodas-validation-ui__sections", children: s.map((n) => {
|
|
794
|
+
const l = t.get(n) ?? [];
|
|
795
|
+
return /* @__PURE__ */ i(f, { className: "mb-3 sodas-validation-ui__section sodas-validation-ui__section--column", children: [
|
|
796
|
+
/* @__PURE__ */ a(f.Header, { children: /* @__PURE__ */ a("h5", { className: "mb-0 card-title", children: n }) }),
|
|
797
|
+
/* @__PURE__ */ a(f.Body, { children: /* @__PURE__ */ a("ul", { className: "list-unstyled mb-0 sodas-validation-ui__list", children: l.map((o, r) => /* @__PURE__ */ a("li", { className: "mb-2 sodas-validation-ui__rule", children: /* @__PURE__ */ a(X, { item: o, showColumn: !1 }) }, r)) }) })
|
|
798
|
+
] }, n);
|
|
799
799
|
}) }),
|
|
800
800
|
e.length === 0 && /* @__PURE__ */ a("p", { className: "text-muted small sodas-validation-ui__empty", children: "No quality metadata to display." })
|
|
801
801
|
] });
|
|
@@ -809,7 +809,7 @@ function we({ qualityMetadata: e }) {
|
|
|
809
809
|
{
|
|
810
810
|
variant: "tabs",
|
|
811
811
|
activeKey: t,
|
|
812
|
-
onSelect: (
|
|
812
|
+
onSelect: (n) => n && s(n),
|
|
813
813
|
role: "tablist",
|
|
814
814
|
"aria-label": "View mode",
|
|
815
815
|
className: "flex-grow-1",
|
|
@@ -858,49 +858,49 @@ function we({ qualityMetadata: e }) {
|
|
|
858
858
|
"aria-labelledby": "quality-metadata-viewer-tab-column",
|
|
859
859
|
hidden: t !== U,
|
|
860
860
|
className: "sodas-validation-ui__panel",
|
|
861
|
-
children: t === U && /* @__PURE__ */ a(
|
|
861
|
+
children: t === U && /* @__PURE__ */ a(ge, { qualityMetadata: e })
|
|
862
862
|
}
|
|
863
863
|
)
|
|
864
864
|
] }) : /* @__PURE__ */ a("div", { className: "alert alert-danger sodas-validation-ui sodas-validation-ui--empty", children: "qualityMetadata must be an array" });
|
|
865
865
|
}
|
|
866
|
-
function
|
|
866
|
+
function ye() {
|
|
867
867
|
const [, e] = E(0);
|
|
868
868
|
return D(() => e((t) => t + 1), []);
|
|
869
869
|
}
|
|
870
870
|
function Re({ template: e }) {
|
|
871
|
-
const t =
|
|
871
|
+
const t = ye(), s = B(e);
|
|
872
872
|
if (s.current = e, e == null || typeof e != "object")
|
|
873
873
|
return /* @__PURE__ */ a("div", { className: "alert alert-danger template-editor template-editor--empty", children: "template must be an object" });
|
|
874
|
-
const
|
|
875
|
-
Array.isArray(
|
|
876
|
-
const
|
|
877
|
-
|
|
878
|
-
}, o = (
|
|
879
|
-
|
|
880
|
-
}, r =
|
|
874
|
+
const n = s.current;
|
|
875
|
+
Array.isArray(n.validationRules) || (n.validationRules = []);
|
|
876
|
+
const l = (y) => {
|
|
877
|
+
n.name = y.target.value, t();
|
|
878
|
+
}, o = (y) => {
|
|
879
|
+
n.description = y.target.value, t();
|
|
880
|
+
}, r = n.name ?? "", b = n.description ?? "", A = n.validationRules;
|
|
881
881
|
return /* @__PURE__ */ i("div", { className: "template-editor", children: [
|
|
882
|
-
/* @__PURE__ */ i(
|
|
883
|
-
/* @__PURE__ */ i(
|
|
884
|
-
/* @__PURE__ */ a(
|
|
882
|
+
/* @__PURE__ */ i(c, { className: "template-editor__meta mb-4", children: [
|
|
883
|
+
/* @__PURE__ */ i(c.Group, { className: "mb-3", children: [
|
|
884
|
+
/* @__PURE__ */ a(c.Label, { children: "Name" }),
|
|
885
885
|
/* @__PURE__ */ a(
|
|
886
|
-
|
|
886
|
+
c.Control,
|
|
887
887
|
{
|
|
888
888
|
type: "text",
|
|
889
889
|
value: r,
|
|
890
|
-
onChange:
|
|
890
|
+
onChange: l,
|
|
891
891
|
placeholder: "Template name",
|
|
892
892
|
"aria-label": "Template name"
|
|
893
893
|
}
|
|
894
894
|
)
|
|
895
895
|
] }),
|
|
896
|
-
/* @__PURE__ */ i(
|
|
897
|
-
/* @__PURE__ */ a(
|
|
896
|
+
/* @__PURE__ */ i(c.Group, { className: "mb-3", children: [
|
|
897
|
+
/* @__PURE__ */ a(c.Label, { children: "Description" }),
|
|
898
898
|
/* @__PURE__ */ a(
|
|
899
|
-
|
|
899
|
+
c.Control,
|
|
900
900
|
{
|
|
901
901
|
as: "textarea",
|
|
902
902
|
rows: 3,
|
|
903
|
-
value:
|
|
903
|
+
value: b,
|
|
904
904
|
onChange: o,
|
|
905
905
|
placeholder: "Template description",
|
|
906
906
|
"aria-label": "Template description"
|
|
@@ -918,36 +918,36 @@ function Ne() {
|
|
|
918
918
|
const [, e] = E(0);
|
|
919
919
|
return D(() => e((t) => t + 1), []);
|
|
920
920
|
}
|
|
921
|
-
function Le({ qualityRequirement: e }) {
|
|
922
|
-
const
|
|
923
|
-
if (
|
|
921
|
+
function Le({ qualityRequirement: e, hook_names: t = [] }) {
|
|
922
|
+
const s = Ne(), n = B(e);
|
|
923
|
+
if (n.current = e, e == null || typeof e != "object")
|
|
924
924
|
return /* @__PURE__ */ a("div", { className: "alert alert-danger quality-requirement-editor quality-requirement-editor--empty", children: "qualityRequirement must be an object" });
|
|
925
|
-
const l =
|
|
925
|
+
const l = n.current;
|
|
926
926
|
Array.isArray(l.nodes) || (l.nodes = []);
|
|
927
|
-
const
|
|
928
|
-
l.name =
|
|
929
|
-
},
|
|
927
|
+
const o = (u) => {
|
|
928
|
+
l.name = u.target.value, s();
|
|
929
|
+
}, r = () => {
|
|
930
930
|
l.nodes.push({
|
|
931
931
|
node_name: "",
|
|
932
932
|
hook: "",
|
|
933
933
|
validation_rules: []
|
|
934
|
-
}),
|
|
935
|
-
},
|
|
936
|
-
l.nodes.splice(
|
|
937
|
-
},
|
|
938
|
-
const
|
|
939
|
-
|
|
940
|
-
},
|
|
934
|
+
}), s();
|
|
935
|
+
}, b = (u) => {
|
|
936
|
+
l.nodes.splice(u, 1), s();
|
|
937
|
+
}, A = (u, g, d) => {
|
|
938
|
+
const v = l.nodes[u];
|
|
939
|
+
v && (v[g] = d, s());
|
|
940
|
+
}, y = l.name ?? "", m = l.nodes;
|
|
941
941
|
return /* @__PURE__ */ i("div", { className: "quality-requirement-editor", children: [
|
|
942
|
-
/* @__PURE__ */ a(
|
|
943
|
-
/* @__PURE__ */ a(
|
|
942
|
+
/* @__PURE__ */ a(c, { className: "quality-requirement-editor__meta mb-4", children: /* @__PURE__ */ i(c.Group, { children: [
|
|
943
|
+
/* @__PURE__ */ a(c.Label, { className: "quality-requirement-editor__name-label", children: "Name" }),
|
|
944
944
|
/* @__PURE__ */ a(
|
|
945
|
-
|
|
945
|
+
c.Control,
|
|
946
946
|
{
|
|
947
947
|
className: "quality-requirement-editor__name-input",
|
|
948
948
|
type: "text",
|
|
949
|
-
value:
|
|
950
|
-
onChange:
|
|
949
|
+
value: y,
|
|
950
|
+
onChange: o,
|
|
951
951
|
placeholder: "Quality requirement name",
|
|
952
952
|
"aria-label": "Quality requirement name"
|
|
953
953
|
}
|
|
@@ -961,32 +961,33 @@ function Le({ qualityRequirement: e }) {
|
|
|
961
961
|
{
|
|
962
962
|
variant: "primary",
|
|
963
963
|
size: "sm",
|
|
964
|
-
onClick:
|
|
964
|
+
onClick: r,
|
|
965
965
|
"aria-label": "Add node",
|
|
966
966
|
children: "Add node"
|
|
967
967
|
}
|
|
968
968
|
)
|
|
969
969
|
] }),
|
|
970
|
-
|
|
971
|
-
/* @__PURE__ */ a("ul", { className: "list-unstyled mb-0 quality-requirement-editor__list", children:
|
|
970
|
+
m.length === 0 && /* @__PURE__ */ a("p", { className: "text-muted small quality-requirement-editor__empty-nodes", children: 'No nodes. Click "Add node" to add one.' }),
|
|
971
|
+
/* @__PURE__ */ a("ul", { className: "list-unstyled mb-0 quality-requirement-editor__list", children: m.map((u, g) => /* @__PURE__ */ a("li", { className: "quality-requirement-editor__node mb-3", children: /* @__PURE__ */ a(
|
|
972
972
|
_e,
|
|
973
973
|
{
|
|
974
|
-
node:
|
|
975
|
-
index:
|
|
976
|
-
|
|
977
|
-
|
|
974
|
+
node: u,
|
|
975
|
+
index: g,
|
|
976
|
+
hookNames: t,
|
|
977
|
+
onRemove: () => b(g),
|
|
978
|
+
onFieldChange: (d, v) => A(g, d, v)
|
|
978
979
|
}
|
|
979
|
-
) },
|
|
980
|
+
) }, g)) })
|
|
980
981
|
] })
|
|
981
982
|
] });
|
|
982
983
|
}
|
|
983
|
-
function _e({ node: e, index: t,
|
|
984
|
-
const
|
|
985
|
-
|
|
986
|
-
const
|
|
987
|
-
return Array.isArray(
|
|
988
|
-
/* @__PURE__ */ i(
|
|
989
|
-
/* @__PURE__ */ i(
|
|
984
|
+
function _e({ node: e, index: t, hookNames: s = [], onRemove: n, onFieldChange: l }) {
|
|
985
|
+
const o = B(e);
|
|
986
|
+
o.current = e;
|
|
987
|
+
const r = o.current;
|
|
988
|
+
return Array.isArray(r.validation_rules) || (r.validation_rules = []), /* @__PURE__ */ i(f, { className: "quality-requirement-editor__node-card", children: [
|
|
989
|
+
/* @__PURE__ */ i(f.Header, { className: "d-flex justify-content-between align-items-center", children: [
|
|
990
|
+
/* @__PURE__ */ i(f.Title, { className: "mb-0 fs-6", children: [
|
|
990
991
|
"Node ",
|
|
991
992
|
t + 1
|
|
992
993
|
] }),
|
|
@@ -995,46 +996,48 @@ function _e({ node: e, index: t, onRemove: s, onFieldChange: l }) {
|
|
|
995
996
|
{
|
|
996
997
|
variant: "danger",
|
|
997
998
|
size: "sm",
|
|
998
|
-
onClick:
|
|
999
|
+
onClick: n,
|
|
999
1000
|
"aria-label": `Remove node ${t + 1}`,
|
|
1000
1001
|
children: "Remove"
|
|
1001
1002
|
}
|
|
1002
1003
|
)
|
|
1003
1004
|
] }),
|
|
1004
|
-
/* @__PURE__ */ i(
|
|
1005
|
-
/* @__PURE__ */ a(
|
|
1006
|
-
/* @__PURE__ */ i(
|
|
1007
|
-
/* @__PURE__ */ a(
|
|
1005
|
+
/* @__PURE__ */ i(f.Body, { children: [
|
|
1006
|
+
/* @__PURE__ */ a(c, { className: "quality-requirement-editor__node-fields mb-3", children: /* @__PURE__ */ i("div", { className: "row g-2", children: [
|
|
1007
|
+
/* @__PURE__ */ i(c.Group, { className: "col-md-6", children: [
|
|
1008
|
+
/* @__PURE__ */ a(c.Label, { children: "Node name" }),
|
|
1008
1009
|
/* @__PURE__ */ a(
|
|
1009
|
-
|
|
1010
|
+
c.Control,
|
|
1010
1011
|
{
|
|
1011
1012
|
size: "sm",
|
|
1012
1013
|
type: "text",
|
|
1013
|
-
value:
|
|
1014
|
-
onChange: (
|
|
1014
|
+
value: r.node_name ?? "",
|
|
1015
|
+
onChange: (b) => l("node_name", b.target.value),
|
|
1015
1016
|
placeholder: "node_name",
|
|
1016
1017
|
"aria-label": "Node name"
|
|
1017
1018
|
}
|
|
1018
1019
|
)
|
|
1019
1020
|
] }),
|
|
1020
|
-
/* @__PURE__ */ i(
|
|
1021
|
-
/* @__PURE__ */ a(
|
|
1022
|
-
/* @__PURE__ */
|
|
1023
|
-
|
|
1021
|
+
/* @__PURE__ */ i(c.Group, { className: "col-md-6", children: [
|
|
1022
|
+
/* @__PURE__ */ a(c.Label, { children: "Hook" }),
|
|
1023
|
+
/* @__PURE__ */ i(
|
|
1024
|
+
c.Select,
|
|
1024
1025
|
{
|
|
1025
1026
|
size: "sm",
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1027
|
+
value: r.hook ?? "",
|
|
1028
|
+
onChange: (b) => l("hook", b.target.value),
|
|
1029
|
+
"aria-label": "Hook",
|
|
1030
|
+
children: [
|
|
1031
|
+
/* @__PURE__ */ a("option", { value: "", children: "선택" }),
|
|
1032
|
+
s.map((b) => /* @__PURE__ */ a("option", { value: b, children: b }, b))
|
|
1033
|
+
]
|
|
1031
1034
|
}
|
|
1032
1035
|
)
|
|
1033
1036
|
] })
|
|
1034
1037
|
] }) }),
|
|
1035
1038
|
/* @__PURE__ */ i("div", { className: "quality-requirement-editor__node-rules pt-3 border-top", children: [
|
|
1036
1039
|
/* @__PURE__ */ a("h6", { className: "mb-2", children: "Validation rules" }),
|
|
1037
|
-
/* @__PURE__ */ a(W, { validationRules:
|
|
1040
|
+
/* @__PURE__ */ a(W, { validationRules: r.validation_rules })
|
|
1038
1041
|
] })
|
|
1039
1042
|
] })
|
|
1040
1043
|
] });
|
|
@@ -1051,25 +1054,25 @@ function Oe({ qualityRequirement: e }) {
|
|
|
1051
1054
|
/* @__PURE__ */ i("div", { className: "pt-3 border-top", children: [
|
|
1052
1055
|
/* @__PURE__ */ a("h5", { className: "mb-3", children: "Nodes" }),
|
|
1053
1056
|
s.length === 0 && /* @__PURE__ */ a("p", { className: "text-muted small mb-0", children: "No nodes." }),
|
|
1054
|
-
/* @__PURE__ */ a("ul", { className: "list-unstyled mb-0", children: s.map((
|
|
1057
|
+
/* @__PURE__ */ a("ul", { className: "list-unstyled mb-0", children: s.map((n, l) => /* @__PURE__ */ a("li", { className: "mb-3", children: /* @__PURE__ */ a(Ce, { node: n, index: l }) }, l)) })
|
|
1055
1058
|
] })
|
|
1056
1059
|
] });
|
|
1057
1060
|
}
|
|
1058
1061
|
function Ce({ node: e, index: t }) {
|
|
1059
|
-
const s = e?.node_name ?? "—",
|
|
1060
|
-
return /* @__PURE__ */ i(
|
|
1061
|
-
/* @__PURE__ */ a(
|
|
1062
|
+
const s = e?.node_name ?? "—", n = e?.hook ?? "—", l = Array.isArray(e?.validation_rules) ? e.validation_rules : [];
|
|
1063
|
+
return /* @__PURE__ */ i(f, { className: "sodas-validation-ui__rule-card", children: [
|
|
1064
|
+
/* @__PURE__ */ a(f.Header, { children: /* @__PURE__ */ i(f.Title, { className: "mb-0 fs-6", children: [
|
|
1062
1065
|
"Node ",
|
|
1063
1066
|
t + 1
|
|
1064
1067
|
] }) }),
|
|
1065
|
-
/* @__PURE__ */ i(
|
|
1068
|
+
/* @__PURE__ */ i(f.Body, { children: [
|
|
1066
1069
|
/* @__PURE__ */ i("div", { className: "d-flex flex-wrap gap-3 mb-3", children: [
|
|
1067
|
-
/* @__PURE__ */ a(
|
|
1068
|
-
/* @__PURE__ */ a(
|
|
1070
|
+
/* @__PURE__ */ a(_, { label: "Node name", value: s }),
|
|
1071
|
+
/* @__PURE__ */ a(_, { label: "Hook", value: n })
|
|
1069
1072
|
] }),
|
|
1070
1073
|
/* @__PURE__ */ i("div", { className: "pt-3 border-top", children: [
|
|
1071
1074
|
/* @__PURE__ */ a("h6", { className: "mb-2", children: "Validation rules" }),
|
|
1072
|
-
|
|
1075
|
+
l.length === 0 ? /* @__PURE__ */ a("p", { className: "text-muted small mb-0", children: "No validation rules." }) : /* @__PURE__ */ a("ul", { className: "list-unstyled mb-0 sodas-validation-ui__list", children: l.map((o, r) => /* @__PURE__ */ a("li", { className: "mb-2", children: /* @__PURE__ */ a(f, { className: "sodas-validation-ui__rule-card", children: /* @__PURE__ */ i(f.Body, { className: "py-2", children: [
|
|
1073
1076
|
/* @__PURE__ */ a("div", { className: "mb-1", children: /* @__PURE__ */ a("span", { className: "fw-semibold small", children: fe(o?.getType ?? o?.type) }) }),
|
|
1074
1077
|
/* @__PURE__ */ a($, { rule: o, showColumn: !0 })
|
|
1075
1078
|
] }) }) }, r)) })
|
|
@@ -1078,7 +1081,7 @@ function Ce({ node: e, index: t }) {
|
|
|
1078
1081
|
] });
|
|
1079
1082
|
}
|
|
1080
1083
|
export {
|
|
1081
|
-
|
|
1084
|
+
ge as ColumnedQualityMetadataViewer,
|
|
1082
1085
|
de as ColumnedValidationRulesEditor,
|
|
1083
1086
|
we as QualityMetadataViewer,
|
|
1084
1087
|
Le as QualityRequirementEditor,
|