@oliasoft-open-source/react-ui-library 4.15.4 → 4.15.6-beta-1
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 +32 -28
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -16,7 +16,7 @@ import * as PropTypes from "prop-types";
|
|
|
16
16
|
import PropTypes__default from "prop-types";
|
|
17
17
|
import ReactDOM, { createPortal, unstable_batchedUpdates, render } from "react-dom";
|
|
18
18
|
import { noop as noop$3, set, get as get$2, isString as isString$3, isNumber as isNumber$1, isBoolean as isBoolean$2, isFunction as isFunction$3, isEmpty, isArray as isArray$1, toNumber, debounce as debounce$2, isObject as isObject$5, isEqual as isEqual$4 } from "lodash";
|
|
19
|
-
import { toString as toString$1, isScientificStringNum, roundToPrecision, toNum, validateNumber, cleanNumStr, stripLeadingZeros, roundToFixed, roundByMagnitude, unitFromQuantity, getUnit, KNOWN_UNITS, ALT_UNITS, isValueWithUnit, getValue as getValue$1, withUnit, convertSamePrecision, convertAndGetValue, split as split$1, label as label$b, isValidNum, getAltUnitsListByQuantity, altUnitsList, getUnitsForQuantity, roundByMagnitudeToFixed } from "@oliasoft-open-source/units";
|
|
19
|
+
import { toString as toString$1, isScientificStringNum, roundToPrecision, toNum, validateNumber, cleanNumStr, stripLeadingZeros, roundToFixed, roundByMagnitude, unitFromQuantity, getUnit, KNOWN_UNITS, ALT_UNITS, isValueWithUnit, getValue as getValue$1, withUnit, convertSamePrecision, convertAndGetValue, round as round$1, split as split$1, label as label$b, isValidNum, getAltUnitsListByQuantity, altUnitsList, getUnitsForQuantity, roundByMagnitudeToFixed } from "@oliasoft-open-source/units";
|
|
20
20
|
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
21
21
|
function getDefaultExportFromCjs(x2) {
|
|
22
22
|
return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
|
|
@@ -4312,7 +4312,7 @@ const Option$2 = ({
|
|
|
4312
4312
|
styles$L.option,
|
|
4313
4313
|
disabled2 ? styles$L.disabled : "",
|
|
4314
4314
|
inline2 ? styles$L.inline : "",
|
|
4315
|
-
selected2 ? styles$L.selected : ""
|
|
4315
|
+
selected2 ? styles$L == null ? void 0 : styles$L.selected : ""
|
|
4316
4316
|
),
|
|
4317
4317
|
onClick: handleClick2,
|
|
4318
4318
|
"data-testid": testId,
|
|
@@ -4378,27 +4378,27 @@ const Section$1 = ({
|
|
|
4378
4378
|
return /* @__PURE__ */ jsx(
|
|
4379
4379
|
Option$2,
|
|
4380
4380
|
{
|
|
4381
|
-
actions: section2.actions,
|
|
4381
|
+
actions: section2 == null ? void 0 : section2.actions,
|
|
4382
4382
|
label: (section2 == null ? void 0 : section2.label) ?? "",
|
|
4383
|
-
url: section2.url,
|
|
4384
|
-
onClick: section2.onClick,
|
|
4385
|
-
description: section2.description,
|
|
4386
|
-
icon: section2.icon,
|
|
4387
|
-
selected: section2.selected,
|
|
4383
|
+
url: section2 == null ? void 0 : section2.url,
|
|
4384
|
+
onClick: section2 == null ? void 0 : section2.onClick,
|
|
4385
|
+
description: section2 == null ? void 0 : section2.description,
|
|
4386
|
+
icon: section2 == null ? void 0 : section2.icon,
|
|
4387
|
+
selected: section2 == null ? void 0 : section2.selected,
|
|
4388
4388
|
closeOnOptionClick,
|
|
4389
4389
|
close: close2,
|
|
4390
|
-
disabled: section2.disabled || disabledContext,
|
|
4391
|
-
inline: section2.inline,
|
|
4392
|
-
title: section2.title,
|
|
4393
|
-
upload: section2.upload,
|
|
4394
|
-
onChange: section2.onChange,
|
|
4395
|
-
testId: section2.testId,
|
|
4396
|
-
component: section2.component
|
|
4390
|
+
disabled: (section2 == null ? void 0 : section2.disabled) || disabledContext,
|
|
4391
|
+
inline: section2 == null ? void 0 : section2.inline,
|
|
4392
|
+
title: section2 == null ? void 0 : section2.title,
|
|
4393
|
+
upload: section2 == null ? void 0 : section2.upload,
|
|
4394
|
+
onChange: section2 == null ? void 0 : section2.onChange,
|
|
4395
|
+
testId: section2 == null ? void 0 : section2.testId,
|
|
4396
|
+
component: section2 == null ? void 0 : section2.component
|
|
4397
4397
|
}
|
|
4398
4398
|
);
|
|
4399
4399
|
case MenuType.MENU:
|
|
4400
4400
|
const selected2 = !!((_b = (_a2 = section2 == null ? void 0 : section2.menu) == null ? void 0 : _a2.sections) == null ? void 0 : _b.find(
|
|
4401
|
-
(s) => s.selected
|
|
4401
|
+
(s) => s == null ? void 0 : s.selected
|
|
4402
4402
|
));
|
|
4403
4403
|
return /* @__PURE__ */ jsx(
|
|
4404
4404
|
DropDownMenu,
|
|
@@ -4623,7 +4623,7 @@ const Text$1 = ({
|
|
|
4623
4623
|
styles$L.trigger,
|
|
4624
4624
|
disabled2 ? styles$L.disabled : null,
|
|
4625
4625
|
isOpen2 ? styles$L.active : null,
|
|
4626
|
-
selected2 ? styles$L.selected : null
|
|
4626
|
+
selected2 ? styles$L == null ? void 0 : styles$L.selected : null
|
|
4627
4627
|
),
|
|
4628
4628
|
children: [
|
|
4629
4629
|
/* @__PURE__ */ jsx("span", { className: styles$L.label, title: titleText, children: label2 }),
|
|
@@ -19468,7 +19468,7 @@ const Option$1 = ({
|
|
|
19468
19468
|
option: option2,
|
|
19469
19469
|
onChange
|
|
19470
19470
|
}) => {
|
|
19471
|
-
const { key: key2, label: label2, selected: selected2 } = option2;
|
|
19471
|
+
const { key: key2, label: label2, selected: selected2 } = option2 ?? {};
|
|
19472
19472
|
return /* @__PURE__ */ jsx("div", { className: styles$q.item, children: /* @__PURE__ */ jsx(CheckBox, { label: label2, noMargin: true, checked: selected2, onChange }) }, key2);
|
|
19473
19473
|
};
|
|
19474
19474
|
const Heading$1 = ({ label: label2 }) => /* @__PURE__ */ jsx("div", { className: styles$q.heading, children: label2 });
|
|
@@ -19519,7 +19519,7 @@ const Layer$1 = ({
|
|
|
19519
19519
|
onClick: (evt) => {
|
|
19520
19520
|
const next2 = options.map((option2) => ({
|
|
19521
19521
|
...option2,
|
|
19522
|
-
selected: !option2.selected
|
|
19522
|
+
selected: !(option2 == null ? void 0 : option2.selected)
|
|
19523
19523
|
}));
|
|
19524
19524
|
onChangeOptions(evt, next2);
|
|
19525
19525
|
},
|
|
@@ -19543,7 +19543,7 @@ const Layer$1 = ({
|
|
|
19543
19543
|
onChange: (evt) => {
|
|
19544
19544
|
const { value } = option2;
|
|
19545
19545
|
const next2 = options.map(
|
|
19546
|
-
(option22) => option22.value !== value ? option22 : { ...option22, selected: !option22.selected }
|
|
19546
|
+
(option22) => option22.value !== value ? option22 : { ...option22, selected: !(option22 == null ? void 0 : option22.selected) }
|
|
19547
19547
|
);
|
|
19548
19548
|
onChangeOptions(evt, next2);
|
|
19549
19549
|
}
|
|
@@ -20546,7 +20546,7 @@ const Option = ({
|
|
|
20546
20546
|
className: cx$2(
|
|
20547
20547
|
styles$n.option,
|
|
20548
20548
|
disabled2 ? styles$n.disabled : "",
|
|
20549
|
-
selected2 ? styles$n.selected : "",
|
|
20549
|
+
selected2 ? styles$n == null ? void 0 : styles$n.selected : "",
|
|
20550
20550
|
focused2 ? styles$n.focused : ""
|
|
20551
20551
|
),
|
|
20552
20552
|
onClick: !disabled2 && onSelectOption ? onSelectOption : void 0,
|
|
@@ -20686,7 +20686,7 @@ const Layer = ({
|
|
|
20686
20686
|
{
|
|
20687
20687
|
closeLayer,
|
|
20688
20688
|
section: sections[index2],
|
|
20689
|
-
selected: isMulti2 && sections[index2].type !== MenuType.HEADING && Array.isArray(selectedOptions) ? selectedOptions.some(
|
|
20689
|
+
selected: isMulti2 && sections[index2].type !== MenuType.HEADING && Array.isArray(selectedOptions) ? selectedOptions == null ? void 0 : selectedOptions.some(
|
|
20690
20690
|
(v2) => {
|
|
20691
20691
|
var _a3;
|
|
20692
20692
|
return v2 && (v2 == null ? void 0 : v2.value) === ((_a3 = sections == null ? void 0 : sections[index2]) == null ? void 0 : _a3.value);
|
|
@@ -21606,10 +21606,10 @@ const getFirstSelectedOptionIndex = (options, selectedOptions) => {
|
|
|
21606
21606
|
const nonExistentValue = (options, selectedOptions) => {
|
|
21607
21607
|
const multi = isMulti(selectedOptions);
|
|
21608
21608
|
const selected2 = multi ? selectedOptions : isEmptyNullOrUndefined(selectedOptions) ? [] : [selectedOptions];
|
|
21609
|
-
return !selected2.every((selectedValue) => {
|
|
21610
|
-
const found2 = options.find((o) => o.value === selectedValue.value);
|
|
21609
|
+
return !(selected2 == null ? void 0 : selected2.every((selectedValue) => {
|
|
21610
|
+
const found2 = options == null ? void 0 : options.find((o) => (o == null ? void 0 : o.value) === (selectedValue == null ? void 0 : selectedValue.value));
|
|
21611
21611
|
return found2 !== void 0;
|
|
21612
|
-
});
|
|
21612
|
+
}));
|
|
21613
21613
|
};
|
|
21614
21614
|
const standardizeInputs = (options, selectedOptions, enableAutoScroll, checkNonExistentValues) => {
|
|
21615
21615
|
const cleanedOptions = Array.isArray(options) ? options : [];
|
|
@@ -21740,7 +21740,7 @@ const Select = (props) => {
|
|
|
21740
21740
|
};
|
|
21741
21741
|
const selectedRowsPerPage = (options, value) => {
|
|
21742
21742
|
return value || options && options.reduce((acc, row2) => {
|
|
21743
|
-
return row2.selected ? Number(row2.value) : acc;
|
|
21743
|
+
return (row2 == null ? void 0 : row2.selected) ? Number(row2 == null ? void 0 : row2.value) : acc;
|
|
21744
21744
|
}, 10) || 10;
|
|
21745
21745
|
};
|
|
21746
21746
|
const numberOfPages = (numberOfRows, pageContainer) => {
|
|
@@ -22157,7 +22157,7 @@ const RadioButton = ({
|
|
|
22157
22157
|
mainLabel && /* @__PURE__ */ jsx("label", { className: cx$2(inline2 && styles$h.labelMargin), children: label2 }),
|
|
22158
22158
|
options.map(
|
|
22159
22159
|
(option2, index2) => {
|
|
22160
|
-
const selected2 = option2.checked || option2.value === selectedValue || false;
|
|
22160
|
+
const selected2 = (option2 == null ? void 0 : option2.checked) || (option2 == null ? void 0 : option2.value) === selectedValue || false;
|
|
22161
22161
|
return /* @__PURE__ */ jsx(
|
|
22162
22162
|
RadioInput,
|
|
22163
22163
|
{
|
|
@@ -70306,6 +70306,10 @@ const initializeContext = (context2) => {
|
|
|
70306
70306
|
UnitContext = context2;
|
|
70307
70307
|
}
|
|
70308
70308
|
};
|
|
70309
|
+
const safeRoundNumbers = (value) => {
|
|
70310
|
+
const isScientific = isScientificStringNum(value);
|
|
70311
|
+
return !isScientific ? safeToString(round$1(toNum(value))) : value;
|
|
70312
|
+
};
|
|
70309
70313
|
const predefinedMenuActive = "_predefinedMenuActive_ye9w9_1";
|
|
70310
70314
|
const inputWrapper = "_inputWrapper_ye9w9_4";
|
|
70311
70315
|
const styles = {
|
|
@@ -70612,7 +70616,7 @@ const UnitInput = ({
|
|
|
70612
70616
|
sections: alternativeUnits.map(([value2, altUnit, label2]) => {
|
|
70613
70617
|
const displayUnit = label2 || altUnit || "";
|
|
70614
70618
|
const safeValue = isValidNum(value2) ? value2 : "";
|
|
70615
|
-
const displayValue = enableCosmeticRounding ?
|
|
70619
|
+
const displayValue = enableCosmeticRounding ? safeRoundNumbers(safeValue) : safeValue;
|
|
70616
70620
|
return {
|
|
70617
70621
|
type: "Option",
|
|
70618
70622
|
label: displayValue,
|