@isettingkit/business-rules 0.1.14 → 0.1.16
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 +187 -188
- package/package.json +2 -2
package/dist/index.es.js
CHANGED
|
@@ -1,91 +1,91 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as g, jsx as n, Fragment as F } from "react/jsx-runtime";
|
|
2
2
|
import { useFormik as Q } from "formik";
|
|
3
|
-
import { useState as x, useEffect as
|
|
4
|
-
import { Divider as
|
|
3
|
+
import { useState as x, useEffect as q } from "react";
|
|
4
|
+
import { Divider as E } from "@inubekit/divider";
|
|
5
5
|
import { Stack as o } from "@inubekit/stack";
|
|
6
6
|
import { Text as y } from "@inubekit/text";
|
|
7
|
-
import { Toggle as
|
|
8
|
-
import { ValueHowToSetUp as f, ValueDataType as R, DecisionConditionRenderer as
|
|
9
|
-
import { Textarea as
|
|
10
|
-
import { Date as
|
|
11
|
-
import { Checkbox as
|
|
12
|
-
import { Button as
|
|
13
|
-
import { object as
|
|
14
|
-
import { DecisionViewConditionRenderer as
|
|
15
|
-
import { MdOutlineRemoveRedEye as
|
|
16
|
-
import { Icon as
|
|
17
|
-
import { inube as
|
|
18
|
-
import
|
|
19
|
-
const
|
|
7
|
+
import { Toggle as P } from "@inubekit/toggle";
|
|
8
|
+
import { ValueHowToSetUp as f, ValueDataType as R, parsePercentageString as Z, DecisionConditionRenderer as U } from "@isettingkit/input";
|
|
9
|
+
import { Textarea as J } from "@inubekit/textarea";
|
|
10
|
+
import { Date as L } from "@inubekit/date";
|
|
11
|
+
import { Checkbox as K } from "@inubekit/checkbox";
|
|
12
|
+
import { Button as M } from "@inubekit/button";
|
|
13
|
+
import { object as $, string as z, number as O, mixed as H } from "yup";
|
|
14
|
+
import { DecisionViewConditionRenderer as V } from "@isettingkit/view";
|
|
15
|
+
import { MdOutlineRemoveRedEye as W, MdOutlineDelete as X } from "react-icons/md";
|
|
16
|
+
import { Icon as I } from "@inubekit/icon";
|
|
17
|
+
import { inube as Y } from "@inubekit/foundations";
|
|
18
|
+
import B from "styled-components";
|
|
19
|
+
const ee = (t) => {
|
|
20
20
|
const {
|
|
21
21
|
label: e,
|
|
22
22
|
labelText: a,
|
|
23
23
|
onHandleChange: i,
|
|
24
24
|
placeholder: l,
|
|
25
|
-
required:
|
|
25
|
+
required: c,
|
|
26
26
|
value: m = ""
|
|
27
|
-
} = t, [
|
|
28
|
-
return /* @__PURE__ */
|
|
27
|
+
} = t, [d, b] = x(m);
|
|
28
|
+
return /* @__PURE__ */ g(o, { direction: "column", margin: "10px 4px", children: [
|
|
29
29
|
/* @__PURE__ */ n(y, { size: "large", appearance: "gray", weight: "bold", margin: "10px 0", children: a }),
|
|
30
30
|
/* @__PURE__ */ n(o, { margin: "10px 0", children: /* @__PURE__ */ n(
|
|
31
|
-
|
|
31
|
+
J,
|
|
32
32
|
{
|
|
33
33
|
id: "reasonChange",
|
|
34
34
|
label: e,
|
|
35
|
-
onChange: (
|
|
36
|
-
b(
|
|
35
|
+
onChange: (p) => {
|
|
36
|
+
b(p.target.value), i(p);
|
|
37
37
|
},
|
|
38
38
|
placeholder: l,
|
|
39
|
-
required:
|
|
40
|
-
value:
|
|
39
|
+
required: c,
|
|
40
|
+
value: d,
|
|
41
41
|
maxLength: 120,
|
|
42
42
|
fullwidth: !0
|
|
43
43
|
}
|
|
44
44
|
) })
|
|
45
45
|
] });
|
|
46
|
-
},
|
|
46
|
+
}, ne = (t) => {
|
|
47
47
|
const {
|
|
48
48
|
checked: e,
|
|
49
49
|
children: a,
|
|
50
50
|
handleToggleChange: i,
|
|
51
51
|
id: l,
|
|
52
|
-
labelToggle:
|
|
52
|
+
labelToggle: c,
|
|
53
53
|
name: m,
|
|
54
|
-
valueToggle:
|
|
55
|
-
} = t, [b, C] = x(e),
|
|
54
|
+
valueToggle: d = ""
|
|
55
|
+
} = t, [b, C] = x(e), p = (v) => {
|
|
56
56
|
C(v.target.checked), i(v);
|
|
57
57
|
};
|
|
58
|
-
return
|
|
58
|
+
return q(() => {
|
|
59
59
|
C(e);
|
|
60
|
-
}, [e]), /* @__PURE__ */
|
|
60
|
+
}, [e]), /* @__PURE__ */ g(F, { children: [
|
|
61
61
|
/* @__PURE__ */ n(o, { children: /* @__PURE__ */ n(
|
|
62
|
-
|
|
62
|
+
P,
|
|
63
63
|
{
|
|
64
64
|
checked: b,
|
|
65
65
|
id: l,
|
|
66
66
|
margin: "10px",
|
|
67
67
|
name: m,
|
|
68
|
-
onChange:
|
|
68
|
+
onChange: p,
|
|
69
69
|
size: "small",
|
|
70
|
-
value:
|
|
71
|
-
children: /* @__PURE__ */ n(y, { size: "medium", type: "label", weight: "bold", children:
|
|
70
|
+
value: d,
|
|
71
|
+
children: /* @__PURE__ */ n(y, { size: "medium", type: "label", weight: "bold", children: c })
|
|
72
72
|
}
|
|
73
73
|
) }),
|
|
74
74
|
b && /* @__PURE__ */ n(F, { children: a })
|
|
75
75
|
] });
|
|
76
|
-
},
|
|
76
|
+
}, te = (t) => {
|
|
77
77
|
const {
|
|
78
78
|
onHandleStartChange: e,
|
|
79
79
|
onHandleEndChange: a,
|
|
80
80
|
labelStart: i,
|
|
81
81
|
labelEnd: l,
|
|
82
|
-
checkedClosed:
|
|
82
|
+
checkedClosed: c = !1,
|
|
83
83
|
required: m = !1,
|
|
84
|
-
valueStart:
|
|
84
|
+
valueStart: d = "",
|
|
85
85
|
valueEnd: b = ""
|
|
86
|
-
} = t, [C,
|
|
87
|
-
return /* @__PURE__ */
|
|
88
|
-
/* @__PURE__ */
|
|
86
|
+
} = t, [C, p] = x(c), [v, w] = x(d), [S, T] = x(b);
|
|
87
|
+
return /* @__PURE__ */ g(F, { children: [
|
|
88
|
+
/* @__PURE__ */ g(o, { direction: "row", justifyContent: "space-between", margin: "10px 0", children: [
|
|
89
89
|
/* @__PURE__ */ n(o, { children: /* @__PURE__ */ n(
|
|
90
90
|
y,
|
|
91
91
|
{
|
|
@@ -105,11 +105,11 @@ const Y = (t) => {
|
|
|
105
105
|
wrap: "wrap",
|
|
106
106
|
gap: "4px",
|
|
107
107
|
children: /* @__PURE__ */ n(
|
|
108
|
-
|
|
108
|
+
K,
|
|
109
109
|
{
|
|
110
110
|
label: "Cerrada",
|
|
111
|
-
onChange: ({ target:
|
|
112
|
-
|
|
111
|
+
onChange: ({ target: s }) => {
|
|
112
|
+
p(s.checked);
|
|
113
113
|
},
|
|
114
114
|
checked: C,
|
|
115
115
|
value: ""
|
|
@@ -118,14 +118,14 @@ const Y = (t) => {
|
|
|
118
118
|
}
|
|
119
119
|
)
|
|
120
120
|
] }),
|
|
121
|
-
/* @__PURE__ */
|
|
121
|
+
/* @__PURE__ */ g(o, { justifyContent: "space-between", gap: "24px", children: [
|
|
122
122
|
/* @__PURE__ */ n(o, { width: "189px", children: /* @__PURE__ */ n(
|
|
123
|
-
|
|
123
|
+
L,
|
|
124
124
|
{
|
|
125
125
|
id: "dateStart",
|
|
126
126
|
label: i,
|
|
127
|
-
onChange: (
|
|
128
|
-
|
|
127
|
+
onChange: (s) => {
|
|
128
|
+
w(s.target.value), e(s);
|
|
129
129
|
},
|
|
130
130
|
value: v,
|
|
131
131
|
required: m,
|
|
@@ -133,21 +133,21 @@ const Y = (t) => {
|
|
|
133
133
|
}
|
|
134
134
|
) }),
|
|
135
135
|
C && /* @__PURE__ */ n(o, { width: "189px", children: /* @__PURE__ */ n(
|
|
136
|
-
|
|
136
|
+
L,
|
|
137
137
|
{
|
|
138
138
|
id: "dateEnd",
|
|
139
139
|
label: l,
|
|
140
|
-
onChange: (
|
|
141
|
-
T(
|
|
140
|
+
onChange: (s) => {
|
|
141
|
+
T(s.target.value), a(s);
|
|
142
142
|
},
|
|
143
|
-
value:
|
|
143
|
+
value: S,
|
|
144
144
|
required: m,
|
|
145
145
|
size: "compact"
|
|
146
146
|
}
|
|
147
147
|
) })
|
|
148
148
|
] })
|
|
149
149
|
] });
|
|
150
|
-
},
|
|
150
|
+
}, N = (t) => {
|
|
151
151
|
if ("value" in t && "valueUse" in t && t.value !== void 0) {
|
|
152
152
|
const e = t.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;
|
|
153
153
|
switch (t.valueUse) {
|
|
@@ -157,7 +157,7 @@ const Y = (t) => {
|
|
|
157
157
|
"isArrayOrString",
|
|
158
158
|
"Must be an array of strings/numbers or a single string",
|
|
159
159
|
(l) => Array.isArray(l) ? l.every(
|
|
160
|
-
(
|
|
160
|
+
(c) => typeof c == "string" || typeof c == "number"
|
|
161
161
|
) : typeof l == "string"
|
|
162
162
|
),
|
|
163
163
|
value: e
|
|
@@ -168,16 +168,16 @@ const Y = (t) => {
|
|
|
168
168
|
"isArrayOrString",
|
|
169
169
|
"Must be an array of strings/numbers or a single string",
|
|
170
170
|
(l) => Array.isArray(l) ? l.every(
|
|
171
|
-
(
|
|
171
|
+
(c) => typeof c == "string" || typeof c == "number"
|
|
172
172
|
) : typeof l == "string"
|
|
173
173
|
),
|
|
174
174
|
value: e
|
|
175
175
|
};
|
|
176
176
|
case f.RANGE:
|
|
177
177
|
return {
|
|
178
|
-
schema:
|
|
179
|
-
from:
|
|
180
|
-
to:
|
|
178
|
+
schema: $({
|
|
179
|
+
from: O().required("Range From is required").max(i, "'Range From' cannot be greater than 'Range To'").min(0, "'Range From' cannot be less than 0"),
|
|
180
|
+
to: O().required("Range To is required").min(a, "'Range To' cannot be less than 'Range From'").min(0, "'Range To' cannot be less than 0")
|
|
181
181
|
}),
|
|
182
182
|
value: {
|
|
183
183
|
from: a,
|
|
@@ -188,30 +188,30 @@ const Y = (t) => {
|
|
|
188
188
|
case f.LESS_THAN:
|
|
189
189
|
case f.EQUAL:
|
|
190
190
|
return t.dataType === R.PERCENTAGE ? {
|
|
191
|
-
schema:
|
|
191
|
+
schema: O().required("Percentage is required").min(0, "Percentage cannot be less than 0").max(100, "Percentage cannot be greater than 100"),
|
|
192
192
|
value: e
|
|
193
193
|
} : {
|
|
194
|
-
schema:
|
|
194
|
+
schema: z().required("Required"),
|
|
195
195
|
value: e
|
|
196
196
|
};
|
|
197
197
|
default:
|
|
198
198
|
return {
|
|
199
|
-
schema:
|
|
199
|
+
schema: z(),
|
|
200
200
|
value: void 0
|
|
201
201
|
};
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
|
-
},
|
|
204
|
+
}, ae = (t) => {
|
|
205
205
|
const e = {}, a = {};
|
|
206
206
|
if (t) {
|
|
207
|
-
const i =
|
|
207
|
+
const i = N(t);
|
|
208
208
|
i && (e[t.name] = i.schema, a[t.name] = i.value);
|
|
209
209
|
}
|
|
210
210
|
return t.conditions && t.conditions.forEach((i) => {
|
|
211
|
-
const l =
|
|
211
|
+
const l = N(i);
|
|
212
212
|
l && (e[i.name] = l.schema, a[i.name] = l.value);
|
|
213
|
-
}), { validationSchema:
|
|
214
|
-
},
|
|
213
|
+
}), { validationSchema: $().shape(e), initialValues: a };
|
|
214
|
+
}, j = (t) => {
|
|
215
215
|
if (typeof t == "string")
|
|
216
216
|
return t;
|
|
217
217
|
if (typeof t == "object" && ("from" in t || "to" in t))
|
|
@@ -221,54 +221,53 @@ const Y = (t) => {
|
|
|
221
221
|
};
|
|
222
222
|
for (const e in t)
|
|
223
223
|
if (Object.prototype.hasOwnProperty.call(t, e)) {
|
|
224
|
-
const a =
|
|
224
|
+
const a = j(t[e]);
|
|
225
225
|
if (a) return a;
|
|
226
226
|
}
|
|
227
227
|
return "";
|
|
228
|
-
},
|
|
229
|
-
var S;
|
|
228
|
+
}, re = (t) => {
|
|
230
229
|
const {
|
|
231
230
|
decision: e,
|
|
232
231
|
formik: a,
|
|
233
232
|
onChangeCondition: i,
|
|
234
233
|
onChangeDecision: l,
|
|
235
|
-
onStartChange:
|
|
234
|
+
onStartChange: c,
|
|
236
235
|
onEndChange: m,
|
|
237
|
-
textValues:
|
|
236
|
+
textValues: d,
|
|
238
237
|
onCancel: b,
|
|
239
238
|
onSubmit: C
|
|
240
|
-
} = t, [
|
|
239
|
+
} = t, [p, v] = x(!1), [w, S] = x(!0), T = {
|
|
241
240
|
name: e.name,
|
|
242
241
|
dataType: e.dataType,
|
|
243
|
-
value: e.value,
|
|
242
|
+
value: e.dataType === "percentage" ? Z(e.value) : e.value,
|
|
244
243
|
valueUse: e.valueUse,
|
|
245
244
|
possibleValue: e.possibleValue
|
|
246
245
|
};
|
|
247
|
-
|
|
246
|
+
q(() => {
|
|
248
247
|
console.log("Updated formik.errors in RulesFormUI:", a.errors);
|
|
249
248
|
}, [a.errors]);
|
|
250
|
-
const
|
|
249
|
+
const D = (r) => {
|
|
251
250
|
v(r.target.checked);
|
|
252
251
|
}, k = (r) => {
|
|
253
|
-
r.target.value ?
|
|
254
|
-
},
|
|
255
|
-
const
|
|
256
|
-
return typeof
|
|
257
|
-
},
|
|
258
|
-
const
|
|
259
|
-
return
|
|
252
|
+
r.target.value ? S(!1) : S(!0);
|
|
253
|
+
}, u = (r) => {
|
|
254
|
+
const h = j(a.errors[r] || {});
|
|
255
|
+
return typeof h == "string" ? h ? "invalid" : "pending" : h;
|
|
256
|
+
}, s = (r) => {
|
|
257
|
+
const h = j(a.errors[r] || {});
|
|
258
|
+
return h;
|
|
260
259
|
};
|
|
261
|
-
return /* @__PURE__ */
|
|
262
|
-
/* @__PURE__ */
|
|
263
|
-
/* @__PURE__ */ n(y, { weight: "bold", size: "medium", children:
|
|
260
|
+
return /* @__PURE__ */ g(o, { direction: "column", gap: "24px", children: [
|
|
261
|
+
/* @__PURE__ */ g(o, { direction: "column", gap: "16", children: [
|
|
262
|
+
/* @__PURE__ */ n(y, { weight: "bold", size: "medium", children: d.criteria }),
|
|
264
263
|
e && /* @__PURE__ */ n(
|
|
265
|
-
|
|
264
|
+
U,
|
|
266
265
|
{
|
|
267
266
|
element: T,
|
|
268
267
|
onDecision: l,
|
|
269
268
|
valueData: a.values[e.name],
|
|
270
269
|
message: a.errors[e.name],
|
|
271
|
-
status:
|
|
270
|
+
status: u(e.name),
|
|
272
271
|
textValues: {
|
|
273
272
|
selectOptions: "Select an option",
|
|
274
273
|
selectOption: "Option selected",
|
|
@@ -278,27 +277,27 @@ const Y = (t) => {
|
|
|
278
277
|
}
|
|
279
278
|
)
|
|
280
279
|
] }),
|
|
281
|
-
/* @__PURE__ */ n(
|
|
282
|
-
/* @__PURE__ */
|
|
283
|
-
/* @__PURE__ */
|
|
284
|
-
/* @__PURE__ */ n(y, { children:
|
|
280
|
+
/* @__PURE__ */ n(E, { dashed: !0 }),
|
|
281
|
+
/* @__PURE__ */ g(o, { direction: "column", children: [
|
|
282
|
+
/* @__PURE__ */ g(o, { direction: "row", gap: "16px", justifyContent: "space-between", children: [
|
|
283
|
+
/* @__PURE__ */ n(y, { children: d.factsThatConditionIt }),
|
|
285
284
|
/* @__PURE__ */ n(
|
|
286
|
-
|
|
285
|
+
P,
|
|
287
286
|
{
|
|
288
287
|
id: "toogleNone",
|
|
289
|
-
onChange:
|
|
290
|
-
checked:
|
|
288
|
+
onChange: D,
|
|
289
|
+
checked: p,
|
|
291
290
|
size: "small",
|
|
292
|
-
children: /* @__PURE__ */ n(y, { size: "medium", type: "label", weight: "bold", children:
|
|
291
|
+
children: /* @__PURE__ */ n(y, { size: "medium", type: "label", weight: "bold", children: d.none })
|
|
293
292
|
}
|
|
294
293
|
)
|
|
295
294
|
] }),
|
|
296
295
|
e.conditions && e.conditions.map((r) => /* @__PURE__ */ n(o, { direction: "column", children: /* @__PURE__ */ n(
|
|
297
|
-
|
|
296
|
+
ne,
|
|
298
297
|
{
|
|
299
|
-
checked: !
|
|
300
|
-
handleToggleChange: (
|
|
301
|
-
|
|
298
|
+
checked: !p,
|
|
299
|
+
handleToggleChange: (h) => {
|
|
300
|
+
h.target.checked || i(
|
|
302
301
|
{
|
|
303
302
|
value: "",
|
|
304
303
|
to: 0,
|
|
@@ -312,119 +311,119 @@ const Y = (t) => {
|
|
|
312
311
|
labelToggle: r.name.split(/(?=[A-Z])/).join(" "),
|
|
313
312
|
name: r.name.replace(" ", ""),
|
|
314
313
|
children: /* @__PURE__ */ n(
|
|
315
|
-
|
|
314
|
+
U,
|
|
316
315
|
{
|
|
317
316
|
element: r,
|
|
318
317
|
onDecision: i,
|
|
319
318
|
valueData: a.values[r.name],
|
|
320
|
-
message:
|
|
321
|
-
status:
|
|
319
|
+
message: s(r.name),
|
|
320
|
+
status: u(r.name),
|
|
322
321
|
textValues: {
|
|
323
322
|
selectOptions: "Select an option",
|
|
324
323
|
selectOption: "Option selected",
|
|
325
|
-
rangeMin: (
|
|
326
|
-
rangeMax: (
|
|
324
|
+
rangeMin: (h) => `Minimum ${h}`,
|
|
325
|
+
rangeMax: (h) => `Maximum ${h}`
|
|
327
326
|
}
|
|
328
327
|
}
|
|
329
328
|
)
|
|
330
329
|
}
|
|
331
330
|
) }, r.name))
|
|
332
331
|
] }),
|
|
333
|
-
/* @__PURE__ */ n(
|
|
332
|
+
/* @__PURE__ */ n(E, { dashed: !0 }),
|
|
334
333
|
/* @__PURE__ */ n(o, { direction: "column", children: /* @__PURE__ */ n(
|
|
335
|
-
|
|
334
|
+
ee,
|
|
336
335
|
{
|
|
337
|
-
label:
|
|
338
|
-
labelText:
|
|
336
|
+
label: d.reasonForChange,
|
|
337
|
+
labelText: d.change,
|
|
339
338
|
onHandleChange: k,
|
|
340
|
-
placeholder:
|
|
339
|
+
placeholder: d.changePlaceholder,
|
|
341
340
|
required: !0
|
|
342
341
|
}
|
|
343
342
|
) }),
|
|
344
|
-
/* @__PURE__ */ n(
|
|
343
|
+
/* @__PURE__ */ n(E, { dashed: !0 }),
|
|
345
344
|
/* @__PURE__ */ n(o, { direction: "column", children: e && /* @__PURE__ */ n(
|
|
346
|
-
|
|
345
|
+
te,
|
|
347
346
|
{
|
|
348
|
-
onHandleStartChange: (r) =>
|
|
347
|
+
onHandleStartChange: (r) => c(r.target.value),
|
|
349
348
|
onHandleEndChange: (r) => m(r.target.value),
|
|
350
|
-
labelStart:
|
|
351
|
-
labelEnd:
|
|
349
|
+
labelStart: d.termStart,
|
|
350
|
+
labelEnd: d.termEnd,
|
|
352
351
|
checkedClosed: !!e.endDate,
|
|
353
|
-
valueStart: e.startDate
|
|
354
|
-
valueEnd: (
|
|
352
|
+
valueStart: String(e.startDate),
|
|
353
|
+
valueEnd: String(e.endDate) || ""
|
|
355
354
|
}
|
|
356
355
|
) }),
|
|
357
|
-
/* @__PURE__ */ n(
|
|
358
|
-
/* @__PURE__ */
|
|
359
|
-
/* @__PURE__ */ n(
|
|
356
|
+
/* @__PURE__ */ n(E, { dashed: !0 }),
|
|
357
|
+
/* @__PURE__ */ g(o, { direction: "row", justifyContent: "end", gap: "16px", children: [
|
|
358
|
+
/* @__PURE__ */ n(M, { appearance: "gray", onClick: b, children: d.cancel }),
|
|
360
359
|
/* @__PURE__ */ n(
|
|
361
|
-
|
|
360
|
+
M,
|
|
362
361
|
{
|
|
363
362
|
onClick: C,
|
|
364
|
-
disabled:
|
|
363
|
+
disabled: w || !a.isValid,
|
|
365
364
|
type: "submit",
|
|
366
|
-
children:
|
|
365
|
+
children: d.confirm
|
|
367
366
|
}
|
|
368
367
|
)
|
|
369
368
|
] })
|
|
370
369
|
] });
|
|
371
|
-
},
|
|
372
|
-
const { id: e, decision: a, onCancel: i, onSubmitEvent: l, textValues:
|
|
373
|
-
|
|
374
|
-
}, C = (
|
|
375
|
-
const
|
|
376
|
-
|
|
377
|
-
if (!
|
|
378
|
-
return
|
|
379
|
-
const
|
|
370
|
+
}, ke = (t) => {
|
|
371
|
+
const { id: e, decision: a, onCancel: i, onSubmitEvent: l, textValues: c } = t, [m, d] = x(a), b = (u, s) => {
|
|
372
|
+
D.setFieldValue(u, s), D.validateField(u);
|
|
373
|
+
}, C = (u, s) => {
|
|
374
|
+
const r = u instanceof Date ? u.toISOString() : u;
|
|
375
|
+
d((h) => {
|
|
376
|
+
if (!h.conditions)
|
|
377
|
+
return h;
|
|
378
|
+
const G = h.conditions.map((A) => A.name === s ? { ...A, value: r } : A);
|
|
380
379
|
return {
|
|
381
|
-
...
|
|
382
|
-
conditions:
|
|
380
|
+
...h,
|
|
381
|
+
conditions: G
|
|
383
382
|
};
|
|
384
|
-
}), b(
|
|
385
|
-
},
|
|
386
|
-
|
|
387
|
-
(
|
|
388
|
-
) : console.warn("Invalid type for value:", c);
|
|
389
|
-
}, v = (c) => {
|
|
390
|
-
u(
|
|
391
|
-
(d) => k(d, "endDate", new Date(c))
|
|
383
|
+
}), b(s, r);
|
|
384
|
+
}, p = (u) => {
|
|
385
|
+
d(
|
|
386
|
+
(s) => k(s, "value", u)
|
|
392
387
|
);
|
|
393
|
-
},
|
|
394
|
-
|
|
395
|
-
(
|
|
388
|
+
}, v = (u) => {
|
|
389
|
+
d(
|
|
390
|
+
(s) => k(s, "endDate", u)
|
|
396
391
|
);
|
|
397
|
-
},
|
|
398
|
-
|
|
399
|
-
|
|
392
|
+
}, w = (u) => {
|
|
393
|
+
d(
|
|
394
|
+
(s) => k(s, "startDate", u)
|
|
395
|
+
);
|
|
396
|
+
}, { validationSchema: S, initialValues: T } = ae(m);
|
|
397
|
+
S.validate(T, { abortEarly: !1 }).then(() => console.log("Validation passed")).catch((u) => console.log("Validation failed:", u.errors));
|
|
398
|
+
const D = Q({
|
|
400
399
|
initialValues: T,
|
|
401
|
-
validationSchema:
|
|
400
|
+
validationSchema: S,
|
|
402
401
|
validateOnChange: !0,
|
|
403
402
|
validateOnBlur: !0,
|
|
404
403
|
onSubmit: () => {
|
|
405
404
|
l(m);
|
|
406
405
|
}
|
|
407
|
-
}), k = (
|
|
408
|
-
...
|
|
409
|
-
...
|
|
410
|
-
[
|
|
406
|
+
}), k = (u, s, r) => ({
|
|
407
|
+
...u,
|
|
408
|
+
...u.decision,
|
|
409
|
+
[s]: r
|
|
411
410
|
});
|
|
412
411
|
return /* @__PURE__ */ n(
|
|
413
|
-
|
|
412
|
+
re,
|
|
414
413
|
{
|
|
415
414
|
id: e,
|
|
416
|
-
formik:
|
|
415
|
+
formik: D,
|
|
417
416
|
decision: m,
|
|
418
417
|
onCancel: i,
|
|
419
418
|
onSubmit: () => l(m),
|
|
420
419
|
onChangeCondition: C,
|
|
421
|
-
onChangeDecision:
|
|
422
|
-
onStartChange:
|
|
420
|
+
onChangeDecision: p,
|
|
421
|
+
onStartChange: w,
|
|
423
422
|
onEndChange: v,
|
|
424
|
-
textValues:
|
|
423
|
+
textValues: c
|
|
425
424
|
}
|
|
426
425
|
);
|
|
427
|
-
},
|
|
426
|
+
}, _ = (t) => {
|
|
428
427
|
if (!t)
|
|
429
428
|
return;
|
|
430
429
|
const e = t.value;
|
|
@@ -446,44 +445,44 @@ const Y = (t) => {
|
|
|
446
445
|
}
|
|
447
446
|
return e;
|
|
448
447
|
}, we = (t) => {
|
|
449
|
-
const { decision: e, textValues: a } = t, i = (
|
|
448
|
+
const { decision: e, textValues: a } = t, i = (c) => c && Object.keys(c).length > 0, l = {
|
|
450
449
|
name: e.name,
|
|
451
450
|
dataType: e.dataType,
|
|
452
451
|
value: e.value,
|
|
453
452
|
valueUse: e.valueUse
|
|
454
453
|
};
|
|
455
|
-
return /* @__PURE__ */
|
|
456
|
-
/* @__PURE__ */
|
|
454
|
+
return /* @__PURE__ */ g(o, { direction: "column", gap: "24px", children: [
|
|
455
|
+
/* @__PURE__ */ g(o, { direction: "column", gap: "16px", children: [
|
|
457
456
|
/* @__PURE__ */ n(y, { type: "title", size: "medium", appearance: "gray", weight: "bold", children: a.criteria }),
|
|
458
457
|
/* @__PURE__ */ n(o, { justifyContent: "space-between", children: e && /* @__PURE__ */ n(o, { direction: "column", children: /* @__PURE__ */ n(
|
|
459
|
-
|
|
458
|
+
V,
|
|
460
459
|
{
|
|
461
460
|
element: l,
|
|
462
|
-
valueData:
|
|
461
|
+
valueData: _(l)
|
|
463
462
|
}
|
|
464
463
|
) }, e.name) })
|
|
465
464
|
] }),
|
|
466
|
-
/* @__PURE__ */
|
|
465
|
+
/* @__PURE__ */ g(o, { direction: "column", gap: "16px", justifyContent: "space-between", children: [
|
|
467
466
|
/* @__PURE__ */ n(y, { type: "title", size: "medium", appearance: "gray", weight: "bold", children: a.factsThatConditionIt }),
|
|
468
|
-
e.conditions && e.conditions.map((
|
|
469
|
-
const m =
|
|
467
|
+
e.conditions && e.conditions.map((c) => {
|
|
468
|
+
const m = c.value;
|
|
470
469
|
return (typeof m == "object" && i(m) || m) && /* @__PURE__ */ n(o, { direction: "column", children: /* @__PURE__ */ n(
|
|
471
|
-
|
|
470
|
+
V,
|
|
472
471
|
{
|
|
473
472
|
element: {
|
|
474
|
-
...
|
|
473
|
+
...c,
|
|
475
474
|
value: m
|
|
476
475
|
},
|
|
477
|
-
valueData:
|
|
476
|
+
valueData: _(c)
|
|
478
477
|
}
|
|
479
|
-
) },
|
|
478
|
+
) }, c.name);
|
|
480
479
|
})
|
|
481
480
|
] }),
|
|
482
|
-
/* @__PURE__ */
|
|
481
|
+
/* @__PURE__ */ g(o, { direction: "column", gap: "12px", children: [
|
|
483
482
|
/* @__PURE__ */ n(y, { type: "title", size: "medium", appearance: "gray", weight: "bold", children: a.terms }),
|
|
484
|
-
/* @__PURE__ */
|
|
483
|
+
/* @__PURE__ */ g(o, { justifyContent: "space-between", children: [
|
|
485
484
|
(e == null ? void 0 : e.startDate) && /* @__PURE__ */ n(
|
|
486
|
-
|
|
485
|
+
V,
|
|
487
486
|
{
|
|
488
487
|
element: {
|
|
489
488
|
name: "Fecha de inicio",
|
|
@@ -498,7 +497,7 @@ const Y = (t) => {
|
|
|
498
497
|
"startDate"
|
|
499
498
|
),
|
|
500
499
|
(e == null ? void 0 : e.endDate) && /* @__PURE__ */ n(
|
|
501
|
-
|
|
500
|
+
V,
|
|
502
501
|
{
|
|
503
502
|
element: {
|
|
504
503
|
name: "Fecha de final",
|
|
@@ -513,16 +512,16 @@ const Y = (t) => {
|
|
|
513
512
|
] })
|
|
514
513
|
] })
|
|
515
514
|
] });
|
|
516
|
-
},
|
|
515
|
+
}, oe = B.div`
|
|
517
516
|
border-radius: 8px;
|
|
518
|
-
border: 1px solid ${
|
|
517
|
+
border: 1px solid ${Y.palette.neutral.N30};
|
|
519
518
|
box-sizing: border-box;
|
|
520
519
|
display: flex;
|
|
521
520
|
flex-direction: column;
|
|
522
521
|
height: 340px;
|
|
523
522
|
width: 332px;
|
|
524
523
|
box-shadow: 0px 4px 8px 3px rgba(0, 0, 0, 0.1);
|
|
525
|
-
`,
|
|
524
|
+
`, ie = B.div`
|
|
526
525
|
width: 100%;
|
|
527
526
|
height: 100%;
|
|
528
527
|
overflow-y: auto;
|
|
@@ -540,32 +539,32 @@ const Y = (t) => {
|
|
|
540
539
|
background-color: #ebecf0;
|
|
541
540
|
border-radius: 8px;
|
|
542
541
|
}
|
|
543
|
-
`,
|
|
542
|
+
`, Ee = (t) => {
|
|
544
543
|
const { children: e, handleDelete: a, handleView: i, id: l } = t;
|
|
545
|
-
return /* @__PURE__ */
|
|
546
|
-
/* @__PURE__ */ n(o, { height: "282px", gap: "24px", direction: "column", children: /* @__PURE__ */ n(
|
|
547
|
-
/* @__PURE__ */
|
|
548
|
-
/* @__PURE__ */ n(
|
|
549
|
-
/* @__PURE__ */
|
|
544
|
+
return /* @__PURE__ */ g(oe, { children: [
|
|
545
|
+
/* @__PURE__ */ n(o, { height: "282px", gap: "24px", direction: "column", children: /* @__PURE__ */ n(ie, { children: /* @__PURE__ */ n(o, { direction: "column", margin: "10px", children: e }) }) }),
|
|
546
|
+
/* @__PURE__ */ g(o, { gap: "16px", direction: "column", margin: "2px 12px", children: [
|
|
547
|
+
/* @__PURE__ */ n(E, {}),
|
|
548
|
+
/* @__PURE__ */ g(o, { gap: "16px", justifyContent: "end", children: [
|
|
550
549
|
/* @__PURE__ */ n(
|
|
551
|
-
|
|
550
|
+
I,
|
|
552
551
|
{
|
|
553
552
|
appearance: "dark",
|
|
554
553
|
size: "24px",
|
|
555
554
|
cursorHover: !0,
|
|
556
|
-
icon: /* @__PURE__ */ n(
|
|
555
|
+
icon: /* @__PURE__ */ n(W, {}),
|
|
557
556
|
onClick: () => {
|
|
558
557
|
i(l);
|
|
559
558
|
}
|
|
560
559
|
}
|
|
561
560
|
),
|
|
562
561
|
/* @__PURE__ */ n(
|
|
563
|
-
|
|
562
|
+
I,
|
|
564
563
|
{
|
|
565
564
|
cursorHover: !0,
|
|
566
565
|
appearance: "dark",
|
|
567
566
|
size: "24px",
|
|
568
|
-
icon: /* @__PURE__ */ n(
|
|
567
|
+
icon: /* @__PURE__ */ n(X, {}),
|
|
569
568
|
onClick: () => {
|
|
570
569
|
a(l);
|
|
571
570
|
}
|
|
@@ -576,7 +575,7 @@ const Y = (t) => {
|
|
|
576
575
|
] });
|
|
577
576
|
};
|
|
578
577
|
export {
|
|
579
|
-
|
|
578
|
+
Ee as BusinessRuleCard,
|
|
580
579
|
we as BusinessRuleView,
|
|
581
|
-
|
|
580
|
+
ke as RulesForm
|
|
582
581
|
};
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
],
|
|
11
11
|
"description": "",
|
|
12
12
|
"private": false,
|
|
13
|
-
"version": "0.1.
|
|
13
|
+
"version": "0.1.16",
|
|
14
14
|
"type": "module",
|
|
15
15
|
"exports": {
|
|
16
16
|
".": {
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@inubekit/text": "^2.17.0",
|
|
49
49
|
"@inubekit/textarea": "^2.45.0",
|
|
50
50
|
"@inubekit/toggle": "^3.8.2",
|
|
51
|
-
"@isettingkit/input": "^0.1.
|
|
51
|
+
"@isettingkit/input": "^0.1.24",
|
|
52
52
|
"@isettingkit/view": "^0.1.13"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|