@isettingkit/business-rules 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +127 -125
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as a, jsxs as u, Fragment as E } from "react/jsx-runtime";
|
|
2
2
|
import { MdOutlineDelete as he, MdClear as Z, MdAdd as ee, MdOutlineFilterAltOff as ue, MdOutlineFilterAlt as pe } from "react-icons/md";
|
|
3
|
-
import { inube as v, Stack as h, Divider as D, Icon as O, Text as y, SkeletonLine as
|
|
3
|
+
import { inube as v, Stack as h, Divider as D, Icon as O, Text as y, SkeletonLine as F, useMediaQuery as I, Blanket as te, Button as N, Grid as ne, Box as ge, Tag as me, Checkpicker as be, Toggle as ie, Checkbox as Te, Date as G } from "@inubekit/inubekit";
|
|
4
4
|
import f, { keyframes as fe } from "styled-components";
|
|
5
5
|
import { ValueDataType as k, ValueHowToSetUp as L, DecisionConditionRender as Q } from "@isettingkit/input";
|
|
6
6
|
import { DecisionViewConditionRenderer as _ } from "@isettingkit/view";
|
|
@@ -91,7 +91,7 @@ const H = (t) => {
|
|
|
91
91
|
to: t.to ?? ""
|
|
92
92
|
}), Ee = (t) => t.value, Ne = (t) => t.value, ke = (t) => t.value;
|
|
93
93
|
var x = /* @__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))(x || {});
|
|
94
|
-
const
|
|
94
|
+
const Ae = {
|
|
95
95
|
[x.LIST_OF_VALUES]: we,
|
|
96
96
|
[x.LIST_OF_VALUES_MULTI]: Se,
|
|
97
97
|
[x.RANGE]: De,
|
|
@@ -99,20 +99,21 @@ const Fe = {
|
|
|
99
99
|
[x.LESS_THAN]: Ne,
|
|
100
100
|
[x.EQUAL]: ke
|
|
101
101
|
}, $ = (t) => {
|
|
102
|
-
const e = t == null ? void 0 : t.value, n = typeof e == "object" && e !== null && !Array.isArray(e), i =
|
|
102
|
+
const e = t == null ? void 0 : t.value, n = typeof e == "object" && e !== null && !Array.isArray(e), i = Ae[t == null ? void 0 : t.howToSetTheDecision] || Ce;
|
|
103
103
|
return n && i(e) || e || void 0;
|
|
104
|
-
},
|
|
104
|
+
}, Fe = (t) => {
|
|
105
105
|
const {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
conditionsAlignment: e,
|
|
107
|
+
decision: n,
|
|
108
|
+
decisionDateElement: i,
|
|
109
109
|
decisionMapper: o,
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
110
|
+
loading: r,
|
|
111
|
+
skeleton: p,
|
|
112
|
+
terms: g,
|
|
113
|
+
textValues: d,
|
|
114
|
+
visibleConditions: c
|
|
114
115
|
} = t;
|
|
115
|
-
return
|
|
116
|
+
return r ? /* @__PURE__ */ u(h, { direction: "column", gap: "12px", children: [
|
|
116
117
|
/* @__PURE__ */ a(h, { direction: "column", alignItems: "center", children: /* @__PURE__ */ a(
|
|
117
118
|
_,
|
|
118
119
|
{
|
|
@@ -122,14 +123,14 @@ const Fe = {
|
|
|
122
123
|
),
|
|
123
124
|
type: "decision"
|
|
124
125
|
}
|
|
125
|
-
) },
|
|
126
|
+
) }, n.ruleName),
|
|
126
127
|
/* @__PURE__ */ a(D, { dashed: !0 }),
|
|
127
128
|
/* @__PURE__ */ a(K, { children: /* @__PURE__ */ u(
|
|
128
129
|
h,
|
|
129
130
|
{
|
|
130
131
|
direction: "column",
|
|
131
132
|
gap: "12px",
|
|
132
|
-
justifyContent:
|
|
133
|
+
justifyContent: e,
|
|
133
134
|
height: "203px",
|
|
134
135
|
children: [
|
|
135
136
|
/* @__PURE__ */ a(
|
|
@@ -140,28 +141,28 @@ const Fe = {
|
|
|
140
141
|
appearance: "dark",
|
|
141
142
|
weight: "bold",
|
|
142
143
|
textAlign: "center",
|
|
143
|
-
children:
|
|
144
|
+
children: d.factsThatConditionIt
|
|
144
145
|
}
|
|
145
146
|
),
|
|
146
|
-
|
|
147
|
+
c.map((s) => /* @__PURE__ */ a(J, { children: /* @__PURE__ */ a(h, { direction: "column", padding: "8px", children: /* @__PURE__ */ a(
|
|
147
148
|
_,
|
|
148
149
|
{
|
|
149
|
-
element: { ...
|
|
150
|
+
element: { ...s, value: s.value },
|
|
150
151
|
valueData: $(
|
|
151
|
-
|
|
152
|
+
s
|
|
152
153
|
)
|
|
153
154
|
}
|
|
154
|
-
) }) },
|
|
155
|
-
|
|
155
|
+
) }) }, s.conditionName)),
|
|
156
|
+
g && /* @__PURE__ */ u(E, { children: [
|
|
156
157
|
/* @__PURE__ */ a(D, { dashed: !0 }),
|
|
157
|
-
|
|
158
|
+
i && /* @__PURE__ */ a(
|
|
158
159
|
_,
|
|
159
160
|
{
|
|
160
|
-
element:
|
|
161
|
-
valueData:
|
|
161
|
+
element: i.element,
|
|
162
|
+
valueData: i.valueData,
|
|
162
163
|
type: "decision"
|
|
163
164
|
},
|
|
164
|
-
|
|
165
|
+
d.terms
|
|
165
166
|
)
|
|
166
167
|
] })
|
|
167
168
|
]
|
|
@@ -169,12 +170,12 @@ const Fe = {
|
|
|
169
170
|
) })
|
|
170
171
|
] }) : /* @__PURE__ */ u(h, { direction: "column", gap: "12px", children: [
|
|
171
172
|
/* @__PURE__ */ u(h, { direction: "column", alignItems: "center", gap: "4px", children: [
|
|
172
|
-
/* @__PURE__ */ a(
|
|
173
|
-
/* @__PURE__ */ a(
|
|
173
|
+
/* @__PURE__ */ a(F, { animated: !0, width: "180px" }),
|
|
174
|
+
/* @__PURE__ */ a(F, { animated: !0, width: "85px" })
|
|
174
175
|
] }, "loading"),
|
|
175
176
|
/* @__PURE__ */ u(h, { direction: "column", gap: "12px", alignItems: "center", children: [
|
|
176
177
|
/* @__PURE__ */ a(D, { dashed: !0 }),
|
|
177
|
-
/* @__PURE__ */ a(
|
|
178
|
+
/* @__PURE__ */ a(F, { animated: !0, width: "150px" })
|
|
178
179
|
] }),
|
|
179
180
|
/* @__PURE__ */ a(K, { children: /* @__PURE__ */ a(
|
|
180
181
|
h,
|
|
@@ -183,7 +184,7 @@ const Fe = {
|
|
|
183
184
|
gap: "12px",
|
|
184
185
|
justifyContent: "space-between",
|
|
185
186
|
height: "203px",
|
|
186
|
-
children:
|
|
187
|
+
children: p.map((s, l) => /* @__PURE__ */ a(J, { children: /* @__PURE__ */ u(
|
|
187
188
|
h,
|
|
188
189
|
{
|
|
189
190
|
direction: "column",
|
|
@@ -191,16 +192,16 @@ const Fe = {
|
|
|
191
192
|
alignItems: "start",
|
|
192
193
|
padding: "8px",
|
|
193
194
|
children: [
|
|
194
|
-
/* @__PURE__ */ a(
|
|
195
|
-
/* @__PURE__ */ a(
|
|
195
|
+
/* @__PURE__ */ a(F, { animated: !0, width: "180px" }),
|
|
196
|
+
/* @__PURE__ */ a(F, { animated: !0, width: "85px" })
|
|
196
197
|
]
|
|
197
198
|
}
|
|
198
|
-
) }, `condition-${
|
|
199
|
+
) }, `condition-${l}`))
|
|
199
200
|
}
|
|
200
201
|
) })
|
|
201
202
|
] });
|
|
202
203
|
}, re = (t) => {
|
|
203
|
-
var
|
|
204
|
+
var b;
|
|
204
205
|
const { decision: e, loading: n = !1, textValues: i } = t, o = !!(e != null && e.effectiveFrom), r = !!(e != null && e.validUntil), p = o && r ? {
|
|
205
206
|
element: {
|
|
206
207
|
labelName: i == null ? void 0 : i.terms,
|
|
@@ -235,20 +236,21 @@ const Fe = {
|
|
|
235
236
|
decisionDataType: e.decisionDataType || "alphabetical",
|
|
236
237
|
value: $(e),
|
|
237
238
|
howToSetTheDecision: e.howToSetTheDecision || "EqualTo"
|
|
238
|
-
} : null,
|
|
239
|
-
(
|
|
240
|
-
)) || [],
|
|
239
|
+
} : null, d = ((b = e == null ? void 0 : e.conditionsThatEstablishesTheDecision) == null ? void 0 : b.filter(
|
|
240
|
+
(T) => !T.hidden
|
|
241
|
+
)) || [], c = Array.from({ length: 5 }), s = !!(!n && e && i && g), l = d.length < 2 ? "start" : "space-between";
|
|
241
242
|
return /* @__PURE__ */ a(
|
|
242
|
-
|
|
243
|
+
Fe,
|
|
243
244
|
{
|
|
244
|
-
|
|
245
|
-
textValues: i,
|
|
245
|
+
conditionsAlignment: l,
|
|
246
246
|
decision: e,
|
|
247
|
-
decisionMapper: g,
|
|
248
|
-
visibleConditions: s,
|
|
249
247
|
decisionDateElement: p,
|
|
250
|
-
|
|
251
|
-
|
|
248
|
+
decisionMapper: g,
|
|
249
|
+
loading: s,
|
|
250
|
+
skeleton: c,
|
|
251
|
+
terms: !!(i != null && i.terms),
|
|
252
|
+
textValues: i,
|
|
253
|
+
visibleConditions: d
|
|
252
254
|
}
|
|
253
255
|
);
|
|
254
256
|
}, $e = f.div`
|
|
@@ -460,8 +462,8 @@ const qe = {
|
|
|
460
462
|
handleOpenModal: r,
|
|
461
463
|
handleDelete: p,
|
|
462
464
|
textValues: g
|
|
463
|
-
} = t,
|
|
464
|
-
(
|
|
465
|
+
} = t, d = o ? Array.from({ length: 3 }).map(
|
|
466
|
+
(s, l) => j({
|
|
465
467
|
type: "loading",
|
|
466
468
|
index: l,
|
|
467
469
|
controls: e,
|
|
@@ -472,9 +474,9 @@ const qe = {
|
|
|
472
474
|
textValues: g
|
|
473
475
|
})
|
|
474
476
|
) : i == null ? void 0 : i.map(
|
|
475
|
-
(
|
|
477
|
+
(s) => j({
|
|
476
478
|
type: "decision",
|
|
477
|
-
decision:
|
|
479
|
+
decision: s,
|
|
478
480
|
controls: e,
|
|
479
481
|
customTitleContentAddCard: n,
|
|
480
482
|
loading: o,
|
|
@@ -482,8 +484,8 @@ const qe = {
|
|
|
482
484
|
handleDelete: p,
|
|
483
485
|
textValues: g
|
|
484
486
|
})
|
|
485
|
-
),
|
|
486
|
-
return { renderedCards:
|
|
487
|
+
), c = ((i == null ? void 0 : i.length) === 0 || i.length < Math.floor(window.innerWidth / 300)) && !o && e;
|
|
488
|
+
return { renderedCards: d, shouldRenderAddCard: c };
|
|
487
489
|
}, gt = (t) => {
|
|
488
490
|
const {
|
|
489
491
|
controls: e = !0,
|
|
@@ -493,22 +495,22 @@ const qe = {
|
|
|
493
495
|
textValues: r,
|
|
494
496
|
decisionTemplate: p,
|
|
495
497
|
isModalOpen: g,
|
|
496
|
-
selectedDecision:
|
|
497
|
-
loading:
|
|
498
|
-
handleOpenModal:
|
|
498
|
+
selectedDecision: d,
|
|
499
|
+
loading: c,
|
|
500
|
+
handleOpenModal: s,
|
|
499
501
|
handleCloseModal: l,
|
|
500
502
|
handleSubmitForm: b,
|
|
501
503
|
handleDelete: T,
|
|
502
504
|
terms: m = !0
|
|
503
|
-
} = t, C = I("(max-width: 681px)"), w = I("(max-width: 400px)"), { renderedCards:
|
|
505
|
+
} = t, C = I("(max-width: 681px)"), w = I("(max-width: 400px)"), { renderedCards: A, shouldRenderAddCard: U } = je({
|
|
504
506
|
controls: e,
|
|
505
507
|
customTitleContentAddCard: n,
|
|
506
508
|
decisions: o,
|
|
507
|
-
loading:
|
|
508
|
-
handleOpenModal:
|
|
509
|
+
loading: c,
|
|
510
|
+
handleOpenModal: s,
|
|
509
511
|
handleDelete: T,
|
|
510
512
|
textValues: r
|
|
511
|
-
}), R = (o == null ? void 0 : o.length) === 0 && !
|
|
513
|
+
}), R = (o == null ? void 0 : o.length) === 0 && !c;
|
|
512
514
|
return /* @__PURE__ */ u(E, { children: [
|
|
513
515
|
/* @__PURE__ */ a(Ve, { children: /* @__PURE__ */ a(Oe, { children: /* @__PURE__ */ a(h, { direction: "column", gap: "16px", padding: "6px", children: R ? /* @__PURE__ */ u(
|
|
514
516
|
h,
|
|
@@ -543,7 +545,7 @@ const qe = {
|
|
|
543
545
|
N,
|
|
544
546
|
{
|
|
545
547
|
iconBefore: /* @__PURE__ */ a(ee, {}),
|
|
546
|
-
onClick: () =>
|
|
548
|
+
onClick: () => s ? s() : null,
|
|
547
549
|
children: n || "Agregar decisión"
|
|
548
550
|
}
|
|
549
551
|
)
|
|
@@ -562,15 +564,15 @@ const qe = {
|
|
|
562
564
|
padding: "6px",
|
|
563
565
|
height: C ? "auto" : "484px",
|
|
564
566
|
children: [
|
|
565
|
-
|
|
567
|
+
A,
|
|
566
568
|
U && j({
|
|
567
569
|
type: "add",
|
|
568
570
|
index: o == null ? void 0 : o.length,
|
|
569
571
|
controls: e,
|
|
570
572
|
customTitleContentAddCard: n,
|
|
571
573
|
customMessageEmptyDecisions: i,
|
|
572
|
-
loading:
|
|
573
|
-
handleOpenModal:
|
|
574
|
+
loading: c,
|
|
575
|
+
handleOpenModal: s,
|
|
574
576
|
handleDelete: T,
|
|
575
577
|
textValues: r,
|
|
576
578
|
shouldRenderEmptyMessage: R,
|
|
@@ -584,11 +586,11 @@ const qe = {
|
|
|
584
586
|
{
|
|
585
587
|
portalId: "modal-portal",
|
|
586
588
|
onCloseModal: l,
|
|
587
|
-
title:
|
|
589
|
+
title: d ? "Editar Decisión" : "Nueva decisión",
|
|
588
590
|
children: /* @__PURE__ */ a(
|
|
589
591
|
it,
|
|
590
592
|
{
|
|
591
|
-
decision:
|
|
593
|
+
decision: d || p,
|
|
592
594
|
onSubmitEvent: b,
|
|
593
595
|
textValues: r,
|
|
594
596
|
onCancel: () => l ? l() : () => {
|
|
@@ -630,9 +632,9 @@ const qe = {
|
|
|
630
632
|
alignItems: r,
|
|
631
633
|
alignContent: p,
|
|
632
634
|
height: g,
|
|
633
|
-
width:
|
|
634
|
-
gap:
|
|
635
|
-
background:
|
|
635
|
+
width: d,
|
|
636
|
+
gap: c,
|
|
637
|
+
background: s,
|
|
636
638
|
borderRadius: l,
|
|
637
639
|
border: b,
|
|
638
640
|
margin: T = "0px",
|
|
@@ -648,10 +650,10 @@ const qe = {
|
|
|
648
650
|
alignItems: r,
|
|
649
651
|
alignContent: p,
|
|
650
652
|
height: g,
|
|
651
|
-
width:
|
|
653
|
+
width: d,
|
|
652
654
|
wrap: n,
|
|
653
|
-
gap:
|
|
654
|
-
background:
|
|
655
|
+
gap: c,
|
|
656
|
+
background: s,
|
|
655
657
|
border: b,
|
|
656
658
|
margin: T,
|
|
657
659
|
padding: m,
|
|
@@ -730,17 +732,17 @@ const qe = {
|
|
|
730
732
|
onClick: r,
|
|
731
733
|
onCloseModal: p,
|
|
732
734
|
portalId: g,
|
|
733
|
-
title:
|
|
734
|
-
} = t,
|
|
735
|
-
if (!
|
|
735
|
+
title: d
|
|
736
|
+
} = t, c = I("(max-width: 768px)"), s = document.getElementById(g);
|
|
737
|
+
if (!s)
|
|
736
738
|
throw new Error(
|
|
737
739
|
"The portal node is not defined. This can occur when the specific node used to render the portal has not been defined correctly."
|
|
738
740
|
);
|
|
739
741
|
return ae(
|
|
740
|
-
/* @__PURE__ */ a(te, { children: /* @__PURE__ */ u(Pe, { $smallScreen:
|
|
742
|
+
/* @__PURE__ */ a(te, { children: /* @__PURE__ */ u(Pe, { $smallScreen: c, children: [
|
|
741
743
|
/* @__PURE__ */ u(h, { direction: "column", gap: "16px", children: [
|
|
742
744
|
/* @__PURE__ */ u(h, { alignContent: "center", justifyContent: "space-between", children: [
|
|
743
|
-
/* @__PURE__ */ a(y, { appearance: "dark", size: "small", type: "headline", children:
|
|
745
|
+
/* @__PURE__ */ a(y, { appearance: "dark", size: "small", type: "headline", children: d }),
|
|
744
746
|
/* @__PURE__ */ u(h, { alignItems: "center", children: [
|
|
745
747
|
/* @__PURE__ */ a(y, { children: "Cerrar" }),
|
|
746
748
|
/* @__PURE__ */ a(
|
|
@@ -781,7 +783,7 @@ const qe = {
|
|
|
781
783
|
)
|
|
782
784
|
] })
|
|
783
785
|
] }) }),
|
|
784
|
-
|
|
786
|
+
s
|
|
785
787
|
);
|
|
786
788
|
}, Tt = (t) => {
|
|
787
789
|
const { fields: e, onChange: n } = t;
|
|
@@ -922,9 +924,9 @@ function Ke({
|
|
|
922
924
|
o.values.value,
|
|
923
925
|
o.values.decisionDataType
|
|
924
926
|
).schema),
|
|
925
|
-
conditionsThatEstablishesTheDecision: Y((
|
|
927
|
+
conditionsThatEstablishesTheDecision: Y((d, { parent: c }) => {
|
|
926
928
|
var b;
|
|
927
|
-
if ((
|
|
929
|
+
if ((c == null ? void 0 : c.toggleNone) && Object.keys(c.conditionsThatEstablishesTheDecision || {}).length > 0) return M().shape({});
|
|
928
930
|
const l = (b = t.conditionsThatEstablishesTheDecision) == null ? void 0 : b.reduce(
|
|
929
931
|
(T, m) => {
|
|
930
932
|
if (o.values.conditionsThatEstablishesTheDecision[m.conditionName] !== void 0) {
|
|
@@ -953,52 +955,52 @@ function Ke({
|
|
|
953
955
|
"effective From date is required"
|
|
954
956
|
), r.validUntil = W().when(
|
|
955
957
|
"checkClosed",
|
|
956
|
-
(
|
|
958
|
+
(d, c, { parent: s }) => (s == null ? void 0 : s.checkClosed) ? c.required("valid Until date is required").test(
|
|
957
959
|
"is-after-startDate",
|
|
958
960
|
"valid Until date must be greater than or equal to Start date",
|
|
959
961
|
function(b) {
|
|
960
962
|
const T = this.parent.effectiveFrom;
|
|
961
963
|
return !T || !b ? !0 : new Date(b) >= new Date(T);
|
|
962
964
|
}
|
|
963
|
-
) :
|
|
965
|
+
) : c.notRequired()
|
|
964
966
|
));
|
|
965
967
|
const p = M(r);
|
|
966
968
|
return o = xe({
|
|
967
969
|
initialValues: i,
|
|
968
970
|
validationSchema: p,
|
|
969
971
|
validateOnBlur: !0,
|
|
970
|
-
onSubmit: (
|
|
971
|
-
var
|
|
972
|
-
const
|
|
972
|
+
onSubmit: (d) => {
|
|
973
|
+
var s;
|
|
974
|
+
const c = {
|
|
973
975
|
...t,
|
|
974
|
-
ruleName:
|
|
975
|
-
decisionDataType:
|
|
976
|
-
howToSetTheDecision:
|
|
977
|
-
value:
|
|
978
|
-
effectiveFrom:
|
|
979
|
-
validUntil:
|
|
980
|
-
conditionsThatEstablishesTheDecision: (
|
|
981
|
-
const b =
|
|
976
|
+
ruleName: d.ruleName,
|
|
977
|
+
decisionDataType: d.decisionDataType,
|
|
978
|
+
howToSetTheDecision: d.howToSetTheDecision,
|
|
979
|
+
value: d.value,
|
|
980
|
+
effectiveFrom: d.effectiveFrom,
|
|
981
|
+
validUntil: d.validUntil,
|
|
982
|
+
conditionsThatEstablishesTheDecision: (s = t.conditionsThatEstablishesTheDecision) == null ? void 0 : s.filter((l) => {
|
|
983
|
+
const b = d.conditionsThatEstablishesTheDecision[l.conditionName];
|
|
982
984
|
return b != null && b !== "";
|
|
983
985
|
}).map((l) => ({
|
|
984
986
|
...l,
|
|
985
|
-
value:
|
|
987
|
+
value: d.conditionsThatEstablishesTheDecision[l.conditionName]
|
|
986
988
|
}))
|
|
987
989
|
};
|
|
988
|
-
e(
|
|
990
|
+
e(c);
|
|
989
991
|
}
|
|
990
|
-
}), { formik: o, handleToggleNoneChange: (
|
|
991
|
-
var
|
|
992
|
-
o.setFieldValue("toggleNone",
|
|
993
|
-
if (
|
|
992
|
+
}), { formik: o, handleToggleNoneChange: (d) => {
|
|
993
|
+
var c;
|
|
994
|
+
o.setFieldValue("toggleNone", d), (c = t.conditionsThatEstablishesTheDecision) == null || c.forEach((s) => {
|
|
995
|
+
if (d)
|
|
994
996
|
o.setFieldValue(
|
|
995
|
-
`conditionsThatEstablishesTheDecision.${
|
|
997
|
+
`conditionsThatEstablishesTheDecision.${s.conditionName}`,
|
|
996
998
|
void 0
|
|
997
999
|
);
|
|
998
1000
|
else {
|
|
999
|
-
const l =
|
|
1001
|
+
const l = s.howToSetTheCondition === x.LIST_OF_VALUES_MULTI ? [] : "";
|
|
1000
1002
|
o.setFieldValue(
|
|
1001
|
-
`conditionsThatEstablishesTheDecision.${
|
|
1003
|
+
`conditionsThatEstablishesTheDecision.${s.conditionName}`,
|
|
1002
1004
|
l
|
|
1003
1005
|
);
|
|
1004
1006
|
}
|
|
@@ -1040,25 +1042,25 @@ const Xe = f.div`
|
|
|
1040
1042
|
labelToggle: r,
|
|
1041
1043
|
name: p,
|
|
1042
1044
|
valueToggle: g = ""
|
|
1043
|
-
} = t, [
|
|
1044
|
-
|
|
1045
|
+
} = t, [d, c] = V(e), s = (l) => {
|
|
1046
|
+
c(l.target.checked), i(l);
|
|
1045
1047
|
};
|
|
1046
1048
|
return ye(() => {
|
|
1047
|
-
|
|
1049
|
+
c(e);
|
|
1048
1050
|
}, [e]), /* @__PURE__ */ u(E, { children: [
|
|
1049
1051
|
/* @__PURE__ */ a(h, { children: /* @__PURE__ */ a(
|
|
1050
1052
|
ie,
|
|
1051
1053
|
{
|
|
1052
|
-
checked:
|
|
1054
|
+
checked: d,
|
|
1053
1055
|
id: o,
|
|
1054
1056
|
name: p,
|
|
1055
|
-
onChange:
|
|
1057
|
+
onChange: s,
|
|
1056
1058
|
size: "small",
|
|
1057
1059
|
value: g,
|
|
1058
1060
|
children: /* @__PURE__ */ a(y, { size: "medium", type: "label", weight: "bold", children: r })
|
|
1059
1061
|
}
|
|
1060
1062
|
) }),
|
|
1061
|
-
|
|
1063
|
+
d && /* @__PURE__ */ a(E, { children: n })
|
|
1062
1064
|
] });
|
|
1063
1065
|
}, tt = (t) => {
|
|
1064
1066
|
const {
|
|
@@ -1069,17 +1071,17 @@ const Xe = f.div`
|
|
|
1069
1071
|
labelEnd: r,
|
|
1070
1072
|
checkedClosed: p = !1,
|
|
1071
1073
|
required: g = !1,
|
|
1072
|
-
valueStart:
|
|
1073
|
-
valueEnd:
|
|
1074
|
-
messageStart:
|
|
1074
|
+
valueStart: d = "",
|
|
1075
|
+
valueEnd: c = "",
|
|
1076
|
+
messageStart: s = "",
|
|
1075
1077
|
messageEnd: l = "",
|
|
1076
1078
|
statusStart: b = "pending",
|
|
1077
1079
|
statusEnd: T = "pending"
|
|
1078
|
-
} = t, [m, C] = V(p), [w,
|
|
1080
|
+
} = t, [m, C] = V(p), [w, A] = V(d), [U, R] = V(c), P = ({ target: S }) => {
|
|
1079
1081
|
C(S.checked), i && i(S.checked);
|
|
1080
|
-
}, de = (S) => {
|
|
1081
|
-
F(S.target.value), e(S);
|
|
1082
1082
|
}, se = (S) => {
|
|
1083
|
+
A(S.target.value), e(S);
|
|
1084
|
+
}, de = (S) => {
|
|
1083
1085
|
R(S.target.value), n(S);
|
|
1084
1086
|
}, ce = I("(max-width: 400px)");
|
|
1085
1087
|
return /* @__PURE__ */ u(E, { children: [
|
|
@@ -1126,12 +1128,12 @@ const Xe = f.div`
|
|
|
1126
1128
|
{
|
|
1127
1129
|
id: "dateStart",
|
|
1128
1130
|
label: o,
|
|
1129
|
-
onChange:
|
|
1131
|
+
onChange: se,
|
|
1130
1132
|
value: w,
|
|
1131
1133
|
required: g,
|
|
1132
1134
|
size: "compact",
|
|
1133
1135
|
status: b,
|
|
1134
|
-
message:
|
|
1136
|
+
message: s
|
|
1135
1137
|
}
|
|
1136
1138
|
),
|
|
1137
1139
|
m && /* @__PURE__ */ a(
|
|
@@ -1139,7 +1141,7 @@ const Xe = f.div`
|
|
|
1139
1141
|
{
|
|
1140
1142
|
id: "dateEnd",
|
|
1141
1143
|
label: r,
|
|
1142
|
-
onChange:
|
|
1144
|
+
onChange: de,
|
|
1143
1145
|
value: U,
|
|
1144
1146
|
required: g,
|
|
1145
1147
|
size: "compact",
|
|
@@ -1160,9 +1162,9 @@ const Xe = f.div`
|
|
|
1160
1162
|
normalizedDecision: r,
|
|
1161
1163
|
handleToggleNoneChange: p,
|
|
1162
1164
|
handleConditionToggleChange: g,
|
|
1163
|
-
showConditionsError:
|
|
1164
|
-
termStartStatus:
|
|
1165
|
-
termEndStatus:
|
|
1165
|
+
showConditionsError: d,
|
|
1166
|
+
termStartStatus: c,
|
|
1167
|
+
termEndStatus: s
|
|
1166
1168
|
} = t;
|
|
1167
1169
|
return /* @__PURE__ */ a("form", { onSubmit: e.handleSubmit, children: /* @__PURE__ */ u(h, { direction: "column", gap: "24px", children: [
|
|
1168
1170
|
Q({
|
|
@@ -1229,8 +1231,8 @@ const Xe = f.div`
|
|
|
1229
1231
|
valueEnd: e.values.validUntil,
|
|
1230
1232
|
messageStart: e.errors.effectiveFrom,
|
|
1231
1233
|
messageEnd: e.errors.validUntil,
|
|
1232
|
-
statusStart:
|
|
1233
|
-
statusEnd:
|
|
1234
|
+
statusStart: c,
|
|
1235
|
+
statusEnd: s,
|
|
1234
1236
|
onHandleStartChange: (l) => e.setFieldValue("effectiveFrom", l.target.value),
|
|
1235
1237
|
onHandleEndChange: (l) => e.setFieldValue("validUntil", l.target.value),
|
|
1236
1238
|
onCheckClosedChange: (l) => {
|
|
@@ -1241,7 +1243,7 @@ const Xe = f.div`
|
|
|
1241
1243
|
)
|
|
1242
1244
|
] }),
|
|
1243
1245
|
/* @__PURE__ */ a(D, {}),
|
|
1244
|
-
|
|
1246
|
+
d && /* @__PURE__ */ a(y, { type: "label", size: "medium", appearance: "danger", children: String(e.errors.conditionsThatEstablishesTheDecision) }),
|
|
1245
1247
|
/* @__PURE__ */ u(h, { direction: "row", justifyContent: "end", gap: "16px", children: [
|
|
1246
1248
|
/* @__PURE__ */ a(N, { appearance: "gray", onClick: i, children: n.cancel }),
|
|
1247
1249
|
/* @__PURE__ */ a(N, { type: "submit", children: n.confirm })
|
|
@@ -1259,9 +1261,9 @@ const Xe = f.div`
|
|
|
1259
1261
|
howToSetTheCondition: e.howToSetTheDecision,
|
|
1260
1262
|
decisionDataType: e.decisionDataType,
|
|
1261
1263
|
listOfPossibleValues: e.listOfPossibleValues
|
|
1262
|
-
},
|
|
1264
|
+
}, d = ((T = e.conditionsThatEstablishesTheDecision) == null ? void 0 : T.filter(
|
|
1263
1265
|
(m) => !m.hidden
|
|
1264
|
-
)) || [],
|
|
1266
|
+
)) || [], c = !!r.errors.conditionsThatEstablishesTheDecision && r.submitCount > 0, s = r.touched.effectiveFrom ? r.errors.effectiveFrom ? "invalid" : "valid" : void 0, l = r.touched.validUntil ? r.errors.validUntil ? "invalid" : "valid" : void 0;
|
|
1265
1267
|
return /* @__PURE__ */ a(
|
|
1266
1268
|
nt,
|
|
1267
1269
|
{
|
|
@@ -1269,7 +1271,7 @@ const Xe = f.div`
|
|
|
1269
1271
|
onCancel: o,
|
|
1270
1272
|
textValues: i,
|
|
1271
1273
|
decision: e,
|
|
1272
|
-
visibleConditions:
|
|
1274
|
+
visibleConditions: d,
|
|
1273
1275
|
normalizedDecision: g,
|
|
1274
1276
|
handleToggleNoneChange: p,
|
|
1275
1277
|
handleConditionToggleChange: (m, C) => (w) => {
|
|
@@ -1283,15 +1285,15 @@ const Xe = f.div`
|
|
|
1283
1285
|
!1
|
|
1284
1286
|
);
|
|
1285
1287
|
else {
|
|
1286
|
-
const
|
|
1288
|
+
const A = C ? [] : "";
|
|
1287
1289
|
r.setFieldValue(
|
|
1288
1290
|
`conditionsThatEstablishesTheDecision.${m}`,
|
|
1289
|
-
|
|
1291
|
+
A
|
|
1290
1292
|
);
|
|
1291
1293
|
}
|
|
1292
1294
|
},
|
|
1293
|
-
showConditionsError:
|
|
1294
|
-
termStartStatus:
|
|
1295
|
+
showConditionsError: c,
|
|
1296
|
+
termStartStatus: s,
|
|
1295
1297
|
termEndStatus: l
|
|
1296
1298
|
}
|
|
1297
1299
|
);
|