@osdk/react-components 0.3.0-main-20260408113649 → 0.3.0-main-20260408142652
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -4
- package/build/browser/object-table/ObjectTable.js +2 -1
- package/build/browser/object-table/ObjectTable.js.map +1 -1
- package/build/browser/object-table/ObjectTableApi.js.map +1 -1
- package/build/browser/object-table/hooks/useFunctionColumnsData.js +2 -1
- package/build/browser/object-table/hooks/useFunctionColumnsData.js.map +1 -1
- package/build/browser/object-table/hooks/useObjectTableData.js +8 -4
- package/build/browser/object-table/hooks/useObjectTableData.js.map +1 -1
- package/build/browser/object-table/utils/stripDerivedPropertiesFromParams.js +61 -0
- package/build/browser/object-table/utils/stripDerivedPropertiesFromParams.js.map +1 -0
- package/build/cjs/public/experimental.cjs +47 -6
- package/build/cjs/public/experimental.cjs.map +1 -1
- package/build/cjs/public/experimental.d.cts +9 -1
- package/build/esm/object-table/ObjectTable.js +2 -1
- package/build/esm/object-table/ObjectTable.js.map +1 -1
- package/build/esm/object-table/ObjectTableApi.js.map +1 -1
- package/build/esm/object-table/hooks/useFunctionColumnsData.js +2 -1
- package/build/esm/object-table/hooks/useFunctionColumnsData.js.map +1 -1
- package/build/esm/object-table/hooks/useObjectTableData.js +8 -4
- package/build/esm/object-table/hooks/useObjectTableData.js.map +1 -1
- package/build/esm/object-table/utils/stripDerivedPropertiesFromParams.js +61 -0
- package/build/esm/object-table/utils/stripDerivedPropertiesFromParams.js.map +1 -0
- package/build/types/object-table/ObjectTable.d.ts +1 -1
- package/build/types/object-table/ObjectTable.d.ts.map +1 -1
- package/build/types/object-table/ObjectTableApi.d.ts +8 -0
- package/build/types/object-table/ObjectTableApi.d.ts.map +1 -1
- package/build/types/object-table/hooks/useFunctionColumnsData.d.ts.map +1 -1
- package/build/types/object-table/hooks/useObjectTableData.d.ts +1 -1
- package/build/types/object-table/hooks/useObjectTableData.d.ts.map +1 -1
- package/build/types/object-table/utils/stripDerivedPropertiesFromParams.d.ts +8 -0
- package/build/types/object-table/utils/stripDerivedPropertiesFromParams.d.ts.map +1 -0
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
# @osdk/react-components
|
|
2
2
|
|
|
3
|
-
## 0.3.0-main-
|
|
3
|
+
## 0.3.0-main-20260408142652
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
7
7
|
- f8b9f12: Cache results from useOsdkFunctions
|
|
8
|
+
- 0b349bd: Fix returned objectSet in ObjectSetQuery
|
|
8
9
|
- 89def41: minor bump associated with BlueprintJS upgrade
|
|
10
|
+
- 6786113: Add dedupeIntervalMs prop to ObjectTable to configure the dedupe interval for caching network requests
|
|
9
11
|
|
|
10
12
|
### Patch Changes
|
|
11
13
|
|
|
@@ -14,11 +16,12 @@
|
|
|
14
16
|
- b2b512e: Address FilePickerField PR review comments: memoize computed values, add aria-label, rename CSS token, add keyboard interaction tests
|
|
15
17
|
- Updated dependencies [f8b9f12]
|
|
16
18
|
- Updated dependencies [bcf359f]
|
|
19
|
+
- Updated dependencies [0b349bd]
|
|
17
20
|
- Updated dependencies [51ccca8]
|
|
18
21
|
- Updated dependencies [fb85818]
|
|
19
|
-
- @osdk/client@2.9.0-main-
|
|
20
|
-
- @osdk/react@0.11.0-main-
|
|
21
|
-
- @osdk/api@2.9.0-main-
|
|
22
|
+
- @osdk/client@2.9.0-main-20260408142652
|
|
23
|
+
- @osdk/react@0.11.0-main-20260408142652
|
|
24
|
+
- @osdk/api@2.9.0-main-20260408142652
|
|
22
25
|
|
|
23
26
|
## 0.2.0
|
|
24
27
|
|
|
@@ -43,6 +43,7 @@ export function ObjectTable({
|
|
|
43
43
|
columnDefinitions,
|
|
44
44
|
filter,
|
|
45
45
|
objectSetOptions,
|
|
46
|
+
dedupeIntervalMs,
|
|
46
47
|
orderBy,
|
|
47
48
|
defaultOrderBy,
|
|
48
49
|
onOrderByChanged,
|
|
@@ -82,7 +83,7 @@ export function ObjectTable({
|
|
|
82
83
|
fetchMore,
|
|
83
84
|
isLoading,
|
|
84
85
|
error
|
|
85
|
-
} = useObjectTableData(objectType, columnDefinitions, filter, sorting, objectSet, objectSetOptions);
|
|
86
|
+
} = useObjectTableData(objectType, columnDefinitions, filter, sorting, objectSet, objectSetOptions, dedupeIntervalMs);
|
|
86
87
|
const {
|
|
87
88
|
columns,
|
|
88
89
|
loading: isColumnsLoading
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObjectTable.js","names":["getCoreRowModel","useReactTable","React","useCallback","useMemo","useColumnDefs","useColumnPinning","useColumnResize","useColumnVisibility","useEditableTable","useObjectTableData","useRowSelection","useSelectionColumn","useTableSorting","BaseTable","getRowId","EMPTY_ARRAY","ObjectTable","objectType","objectSet","columnDefinitions","filter","objectSetOptions","orderBy","defaultOrderBy","onOrderByChanged","onColumnsPinnedChanged","onColumnResize","onRowSelection","renderCellContextMenu","selectionMode","selectedRows","isAllSelected","isAllSelectedProp","onColumnVisibilityChanged","onCellValueChanged","onSubmitEdits","enableOrdering","enableColumnPinning","enableColumnResizing","enableColumnConfig","editMode","props","columnSizing","onColumnSizingChange","sorting","onSortingChange","data","fetchMore","isLoading","error","columns","loading","isColumnsLoading","rowSelection","hasSelection","onToggleAll","onToggleRow","enableRowSelection","selectionColumn","columnVisibility","onColumnVisibilityChange","columnOrder","onColumnOrderChange","allColumns","columnPinning","onColumnPinningChange","hasSelectionColumn","editableConfig","table","state","enableSorting","columnResizeMode","columnResizeDirection","manualSorting","defaultColumn","minSize","meta","onCellEdit","onCellValidationError","clearCellValidationError","cellEdits","isInEditMode","editModeState","isActive","validationErrors","onRenderCellContextMenu","row","cell","getValue","headerMenuFeatureFlags","showSortingItems","showPinningItems","showResizeItem","showConfigItem","createElement","fetchNextPage","onRowClick","rowHeight","className"],"sources":["ObjectTable.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 {\n ObjectOrInterfaceDefinition,\n Osdk,\n PropertyKeys,\n QueryDefinition,\n SimplePropertyDef,\n} from \"@osdk/api\";\nimport type { Cell } from \"@tanstack/react-table\";\nimport { getCoreRowModel, useReactTable } from \"@tanstack/react-table\";\nimport React, { useCallback, useMemo } from \"react\";\nimport { useColumnDefs } from \"./hooks/useColumnDefs.js\";\nimport { useColumnPinning } from \"./hooks/useColumnPinning.js\";\nimport { useColumnResize } from \"./hooks/useColumnResize.js\";\nimport { useColumnVisibility } from \"./hooks/useColumnVisibility.js\";\nimport { useEditableTable } from \"./hooks/useEditableTable.js\";\nimport { useObjectTableData } from \"./hooks/useObjectTableData.js\";\nimport { useRowSelection } from \"./hooks/useRowSelection.js\";\nimport { useSelectionColumn } from \"./hooks/useSelectionColumn.js\";\nimport { useTableSorting } from \"./hooks/useTableSorting.js\";\nimport type { ObjectTableProps } from \"./ObjectTableApi.js\";\nimport { BaseTable } from \"./Table.js\";\nimport type { HeaderMenuFeatureFlags } from \"./TableHeaderWithPopover.js\";\nimport { getRowId } from \"./utils/getRowId.js\";\nimport type { EditableConfig } from \"./utils/types.js\";\n\n/**\n * ObjectTable - A headless table component for displaying OSDK object sets\n *\n * @example\n * ```tsx\n * <ObjectTable objectType={MyObjectType} />\n * ```\n */\n\nconst EMPTY_ARRAY: [] = [];\n\nexport function ObjectTable<\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 objectType,\n objectSet,\n columnDefinitions,\n filter,\n objectSetOptions,\n orderBy,\n defaultOrderBy,\n onOrderByChanged,\n onColumnsPinnedChanged,\n onColumnResize,\n onRowSelection,\n renderCellContextMenu,\n selectionMode = \"none\",\n selectedRows,\n isAllSelected: isAllSelectedProp,\n onColumnVisibilityChanged,\n onCellValueChanged,\n onSubmitEdits,\n enableOrdering = true,\n enableColumnPinning = true,\n enableColumnResizing = true,\n enableColumnConfig = true,\n editMode = \"manual\",\n ...props\n}: ObjectTableProps<Q, RDPs, FunctionColumns>): React.ReactElement {\n const { columnSizing, onColumnSizingChange } = useColumnResize({\n onColumnResize,\n });\n\n const { sorting, onSortingChange } = useTableSorting<\n Q,\n RDPs,\n FunctionColumns\n >(\n {\n orderBy,\n defaultOrderBy,\n onOrderByChanged,\n },\n );\n\n const { data, fetchMore, isLoading, error } = useObjectTableData<\n Q,\n RDPs,\n FunctionColumns\n >(\n objectType,\n columnDefinitions,\n filter,\n sorting,\n objectSet,\n objectSetOptions,\n );\n\n const { columns, loading: isColumnsLoading } = useColumnDefs<\n Q,\n RDPs,\n FunctionColumns\n >(\n objectType,\n columnDefinitions,\n );\n\n const {\n rowSelection,\n isAllSelected,\n hasSelection,\n onToggleAll,\n onToggleRow,\n enableRowSelection,\n } = useRowSelection<Q, RDPs>({\n selectionMode,\n selectedRows,\n isAllSelected: isAllSelectedProp,\n onRowSelection,\n data,\n });\n\n const selectionColumn = useSelectionColumn<Q, RDPs>(\n {\n selectionMode,\n isAllSelected,\n hasSelection,\n onToggleAll,\n onToggleRow,\n },\n );\n\n const {\n columnVisibility,\n onColumnVisibilityChange,\n columnOrder,\n onColumnOrderChange,\n } = useColumnVisibility({\n allColumns: columns,\n onColumnVisibilityChanged,\n });\n\n const { columnPinning, onColumnPinningChange } = useColumnPinning({\n columnDefinitions,\n hasSelectionColumn: enableRowSelection,\n onColumnsPinnedChanged,\n });\n\n const allColumns = useMemo(() => {\n return selectionColumn ? [selectionColumn, ...columns] : columns;\n }, [selectionColumn, columns]);\n\n const editableConfig: EditableConfig<\n Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n unknown\n > = useEditableTable({\n editMode,\n onCellValueChanged,\n onSubmitEdits,\n });\n\n const table = useReactTable<\n Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>\n >({\n data: data ?? EMPTY_ARRAY,\n columns: allColumns,\n getCoreRowModel: getCoreRowModel(),\n state: {\n columnVisibility,\n columnOrder,\n rowSelection,\n sorting,\n columnSizing,\n columnPinning,\n },\n onSortingChange,\n onColumnSizingChange,\n onColumnPinningChange,\n onColumnVisibilityChange,\n onColumnOrderChange,\n enableRowSelection,\n enableSorting: enableOrdering,\n columnResizeMode: \"onChange\",\n columnResizeDirection: \"ltr\",\n manualSorting: true, // Enable manual sorting to indicate server-side sorting\n defaultColumn: {\n minSize: 80,\n },\n getRowId,\n meta: {\n onCellEdit: editableConfig.onCellEdit,\n onCellValidationError: editableConfig.onCellValidationError,\n clearCellValidationError: editableConfig.clearCellValidationError,\n cellEdits: editableConfig.cellEdits,\n isInEditMode: editableConfig.editModeState.isActive,\n validationErrors: editableConfig.validationErrors,\n },\n });\n\n const onRenderCellContextMenu = useCallback(\n (\n row: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n cell: Cell<\n Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n unknown\n >,\n ) => {\n return renderCellContextMenu?.(row, cell.getValue());\n },\n [renderCellContextMenu],\n );\n\n const isTableLoading = isLoading || isColumnsLoading;\n\n const headerMenuFeatureFlags: HeaderMenuFeatureFlags = useMemo(() => ({\n showSortingItems: enableOrdering,\n showPinningItems: enableColumnPinning,\n showResizeItem: enableColumnResizing,\n showConfigItem: enableColumnConfig,\n }), [\n enableOrdering,\n enableColumnPinning,\n enableColumnResizing,\n enableColumnConfig,\n ]);\n\n return (\n <BaseTable<Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>>\n table={table}\n isLoading={isTableLoading}\n fetchNextPage={fetchMore}\n onRowClick={props.onRowClick}\n rowHeight={props.rowHeight}\n renderCellContextMenu={onRenderCellContextMenu}\n className={props.className}\n error={error}\n headerMenuFeatureFlags={headerMenuFeatureFlags}\n editableConfig={editableConfig}\n />\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAUA,SAASA,eAAe,EAAEC,aAAa,QAAQ,uBAAuB;AACtE,OAAOC,KAAK,IAAIC,WAAW,EAAEC,OAAO,QAAQ,OAAO;AACnD,SAASC,aAAa,QAAQ,0BAA0B;AACxD,SAASC,gBAAgB,QAAQ,6BAA6B;AAC9D,SAASC,eAAe,QAAQ,4BAA4B;AAC5D,SAASC,mBAAmB,QAAQ,gCAAgC;AACpE,SAASC,gBAAgB,QAAQ,6BAA6B;AAC9D,SAASC,kBAAkB,QAAQ,+BAA+B;AAClE,SAASC,eAAe,QAAQ,4BAA4B;AAC5D,SAASC,kBAAkB,QAAQ,+BAA+B;AAClE,SAASC,eAAe,QAAQ,4BAA4B;AAE5D,SAASC,SAAS,QAAQ,YAAY;AAEtC,SAASC,QAAQ,QAAQ,qBAAqB;AAG9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMC,WAAe,GAAG,EAAE;AAE1B,OAAO,SAASC,WAAWA,CAUzB;EACAC,UAAU;EACVC,SAAS;EACTC,iBAAiB;EACjBC,MAAM;EACNC,gBAAgB;EAChBC,OAAO;EACPC,cAAc;EACdC,gBAAgB;EAChBC,sBAAsB;EACtBC,cAAc;EACdC,cAAc;EACdC,qBAAqB;EACrBC,aAAa,GAAG,MAAM;EACtBC,YAAY;EACZC,aAAa,EAAEC,iBAAiB;EAChCC,yBAAyB;EACzBC,kBAAkB;EAClBC,aAAa;EACbC,cAAc,GAAG,IAAI;EACrBC,mBAAmB,GAAG,IA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,CAAC;EACtD,CAAC,EACD,CAAC5D,qBAAqB,CACxB,CAAC;EAID,MAAM6D,sBAA8C,GAAGtF,OAAO,CAAC,OAAO;IACpEuF,gBAAgB,EAAEtD,cAAc;IAChCuD,gBAAgB,EAAEtD,mBAAmB;IACrCuD,cAAc,EAAEtD,oBAAoB;IACpCuD,cAAc,EAAEtD;EAClB,CAAC,CAAC,EAAE,CACFH,cAAc,EACdC,mBAAmB,EACnBC,oBAAoB,EACpBC,kBAAkB,CACnB,CAAC;EAEF,oBACEtC,KAAA,CAAA6F,aAAA,CAACjF,SAAS;IACRuD,KAAK,EAAEA,KAAM;IACbpB,SAAS,EAjBUA,SAAS,IAAII,gBAiBN;IAC1B2C,aAAa,EAAEhD,SAAU;IACzBiD,UAAU,EAAEvD,KAAK,CAACuD,UAAW;IAC7BC,SAAS,EAAExD,KAAK,CAACwD,SAAU;IAC3BrE,qBAAqB,EAAEyD,uBAAwB;IAC/Ca,SAAS,EAAEzD,KAAK,CAACyD,SAAU;IAC3BjD,KAAK,EAAEA,KAAM;IACbwC,sBAAsB,EAAEA,sBAAuB;IAC/CtB,cAAc,EAAEA;EAAe,CAChC,CAAC;AAEN","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"ObjectTable.js","names":["getCoreRowModel","useReactTable","React","useCallback","useMemo","useColumnDefs","useColumnPinning","useColumnResize","useColumnVisibility","useEditableTable","useObjectTableData","useRowSelection","useSelectionColumn","useTableSorting","BaseTable","getRowId","EMPTY_ARRAY","ObjectTable","objectType","objectSet","columnDefinitions","filter","objectSetOptions","dedupeIntervalMs","orderBy","defaultOrderBy","onOrderByChanged","onColumnsPinnedChanged","onColumnResize","onRowSelection","renderCellContextMenu","selectionMode","selectedRows","isAllSelected","isAllSelectedProp","onColumnVisibilityChanged","onCellValueChanged","onSubmitEdits","enableOrdering","enableColumnPinning","enableColumnResizing","enableColumnConfig","editMode","props","columnSizing","onColumnSizingChange","sorting","onSortingChange","data","fetchMore","isLoading","error","columns","loading","isColumnsLoading","rowSelection","hasSelection","onToggleAll","onToggleRow","enableRowSelection","selectionColumn","columnVisibility","onColumnVisibilityChange","columnOrder","onColumnOrderChange","allColumns","columnPinning","onColumnPinningChange","hasSelectionColumn","editableConfig","table","state","enableSorting","columnResizeMode","columnResizeDirection","manualSorting","defaultColumn","minSize","meta","onCellEdit","onCellValidationError","clearCellValidationError","cellEdits","isInEditMode","editModeState","isActive","validationErrors","onRenderCellContextMenu","row","cell","getValue","headerMenuFeatureFlags","showSortingItems","showPinningItems","showResizeItem","showConfigItem","createElement","fetchNextPage","onRowClick","rowHeight","className"],"sources":["ObjectTable.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 {\n ObjectOrInterfaceDefinition,\n Osdk,\n PropertyKeys,\n QueryDefinition,\n SimplePropertyDef,\n} from \"@osdk/api\";\nimport type { Cell } from \"@tanstack/react-table\";\nimport { getCoreRowModel, useReactTable } from \"@tanstack/react-table\";\nimport React, { useCallback, useMemo } from \"react\";\nimport { useColumnDefs } from \"./hooks/useColumnDefs.js\";\nimport { useColumnPinning } from \"./hooks/useColumnPinning.js\";\nimport { useColumnResize } from \"./hooks/useColumnResize.js\";\nimport { useColumnVisibility } from \"./hooks/useColumnVisibility.js\";\nimport { useEditableTable } from \"./hooks/useEditableTable.js\";\nimport { useObjectTableData } from \"./hooks/useObjectTableData.js\";\nimport { useRowSelection } from \"./hooks/useRowSelection.js\";\nimport { useSelectionColumn } from \"./hooks/useSelectionColumn.js\";\nimport { useTableSorting } from \"./hooks/useTableSorting.js\";\nimport type { ObjectTableProps } from \"./ObjectTableApi.js\";\nimport { BaseTable } from \"./Table.js\";\nimport type { HeaderMenuFeatureFlags } from \"./TableHeaderWithPopover.js\";\nimport { getRowId } from \"./utils/getRowId.js\";\nimport type { EditableConfig } from \"./utils/types.js\";\n\n/**\n * ObjectTable - A headless table component for displaying OSDK object sets\n *\n * @example\n * ```tsx\n * <ObjectTable objectType={MyObjectType} />\n * ```\n */\n\nconst EMPTY_ARRAY: [] = [];\n\nexport function ObjectTable<\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 objectType,\n objectSet,\n columnDefinitions,\n filter,\n objectSetOptions,\n dedupeIntervalMs,\n orderBy,\n defaultOrderBy,\n onOrderByChanged,\n onColumnsPinnedChanged,\n onColumnResize,\n onRowSelection,\n renderCellContextMenu,\n selectionMode = \"none\",\n selectedRows,\n isAllSelected: isAllSelectedProp,\n onColumnVisibilityChanged,\n onCellValueChanged,\n onSubmitEdits,\n enableOrdering = true,\n enableColumnPinning = true,\n enableColumnResizing = true,\n enableColumnConfig = true,\n editMode = \"manual\",\n ...props\n}: ObjectTableProps<Q, RDPs, FunctionColumns>): React.ReactElement {\n const { columnSizing, onColumnSizingChange } = useColumnResize({\n onColumnResize,\n });\n\n const { sorting, onSortingChange } = useTableSorting<\n Q,\n RDPs,\n FunctionColumns\n >(\n {\n orderBy,\n defaultOrderBy,\n onOrderByChanged,\n },\n );\n\n const { data, fetchMore, isLoading, error } = useObjectTableData<\n Q,\n RDPs,\n FunctionColumns\n >(\n objectType,\n columnDefinitions,\n filter,\n sorting,\n objectSet,\n objectSetOptions,\n dedupeIntervalMs,\n );\n\n const { columns, loading: isColumnsLoading } = useColumnDefs<\n Q,\n RDPs,\n FunctionColumns\n >(\n objectType,\n columnDefinitions,\n );\n\n const {\n rowSelection,\n isAllSelected,\n hasSelection,\n onToggleAll,\n onToggleRow,\n enableRowSelection,\n } = useRowSelection<Q, RDPs>({\n selectionMode,\n selectedRows,\n isAllSelected: isAllSelectedProp,\n onRowSelection,\n data,\n });\n\n const selectionColumn = useSelectionColumn<Q, RDPs>(\n {\n selectionMode,\n isAllSelected,\n hasSelection,\n onToggleAll,\n onToggleRow,\n },\n );\n\n const {\n columnVisibility,\n onColumnVisibilityChange,\n columnOrder,\n onColumnOrderChange,\n } = useColumnVisibility({\n allColumns: columns,\n onColumnVisibilityChanged,\n });\n\n const { columnPinning, onColumnPinningChange } = useColumnPinning({\n columnDefinitions,\n hasSelectionColumn: enableRowSelection,\n onColumnsPinnedChanged,\n });\n\n const allColumns = useMemo(() => {\n return selectionColumn ? [selectionColumn, ...columns] : columns;\n }, [selectionColumn, columns]);\n\n const editableConfig: EditableConfig<\n Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n unknown\n > = useEditableTable({\n editMode,\n onCellValueChanged,\n onSubmitEdits,\n });\n\n const table = useReactTable<\n Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>\n >({\n data: data ?? EMPTY_ARRAY,\n columns: allColumns,\n getCoreRowModel: getCoreRowModel(),\n state: {\n columnVisibility,\n columnOrder,\n rowSelection,\n sorting,\n columnSizing,\n columnPinning,\n },\n onSortingChange,\n onColumnSizingChange,\n onColumnPinningChange,\n onColumnVisibilityChange,\n onColumnOrderChange,\n enableRowSelection,\n enableSorting: enableOrdering,\n columnResizeMode: \"onChange\",\n columnResizeDirection: \"ltr\",\n manualSorting: true, // Enable manual sorting to indicate server-side sorting\n defaultColumn: {\n minSize: 80,\n },\n getRowId,\n meta: {\n onCellEdit: editableConfig.onCellEdit,\n onCellValidationError: editableConfig.onCellValidationError,\n clearCellValidationError: editableConfig.clearCellValidationError,\n cellEdits: editableConfig.cellEdits,\n isInEditMode: editableConfig.editModeState.isActive,\n validationErrors: editableConfig.validationErrors,\n },\n });\n\n const onRenderCellContextMenu = useCallback(\n (\n row: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n cell: Cell<\n Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n unknown\n >,\n ) => {\n return renderCellContextMenu?.(row, cell.getValue());\n },\n [renderCellContextMenu],\n );\n\n const isTableLoading = isLoading || isColumnsLoading;\n\n const headerMenuFeatureFlags: HeaderMenuFeatureFlags = useMemo(() => ({\n showSortingItems: enableOrdering,\n showPinningItems: enableColumnPinning,\n showResizeItem: enableColumnResizing,\n showConfigItem: enableColumnConfig,\n }), [\n enableOrdering,\n enableColumnPinning,\n enableColumnResizing,\n enableColumnConfig,\n ]);\n\n return (\n <BaseTable<Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>>\n table={table}\n isLoading={isTableLoading}\n fetchNextPage={fetchMore}\n onRowClick={props.onRowClick}\n rowHeight={props.rowHeight}\n renderCellContextMenu={onRenderCellContextMenu}\n className={props.className}\n error={error}\n headerMenuFeatureFlags={headerMenuFeatureFlags}\n editableConfig={editableConfig}\n />\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAUA,SAASA,eAAe,EAAEC,aAAa,QAAQ,uBAAuB;AACtE,OAAOC,KAAK,IAAIC,WAAW,EAAEC,OAAO,QAAQ,OAAO;AACnD,SAASC,aAAa,QAAQ,0BAA0B;AACxD,SAASC,gBAAgB,QAAQ,6BAA6B;AAC9D,SAASC,eAAe,QAAQ,4BAA4B;AAC5D,SAASC,mBAAmB,QAAQ,gCAAgC;AACpE,SAASC,gBAAgB,QAAQ,6BAA6B;AAC9D,SAASC,kBAAkB,QAAQ,+BAA+B;AAClE,SAASC,eAAe,QAAQ,4BAA4B;AAC5D,SAASC,kBAAkB,QAAQ,+BAA+B;AAClE,SAASC,eAAe,QAAQ,4BAA4B;AAE5D,SAASC,SAAS,QAAQ,YAAY;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}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObjectTableApi.js","names":[],"sources":["ObjectTableApi.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 CompileTimeMetadata,\n DerivedProperty,\n ObjectOrInterfaceDefinition,\n ObjectSet,\n Osdk,\n PrimaryKeyType,\n PropertyKeys,\n QueryDefinition,\n SimplePropertyDef,\n WhereClause,\n} from \"@osdk/api\";\nimport type { QueryParameterType } from \"@osdk/client/unstable-do-not-use\";\nimport type * as React from \"react\";\nimport type { CellEditInfo } from \"./utils/types.js\";\n\nexport type ColumnDefinition<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n> = {\n locator: ColumnDefinitionLocator<Q, RDPs, FunctionColumns>;\n\n /**\n * @default true\n */\n isVisible?: boolean;\n\n /**\n * @default none\n */\n pinned?: \"left\" | \"right\" | \"none\";\n width?: number;\n minWidth?: number;\n maxWidth?: number;\n resizable?: boolean;\n orderable?: boolean;\n filterable?: boolean;\n editable?: boolean;\n\n /**\n * Additional function to validate the cell value during edit\n *\n * @param value the current cell value\n * @returns a promise that resolves to an error message string if validation fails, or undefined if validation succeeds\n */\n validateEdit?: (\n value: unknown,\n ) => Promise<string | undefined>;\n\n renderCell?: (\n object: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n locator: ColumnDefinitionLocator<Q, RDPs, FunctionColumns>,\n ) => React.ReactNode;\n\n /**\n * If provided, this will be used in the column header.\n * If both columnName and renderHeader are provided, renderHeader will take precedence in the table header.\n * columnName will still be used in other parts where the column name is displayed.\n *\n * If not provided,\n * for a property column, the property displayName will be used\n * for other columns, the id will be used.\n */\n columnName?: string;\n\n /**\n * If provided, this will be used to render the header component.\n * When both columnName and renderHeader are provided, renderHeader will take precedence in the table header.\n */\n renderHeader?: () => React.ReactNode;\n};\n\nexport type ExtractQueryParameters<\n Q extends QueryDefinition,\n> = CompileTimeMetadata<Q>[\"parameters\"] extends Record<string, never>\n ? undefined\n : QueryParameterType<CompileTimeMetadata<Q>[\"parameters\"]>;\n\nexport interface PropertyColumnLocator<Q extends ObjectOrInterfaceDefinition> {\n type: \"property\";\n id: PropertyKeys<Q>;\n}\n\nexport interface FunctionColumnLocator<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n> {\n /**\n * This is equivalent to workshop's function-backed columns.\n * The function needs to meet the specifications stated in https://www.palantir.com/docs/foundry/workshop/widgets-object-table/#function-backed-columns\n */\n type: \"function\";\n id: keyof FunctionColumns;\n queryDefinition: FunctionColumns[keyof FunctionColumns];\n\n /**\n * The function will be called with the current object set to get the input parameters for the function query.\n * @param objectSet - The current object set.\n * @returns - The function's input parameters including the object set.\n */\n getFunctionParams: (\n objectSet: ObjectSet<Q, RDPs>,\n ) => ExtractQueryParameters<FunctionColumns[keyof FunctionColumns]>;\n\n /**\n * Function to generate keys for looking up results in the FunctionsMap.\n * @param object - The object instance\n * @returns - The key to use for looking up this object's result in the FunctionsMap\n */\n getKey: (\n object: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n ) => string;\n\n /**\n * Function to extract the cell value from the raw cell data returned by the function.\n * This is useful when functions return custom types with multiple properties.\n * @param cellData - The raw data returned by the function for this object\n * @returns - The value to display in the cell\n */\n getValue?: (cellData?: unknown) => unknown;\n\n /**\n * Minimum time between re-fetches of the same function with the same parameters, in milliseconds.\n * Defaults to 5 minutes to maximize cache hits\n * @default 300_000 (5 minutes)\n */\n dedupeIntervalMs?: number;\n}\n\nexport interface RdpColumnLocator<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n> {\n type: \"rdp\";\n id: keyof RDPs;\n creator: DerivedProperty.Creator<Q, RDPs[keyof RDPs]>;\n}\n\nexport interface CustomColumnLocator {\n type: \"custom\";\n id: string;\n}\n\nexport type ColumnDefinitionLocator<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n> =\n | PropertyColumnLocator<Q>\n | FunctionColumnLocator<Q, RDPs, FunctionColumns>\n | RdpColumnLocator<Q, RDPs>\n | CustomColumnLocator;\n\nexport interface ObjectTableProps<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n> {\n /**\n * The object or interface type of the object\n * If objectSet is not provided, objects will be fetched based on this type.\n */\n objectType: Q;\n\n /**\n * The set of objects to show in the table.\n * If provided and the objectType is not an interface, the table will use objectSet to fetch objects instead of fetching based on objectType.\n */\n objectSet?: ObjectSet<Q>;\n\n objectSetOptions?: ObjectSetOptions<Q>;\n\n /**\n * Ordered list of column definitions to show in the table\n *\n * If not provided, all of the properties of the object type will be shown in default order.\n */\n columnDefinitions?: Array<ColumnDefinition<Q, RDPs, FunctionColumns>>;\n\n /**\n * Whether the table is filterable by the user.\n *\n * @default true\n */\n enableFiltering?: boolean;\n\n /**\n * The current where clause to filter the objects in the table.\n * If provided, the filter is controlled.\n */\n filter?: WhereClause<Q, RDPs>;\n\n /**\n * Called when the where clause is changed.\n * Required when filter is controlled.\n *\n * @param newWhere The new where clause\n */\n onFilterChanged?: (newWhere: WhereClause<Q, RDPs>) => void;\n\n /**\n * Whether the table is sortable by the user.\n *\n * @default true\n */\n enableOrdering?: boolean;\n\n /**\n * Whether columns can be pinned by the user.\n *\n * @default true\n */\n enableColumnPinning?: boolean;\n\n /**\n * Whether columns can be resized by the user.\n *\n * @default true\n */\n enableColumnResizing?: boolean;\n\n /**\n * Whether the column configuration dialog for column visibility and ordering is available to the user.\n *\n * @default true\n */\n enableColumnConfig?: boolean;\n\n /**\n * Controls the edit mode behavior of the table.\n * - \"always\": Editable cells are immediately in edit mode on row clicked.\n * - \"manual\": User can toggle edit mode on/off via the Edit Table button.\n *\n * @default \"manual\"\n */\n editMode?: \"always\" | \"manual\";\n\n /**\n * The default order by clause to sort the objects in the table.\n * If provided without orderBy prop, the sorting is uncontrolled.\n * If both orderBy and defaultOrderBy are provided, orderBy takes precedence.\n */\n defaultOrderBy?: Array<{\n property: PropertyKeys<Q>;\n direction: \"asc\" | \"desc\";\n }>;\n\n /**\n * The current order by clause to sort the objects in the table.\n * If provided, the sorting is controlled.\n * If both orderBy and defaultOrderBy are provided, orderBy takes precedence.\n */\n orderBy?: Array<{\n property: PropertyKeys<Q>;\n direction: \"asc\" | \"desc\";\n }>;\n\n /**\n * Called when the order by clause is changed.\n * Required when sorting is controlled.\n *\n * @param newOrderBy The new order by clause\n */\n onOrderByChanged?: (\n newOrderBy: Array<{\n property: PropertyKeys<Q>;\n direction: \"asc\" | \"desc\";\n }>,\n ) => void;\n\n /**\n * Called after the value of a cell is edited and committed by the user.\n *\n * @param info An object containing details about the cell that was edited,\n * including the rowId, columnId, new and old values, and the row data before the edit\n */\n onCellValueChanged?: (\n info: CellEditInfo<\n Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n unknown\n >,\n ) => void;\n\n /**\n * If provided, the button Submit Edits will be shown in the table\n *\n * @param edits an array of edit info containing details about the edited cells\n * including the rowId, columnId, new and old values, and the row data before the edit\n * @return a promise that resolves to true if the edits were successfully submitted\n */\n onSubmitEdits?: (edits: CellEditInfo<\n Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n unknown\n >[]) => Promise<boolean>;\n\n /**\n * Called when the column visibility or ordering changed.\n *\n * If provided, the table will allow the user to show/hide columns.\n *\n * @param newStates The columns sorted in their display order in the table and their visibility state.\n */\n onColumnVisibilityChanged?: (\n newStates: Array<{\n columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns;\n isVisible: boolean;\n }>,\n ) => void;\n\n /**\n * Called when the pinned columns change.\n *\n * If provided, the table will allow the user to pin/unpin columns.\n *\n * @param newStates The new list of column pin states\n */\n onColumnsPinnedChanged?: (\n newStates: Array<{\n columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns;\n pinned: \"left\" | \"right\" | \"none\";\n }>,\n ) => void;\n\n /**\n * Called when a column is resized.\n *\n * @param columnId The ID of the resized column\n * @param newWidth The new width of the column. When newWidth = null, the column size is reset.\n */\n onColumnResize?: (\n columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns,\n newWidth: number | null,\n ) => void;\n\n /**\n * Called when a row is clicked.\n *\n * @param object The object representing the clicked row\n */\n onRowClick?: (\n object: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n ) => void;\n\n /**\n * Selection mode for the table rows.\n *\n * If multiple, a checkbox will be shown for each row to allow selecting multiple rows\n * as well as a top-level checkbox in the header to select all rows.\n *\n * @default \"none\"\n */\n selectionMode?: \"single\" | \"multiple\" | \"none\";\n\n /**\n * The currently selected rows in the table.\n * If provided, the row selection is controlled.\n */\n selectedRows?: PrimaryKeyType<Q>[];\n\n /**\n * Indicates whether all rows are selected in controlled mode.\n * When true, the table will show all rows as selected regardless of the selectedRows array.\n */\n isAllSelected?: boolean;\n\n /**\n * Called when the row selection changes.\n * Required when row selection is controlled.\n *\n * @param selectedRowIds The primary keys of currently selected rows\n * @param isSelectAll Whether the change was triggered by a \"select all\" action. Defaults to false\n */\n onRowSelection?: (\n selectedRowIds: PrimaryKeyType<Q>[],\n isSelectAll?: boolean,\n ) => void;\n /**\n * If provided, will render this context menu when right clicking on a cell\n */\n renderCellContextMenu?: (\n row: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n cellValue: unknown,\n ) => React.ReactNode;\n\n /**\n * The height of each row in pixels.\n *\n * @default 40\n */\n rowHeight?: number;\n\n className?: string;\n}\n\nexport interface ObjectSetOptions<\n Q extends ObjectOrInterfaceDefinition,\n> {\n /**\n * Object sets to union with\n */\n union?: ObjectSet<Q>[];\n\n /**\n * Object sets to intersect with\n */\n intersect?: ObjectSet<Q>[];\n\n /**\n * Object sets to subtract from\n */\n subtract?: ObjectSet<Q>[];\n}\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"ObjectTableApi.js","names":[],"sources":["ObjectTableApi.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 CompileTimeMetadata,\n DerivedProperty,\n ObjectOrInterfaceDefinition,\n ObjectSet,\n Osdk,\n PrimaryKeyType,\n PropertyKeys,\n QueryDefinition,\n SimplePropertyDef,\n WhereClause,\n} from \"@osdk/api\";\nimport type { QueryParameterType } from \"@osdk/client/unstable-do-not-use\";\nimport type * as React from \"react\";\nimport type { CellEditInfo } from \"./utils/types.js\";\n\nexport type ColumnDefinition<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n> = {\n locator: ColumnDefinitionLocator<Q, RDPs, FunctionColumns>;\n\n /**\n * @default true\n */\n isVisible?: boolean;\n\n /**\n * @default none\n */\n pinned?: \"left\" | \"right\" | \"none\";\n width?: number;\n minWidth?: number;\n maxWidth?: number;\n resizable?: boolean;\n orderable?: boolean;\n filterable?: boolean;\n editable?: boolean;\n\n /**\n * Additional function to validate the cell value during edit\n *\n * @param value the current cell value\n * @returns a promise that resolves to an error message string if validation fails, or undefined if validation succeeds\n */\n validateEdit?: (\n value: unknown,\n ) => Promise<string | undefined>;\n\n renderCell?: (\n object: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n locator: ColumnDefinitionLocator<Q, RDPs, FunctionColumns>,\n ) => React.ReactNode;\n\n /**\n * If provided, this will be used in the column header.\n * If both columnName and renderHeader are provided, renderHeader will take precedence in the table header.\n * columnName will still be used in other parts where the column name is displayed.\n *\n * If not provided,\n * for a property column, the property displayName will be used\n * for other columns, the id will be used.\n */\n columnName?: string;\n\n /**\n * If provided, this will be used to render the header component.\n * When both columnName and renderHeader are provided, renderHeader will take precedence in the table header.\n */\n renderHeader?: () => React.ReactNode;\n};\n\nexport type ExtractQueryParameters<\n Q extends QueryDefinition,\n> = CompileTimeMetadata<Q>[\"parameters\"] extends Record<string, never>\n ? undefined\n : QueryParameterType<CompileTimeMetadata<Q>[\"parameters\"]>;\n\nexport interface PropertyColumnLocator<Q extends ObjectOrInterfaceDefinition> {\n type: \"property\";\n id: PropertyKeys<Q>;\n}\n\nexport interface FunctionColumnLocator<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n> {\n /**\n * This is equivalent to workshop's function-backed columns.\n * The function needs to meet the specifications stated in https://www.palantir.com/docs/foundry/workshop/widgets-object-table/#function-backed-columns\n */\n type: \"function\";\n id: keyof FunctionColumns;\n queryDefinition: FunctionColumns[keyof FunctionColumns];\n\n /**\n * The function will be called with the current object set to get the input parameters for the function query.\n * @param objectSet - The current object set.\n * @returns - The function's input parameters including the object set.\n */\n getFunctionParams: (\n objectSet: ObjectSet<Q, RDPs>,\n ) => ExtractQueryParameters<FunctionColumns[keyof FunctionColumns]>;\n\n /**\n * Function to generate keys for looking up results in the FunctionsMap.\n * @param object - The object instance\n * @returns - The key to use for looking up this object's result in the FunctionsMap\n */\n getKey: (\n object: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n ) => string;\n\n /**\n * Function to extract the cell value from the raw cell data returned by the function.\n * This is useful when functions return custom types with multiple properties.\n * @param cellData - The raw data returned by the function for this object\n * @returns - The value to display in the cell\n */\n getValue?: (cellData?: unknown) => unknown;\n\n /**\n * Minimum time between re-fetches of the same function with the same parameters, in milliseconds.\n * Defaults to 5 minutes to maximize cache hits\n * @default 300_000 (5 minutes)\n */\n dedupeIntervalMs?: number;\n}\n\nexport interface RdpColumnLocator<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n> {\n type: \"rdp\";\n id: keyof RDPs;\n creator: DerivedProperty.Creator<Q, RDPs[keyof RDPs]>;\n}\n\nexport interface CustomColumnLocator {\n type: \"custom\";\n id: string;\n}\n\nexport type ColumnDefinitionLocator<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n> =\n | PropertyColumnLocator<Q>\n | FunctionColumnLocator<Q, RDPs, FunctionColumns>\n | RdpColumnLocator<Q, RDPs>\n | CustomColumnLocator;\n\nexport interface ObjectTableProps<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n> {\n /**\n * The object or interface type of the object\n * If objectSet is not provided, objects will be fetched based on this type.\n */\n objectType: Q;\n\n /**\n * The set of objects to show in the table.\n * If provided and the objectType is not an interface, the table will use objectSet to fetch objects instead of fetching based on objectType.\n */\n objectSet?: ObjectSet<Q>;\n\n objectSetOptions?: ObjectSetOptions<Q>;\n\n /**\n * Minimum time between fetch requests in milliseconds.\n * Increasing this value reduces redundant network calls when the same data\n * is requested multiple times in quick succession.\n *\n * @default 60_000 1 minute\n */\n dedupeIntervalMs?: number;\n\n /**\n * Ordered list of column definitions to show in the table\n *\n * If not provided, all of the properties of the object type will be shown in default order.\n */\n columnDefinitions?: Array<ColumnDefinition<Q, RDPs, FunctionColumns>>;\n\n /**\n * Whether the table is filterable by the user.\n *\n * @default true\n */\n enableFiltering?: boolean;\n\n /**\n * The current where clause to filter the objects in the table.\n * If provided, the filter is controlled.\n */\n filter?: WhereClause<Q, RDPs>;\n\n /**\n * Called when the where clause is changed.\n * Required when filter is controlled.\n *\n * @param newWhere The new where clause\n */\n onFilterChanged?: (newWhere: WhereClause<Q, RDPs>) => void;\n\n /**\n * Whether the table is sortable by the user.\n *\n * @default true\n */\n enableOrdering?: boolean;\n\n /**\n * Whether columns can be pinned by the user.\n *\n * @default true\n */\n enableColumnPinning?: boolean;\n\n /**\n * Whether columns can be resized by the user.\n *\n * @default true\n */\n enableColumnResizing?: boolean;\n\n /**\n * Whether the column configuration dialog for column visibility and ordering is available to the user.\n *\n * @default true\n */\n enableColumnConfig?: boolean;\n\n /**\n * Controls the edit mode behavior of the table.\n * - \"always\": Editable cells are immediately in edit mode on row clicked.\n * - \"manual\": User can toggle edit mode on/off via the Edit Table button.\n *\n * @default \"manual\"\n */\n editMode?: \"always\" | \"manual\";\n\n /**\n * The default order by clause to sort the objects in the table.\n * If provided without orderBy prop, the sorting is uncontrolled.\n * If both orderBy and defaultOrderBy are provided, orderBy takes precedence.\n */\n defaultOrderBy?: Array<{\n property: PropertyKeys<Q>;\n direction: \"asc\" | \"desc\";\n }>;\n\n /**\n * The current order by clause to sort the objects in the table.\n * If provided, the sorting is controlled.\n * If both orderBy and defaultOrderBy are provided, orderBy takes precedence.\n */\n orderBy?: Array<{\n property: PropertyKeys<Q>;\n direction: \"asc\" | \"desc\";\n }>;\n\n /**\n * Called when the order by clause is changed.\n * Required when sorting is controlled.\n *\n * @param newOrderBy The new order by clause\n */\n onOrderByChanged?: (\n newOrderBy: Array<{\n property: PropertyKeys<Q>;\n direction: \"asc\" | \"desc\";\n }>,\n ) => void;\n\n /**\n * Called after the value of a cell is edited and committed by the user.\n *\n * @param info An object containing details about the cell that was edited,\n * including the rowId, columnId, new and old values, and the row data before the edit\n */\n onCellValueChanged?: (\n info: CellEditInfo<\n Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n unknown\n >,\n ) => void;\n\n /**\n * If provided, the button Submit Edits will be shown in the table\n *\n * @param edits an array of edit info containing details about the edited cells\n * including the rowId, columnId, new and old values, and the row data before the edit\n * @return a promise that resolves to true if the edits were successfully submitted\n */\n onSubmitEdits?: (edits: CellEditInfo<\n Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n unknown\n >[]) => Promise<boolean>;\n\n /**\n * Called when the column visibility or ordering changed.\n *\n * If provided, the table will allow the user to show/hide columns.\n *\n * @param newStates The columns sorted in their display order in the table and their visibility state.\n */\n onColumnVisibilityChanged?: (\n newStates: Array<{\n columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns;\n isVisible: boolean;\n }>,\n ) => void;\n\n /**\n * Called when the pinned columns change.\n *\n * If provided, the table will allow the user to pin/unpin columns.\n *\n * @param newStates The new list of column pin states\n */\n onColumnsPinnedChanged?: (\n newStates: Array<{\n columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns;\n pinned: \"left\" | \"right\" | \"none\";\n }>,\n ) => void;\n\n /**\n * Called when a column is resized.\n *\n * @param columnId The ID of the resized column\n * @param newWidth The new width of the column. When newWidth = null, the column size is reset.\n */\n onColumnResize?: (\n columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns,\n newWidth: number | null,\n ) => void;\n\n /**\n * Called when a row is clicked.\n *\n * @param object The object representing the clicked row\n */\n onRowClick?: (\n object: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n ) => void;\n\n /**\n * Selection mode for the table rows.\n *\n * If multiple, a checkbox will be shown for each row to allow selecting multiple rows\n * as well as a top-level checkbox in the header to select all rows.\n *\n * @default \"none\"\n */\n selectionMode?: \"single\" | \"multiple\" | \"none\";\n\n /**\n * The currently selected rows in the table.\n * If provided, the row selection is controlled.\n */\n selectedRows?: PrimaryKeyType<Q>[];\n\n /**\n * Indicates whether all rows are selected in controlled mode.\n * When true, the table will show all rows as selected regardless of the selectedRows array.\n */\n isAllSelected?: boolean;\n\n /**\n * Called when the row selection changes.\n * Required when row selection is controlled.\n *\n * @param selectedRowIds The primary keys of currently selected rows\n * @param isSelectAll Whether the change was triggered by a \"select all\" action. Defaults to false\n */\n onRowSelection?: (\n selectedRowIds: PrimaryKeyType<Q>[],\n isSelectAll?: boolean,\n ) => void;\n /**\n * If provided, will render this context menu when right clicking on a cell\n */\n renderCellContextMenu?: (\n row: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n cellValue: unknown,\n ) => React.ReactNode;\n\n /**\n * The height of each row in pixels.\n *\n * @default 40\n */\n rowHeight?: number;\n\n className?: string;\n}\n\nexport interface ObjectSetOptions<\n Q extends ObjectOrInterfaceDefinition,\n> {\n /**\n * Object sets to union with\n */\n union?: ObjectSet<Q>[];\n\n /**\n * Object sets to intersect with\n */\n intersect?: ObjectSet<Q>[];\n\n /**\n * Object sets to subtract from\n */\n subtract?: ObjectSet<Q>[];\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
import { useOsdkFunctions } from "@osdk/react/experimental";
|
|
18
18
|
import { useMemo } from "react";
|
|
19
19
|
import { createAsyncCellData } from "../utils/AsyncCellData.js";
|
|
20
|
+
import { stripDerivedPropertiesFromParams } from "../utils/stripDerivedPropertiesFromParams.js";
|
|
20
21
|
// Function column data is readOnly and can be cached aggressively,
|
|
21
22
|
// so we set a longer dedupe interval to maximize cache hits
|
|
22
23
|
export const DEFAULT_DEDUPE_INTERVAL_MS = 300_000; // 5 minutes
|
|
@@ -39,7 +40,7 @@ export function useFunctionColumnsData(objectSet, objects, columnDefinitions) {
|
|
|
39
40
|
return functionColumnConfigs.map(config => ({
|
|
40
41
|
queryDefinition: config.queryDefinition,
|
|
41
42
|
options: {
|
|
42
|
-
params: config.getParams(stableObjectSet),
|
|
43
|
+
params: stripDerivedPropertiesFromParams(config.getParams(stableObjectSet)),
|
|
43
44
|
dedupeIntervalMs: config.dedupeIntervalMs ?? DEFAULT_DEDUPE_INTERVAL_MS
|
|
44
45
|
}
|
|
45
46
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFunctionColumnsData.js","names":["useOsdkFunctions","useMemo","createAsyncCellData","DEFAULT_DEDUPE_INTERVAL_MS","useFunctionColumnsData","objectSet","objects","columnDefinitions","functionColumnConfigs","getFunctionColumnConfigs","stableObjects","useStableObjects","stableObjectSet","JSON","stringify","disabled","length","queries","map","config","queryDefinition","options","params","getParams","dedupeIntervalMs","results","enabled","data","columnData","forEach","result","index","functionsMap","columnIds","columnId","getValue","getKey","columnGetKey","obj","key","String","$primaryKey","isLoading","error","customKey","rawData","cellData","configsByApiName","Map","colDef","locator","type","apiName","existingConfig","get","push","id","Math","min","set","getFunctionParams","Array","from","values","item","$apiName","sort","a","b","localeCompare"],"sources":["useFunctionColumnsData.ts"],"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 {\n ObjectOrInterfaceDefinition,\n ObjectSet,\n Osdk,\n PropertyKeys,\n QueryDefinition,\n SimplePropertyDef,\n} from \"@osdk/api\";\nimport {\n type FunctionQueryParams,\n useOsdkFunctions,\n} from \"@osdk/react/experimental\";\n\nimport { useMemo } from \"react\";\nimport type {\n ColumnDefinition,\n FunctionColumnLocator,\n} from \"../ObjectTableApi.js\";\nimport {\n type AsyncCellData,\n createAsyncCellData,\n} from \"../utils/AsyncCellData.js\";\n\nexport interface FunctionColumnData {\n [columnId: string]: {\n [objectPrimaryKey: string]: AsyncCellData;\n };\n}\n\ntype FunctionColumnConfig<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n> = {\n queryDefinition: QueryDefinition<unknown>;\n getParams: (\n objectSet: ObjectSet<Q, RDPs>,\n ) => unknown;\n columnIds: Array<{\n columnId: string;\n getValue?: (cellData: unknown) => unknown;\n getKey: (\n object: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n ) => string;\n }>;\n dedupeIntervalMs?: number;\n};\n\n// Function column data is readOnly and can be cached aggressively,\n// so we set a longer dedupe interval to maximize cache hits\nexport const DEFAULT_DEDUPE_INTERVAL_MS = 300_000; // 5 minutes\n\nexport function useFunctionColumnsData<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n>(\n objectSet: ObjectSet<Q, RDPs> | undefined,\n objects:\n | Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>[]\n | undefined,\n columnDefinitions?: Array<ColumnDefinition<Q, RDPs, FunctionColumns>>,\n): FunctionColumnData {\n // Function column configurations grouped by unique query definition\n const functionColumnConfigs = useMemo(\n () => getFunctionColumnConfigs(columnDefinitions),\n [columnDefinitions],\n );\n\n const stableObjects = useStableObjects(objects);\n\n // TODO: replace with useDeepEqual when it's added\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const stableObjectSet = useMemo(() => objectSet, [JSON.stringify(objectSet)]);\n\n const disabled = !stableObjectSet || !stableObjects?.length\n || functionColumnConfigs.length === 0;\n\n // Prepare queries for useOsdkFunctions\n const queries = useMemo(\n () => {\n if (disabled) {\n return [];\n }\n\n return functionColumnConfigs.map(\n (config): FunctionQueryParams<QueryDefinition<unknown>> => ({\n queryDefinition: config.queryDefinition,\n options: {\n params: config.getParams(stableObjectSet),\n dedupeIntervalMs: config.dedupeIntervalMs\n ?? DEFAULT_DEDUPE_INTERVAL_MS,\n } as FunctionQueryParams<QueryDefinition<unknown>>[\"options\"],\n }),\n );\n },\n [disabled, functionColumnConfigs, stableObjectSet],\n );\n\n const results = useOsdkFunctions(\n {\n queries,\n enabled: !disabled,\n },\n );\n\n const data = useMemo(() => {\n const columnData: FunctionColumnData = {};\n\n if (disabled || !stableObjects) return columnData;\n\n results.forEach((result, index) => {\n const config = functionColumnConfigs[index];\n if (!config) return;\n\n const functionsMap = result.data as Record<string, unknown> | undefined;\n\n config.columnIds.forEach(\n ({ columnId, getValue, getKey: columnGetKey }) => {\n if (!columnData[columnId]) {\n columnData[columnId] = {};\n }\n\n stableObjects.forEach(obj => {\n const key = String(obj.$primaryKey);\n\n if (result.isLoading) {\n columnData[columnId][key] = createAsyncCellData({\n isLoading: true,\n });\n } else if (result.error) {\n columnData[columnId][key] = createAsyncCellData({\n error: result.error,\n isLoading: false,\n });\n } else if (functionsMap) {\n const customKey = columnGetKey(obj);\n const rawData = functionsMap[customKey];\n const cellData = getValue ? getValue(rawData) : rawData;\n columnData[columnId][key] = createAsyncCellData({\n data: cellData,\n isLoading: false,\n });\n }\n });\n },\n );\n });\n\n return columnData;\n }, [results, functionColumnConfigs, stableObjects, disabled]);\n\n return data;\n}\n\nfunction getFunctionColumnConfigs<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n>(\n columnDefinitions?: Array<ColumnDefinition<Q, RDPs, FunctionColumns>>,\n): Array<FunctionColumnConfig<Q, RDPs>> {\n if (!columnDefinitions) return [];\n\n // Group columns by their query definition apiName\n const configsByApiName = new Map<\n string,\n FunctionColumnConfig<Q, RDPs>\n >();\n\n columnDefinitions.forEach((colDef) => {\n if (colDef.locator.type === \"function\") {\n const locator = colDef.locator as FunctionColumnLocator<\n Q,\n RDPs,\n FunctionColumns\n >;\n\n const apiName = locator.queryDefinition.apiName;\n const existingConfig = configsByApiName.get(apiName);\n\n if (existingConfig) {\n // Add this column to the existing config\n existingConfig.columnIds.push({\n columnId: String(locator.id),\n getValue: locator.getValue,\n getKey: locator.getKey,\n });\n // When multiple columns share a query, use the shortest dedupe interval\n if (locator.dedupeIntervalMs != null) {\n existingConfig.dedupeIntervalMs = existingConfig.dedupeIntervalMs\n != null\n ? Math.min(\n existingConfig.dedupeIntervalMs,\n locator.dedupeIntervalMs,\n )\n : locator.dedupeIntervalMs;\n }\n } else {\n // Create new config\n configsByApiName.set(apiName, {\n queryDefinition: locator.queryDefinition,\n getParams: locator.getFunctionParams,\n columnIds: [{\n columnId: String(locator.id),\n getValue: locator.getValue,\n getKey: locator.getKey,\n }],\n dedupeIntervalMs: locator.dedupeIntervalMs,\n });\n }\n }\n });\n\n return Array.from(configsByApiName.values());\n}\n\nconst useStableObjects = <\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n>(\n objects:\n | Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>[]\n | undefined,\n):\n | Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>[]\n | undefined =>\n{\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return useMemo(() => objects, [\n // eslint-disable-next-line react-hooks/exhaustive-deps\n JSON.stringify(\n (objects ?? []).map(item => ({\n $apiName: item.$apiName,\n $primaryKey: item.$primaryKey,\n })).sort((a, b) => {\n if (a.$apiName !== b.$apiName) {\n return a.$apiName.localeCompare(b.$apiName);\n }\n return String(a.$primaryKey).localeCompare(String(b.$primaryKey));\n }),\n ),\n ]);\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAUA,SAEEA,gBAAgB,QACX,0BAA0B;AAEjC,SAASC,OAAO,QAAQ,OAAO;AAK/B,SAEEC,mBAAmB,QACd,2BAA2B;AA0BlC;AACA;AACA,OAAO,MAAMC,0BAA0B,GAAG,OAAO,CAAC,CAAC;;AAEnD,OAAO,SAASC,sBAAsBA,CAQpCC,SAAyC,EACzCC,OAEa,EACbC,iBAAqE,EACjD;EACpB;EACA,MAAMC,qBAAqB,GAAGP,OAAO,CACnC,MAAMQ,wBAAwB,CAACF,iBAAiB,CAAC,EACjD,CAACA,iBAAiB,CACpB,CAAC;EAED,MAAMG,aAAa,GAAGC,gBAAgB,CAACL,OAAO,CAAC;;EAE/C;EACA;EACA,MAAMM,eAAe,GAAGX,OAAO,CAAC,MAAMI,SAAS,EAAE,CAACQ,IAAI,CAACC,SAAS,CAACT,SAAS,CAAC,CAAC,CAAC;EAE7E,MAAMU,QAAQ,GAAG,CAACH,eAAe,IAAI,CAACF,aAAa,EAAEM,MAAM,IACtDR,qBAAqB,CAACQ,MAAM,KAAK,CAAC;;EAEvC;EACA,MAAMC,OAAO,GAAGhB,OAAO,CACrB,MAAM;IACJ,IAAIc,QAAQ,EAAE;MACZ,OAAO,EAAE;IACX;IAEA,OAAOP,qBAAqB,CAACU,GAAG,CAC7BC,MAAM,KAAqD;MAC1DC,eAAe,EAAED,MAAM,CAACC,eAAe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KAAKG,CAAC,CAACH,QAAQ,EAAE;MAC7B,OAAOE,CAAC,CAACF,QAAQ,CAACI,aAAa,CAACD,CAAC,CAACH,QAAQ,CAAC;IAC7C;IACA,OAAOzB,MAAM,CAAC2B,CAAC,CAAC1B,WAAW,CAAC,CAAC4B,aAAa,CAAC7B,MAAM,CAAC4B,CAAC,CAAC3B,WAAW,CAAC,CAAC;EACnE,CAAC,CACH,CAAC,CACF,CAAC;AACJ,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"useFunctionColumnsData.js","names":["useOsdkFunctions","useMemo","createAsyncCellData","stripDerivedPropertiesFromParams","DEFAULT_DEDUPE_INTERVAL_MS","useFunctionColumnsData","objectSet","objects","columnDefinitions","functionColumnConfigs","getFunctionColumnConfigs","stableObjects","useStableObjects","stableObjectSet","JSON","stringify","disabled","length","queries","map","config","queryDefinition","options","params","getParams","dedupeIntervalMs","results","enabled","data","columnData","forEach","result","index","functionsMap","columnIds","columnId","getValue","getKey","columnGetKey","obj","key","String","$primaryKey","isLoading","error","customKey","rawData","cellData","configsByApiName","Map","colDef","locator","type","apiName","existingConfig","get","push","id","Math","min","set","getFunctionParams","Array","from","values","item","$apiName","sort","a","b","localeCompare"],"sources":["useFunctionColumnsData.ts"],"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 {\n ObjectOrInterfaceDefinition,\n ObjectSet,\n Osdk,\n PropertyKeys,\n QueryDefinition,\n SimplePropertyDef,\n} from \"@osdk/api\";\nimport {\n type FunctionQueryParams,\n useOsdkFunctions,\n} from \"@osdk/react/experimental\";\n\nimport { useMemo } from \"react\";\nimport type {\n ColumnDefinition,\n FunctionColumnLocator,\n} from \"../ObjectTableApi.js\";\nimport {\n type AsyncCellData,\n createAsyncCellData,\n} from \"../utils/AsyncCellData.js\";\nimport { stripDerivedPropertiesFromParams } from \"../utils/stripDerivedPropertiesFromParams.js\";\n\nexport interface FunctionColumnData {\n [columnId: string]: {\n [objectPrimaryKey: string]: AsyncCellData;\n };\n}\n\ntype FunctionColumnConfig<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n> = {\n queryDefinition: QueryDefinition<unknown>;\n getParams: (\n objectSet: ObjectSet<Q, RDPs>,\n ) => unknown;\n columnIds: Array<{\n columnId: string;\n getValue?: (cellData: unknown) => unknown;\n getKey: (\n object: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n ) => string;\n }>;\n dedupeIntervalMs?: number;\n};\n\n// Function column data is readOnly and can be cached aggressively,\n// so we set a longer dedupe interval to maximize cache hits\nexport const DEFAULT_DEDUPE_INTERVAL_MS = 300_000; // 5 minutes\n\nexport function useFunctionColumnsData<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n>(\n objectSet: ObjectSet<Q, RDPs> | undefined,\n objects:\n | Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>[]\n | undefined,\n columnDefinitions?: Array<ColumnDefinition<Q, RDPs, FunctionColumns>>,\n): FunctionColumnData {\n // Function column configurations grouped by unique query definition\n const functionColumnConfigs = useMemo(\n () => getFunctionColumnConfigs(columnDefinitions),\n [columnDefinitions],\n );\n\n const stableObjects = useStableObjects(objects);\n\n // TODO: replace with useDeepEqual when it's added\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const stableObjectSet = useMemo(() => objectSet, [JSON.stringify(objectSet)]);\n\n const disabled = !stableObjectSet || !stableObjects?.length\n || functionColumnConfigs.length === 0;\n\n // Prepare queries for useOsdkFunctions\n const queries = useMemo(\n () => {\n if (disabled) {\n return [];\n }\n\n return functionColumnConfigs.map(\n (config): FunctionQueryParams<QueryDefinition<unknown>> => ({\n queryDefinition: config.queryDefinition,\n options: {\n params: stripDerivedPropertiesFromParams(\n config.getParams(stableObjectSet),\n ),\n dedupeIntervalMs: config.dedupeIntervalMs\n ?? DEFAULT_DEDUPE_INTERVAL_MS,\n } as FunctionQueryParams<QueryDefinition<unknown>>[\"options\"],\n }),\n );\n },\n [disabled, functionColumnConfigs, stableObjectSet],\n );\n\n const results = useOsdkFunctions(\n {\n queries,\n enabled: !disabled,\n },\n );\n\n const data = useMemo(() => {\n const columnData: FunctionColumnData = {};\n\n if (disabled || !stableObjects) return columnData;\n\n results.forEach((result, index) => {\n const config = functionColumnConfigs[index];\n if (!config) return;\n\n const functionsMap = result.data as Record<string, unknown> | undefined;\n\n config.columnIds.forEach(\n ({ columnId, getValue, getKey: columnGetKey }) => {\n if (!columnData[columnId]) {\n columnData[columnId] = {};\n }\n\n stableObjects.forEach(obj => {\n const key = String(obj.$primaryKey);\n\n if (result.isLoading) {\n columnData[columnId][key] = createAsyncCellData({\n isLoading: true,\n });\n } else if (result.error) {\n columnData[columnId][key] = createAsyncCellData({\n error: result.error,\n isLoading: false,\n });\n } else if (functionsMap) {\n const customKey = columnGetKey(obj);\n const rawData = functionsMap[customKey];\n const cellData = getValue ? getValue(rawData) : rawData;\n columnData[columnId][key] = createAsyncCellData({\n data: cellData,\n isLoading: false,\n });\n }\n });\n },\n );\n });\n\n return columnData;\n }, [results, functionColumnConfigs, stableObjects, disabled]);\n\n return data;\n}\n\nfunction getFunctionColumnConfigs<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n>(\n columnDefinitions?: Array<ColumnDefinition<Q, RDPs, FunctionColumns>>,\n): Array<FunctionColumnConfig<Q, RDPs>> {\n if (!columnDefinitions) return [];\n\n // Group columns by their query definition apiName\n const configsByApiName = new Map<\n string,\n FunctionColumnConfig<Q, RDPs>\n >();\n\n columnDefinitions.forEach((colDef) => {\n if (colDef.locator.type === \"function\") {\n const locator = colDef.locator as FunctionColumnLocator<\n Q,\n RDPs,\n FunctionColumns\n >;\n\n const apiName = locator.queryDefinition.apiName;\n const existingConfig = configsByApiName.get(apiName);\n\n if (existingConfig) {\n // Add this column to the existing config\n existingConfig.columnIds.push({\n columnId: String(locator.id),\n getValue: locator.getValue,\n getKey: locator.getKey,\n });\n // When multiple columns share a query, use the shortest dedupe interval\n if (locator.dedupeIntervalMs != null) {\n existingConfig.dedupeIntervalMs = existingConfig.dedupeIntervalMs\n != null\n ? Math.min(\n existingConfig.dedupeIntervalMs,\n locator.dedupeIntervalMs,\n )\n : locator.dedupeIntervalMs;\n }\n } else {\n // Create new config\n configsByApiName.set(apiName, {\n queryDefinition: locator.queryDefinition,\n getParams: locator.getFunctionParams,\n columnIds: [{\n columnId: String(locator.id),\n getValue: locator.getValue,\n getKey: locator.getKey,\n }],\n dedupeIntervalMs: locator.dedupeIntervalMs,\n });\n }\n }\n });\n\n return Array.from(configsByApiName.values());\n}\n\nconst useStableObjects = <\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n>(\n objects:\n | Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>[]\n | undefined,\n):\n | Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>[]\n | undefined =>\n{\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return useMemo(() => objects, [\n // eslint-disable-next-line react-hooks/exhaustive-deps\n JSON.stringify(\n (objects ?? []).map(item => ({\n $apiName: item.$apiName,\n $primaryKey: item.$primaryKey,\n })).sort((a, b) => {\n if (a.$apiName !== b.$apiName) {\n return a.$apiName.localeCompare(b.$apiName);\n }\n return String(a.$primaryKey).localeCompare(String(b.$primaryKey));\n }),\n ),\n ]);\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAUA,SAEEA,gBAAgB,QACX,0BAA0B;AAEjC,SAASC,OAAO,QAAQ,OAAO;AAK/B,SAEEC,mBAAmB,QACd,2BAA2B;AAClC,SAASC,gCAAgC,QAAQ,8CAA8C;AA0B/F;AACA;AACA,OAAO,MAAMC,0BAA0B,GAAG,OAAO,CAAC,CAAC;;AAEnD,OAAO,SAASC,sBAAsBA,CAQpCC,SAAyC,EACzCC,OAEa,EACbC,iBAAqE,EACjD;EACpB;EACA,MAAMC,qBAAqB,GAAGR,OAAO,CACnC,MAAMS,wBAAwB,CAACF,iBAAiB,CAAC,EACjD,CAACA,iBAAiB,CACpB,CAAC;EAED,MAAMG,aAAa,GAAGC,gBAAgB,CAACL,OAAO,CAAC;;EAE/C;EACA;EACA,MAAMM,eAAe,GAAGZ,OAAO,CAAC,MAAMK,SAAS,EAAE,CAACQ,IAAI,CAACC,SAAS,CAACT,SAAS,CAAC,CAAC,CAAC;EAE7E,MAAMU,QAAQ,GAAG,CAACH,eAAe,IAAI,CAACF,aAAa,EAAEM,MAAM,IACtDR,qBAAqB,CAACQ,MAAM,KAAK,CAAC;;EAEvC;EACA,MAAMC,OAAO,GAAGjB,OAAO,CACrB,MAAM;IACJ,IAAIe,QAAQ,EAAE;MACZ,OAAO,EAAE;IACX;IAEA,OAAOP,qBAAqB,CAACU,GAAG,CAC7BC,MAAM,KAAqD;MAC1DC,eAAe,EAAED,MAAM,CAACC,eAAe;MACvCC,OAAO,EAAE;QACPC,MAAM,EAAEpB,gCAAgC,CACtCiB,MAAM,CAACI,SAAS,CAACX,eAAe,CAClC,CAAC;QACDY,gBAAgB,EAAEL,MAAM,CAACK,gBAAgB,IACpCrB;MACP;IACF,CAAC,CACH,C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CAAC1B,WAAW,CAAC,CAAC4B,aAAa,CAAC7B,MAAM,CAAC4B,CAAC,CAAC3B,WAAW,CAAC,CAAC;EACnE,CAAC,CACH,CAAC,CACF,CAAC;AACJ,CAAC","ignoreList":[]}
|
|
@@ -18,13 +18,15 @@ import { useObjectSet, useOsdkObjects } from "@osdk/react/experimental";
|
|
|
18
18
|
import { useMemo } from "react";
|
|
19
19
|
import { useFunctionColumnsData } from "./useFunctionColumnsData.js";
|
|
20
20
|
const PAGE_SIZE = 50;
|
|
21
|
+
const DEFAULT_DEDUPE_INTERVAL_MS = 60_000;
|
|
21
22
|
/**
|
|
22
23
|
* This hook is a wrapper that conditionally uses either useObjectSet or useOsdkObjects
|
|
23
24
|
* based on whether an objectSet prop is provided.
|
|
24
25
|
* It extracts RDP locators from columnDefinitions and applies withProperties
|
|
25
26
|
* to return data containing the derived properties.
|
|
26
27
|
*/
|
|
27
|
-
export function useObjectTableData(objectOrInterfaceType, columnDefinitions, filter, sorting, objectSet, objectSetOptions) {
|
|
28
|
+
export function useObjectTableData(objectOrInterfaceType, columnDefinitions, filter, sorting, objectSet, objectSetOptions, dedupeIntervalMs) {
|
|
29
|
+
const resolvedDedupeIntervalMs = dedupeIntervalMs ?? DEFAULT_DEDUPE_INTERVAL_MS;
|
|
28
30
|
const orderBy = useMemo(() => {
|
|
29
31
|
if (!sorting || sorting.length === 0) {
|
|
30
32
|
return undefined;
|
|
@@ -66,21 +68,23 @@ export function useObjectTableData(objectOrInterfaceType, columnDefinitions, fil
|
|
|
66
68
|
where: filter,
|
|
67
69
|
orderBy,
|
|
68
70
|
pageSize: PAGE_SIZE,
|
|
69
|
-
enabled: shouldUseObjectSet
|
|
71
|
+
enabled: shouldUseObjectSet,
|
|
72
|
+
dedupeIntervalMs: resolvedDedupeIntervalMs
|
|
70
73
|
});
|
|
71
74
|
const osdkObjectsResult = useOsdkObjects(objectOrInterfaceType, {
|
|
72
75
|
withProperties,
|
|
73
76
|
pageSize: PAGE_SIZE,
|
|
74
77
|
where: filter,
|
|
75
78
|
orderBy,
|
|
76
|
-
enabled: !shouldUseObjectSet
|
|
79
|
+
enabled: !shouldUseObjectSet,
|
|
80
|
+
dedupeIntervalMs: resolvedDedupeIntervalMs
|
|
77
81
|
});
|
|
78
82
|
|
|
79
83
|
// Get the result from the appropriate hook
|
|
80
84
|
const baseResult = shouldUseObjectSet ? objectSetResult : osdkObjectsResult;
|
|
81
85
|
|
|
82
86
|
// Call useFunctionColumnsData to get function column data
|
|
83
|
-
const functionColumnData = useFunctionColumnsData(
|
|
87
|
+
const functionColumnData = useFunctionColumnsData(baseResult.objectSet, baseResult.data, columnDefinitions);
|
|
84
88
|
|
|
85
89
|
// Merge function column data into each object
|
|
86
90
|
const mergedData = useMemo(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useObjectTableData.js","names":["useObjectSet","useOsdkObjects","useMemo","useFunctionColumnsData","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","baseResult","functionColumnData","data","mergedData","obj","objKey","String","$primaryKey","functionData","Object","entries","forEach","columnId","columnData"],"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\";\nimport type { AsyncCellData } from \"../utils/AsyncCellData.js\";\nimport { useFunctionColumnsData } from \"./useFunctionColumnsData.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\ninterface UseObjectTableDataResult<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n> extends Omit<UseOsdkListResult<Q, RDPs>, \"isOptimistic\"> {}\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): UseObjectTableDataResult<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, RDPs> : 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 // Get the result from the appropriate hook\n const baseResult = shouldUseObjectSet ? objectSetResult : osdkObjectsResult;\n\n // Call useFunctionColumnsData to get function column data\n const functionColumnData = useFunctionColumnsData<Q, RDPs, FunctionColumns>(\n
|
|
1
|
+
{"version":3,"file":"useObjectTableData.js","names":["useObjectSet","useOsdkObjects","useMemo","useFunctionColumnsData","PAGE_SIZE","DEFAULT_DEDUPE_INTERVAL_MS","useObjectTableData","objectOrInterfaceType","columnDefinitions","filter","sorting","objectSet","objectSetOptions","dedupeIntervalMs","resolvedDedupeIntervalMs","orderBy","length","undefined","reduce","acc","sort","id","desc","withProperties","rdpColumns","map","colDef","locator","colLocator","type","cur","creator","isObjectType","shouldUseObjectSet","objectSetResult","where","pageSize","enabled","osdkObjectsResult","baseResult","functionColumnData","data","mergedData","obj","objKey","String","$primaryKey","functionData","Object","entries","forEach","columnId","columnData"],"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\";\nimport type { AsyncCellData } from \"../utils/AsyncCellData.js\";\nimport { useFunctionColumnsData } from \"./useFunctionColumnsData.js\";\n\nconst PAGE_SIZE = 50;\nconst DEFAULT_DEDUPE_INTERVAL_MS = 60_000;\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\ninterface UseObjectTableDataResult<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n> extends Omit<UseOsdkListResult<Q, RDPs>, \"isOptimistic\"> {}\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 dedupeIntervalMs?: number,\n): UseObjectTableDataResult<Q, RDPs> {\n const resolvedDedupeIntervalMs = dedupeIntervalMs\n ?? DEFAULT_DEDUPE_INTERVAL_MS;\n\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, RDPs> : 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 dedupeIntervalMs: resolvedDedupeIntervalMs,\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 dedupeIntervalMs: resolvedDedupeIntervalMs,\n },\n );\n\n // Get the result from the appropriate hook\n const baseResult = shouldUseObjectSet ? objectSetResult : osdkObjectsResult;\n\n // Call useFunctionColumnsData to get function column data\n const functionColumnData = useFunctionColumnsData<Q, RDPs, FunctionColumns>(\n baseResult.objectSet,\n baseResult.data,\n columnDefinitions,\n );\n\n // Merge function column data into each object\n const mergedData = useMemo(() => {\n if (!baseResult.data) return baseResult.data;\n\n return baseResult.data.map(obj => {\n const objKey = String(obj.$primaryKey);\n const functionData: Record<string, AsyncCellData> = {};\n\n // Collect all function column data for this object\n Object.entries(functionColumnData).forEach(([columnId, columnData]) => {\n if (columnData[objKey]) {\n functionData[columnId] = columnData[objKey];\n }\n });\n\n // Return object with function data merged in\n return {\n ...obj,\n ...functionData,\n };\n });\n }, [baseResult.data, functionColumnData]);\n\n // Return the result with merged data\n return {\n ...baseResult,\n data: mergedData,\n } as UseObjectTableDataResult<Q, RDPs>;\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,SAASC,sBAAsB,QAAQ,6BAA6B;AAEpE,MAAMC,SAA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,KAAK;QACrE,IAAIA,UAAU,CAACR,MAAM,CAAC,EAAE;UACtBG,YAAY,CAACI,QAAQ,CAAC,GAAGC,UAAU,CAACR,MAAM,CAAC;QAC7C;MACF,CAAC,CAAC;;MAEF;MACA,OAAO;QACL,GAAGD,GAAG;QACN,GAAGI;MACL,CAAC;IACH,CAAC,CAAC;EACJ,CAAC,EAAE,CAACR,UAAU,CAACE,IAAI,EAAED,kBAAkB,CAAC,CAAC;;EAEzC;EACA,OAAO;IACL,GAAGD,UAAU;IACbE,IAAI,EAAEC;EACR,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1,61 @@
|
|
|
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 { getWireObjectSet, isObjectSet } from "@osdk/client";
|
|
18
|
+
|
|
19
|
+
// TODO: Remove this workaround once function queries support
|
|
20
|
+
// derivedProperties (withProperties) in the ObjectSet payload.
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Function queries fail when the payload contains ObjectSets with
|
|
24
|
+
* derivedProperties (withProperties nodes). This strips them by
|
|
25
|
+
* converting any ObjectSet param values to their wire representation
|
|
26
|
+
* with withProperties nodes unwrapped.
|
|
27
|
+
*/
|
|
28
|
+
export function stripDerivedPropertiesFromParams(params) {
|
|
29
|
+
if (params == null || typeof params !== "object") {
|
|
30
|
+
return params;
|
|
31
|
+
}
|
|
32
|
+
if (isObjectSet(params)) {
|
|
33
|
+
const wire = getWireObjectSet(params);
|
|
34
|
+
return stripWithPropertiesFromWire(wire);
|
|
35
|
+
}
|
|
36
|
+
if (Array.isArray(params)) {
|
|
37
|
+
return params.map(stripDerivedPropertiesFromParams);
|
|
38
|
+
}
|
|
39
|
+
const result = {};
|
|
40
|
+
for (const [key, value] of Object.entries(params)) {
|
|
41
|
+
result[key] = stripDerivedPropertiesFromParams(value);
|
|
42
|
+
}
|
|
43
|
+
return result;
|
|
44
|
+
}
|
|
45
|
+
export function stripWithPropertiesFromWire(wire) {
|
|
46
|
+
if (wire.type === "withProperties") {
|
|
47
|
+
return stripWithPropertiesFromWire(wire.objectSet);
|
|
48
|
+
}
|
|
49
|
+
const result = {};
|
|
50
|
+
for (const [key, value] of Object.entries(wire)) {
|
|
51
|
+
if (key === "objectSet" && value != null && typeof value === "object" && !Array.isArray(value)) {
|
|
52
|
+
result[key] = stripWithPropertiesFromWire(value);
|
|
53
|
+
} else if (key === "objectSets" && Array.isArray(value)) {
|
|
54
|
+
result[key] = value.map(os => stripWithPropertiesFromWire(os));
|
|
55
|
+
} else {
|
|
56
|
+
result[key] = value;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return result;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=stripDerivedPropertiesFromParams.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stripDerivedPropertiesFromParams.js","names":["getWireObjectSet","isObjectSet","stripDerivedPropertiesFromParams","params","wire","stripWithPropertiesFromWire","Array","isArray","map","result","key","value","Object","entries","type","objectSet","os"],"sources":["stripDerivedPropertiesFromParams.ts"],"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 { getWireObjectSet, isObjectSet } from \"@osdk/client\";\n\n// TODO: Remove this workaround once function queries support\n// derivedProperties (withProperties) in the ObjectSet payload.\n\n/**\n * Function queries fail when the payload contains ObjectSets with\n * derivedProperties (withProperties nodes). This strips them by\n * converting any ObjectSet param values to their wire representation\n * with withProperties nodes unwrapped.\n */\nexport function stripDerivedPropertiesFromParams(params: unknown): unknown {\n if (params == null || typeof params !== \"object\") {\n return params;\n }\n\n if (isObjectSet(params)) {\n const wire = getWireObjectSet(params) as unknown as Record<\n string,\n unknown\n >;\n return stripWithPropertiesFromWire(wire);\n }\n\n if (Array.isArray(params)) {\n return params.map(stripDerivedPropertiesFromParams);\n }\n\n const result: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(params)) {\n result[key] = stripDerivedPropertiesFromParams(value);\n }\n return result;\n}\n\nexport function stripWithPropertiesFromWire(\n wire: Record<string, unknown>,\n): Record<string, unknown> {\n if (wire.type === \"withProperties\") {\n return stripWithPropertiesFromWire(\n wire.objectSet as Record<string, unknown>,\n );\n }\n\n const result: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(wire)) {\n if (\n key === \"objectSet\" && value != null && typeof value === \"object\"\n && !Array.isArray(value)\n ) {\n result[key] = stripWithPropertiesFromWire(\n value as Record<string, unknown>,\n );\n } else if (key === \"objectSets\" && Array.isArray(value)) {\n result[key] = value.map(os =>\n stripWithPropertiesFromWire(os as Record<string, unknown>)\n );\n } else {\n result[key] = value;\n }\n }\n return result;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,gBAAgB,EAAEC,WAAW,QAAQ,cAAc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K,CAACC,OAAO,CAACI,KAAK,CAAC,EAAE;MACvDF,MAAM,CAACC,GAAG,CAAC,GAAGC,KAAK,CAACH,GAAG,CAACQ,EAAE,IACxBX,2BAA2B,CAACW,EAA6B,CAC3D,CAAC;IACH,CAAC,MAAM;MACLP,MAAM,CAACC,GAAG,CAAC,GAAGC,KAAK;IACrB;EACF;EACA,OAAOF,MAAM;AACf","ignoreList":[]}
|
|
@@ -19,6 +19,7 @@ var checkbox = require('@base-ui/react/checkbox');
|
|
|
19
19
|
var combobox = require('@base-ui/react/combobox');
|
|
20
20
|
var react = require('@osdk/react');
|
|
21
21
|
var reactTable = require('@tanstack/react-table');
|
|
22
|
+
var client = require('@osdk/client');
|
|
22
23
|
var collapsible = require('@base-ui/react/collapsible');
|
|
23
24
|
var reactVirtual = require('@tanstack/react-virtual');
|
|
24
25
|
var reactDom = require('react-dom');
|
|
@@ -4666,6 +4667,41 @@ function useEditableTable({
|
|
|
4666
4667
|
clearCellValidationError
|
|
4667
4668
|
};
|
|
4668
4669
|
}
|
|
4670
|
+
function stripDerivedPropertiesFromParams(params) {
|
|
4671
|
+
if (params == null || typeof params !== "object") {
|
|
4672
|
+
return params;
|
|
4673
|
+
}
|
|
4674
|
+
if (client.isObjectSet(params)) {
|
|
4675
|
+
const wire = client.getWireObjectSet(params);
|
|
4676
|
+
return stripWithPropertiesFromWire(wire);
|
|
4677
|
+
}
|
|
4678
|
+
if (Array.isArray(params)) {
|
|
4679
|
+
return params.map(stripDerivedPropertiesFromParams);
|
|
4680
|
+
}
|
|
4681
|
+
const result = {};
|
|
4682
|
+
for (const [key, value] of Object.entries(params)) {
|
|
4683
|
+
result[key] = stripDerivedPropertiesFromParams(value);
|
|
4684
|
+
}
|
|
4685
|
+
return result;
|
|
4686
|
+
}
|
|
4687
|
+
function stripWithPropertiesFromWire(wire) {
|
|
4688
|
+
if (wire.type === "withProperties") {
|
|
4689
|
+
return stripWithPropertiesFromWire(wire.objectSet);
|
|
4690
|
+
}
|
|
4691
|
+
const result = {};
|
|
4692
|
+
for (const [key, value] of Object.entries(wire)) {
|
|
4693
|
+
if (key === "objectSet" && value != null && typeof value === "object" && !Array.isArray(value)) {
|
|
4694
|
+
result[key] = stripWithPropertiesFromWire(value);
|
|
4695
|
+
} else if (key === "objectSets" && Array.isArray(value)) {
|
|
4696
|
+
result[key] = value.map((os) => stripWithPropertiesFromWire(os));
|
|
4697
|
+
} else {
|
|
4698
|
+
result[key] = value;
|
|
4699
|
+
}
|
|
4700
|
+
}
|
|
4701
|
+
return result;
|
|
4702
|
+
}
|
|
4703
|
+
|
|
4704
|
+
// src/object-table/hooks/useFunctionColumnsData.ts
|
|
4669
4705
|
var DEFAULT_DEDUPE_INTERVAL_MS = 3e5;
|
|
4670
4706
|
function useFunctionColumnsData(objectSet, objects, columnDefinitions) {
|
|
4671
4707
|
const functionColumnConfigs = React76.useMemo(() => getFunctionColumnConfigs(columnDefinitions), [columnDefinitions]);
|
|
@@ -4679,7 +4715,7 @@ function useFunctionColumnsData(objectSet, objects, columnDefinitions) {
|
|
|
4679
4715
|
return functionColumnConfigs.map((config) => ({
|
|
4680
4716
|
queryDefinition: config.queryDefinition,
|
|
4681
4717
|
options: {
|
|
4682
|
-
params: config.getParams(stableObjectSet),
|
|
4718
|
+
params: stripDerivedPropertiesFromParams(config.getParams(stableObjectSet)),
|
|
4683
4719
|
dedupeIntervalMs: config.dedupeIntervalMs ?? DEFAULT_DEDUPE_INTERVAL_MS
|
|
4684
4720
|
}
|
|
4685
4721
|
}));
|
|
@@ -4780,7 +4816,9 @@ var useStableObjects = (objects) => {
|
|
|
4780
4816
|
|
|
4781
4817
|
// src/object-table/hooks/useObjectTableData.ts
|
|
4782
4818
|
var PAGE_SIZE = 50;
|
|
4783
|
-
|
|
4819
|
+
var DEFAULT_DEDUPE_INTERVAL_MS2 = 6e4;
|
|
4820
|
+
function useObjectTableData(objectOrInterfaceType, columnDefinitions, filter, sorting, objectSet, objectSetOptions, dedupeIntervalMs) {
|
|
4821
|
+
const resolvedDedupeIntervalMs = dedupeIntervalMs ?? DEFAULT_DEDUPE_INTERVAL_MS2;
|
|
4784
4822
|
const orderBy = React76.useMemo(() => {
|
|
4785
4823
|
if (!sorting || sorting.length === 0) {
|
|
4786
4824
|
return void 0;
|
|
@@ -4815,17 +4853,19 @@ function useObjectTableData(objectOrInterfaceType, columnDefinitions, filter, so
|
|
|
4815
4853
|
where: filter,
|
|
4816
4854
|
orderBy,
|
|
4817
4855
|
pageSize: PAGE_SIZE,
|
|
4818
|
-
enabled: shouldUseObjectSet
|
|
4856
|
+
enabled: shouldUseObjectSet,
|
|
4857
|
+
dedupeIntervalMs: resolvedDedupeIntervalMs
|
|
4819
4858
|
});
|
|
4820
4859
|
const osdkObjectsResult = experimental.useOsdkObjects(objectOrInterfaceType, {
|
|
4821
4860
|
withProperties,
|
|
4822
4861
|
pageSize: PAGE_SIZE,
|
|
4823
4862
|
where: filter,
|
|
4824
4863
|
orderBy,
|
|
4825
|
-
enabled: !shouldUseObjectSet
|
|
4864
|
+
enabled: !shouldUseObjectSet,
|
|
4865
|
+
dedupeIntervalMs: resolvedDedupeIntervalMs
|
|
4826
4866
|
});
|
|
4827
4867
|
const baseResult = shouldUseObjectSet ? objectSetResult : osdkObjectsResult;
|
|
4828
|
-
const functionColumnData = useFunctionColumnsData(
|
|
4868
|
+
const functionColumnData = useFunctionColumnsData(baseResult.objectSet, baseResult.data, columnDefinitions);
|
|
4829
4869
|
const mergedData = React76.useMemo(() => {
|
|
4830
4870
|
if (!baseResult.data) return baseResult.data;
|
|
4831
4871
|
return baseResult.data.map((obj) => {
|
|
@@ -6417,6 +6457,7 @@ function ObjectTable({
|
|
|
6417
6457
|
columnDefinitions,
|
|
6418
6458
|
filter,
|
|
6419
6459
|
objectSetOptions,
|
|
6460
|
+
dedupeIntervalMs,
|
|
6420
6461
|
orderBy,
|
|
6421
6462
|
defaultOrderBy,
|
|
6422
6463
|
onOrderByChanged,
|
|
@@ -6456,7 +6497,7 @@ function ObjectTable({
|
|
|
6456
6497
|
fetchMore,
|
|
6457
6498
|
isLoading,
|
|
6458
6499
|
error
|
|
6459
|
-
} = useObjectTableData(objectType, columnDefinitions, filter, sorting, objectSet, objectSetOptions);
|
|
6500
|
+
} = useObjectTableData(objectType, columnDefinitions, filter, sorting, objectSet, objectSetOptions, dedupeIntervalMs);
|
|
6460
6501
|
const {
|
|
6461
6502
|
columns,
|
|
6462
6503
|
loading: isColumnsLoading
|