@isettingkit/business-rules 0.1.29 → 0.1.31
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 +450 -502
- package/package.json +2 -2
package/dist/index.es.js
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { ValueDataType as
|
|
1
|
+
import { jsxs as u, Fragment as E, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { ValueDataType as k, ValueHowToSetUp as b, DecisionConditionRender as $ } from "@isettingkit/input";
|
|
3
3
|
import { Stack as s } from "@inubekit/stack";
|
|
4
|
-
import { Divider as
|
|
5
|
-
import { Button as
|
|
6
|
-
import { useState as
|
|
7
|
-
import { Text as
|
|
8
|
-
import { Date as
|
|
9
|
-
import { Checkbox as
|
|
10
|
-
import { Toggle as
|
|
11
|
-
import { inube as
|
|
12
|
-
import
|
|
13
|
-
import { useFormik as
|
|
14
|
-
import { mixed as
|
|
15
|
-
import { DecisionViewConditionRenderer as
|
|
16
|
-
import { SkeletonLine as
|
|
17
|
-
import { MdOutlineDelete as
|
|
18
|
-
import { Icon as
|
|
19
|
-
import { createPortal as
|
|
20
|
-
import { Blanket as
|
|
21
|
-
import { Grid as
|
|
22
|
-
import { useMediaQuery as
|
|
23
|
-
const
|
|
4
|
+
import { Divider as w } from "@inubekit/divider";
|
|
5
|
+
import { Button as z } from "@inubekit/button";
|
|
6
|
+
import { useState as _, useEffect as te } from "react";
|
|
7
|
+
import { Text as x } from "@inubekit/text";
|
|
8
|
+
import { Date as q } from "@inubekit/date";
|
|
9
|
+
import { Checkbox as re } from "@inubekit/checkbox";
|
|
10
|
+
import { Toggle as B } from "@inubekit/toggle";
|
|
11
|
+
import { inube as v } from "@inubekit/foundations";
|
|
12
|
+
import g, { keyframes as ae } from "styled-components";
|
|
13
|
+
import { useFormik as ne } from "formik";
|
|
14
|
+
import { mixed as P, object as L, number as R, string as I, date as O, lazy as j } from "yup";
|
|
15
|
+
import { DecisionViewConditionRenderer as N } from "@isettingkit/view";
|
|
16
|
+
import { SkeletonLine as T } from "@inubekit/skeleton";
|
|
17
|
+
import { MdOutlineDelete as oe, MdClear as ie, MdAdd as de } from "react-icons/md";
|
|
18
|
+
import { Icon as Q } from "@inubekit/icon";
|
|
19
|
+
import { createPortal as le } from "react-dom";
|
|
20
|
+
import { Blanket as se } from "@inubekit/blanket";
|
|
21
|
+
import { Grid as ce } from "@inubekit/grid";
|
|
22
|
+
import { useMediaQuery as ue } from "@inubekit/hooks";
|
|
23
|
+
const he = (e) => {
|
|
24
24
|
const {
|
|
25
25
|
onHandleStartChange: t,
|
|
26
|
-
onHandleEndChange:
|
|
27
|
-
onCheckClosedChange:
|
|
28
|
-
labelStart:
|
|
29
|
-
labelEnd:
|
|
30
|
-
checkedClosed:
|
|
31
|
-
required:
|
|
32
|
-
valueStart:
|
|
33
|
-
valueEnd:
|
|
26
|
+
onHandleEndChange: a,
|
|
27
|
+
onCheckClosedChange: n,
|
|
28
|
+
labelStart: c,
|
|
29
|
+
labelEnd: o,
|
|
30
|
+
checkedClosed: l = !1,
|
|
31
|
+
required: i = !1,
|
|
32
|
+
valueStart: h = "",
|
|
33
|
+
valueEnd: d = "",
|
|
34
34
|
messageStart: m = "",
|
|
35
|
-
messageEnd:
|
|
36
|
-
statusStart:
|
|
37
|
-
statusEnd:
|
|
38
|
-
} = e, [
|
|
39
|
-
return /* @__PURE__ */
|
|
40
|
-
/* @__PURE__ */
|
|
41
|
-
/* @__PURE__ */
|
|
42
|
-
|
|
35
|
+
messageEnd: p = "",
|
|
36
|
+
statusStart: f = "pending",
|
|
37
|
+
statusEnd: S = "pending"
|
|
38
|
+
} = e, [A, J] = _(l), [K, X] = _(h), [Z, ee] = _(d);
|
|
39
|
+
return /* @__PURE__ */ u(E, { children: [
|
|
40
|
+
/* @__PURE__ */ u(s, { direction: "row", justifyContent: "space-between", margin: "10px 0", children: [
|
|
41
|
+
/* @__PURE__ */ r(s, { children: /* @__PURE__ */ r(
|
|
42
|
+
x,
|
|
43
43
|
{
|
|
44
44
|
appearance: "gray",
|
|
45
45
|
margin: "10px 0",
|
|
@@ -49,66 +49,66 @@ const fe = (e) => {
|
|
|
49
49
|
children: "Vigencia"
|
|
50
50
|
}
|
|
51
51
|
) }),
|
|
52
|
-
/* @__PURE__ */
|
|
52
|
+
/* @__PURE__ */ r(
|
|
53
53
|
s,
|
|
54
54
|
{
|
|
55
55
|
alignContent: "center",
|
|
56
56
|
justifyContent: "center",
|
|
57
57
|
wrap: "wrap",
|
|
58
58
|
gap: "4px",
|
|
59
|
-
children: /* @__PURE__ */
|
|
60
|
-
|
|
59
|
+
children: /* @__PURE__ */ r(
|
|
60
|
+
re,
|
|
61
61
|
{
|
|
62
62
|
label: "Cerrada",
|
|
63
|
-
onChange: ({ target:
|
|
64
|
-
|
|
63
|
+
onChange: ({ target: y }) => {
|
|
64
|
+
J(y.checked), n && n(y.checked);
|
|
65
65
|
},
|
|
66
|
-
checked:
|
|
66
|
+
checked: A,
|
|
67
67
|
value: ""
|
|
68
68
|
}
|
|
69
69
|
)
|
|
70
70
|
}
|
|
71
71
|
)
|
|
72
72
|
] }),
|
|
73
|
-
/* @__PURE__ */
|
|
74
|
-
/* @__PURE__ */
|
|
75
|
-
|
|
73
|
+
/* @__PURE__ */ u(s, { justifyContent: "space-between", gap: "24px", children: [
|
|
74
|
+
/* @__PURE__ */ r(s, { width: "189px", children: /* @__PURE__ */ r(
|
|
75
|
+
q,
|
|
76
76
|
{
|
|
77
77
|
id: "dateStart",
|
|
78
|
-
label:
|
|
79
|
-
onChange: (
|
|
80
|
-
|
|
78
|
+
label: c,
|
|
79
|
+
onChange: (y) => {
|
|
80
|
+
X(y.target.value), t(y);
|
|
81
81
|
},
|
|
82
|
-
value:
|
|
83
|
-
required:
|
|
82
|
+
value: K,
|
|
83
|
+
required: i,
|
|
84
84
|
size: "compact",
|
|
85
|
-
status:
|
|
85
|
+
status: f,
|
|
86
86
|
message: m
|
|
87
87
|
}
|
|
88
88
|
) }),
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
A && /* @__PURE__ */ r(s, { width: "189px", children: /* @__PURE__ */ r(
|
|
90
|
+
q,
|
|
91
91
|
{
|
|
92
92
|
id: "dateEnd",
|
|
93
|
-
label:
|
|
94
|
-
onChange: (
|
|
95
|
-
|
|
93
|
+
label: o,
|
|
94
|
+
onChange: (y) => {
|
|
95
|
+
ee(y.target.value), a(y);
|
|
96
96
|
},
|
|
97
|
-
value:
|
|
98
|
-
required:
|
|
97
|
+
value: Z,
|
|
98
|
+
required: i,
|
|
99
99
|
size: "compact",
|
|
100
|
-
status:
|
|
101
|
-
message:
|
|
100
|
+
status: S,
|
|
101
|
+
message: p
|
|
102
102
|
}
|
|
103
103
|
) })
|
|
104
104
|
] })
|
|
105
105
|
] });
|
|
106
|
-
},
|
|
106
|
+
}, pe = g.div`
|
|
107
107
|
& > div {
|
|
108
108
|
border-radius: 8px;
|
|
109
|
-
border: 1px solid ${
|
|
109
|
+
border: 1px solid ${v.palette.neutral.N30};
|
|
110
110
|
}
|
|
111
|
-
`,
|
|
111
|
+
`, ge = g.div`
|
|
112
112
|
width: 100%;
|
|
113
113
|
height: 100%;
|
|
114
114
|
overflow-y: auto;
|
|
@@ -125,194 +125,184 @@ const fe = (e) => {
|
|
|
125
125
|
background-color: #ebecf0;
|
|
126
126
|
border-radius: 8px;
|
|
127
127
|
}
|
|
128
|
-
`,
|
|
128
|
+
`, me = (e) => {
|
|
129
129
|
const {
|
|
130
130
|
checked: t,
|
|
131
|
-
children:
|
|
132
|
-
handleToggleChange:
|
|
133
|
-
id:
|
|
134
|
-
labelToggle:
|
|
135
|
-
name:
|
|
136
|
-
valueToggle:
|
|
137
|
-
} = e, [
|
|
138
|
-
p
|
|
131
|
+
children: a,
|
|
132
|
+
handleToggleChange: n,
|
|
133
|
+
id: c,
|
|
134
|
+
labelToggle: o,
|
|
135
|
+
name: l,
|
|
136
|
+
valueToggle: i = ""
|
|
137
|
+
} = e, [h, d] = _(t), m = (p) => {
|
|
138
|
+
d(p.target.checked), n(p);
|
|
139
139
|
};
|
|
140
|
-
return
|
|
141
|
-
|
|
142
|
-
}, [t]), /* @__PURE__ */
|
|
143
|
-
/* @__PURE__ */
|
|
144
|
-
|
|
140
|
+
return te(() => {
|
|
141
|
+
d(t);
|
|
142
|
+
}, [t]), /* @__PURE__ */ u(E, { children: [
|
|
143
|
+
/* @__PURE__ */ r(s, { children: /* @__PURE__ */ r(
|
|
144
|
+
B,
|
|
145
145
|
{
|
|
146
|
-
checked:
|
|
147
|
-
id:
|
|
148
|
-
name:
|
|
146
|
+
checked: h,
|
|
147
|
+
id: c,
|
|
148
|
+
name: l,
|
|
149
149
|
onChange: m,
|
|
150
150
|
size: "small",
|
|
151
|
-
value:
|
|
152
|
-
children: /* @__PURE__ */
|
|
151
|
+
value: i,
|
|
152
|
+
children: /* @__PURE__ */ r(x, { size: "medium", type: "label", weight: "bold", children: o })
|
|
153
153
|
}
|
|
154
154
|
) }),
|
|
155
|
-
|
|
155
|
+
h && /* @__PURE__ */ r(E, { children: a })
|
|
156
156
|
] });
|
|
157
|
-
},
|
|
158
|
-
schema:
|
|
157
|
+
}, be = (e) => ({
|
|
158
|
+
schema: P().test(
|
|
159
159
|
"isArrayOrString",
|
|
160
160
|
"Must be an array of strings/numbers or a single string",
|
|
161
161
|
(t) => Array.isArray(t) ? t.every(
|
|
162
|
-
(
|
|
162
|
+
(a) => typeof a == "string" || typeof a == "number"
|
|
163
163
|
) : typeof t == "string"
|
|
164
164
|
),
|
|
165
165
|
value: e
|
|
166
|
-
}),
|
|
167
|
-
schema:
|
|
166
|
+
}), fe = (e) => ({
|
|
167
|
+
schema: P().test(
|
|
168
168
|
"isArrayOrString",
|
|
169
169
|
"Must be an array of strings/numbers or a single string",
|
|
170
170
|
(t) => Array.isArray(t) ? t.every(
|
|
171
|
-
(
|
|
171
|
+
(a) => typeof a == "string" || typeof a == "number"
|
|
172
172
|
) : typeof t == "string"
|
|
173
173
|
),
|
|
174
174
|
value: e
|
|
175
|
-
}),
|
|
176
|
-
const t = (e == null ? void 0 : e.from) ?? 0,
|
|
175
|
+
}), xe = (e) => {
|
|
176
|
+
const t = (e == null ? void 0 : e.from) ?? 0, a = (e == null ? void 0 : e.to) ?? 0;
|
|
177
177
|
return {
|
|
178
|
-
schema:
|
|
179
|
-
from:
|
|
180
|
-
to:
|
|
178
|
+
schema: L({
|
|
179
|
+
from: R().required("Range From is required").max(a, "'Range From' cannot be greater than 'Range To'").min(0, "'Range From' cannot be less than 0"),
|
|
180
|
+
to: R().min(0, "To value must be greater than or equal to 0").required("To value is required").test(
|
|
181
|
+
"is-greater",
|
|
182
|
+
"To value must be greater than From value",
|
|
183
|
+
function(n) {
|
|
184
|
+
const { from: c } = this.parent;
|
|
185
|
+
return n > c;
|
|
186
|
+
}
|
|
187
|
+
)
|
|
181
188
|
}),
|
|
182
|
-
value: { from: t, to:
|
|
189
|
+
value: { from: t, to: a }
|
|
183
190
|
};
|
|
184
|
-
},
|
|
185
|
-
schema:
|
|
191
|
+
}, V = (e, t) => t === k.PERCENTAGE ? {
|
|
192
|
+
schema: R().required("Percentage is required").min(0, "Percentage cannot be less than 0").max(100, "Percentage cannot be greater than 100"),
|
|
186
193
|
value: e
|
|
187
194
|
} : {
|
|
188
|
-
schema:
|
|
195
|
+
schema: I().required("Required"),
|
|
189
196
|
value: e
|
|
190
|
-
},
|
|
191
|
-
schema:
|
|
197
|
+
}, ye = (e) => ({
|
|
198
|
+
schema: I().required("Required").test(
|
|
192
199
|
"non-empty",
|
|
193
200
|
"Value cannot be empty",
|
|
194
201
|
(t) => t != null && t.trim() !== ""
|
|
195
202
|
),
|
|
196
203
|
value: e
|
|
197
|
-
}),
|
|
198
|
-
[
|
|
199
|
-
[
|
|
200
|
-
[
|
|
201
|
-
[
|
|
202
|
-
[
|
|
203
|
-
[
|
|
204
|
-
},
|
|
205
|
-
function
|
|
206
|
-
const
|
|
204
|
+
}), ve = {
|
|
205
|
+
[b.LIST_OF_VALUES]: be,
|
|
206
|
+
[b.LIST_OF_VALUES_MULTI]: fe,
|
|
207
|
+
[b.RANGE]: xe,
|
|
208
|
+
[b.GREATER_THAN]: V,
|
|
209
|
+
[b.LESS_THAN]: V,
|
|
210
|
+
[b.EQUAL]: V
|
|
211
|
+
}, M = (e) => ve[e] || ye;
|
|
212
|
+
function Ce({ decision: e, onSubmitEvent: t }) {
|
|
213
|
+
const a = {
|
|
207
214
|
name: e.name || "",
|
|
208
|
-
dataType: e.dataType ||
|
|
215
|
+
dataType: e.dataType || k.ALPHABETICAL,
|
|
209
216
|
valueUse: e.valueUse || "",
|
|
210
|
-
value: e.value ||
|
|
217
|
+
value: e.value || "",
|
|
211
218
|
startDate: e.startDate || "",
|
|
212
219
|
endDate: e.endDate || "",
|
|
213
220
|
toggleNone: !0,
|
|
214
221
|
conditions: {},
|
|
215
222
|
checkClosed: !1
|
|
216
|
-
},
|
|
217
|
-
name:
|
|
218
|
-
startDate:
|
|
219
|
-
endDate:
|
|
223
|
+
}, n = L({
|
|
224
|
+
name: I().required("Name is required"),
|
|
225
|
+
startDate: O().required("Start date is required"),
|
|
226
|
+
endDate: O().when("checkClosed", (l, i, { parent: h }) => (h == null ? void 0 : h.checkClosed) ? i.required("End date is required").test(
|
|
220
227
|
"is-after-startDate",
|
|
221
228
|
"End date must be greater than or equal to Start date",
|
|
222
229
|
function(m) {
|
|
223
|
-
const
|
|
224
|
-
return !
|
|
230
|
+
const p = this.parent.startDate;
|
|
231
|
+
return !p || !m ? !0 : new Date(m) >= new Date(p);
|
|
225
232
|
}
|
|
226
|
-
) :
|
|
227
|
-
value:
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
"To value must be greater than From value",
|
|
232
|
-
function(i) {
|
|
233
|
-
const { from: l } = this.parent;
|
|
234
|
-
return i > l;
|
|
235
|
-
}
|
|
236
|
-
)
|
|
237
|
-
}).required("Range value is required"),
|
|
238
|
-
conditions: se((i, { parent: l }) => {
|
|
239
|
-
var p, m;
|
|
240
|
-
return (l == null ? void 0 : l.toggleNone) && ((p = l == null ? void 0 : l.conditions) == null ? void 0 : p.length) > 0 ? V().shape({}) : V(
|
|
233
|
+
) : i.notRequired()),
|
|
234
|
+
value: j(() => M(c.values.valueUse)(c.values.value, c.values.dataType).schema),
|
|
235
|
+
conditions: j((l, { parent: i }) => {
|
|
236
|
+
var d, m;
|
|
237
|
+
return (i == null ? void 0 : i.toggleNone) && ((d = i == null ? void 0 : i.conditions) == null ? void 0 : d.length) > 0 ? L().shape({}) : L(
|
|
241
238
|
(m = e.conditions) == null ? void 0 : m.reduce(
|
|
242
|
-
(
|
|
243
|
-
if (
|
|
244
|
-
const
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
239
|
+
(p, f) => {
|
|
240
|
+
if (c.values.conditions[f.name] !== void 0) {
|
|
241
|
+
const S = M(f.valueUse);
|
|
242
|
+
p[f.name] = S(
|
|
243
|
+
f.value,
|
|
244
|
+
f.dataType
|
|
248
245
|
).schema;
|
|
249
246
|
}
|
|
250
|
-
return
|
|
247
|
+
return p;
|
|
251
248
|
},
|
|
252
249
|
{}
|
|
253
250
|
)
|
|
254
251
|
);
|
|
255
252
|
})
|
|
256
|
-
}),
|
|
257
|
-
initialValues:
|
|
258
|
-
validationSchema:
|
|
253
|
+
}), c = ne({
|
|
254
|
+
initialValues: a,
|
|
255
|
+
validationSchema: n,
|
|
259
256
|
validateOnBlur: !0,
|
|
260
|
-
onSubmit: (
|
|
261
|
-
var
|
|
262
|
-
const
|
|
257
|
+
onSubmit: (l) => {
|
|
258
|
+
var h;
|
|
259
|
+
const i = {
|
|
263
260
|
...e,
|
|
264
|
-
name:
|
|
265
|
-
dataType:
|
|
266
|
-
valueUse:
|
|
267
|
-
value:
|
|
268
|
-
startDate:
|
|
269
|
-
endDate:
|
|
270
|
-
conditions: (
|
|
271
|
-
...
|
|
272
|
-
value:
|
|
261
|
+
name: l.name,
|
|
262
|
+
dataType: l.dataType,
|
|
263
|
+
valueUse: l.valueUse,
|
|
264
|
+
value: l.value,
|
|
265
|
+
startDate: l.startDate,
|
|
266
|
+
endDate: l.endDate,
|
|
267
|
+
conditions: (h = e.conditions) == null ? void 0 : h.map((d) => ({
|
|
268
|
+
...d,
|
|
269
|
+
value: l.conditions[d.name]
|
|
273
270
|
}))
|
|
274
271
|
};
|
|
275
|
-
t(
|
|
272
|
+
t(i);
|
|
276
273
|
}
|
|
277
274
|
});
|
|
278
|
-
return { formik:
|
|
279
|
-
var
|
|
280
|
-
|
|
281
|
-
if (
|
|
282
|
-
|
|
275
|
+
return { formik: c, handleToggleNoneChange: (l) => {
|
|
276
|
+
var i;
|
|
277
|
+
c.setFieldValue("toggleNone", l), (i = e.conditions) == null || i.forEach((h) => {
|
|
278
|
+
if (l)
|
|
279
|
+
c.setFieldValue(`conditions.${h.name}`, void 0);
|
|
283
280
|
else {
|
|
284
|
-
const
|
|
285
|
-
|
|
281
|
+
const d = h.valueUse === b.LIST_OF_VALUES_MULTI ? [] : "";
|
|
282
|
+
c.setFieldValue(`conditions.${h.name}`, d);
|
|
286
283
|
}
|
|
287
284
|
});
|
|
288
285
|
} };
|
|
289
286
|
}
|
|
290
|
-
const
|
|
291
|
-
var
|
|
292
|
-
const { decision: t, onSubmitEvent:
|
|
287
|
+
const we = (e) => {
|
|
288
|
+
var h;
|
|
289
|
+
const { decision: t, onSubmitEvent: a, textValues: n, onCancel: c } = e, { formik: o, handleToggleNoneChange: l } = Ce({
|
|
293
290
|
decision: t,
|
|
294
|
-
onSubmitEvent:
|
|
295
|
-
})
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
statusFrom: (p = r.touched.value) != null && p.from ? (m = r.errors.value) != null && m.from ? "invalid" : "valid" : "pending",
|
|
310
|
-
statusTo: (g = r.touched.value) != null && g.to ? (v = r.errors.value) != null && v.to ? "invalid" : "valid" : "pending",
|
|
311
|
-
onBlur: r.handleBlur
|
|
312
|
-
}
|
|
313
|
-
),
|
|
314
|
-
/* @__PURE__ */ a(T, { dashed: !0 }),
|
|
315
|
-
/* @__PURE__ */ a(ve, { children: /* @__PURE__ */ a(xe, { children: /* @__PURE__ */ c(
|
|
291
|
+
onSubmitEvent: a
|
|
292
|
+
}), i = {
|
|
293
|
+
name: t.name,
|
|
294
|
+
valueUse: t.valueUse,
|
|
295
|
+
dataType: t.dataType,
|
|
296
|
+
possibleValue: t.possibleValue
|
|
297
|
+
};
|
|
298
|
+
return /* @__PURE__ */ r("form", { onSubmit: o.handleSubmit, children: /* @__PURE__ */ u(s, { direction: "column", gap: "24px", children: [
|
|
299
|
+
$({
|
|
300
|
+
condition: i,
|
|
301
|
+
formik: o,
|
|
302
|
+
isDecision: !0
|
|
303
|
+
}),
|
|
304
|
+
/* @__PURE__ */ r(w, { dashed: !0 }),
|
|
305
|
+
/* @__PURE__ */ r(pe, { children: /* @__PURE__ */ r(ge, { children: /* @__PURE__ */ u(
|
|
316
306
|
s,
|
|
317
307
|
{
|
|
318
308
|
direction: "column",
|
|
@@ -320,133 +310,91 @@ const Ae = (e) => {
|
|
|
320
310
|
gap: "16px",
|
|
321
311
|
height: "272px",
|
|
322
312
|
children: [
|
|
323
|
-
/* @__PURE__ */
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
}
|
|
334
|
-
)
|
|
335
|
-
] }),
|
|
336
|
-
/* @__PURE__ */ a(s, { direction: "column", gap: "20px", children: (w = t.conditions) == null ? void 0 : w.map((n) => {
|
|
337
|
-
var R, N, I, U, $, M, O;
|
|
338
|
-
return /* @__PURE__ */ a(
|
|
339
|
-
ye,
|
|
340
|
-
{
|
|
341
|
-
id: `toggle-${n.name}`,
|
|
342
|
-
name: `toggle.${n.name}`,
|
|
343
|
-
labelToggle: n.name,
|
|
344
|
-
checked: !r.values.toggleNone && r.values.conditions[n.name] !== void 0,
|
|
345
|
-
handleToggleChange: (C) => {
|
|
346
|
-
if (!C.target.checked)
|
|
347
|
-
r.setFieldValue(
|
|
348
|
-
`conditions.${n.name}`,
|
|
349
|
-
void 0
|
|
350
|
-
), r.setFieldTouched(
|
|
351
|
-
`conditions.${n.name}`,
|
|
352
|
-
!1,
|
|
353
|
-
!1
|
|
354
|
-
);
|
|
355
|
-
else {
|
|
356
|
-
const E = n.valueUse === f.LIST_OF_VALUES_MULTI ? [] : "";
|
|
357
|
-
r.setFieldValue(
|
|
358
|
-
`conditions.${n.name}`,
|
|
359
|
-
E
|
|
360
|
-
);
|
|
361
|
-
}
|
|
362
|
-
},
|
|
363
|
-
children: n.valueUse === f.LIST_OF_VALUES_MULTI ? /* @__PURE__ */ a(
|
|
364
|
-
re,
|
|
365
|
-
{
|
|
366
|
-
id: n.name,
|
|
367
|
-
labelSelect: n.name,
|
|
368
|
-
labelSelected: `Selected ${n.name}`,
|
|
369
|
-
options: (N = (R = n.possibleValue) == null ? void 0 : R.list) == null ? void 0 : N.map((C) => ({
|
|
370
|
-
id: C,
|
|
371
|
-
label: C,
|
|
372
|
-
checked: (r.values.conditions[n.name] || []).includes(C)
|
|
373
|
-
})),
|
|
374
|
-
onHandleSelectCheckChange: (C) => {
|
|
375
|
-
const x = C.filter((E) => E.checked).map((E) => E.id);
|
|
376
|
-
r.setFieldValue(
|
|
377
|
-
`conditions.${n.name}`,
|
|
378
|
-
x
|
|
379
|
-
), r.setFieldTouched(
|
|
380
|
-
`conditions.${n.name}`,
|
|
381
|
-
!0,
|
|
382
|
-
!0
|
|
383
|
-
);
|
|
384
|
-
},
|
|
385
|
-
placeholderSelect: `Select ${n.name}`,
|
|
386
|
-
message: (I = r.touched.conditions) != null && I[n.name] && ((U = r.errors.conditions) != null && U[n.name]) ? r.errors.conditions[n.name] : void 0,
|
|
387
|
-
onBlur: () => r.setFieldTouched(
|
|
388
|
-
`conditions.${n.name}`,
|
|
389
|
-
!0,
|
|
390
|
-
!0
|
|
391
|
-
)
|
|
392
|
-
}
|
|
393
|
-
) : /* @__PURE__ */ a(
|
|
394
|
-
ne,
|
|
313
|
+
/* @__PURE__ */ u(
|
|
314
|
+
s,
|
|
315
|
+
{
|
|
316
|
+
justifyContent: "space-between",
|
|
317
|
+
alignItems: "center",
|
|
318
|
+
gap: "64px",
|
|
319
|
+
children: [
|
|
320
|
+
/* @__PURE__ */ r(x, { type: "title", size: "small", weight: "bold", appearance: "gray", children: n.factsThatConditionIt }),
|
|
321
|
+
/* @__PURE__ */ r(
|
|
322
|
+
B,
|
|
395
323
|
{
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
`conditions.${n.name}`,
|
|
402
|
-
C
|
|
403
|
-
),
|
|
404
|
-
messageValidate: String(
|
|
405
|
-
($ = r.errors.conditions) == null ? void 0 : $[n.name]
|
|
406
|
-
),
|
|
407
|
-
statusValidate: (M = r.touched.conditions) != null && M[n.name] ? (O = r.errors.conditions) != null && O[n.name] ? "invalid" : "valid" : void 0,
|
|
408
|
-
onBlur: r.handleBlur
|
|
324
|
+
id: "toggleNone",
|
|
325
|
+
onChange: () => l(!o.values.toggleNone),
|
|
326
|
+
checked: o.values.toggleNone,
|
|
327
|
+
size: "small",
|
|
328
|
+
children: /* @__PURE__ */ r(x, { size: "medium", type: "label", weight: "bold", children: n.none })
|
|
409
329
|
}
|
|
410
330
|
)
|
|
331
|
+
]
|
|
332
|
+
}
|
|
333
|
+
),
|
|
334
|
+
/* @__PURE__ */ r(s, { direction: "column", gap: "20px", children: (h = t.conditions) == null ? void 0 : h.map((d) => /* @__PURE__ */ r(
|
|
335
|
+
me,
|
|
336
|
+
{
|
|
337
|
+
id: `toggle-${d.name}`,
|
|
338
|
+
name: `toggle.${d.name}`,
|
|
339
|
+
labelToggle: d.name,
|
|
340
|
+
checked: !o.values.toggleNone && o.values.conditions[d.name] !== void 0,
|
|
341
|
+
handleToggleChange: (m) => {
|
|
342
|
+
if (!m.target.checked)
|
|
343
|
+
o.setFieldValue(
|
|
344
|
+
`conditions.${d.name}`,
|
|
345
|
+
void 0
|
|
346
|
+
), o.setFieldTouched(
|
|
347
|
+
`conditions.${d.name}`,
|
|
348
|
+
!1,
|
|
349
|
+
!1
|
|
350
|
+
);
|
|
351
|
+
else {
|
|
352
|
+
const f = d.valueUse === b.LIST_OF_VALUES_MULTI ? [] : "";
|
|
353
|
+
o.setFieldValue(
|
|
354
|
+
`conditions.${d.name}`,
|
|
355
|
+
f
|
|
356
|
+
);
|
|
357
|
+
}
|
|
411
358
|
},
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
359
|
+
children: $({ condition: d, formik: o })
|
|
360
|
+
},
|
|
361
|
+
d.name
|
|
362
|
+
)) })
|
|
415
363
|
]
|
|
416
364
|
}
|
|
417
365
|
) }) }),
|
|
418
|
-
/* @__PURE__ */
|
|
419
|
-
/* @__PURE__ */
|
|
420
|
-
|
|
366
|
+
/* @__PURE__ */ r(w, { dashed: !0 }),
|
|
367
|
+
/* @__PURE__ */ r(
|
|
368
|
+
he,
|
|
421
369
|
{
|
|
422
|
-
labelStart:
|
|
423
|
-
labelEnd:
|
|
424
|
-
valueStart:
|
|
425
|
-
valueEnd:
|
|
426
|
-
messageStart:
|
|
427
|
-
messageEnd:
|
|
428
|
-
statusStart:
|
|
429
|
-
statusEnd:
|
|
430
|
-
onHandleStartChange: (
|
|
431
|
-
onHandleEndChange: (
|
|
432
|
-
onCheckClosedChange: (
|
|
433
|
-
|
|
370
|
+
labelStart: n.termStart,
|
|
371
|
+
labelEnd: n.termEnd,
|
|
372
|
+
valueStart: o.values.startDate,
|
|
373
|
+
valueEnd: o.values.endDate,
|
|
374
|
+
messageStart: o.errors.startDate,
|
|
375
|
+
messageEnd: o.errors.endDate,
|
|
376
|
+
statusStart: o.touched.startDate ? o.errors.startDate ? "invalid" : "valid" : void 0,
|
|
377
|
+
statusEnd: o.touched.endDate ? o.errors.endDate ? "invalid" : "valid" : void 0,
|
|
378
|
+
onHandleStartChange: (d) => o.setFieldValue("startDate", d.target.value),
|
|
379
|
+
onHandleEndChange: (d) => o.setFieldValue("endDate", d.target.value),
|
|
380
|
+
onCheckClosedChange: (d) => {
|
|
381
|
+
o.setFieldValue("checkClosed", d), d && o.setFieldValue("endDate", "");
|
|
434
382
|
},
|
|
435
|
-
checkedClosed:
|
|
383
|
+
checkedClosed: o.values.checkClosed
|
|
436
384
|
}
|
|
437
385
|
),
|
|
438
|
-
/* @__PURE__ */
|
|
439
|
-
/* @__PURE__ */
|
|
440
|
-
/* @__PURE__ */
|
|
441
|
-
/* @__PURE__ */
|
|
386
|
+
/* @__PURE__ */ r(w, {}),
|
|
387
|
+
/* @__PURE__ */ u(s, { direction: "row", justifyContent: "end", gap: "16px", children: [
|
|
388
|
+
/* @__PURE__ */ r(z, { appearance: "gray", onClick: c, children: n.cancel }),
|
|
389
|
+
/* @__PURE__ */ r(z, { type: "submit", children: n.confirm })
|
|
442
390
|
] })
|
|
443
391
|
] }) });
|
|
444
|
-
},
|
|
392
|
+
}, H = g.div`
|
|
445
393
|
& > div {
|
|
446
394
|
border-radius: 8px;
|
|
447
|
-
border: 1px solid ${
|
|
395
|
+
border: 1px solid ${v.palette.neutral.N30};
|
|
448
396
|
}
|
|
449
|
-
`,
|
|
397
|
+
`, G = g.div`
|
|
450
398
|
width: 100%;
|
|
451
399
|
height: 100%;
|
|
452
400
|
overflow-y: auto;
|
|
@@ -464,41 +412,41 @@ const Ae = (e) => {
|
|
|
464
412
|
background-color: #ebecf0;
|
|
465
413
|
border-radius: 8px;
|
|
466
414
|
}
|
|
467
|
-
`,
|
|
415
|
+
`, ke = (e) => e.value, Se = (e) => e.value, Te = (e) => ({
|
|
468
416
|
from: e.from ?? "",
|
|
469
417
|
to: e.to ?? ""
|
|
470
|
-
}),
|
|
471
|
-
var
|
|
472
|
-
const
|
|
473
|
-
[
|
|
474
|
-
[
|
|
475
|
-
[
|
|
476
|
-
[
|
|
477
|
-
[
|
|
478
|
-
[
|
|
418
|
+
}), De = (e) => e.value, Ee = (e) => e.value, Ae = (e) => e.value;
|
|
419
|
+
var C = /* @__PURE__ */ ((e) => (e.EQUAL = "equal", e.GREATER_THAN = "greater_than", e.LESS_THAN = "less_than", e.LIST_OF_VALUES = "list_of_values", e.LIST_OF_VALUES_MULTI = "list_of_values_multi", e.RANGE = "range", e))(C || {});
|
|
420
|
+
const Ne = (e) => e.value, _e = {
|
|
421
|
+
[C.LIST_OF_VALUES]: ke,
|
|
422
|
+
[C.LIST_OF_VALUES_MULTI]: Se,
|
|
423
|
+
[C.RANGE]: Te,
|
|
424
|
+
[C.GREATER_THAN]: De,
|
|
425
|
+
[C.LESS_THAN]: Ee,
|
|
426
|
+
[C.EQUAL]: Ae
|
|
479
427
|
};
|
|
480
|
-
function
|
|
481
|
-
const t = e == null ? void 0 : e.value,
|
|
482
|
-
return
|
|
428
|
+
function D(e) {
|
|
429
|
+
const t = e == null ? void 0 : e.value, a = typeof t == "object" && t !== null && !Array.isArray(t), n = _e[e == null ? void 0 : e.valueUse] || Ne;
|
|
430
|
+
return a && n(t) || t || void 0;
|
|
483
431
|
}
|
|
484
|
-
const
|
|
485
|
-
const { decision: t, loading:
|
|
432
|
+
const Y = (e) => {
|
|
433
|
+
const { decision: t, loading: a = !1, textValues: n } = e, c = (l) => l && Object.keys(l).length > 0, o = {
|
|
486
434
|
name: (t == null ? void 0 : t.name) || "",
|
|
487
435
|
dataType: (t == null ? void 0 : t.dataType) || "alphabetical",
|
|
488
|
-
value:
|
|
436
|
+
value: D(t),
|
|
489
437
|
valueUse: (t == null ? void 0 : t.valueUse) || "equal"
|
|
490
438
|
};
|
|
491
|
-
return !
|
|
492
|
-
t && /* @__PURE__ */
|
|
493
|
-
|
|
439
|
+
return !a && t && n ? /* @__PURE__ */ u(s, { direction: "column", gap: "12px", children: [
|
|
440
|
+
t && /* @__PURE__ */ r(s, { direction: "column", alignItems: "center", children: /* @__PURE__ */ r(
|
|
441
|
+
N,
|
|
494
442
|
{
|
|
495
|
-
element:
|
|
496
|
-
valueData:
|
|
443
|
+
element: o,
|
|
444
|
+
valueData: D(o),
|
|
497
445
|
type: "decision"
|
|
498
446
|
}
|
|
499
447
|
) }, t.name),
|
|
500
|
-
/* @__PURE__ */
|
|
501
|
-
/* @__PURE__ */
|
|
448
|
+
/* @__PURE__ */ r(w, { dashed: !0 }),
|
|
449
|
+
/* @__PURE__ */ r(G, { children: /* @__PURE__ */ u(
|
|
502
450
|
s,
|
|
503
451
|
{
|
|
504
452
|
direction: "column",
|
|
@@ -506,95 +454,95 @@ const ee = (e) => {
|
|
|
506
454
|
justifyContent: "space-between",
|
|
507
455
|
height: "203px",
|
|
508
456
|
children: [
|
|
509
|
-
/* @__PURE__ */
|
|
510
|
-
|
|
457
|
+
/* @__PURE__ */ r(
|
|
458
|
+
x,
|
|
511
459
|
{
|
|
512
460
|
type: "label",
|
|
513
461
|
size: "large",
|
|
514
462
|
appearance: "dark",
|
|
515
463
|
weight: "bold",
|
|
516
464
|
textAlign: "center",
|
|
517
|
-
children:
|
|
465
|
+
children: n.factsThatConditionIt
|
|
518
466
|
}
|
|
519
467
|
),
|
|
520
|
-
t.conditions && t.conditions.map((
|
|
521
|
-
if (
|
|
522
|
-
const
|
|
523
|
-
return (typeof
|
|
524
|
-
|
|
468
|
+
t.conditions && t.conditions.map((l) => {
|
|
469
|
+
if (l.hidden) return null;
|
|
470
|
+
const i = l.value;
|
|
471
|
+
return (typeof i == "object" && c(i) || i !== void 0 && typeof i == "string" && i.length > 0) && /* @__PURE__ */ r(H, { children: /* @__PURE__ */ r(s, { direction: "column", padding: "8px", children: /* @__PURE__ */ r(
|
|
472
|
+
N,
|
|
525
473
|
{
|
|
526
474
|
element: {
|
|
527
|
-
...
|
|
528
|
-
value:
|
|
475
|
+
...l,
|
|
476
|
+
value: i
|
|
529
477
|
},
|
|
530
|
-
valueData:
|
|
478
|
+
valueData: D(l)
|
|
531
479
|
}
|
|
532
|
-
) }) },
|
|
480
|
+
) }) }, l.name);
|
|
533
481
|
}),
|
|
534
|
-
/* @__PURE__ */
|
|
535
|
-
/* @__PURE__ */
|
|
536
|
-
(t == null ? void 0 : t.startDate) && (t == null ? void 0 : t.endDate) && /* @__PURE__ */
|
|
537
|
-
|
|
482
|
+
/* @__PURE__ */ r(w, { dashed: !0 }),
|
|
483
|
+
/* @__PURE__ */ u(s, { direction: "column", gap: "12px", children: [
|
|
484
|
+
(t == null ? void 0 : t.startDate) && (t == null ? void 0 : t.endDate) && /* @__PURE__ */ r(
|
|
485
|
+
N,
|
|
538
486
|
{
|
|
539
487
|
element: {
|
|
540
|
-
name:
|
|
488
|
+
name: n.terms,
|
|
541
489
|
value: String(t.startDate),
|
|
542
|
-
valueUse:
|
|
543
|
-
dataType:
|
|
490
|
+
valueUse: b.RANGE,
|
|
491
|
+
dataType: k.DATE
|
|
544
492
|
},
|
|
545
|
-
valueData:
|
|
546
|
-
name:
|
|
493
|
+
valueData: D({
|
|
494
|
+
name: n.terms,
|
|
547
495
|
value: {
|
|
548
496
|
from: String(t.startDate),
|
|
549
497
|
to: String(t.endDate)
|
|
550
498
|
},
|
|
551
|
-
valueUse:
|
|
552
|
-
dataType:
|
|
499
|
+
valueUse: b.RANGE,
|
|
500
|
+
dataType: k.DATE
|
|
553
501
|
}),
|
|
554
502
|
type: "decision"
|
|
555
503
|
},
|
|
556
|
-
|
|
504
|
+
n.terms
|
|
557
505
|
),
|
|
558
|
-
(t == null ? void 0 : t.startDate) && !(t != null && t.endDate) && /* @__PURE__ */
|
|
559
|
-
|
|
506
|
+
(t == null ? void 0 : t.startDate) && !(t != null && t.endDate) && /* @__PURE__ */ r(
|
|
507
|
+
N,
|
|
560
508
|
{
|
|
561
509
|
element: {
|
|
562
|
-
name:
|
|
510
|
+
name: n.terms,
|
|
563
511
|
value: String(t.startDate),
|
|
564
|
-
valueUse:
|
|
565
|
-
dataType:
|
|
512
|
+
valueUse: b.EQUAL,
|
|
513
|
+
dataType: k.DATE
|
|
566
514
|
},
|
|
567
|
-
valueData:
|
|
568
|
-
name:
|
|
515
|
+
valueData: D({
|
|
516
|
+
name: n.terms,
|
|
569
517
|
value: String(t.startDate),
|
|
570
|
-
valueUse:
|
|
571
|
-
dataType:
|
|
518
|
+
valueUse: b.EQUAL,
|
|
519
|
+
dataType: k.DATE
|
|
572
520
|
}),
|
|
573
521
|
type: "decision"
|
|
574
522
|
},
|
|
575
|
-
|
|
523
|
+
n.terms
|
|
576
524
|
)
|
|
577
525
|
] })
|
|
578
526
|
]
|
|
579
527
|
}
|
|
580
528
|
) })
|
|
581
|
-
] }) : /* @__PURE__ */
|
|
582
|
-
/* @__PURE__ */
|
|
583
|
-
/* @__PURE__ */
|
|
584
|
-
/* @__PURE__ */
|
|
529
|
+
] }) : /* @__PURE__ */ u(s, { direction: "column", gap: "12px", children: [
|
|
530
|
+
/* @__PURE__ */ u(s, { direction: "column", alignItems: "center", gap: "4px", children: [
|
|
531
|
+
/* @__PURE__ */ r(T, { animated: !0, width: "180px" }),
|
|
532
|
+
/* @__PURE__ */ r(T, { animated: !0, width: "85px" })
|
|
585
533
|
] }, "loading"),
|
|
586
|
-
/* @__PURE__ */
|
|
587
|
-
/* @__PURE__ */
|
|
588
|
-
/* @__PURE__ */
|
|
534
|
+
/* @__PURE__ */ u(s, { direction: "column", gap: "12px", alignItems: "center", children: [
|
|
535
|
+
/* @__PURE__ */ r(w, { dashed: !0 }),
|
|
536
|
+
/* @__PURE__ */ r(T, { animated: !0, width: "150px" })
|
|
589
537
|
] }),
|
|
590
|
-
/* @__PURE__ */
|
|
538
|
+
/* @__PURE__ */ r(G, { children: /* @__PURE__ */ r(
|
|
591
539
|
s,
|
|
592
540
|
{
|
|
593
541
|
direction: "column",
|
|
594
542
|
gap: "12px",
|
|
595
543
|
justifyContent: "space-between",
|
|
596
544
|
height: "203px",
|
|
597
|
-
children: Array.from({ length: 5 }).map((
|
|
545
|
+
children: Array.from({ length: 5 }).map((l, i) => /* @__PURE__ */ r(H, { children: /* @__PURE__ */ u(
|
|
598
546
|
s,
|
|
599
547
|
{
|
|
600
548
|
direction: "column",
|
|
@@ -602,17 +550,17 @@ const ee = (e) => {
|
|
|
602
550
|
alignItems: "start",
|
|
603
551
|
padding: "8px",
|
|
604
552
|
children: [
|
|
605
|
-
/* @__PURE__ */
|
|
606
|
-
/* @__PURE__ */
|
|
553
|
+
/* @__PURE__ */ r(T, { animated: !0, width: "180px" }),
|
|
554
|
+
/* @__PURE__ */ r(T, { animated: !0, width: "85px" })
|
|
607
555
|
]
|
|
608
556
|
}
|
|
609
|
-
) }, `condition-${
|
|
557
|
+
) }, `condition-${i}`))
|
|
610
558
|
}
|
|
611
559
|
) })
|
|
612
560
|
] });
|
|
613
|
-
},
|
|
561
|
+
}, Le = g.div`
|
|
614
562
|
border-radius: 8px;
|
|
615
|
-
border: 1px solid ${
|
|
563
|
+
border: 1px solid ${v.palette.neutral.N30};
|
|
616
564
|
box-sizing: border-box;
|
|
617
565
|
display: flex;
|
|
618
566
|
flex-direction: column;
|
|
@@ -622,7 +570,7 @@ const ee = (e) => {
|
|
|
622
570
|
height: 100%;
|
|
623
571
|
box-shadow: 0px 4px 8px 3px rgba(0, 0, 0, 0.1);
|
|
624
572
|
`;
|
|
625
|
-
|
|
573
|
+
g.div`
|
|
626
574
|
width: 100%;
|
|
627
575
|
height: 100%;
|
|
628
576
|
overflow-y: auto;
|
|
@@ -641,35 +589,35 @@ b.div`
|
|
|
641
589
|
border-radius: 8px;
|
|
642
590
|
}
|
|
643
591
|
`;
|
|
644
|
-
const
|
|
645
|
-
const { children: t, controls:
|
|
646
|
-
return /* @__PURE__ */
|
|
592
|
+
const F = (e) => {
|
|
593
|
+
const { children: t, controls: a = !0, handleDelete: n, id: c } = e;
|
|
594
|
+
return /* @__PURE__ */ r(Le, { children: /* @__PURE__ */ u(s, { direction: "column", gap: "16px", padding: "12px 16px", children: [
|
|
647
595
|
t,
|
|
648
|
-
|
|
649
|
-
/* @__PURE__ */
|
|
650
|
-
/* @__PURE__ */
|
|
651
|
-
|
|
596
|
+
a && /* @__PURE__ */ u(E, { children: [
|
|
597
|
+
/* @__PURE__ */ r(w, {}),
|
|
598
|
+
/* @__PURE__ */ r(s, { gap: "16px", justifyContent: "end", children: /* @__PURE__ */ r(
|
|
599
|
+
Q,
|
|
652
600
|
{
|
|
653
601
|
cursorHover: !0,
|
|
654
602
|
appearance: "dark",
|
|
655
603
|
size: "24px",
|
|
656
|
-
icon: /* @__PURE__ */
|
|
604
|
+
icon: /* @__PURE__ */ r(oe, {}),
|
|
657
605
|
onClick: () => {
|
|
658
|
-
|
|
606
|
+
n(c);
|
|
659
607
|
}
|
|
660
608
|
}
|
|
661
609
|
) })
|
|
662
610
|
] })
|
|
663
611
|
] }) });
|
|
664
|
-
},
|
|
612
|
+
}, Ve = g.div`
|
|
665
613
|
position: relative;
|
|
666
614
|
& > div {
|
|
667
615
|
padding: 24px 16px;
|
|
668
616
|
}
|
|
669
|
-
`,
|
|
617
|
+
`, Re = g.div`
|
|
670
618
|
background-color: ${({ theme: e }) => {
|
|
671
|
-
var t,
|
|
672
|
-
return ((
|
|
619
|
+
var t, a;
|
|
620
|
+
return ((a = (t = e == null ? void 0 : e.palette) == null ? void 0 : t.neutral) == null ? void 0 : a.N0) || v.palette.neutral.N0;
|
|
673
621
|
}};
|
|
674
622
|
max-width: 450px;
|
|
675
623
|
max-height: 90vh;
|
|
@@ -697,23 +645,23 @@ const G = (e) => {
|
|
|
697
645
|
background-color: #ebecf0;
|
|
698
646
|
border-radius: 8px;
|
|
699
647
|
}
|
|
700
|
-
`,
|
|
701
|
-
const { children: t, portalId:
|
|
702
|
-
if (!
|
|
648
|
+
`, Ue = (e) => {
|
|
649
|
+
const { children: t, portalId: a, onCloseModal: n, title: c } = e, o = document.getElementById(a);
|
|
650
|
+
if (!o)
|
|
703
651
|
throw new Error(
|
|
704
652
|
"The portal node is not defined. This can occur when the specific node used to render the portal has not been defined correctly."
|
|
705
653
|
);
|
|
706
|
-
return
|
|
707
|
-
/* @__PURE__ */
|
|
708
|
-
/* @__PURE__ */
|
|
709
|
-
/* @__PURE__ */
|
|
710
|
-
/* @__PURE__ */
|
|
654
|
+
return le(
|
|
655
|
+
/* @__PURE__ */ r(Ve, { children: /* @__PURE__ */ r(se, { children: /* @__PURE__ */ r(Re, { children: /* @__PURE__ */ u(s, { direction: "column", gap: "24px", children: [
|
|
656
|
+
/* @__PURE__ */ r(s, { direction: "column", gap: "24px", children: /* @__PURE__ */ u(s, { alignItems: "center", justifyContent: "space-between", children: [
|
|
657
|
+
/* @__PURE__ */ r(x, { type: "title", size: "large", appearance: "dark", weight: "bold", children: c }),
|
|
658
|
+
/* @__PURE__ */ r(ie, { size: "24px", cursor: "pointer", onClick: n })
|
|
711
659
|
] }) }),
|
|
712
660
|
t
|
|
713
661
|
] }) }) }) }),
|
|
714
|
-
|
|
662
|
+
o
|
|
715
663
|
);
|
|
716
|
-
},
|
|
664
|
+
}, Ie = ae`
|
|
717
665
|
from {
|
|
718
666
|
opacity: 0;
|
|
719
667
|
transform: translateY(20px);
|
|
@@ -722,16 +670,16 @@ const G = (e) => {
|
|
|
722
670
|
opacity: 1;
|
|
723
671
|
transform: translateY(0);
|
|
724
672
|
}
|
|
725
|
-
`,
|
|
673
|
+
`, W = g.div`
|
|
726
674
|
width: 100%;
|
|
727
675
|
height: 100%;
|
|
728
676
|
& > div {
|
|
729
|
-
animation: ${
|
|
677
|
+
animation: ${Ie} 600ms ease-out;
|
|
730
678
|
}
|
|
731
679
|
`;
|
|
732
|
-
|
|
680
|
+
g.div`
|
|
733
681
|
border-radius: 8px;
|
|
734
|
-
border: 1px solid ${
|
|
682
|
+
border: 1px solid ${v.palette.neutral.N30};
|
|
735
683
|
box-sizing: border-box;
|
|
736
684
|
display: flex;
|
|
737
685
|
flex-direction: column;
|
|
@@ -741,7 +689,7 @@ b.div`
|
|
|
741
689
|
height: 100%;
|
|
742
690
|
box-shadow: 0px 4px 8px 3px rgba(0, 0, 0, 0.1);
|
|
743
691
|
`;
|
|
744
|
-
const
|
|
692
|
+
const Fe = g.div`
|
|
745
693
|
& > div {
|
|
746
694
|
width: 100%;
|
|
747
695
|
height: 100%;
|
|
@@ -761,16 +709,16 @@ const je = b.div`
|
|
|
761
709
|
border-radius: 8px;
|
|
762
710
|
}
|
|
763
711
|
}
|
|
764
|
-
`,
|
|
712
|
+
`, $e = g.div`
|
|
765
713
|
& > div > div {
|
|
766
714
|
border-radius: 8px;
|
|
767
|
-
border: 1px solid ${
|
|
715
|
+
border: 1px solid ${v.palette.neutral.N30};
|
|
768
716
|
box-sizing: border-box;
|
|
769
717
|
box-shadow: 0px 4px 8px 3px rgba(0, 0, 0, 0.1);
|
|
770
718
|
}
|
|
771
|
-
`,
|
|
719
|
+
`, ze = g.div`
|
|
772
720
|
& > div {
|
|
773
|
-
background-color: ${
|
|
721
|
+
background-color: ${v.palette.neutral.N30};
|
|
774
722
|
justify-content: center;
|
|
775
723
|
}
|
|
776
724
|
min-height: 300px;
|
|
@@ -778,139 +726,139 @@ const je = b.div`
|
|
|
778
726
|
height: 100%;
|
|
779
727
|
padding-bottom: 12px;
|
|
780
728
|
`;
|
|
781
|
-
|
|
729
|
+
g.div`
|
|
782
730
|
& > div {
|
|
783
731
|
border-radius: 8px;
|
|
784
|
-
border: 1px solid ${
|
|
732
|
+
border: 1px solid ${v.palette.neutral.N30};
|
|
785
733
|
}
|
|
786
734
|
`;
|
|
787
|
-
function
|
|
735
|
+
function qe({
|
|
788
736
|
index: e,
|
|
789
737
|
handleOpenModal: t
|
|
790
738
|
}) {
|
|
791
|
-
return /* @__PURE__ */
|
|
792
|
-
|
|
739
|
+
return /* @__PURE__ */ r(
|
|
740
|
+
F,
|
|
793
741
|
{
|
|
794
742
|
id: `loading-card-${e}`,
|
|
795
743
|
handleDelete: () => {
|
|
796
744
|
},
|
|
797
745
|
handleView: () => t(),
|
|
798
746
|
controls: !1,
|
|
799
|
-
children: /* @__PURE__ */
|
|
747
|
+
children: /* @__PURE__ */ r(Y, { loading: !0 })
|
|
800
748
|
},
|
|
801
749
|
`loading-card-${e}`
|
|
802
750
|
);
|
|
803
751
|
}
|
|
804
|
-
function
|
|
752
|
+
function Oe({
|
|
805
753
|
decision: e,
|
|
806
754
|
controls: t,
|
|
807
|
-
handleOpenModal:
|
|
808
|
-
handleDelete:
|
|
809
|
-
textValues:
|
|
755
|
+
handleOpenModal: a,
|
|
756
|
+
handleDelete: n,
|
|
757
|
+
textValues: c
|
|
810
758
|
}) {
|
|
811
|
-
return e ? /* @__PURE__ */
|
|
812
|
-
/* @__PURE__ */
|
|
813
|
-
/* @__PURE__ */
|
|
814
|
-
|
|
759
|
+
return e ? /* @__PURE__ */ r(W, { children: /* @__PURE__ */ u(s, { direction: "column", gap: "4px", width: "100%", padding: "0 0 12px 0", children: [
|
|
760
|
+
/* @__PURE__ */ r(x, { type: "title", size: "medium", appearance: "gray", weight: "bold", children: e.id }),
|
|
761
|
+
/* @__PURE__ */ r(
|
|
762
|
+
F,
|
|
815
763
|
{
|
|
816
764
|
id: e.id,
|
|
817
|
-
handleDelete: () =>
|
|
818
|
-
handleView: () =>
|
|
765
|
+
handleDelete: () => n(e.id),
|
|
766
|
+
handleView: () => a(e),
|
|
819
767
|
controls: t,
|
|
820
|
-
children: /* @__PURE__ */
|
|
768
|
+
children: /* @__PURE__ */ r(Y, { decision: e, textValues: c })
|
|
821
769
|
}
|
|
822
770
|
)
|
|
823
771
|
] }) }, e.id) : null;
|
|
824
772
|
}
|
|
825
|
-
function
|
|
773
|
+
function je({
|
|
826
774
|
index: e,
|
|
827
775
|
handleOpenModal: t
|
|
828
776
|
}) {
|
|
829
|
-
return /* @__PURE__ */
|
|
830
|
-
/* @__PURE__ */
|
|
831
|
-
/* @__PURE__ */
|
|
832
|
-
|
|
777
|
+
return /* @__PURE__ */ r(W, { children: /* @__PURE__ */ u(s, { direction: "column", gap: "4px", width: "100%", height: "100%", children: [
|
|
778
|
+
/* @__PURE__ */ r(x, { type: "title", size: "medium", appearance: "gray", weight: "bold", children: "Nueva decisión" }),
|
|
779
|
+
/* @__PURE__ */ r(ze, { onClick: () => t(), children: /* @__PURE__ */ r(
|
|
780
|
+
F,
|
|
833
781
|
{
|
|
834
782
|
id: `add-decision-${e}`,
|
|
835
783
|
handleDelete: () => {
|
|
836
784
|
},
|
|
837
785
|
handleView: () => t(),
|
|
838
786
|
controls: !1,
|
|
839
|
-
children: /* @__PURE__ */
|
|
840
|
-
/* @__PURE__ */
|
|
841
|
-
/* @__PURE__ */
|
|
787
|
+
children: /* @__PURE__ */ u(s, { direction: "column", gap: "12px", alignItems: "center", children: [
|
|
788
|
+
/* @__PURE__ */ r(Q, { appearance: "gray", icon: /* @__PURE__ */ r(de, {}), size: "35px" }),
|
|
789
|
+
/* @__PURE__ */ r(x, { appearance: "gray", type: "body", size: "large", children: "Agregar decisión" })
|
|
842
790
|
] })
|
|
843
791
|
}
|
|
844
792
|
) })
|
|
845
793
|
] }) }, `add-decision-${e}`);
|
|
846
794
|
}
|
|
847
|
-
const
|
|
848
|
-
loading:
|
|
849
|
-
decision:
|
|
850
|
-
add:
|
|
795
|
+
const Me = {
|
|
796
|
+
loading: qe,
|
|
797
|
+
decision: Oe,
|
|
798
|
+
add: je
|
|
851
799
|
};
|
|
852
|
-
function
|
|
853
|
-
const { type: t } = e,
|
|
854
|
-
return
|
|
800
|
+
function U(e) {
|
|
801
|
+
const { type: t } = e, a = Me[t];
|
|
802
|
+
return a ? a(e) : null;
|
|
855
803
|
}
|
|
856
|
-
function
|
|
804
|
+
function He({
|
|
857
805
|
controls: e,
|
|
858
806
|
decisions: t,
|
|
859
|
-
loading:
|
|
860
|
-
handleOpenModal:
|
|
861
|
-
handleDelete:
|
|
862
|
-
textValues:
|
|
807
|
+
loading: a,
|
|
808
|
+
handleOpenModal: n,
|
|
809
|
+
handleDelete: c,
|
|
810
|
+
textValues: o
|
|
863
811
|
}) {
|
|
864
|
-
const
|
|
865
|
-
(
|
|
812
|
+
const l = a ? Array.from({ length: 3 }).map(
|
|
813
|
+
(h, d) => U({
|
|
866
814
|
type: "loading",
|
|
867
|
-
index:
|
|
815
|
+
index: d,
|
|
868
816
|
controls: e,
|
|
869
|
-
loading:
|
|
870
|
-
handleOpenModal:
|
|
871
|
-
handleDelete:
|
|
872
|
-
textValues:
|
|
817
|
+
loading: a,
|
|
818
|
+
handleOpenModal: n,
|
|
819
|
+
handleDelete: c,
|
|
820
|
+
textValues: o
|
|
873
821
|
})
|
|
874
822
|
) : t.map(
|
|
875
|
-
(
|
|
823
|
+
(h) => U({
|
|
876
824
|
type: "decision",
|
|
877
|
-
decision:
|
|
825
|
+
decision: h,
|
|
878
826
|
controls: e,
|
|
879
|
-
loading:
|
|
880
|
-
handleOpenModal:
|
|
881
|
-
handleDelete:
|
|
882
|
-
textValues:
|
|
827
|
+
loading: a,
|
|
828
|
+
handleOpenModal: n,
|
|
829
|
+
handleDelete: c,
|
|
830
|
+
textValues: o
|
|
883
831
|
})
|
|
884
|
-
),
|
|
885
|
-
return { renderedCards:
|
|
832
|
+
), i = (t.length === 0 || t.length < Math.floor(window.innerWidth / 300)) && !a && e;
|
|
833
|
+
return { renderedCards: l, shouldRenderAddCard: i };
|
|
886
834
|
}
|
|
887
|
-
const
|
|
835
|
+
const mt = (e) => {
|
|
888
836
|
const {
|
|
889
837
|
controls: t = !0,
|
|
890
|
-
decisions:
|
|
891
|
-
textValues:
|
|
892
|
-
decisionTemplate:
|
|
893
|
-
isModalOpen:
|
|
894
|
-
selectedDecision:
|
|
895
|
-
loading:
|
|
896
|
-
handleOpenModal:
|
|
897
|
-
handleCloseModal:
|
|
838
|
+
decisions: a,
|
|
839
|
+
textValues: n,
|
|
840
|
+
decisionTemplate: c,
|
|
841
|
+
isModalOpen: o,
|
|
842
|
+
selectedDecision: l,
|
|
843
|
+
loading: i,
|
|
844
|
+
handleOpenModal: h,
|
|
845
|
+
handleCloseModal: d,
|
|
898
846
|
handleSubmitForm: m,
|
|
899
|
-
handleDelete:
|
|
900
|
-
} = e,
|
|
847
|
+
handleDelete: p
|
|
848
|
+
} = e, f = ue("(max-width: 681px)"), { renderedCards: S, shouldRenderAddCard: A } = He({
|
|
901
849
|
controls: t,
|
|
902
|
-
decisions:
|
|
903
|
-
loading:
|
|
904
|
-
handleOpenModal:
|
|
905
|
-
handleDelete:
|
|
906
|
-
textValues:
|
|
850
|
+
decisions: a,
|
|
851
|
+
loading: i,
|
|
852
|
+
handleOpenModal: h,
|
|
853
|
+
handleDelete: p,
|
|
854
|
+
textValues: n
|
|
907
855
|
});
|
|
908
|
-
return /* @__PURE__ */
|
|
909
|
-
/* @__PURE__ */
|
|
910
|
-
|
|
856
|
+
return /* @__PURE__ */ u(E, { children: [
|
|
857
|
+
/* @__PURE__ */ r($e, { children: /* @__PURE__ */ r(Fe, { children: /* @__PURE__ */ u(s, { direction: "column", gap: "16px", padding: "6px", children: [
|
|
858
|
+
a.length === 0 && !i && /* @__PURE__ */ u(x, { as: "span", type: "label", size: "large", appearance: "gray", children: [
|
|
911
859
|
"Aún no tienes definidas tasas de interés efectivas. Presiona",
|
|
912
|
-
/* @__PURE__ */
|
|
913
|
-
|
|
860
|
+
/* @__PURE__ */ r(
|
|
861
|
+
x,
|
|
914
862
|
{
|
|
915
863
|
as: "span",
|
|
916
864
|
type: "label",
|
|
@@ -922,8 +870,8 @@ const vt = (e) => {
|
|
|
922
870
|
),
|
|
923
871
|
"para empezar."
|
|
924
872
|
] }),
|
|
925
|
-
/* @__PURE__ */
|
|
926
|
-
|
|
873
|
+
/* @__PURE__ */ u(
|
|
874
|
+
ce,
|
|
927
875
|
{
|
|
928
876
|
templateColumns: "repeat(auto-fill, minmax(300px, 1fr))",
|
|
929
877
|
autoFlow: "row dense",
|
|
@@ -933,35 +881,35 @@ const vt = (e) => {
|
|
|
933
881
|
autoRows: "1fr",
|
|
934
882
|
justifyItems: "center",
|
|
935
883
|
padding: "6px",
|
|
936
|
-
height:
|
|
884
|
+
height: f ? "auto" : "484px",
|
|
937
885
|
children: [
|
|
938
|
-
|
|
939
|
-
|
|
886
|
+
S,
|
|
887
|
+
A && U({
|
|
940
888
|
type: "add",
|
|
941
|
-
index:
|
|
889
|
+
index: a.length,
|
|
942
890
|
controls: t,
|
|
943
|
-
loading:
|
|
944
|
-
handleOpenModal:
|
|
945
|
-
handleDelete:
|
|
946
|
-
textValues:
|
|
891
|
+
loading: i,
|
|
892
|
+
handleOpenModal: h,
|
|
893
|
+
handleDelete: p,
|
|
894
|
+
textValues: n
|
|
947
895
|
})
|
|
948
896
|
]
|
|
949
897
|
}
|
|
950
898
|
)
|
|
951
899
|
] }) }) }),
|
|
952
|
-
|
|
953
|
-
|
|
900
|
+
o && /* @__PURE__ */ r(
|
|
901
|
+
Ue,
|
|
954
902
|
{
|
|
955
903
|
portalId: "modal-portal",
|
|
956
|
-
onCloseModal:
|
|
957
|
-
title:
|
|
958
|
-
children: /* @__PURE__ */
|
|
959
|
-
|
|
904
|
+
onCloseModal: d,
|
|
905
|
+
title: l ? "Editar Decisión" : "Nueva decisión",
|
|
906
|
+
children: /* @__PURE__ */ r(
|
|
907
|
+
we,
|
|
960
908
|
{
|
|
961
|
-
decision:
|
|
909
|
+
decision: l || c,
|
|
962
910
|
onSubmitEvent: m,
|
|
963
|
-
textValues:
|
|
964
|
-
onCancel: () =>
|
|
911
|
+
textValues: n,
|
|
912
|
+
onCancel: () => d()
|
|
965
913
|
}
|
|
966
914
|
)
|
|
967
915
|
}
|
|
@@ -969,9 +917,9 @@ const vt = (e) => {
|
|
|
969
917
|
] });
|
|
970
918
|
};
|
|
971
919
|
export {
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
920
|
+
F as BusinessRuleCard,
|
|
921
|
+
Y as BusinessRuleView,
|
|
922
|
+
mt as BusinessRules,
|
|
923
|
+
Ue as ModalRules,
|
|
924
|
+
we as RulesForm
|
|
977
925
|
};
|