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