@isettingkit/business-rules 0.1.25 → 0.1.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +124 -122
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsxs as c, Fragment as A, jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import { ValueDataType as V, ValueHowToSetUp as
|
|
2
|
+
import { ValueDataType as V, ValueHowToSetUp as m, InputRange as ee, MultipleChoices as te, DynamicField as ae } from "@isettingkit/input";
|
|
3
3
|
import { Stack as d } from "@inubekit/stack";
|
|
4
|
-
import { Divider as
|
|
4
|
+
import { Divider as S } from "@inubekit/divider";
|
|
5
5
|
import { Button as B } from "@inubekit/button";
|
|
6
6
|
import { useState as _, useEffect as re } from "react";
|
|
7
7
|
import { Text as y } from "@inubekit/text";
|
|
8
8
|
import { Date as G } from "@inubekit/date";
|
|
9
9
|
import { Checkbox as ne } from "@inubekit/checkbox";
|
|
10
10
|
import { Toggle as K } from "@inubekit/toggle";
|
|
11
|
-
import { inube as
|
|
11
|
+
import { inube as k } from "@inubekit/foundations";
|
|
12
12
|
import b, { keyframes as oe } from "styled-components";
|
|
13
13
|
import { useFormik as le } from "formik";
|
|
14
14
|
import { mixed as X, object as F, number as N, string as H, date as P, lazy as ie } from "yup";
|
|
@@ -17,25 +17,25 @@ import { SkeletonLine as E } from "@inubekit/skeleton";
|
|
|
17
17
|
import { MdOutlineDelete as de, MdClear as se, MdAdd as ce } from "react-icons/md";
|
|
18
18
|
import { Icon as Z } from "@inubekit/icon";
|
|
19
19
|
import { createPortal as ue } from "react-dom";
|
|
20
|
-
import { Blanket as
|
|
21
|
-
import { Grid as
|
|
20
|
+
import { Blanket as he } from "@inubekit/blanket";
|
|
21
|
+
import { Grid as pe } from "@inubekit/grid";
|
|
22
22
|
import { useMediaQuery as me } from "@inubekit/hooks";
|
|
23
23
|
const ge = (r) => {
|
|
24
24
|
const {
|
|
25
25
|
onHandleStartChange: e,
|
|
26
26
|
onHandleEndChange: s,
|
|
27
27
|
onCheckClosedChange: i,
|
|
28
|
-
labelStart:
|
|
28
|
+
labelStart: h,
|
|
29
29
|
labelEnd: a,
|
|
30
30
|
checkedClosed: l = !1,
|
|
31
31
|
required: o = !1,
|
|
32
|
-
valueStart:
|
|
32
|
+
valueStart: u = "",
|
|
33
33
|
valueEnd: g = "",
|
|
34
|
-
messageStart:
|
|
34
|
+
messageStart: v = "",
|
|
35
35
|
messageEnd: f = "",
|
|
36
36
|
statusStart: p = "pending",
|
|
37
|
-
statusEnd:
|
|
38
|
-
} = r, [n, U] = _(l), [I,
|
|
37
|
+
statusEnd: w = "pending"
|
|
38
|
+
} = r, [n, U] = _(l), [I, R] = _(u), [$, L] = _(g);
|
|
39
39
|
return /* @__PURE__ */ c(A, { children: [
|
|
40
40
|
/* @__PURE__ */ c(d, { direction: "row", justifyContent: "space-between", margin: "10px 0", children: [
|
|
41
41
|
/* @__PURE__ */ t(d, { children: /* @__PURE__ */ t(
|
|
@@ -60,8 +60,8 @@ const ge = (r) => {
|
|
|
60
60
|
ne,
|
|
61
61
|
{
|
|
62
62
|
label: "Cerrada",
|
|
63
|
-
onChange: ({ target:
|
|
64
|
-
U(
|
|
63
|
+
onChange: ({ target: x }) => {
|
|
64
|
+
U(x.checked), i && i(x.checked);
|
|
65
65
|
},
|
|
66
66
|
checked: n,
|
|
67
67
|
value: ""
|
|
@@ -75,15 +75,15 @@ const ge = (r) => {
|
|
|
75
75
|
G,
|
|
76
76
|
{
|
|
77
77
|
id: "dateStart",
|
|
78
|
-
label:
|
|
79
|
-
onChange: (
|
|
80
|
-
|
|
78
|
+
label: h,
|
|
79
|
+
onChange: (x) => {
|
|
80
|
+
R(x.target.value), e(x);
|
|
81
81
|
},
|
|
82
82
|
value: I,
|
|
83
83
|
required: o,
|
|
84
84
|
size: "compact",
|
|
85
85
|
status: p,
|
|
86
|
-
message:
|
|
86
|
+
message: v
|
|
87
87
|
}
|
|
88
88
|
) }),
|
|
89
89
|
n && /* @__PURE__ */ t(d, { width: "189px", children: /* @__PURE__ */ t(
|
|
@@ -91,13 +91,13 @@ const ge = (r) => {
|
|
|
91
91
|
{
|
|
92
92
|
id: "dateEnd",
|
|
93
93
|
label: a,
|
|
94
|
-
onChange: (
|
|
95
|
-
L(
|
|
94
|
+
onChange: (x) => {
|
|
95
|
+
L(x.target.value), s(x);
|
|
96
96
|
},
|
|
97
|
-
value:
|
|
97
|
+
value: $,
|
|
98
98
|
required: o,
|
|
99
99
|
size: "compact",
|
|
100
|
-
status:
|
|
100
|
+
status: w,
|
|
101
101
|
message: f
|
|
102
102
|
}
|
|
103
103
|
) })
|
|
@@ -106,7 +106,7 @@ const ge = (r) => {
|
|
|
106
106
|
}, be = b.div`
|
|
107
107
|
& > div {
|
|
108
108
|
border-radius: 8px;
|
|
109
|
-
border: 1px solid ${
|
|
109
|
+
border: 1px solid ${k.palette.neutral.N30};
|
|
110
110
|
}
|
|
111
111
|
`, fe = b.div`
|
|
112
112
|
width: 100%;
|
|
@@ -125,16 +125,16 @@ const ge = (r) => {
|
|
|
125
125
|
background-color: #ebecf0;
|
|
126
126
|
border-radius: 8px;
|
|
127
127
|
}
|
|
128
|
-
`,
|
|
128
|
+
`, ve = (r) => {
|
|
129
129
|
const {
|
|
130
130
|
checked: e,
|
|
131
131
|
children: s,
|
|
132
132
|
handleToggleChange: i,
|
|
133
|
-
id:
|
|
133
|
+
id: h,
|
|
134
134
|
labelToggle: a,
|
|
135
135
|
name: l,
|
|
136
136
|
valueToggle: o = ""
|
|
137
|
-
} = r, [
|
|
137
|
+
} = r, [u, g] = _(e), v = (f) => {
|
|
138
138
|
g(f.target.checked), i(f);
|
|
139
139
|
};
|
|
140
140
|
return re(() => {
|
|
@@ -143,18 +143,18 @@ const ge = (r) => {
|
|
|
143
143
|
/* @__PURE__ */ t(d, { children: /* @__PURE__ */ t(
|
|
144
144
|
K,
|
|
145
145
|
{
|
|
146
|
-
checked:
|
|
147
|
-
id:
|
|
146
|
+
checked: u,
|
|
147
|
+
id: h,
|
|
148
148
|
name: l,
|
|
149
|
-
onChange:
|
|
149
|
+
onChange: v,
|
|
150
150
|
size: "small",
|
|
151
151
|
value: o,
|
|
152
152
|
children: /* @__PURE__ */ t(y, { size: "medium", type: "label", weight: "bold", children: a })
|
|
153
153
|
}
|
|
154
154
|
) }),
|
|
155
|
-
|
|
155
|
+
u && /* @__PURE__ */ t(A, { children: s })
|
|
156
156
|
] });
|
|
157
|
-
},
|
|
157
|
+
}, xe = (r) => ({
|
|
158
158
|
schema: X().test(
|
|
159
159
|
"isArrayOrString",
|
|
160
160
|
"Must be an array of strings/numbers or a single string",
|
|
@@ -172,7 +172,7 @@ const ge = (r) => {
|
|
|
172
172
|
) : typeof e == "string"
|
|
173
173
|
),
|
|
174
174
|
value: r
|
|
175
|
-
}),
|
|
175
|
+
}), Ce = (r) => {
|
|
176
176
|
const e = (r == null ? void 0 : r.from) ?? 0, s = (r == null ? void 0 : r.to) ?? 0;
|
|
177
177
|
return {
|
|
178
178
|
schema: F({
|
|
@@ -187,21 +187,21 @@ const ge = (r) => {
|
|
|
187
187
|
} : {
|
|
188
188
|
schema: H().required("Required"),
|
|
189
189
|
value: r
|
|
190
|
-
},
|
|
190
|
+
}, we = (r) => ({
|
|
191
191
|
schema: H().required("Required").test(
|
|
192
192
|
"non-empty",
|
|
193
193
|
"Value cannot be empty",
|
|
194
194
|
(e) => e != null && e.trim() !== ""
|
|
195
195
|
),
|
|
196
196
|
value: r
|
|
197
|
-
}),
|
|
198
|
-
[
|
|
199
|
-
[
|
|
200
|
-
[
|
|
201
|
-
[
|
|
202
|
-
[
|
|
203
|
-
[
|
|
204
|
-
},
|
|
197
|
+
}), ke = {
|
|
198
|
+
[m.LIST_OF_VALUES]: xe,
|
|
199
|
+
[m.LIST_OF_VALUES_MULTI]: ye,
|
|
200
|
+
[m.RANGE]: Ce,
|
|
201
|
+
[m.GREATER_THAN]: O,
|
|
202
|
+
[m.LESS_THAN]: O,
|
|
203
|
+
[m.EQUAL]: O
|
|
204
|
+
}, Se = (r) => ke[r] || we;
|
|
205
205
|
function Te({ decision: r, onSubmitEvent: e }) {
|
|
206
206
|
const s = {
|
|
207
207
|
name: r.name || "",
|
|
@@ -211,11 +211,12 @@ function Te({ decision: r, onSubmitEvent: e }) {
|
|
|
211
211
|
startDate: r.startDate || "",
|
|
212
212
|
endDate: r.endDate || "",
|
|
213
213
|
toggleNone: !0,
|
|
214
|
-
conditions: {}
|
|
214
|
+
conditions: {},
|
|
215
|
+
checkClosed: !1
|
|
215
216
|
}, i = F({
|
|
216
217
|
name: H().required("Name is required"),
|
|
217
218
|
startDate: P().required("Start date is required"),
|
|
218
|
-
endDate: P().required("End date is required"),
|
|
219
|
+
endDate: P().when("checkClosed", (l, o, { parent: u }) => (u == null ? void 0 : u.checkClosed) ? o.required("End date is required") : o.notRequired()),
|
|
219
220
|
value: F({
|
|
220
221
|
from: N().min(0, "From value must be greater than or equal to 0").required("From value is required"),
|
|
221
222
|
to: N().min(0, "To value must be greater than or equal to 0").required("To value is required").test(
|
|
@@ -228,13 +229,13 @@ function Te({ decision: r, onSubmitEvent: e }) {
|
|
|
228
229
|
)
|
|
229
230
|
}).required("Range value is required"),
|
|
230
231
|
conditions: ie((l, { parent: o }) => {
|
|
231
|
-
var g,
|
|
232
|
+
var g, v;
|
|
232
233
|
return (o == null ? void 0 : o.toggleNone) && ((g = o == null ? void 0 : o.conditions) == null ? void 0 : g.length) > 0 ? F().shape({}) : F(
|
|
233
|
-
(
|
|
234
|
+
(v = r.conditions) == null ? void 0 : v.reduce(
|
|
234
235
|
(f, p) => {
|
|
235
|
-
if (
|
|
236
|
-
const
|
|
237
|
-
f[p.name] =
|
|
236
|
+
if (h.values.conditions[p.name] !== void 0) {
|
|
237
|
+
const w = Se(p.valueUse);
|
|
238
|
+
f[p.name] = w(
|
|
238
239
|
p.value,
|
|
239
240
|
p.dataType
|
|
240
241
|
).schema;
|
|
@@ -245,12 +246,12 @@ function Te({ decision: r, onSubmitEvent: e }) {
|
|
|
245
246
|
)
|
|
246
247
|
);
|
|
247
248
|
})
|
|
248
|
-
}),
|
|
249
|
+
}), h = le({
|
|
249
250
|
initialValues: s,
|
|
250
251
|
validationSchema: i,
|
|
251
252
|
validateOnBlur: !0,
|
|
252
253
|
onSubmit: (l) => {
|
|
253
|
-
var
|
|
254
|
+
var u;
|
|
254
255
|
const o = {
|
|
255
256
|
...r,
|
|
256
257
|
name: l.name,
|
|
@@ -259,7 +260,7 @@ function Te({ decision: r, onSubmitEvent: e }) {
|
|
|
259
260
|
value: l.value,
|
|
260
261
|
startDate: l.startDate,
|
|
261
262
|
endDate: l.endDate,
|
|
262
|
-
conditions: (
|
|
263
|
+
conditions: (u = r.conditions) == null ? void 0 : u.map((g) => ({
|
|
263
264
|
...g,
|
|
264
265
|
value: l.conditions[g.name]
|
|
265
266
|
}))
|
|
@@ -267,21 +268,21 @@ function Te({ decision: r, onSubmitEvent: e }) {
|
|
|
267
268
|
e(o);
|
|
268
269
|
}
|
|
269
270
|
});
|
|
270
|
-
return { formik:
|
|
271
|
+
return { formik: h, handleToggleNoneChange: (l) => {
|
|
271
272
|
var o;
|
|
272
|
-
|
|
273
|
+
h.setFieldValue("toggleNone", l), (o = r.conditions) == null || o.forEach((u) => {
|
|
273
274
|
if (l)
|
|
274
|
-
|
|
275
|
+
h.setFieldValue(`conditions.${u.name}`, void 0);
|
|
275
276
|
else {
|
|
276
|
-
const g =
|
|
277
|
-
|
|
277
|
+
const g = u.valueUse === m.LIST_OF_VALUES_MULTI ? [] : "";
|
|
278
|
+
h.setFieldValue(`conditions.${u.name}`, g);
|
|
278
279
|
}
|
|
279
280
|
});
|
|
280
281
|
} };
|
|
281
282
|
}
|
|
282
283
|
const Ee = (r) => {
|
|
283
|
-
var o,
|
|
284
|
-
const { decision: e, onSubmitEvent: s, textValues: i, onCancel:
|
|
284
|
+
var o, u, g, v, f, p, w;
|
|
285
|
+
const { decision: e, onSubmitEvent: s, textValues: i, onCancel: h } = r, { formik: a, handleToggleNoneChange: l } = Te({
|
|
285
286
|
decision: e,
|
|
286
287
|
onSubmitEvent: s
|
|
287
288
|
});
|
|
@@ -297,13 +298,13 @@ const Ee = (r) => {
|
|
|
297
298
|
handleInputChangeFrom: (n) => a.setFieldValue("value.from", n),
|
|
298
299
|
handleInputChangeTo: (n) => a.setFieldValue("value.to", n),
|
|
299
300
|
messageFrom: (o = a.errors.value) == null ? void 0 : o.from,
|
|
300
|
-
messageTo: (
|
|
301
|
-
statusFrom: (g = a.touched.value) != null && g.from ? (
|
|
301
|
+
messageTo: (u = a.errors.value) == null ? void 0 : u.to,
|
|
302
|
+
statusFrom: (g = a.touched.value) != null && g.from ? (v = a.errors.value) != null && v.from ? "invalid" : "valid" : "pending",
|
|
302
303
|
statusTo: (f = a.touched.value) != null && f.to ? (p = a.errors.value) != null && p.to ? "invalid" : "valid" : "pending",
|
|
303
304
|
onBlur: a.handleBlur
|
|
304
305
|
}
|
|
305
306
|
),
|
|
306
|
-
/* @__PURE__ */ t(
|
|
307
|
+
/* @__PURE__ */ t(S, { dashed: !0 }),
|
|
307
308
|
/* @__PURE__ */ t(be, { children: /* @__PURE__ */ t(fe, { children: /* @__PURE__ */ c(
|
|
308
309
|
d,
|
|
309
310
|
{
|
|
@@ -325,17 +326,17 @@ const Ee = (r) => {
|
|
|
325
326
|
}
|
|
326
327
|
)
|
|
327
328
|
] }),
|
|
328
|
-
/* @__PURE__ */ t(d, { direction: "column", gap: "20px", children: (
|
|
329
|
-
var U, I,
|
|
329
|
+
/* @__PURE__ */ t(d, { direction: "column", gap: "20px", children: (w = e.conditions) == null ? void 0 : w.map((n) => {
|
|
330
|
+
var U, I, R, $, L, z, j;
|
|
330
331
|
return /* @__PURE__ */ t(
|
|
331
|
-
|
|
332
|
+
ve,
|
|
332
333
|
{
|
|
333
334
|
id: `toggle-${n.name}`,
|
|
334
335
|
name: `toggle.${n.name}`,
|
|
335
336
|
labelToggle: n.name,
|
|
336
337
|
checked: !a.values.toggleNone && a.values.conditions[n.name] !== void 0,
|
|
337
|
-
handleToggleChange: (
|
|
338
|
-
if (!
|
|
338
|
+
handleToggleChange: (C) => {
|
|
339
|
+
if (!C.target.checked)
|
|
339
340
|
a.setFieldValue(
|
|
340
341
|
`conditions.${n.name}`,
|
|
341
342
|
void 0
|
|
@@ -345,29 +346,29 @@ const Ee = (r) => {
|
|
|
345
346
|
!1
|
|
346
347
|
);
|
|
347
348
|
else {
|
|
348
|
-
const T = n.valueUse ===
|
|
349
|
+
const T = n.valueUse === m.LIST_OF_VALUES_MULTI ? [] : "";
|
|
349
350
|
a.setFieldValue(
|
|
350
351
|
`conditions.${n.name}`,
|
|
351
352
|
T
|
|
352
353
|
);
|
|
353
354
|
}
|
|
354
355
|
},
|
|
355
|
-
children: n.valueUse ===
|
|
356
|
+
children: n.valueUse === m.LIST_OF_VALUES_MULTI ? /* @__PURE__ */ t(
|
|
356
357
|
te,
|
|
357
358
|
{
|
|
358
359
|
id: n.name,
|
|
359
360
|
labelSelect: n.name,
|
|
360
361
|
labelSelected: `Selected ${n.name}`,
|
|
361
|
-
options: (I = (U = n.possibleValue) == null ? void 0 : U.list) == null ? void 0 : I.map((
|
|
362
|
-
id:
|
|
363
|
-
label:
|
|
364
|
-
checked: (a.values.conditions[n.name] || []).includes(
|
|
362
|
+
options: (I = (U = n.possibleValue) == null ? void 0 : U.list) == null ? void 0 : I.map((C) => ({
|
|
363
|
+
id: C,
|
|
364
|
+
label: C,
|
|
365
|
+
checked: (a.values.conditions[n.name] || []).includes(C)
|
|
365
366
|
})),
|
|
366
|
-
onHandleSelectCheckChange: (
|
|
367
|
-
const
|
|
367
|
+
onHandleSelectCheckChange: (C) => {
|
|
368
|
+
const x = C.filter((T) => T.checked).map((T) => T.id);
|
|
368
369
|
a.setFieldValue(
|
|
369
370
|
`conditions.${n.name}`,
|
|
370
|
-
|
|
371
|
+
x
|
|
371
372
|
), a.setFieldTouched(
|
|
372
373
|
`conditions.${n.name}`,
|
|
373
374
|
!0,
|
|
@@ -375,7 +376,7 @@ const Ee = (r) => {
|
|
|
375
376
|
);
|
|
376
377
|
},
|
|
377
378
|
placeholderSelect: `Select ${n.name}`,
|
|
378
|
-
message: (
|
|
379
|
+
message: (R = a.touched.conditions) != null && R[n.name] && (($ = a.errors.conditions) != null && $[n.name]) ? a.errors.conditions[n.name] : void 0,
|
|
379
380
|
onBlur: () => a.setFieldTouched(
|
|
380
381
|
`conditions.${n.name}`,
|
|
381
382
|
!0,
|
|
@@ -389,9 +390,9 @@ const Ee = (r) => {
|
|
|
389
390
|
name: `conditions.${n.name}`,
|
|
390
391
|
label: n.name,
|
|
391
392
|
value: a.values.conditions[n.name],
|
|
392
|
-
onChange: (
|
|
393
|
+
onChange: (C) => a.setFieldValue(
|
|
393
394
|
`conditions.${n.name}`,
|
|
394
|
-
|
|
395
|
+
C
|
|
395
396
|
),
|
|
396
397
|
messageValidate: String(
|
|
397
398
|
(L = a.errors.conditions) == null ? void 0 : L[n.name]
|
|
@@ -407,7 +408,7 @@ const Ee = (r) => {
|
|
|
407
408
|
]
|
|
408
409
|
}
|
|
409
410
|
) }) }),
|
|
410
|
-
/* @__PURE__ */ t(
|
|
411
|
+
/* @__PURE__ */ t(S, { dashed: !0 }),
|
|
411
412
|
/* @__PURE__ */ t(
|
|
412
413
|
ge,
|
|
413
414
|
{
|
|
@@ -422,13 +423,14 @@ const Ee = (r) => {
|
|
|
422
423
|
onHandleStartChange: (n) => a.setFieldValue("startDate", n.target.value),
|
|
423
424
|
onHandleEndChange: (n) => a.setFieldValue("endDate", n.target.value),
|
|
424
425
|
onCheckClosedChange: (n) => {
|
|
425
|
-
n
|
|
426
|
-
}
|
|
426
|
+
a.setFieldValue("checkClosed", n), n && a.setFieldValue("endDate", "");
|
|
427
|
+
},
|
|
428
|
+
checkedClosed: a.values.checkClosed
|
|
427
429
|
}
|
|
428
430
|
),
|
|
429
|
-
/* @__PURE__ */ t(
|
|
431
|
+
/* @__PURE__ */ t(S, {}),
|
|
430
432
|
/* @__PURE__ */ c(d, { direction: "row", justifyContent: "end", gap: "16px", children: [
|
|
431
|
-
/* @__PURE__ */ t(B, { appearance: "gray", onClick:
|
|
433
|
+
/* @__PURE__ */ t(B, { appearance: "gray", onClick: h, children: i.cancel }),
|
|
432
434
|
/* @__PURE__ */ t(B, { type: "submit", children: i.confirm })
|
|
433
435
|
] })
|
|
434
436
|
] }) });
|
|
@@ -440,18 +442,18 @@ const Ee = (r) => {
|
|
|
440
442
|
return;
|
|
441
443
|
if (((i) => typeof i == "object" && i !== null)(e))
|
|
442
444
|
switch (r.valueUse) {
|
|
443
|
-
case
|
|
445
|
+
case m.LIST_OF_VALUES_MULTI:
|
|
444
446
|
return e;
|
|
445
|
-
case
|
|
447
|
+
case m.LIST_OF_VALUES:
|
|
446
448
|
return e;
|
|
447
|
-
case
|
|
449
|
+
case m.RANGE:
|
|
448
450
|
return {
|
|
449
451
|
from: e.from,
|
|
450
452
|
to: e.to
|
|
451
453
|
};
|
|
452
|
-
case
|
|
453
|
-
case
|
|
454
|
-
case
|
|
454
|
+
case m.GREATER_THAN:
|
|
455
|
+
case m.LESS_THAN:
|
|
456
|
+
case m.EQUAL:
|
|
455
457
|
return e.value;
|
|
456
458
|
default:
|
|
457
459
|
return e.value;
|
|
@@ -460,7 +462,7 @@ const Ee = (r) => {
|
|
|
460
462
|
}, Q = b.div`
|
|
461
463
|
& > div {
|
|
462
464
|
border-radius: 8px;
|
|
463
|
-
border: 1px solid ${
|
|
465
|
+
border: 1px solid ${k.palette.neutral.N30};
|
|
464
466
|
}
|
|
465
467
|
`, Y = b.div`
|
|
466
468
|
width: 100%;
|
|
@@ -481,7 +483,7 @@ const Ee = (r) => {
|
|
|
481
483
|
border-radius: 8px;
|
|
482
484
|
}
|
|
483
485
|
`, W = (r) => {
|
|
484
|
-
const { decision: e, loading: s = !1, textValues: i } = r,
|
|
486
|
+
const { decision: e, loading: s = !1, textValues: i } = r, h = (l) => l && Object.keys(l).length > 0, a = {
|
|
485
487
|
name: (e == null ? void 0 : e.name) || "",
|
|
486
488
|
dataType: (e == null ? void 0 : e.dataType) || "alphabetical",
|
|
487
489
|
value: D(e),
|
|
@@ -496,7 +498,7 @@ const Ee = (r) => {
|
|
|
496
498
|
type: "decision"
|
|
497
499
|
}
|
|
498
500
|
) }, e.name),
|
|
499
|
-
/* @__PURE__ */ t(
|
|
501
|
+
/* @__PURE__ */ t(S, { dashed: !0 }),
|
|
500
502
|
/* @__PURE__ */ t(Y, { children: /* @__PURE__ */ c(
|
|
501
503
|
d,
|
|
502
504
|
{
|
|
@@ -519,7 +521,7 @@ const Ee = (r) => {
|
|
|
519
521
|
e.conditions && e.conditions.map((l) => {
|
|
520
522
|
if (l.hidden) return null;
|
|
521
523
|
const o = l.value;
|
|
522
|
-
return (typeof o == "object" &&
|
|
524
|
+
return (typeof o == "object" && h(o) || o !== void 0 && typeof o == "string" && o.length > 0) && /* @__PURE__ */ t(Q, { children: /* @__PURE__ */ t(d, { direction: "column", padding: "8px", children: /* @__PURE__ */ t(
|
|
523
525
|
q,
|
|
524
526
|
{
|
|
525
527
|
element: {
|
|
@@ -530,7 +532,7 @@ const Ee = (r) => {
|
|
|
530
532
|
}
|
|
531
533
|
) }) }, l.name);
|
|
532
534
|
}),
|
|
533
|
-
/* @__PURE__ */ t(
|
|
535
|
+
/* @__PURE__ */ t(S, { dashed: !0 }),
|
|
534
536
|
/* @__PURE__ */ c(d, { direction: "column", gap: "12px", children: [
|
|
535
537
|
(e == null ? void 0 : e.startDate) && (e == null ? void 0 : e.endDate) && /* @__PURE__ */ t(
|
|
536
538
|
q,
|
|
@@ -538,7 +540,7 @@ const Ee = (r) => {
|
|
|
538
540
|
element: {
|
|
539
541
|
name: i.terms,
|
|
540
542
|
value: String(e.startDate),
|
|
541
|
-
valueUse:
|
|
543
|
+
valueUse: m.RANGE,
|
|
542
544
|
dataType: V.DATE
|
|
543
545
|
},
|
|
544
546
|
valueData: D({
|
|
@@ -547,7 +549,7 @@ const Ee = (r) => {
|
|
|
547
549
|
from: String(e.startDate),
|
|
548
550
|
to: String(e.endDate)
|
|
549
551
|
},
|
|
550
|
-
valueUse:
|
|
552
|
+
valueUse: m.RANGE,
|
|
551
553
|
dataType: V.DATE
|
|
552
554
|
}),
|
|
553
555
|
type: "decision"
|
|
@@ -560,13 +562,13 @@ const Ee = (r) => {
|
|
|
560
562
|
element: {
|
|
561
563
|
name: i.terms,
|
|
562
564
|
value: String(e.startDate),
|
|
563
|
-
valueUse:
|
|
565
|
+
valueUse: m.EQUAL,
|
|
564
566
|
dataType: V.DATE
|
|
565
567
|
},
|
|
566
568
|
valueData: D({
|
|
567
569
|
name: i.terms,
|
|
568
570
|
value: String(e.startDate),
|
|
569
|
-
valueUse:
|
|
571
|
+
valueUse: m.EQUAL,
|
|
570
572
|
dataType: V.DATE
|
|
571
573
|
}),
|
|
572
574
|
type: "decision"
|
|
@@ -583,7 +585,7 @@ const Ee = (r) => {
|
|
|
583
585
|
/* @__PURE__ */ t(E, { animated: !0, width: "85px" })
|
|
584
586
|
] }, "loading"),
|
|
585
587
|
/* @__PURE__ */ c(d, { direction: "column", gap: "12px", alignItems: "center", children: [
|
|
586
|
-
/* @__PURE__ */ t(
|
|
588
|
+
/* @__PURE__ */ t(S, { dashed: !0 }),
|
|
587
589
|
/* @__PURE__ */ t(E, { animated: !0, width: "150px" })
|
|
588
590
|
] }),
|
|
589
591
|
/* @__PURE__ */ t(Y, { children: /* @__PURE__ */ t(
|
|
@@ -611,7 +613,7 @@ const Ee = (r) => {
|
|
|
611
613
|
] });
|
|
612
614
|
}, De = b.div`
|
|
613
615
|
border-radius: 8px;
|
|
614
|
-
border: 1px solid ${
|
|
616
|
+
border: 1px solid ${k.palette.neutral.N30};
|
|
615
617
|
box-sizing: border-box;
|
|
616
618
|
display: flex;
|
|
617
619
|
flex-direction: column;
|
|
@@ -641,11 +643,11 @@ b.div`
|
|
|
641
643
|
}
|
|
642
644
|
`;
|
|
643
645
|
const M = (r) => {
|
|
644
|
-
const { children: e, controls: s = !0, handleDelete: i, id:
|
|
646
|
+
const { children: e, controls: s = !0, handleDelete: i, id: h } = r;
|
|
645
647
|
return /* @__PURE__ */ t(De, { children: /* @__PURE__ */ c(d, { direction: "column", gap: "16px", padding: "12px 16px", children: [
|
|
646
648
|
e,
|
|
647
649
|
s && /* @__PURE__ */ c(A, { children: [
|
|
648
|
-
/* @__PURE__ */ t(
|
|
650
|
+
/* @__PURE__ */ t(S, {}),
|
|
649
651
|
/* @__PURE__ */ t(d, { gap: "16px", justifyContent: "end", children: /* @__PURE__ */ t(
|
|
650
652
|
Z,
|
|
651
653
|
{
|
|
@@ -654,7 +656,7 @@ const M = (r) => {
|
|
|
654
656
|
size: "24px",
|
|
655
657
|
icon: /* @__PURE__ */ t(de, {}),
|
|
656
658
|
onClick: () => {
|
|
657
|
-
i(
|
|
659
|
+
i(h);
|
|
658
660
|
}
|
|
659
661
|
}
|
|
660
662
|
) })
|
|
@@ -668,7 +670,7 @@ const M = (r) => {
|
|
|
668
670
|
`, Fe = b.div`
|
|
669
671
|
background-color: ${({ theme: r }) => {
|
|
670
672
|
var e, s;
|
|
671
|
-
return ((s = (e = r == null ? void 0 : r.palette) == null ? void 0 : e.neutral) == null ? void 0 : s.N0) ||
|
|
673
|
+
return ((s = (e = r == null ? void 0 : r.palette) == null ? void 0 : e.neutral) == null ? void 0 : s.N0) || k.palette.neutral.N0;
|
|
672
674
|
}};
|
|
673
675
|
max-width: 450px;
|
|
674
676
|
max-height: 90vh;
|
|
@@ -697,15 +699,15 @@ const M = (r) => {
|
|
|
697
699
|
border-radius: 8px;
|
|
698
700
|
}
|
|
699
701
|
`, Ae = (r) => {
|
|
700
|
-
const { children: e, portalId: s, onCloseModal: i, title:
|
|
702
|
+
const { children: e, portalId: s, onCloseModal: i, title: h } = r, a = document.getElementById(s);
|
|
701
703
|
if (!a)
|
|
702
704
|
throw new Error(
|
|
703
705
|
"The portal node is not defined. This can occur when the specific node used to render the portal has not been defined correctly."
|
|
704
706
|
);
|
|
705
707
|
return ue(
|
|
706
|
-
/* @__PURE__ */ t(Ve, { children: /* @__PURE__ */ t(
|
|
708
|
+
/* @__PURE__ */ t(Ve, { children: /* @__PURE__ */ t(he, { children: /* @__PURE__ */ t(Fe, { children: /* @__PURE__ */ c(d, { direction: "column", gap: "24px", children: [
|
|
707
709
|
/* @__PURE__ */ t(d, { direction: "column", gap: "24px", children: /* @__PURE__ */ c(d, { alignItems: "center", justifyContent: "space-between", children: [
|
|
708
|
-
/* @__PURE__ */ t(y, { type: "title", size: "large", appearance: "dark", weight: "bold", children:
|
|
710
|
+
/* @__PURE__ */ t(y, { type: "title", size: "large", appearance: "dark", weight: "bold", children: h }),
|
|
709
711
|
/* @__PURE__ */ t(se, { size: "24px", cursor: "pointer", onClick: i })
|
|
710
712
|
] }) }),
|
|
711
713
|
e
|
|
@@ -730,7 +732,7 @@ const M = (r) => {
|
|
|
730
732
|
`;
|
|
731
733
|
b.div`
|
|
732
734
|
border-radius: 8px;
|
|
733
|
-
border: 1px solid ${
|
|
735
|
+
border: 1px solid ${k.palette.neutral.N30};
|
|
734
736
|
box-sizing: border-box;
|
|
735
737
|
display: flex;
|
|
736
738
|
flex-direction: column;
|
|
@@ -763,13 +765,13 @@ const Ue = b.div`
|
|
|
763
765
|
`, Ie = b.div`
|
|
764
766
|
& > div > div {
|
|
765
767
|
border-radius: 8px;
|
|
766
|
-
border: 1px solid ${
|
|
768
|
+
border: 1px solid ${k.palette.neutral.N30};
|
|
767
769
|
box-sizing: border-box;
|
|
768
770
|
box-shadow: 0px 4px 8px 3px rgba(0, 0, 0, 0.1);
|
|
769
771
|
}
|
|
770
|
-
`,
|
|
772
|
+
`, Re = b.div`
|
|
771
773
|
& > div {
|
|
772
|
-
background-color: ${
|
|
774
|
+
background-color: ${k.palette.neutral.N30};
|
|
773
775
|
justify-content: center;
|
|
774
776
|
}
|
|
775
777
|
min-height: 300px;
|
|
@@ -780,7 +782,7 @@ const Ue = b.div`
|
|
|
780
782
|
b.div`
|
|
781
783
|
& > div {
|
|
782
784
|
border-radius: 8px;
|
|
783
|
-
border: 1px solid ${
|
|
785
|
+
border: 1px solid ${k.palette.neutral.N30};
|
|
784
786
|
}
|
|
785
787
|
`;
|
|
786
788
|
const rt = ({
|
|
@@ -788,13 +790,13 @@ const rt = ({
|
|
|
788
790
|
decisions: e,
|
|
789
791
|
textValues: s,
|
|
790
792
|
decisionTemplate: i,
|
|
791
|
-
isModalOpen:
|
|
793
|
+
isModalOpen: h,
|
|
792
794
|
selectedDecision: a,
|
|
793
795
|
loading: l,
|
|
794
796
|
handleOpenModal: o,
|
|
795
|
-
handleCloseModal:
|
|
797
|
+
handleCloseModal: u,
|
|
796
798
|
handleSubmitForm: g,
|
|
797
|
-
handleDelete:
|
|
799
|
+
handleDelete: v
|
|
798
800
|
}) => {
|
|
799
801
|
const f = me("(max-width: 681px)");
|
|
800
802
|
return /* @__PURE__ */ c(A, { children: [
|
|
@@ -817,7 +819,7 @@ const rt = ({
|
|
|
817
819
|
"para empezar."
|
|
818
820
|
] }),
|
|
819
821
|
/* @__PURE__ */ c(
|
|
820
|
-
|
|
822
|
+
pe,
|
|
821
823
|
{
|
|
822
824
|
templateColumns: "repeat(auto-fill, minmax(300px, 1fr))",
|
|
823
825
|
autoFlow: "row dense",
|
|
@@ -829,17 +831,17 @@ const rt = ({
|
|
|
829
831
|
padding: "6px",
|
|
830
832
|
height: f ? "auto" : "484px",
|
|
831
833
|
children: [
|
|
832
|
-
l ? Array.from({ length: 3 }).map((p,
|
|
834
|
+
l ? Array.from({ length: 3 }).map((p, w) => /* @__PURE__ */ t(
|
|
833
835
|
M,
|
|
834
836
|
{
|
|
835
|
-
id: `loading-card-${
|
|
837
|
+
id: `loading-card-${w}`,
|
|
836
838
|
handleDelete: () => {
|
|
837
839
|
},
|
|
838
840
|
handleView: () => o(),
|
|
839
841
|
controls: !1,
|
|
840
842
|
children: /* @__PURE__ */ t(W, { loading: !0 })
|
|
841
843
|
},
|
|
842
|
-
`loading-card-${
|
|
844
|
+
`loading-card-${w}`
|
|
843
845
|
)) : e.map((p) => /* @__PURE__ */ t(J, { children: /* @__PURE__ */ c(
|
|
844
846
|
d,
|
|
845
847
|
{
|
|
@@ -862,7 +864,7 @@ const rt = ({
|
|
|
862
864
|
M,
|
|
863
865
|
{
|
|
864
866
|
id: p.id,
|
|
865
|
-
handleDelete: () =>
|
|
867
|
+
handleDelete: () => v(p.id),
|
|
866
868
|
handleView: () => o(p),
|
|
867
869
|
controls: r,
|
|
868
870
|
children: /* @__PURE__ */ t(
|
|
@@ -897,7 +899,7 @@ const rt = ({
|
|
|
897
899
|
}
|
|
898
900
|
),
|
|
899
901
|
/* @__PURE__ */ t(
|
|
900
|
-
|
|
902
|
+
Re,
|
|
901
903
|
{
|
|
902
904
|
onClick: () => o(),
|
|
903
905
|
children: /* @__PURE__ */ t(
|
|
@@ -939,11 +941,11 @@ const rt = ({
|
|
|
939
941
|
}
|
|
940
942
|
)
|
|
941
943
|
] }) }) }),
|
|
942
|
-
|
|
944
|
+
h && /* @__PURE__ */ t(
|
|
943
945
|
Ae,
|
|
944
946
|
{
|
|
945
947
|
portalId: "modal-portal",
|
|
946
|
-
onCloseModal:
|
|
948
|
+
onCloseModal: u,
|
|
947
949
|
title: a ? "Editar Decisión" : "Nueva decisión",
|
|
948
950
|
children: /* @__PURE__ */ t(
|
|
949
951
|
Ee,
|
|
@@ -951,7 +953,7 @@ const rt = ({
|
|
|
951
953
|
decision: a || i,
|
|
952
954
|
onSubmitEvent: g,
|
|
953
955
|
textValues: s,
|
|
954
|
-
onCancel: () =>
|
|
956
|
+
onCancel: () => u()
|
|
955
957
|
}
|
|
956
958
|
)
|
|
957
959
|
}
|