@oliasoft-open-source/react-ui-library 4.5.0-beta-1 → 4.5.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.
Files changed (150) hide show
  1. package/dist/index.d.ts +2 -56
  2. package/dist/index.js +69 -219
  3. package/dist/index.js.map +1 -1
  4. package/dist/storybook/assets/{Color-6VNJS4EI-OKUPsN5g.js → Color-6VNJS4EI-Wo3sTH7y.js} +1 -1
  5. package/dist/storybook/assets/{DocsRenderer-NNNQARDV-GtO0h5cy.js → DocsRenderer-NNNQARDV-Yh9Nd5gV.js} +1 -1
  6. package/dist/storybook/assets/{WithTooltip-4HIR6TLV-oJGDwI7F.js → WithTooltip-4HIR6TLV-sgH3fqcb.js} +1 -1
  7. package/dist/storybook/assets/accordion.stories-DAmwlTmm.js +170 -0
  8. package/dist/storybook/assets/{actions-Z9jDWreP.js → actions-SGexXf58.js} +1 -1
  9. package/dist/storybook/assets/{actions.stories-Qrio9EMy.js → actions.stories-dDCC23QK.js} +1 -1
  10. package/dist/storybook/assets/{afe.stories-fh4-T0m2.js → afe.stories-1YkAm2l2.js} +1 -1
  11. package/dist/storybook/assets/{badge.stories-C0MXS15j.js → badge.stories-nzXJ1qip.js} +1 -1
  12. package/dist/storybook/assets/{blowout.stories-BXWf5R9h.js → blowout.stories-ro9WCHli.js} +1 -1
  13. package/dist/storybook/assets/breadcrumb.stories-V7ozYBO-.js +1 -0
  14. package/dist/storybook/assets/{button-7V8oA22w.js → button-IoNblLER.js} +1 -1
  15. package/dist/storybook/assets/{button-group-q8QKkLVU.js → button-group-KeeGgC4K.js} +1 -1
  16. package/dist/storybook/assets/{button-group.stories-tLZpLTfD.js → button-group.stories-DG3i2d7K.js} +1 -1
  17. package/dist/storybook/assets/{button.stories-PhWmZXOu.js → button.stories-R9_1tl9l.js} +1 -1
  18. package/dist/storybook/assets/{buttons-and-links-mIhXkKfh.js → buttons-and-links-G0egBJCQ.js} +2 -2
  19. package/dist/storybook/assets/{card.stories-HzHJW6ek.js → card.stories-OtRekExg.js} +1 -1
  20. package/dist/storybook/assets/{casing-loads.stories-i9Kyuvs1.js → casing-loads.stories--oHbAVn4.js} +1 -1
  21. package/dist/storybook/assets/cell.stories-S9IDsuIA.js +212 -0
  22. package/dist/storybook/assets/{check-box-LZdXXKhv.js → check-box-BX5dfQFk.js} +1 -1
  23. package/dist/storybook/assets/{check-box.stories-0XCykxnz.js → check-box.stories-FNs72smP.js} +1 -1
  24. package/dist/storybook/assets/{chunk-HLWAVYOI-YpA4-WPj.js → chunk-HLWAVYOI-R756X9cQ.js} +1 -1
  25. package/dist/storybook/assets/{color-0ogqq8EH.js → color-6FMn1O-g.js} +1 -1
  26. package/dist/storybook/assets/{column.stories-6OLsjlcP.js → column.stories-5pd3N4bE.js} +1 -1
  27. package/dist/storybook/assets/dialog-dekS0lUR.js +1 -0
  28. package/dist/storybook/assets/dialog-gTGZ42G6.css +1 -0
  29. package/dist/storybook/assets/{drawer-WuErQ5Z8.js → drawer-TM-jK3WR.js} +1 -1
  30. package/dist/storybook/assets/{drawer.stories-BLdyJ3NA.js → drawer.stories-K-pmYbOj.js} +1 -1
  31. package/dist/storybook/assets/empty.stories-KIByp315.js +1 -0
  32. package/dist/storybook/assets/{field-eknsj_Ll.js → field-kOZPBHf6.js} +1 -1
  33. package/dist/storybook/assets/{field.stories-RmhJ16HT.js → field.stories-aEccauPi.js} +1 -1
  34. package/dist/storybook/assets/file-input.stories-22XjkzbO.js +66 -0
  35. package/dist/storybook/assets/{flex-RYZsoWEN.js → flex-ZVra76N-.js} +1 -1
  36. package/dist/storybook/assets/{flex.stories-lLz0Xrt_.js → flex.stories-kjbyZMWP.js} +1 -1
  37. package/dist/storybook/assets/{footer.stories-guoNYzr9.js → footer.stories-4uhW-z_4.js} +1 -1
  38. package/dist/storybook/assets/{form.stories-tzZoKyyL.js → form.stories-_A7_Mppm.js} +1 -1
  39. package/dist/storybook/assets/{formation.stories-KUe50fTQ.js → formation.stories-ZGzBQKt1.js} +1 -1
  40. package/dist/storybook/assets/{formatter-SWP5E3XI-Z60pYM_f.js → formatter-SWP5E3XI-yTTNZ_t2.js} +1 -1
  41. package/dist/storybook/assets/{heading-Bk0bpNfe.js → heading-cUVItwKq.js} +1 -1
  42. package/dist/storybook/assets/{heading.stories-HLMPkIPo.js → heading.stories-K-Z0sIoo.js} +1 -1
  43. package/dist/storybook/assets/{help-icon--rUDxLUD.js → help-icon-nI9A506M.js} +1 -1
  44. package/dist/storybook/assets/{help-icon.stories-vifwJgNA.js → help-icon.stories-Qz7MKCnQ.js} +1 -1
  45. package/dist/storybook/assets/{icon.stories-W-UgTWyK.js → icon.stories-icqUrCtQ.js} +1 -1
  46. package/dist/storybook/assets/iframe-SrZRNvhh.js +7 -0
  47. package/dist/storybook/assets/{index-isA0pQQP.js → index-4BJtFSI2.js} +5 -5
  48. package/dist/storybook/assets/{input-group.stories-WljyIQ0a.js → input-group.stories-EouZEW-v.js} +1 -1
  49. package/dist/storybook/assets/{input-u1He-wWs.js → input-iDZqV-2m.js} +1 -1
  50. package/dist/storybook/assets/{input-validation-lBeNJX0o.js → input-validation-kZPNHjD7.js} +1 -1
  51. package/dist/storybook/assets/{input.stories-rLdDRxtU.js → input.stories-iopguZKB.js} +1 -1
  52. package/dist/storybook/assets/{inputs-bYS5qR_g.js → inputs-V80YGmaz.js} +14 -14
  53. package/dist/storybook/assets/{label-0_Qf6I8t.js → label-RpB4JmHX.js} +1 -1
  54. package/dist/storybook/assets/{label.stories-aXdU5_Ql.js → label.stories-HcdQ1bEB.js} +1 -1
  55. package/dist/storybook/assets/{layout-forms-S1UZag29.js → layout-forms-FANlSXRU.js} +1 -1
  56. package/dist/storybook/assets/{layout-general-U3YRmnqR.js → layout-general-LrT4H6RD.js} +1 -1
  57. package/dist/storybook/assets/{list-dAlCO11z.js → list-ciYNlkVM.js} +1 -1
  58. package/dist/storybook/assets/list-heading-XbqCJOHh.js +1 -0
  59. package/dist/storybook/assets/{list.stories-data-IcFu6vvd.js → list.stories-data-spFiMtCi.js} +1 -1
  60. package/dist/storybook/assets/{list.stories-bt_cumRX.js → list.stories-khlFbVFq.js} +1 -1
  61. package/dist/storybook/assets/{loader.stories-0OwmnNML.js → loader.stories-G8Q_Fm8u.js} +1 -1
  62. package/dist/storybook/assets/{menu.stories-data-hEz8P1yK.js → menu.stories-data-VCYkzuDD.js} +1 -1
  63. package/dist/storybook/assets/{menu.stories-VwRF_Pbx.js → menu.stories-sot2Whii.js} +1 -1
  64. package/dist/storybook/assets/{message-yii7x6Na.js → message-uMHaTEXV.js} +1 -1
  65. package/dist/storybook/assets/{message.stories-9RWD3-p1.js → message.stories-BqM_-mrZ.js} +1 -1
  66. package/dist/storybook/assets/{modal.stories-rVfow_s3.js → modal.stories-K4XxeWTp.js} +1 -1
  67. package/dist/storybook/assets/{number-input-SvjJIGsW.js → number-input-d7hXQldd.js} +1 -1
  68. package/dist/storybook/assets/{number-input.stories-BURENIFo.js → number-input.stories-SOsG2FLJ.js} +1 -1
  69. package/dist/storybook/assets/option-dropdown.stories-1Y5JDaBF.js +21 -0
  70. package/dist/storybook/assets/{padding-and-spacing-Ej5fu8GG.js → padding-and-spacing-sd88NtLC.js} +1 -1
  71. package/dist/storybook/assets/page.stories-B5gzoAi8.js +57 -0
  72. package/dist/storybook/assets/{pagination-5n5spTRo.js → pagination-Eaj_UOBW.js} +1 -1
  73. package/dist/storybook/assets/{pagination.stories-g4a-aSxq.js → pagination.stories-sl2a8BMq.js} +1 -1
  74. package/dist/storybook/assets/pop-confirm.stories-94l3Xg8w.js +9 -0
  75. package/dist/storybook/assets/{popover-Y3FpGdUS.js → popover-uAo1e4-D.js} +1 -1
  76. package/dist/storybook/assets/{popover.stories-b7Tt4S0j.js → popover.stories-XaqJOrng.js} +1 -1
  77. package/dist/storybook/assets/{preview-8d3sl769.js → preview-HzqOHlF7.js} +2 -2
  78. package/dist/storybook/assets/{global-M-3dCKk3.css → preview-QdB_aBj_.css} +1 -1
  79. package/dist/storybook/assets/{preview-UZXZGus9.js → preview-ixZGzwV9.js} +3 -3
  80. package/dist/storybook/assets/{projects.stories-bo3cPOP-.js → projects.stories-ojOsn6HU.js} +1 -1
  81. package/dist/storybook/assets/{radio-button-jHcwHUA4.js → radio-button-QcS9mLYi.js} +1 -1
  82. package/dist/storybook/assets/{radio-button.stories-LkCJsp5P.js → radio-button.stories-KCS981-F.js} +1 -1
  83. package/dist/storybook/assets/{reservoirs.stories-RUFcw2h6.js → reservoirs.stories-Dg5QFAXV.js} +1 -1
  84. package/dist/storybook/assets/{rich-text-input-W-kYpvgO.js → rich-text-input.stories-D55Op5Gf.js} +127 -52
  85. package/dist/storybook/assets/{row.stories-TurDc49t.js → row.stories-HVr8m6RK.js} +1 -1
  86. package/dist/storybook/assets/{select-JjEPivho.js → select-Z1HqJ5aU.js} +1 -1
  87. package/dist/storybook/assets/{select.stories-qFDyxRFm.js → select.stories-oUxeDUts.js} +1 -1
  88. package/dist/storybook/assets/{side-bar-Fjr2t9MT.js → side-bar-GJ2tcZYY.js} +1 -1
  89. package/dist/storybook/assets/{side-bar.stories-sxBJCVnV.js → side-bar.stories-q_bRwHV_.js} +1 -1
  90. package/dist/storybook/assets/{site.stories-Hnwa5Rxk.js → site.stories-OEW6o2C_.js} +1 -1
  91. package/dist/storybook/assets/{slider-nl2rJ9LF.js → slider-_5NQKbM-.js} +1 -1
  92. package/dist/storybook/assets/{slider.stories--aZa8kf-.js → slider.stories-QyyBB_rz.js} +1 -1
  93. package/dist/storybook/assets/{spacer.stories-eCrKj4b3.js → spacer.stories-CWSQp7tw.js} +1 -1
  94. package/dist/storybook/assets/{syntaxhighlighter-NMPM6SWI-LVCFR00p.js → syntaxhighlighter-NMPM6SWI-7eVUNnH3.js} +1 -1
  95. package/dist/storybook/assets/table-_jWgMFOi.js +1 -0
  96. package/dist/storybook/assets/{table.stories-data-txTr9mYv.js → table.stories-data-2BZDVr2X.js} +1 -1
  97. package/dist/storybook/assets/{table.stories-TGOwb9FU.js → table.stories-lwqVUJHa.js} +1 -1
  98. package/dist/storybook/assets/text-link.stories-kjfUeFtk.js +1 -0
  99. package/dist/storybook/assets/{textarea-8bcldTyf.js → textarea-1cVdadvY.js} +1 -1
  100. package/dist/storybook/assets/{textarea.stories-D9SctTMD.js → textarea.stories-twGqf34D.js} +1 -1
  101. package/dist/storybook/assets/{title.stories-InoCrXr8.js → title.stories-Djnk3crF.js} +1 -1
  102. package/dist/storybook/assets/{toaster-2HasMRmP.js → toaster-eOozfa7U.js} +1 -1
  103. package/dist/storybook/assets/{toaster.stories-NBYloz0_.js → toaster.stories-ft_M65x0.js} +1 -1
  104. package/dist/storybook/assets/{toggle-BPI2y-lU.js → toggle-wk0GbVB8.js} +1 -1
  105. package/dist/storybook/assets/{toggle.stories-aVmjpons.js → toggle.stories-LC6LSCD2.js} +1 -1
  106. package/dist/storybook/assets/{tooltip-HEHiU__l.js → tooltip-ZHdi6rl-.js} +1 -1
  107. package/dist/storybook/assets/{tooltip.stories-tiOgoWHH.js → tooltip.stories-gTfOeEzv.js} +1 -1
  108. package/dist/storybook/assets/{tooltip.test-case.stories-kIeZayHw.js → tooltip.test-case.stories-y-bQOM0s.js} +1 -1
  109. package/dist/storybook/assets/{top-bar-3dxv0sp9.js → top-bar-0fDAFWyC.js} +1 -1
  110. package/dist/storybook/assets/{top-bar.stories-sMvXnmhR.js → top-bar.stories-YKtteM_h.js} +1 -1
  111. package/dist/storybook/assets/{top-bar.testcase.stories-Nb8fdPBS.js → top-bar.testcase.stories-Z-6C5D2R.js} +1 -1
  112. package/dist/storybook/assets/tree.stories-5fjCVN1S.js +180 -0
  113. package/dist/storybook/assets/unit-input.stories-ZdrR9JWT.js +273 -0
  114. package/dist/storybook/iframe.html +1 -1
  115. package/dist/storybook/index.json +1 -1
  116. package/dist/storybook/project.json +1 -1
  117. package/dist/storybook/stories.json +1 -1
  118. package/package.json +1 -1
  119. package/dist/storybook/assets/accordion-with-default-toggle-8PUIm8jP.js +0 -1
  120. package/dist/storybook/assets/accordion.stories-xUgAzm87.js +0 -170
  121. package/dist/storybook/assets/breadcrumb-WFZ7OoC2.js +0 -1
  122. package/dist/storybook/assets/breadcrumb.stories-mou0ppaX.js +0 -1
  123. package/dist/storybook/assets/cell.stories-QHDggPeA.js +0 -208
  124. package/dist/storybook/assets/empty-PU0JdhZM.js +0 -1
  125. package/dist/storybook/assets/empty.stories-FYO6syUx.js +0 -1
  126. package/dist/storybook/assets/file-input-7-7kYhsS.js +0 -1
  127. package/dist/storybook/assets/file-input.stories-lW0gLK14.js +0 -66
  128. package/dist/storybook/assets/iframe-ybuSzuG4.js +0 -7
  129. package/dist/storybook/assets/meta-content-2S9BpSoX.js +0 -1
  130. package/dist/storybook/assets/modal-BJKGBCkS.css +0 -1
  131. package/dist/storybook/assets/modal-Dr5HffrG.js +0 -1
  132. package/dist/storybook/assets/option-dropdown-6QvoS02o.js +0 -1
  133. package/dist/storybook/assets/option-dropdown.stories-5qw-N2Q9.js +0 -21
  134. package/dist/storybook/assets/page.stories-4zM8wrxN.js +0 -57
  135. package/dist/storybook/assets/pop-confirm-nfz5S-f-.js +0 -1
  136. package/dist/storybook/assets/pop-confirm.stories-1vIAhdl-.js +0 -9
  137. package/dist/storybook/assets/preview-agc3Xxfb.css +0 -1
  138. package/dist/storybook/assets/print-header-mVYWFles.js +0 -1
  139. package/dist/storybook/assets/rich-text-input.stories-6-587T_0.js +0 -76
  140. package/dist/storybook/assets/table-lfeSnryj.js +0 -1
  141. package/dist/storybook/assets/text-link-1uKYQqn_.js +0 -1
  142. package/dist/storybook/assets/text-link.stories-ZcuOY5VK.js +0 -1
  143. package/dist/storybook/assets/tree-Rhl5ea49.js +0 -6
  144. package/dist/storybook/assets/tree.stories-dFH-G6se.js +0 -123
  145. package/dist/storybook/assets/unit-input-fxjK7nON.js +0 -1
  146. package/dist/storybook/assets/unit-input.stories--UApgPT-.js +0 -273
  147. package/dist/storybook/assets/unit-table.stories-Vd1Nqk2h.js +0 -434
  148. /package/dist/storybook/assets/{accordion-with-default-toggle-tw1O4Ru6.css → accordion-tw1O4Ru6.css} +0 -0
  149. /package/dist/storybook/assets/{meta-content-Y8BAUuV6.css → list-heading-Y8BAUuV6.css} +0 -0
  150. /package/dist/storybook/assets/{print-header-6iak35D6.css → page-6iak35D6.css} +0 -0
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,7 @@ export declare interface ITreeProps {
1534
1494
  expand: React_2.ReactNode;
1535
1495
  collapse: React_2.ReactNode;
1536
1496
  };
