@osdk/react-components 0.2.0-beta.10 → 0.2.0-beta.12

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 (182) hide show
  1. package/AGENTS.md +105 -0
  2. package/CHANGELOG.md +22 -0
  3. package/build/browser/object-table/DefaultCellRenderer.js +5 -2
  4. package/build/browser/object-table/DefaultCellRenderer.js.map +1 -1
  5. package/build/browser/object-table/EditableCell.js +16 -6
  6. package/build/browser/object-table/EditableCell.js.map +1 -1
  7. package/build/browser/object-table/EditableCell.module.css +30 -2
  8. package/build/browser/object-table/EditableCell.module.css.js +2 -1
  9. package/build/browser/object-table/ObjectTable.js +9 -22
  10. package/build/browser/object-table/ObjectTable.js.map +1 -1
  11. package/build/browser/object-table/ObjectTableApi.js.map +1 -1
  12. package/build/browser/object-table/Table.js +23 -15
  13. package/build/browser/object-table/Table.js.map +1 -1
  14. package/build/browser/object-table/Table.module.css +0 -8
  15. package/build/browser/object-table/Table.module.css.js +1 -2
  16. package/build/browser/object-table/TableBody.js +8 -2
  17. package/build/browser/object-table/TableBody.js.map +1 -1
  18. package/build/browser/object-table/TableCell.module.css +0 -8
  19. package/build/browser/object-table/TableEditContainer.js +79 -0
  20. package/build/browser/object-table/TableEditContainer.js.map +1 -0
  21. package/build/browser/object-table/TableEditContainer.module.css +44 -0
  22. package/build/browser/object-table/TableEditContainer.module.css.js +9 -0
  23. package/build/browser/object-table/TableRow.js +12 -4
  24. package/build/browser/object-table/TableRow.js.map +1 -1
  25. package/build/browser/object-table/TableRow.module.css +2 -1
  26. package/build/browser/object-table/hooks/useEditableTable.js +20 -11
  27. package/build/browser/object-table/hooks/useEditableTable.js.map +1 -1
  28. package/build/browser/object-table/hooks/useObjectTableData.js +0 -5
  29. package/build/browser/object-table/hooks/useObjectTableData.js.map +1 -1
  30. package/build/browser/object-table/utils/getCellId.js +0 -7
  31. package/build/browser/object-table/utils/getCellId.js.map +1 -1
  32. package/build/browser/object-table/utils/types.js.map +1 -1
  33. package/build/browser/public/experimental.js.map +1 -1
  34. package/build/browser/styles.css +79 -19
  35. package/build/cjs/public/experimental.cjs +179 -90
  36. package/build/cjs/public/experimental.cjs.map +1 -1
  37. package/build/cjs/public/experimental.css +96 -57
  38. package/build/cjs/public/experimental.css.map +1 -1
  39. package/build/cjs/public/experimental.d.cts +40 -18
  40. package/build/esm/object-table/DefaultCellRenderer.js +5 -2
  41. package/build/esm/object-table/DefaultCellRenderer.js.map +1 -1
  42. package/build/esm/object-table/EditableCell.js +16 -6
  43. package/build/esm/object-table/EditableCell.js.map +1 -1
  44. package/build/esm/object-table/EditableCell.module.css +30 -2
  45. package/build/esm/object-table/ObjectTable.js +9 -22
  46. package/build/esm/object-table/ObjectTable.js.map +1 -1
  47. package/build/esm/object-table/ObjectTableApi.js.map +1 -1
  48. package/build/esm/object-table/Table.js +23 -15
  49. package/build/esm/object-table/Table.js.map +1 -1
  50. package/build/esm/object-table/Table.module.css +0 -8
  51. package/build/esm/object-table/TableBody.js +8 -2
  52. package/build/esm/object-table/TableBody.js.map +1 -1
  53. package/build/esm/object-table/TableCell.module.css +0 -8
  54. package/build/esm/object-table/TableEditContainer.js +79 -0
  55. package/build/esm/object-table/TableEditContainer.js.map +1 -0
  56. package/build/esm/object-table/TableEditContainer.module.css +44 -0
  57. package/build/esm/object-table/TableRow.js +12 -4
  58. package/build/esm/object-table/TableRow.js.map +1 -1
  59. package/build/esm/object-table/TableRow.module.css +2 -1
  60. package/build/esm/object-table/hooks/useEditableTable.js +20 -11
  61. package/build/esm/object-table/hooks/useEditableTable.js.map +1 -1
  62. package/build/esm/object-table/hooks/useObjectTableData.js +0 -5
  63. package/build/esm/object-table/hooks/useObjectTableData.js.map +1 -1
  64. package/build/esm/object-table/utils/getCellId.js +0 -7
  65. package/build/esm/object-table/utils/getCellId.js.map +1 -1
  66. package/build/esm/object-table/utils/types.js.map +1 -1
  67. package/build/esm/public/experimental.js.map +1 -1
  68. package/build/types/object-table/DefaultCellRenderer.d.ts +2 -2
  69. package/build/types/object-table/DefaultCellRenderer.d.ts.map +1 -1
  70. package/build/types/object-table/EditableCell.d.ts +18 -6
  71. package/build/types/object-table/EditableCell.d.ts.map +1 -1
  72. package/build/types/object-table/ObjectTable.d.ts +1 -1
  73. package/build/types/object-table/ObjectTable.d.ts.map +1 -1
  74. package/build/types/object-table/ObjectTableApi.d.ts +16 -6
  75. package/build/types/object-table/ObjectTableApi.d.ts.map +1 -1
  76. package/build/types/object-table/Table.d.ts +5 -10
  77. package/build/types/object-table/Table.d.ts.map +1 -1
  78. package/build/types/object-table/TableBody.d.ts +4 -1
  79. package/build/types/object-table/TableBody.d.ts.map +1 -1
  80. package/build/types/object-table/TableEditContainer.d.ts +9 -0
  81. package/build/types/object-table/TableEditContainer.d.ts.map +1 -0
  82. package/build/types/object-table/TableRow.d.ts +5 -1
  83. package/build/types/object-table/TableRow.d.ts.map +1 -1
  84. package/build/types/object-table/hooks/useEditableTable.d.ts +4 -9
  85. package/build/types/object-table/hooks/useEditableTable.d.ts.map +1 -1
  86. package/build/types/object-table/utils/getCellId.d.ts +0 -1
  87. package/build/types/object-table/utils/getCellId.d.ts.map +1 -1
  88. package/build/types/object-table/utils/types.d.ts +25 -3
  89. package/build/types/object-table/utils/types.d.ts.map +1 -1
  90. package/build/types/public/experimental.d.ts +1 -1
  91. package/build/types/public/experimental.d.ts.map +1 -1
  92. package/package.json +7 -6
  93. package/build/browser/filter-list/__tests__/LinkedPropertyInput.test.js +0 -202
  94. package/build/browser/filter-list/__tests__/LinkedPropertyInput.test.js.map +0 -1
  95. package/build/browser/filter-list/__tests__/dateUtils.test.js +0 -55
  96. package/build/browser/filter-list/__tests__/dateUtils.test.js.map +0 -1
  97. package/build/browser/filter-list/__tests__/filterStateToWhereClause.test.js +0 -296
  98. package/build/browser/filter-list/__tests__/filterStateToWhereClause.test.js.map +0 -1
  99. package/build/browser/filter-list/__tests__/getFilterKey.test.js +0 -53
  100. package/build/browser/filter-list/__tests__/getFilterKey.test.js.map +0 -1
  101. package/build/browser/filter-list/__tests__/testUtils.js +0 -203
  102. package/build/browser/filter-list/__tests__/testUtils.js.map +0 -1
  103. package/build/browser/filter-list/hooks/__tests__/useFilterListState.test.js +0 -128
  104. package/build/browser/filter-list/hooks/__tests__/useFilterListState.test.js.map +0 -1
  105. package/build/browser/object-table/__tests__/useEditableTable.test.js +0 -197
  106. package/build/browser/object-table/__tests__/useEditableTable.test.js.map +0 -1
  107. package/build/browser/object-table/hooks/__tests__/useCellContextMenu.test.js +0 -147
  108. package/build/browser/object-table/hooks/__tests__/useCellContextMenu.test.js.map +0 -1
  109. package/build/browser/object-table/hooks/__tests__/useColumnDefs.test.js +0 -520
  110. package/build/browser/object-table/hooks/__tests__/useColumnDefs.test.js.map +0 -1
  111. package/build/browser/object-table/hooks/__tests__/useColumnPinning.test.js +0 -266
  112. package/build/browser/object-table/hooks/__tests__/useColumnPinning.test.js.map +0 -1
  113. package/build/browser/object-table/hooks/__tests__/useColumnVisibility.test.js +0 -200
  114. package/build/browser/object-table/hooks/__tests__/useColumnVisibility.test.js.map +0 -1
  115. package/build/browser/object-table/hooks/__tests__/useObjectTableData.test.js +0 -315
  116. package/build/browser/object-table/hooks/__tests__/useObjectTableData.test.js.map +0 -1
  117. package/build/browser/object-table/hooks/__tests__/useRowSelection.test.js +0 -596
  118. package/build/browser/object-table/hooks/__tests__/useRowSelection.test.js.map +0 -1
  119. package/build/browser/object-table/hooks/__tests__/useSelectionColumn.test.js +0 -220
  120. package/build/browser/object-table/hooks/__tests__/useSelectionColumn.test.js.map +0 -1
  121. package/build/browser/object-table/hooks/__tests__/useTableSorting.test.js +0 -501
  122. package/build/browser/object-table/hooks/__tests__/useTableSorting.test.js.map +0 -1
  123. package/build/esm/filter-list/__tests__/LinkedPropertyInput.test.js +0 -202
  124. package/build/esm/filter-list/__tests__/LinkedPropertyInput.test.js.map +0 -1
  125. package/build/esm/filter-list/__tests__/dateUtils.test.js +0 -55
  126. package/build/esm/filter-list/__tests__/dateUtils.test.js.map +0 -1
  127. package/build/esm/filter-list/__tests__/filterStateToWhereClause.test.js +0 -296
  128. package/build/esm/filter-list/__tests__/filterStateToWhereClause.test.js.map +0 -1
  129. package/build/esm/filter-list/__tests__/getFilterKey.test.js +0 -53
  130. package/build/esm/filter-list/__tests__/getFilterKey.test.js.map +0 -1
  131. package/build/esm/filter-list/__tests__/testUtils.js +0 -203
  132. package/build/esm/filter-list/__tests__/testUtils.js.map +0 -1
  133. package/build/esm/filter-list/hooks/__tests__/useFilterListState.test.js +0 -128
  134. package/build/esm/filter-list/hooks/__tests__/useFilterListState.test.js.map +0 -1
  135. package/build/esm/object-table/__tests__/useEditableTable.test.js +0 -197
  136. package/build/esm/object-table/__tests__/useEditableTable.test.js.map +0 -1
  137. package/build/esm/object-table/hooks/__tests__/useCellContextMenu.test.js +0 -147
  138. package/build/esm/object-table/hooks/__tests__/useCellContextMenu.test.js.map +0 -1
  139. package/build/esm/object-table/hooks/__tests__/useColumnDefs.test.js +0 -520
  140. package/build/esm/object-table/hooks/__tests__/useColumnDefs.test.js.map +0 -1
  141. package/build/esm/object-table/hooks/__tests__/useColumnPinning.test.js +0 -266
  142. package/build/esm/object-table/hooks/__tests__/useColumnPinning.test.js.map +0 -1
  143. package/build/esm/object-table/hooks/__tests__/useColumnVisibility.test.js +0 -200
  144. package/build/esm/object-table/hooks/__tests__/useColumnVisibility.test.js.map +0 -1
  145. package/build/esm/object-table/hooks/__tests__/useObjectTableData.test.js +0 -315
  146. package/build/esm/object-table/hooks/__tests__/useObjectTableData.test.js.map +0 -1
  147. package/build/esm/object-table/hooks/__tests__/useRowSelection.test.js +0 -596
  148. package/build/esm/object-table/hooks/__tests__/useRowSelection.test.js.map +0 -1
  149. package/build/esm/object-table/hooks/__tests__/useSelectionColumn.test.js +0 -220
  150. package/build/esm/object-table/hooks/__tests__/useSelectionColumn.test.js.map +0 -1
  151. package/build/esm/object-table/hooks/__tests__/useTableSorting.test.js +0 -501
  152. package/build/esm/object-table/hooks/__tests__/useTableSorting.test.js.map +0 -1
  153. package/build/types/filter-list/__tests__/LinkedPropertyInput.test.d.ts +0 -1
  154. package/build/types/filter-list/__tests__/LinkedPropertyInput.test.d.ts.map +0 -1
  155. package/build/types/filter-list/__tests__/dateUtils.test.d.ts +0 -1
  156. package/build/types/filter-list/__tests__/dateUtils.test.d.ts.map +0 -1
  157. package/build/types/filter-list/__tests__/filterStateToWhereClause.test.d.ts +0 -1
  158. package/build/types/filter-list/__tests__/filterStateToWhereClause.test.d.ts.map +0 -1
  159. package/build/types/filter-list/__tests__/getFilterKey.test.d.ts +0 -1
  160. package/build/types/filter-list/__tests__/getFilterKey.test.d.ts.map +0 -1
  161. package/build/types/filter-list/__tests__/testUtils.d.ts +0 -65
  162. package/build/types/filter-list/__tests__/testUtils.d.ts.map +0 -1
  163. package/build/types/filter-list/hooks/__tests__/useFilterListState.test.d.ts +0 -1
  164. package/build/types/filter-list/hooks/__tests__/useFilterListState.test.d.ts.map +0 -1
  165. package/build/types/object-table/__tests__/useEditableTable.test.d.ts +0 -1
  166. package/build/types/object-table/__tests__/useEditableTable.test.d.ts.map +0 -1
  167. package/build/types/object-table/hooks/__tests__/useCellContextMenu.test.d.ts +0 -1
  168. package/build/types/object-table/hooks/__tests__/useCellContextMenu.test.d.ts.map +0 -1
  169. package/build/types/object-table/hooks/__tests__/useColumnDefs.test.d.ts +0 -1
  170. package/build/types/object-table/hooks/__tests__/useColumnDefs.test.d.ts.map +0 -1
  171. package/build/types/object-table/hooks/__tests__/useColumnPinning.test.d.ts +0 -1
  172. package/build/types/object-table/hooks/__tests__/useColumnPinning.test.d.ts.map +0 -1
  173. package/build/types/object-table/hooks/__tests__/useColumnVisibility.test.d.ts +0 -1
  174. package/build/types/object-table/hooks/__tests__/useColumnVisibility.test.d.ts.map +0 -1
  175. package/build/types/object-table/hooks/__tests__/useObjectTableData.test.d.ts +0 -1
  176. package/build/types/object-table/hooks/__tests__/useObjectTableData.test.d.ts.map +0 -1
  177. package/build/types/object-table/hooks/__tests__/useRowSelection.test.d.ts +0 -1
  178. package/build/types/object-table/hooks/__tests__/useRowSelection.test.d.ts.map +0 -1
  179. package/build/types/object-table/hooks/__tests__/useSelectionColumn.test.d.ts +0 -1
  180. package/build/types/object-table/hooks/__tests__/useSelectionColumn.test.d.ts.map +0 -1
  181. package/build/types/object-table/hooks/__tests__/useTableSorting.test.d.ts +0 -1
  182. package/build/types/object-table/hooks/__tests__/useTableSorting.test.d.ts.map +0 -1
