@osdk/react-components 0.1.0-beta.6 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +2 -5
  3. package/build/browser/base-components/checkbox/Checkbox.js +32 -27
  4. package/build/browser/object-table/CellContextMenu.js +20 -23
  5. package/build/browser/object-table/LoadingCell.js +38 -0
  6. package/build/browser/object-table/LoadingCell.js.map +1 -0
  7. package/build/browser/object-table/LoadingRow.js +69 -0
  8. package/build/browser/object-table/LoadingRow.js.map +1 -0
  9. package/build/browser/object-table/LoadingStateTable.js +395 -0
  10. package/build/browser/object-table/LoadingStateTable.js.map +1 -0
  11. package/build/browser/object-table/NonIdealState.js +25 -0
  12. package/build/browser/object-table/NonIdealState.js.map +1 -0
  13. package/build/browser/object-table/ObjectTable.js +6 -5
  14. package/build/browser/object-table/ObjectTable.js.map +1 -1
  15. package/build/browser/object-table/ObjectTableApi.js.map +1 -1
  16. package/build/browser/object-table/Table.js +948 -45
  17. package/build/browser/object-table/Table.js.map +1 -1
  18. package/build/browser/object-table/TableBody.js +269 -34
  19. package/build/browser/object-table/TableBody.js.map +1 -1
  20. package/build/browser/object-table/TableCell.js +111 -31
  21. package/build/browser/object-table/TableCell.js.map +1 -1
  22. package/build/browser/object-table/TableHeader.js +215 -38
  23. package/build/browser/object-table/TableHeaderContent.js +18 -21
  24. package/build/browser/object-table/TableHeaderContent.js.map +1 -1
  25. package/build/browser/object-table/TableHeaderWithPopover.js +80 -66
  26. package/build/browser/object-table/TableRow.js +144 -26
  27. package/build/browser/object-table/hooks/__tests__/useObjectTableData.test.js +18 -20
  28. package/build/browser/object-table/hooks/__tests__/useObjectTableData.test.js.map +1 -1
  29. package/build/browser/object-table/hooks/useColumnDefs.js +6 -2
  30. package/build/browser/object-table/hooks/useColumnDefs.js.map +1 -1
  31. package/build/browser/object-table/hooks/useColumnPinning.js.map +1 -1
  32. package/build/browser/object-table/hooks/useColumnVisibility.js.map +1 -1
  33. package/build/browser/object-table/hooks/useObjectTableData.js +7 -6
  34. package/build/browser/object-table/hooks/useObjectTableData.js.map +1 -1
  35. package/build/browser/object-table/hooks/useRowSelection.js.map +1 -1
  36. package/build/browser/object-table/hooks/useSelectionColumn.js.map +1 -1
  37. package/build/browser/object-table/hooks/useTableSorting.js.map +1 -1
  38. package/build/browser/object-table/utils/getRowId.js.map +1 -1
  39. package/build/cjs/public/experimental.cjs +435 -264
  40. package/build/cjs/public/experimental.cjs.map +1 -1
  41. package/build/cjs/public/experimental.css +114 -56
  42. package/build/cjs/public/experimental.css.map +1 -1
  43. package/build/cjs/public/experimental.d.cts +8 -11
  44. package/build/esm/base-components/checkbox/Checkbox.module.css +10 -3
  45. package/build/esm/object-table/CellContextMenu.module.css +1 -1
  46. package/build/{browser/object-table/CellContextMenu.module.css → esm/object-table/LoadingCell.js} +16 -3
  47. package/build/esm/object-table/LoadingCell.js.map +1 -0
  48. package/build/esm/object-table/LoadingCell.module.css +48 -0
  49. package/build/esm/object-table/LoadingRow.js +43 -0
  50. package/build/esm/object-table/LoadingRow.js.map +1 -0
  51. package/build/esm/object-table/LoadingStateTable.js +101 -0
  52. package/build/esm/object-table/LoadingStateTable.js.map +1 -0
  53. package/build/{browser/object-table/TableHeaderContent.module.css → esm/object-table/NonIdealState.js} +11 -13
  54. package/build/esm/object-table/NonIdealState.js.map +1 -0
  55. package/build/{browser/object-table/Table.module.css → esm/object-table/NonIdealState.module.css} +10 -4
  56. package/build/esm/object-table/ObjectTable.js +6 -5
  57. package/build/esm/object-table/ObjectTable.js.map +1 -1
  58. package/build/esm/object-table/ObjectTableApi.js.map +1 -1
  59. package/build/esm/object-table/Table.js +34 -13
  60. package/build/esm/object-table/Table.js.map +1 -1
  61. package/build/esm/object-table/Table.module.css +2 -2
  62. package/build/esm/object-table/TableBody.js +13 -2
  63. package/build/esm/object-table/TableBody.js.map +1 -1
  64. package/build/esm/object-table/TableCell.js.map +1 -1
  65. package/build/esm/object-table/TableCell.module.css +7 -8
  66. package/build/esm/object-table/TableHeader.module.css +15 -9
  67. package/build/esm/object-table/TableHeaderContent.js.map +1 -1
  68. package/build/esm/object-table/TableHeaderWithPopover.module.css +31 -26
  69. package/build/esm/object-table/TableRow.module.css +1 -1
  70. package/build/esm/object-table/hooks/__tests__/useObjectTableData.test.js +18 -20
  71. package/build/esm/object-table/hooks/__tests__/useObjectTableData.test.js.map +1 -1
  72. package/build/esm/object-table/hooks/useColumnDefs.js +6 -2
  73. package/build/esm/object-table/hooks/useColumnDefs.js.map +1 -1
  74. package/build/esm/object-table/hooks/useColumnPinning.js.map +1 -1
  75. package/build/esm/object-table/hooks/useColumnVisibility.js.map +1 -1
  76. package/build/esm/object-table/hooks/useObjectTableData.js +7 -6
  77. package/build/esm/object-table/hooks/useObjectTableData.js.map +1 -1
  78. package/build/esm/object-table/hooks/useRowSelection.js.map +1 -1
  79. package/build/esm/object-table/hooks/useSelectionColumn.js.map +1 -1
  80. package/build/esm/object-table/hooks/useTableSorting.js.map +1 -1
  81. package/build/esm/object-table/utils/getRowId.js.map +1 -1
  82. package/build/types/object-table/LoadingCell.d.ts +4 -0
  83. package/build/types/object-table/LoadingCell.d.ts.map +1 -0
  84. package/build/types/object-table/LoadingRow.d.ts +11 -0
  85. package/build/types/object-table/LoadingRow.d.ts.map +1 -0
  86. package/build/types/object-table/LoadingStateTable.d.ts +11 -0
  87. package/build/types/object-table/LoadingStateTable.d.ts.map +1 -0
  88. package/build/types/object-table/NonIdealState.d.ts +6 -0
  89. package/build/types/object-table/NonIdealState.d.ts.map +1 -0
  90. package/build/types/object-table/ObjectTable.d.ts +4 -4
  91. package/build/types/object-table/ObjectTable.d.ts.map +1 -1
  92. package/build/types/object-table/ObjectTableApi.d.ts +4 -8
  93. package/build/types/object-table/ObjectTableApi.d.ts.map +1 -1
  94. package/build/types/object-table/Table.d.ts +2 -1
  95. package/build/types/object-table/Table.d.ts.map +1 -1
  96. package/build/types/object-table/TableBody.d.ts +4 -2
  97. package/build/types/object-table/TableBody.d.ts.map +1 -1
  98. package/build/types/object-table/TableHeaderContent.d.ts.map +1 -1
  99. package/build/types/object-table/hooks/useColumnDefs.d.ts +3 -3
  100. package/build/types/object-table/hooks/useColumnDefs.d.ts.map +1 -1
  101. package/build/types/object-table/hooks/useColumnPinning.d.ts +3 -3
  102. package/build/types/object-table/hooks/useColumnPinning.d.ts.map +1 -1
  103. package/build/types/object-table/hooks/useColumnVisibility.d.ts +3 -3
  104. package/build/types/object-table/hooks/useColumnVisibility.d.ts.map +1 -1
  105. package/build/types/object-table/hooks/useObjectTableData.d.ts +6 -6
  106. package/build/types/object-table/hooks/useObjectTableData.d.ts.map +1 -1
  107. package/build/types/object-table/hooks/useRowSelection.d.ts +3 -3
  108. package/build/types/object-table/hooks/useRowSelection.d.ts.map +1 -1
  109. package/build/types/object-table/hooks/useSelectionColumn.d.ts +2 -2
  110. package/build/types/object-table/hooks/useSelectionColumn.d.ts.map +1 -1
  111. package/build/types/object-table/hooks/useTableSorting.d.ts +3 -3
  112. package/build/types/object-table/hooks/useTableSorting.d.ts.map +1 -1
  113. package/build/types/object-table/utils/getRowId.d.ts +3 -3
  114. package/build/types/object-table/utils/getRowId.d.ts.map +1 -1
  115. package/package.json +6 -6
  116. package/build/browser/base-components/checkbox/Checkbox.module.css +0 -72
  117. package/build/browser/object-table/TableBody.module.css +0 -20
  118. package/build/browser/object-table/TableCell.module.css +0 -63
  119. package/build/browser/object-table/TableHeader.module.css +0 -95
  120. package/build/browser/object-table/TableHeaderWithPopover.module.css +0 -105
  121. package/build/browser/object-table/TableRow.module.css +0 -60
