@isettingkit/business-rules 2.1.17 → 2.1.18
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 +101 -88
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -70,14 +70,14 @@ const Qe = (e) => {
|
|
|
70
70
|
from: e.from ?? "",
|
|
71
71
|
to: e.to ?? ""
|
|
72
72
|
}), ir = (e) => e.value, lr = (e) => e.value, sr = (e) => e.value;
|
|
73
|
-
var
|
|
73
|
+
var k = /* @__PURE__ */ ((e) => (e.EQUAL = "EqualTo", e.GREATER_THAN = "GreaterThan", e.LESS_THAN = "LessThan", e.LIST_OF_VALUES = "ListOfValues", e.LIST_OF_VALUES_MULTI = "ListOfValuesMulti", e.RANGE = "Range", e))(k || {});
|
|
74
74
|
const dr = {
|
|
75
|
-
[
|
|
76
|
-
[
|
|
77
|
-
[
|
|
78
|
-
[
|
|
79
|
-
[
|
|
80
|
-
[
|
|
75
|
+
[k.LIST_OF_VALUES]: rr,
|
|
76
|
+
[k.LIST_OF_VALUES_MULTI]: or,
|
|
77
|
+
[k.RANGE]: ar,
|
|
78
|
+
[k.GREATER_THAN]: ir,
|
|
79
|
+
[k.LESS_THAN]: lr,
|
|
80
|
+
[k.EQUAL]: sr
|
|
81
81
|
}, He = (e) => {
|
|
82
82
|
const n = e == null ? void 0 : e.value, t = typeof n == "object" && n !== null && !Array.isArray(n), r = dr[e == null ? void 0 : e.howToSetTheDecision] || tr;
|
|
83
83
|
return t && r(n) || n || void 0;
|
|
@@ -753,12 +753,12 @@ const Sr = C.div`
|
|
|
753
753
|
from: e.from ?? "",
|
|
754
754
|
to: e.to ?? ""
|
|
755
755
|
}), Rr = (e) => e.value, Fr = (e) => e.value, Lr = (e) => e.value, Or = {
|
|
756
|
-
[
|
|
757
|
-
[
|
|
758
|
-
[
|
|
759
|
-
[
|
|
760
|
-
[
|
|
761
|
-
[
|
|
756
|
+
[k.LIST_OF_VALUES]: Ar,
|
|
757
|
+
[k.LIST_OF_VALUES_MULTI]: $r,
|
|
758
|
+
[k.RANGE]: Ir,
|
|
759
|
+
[k.GREATER_THAN]: Rr,
|
|
760
|
+
[k.LESS_THAN]: Fr,
|
|
761
|
+
[k.EQUAL]: Lr
|
|
762
762
|
}, qe = (e) => {
|
|
763
763
|
const n = e == null ? void 0 : e.value, t = typeof n == "object" && n !== null && !Array.isArray(n), r = Or[e == null ? void 0 : e.howToSetTheDecision] || kr;
|
|
764
764
|
return t && r(n) || n || void 0;
|
|
@@ -1100,12 +1100,12 @@ const Ur = (e) => {
|
|
|
1100
1100
|
schema: de().required("Requerido"),
|
|
1101
1101
|
value: e
|
|
1102
1102
|
}, Xr = {
|
|
1103
|
-
[
|
|
1104
|
-
[
|
|
1105
|
-
[
|
|
1106
|
-
[
|
|
1107
|
-
[
|
|
1108
|
-
[
|
|
1103
|
+
[k.LIST_OF_VALUES]: Gr,
|
|
1104
|
+
[k.LIST_OF_VALUES_MULTI]: Yr,
|
|
1105
|
+
[k.RANGE]: Wr,
|
|
1106
|
+
[k.GREATER_THAN]: bn,
|
|
1107
|
+
[k.LESS_THAN]: bn,
|
|
1108
|
+
[k.EQUAL]: bn
|
|
1109
1109
|
}, Qr = (e) => Xr[e] || Br;
|
|
1110
1110
|
var On = /* @__PURE__ */ ((e) => (e.EQUAL = "EqualTo", e.GREATER_THAN = "GreaterThan", e.LESS_THAN = "LessThan", e.LIST_OF_VALUES = "ListOfValues", e.LIST_OF_VALUES_MULTI = "ListOfValuesMulti", e.RANGE = "Range", e))(On || {});
|
|
1111
1111
|
const tn = (e) => e != null && (typeof e != "string" || e.trim() !== "") && (!Array.isArray(e) || e.length > 0), Zr = (e, n) => {
|
|
@@ -1655,12 +1655,12 @@ const Jr = C.div`
|
|
|
1655
1655
|
from: e.from ?? "",
|
|
1656
1656
|
to: e.to ?? ""
|
|
1657
1657
|
}), uo = (e) => e.value, po = (e) => e.value, go = (e) => e.value, ho = {
|
|
1658
|
-
[
|
|
1659
|
-
[
|
|
1660
|
-
[
|
|
1661
|
-
[
|
|
1662
|
-
[
|
|
1663
|
-
[
|
|
1658
|
+
[k.LIST_OF_VALUES]: lo,
|
|
1659
|
+
[k.LIST_OF_VALUES_MULTI]: so,
|
|
1660
|
+
[k.RANGE]: co,
|
|
1661
|
+
[k.GREATER_THAN]: uo,
|
|
1662
|
+
[k.LESS_THAN]: po,
|
|
1663
|
+
[k.EQUAL]: go
|
|
1664
1664
|
}, Be = (e) => {
|
|
1665
1665
|
const n = e == null ? void 0 : e.value;
|
|
1666
1666
|
if (typeof n == "string" && n.includes(" a ")) {
|
|
@@ -1678,7 +1678,7 @@ const Jr = C.div`
|
|
|
1678
1678
|
}
|
|
1679
1679
|
return n;
|
|
1680
1680
|
}
|
|
1681
|
-
return typeof n == "object" && n !== null && !Array.isArray(n) ? (ho[e == null ? void 0 : e.howToSetTheDecision] || io)(n) : n || void 0;
|
|
1681
|
+
return typeof n == "object" && n !== null && !Array.isArray(n) ? "from" in n && "to" in n ? n : (ho[e == null ? void 0 : e.howToSetTheDecision] || io)(n) : n || void 0;
|
|
1682
1682
|
}, fo = C.div`
|
|
1683
1683
|
display: flex;
|
|
1684
1684
|
justify-content: ${({ $justifyContent: e }) => e};
|
|
@@ -1883,7 +1883,14 @@ const yo = (e) => {
|
|
|
1883
1883
|
) }),
|
|
1884
1884
|
l && /* @__PURE__ */ m(z, { children: [
|
|
1885
1885
|
/* @__PURE__ */ i(G, { dashed: !0 }),
|
|
1886
|
-
N ? /* @__PURE__ */ i(
|
|
1886
|
+
N ? /* @__PURE__ */ i(
|
|
1887
|
+
st,
|
|
1888
|
+
{
|
|
1889
|
+
tabs: b,
|
|
1890
|
+
selectedTab: D,
|
|
1891
|
+
onChange: T
|
|
1892
|
+
}
|
|
1893
|
+
) : /* @__PURE__ */ i(
|
|
1887
1894
|
R,
|
|
1888
1895
|
{
|
|
1889
1896
|
type: "label",
|
|
@@ -1912,7 +1919,11 @@ const yo = (e) => {
|
|
|
1912
1919
|
children: /* @__PURE__ */ i(
|
|
1913
1920
|
Je,
|
|
1914
1921
|
{
|
|
1915
|
-
element: {
|
|
1922
|
+
element: {
|
|
1923
|
+
...w,
|
|
1924
|
+
value: w.value,
|
|
1925
|
+
howToSetTheCondition: w.howToSetTheCondition === se.LIST_OF_VALUES ? se.LIST_OF_VALUES_MULTI : w.howToSetTheCondition
|
|
1926
|
+
},
|
|
1916
1927
|
valueData: Be(
|
|
1917
1928
|
w
|
|
1918
1929
|
)
|
|
@@ -2013,13 +2024,15 @@ const yo = (e) => {
|
|
|
2013
2024
|
if (e == null) return "";
|
|
2014
2025
|
const t = Array.isArray(e) ? e.join(", ") : typeof e == "object" && e !== null ? JSON.stringify(e) : String(e ?? "");
|
|
2015
2026
|
switch (n) {
|
|
2016
|
-
case
|
|
2027
|
+
case k.LESS_THAN:
|
|
2017
2028
|
return `Menor a ${t}`;
|
|
2018
|
-
case
|
|
2029
|
+
case k.GREATER_THAN:
|
|
2019
2030
|
return `Mayor a ${t}`;
|
|
2020
|
-
case
|
|
2031
|
+
case k.LIST_OF_VALUES:
|
|
2032
|
+
return e;
|
|
2033
|
+
case k.LIST_OF_VALUES_MULTI:
|
|
2021
2034
|
return e;
|
|
2022
|
-
case
|
|
2035
|
+
case k.RANGE:
|
|
2023
2036
|
return e;
|
|
2024
2037
|
default:
|
|
2025
2038
|
return String(t);
|
|
@@ -2071,25 +2084,25 @@ const yo = (e) => {
|
|
|
2071
2084
|
} : null, b = P.useMemo(
|
|
2072
2085
|
() => t ? Pe(t) : {},
|
|
2073
2086
|
[t]
|
|
2074
|
-
), D = ((le = (me = t == null ? void 0 : t.conditionGroups) == null ? void 0 : me.map((
|
|
2075
|
-
const
|
|
2076
|
-
|
|
2087
|
+
), D = ((le = (me = t == null ? void 0 : t.conditionGroups) == null ? void 0 : me.map((A) => A == null ? void 0 : A.ConditionGroupId)) == null ? void 0 : le.filter(Boolean)) || Object.keys(b), T = D[0] || "group-primary", S = P.useMemo(() => {
|
|
2088
|
+
const A = {}, M = b[T] || [], pe = b["group-primary"] || [];
|
|
2089
|
+
A["group-primary"] = T === "group-primary" ? pe : [...M, ...pe];
|
|
2077
2090
|
for (const L of D)
|
|
2078
|
-
!L || L === T || L !== "group-primary" && b[L] && (
|
|
2091
|
+
!L || L === T || L !== "group-primary" && b[L] && (A[L] = b[L]);
|
|
2079
2092
|
for (const L of Object.keys(b))
|
|
2080
|
-
L === "group-primary" || L === T || L in
|
|
2081
|
-
return
|
|
2093
|
+
L === "group-primary" || L === T || L in A || (A[L] = b[L]);
|
|
2094
|
+
return A;
|
|
2082
2095
|
}, [b, T, D]), N = P.useMemo(() => {
|
|
2083
|
-
const
|
|
2096
|
+
const A = [
|
|
2084
2097
|
"group-primary",
|
|
2085
2098
|
...Object.keys(S).filter((M) => M !== "group-primary")
|
|
2086
2099
|
];
|
|
2087
|
-
return Array.from(new Set(
|
|
2100
|
+
return Array.from(new Set(A));
|
|
2088
2101
|
}, [S]), w = P.useMemo(() => {
|
|
2089
|
-
const
|
|
2102
|
+
const A = {};
|
|
2090
2103
|
return Object.keys(S).forEach((M) => {
|
|
2091
2104
|
const pe = S[M];
|
|
2092
|
-
pe && Array.isArray(pe) ?
|
|
2105
|
+
pe && Array.isArray(pe) ? A[M] = pe.map((L) => {
|
|
2093
2106
|
let I = L.labelName;
|
|
2094
2107
|
L.TimeUnit && L.labelName && (I = xo(L.labelName, L.TimeUnit));
|
|
2095
2108
|
let U = L.value;
|
|
@@ -2101,23 +2114,23 @@ const yo = (e) => {
|
|
|
2101
2114
|
labelName: I,
|
|
2102
2115
|
value: U
|
|
2103
2116
|
};
|
|
2104
|
-
}) :
|
|
2105
|
-
}),
|
|
2117
|
+
}) : A[M] = pe;
|
|
2118
|
+
}), A;
|
|
2106
2119
|
}, [S]), F = ht(
|
|
2107
2120
|
w,
|
|
2108
|
-
(
|
|
2121
|
+
(A) => !A.hidden
|
|
2109
2122
|
), O = {};
|
|
2110
2123
|
let $ = 1;
|
|
2111
|
-
const V = N.map((
|
|
2112
|
-
const M =
|
|
2113
|
-
return O[M] =
|
|
2124
|
+
const V = N.map((A) => {
|
|
2125
|
+
const M = A === "group-primary" ? "mainCondition" : `alternateCondition-${$++}`;
|
|
2126
|
+
return O[M] = A, {
|
|
2114
2127
|
id: M,
|
|
2115
|
-
label:
|
|
2128
|
+
label: A === "group-primary" ? Bn(A, 0) : Bn(A, Number(M.split("-").at(-1))),
|
|
2116
2129
|
isDisabled: !1
|
|
2117
2130
|
};
|
|
2118
2131
|
}), [Z, be] = P.useState(
|
|
2119
2132
|
((_ = V[0]) == null ? void 0 : _.id) ?? "mainCondition"
|
|
2120
|
-
), ve = (
|
|
2133
|
+
), ve = (A) => be(A), fe = O[Z] ?? "group-primary", ae = F[fe] ?? [], ye = N.length > 1, Ne = Array.from({ length: 5 }), ue = !!(!r && t && o && x), xe = ae.length < 2 ? "start" : "space-between", Te = `N° ${String((a ?? 0) + 1).padStart(2, "0")}`;
|
|
2121
2134
|
return /* @__PURE__ */ i(
|
|
2122
2135
|
yo,
|
|
2123
2136
|
{
|
|
@@ -2493,12 +2506,12 @@ const Co = C.div`
|
|
|
2493
2506
|
value: e
|
|
2494
2507
|
};
|
|
2495
2508
|
}, Vo = {
|
|
2496
|
-
[
|
|
2497
|
-
[
|
|
2498
|
-
[
|
|
2499
|
-
[
|
|
2500
|
-
[
|
|
2501
|
-
[
|
|
2509
|
+
[k.LIST_OF_VALUES]: Mo,
|
|
2510
|
+
[k.LIST_OF_VALUES_MULTI]: Po,
|
|
2511
|
+
[k.RANGE]: zo,
|
|
2512
|
+
[k.GREATER_THAN]: vn,
|
|
2513
|
+
[k.LESS_THAN]: vn,
|
|
2514
|
+
[k.EQUAL]: vn
|
|
2502
2515
|
}, Gn = (e) => Vo[e] || Oo;
|
|
2503
2516
|
function _o({
|
|
2504
2517
|
decision: e,
|
|
@@ -2904,14 +2917,14 @@ function Zo(e) {
|
|
|
2904
2917
|
}
|
|
2905
2918
|
function Ko(e) {
|
|
2906
2919
|
switch (e) {
|
|
2907
|
-
case
|
|
2908
|
-
case
|
|
2909
|
-
case
|
|
2920
|
+
case k.EQUAL:
|
|
2921
|
+
case k.GREATER_THAN:
|
|
2922
|
+
case k.LESS_THAN:
|
|
2910
2923
|
return "sea";
|
|
2911
|
-
case
|
|
2924
|
+
case k.RANGE:
|
|
2912
2925
|
return "esté entre";
|
|
2913
|
-
case
|
|
2914
|
-
case
|
|
2926
|
+
case k.LIST_OF_VALUES:
|
|
2927
|
+
case k.LIST_OF_VALUES_MULTI:
|
|
2915
2928
|
return "esté en";
|
|
2916
2929
|
default:
|
|
2917
2930
|
return "sea";
|
|
@@ -3747,12 +3760,12 @@ const aa = C.div`
|
|
|
3747
3760
|
schema: de().required("Requerido"),
|
|
3748
3761
|
value: e
|
|
3749
3762
|
}, ma = {
|
|
3750
|
-
[
|
|
3751
|
-
[
|
|
3752
|
-
[
|
|
3753
|
-
[
|
|
3754
|
-
[
|
|
3755
|
-
[
|
|
3763
|
+
[k.LIST_OF_VALUES]: ga,
|
|
3764
|
+
[k.LIST_OF_VALUES_MULTI]: ha,
|
|
3765
|
+
[k.RANGE]: fa,
|
|
3766
|
+
[k.GREATER_THAN]: yn,
|
|
3767
|
+
[k.LESS_THAN]: yn,
|
|
3768
|
+
[k.EQUAL]: yn
|
|
3756
3769
|
}, Wn = (e) => ma[e] || pa;
|
|
3757
3770
|
function ba({
|
|
3758
3771
|
decision: e,
|
|
@@ -3885,7 +3898,7 @@ function ba({
|
|
|
3885
3898
|
void 0
|
|
3886
3899
|
);
|
|
3887
3900
|
else {
|
|
3888
|
-
const c = u.howToSetTheCondition ===
|
|
3901
|
+
const c = u.howToSetTheCondition === k.LIST_OF_VALUES_MULTI ? [] : "";
|
|
3889
3902
|
o.setFieldValue(
|
|
3890
3903
|
`conditionsThatEstablishesTheDecision.${u.conditionName}`,
|
|
3891
3904
|
c
|
|
@@ -4098,7 +4111,7 @@ const va = C.div`
|
|
|
4098
4111
|
checked: !n.values.toggleNone && n.values.conditionsThatEstablishesTheDecision[c.conditionName] !== void 0,
|
|
4099
4112
|
handleToggleChange: (g) => d(
|
|
4100
4113
|
c.conditionName,
|
|
4101
|
-
c.howToSetTheCondition ===
|
|
4114
|
+
c.howToSetTheCondition === k.LIST_OF_VALUES_MULTI
|
|
4102
4115
|
)(g.target.checked),
|
|
4103
4116
|
children: on({ condition: c, formik: n })
|
|
4104
4117
|
},
|
|
@@ -6385,9 +6398,9 @@ const Gi = (e) => {
|
|
|
6385
6398
|
} = e, ae = Fn(In), ye = ((le = (me = ae == null ? void 0 : ae.input) == null ? void 0 : me.required) == null ? void 0 : le.appearance) || ge.required.appearance, Ne = h && !r, ue = D || b === "" ? "" : rt(g, b), xe = dt(
|
|
6386
6399
|
() => g.filter((_) => S.includes(_.id)),
|
|
6387
6400
|
[g, S]
|
|
6388
|
-
), Te = (_,
|
|
6401
|
+
), Te = (_, A) => {
|
|
6389
6402
|
_.stopPropagation(), ve({
|
|
6390
|
-
target: { checked: !1, value:
|
|
6403
|
+
target: { checked: !1, value: A }
|
|
6391
6404
|
});
|
|
6392
6405
|
};
|
|
6393
6406
|
return /* @__PURE__ */ m(_i, { $fullwidth: a, $disabled: r, ref: n, children: [
|
|
@@ -6461,7 +6474,7 @@ const Gi = (e) => {
|
|
|
6461
6474
|
label: _.label,
|
|
6462
6475
|
removable: !0,
|
|
6463
6476
|
displayIcon: !1,
|
|
6464
|
-
onClose: (
|
|
6477
|
+
onClose: (A) => Te(A, _.id)
|
|
6465
6478
|
},
|
|
6466
6479
|
_.id
|
|
6467
6480
|
)) : (b ?? "") !== "" && /* @__PURE__ */ i(
|
|
@@ -6540,51 +6553,51 @@ const Gi = (e) => {
|
|
|
6540
6553
|
} = e, [$, V] = H(!1), [Z, be] = H(!1), [ve, fe] = H([]), ae = Fe(null);
|
|
6541
6554
|
$e(() => {
|
|
6542
6555
|
if (N) {
|
|
6543
|
-
const
|
|
6544
|
-
fe(
|
|
6556
|
+
const A = T ? T.split(",").map((M) => M.trim()) : [];
|
|
6557
|
+
fe(A);
|
|
6545
6558
|
}
|
|
6546
6559
|
}, [T, N]);
|
|
6547
6560
|
function ye() {
|
|
6548
6561
|
u(l, ""), fe([]), V(!1);
|
|
6549
6562
|
}
|
|
6550
|
-
function Ne(
|
|
6563
|
+
function Ne(A) {
|
|
6551
6564
|
if (!n) {
|
|
6552
6565
|
V(!$);
|
|
6553
6566
|
try {
|
|
6554
|
-
c && c(
|
|
6567
|
+
c && c(A);
|
|
6555
6568
|
} catch (M) {
|
|
6556
6569
|
console.error(`Error when clicking over select. ${M}`);
|
|
6557
6570
|
}
|
|
6558
6571
|
}
|
|
6559
6572
|
}
|
|
6560
|
-
const ue = Zt((
|
|
6561
|
-
ae.current &&
|
|
6573
|
+
const ue = Zt((A) => {
|
|
6574
|
+
ae.current && A.target && !ae.current.contains(A.target) && V(!1);
|
|
6562
6575
|
}, []);
|
|
6563
|
-
function xe(
|
|
6576
|
+
function xe(A) {
|
|
6564
6577
|
try {
|
|
6565
|
-
|
|
6578
|
+
A.type === "focus" && (be(!0), g && g(A)), A.type === "blur" && (be(!1), p && p(A));
|
|
6566
6579
|
} catch (M) {
|
|
6567
6580
|
console.error(`Error executing focus/blur callback. ${M}`);
|
|
6568
6581
|
}
|
|
6569
6582
|
}
|
|
6570
|
-
function Te(
|
|
6583
|
+
function Te(A) {
|
|
6571
6584
|
V(!1);
|
|
6572
6585
|
try {
|
|
6573
|
-
u && u(l,
|
|
6586
|
+
u && u(l, A);
|
|
6574
6587
|
} catch (M) {
|
|
6575
6588
|
console.error(`Error when changing value using callback. ${M}`);
|
|
6576
6589
|
}
|
|
6577
6590
|
}
|
|
6578
|
-
function me(
|
|
6579
|
-
|
|
6591
|
+
function me(A) {
|
|
6592
|
+
A.key === "Escape" && V(!1), V(!$);
|
|
6580
6593
|
try {
|
|
6581
|
-
f && f(
|
|
6594
|
+
f && f(A);
|
|
6582
6595
|
} catch (M) {
|
|
6583
6596
|
console.error(`Error when clicking over select. ${M}`);
|
|
6584
6597
|
}
|
|
6585
6598
|
}
|
|
6586
|
-
function le(
|
|
6587
|
-
const { value: M, checked: pe } =
|
|
6599
|
+
function le(A) {
|
|
6600
|
+
const { value: M, checked: pe } = A.target;
|
|
6588
6601
|
fe((L) => {
|
|
6589
6602
|
const I = pe ? [...L, M] : L.filter((U) => U !== M);
|
|
6590
6603
|
return u(l, I.join(",")), I;
|