1497
+ allowParentReassignment?: boolean;
1537
1498
  }
1538
1499
 
1539
1500
  export declare interface IUnitInputProps {
@@ -1572,19 +1533,6 @@ export declare interface IUnitInputProps {
1572
1533
  unitTemplate?: Record<string, any>;
1573
1534
  }
1574
1535
 
1575
- declare interface IUnitTableProps {
1576
- data: Array<any>;
1577
- unitTemplate: Record<string, any>;
1578
- tableDef: ITableDefinition[];
1579
- convertToCells: (displayedData: Array<any>, displayedUnits: Record<string, any>) => {
1580
- cells: ICell[];
1581
- actions: IActionsType;
1582
- }[];
1583
- tableActions: ITableActions;
1584
- oldStructureType?: string | null;
1585
- testId: string;
1586
- }
1587
-
1588
1536
  export declare const Label: ({ label, width, helpText, helpTextMaxWidth, onClickHelp, lock, info, libraryIcon, labelLeft, }: ILabelProps) => JSX_2.Element;
1589
1537
 
1590
1538
  export declare const List: ({ list, bordered, expanding, narrow, toggleNarrow, onToggleNarrow, invokeEditOnRowClick, noHeader, stickyHeader, draggable, onListReorder, marginBottom, height, testId, scrollDetails, }: IListProps) => JSX_2.Element;
@@ -1763,7 +1711,7 @@ export declare const Tooltip: ({ children, text, error, placement, possiblePlace
1763
1711
 
1764
1712
  export declare const TopBar: ({ title, appSwitcher, content, contentRight, warning, height, fixedPosition, }: ITopBarProps) => JSX_2.Element;
1765
1713
 
1766
- export declare const Tree: ({ list, draggable, onListReorder, onChangeOpen, testId, isInitialOpen, treeRef, itemHasChild, onItemToggle, icons, }: ITreeProps) => JSX_2.Element;
1714
+ export declare const Tree: ({ list, draggable, onListReorder, onChangeOpen, testId, isInitialOpen, treeRef, itemHasChild, onItemToggle, icons, allowParentReassignment, }: ITreeProps) => JSX_2.Element;
1767
1715
 
1768
1716
  export declare enum TriggerType {
1769
1717
  TEXT = "Text",
@@ -1801,8 +1749,6 @@ export declare type TTriggerType = 'Text' | 'Button' | 'DropDownButton' | 'Compo
1801
1749
 
1802
1750
  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
1751
 
1804
- export declare const UnitTable: ({ data, unitTemplate, tableDef, convertToCells, tableActions, testId, oldStructureType, }: IUnitTableProps) => JSX_2.Element;
1805
-
1806
1752
  export declare const useFocus: () => UseFocusReturnType;
1807
1753
 
1808
1754
  declare type UseFocusReturnType = [MutableRefObject<HTMLInputElement | null>, TEmpty];
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, cloneDeep } 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, convertAndGetValue, isNumeric, getAltUnitsListByQuantity } from "@oliasoft-open-source/units";
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 } 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 } 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,
@@ -70007,24 +70010,75 @@ const Tree = ({
70007
70010
  treeRef,
70008
70011
  itemHasChild,
70009
70012
  onItemToggle,
70010
- icons: icons2
70013
+ icons: icons2,
70014
+ allowParentReassignment
70011
70015
  }) => {
70012
70016
  var _a;
70013
- const handleDrop = (newTree) => {
70014
- if (onListReorder) {
70015
- const newList = newTree.map(({ id: id2, parent, droppable: droppable2, data }) => ({
70017
+ const handleOpen = (id2) => {
70018
+ if (onChangeOpen) {
70019
+ onChangeOpen(id2);
70020
+ }
70021
+ };
70022
+ const findNodeIndexById = (tree22, id2) => {
70023
+ return (tree22 == null ? void 0 : tree22.findIndex((node2) => (node2 == null ? void 0 : node2.id) === id2)) ?? -1;
70024
+ };
70025
+ const setDragSourceParentToGrandparent = (dragSource, workingTree) => {
70026
+ const dragSourceParentIndex = findNodeIndexById(
70027
+ workingTree,
70028
+ dragSource == null ? void 0 : dragSource.parent
70029
+ );
70030
+ if (dragSourceParentIndex >= 0) {
70031
+ const grandparent = workingTree == null ? void 0 : workingTree.find(
70032
+ (node2) => {
70033
+ var _a2;
70034
+ return (node2 == null ? void 0 : node2.id) === ((_a2 = workingTree[dragSourceParentIndex]) == null ? void 0 : _a2.parent);
70035
+ }
70036
+ );
70037
+ dragSource.parent = grandparent ? grandparent.id : 0;
70038
+ }
70039
+ };
70040
+ const removeDragSourceFromWorkingTree = (dragSource, workingTree) => {
70041
+ return (workingTree == null ? void 0 : workingTree.filter((node2) => (node2 == null ? void 0 : node2.id) !== (dragSource == null ? void 0 : dragSource.id))) ?? [];
70042
+ };
70043
+ const insertDragSourceAfterParentInWorkingTree = (dragSource, dragSourceParentIndex, workingTree) => {
70044
+ workingTree == null ? void 0 : workingTree.splice(dragSourceParentIndex, 0, dragSource);
70045
+ return workingTree;
70046
+ };
70047
+ const transformTreeToList = (tree22) => {
70048
+ return tree22.map(({ id: id2, parent, droppable: droppable2, data }) => {
70049
+ return {
70016
70050
  id: id2,
70017
70051
  parent,
70018
70052
  droppable: droppable2,
70019
70053
  ...data
70020
- }));
70021
- onListReorder(newList);
70022
- }
70054
+ };
70055
+ });
70023
70056
  };
70024
- const handleOpen = (id2) => {
70025
- if (onChangeOpen) {
70026
- onChangeOpen(id2);
70057
+ const handleDrop = (newTree, option2) => {
70058
+ const { dragSource, dropTarget: dropTarget2 } = option2;
70059
+ let workingTree = [...newTree];
70060
+ if (!onListReorder)
70061
+ return;
70062
+ const dragSourceIndex = findNodeIndexById(workingTree, dragSource == null ? void 0 : dragSource.id);
70063
+ const dragSourceParentIndex = findNodeIndexById(
70064
+ workingTree,
70065
+ dragSource == null ? void 0 : dragSource.parent
70066
+ );
70067
+ let newList = [];
70068
+ if ((dragSource == null ? void 0 : dragSource.parent) === (dropTarget2 == null ? void 0 : dropTarget2.id) && dragSourceIndex === 0 && allowParentReassignment) {
70069
+ setDragSourceParentToGrandparent(dragSource, workingTree);
70070
+ workingTree = removeDragSourceFromWorkingTree(
70071
+ dragSource,
70072
+ workingTree
70073
+ );
70074
+ workingTree = insertDragSourceAfterParentInWorkingTree(
70075
+ dragSource,
70076
+ dragSourceParentIndex,
70077
+ workingTree
70078
+ );
70027
70079
  }
70080
+ newList = transformTreeToList(workingTree);
70081
+ onListReorder(newList);
70028
70082
  };
70029
70083
  const tree2 = (_a = list2 == null ? void 0 : list2.items) == null ? void 0 : _a.map(({ id: id2, droppable: droppable2, parent, name: name2, ...rest }) => ({
70030
70084
  id: id2,
@@ -70541,209 +70595,6 @@ const UnitInput = ({
70541
70595
  }
70542
70596
  );
70543
70597
  };
70544
- const STRUCTURE_TYPE = Object.freeze({
70545
- ARRAY: "array",
70546
- OBJECT: "object"
70547
- });
70548
- const getUnitCells = ({
70549
- tableDef,
70550
- displayedUnits,
70551
- handleUnitChange,
70552
- oldStructureType
70553
- }) => {
70554
- return tableDef.map(({ convertible, unitKey, key: key2 }, ix) => {
70555
- var _a;
70556
- if (!convertible) {
70557
- return { value: "" };
70558
- }
70559
- const oldUnit = oldStructureType === STRUCTURE_TYPE.ARRAY ? displayedUnits[ix] : displayedUnits[key2];
70560
- const options = (_a = getAltUnitsListByQuantity(unitKey)) == null ? void 0 : _a.map(
70561
- ({ unit: unit2, label: label2 }) => ({
70562
- label: label2,
70563
- value: unit2
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);
70614
- }
70615
- if (oldStructureType) {
70616
- if (oldStructureType === STRUCTURE_TYPE.ARRAY) {
70617
- row2[columnIx] = displayedValue;
70618
- return row2;
70619
- }
70620
- } else {
70621
- if (isValueWithUnit(value) && unitTo) {
70622
- const convertedValue = convertAndGetValue(displayedValue, unitTo);
70623
- displayedValue = isNumeric(convertedValue) ? withUnit(convertedValue, unitTo) : displayedValue;
70624
- }
70625
- }
70626
- return {
70627
- ...prev2,
70628
- [key2]: displayedValue
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
- };
70691
- };
70692
- const UnitTable = ({
70693
- data,
70694
- unitTemplate,
70695
- tableDef,
70696
- convertToCells,
70697
- tableActions,
70698
- testId,
70699
- oldStructureType = STRUCTURE_TYPE.OBJECT
70700
- }) => {
70701
- const [displayedUnits, setDisplayedUnits] = useState(getDisplayedUnits(tableDef, unitTemplate, oldStructureType));
70702
- useEffect(() => {
70703
- setDisplayedUnits(
70704
- getDisplayedUnits(tableDef, unitTemplate, oldStructureType)
70705
- );
70706
- }, [unitTemplate]);
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 }));
70716
- }
70717
- };
70718
- const { headers, rows } = useMemo$1(
70719
- () => buildTable({
70720
- rows: convertToCells(
70721
- onConvertData(data, displayedUnits, tableDef, oldStructureType),
70722
- displayedUnits
70723
- ),
70724
- tableDef,
70725
- displayedUnits,
70726
- handleUnitChange,
70727
- tableActions,
70728
- oldStructureType
70729
- }),
70730
- [displayedUnits, data]
70731
- );
70732
- return /* @__PURE__ */ jsx(
70733
- Table,
70734
- {
70735
- table: {
70736
- testId,
70737
- headers,
70738
- rows,
70739
- columnAlignment: tableDef.map((def) => def.columnAlignment),
70740
- columnWidths: tableDef.map((def) => def.columnWidth),
70741
- fixedWidth: "auto"
70742
- },
70743
- onListReorder: (tableActions == null ? void 0 : tableActions.reorderComponents) || void 0
70744
- }
70745
- );
70746
- };
70747
70598
  export {
70748
70599
  Accordion,
70749
70600
  AccordionWithDefaultToggle,
@@ -70823,7 +70674,6 @@ export {
70823
70674
  Tree,
70824
70675
  TriggerType,
70825
70676
  UnitInput,
70826
- UnitTable,
70827
70677
  dismissToast,
70828
70678
  readFile,
70829
70679
  toast,