@@ -1 +1 @@
1
- {"version":3,"file":"Table.js","names":["classNames","React","useCallback","useRef","styles","TableBody","TableHeader","BaseTable","table","isLoading","fetchNextPage","onRowClick","rowHeight","renderCellContextMenu","className","tableContainerRef","fetchingRef","fetchMoreOnEndReached","containerRefElement","current","scrollHeight","scrollTop","clientHeight","handleScroll","e","currentTarget","createElement","ref","osdkTableContainer","onScroll","rows","getRowModel"],"sources":["Table.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, RowData, Table } from \"@tanstack/react-table\";\nimport classNames from \"classnames\";\nimport React, { type ReactElement, useCallback, useRef } from \"react\";\nimport styles from \"./Table.module.css\";\nimport { TableBody } from \"./TableBody.js\";\nimport { TableHeader } from \"./TableHeader.js\";\n\nexport interface BaseTableProps<TData extends RowData> {\n table: Table<TData>;\n isLoading?: boolean;\n fetchNextPage?: () => Promise<void>;\n onRowClick?: (row: TData) => void;\n rowHeight?: number;\n renderCellContextMenu?: (\n row: TData,\n cell: Cell<TData, unknown>,\n ) => React.ReactNode;\n className?: string;\n}\n\nexport function BaseTable<TData extends RowData>(\n {\n table,\n isLoading,\n fetchNextPage,\n onRowClick,\n rowHeight,\n renderCellContextMenu,\n className,\n }: BaseTableProps<TData>,\n): ReactElement {\n const tableContainerRef = useRef<HTMLDivElement>(null);\n\n // Using a ref to prevent duplicate fetches from rapid scroll events while a fetch is in-flight\n const fetchingRef = useRef(false);\n\n const fetchMoreOnEndReached = useCallback(\n async (containerRefElement?: HTMLDivElement | null) => {\n if (containerRefElement && !fetchingRef.current) {\n const { scrollHeight, scrollTop, clientHeight } = containerRefElement;\n if (\n scrollHeight - scrollTop - clientHeight < 100\n && !isLoading\n ) {\n fetchingRef.current = true;\n try {\n await fetchNextPage?.();\n } finally {\n fetchingRef.current = false;\n }\n }\n }\n },\n [fetchNextPage, isLoading],\n );\n\n const handleScroll = useCallback(\n async (e: React.UIEvent<HTMLDivElement>) => {\n await fetchMoreOnEndReached(e.currentTarget);\n },\n [fetchMoreOnEndReached],\n );\n\n // TODO: Handle error, loading and empty states\n\n return (\n <div\n ref={tableContainerRef}\n className={classNames(styles.osdkTableContainer, className)}\n onScroll={handleScroll}\n >\n <table>\n <TableHeader table={table} />\n <TableBody\n rows={table.getRowModel().rows}\n tableContainerRef={tableContainerRef}\n onRowClick={onRowClick}\n rowHeight={rowHeight}\n renderCellContextMenu={renderCellContextMenu}\n />\n </table>\n </div>\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,OAAOA,UAAU,MAAM,YAAY;AACnC,OAAOC,KAAK,IAAuBC,WAAW,EAAEC,MAAM,QAAQ,OAAO;AACrE,OAAOC,MAAM,MAAM,oBAAoB;AACvC,SAASC,SAAS,QAAQ,gBAAgB;AAC1C,SAASC,WAAW,QAAQ,kBAAkB;AAe9C,OAAO,SAASC,SAASA,CACvB;EACEC,KAAK;EACLC,SAAS;EACTC,aAAa;EACbC,UAAU;EACVC,SAAS;EACTC,qBAAqB;EACrBC;AACqB,CAAC,EACV;EACd,MAAMC,iBAAiB,GAAGZ,MAAM,CAAiB,IAAI,CAAC;;EAEtD;EACA,MAAMa,WAAW,GAAGb,MAAM,CAAC,KAAK,CAAC;EAEjC,MAAMc,qBAAqB,GAAGf,WAAW,CACvC,MAAOgB,mBAA2C,IAAK;IACrD,IAAIA,mBAAmB,IAAI,CAACF,WAAW,CAACG,OAAO,EAAE;MAC/C,MAAM;QAAEC,YAAY;QAAEC,SAAS;QAAEC;MAAa,CAAC,GAAGJ,mBAAmB;MACrE,IACEE,YAAY,GAAGC,SAAS,GAAGC,YAAY,GAAG,GAAG,IAC1C,CAACb,SAAS,EACb;QACAO,WAAW,CAACG,OAAO,GAAG,IAAI;QAC1B,IAAI;UACF,MAAMT,aAAa,GAAG,CAAC;QACzB,CAAC,SAAS;UACRM,WAAW,CAACG,OAAO,GAAG,KAAK;QAC7B;MACF;IACF;EACF,CAAC,EACD,CAACT,aAAa,EAAED,SAAS,CAC3B,CAAC;EAED,MAAMc,YAAY,GAAGrB,WAAW,CAC9B,MAAOsB,CAAgC,IAAK;IAC1C,MAAMP,qBAAqB,CAACO,CAAC,CAACC,aAAa,CAAC;EAC9C,CAAC,EACD,CAACR,qBAAqB,CACxB,CAAC;;EAED;;EAEA,oBACEhB,KAAA,CAAAyB,aAAA;IACEC,GAAG,EAAEZ,iBAAkB;IACvBD,SAAS,EAAEd,UAAU,CAACI,MAAM,CAACwB,kBAAkB,EAAEd,SAAS,CAAE;IAC5De,QAAQ,EAAEN;EAAa,gBAEvBtB,KAAA,CAAAyB,aAAA,6BACEzB,KAAA,CAAAyB,aAAA,CAACpB,WAAW;IAACE,KAAK,EAAEA;EAAM,CAAE,CAAC,eAC7BP,KAAA,CAAAyB,aAAA,CAACrB,SAAS;IACRyB,IAAI,EAAEtB,KAAK,CAACuB,WAAW,CAAC,CAAC,CAACD,IAAK;IAC/Bf,iBAAiB,EAAEA,iBAAkB;IACrCJ,UAAU,EAAEA,UAAW;IACvBC,SAAS,EAAEA,SAAU;IACrBC,qBAAqB,EAAEA;EAAsB,CAC9C,CACI,CACJ,CAAC;AAEV","ignoreList":[]}
1
+ {"version":3,"file":"Table.js","names":["classNames","React","useCallback","useEffect","useRef","useState","LoadingStateTable","NonIdealState","styles","TableBody","TableHeader","BaseTable","table","isLoading","fetchNextPage","onRowClick","rowHeight","renderCellContextMenu","className","error","tableContainerRef","isLoadingMore","setIsLoadingMore","fetchingRef","fetchMoreOnEndReached","containerRefElement","current","scrollHeight","scrollTop","clientHeight","handleScroll","e","currentTarget","rows","getRowModel","headerGroups","getHeaderGroups","hasData","length","createElement","ref","osdkTableContainer","onScroll","Fragment","message"],"sources":["Table.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, RowData, Table } from \"@tanstack/react-table\";\nimport classNames from \"classnames\";\nimport React, {\n type ReactElement,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport { LoadingStateTable } from \"./LoadingStateTable.js\";\nimport { NonIdealState } from \"./NonIdealState.js\";\nimport styles from \"./Table.module.css\";\nimport { TableBody } from \"./TableBody.js\";\nimport { TableHeader } from \"./TableHeader.js\";\n\nexport interface BaseTableProps<TData extends RowData> {\n table: Table<TData>;\n isLoading?: boolean;\n fetchNextPage?: () => Promise<void>;\n onRowClick?: (row: TData) => void;\n rowHeight?: number;\n renderCellContextMenu?: (\n row: TData,\n cell: Cell<TData, unknown>,\n ) => React.ReactNode;\n className?: string;\n error?: Error;\n}\n\nexport function BaseTable<TData extends RowData>(\n {\n table,\n isLoading,\n fetchNextPage,\n onRowClick,\n rowHeight,\n renderCellContextMenu,\n className,\n error,\n }: BaseTableProps<TData>,\n): ReactElement {\n const tableContainerRef = useRef<HTMLDivElement>(null);\n const [isLoadingMore, setIsLoadingMore] = useState(false);\n\n // Using a ref to prevent duplicate fetches from rapid scroll events while a fetch is in-flight\n const fetchingRef = useRef(false);\n\n useEffect(() => {\n if (!isLoading || fetchNextPage == null) {\n setIsLoadingMore(false);\n }\n }, [isLoading, fetchNextPage]);\n\n const fetchMoreOnEndReached = useCallback(\n async (containerRefElement?: HTMLDivElement | null) => {\n if (containerRefElement && !fetchingRef.current && !isLoadingMore) {\n const { scrollHeight, scrollTop, clientHeight } = containerRefElement;\n if (\n scrollHeight - scrollTop - clientHeight < 100\n && !isLoading && fetchNextPage != null\n ) {\n fetchingRef.current = true;\n setIsLoadingMore(true);\n try {\n await fetchNextPage();\n } finally {\n fetchingRef.current = false;\n }\n }\n }\n },\n [fetchNextPage, isLoading, isLoadingMore],\n );\n\n const handleScroll = useCallback(\n async (e: React.UIEvent<HTMLDivElement>) => {\n await fetchMoreOnEndReached(e.currentTarget);\n },\n [fetchMoreOnEndReached],\n );\n\n const rows = table.getRowModel().rows;\n const headerGroups = table.getHeaderGroups();\n const hasData = rows.length > 0;\n\n return (\n <div\n ref={tableContainerRef}\n className={classNames(styles.osdkTableContainer, className)}\n onScroll={handleScroll}\n >\n <table>\n {isLoading && !hasData\n ? (\n <LoadingStateTable\n table={table}\n headerGroups={headerGroups}\n rowHeight={rowHeight}\n tableContainerRef={tableContainerRef}\n />\n )\n : (\n <>\n <TableHeader table={table} />\n {!hasData && error == null\n ? <NonIdealState message={\"No Data\"} />\n : (\n <TableBody\n rows={rows}\n tableContainerRef={tableContainerRef}\n onRowClick={onRowClick}\n rowHeight={rowHeight}\n renderCellContextMenu={renderCellContextMenu}\n isLoadingMore={isLoadingMore}\n headerGroups={headerGroups}\n />\n )}\n </>\n )}\n {error != null && (\n <NonIdealState message={`Error Loading Data: ${error.message}`} />\n )}\n </table>\n </div>\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,OAAOA,UAAU,MAAM,YAAY;AACnC,OAAOC,KAAK,IAEVC,WAAW,EACXC,SAAS,EACTC,MAAM,EACNC,QAAQ,QACH,OAAO;AACd,SAASC,iBAAiB,QAAQ,wBAAwB;AAC1D,SAASC,aAAa,QAAQ,oBAAoB;AAClD,OAAOC,MAAM,MAAM,oBAAoB;AACvC,SAASC,SAAS,QAAQ,gBAAgB;AAC1C,SAASC,WAAW,QAAQ,kBAAkB;AAgB9C,OAAO,SAASC,SAASA,CACvB;EACEC,KAAK;EACLC,SAAS;EACTC,aAAa;EACbC,UAAU;EACVC,SAAS;EACTC,qBAAqB;EACrBC,SAAS;EACTC;AACqB,CAAC,EACV;EACd,MAAMC,iBAAiB,GAAGhB,MAAM,CAAiB,IAAI,CAAC;EACtD,MAAM,CAACiB,aAAa,EAAEC,gBAAgB,CAAC,GAAGjB,QAAQ,CAAC,KAAK,CAAC;;EAEzD;EACA,MAAMkB,WAAW,GAAGnB,MAAM,CAAC,KAAK,CAAC;EAEjCD,SAAS,CAAC,MAAM;IACd,IAAI,CAACU,SAAS,IAAIC,aAAa,IAAI,IAAI,EAAE;MACvCQ,gBAAgB,CAAC,KAAK,CAAC;IACzB;EACF,CAAC,EAAE,CAACT,SAAS,EAAEC,aAAa,CAAC,CAAC;EAE9B,MAAMU,qBAAqB,GAAGtB,WAAW,CACvC,MAAOuB,mBAA2C,IAAK;IACrD,IAAIA,mBAAmB,IAAI,CAACF,WAAW,CAACG,OAAO,IAAI,CAACL,aAAa,EAAE;MACjE,MAAM;QAAEM,YAAY;QAAEC,SAAS;QAAEC;MAAa,CAAC,GAAGJ,mBAAmB;MACrE,IACEE,YAAY,GAAGC,SAAS,GAAGC,YAAY,GAAG,GAAG,IAC1C,CAAChB,SAAS,IAAIC,aAAa,IAAI,IAAI,EACtC;QACAS,WAAW,CAACG,OAAO,GAAG,IAAI;QAC1BJ,gBAAgB,CAAC,IAAI,CAAC;QACtB,IAAI;UACF,MAAMR,aAAa,CAAC,CAAC;QACvB,CAAC,SAAS;UACRS,WAAW,CAACG,OAAO,GAAG,KAAK;QAC7B;MACF;IACF;EACF,CAAC,EACD,CAACZ,aAAa,EAAED,SAAS,EAAEQ,aAAa,CAC1C,CAAC;EAED,MAAMS,YAAY,GAAG5B,WAAW,CAC9B,MAAO6B,CAAgC,IAAK;IAC1C,MAAMP,qBAAqB,CAACO,CAAC,CAACC,aAAa,CAAC;EAC9C,CAAC,EACD,CAACR,qBAAqB,CACxB,CAAC;EAED,MAAMS,IAAI,GAAGrB,KAAK,CAACsB,WAAW,CAAC,CAAC,CAACD,IAAI;EACrC,MAAME,YAAY,GAAGvB,KAAK,CAACwB,eAAe,CAAC,CAAC;EAC5C,MAAMC,OAAO,GAAGJ,IAAI,CAACK,MAAM,GAAG,CAAC;EAE/B,oBACErC,KAAA,CAAAsC,aAAA;IACEC,GAAG,EAAEpB,iBAAkB;IACvBF,SAAS,EAAElB,UAAU,CAACQ,MAAM,CAACiC,kBAAkB,EAAEvB,SAAS,CAAE;IAC5DwB,QAAQ,EAAEZ;EAAa,gBAEvB7B,KAAA,CAAAsC,aAAA,gBACG1B,SAAS,IAAI,CAACwB,OAAO,gBAElBpC,KAAA,CAAAsC,aAAA,CAACjC,iBAAiB;IAChBM,KAAK,EAAEA,KAAM;IACbuB,YAAY,EAAEA,YAAa;IAC3BnB,SAAS,EAAEA,SAAU;IACrBI,iBAAiB,EAAEA;EAAkB,CACtC,CAAC,gBAGFnB,KAAA,CAAAsC,aAAA,CAAAtC,KAAA,CAAA0C,QAAA,qBACE1C,KAAA,CAAAsC,aAAA,CAAC7B,WAAW;IAACE,KAAK,EAAEA;EAAM,CAAE,CAAC,EAC5B,CAACyB,OAAO,IAAIlB,KAAK,IAAI,IAAI,gBACtBlB,KAAA,CAAAsC,aAAA,CAAChC,aAAa;IAACqC,OAAO,EAAE;EAAU,CAAE,CAAC,gBAErC3C,KAAA,CAAAsC,aAAA,CAAC9B,SAAS;IACRwB,IAAI,EAAEA,IAAK;IACXb,iBAAiB,EAAEA,iBAAkB;IACrCL,UAAU,EAAEA,UAAW;IACvBC,SAAS,EAAEA,SAAU;IACrBC,qBAAqB,EAAEA,qBAAsB;IAC7CI,aAAa,EAAEA,aAAc;IAC7Bc,YAAY,EAAEA;EAAa,CAC5B,CAEL,CACH,EACFhB,KAAK,IAAI,IAAI,iBACZlB,KAAA,CAAAsC,aAAA,CAAChC,aAAa;IAACqC,OAAO,EAAE,uBAAuBzB,KAAK,CAACyB,OAAO;EAAG,CAAE,CAE9D,CACJ,CAAC;AAEV","ignoreList":[]}
@@ -1,56 +1,291 @@
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
-
1
+ // build/browser/object-table/TableBody.js
17
2
  import { useVirtualizer } from "@tanstack/react-virtual";
18
- import React, { useLayoutEffect } from "react";
19
- import styles from "./TableBody.module.css";
20
- import { TableRow } from "./TableRow.js";
21
- export function TableBody({
3
+ import React6, { useLayoutEffect } from "react";
4
+
5
+ // build/browser/object-table/LoadingRow.js
6
+ import React2 from "react";
7
+ import classNames from "classnames";
8
+ import React from "react";
9
+ var css = '/*\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\n.osdkLoadingCell {\n height: var(--osdk-table-cell-fontSize);\n border-radius: calc(var(--osdk-surface-border-radius) * 0.5);\n flex: 1;\n}\n\n/* Blueprint skeleton animation keyframes */\n@keyframes skeleton-glow {\n from {\n background: var(--osdk-table-skeleton-color-from);\n border-color: var(--osdk-table-skeleton-color-from);\n }\n\n to {\n background: var(--osdk-table-skeleton-color-to);\n border-color: var(--osdk-table-skeleton-color-to);\n }\n}\n\n.osdkCellSkeleton {\n animation: 1000ms linear infinite alternate skeleton-glow;\n background: var(--osdk-table-skeleton-color-from);\n background-clip: padding-box;\n border-color: var(--osdk-table-skeleton-color-from);\n border-radius: calc(var(--osdk-surface-border-radius) * 0.5);\n border: 1px solid var(--osdk-table-skeleton-border-color);\n box-shadow: none;\n color: transparent;\n cursor: default;\n pointer-events: none;\n user-select: none;\n}\n';
10
+ if (typeof document !== "undefined") {
11
+ const style = document.createElement("style");
12
+ style.textContent = css;
13
+ document.head.appendChild(style);
14
+ }
15
+ var LoadingCell_default = { "osdkLoadingCell": "osdkLoadingCell", "osdkCellSkeleton": "osdkCellSkeleton" };
16
+ var css2 = '/*\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\n.osdkTableCell {\n display: flex;\n align-items: center;\n text-align: left;\n position: relative;\n padding: var(--osdk-table-cell-padding);\n font-size: var(--osdk-table-cell-fontSize);\n color: var(--osdk-table-cell-color);\n background-color: inherit;\n border-right: var(--osdk-table-cell-divider);\n\n &:first-child {\n border-left: var(--osdk-table-border);\n }\n\n &:last-child {\n border-right: var(--osdk-table-border);\n }\n}\n\n.osdkTableCell[data-pinned="left"],\n.osdkTableCell[data-pinned="right"] {\n position: sticky;\n z-index: var(--osdk-surface-z-index-1);\n}\n\n/* Last left-pinned column - no left-pinned siblings after it */\n.osdkTableCell[data-pinned="left"]:not(:has(~ [data-pinned="left"])) {\n border-right: var(--osdk-table-pinned-column-border);\n}\n\n/* First right-pinned column - no right-pinned siblings before it */\n.osdkTableCell[data-pinned="right"]:not(:has(~ [data-pinned="right"]):nth-child(n+2)) {\n border-left: var(--osdk-table-pinned-column-border);\n}\n\n.osdkTableCell:has([role="checkbox"]) {\n justify-content: center;\n}\n\n.osdkTableCellContent:not(:has([role="checkbox"])) {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n text-align: left;\n}\n';
17
+ if (typeof document !== "undefined") {
18
+ const style = document.createElement("style");
19
+ style.textContent = css2;
20
+ document.head.appendChild(style);
21
+ }
22
+ var TableCell_default = { "osdkTableCell": "osdkTableCell", "osdkTableCellContent": "osdkTableCellContent" };
23
+ function LoadingCell({
24
+ width
25
+ }) {
26
+ return /* @__PURE__ */ React.createElement("td", {
27
+ className: TableCell_default.osdkTableCell,
28
+ style: {
29
+ width
30
+ }
31
+ }, /* @__PURE__ */ React.createElement("div", {
32
+ className: classNames(LoadingCell_default.osdkLoadingCell, LoadingCell_default.osdkCellSkeleton)
33
+ }));
34
+ }
35
+ var css3 = '/*\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\n.osdkTableRow {\n position: absolute;\n display: flex;\n background-color: var(--osdk-table-row-bg-default);\n border-top: var(--osdk-table-row-divider);\n border-bottom: var(--osdk-table-border-width) solid transparent;\n\n &:last-child {\n border-bottom: var(--osdk-table-border);\n }\n\n /* Zebra rows */\n &:nth-child(even) {\n background-color: var(\n --osdk-table-row-bg-alternate,\n var(--osdk-table-row-bg-default)\n );\n }\n\n &:hover {\n z-index: 1;\n background-color: var(\n --osdk-table-row-bg-hover,\n var(--osdk-surface-background-color-default-hover)\n );\n border-top-color: var(--osdk-table-row-border-color-hover);\n border-bottom-color: var(--osdk-table-row-border-color-hover);\n }\n\n &[data-selected="true"] {\n z-index: 2;\n background-color: var(--osdk-table-row-bg-active);\n border-top-color: var(--osdk-table-row-border-color-active);\n border-bottom-color: var(--osdk-table-row-border-color-active);\n }\n\n &[data-selected="true"] + &[data-selected="true"] {\n border-top-color: transparent;\n }\n\n &[data-selected="true"]:has(+ &[data-selected="true"]) {\n border-bottom-color: transparent;\n }\n}\n';
36
+ if (typeof document !== "undefined") {
37
+ const style = document.createElement("style");
38
+ style.textContent = css3;
39
+ document.head.appendChild(style);
40
+ }
41
+ var TableRow_default = { "osdkTableRow": "osdkTableRow" };
42
+ function LoadingRow({
43
+ headers,
44
+ columnCount,
45
+ translateY,
46
+ rowHeight = 40,
47
+ columnWidth = 80
48
+ }) {
49
+ return /* @__PURE__ */ React2.createElement("tr", {
50
+ className: TableRow_default.osdkTableRow,
51
+ style: {
52
+ height: `${rowHeight}px`,
53
+ transform: `translateY(${translateY}px)`
54
+ }
55
+ }, /* @__PURE__ */ React2.createElement(React2.Fragment, null, Array.from({
56
+ length: columnCount
57
+ }).map((_, index) => {
58
+ const width = headers.length > index ? headers[index].getSize() : columnWidth;
59
+ return /* @__PURE__ */ React2.createElement(LoadingCell, {
60
+ key: `loading-cell-${index}`,
61
+ width
62
+ });
63
+ })));
64
+ }
65
+
66
+ // build/browser/object-table/TableBody.module.css
67
+ var css4 = '/*\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\n.osdkTableBody {\n display: grid;\n position: relative;\n}\n';
68
+ if (typeof document !== "undefined") {
69
+ const style = document.createElement("style");
70
+ style.textContent = css4;
71
+ document.head.appendChild(style);
72
+ }
73
+ var TableBody_default = { "osdkTableBody": "osdkTableBody" };
74
+
75
+ // build/browser/object-table/TableRow.js
76
+ import React5, { useCallback as useCallback2 } from "react";
77
+
78
+ // build/browser/object-table/TableCell.js
79
+ import { flexRender } from "@tanstack/react-table";
80
+ import React4, { useRef as useRef2 } from "react";
81
+
82
+ // build/browser/object-table/CellContextMenu.js
83
+ import React3, { useEffect, useRef } from "react";
84
+ import { createPortal } from "react-dom";
85
+ var css5 = '/*\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\n.osdkCellContextMenu {\n position: fixed;\n z-index: var(--osdk-surface-z-index-2);\n}\n';
86
+ if (typeof document !== "undefined") {
87
+ const style = document.createElement("style");
88
+ style.textContent = css5;
89
+ document.head.appendChild(style);
90
+ }
91
+ var CellContextMenu_default = { "osdkCellContextMenu": "osdkCellContextMenu" };
92
+ function CellContextMenu({
93
+ cell,
94
+ position,
95
+ onClose,
96
+ renderContent
97
+ }) {
98
+ const ref = useRef(null);
99
+ useEffect(() => {
100
+ const handleClickOutside = (event) => {
101
+ if (ref.current && !ref.current.contains(event.target)) {
102
+ onClose();
103
+ }
104
+ };
105
+ document.addEventListener("mousedown", handleClickOutside);
106
+ return () => {
107
+ document.removeEventListener("mousedown", handleClickOutside);
108
+ };
109
+ }, [onClose]);
110
+ return /* @__PURE__ */ createPortal(/* @__PURE__ */ React3.createElement("div", {
111
+ ref,
112
+ className: CellContextMenu_default.osdkCellContextMenu,
113
+ style: {
114
+ left: position.left,
115
+ top: position.top,
116
+ minWidth: position.width
117
+ }
118
+ }, renderContent(cell.row.original, cell)), document.body);
119
+ }
120
+
121
+ // build/browser/object-table/hooks/useCellContextMenu.js
122
+ import { useCallback, useState } from "react";
123
+ var useCellContextMenu = ({
124
+ tdRef
125
+ }) => {
126
+ const [popoverPosition, setPopoverPosition] = useState(null);
127
+ const [isContextMenuOpen, setIsContextMenuOpen] = useState(false);
128
+ const handleOpenContextMenu = useCallback((event) => {
129
+ event.preventDefault();
130
+ event.stopPropagation();
131
+ if (tdRef.current) {
132
+ const rect = tdRef.current.getBoundingClientRect();
133
+ const position = {
134
+ left: rect.left,
135
+ top: rect.bottom,
136
+ width: rect.width
137
+ };
138
+ setPopoverPosition(position);
139
+ setIsContextMenuOpen(true);
140
+ }
141
+ }, [tdRef]);
142
+ const handleCloseContextMenu = useCallback(() => {
143
+ setIsContextMenuOpen(false);
144
+ setPopoverPosition(null);
145
+ }, []);
146
+ return {
147
+ isContextMenuOpen,
148
+ handleOpenContextMenu,
149
+ handleCloseContextMenu,
150
+ popoverPosition
151
+ };
152
+ };
153
+
154
+ // build/browser/object-table/TableCell.module.css
155
+ var css6 = '/*\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\n.osdkTableCell {\n display: flex;\n align-items: center;\n text-align: left;\n position: relative;\n padding: var(--osdk-table-cell-padding);\n font-size: var(--osdk-table-cell-fontSize);\n color: var(--osdk-table-cell-color);\n background-color: inherit;\n border-right: var(--osdk-table-cell-divider);\n\n &:first-child {\n border-left: var(--osdk-table-border);\n }\n\n &:last-child {\n border-right: var(--osdk-table-border);\n }\n}\n\n.osdkTableCell[data-pinned="left"],\n.osdkTableCell[data-pinned="right"] {\n position: sticky;\n z-index: var(--osdk-surface-z-index-1);\n}\n\n/* Last left-pinned column - no left-pinned siblings after it */\n.osdkTableCell[data-pinned="left"]:not(:has(~ [data-pinned="left"])) {\n border-right: var(--osdk-table-pinned-column-border);\n}\n\n/* First right-pinned column - no right-pinned siblings before it */\n.osdkTableCell[data-pinned="right"]:not(:has(~ [data-pinned="right"]):nth-child(n+2)) {\n border-left: var(--osdk-table-pinned-column-border);\n}\n\n.osdkTableCell:has([role="checkbox"]) {\n justify-content: center;\n}\n\n.osdkTableCellContent:not(:has([role="checkbox"])) {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n text-align: left;\n}\n';
156
+ if (typeof document !== "undefined") {
157
+ const style = document.createElement("style");
158
+ style.textContent = css6;
159
+ document.head.appendChild(style);
160
+ }
161
+ var TableCell_default2 = { "osdkTableCell": "osdkTableCell", "osdkTableCellContent": "osdkTableCellContent" };
162
+
163
+ // build/browser/object-table/utils/constants.js
164
+ var SELECTION_COLUMN_ID = "__selection__";
165
+
166
+ // build/browser/object-table/utils/getColumnPinningStyles.js
167
+ function getColumnPinningStyles(column) {
168
+ const isPinned = column.getIsPinned();
169
+ return {
170
+ columnStyles: {
171
+ left: isPinned === "left" ? `${column.getStart("left")}px` : void 0,
172
+ right: isPinned === "right" ? `${column.getAfter("right")}px` : void 0,
173
+ width: column.getSize()
174
+ }
175
+ };
176
+ }
177
+
178
+ // build/browser/object-table/TableCell.js
179
+ function TableCell({
180
+ cell,
181
+ renderCellContextMenu
182
+ }) {
183
+ const tdRef = useRef2(null);
184
+ const isSelectColumn = cell.column.id === SELECTION_COLUMN_ID;
185
+ const {
186
+ isContextMenuOpen,
187
+ handleOpenContextMenu,
188
+ handleCloseContextMenu,
189
+ popoverPosition
190
+ } = useCellContextMenu({
191
+ tdRef
192
+ });
193
+ const {
194
+ columnStyles
195
+ } = getColumnPinningStyles(cell.column);
196
+ return /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement("td", {
197
+ ref: tdRef,
198
+ "data-pinned": cell.column.getIsPinned(),
199
+ className: TableCell_default2.osdkTableCell,
200
+ style: columnStyles,
201
+ onContextMenu: handleOpenContextMenu
202
+ }, /* @__PURE__ */ React4.createElement("div", {
203
+ className: TableCell_default2.osdkTableCellContent
204
+ }, flexRender(cell.column.columnDef.cell, cell.getContext()))), !isSelectColumn && isContextMenuOpen && !!popoverPosition && !!renderCellContextMenu && /* @__PURE__ */ React4.createElement(CellContextMenu, {
205
+ cell,
206
+ position: popoverPosition,
207
+ onClose: handleCloseContextMenu,
208
+ renderContent: renderCellContextMenu
209
+ }));
210
+ }
211
+
212
+ // build/browser/object-table/TableRow.module.css
213
+ var css7 = '/*\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\n.osdkTableRow {\n position: absolute;\n display: flex;\n background-color: var(--osdk-table-row-bg-default);\n border-top: var(--osdk-table-row-divider);\n border-bottom: var(--osdk-table-border-width) solid transparent;\n\n &:last-child {\n border-bottom: var(--osdk-table-border);\n }\n\n /* Zebra rows */\n &:nth-child(even) {\n background-color: var(\n --osdk-table-row-bg-alternate,\n var(--osdk-table-row-bg-default)\n );\n }\n\n &:hover {\n z-index: 1;\n background-color: var(\n --osdk-table-row-bg-hover,\n var(--osdk-surface-background-color-default-hover)\n );\n border-top-color: var(--osdk-table-row-border-color-hover);\n border-bottom-color: var(--osdk-table-row-border-color-hover);\n }\n\n &[data-selected="true"] {\n z-index: 2;\n background-color: var(--osdk-table-row-bg-active);\n border-top-color: var(--osdk-table-row-border-color-active);\n border-bottom-color: var(--osdk-table-row-border-color-active);\n }\n\n &[data-selected="true"] + &[data-selected="true"] {\n border-top-color: transparent;\n }\n\n &[data-selected="true"]:has(+ &[data-selected="true"]) {\n border-bottom-color: transparent;\n }\n}\n';
214
+ if (typeof document !== "undefined") {
215
+ const style = document.createElement("style");
216
+ style.textContent = css7;
217
+ document.head.appendChild(style);
218
+ }
219
+ var TableRow_default2 = { "osdkTableRow": "osdkTableRow" };
220
+
221
+ // build/browser/object-table/TableRow.js
222
+ function TableRow({
223
+ row,
224
+ virtualRow,
225
+ onRowClick,
226
+ renderCellContextMenu
227
+ }) {
228
+ const handleClick = useCallback2(() => {
229
+ onRowClick?.(row.original);
230
+ }, [onRowClick, row.original]);
231
+ return /* @__PURE__ */ React5.createElement("tr", {
232
+ "data-selected": row.getIsSelected(),
233
+ className: TableRow_default2.osdkTableRow,
234
+ style: {
235
+ height: `${virtualRow.size}px`,
236
+ transform: `translateY(${virtualRow.start}px)`
237
+ },
238
+ onClick: handleClick
239
+ }, row.getVisibleCells().map((cell) => /* @__PURE__ */ React5.createElement(TableCell, {
240
+ key: cell.id,
241
+ cell,
242
+ renderCellContextMenu
243
+ })));
244
+ }
245
+
246
+ // build/browser/object-table/TableBody.js
247
+ function TableBody({
22
248
  rows,
23
249
  tableContainerRef,
24
250
  onRowClick,
25
251
  renderCellContextMenu,
26
- rowHeight = 40
252
+ rowHeight = 40,
253
+ isLoadingMore = false,
254
+ headerGroups = []
27
255
  }) {
28
- // Important: Keep the row virtualizer in the lowest component possible to avoid unnecessary re-renders.
29
256
  const rowVirtualizer = useVirtualizer({
30
257
  count: rows.length,
31
258
  estimateSize: () => rowHeight,
32
259
  getScrollElement: () => tableContainerRef.current,
33
260
  overscan: 5
34
261
  });
35
-
36
- // Measure the virtualizer after the DOM has been laid out to ensure proper dimensions
37
262
  useLayoutEffect(() => {
38
263
  rowVirtualizer.measure();
39
264
  }, [rowVirtualizer, rows.length]);
40
- return /*#__PURE__*/React.createElement("tbody", {
41
- className: styles.osdkTableBody,
265
+ const totalSize = rowVirtualizer.getTotalSize();
266
+ const bodyHeight = isLoadingMore ? totalSize + rowHeight : totalSize;
267
+ const headers = headerGroups[0]?.headers ?? [];
268
+ return /* @__PURE__ */ React6.createElement("tbody", {
269
+ className: TableBody_default.osdkTableBody,
42
270
  style: {
43
- height: `${rowVirtualizer.getTotalSize()}px`
271
+ height: `${bodyHeight}px`
44
272
  }
45
- }, rowVirtualizer.getVirtualItems().map(virtualRow => {
273
+ }, rowVirtualizer.getVirtualItems().map((virtualRow) => {
46
274
  const row = rows[virtualRow.index];
47
- return /*#__PURE__*/React.createElement(TableRow, {
275
+ return /* @__PURE__ */ React6.createElement(TableRow, {
48
276
  key: row.id,
49
- row: row,
50
- virtualRow: virtualRow,
51
- onRowClick: onRowClick,
52
- renderCellContextMenu: renderCellContextMenu
277
+ row,
278
+ virtualRow,
279
+ onRowClick,
280
+ renderCellContextMenu
53
281
  });
282
+ }), isLoadingMore && /* @__PURE__ */ React6.createElement(LoadingRow, {
283
+ headers,
284
+ translateY: totalSize,
285
+ rowHeight,
286
+ columnCount: headers.length
54
287
  }));
55
288
  }
56
- //# sourceMappingURL=TableBody.js.map
289
+ export {
290
+ TableBody
291
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"TableBody.js","names":["useVirtualizer","React","useLayoutEffect","styles","TableRow","TableBody","rows","tableContainerRef","onRowClick","renderCellContextMenu","rowHeight","rowVirtualizer","count","length","estimateSize","getScrollElement","current","overscan","measure","createElement","className","osdkTableBody","style","height","getTotalSize","getVirtualItems","map","virtualRow","row","index","key","id"],"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, Row, RowData } from \"@tanstack/react-table\";\nimport { useVirtualizer } from \"@tanstack/react-virtual\";\nimport React, { useLayoutEffect } from \"react\";\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}\n\nexport function TableBody<TData extends RowData>({\n rows,\n tableContainerRef,\n onRowClick,\n renderCellContextMenu,\n rowHeight = 40,\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 return (\n <tbody\n className={styles.osdkTableBody}\n style={{\n height: `${rowVirtualizer.getTotalSize()}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 </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,OAAOC,MAAM,MAAM,wBAAwB;AAC3C,SAASC,QAAQ,QAAQ,eAAe;AAaxC,OAAO,SAASC,SAASA,CAAwB;EAC/CC,IAAI;EACJC,iBAAiB;EACjBC,UAAU;EACVC,qBAAqB;EACrBC,SAAS,GAAG;AACS,CAAC,EAAsB;EAC5C;EACA,MAAMC,cAAc,GAAGX,cAAc,CAAsC;IACzEY,KAAK,EAAEN,IAAI,CAACO,MAAM;IAClBC,YAAY,EAAEA,CAAA,KAAMJ,SAAS;IAC7BK,gBAAgB,EAAEA,CAAA,KAAMR,iBAAiB,CAACS,OAAO;IACjDC,QAAQ,EAAE;EACZ,CAAC,CAAC;;EAEF;EACAf,eAAe,CAAC,MAAM;IACpBS,cAAc,CAACO,OAAO,CAAC,CAAC;EAC1B,CAAC,EAAE,CAACP,cAAc,EAAEL,IAAI,CAACO,MAAM,CAAC,CAAC;EAEjC,oBACEZ,KAAA,CAAAkB,aAAA;IACEC,SAAS,EAAEjB,MAAM,CAACkB,aAAc;IAChCC,KAAK,EAAE;MACLC,MAAM,EAAE,GAAGZ,cAAc,CAACa,YAAY,CAAC,CAAC;IAC1C;EAAE,GAEDb,cAAc,CAACc,eAAe,CAAC,CAAC,CAACC,GAAG,CAAEC,UAAU,IAAK;IACpD,MAAMC,GAAG,GAAGtB,IAAI,CAACqB,UAAU,CAACE,KAAK,CAAC;IAElC,oBACE5B,KAAA,CAAAkB,aAAA,CAACf,QAAQ;MACP0B,GAAG,EAAEF,GAAG,CAACG,EAAG;MACZH,GAAG,EAAEA,GAAI;MACTD,UAAU,EAAEA,UAAW;MACvBnB,UAAU,EAAEA,UAAW;MACvBC,qBAAqB,EAAEA;IAAsB,CAC9C,CAAC;EAEN,CAAC,CACI,CAAC;AAEZ","ignoreList":[]}
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,31 +1,109 @@
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
-
1
+ // build/browser/object-table/TableCell.js
17
2
  import { flexRender } from "@tanstack/react-table";
18
- import React, { useRef } from "react";
19
- import { CellContextMenu } from "./CellContextMenu.js";
20
- import { useCellContextMenu } from "./hooks/useCellContextMenu.js";
21
- import styles from "./TableCell.module.css";
22
- import { SELECTION_COLUMN_ID } from "./utils/constants.js";
23
- import { getColumnPinningStyles } from "./utils/getColumnPinningStyles.js";
24
- export function TableCell({
3
+ import React2, { useRef as useRef2 } from "react";
4
+
5
+ // build/browser/object-table/CellContextMenu.js
6
+ import React, { useEffect, useRef } from "react";
7
+ import { createPortal } from "react-dom";
8
+ var css = '/*\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\n.osdkCellContextMenu {\n position: fixed;\n z-index: var(--osdk-surface-z-index-2);\n}\n';
9
+ if (typeof document !== "undefined") {
10
+ const style = document.createElement("style");
11
+ style.textContent = css;
12
+ document.head.appendChild(style);
13
+ }
14
+ var CellContextMenu_default = { "osdkCellContextMenu": "osdkCellContextMenu" };
15
+ function CellContextMenu({
16
+ cell,
17
+ position,
18
+ onClose,
19
+ renderContent
20
+ }) {
21
+ const ref = useRef(null);
22
+ useEffect(() => {
23
+ const handleClickOutside = (event) => {
24
+ if (ref.current && !ref.current.contains(event.target)) {
25
+ onClose();
26
+ }
27
+ };
28
+ document.addEventListener("mousedown", handleClickOutside);
29
+ return () => {
30
+ document.removeEventListener("mousedown", handleClickOutside);
31
+ };
32
+ }, [onClose]);
33
+ return /* @__PURE__ */ createPortal(/* @__PURE__ */ React.createElement("div", {
34
+ ref,
35
+ className: CellContextMenu_default.osdkCellContextMenu,
36
+ style: {
37
+ left: position.left,
38
+ top: position.top,
39
+ minWidth: position.width
40
+ }
41
+ }, renderContent(cell.row.original, cell)), document.body);
42
+ }
43
+
44
+ // build/browser/object-table/hooks/useCellContextMenu.js
45
+ import { useCallback, useState } from "react";
46
+ var useCellContextMenu = ({
47
+ tdRef
48
+ }) => {
49
+ const [popoverPosition, setPopoverPosition] = useState(null);
50
+ const [isContextMenuOpen, setIsContextMenuOpen] = useState(false);
51
+ const handleOpenContextMenu = useCallback((event) => {
52
+ event.preventDefault();
53
+ event.stopPropagation();
54
+ if (tdRef.current) {
55
+ const rect = tdRef.current.getBoundingClientRect();
56
+ const position = {
57
+ left: rect.left,
58
+ top: rect.bottom,
59
+ width: rect.width
60
+ };
61
+ setPopoverPosition(position);
62
+ setIsContextMenuOpen(true);
63
+ }
64
+ }, [tdRef]);
65
+ const handleCloseContextMenu = useCallback(() => {
66
+ setIsContextMenuOpen(false);
67
+ setPopoverPosition(null);
68
+ }, []);
69
+ return {
70
+ isContextMenuOpen,
71
+ handleOpenContextMenu,
72
+ handleCloseContextMenu,
73
+ popoverPosition
74
+ };
75
+ };
76
+
77
+ // build/browser/object-table/TableCell.module.css
78
+ var css2 = '/*\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\n.osdkTableCell {\n display: flex;\n align-items: center;\n text-align: left;\n position: relative;\n padding: var(--osdk-table-cell-padding);\n font-size: var(--osdk-table-cell-fontSize);\n color: var(--osdk-table-cell-color);\n background-color: inherit;\n border-right: var(--osdk-table-cell-divider);\n\n &:first-child {\n border-left: var(--osdk-table-border);\n }\n\n &:last-child {\n border-right: var(--osdk-table-border);\n }\n}\n\n.osdkTableCell[data-pinned="left"],\n.osdkTableCell[data-pinned="right"] {\n position: sticky;\n z-index: var(--osdk-surface-z-index-1);\n}\n\n/* Last left-pinned column - no left-pinned siblings after it */\n.osdkTableCell[data-pinned="left"]:not(:has(~ [data-pinned="left"])) {\n border-right: var(--osdk-table-pinned-column-border);\n}\n\n/* First right-pinned column - no right-pinned siblings before it */\n.osdkTableCell[data-pinned="right"]:not(:has(~ [data-pinned="right"]):nth-child(n+2)) {\n border-left: var(--osdk-table-pinned-column-border);\n}\n\n.osdkTableCell:has([role="checkbox"]) {\n justify-content: center;\n}\n\n.osdkTableCellContent:not(:has([role="checkbox"])) {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n text-align: left;\n}\n';
79
+ if (typeof document !== "undefined") {
80
+ const style = document.createElement("style");
81
+ style.textContent = css2;
82
+ document.head.appendChild(style);
83
+ }
84
+ var TableCell_default = { "osdkTableCell": "osdkTableCell", "osdkTableCellContent": "osdkTableCellContent" };
85
+
86
+ // build/browser/object-table/utils/constants.js
87
+ var SELECTION_COLUMN_ID = "__selection__";
88
+
89
+ // build/browser/object-table/utils/getColumnPinningStyles.js
90
+ function getColumnPinningStyles(column) {
91
+ const isPinned = column.getIsPinned();
92
+ return {
93
+ columnStyles: {
94
+ left: isPinned === "left" ? `${column.getStart("left")}px` : void 0,
95
+ right: isPinned === "right" ? `${column.getAfter("right")}px` : void 0,
96
+ width: column.getSize()
97
+ }
98
+ };
99
+ }
100
+
101
+ // build/browser/object-table/TableCell.js
102
+ function TableCell({
25
103
  cell,
26
104
  renderCellContextMenu
27
105
  }) {
28
- const tdRef = useRef(null);
106
+ const tdRef = useRef2(null);
29
107
  const isSelectColumn = cell.column.id === SELECTION_COLUMN_ID;
30
108
  const {
31
109
  isContextMenuOpen,
@@ -38,19 +116,21 @@ export function TableCell({
38
116
  const {
39
117
  columnStyles
40
118
  } = getColumnPinningStyles(cell.column);
41
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("td", {
119
+ return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement("td", {
42
120
  ref: tdRef,
43
121
  "data-pinned": cell.column.getIsPinned(),
44
- className: styles.osdkTableCell,
122
+ className: TableCell_default.osdkTableCell,
45
123
  style: columnStyles,
46
124
  onContextMenu: handleOpenContextMenu
47
- }, /*#__PURE__*/React.createElement("div", {
48
- className: styles.osdkTableCellContent
49
- }, flexRender(cell.column.columnDef.cell, cell.getContext()))), !isSelectColumn && isContextMenuOpen && !!popoverPosition && !!renderCellContextMenu && /*#__PURE__*/React.createElement(CellContextMenu, {
50
- cell: cell,
125
+ }, /* @__PURE__ */ React2.createElement("div", {
126
+ className: TableCell_default.osdkTableCellContent
127
+ }, flexRender(cell.column.columnDef.cell, cell.getContext()))), !isSelectColumn && isContextMenuOpen && !!popoverPosition && !!renderCellContextMenu && /* @__PURE__ */ React2.createElement(CellContextMenu, {
128
+ cell,
51
129
  position: popoverPosition,
52
130
  onClose: handleCloseContextMenu,
53
131
  renderContent: renderCellContextMenu
54
132
  }));
55
133
  }
56
- //# sourceMappingURL=TableCell.js.map
134
+ export {
135
+ TableCell
136
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"TableCell.js","names":["flexRender","React","useRef","CellContextMenu","useCellContextMenu","styles","SELECTION_COLUMN_ID","getColumnPinningStyles","TableCell","cell","renderCellContextMenu","tdRef","isSelectColumn","column","id","isContextMenuOpen","handleOpenContextMenu","handleCloseContextMenu","popoverPosition","columnStyles","createElement","Fragment","ref","getIsPinned","className","osdkTableCell","style","onContextMenu","osdkTableCellContent","columnDef","getContext","position","onClose","renderContent"],"sources":["TableCell.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, RowData } from \"@tanstack/react-table\";\nimport { flexRender } from \"@tanstack/react-table\";\nimport type { ReactNode } from \"react\";\nimport React, { useRef } from \"react\";\nimport { CellContextMenu } from \"./CellContextMenu.js\";\nimport { useCellContextMenu } from \"./hooks/useCellContextMenu.js\";\nimport styles from \"./TableCell.module.css\";\nimport { SELECTION_COLUMN_ID } from \"./utils/constants.js\";\nimport { getColumnPinningStyles } from \"./utils/getColumnPinningStyles.js\";\n\ninterface TableCellProps<TData extends RowData> {\n cell: Cell<TData, unknown>;\n renderCellContextMenu?: (\n row: TData,\n cell: Cell<TData, unknown>,\n ) => React.ReactNode;\n}\n\nexport function TableCell<TData extends RowData>(\n { cell, renderCellContextMenu }: TableCellProps<TData>,\n): React.ReactElement {\n const tdRef = useRef<HTMLTableCellElement>(null);\n const isSelectColumn = cell.column.id === SELECTION_COLUMN_ID;\n\n const {\n isContextMenuOpen,\n handleOpenContextMenu,\n handleCloseContextMenu,\n popoverPosition,\n } = useCellContextMenu({\n tdRef,\n });\n\n const shouldRenderContextMenu = !isSelectColumn && isContextMenuOpen\n && !!popoverPosition\n && !!renderCellContextMenu;\n\n const { columnStyles } = getColumnPinningStyles(cell.column);\n\n return (\n <>\n <td\n ref={tdRef}\n data-pinned={cell.column.getIsPinned()}\n className={styles.osdkTableCell}\n style={columnStyles}\n onContextMenu={handleOpenContextMenu}\n >\n <div className={styles.osdkTableCellContent}>\n {flexRender(cell.column.columnDef.cell, cell.getContext()) as\n | ReactNode\n | React.JSX.Element}\n </div>\n </td>\n {shouldRenderContextMenu\n && (\n <CellContextMenu\n cell={cell}\n position={popoverPosition}\n onClose={handleCloseContextMenu}\n renderContent={renderCellContextMenu}\n />\n )}\n </>\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,UAAU,QAAQ,uBAAuB;AAElD,OAAOC,KAAK,IAAIC,MAAM,QAAQ,OAAO;AACrC,SAASC,eAAe,QAAQ,sBAAsB;AACtD,SAASC,kBAAkB,QAAQ,+BAA+B;AAClE,OAAOC,MAAM,MAAM,wBAAwB;AAC3C,SAASC,mBAAmB,QAAQ,sBAAsB;AAC1D,SAASC,sBAAsB,QAAQ,mCAAmC;AAU1E,OAAO,SAASC,SAASA,CACvB;EAAEC,IAAI;EAAEC;AAA6C,CAAC,EAClC;EACpB,MAAMC,KAAK,GAAGT,MAAM,CAAuB,IAAI,CAAC;EAChD,MAAMU,cAAc,GAAGH,IAAI,CAACI,MAAM,CAACC,EAAE,KAAKR,mBAAmB;EAE7D,MAAM;IACJS,iBAAiB;IACjBC,qBAAqB;IACrBC,sBAAsB;IACtBC;EACF,CAAC,GAAGd,kBAAkB,CAAC;IACrBO;EACF,CAAC,CAAC;EAMF,MAAM;IAAEQ;EAAa,CAAC,GAAGZ,sBAAsB,CAACE,IAAI,CAACI,MAAM,CAAC;EAE5D,oBACEZ,KAAA,CAAAmB,aAAA,CAAAnB,KAAA,CAAAoB,QAAA,qBACEpB,KAAA,CAAAmB,aAAA;IACEE,GAAG,EAAEX,KAAM;IACX,eAAaF,IAAI,CAACI,MAAM,CAACU,WAAW,CAAC,CAAE;IACvCC,SAAS,EAAEnB,MAAM,CAACoB,aAAc;IAChCC,KAAK,EAAEP,YAAa;IACpBQ,aAAa,EAAEX;EAAsB,gBAErCf,KAAA,CAAAmB,aAAA;IAAKI,SAAS,EAAEnB,MAAM,CAACuB;EAAqB,GACzC5B,UAAU,CAACS,IAAI,CAACI,MAAM,CAACgB,SAAS,CAACpB,IAAI,EAAEA,IAAI,CAACqB,UAAU,CAAC,CAAC,CAGtD,CACH,CAAC,EApBuB,CAAClB,cAAc,IAAIG,iBAAiB,IAC/D,CAAC,CAACG,eAAe,IACjB,CAAC,CAACR,qBAAqB,iBAqBpBT,KAAA,CAAAmB,aAAA,CAACjB,eAAe;IACdM,IAAI,EAAEA,IAAK;IACXsB,QAAQ,EAAEb,eAAgB;IAC1Bc,OAAO,EAAEf,sBAAuB;IAChCgB,aAAa,EAAEvB;EAAsB,CACtC,CAEL,CAAC;AAEP","ignoreList":[]}
1
+ {"version":3,"file":"TableCell.js","names":["flexRender","React","useRef","CellContextMenu","useCellContextMenu","styles","SELECTION_COLUMN_ID","getColumnPinningStyles","TableCell","cell","renderCellContextMenu","tdRef","isSelectColumn","column","id","isContextMenuOpen","handleOpenContextMenu","handleCloseContextMenu","popoverPosition","columnStyles","createElement","Fragment","ref","getIsPinned","className","osdkTableCell","style","onContextMenu","osdkTableCellContent","columnDef","getContext","position","onClose","renderContent"],"sources":["TableCell.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, RowData } from \"@tanstack/react-table\";\nimport { flexRender } from \"@tanstack/react-table\";\nimport type { ReactNode } from \"react\";\nimport React, { useRef } from \"react\";\nimport { CellContextMenu } from \"./CellContextMenu.js\";\nimport { useCellContextMenu } from \"./hooks/useCellContextMenu.js\";\nimport styles from \"./TableCell.module.css\";\nimport { SELECTION_COLUMN_ID } from \"./utils/constants.js\";\nimport { getColumnPinningStyles } from \"./utils/getColumnPinningStyles.js\";\n\ninterface TableCellProps<TData extends RowData> {\n cell: Cell<TData, unknown>;\n renderCellContextMenu?: (\n row: TData,\n cell: Cell<TData, unknown>,\n ) => React.ReactNode;\n}\n\nexport function TableCell<TData extends RowData>(\n { cell, renderCellContextMenu }: TableCellProps<TData>,\n): React.ReactElement {\n const tdRef = useRef<HTMLTableCellElement>(null);\n const isSelectColumn = cell.column.id === SELECTION_COLUMN_ID;\n\n const {\n isContextMenuOpen,\n handleOpenContextMenu,\n handleCloseContextMenu,\n popoverPosition,\n } = useCellContextMenu({\n tdRef,\n });\n\n const shouldRenderContextMenu = !isSelectColumn && isContextMenuOpen\n && !!popoverPosition\n && !!renderCellContextMenu;\n\n const { columnStyles } = getColumnPinningStyles(cell.column);\n\n return (\n <>\n <td\n ref={tdRef}\n data-pinned={cell.column.getIsPinned()}\n className={styles.osdkTableCell}\n style={columnStyles}\n onContextMenu={handleOpenContextMenu}\n >\n <div className={styles.osdkTableCellContent}>\n {flexRender(\n cell.column.columnDef.cell,\n cell.getContext(),\n ) as ReactNode}\n </div>\n </td>\n {shouldRenderContextMenu\n && (\n <CellContextMenu\n cell={cell}\n position={popoverPosition}\n onClose={handleCloseContextMenu}\n renderContent={renderCellContextMenu}\n />\n )}\n </>\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,UAAU,QAAQ,uBAAuB;AAElD,OAAOC,KAAK,IAAIC,MAAM,QAAQ,OAAO;AACrC,SAASC,eAAe,QAAQ,sBAAsB;AACtD,SAASC,kBAAkB,QAAQ,+BAA+B;AAClE,OAAOC,MAAM,MAAM,wBAAwB;AAC3C,SAASC,mBAAmB,QAAQ,sBAAsB;AAC1D,SAASC,sBAAsB,QAAQ,mCAAmC;AAU1E,OAAO,SAASC,SAASA,CACvB;EAAEC,IAAI;EAAEC;AAA6C,CAAC,EAClC;EACpB,MAAMC,KAAK,GAAGT,MAAM,CAAuB,IAAI,CAAC;EAChD,MAAMU,cAAc,GAAGH,IAAI,CAACI,MAAM,CAACC,EAAE,KAAKR,mBAAmB;EAE7D,MAAM;IACJS,iBAAiB;IACjBC,qBAAqB;IACrBC,sBAAsB;IACtBC;EACF,CAAC,GAAGd,kBAAkB,CAAC;IACrBO;EACF,CAAC,CAAC;EAMF,MAAM;IAAEQ;EAAa,CAAC,GAAGZ,sBAAsB,CAACE,IAAI,CAACI,MAAM,CAAC;EAE5D,oBACEZ,KAAA,CAAAmB,aAAA,CAAAnB,KAAA,CAAAoB,QAAA,qBACEpB,KAAA,CAAAmB,aAAA;IACEE,GAAG,EAAEX,KAAM;IACX,eAAaF,IAAI,CAACI,MAAM,CAACU,WAAW,CAAC,CAAE;IACvCC,SAAS,EAAEnB,MAAM,CAACoB,aAAc;IAChCC,KAAK,EAAEP,YAAa;IACpBQ,aAAa,EAAEX;EAAsB,gBAErCf,KAAA,CAAAmB,aAAA;IAAKI,SAAS,EAAEnB,MAAM,CAACuB;EAAqB,GACzC5B,UAAU,CACTS,IAAI,CAACI,MAAM,CAACgB,SAAS,CAACpB,IAAI,EAC1BA,IAAI,CAACqB,UAAU,CAAC,CAClB,CACG,CACH,CAAC,EArBuB,CAAClB,cAAc,IAAIG,iBAAiB,IAC/D,CAAC,CAACG,eAAe,IACjB,CAAC,CAACR,qBAAqB,iBAsBpBT,KAAA,CAAAmB,aAAA,CAACjB,eAAe;IACdM,IAAI,EAAEA,IAAK;IACXsB,QAAQ,EAAEb,eAAgB;IAC1Bc,OAAO,EAAEf,sBAAuB;IAChCgB,aAAa,EAAEvB;EAAsB,CACtC,CAEL,CAAC;AAEP","ignoreList":[]}