@oliasoft-open-source/react-ui-library 5.7.0-beta-1 → 5.7.0-beta-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.d.ts +3 -1
- package/dist/index.js +84 -21
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -41,7 +41,7 @@ export declare interface AuditLogItem {
|
|
|
41
41
|
operation: AuditLogOperation;
|
|
42
42
|
source: AuditLogSource;
|
|
43
43
|
createdAt: string;
|
|
44
|
-
diffs:
|
|
44
|
+
diffs: JsonDelta | JsonDelta[];
|
|
45
45
|
operationMetaData?: string;
|
|
46
46
|
}
|
|
47
47
|
|
|
@@ -1843,6 +1843,8 @@ export declare interface IUnitTableRow extends Omit<TRowType, 'cells'> {
|
|
|
1843
1843
|
declare interface IUnitTableStaticCell extends IStaticCell, IUnitTableCell {
|
|
1844
1844
|
}
|
|
1845
1845
|
|
|
1846
|
+
declare type JsonDelta = Record<string, any>;
|
|
1847
|
+
|
|
1846
1848
|
export declare const Label: ({ label, width, helpText, helpTextMaxWidth, onClickHelp, lock, info, libraryIcon, labelLeft, textTransform, }: ILabelProps) => JSX_2.Element;
|
|
1847
1849
|
|
|
1848
1850
|
export declare const List: ({ list, bordered, expanding, narrow, toggleNarrow, onToggleNarrow, invokeEditOnRowClick, noHeader, stickyHeader, draggable, onListReorder, marginBottom, height, testId, scrollDetails, }: IListProps) => JSX_2.Element;
|
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
|
+
}), ku = k || K?.value === void 0, [J, Au] = useState(w ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM), ju = !!(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
|
+
}), Mu = () => {
|
|
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
|
+
}, Nu = (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
|
+
}, Pu = (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 && Au(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 = Mu(), Z = label(K.unit) || K.unit || "", Fu = p || !X || X && X.length === 1, Q = getStringName(e), $, Iu = (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 && (Au(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(Iu);
|
|
6695
6695
|
$ = [...$, ...e];
|
|
6696
6696
|
}
|
|
6697
|
-
let
|
|
6697
|
+
let Lu = (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
|
+
}, Ru = !C && (!F || F === GroupOrder.FIRST) ? GroupOrder.FIRST : GroupOrder.MIDDLE, zu = !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: Lu(t),
|
|
6742
6742
|
value: K.value,
|
|
6743
|
-
onChange:
|
|
6743
|
+
onChange: Nu,
|
|
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: ku,
|
|
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: Ru,
|
|
6754
|
+
disableInternalErrorValidationMessages: ju,
|
|
6755
6755
|
small: o,
|
|
6756
6756
|
selectOnFocus: P,
|
|
6757
6757
|
tooltip: I
|
|
6758
6758
|
}, Q)
|
|
6759
6759
|
}),
|
|
6760
|
-
Z && (
|
|
6761
|
-
groupOrder:
|
|
6760
|
+
Z && (Fu || !H ? /* @__PURE__ */ jsx(InputGroupAddon, {
|
|
6761
|
+
groupOrder: zu,
|
|
6762
6762
|
small: o,
|
|
6763
6763
|
children: Z
|
|
6764
6764
|
}) : /* @__PURE__ */ jsx(Menu, {
|
|
6765
|
-
groupOrder:
|
|
6765
|
+
groupOrder: zu,
|
|
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(), Pu(e, t);
|
|
6782
6782
|
},
|
|
6783
6783
|
description: r,
|
|
6784
6784
|
selected: r === Z,
|
|
@@ -7070,6 +7070,68 @@ function formatDate({ date: e, showTime: t, showSeconds: n, timeZone: r, showTim
|
|
|
7070
7070
|
timeZoneName: i ? "short" : void 0
|
|
7071
7071
|
}) : null;
|
|
7072
7072
|
}
|
|
7073
|
+
var isObj = (e) => !!e && typeof e == "object" && !Array.isArray(e), countOne = (e) => {
|
|
7074
|
+
let t = {
|
|
7075
|
+
total: 0,
|
|
7076
|
+
added: 0,
|
|
7077
|
+
removed: 0,
|
|
7078
|
+
modified: 0,
|
|
7079
|
+
moved: 0,
|
|
7080
|
+
text: 0
|
|
7081
|
+
}, n = (e) => {
|
|
7082
|
+
if (Array.isArray(e)) {
|
|
7083
|
+
let n = e[0];
|
|
7084
|
+
if (typeof n == "string" && n.startsWith("@@")) {
|
|
7085
|
+
t.text++, t.total++;
|
|
7086
|
+
return;
|
|
7087
|
+
}
|
|
7088
|
+
if (e.length === 1) {
|
|
7089
|
+
t.added++, t.total++;
|
|
7090
|
+
return;
|
|
7091
|
+
}
|
|
7092
|
+
if (e.length === 2) {
|
|
7093
|
+
t.modified++, t.total++;
|
|
7094
|
+
return;
|
|
7095
|
+
}
|
|
7096
|
+
if (e.length === 3) {
|
|
7097
|
+
let n = e[2];
|
|
7098
|
+
if (n === 0) {
|
|
7099
|
+
t.removed++, t.total++;
|
|
7100
|
+
return;
|
|
7101
|
+
}
|
|
7102
|
+
if (n === 3) {
|
|
7103
|
+
t.moved++, t.total++;
|
|
7104
|
+
return;
|
|
7105
|
+
}
|
|
7106
|
+
t.modified++, t.total++;
|
|
7107
|
+
return;
|
|
7108
|
+
}
|
|
7109
|
+
t.modified++, t.total++;
|
|
7110
|
+
return;
|
|
7111
|
+
}
|
|
7112
|
+
if (isObj(e)) {
|
|
7113
|
+
if (e._t === "a") {
|
|
7114
|
+
for (let t in e) t !== "_t" && n(e[t]);
|
|
7115
|
+
return;
|
|
7116
|
+
}
|
|
7117
|
+
for (let t in e) n(e[t]);
|
|
7118
|
+
}
|
|
7119
|
+
};
|
|
7120
|
+
return n(e), t;
|
|
7121
|
+
};
|
|
7122
|
+
function countDeltas(e) {
|
|
7123
|
+
return (Array.isArray(e) ? e : e ? [e] : []).reduce((e, t) => {
|
|
7124
|
+
let n = countOne(t);
|
|
7125
|
+
return e.total += n.total, e.added += n.added, e.removed += n.removed, e.modified += n.modified, e.moved += n.moved, e.text += n.text, e;
|
|
7126
|
+
}, {
|
|
7127
|
+
total: 0,
|
|
7128
|
+
added: 0,
|
|
7129
|
+
removed: 0,
|
|
7130
|
+
modified: 0,
|
|
7131
|
+
moved: 0,
|
|
7132
|
+
text: 0
|
|
7133
|
+
});
|
|
7134
|
+
}
|
|
7073
7135
|
function AuditLogTable({ logs: e, onClick: t, loading: n }) {
|
|
7074
7136
|
let [r, i] = useState(!0), [a, o] = useState(!0), s = [
|
|
7075
7137
|
{
|
|
@@ -7088,14 +7150,15 @@ function AuditLogTable({ logs: e, onClick: t, loading: n }) {
|
|
|
7088
7150
|
label: "Show all",
|
|
7089
7151
|
value: 0
|
|
7090
7152
|
}
|
|
7091
|
-
], [c, l] = useState(10), [u, d] = useState(1), f = ({ diffs: e
|
|
7153
|
+
], [c, l] = useState(10), [u, d] = useState(1), f = ({ diffs: e, userName: t, source: n, operation: r, operationMetaData: i }) => {
|
|
7154
|
+
let a = countDeltas(e), o = a.total ? `${a.total} change${a.total === 1 ? "" : "s"}` : "no field changes";
|
|
7092
7155
|
if (n === "API") return r === "Created" ? `Created through API by ${t || "Unknown user"}` : `Changed through API by ${t || "Unknown user"}`;
|
|
7093
7156
|
switch (r) {
|
|
7094
7157
|
case "Created": return `Created by ${t}`;
|
|
7095
7158
|
case "Cloned": return `Cloned by ${t} (from ${i || "unknown"})`;
|
|
7096
7159
|
case "Reverted": return `Reverted by ${t}`;
|
|
7097
7160
|
case "Imported": return `Imported by ${t}`;
|
|
7098
|
-
case "Updated": return `Updated by ${t} (${
|
|
7161
|
+
case "Updated": return `Updated by ${t} (${o})`;
|
|
7099
7162
|
default: return `Change by ${t}`;
|
|
7100
7163
|
}
|
|
7101
7164
|
}, p = (u - 1) * (c || e.length || 1), h = c === 0 ? e.length : p + c, g = e.slice(p, h), _ = [{ cells: [
|
package/package.json
CHANGED