@oliasoft-open-source/react-ui-library 5.10.0-beta-1 → 5.10.0-beta-3
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 +4 -3
- package/dist/index.js +35 -36
- package/package.json +6 -3
package/dist/index.d.ts
CHANGED
|
@@ -1867,9 +1867,10 @@ declare interface IUnitTableStaticCell extends IStaticCell, IUnitTableCell {
|
|
|
1867
1867
|
}
|
|
1868
1868
|
|
|
1869
1869
|
export declare interface IUsageTrackerProps {
|
|
1870
|
+
pathName: string;
|
|
1871
|
+
moduleName: string;
|
|
1870
1872
|
onNavigate: (args: NavigationEventArgs) => void;
|
|
1871
|
-
|
|
1872
|
-
onStartNavigationTimeEvent?: () => void;
|
|
1873
|
+
onStartTimingEvent?: () => void;
|
|
1873
1874
|
}
|
|
1874
1875
|
|
|
1875
1876
|
declare type JsonDelta = Record<string, any>;
|
|
@@ -2230,7 +2231,7 @@ export declare const UnitInput: ({ name, placeholder, disabled, disabledUnit, er
|
|
|
2230
2231
|
|
|
2231
2232
|
export declare const UnitTable: ({ table, unitConfig, convertBackToStorageUnit, enableCosmeticRounding, enableDisplayRounding, onListReorder, canListReorder, beforeRenderRow: beforeRenderRowProp, }: IUnitTableProps) => JSX_2.Element;
|
|
2232
2233
|
|
|
2233
|
-
export declare const UsageTracker: ({
|
|
2234
|
+
export declare const UsageTracker: ({ pathName, moduleName, onNavigate, onStartTimingEvent, }: IUsageTrackerProps) => null;
|
|
2234
2235
|
|
|
2235
2236
|
export declare const useFocus: () => UseFocusReturnType;
|
|
2236
2237
|
|
package/dist/index.js
CHANGED
|
@@ -30,7 +30,6 @@ import "remirror/styles/all.css";
|
|
|
30
30
|
import { DndProvider } from "react-dnd";
|
|
31
31
|
import { MultiBackend, Tree as Tree$1, getBackendOptions } from "@minoru/react-dnd-treeview";
|
|
32
32
|
import ReactDiffViewer, { DiffMethod } from "react-diff-viewer-continued";
|
|
33
|
-
import { useLocation } from "react-router-dom";
|
|
34
33
|
let TriggerType = /* @__PURE__ */ function(e) {
|
|
35
34
|
return e.TEXT = "Text", e.BUTTON = "Button", e.DROP_DOWN_BUTTON = "DropDownButton", e.COMPONENT = "Component", e;
|
|
36
35
|
}({}), GroupOrder = /* @__PURE__ */ function(e) {
|
|
@@ -6612,7 +6611,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6612
6611
|
} : {
|
|
6613
6612
|
value: G,
|
|
6614
6613
|
unit: U
|
|
6615
|
-
}),
|
|
6614
|
+
}), Pd = k || K?.value === void 0, [J, Fd] = useState(w ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM), Id = !!(O || n), Y = C && C.find((e) => {
|
|
6616
6615
|
if (!e?.value) return;
|
|
6617
6616
|
if (E) return E === e.valueKey;
|
|
6618
6617
|
let t = isValueWithUnit(e.value) ? getUnit(e.value) : "", { value: n = l } = convertUnit({
|
|
@@ -6621,7 +6620,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6621
6620
|
toUnit: t
|
|
6622
6621
|
});
|
|
6623
6622
|
return withUnit(n, t) === e.value;
|
|
6624
|
-
}),
|
|
6623
|
+
}), Ld = () => {
|
|
6625
6624
|
let e = l ?? "", t = K.unit;
|
|
6626
6625
|
if (checkConversion({
|
|
6627
6626
|
value: e,
|
|
@@ -6635,7 +6634,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6635
6634
|
return null;
|
|
6636
6635
|
}
|
|
6637
6636
|
} else return getAltUnitsListByQuantity(u)?.map((e) => ["", e?.unit]);
|
|
6638
|
-
},
|
|
6637
|
+
}, Rd = (t) => {
|
|
6639
6638
|
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;
|
|
6640
6639
|
h({ target: {
|
|
6641
6640
|
value: s,
|
|
@@ -6648,7 +6647,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6648
6647
|
}), R(() => {
|
|
6649
6648
|
r.selectionStart = a, r.selectionEnd = a;
|
|
6650
6649
|
});
|
|
6651
|
-
},
|
|
6650
|
+
}, zd = (e, t) => {
|
|
6652
6651
|
t === K.unit || isNaN(Number(e)) || (q({
|
|
6653
6652
|
value: e,
|
|
6654
6653
|
unit: t
|
|
@@ -6679,7 +6678,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6679
6678
|
e !== void 0 && q({
|
|
6680
6679
|
value: e,
|
|
6681
6680
|
unit: t
|
|
6682
|
-
}), C &&
|
|
6681
|
+
}), C && Fd(Y && T ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM);
|
|
6683
6682
|
}
|
|
6684
6683
|
}, [
|
|
6685
6684
|
U,
|
|
@@ -6687,7 +6686,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6687
6686
|
i,
|
|
6688
6687
|
T
|
|
6689
6688
|
]);
|
|
6690
|
-
let X =
|
|
6689
|
+
let X = Ld(), Z = label(K.unit) || K.unit || "", Bd = p || !X || X && X.length === 1, Q = getStringName(e), $, Vd = (t) => {
|
|
6691
6690
|
let r = t?.value ? t.value : "", [i = "", a = ""] = isValueWithUnit(r) ? split(r) : [r], o = withPrettyUnitLabel(r);
|
|
6692
6691
|
if (checkConversion({
|
|
6693
6692
|
value: r,
|
|
@@ -6707,7 +6706,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6707
6706
|
type: MenuType.OPTION,
|
|
6708
6707
|
inline: !0,
|
|
6709
6708
|
onClick: () => {
|
|
6710
|
-
validateNumber(i).valid && !n && (
|
|
6709
|
+
validateNumber(i).valid && !n && (Fd(PredefinedOptionsMenuState.PREDEFINED), h({ target: {
|
|
6711
6710
|
value: r,
|
|
6712
6711
|
name: typeof e == "string" ? e : e?.fieldName || "",
|
|
6713
6712
|
predefinedSelected: !0,
|
|
@@ -6734,10 +6733,10 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6734
6733
|
label: "Custom",
|
|
6735
6734
|
selected: J === PredefinedOptionsMenuState.CUSTOM
|
|
6736
6735
|
}], C?.length) {
|
|
6737
|
-
let e = C.map(
|
|
6736
|
+
let e = C.map(Vd);
|
|
6738
6737
|
$ = [...$, ...e];
|
|
6739
6738
|
}
|
|
6740
|
-
let
|
|
6739
|
+
let Hd = (e) => {
|
|
6741
6740
|
if (isValueWithUnit(e)) {
|
|
6742
6741
|
let t = getUnit(e), { value: n } = safeConvertValue({
|
|
6743
6742
|
value: e,
|
|
@@ -6749,7 +6748,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6749
6748
|
return n;
|
|
6750
6749
|
}
|
|
6751
6750
|
return e;
|
|
6752
|
-
},
|
|
6751
|
+
}, Ud = !C && (!F || F === GroupOrder.FIRST) ? GroupOrder.FIRST : GroupOrder.MIDDLE, Wd = !F || F === GroupOrder.LAST ? GroupOrder.LAST : GroupOrder.MIDDLE;
|
|
6753
6752
|
return /* @__PURE__ */ jsx("div", {
|
|
6754
6753
|
className: J === PredefinedOptionsMenuState.PREDEFINED ? cx(unit_input_module_default.predefinedMenuActive) : "",
|
|
6755
6754
|
children: /* @__PURE__ */ jsxs(InputGroup, {
|
|
@@ -6781,31 +6780,31 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6781
6780
|
name: Q,
|
|
6782
6781
|
testId: x,
|
|
6783
6782
|
disabled: n,
|
|
6784
|
-
placeholder:
|
|
6783
|
+
placeholder: Hd(t),
|
|
6785
6784
|
value: K.value,
|
|
6786
|
-
onChange:
|
|
6785
|
+
onChange: Rd,
|
|
6787
6786
|
onFocus: v,
|
|
6788
6787
|
error: i === null ? void 0 : i,
|
|
6789
6788
|
warning: S === null ? void 0 : S,
|
|
6790
6789
|
left: a,
|
|
6791
|
-
allowEmpty:
|
|
6790
|
+
allowEmpty: Pd,
|
|
6792
6791
|
validationCallback: (e, t) => D(Q, t),
|
|
6793
6792
|
enableCosmeticRounding: j,
|
|
6794
6793
|
enableDisplayRounding: M,
|
|
6795
6794
|
roundDisplayValue: N,
|
|
6796
|
-
groupOrder:
|
|
6797
|
-
disableInternalErrorValidationMessages:
|
|
6795
|
+
groupOrder: Ud,
|
|
6796
|
+
disableInternalErrorValidationMessages: Id,
|
|
6798
6797
|
small: o,
|
|
6799
6798
|
selectOnFocus: P,
|
|
6800
6799
|
tooltip: I
|
|
6801
6800
|
}, Q)
|
|
6802
6801
|
}),
|
|
6803
|
-
Z && (
|
|
6804
|
-
groupOrder:
|
|
6802
|
+
Z && (Bd || !H ? /* @__PURE__ */ jsx(InputGroupAddon, {
|
|
6803
|
+
groupOrder: Wd,
|
|
6805
6804
|
small: o,
|
|
6806
6805
|
children: Z
|
|
6807
6806
|
}) : /* @__PURE__ */ jsx(Menu, {
|
|
6808
|
-
groupOrder:
|
|
6807
|
+
groupOrder: Wd,
|
|
6809
6808
|
maxHeight: 380,
|
|
6810
6809
|
disabled: r,
|
|
6811
6810
|
testId: x && `${x}-menu`,
|
|
@@ -6821,7 +6820,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6821
6820
|
label: j ? safeRoundNumbers(i) : i,
|
|
6822
6821
|
inline: !0,
|
|
6823
6822
|
onClick: (n) => {
|
|
6824
|
-
n.stopPropagation(),
|
|
6823
|
+
n.stopPropagation(), zd(e, t);
|
|
6825
6824
|
},
|
|
6826
6825
|
description: r,
|
|
6827
6826
|
selected: r === Z,
|
|
@@ -8689,29 +8688,29 @@ const ComparisonViewModal = ({ auditLog: e, auditLogs: t, data: n, isOpen: r, se
|
|
|
8689
8688
|
auditLog: f,
|
|
8690
8689
|
data: t
|
|
8691
8690
|
})] });
|
|
8692
|
-
}, UsageTracker = ({
|
|
8693
|
-
let
|
|
8691
|
+
}, UsageTracker = ({ pathName: e, moduleName: t, onNavigate: n, onStartTimingEvent: r }) => {
|
|
8692
|
+
let i = window.location.href, a = useRef(i);
|
|
8694
8693
|
return useEffect(() => {
|
|
8695
|
-
|
|
8696
|
-
let
|
|
8697
|
-
|
|
8698
|
-
let
|
|
8699
|
-
|
|
8700
|
-
moduleName:
|
|
8701
|
-
moduleUrl:
|
|
8702
|
-
startTime:
|
|
8694
|
+
a.current = i;
|
|
8695
|
+
let e = Date.now();
|
|
8696
|
+
r && r();
|
|
8697
|
+
let o = () => {
|
|
8698
|
+
n({
|
|
8699
|
+
moduleName: t,
|
|
8700
|
+
moduleUrl: a.current,
|
|
8701
|
+
startTime: e,
|
|
8703
8702
|
endTime: Date.now()
|
|
8704
8703
|
});
|
|
8705
8704
|
};
|
|
8706
|
-
return window.addEventListener("beforeunload",
|
|
8707
|
-
window.removeEventListener("beforeunload",
|
|
8708
|
-
moduleName:
|
|
8709
|
-
moduleUrl:
|
|
8710
|
-
startTime:
|
|
8705
|
+
return window.addEventListener("beforeunload", o), () => {
|
|
8706
|
+
window.removeEventListener("beforeunload", o), n({
|
|
8707
|
+
moduleName: t,
|
|
8708
|
+
moduleUrl: a.current,
|
|
8709
|
+
startTime: e,
|
|
8711
8710
|
endTime: Date.now()
|
|
8712
8711
|
});
|
|
8713
8712
|
};
|
|
8714
|
-
}, [
|
|
8713
|
+
}, [e, t]), null;
|
|
8715
8714
|
}, isPrimitiveValue = (e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e === null, initializeGuiLibrary = (e) => {
|
|
8716
8715
|
setConfig(ConfigKeyType.LanguageKey, e.languageKey), Object.entries(e).forEach(([e, t]) => {
|
|
8717
8716
|
if (e === ConfigKeyType.Translations) setConfig(e, getTranslations(t));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oliasoft-open-source/react-ui-library",
|
|
3
|
-
"version": "5.10.0-beta-
|
|
3
|
+
"version": "5.10.0-beta-3",
|
|
4
4
|
"description": "Reusable UI components for React projects",
|
|
5
5
|
"homepage": "https://oliasoft-open-source.gitlab.io/react-ui-library",
|
|
6
6
|
"bugs": {
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"lint:check": "eslint \"**/*.{js,jsx,ts,tsx}\"",
|
|
41
41
|
"lint:fix": "eslint --fix \"**/*.{js,jsx,ts,tsx}\"",
|
|
42
42
|
"prepare": "husky",
|
|
43
|
-
"prettier:check": "prettier --check \"**/*.{js,jsx,json,css,less}\"",
|
|
44
|
-
"prettier:fix": "prettier --write \"**/*.{js,jsx,json,css,less}\"",
|
|
43
|
+
"prettier:check": "prettier --check \"**/*.{js,jsx,json,css,less,ts,tsx}\"",
|
|
44
|
+
"prettier:fix": "prettier --write \"**/*.{js,jsx,json,css,less,ts,tsx}\"",
|
|
45
45
|
"preview:docs": "yarn build:docs && yarn run http-server ./public -o -p 9002 -c-1",
|
|
46
46
|
"preview:storybook": "yarn run http-server ./public/storybook -o -p 9003 -c-1",
|
|
47
47
|
"test": "yarn run prettier:check && yarn run lint:check && yarn run test:unit",
|
|
@@ -104,6 +104,9 @@
|
|
|
104
104
|
"@storybook/test-runner": "0.23.0",
|
|
105
105
|
"@storybook/theming": "^8.6.14",
|
|
106
106
|
"@storybook/types": "^8.6.14",
|
|
107
|
+
"@testing-library/dom": "^10.4.1",
|
|
108
|
+
"@testing-library/react": "^16.3.1",
|
|
109
|
+
"@testing-library/user-event": "^14.6.1",
|
|
107
110
|
"@types/jest": "^29.5.14",
|
|
108
111
|
"@types/papaparse": "^5.3.16",
|
|
109
112
|
"@types/react": "^18.3.18",
|