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