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