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