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