@oliasoft-open-source/react-ui-library 5.7.0-beta-8 → 5.7.0-beta-10
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/global.css +1 -1
- package/dist/index.js +90 -35
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6569,7 +6569,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6569
6569
|
} : {
|
|
6570
6570
|
value: G,
|
|
6571
6571
|
unit: U
|
|
6572
|
-
}),
|
|
6572
|
+
}), Od = k || K?.value === void 0, [J, kd] = useState(w ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM), Ad = !!(O || n), Y = C && C.find((e) => {
|
|
6573
6573
|
if (!e?.value) return;
|
|
6574
6574
|
if (E) return E === e.valueKey;
|
|
6575
6575
|
let t = isValueWithUnit(e.value) ? getUnit(e.value) : "", { value: n = l } = convertUnit({
|
|
@@ -6578,7 +6578,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6578
6578
|
toUnit: t
|
|
6579
6579
|
});
|
|
6580
6580
|
return withUnit(n, t) === e.value;
|
|
6581
|
-
}),
|
|
6581
|
+
}), jd = () => {
|
|
6582
6582
|
let e = l ?? "", t = K.unit;
|
|
6583
6583
|
if (checkConversion({
|
|
6584
6584
|
value: e,
|
|
@@ -6592,7 +6592,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6592
6592
|
return null;
|
|
6593
6593
|
}
|
|
6594
6594
|
} else return getAltUnitsListByQuantity(u)?.map((e) => ["", e?.unit]);
|
|
6595
|
-
},
|
|
6595
|
+
}, Md = (t) => {
|
|
6596
6596
|
let n = getStringName(e), r = t.target, { value: i, selectionStart: a } = r, o = withUnit(i, K?.unit || ""), s = A ? withUnit(convertAndGetValue(o, B), B) : o;
|
|
6597
6597
|
h({ target: {
|
|
6598
6598
|
value: s,
|
|
@@ -6605,7 +6605,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6605
6605
|
}), R(() => {
|
|
6606
6606
|
r.selectionStart = a, r.selectionEnd = a;
|
|
6607
6607
|
});
|
|
6608
|
-
},
|
|
6608
|
+
}, Nd = (e, t) => {
|
|
6609
6609
|
t === K.unit || isNaN(Number(e)) || (q({
|
|
6610
6610
|
value: e,
|
|
6611
6611
|
unit: t
|
|
@@ -6636,7 +6636,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6636
6636
|
e !== void 0 && q({
|
|
6637
6637
|
value: e,
|
|
6638
6638
|
unit: t
|
|
6639
|
-
}), C &&
|
|
6639
|
+
}), C && kd(Y && T ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM);
|
|
6640
6640
|
}
|
|
6641
6641
|
}, [
|
|
6642
6642
|
U,
|
|
@@ -6644,7 +6644,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6644
6644
|
i,
|
|
6645
6645
|
T
|
|
6646
6646
|
]);
|
|
6647
|
-
let X =
|
|
6647
|
+
let X = jd(), Z = label(K.unit) || K.unit || "", Pd = p || !X || X && X.length === 1, Q = getStringName(e), $, Fd = (t) => {
|
|
6648
6648
|
let r = t?.value ? t.value : "", [i = "", a = ""] = isValueWithUnit(r) ? split(r) : [r], o = withPrettyUnitLabel(r);
|
|
6649
6649
|
if (checkConversion({
|
|
6650
6650
|
value: r,
|
|
@@ -6664,7 +6664,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6664
6664
|
type: MenuType.OPTION,
|
|
6665
6665
|
inline: !0,
|
|
6666
6666
|
onClick: () => {
|
|
6667
|
-
validateNumber(i).valid && !n && (
|
|
6667
|
+
validateNumber(i).valid && !n && (kd(PredefinedOptionsMenuState.PREDEFINED), h({ target: {
|
|
6668
6668
|
value: r,
|
|
6669
6669
|
name: typeof e == "string" ? e : e?.fieldName || "",
|
|
6670
6670
|
predefinedSelected: !0,
|
|
@@ -6691,10 +6691,10 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6691
6691
|
label: "Custom",
|
|
6692
6692
|
selected: J === PredefinedOptionsMenuState.CUSTOM
|
|
6693
6693
|
}], C?.length) {
|
|
6694
|
-
let e = C.map(
|
|
6694
|
+
let e = C.map(Fd);
|
|
6695
6695
|
$ = [...$, ...e];
|
|
6696
6696
|
}
|
|
6697
|
-
let
|
|
6697
|
+
let Id = (e) => {
|
|
6698
6698
|
if (isValueWithUnit(e)) {
|
|
6699
6699
|
let t = getUnit(e), { value: n } = safeConvertValue({
|
|
6700
6700
|
value: e,
|
|
@@ -6706,7 +6706,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6706
6706
|
return n;
|
|
6707
6707
|
}
|
|
6708
6708
|
return e;
|
|
6709
|
-
},
|
|
6709
|
+
}, Ld = !C && (!F || F === GroupOrder.FIRST) ? GroupOrder.FIRST : GroupOrder.MIDDLE, Rd = !F || F === GroupOrder.LAST ? GroupOrder.LAST : GroupOrder.MIDDLE;
|
|
6710
6710
|
return /* @__PURE__ */ jsx("div", {
|
|
6711
6711
|
className: J === PredefinedOptionsMenuState.PREDEFINED ? cx(unit_input_module_default.predefinedMenuActive) : "",
|
|
6712
6712
|
children: /* @__PURE__ */ jsxs(InputGroup, {
|
|
@@ -6738,31 +6738,31 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6738
6738
|
name: Q,
|
|
6739
6739
|
testId: x,
|
|
6740
6740
|
disabled: n,
|
|
6741
|
-
placeholder:
|
|
6741
|
+
placeholder: Id(t),
|
|
6742
6742
|
value: K.value,
|
|
6743
|
-
onChange:
|
|
6743
|
+
onChange: Md,
|
|
6744
6744
|
onFocus: v,
|
|
6745
6745
|
error: i === null ? void 0 : i,
|
|
6746
6746
|
warning: S === null ? void 0 : S,
|
|
6747
6747
|
left: a,
|
|
6748
|
-
allowEmpty:
|
|
6748
|
+
allowEmpty: Od,
|
|
6749
6749
|
validationCallback: (e, t) => D(Q, t),
|
|
6750
6750
|
enableCosmeticRounding: j,
|
|
6751
6751
|
enableDisplayRounding: M,
|
|
6752
6752
|
roundDisplayValue: N,
|
|
6753
|
-
groupOrder:
|
|
6754
|
-
disableInternalErrorValidationMessages:
|
|
6753
|
+
groupOrder: Ld,
|
|
6754
|
+
disableInternalErrorValidationMessages: Ad,
|
|
6755
6755
|
small: o,
|
|
6756
6756
|
selectOnFocus: P,
|
|
6757
6757
|
tooltip: I
|
|
6758
6758
|
}, Q)
|
|
6759
6759
|
}),
|
|
6760
|
-
Z && (
|
|
6761
|
-
groupOrder:
|
|
6760
|
+
Z && (Pd || !H ? /* @__PURE__ */ jsx(InputGroupAddon, {
|
|
6761
|
+
groupOrder: Rd,
|
|
6762
6762
|
small: o,
|
|
6763
6763
|
children: Z
|
|
6764
6764
|
}) : /* @__PURE__ */ jsx(Menu, {
|
|
6765
|
-
groupOrder:
|
|
6765
|
+
groupOrder: Rd,
|
|
6766
6766
|
maxHeight: 380,
|
|
6767
6767
|
disabled: r,
|
|
6768
6768
|
testId: x && `${x}-menu`,
|
|
@@ -6778,7 +6778,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6778
6778
|
label: j ? safeRoundNumbers(i) : i,
|
|
6779
6779
|
inline: !0,
|
|
6780
6780
|
onClick: (n) => {
|
|
6781
|
-
n.stopPropagation(),
|
|
6781
|
+
n.stopPropagation(), Nd(e, t);
|
|
6782
6782
|
},
|
|
6783
6783
|
description: r,
|
|
6784
6784
|
selected: r === Z,
|
|
@@ -8316,7 +8316,56 @@ const createDiffPatcher = (e = {}) => create({
|
|
|
8316
8316
|
minLength: 120
|
|
8317
8317
|
},
|
|
8318
8318
|
cloneDiffValues: !0
|
|
8319
|
-
}),
|
|
8319
|
+
}), defaultMessage = (e) => {
|
|
8320
|
+
switch (e.length) {
|
|
8321
|
+
case 1: {
|
|
8322
|
+
let [t] = e;
|
|
8323
|
+
return {
|
|
8324
|
+
type: "Created",
|
|
8325
|
+
before: "",
|
|
8326
|
+
after: String(t)
|
|
8327
|
+
};
|
|
8328
|
+
}
|
|
8329
|
+
case 2: {
|
|
8330
|
+
let [t, n] = e;
|
|
8331
|
+
return {
|
|
8332
|
+
type: "Modified",
|
|
8333
|
+
before: String(t),
|
|
8334
|
+
after: String(n)
|
|
8335
|
+
};
|
|
8336
|
+
}
|
|
8337
|
+
case 3: {
|
|
8338
|
+
let [t] = e;
|
|
8339
|
+
return {
|
|
8340
|
+
type: "Deleted",
|
|
8341
|
+
before: String(t),
|
|
8342
|
+
after: ""
|
|
8343
|
+
};
|
|
8344
|
+
}
|
|
8345
|
+
default: return {
|
|
8346
|
+
type: "Modified",
|
|
8347
|
+
before: "",
|
|
8348
|
+
after: ""
|
|
8349
|
+
};
|
|
8350
|
+
}
|
|
8351
|
+
}, ChangesOverview = ({ diffs: e }) => {
|
|
8352
|
+
let t = {
|
|
8353
|
+
headers: [{ cells: [
|
|
8354
|
+
{ value: "Tpye" },
|
|
8355
|
+
{ value: "Before" },
|
|
8356
|
+
{ value: "After" }
|
|
8357
|
+
] }],
|
|
8358
|
+
rows: e.map((e) => {
|
|
8359
|
+
let { deltaFormat: t } = e, { type: n, before: r, after: i } = defaultMessage(t);
|
|
8360
|
+
return { cells: [
|
|
8361
|
+
{ value: n },
|
|
8362
|
+
{ value: r },
|
|
8363
|
+
{ value: i }
|
|
8364
|
+
] };
|
|
8365
|
+
})
|
|
8366
|
+
};
|
|
8367
|
+
return /* @__PURE__ */ jsx(Table, { table: t });
|
|
8368
|
+
}, viewTypes = Object.freeze({
|
|
8320
8369
|
summary: {
|
|
8321
8370
|
label: "Summary",
|
|
8322
8371
|
value: "summary"
|
|
@@ -8326,7 +8375,17 @@ const createDiffPatcher = (e = {}) => create({
|
|
|
8326
8375
|
value: "compare"
|
|
8327
8376
|
}
|
|
8328
8377
|
});
|
|
8329
|
-
var jsondiffpatcher = createDiffPatcher(), isDeltaArray = (e) => Array.isArray(e), unpatchWith = (e, t) => t ? isDeltaArray(t) ? t.length === 0 ? e : t.reduce((e, t) => jsondiffpatcher.unpatch(cloneDeep(e), cloneDeep(t)), cloneDeep(e)) : jsondiffpatcher.unpatch(cloneDeep(e), cloneDeep(t)) : e
|
|
8378
|
+
var jsondiffpatcher = createDiffPatcher(), isDeltaArray = (e) => Array.isArray(e), unpatchWith = (e, t) => t ? isDeltaArray(t) ? t.length === 0 ? e : t.reduce((e, t) => jsondiffpatcher.unpatch(cloneDeep(e), cloneDeep(t)), cloneDeep(e)) : jsondiffpatcher.unpatch(cloneDeep(e), cloneDeep(t)) : e, transformDiffs = (e) => {
|
|
8379
|
+
let t = ["user", "unittemplate"], n = [], r = [], i = (e) => {
|
|
8380
|
+
e && Object.keys(e).forEach((a) => {
|
|
8381
|
+
t.includes(a) || (r.push(a), isArray(e[a]) ? n.push({
|
|
8382
|
+
deltaFormat: [...e[a]],
|
|
8383
|
+
path: [...r]
|
|
8384
|
+
}) : isObject(e[a]) && i(e[a]), r.pop());
|
|
8385
|
+
});
|
|
8386
|
+
};
|
|
8387
|
+
return e ? (i(e), n) : [];
|
|
8388
|
+
};
|
|
8330
8389
|
const createDiffJson = (e, t, n) => {
|
|
8331
8390
|
let r = t.filter((t) => !!t.diffs && t.createdAt >= e.createdAt), i = Array(r.length + 1);
|
|
8332
8391
|
i[0] = cloneDeep(n);
|
|
@@ -8357,25 +8416,21 @@ var comparison_view_modal_default = ({ auditLog: e, auditLogs: t, data: n, isOpe
|
|
|
8357
8416
|
label: e,
|
|
8358
8417
|
value: t
|
|
8359
8418
|
})), [s, c] = useState(o[0]), { oldJson: l, newJson: u } = createDiffJson(e, t, n);
|
|
8360
|
-
return console.log("React gui library:", l, u), /* @__PURE__ */ jsx(Modal, {
|
|
8419
|
+
return console.log(typeof l, typeof u), console.log("React gui library:", l, u), /* @__PURE__ */ jsx(Modal, {
|
|
8361
8420
|
visible: r,
|
|
8362
8421
|
centered: !0,
|
|
8363
8422
|
children: /* @__PURE__ */ jsx(Dialog, { dialog: {
|
|
8364
8423
|
scroll: !0,
|
|
8365
8424
|
heading: "Comparison view",
|
|
8366
|
-
content: /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
8367
|
-
|
|
8368
|
-
|
|
8369
|
-
|
|
8370
|
-
|
|
8371
|
-
|
|
8372
|
-
|
|
8373
|
-
|
|
8374
|
-
|
|
8375
|
-
oldJson: l,
|
|
8376
|
-
newJson: u
|
|
8377
|
-
})
|
|
8378
|
-
] }),
|
|
8425
|
+
content: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Tabs, {
|
|
8426
|
+
name: "ViewTab",
|
|
8427
|
+
onChange: (e) => c(o.find((t) => t.value === e.target.value)),
|
|
8428
|
+
options: o,
|
|
8429
|
+
value: s
|
|
8430
|
+
}), s.value === "summary" ? /* @__PURE__ */ jsx(ChangesOverview, { diffs: transformDiffs(a) }) : /* @__PURE__ */ jsx(DiffViewer, {
|
|
8431
|
+
oldJson: l,
|
|
8432
|
+
newJson: u
|
|
8433
|
+
})] }),
|
|
8379
8434
|
footer: /* @__PURE__ */ jsx(Button, {
|
|
8380
8435
|
label: "Cancel",
|
|
8381
8436
|
onClick: i
|
package/package.json
CHANGED