@oliasoft-open-source/react-ui-library 5.11.7-beta-3 → 5.11.7-beta-5
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.js +29 -26
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2741,7 +2741,7 @@ const useCustomSelectLogic = ({ state: e, dispatch: t, options: n, setTriggerFoc
|
|
|
2741
2741
|
layerFocus: initialLayerFocus(e, C ?? 0),
|
|
2742
2742
|
triggerFocus: initialTriggerFocus,
|
|
2743
2743
|
isLayerOpen: !1
|
|
2744
|
-
})), { getTriggerWidth: F, onKeyEvent: I, clearAllIsFocused: L, triggerProps: R, onClickTrigger: z, onChangeSearch: B, onClickDeselectOption: V, onClickClearAll: H, renderLayer: U, layerProps: W, closeLayer: G, onSelectOption: K, getLayerWidth: q, triggerBounds:
|
|
2744
|
+
})), { getTriggerWidth: F, onKeyEvent: I, clearAllIsFocused: L, triggerProps: R, onClickTrigger: z, onChangeSearch: B, onClickDeselectOption: V, onClickClearAll: H, renderLayer: U, layerProps: W, closeLayer: G, onSelectOption: K, getLayerWidth: q, triggerBounds: zd } = useCustomSelectLogic({
|
|
2745
2745
|
...e,
|
|
2746
2746
|
state: N,
|
|
2747
2747
|
dispatch: P,
|
|
@@ -2809,7 +2809,7 @@ const useCustomSelectLogic = ({ state: e, dispatch: t, options: n, setTriggerFoc
|
|
|
2809
2809
|
closeLayer: () => {
|
|
2810
2810
|
b && G();
|
|
2811
2811
|
},
|
|
2812
|
-
width: q(
|
|
2812
|
+
width: q(zd),
|
|
2813
2813
|
small: d,
|
|
2814
2814
|
focusedOptionIndex: N.layerFocus.current,
|
|
2815
2815
|
firstSelectedOptionIndex: C ?? 0,
|
|
@@ -4163,7 +4163,7 @@ const Empty = ({ width: e = "auto", height: t = "auto", text: n = "No data", chi
|
|
|
4163
4163
|
var isValidLength = (e, t, n) => e >= t - n, isNonPlaceholderUnit = (e) => !!e && e !== "blank" && e.trim() !== "", validateColumnLength = (e, t, n, r, i, a, o) => {
|
|
4164
4164
|
let s = [], c = r.filter((e) => e.optionalColumn).length, l = r.length, u = c ? `${l - c} or ${l}` : `${l}`, d = i && a ? 2 : i || a ? 1 : 0;
|
|
4165
4165
|
if (i && !isValidLength(e.length, l, c) && s.push(o("incorrectNumberOfFieldNameHeaderColumns", { expectedLengthMessage: u })), a) {
|
|
4166
|
-
let e = r.filter((e) => Array.isArray(e?.validUnits) && e?.validUnits?.some(isNonPlaceholderUnit)).length, n = t?.filter(isNonPlaceholderUnit)?.length, i = r?.filter((e) => e?.optionalColumn || !Array.isArray(e?.validUnits) || e.validUnits.includes("blank"))?.length;
|
|
4166
|
+
let e = r.filter((e) => !e.optionalColumn && Array.isArray(e?.validUnits) && e?.validUnits?.some(isNonPlaceholderUnit)).length, n = t?.filter(isNonPlaceholderUnit)?.length, i = r?.filter((e) => e?.optionalColumn || !Array.isArray(e?.validUnits) || e.validUnits.includes("blank"))?.length;
|
|
4167
4167
|
isValidLength(n, e, i) || s.push(o("incorrectNumberOfUnitHeaderColumns", { expectedLengthMessage: u }));
|
|
4168
4168
|
}
|
|
4169
4169
|
return n.length === 0 ? s.push(o("incorrectNumberOfDataColumns", {
|
|
@@ -4231,12 +4231,15 @@ var isValidLength = (e, t, n) => e >= t - n, isNonPlaceholderUnit = (e) => !!e &
|
|
|
4231
4231
|
})}`);
|
|
4232
4232
|
});
|
|
4233
4233
|
}), r;
|
|
4234
|
+
}, resolveEffectiveRules = (e, t) => {
|
|
4235
|
+
let n = e.filter((e) => !e.optionalColumn);
|
|
4236
|
+
return t === n.length ? n : (e.length, e);
|
|
4234
4237
|
};
|
|
4235
4238
|
const validate = (e, t, n, r, i, a, o) => {
|
|
4236
|
-
let s = validateColumnLength(e, t, n,
|
|
4237
|
-
return
|
|
4238
|
-
isValid:
|
|
4239
|
-
errors:
|
|
4239
|
+
let s = n.reduce((e, t) => Math.max(e, t.length), 0), c = Math.max(e.length, t.length, s), l = resolveEffectiveRules(r, c), u = validateColumnLength(e, t, n, l, i, a, o);
|
|
4240
|
+
return u.length === 0 && (u = u.concat(validateHeadings(e, t, l, i, a, o), validateValues(n, l, o))), {
|
|
4241
|
+
isValid: u.length === 0,
|
|
4242
|
+
errors: u
|
|
4240
4243
|
};
|
|
4241
4244
|
}, hasHeaders = (e, t, n) => {
|
|
4242
4245
|
let r = (e) => e.replace(/,/g, "."), i = e[0]?.some((e) => isNaN(Number(r(e)))) ?? !1, a = e[1]?.some((e) => isNaN(Number(r(e)))) ?? !1, o = e[0]?.some((e) => t.includes(e)) ?? !1, s = e[0]?.some((e) => n.includes(e)) ?? !1, c = e[1]?.some((e) => n.includes(e)) ?? !1, l = e[0]?.some((e) => !isNaN(Number(r(e)))) ?? !1, u = e[1]?.some((e) => !isNaN(Number(r(e)))) ?? !1;
|
|
@@ -6736,7 +6739,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6736
6739
|
} : {
|
|
6737
6740
|
value: G,
|
|
6738
6741
|
unit: U
|
|
6739
|
-
}),
|
|
6742
|
+
}), zd = k || K?.value === void 0, [J, Bd] = useState(w ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM), Vd = !!(O || n), Y = C && C.find((e) => {
|
|
6740
6743
|
if (!e?.value) return;
|
|
6741
6744
|
if (E) return E === e.valueKey;
|
|
6742
6745
|
let t = isValueWithUnit(e.value) ? getUnit(e.value) : "", { value: n = l } = convertUnit({
|
|
@@ -6745,7 +6748,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6745
6748
|
toUnit: t
|
|
6746
6749
|
});
|
|
6747
6750
|
return withUnit(n, t) === e.value;
|
|
6748
|
-
}),
|
|
6751
|
+
}), Hd = () => {
|
|
6749
6752
|
let e = l ?? "", t = K.unit;
|
|
6750
6753
|
if (checkConversion({
|
|
6751
6754
|
value: e,
|
|
@@ -6759,7 +6762,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6759
6762
|
return null;
|
|
6760
6763
|
}
|
|
6761
6764
|
} else return getAltUnitsListByQuantity(u)?.map((e) => ["", e?.unit]);
|
|
6762
|
-
},
|
|
6765
|
+
}, Ud = (t) => {
|
|
6763
6766
|
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;
|
|
6764
6767
|
h({ target: {
|
|
6765
6768
|
value: s,
|
|
@@ -6772,7 +6775,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6772
6775
|
}), R(() => {
|
|
6773
6776
|
r.selectionStart = a, r.selectionEnd = a;
|
|
6774
6777
|
});
|
|
6775
|
-
},
|
|
6778
|
+
}, Wd = (e, t) => {
|
|
6776
6779
|
t === K.unit || isNaN(Number(e)) || (q({
|
|
6777
6780
|
value: e,
|
|
6778
6781
|
unit: t
|
|
@@ -6803,7 +6806,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6803
6806
|
e !== void 0 && q({
|
|
6804
6807
|
value: e,
|
|
6805
6808
|
unit: t
|
|
6806
|
-
}),
|
|
6809
|
+
}), Bd(C && Y && T ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM);
|
|
6807
6810
|
}
|
|
6808
6811
|
}, [
|
|
6809
6812
|
U,
|
|
@@ -6811,7 +6814,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6811
6814
|
i,
|
|
6812
6815
|
T
|
|
6813
6816
|
]);
|
|
6814
|
-
let X =
|
|
6817
|
+
let X = Hd(), Z = label(K.unit) || K.unit || "", Gd = p || !X || X && X.length === 1, Q = getStringName(e), $, Kd = (t) => {
|
|
6815
6818
|
let r = t?.value ? t.value : "", [i = "", a = ""] = isValueWithUnit(r) ? split(r) : [r], o = withPrettyUnitLabel(r);
|
|
6816
6819
|
if (checkConversion({
|
|
6817
6820
|
value: r,
|
|
@@ -6831,7 +6834,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6831
6834
|
type: MenuType.OPTION,
|
|
6832
6835
|
inline: !0,
|
|
6833
6836
|
onClick: () => {
|
|
6834
|
-
validateNumber(i).valid && !n && (
|
|
6837
|
+
validateNumber(i).valid && !n && (Bd(PredefinedOptionsMenuState.PREDEFINED), h({ target: {
|
|
6835
6838
|
value: r,
|
|
6836
6839
|
name: typeof e == "string" ? e : e?.fieldName || "",
|
|
6837
6840
|
predefinedSelected: !0,
|
|
@@ -6858,10 +6861,10 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6858
6861
|
label: "Custom",
|
|
6859
6862
|
selected: J === PredefinedOptionsMenuState.CUSTOM
|
|
6860
6863
|
}], C?.length) {
|
|
6861
|
-
let e = C.map(
|
|
6864
|
+
let e = C.map(Kd);
|
|
6862
6865
|
$ = [...$, ...e];
|
|
6863
6866
|
}
|
|
6864
|
-
let
|
|
6867
|
+
let qd = (e) => {
|
|
6865
6868
|
if (isValueWithUnit(e)) {
|
|
6866
6869
|
let t = getUnit(e), { value: n } = safeConvertValue({
|
|
6867
6870
|
value: e,
|
|
@@ -6873,7 +6876,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6873
6876
|
return n;
|
|
6874
6877
|
}
|
|
6875
6878
|
return e;
|
|
6876
|
-
},
|
|
6879
|
+
}, Jd = !C && (!F || F === GroupOrder.FIRST) ? GroupOrder.FIRST : GroupOrder.MIDDLE, Yd = !F || F === GroupOrder.LAST ? GroupOrder.LAST : GroupOrder.MIDDLE;
|
|
6877
6880
|
return /* @__PURE__ */ jsx("div", {
|
|
6878
6881
|
className: J === PredefinedOptionsMenuState.PREDEFINED ? cx(unit_input_module_default.predefinedMenuActive) : "",
|
|
6879
6882
|
children: /* @__PURE__ */ jsxs(InputGroup, {
|
|
@@ -6905,31 +6908,31 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6905
6908
|
name: Q,
|
|
6906
6909
|
testId: x,
|
|
6907
6910
|
disabled: n,
|
|
6908
|
-
placeholder:
|
|
6911
|
+
placeholder: qd(t),
|
|
6909
6912
|
value: K.value,
|
|
6910
|
-
onChange:
|
|
6913
|
+
onChange: Ud,
|
|
6911
6914
|
onFocus: v,
|
|
6912
6915
|
error: i === null ? void 0 : i,
|
|
6913
6916
|
warning: S === null ? void 0 : S,
|
|
6914
6917
|
left: a,
|
|
6915
|
-
allowEmpty:
|
|
6918
|
+
allowEmpty: zd,
|
|
6916
6919
|
validationCallback: (e, t) => D(Q, t),
|
|
6917
6920
|
enableCosmeticRounding: j,
|
|
6918
6921
|
enableDisplayRounding: M,
|
|
6919
6922
|
roundDisplayValue: N,
|
|
6920
|
-
groupOrder:
|
|
6921
|
-
disableInternalErrorValidationMessages:
|
|
6923
|
+
groupOrder: Jd,
|
|
6924
|
+
disableInternalErrorValidationMessages: Vd,
|
|
6922
6925
|
small: o,
|
|
6923
6926
|
selectOnFocus: P,
|
|
6924
6927
|
tooltip: I
|
|
6925
6928
|
}, Q)
|
|
6926
6929
|
}),
|
|
6927
|
-
Z && (
|
|
6928
|
-
groupOrder:
|
|
6930
|
+
Z && (Gd || !H ? /* @__PURE__ */ jsx(InputGroupAddon, {
|
|
6931
|
+
groupOrder: Yd,
|
|
6929
6932
|
small: o,
|
|
6930
6933
|
children: Z
|
|
6931
6934
|
}) : /* @__PURE__ */ jsx(Menu, {
|
|
6932
|
-
groupOrder:
|
|
6935
|
+
groupOrder: Yd,
|
|
6933
6936
|
maxHeight: 380,
|
|
6934
6937
|
disabled: r,
|
|
6935
6938
|
testId: x && `${x}-menu`,
|
|
@@ -6945,7 +6948,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6945
6948
|
label: j ? safeRoundNumbers(i) : i,
|
|
6946
6949
|
inline: !0,
|
|
6947
6950
|
onClick: (n) => {
|
|
6948
|
-
n.stopPropagation(),
|
|
6951
|
+
n.stopPropagation(), Wd(e, t);
|
|
6949
6952
|
},
|
|
6950
6953
|
description: r,
|
|
6951
6954
|
selected: r === Z,
|
package/package.json
CHANGED