@oliasoft-open-source/react-ui-library 4.5.0-beta-1 → 4.5.0
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/404.html +1 -0
- package/dist/index.d.ts +49 -53
- package/dist/index.js +189 -203
- package/dist/index.js.map +1 -1
- package/dist/storybook/assets/{Color-6VNJS4EI-OKUPsN5g.js → Color-6VNJS4EI-HEi_eHev.js} +1 -1
- package/dist/storybook/assets/{DocsRenderer-NNNQARDV-GtO0h5cy.js → DocsRenderer-NNNQARDV-inNf3vhV.js} +1 -1
- package/dist/storybook/assets/{WithTooltip-4HIR6TLV-oJGDwI7F.js → WithTooltip-4HIR6TLV-YjRbtiQd.js} +1 -1
- package/dist/storybook/assets/accordion.stories-DAmwlTmm.js +170 -0
- package/dist/storybook/assets/{actions-Z9jDWreP.js → actions-SGexXf58.js} +1 -1
- package/dist/storybook/assets/{actions.stories-Qrio9EMy.js → actions.stories-dDCC23QK.js} +1 -1
- package/dist/storybook/assets/{afe.stories-fh4-T0m2.js → afe.stories-YefEu4ve.js} +1 -1
- package/dist/storybook/assets/{badge.stories-C0MXS15j.js → badge.stories-nzXJ1qip.js} +1 -1
- package/dist/storybook/assets/{blowout.stories-BXWf5R9h.js → blowout.stories-FLPAE9fr.js} +1 -1
- package/dist/storybook/assets/breadcrumb.stories-V7ozYBO-.js +1 -0
- package/dist/storybook/assets/{button-7V8oA22w.js → button-IoNblLER.js} +1 -1
- package/dist/storybook/assets/{button-group-q8QKkLVU.js → button-group-KeeGgC4K.js} +1 -1
- package/dist/storybook/assets/{button-group.stories-tLZpLTfD.js → button-group.stories-DG3i2d7K.js} +1 -1
- package/dist/storybook/assets/{button.stories-PhWmZXOu.js → button.stories-R9_1tl9l.js} +1 -1
- package/dist/storybook/assets/{buttons-and-links-mIhXkKfh.js → buttons-and-links-M1gBHZkR.js} +2 -2
- package/dist/storybook/assets/{card.stories-HzHJW6ek.js → card.stories-OtRekExg.js} +1 -1
- package/dist/storybook/assets/{casing-loads.stories-i9Kyuvs1.js → casing-loads.stories-7fO3E08h.js} +1 -1
- package/dist/storybook/assets/cell.stories-S9IDsuIA.js +212 -0
- package/dist/storybook/assets/{check-box-LZdXXKhv.js → check-box-BX5dfQFk.js} +1 -1
- package/dist/storybook/assets/{check-box.stories-0XCykxnz.js → check-box.stories-FNs72smP.js} +1 -1
- package/dist/storybook/assets/{chunk-HLWAVYOI-YpA4-WPj.js → chunk-HLWAVYOI-H4e42Z9I.js} +1 -1
- package/dist/storybook/assets/{color-0ogqq8EH.js → color-heFzWL2m.js} +1 -1
- package/dist/storybook/assets/{column.stories-6OLsjlcP.js → column.stories-5pd3N4bE.js} +1 -1
- package/dist/storybook/assets/dialog-dekS0lUR.js +1 -0
- package/dist/storybook/assets/dialog-gTGZ42G6.css +1 -0
- package/dist/storybook/assets/{drawer-WuErQ5Z8.js → drawer-TM-jK3WR.js} +1 -1
- package/dist/storybook/assets/{drawer.stories-BLdyJ3NA.js → drawer.stories-HJN51eTr.js} +1 -1
- package/dist/storybook/assets/empty.stories-KIByp315.js +1 -0
- package/dist/storybook/assets/{field-eknsj_Ll.js → field-kOZPBHf6.js} +1 -1
- package/dist/storybook/assets/{field.stories-RmhJ16HT.js → field.stories-aEccauPi.js} +1 -1
- package/dist/storybook/assets/file-input.stories-22XjkzbO.js +66 -0
- package/dist/storybook/assets/{flex-RYZsoWEN.js → flex-ZVra76N-.js} +1 -1
- package/dist/storybook/assets/{flex.stories-lLz0Xrt_.js → flex.stories-kjbyZMWP.js} +1 -1
- package/dist/storybook/assets/{footer.stories-guoNYzr9.js → footer.stories-4uhW-z_4.js} +1 -1
- package/dist/storybook/assets/{form.stories-tzZoKyyL.js → form.stories-_A7_Mppm.js} +1 -1
- package/dist/storybook/assets/{formation.stories-KUe50fTQ.js → formation.stories-PmRbjLVy.js} +1 -1
- package/dist/storybook/assets/{formatter-SWP5E3XI-Z60pYM_f.js → formatter-SWP5E3XI-PYpdbOxZ.js} +1 -1
- package/dist/storybook/assets/{heading-Bk0bpNfe.js → heading-cUVItwKq.js} +1 -1
- package/dist/storybook/assets/{heading.stories-HLMPkIPo.js → heading.stories-K-Z0sIoo.js} +1 -1
- package/dist/storybook/assets/{help-icon--rUDxLUD.js → help-icon-nI9A506M.js} +1 -1
- package/dist/storybook/assets/{help-icon.stories-vifwJgNA.js → help-icon.stories-Qz7MKCnQ.js} +1 -1
- package/dist/storybook/assets/{icon.stories-W-UgTWyK.js → icon.stories-icqUrCtQ.js} +1 -1
- package/dist/storybook/assets/iframe-IZZyfjHT.js +7 -0
- package/dist/storybook/assets/{index-isA0pQQP.js → index-kEA1EH0x.js} +5 -5
- package/dist/storybook/assets/{input-group.stories-WljyIQ0a.js → input-group.stories-EouZEW-v.js} +1 -1
- package/dist/storybook/assets/{input-u1He-wWs.js → input-iDZqV-2m.js} +1 -1
- package/dist/storybook/assets/{input-validation-lBeNJX0o.js → input-validation-SIDSAFaH.js} +1 -1
- package/dist/storybook/assets/{input.stories-rLdDRxtU.js → input.stories-iopguZKB.js} +1 -1
- package/dist/storybook/assets/{inputs-bYS5qR_g.js → inputs-Q-JCPEm_.js} +14 -14
- package/dist/storybook/assets/{label-0_Qf6I8t.js → label-RpB4JmHX.js} +1 -1
- package/dist/storybook/assets/{label.stories-aXdU5_Ql.js → label.stories-HcdQ1bEB.js} +1 -1
- package/dist/storybook/assets/{layout-forms-S1UZag29.js → layout-forms-sTxS59Zq.js} +1 -1
- package/dist/storybook/assets/{layout-general-U3YRmnqR.js → layout-general-82Ja2Lb_.js} +1 -1
- package/dist/storybook/assets/{list-dAlCO11z.js → list-5kbN7yr8.js} +1 -1
- package/dist/storybook/assets/list-heading-XbqCJOHh.js +1 -0
- package/dist/storybook/assets/{list.stories-bt_cumRX.js → list.stories-a1qTCCEj.js} +1 -1
- package/dist/storybook/assets/{list.stories-data-IcFu6vvd.js → list.stories-data-spFiMtCi.js} +1 -1
- package/dist/storybook/assets/{loader.stories-0OwmnNML.js → loader.stories-G8Q_Fm8u.js} +1 -1
- package/dist/storybook/assets/{menu.stories-data-hEz8P1yK.js → menu.stories-data-VCYkzuDD.js} +1 -1
- package/dist/storybook/assets/{menu.stories-VwRF_Pbx.js → menu.stories-sot2Whii.js} +1 -1
- package/dist/storybook/assets/{message-yii7x6Na.js → message-uMHaTEXV.js} +1 -1
- package/dist/storybook/assets/{message.stories-9RWD3-p1.js → message.stories-BqM_-mrZ.js} +1 -1
- package/dist/storybook/assets/{modal.stories-rVfow_s3.js → modal.stories-K4XxeWTp.js} +1 -1
- package/dist/storybook/assets/{number-input-SvjJIGsW.js → number-input-d7hXQldd.js} +1 -1
- package/dist/storybook/assets/{number-input.stories-BURENIFo.js → number-input.stories-SOsG2FLJ.js} +1 -1
- package/dist/storybook/assets/option-dropdown.stories-1Y5JDaBF.js +21 -0
- package/dist/storybook/assets/{padding-and-spacing-Ej5fu8GG.js → padding-and-spacing-CLf0dRGb.js} +1 -1
- package/dist/storybook/assets/page.stories-eHXLB7iO.js +57 -0
- package/dist/storybook/assets/{pagination-5n5spTRo.js → pagination-Eaj_UOBW.js} +1 -1
- package/dist/storybook/assets/{pagination.stories-g4a-aSxq.js → pagination.stories-sl2a8BMq.js} +1 -1
- package/dist/storybook/assets/pop-confirm.stories-94l3Xg8w.js +9 -0
- package/dist/storybook/assets/{popover-Y3FpGdUS.js → popover-uAo1e4-D.js} +1 -1
- package/dist/storybook/assets/{popover.stories-b7Tt4S0j.js → popover.stories-XaqJOrng.js} +1 -1
- package/dist/storybook/assets/{global-M-3dCKk3.css → preview-QdB_aBj_.css} +1 -1
- package/dist/storybook/assets/{preview-8d3sl769.js → preview-kCAXH-J5.js} +2 -2
- package/dist/storybook/assets/{preview-UZXZGus9.js → preview-niHg4y_T.js} +3 -3
- package/dist/storybook/assets/{projects.stories-bo3cPOP-.js → projects.stories-GYkShoTB.js} +1 -1
- package/dist/storybook/assets/{radio-button-jHcwHUA4.js → radio-button-QcS9mLYi.js} +1 -1
- package/dist/storybook/assets/{radio-button.stories-LkCJsp5P.js → radio-button.stories-KCS981-F.js} +1 -1
- package/dist/storybook/assets/{reservoirs.stories-RUFcw2h6.js → reservoirs.stories-ZhxgN63G.js} +1 -1
- package/dist/storybook/assets/{rich-text-input-W-kYpvgO.js → rich-text-input.stories-D55Op5Gf.js} +127 -52
- package/dist/storybook/assets/{row.stories-TurDc49t.js → row.stories-HVr8m6RK.js} +1 -1
- package/dist/storybook/assets/{select-JjEPivho.js → select-Z1HqJ5aU.js} +1 -1
- package/dist/storybook/assets/{select.stories-qFDyxRFm.js → select.stories-oUxeDUts.js} +1 -1
- package/dist/storybook/assets/{side-bar-Fjr2t9MT.js → side-bar-GJ2tcZYY.js} +1 -1
- package/dist/storybook/assets/{side-bar.stories-sxBJCVnV.js → side-bar.stories-q_bRwHV_.js} +1 -1
- package/dist/storybook/assets/{site.stories-Hnwa5Rxk.js → site.stories-AbEac__s.js} +1 -1
- package/dist/storybook/assets/{slider-nl2rJ9LF.js → slider-_5NQKbM-.js} +1 -1
- package/dist/storybook/assets/{slider.stories--aZa8kf-.js → slider.stories-QyyBB_rz.js} +1 -1
- package/dist/storybook/assets/{spacer.stories-eCrKj4b3.js → spacer.stories-CWSQp7tw.js} +1 -1
- package/dist/storybook/assets/{syntaxhighlighter-NMPM6SWI-LVCFR00p.js → syntaxhighlighter-NMPM6SWI-q5ulcVwD.js} +1 -1
- package/dist/storybook/assets/table-_jWgMFOi.js +1 -0
- package/dist/storybook/assets/{table.stories-data-txTr9mYv.js → table.stories-data-2BZDVr2X.js} +1 -1
- package/dist/storybook/assets/{table.stories-TGOwb9FU.js → table.stories-lwqVUJHa.js} +1 -1
- package/dist/storybook/assets/text-link.stories-kjfUeFtk.js +1 -0
- package/dist/storybook/assets/{textarea-8bcldTyf.js → textarea-1cVdadvY.js} +1 -1
- package/dist/storybook/assets/{textarea.stories-D9SctTMD.js → textarea.stories-twGqf34D.js} +1 -1
- package/dist/storybook/assets/{title.stories-InoCrXr8.js → title.stories-Djnk3crF.js} +1 -1
- package/dist/storybook/assets/{toaster-2HasMRmP.js → toaster-eOozfa7U.js} +1 -1
- package/dist/storybook/assets/{toaster.stories-NBYloz0_.js → toaster.stories-ft_M65x0.js} +1 -1
- package/dist/storybook/assets/{toggle-BPI2y-lU.js → toggle-wk0GbVB8.js} +1 -1
- package/dist/storybook/assets/{toggle.stories-aVmjpons.js → toggle.stories-LC6LSCD2.js} +1 -1
- package/dist/storybook/assets/{tooltip-HEHiU__l.js → tooltip-ZHdi6rl-.js} +1 -1
- package/dist/storybook/assets/{tooltip.stories-tiOgoWHH.js → tooltip.stories-gTfOeEzv.js} +1 -1
- package/dist/storybook/assets/{tooltip.test-case.stories-kIeZayHw.js → tooltip.test-case.stories-y-bQOM0s.js} +1 -1
- package/dist/storybook/assets/{top-bar-3dxv0sp9.js → top-bar-uqbsCAt-.js} +1 -1
- package/dist/storybook/assets/{top-bar.stories-sMvXnmhR.js → top-bar.stories-lt8T4EVJ.js} +1 -1
- package/dist/storybook/assets/{top-bar.testcase.stories-Nb8fdPBS.js → top-bar.testcase.stories-_Nc_6uY7.js} +1 -1
- package/dist/storybook/assets/tree.stories-5fjCVN1S.js +180 -0
- package/dist/storybook/assets/unit-input.stories-ZdrR9JWT.js +273 -0
- package/dist/storybook/iframe.html +1 -1
- package/dist/storybook/index.json +1 -1
- package/dist/storybook/project.json +1 -1
- package/dist/storybook/stories.json +1 -1
- package/package.json +1 -1
- package/dist/storybook/assets/accordion-with-default-toggle-8PUIm8jP.js +0 -1
- package/dist/storybook/assets/accordion.stories-xUgAzm87.js +0 -170
- package/dist/storybook/assets/breadcrumb-WFZ7OoC2.js +0 -1
- package/dist/storybook/assets/breadcrumb.stories-mou0ppaX.js +0 -1
- package/dist/storybook/assets/cell.stories-QHDggPeA.js +0 -208
- package/dist/storybook/assets/empty-PU0JdhZM.js +0 -1
- package/dist/storybook/assets/empty.stories-FYO6syUx.js +0 -1
- package/dist/storybook/assets/file-input-7-7kYhsS.js +0 -1
- package/dist/storybook/assets/file-input.stories-lW0gLK14.js +0 -66
- package/dist/storybook/assets/iframe-ybuSzuG4.js +0 -7
- package/dist/storybook/assets/meta-content-2S9BpSoX.js +0 -1
- package/dist/storybook/assets/modal-BJKGBCkS.css +0 -1
- package/dist/storybook/assets/modal-Dr5HffrG.js +0 -1
- package/dist/storybook/assets/option-dropdown-6QvoS02o.js +0 -1
- package/dist/storybook/assets/option-dropdown.stories-5qw-N2Q9.js +0 -21
- package/dist/storybook/assets/page.stories-4zM8wrxN.js +0 -57
- package/dist/storybook/assets/pop-confirm-nfz5S-f-.js +0 -1
- package/dist/storybook/assets/pop-confirm.stories-1vIAhdl-.js +0 -9
- package/dist/storybook/assets/preview-agc3Xxfb.css +0 -1
- package/dist/storybook/assets/print-header-mVYWFles.js +0 -1
- package/dist/storybook/assets/rich-text-input.stories-6-587T_0.js +0 -76
- package/dist/storybook/assets/table-lfeSnryj.js +0 -1
- package/dist/storybook/assets/text-link-1uKYQqn_.js +0 -1
- package/dist/storybook/assets/text-link.stories-ZcuOY5VK.js +0 -1
- package/dist/storybook/assets/tree-Rhl5ea49.js +0 -6
- package/dist/storybook/assets/tree.stories-dFH-G6se.js +0 -123
- package/dist/storybook/assets/unit-input-fxjK7nON.js +0 -1
- package/dist/storybook/assets/unit-input.stories--UApgPT-.js +0 -273
- package/dist/storybook/assets/unit-table.stories-Vd1Nqk2h.js +0 -434
- /package/dist/storybook/assets/{accordion-with-default-toggle-tw1O4Ru6.css → accordion-tw1O4Ru6.css} +0 -0
- /package/dist/storybook/assets/{meta-content-Y8BAUuV6.css → list-heading-Y8BAUuV6.css} +0 -0
- /package/dist/storybook/assets/{print-header-6iak35D6.css → page-6iak35D6.css} +0 -0
package/dist/404.html
ADDED
|
@@ -0,0 +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-neKlYvgy.js"></script><link rel="stylesheet" crossorigin href="/react-ui-library/assets/index-AkeNwthw.css"></head><body><div id="content"></div></body>
|
package/dist/index.d.ts
CHANGED
|
@@ -158,8 +158,6 @@ export declare interface IActionProps {
|
|
|
158
158
|
closeLayer?: TEmpty;
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
-
declare type IActionsType = (IAction | ISubAction | IChildComponent)[];
|
|
162
|
-
|
|
163
161
|
export declare interface IBadgeProps {
|
|
164
162
|
children?: ReactNode;
|
|
165
163
|
color?: string;
|
|
@@ -233,20 +231,6 @@ export declare interface ICardProps {
|
|
|
233
231
|
children?: ReactNode;
|
|
234
232
|
}
|
|
235
233
|
|
|
236
|
-
declare interface ICell {
|
|
237
|
-
value: number | string;
|
|
238
|
-
type: string;
|
|
239
|
-
onChange: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
240
|
-
placeholder?: string;
|
|
241
|
-
testId?: string;
|
|
242
|
-
disabled?: boolean;
|
|
243
|
-
style?: object;
|
|
244
|
-
options?: {
|
|
245
|
-
label: string;
|
|
246
|
-
value: string | number;
|
|
247
|
-
}[];
|
|
248
|
-
}
|
|
249
|
-
|
|
250
234
|
declare interface ICheckBoxCell extends TCommonCell {
|
|
251
235
|
label?: string | null;
|
|
252
236
|
checked: boolean;
|
|
@@ -272,11 +256,6 @@ export declare interface ICheckBoxProps {
|
|
|
272
256
|
onClickHelp?: TEmpty;
|
|
273
257
|
}
|
|
274
258
|
|
|
275
|
-
declare interface IChildComponent {
|
|
276
|
-
childComponent: ReactNode | (() => ReactNode);
|
|
277
|
-
testId?: string;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
259
|
/**
|
|
281
260
|
* Icon wrapper component to support different icon formats:
|
|
282
261
|
* - string names (default recommendation)
|
|
@@ -1302,25 +1281,6 @@ declare interface ISubAction_2 {
|
|
|
1302
1281
|
onClick: TEmpty;
|
|
1303
1282
|
}
|
|
1304
1283
|
|
|
1305
|
-
declare interface ITableActions {
|
|
1306
|
-
addRow?: () => void;
|
|
1307
|
-
reorderComponents?: () => void;
|
|
1308
|
-
}
|
|
1309
|
-
|
|
1310
|
-
declare interface ITableDefinition {
|
|
1311
|
-
key: string;
|
|
1312
|
-
header: string;
|
|
1313
|
-
translationKey: string;
|
|
1314
|
-
type: string;
|
|
1315
|
-
convertible: boolean;
|
|
1316
|
-
unitKey: string;
|
|
1317
|
-
columnAlignment: string;
|
|
1318
|
-
columnWidth: string;
|
|
1319
|
-
defaultValue?: number | string | null;
|
|
1320
|
-
options?: Array<any>;
|
|
1321
|
-
placeholder?: string;
|
|
1322
|
-
}
|
|
1323
|
-
|
|
1324
1284
|
export declare interface ITableProps {
|
|
1325
1285
|
onListReorder?: (obj: {
|
|
1326
1286
|
from: number;
|
|
@@ -1534,6 +1494,13 @@ export declare interface ITreeProps {
|
|
|
1534
1494
|
expand: React_2.ReactNode;
|
|
1535
1495
|
collapse: React_2.ReactNode;
|
|
1536
1496
|
};
|
|
1497
|
+
allowParentReassignment?: boolean;
|
|
1498
|
+
}
|
|
1499
|
+
|
|
1500
|
+
declare interface IUnitConfigItem {
|
|
1501
|
+
unitKey: string;
|
|
1502
|
+
storageUnit: string;
|
|
1503
|
+
preferredUnit: string;
|
|
1537
1504
|
}
|
|
1538
1505
|
|
|
1539
1506
|
export declare interface IUnitInputProps {
|
|
@@ -1572,17 +1539,44 @@ export declare interface IUnitInputProps {
|
|
|
1572
1539
|
unitTemplate?: Record<string, any>;
|
|
1573
1540
|
}
|
|
1574
1541
|
|
|
1575
|
-
declare interface
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1542
|
+
declare interface IUnitTable extends Omit<ITableProps['table'], 'rows'> {
|
|
1543
|
+
rows?: IUnitTableRow[];
|
|
1544
|
+
}
|
|
1545
|
+
|
|
1546
|
+
declare interface IUnitTableCell {
|
|
1547
|
+
autoUnit: boolean;
|
|
1548
|
+
unitKey: string;
|
|
1549
|
+
formatDisplayValue?: (value: string | number) => void;
|
|
1550
|
+
}
|
|
1551
|
+
|
|
1552
|
+
declare interface IUnitTableInputCell extends IInputCell, IUnitTableCell {
|
|
1553
|
+
onChange: (args: any) => void;
|
|
1554
|
+
}
|
|
1555
|
+
|
|
1556
|
+
declare interface IUnitTableNumberInputCell extends INumberInputCell, IUnitTableCell {
|
|
1557
|
+
onChange: (args: any) => void;
|
|
1558
|
+
}
|
|
1559
|
+
|
|
1560
|
+
export declare interface IUnitTableOnChangeEvent extends React_2.ChangeEvent<HTMLInputElement> {
|
|
1561
|
+
target: EventTarget & HTMLInputElement & {
|
|
1562
|
+
rowIndex: number;
|
|
1563
|
+
cellIndex: number;
|
|
1564
|
+
unit: string;
|
|
1565
|
+
};
|
|
1566
|
+
}
|
|
1567
|
+
|
|
1568
|
+
export declare interface IUnitTableProps extends Omit<ITableProps, 'table'> {
|
|
1569
|
+
table: IUnitTable;
|
|
1570
|
+
unitConfig: IUnitConfigItem[];
|
|
1571
|
+
convertBackToStorageUnit: boolean;
|
|
1572
|
+
enableCosmeticRounding: boolean;
|
|
1573
|
+
}
|
|
1574
|
+
|
|
1575
|
+
export declare interface IUnitTableRow extends Omit<TRowType, 'cells'> {
|
|
1576
|
+
cells: TUnitTableCellShape[];
|
|
1577
|
+
}
|
|
1578
|
+
|
|
1579
|
+
declare interface IUnitTableStaticCell extends IStaticCell, IUnitTableCell {
|
|
1586
1580
|
}
|
|
1587
1581
|
|
|
1588
1582
|
export declare const Label: ({ label, width, helpText, helpTextMaxWidth, onClickHelp, lock, info, libraryIcon, labelLeft, }: ILabelProps) => JSX_2.Element;
|
|
@@ -1763,7 +1757,7 @@ export declare const Tooltip: ({ children, text, error, placement, possiblePlace
|
|
|
1763
1757
|
|
|
1764
1758
|
export declare const TopBar: ({ title, appSwitcher, content, contentRight, warning, height, fixedPosition, }: ITopBarProps) => JSX_2.Element;
|
|
1765
1759
|
|
|
1766
|
-
export declare const Tree: ({ list, draggable, onListReorder, onChangeOpen, testId, isInitialOpen, treeRef, itemHasChild, onItemToggle, icons, }: ITreeProps) => JSX_2.Element;
|
|
1760
|
+
export declare const Tree: ({ list, draggable, onListReorder, onChangeOpen, testId, isInitialOpen, treeRef, itemHasChild, onItemToggle, icons, allowParentReassignment, }: ITreeProps) => JSX_2.Element;
|
|
1767
1761
|
|
|
1768
1762
|
export declare enum TriggerType {
|
|
1769
1763
|
TEXT = "Text",
|
|
@@ -1799,9 +1793,11 @@ declare type TTopBarContent = TLinkElement | TButtonElement | TMenuElement | TCo
|
|
|
1799
1793
|
|
|
1800
1794
|
export declare type TTriggerType = 'Text' | 'Button' | 'DropDownButton' | 'Component';
|
|
1801
1795
|
|
|
1796
|
+
declare type TUnitTableCellShape = TCellShape | IUnitTableStaticCell | IUnitTableInputCell | IUnitTableNumberInputCell;
|
|
1797
|
+
|
|
1802
1798
|
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;
|
|
1803
1799
|
|
|
1804
|
-
export declare const UnitTable: ({
|
|
1800
|
+
export declare const UnitTable: ({ table, unitConfig, convertBackToStorageUnit, enableCosmeticRounding, }: IUnitTableProps) => JSX_2.Element;
|
|
1805
1801
|
|
|
1806
1802
|
export declare const useFocus: () => UseFocusReturnType;
|
|
1807
1803
|
|
package/dist/index.js
CHANGED
|
@@ -10,8 +10,8 @@ import React__default, { useContext, isValidElement, useState, useRef, useEffect
|
|
|
10
10
|
import * as PropTypes from "prop-types";
|
|
11
11
|
import PropTypes__default from "prop-types";
|
|
12
12
|
import ReactDOM, { createPortal, unstable_batchedUpdates, render } from "react-dom";
|
|
13
|
-
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, isObjectLike, has as has$1,
|
|
14
|
-
import { validateNumber, cleanNumStr, unitFromQuantity, isValueWithUnit, withUnit, convertSamePrecision, getValue as getValue$1, getUnit, KNOWN_UNITS, split as split$1, checkAndCleanDecimalComma, label as label$b, altUnitsList,
|
|
13
|
+
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, isObjectLike, has as has$1, isEqual as isEqual$4 } from "lodash";
|
|
14
|
+
import { validateNumber, cleanNumStr, unitFromQuantity, isValueWithUnit, withUnit, convertSamePrecision, getValue as getValue$1, getUnit, KNOWN_UNITS, split as split$1, checkAndCleanDecimalComma, label as label$b, altUnitsList, getUnitsForQuantity, convertAndGetValue, roundToPrecision } from "@oliasoft-open-source/units";
|
|
15
15
|
import { isValueWithUnit as isValueWithUnit$1 } from "@oliasoft-open-source/units/dist/units";
|
|
16
16
|
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
17
17
|
function getDefaultExportFromCjs(x2) {
|
|
@@ -55702,7 +55702,8 @@ const styles$7 = {
|
|
|
55702
55702
|
const InputCell = ({
|
|
55703
55703
|
cell: cell2,
|
|
55704
55704
|
columnAlignment,
|
|
55705
|
-
testId
|
|
55705
|
+
testId,
|
|
55706
|
+
type
|
|
55706
55707
|
}) => {
|
|
55707
55708
|
return /* @__PURE__ */ jsx(
|
|
55708
55709
|
Input$1,
|
|
@@ -55726,7 +55727,8 @@ const InputCell = ({
|
|
|
55726
55727
|
right: columnAlignment === Align.RIGHT,
|
|
55727
55728
|
testId,
|
|
55728
55729
|
tabIndex: cell2.disabled ? -1 : 0,
|
|
55729
|
-
tooltip: cell2.tooltip
|
|
55730
|
+
tooltip: cell2.tooltip,
|
|
55731
|
+
type
|
|
55730
55732
|
}
|
|
55731
55733
|
);
|
|
55732
55734
|
};
|
|
@@ -55908,7 +55910,7 @@ const InputCellWrapper = ({
|
|
|
55908
55910
|
columnAlignment,
|
|
55909
55911
|
testId
|
|
55910
55912
|
}
|
|
55911
|
-
) : cell2.type === "NumberInput" ? /* @__PURE__ */ jsx(NumberInputCell, { cell: cell2, testId }) : cell2.type === "Select" ? /* @__PURE__ */ jsx(
|
|
55913
|
+
) : cell2.type === "NumberInput" ? /* @__PURE__ */ jsx(NumberInputCell, { cell: cell2, testId }) : cell2.type === "DateInput" ? /* @__PURE__ */ jsx(InputCell, { cell: cell2, testId, type: "date" }) : cell2.type === "Select" ? /* @__PURE__ */ jsx(
|
|
55912
55914
|
SelectCell,
|
|
55913
55915
|
{
|
|
55914
55916
|
cell: cell2,
|
|
@@ -56090,6 +56092,7 @@ const CellWrapper = ({
|
|
|
56090
56092
|
switch (cell2.type) {
|
|
56091
56093
|
case "Input":
|
|
56092
56094
|
case "NumberInput":
|
|
56095
|
+
case "DateInput":
|
|
56093
56096
|
case "Select":
|
|
56094
56097
|
return /* @__PURE__ */ jsx(
|
|
56095
56098
|
InputCellWrapper,
|
|
@@ -56123,6 +56126,7 @@ var CellType = /* @__PURE__ */ ((CellType2) => {
|
|
|
56123
56126
|
CellType2["SLIDER"] = "Slider";
|
|
56124
56127
|
CellType2["CHECKBOX"] = "CheckBox";
|
|
56125
56128
|
CellType2["ACTIONS"] = "Actions";
|
|
56129
|
+
CellType2["AUTO_UNIT"] = "AutoUnit";
|
|
56126
56130
|
return CellType2;
|
|
56127
56131
|
})(CellType || {});
|
|
56128
56132
|
const Cell = ({
|
|
@@ -70007,24 +70011,75 @@ const Tree = ({
|
|
|
70007
70011
|
treeRef,
|
|
70008
70012
|
itemHasChild,
|
|
70009
70013
|
onItemToggle,
|
|
70010
|
-
icons: icons2
|
|
70014
|
+
icons: icons2,
|
|
70015
|
+
allowParentReassignment
|
|
70011
70016
|
}) => {
|
|
70012
70017
|
var _a;
|
|
70013
|
-
const
|
|
70014
|
-
if (
|
|
70015
|
-
|
|
70018
|
+
const handleOpen = (id2) => {
|
|
70019
|
+
if (onChangeOpen) {
|
|
70020
|
+
onChangeOpen(id2);
|
|
70021
|
+
}
|
|
70022
|
+
};
|
|
70023
|
+
const findNodeIndexById = (tree22, id2) => {
|
|
70024
|
+
return (tree22 == null ? void 0 : tree22.findIndex((node2) => (node2 == null ? void 0 : node2.id) === id2)) ?? -1;
|
|
70025
|
+
};
|
|
70026
|
+
const setDragSourceParentToGrandparent = (dragSource, workingTree) => {
|
|
70027
|
+
const dragSourceParentIndex = findNodeIndexById(
|
|
70028
|
+
workingTree,
|
|
70029
|
+
dragSource == null ? void 0 : dragSource.parent
|
|
70030
|
+
);
|
|
70031
|
+
if (dragSourceParentIndex >= 0) {
|
|
70032
|
+
const grandparent = workingTree == null ? void 0 : workingTree.find(
|
|
70033
|
+
(node2) => {
|
|
70034
|
+
var _a2;
|
|
70035
|
+
return (node2 == null ? void 0 : node2.id) === ((_a2 = workingTree[dragSourceParentIndex]) == null ? void 0 : _a2.parent);
|
|
70036
|
+
}
|
|
70037
|
+
);
|
|
70038
|
+
dragSource.parent = grandparent ? grandparent.id : 0;
|
|
70039
|
+
}
|
|
70040
|
+
};
|
|
70041
|
+
const removeDragSourceFromWorkingTree = (dragSource, workingTree) => {
|
|
70042
|
+
return (workingTree == null ? void 0 : workingTree.filter((node2) => (node2 == null ? void 0 : node2.id) !== (dragSource == null ? void 0 : dragSource.id))) ?? [];
|
|
70043
|
+
};
|
|
70044
|
+
const insertDragSourceAfterParentInWorkingTree = (dragSource, dragSourceParentIndex, workingTree) => {
|
|
70045
|
+
workingTree == null ? void 0 : workingTree.splice(dragSourceParentIndex, 0, dragSource);
|
|
70046
|
+
return workingTree;
|
|
70047
|
+
};
|
|
70048
|
+
const transformTreeToList = (tree22) => {
|
|
70049
|
+
return tree22.map(({ id: id2, parent, droppable: droppable2, data }) => {
|
|
70050
|
+
return {
|
|
70016
70051
|
id: id2,
|
|
70017
70052
|
parent,
|
|
70018
70053
|
droppable: droppable2,
|
|
70019
70054
|
...data
|
|
70020
|
-
}
|
|
70021
|
-
|
|
70022
|
-
}
|
|
70055
|
+
};
|
|
70056
|
+
});
|
|
70023
70057
|
};
|
|
70024
|
-
const
|
|
70025
|
-
|
|
70026
|
-
|
|
70058
|
+
const handleDrop = (newTree, option2) => {
|
|
70059
|
+
const { dragSource, dropTarget: dropTarget2 } = option2;
|
|
70060
|
+
let workingTree = [...newTree];
|
|
70061
|
+
if (!onListReorder)
|
|
70062
|
+
return;
|
|
70063
|
+
const dragSourceIndex = findNodeIndexById(workingTree, dragSource == null ? void 0 : dragSource.id);
|
|
70064
|
+
const dragSourceParentIndex = findNodeIndexById(
|
|
70065
|
+
workingTree,
|
|
70066
|
+
dragSource == null ? void 0 : dragSource.parent
|
|
70067
|
+
);
|
|
70068
|
+
let newList = [];
|
|
70069
|
+
if ((dragSource == null ? void 0 : dragSource.parent) === (dropTarget2 == null ? void 0 : dropTarget2.id) && dragSourceIndex === 0 && allowParentReassignment) {
|
|
70070
|
+
setDragSourceParentToGrandparent(dragSource, workingTree);
|
|
70071
|
+
workingTree = removeDragSourceFromWorkingTree(
|
|
70072
|
+
dragSource,
|
|
70073
|
+
workingTree
|
|
70074
|
+
);
|
|
70075
|
+
workingTree = insertDragSourceAfterParentInWorkingTree(
|
|
70076
|
+
dragSource,
|
|
70077
|
+
dragSourceParentIndex,
|
|
70078
|
+
workingTree
|
|
70079
|
+
);
|
|
70027
70080
|
}
|
|
70081
|
+
newList = transformTreeToList(workingTree);
|
|
70082
|
+
onListReorder(newList);
|
|
70028
70083
|
};
|
|
70029
70084
|
const tree2 = (_a = list2 == null ? void 0 : list2.items) == null ? void 0 : _a.map(({ id: id2, droppable: droppable2, parent, name: name2, ...rest }) => ({
|
|
70030
70085
|
id: id2,
|
|
@@ -70541,206 +70596,137 @@ const UnitInput = ({
|
|
|
70541
70596
|
}
|
|
70542
70597
|
);
|
|
70543
70598
|
};
|
|
70544
|
-
const
|
|
70545
|
-
|
|
70546
|
-
|
|
70547
|
-
|
|
70548
|
-
|
|
70549
|
-
|
|
70550
|
-
|
|
70551
|
-
|
|
70552
|
-
|
|
70599
|
+
const normalizeUnits = (unitConfig) => unitConfig.reduce(
|
|
70600
|
+
({ preferredUnits, storageUnits }, { unitKey, preferredUnit, storageUnit }) => {
|
|
70601
|
+
preferredUnits[unitKey] = preferredUnit;
|
|
70602
|
+
storageUnits[unitKey] = storageUnit;
|
|
70603
|
+
return { preferredUnits, storageUnits };
|
|
70604
|
+
},
|
|
70605
|
+
{ preferredUnits: {}, storageUnits: {} }
|
|
70606
|
+
);
|
|
70607
|
+
const convertVisibleRows = ({
|
|
70608
|
+
headers,
|
|
70609
|
+
rows,
|
|
70610
|
+
selectedUnits,
|
|
70611
|
+
storageUnits,
|
|
70612
|
+
onChangeUnit,
|
|
70613
|
+
convertBackToStorageUnit,
|
|
70614
|
+
enableCosmeticRounding
|
|
70553
70615
|
}) => {
|
|
70554
|
-
|
|
70555
|
-
|
|
70556
|
-
|
|
70557
|
-
|
|
70558
|
-
|
|
70559
|
-
|
|
70560
|
-
|
|
70561
|
-
|
|
70562
|
-
|
|
70563
|
-
|
|
70564
|
-
|
|
70565
|
-
|
|
70566
|
-
const onChange = ({
|
|
70567
|
-
target: { value: newUnit }
|
|
70568
|
-
}) => {
|
|
70569
|
-
if (newUnit === oldUnit) {
|
|
70570
|
-
return;
|
|
70571
|
-
}
|
|
70572
|
-
handleUnitChange(key2, newUnit, ix);
|
|
70573
|
-
};
|
|
70574
|
-
return {
|
|
70575
|
-
value: oldUnit,
|
|
70576
|
-
options,
|
|
70577
|
-
type: "Select",
|
|
70578
|
-
onChange
|
|
70579
|
-
};
|
|
70580
|
-
});
|
|
70581
|
-
};
|
|
70582
|
-
const getHeaders = ({ tableDef }) => tableDef.map(({ header: header2 }) => ({
|
|
70583
|
-
value: header2
|
|
70584
|
-
}));
|
|
70585
|
-
const onConvertData = (data, displayedUnits, tableDef, oldStructureType) => {
|
|
70586
|
-
if (!(data == null ? void 0 : data.length))
|
|
70587
|
-
return [];
|
|
70588
|
-
let storedUnits;
|
|
70589
|
-
const tableData = cloneDeep(data);
|
|
70590
|
-
if (oldStructureType) {
|
|
70591
|
-
[storedUnits] = tableData.splice(0, 1);
|
|
70592
|
-
}
|
|
70593
|
-
const convertedTable = tableData.map((row2) => {
|
|
70594
|
-
const convertedRow = tableDef.reduce((prev2, colDef, columnIx) => {
|
|
70595
|
-
const { key: key2, defaultValue } = colDef;
|
|
70596
|
-
const unitTo = oldStructureType === STRUCTURE_TYPE.ARRAY ? (
|
|
70597
|
-
// @ts-ignore TODO Peter B
|
|
70598
|
-
displayedUnits[columnIx]
|
|
70599
|
-
) : (
|
|
70600
|
-
// @ts-ignore TODO Peter B
|
|
70601
|
-
displayedUnits[key2]
|
|
70602
|
-
);
|
|
70603
|
-
const unitFrom = oldStructureType === STRUCTURE_TYPE.ARRAY ? (
|
|
70604
|
-
// @ts-ignore TODO Peter B
|
|
70605
|
-
storedUnits[columnIx]
|
|
70606
|
-
) : (
|
|
70607
|
-
// @ts-ignore TODO Peter B
|
|
70608
|
-
storedUnits == null ? void 0 : storedUnits[key2]
|
|
70609
|
-
);
|
|
70610
|
-
const value = oldStructureType === STRUCTURE_TYPE.ARRAY ? row2[columnIx] : row2[key2];
|
|
70611
|
-
let displayedValue = value ?? defaultValue;
|
|
70612
|
-
if (unitFrom && unitTo) {
|
|
70613
|
-
displayedValue = convertAndGetValue(displayedValue, unitTo, unitFrom);
|
|
70616
|
+
const convertedHeaders = headers ? headers.map((headerRow) => ({
|
|
70617
|
+
...headerRow,
|
|
70618
|
+
cells: headerRow.cells.map((headerCell) => {
|
|
70619
|
+
if (headerCell.type === CellType.AUTO_UNIT) {
|
|
70620
|
+
const { unitKey } = headerCell;
|
|
70621
|
+
return {
|
|
70622
|
+
value: selectedUnits[unitKey],
|
|
70623
|
+
type: CellType.SELECT,
|
|
70624
|
+
options: getUnitsForQuantity(unitKey),
|
|
70625
|
+
native: true,
|
|
70626
|
+
onChange: (evt) => onChangeUnit({ unitKey, value: evt.target.value })
|
|
70627
|
+
};
|
|
70614
70628
|
}
|
|
70615
|
-
|
|
70616
|
-
|
|
70617
|
-
|
|
70618
|
-
|
|
70619
|
-
|
|
70620
|
-
|
|
70621
|
-
|
|
70622
|
-
|
|
70623
|
-
|
|
70624
|
-
|
|
70629
|
+
return headerCell;
|
|
70630
|
+
})
|
|
70631
|
+
})) : [];
|
|
70632
|
+
const convertedRows = rows ? rows.map((row2, rowIndex) => ({
|
|
70633
|
+
...row2,
|
|
70634
|
+
cells: row2.cells.map((cell2, cellIndex) => {
|
|
70635
|
+
if ("autoUnit" in cell2 && (cell2 == null ? void 0 : cell2.autoUnit) && (typeof (cell2 == null ? void 0 : cell2.value) === "string" || typeof (cell2 == null ? void 0 : cell2.value) === "number")) {
|
|
70636
|
+
const { formatDisplayValue, unitKey, value } = cell2;
|
|
70637
|
+
const selectedUnit = selectedUnits[unitKey];
|
|
70638
|
+
const storageUnit = storageUnits[unitKey];
|
|
70639
|
+
const unitChanged = selectedUnit !== storageUnit;
|
|
70640
|
+
const convertedValue = unitChanged ? convertAndGetValue(value, selectedUnit, storageUnit) : cell2.value;
|
|
70641
|
+
const displayValue = unitChanged && enableCosmeticRounding ? (
|
|
70642
|
+
/*
|
|
70643
|
+
Optionally do Excel-style "cosmetic rounding" of display values (only if enableCosmeticRounding prop on)
|
|
70644
|
+
This means rounding to slightly less precision than the underlying floating-point number type, to
|
|
70645
|
+
resolve floating-point "rounding noise" associated with storing values in one unit but converting
|
|
70646
|
+
and displaying them in another unit. This solution was evaluated by Tools Team in relation to
|
|
70647
|
+
tickets OW-10614 and OW-15745.
|
|
70648
|
+
*/
|
|
70649
|
+
roundToPrecision(convertedValue, 14)
|
|
70650
|
+
) : convertedValue;
|
|
70651
|
+
const formattedDisplayValue = formatDisplayValue ? formatDisplayValue(displayValue) : displayValue;
|
|
70652
|
+
return {
|
|
70653
|
+
...cell2,
|
|
70654
|
+
value: formattedDisplayValue,
|
|
70655
|
+
onChange: (evt) => {
|
|
70656
|
+
const { value: value2 } = evt.target;
|
|
70657
|
+
const storageUnit2 = storageUnits[unitKey];
|
|
70658
|
+
const selectedUnit2 = selectedUnits[unitKey];
|
|
70659
|
+
const unitChanged2 = selectedUnit2 !== storageUnit2;
|
|
70660
|
+
const nextValueConverted = unitChanged2 ? convertAndGetValue(value2, storageUnit2, selectedUnit2) : value2;
|
|
70661
|
+
const nextUnit = convertBackToStorageUnit ? storageUnit2 : selectedUnit2;
|
|
70662
|
+
if ("onChange" in cell2) {
|
|
70663
|
+
const { onChange } = cell2;
|
|
70664
|
+
const event = {
|
|
70665
|
+
...evt,
|
|
70666
|
+
target: {
|
|
70667
|
+
...evt.target,
|
|
70668
|
+
value: String(nextValueConverted),
|
|
70669
|
+
rowIndex,
|
|
70670
|
+
cellIndex,
|
|
70671
|
+
unit: nextUnit
|
|
70672
|
+
}
|
|
70673
|
+
};
|
|
70674
|
+
onChange(event);
|
|
70675
|
+
}
|
|
70676
|
+
}
|
|
70677
|
+
};
|
|
70625
70678
|
}
|
|
70626
|
-
return
|
|
70627
|
-
|
|
70628
|
-
|
|
70629
|
-
|
|
70630
|
-
}, {});
|
|
70631
|
-
return convertedRow;
|
|
70632
|
-
});
|
|
70633
|
-
return oldStructureType ? [displayedUnits, ...convertedTable] : convertedTable;
|
|
70634
|
-
};
|
|
70635
|
-
const addRowHeader = (addRow, data, displayedUnits) => ({
|
|
70636
|
-
label: "Add",
|
|
70637
|
-
icon: "plus",
|
|
70638
|
-
primary: true,
|
|
70639
|
-
onClick: () => addRow(data, displayedUnits),
|
|
70640
|
-
testId: "lithology-table-add-new-row"
|
|
70641
|
-
});
|
|
70642
|
-
const getDisplayedUnits = (tableDef, unitTemplate, oldStructureType) => {
|
|
70643
|
-
if (oldStructureType === STRUCTURE_TYPE.ARRAY) {
|
|
70644
|
-
return tableDef.reduce((prev2, curr, ix) => {
|
|
70645
|
-
const { unitKey } = curr;
|
|
70646
|
-
prev2[ix] = unitTemplate[unitKey];
|
|
70647
|
-
return prev2;
|
|
70648
|
-
}, []);
|
|
70649
|
-
}
|
|
70650
|
-
return tableDef.reduce((prev2, curr) => {
|
|
70651
|
-
const { key: key2, unitKey } = curr;
|
|
70652
|
-
return {
|
|
70653
|
-
...prev2,
|
|
70654
|
-
[key2]: unitTemplate[unitKey]
|
|
70655
|
-
};
|
|
70656
|
-
}, {});
|
|
70657
|
-
};
|
|
70658
|
-
const buildTable = ({
|
|
70659
|
-
rows,
|
|
70660
|
-
tableDef,
|
|
70661
|
-
displayedUnits,
|
|
70662
|
-
handleUnitChange,
|
|
70663
|
-
tableActions,
|
|
70664
|
-
oldStructureType = STRUCTURE_TYPE.OBJECT
|
|
70665
|
-
}) => {
|
|
70666
|
-
if (!rows) {
|
|
70667
|
-
return {
|
|
70668
|
-
rows: [],
|
|
70669
|
-
headers: []
|
|
70670
|
-
};
|
|
70671
|
-
}
|
|
70672
|
-
const { addRow } = tableActions;
|
|
70673
|
-
const headers = [
|
|
70674
|
-
{
|
|
70675
|
-
cells: getHeaders({ tableDef }),
|
|
70676
|
-
actions: addRow ? [addRowHeader(addRow, rows, displayedUnits)] : []
|
|
70677
|
-
},
|
|
70678
|
-
{
|
|
70679
|
-
cells: getUnitCells({
|
|
70680
|
-
tableDef,
|
|
70681
|
-
displayedUnits,
|
|
70682
|
-
handleUnitChange,
|
|
70683
|
-
oldStructureType
|
|
70684
|
-
})
|
|
70685
|
-
}
|
|
70686
|
-
];
|
|
70687
|
-
return {
|
|
70688
|
-
headers,
|
|
70689
|
-
rows
|
|
70690
|
-
};
|
|
70679
|
+
return cell2;
|
|
70680
|
+
})
|
|
70681
|
+
})) : [];
|
|
70682
|
+
return { convertedHeaders, convertedRows };
|
|
70691
70683
|
};
|
|
70692
70684
|
const UnitTable = ({
|
|
70693
|
-
|
|
70694
|
-
|
|
70695
|
-
|
|
70696
|
-
|
|
70697
|
-
tableActions,
|
|
70698
|
-
testId,
|
|
70699
|
-
oldStructureType = STRUCTURE_TYPE.OBJECT
|
|
70685
|
+
table: table2,
|
|
70686
|
+
unitConfig,
|
|
70687
|
+
convertBackToStorageUnit = true,
|
|
70688
|
+
enableCosmeticRounding = true
|
|
70700
70689
|
}) => {
|
|
70701
|
-
const
|
|
70690
|
+
const { rows, headers, ...otherProps } = table2;
|
|
70691
|
+
const { storageUnits, preferredUnits } = normalizeUnits(unitConfig);
|
|
70692
|
+
const previousPreferredUnits = usePrevious(preferredUnits);
|
|
70693
|
+
const [selectedUnits, setSelectedUnits] = useState(preferredUnits);
|
|
70694
|
+
const onChangeUnit = ({
|
|
70695
|
+
unitKey,
|
|
70696
|
+
value
|
|
70697
|
+
}) => setSelectedUnits({
|
|
70698
|
+
...selectedUnits,
|
|
70699
|
+
[unitKey]: value
|
|
70700
|
+
});
|
|
70701
|
+
const convertViewData = (selectedUnits2) => convertVisibleRows({
|
|
70702
|
+
headers,
|
|
70703
|
+
rows,
|
|
70704
|
+
selectedUnits: selectedUnits2,
|
|
70705
|
+
storageUnits,
|
|
70706
|
+
onChangeUnit,
|
|
70707
|
+
convertBackToStorageUnit,
|
|
70708
|
+
enableCosmeticRounding
|
|
70709
|
+
});
|
|
70710
|
+
const convertedViewData = convertViewData(selectedUnits);
|
|
70711
|
+
const [viewData, setViewData] = useState(convertedViewData);
|
|
70702
70712
|
useEffect(() => {
|
|
70703
|
-
|
|
70704
|
-
|
|
70705
|
-
|
|
70706
|
-
|
|
70707
|
-
const handleUnitChange = (key2, unit2, ix) => {
|
|
70708
|
-
if (oldStructureType === STRUCTURE_TYPE.ARRAY) {
|
|
70709
|
-
setDisplayedUnits((prev2) => {
|
|
70710
|
-
const newUnits = [...prev2];
|
|
70711
|
-
newUnits[ix] = unit2;
|
|
70712
|
-
return newUnits;
|
|
70713
|
-
});
|
|
70714
|
-
} else {
|
|
70715
|
-
setDisplayedUnits((prev2) => ({ ...prev2, [key2]: unit2 }));
|
|
70713
|
+
const templateChanged = !isEqual$4(preferredUnits, previousPreferredUnits);
|
|
70714
|
+
if (templateChanged) {
|
|
70715
|
+
setSelectedUnits(preferredUnits);
|
|
70716
|
+
setViewData(convertViewData(preferredUnits));
|
|
70716
70717
|
}
|
|
70717
|
-
};
|
|
70718
|
-
|
|
70719
|
-
()
|
|
70720
|
-
|
|
70721
|
-
onConvertData(data, displayedUnits, tableDef, oldStructureType),
|
|
70722
|
-
displayedUnits
|
|
70723
|
-
),
|
|
70724
|
-
tableDef,
|
|
70725
|
-
displayedUnits,
|
|
70726
|
-
handleUnitChange,
|
|
70727
|
-
tableActions,
|
|
70728
|
-
oldStructureType
|
|
70729
|
-
}),
|
|
70730
|
-
[displayedUnits, data]
|
|
70731
|
-
);
|
|
70718
|
+
}, [unitConfig]);
|
|
70719
|
+
useEffect(() => {
|
|
70720
|
+
setViewData(convertViewData(selectedUnits));
|
|
70721
|
+
}, [table2, selectedUnits]);
|
|
70732
70722
|
return /* @__PURE__ */ jsx(
|
|
70733
70723
|
Table,
|
|
70734
70724
|
{
|
|
70735
70725
|
table: {
|
|
70736
|
-
|
|
70737
|
-
headers,
|
|
70738
|
-
rows
|
|
70739
|
-
|
|
70740
|
-
columnWidths: tableDef.map((def) => def.columnWidth),
|
|
70741
|
-
fixedWidth: "auto"
|
|
70742
|
-
},
|
|
70743
|
-
onListReorder: (tableActions == null ? void 0 : tableActions.reorderComponents) || void 0
|
|
70726
|
+
...otherProps,
|
|
70727
|
+
headers: viewData.convertedHeaders,
|
|
70728
|
+
rows: viewData.convertedRows
|
|
70729
|
+
}
|
|
70744
70730
|
}
|
|
70745
70731
|
);
|
|
70746
70732
|
};
|