@@ -26,7 +26,10 @@ export function TableBody({
26
26
  renderCellContextMenu,
27
27
  rowHeight = 40,
28
28
  isLoadingMore = false,
29
- headerGroups = []
29
+ headerGroups = [],
30
+ focusedRowId,
31
+ setFocusedRowId,
32
+ isInEditMode
30
33
  }) {
31
34
  // Important: Keep the row virtualizer in the lowest component possible to avoid unnecessary re-renders.
32
35
  const rowVirtualizer = useVirtualizer({
@@ -55,7 +58,10 @@ export function TableBody({
55
58
  row: row,
56
59
  virtualRow: virtualRow,
57
60
  onRowClick: onRowClick,
58
- renderCellContextMenu: renderCellContextMenu
61
+ renderCellContextMenu: renderCellContextMenu,
62
+ focusedRowId: focusedRowId,
63
+ setFocusedRowId: setFocusedRowId,
64
+ isInEditMode: isInEditMode
59
65
  });
60
66
  }), isLoadingMore && /*#__PURE__*/React.createElement(LoadingRow, {
61
67
  headers: headers,
@@ -1 +1 @@
1
- {"version":3,"file":"TableBody.js","names":["useVirtualizer","React","useLayoutEffect","LoadingRow","styles","TableRow","TableBody","rows","tableContainerRef","onRowClick","renderCellContextMenu","rowHeight","isLoadingMore","headerGroups","rowVirtualizer","count","length","estimateSize","getScrollElement","current","overscan","measure","totalSize","getTotalSize","bodyHeight","headers","createElement","className","osdkTableBody","style","height","getVirtualItems","map","virtualRow","row","index","key","id","translateY","columnCount"],"sources":["TableBody.tsx"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Cell, HeaderGroup, Row, RowData } from \"@tanstack/react-table\";\nimport { useVirtualizer } from \"@tanstack/react-virtual\";\nimport React, { useLayoutEffect } from \"react\";\nimport { LoadingRow } from \"./LoadingRow.js\";\nimport styles from \"./TableBody.module.css\";\nimport { TableRow } from \"./TableRow.js\";\n\ninterface TableBodyProps<TData extends RowData> {\n rows: Array<Row<TData>>;\n tableContainerRef: React.RefObject<HTMLDivElement>;\n onRowClick?: (row: TData) => void;\n rowHeight?: number;\n renderCellContextMenu?: (\n row: TData,\n cell: Cell<TData, unknown>,\n ) => React.ReactNode;\n isLoadingMore?: boolean;\n headerGroups?: Array<HeaderGroup<TData>>;\n}\n\nexport function TableBody<TData extends RowData>({\n rows,\n tableContainerRef,\n onRowClick,\n renderCellContextMenu,\n rowHeight = 40,\n isLoadingMore = false,\n headerGroups = [],\n}: TableBodyProps<TData>): React.ReactElement {\n // Important: Keep the row virtualizer in the lowest component possible to avoid unnecessary re-renders.\n const rowVirtualizer = useVirtualizer<HTMLDivElement, HTMLTableRowElement>({\n count: rows.length,\n estimateSize: () => rowHeight,\n getScrollElement: () => tableContainerRef.current,\n overscan: 5,\n });\n\n // Measure the virtualizer after the DOM has been laid out to ensure proper dimensions\n useLayoutEffect(() => {\n rowVirtualizer.measure();\n }, [rowVirtualizer, rows.length]);\n\n const totalSize = rowVirtualizer.getTotalSize();\n const bodyHeight = isLoadingMore\n ? totalSize + rowHeight\n : totalSize;\n\n const headers = headerGroups[0]?.headers ?? [];\n\n return (\n <tbody\n className={styles.osdkTableBody}\n style={{\n height: `${bodyHeight}px`,\n }}\n >\n {rowVirtualizer.getVirtualItems().map((virtualRow) => {\n const row = rows[virtualRow.index];\n\n return (\n <TableRow\n key={row.id}\n row={row}\n virtualRow={virtualRow}\n onRowClick={onRowClick}\n renderCellContextMenu={renderCellContextMenu}\n />\n );\n })}\n {isLoadingMore && (\n <LoadingRow\n headers={headers}\n translateY={totalSize}\n rowHeight={rowHeight}\n columnCount={headers.length}\n />\n )}\n </tbody>\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,cAAc,QAAQ,yBAAyB;AACxD,OAAOC,KAAK,IAAIC,eAAe,QAAQ,OAAO;AAC9C,SAASC,UAAU,QAAQ,iBAAiB;AAC5C,OAAOC,MAAM,MAAM,wBAAwB;AAC3C,SAASC,QAAQ,QAAQ,eAAe;AAexC,OAAO,SAASC,SAASA,CAAwB;EAC/CC,IAAI;EACJC,iBAAiB;EACjBC,UAAU;EACVC,qBAAqB;EACrBC,SAAS,GAAG,EAAE;EACdC,aAAa,GAAG,KAAK;EACrBC,YAAY,GAAG;AACM,CAAC,EAAsB;EAC5C;EACA,MAAMC,cAAc,GAAGd,cAAc,CAAsC;IACzEe,KAAK,EAAER,IAAI,CAACS,MAAM;IAClBC,YAAY,EAAEA,CAAA,KAAMN,SAAS;IAC7BO,gBAAgB,EAAEA,CAAA,KAAMV,iBAAiB,CAACW,OAAO;IACjDC,QAAQ,EAAE;EACZ,CAAC,CAAC;;EAEF;EACAlB,eAAe,CAAC,MAAM;IACpBY,cAAc,CAACO,OAAO,CAAC,CAAC;EAC1B,CAAC,EAAE,CAACP,cAAc,EAAEP,IAAI,CAACS,MAAM,CAAC,CAAC;EAEjC,MAAMM,SAAS,GAAGR,cAAc,CAACS,YAAY,CAAC,CAAC;EAC/C,MAAMC,UAAU,GAAGZ,aAAa,GAC5BU,SAAS,GAAGX,SAAS,GACrBW,SAAS;EAEb,MAAMG,OAAO,GAAGZ,YAAY,CAAC,CAAC,CAAC,EAAEY,OAAO,IAAI,EAAE;EAE9C,oBACExB,KAAA,CAAAyB,aAAA;IACEC,SAAS,EAAEvB,MAAM,CAACwB,aAAc;IAChCC,KAAK,EAAE;MACLC,MAAM,EAAE,GAAGN,UAAU;IACvB;EAAE,GAEDV,cAAc,CAACiB,eAAe,CAAC,CAAC,CAACC,GAAG,CAAEC,UAAU,IAAK;IACpD,MAAMC,GAAG,GAAG3B,IAAI,CAAC0B,UAAU,CAACE,KAAK,CAAC;IAElC,oBACElC,KAAA,CAAAyB,aAAA,CAACrB,QAAQ;MACP+B,GAAG,EAAEF,GAAG,CAACG,EAAG;MACZH,GAAG,EAAEA,GAAI;MACTD,UAAU,EAAEA,UAAW;MACvBxB,UAAU,EAAEA,UAAW;MACvBC,qBAAqB,EAAEA;IAAsB,CAC9C,CAAC;EAEN,CAAC,CAAC,EACDE,aAAa,iBACZX,KAAA,CAAAyB,aAAA,CAACvB,UAAU;IACTsB,OAAO,EAAEA,OAAQ;IACjBa,UAAU,EAAEhB,SAAU;IACtBX,SAAS,EAAEA,SAAU;IACrB4B,WAAW,EAAEd,OAAO,CAACT;EAAO,CAC7B,CAEE,CAAC;AAEZ","ignoreList":[]}
1
+ {"version":3,"file":"TableBody.js","names":["useVirtualizer","React","useLayoutEffect","LoadingRow","styles","TableRow","TableBody","rows","tableContainerRef","onRowClick","renderCellContextMenu","rowHeight","isLoadingMore","headerGroups","focusedRowId","setFocusedRowId","isInEditMode","rowVirtualizer","count","length","estimateSize","getScrollElement","current","overscan","measure","totalSize","getTotalSize","bodyHeight","headers","createElement","className","osdkTableBody","style","height","getVirtualItems","map","virtualRow","row","index","key","id","translateY","columnCount"],"sources":["TableBody.tsx"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Cell, HeaderGroup, Row, RowData } from \"@tanstack/react-table\";\nimport { useVirtualizer } from \"@tanstack/react-virtual\";\nimport React, { useLayoutEffect } from \"react\";\nimport { LoadingRow } from \"./LoadingRow.js\";\nimport styles from \"./TableBody.module.css\";\nimport { TableRow } from \"./TableRow.js\";\n\ninterface TableBodyProps<TData extends RowData> {\n rows: Array<Row<TData>>;\n tableContainerRef: React.RefObject<HTMLDivElement>;\n onRowClick?: (row: TData) => void;\n rowHeight?: number;\n renderCellContextMenu?: (\n row: TData,\n cell: Cell<TData, unknown>,\n ) => React.ReactNode;\n isLoadingMore?: boolean;\n headerGroups?: Array<HeaderGroup<TData>>;\n focusedRowId?: string | null;\n setFocusedRowId?: (rowId: string | null) => void;\n isInEditMode?: boolean;\n}\n\nexport function TableBody<TData extends RowData>({\n rows,\n tableContainerRef,\n onRowClick,\n renderCellContextMenu,\n rowHeight = 40,\n isLoadingMore = false,\n headerGroups = [],\n focusedRowId,\n setFocusedRowId,\n isInEditMode,\n}: TableBodyProps<TData>): React.ReactElement {\n // Important: Keep the row virtualizer in the lowest component possible to avoid unnecessary re-renders.\n const rowVirtualizer = useVirtualizer<HTMLDivElement, HTMLTableRowElement>({\n count: rows.length,\n estimateSize: () => rowHeight,\n getScrollElement: () => tableContainerRef.current,\n overscan: 5,\n });\n\n // Measure the virtualizer after the DOM has been laid out to ensure proper dimensions\n useLayoutEffect(() => {\n rowVirtualizer.measure();\n }, [rowVirtualizer, rows.length]);\n\n const totalSize = rowVirtualizer.getTotalSize();\n const bodyHeight = isLoadingMore\n ? totalSize + rowHeight\n : totalSize;\n\n const headers = headerGroups[0]?.headers ?? [];\n\n return (\n <tbody\n className={styles.osdkTableBody}\n style={{\n height: `${bodyHeight}px`,\n }}\n >\n {rowVirtualizer.getVirtualItems().map((virtualRow) => {\n const row = rows[virtualRow.index];\n\n return (\n <TableRow\n key={row.id}\n row={row}\n virtualRow={virtualRow}\n onRowClick={onRowClick}\n renderCellContextMenu={renderCellContextMenu}\n focusedRowId={focusedRowId}\n setFocusedRowId={setFocusedRowId}\n isInEditMode={isInEditMode}\n />\n );\n })}\n {isLoadingMore && (\n <LoadingRow\n headers={headers}\n translateY={totalSize}\n rowHeight={rowHeight}\n columnCount={headers.length}\n />\n )}\n </tbody>\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,cAAc,QAAQ,yBAAyB;AACxD,OAAOC,KAAK,IAAIC,eAAe,QAAQ,OAAO;AAC9C,SAASC,UAAU,QAAQ,iBAAiB;AAC5C,OAAOC,MAAM,MAAM,wBAAwB;AAC3C,SAASC,QAAQ,QAAQ,eAAe;AAkBxC,OAAO,SAASC,SAASA,CAAwB;EAC/CC,IAAI;EACJC,iBAAiB;EACjBC,UAAU;EACVC,qBAAqB;EACrBC,SAAS,GAAG,EAAE;EACdC,aAAa,GAAG,KAAK;EACrBC,YAAY,GAAG,EAAE;EACjBC,YAAY;EACZC,eAAe;EACfC;AACqB,CAAC,EAAsB;EAC5C;EACA,MAAMC,cAAc,GAAGjB,cAAc,CAAsC;IACzEkB,KAAK,EAAEX,IAAI,CAACY,MAAM;IAClBC,YAAY,EAAEA,CAAA,KAAMT,SAAS;IAC7BU,gBAAgB,EAAEA,CAAA,KAAMb,iBAAiB,CAACc,OAAO;IACjDC,QAAQ,EAAE;EACZ,CAAC,CAAC;;EAEF;EACArB,eAAe,CAAC,MAAM;IACpBe,cAAc,CAACO,OAAO,CAAC,CAAC;EAC1B,CAAC,EAAE,CAACP,cAAc,EAAEV,IAAI,CAACY,MAAM,CAAC,CAAC;EAEjC,MAAMM,SAAS,GAAGR,cAAc,CAACS,YAAY,CAAC,CAAC;EAC/C,MAAMC,UAAU,GAAGf,aAAa,GAC5Ba,SAAS,GAAGd,SAAS,GACrBc,SAAS;EAEb,MAAMG,OAAO,GAAGf,YAAY,CAAC,CAAC,CAAC,EAAEe,OAAO,IAAI,EAAE;EAE9C,oBACE3B,KAAA,CAAA4B,aAAA;IACEC,SAAS,EAAE1B,MAAM,CAAC2B,aAAc;IAChCC,KAAK,EAAE;MACLC,MAAM,EAAE,GAAGN,UAAU;IACvB;EAAE,GAEDV,cAAc,CAACiB,eAAe,CAAC,CAAC,CAACC,GAAG,CAAEC,UAAU,IAAK;IACpD,MAAMC,GAAG,GAAG9B,IAAI,CAAC6B,UAAU,CAACE,KAAK,CAAC;IAElC,oBACErC,KAAA,CAAA4B,aAAA,CAACxB,QAAQ;MACPkC,GAAG,EAAEF,GAAG,CAACG,EAAG;MACZH,GAAG,EAAEA,GAAI;MACTD,UAAU,EAAEA,UAAW;MACvB3B,UAAU,EAAEA,UAAW;MACvBC,qBAAqB,EAAEA,qBAAsB;MAC7CI,YAAY,EAAEA,YAAa;MAC3BC,eAAe,EAAEA,eAAgB;MACjCC,YAAY,EAAEA;IAAa,CAC5B,CAAC;EAEN,CAAC,CAAC,EACDJ,aAAa,iBACZX,KAAA,CAAA4B,aAAA,CAAC1B,UAAU;IACTyB,OAAO,EAAEA,OAAQ;IACjBa,UAAU,EAAEhB,SAAU;IACtBd,SAAS,EAAEA,SAAU;IACrB+B,WAAW,EAAEd,OAAO,CAACT;EAAO,CAC7B,CAEE,CAAC;AAEZ","ignoreList":[]}
@@ -59,14 +59,6 @@
59
59
  padding: 0;
60
60
  }
61
61
 
62
- /* Show focus state for editable cells */
63
- .osdkTableCell:not(:has([role="checkbox"])):has(input):focus-within {
64
- border: var(--osdk-emphasis-focus-width) solid
65
- var(--osdk-emphasis-focus-color);
66
- border-radius: var(--osdk-surface-border-radius);
67
- background-color: var(--osdk-table-cell-editable-bg);
68
- }
69
-
70
62
  .osdkTableCellContent:not(:has([role="checkbox"])) {
71
63
  overflow: hidden;
72
64
  text-overflow: ellipsis;
@@ -0,0 +1,79 @@
1
+ /*
2
+ * Copyright 2026 Palantir Technologies, Inc. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import React, { useCallback, useState } from "react";
18
+ import { ActionButton } from "../base-components/action-button/ActionButton.js";
19
+ import styles from "./TableEditContainer.module.css";
20
+ export function TableEditContainer({
21
+ editableConfig,
22
+ focusedRowId
23
+ }) {
24
+ const {
25
+ cellEdits,
26
+ onSubmitEdits,
27
+ clearEdits,
28
+ editMode
29
+ } = editableConfig ?? {};
30
+ const hasEdits = Object.keys(cellEdits ?? {}).length > 0;
31
+ const [isSubmitting, setIsSubmitting] = useState(false);
32
+ const isInEditMode = editMode?.isActive;
33
+ const canToggleEditMode = editMode?.type === "manual";
34
+ const handleSubmitEdits = useCallback(async () => {
35
+ setIsSubmitting(true);
36
+ try {
37
+ const success = await onSubmitEdits?.();
38
+ if (success) {
39
+ clearEdits?.();
40
+ if (editMode?.type === "manual") {
41
+ editMode.setActive(false);
42
+ }
43
+ }
44
+ } finally {
45
+ setIsSubmitting(false);
46
+ }
47
+ }, [editMode, onSubmitEdits, clearEdits]);
48
+ const handleCancelEdits = useCallback(() => {
49
+ clearEdits?.();
50
+ if (editMode?.type === "manual") {
51
+ editMode.setActive(false);
52
+ }
53
+ }, [clearEdits, editMode]);
54
+ const handleEnterEditMode = useCallback(() => {
55
+ if (editMode?.type === "manual") {
56
+ editMode.setActive(true);
57
+ }
58
+ }, [editMode]);
59
+ return /*#__PURE__*/React.createElement("div", {
60
+ className: styles.tableEditContainer
61
+ }, hasEdits ? /*#__PURE__*/React.createElement("div", {
62
+ className: styles.modificationCount
63
+ }, `${cellEdits ? Object.keys(cellEdits).length : 0} modifications`) : isInEditMode && !focusedRowId && /*#__PURE__*/React.createElement("div", {
64
+ className: styles.placeholder
65
+ }, "Select a row to edit data\u2026"), /*#__PURE__*/React.createElement("div", {
66
+ className: styles.editButtons
67
+ }, !isInEditMode && canToggleEditMode && /*#__PURE__*/React.createElement(ActionButton, {
68
+ variant: "primary",
69
+ onClick: handleEnterEditMode
70
+ }, "Edit Table"), isInEditMode && canToggleEditMode && /*#__PURE__*/React.createElement(ActionButton, {
71
+ variant: "secondary",
72
+ onClick: handleCancelEdits
73
+ }, "Cancel"), isInEditMode && !!onSubmitEdits && /*#__PURE__*/React.createElement(ActionButton, {
74
+ variant: "primary",
75
+ onClick: handleSubmitEdits,
76
+ disabled: !hasEdits || isSubmitting
77
+ }, "Submit Edits")));
78
+ }
79
+ //# sourceMappingURL=TableEditContainer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TableEditContainer.js","names":["React","useCallback","useState","ActionButton","styles","TableEditContainer","editableConfig","focusedRowId","cellEdits","onSubmitEdits","clearEdits","editMode","hasEdits","Object","keys","length","isSubmitting","setIsSubmitting","isInEditMode","isActive","canToggleEditMode","type","handleSubmitEdits","success","setActive","handleCancelEdits","handleEnterEditMode","createElement","className","tableEditContainer","modificationCount","placeholder","editButtons","variant","onClick","disabled"],"sources":["TableEditContainer.tsx"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { RowData } from \"@tanstack/react-table\";\nimport React, { type ReactElement, useCallback, useState } from \"react\";\nimport { ActionButton } from \"../base-components/action-button/ActionButton.js\";\nimport styles from \"./TableEditContainer.module.css\";\nimport type { EditableConfig } from \"./utils/types.js\";\n\ninterface TableEditContainerProps<\n TData extends RowData,\n> {\n editableConfig?: EditableConfig<TData, unknown>;\n focusedRowId?: string | null;\n}\n\nexport function TableEditContainer<\n TData extends RowData,\n>({\n editableConfig,\n focusedRowId,\n}: TableEditContainerProps<TData>): ReactElement {\n const {\n cellEdits,\n onSubmitEdits,\n clearEdits,\n editMode,\n } = editableConfig ?? {};\n\n const hasEdits = Object.keys(cellEdits ?? {}).length > 0;\n const [isSubmitting, setIsSubmitting] = useState(false);\n\n const isInEditMode = editMode?.isActive;\n const canToggleEditMode = editMode?.type === \"manual\";\n\n const handleSubmitEdits = useCallback(async () => {\n setIsSubmitting(true);\n try {\n const success = await onSubmitEdits?.();\n if (success) {\n clearEdits?.();\n if (editMode?.type === \"manual\") {\n editMode.setActive(false);\n }\n }\n } finally {\n setIsSubmitting(false);\n }\n }, [editMode, onSubmitEdits, clearEdits]);\n\n const handleCancelEdits = useCallback(() => {\n clearEdits?.();\n if (editMode?.type === \"manual\") {\n editMode.setActive(false);\n }\n }, [clearEdits, editMode]);\n\n const handleEnterEditMode = useCallback(() => {\n if (editMode?.type === \"manual\") {\n editMode.setActive(true);\n }\n }, [editMode]);\n\n return (\n <div className={styles.tableEditContainer}>\n {hasEdits\n ? (\n <div className={styles.modificationCount}>\n {`${cellEdits ? Object.keys(cellEdits).length : 0} modifications`}\n </div>\n )\n : (isInEditMode && !focusedRowId && (\n <div className={styles.placeholder}>\n Select a row to edit data…\n </div>\n ))}\n <div className={styles.editButtons}>\n {!isInEditMode && canToggleEditMode && (\n <ActionButton\n variant=\"primary\"\n onClick={handleEnterEditMode}\n >\n Edit Table\n </ActionButton>\n )}\n {isInEditMode && canToggleEditMode && (\n <ActionButton\n variant=\"secondary\"\n onClick={handleCancelEdits}\n >\n Cancel\n </ActionButton>\n )}\n {isInEditMode && !!onSubmitEdits && (\n <ActionButton\n variant=\"primary\"\n onClick={handleSubmitEdits}\n disabled={!hasEdits || isSubmitting}\n >\n Submit Edits\n </ActionButton>\n )}\n </div>\n </div>\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,OAAOA,KAAK,IAAuBC,WAAW,EAAEC,QAAQ,QAAQ,OAAO;AACvE,SAASC,YAAY,QAAQ,kDAAkD;AAC/E,OAAOC,MAAM,MAAM,iCAAiC;AAUpD,OAAO,SAASC,kBAAkBA,CAEhC;EACAC,cAAc;EACdC;AAC8B,CAAC,EAAgB;EAC/C,MAAM;IACJC,SAAS;IACTC,aAAa;IACbC,UAAU;IACVC;EACF,CAAC,GAAGL,cAAc,IAAI,CAAC,CAAC;EAExB,MAAMM,QAAQ,GAAGC,MAAM,CAACC,IAAI,CAACN,SAAS,IAAI,CAAC,CAAC,CAAC,CAACO,MAAM,GAAG,CAAC;EACxD,MAAM,CAACC,YAAY,EAAEC,eAAe,CAAC,GAAGf,QAAQ,CAAC,KAAK,CAAC;EAEvD,MAAMgB,YAAY,GAAGP,QAAQ,EAAEQ,QAAQ;EACvC,MAAMC,iBAAiB,GAAGT,QAAQ,EAAEU,IAAI,KAAK,QAAQ;EAErD,MAAMC,iBAAiB,GAAGrB,WAAW,CAAC,YAAY;IAChDgB,eAAe,CAAC,IAAI,CAAC;IACrB,IAAI;MACF,MAAMM,OAAO,GAAG,MAAMd,aAAa,GAAG,CAAC;MACvC,IAAIc,OAAO,EAAE;QACXb,UAAU,GAAG,CAAC;QACd,IAAIC,QAAQ,EAAEU,IAAI,KAAK,QAAQ,EAAE;UAC/BV,QAAQ,CAACa,SAAS,CAAC,KAAK,CAAC;QAC3B;MACF;IACF,CAAC,SAAS;MACRP,eAAe,CAAC,KAAK,CAAC;IACxB;E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QAEa,CACf,EACAP,YAAY,IAAI,CAAC,CAACT,aAAa,iBAC9BT,KAAA,CAAA2B,aAAA,CAACxB,YAAY;IACX8B,OAAO,EAAC,SAAS;IACjBC,OAAO,EAAEZ,iBAAkB;IAC3Ba,QAAQ,EAAE,CAACvB,QAAQ,IAAII;EAAa,GACrC,cAEa,CAEb,CACF,CAAC;AAEV","ignoreList":[]}
@@ -0,0 +1,44 @@
1
+ /*
2
+ * Copyright 2025 Palantir Technologies, Inc. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ .tableEditContainer {
18
+ display: flex;
19
+ justify-content: space-between;
20
+ align-items: center;
21
+ background-color: var(--osdk-surface-background-color-default-rest);
22
+ border-top: var(--osdk-table-border);
23
+ padding: var(--osdk-table-edit-container-padding);
24
+ min-height: var(--osdk-table-edit-container-min-height);
25
+ }
26
+
27
+ .placeholder {
28
+ color: var(--osdk-typography-color-muted);
29
+ font-size: var(--osdk-typography-size-body-small);
30
+ padding: calc(var(--osdk-surface-spacing) * 2) 0;
31
+ }
32
+
33
+ .modificationCount {
34
+ color: var(--osdk-intent-primary-rest);
35
+ font-size: var(--osdk-typography-size-body-small);
36
+ padding: calc(var(--osdk-surface-spacing) * 2) 0;
37
+ }
38
+
39
+ .editButtons {
40
+ display: flex;
41
+ justify-content: flex-end;
42
+ gap: 8px;
43
+ flex: 1;
44
+ }
@@ -17,17 +17,24 @@
17
17
  import React, { useCallback } from "react";
18
18
  import { TableCell } from "./TableCell.js";
19
19
  import styles from "./TableRow.module.css";
20
- export function TableRow({
20
+ function TableRowInner({
21
21
  row,
22
22
  virtualRow,
23
23
  onRowClick,
24
- renderCellContextMenu
24
+ renderCellContextMenu,
25
+ focusedRowId,
26
+ setFocusedRowId,
27
+ isInEditMode
25
28
  }) {
26
29
  const handleClick = useCallback(() => {
27
- onRowClick?.(row.original);
28
- }, [onRowClick, row.original]);
30
+ setFocusedRowId?.(row.id);
31
+ if (!isInEditMode) {
32
+ onRowClick?.(row.original);
33
+ }
34
+ }, [isInEditMode, onRowClick, row.original, row.id, setFocusedRowId]);
29
35
  return /*#__PURE__*/React.createElement("tr", {
30
36
  "data-selected": row.getIsSelected(),
37
+ "data-focused": focusedRowId === row.id,
31
38
  className: styles.osdkTableRow,
32
39
  style: {
33
40
  height: `${virtualRow.size}px`,
@@ -40,4 +47,5 @@ export function TableRow({
40
47
  renderCellContextMenu: renderCellContextMenu
41
48
  })));
42
49
  }
50
+ export const TableRow = /*#__PURE__*/React.memo(TableRowInner);
43
51
  //# sourceMappingURL=TableRow.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TableRow.js","names":["React","useCallback","TableCell","styles","TableRow","row","virtualRow","onRowClick","renderCellContextMenu","handleClick","original","createElement","getIsSelected","className","osdkTableRow","style","height","size","transform","start","onClick","getVisibleCells","map","cell","key","id"],"sources":["TableRow.tsx"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Cell, Row, RowData } from \"@tanstack/react-table\";\nimport type { VirtualItem } from \"@tanstack/react-virtual\";\nimport React, { useCallback } from \"react\";\nimport { TableCell } from \"./TableCell.js\";\nimport styles from \"./TableRow.module.css\";\n\ninterface TableRowProps<TData extends RowData> {\n row: Row<TData>;\n virtualRow: VirtualItem;\n onRowClick?: (row: TData) => void;\n renderCellContextMenu?: (\n row: TData,\n cell: Cell<TData, unknown>,\n ) => React.ReactNode;\n}\n\nexport function TableRow<TData extends RowData>({\n row,\n virtualRow,\n onRowClick,\n renderCellContextMenu,\n}: TableRowProps<TData>): React.ReactElement {\n const handleClick = useCallback(() => {\n onRowClick?.(row.original);\n }, [onRowClick, row.original]);\n\n return (\n <tr\n data-selected={row.getIsSelected()}\n className={styles.osdkTableRow}\n style={{\n height: `${virtualRow.size}px`,\n transform: `translateY(${virtualRow.start}px)`,\n }}\n onClick={handleClick}\n >\n {row.getVisibleCells().map((cell) => (\n <TableCell\n key={cell.id}\n cell={cell}\n renderCellContextMenu={renderCellContextMenu}\n />\n ))}\n </tr>\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,OAAOA,KAAK,IAAIC,WAAW,QAAQ,OAAO;AAC1C,SAASC,SAAS,QAAQ,gBAAgB;AAC1C,OAAOC,MAAM,MAAM,uBAAuB;AAY1C,OAAO,SAASC,QAAQA,CAAwB;EAC9CC,GAAG;EACHC,UAAU;EACVC,UAAU;EACVC;AACoB,CAAC,EAAsB;EAC3C,MAAMC,WAAW,GAAGR,WAAW,CAAC,MAAM;IACpCM,UAAU,GAAGF,GAAG,CAACK,QAAQ,CAAC;EAC5B,CAAC,EAAE,CAACH,UAAU,EAAEF,GAAG,CAACK,QAAQ,CAAC,CAAC;EAE9B,oBACEV,KAAA,CAAAW,aAAA;IACE,iBAAeN,GAAG,CAACO,aAAa,CAAC,CAAE;IACnCC,SAAS,EAAEV,MAAM,CAACW,YAAa;IAC/BC,KAAK,EAAE;MACLC,MAAM,EAAE,GAAGV,UAAU,CAACW,IAAI,IAAI;MAC9BC,SAAS,EAAE,cAAcZ,UAAU,CAACa,KAAK;IAC3C,CAAE;IACFC,OAAO,EAAEX;EAAY,GAEpBJ,GAAG,CAACgB,eAAe,CAAC,CAAC,CAACC,GAAG,CAAEC,IAAI,iBAC9BvB,KAAA,CAAAW,aAAA,CAACT,SAAS;IACRsB,GAAG,EAAED,IAAI,CAACE,EAAG;IACbF,IAAI,EAAEA,IAAK;IACXf,qBAAqB,EAAEA;EAAsB,CAC9C,CACF,CACC,CAAC;AAET","ignoreList":[]}
1
+ {"version":3,"file":"TableRow.js","names":["React","useCallback","TableCell","styles","TableRowInner","row","virtualRow","onRowClick","renderCellContextMenu","focusedRowId","setFocusedRowId","isInEditMode","handleClick","id","original","createElement","getIsSelected","className","osdkTableRow","style","height","size","transform","start","onClick","getVisibleCells","map","cell","key","TableRow","memo"],"sources":["TableRow.tsx"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Cell, Row, RowData } from \"@tanstack/react-table\";\nimport type { VirtualItem } from \"@tanstack/react-virtual\";\nimport React, { useCallback } from \"react\";\nimport { TableCell } from \"./TableCell.js\";\nimport styles from \"./TableRow.module.css\";\n\ninterface TableRowProps<TData extends RowData> {\n row: Row<TData>;\n virtualRow: VirtualItem;\n onRowClick?: (row: TData) => void;\n renderCellContextMenu?: (\n row: TData,\n cell: Cell<TData, unknown>,\n ) => React.ReactNode;\n focusedRowId?: string | null;\n setFocusedRowId?: (rowId: string | null) => void;\n isInEditMode?: boolean;\n}\n\nfunction TableRowInner<TData extends RowData>({\n row,\n virtualRow,\n onRowClick,\n renderCellContextMenu,\n focusedRowId,\n setFocusedRowId,\n isInEditMode,\n}: TableRowProps<TData>): React.ReactElement {\n const handleClick = useCallback(() => {\n setFocusedRowId?.(row.id);\n\n if (!isInEditMode) {\n onRowClick?.(row.original);\n }\n }, [isInEditMode, onRowClick, row.original, row.id, setFocusedRowId]);\n\n return (\n <tr\n data-selected={row.getIsSelected()}\n data-focused={focusedRowId === row.id}\n className={styles.osdkTableRow}\n style={{\n height: `${virtualRow.size}px`,\n transform: `translateY(${virtualRow.start}px)`,\n }}\n onClick={handleClick}\n >\n {row.getVisibleCells().map((cell) => (\n <TableCell\n key={cell.id}\n cell={cell}\n renderCellContextMenu={renderCellContextMenu}\n />\n ))}\n </tr>\n );\n}\n\nexport const TableRow = React.memo(\n TableRowInner,\n) as typeof TableRowInner;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,OAAOA,KAAK,IAAIC,WAAW,QAAQ,OAAO;AAC1C,SAASC,SAAS,QAAQ,gBAAgB;AAC1C,OAAOC,MAAM,MAAM,uBAAuB;AAe1C,SAASC,aAAaA,CAAwB;EAC5CC,GAAG;EACHC,UAAU;EACVC,UAAU;EACVC,qBAAqB;EACrBC,YAAY;EACZC,eAAe;EACfC;AACoB,CAAC,EAAsB;EAC3C,MAAMC,WAAW,GAAGX,WAAW,CAAC,MAAM;IACpCS,eAAe,GAAGL,GAAG,CAACQ,EAAE,CAAC;IAEzB,IAAI,CAACF,YAAY,EAAE;MACjBJ,UAAU,GAAGF,GAAG,CAACS,QAAQ,CAAC;IAC5B;EACF,CAAC,EAAE,CAACH,YAAY,EAAEJ,UAAU,EAAEF,GAAG,CAACS,QAAQ,EAAET,GAAG,CAACQ,EAAE,EAAEH,eAAe,CAAC,CAAC;EAErE,oBACEV,KAAA,CAAAe,aAAA;IACE,iBAAeV,GAAG,CAACW,aAAa,CAAC,CAAE;IACnC,gBAAcP,YAAY,KAAKJ,GAAG,CAACQ,EAAG;IACtCI,SAAS,EAAEd,MAAM,CAACe,YAAa;IAC/BC,KAAK,EAAE;MACLC,MAAM,EAAE,GAAGd,UAAU,CAACe,IAAI,IAAI;MAC9BC,SAAS,EAAE,cAAchB,UAAU,CAACiB,KAAK;IAC3C,CAAE;IACFC,OAAO,EAAEZ;EAAY,GAEpBP,GAAG,CAACoB,eAAe,CAAC,CAAC,CAACC,GAAG,CAAEC,IAAI,iBAC9B3B,KAAA,CAAAe,aAAA,CAACb,SAAS;IACR0B,GAAG,EAAED,IAAI,CAACd,EAAG;IACbc,IAAI,EAAEA,IAAK;IACXnB,qBAAqB,EAAEA;EAAsB,CAC9C,CACF,CACC,CAAC;AAET;AAEA,OAAO,MAAMqB,QAAQ,gBAAG7B,KAAK,CAAC8B,IAAI,CAChC1B,aACF,CAAyB","ignoreList":[]}
@@ -45,7 +45,8 @@
45
45
  border-bottom-color: var(--osdk-table-row-border-color-hover);
46
46
  }
47
47
 
48
- &[data-selected="true"] {
48
+ &[data-selected="true"],
49
+ &[data-focused="true"] {
49
50
  z-index: 2;
50
51
  background-color: var(--osdk-table-row-bg-active);
51
52
  border-top-color: var(--osdk-table-row-border-color-active);
@@ -15,17 +15,16 @@
15
15
  */
16
16
 
17
17
  import { useCallback, useState } from "react";
18
- import { getCellIdentifier } from "../utils/getCellId.js";
19
18
  export function useEditableTable({
19
+ editMode = "manual",
20
20
  onCellValueChanged,
21
21
  onSubmitEdits
22
22
  }) {
23
+ const [isActive, setActive] = useState(editMode === "always");
23
24
  const [cellEdits, setCellEdits] = useState({});
24
- const handleCellEdit = useCallback((cellId, state) => {
25
- const cellIdentifier = getCellIdentifier(cellId);
26
-
25
+ const handleCellEdit = useCallback((cellId, info) => {
27
26
  // If value is changed back to original, remove it from edits
28
- if (state.newValue === state.oldValue) {
27
+ if (info.newValue === info.oldValue) {
29
28
  setCellEdits(prev => {
30
29
  const {
31
30
  [cellId]: _,
@@ -36,22 +35,32 @@ export function useEditableTable({
36
35
  } else {
37
36
  setCellEdits(prev => ({
38
37
  ...prev,
39
- [cellId]: state
38
+ [cellId]: info
40
39
  }));
41
40
  }
42
- onCellValueChanged?.(cellIdentifier, state);
41
+ onCellValueChanged?.(info);
43
42
  }, [onCellValueChanged]);
44
43
  const clearEdits = useCallback(() => {
45
44
  setCellEdits({});
46
45
  }, []);
47
46
  const handleSubmitEdits = useCallback(async () => {
48
- await onSubmitEdits?.(cellEdits);
47
+ const edits = Object.values(cellEdits);
48
+ return onSubmitEdits ? onSubmitEdits(edits) : false;
49
49
  }, [cellEdits, onSubmitEdits]);
50
+ const editModeConfig = editMode === "always" ? {
51
+ type: "always",
52
+ isActive: true
53
+ } : {
54
+ type: "manual",
55
+ isActive,
56
+ setActive
57
+ };
50
58
  return {
51
59
  cellEdits,
52
- handleCellEdit,
53
- handleSubmitEdits,
54
- clearEdits
60
+ onCellEdit: handleCellEdit,
61
+ onSubmitEdits: onSubmitEdits ? handleSubmitEdits : undefined,
62
+ clearEdits,
63
+ editMode: editModeConfig
55
64
  };
56
65
  }
57
66
  //# sourceMappingURL=useEditableTable.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useEditableTable.js","names":["useCallback","useState","getCellIdentifier","useEditableTable","onCellValueChanged","onSubmitEdits","cellEdits","setCellEdits","handleCellEdit","cellId","state","cellIdentifier","newValue","oldValue","prev","_","rest","clearEdits","handleSubmitEdits"],"sources":["useEditableTable.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ObjectOrInterfaceDefinition,\n QueryDefinition,\n SimplePropertyDef,\n} from \"@osdk/api\";\nimport { useCallback, useState } from \"react\";\nimport type { ObjectTableProps } from \"../ObjectTableApi.js\";\nimport { getCellIdentifier } from \"../utils/getCellId.js\";\nimport type { CellValueState } from \"../utils/types.js\";\n\nexport interface UseEditableTableProps<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<\n string,\n never\n >,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n> {\n onCellValueChanged?: ObjectTableProps<\n Q,\n RDPs,\n FunctionColumns\n >[\"onCellValueChanged\"];\n\n onSubmitEdits?: ObjectTableProps<\n Q,\n RDPs,\n FunctionColumns\n >[\"onSubmitEdits\"];\n}\n\nexport interface UseEditableTableResult {\n cellEdits: Record<string, CellValueState>;\n handleCellEdit: (\n cellId: string,\n state: CellValueState,\n ) => void;\n handleSubmitEdits: () => Promise<void>;\n clearEdits: () => void;\n}\n\nexport function useEditableTable<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<\n string,\n never\n >,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n>({\n onCellValueChanged,\n onSubmitEdits,\n}: UseEditableTableProps<Q, RDPs, FunctionColumns>): UseEditableTableResult {\n const [cellEdits, setCellEdits] = useState<Record<string, CellValueState>>(\n {},\n );\n\n const handleCellEdit = useCallback(\n (cellId: string, state: CellValueState) => {\n const cellIdentifier = getCellIdentifier(cellId);\n\n // If value is changed back to original, remove it from edits\n if (state.newValue === state.oldValue) {\n setCellEdits(prev => {\n const { [cellId]: _, ...rest } = prev;\n return rest;\n });\n } else {\n setCellEdits(prev => ({\n ...prev,\n [cellId]: state,\n }));\n }\n\n onCellValueChanged?.(cellIdentifier, state);\n },\n [onCellValueChanged],\n );\n\n const clearEdits = useCallback(() => {\n setCellEdits({});\n }, []);\n\n const handleSubmitEdits = useCallback(async () => {\n await onSubmitEdits?.(cellEdits);\n }, [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IACLC,SAAS;IACTE,cAAc;IACdU,iBAAiB;IACjBD;EACF,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"useEditableTable.js","names":["useCallback","useState","useEditableTable","editMode","onCellValueChanged","onSubmitEdits","isActive","setActive","cellEdits","setCellEdits","handleCellEdit","cellId","info","newValue","oldValue","prev","_","rest","clearEdits","handleSubmitEdits","edits","Object","values","editModeConfig","type","onCellEdit","undefined"],"sources":["useEditableTable.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ObjectOrInterfaceDefinition,\n Osdk,\n PropertyKeys,\n QueryDefinition,\n SimplePropertyDef,\n} from \"@osdk/api\";\nimport { useCallback, useState } from \"react\";\nimport type { ObjectTableProps } from \"../ObjectTableApi.js\";\nimport type { CellEditInfo, EditableConfig, EditMode } from \"../utils/types.js\";\n\nexport interface UseEditableTableProps<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<\n string,\n never\n >,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n> {\n editMode?: \"always\" | \"manual\";\n\n onCellValueChanged?: ObjectTableProps<\n Q,\n RDPs,\n FunctionColumns\n >[\"onCellValueChanged\"];\n\n onSubmitEdits?: ObjectTableProps<\n Q,\n RDPs,\n FunctionColumns\n >[\"onSubmitEdits\"];\n}\n\nexport function useEditableTable<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<\n string,\n never\n >,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n>({\n editMode = \"manual\",\n onCellValueChanged,\n onSubmitEdits,\n}: UseEditableTableProps<Q, RDPs, FunctionColumns>): EditableConfig<\n Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n unknown\n> {\n const [isActive, setActive] = useState(editMode === \"always\");\n const [cellEdits, setCellEdits] = useState<\n Record<\n string,\n CellEditInfo<\n Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n unknown\n >\n >\n >(\n {},\n );\n\n const handleCellEdit = useCallback(\n (\n cellId: string,\n info: CellEditInfo<\n Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n unknown\n >,\n ) => {\n // If value is changed back to original, remove it from edits\n if (info.newValue === info.oldValue) {\n setCellEdits(prev => {\n const { [cellId]: _, ...rest } = prev;\n return rest;\n });\n } else {\n setCellEdits(prev => ({\n ...prev,\n [cellId]: info,\n }));\n }\n\n onCellValueChanged?.(info);\n },\n [onCellValueChanged],\n );\n\n const clearEdits = useCallback(() => {\n setCellEdits({});\n }, []);\n\n const handleSubmitEdits = useCallback(async () => {\n const edits = Object.values(cellEdits);\n return onSubmitEdits ? onSubmitEdits(edits) : false;\n }, [cellEdits, onSubmitEdits]);\n\n const editModeConfig: EditMode = editMode === \"always\"\n ? { type: \"always\", isActive: true }\n : { type: \"manual\", isActive, setActive };\n\n return {\n cellEdits,\n onCellEdit: handleCellEdit,\n onSubmitEdits: onSubmitEdits ? handleSubmitEdits : undefined,\n clearEdits,\n editMode: editModeConfig,\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA,SAASA,WAAW,EAAEC,QAAQ,QAAQ,OAAO;AA8B7C,OAAO,SAASC,gBAAgBA,CAU9B;EACAC,QAAQ,GAAG,QAAQ;EACnBC,kBAAkB;EAClBC;AAC+C,CAAC,EAGhD;EACA,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c;IAC1BL,aAAa,EAAEA,aAAa,GAAGc,iBAAiB,GAAGO,SAAS;IAC5DR,UAAU;IACVf,QAAQ,EAAEoB;EACZ,CAAC;AACH","ignoreList":[]}
@@ -77,8 +77,6 @@ export function useObjectTableData(objectOrInterfaceType, columnDefinitions, fil
77
77
 
78
78
  // Return the appropriate result based on which hook is enabled
79
79
  if (shouldUseObjectSet) {
80
- // eslint-disable-next-line no-console
81
- console.debug("Using useObjectSet for data fetching in ObjectTable because objectSet is provided and objectType is an object.");
82
80
  // Convert UseObjectSetResult to UseOsdkListResult format
83
81
  return {
84
82
  data: objectSetResult.data,
@@ -89,9 +87,6 @@ export function useObjectTableData(objectOrInterfaceType, columnDefinitions, fil
89
87
  isOptimistic: false // ObjectSet doesn't support optimistic updates
90
88
  };
91
89
  }
92
-
93
- // eslint-disable-next-line no-console
94
- console.debug("Using useOsdkObjects for data fetching in ObjectTable because objectSet is not provided or objectType is an interface.");
95
90
  return osdkObjectsResult;
96
91
  }
97
92
  //# sourceMappingURL=useObjectTableData.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useObjectTableData.js","names":["useObjectSet","useOsdkObjects","useMemo","PAGE_SIZE","useObjectTableData","objectOrInterfaceType","columnDefinitions","filter","sorting","objectSet","objectSetOptions","orderBy","length","undefined","reduce","acc","sort","id","desc","withProperties","rdpColumns","map","colDef","locator","colLocator","type","cur","creator","isObjectType","shouldUseObjectSet","objectSetResult","where","pageSize","enabled","osdkObjectsResult","console","debug","data","fetchMore","isLoading","error","totalCount","isOptimistic"],"sources":["useObjectTableData.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n DerivedProperty,\n ObjectOrInterfaceDefinition,\n ObjectSet,\n PropertyKeys,\n QueryDefinition,\n SimplePropertyDef,\n WhereClause,\n} from \"@osdk/api\";\nimport type { UseOsdkListResult } from \"@osdk/react/experimental\";\nimport { useObjectSet, useOsdkObjects } from \"@osdk/react/experimental\";\nimport type { SortingState } from \"@tanstack/react-table\";\nimport { useMemo } from \"react\";\nimport type { ColumnDefinition, ObjectSetOptions } from \"../ObjectTableApi.js\";\n\nconst PAGE_SIZE = 50;\n\ntype WithProperties<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<\n string,\n never\n >,\n> = {\n [K in keyof RDPs]: DerivedProperty.Creator<Q, RDPs[K]>;\n};\n/**\n * This hook is a wrapper that conditionally uses either useObjectSet or useOsdkObjects\n * based on whether an objectSet prop is provided.\n * It extracts RDP locators from columnDefinitions and applies withProperties\n * to return data containing the derived properties.\n */\nexport function useObjectTableData<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<\n string,\n never\n >,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n>(\n objectOrInterfaceType: Q,\n columnDefinitions?: Array<ColumnDefinition<Q, RDPs, FunctionColumns>>,\n filter?: WhereClause<Q, RDPs>,\n sorting?: SortingState,\n objectSet?: ObjectSet<Q>,\n objectSetOptions?: ObjectSetOptions<Q>,\n): UseOsdkListResult<Q, RDPs> {\n const orderBy = useMemo(() => {\n if (!sorting || sorting.length === 0) {\n return undefined;\n }\n\n return sorting.reduce<{ [K in PropertyKeys<Q>]?: \"asc\" | \"desc\" }>(\n (acc, sort) => {\n acc[sort.id as PropertyKeys<Q>] = sort.desc ? \"desc\" : \"asc\";\n return acc;\n },\n {},\n );\n }, [sorting]);\n\n // Extract derived properties definition\n const withProperties = useMemo(() => {\n if (!columnDefinitions) {\n return;\n }\n\n const rdpColumns = columnDefinitions.map(colDef => colDef.locator).filter(\n (colLocator) => {\n return colLocator.type === \"rdp\";\n },\n );\n\n if (!rdpColumns.length) {\n return;\n }\n\n return rdpColumns.reduce<WithProperties<Q, RDPs>>(\n (acc, cur) => {\n return {\n ...acc,\n [cur.id]: cur.creator,\n };\n },\n {} as WithProperties<Q, RDPs>,\n );\n }, [columnDefinitions]);\n\n // When objectSet is provided and it's an object type, use useObjectSet. Otherwise, use useOsdkObjects.\n const isObjectType = objectOrInterfaceType.type === \"object\";\n const shouldUseObjectSet = !!objectSet && isObjectType;\n\n // When shouldUseObjectSet is true, we know objectSet is defined\n // and objectOrInterfaceType is an ObjectTypeDefinition\n const objectSetResult = useObjectSet(\n shouldUseObjectSet ? objectSet as ObjectSet<Q> : undefined as any,\n {\n ...(objectSetOptions as ObjectSetOptions<Q>),\n withProperties: withProperties as WithProperties<\n Q,\n RDPs\n >,\n where: filter,\n orderBy,\n pageSize: PAGE_SIZE,\n enabled: shouldUseObjectSet,\n },\n );\n\n const osdkObjectsResult = useOsdkObjects<\n Q,\n RDPs\n >(\n objectOrInterfaceType,\n {\n withProperties,\n pageSize: PAGE_SIZE,\n where: filter,\n orderBy,\n enabled: !shouldUseObjectSet,\n },\n );\n\n // Return the appropriate result based on which hook is enabled\n if (shouldUseObjectSet) {\n // eslint-disable-next-line no-console\n console.debug(\n \"Using useObjectSet for data fetching in ObjectTable because objectSet is provided and objectType is an object.\",\n );\n // Convert UseObjectSetResult to UseOsdkListResult format\n return {\n data: objectSetResult.data,\n fetchMore: objectSetResult.fetchMore,\n isLoading: objectSetResult.isLoading,\n error: objectSetResult.error,\n totalCount: objectSetResult.totalCount,\n isOptimistic: false, // ObjectSet doesn't support optimistic updates\n } as UseOsdkListResult<Q, RDPs>;\n }\n\n // eslint-disable-next-line no-console\n console.debug(\n \"Using useOsdkObjects for data fetching in ObjectTable because objectSet is not provided or objectType is an interface.\",\n );\n return osdkObjectsResult;\n}\n"],"mappings":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,CAAC,EACD,CAAC,CACH,CAAC;EACH,CAAC,EAAE,CAACrB,iBAAiB,CAAC,CAAC;;EAEvB;EACA,MAAMsB,YAAY,GAAGvB,qBAAqB,CAACoB,IAAI,KAAK,QAAQ;EAC5D,MAAMI,kBAAkB,GAAG,CAAC,CAACpB,SAAS,IAAImB,YAAY;;EAEtD;EACA;EACA,MAAME,eAAe,GAAG9B,YAAY,CAClC6B,kBAAkB,GAAGpB,SAAS,GAAmBI,SAAgB,EACjE;IACE,GAAIH,gBAAwC;IAC5CS,cAAc,EAAEA,cAGf;IACDY,KAAK,EAAExB,MAAM;IACbI,OAAO;IACPqB,QAAQ,EAAE7B,SAAS;IACnB8B,OAAO,EAAEJ;EACX,CACF,CAAC;EAED,MAAMK,iBAAiB,GAAGjC,cAAc,CAItCI,qBAAqB,EACrB;IACEc,cAAc;IACda,QAAQ,EAAE7B,SAAS;IACnB4B,KAAK,EAAExB,MAAM;IACbI,OAAO;IACPsB,OAAO,EAAE,CAACJ;EACZ,CACF,CAAC;;EAED;EACA,IAAIA,kBAAkB,EAAE;IACtB;IACAM,OAAO,CAACC,KAAK,CACX,gHACF,CAAC;IACD;IACA,OAAO;MACLC,IAAI,EAAEP,eAAe,CAACO,IAAI;MAC1BC,SAAS,EAAER,eAAe,CAACQ,SAAS;MACpCC,SAAS,EAAET,eAAe,CAACS,SAAS;MACpCC,KAAK,EAAEV,eAAe,CAACU,KAAK;MAC5BC,UAAU,EAAEX,eAAe,CAACW,UAAU;MACtCC,YAAY,EAAE,KAAK,CAAE;IACvB,CAAC;EACH;;EAEA;EACAP,OAAO,CAACC,KAAK,CACX,wHACF,CAAC;EACD,OAAOF,iBAAiB;AAC1B","ignoreList":[]}
1
+ {"version":3,"file":"useObjectTableData.js","names":["useObjectSet","useOsdkObjects","useMemo","PAGE_SIZE","useObjectTableData","objectOrInterfaceType","columnDefinitions","filter","sorting","objectSet","objectSetOptions","orderBy","length","undefined","reduce","acc","sort","id","desc","withProperties","rdpColumns","map","colDef","locator","colLocator","type","cur","creator","isObjectType","shouldUseObjectSet","objectSetResult","where","pageSize","enabled","osdkObjectsResult","data","fetchMore","isLoading","error","totalCount","isOptimistic"],"sources":["useObjectTableData.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n DerivedProperty,\n ObjectOrInterfaceDefinition,\n ObjectSet,\n PropertyKeys,\n QueryDefinition,\n SimplePropertyDef,\n WhereClause,\n} from \"@osdk/api\";\nimport type { UseOsdkListResult } from \"@osdk/react/experimental\";\nimport { useObjectSet, useOsdkObjects } from \"@osdk/react/experimental\";\nimport type { SortingState } from \"@tanstack/react-table\";\nimport { useMemo } from \"react\";\nimport type { ColumnDefinition, ObjectSetOptions } from \"../ObjectTableApi.js\";\n\nconst PAGE_SIZE = 50;\n\ntype WithProperties<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<\n string,\n never\n >,\n> = {\n [K in keyof RDPs]: DerivedProperty.Creator<Q, RDPs[K]>;\n};\n/**\n * This hook is a wrapper that conditionally uses either useObjectSet or useOsdkObjects\n * based on whether an objectSet prop is provided.\n * It extracts RDP locators from columnDefinitions and applies withProperties\n * to return data containing the derived properties.\n */\nexport function useObjectTableData<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<\n string,\n never\n >,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n>(\n objectOrInterfaceType: Q,\n columnDefinitions?: Array<ColumnDefinition<Q, RDPs, FunctionColumns>>,\n filter?: WhereClause<Q, RDPs>,\n sorting?: SortingState,\n objectSet?: ObjectSet<Q>,\n objectSetOptions?: ObjectSetOptions<Q>,\n): UseOsdkListResult<Q, RDPs> {\n const orderBy = useMemo(() => {\n if (!sorting || sorting.length === 0) {\n return undefined;\n }\n\n return sorting.reduce<{ [K in PropertyKeys<Q>]?: \"asc\" | \"desc\" }>(\n (acc, sort) => {\n acc[sort.id as PropertyKeys<Q>] = sort.desc ? \"desc\" : \"asc\";\n return acc;\n },\n {},\n );\n }, [sorting]);\n\n // Extract derived properties definition\n const withProperties = useMemo(() => {\n if (!columnDefinitions) {\n return;\n }\n\n const rdpColumns = columnDefinitions.map(colDef => colDef.locator).filter(\n (colLocator) => {\n return colLocator.type === \"rdp\";\n },\n );\n\n if (!rdpColumns.length) {\n return;\n }\n\n return rdpColumns.reduce<WithProperties<Q, RDPs>>(\n (acc, cur) => {\n return {\n ...acc,\n [cur.id]: cur.creator,\n };\n },\n {} as WithProperties<Q, RDPs>,\n );\n }, [columnDefinitions]);\n\n // When objectSet is provided and it's an object type, use useObjectSet. Otherwise, use useOsdkObjects.\n const isObjectType = objectOrInterfaceType.type === \"object\";\n const shouldUseObjectSet = !!objectSet && isObjectType;\n\n // When shouldUseObjectSet is true, we know objectSet is defined\n // and objectOrInterfaceType is an ObjectTypeDefinition\n const objectSetResult = useObjectSet(\n shouldUseObjectSet ? objectSet as ObjectSet<Q> : undefined as any,\n {\n ...(objectSetOptions as ObjectSetOptions<Q>),\n withProperties: withProperties as WithProperties<\n Q,\n RDPs\n >,\n where: filter,\n orderBy,\n pageSize: PAGE_SIZE,\n enabled: shouldUseObjectSet,\n },\n );\n\n const osdkObjectsResult = useOsdkObjects<\n Q,\n RDPs\n >(\n objectOrInterfaceType,\n {\n withProperties,\n pageSize: PAGE_SIZE,\n where: filter,\n orderBy,\n enabled: !shouldUseObjectSet,\n },\n );\n\n // Return the appropriate result based on which hook is enabled\n if (shouldUseObjectSet) {\n // Convert UseObjectSetResult to UseOsdkListResult format\n return {\n data: objectSetResult.data,\n fetchMore: objectSetResult.fetchMore,\n isLoading: objectSetResult.isLoading,\n error: objectSetResult.error,\n totalCount: objectSetResult.totalCount,\n isOptimistic: false, // ObjectSet doesn't support optimistic updates\n } as UseOsdkListResult<Q, RDPs>;\n }\n\n return osdkObjectsResult;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAYA,SAASA,YAAY,EAAEC,cAAc,QAAQ,0BAA0B;AAEvE,SAASC,OAAO,QAAQ,OAAO;AAG/B,MAAMC,SAAS,GAAG,EAAE;AAWpB;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,kBAAkBA,CAWhCC,qBAAwB,EACxBC,iBAAqE,EACrEC,MAA6B,EAC7BC,OAAsB,EACtBC,SAAwB,EACxBC,gBAAsC,EACV;EAC5B,MAAMC,OAAO,GAAGT,OAAO,CAAC,MAAM;IAC5B,IAAI,CAACM,OAAO,IAAIA,OAAO,CAACI,MAAM,KAAK,CAAC,EAAE;MACpC,OAAOC,SAAS;IAClB;IAEA,OAAOL,OAAO,CAACM,MAAM,CACnB,CAACC,GAAG,EAAEC,IAAI,KAAK;MACbD,GAAG,CAACC,IAAI,CAACC,EAAE,CAAoB,GAAGD,IAAI,CAACE,IAAI,GAAG,MAAM,GAAG,KAAK;MAC5D,OAAOH,GAAG;IACZ,CAAC,EACD,CAAC,CACH,CAAC;EACH,CAAC,EAAE,CAACP,OAAO,CAAC,CAAC;;EAEb;EACA,MAAMW,cAAc,GAAGjB,OAAO,CAAC,MAAM;IACnC,IAAI,CAACI,iBAAiB,EAAE;MACtB;IACF;IAEA,MAAMc,UAAU,GAAGd,iBAAiB,CAACe,GAAG,CAACC,MAAM,IAAIA,MAAM,CAACC,OAAO,CAAC,CAAChB,MAAM,CACtEiB,UAAU,IAAK;MACd,OAAOA,UAAU,CAACC,IAAI,KAAK,KAAK;IAClC,CACF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18
18
  return JSON.stringify(cellIdentifier);
19
19
  }
20
- export function getCellIdentifier(cellId) {
21
- const parsed = JSON.parse(cellId);
22
- if (typeof parsed === "object" && parsed != null && "rowId" in parsed && "columnId" in parsed) {
23
- return parsed;
24
- }
25
- throw new Error("Parsed cellId does not have required properties");
26
- }
27
20
  //# sourceMappingURL=getCellId.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getCellId.js","names":["getCellId","cellIdentifier","JSON","stringify","getCellIdentifier","cellId","parsed","parse","Error"],"sources":["getCellId.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { CellIdentifier } from \"./types.js\";\n\nexport function getCellId(cellIdentifier: CellIdentifier): string {\n return JSON.stringify(cellIdentifier);\n}\n\nexport function getCellIdentifier(cellId: string): CellIdentifier {\n const parsed = JSON.parse(cellId);\n if (\n typeof parsed === \"object\" && parsed != null && \"rowId\" in parsed\n && \"columnId\" in parsed\n ) {\n return parsed as CellIdentifier;\n }\n throw new Error(\"Parsed cellId does not have required properties\");\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,OAAO,SAASA,SAASA,CAACC,cAA8B,EAAU;EAChE,OAAOC,IAAI,CAACC,SAAS,CAACF,cAAc,CAAC;AACvC;AAEA,OAAO,SAASG,iBAAiBA,CAACC,MAAc,EAAkB;EAChE,MAAMC,MAAM,GAAGJ,IAAI,CAACK,KAAK,CAACF,MAAM,CAAC;EACjC,IACE,OAAOC,MAAM,KAAK,QAAQ,IAAIA,MAAM,IAAI,IAAI,IAAI,OAAO,IAAIA,MAAM,IAC9D,UAAU,IAAIA,MAAM,EACvB;IACA,OAAOA,MAAM;EACf;EACA,MAAM,IAAIE,KAAK,CAAC,iDAAiD,CAAC;AACpE","ignoreList":[]}
1
+ {"version":3,"file":"getCellId.js","names":["getCellId","cellIdentifier","JSON","stringify"],"sources":["getCellId.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { CellIdentifier } from \"./types.js\";\n\nexport function getCellId(cellIdentifier: CellIdentifier): string {\n return JSON.stringify(cellIdentifier);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,OAAO,SAASA,SAASA,CAACC,cAA8B,EAAU;EAChE,OAAOC,IAAI,CAACC,SAAS,CAACF,cAAc,CAAC;AACvC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["types.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { RowData } from \"@tanstack/react-table\";\n\nexport interface ColumnOption {\n id: string;\n name: string;\n canSort: boolean;\n}\n\nexport interface CellIdentifier {\n rowId: string;\n columnId: string;\n}\n\nexport interface CellValueState<TData extends RowData = unknown> {\n newValue: TData;\n oldValue: TData;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["types.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { RowData } from \"@tanstack/react-table\";\n\nexport interface ColumnOption {\n id: string;\n name: string;\n canSort: boolean;\n}\n\nexport interface CellIdentifier {\n rowId: string;\n columnId: string;\n}\n\nexport interface CellEditInfo<\n TData extends RowData = unknown,\n CellValue = unknown,\n> extends CellIdentifier {\n newValue: CellValue;\n oldValue: CellValue;\n originalRowData: TData;\n}\n\nexport type EditMode =\n | { type: \"always\"; isActive: true }\n | { type: \"manual\"; isActive: boolean; setActive: (value: boolean) => void };\n\nexport interface EditableConfig<\n TData extends RowData = unknown,\n CellValue = unknown,\n> {\n cellEdits: Record<string, CellEditInfo<TData, CellValue>>;\n onCellEdit: (\n cellId: string,\n info: CellEditInfo<TData, CellValue>,\n ) => void;\n onSubmitEdits?: () => Promise<boolean>;\n clearEdits: () => void;\n editMode: EditMode;\n}\n"],"mappings":"","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"experimental.js","names":["FilterList","ObjectTable","BaseTable","ColumnConfigDialog"],"sources":["experimental.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport { FilterList } from \"../filter-list/base/FilterList.js\";\nexport type {\n FilterDefinitionUnion,\n FilterListProps,\n} from \"../filter-list/FilterListApi.js\";\nexport type {\n FilterComponentType,\n FilterListItemProps,\n FilterState,\n PropertyFilterDefinition,\n} from \"../filter-list/FilterListItemApi.js\";\n\n// ObjectTable that loads and displays data for a given objectSet\nexport { ObjectTable } from \"../object-table/ObjectTable.js\";\nexport type {\n ColumnDefinition,\n ColumnDefinitionLocator,\n ObjectTableProps,\n} from \"../object-table/ObjectTableApi.js\";\nexport type {\n CellIdentifier,\n CellValueState,\n} from \"../object-table/utils/types.js\";\n\n// BaseTable that does not handle data fetching\nexport type { BaseTableProps } from \"../object-table/Table.js\";\nexport { BaseTable } from \"../object-table/Table.js\";\n\nexport { ColumnConfigDialog } from \"../object-table/ColumnConfigDialog.js\";\nexport type {\n ColumnConfigDialogProps,\n ColumnConfigOptions,\n} from \"../object-table/ColumnConfigDialog.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,UAAU,QAAQ,mCAAmC;AAY9D;AACA,SAASC,WAAW,QAAQ,gCAAgC;;AAW5D;;AAEA,SAASC,SAAS,QAAQ,0BAA0B;AAEpD,SAASC,kBAAkB,QAAQ,uCAAuC","ignoreList":[]}
1
+ {"version":3,"file":"experimental.js","names":["FilterList","ObjectTable","BaseTable","ColumnConfigDialog"],"sources":["experimental.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport { FilterList } from \"../filter-list/base/FilterList.js\";\nexport type {\n FilterDefinitionUnion,\n FilterListProps,\n} from \"../filter-list/FilterListApi.js\";\nexport type {\n FilterComponentType,\n FilterListItemProps,\n FilterState,\n PropertyFilterDefinition,\n} from \"../filter-list/FilterListItemApi.js\";\n\n// ObjectTable that loads and displays data for a given objectSet\nexport { ObjectTable } from \"../object-table/ObjectTable.js\";\nexport type {\n ColumnDefinition,\n ColumnDefinitionLocator,\n ObjectTableProps,\n} from \"../object-table/ObjectTableApi.js\";\nexport type { CellEditInfo } from \"../object-table/utils/types.js\";\n\n// BaseTable that does not handle data fetching\nexport type { BaseTableProps } from \"../object-table/Table.js\";\nexport { BaseTable } from \"../object-table/Table.js\";\n\nexport { ColumnConfigDialog } from \"../object-table/ColumnConfigDialog.js\";\nexport type {\n ColumnConfigDialogProps,\n ColumnConfigOptions,\n} from \"../object-table/ColumnConfigDialog.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,UAAU,QAAQ,mCAAmC;AAY9D;AACA,SAASC,WAAW,QAAQ,gCAAgC;;AAQ5D;;AAEA,SAASC,SAAS,QAAQ,0BAA0B;AAEpD,SAASC,kBAAkB,QAAQ,uCAAuC","ignoreList":[]}
@@ -1,3 +1,3 @@
1
- import type { CellContext } from "@tanstack/react-table";
1
+ import type { CellContext, RowData } from "@tanstack/react-table";
2
2
  import React from "react";
3
- export declare function renderDefaultCell<TData>(cellContext: CellContext<TData, unknown>): React.ReactNode;
3
+ export declare function renderDefaultCell<TData extends RowData>(cellContext: CellContext<TData, unknown>): React.ReactNode;
@@ -1 +1 @@
1
- {"mappings":"AAgBA,cAAc,mBAAmB,uBAAwB;AACzD,OAAO,WAAW,OAAQ;AAI1B,OAAO,iBAAS,kBAAkB,OAChCA,aAAa,YAAY,kBACxB,MAAM","names":["cellContext: CellContext<TData, unknown>"],"sources":["../../../src/object-table/DefaultCellRenderer.tsx"],"version":3,"file":"DefaultCellRenderer.d.ts"}
1
+ {"mappings":"AAgBA,cAAc,aAAa,eAAe,uBAAwB;AAClE,OAAO,WAAW,OAAQ;AAI1B,OAAO,iBAAS,kBAAkB,cAAc,SAC9CA,aAAa,YAAY,kBACxB,MAAM","names":["cellContext: CellContext<TData, unknown>"],"sources":["../../../src/object-table/DefaultCellRenderer.tsx"],"version":3,"file":"DefaultCellRenderer.d.ts"}
@@ -1,10 +1,22 @@
1
+ import type { RowData } from "@tanstack/react-table";
1
2
  import React from "react";
2
- import type { CellValueState } from "./utils/types.js";
3
- export interface EditableCellProps {
4
- initialValue: unknown;
5
- currentValue: unknown;
3
+ import type { CellEditInfo } from "./utils/types.js";
4
+ export interface EditableCellProps<
5
+ TData extends RowData,
6
+ CellValue = unknown
7
+ > {
8
+ initialValue: CellValue;
9
+ currentValue: CellValue;
6
10
  cellId: string;
7
11
  dataType?: string;
8
- onCellEdit?: (cellId: string, state: CellValueState) => void;
12
+ onCellEdit: (cellId: string, info: CellEditInfo<TData, CellValue>) => void;
13
+ originalRowData: TData;
14
+ rowId: string;
15
+ columnId: string;
9
16
  }
10
- export declare function EditableCell({ initialValue, currentValue, cellId, dataType, onCellEdit }: EditableCellProps): React.ReactElement;
17
+ declare function EditableCellInner<
18
+ TData extends RowData,
19
+ CellValue = unknown
20
+ >({ initialValue, currentValue, cellId, dataType, onCellEdit, originalRowData, rowId, columnId }: EditableCellProps<TData, CellValue>): React.ReactElement;
21
+ export declare const EditableCell: typeof EditableCellInner;
22
+ export {};
@@ -1 +1 @@
1
- {"mappings":"AAiBA,OAAO,WAAyD,OAAQ;AAExE,cAAc,sBAAsB,kBAAmB;AAEvD,iBAAiB,kBAAkB;CACjC;CACA;CACA;CACA;CACA,cAAcA,gBAAgBC,OAAO;AACtC;AA4CD,OAAO,iBAAS,aAAa,EAC3B,cACA,cACA,QACA,UACA,YACkB,EAAjB,oBAAoB,MAAM","names":["cellId: string","state: CellValueState"],"sources":["../../../src/object-table/EditableCell.tsx"],"version":3,"file":"EditableCell.d.ts"}
1
+ {"mappings":"AAiBA,cAAc,eAAe,uBAAwB;AAErD,OAAO,WAAyD,OAAQ;AAExE,cAAc,oBAAoB,kBAAmB;AAErD,iBAAiB;CAAkB,cAAc;CAAS;EAAqB;CAC7E,cAAc;CACd,cAAc;CACd;CACA;CACA,aAAaA,gBAAgBC,MAAM,aAAa,OAAO;CACvD,iBAAiB;CACjB;CACA;AACD;AA4CD,iBAAS;CAAkB,cAAc;CAAS;EAAqB,EACrE,cACA,cACA,QACA,UACA,YACA,iBACA,OACA,UACoC,EAAnC,kBAAkB,OAAO,aAAa,MAAM;AAyE/C,OAAO,cAAM,qBAED","names":["cellId: string","info: CellEditInfo<TData, CellValue>"],"sources":["../../../src/object-table/EditableCell.tsx"],"version":3,"file":"EditableCell.d.ts"}
@@ -13,4 +13,4 @@ export declare function ObjectTable<
13
13
  Q extends ObjectOrInterfaceDefinition,
14
14
  RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,
15
15
  FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<string, never>
16
- >({ objectType, objectSet, columnDefinitions, filter, objectSetOptions, orderBy, defaultOrderBy, onOrderByChanged, onColumnsPinnedChanged, onColumnResize, onRowSelection, renderCellContextMenu, selectionMode, selectedRows, onColumnVisibilityChanged, onCellValueChanged, onSubmitEdits, enableOrdering, enableColumnPinning, enableColumnResizing, enableColumnConfig,...props }: ObjectTableProps<Q, RDPs, FunctionColumns>): React.ReactElement;
16
+ >({ objectType, objectSet, columnDefinitions, filter, objectSetOptions, orderBy, defaultOrderBy, onOrderByChanged, onColumnsPinnedChanged, onColumnResize, onRowSelection, renderCellContextMenu, selectionMode, selectedRows, onColumnVisibilityChanged, onCellValueChanged, onSubmitEdits, enableOrdering, enableColumnPinning, enableColumnResizing, enableColumnConfig, editMode,...props }: ObjectTableProps<Q, RDPs, FunctionColumns>): React.ReactElement;
@@ -1 +1 @@
1
- {"mappings":"AAgBA,cACE,6BAGA,iBACA,yBACK,WAAY;AAGnB,OAAO,WAAqC,OAAQ;AAUpD,cAAc,wBAAwB,qBAAsB;;;;;;;;;AAc5D,OAAO,iBAAS;CACd,UAAU;CACV,aAAa,eAAe,qBAAqB;CAIjD,wBAAwB,eAAe,gBAAgB,CAAE,MAAK;EAI9D,EACA,YACA,WACA,mBACA,QACA,kBACA,SACA,gBACA,kBACA,wBACA,gBACA,gBACA,uBACA,eACA,cACA,2BACA,oBACA,eACA,gBACA,qBACA,sBACA,mBACA,GAAG,OACwC,EAA1C,iBAAiB,GAAG,MAAM,mBAAmB,MAAM","names":[],"sources":["../../../src/object-table/ObjectTable.tsx"],"version":3,"file":"ObjectTable.d.ts"}
1
+ {"mappings":"AAgBA,cACE,6BAGA,iBACA,yBACK,WAAY;AAGnB,OAAO,WAAqC,OAAQ;AAUpD,cAAc,wBAAwB,qBAAsB;;;;;;;;;AAe5D,OAAO,iBAAS;CACd,UAAU;CACV,aAAa,eAAe,qBAAqB;CAIjD,wBAAwB,eAAe,gBAAgB,CAAE,MAAK;EAI9D,EACA,YACA,WACA,mBACA,QACA,kBACA,SACA,gBACA,kBACA,wBACA,gBACA,gBACA,uBACA,eACA,cACA,2BACA,oBACA,eACA,gBACA,qBACA,sBACA,oBACA,SACA,GAAG,OACwC,EAA1C,iBAAiB,GAAG,MAAM,mBAAmB,MAAM","names":[],"sources":["../../../src/object-table/ObjectTable.tsx"],"version":3,"file":"ObjectTable.d.ts"}
@@ -1,6 +1,6 @@
1
1
  import type { DerivedProperty, ObjectOrInterfaceDefinition, ObjectSet, Osdk, PrimaryKeyType, PropertyKeys, QueryDefinition, SimplePropertyDef, WhereClause } from "@osdk/api";
2
2
  import type * as React from "react";
3
- import type { CellIdentifier, CellValueState } from "./utils/types.js";
3
+ import type { CellEditInfo } from "./utils/types.js";
4
4
  export type ColumnDefinition<
5
5
  Q extends ObjectOrInterfaceDefinition,
6
6
  RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,
@@ -122,6 +122,14 @@ export interface ObjectTableProps<
122
122
  */
123
123
  enableColumnConfig?: boolean;
124
124
  /**
125
+ * Controls the edit mode behavior of the table.
126
+ * - "always": Editable cells are immediately in edit mode on row clicked.
127
+ * - "manual": User can toggle edit mode on/off via the Edit Table button.
128
+ *
129
+ * @default "manual"
130
+ */
131
+ editMode?: "always" | "manual";
132
+ /**
125
133
  * The default order by clause to sort the objects in the table.
126
134
  * If provided without orderBy prop, the sorting is uncontrolled.
127
135
  * If both orderBy and defaultOrderBy are provided, orderBy takes precedence.
@@ -152,16 +160,18 @@ export interface ObjectTableProps<
152
160
  /**
153
161
  * Called after the value of a cell is edited and committed by the user.
154
162
  *
155
- * @param cell The cell that was edited, identified by its row and column IDs
156
- * @param state The new and old values of the cell
163
+ * @param info An object containing details about the cell that was edited,
164
+ * including the rowId, columnId, new and old values, and the row data before the edit
157
165
  */
158
- onCellValueChanged?: (cell: CellIdentifier, state: CellValueState) => void;
166
+ onCellValueChanged?: (info: CellEditInfo<Osdk.Instance<Q, "$allBaseProperties", PropertyKeys<Q>, RDPs>, unknown>) => void;
159
167
  /**
160
168
  * If provided, the button Submit Edits will be shown in the table
161
169
  *
162
- * @param edits a map of cellId (stringified CellIdentifier) to the new and old values of the cell
170
+ * @param edits an array of edit info containing details about the edited cells
171
+ * including the rowId, columnId, new and old values, and the row data before the edit
172
+ * @return a promise that resolves to true if the edits were successfully submitted
163
173
  */
164
- onSubmitEdits?: (edits: Record<string, CellValueState>) => Promise<void>;
174
+ onSubmitEdits?: (edits: CellEditInfo<Osdk.Instance<Q, "$allBaseProperties", PropertyKeys<Q>, RDPs>, unknown>[]) => Promise<boolean>;
165
175
  /**
166
176
  * Called when the column visibility or ordering changed.
167
177
  *