@oliasoft-open-source/react-ui-library 4.7.3 → 4.8.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/assets/{index-D5kcnHmD.js → index-Csdt18_R.js} +1 -9
- package/dist/global.css +4 -1
- package/dist/index.d.ts +16 -6
- package/dist/index.html +1 -1
- package/dist/index.js +121 -158
- package/dist/index.js.map +1 -1
- package/dist/storybook/assets/Color-KGDBMAHA-BS-rAnbo.js +1 -0
- package/dist/storybook/assets/DocsRenderer-PKQXORMH-DZ7r3cmw.js +1 -0
- package/dist/storybook/assets/{accordion-6ouB0WTt.js → accordion-BiuI_LCA.js} +1 -1
- package/dist/storybook/assets/{accordion.stories-DlFZNmdv.js → accordion.stories-CKrpJWRn.js} +2 -2
- package/dist/storybook/assets/{actions-Cu_0szZ4.js → actions-CHgr8eL8.js} +1 -1
- package/dist/storybook/assets/{actions.stories-SCPuAp0T.js → actions.stories-CCDxFKFk.js} +1 -1
- package/dist/storybook/assets/{afe.stories-G3SzS3sg.js → afe.stories-80-X2oCf.js} +2 -2
- package/dist/storybook/assets/{badge.stories-DGYA6_1I.js → badge.stories-D5DA-vxC.js} +1 -1
- package/dist/storybook/assets/{blowout.stories-P0LHuXSY.js → blowout.stories-ES-Fuaqn.js} +1 -1
- package/dist/storybook/assets/{button-_0DiND6h.js → button-VxhoNhrV.js} +1 -1
- package/dist/storybook/assets/{button-group-BYiHMljF.js → button-group-CwJdFo2z.js} +1 -1
- package/dist/storybook/assets/{button-group.stories-Bz6NHaeB.js → button-group.stories-DU5k5qCY.js} +1 -1
- package/dist/storybook/assets/{button.stories-vVBGddVf.js → button.stories-DVtec2Eo.js} +2 -2
- package/dist/storybook/assets/{buttons-and-links-B6aQa-f5.js → buttons-and-links-sTGnmj6h.js} +2 -2
- package/dist/storybook/assets/{card.stories-DIlqxO94.js → card.stories-CsTB0DuM.js} +1 -1
- package/dist/storybook/assets/{casing-loads.stories-0T--WlaD.js → casing-loads.stories-Do3mZuX2.js} +2 -2
- package/dist/storybook/assets/{cell.stories-C5Tkxyfr.js → cell.stories-B0YsumDa.js} +2 -2
- package/dist/storybook/assets/{check-box-DkdQxC5c.js → check-box-BtCGePRy.js} +1 -1
- package/dist/storybook/assets/check-box.stories-B6vW-2Fd.js +126 -0
- package/dist/storybook/assets/{chunk-HLWAVYOI-dB_9CZG8.js → chunk-HLWAVYOI-BqK-R5cR.js} +1 -1
- package/dist/storybook/assets/color-Cvx86PKp.js +25 -0
- package/dist/storybook/assets/{column.stories-C1Sxwh4f.js → column.stories-BxfR9Tla.js} +1 -1
- package/dist/storybook/assets/dialog-Di8hNunM.js +1 -0
- package/dist/storybook/assets/{drawer-vbDFqa4U.js → drawer-BhuWxI7V.js} +1 -1
- package/dist/storybook/assets/{drawer.stories-CmbGsKmS.js → drawer.stories-B-PsNJJ6.js} +4 -4
- package/dist/storybook/assets/{empty.stories-iHPKKy4z.js → empty.stories-BVYXwvpa.js} +1 -1
- package/dist/storybook/assets/{field-DwLk_uWj.js → field-HrLaMLbx.js} +1 -1
- package/dist/storybook/assets/{field.stories-s-0LQVbp.js → field.stories-B9p9nBgY.js} +1 -1
- package/dist/storybook/assets/{file-button.stories-C90kcfbw.js → file-button.stories-FOaiNPt-.js} +1 -1
- package/dist/storybook/assets/{file-input-C_2w1dKj.js → file-input-BpMtsZ2S.js} +1 -1
- package/dist/storybook/assets/{file-input.stories-BEsZox6U.js → file-input.stories-Jrdw5k-s.js} +1 -1
- package/dist/storybook/assets/{flex.stories-D-QN0gkk.js → flex.stories-BEXf0VqI.js} +1 -1
- package/dist/storybook/assets/footer.stories-CMN_mVki.js +3 -0
- package/dist/storybook/assets/form.stories-C1Qx3M_1.js +49 -0
- package/dist/storybook/assets/formation.stories-CCJYaUpG.js +74 -0
- package/dist/storybook/assets/{heading-DkSFysAb.js → heading-CRNoBc7q.js} +1 -1
- package/dist/storybook/assets/{heading.stories-Dtq7LNlB.js → heading.stories-DahFxeiX.js} +1 -1
- package/dist/storybook/assets/{help-icon-LfPZiYla.js → help-icon-Buhx5nl6.js} +1 -1
- package/dist/storybook/assets/{help-icon.stories-Dh2ylnGq.js → help-icon.stories-DbmZ1fgP.js} +1 -1
- package/dist/storybook/assets/icon-BSFY3vDO.js +8 -0
- package/dist/storybook/assets/{icon.stories-B-tKaIKA.js → icon.stories-C1hZXIMX.js} +1 -1
- package/dist/storybook/assets/iframe-CUVhB5TR.js +2 -0
- package/dist/storybook/assets/{index-ccPuy0l1.js → index-B8zF6D3V.js} +8 -8
- package/dist/storybook/assets/index-Be0hXiyp.js +179 -0
- package/dist/storybook/assets/index-CF7H4eMJ.js +28 -0
- package/dist/storybook/assets/index-omjWi7I7.js +1 -0
- package/dist/storybook/assets/{index.es-D2piFfFj.js → index.es-DazXb-ul.js} +4 -4
- package/dist/storybook/assets/inheritsLoose-DP0QEDDI.js +1 -0
- package/dist/storybook/assets/{input-D97ganXq.js → input-BW9trNAW.js} +1 -1
- package/dist/storybook/assets/{input-group.stories-BcoORZ9x.js → input-group.stories-44quIZTV.js} +2 -2
- package/dist/storybook/assets/{input-validation-CLVu4gtl.js → input-validation-BREYBXzB.js} +2 -2
- package/dist/storybook/assets/{input.stories-BHdUwYqV.js → input.stories-BruLeJ44.js} +1 -1
- package/dist/storybook/assets/{inputs-qWlLPYX_.js → inputs-DkxT6vDD.js} +2 -2
- package/dist/storybook/assets/{label-tWjEmTQJ.js → label-CqmyC9he.js} +1 -1
- package/dist/storybook/assets/{label.stories-BTA8N7tD.js → label.stories-C0AO5F1a.js} +1 -1
- package/dist/storybook/assets/layout-forms-Y0Chz5wF.js +16 -0
- package/dist/storybook/assets/{layout-general-Dn1nlXYw.js → layout-general-CRJUCd3s.js} +2 -2
- package/dist/storybook/assets/{list-BpVed6Pw.js → list-yVTOdmpX.js} +1 -1
- package/dist/storybook/assets/{list.stories-CiT9J_FH.js → list.stories-ChqQXY5M.js} +2 -2
- package/dist/storybook/assets/{list.stories-data-CnVYk3eo.js → list.stories-data-Iq66w9oH.js} +1 -1
- package/dist/storybook/assets/{loader.stories-BKBFctQ1.js → loader.stories-DM7ZJBgz.js} +1 -1
- package/dist/storybook/assets/menu.stories-Dozt6Npk.js +84 -0
- package/dist/storybook/assets/message-BYzRg8Ae.js +1 -0
- package/dist/storybook/assets/{message.stories-C8YRT7nL.js → message.stories-K3bQ-5bJ.js} +1 -1
- package/dist/storybook/assets/{meta-content-Djgg-tiF.js → meta-content-cbHGvPJ7.js} +1 -1
- package/dist/storybook/assets/modal.stories-BX49dKIM.js +220 -0
- package/dist/storybook/assets/{number-input-B-Nmya5O.js → number-input-CD-fbjVQ.js} +1 -1
- package/dist/storybook/assets/number-input.stories-h1PlFB_G.js +105 -0
- package/dist/storybook/assets/{option-dropdown.stories-COGmMWEl.js → option-dropdown.stories-CoLsSS95.js} +1 -1
- package/dist/storybook/assets/{padding-and-spacing-BNiScrzg.js → padding-and-spacing-DYx_u7EA.js} +2 -2
- package/dist/storybook/assets/{page.stories-BB3g1zwB.js → page.stories-Cse3cMsO.js} +1 -1
- package/dist/storybook/assets/{pagination-DSQeMPG_.js → pagination-iSMIbR33.js} +1 -1
- package/dist/storybook/assets/pagination.stories-BUPaZD5R.js +59 -0
- package/dist/storybook/assets/{pop-confirm.stories-Cr_ZBbLn.js → pop-confirm.stories-Dhid1FK8.js} +1 -1
- package/dist/storybook/assets/popover-CzZdWNnB.js +1 -0
- package/dist/storybook/assets/popover.stories-Duemqiqp.js +10 -0
- package/dist/storybook/assets/{preview-DhMlVLsE.js → preview-B2Xzz4-3.js} +2 -2
- package/dist/storybook/assets/preview-DLBQXbKW.js +1 -0
- package/dist/storybook/assets/preview-kt6m1zZo.js +2 -0
- package/dist/storybook/assets/projects.stories-DU-QlBa6.js +47 -0
- package/dist/storybook/assets/{radio-button-BD7pi0ao.js → radio-button-YBwYcMaM.js} +1 -1
- package/dist/storybook/assets/radio-button.stories-8QEKlNvO.js +71 -0
- package/dist/storybook/assets/react-router-dom-Ck2Y_Fzc.js +8 -0
- package/dist/storybook/assets/{reservoirs.stories-kxVBoa7Y.js → reservoirs.stories-aSZ9r1Pu.js} +2 -2
- package/dist/storybook/assets/{rich-text-input.stories-C5pcIbSa.js → rich-text-input.stories-CsFyrKRA.js} +3 -3
- package/dist/storybook/assets/{row.stories-ATsrjumb.js → row.stories-ZCrMoTuY.js} +2 -2
- package/dist/storybook/assets/select-C8iu4-uz.js +40 -0
- package/dist/storybook/assets/select.stories-DbgjgsiX.js +579 -0
- package/dist/storybook/assets/{side-bar-WsK6pkmj.js → side-bar-CKbHPgIV.js} +1 -1
- package/dist/storybook/assets/{side-bar.stories-Bu2q_b_w.js → side-bar.stories-MUj_dj1F.js} +1 -1
- package/dist/storybook/assets/{site.stories-Yh4uNi3Q.js → site.stories-Ci4g5W2A.js} +2 -2
- package/dist/storybook/assets/{slider-CxVlS0fh.js → slider-DAramr8j.js} +4 -4
- package/dist/storybook/assets/{slider.stories-_wS70xsm.js → slider.stories-Cd0rLfHP.js} +2 -2
- package/dist/storybook/assets/{smart-upload-modal.stories-DDlO9y2j.js → smart-upload-modal.stories-DgnJ79fa.js} +1 -1
- package/dist/storybook/assets/{spacer.stories-B3LrTr7b.js → spacer.stories-CHEZdgDM.js} +1 -1
- package/dist/storybook/assets/{table-DPvzYjoq.js → table-ZQD4ELIM.js} +1 -1
- package/dist/storybook/assets/{table.stories-BGQ1O9nw.js → table.stories-DGedoAir.js} +2 -2
- package/dist/storybook/assets/{table.stories-data-2STKbgzG.js → table.stories-data-CR9VpXHs.js} +1 -1
- package/dist/storybook/assets/text-link.stories-BQAkVO-W.js +14 -0
- package/dist/storybook/assets/{textarea-DOJDK8hI.js → textarea-BV7xWEdt.js} +1 -1
- package/dist/storybook/assets/{textarea.stories-CKm5MlQF.js → textarea.stories-aRLEoDHg.js} +1 -1
- package/dist/storybook/assets/{title.stories-CVRTXggL.js → title.stories-jQBBSflc.js} +2 -2
- package/dist/storybook/assets/toaster-BNO0suPv.js +1 -0
- package/dist/storybook/assets/toaster.stories-CAqrDYpd.js +89 -0
- package/dist/storybook/assets/{toggle-t1iTuSL7.js → toggle-CBpNgTrm.js} +1 -1
- package/dist/storybook/assets/toggle.stories-t0T4HV1D.js +141 -0
- package/dist/storybook/assets/{tooltip-C_E_6ym5.js → tooltip-1V7clEnw.js} +1 -1
- package/dist/storybook/assets/{tooltip.stories-C70ADjjJ.js → tooltip.stories-1YexWg6N.js} +1 -1
- package/dist/storybook/assets/{tooltip.test-case.stories-BtrJUImB.js → tooltip.test-case.stories-i9YQqba1.js} +1 -1
- package/dist/storybook/assets/{top-bar-R-CjhJ21.js → top-bar-C_tn2Pc5.js} +1 -1
- package/dist/storybook/assets/top-bar.stories-B2a-RgK-.js +21 -0
- package/dist/storybook/assets/{top-bar.testcase.stories-ZPaSRyIh.js → top-bar.testcase.stories-DoPEAMYc.js} +1 -1
- package/dist/storybook/assets/{tree.stories-Ghxps-dL.js → tree.stories-6UHASEZu.js} +1 -1
- package/dist/storybook/assets/{unit-input.stories-Bqt0CdF7.js → unit-input.stories-C7XlUSaC.js} +1 -1
- package/dist/storybook/assets/unit-table.stories-BJbxGp7Y.js +150 -0
- package/dist/storybook/iframe.html +1 -1
- package/dist/storybook/index.html +6 -2
- package/dist/storybook/index.json +1 -1
- package/dist/storybook/project.json +1 -1
- package/dist/storybook/sb-addons/interactions-2/manager-bundle.js +233 -0
- package/dist/storybook/sb-addons/storybook-dark-mode-esm-preset-3/manager-bundle.js.LEGAL.txt +0 -0
- package/package.json +1 -1
- package/dist/404.html +0 -1
- package/dist/storybook/assets/Color-KGDBMAHA-RK4YYQs0.js +0 -1
- package/dist/storybook/assets/DocsRenderer-PKQXORMH-B0ryFlHH.js +0 -1
- package/dist/storybook/assets/check-box.stories-D8C12IQo.js +0 -102
- package/dist/storybook/assets/color-BSzeqkLx.js +0 -25
- package/dist/storybook/assets/dialog-CAWCUmp3.js +0 -1
- package/dist/storybook/assets/extends-CF3RwP-h.js +0 -1
- package/dist/storybook/assets/footer.stories-U_zMDmxF.js +0 -3
- package/dist/storybook/assets/form.stories-1L75MGpX.js +0 -49
- package/dist/storybook/assets/formation.stories-YHpXrXvC.js +0 -74
- package/dist/storybook/assets/icon-BP4BO6-k.js +0 -8
- package/dist/storybook/assets/iframe-CNFcCVDc.js +0 -2
- package/dist/storybook/assets/index-BIwFZkUc.js +0 -1
- package/dist/storybook/assets/inheritsLoose-DR8r8Ogv.js +0 -1
- package/dist/storybook/assets/layout-forms-p4s8eHw6.js +0 -16
- package/dist/storybook/assets/menu.stories-Bp8L83xx.js +0 -82
- package/dist/storybook/assets/message-ttrR1AaP.js +0 -1
- package/dist/storybook/assets/modal.stories-BoVj2EsX.js +0 -200
- package/dist/storybook/assets/number-input.stories-CcNTeD25.js +0 -97
- package/dist/storybook/assets/pagination.stories-DjIohcDx.js +0 -59
- package/dist/storybook/assets/popover-Dq3iC_lM.js +0 -1
- package/dist/storybook/assets/popover.stories-CoWCb2Mn.js +0 -10
- package/dist/storybook/assets/preview-CZPuAPNr.js +0 -2
- package/dist/storybook/assets/projects.stories-BesbPJ8Z.js +0 -47
- package/dist/storybook/assets/radio-button.stories-B84Ip3NV.js +0 -61
- package/dist/storybook/assets/react-router-dom-CMITYWBH.js +0 -8
- package/dist/storybook/assets/select-78sreKsp.js +0 -40
- package/dist/storybook/assets/select.stories-CZwsHVDB.js +0 -914
- package/dist/storybook/assets/text-link.stories-BsuVBOWo.js +0 -14
- package/dist/storybook/assets/toaster-DPbde9Mi.js +0 -1
- package/dist/storybook/assets/toaster.stories-DfbfDavp.js +0 -86
- package/dist/storybook/assets/toggle.stories-D44S3Nix.js +0 -117
- package/dist/storybook/assets/top-bar.stories-BYN9rcUw.js +0 -21
- package/dist/storybook/assets/unit-table.stories-DXies3fA.js +0 -150
- /package/dist/storybook/sb-addons/{storybook-dark-mode-esm-preset-2 → interactions-2}/manager-bundle.js.LEGAL.txt +0 -0
- /package/dist/storybook/sb-addons/{storybook-dark-mode-esm-preset-2 → storybook-dark-mode-esm-preset-3}/manager-bundle.js +0 -0
|
@@ -11918,15 +11918,7 @@ const TooltipLayer = ({
|
|
|
11918
11918
|
...layerProps,
|
|
11919
11919
|
children: [
|
|
11920
11920
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { maxWidth, fontSize, padding: padding2 }, children: text2 }),
|
|
11921
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
11922
|
-
Arrow,
|
|
11923
|
-
{
|
|
11924
|
-
...arrowProps,
|
|
11925
|
-
size: 6,
|
|
11926
|
-
onPointerEnterCapture: void 0,
|
|
11927
|
-
onPointerLeaveCapture: void 0
|
|
11928
|
-
}
|
|
11929
|
-
)
|
|
11921
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Arrow, { ...arrowProps, size: 6 })
|
|
11930
11922
|
]
|
|
11931
11923
|
}
|
|
11932
11924
|
);
|
package/dist/global.css
CHANGED
|
@@ -11222,6 +11222,9 @@ tbody ._staticCell_u3xdj_116 ._staticCellContent_u3xdj_119 {
|
|
|
11222
11222
|
background-color: var(--color-background-primary);
|
|
11223
11223
|
transform: translate(-50%, -50%);
|
|
11224
11224
|
}
|
|
11225
|
-
.
|
|
11225
|
+
._predefinedMenuActive_ye9w9_1 input {
|
|
11226
11226
|
background: var(--color-background-disabled) !important;
|
|
11227
11227
|
}
|
|
11228
|
+
._inputWrapper_ye9w9_4 {
|
|
11229
|
+
flex: 1;
|
|
11230
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -900,6 +900,7 @@ declare interface INumberInputCell extends TCommonCell {
|
|
|
900
900
|
left?: boolean;
|
|
901
901
|
validationCallback?: TEmpty;
|
|
902
902
|
allowEmpty?: boolean;
|
|
903
|
+
enableCosmeticRounding: boolean;
|
|
903
904
|
enableDisplayRounding: boolean;
|
|
904
905
|
roundDisplayValue: (value: TStringNumberNull) => TStringNumberNull;
|
|
905
906
|
}
|
|
@@ -928,8 +929,10 @@ export declare interface INumberInputProps {
|
|
|
928
929
|
allowEmpty?: boolean;
|
|
929
930
|
isInTable?: boolean;
|
|
930
931
|
groupOrder?: any;
|
|
932
|
+
enableCosmeticRounding?: boolean;
|
|
931
933
|
enableDisplayRounding?: boolean;
|
|
932
934
|
roundDisplayValue?: (args: TStringNumberNull) => TStringNumberNull;
|
|
935
|
+
disableInternalErrorValidationMessages?: boolean;
|
|
933
936
|
}
|
|
934
937
|
|
|
935
938
|
export declare interface IOptionDropdownProps {
|
|
@@ -1578,10 +1581,7 @@ export declare interface IUnitInputProps {
|
|
|
1578
1581
|
initialPredefinedOption?: boolean;
|
|
1579
1582
|
shouldLinkAutomaticly?: boolean;
|
|
1580
1583
|
selectedPredefinedOptionKey?: string;
|
|
1581
|
-
validationCallback?: (
|
|
1582
|
-
name: string;
|
|
1583
|
-
error: string | null;
|
|
1584
|
-
};
|
|
1584
|
+
validationCallback?: (params: IUnitInputValidationCallbackPayload) => void;
|
|
1585
1585
|
disabledValidation?: boolean;
|
|
1586
1586
|
allowEmpty?: boolean;
|
|
1587
1587
|
autoValue?: string;
|
|
@@ -1590,6 +1590,16 @@ export declare interface IUnitInputProps {
|
|
|
1590
1590
|
onClick?: MouseEventHandler<HTMLInputElement>;
|
|
1591
1591
|
onFocus?: FocusEventHandler<HTMLInputElement>;
|
|
1592
1592
|
unitTemplate?: Record<string, any>;
|
|
1593
|
+
convertBackToStorageUnit?: boolean;
|
|
1594
|
+
enableCosmeticRounding?: boolean;
|
|
1595
|
+
enableDisplayRounding?: boolean;
|
|
1596
|
+
}
|
|
1597
|
+
|
|
1598
|
+
declare interface IUnitInputValidationCallbackPayload {
|
|
1599
|
+
name: string | {
|
|
1600
|
+
fieldName: string;
|
|
1601
|
+
};
|
|
1602
|
+
error: string | null;
|
|
1593
1603
|
}
|
|
1594
1604
|
|
|
1595
1605
|
declare interface IUnitTable extends Omit<ITableProps['table'], 'rows'> {
|
|
@@ -1671,7 +1681,7 @@ export declare const Modal: ({ children, visible, centered, width, onEnter, onEs
|
|
|
1671
1681
|
|
|
1672
1682
|
export declare const NativeSelect: ({ disabled, error, warning, tooltip, options, onChange, onFocus, onBlur, right, small, tabIndex, selectedOption, width, groupOrder, testId, isInTable, clearable, placeholder, hasNonExistentValue, maxTooltipWidth, borderRadius, }: INativeSelectProps) => JSX_2.Element;
|
|
1673
1683
|
|
|
1674
|
-
export declare const NumberInput: ({ name, placeholder, disabled, error, left, small, width, value, onChange, onFocus, onBlur, tabIndex, testId, tooltip, warning, validationCallback, allowEmpty, isInTable, groupOrder, enableDisplayRounding, roundDisplayValue, }: INumberInputProps) => JSX_2.Element;
|
|
1684
|
+
export declare const NumberInput: ({ name, placeholder, disabled, error, left, small, width, value, onChange, onFocus, onBlur, tabIndex, testId, tooltip, warning, validationCallback, allowEmpty, isInTable, groupOrder, enableCosmeticRounding, enableDisplayRounding, roundDisplayValue, disableInternalErrorValidationMessages, }: INumberInputProps) => JSX_2.Element;
|
|
1675
1685
|
|
|
1676
1686
|
export declare const OptionDropdown: ({ name, label, options, onChange, showHeader, maxHeight, }: IOptionDropdownProps) => ReactElement;
|
|
1677
1687
|
|
|
@@ -1852,7 +1862,7 @@ export declare type TTriggerType = 'Text' | 'Button' | 'DropDownButton' | 'Compo
|
|
|
1852
1862
|
|
|
1853
1863
|
declare type TUnitTableCellShape = TCellShape | IUnitTableStaticCell | IUnitTableInputCell | IUnitTableNumberInputCell;
|
|
1854
1864
|
|
|
1855
|
-
export declare const UnitInput: ({ name, placeholder, disabled, disabledUnit, error, left, small, width, value, unitkey, initUnit, noConversion, onChange, onClick, onFocus, onSwitchUnit, unitTemplate, doNotConvertValue, testId, warning, predefinedOptions, initialPredefinedOption, shouldLinkAutomaticly, selectedPredefinedOptionKey, validationCallback, disabledValidation, allowEmpty, autoValue, }: IUnitInputProps) => JSX_2.Element;
|
|
1865
|
+
export declare const UnitInput: ({ name, placeholder, disabled, disabledUnit, error, left, small, width, value, unitkey, initUnit, noConversion, onChange, onClick, onFocus, onSwitchUnit, unitTemplate, doNotConvertValue, testId, warning, predefinedOptions, initialPredefinedOption, shouldLinkAutomaticly, selectedPredefinedOptionKey, validationCallback, disabledValidation, allowEmpty, autoValue, convertBackToStorageUnit, enableCosmeticRounding, enableDisplayRounding, }: IUnitInputProps) => JSX_2.Element;
|
|
1856
1866
|
|
|
1857
1867
|
export declare const UnitTable: ({ table, unitConfig, convertBackToStorageUnit, enableCosmeticRounding, enableDisplayRounding, }: IUnitTableProps) => JSX_2.Element;
|
|
1858
1868
|
|
package/dist/index.html
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<!doctype html><head><title>React UI Library</title><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1" user-scalable="no"><meta name="apple-mobile-web-app-capable" content="yes"><script type="module" crossorigin src="/react-ui-library/assets/index-
|
|
1
|
+
<!doctype html><head><title>React UI Library</title><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1" user-scalable="no"><meta name="apple-mobile-web-app-capable" content="yes"><script type="module" crossorigin src="/react-ui-library/assets/index-Csdt18_R.js"></script><link rel="stylesheet" crossorigin href="/react-ui-library/assets/index-Oe0PlEED.css"></head><body><div id="content"></div></body>
|
package/dist/index.js
CHANGED
|
@@ -7,9 +7,8 @@ import React__default, { useContext, isValidElement, useState, useRef, useEffect
|
|
|
7
7
|
import * as PropTypes from "prop-types";
|
|
8
8
|
import PropTypes__default from "prop-types";
|
|
9
9
|
import ReactDOM, { createPortal, unstable_batchedUpdates, render } from "react-dom";
|
|
10
|
-
import _$1, { 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,
|
|
11
|
-
import { roundToFixed, validateNumber, cleanNumStr, unitFromQuantity, isValueWithUnit, withUnit, convertSamePrecision, getValue as getValue$1, getUnit, KNOWN_UNITS, split as split$1,
|
|
12
|
-
import { isValueWithUnit as isValueWithUnit$1 } from "@oliasoft-open-source/units/dist/units";
|
|
10
|
+
import _$1, { 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";
|
|
11
|
+
import { isScientificStringNum, roundToPrecision, roundToFixed, validateNumber, cleanNumStr, unitFromQuantity, isValueWithUnit, withUnit, convertSamePrecision, getValue as getValue$1, getUnit, KNOWN_UNITS, split as split$1, label as label$b, altUnitsList, convertAndGetValue, getUnitsForQuantity, roundByMagnitudeToFixed } from "@oliasoft-open-source/units";
|
|
13
12
|
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
14
13
|
function getDefaultExportFromCjs(x2) {
|
|
15
14
|
return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
|
|
@@ -55454,7 +55453,7 @@ const inputDisabled$1 = "_inputDisabled_u3xdj_61";
|
|
|
55454
55453
|
const hideScrollbars$1 = "_hideScrollbars_u3xdj_67";
|
|
55455
55454
|
const cell = "_cell_u3xdj_77";
|
|
55456
55455
|
const disabledLink = "_disabledLink_u3xdj_87";
|
|
55457
|
-
const inputWrapper = "_inputWrapper_u3xdj_91";
|
|
55456
|
+
const inputWrapper$1 = "_inputWrapper_u3xdj_91";
|
|
55458
55457
|
const breakWord = "_breakWord_u3xdj_106";
|
|
55459
55458
|
const inputCell = "_inputCell_u3xdj_109";
|
|
55460
55459
|
const sliderCell = "_sliderCell_u3xdj_112";
|
|
@@ -55484,7 +55483,7 @@ const styles$7 = {
|
|
|
55484
55483
|
hideScrollbars: hideScrollbars$1,
|
|
55485
55484
|
cell,
|
|
55486
55485
|
disabledLink,
|
|
55487
|
-
inputWrapper,
|
|
55486
|
+
inputWrapper: inputWrapper$1,
|
|
55488
55487
|
breakWord,
|
|
55489
55488
|
inputCell,
|
|
55490
55489
|
sliderCell,
|
|
@@ -55540,6 +55539,11 @@ const InputCell = ({
|
|
|
55540
55539
|
}
|
|
55541
55540
|
);
|
|
55542
55541
|
};
|
|
55542
|
+
const COSMETIC_ROUNDING_DEFAULT_PRECISION = 14;
|
|
55543
|
+
const roundNumberCosmetic = (value) => {
|
|
55544
|
+
const isScientific = isScientificStringNum(value);
|
|
55545
|
+
return !isScientific ? roundToPrecision(value, COSMETIC_ROUNDING_DEFAULT_PRECISION) : value;
|
|
55546
|
+
};
|
|
55543
55547
|
const getStringName$1 = (name2) => {
|
|
55544
55548
|
if (!name2) return "";
|
|
55545
55549
|
if (typeof name2 === "string") {
|
|
@@ -55573,61 +55577,58 @@ const NumberInput = ({
|
|
|
55573
55577
|
allowEmpty = false,
|
|
55574
55578
|
isInTable: isInTable2,
|
|
55575
55579
|
groupOrder,
|
|
55580
|
+
enableCosmeticRounding = true,
|
|
55576
55581
|
enableDisplayRounding = false,
|
|
55577
|
-
roundDisplayValue
|
|
55582
|
+
roundDisplayValue,
|
|
55583
|
+
disableInternalErrorValidationMessages = false
|
|
55578
55584
|
}) => {
|
|
55579
55585
|
const inputRef = useRef(null);
|
|
55580
|
-
const [displayValue, setDisplayValue] = useState(value);
|
|
55581
|
-
const [validationError, setValidationError] = useState(null);
|
|
55586
|
+
const [displayValue, setDisplayValue] = useState(String(value));
|
|
55582
55587
|
const [focus2, setFocus] = useState(false);
|
|
55588
|
+
const [pristine, setPristine] = useState(true);
|
|
55583
55589
|
const stringName = getStringName$1(name2);
|
|
55584
55590
|
const validateInputValue = (value2) => {
|
|
55585
|
-
|
|
55591
|
+
const validation = validateNumber(value2);
|
|
55586
55592
|
if (allowEmpty && value2 === "" || validation.valid) {
|
|
55587
55593
|
return { ...validation, valid: true, errors: void 0 };
|
|
55588
55594
|
} else {
|
|
55589
55595
|
return validation;
|
|
55590
55596
|
}
|
|
55591
55597
|
};
|
|
55598
|
+
const { valid, errors: errors2 } = validateInputValue(displayValue);
|
|
55599
|
+
const firstError = errors2 && errors2.length && !disableInternalErrorValidationMessages ? errors2[0] : null;
|
|
55592
55600
|
useEffect(() => {
|
|
55593
|
-
|
|
55594
|
-
|
|
55595
|
-
|
|
55596
|
-
|
|
55597
|
-
validationCallback(stringName, null);
|
|
55598
|
-
} else {
|
|
55599
|
-
const firstError = errors2 && errors2.length ? errors2[0] : null;
|
|
55600
|
-
setValidationError(firstError);
|
|
55601
|
+
setDisplayValue(String(value));
|
|
55602
|
+
}, [value, enableCosmeticRounding, enableDisplayRounding]);
|
|
55603
|
+
useEffect(() => {
|
|
55604
|
+
if (!focus2 && !valid) {
|
|
55601
55605
|
validationCallback(stringName, firstError);
|
|
55606
|
+
} else {
|
|
55607
|
+
validationCallback(stringName, null);
|
|
55602
55608
|
}
|
|
55603
|
-
}, [
|
|
55604
|
-
const
|
|
55605
|
-
|
|
55606
|
-
|
|
55607
|
-
const inputValue = cleanNumStr(
|
|
55608
|
-
value2.replaceAll(" ", "").replaceAll("|", "")
|
|
55609
|
-
);
|
|
55610
|
-
const { valid, errors: errors2 } = validateInputValue(inputValue);
|
|
55611
|
-
if (valid) {
|
|
55612
|
-
const newEvent = {
|
|
55609
|
+
}, [focus2, valid, error2]);
|
|
55610
|
+
const onChangeValue = (evt) => {
|
|
55611
|
+
if (valid && !pristine) {
|
|
55612
|
+
const event = {
|
|
55613
55613
|
...evt,
|
|
55614
55614
|
target: {
|
|
55615
55615
|
...evt.target,
|
|
55616
|
-
value:
|
|
55616
|
+
value: String(displayValue),
|
|
55617
55617
|
name: stringName
|
|
55618
55618
|
}
|
|
55619
55619
|
};
|
|
55620
|
-
onChange(
|
|
55621
|
-
setDisplayValue(inputValue);
|
|
55622
|
-
setValidationError(null);
|
|
55623
|
-
validationCallback(stringName, null);
|
|
55624
|
-
} else {
|
|
55625
|
-
setDisplayValue(inputValue);
|
|
55626
|
-
const firstError = errors2 && errors2.length ? errors2[0] : null;
|
|
55627
|
-
setValidationError(firstError);
|
|
55628
|
-
validationCallback(stringName, firstError);
|
|
55620
|
+
onChange(event);
|
|
55629
55621
|
}
|
|
55630
55622
|
};
|
|
55623
|
+
const onSetValue = (evt) => {
|
|
55624
|
+
const input2 = evt.target;
|
|
55625
|
+
const { value: value2 } = input2;
|
|
55626
|
+
const inputValue = cleanNumStr(
|
|
55627
|
+
value2.replaceAll(" ", "").replaceAll("|", "")
|
|
55628
|
+
);
|
|
55629
|
+
setDisplayValue(inputValue);
|
|
55630
|
+
setPristine(false);
|
|
55631
|
+
};
|
|
55631
55632
|
useEffect(() => {
|
|
55632
55633
|
if (inputRef && (inputRef == null ? void 0 : inputRef.current) && enableDisplayRounding && focus2) {
|
|
55633
55634
|
const textInput = inputRef.current;
|
|
@@ -55645,33 +55646,48 @@ const NumberInput = ({
|
|
|
55645
55646
|
};
|
|
55646
55647
|
const onInputBlur = (evt) => {
|
|
55647
55648
|
setFocus(false);
|
|
55649
|
+
onChangeValue(evt);
|
|
55648
55650
|
onBlur(evt);
|
|
55649
55651
|
};
|
|
55650
|
-
const
|
|
55652
|
+
const shouldDisplayRound = enableDisplayRounding && !focus2 && valid;
|
|
55653
|
+
const valueWithDisplayRounding = shouldDisplayRound ? roundDisplayValue ? String(roundDisplayValue(displayValue)) : roundToFixed(displayValue, 2) : displayValue;
|
|
55654
|
+
const displayValueEndsWithZero = !!(valueWithDisplayRounding == null ? void 0 : valueWithDisplayRounding.endsWith("0"));
|
|
55655
|
+
const shouldCosmeticallyRound = enableCosmeticRounding && // only when prop is enabled
|
|
55656
|
+
valueWithDisplayRounding && // not when empty typed value
|
|
55657
|
+
!displayValueEndsWithZero && // not when intentionally trying to type trailing zeros as interim values (OW-17109)
|
|
55658
|
+
valid;
|
|
55659
|
+
const valueWithCosmeticRounding = shouldCosmeticallyRound ? roundNumberCosmetic(valueWithDisplayRounding) : valueWithDisplayRounding;
|
|
55651
55660
|
return /* @__PURE__ */ jsx(
|
|
55652
|
-
|
|
55661
|
+
KeyboardEventHandler,
|
|
55653
55662
|
{
|
|
55654
|
-
|
|
55655
|
-
|
|
55656
|
-
|
|
55657
|
-
|
|
55658
|
-
|
|
55659
|
-
|
|
55660
|
-
|
|
55661
|
-
|
|
55662
|
-
|
|
55663
|
-
|
|
55664
|
-
|
|
55665
|
-
|
|
55666
|
-
|
|
55667
|
-
|
|
55668
|
-
|
|
55669
|
-
|
|
55670
|
-
|
|
55671
|
-
|
|
55672
|
-
|
|
55673
|
-
|
|
55674
|
-
|
|
55663
|
+
handleKeys: [EventKey.ENTER],
|
|
55664
|
+
onKeyEvent: (_key, evt) => onChangeValue(evt),
|
|
55665
|
+
children: /* @__PURE__ */ jsx(
|
|
55666
|
+
Input$1,
|
|
55667
|
+
{
|
|
55668
|
+
type: "text",
|
|
55669
|
+
name: stringName,
|
|
55670
|
+
testId,
|
|
55671
|
+
disabled: disabled2,
|
|
55672
|
+
placeholder: placeholder3,
|
|
55673
|
+
value: valueWithCosmeticRounding,
|
|
55674
|
+
onChange: onSetValue,
|
|
55675
|
+
onFocus: onInputFocus,
|
|
55676
|
+
onBlur: onInputBlur,
|
|
55677
|
+
error: !focus2 && (firstError || error2),
|
|
55678
|
+
warning: warning2,
|
|
55679
|
+
right: !left2,
|
|
55680
|
+
small: small2,
|
|
55681
|
+
width: width2,
|
|
55682
|
+
isInTable: isInTable2,
|
|
55683
|
+
groupOrder,
|
|
55684
|
+
tabIndex,
|
|
55685
|
+
tooltip: tooltip2,
|
|
55686
|
+
ref: inputRef
|
|
55687
|
+
},
|
|
55688
|
+
stringName
|
|
55689
|
+
)
|
|
55690
|
+
}
|
|
55675
55691
|
);
|
|
55676
55692
|
};
|
|
55677
55693
|
const NumberInputCell = ({ cell: cell2, testId }) => {
|
|
@@ -55697,6 +55713,7 @@ const NumberInputCell = ({ cell: cell2, testId }) => {
|
|
|
55697
55713
|
tooltip: cell2.tooltip,
|
|
55698
55714
|
validationCallback: cell2.validationCallback,
|
|
55699
55715
|
allowEmpty: cell2.allowEmpty,
|
|
55716
|
+
enableCosmeticRounding: cell2.enableCosmeticRounding,
|
|
55700
55717
|
enableDisplayRounding: cell2.enableDisplayRounding,
|
|
55701
55718
|
roundDisplayValue: cell2.roundDisplayValue
|
|
55702
55719
|
}
|
|
@@ -70067,45 +70084,6 @@ const getStringName = (name2) => {
|
|
|
70067
70084
|
}
|
|
70068
70085
|
return typeof name2 === "string" ? name2 : "";
|
|
70069
70086
|
};
|
|
70070
|
-
const isErrorObject = (error2) => isObjectLike(error2) && has$1(error2, "message");
|
|
70071
|
-
const getErrorMessage = (error2) => {
|
|
70072
|
-
if (typeof error2 === "string") {
|
|
70073
|
-
return error2;
|
|
70074
|
-
} else if (isErrorObject(error2)) {
|
|
70075
|
-
return error2.message;
|
|
70076
|
-
} else {
|
|
70077
|
-
return null;
|
|
70078
|
-
}
|
|
70079
|
-
};
|
|
70080
|
-
const hasLeadingZeroes = (value) => {
|
|
70081
|
-
return value.search(RegExp(/(^0{2}\.)|(^0+[1-9])/g)) === 0;
|
|
70082
|
-
};
|
|
70083
|
-
const validate = (value, options) => {
|
|
70084
|
-
var _a;
|
|
70085
|
-
const {
|
|
70086
|
-
allowEmpty = false,
|
|
70087
|
-
autoValue,
|
|
70088
|
-
placeholder: placeholder3,
|
|
70089
|
-
disabledValidation = false
|
|
70090
|
-
} = options || {};
|
|
70091
|
-
const stringValue = String(value);
|
|
70092
|
-
if (disabledValidation || autoValue || placeholder3) {
|
|
70093
|
-
return null;
|
|
70094
|
-
}
|
|
70095
|
-
const cleanValue = isValueWithUnit$1(stringValue) ? getValue$1(stringValue) : stringValue;
|
|
70096
|
-
if (allowEmpty && cleanValue === "") {
|
|
70097
|
-
return null;
|
|
70098
|
-
}
|
|
70099
|
-
if (hasLeadingZeroes(cleanValue)) {
|
|
70100
|
-
return "Invalid number format due to leading zeroes";
|
|
70101
|
-
}
|
|
70102
|
-
const validationErrors = validateNumber(cleanValue);
|
|
70103
|
-
if (!validationErrors.valid) {
|
|
70104
|
-
const firstError = ((_a = validationErrors == null ? void 0 : validationErrors.errors) == null ? void 0 : _a[0]) ?? null;
|
|
70105
|
-
return getErrorMessage(firstError);
|
|
70106
|
-
}
|
|
70107
|
-
return null;
|
|
70108
|
-
};
|
|
70109
70087
|
const isUnitKnown = (unit2 = "") => {
|
|
70110
70088
|
var _a;
|
|
70111
70089
|
return (_a = KNOWN_UNITS) == null ? void 0 : _a.includes(unit2);
|
|
@@ -70114,9 +70092,11 @@ const isKnownUnit = (valueWithUnit, defaultUnit) => {
|
|
|
70114
70092
|
const unitFromValue = getUnit(valueWithUnit || "");
|
|
70115
70093
|
return isUnitKnown(defaultUnit) && isUnitKnown(unitFromValue);
|
|
70116
70094
|
};
|
|
70117
|
-
const predefinedMenuActive = "
|
|
70095
|
+
const predefinedMenuActive = "_predefinedMenuActive_ye9w9_1";
|
|
70096
|
+
const inputWrapper = "_inputWrapper_ye9w9_4";
|
|
70118
70097
|
const styles = {
|
|
70119
|
-
predefinedMenuActive
|
|
70098
|
+
predefinedMenuActive,
|
|
70099
|
+
inputWrapper
|
|
70120
70100
|
};
|
|
70121
70101
|
const UnitInput = ({
|
|
70122
70102
|
name: name2,
|
|
@@ -70150,7 +70130,10 @@ const UnitInput = ({
|
|
|
70150
70130
|
validationCallback = () => ({ name: "", error: null }),
|
|
70151
70131
|
disabledValidation = false,
|
|
70152
70132
|
allowEmpty = false,
|
|
70153
|
-
autoValue
|
|
70133
|
+
autoValue,
|
|
70134
|
+
convertBackToStorageUnit = false,
|
|
70135
|
+
enableCosmeticRounding = true,
|
|
70136
|
+
enableDisplayRounding = false
|
|
70154
70137
|
}) => {
|
|
70155
70138
|
if (typeof value === "number") {
|
|
70156
70139
|
value = `${value}`;
|
|
@@ -70179,11 +70162,11 @@ const UnitInput = ({
|
|
|
70179
70162
|
);
|
|
70180
70163
|
const initDisplayLayer = convertedValue !== "" ? { value: convertedValue, unit: initDisplayUnit } : convertedAutoValue !== "" ? { value: convertedAutoValue, unit: initDisplayUnit } : { value: propValue, unit: propUnit };
|
|
70181
70164
|
const [displayLayer, setDisplayLayer] = useState(initDisplayLayer);
|
|
70182
|
-
const [validationError, setValidationError] = useState(null);
|
|
70183
70165
|
const [predefinedOptionsMenuState, setPredefinedOptionsMenuState] = useState(
|
|
70184
70166
|
initialPredefinedOption ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM
|
|
70185
70167
|
);
|
|
70186
70168
|
const isAutoValue = propValue === "" && autoValue;
|
|
70169
|
+
const disableInternalErrorValidationMessages = !!(disabledValidation || autoValue || placeholder3);
|
|
70187
70170
|
const foundPredefinedMenuOption = predefinedOptions && predefinedOptions.find((el2) => {
|
|
70188
70171
|
if (!(el2 == null ? void 0 : el2.value)) return;
|
|
70189
70172
|
if (selectedPredefinedOptionKey) {
|
|
@@ -70213,33 +70196,16 @@ const UnitInput = ({
|
|
|
70213
70196
|
const stringName2 = getStringName(name2);
|
|
70214
70197
|
const input2 = evt.target;
|
|
70215
70198
|
const { value: inputValue, selectionStart: currentCursorPosition } = input2;
|
|
70216
|
-
const
|
|
70217
|
-
|
|
70218
|
-
|
|
70219
|
-
|
|
70220
|
-
|
|
70221
|
-
|
|
70222
|
-
|
|
70223
|
-
autoValue,
|
|
70224
|
-
placeholder: placeholder3,
|
|
70225
|
-
disabledValidation
|
|
70199
|
+
const newValue = withUnit(inputValue, (displayLayer == null ? void 0 : displayLayer.unit) || "");
|
|
70200
|
+
const returnValue = convertBackToStorageUnit ? withUnit(convertAndGetValue(newValue, propUnit), propUnit) : newValue;
|
|
70201
|
+
onChange({
|
|
70202
|
+
target: {
|
|
70203
|
+
value: returnValue,
|
|
70204
|
+
name: stringName2
|
|
70205
|
+
}
|
|
70226
70206
|
});
|
|
70227
|
-
|
|
70228
|
-
|
|
70229
|
-
target: {
|
|
70230
|
-
value: newValue,
|
|
70231
|
-
name: stringName2
|
|
70232
|
-
}
|
|
70233
|
-
});
|
|
70234
|
-
const [val, u] = split$1(newValue);
|
|
70235
|
-
setDisplayLayer({ value: val, unit: u });
|
|
70236
|
-
setValidationError(null);
|
|
70237
|
-
validationCallback(stringName2, null);
|
|
70238
|
-
} else {
|
|
70239
|
-
setDisplayLayer({ value: cleanInputValue, unit: displayLayer.unit });
|
|
70240
|
-
setValidationError(validationResult);
|
|
70241
|
-
validationCallback(stringName2, validationResult);
|
|
70242
|
-
}
|
|
70207
|
+
const [val, u] = split$1(newValue);
|
|
70208
|
+
setDisplayLayer({ value: val, unit: u });
|
|
70243
70209
|
runAfterUpdate(() => {
|
|
70244
70210
|
input2.selectionStart = currentCursorPosition;
|
|
70245
70211
|
input2.selectionEnd = currentCursorPosition;
|
|
@@ -70285,14 +70251,6 @@ const UnitInput = ({
|
|
|
70285
70251
|
}
|
|
70286
70252
|
}
|
|
70287
70253
|
}
|
|
70288
|
-
const cleanValue = checkAndCleanDecimalComma(propValue);
|
|
70289
|
-
const errorMessage = validate(cleanValue, {
|
|
70290
|
-
allowEmpty,
|
|
70291
|
-
autoValue,
|
|
70292
|
-
placeholder: placeholder3,
|
|
70293
|
-
disabledValidation
|
|
70294
|
-
});
|
|
70295
|
-
setValidationError(errorMessage);
|
|
70296
70254
|
}, [initDisplayUnit, value, error2, shouldLinkAutomaticly]);
|
|
70297
70255
|
const alternativeUnits = getAlternativeUnits();
|
|
70298
70256
|
const displayUnitLabel = label$b(displayLayer.unit) || displayLayer.unit || "";
|
|
@@ -70327,6 +70285,14 @@ const UnitInput = ({
|
|
|
70327
70285
|
selected: foundPredefinedMenuOption === el2 && predefinedOptionsMenuState === PredefinedOptionsMenuState.PREDEFINED
|
|
70328
70286
|
};
|
|
70329
70287
|
};
|
|
70288
|
+
const handleValidationCallback = (name22, error22) => {
|
|
70289
|
+
if (validationCallback) {
|
|
70290
|
+
validationCallback({
|
|
70291
|
+
name: name22,
|
|
70292
|
+
error: error22
|
|
70293
|
+
});
|
|
70294
|
+
}
|
|
70295
|
+
};
|
|
70330
70296
|
sectionsPredefinedMenu = [
|
|
70331
70297
|
{
|
|
70332
70298
|
type: MenuType.OPTION,
|
|
@@ -70383,10 +70349,9 @@ const UnitInput = ({
|
|
|
70383
70349
|
)
|
|
70384
70350
|
}
|
|
70385
70351
|
),
|
|
70386
|
-
/* @__PURE__ */ jsx(
|
|
70387
|
-
|
|
70352
|
+
/* @__PURE__ */ jsx("div", { className: styles.inputWrapper, children: /* @__PURE__ */ jsx(
|
|
70353
|
+
NumberInput,
|
|
70388
70354
|
{
|
|
70389
|
-
type: "text",
|
|
70390
70355
|
name: stringName,
|
|
70391
70356
|
testId,
|
|
70392
70357
|
disabled: disabled2,
|
|
@@ -70399,12 +70364,18 @@ const UnitInput = ({
|
|
|
70399
70364
|
value: displayLayer.value,
|
|
70400
70365
|
onChange: onSetValue,
|
|
70401
70366
|
onFocus,
|
|
70402
|
-
error: error2
|
|
70403
|
-
warning: warning2,
|
|
70404
|
-
|
|
70367
|
+
error: error2 === null ? void 0 : error2,
|
|
70368
|
+
warning: warning2 === null ? void 0 : warning2,
|
|
70369
|
+
left: left2,
|
|
70370
|
+
allowEmpty,
|
|
70371
|
+
validationCallback: handleValidationCallback,
|
|
70372
|
+
enableCosmeticRounding,
|
|
70373
|
+
enableDisplayRounding,
|
|
70374
|
+
groupOrder: predefinedOptions ? "middle" : "first",
|
|
70375
|
+
disableInternalErrorValidationMessages
|
|
70405
70376
|
},
|
|
70406
70377
|
stringName
|
|
70407
|
-
),
|
|
70378
|
+
) }),
|
|
70408
70379
|
displayUnitLabel && (noConvert || !knownUnit ? /* @__PURE__ */ jsx(InputGroupAddon, { groupOrder: "last", children: displayUnitLabel }) : /* @__PURE__ */ jsx(
|
|
70409
70380
|
Menu,
|
|
70410
70381
|
{
|
|
@@ -70418,9 +70389,11 @@ const UnitInput = ({
|
|
|
70418
70389
|
small: small2,
|
|
70419
70390
|
sections: alternativeUnits.map(([value2, altUnit, label2]) => {
|
|
70420
70391
|
const displayUnit = label2 || altUnit || "";
|
|
70392
|
+
const safeValue = !isNaN(Number(value2)) ? value2 : "";
|
|
70393
|
+
const displayValue = enableCosmeticRounding ? roundNumberCosmetic(safeValue) : safeValue;
|
|
70421
70394
|
return {
|
|
70422
70395
|
type: "Option",
|
|
70423
|
-
label:
|
|
70396
|
+
label: displayValue,
|
|
70424
70397
|
inline: true,
|
|
70425
70398
|
onClick: (evt) => {
|
|
70426
70399
|
evt.stopPropagation();
|
|
@@ -70488,22 +70461,12 @@ const convertVisibleRows = ({
|
|
|
70488
70461
|
const storageUnit = storageUnits[unitKey];
|
|
70489
70462
|
const unitChanged = selectedUnit !== storageUnit;
|
|
70490
70463
|
const convertedValue = unitChanged ? convertAndGetValue(value, selectedUnit, storageUnit) : cell2.value;
|
|
70491
|
-
const
|
|
70492
|
-
const displayValue = enableCosmeticRounding && (unitChanged || !isScientific) ? (
|
|
70493
|
-
/*
|
|
70494
|
-
Optionally do Excel-style "cosmetic rounding" of display values (only if enableCosmeticRounding prop on)
|
|
70495
|
-
This means rounding to slightly less precision than the underlying floating-point number type, to
|
|
70496
|
-
resolve floating-point "rounding noise" associated with storing values in one unit but converting
|
|
70497
|
-
and displaying them in another unit. This solution was evaluated by Tools Team in relation to
|
|
70498
|
-
tickets OW-10614 and OW-15745.
|
|
70499
|
-
*/
|
|
70500
|
-
roundToPrecision(convertedValue, 14)
|
|
70501
|
-
) : convertedValue;
|
|
70502
|
-
const formattedDisplayValue = formatDisplayValue ? formatDisplayValue(displayValue) : displayValue;
|
|
70464
|
+
const formattedDisplayValue = formatDisplayValue ? formatDisplayValue(convertedValue) : convertedValue;
|
|
70503
70465
|
return {
|
|
70504
70466
|
...cell2,
|
|
70505
70467
|
value: formattedDisplayValue,
|
|
70506
|
-
enableCosmeticRounding,
|
|
70468
|
+
enableCosmeticRounding: enableCosmeticRounding && unitChanged,
|
|
70469
|
+
//todo: why did we need to check unitChanged here? (original rationale)
|
|
70507
70470
|
enableDisplayRounding,
|
|
70508
70471
|
roundDisplayValue,
|
|
70509
70472
|
onChange: (evt) => {
|