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.
@@ -1,10 +1,10 @@
1
- import { jsx as a, jsxs as i, Fragment as x } from "react/jsx-runtime";
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 N, Button as O, Form as m, Nav as R, Badge as J } from "react-bootstrap";
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 g({ label: e, value: t = "" }) {
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(m.Label, { className: "text-muted small mb-0", children: e }),
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 f({ label: e, value: t = "", type: s = "text", onChange: l, options: n, checkbox: o }) {
35
- return n ? /* @__PURE__ */ i(m.Group, { className: "mb-0 sodas-validation-ui__field", children: [
36
- /* @__PURE__ */ a(m.Label, { children: e }),
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
- m.Select,
38
+ c.Select,
39
39
  {
40
40
  size: "sm",
41
41
  value: t,
42
- onChange: (r) => l(r.target.value),
42
+ onChange: (r) => n(r.target.value),
43
43
  "aria-label": e,
44
- children: n.map((r) => /* @__PURE__ */ a("option", { value: r.value, children: r.label }, r.value))
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(m.Group, { className: "mb-0 sodas-validation-ui__field sodas-validation-ui__field--checkbox", children: /* @__PURE__ */ a(
48
- m.Check,
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) => l(r.target.checked),
53
+ onChange: (r) => n(r.target.checked),
54
54
  "aria-label": e
55
55
  }
56
- ) }) : /* @__PURE__ */ i(m.Group, { className: "mb-0 sodas-validation-ui__field", children: [
57
- /* @__PURE__ */ a(m.Label, { children: e }),
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
- m.Control,
59
+ c.Control,
60
60
  {
61
61
  size: "sm",
62
62
  type: s,
63
63
  value: t,
64
- onChange: (r) => l(r.target.value),
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 l = (n, o) => {
72
- typeof n == "function" && n.call(e, o), s();
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
- f,
77
+ C,
78
78
  {
79
79
  label: "Unique",
80
80
  type: "checkbox",
81
81
  value: e.getUnique,
82
- onChange: (n) => l(e.setUnique, !!n),
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
- f,
88
+ C,
89
89
  {
90
90
  label: "Pattern",
91
91
  value: e.getPattern ?? "",
92
- onChange: (n) => l(e.setPattern, n)
92
+ onChange: (l) => n(e.setPattern, l)
93
93
  }
94
94
  );
95
95
  case p.RANGE:
96
- return /* @__PURE__ */ i(x, { children: [
96
+ return /* @__PURE__ */ i(S, { children: [
97
97
  /* @__PURE__ */ a(
98
- f,
98
+ C,
99
99
  {
100
100
  label: "Min value",
101
101
  type: "number",
102
102
  value: String(e.getMinValue ?? 0),
103
- onChange: (n) => l(e.setMinValue, Number(n) || 0)
103
+ onChange: (l) => n(e.setMinValue, Number(l) || 0)
104
104
  }
105
105
  ),
106
106
  /* @__PURE__ */ a(
107
- f,
107
+ C,
108
108
  {
109
109
  label: "Max value",
110
110
  type: "number",
111
111
  value: String(e.getMaxValue ?? 0),
112
- onChange: (n) => l(e.setMaxValue, Number(n) || 0)
112
+ onChange: (l) => n(e.setMaxValue, Number(l) || 0)
113
113
  }
114
114
  )
115
115
  ] });
116
116
  case p.LENGTH:
117
- return /* @__PURE__ */ i(x, { children: [
117
+ return /* @__PURE__ */ i(S, { children: [
118
118
  /* @__PURE__ */ a(
119
- f,
119
+ C,
120
120
  {
121
121
  label: "Min length",
122
122
  type: "number",
123
123
  value: String(e.getMinLength ?? 0),
124
- onChange: (n) => l(e.setMinLength, Number(n) || 0)
124
+ onChange: (l) => n(e.setMinLength, Number(l) || 0)
125
125
  }
126
126
  ),
127
127
  /* @__PURE__ */ a(
128
- f,
128
+ C,
129
129
  {
130
130
  label: "Max length",
131
131
  type: "number",
132
132
  value: String(e.getMaxLength ?? 0),
133
- onChange: (n) => l(e.setMaxLength, Number(n) || 0)
133
+ onChange: (l) => n(e.setMaxLength, Number(l) || 0)
134
134
  }
135
135
  )
136
136
  ] });
137
137
  case p.ALLOWED_VALUES: {
138
- const n = e.getAllowedValues ?? [], o = Array.isArray(n) ? n.join(", ") : "";
138
+ const l = e.getAllowedValues ?? [], o = Array.isArray(l) ? l.join(", ") : "";
139
139
  return /* @__PURE__ */ a(
140
- f,
140
+ C,
141
141
  {
142
142
  label: "Allowed values (comma-separated)",
143
143
  value: o,
144
- onChange: (r) => l(e.setAllowedValues, r.split(",").map((C) => C.trim()).filter(Boolean))
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
- f,
150
+ C,
151
151
  {
152
152
  label: "Min completeness",
153
153
  type: "number",
154
154
  value: String(e.getMinCompleteness ?? 0),
155
- onChange: (n) => l(e.setMinCompleteness, Number(n) || 0)
155
+ onChange: (l) => n(e.setMinCompleteness, Number(l) || 0)
156
156
  }
157
157
  );
158
158
  case p.DATA_TYPE: {
159
- const n = e.getExpectedType ?? k.STRING;
160
- return /* @__PURE__ */ i(x, { children: [
159
+ const l = e.getExpectedType ?? k.STRING;
160
+ return /* @__PURE__ */ i(S, { children: [
161
161
  /* @__PURE__ */ a(
162
- f,
162
+ C,
163
163
  {
164
164
  label: "Expected type",
165
- value: n,
165
+ value: l,
166
166
  options: te,
167
- onChange: (o) => l(e.setExpectedType, o)
167
+ onChange: (o) => n(e.setExpectedType, o)
168
168
  }
169
169
  ),
170
- n === k.DATETIME && /* @__PURE__ */ a(
171
- f,
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) => l(e.setDatetimeFormat, 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(x, { children: [
182
+ return /* @__PURE__ */ i(S, { children: [
183
183
  /* @__PURE__ */ a(
184
- f,
184
+ C,
185
185
  {
186
186
  label: "Method",
187
187
  value: e.getMethod ?? Y.Z_SCORE,
188
188
  options: ae,
189
- onChange: (n) => l(e.setMethod, n)
189
+ onChange: (l) => n(e.setMethod, l)
190
190
  }
191
191
  ),
192
192
  /* @__PURE__ */ a(
193
- f,
193
+ C,
194
194
  {
195
195
  label: "Threshold",
196
196
  type: "number",
197
197
  value: String(e.getThreshold ?? 0),
198
- onChange: (n) => l(e.setThreshold, Number(n) || 0)
198
+ onChange: (l) => n(e.setThreshold, Number(l) || 0)
199
199
  }
200
200
  )
201
201
  ] });
202
202
  case p.STATISTICAL:
203
- return /* @__PURE__ */ i(x, { children: [
203
+ return /* @__PURE__ */ i(S, { children: [
204
204
  /* @__PURE__ */ a(
205
- f,
205
+ C,
206
206
  {
207
207
  label: "Check",
208
208
  value: e.getCheck ?? "",
209
- onChange: (n) => l(e.setCheck, n)
209
+ onChange: (l) => n(e.setCheck, l)
210
210
  }
211
211
  ),
212
212
  /* @__PURE__ */ a(
213
- f,
213
+ C,
214
214
  {
215
215
  label: "Threshold",
216
216
  type: "number",
217
217
  value: String(e.getThreshold ?? 0),
218
- onChange: (n) => l(e.setThreshold, Number(n) || 0)
218
+ onChange: (l) => n(e.setThreshold, Number(l) || 0)
219
219
  }
220
220
  ),
221
221
  /* @__PURE__ */ a(
222
- f,
222
+ C,
223
223
  {
224
224
  label: "Comparison",
225
225
  value: e.getComparision ?? F.EQUAL,
226
226
  options: G,
227
- onChange: (n) => l(e.setComparision, n)
227
+ onChange: (l) => n(e.setComparision, l)
228
228
  }
229
229
  )
230
230
  ] });
231
231
  case p.CUSTOM: {
232
- const n = e.getCondition ?? {};
233
- return /* @__PURE__ */ i(x, { children: [
232
+ const l = e.getCondition ?? {};
233
+ return /* @__PURE__ */ i(S, { children: [
234
234
  /* @__PURE__ */ a(
235
- f,
235
+ C,
236
236
  {
237
237
  label: "Condition type",
238
- value: n.type ?? z.ALL,
238
+ value: l.type ?? z.ALL,
239
239
  options: ee,
240
- onChange: (o) => l(e.setCondition, {
241
- ...n,
240
+ onChange: (o) => n(e.setCondition, {
241
+ ...l,
242
242
  type: o
243
243
  })
244
244
  }
245
245
  ),
246
246
  /* @__PURE__ */ a(
247
- f,
247
+ C,
248
248
  {
249
249
  label: "Threshold (threholder)",
250
250
  type: "number",
251
- value: String(n.threholder ?? 0),
252
- onChange: (o) => l(e.setCondition, {
253
- ...n,
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
- f,
259
+ C,
260
260
  {
261
261
  label: "Comparison",
262
- value: n.comparision ?? F.EQUAL,
262
+ value: l.comparision ?? F.EQUAL,
263
263
  options: G,
264
- onChange: (o) => l(e.setCondition, {
265
- ...n,
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(g, { label: "Unique", value: T(e, "getUnique", "unique") ? "Yes" : "No" });
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(g, { label: "Pattern", value: T(e, "getPattern", "pattern") ?? "—" });
286
+ return /* @__PURE__ */ a(_, { label: "Pattern", value: T(e, "getPattern", "pattern") ?? "—" });
287
287
  case p.RANGE:
288
288
  case "range":
289
- return /* @__PURE__ */ i(x, { children: [
290
- /* @__PURE__ */ a(g, { label: "Min value", value: String(T(e, "getMinValue", "min_value") ?? "—") }),
291
- /* @__PURE__ */ a(g, { label: "Max value", value: String(T(e, "getMaxValue", "max_value") ?? "—") })
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(x, { children: [
296
- /* @__PURE__ */ a(g, { label: "Min length", value: String(T(e, "getMinLength", "min_length") ?? "—") }),
297
- /* @__PURE__ */ a(g, { label: "Max length", value: String(T(e, "getMaxLength", "max_length") ?? "—") })
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 l = T(e, "getAllowedValues", "allowed_values") ?? [], n = Array.isArray(l) ? l.join(", ") : "—";
302
- return /* @__PURE__ */ a(g, { label: "Allowed values", value: n });
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(g, { label: "Min completeness", value: String(T(e, "getMinCompleteness", "min_completeness") ?? "—") });
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 l = T(e, "getExpectedType", "expected_type") ?? k.STRING ?? "string", o = l === (k?.DATETIME ?? "datetime") ? T(e, "getDatetimeFormat", "datetime_format") ?? "—" : null;
310
- return /* @__PURE__ */ i(x, { children: [
311
- /* @__PURE__ */ a(g, { label: "Expected type", value: l }),
312
- o !== null && /* @__PURE__ */ a(g, { label: "Datetime format", value: o })
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(x, { children: [
318
- /* @__PURE__ */ a(g, { label: "Method", value: T(e, "getMethod", "method") ?? "—" }),
319
- /* @__PURE__ */ a(g, { label: "Threshold", value: String(T(e, "getThreshold", "threshold") ?? "—") })
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(x, { children: [
324
- /* @__PURE__ */ a(g, { label: "Check", value: T(e, "getCheck", "check") ?? "—" }),
325
- /* @__PURE__ */ a(g, { label: "Threshold", value: String(T(e, "getThreshold", "threshold") ?? "—") }),
326
- /* @__PURE__ */ a(g, { label: "Comparison", value: T(e, "getComparision", "comparision") ?? "—" })
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 l = T(e, "getCondition", "condition") ?? {};
331
- return /* @__PURE__ */ i(x, { children: [
332
- /* @__PURE__ */ a(g, { label: "Condition type", value: l.type ?? "—" }),
333
- /* @__PURE__ */ a(g, { label: "Threshold", value: String(l.threholder ?? "—") }),
334
- /* @__PURE__ */ a(g, { label: "Comparison", value: l.comparision ?? "—" })
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(g, { label: "Column", value: e?.getColumn ?? e?.column ?? "—" }),
346
- /* @__PURE__ */ a(g, { label: "Name", value: e?.getName ?? e?.name ?? "—" })
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: l, forceUpdate: n, showColumn: o = !0 }) {
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(N, { className: "sodas-validation-ui__rule-card", children: /* @__PURE__ */ i(N.Body, { children: [
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(N.Title, { className: "mb-0 fs-6", children: M[r] ?? r }),
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(f, { label: "Column", value: e.getColumn, onChange: (C) => l(e, "column", C) }),
370
- /* @__PURE__ */ a(f, { label: "Name", value: e.getName, onChange: (C) => l(e, "name", C) })
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: n }) })
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, l] = E(""), n = (d) => {
381
+ const t = se(), [s, n] = E(""), l = (m) => {
382
382
  if (!Array.isArray(e)) return;
383
- const u = Q(d);
383
+ const u = Q(m);
384
384
  e.push(u), t();
385
385
  }, o = () => {
386
- s && n(s);
387
- }, r = (d) => {
388
- Array.isArray(e) && (e.splice(d, 1), t());
389
- }, C = (d, u, _) => {
390
- u === "column" ? d.setColumn(_) : u === "name" && d.setName(_), t();
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((d, u) => {
396
- const _ = d.getType;
397
- A.has(_) || A.set(_, []), A.get(_).push({ rule: d, index: u });
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 v = [];
400
- return e.forEach((d) => {
401
- const u = d.getType;
402
- v.includes(u) || v.push(u);
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(m.Label, { className: "mb-0 fw-semibold", children: "Add rule:" }),
405
+ /* @__PURE__ */ a(c.Label, { className: "mb-0 fw-semibold", children: "Add rule:" }),
406
406
  /* @__PURE__ */ i(
407
- m.Select,
407
+ c.Select,
408
408
  {
409
409
  className: "sodas-validation-ui__add-select",
410
410
  value: s,
411
- onChange: (d) => l(d.target.value),
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(([d, u]) => /* @__PURE__ */ a("option", { value: d, children: u }, d))
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: v.map((d) => {
432
- const u = A.get(d) ?? [];
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[d] ?? d }) }),
435
- /* @__PURE__ */ a("ul", { className: "list-unstyled mb-0 p-2 sodas-validation-ui__list", children: u.map(({ rule: _, index: c }) => /* @__PURE__ */ a("li", { className: "sodas-validation-ui__rule mb-2", children: /* @__PURE__ */ a(
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: c,
440
- onRemove: () => r(c),
441
- onCommonChange: C,
438
+ rule: g,
439
+ index: d,
440
+ onRemove: () => r(d),
441
+ onCommonChange: b,
442
442
  forceUpdate: t,
443
443
  showColumn: !0
444
444
  }
445
- ) }, c)) })
446
- ] }, d);
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
- ), l = re(), [n, o] = E(0);
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(), C = () => {
467
- const c = `New Column ${n + 1}`;
468
- o((b) => b + 1), s((b) => {
469
- const y = L.fromValidationRules(b.toValidationRules());
470
- return y.appendColumn(c, []), V(y, e), y;
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 = (c) => {
473
- s((b) => {
474
- const y = L.fromValidationRules(b.toValidationRules()), S = y.getColumnNames();
475
- return c >= 0 && c < S.length && (y.removeColumn(c), V(y, e)), y;
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
- }, v = (c, b) => {
478
- const y = String(b).trim();
479
- y !== "" && s((S) => {
480
- const h = L.fromValidationRules(S.toValidationRules()), w = h.getColumnNames();
481
- if (c >= 0 && c < w.length)
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(c, y), V(h, e);
483
+ h.setColumnName(d, N), V(h, e);
484
484
  } catch {
485
485
  }
486
486
  return h;
487
487
  });
488
- }, d = (c, b) => {
489
- const y = Q(b);
490
- y.setColumn(c), s((S) => {
491
- const h = L.fromValidationRules(S.toValidationRules());
492
- return h.getColumnNames().includes(c) ? h.getRules(c).push(y) : h.appendColumn(c, [y]), V(h, e), h;
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 = (c, b) => {
495
- s((y) => {
496
- const S = L.fromValidationRules(y.toValidationRules()), h = S.getRules(c), w = h.indexOf(b);
497
- return w !== -1 && (h.splice(w, 1), V(S, e)), S;
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
- }, _ = (c, b, y) => {
500
- b === "column" ? c.setColumn(y) : b === "name" && c.setName(y), l();
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: C,
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((c, b) => /* @__PURE__ */ a(
513
+ /* @__PURE__ */ a("div", { className: "sodas-validation-ui__sections", children: r.map((d, v) => /* @__PURE__ */ a(
514
514
  ce,
515
515
  {
516
- columnName: c,
517
- columnIndex: b,
518
- rules: t.getRules(c),
519
- onRenameColumn: v,
516
+ columnName: d,
517
+ columnIndex: v,
518
+ rules: t.getRules(d),
519
+ onRenameColumn: y,
520
520
  onRemoveColumn: A,
521
- onAddRule: d,
521
+ onAddRule: m,
522
522
  onRemoveRule: u,
523
- onCommonChange: _,
524
- forceUpdate: l
523
+ onCommonChange: g,
524
+ forceUpdate: n
525
525
  },
526
- b
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: l,
536
- onRemoveColumn: n,
535
+ onRenameColumn: n,
536
+ onRemoveColumn: l,
537
537
  onAddRule: o,
538
538
  onRemoveRule: r,
539
- onCommonChange: C,
539
+ onCommonChange: b,
540
540
  forceUpdate: A
541
541
  }) {
542
- const [v, d] = E(""), [u, _] = E(e), [c, b] = E(!1);
542
+ const [y, m] = E(""), [u, g] = E(e), [d, v] = E(!1);
543
543
  Z(() => {
544
- _(e);
544
+ g(e);
545
545
  }, [e]);
546
- const y = () => {
547
- b(!1);
546
+ const N = () => {
547
+ v(!1);
548
548
  const h = u.trim();
549
- h !== "" && h !== e ? l(t, h) : _(e);
550
- }, S = (h) => {
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(N, { className: "mb-3 sodas-validation-ui__section sodas-validation-ui__section--column", children: [
554
- /* @__PURE__ */ i(N.Header, { className: "d-flex justify-content-between align-items-start gap-2 flex-wrap", children: [
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(m.Label, { className: "small fw-semibold text-muted mb-1", children: "Column Name" }),
557
- c ? /* @__PURE__ */ a(
558
- m.Control,
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) => _(h.target.value),
564
- onBlur: y,
565
- onKeyDown: S,
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: () => b(!0),
574
- onFocus: () => b(!0),
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: () => n(t),
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(N.Body, { children: [
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(m.Label, { className: "mb-0 fw-semibold", children: "Add rule:" }),
595
+ /* @__PURE__ */ a(c.Label, { className: "mb-0 fw-semibold", children: "Add rule:" }),
596
596
  /* @__PURE__ */ i(
597
- m.Select,
597
+ c.Select,
598
598
  {
599
599
  className: "sodas-validation-ui__add-select",
600
- value: v,
601
- onChange: (h) => d(h.target.value),
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
- v && (o(e, v), d(""));
615
+ y && (o(e, y), m(""));
616
616
  },
617
- disabled: !v,
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: C,
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), [l, n] = E(0), [o, r] = E(null), C = B(null), A = async (v) => {
640
- const d = v.target.files?.[0];
641
- if (v.target.value = "", r(null), !!d)
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 _ = (await L.fromCSVFileBrowser(d)).toValidationRules(), c = e;
644
- c.splice(0, c.length, ..._), n((b) => b + 1);
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: (v) => v && s(v),
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: C,
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: () => C.current?.click(),
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 }, l)
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 }, l)
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, l = !!e?.pass;
740
- return { rule: t, score: s, pass: l };
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: l, pass: n } = ue(e), o = s?.getType ?? s?.type;
744
- return /* @__PURE__ */ a(N, { className: "sodas-validation-ui__rule-card sodas-validation-ui__quality-metadata-card", children: /* @__PURE__ */ i(N.Body, { children: [
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(N.Title, { className: "mb-0 fs-6", children: me(o) }),
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(l).toPrecision(3) })
750
+ /* @__PURE__ */ a("strong", { children: Number(n).toPrecision(3) })
751
751
  ] }),
752
- /* @__PURE__ */ a(J, { bg: n ? "success" : "danger", className: "sodas-validation-ui__pass-badge", children: n ? "Pass" : "Fail" })
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((l) => {
769
- const n = he(l), o = n?.getType ?? n?.type ?? "unknown";
770
- t.has(o) || (t.set(o, []), s.push(o)), t.get(o).push(l);
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((l) => {
773
- const n = t.get(l) ?? [];
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(l) }) }),
776
- /* @__PURE__ */ a("ul", { className: "list-unstyled mb-0 p-2 sodas-validation-ui__list", children: n.map((o, r) => /* @__PURE__ */ a("li", { className: "sodas-validation-ui__rule mb-2", children: /* @__PURE__ */ a(X, { item: o, showColumn: !0 }) }, r)) })
777
- ] }, l);
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 ye({ qualityMetadata: e }) {
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((l) => {
790
- const n = be(l), r = (n?.getColumn ?? n?.column ?? "") || "(no column)";
791
- t.has(r) || (t.set(r, []), s.push(r)), t.get(r).push(l);
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((l) => {
794
- const n = t.get(l) ?? [];
795
- return /* @__PURE__ */ i(N, { className: "mb-3 sodas-validation-ui__section sodas-validation-ui__section--column", children: [
796
- /* @__PURE__ */ a(N.Header, { children: /* @__PURE__ */ a("h5", { className: "mb-0 card-title", children: l }) }),
797
- /* @__PURE__ */ a(N.Body, { children: /* @__PURE__ */ a("ul", { className: "list-unstyled mb-0 sodas-validation-ui__list", children: n.map((o, r) => /* @__PURE__ */ a("li", { className: "mb-2 sodas-validation-ui__rule", children: /* @__PURE__ */ a(X, { item: o, showColumn: !1 }) }, r)) }) })
798
- ] }, l);
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: (l) => l && s(l),
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(ye, { qualityMetadata: e })
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 ge() {
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 = ge(), s = B(e);
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 l = s.current;
875
- Array.isArray(l.validationRules) || (l.validationRules = []);
876
- const n = (v) => {
877
- l.name = v.target.value, t();
878
- }, o = (v) => {
879
- l.description = v.target.value, t();
880
- }, r = l.name ?? "", C = l.description ?? "", A = l.validationRules;
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(m, { className: "template-editor__meta mb-4", children: [
883
- /* @__PURE__ */ i(m.Group, { className: "mb-3", children: [
884
- /* @__PURE__ */ a(m.Label, { children: "Name" }),
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
- m.Control,
886
+ c.Control,
887
887
  {
888
888
  type: "text",
889
889
  value: r,
890
- onChange: n,
890
+ onChange: l,
891
891
  placeholder: "Template name",
892
892
  "aria-label": "Template name"
893
893
  }
894
894
  )
895
895
  ] }),
896
- /* @__PURE__ */ i(m.Group, { className: "mb-3", children: [
897
- /* @__PURE__ */ a(m.Label, { children: "Description" }),
896
+ /* @__PURE__ */ i(c.Group, { className: "mb-3", children: [
897
+ /* @__PURE__ */ a(c.Label, { children: "Description" }),
898
898
  /* @__PURE__ */ a(
899
- m.Control,
899
+ c.Control,
900
900
  {
901
901
  as: "textarea",
902
902
  rows: 3,
903
- value: C,
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 t = Ne(), s = B(e);
923
- if (s.current = e, e == null || typeof e != "object")
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 = s.current;
925
+ const l = n.current;
926
926
  Array.isArray(l.nodes) || (l.nodes = []);
927
- const n = (d) => {
928
- l.name = d.target.value, t();
929
- }, o = () => {
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
- }), t();
935
- }, r = (d) => {
936
- l.nodes.splice(d, 1), t();
937
- }, C = (d, u, _) => {
938
- const c = l.nodes[d];
939
- c && (c[u] = _, t());
940
- }, A = l.name ?? "", v = l.nodes;
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(m, { className: "quality-requirement-editor__meta mb-4", children: /* @__PURE__ */ i(m.Group, { children: [
943
- /* @__PURE__ */ a(m.Label, { className: "quality-requirement-editor__name-label", children: "Name" }),
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
- m.Control,
945
+ c.Control,
946
946
  {
947
947
  className: "quality-requirement-editor__name-input",
948
948
  type: "text",
949
- value: A,
950
- onChange: n,
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: o,
964
+ onClick: r,
965
965
  "aria-label": "Add node",
966
966
  children: "Add node"
967
967
  }
968
968
  )
969
969
  ] }),
970
- v.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: v.map((d, u) => /* @__PURE__ */ a("li", { className: "quality-requirement-editor__node mb-3", children: /* @__PURE__ */ a(
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: d,
975
- index: u,
976
- onRemove: () => r(u),
977
- onFieldChange: (_, c) => C(u, _, c)
974
+ node: u,
975
+ index: g,
976
+ hookNames: t,
977
+ onRemove: () => b(g),
978
+ onFieldChange: (d, v) => A(g, d, v)
978
979
  }
979
- ) }, u)) })
980
+ ) }, g)) })
980
981
  ] })
981
982
  ] });
982
983
  }
983
- function _e({ node: e, index: t, onRemove: s, onFieldChange: l }) {
984
- const n = B(e);
985
- n.current = e;
986
- const o = n.current;
987
- return Array.isArray(o.validation_rules) || (o.validation_rules = []), /* @__PURE__ */ i(N, { className: "quality-requirement-editor__node-card", children: [
988
- /* @__PURE__ */ i(N.Header, { className: "d-flex justify-content-between align-items-center", children: [
989
- /* @__PURE__ */ i(N.Title, { className: "mb-0 fs-6", children: [
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: s,
999
+ onClick: n,
999
1000
  "aria-label": `Remove node ${t + 1}`,
1000
1001
  children: "Remove"
1001
1002
  }
1002
1003
  )
1003
1004
  ] }),
1004
- /* @__PURE__ */ i(N.Body, { children: [
1005
- /* @__PURE__ */ a(m, { className: "quality-requirement-editor__node-fields mb-3", children: /* @__PURE__ */ i("div", { className: "row g-2", children: [
1006
- /* @__PURE__ */ i(m.Group, { className: "col-md-6", children: [
1007
- /* @__PURE__ */ a(m.Label, { children: "Node name" }),
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
- m.Control,
1010
+ c.Control,
1010
1011
  {
1011
1012
  size: "sm",
1012
1013
  type: "text",
1013
- value: o.node_name ?? "",
1014
- onChange: (r) => l("node_name", r.target.value),
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(m.Group, { className: "col-md-6", children: [
1021
- /* @__PURE__ */ a(m.Label, { children: "Hook" }),
1022
- /* @__PURE__ */ a(
1023
- m.Control,
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
- type: "text",
1027
- value: o.hook ?? "",
1028
- onChange: (r) => l("hook", r.target.value),
1029
- placeholder: "hook",
1030
- "aria-label": "Hook"
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: o.validation_rules })
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((l, n) => /* @__PURE__ */ a("li", { className: "mb-3", children: /* @__PURE__ */ a(Ce, { node: l, index: n }) }, n)) })
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 ?? "—", l = e?.hook ?? "—", n = Array.isArray(e?.validation_rules) ? e.validation_rules : [];
1060
- return /* @__PURE__ */ i(N, { className: "sodas-validation-ui__rule-card", children: [
1061
- /* @__PURE__ */ a(N.Header, { children: /* @__PURE__ */ i(N.Title, { className: "mb-0 fs-6", children: [
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(N.Body, { children: [
1068
+ /* @__PURE__ */ i(f.Body, { children: [
1066
1069
  /* @__PURE__ */ i("div", { className: "d-flex flex-wrap gap-3 mb-3", children: [
1067
- /* @__PURE__ */ a(g, { label: "Node name", value: s }),
1068
- /* @__PURE__ */ a(g, { label: "Hook", value: l })
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
- n.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: n.map((o, r) => /* @__PURE__ */ a("li", { className: "mb-2", children: /* @__PURE__ */ a(N, { className: "sodas-validation-ui__rule-card", children: /* @__PURE__ */ i(N.Body, { className: "py-2", children: [
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
- ye as ColumnedQualityMetadataViewer,
1084
+ ge as ColumnedQualityMetadataViewer,
1082
1085
  de as ColumnedValidationRulesEditor,
1083
1086
  we as QualityMetadataViewer,
1084
1087
  Le as QualityRequirementEditor,