@oliasoft-open-source/react-ui-library 5.11.7-beta-5 → 5.11.7-beta-7
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 +64 -64
- 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: Rd } = 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(Rd),
|
|
2813
2813
|
small: d,
|
|
2814
2814
|
focusedOptionIndex: N.layerFocus.current,
|
|
2815
2815
|
firstSelectedOptionIndex: C ?? 0,
|
|
@@ -3916,17 +3916,20 @@ const TableScrollWrapper = ({ table: e, children: t }) => {
|
|
|
3916
3916
|
isValid: s
|
|
3917
3917
|
};
|
|
3918
3918
|
}, Table$1 = ({ validationRules: e, parsedResult: t, updateState: n, testId: r }) => {
|
|
3919
|
-
let i = useMemo(() => t.fields.map((e) => ({ value: e })), [t.fields]), [a, s] = useState(20), [l, u] = useState(1), f = useRef([]), h = (l - 1) * a, g = a === 0 ? t.rows.length : h + a, [_, v] = useState([]), y =
|
|
3920
|
-
|
|
3921
|
-
|
|
3919
|
+
let i = useMemo(() => t.fields.map((e) => ({ value: e })), [t.fields]), [a, s] = useState(20), [l, u] = useState(1), f = useRef([]), h = (l - 1) * a, g = a === 0 ? t.rows.length : h + a, [_, v] = useState([]), y = useMemo(() => {
|
|
3920
|
+
let n = e.filter((e) => !e.optionalColumn);
|
|
3921
|
+
return t.fields.length === n.length ? n : e;
|
|
3922
|
+
}, [e, t.fields.length]), b = useCallback((e, r) => (!f.current.length && t.rows.length && (f.current = t.rows[0].map((e) => isNumericLike(e) ? "NumberInput" : "Input")), {
|
|
3923
|
+
cells: e.map((e, a) => {
|
|
3924
|
+
let { columnMessage: o = {}, validator: s = () => null } = y?.[a] ?? {}, c = i?.[a]?.value, l = `${`Row ${r + 1}`} → ${c}:`, u = s(e), d = t?.errors?.find((e) => e.startsWith(l)) ?? null, p = u || d || null;
|
|
3922
3925
|
return {
|
|
3923
|
-
name:
|
|
3924
|
-
value:
|
|
3925
|
-
type: f.current[
|
|
3926
|
+
name: c,
|
|
3927
|
+
value: e,
|
|
3928
|
+
type: f.current[a] ?? "Input",
|
|
3926
3929
|
disableValidationOnFocus: !0,
|
|
3927
|
-
error:
|
|
3928
|
-
validationCallback: (e,
|
|
3929
|
-
let
|
|
3930
|
+
error: p,
|
|
3931
|
+
validationCallback: (e, i) => {
|
|
3932
|
+
let a = `Row ${r + 1}`, { updatedErrors: o, isValid: s } = getUpdatedErrors(t.errors, a, e, i);
|
|
3930
3933
|
n({ parsedResult: {
|
|
3931
3934
|
...t,
|
|
3932
3935
|
errors: o,
|
|
@@ -3934,7 +3937,7 @@ const TableScrollWrapper = ({ table: e, children: t }) => {
|
|
|
3934
3937
|
} });
|
|
3935
3938
|
},
|
|
3936
3939
|
onChange: (e) => {
|
|
3937
|
-
let { value:
|
|
3940
|
+
let { value: i } = e?.target ?? {}, o = `Row ${r + 1}`, l = s(i), { updatedErrors: u, isValid: d } = getUpdatedErrors(t.errors, o, c, l), f = t.rows.map((e, t) => t === r ? e.map((e, t) => t === a ? i : e) : e);
|
|
3938
3941
|
n({ parsedResult: {
|
|
3939
3942
|
...t,
|
|
3940
3943
|
rows: f,
|
|
@@ -3942,17 +3945,17 @@ const TableScrollWrapper = ({ table: e, children: t }) => {
|
|
|
3942
3945
|
isValid: d
|
|
3943
3946
|
} }), v((e) => {
|
|
3944
3947
|
let t = [...e];
|
|
3945
|
-
return t[
|
|
3948
|
+
return t[r] = b(f[r], r), t;
|
|
3946
3949
|
});
|
|
3947
3950
|
},
|
|
3948
|
-
...
|
|
3951
|
+
...o
|
|
3949
3952
|
};
|
|
3950
3953
|
}),
|
|
3951
3954
|
actions: [{
|
|
3952
3955
|
label: "Delete",
|
|
3953
3956
|
icon: "minus",
|
|
3954
3957
|
onClick: () => {
|
|
3955
|
-
let e = t.rows.filter((e, t) => t !==
|
|
3958
|
+
let e = t.rows.filter((e, t) => t !== r);
|
|
3956
3959
|
n({ parsedResult: {
|
|
3957
3960
|
...t,
|
|
3958
3961
|
rows: e
|
|
@@ -3966,7 +3969,7 @@ const TableScrollWrapper = ({ table: e, children: t }) => {
|
|
|
3966
3969
|
n
|
|
3967
3970
|
]);
|
|
3968
3971
|
useEffect(() => {
|
|
3969
|
-
v(t.rows.map((e, t) =>
|
|
3972
|
+
v(t.rows.map((e, t) => b(e, t)));
|
|
3970
3973
|
}, [
|
|
3971
3974
|
t.rows.length,
|
|
3972
3975
|
i,
|
|
@@ -3974,24 +3977,24 @@ const TableScrollWrapper = ({ table: e, children: t }) => {
|
|
|
3974
3977
|
t.errors,
|
|
3975
3978
|
t.isValid
|
|
3976
3979
|
]);
|
|
3977
|
-
let
|
|
3978
|
-
let
|
|
3979
|
-
if (!
|
|
3980
|
-
let
|
|
3980
|
+
let x = useMemo(() => t.fields.map((e, r) => {
|
|
3981
|
+
let a = y?.[r], o = Array.isArray(a?.validUnits) ? a.validUnits : [], s = o?.some((e) => toLower(e) === placeholder$1);
|
|
3982
|
+
if (!o.length || s) return {};
|
|
3983
|
+
let c = t?.units?.[r], l = toLower(c), u = o?.some((e) => toLower(e) === l) ? c : a?.defaultUnit ?? "";
|
|
3981
3984
|
return {
|
|
3982
|
-
key: i?.[
|
|
3983
|
-
value:
|
|
3985
|
+
key: i?.[r]?.value,
|
|
3986
|
+
value: u,
|
|
3984
3987
|
type: "Select",
|
|
3985
|
-
disabled: !
|
|
3986
|
-
options:
|
|
3988
|
+
disabled: !o.length || !u,
|
|
3989
|
+
options: o.map((e) => ({
|
|
3987
3990
|
label: e,
|
|
3988
3991
|
value: e
|
|
3989
3992
|
})),
|
|
3990
3993
|
onChange: (e) => {
|
|
3991
|
-
let { value:
|
|
3994
|
+
let { value: i } = e?.target ?? {}, a = t.units.map((e, t) => t === r ? i : e);
|
|
3992
3995
|
n({ parsedResult: {
|
|
3993
3996
|
...t,
|
|
3994
|
-
units:
|
|
3997
|
+
units: a
|
|
3995
3998
|
} });
|
|
3996
3999
|
}
|
|
3997
4000
|
};
|
|
@@ -4000,30 +4003,30 @@ const TableScrollWrapper = ({ table: e, children: t }) => {
|
|
|
4000
4003
|
e,
|
|
4001
4004
|
i,
|
|
4002
4005
|
n
|
|
4003
|
-
]),
|
|
4006
|
+
]), S = useMemo(() => x.some((e) => !isEmpty(e)), [x]), C = useMemo(() => [{
|
|
4004
4007
|
cells: i,
|
|
4005
4008
|
actions: [{}]
|
|
4006
|
-
}, ...
|
|
4009
|
+
}, ...S ? [{ cells: x }] : []], [
|
|
4007
4010
|
i,
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
]),
|
|
4011
|
+
S,
|
|
4012
|
+
x
|
|
4013
|
+
]), w = useMemo(() => _.slice(h, g), [
|
|
4011
4014
|
_,
|
|
4012
4015
|
h,
|
|
4013
4016
|
g
|
|
4014
|
-
]),
|
|
4017
|
+
]), T = useCallback(({ rowIndex: e }) => {
|
|
4015
4018
|
let n = h + e, r = t.rows[n];
|
|
4016
|
-
return r ?
|
|
4019
|
+
return r ? b(r, n) : {
|
|
4017
4020
|
cells: [],
|
|
4018
4021
|
actions: []
|
|
4019
4022
|
};
|
|
4020
4023
|
}, [
|
|
4021
4024
|
t.rows,
|
|
4022
|
-
|
|
4025
|
+
b,
|
|
4023
4026
|
h
|
|
4024
4027
|
]);
|
|
4025
4028
|
return /* @__PURE__ */ jsx(Table, {
|
|
4026
|
-
beforeRenderRow:
|
|
4029
|
+
beforeRenderRow: T,
|
|
4027
4030
|
onListReorder: ({ from: e, to: r }) => {
|
|
4028
4031
|
let i = [...t.rows], [a] = i.splice(e, 1);
|
|
4029
4032
|
i.splice(r, 0, a), n({ parsedResult: {
|
|
@@ -4037,12 +4040,12 @@ const TableScrollWrapper = ({ table: e, children: t }) => {
|
|
|
4037
4040
|
table: {
|
|
4038
4041
|
testId: `${r}-paste-with-review-modal-table`,
|
|
4039
4042
|
draggable: !0,
|
|
4040
|
-
headers:
|
|
4041
|
-
rows: Array.from({ length:
|
|
4043
|
+
headers: C,
|
|
4044
|
+
rows: Array.from({ length: w?.length || 0 }, () => ({
|
|
4042
4045
|
cells: [],
|
|
4043
4046
|
actions: []
|
|
4044
4047
|
})),
|
|
4045
|
-
rowCount:
|
|
4048
|
+
rowCount: w?.length,
|
|
4046
4049
|
infiniteScroll: !0,
|
|
4047
4050
|
footer: { pagination: {
|
|
4048
4051
|
rowCount: t.rows.length,
|
|
@@ -4231,15 +4234,12 @@ var isValidLength = (e, t, n) => e >= t - n, isNonPlaceholderUnit = (e) => !!e &
|
|
|
4231
4234
|
})}`);
|
|
4232
4235
|
});
|
|
4233
4236
|
}), r;
|
|
4234
|
-
}, resolveEffectiveRules = (e, t) => {
|
|
4235
|
-
let n = e.filter((e) => !e.optionalColumn);
|
|
4236
|
-
return t === n.length ? n : (e.length, e);
|
|
4237
4237
|
};
|
|
4238
4238
|
const validate = (e, t, n, r, i, a, o) => {
|
|
4239
|
-
let s =
|
|
4240
|
-
return
|
|
4241
|
-
isValid:
|
|
4242
|
-
errors:
|
|
4239
|
+
let s = validateColumnLength(e, t, n, r, i, a, o);
|
|
4240
|
+
return s.length === 0 && (s = s.concat(validateHeadings(e, t, r, i, a, o), validateValues(n, r, o))), {
|
|
4241
|
+
isValid: s.length === 0,
|
|
4242
|
+
errors: s
|
|
4243
4243
|
};
|
|
4244
4244
|
}, hasHeaders = (e, t, n) => {
|
|
4245
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;
|
|
@@ -6739,7 +6739,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6739
6739
|
} : {
|
|
6740
6740
|
value: G,
|
|
6741
6741
|
unit: U
|
|
6742
|
-
}),
|
|
6742
|
+
}), Rd = k || K?.value === void 0, [J, zd] = useState(w ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM), Bd = !!(O || n), Y = C && C.find((e) => {
|
|
6743
6743
|
if (!e?.value) return;
|
|
6744
6744
|
if (E) return E === e.valueKey;
|
|
6745
6745
|
let t = isValueWithUnit(e.value) ? getUnit(e.value) : "", { value: n = l } = convertUnit({
|
|
@@ -6748,7 +6748,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6748
6748
|
toUnit: t
|
|
6749
6749
|
});
|
|
6750
6750
|
return withUnit(n, t) === e.value;
|
|
6751
|
-
}),
|
|
6751
|
+
}), Vd = () => {
|
|
6752
6752
|
let e = l ?? "", t = K.unit;
|
|
6753
6753
|
if (checkConversion({
|
|
6754
6754
|
value: e,
|
|
@@ -6762,7 +6762,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6762
6762
|
return null;
|
|
6763
6763
|
}
|
|
6764
6764
|
} else return getAltUnitsListByQuantity(u)?.map((e) => ["", e?.unit]);
|
|
6765
|
-
},
|
|
6765
|
+
}, Hd = (t) => {
|
|
6766
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;
|
|
6767
6767
|
h({ target: {
|
|
6768
6768
|
value: s,
|
|
@@ -6775,7 +6775,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6775
6775
|
}), R(() => {
|
|
6776
6776
|
r.selectionStart = a, r.selectionEnd = a;
|
|
6777
6777
|
});
|
|
6778
|
-
},
|
|
6778
|
+
}, Ud = (e, t) => {
|
|
6779
6779
|
t === K.unit || isNaN(Number(e)) || (q({
|
|
6780
6780
|
value: e,
|
|
6781
6781
|
unit: t
|
|
@@ -6806,7 +6806,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6806
6806
|
e !== void 0 && q({
|
|
6807
6807
|
value: e,
|
|
6808
6808
|
unit: t
|
|
6809
|
-
}),
|
|
6809
|
+
}), zd(C && Y && T ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM);
|
|
6810
6810
|
}
|
|
6811
6811
|
}, [
|
|
6812
6812
|
U,
|
|
@@ -6814,7 +6814,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6814
6814
|
i,
|
|
6815
6815
|
T
|
|
6816
6816
|
]);
|
|
6817
|
-
let X =
|
|
6817
|
+
let X = Vd(), Z = label(K.unit) || K.unit || "", Wd = p || !X || X && X.length === 1, Q = getStringName(e), $, Gd = (t) => {
|
|
6818
6818
|
let r = t?.value ? t.value : "", [i = "", a = ""] = isValueWithUnit(r) ? split(r) : [r], o = withPrettyUnitLabel(r);
|
|
6819
6819
|
if (checkConversion({
|
|
6820
6820
|
value: r,
|
|
@@ -6834,7 +6834,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6834
6834
|
type: MenuType.OPTION,
|
|
6835
6835
|
inline: !0,
|
|
6836
6836
|
onClick: () => {
|
|
6837
|
-
validateNumber(i).valid && !n && (
|
|
6837
|
+
validateNumber(i).valid && !n && (zd(PredefinedOptionsMenuState.PREDEFINED), h({ target: {
|
|
6838
6838
|
value: r,
|
|
6839
6839
|
name: typeof e == "string" ? e : e?.fieldName || "",
|
|
6840
6840
|
predefinedSelected: !0,
|
|
@@ -6861,10 +6861,10 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6861
6861
|
label: "Custom",
|
|
6862
6862
|
selected: J === PredefinedOptionsMenuState.CUSTOM
|
|
6863
6863
|
}], C?.length) {
|
|
6864
|
-
let e = C.map(
|
|
6864
|
+
let e = C.map(Gd);
|
|
6865
6865
|
$ = [...$, ...e];
|
|
6866
6866
|
}
|
|
6867
|
-
let
|
|
6867
|
+
let Kd = (e) => {
|
|
6868
6868
|
if (isValueWithUnit(e)) {
|
|
6869
6869
|
let t = getUnit(e), { value: n } = safeConvertValue({
|
|
6870
6870
|
value: e,
|
|
@@ -6876,7 +6876,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6876
6876
|
return n;
|
|
6877
6877
|
}
|
|
6878
6878
|
return e;
|
|
6879
|
-
},
|
|
6879
|
+
}, qd = !C && (!F || F === GroupOrder.FIRST) ? GroupOrder.FIRST : GroupOrder.MIDDLE, Jd = !F || F === GroupOrder.LAST ? GroupOrder.LAST : GroupOrder.MIDDLE;
|
|
6880
6880
|
return /* @__PURE__ */ jsx("div", {
|
|
6881
6881
|
className: J === PredefinedOptionsMenuState.PREDEFINED ? cx(unit_input_module_default.predefinedMenuActive) : "",
|
|
6882
6882
|
children: /* @__PURE__ */ jsxs(InputGroup, {
|
|
@@ -6908,31 +6908,31 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6908
6908
|
name: Q,
|
|
6909
6909
|
testId: x,
|
|
6910
6910
|
disabled: n,
|
|
6911
|
-
placeholder:
|
|
6911
|
+
placeholder: Kd(t),
|
|
6912
6912
|
value: K.value,
|
|
6913
|
-
onChange:
|
|
6913
|
+
onChange: Hd,
|
|
6914
6914
|
onFocus: v,
|
|
6915
6915
|
error: i === null ? void 0 : i,
|
|
6916
6916
|
warning: S === null ? void 0 : S,
|
|
6917
6917
|
left: a,
|
|
6918
|
-
allowEmpty:
|
|
6918
|
+
allowEmpty: Rd,
|
|
6919
6919
|
validationCallback: (e, t) => D(Q, t),
|
|
6920
6920
|
enableCosmeticRounding: j,
|
|
6921
6921
|
enableDisplayRounding: M,
|
|
6922
6922
|
roundDisplayValue: N,
|
|
6923
|
-
groupOrder:
|
|
6924
|
-
disableInternalErrorValidationMessages:
|
|
6923
|
+
groupOrder: qd,
|
|
6924
|
+
disableInternalErrorValidationMessages: Bd,
|
|
6925
6925
|
small: o,
|
|
6926
6926
|
selectOnFocus: P,
|
|
6927
6927
|
tooltip: I
|
|
6928
6928
|
}, Q)
|
|
6929
6929
|
}),
|
|
6930
|
-
Z && (
|
|
6931
|
-
groupOrder:
|
|
6930
|
+
Z && (Wd || !H ? /* @__PURE__ */ jsx(InputGroupAddon, {
|
|
6931
|
+
groupOrder: Jd,
|
|
6932
6932
|
small: o,
|
|
6933
6933
|
children: Z
|
|
6934
6934
|
}) : /* @__PURE__ */ jsx(Menu, {
|
|
6935
|
-
groupOrder:
|
|
6935
|
+
groupOrder: Jd,
|
|
6936
6936
|
maxHeight: 380,
|
|
6937
6937
|
disabled: r,
|
|
6938
6938
|
testId: x && `${x}-menu`,
|
|
@@ -6948,7 +6948,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6948
6948
|
label: j ? safeRoundNumbers(i) : i,
|
|
6949
6949
|
inline: !0,
|
|
6950
6950
|
onClick: (n) => {
|
|
6951
|
-
n.stopPropagation(),
|
|
6951
|
+
n.stopPropagation(), Ud(e, t);
|
|
6952
6952
|
},
|
|
6953
6953
|
description: r,
|
|
6954
6954
|
selected: r === Z,
|
package/package.json
CHANGED