@isettingkit/business-rules 0.1.24 → 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.d.ts +1 -1
- package/dist/index.es.js +126 -125
- package/package.json +1 -1
package/dist/index.es.d.ts
CHANGED
|
@@ -70,6 +70,6 @@ declare interface IRulesFormTextValues {
|
|
|
70
70
|
|
|
71
71
|
export declare const ModalRules: (props: IModalRules) => ReactPortal;
|
|
72
72
|
|
|
73
|
-
export declare
|
|
73
|
+
export declare const RulesForm: (props: IRulesForm) => JSX_2.Element;
|
|
74
74
|
|
|
75
75
|
export { }
|
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
|
-
var o,
|
|
284
|
-
const { decision: e, onSubmitEvent: s, textValues: i, onCancel:
|
|
283
|
+
const Ee = (r) => {
|
|
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 @@ function 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 @@ function 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 @@ function 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 @@ function 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 @@ function 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 @@ function 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,18 +423,18 @@ function 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
|
] }) });
|
|
435
|
-
}
|
|
436
|
-
const D = (r) => {
|
|
437
|
+
}, D = (r) => {
|
|
437
438
|
if (!r)
|
|
438
439
|
return;
|
|
439
440
|
const e = r.value;
|
|
@@ -441,18 +442,18 @@ const D = (r) => {
|
|
|
441
442
|
return;
|
|
442
443
|
if (((i) => typeof i == "object" && i !== null)(e))
|
|
443
444
|
switch (r.valueUse) {
|
|
444
|
-
case
|
|
445
|
+
case m.LIST_OF_VALUES_MULTI:
|
|
445
446
|
return e;
|
|
446
|
-
case
|
|
447
|
+
case m.LIST_OF_VALUES:
|
|
447
448
|
return e;
|
|
448
|
-
case
|
|
449
|
+
case m.RANGE:
|
|
449
450
|
return {
|
|
450
451
|
from: e.from,
|
|
451
452
|
to: e.to
|
|
452
453
|
};
|
|
453
|
-
case
|
|
454
|
-
case
|
|
455
|
-
case
|
|
454
|
+
case m.GREATER_THAN:
|
|
455
|
+
case m.LESS_THAN:
|
|
456
|
+
case m.EQUAL:
|
|
456
457
|
return e.value;
|
|
457
458
|
default:
|
|
458
459
|
return e.value;
|
|
@@ -461,7 +462,7 @@ const D = (r) => {
|
|
|
461
462
|
}, Q = b.div`
|
|
462
463
|
& > div {
|
|
463
464
|
border-radius: 8px;
|
|
464
|
-
border: 1px solid ${
|
|
465
|
+
border: 1px solid ${k.palette.neutral.N30};
|
|
465
466
|
}
|
|
466
467
|
`, Y = b.div`
|
|
467
468
|
width: 100%;
|
|
@@ -482,7 +483,7 @@ const D = (r) => {
|
|
|
482
483
|
border-radius: 8px;
|
|
483
484
|
}
|
|
484
485
|
`, W = (r) => {
|
|
485
|
-
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 = {
|
|
486
487
|
name: (e == null ? void 0 : e.name) || "",
|
|
487
488
|
dataType: (e == null ? void 0 : e.dataType) || "alphabetical",
|
|
488
489
|
value: D(e),
|
|
@@ -497,7 +498,7 @@ const D = (r) => {
|
|
|
497
498
|
type: "decision"
|
|
498
499
|
}
|
|
499
500
|
) }, e.name),
|
|
500
|
-
/* @__PURE__ */ t(
|
|
501
|
+
/* @__PURE__ */ t(S, { dashed: !0 }),
|
|
501
502
|
/* @__PURE__ */ t(Y, { children: /* @__PURE__ */ c(
|
|
502
503
|
d,
|
|
503
504
|
{
|
|
@@ -520,7 +521,7 @@ const D = (r) => {
|
|
|
520
521
|
e.conditions && e.conditions.map((l) => {
|
|
521
522
|
if (l.hidden) return null;
|
|
522
523
|
const o = l.value;
|
|
523
|
-
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(
|
|
524
525
|
q,
|
|
525
526
|
{
|
|
526
527
|
element: {
|
|
@@ -531,7 +532,7 @@ const D = (r) => {
|
|
|
531
532
|
}
|
|
532
533
|
) }) }, l.name);
|
|
533
534
|
}),
|
|
534
|
-
/* @__PURE__ */ t(
|
|
535
|
+
/* @__PURE__ */ t(S, { dashed: !0 }),
|
|
535
536
|
/* @__PURE__ */ c(d, { direction: "column", gap: "12px", children: [
|
|
536
537
|
(e == null ? void 0 : e.startDate) && (e == null ? void 0 : e.endDate) && /* @__PURE__ */ t(
|
|
537
538
|
q,
|
|
@@ -539,7 +540,7 @@ const D = (r) => {
|
|
|
539
540
|
element: {
|
|
540
541
|
name: i.terms,
|
|
541
542
|
value: String(e.startDate),
|
|
542
|
-
valueUse:
|
|
543
|
+
valueUse: m.RANGE,
|
|
543
544
|
dataType: V.DATE
|
|
544
545
|
},
|
|
545
546
|
valueData: D({
|
|
@@ -548,7 +549,7 @@ const D = (r) => {
|
|
|
548
549
|
from: String(e.startDate),
|
|
549
550
|
to: String(e.endDate)
|
|
550
551
|
},
|
|
551
|
-
valueUse:
|
|
552
|
+
valueUse: m.RANGE,
|
|
552
553
|
dataType: V.DATE
|
|
553
554
|
}),
|
|
554
555
|
type: "decision"
|
|
@@ -561,13 +562,13 @@ const D = (r) => {
|
|
|
561
562
|
element: {
|
|
562
563
|
name: i.terms,
|
|
563
564
|
value: String(e.startDate),
|
|
564
|
-
valueUse:
|
|
565
|
+
valueUse: m.EQUAL,
|
|
565
566
|
dataType: V.DATE
|
|
566
567
|
},
|
|
567
568
|
valueData: D({
|
|
568
569
|
name: i.terms,
|
|
569
570
|
value: String(e.startDate),
|
|
570
|
-
valueUse:
|
|
571
|
+
valueUse: m.EQUAL,
|
|
571
572
|
dataType: V.DATE
|
|
572
573
|
}),
|
|
573
574
|
type: "decision"
|
|
@@ -584,7 +585,7 @@ const D = (r) => {
|
|
|
584
585
|
/* @__PURE__ */ t(E, { animated: !0, width: "85px" })
|
|
585
586
|
] }, "loading"),
|
|
586
587
|
/* @__PURE__ */ c(d, { direction: "column", gap: "12px", alignItems: "center", children: [
|
|
587
|
-
/* @__PURE__ */ t(
|
|
588
|
+
/* @__PURE__ */ t(S, { dashed: !0 }),
|
|
588
589
|
/* @__PURE__ */ t(E, { animated: !0, width: "150px" })
|
|
589
590
|
] }),
|
|
590
591
|
/* @__PURE__ */ t(Y, { children: /* @__PURE__ */ t(
|
|
@@ -612,7 +613,7 @@ const D = (r) => {
|
|
|
612
613
|
] });
|
|
613
614
|
}, De = b.div`
|
|
614
615
|
border-radius: 8px;
|
|
615
|
-
border: 1px solid ${
|
|
616
|
+
border: 1px solid ${k.palette.neutral.N30};
|
|
616
617
|
box-sizing: border-box;
|
|
617
618
|
display: flex;
|
|
618
619
|
flex-direction: column;
|
|
@@ -642,11 +643,11 @@ b.div`
|
|
|
642
643
|
}
|
|
643
644
|
`;
|
|
644
645
|
const M = (r) => {
|
|
645
|
-
const { children: e, controls: s = !0, handleDelete: i, id:
|
|
646
|
+
const { children: e, controls: s = !0, handleDelete: i, id: h } = r;
|
|
646
647
|
return /* @__PURE__ */ t(De, { children: /* @__PURE__ */ c(d, { direction: "column", gap: "16px", padding: "12px 16px", children: [
|
|
647
648
|
e,
|
|
648
649
|
s && /* @__PURE__ */ c(A, { children: [
|
|
649
|
-
/* @__PURE__ */ t(
|
|
650
|
+
/* @__PURE__ */ t(S, {}),
|
|
650
651
|
/* @__PURE__ */ t(d, { gap: "16px", justifyContent: "end", children: /* @__PURE__ */ t(
|
|
651
652
|
Z,
|
|
652
653
|
{
|
|
@@ -655,7 +656,7 @@ const M = (r) => {
|
|
|
655
656
|
size: "24px",
|
|
656
657
|
icon: /* @__PURE__ */ t(de, {}),
|
|
657
658
|
onClick: () => {
|
|
658
|
-
i(
|
|
659
|
+
i(h);
|
|
659
660
|
}
|
|
660
661
|
}
|
|
661
662
|
) })
|
|
@@ -669,7 +670,7 @@ const M = (r) => {
|
|
|
669
670
|
`, Fe = b.div`
|
|
670
671
|
background-color: ${({ theme: r }) => {
|
|
671
672
|
var e, s;
|
|
672
|
-
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;
|
|
673
674
|
}};
|
|
674
675
|
max-width: 450px;
|
|
675
676
|
max-height: 90vh;
|
|
@@ -698,15 +699,15 @@ const M = (r) => {
|
|
|
698
699
|
border-radius: 8px;
|
|
699
700
|
}
|
|
700
701
|
`, Ae = (r) => {
|
|
701
|
-
const { children: e, portalId: s, onCloseModal: i, title:
|
|
702
|
+
const { children: e, portalId: s, onCloseModal: i, title: h } = r, a = document.getElementById(s);
|
|
702
703
|
if (!a)
|
|
703
704
|
throw new Error(
|
|
704
705
|
"The portal node is not defined. This can occur when the specific node used to render the portal has not been defined correctly."
|
|
705
706
|
);
|
|
706
707
|
return ue(
|
|
707
|
-
/* @__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: [
|
|
708
709
|
/* @__PURE__ */ t(d, { direction: "column", gap: "24px", children: /* @__PURE__ */ c(d, { alignItems: "center", justifyContent: "space-between", children: [
|
|
709
|
-
/* @__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 }),
|
|
710
711
|
/* @__PURE__ */ t(se, { size: "24px", cursor: "pointer", onClick: i })
|
|
711
712
|
] }) }),
|
|
712
713
|
e
|
|
@@ -731,7 +732,7 @@ const M = (r) => {
|
|
|
731
732
|
`;
|
|
732
733
|
b.div`
|
|
733
734
|
border-radius: 8px;
|
|
734
|
-
border: 1px solid ${
|
|
735
|
+
border: 1px solid ${k.palette.neutral.N30};
|
|
735
736
|
box-sizing: border-box;
|
|
736
737
|
display: flex;
|
|
737
738
|
flex-direction: column;
|
|
@@ -764,13 +765,13 @@ const Ue = b.div`
|
|
|
764
765
|
`, Ie = b.div`
|
|
765
766
|
& > div > div {
|
|
766
767
|
border-radius: 8px;
|
|
767
|
-
border: 1px solid ${
|
|
768
|
+
border: 1px solid ${k.palette.neutral.N30};
|
|
768
769
|
box-sizing: border-box;
|
|
769
770
|
box-shadow: 0px 4px 8px 3px rgba(0, 0, 0, 0.1);
|
|
770
771
|
}
|
|
771
|
-
`,
|
|
772
|
+
`, Re = b.div`
|
|
772
773
|
& > div {
|
|
773
|
-
background-color: ${
|
|
774
|
+
background-color: ${k.palette.neutral.N30};
|
|
774
775
|
justify-content: center;
|
|
775
776
|
}
|
|
776
777
|
min-height: 300px;
|
|
@@ -781,7 +782,7 @@ const Ue = b.div`
|
|
|
781
782
|
b.div`
|
|
782
783
|
& > div {
|
|
783
784
|
border-radius: 8px;
|
|
784
|
-
border: 1px solid ${
|
|
785
|
+
border: 1px solid ${k.palette.neutral.N30};
|
|
785
786
|
}
|
|
786
787
|
`;
|
|
787
788
|
const rt = ({
|
|
@@ -789,13 +790,13 @@ const rt = ({
|
|
|
789
790
|
decisions: e,
|
|
790
791
|
textValues: s,
|
|
791
792
|
decisionTemplate: i,
|
|
792
|
-
isModalOpen:
|
|
793
|
+
isModalOpen: h,
|
|
793
794
|
selectedDecision: a,
|
|
794
795
|
loading: l,
|
|
795
796
|
handleOpenModal: o,
|
|
796
|
-
handleCloseModal:
|
|
797
|
+
handleCloseModal: u,
|
|
797
798
|
handleSubmitForm: g,
|
|
798
|
-
handleDelete:
|
|
799
|
+
handleDelete: v
|
|
799
800
|
}) => {
|
|
800
801
|
const f = me("(max-width: 681px)");
|
|
801
802
|
return /* @__PURE__ */ c(A, { children: [
|
|
@@ -818,7 +819,7 @@ const rt = ({
|
|
|
818
819
|
"para empezar."
|
|
819
820
|
] }),
|
|
820
821
|
/* @__PURE__ */ c(
|
|
821
|
-
|
|
822
|
+
pe,
|
|
822
823
|
{
|
|
823
824
|
templateColumns: "repeat(auto-fill, minmax(300px, 1fr))",
|
|
824
825
|
autoFlow: "row dense",
|
|
@@ -830,17 +831,17 @@ const rt = ({
|
|
|
830
831
|
padding: "6px",
|
|
831
832
|
height: f ? "auto" : "484px",
|
|
832
833
|
children: [
|
|
833
|
-
l ? Array.from({ length: 3 }).map((p,
|
|
834
|
+
l ? Array.from({ length: 3 }).map((p, w) => /* @__PURE__ */ t(
|
|
834
835
|
M,
|
|
835
836
|
{
|
|
836
|
-
id: `loading-card-${
|
|
837
|
+
id: `loading-card-${w}`,
|
|
837
838
|
handleDelete: () => {
|
|
838
839
|
},
|
|
839
840
|
handleView: () => o(),
|
|
840
841
|
controls: !1,
|
|
841
842
|
children: /* @__PURE__ */ t(W, { loading: !0 })
|
|
842
843
|
},
|
|
843
|
-
`loading-card-${
|
|
844
|
+
`loading-card-${w}`
|
|
844
845
|
)) : e.map((p) => /* @__PURE__ */ t(J, { children: /* @__PURE__ */ c(
|
|
845
846
|
d,
|
|
846
847
|
{
|
|
@@ -863,7 +864,7 @@ const rt = ({
|
|
|
863
864
|
M,
|
|
864
865
|
{
|
|
865
866
|
id: p.id,
|
|
866
|
-
handleDelete: () =>
|
|
867
|
+
handleDelete: () => v(p.id),
|
|
867
868
|
handleView: () => o(p),
|
|
868
869
|
controls: r,
|
|
869
870
|
children: /* @__PURE__ */ t(
|
|
@@ -898,7 +899,7 @@ const rt = ({
|
|
|
898
899
|
}
|
|
899
900
|
),
|
|
900
901
|
/* @__PURE__ */ t(
|
|
901
|
-
|
|
902
|
+
Re,
|
|
902
903
|
{
|
|
903
904
|
onClick: () => o(),
|
|
904
905
|
children: /* @__PURE__ */ t(
|
|
@@ -940,11 +941,11 @@ const rt = ({
|
|
|
940
941
|
}
|
|
941
942
|
)
|
|
942
943
|
] }) }) }),
|
|
943
|
-
|
|
944
|
+
h && /* @__PURE__ */ t(
|
|
944
945
|
Ae,
|
|
945
946
|
{
|
|
946
947
|
portalId: "modal-portal",
|
|
947
|
-
onCloseModal:
|
|
948
|
+
onCloseModal: u,
|
|
948
949
|
title: a ? "Editar Decisión" : "Nueva decisión",
|
|
949
950
|
children: /* @__PURE__ */ t(
|
|
950
951
|
Ee,
|
|
@@ -952,7 +953,7 @@ const rt = ({
|
|
|
952
953
|
decision: a || i,
|
|
953
954
|
onSubmitEvent: g,
|
|
954
955
|
textValues: s,
|
|
955
|
-
onCancel: () =>
|
|
956
|
+
onCancel: () => u()
|
|
956
957
|
}
|
|
957
958
|
)
|
|
958
959
|
}
|