@osdk/react-components 0.1.0-beta.3 → 0.1.0-beta.5
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 +28 -0
- package/build/browser/base-components/checkbox/Checkbox.module.css +11 -10
- package/build/browser/object-table/CellContextMenu.js +2 -2
- package/build/browser/object-table/CellContextMenu.js.map +1 -1
- package/build/browser/object-table/CellContextMenu.module.css +20 -0
- package/build/browser/object-table/ObjectTable.js +37 -10
- 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/Table.js +7 -16
- package/build/browser/object-table/Table.js.map +1 -1
- package/build/browser/object-table/Table.module.css +22 -0
- package/build/browser/object-table/TableBody.js +2 -2
- package/build/browser/object-table/TableBody.js.map +1 -1
- package/build/browser/object-table/TableBody.module.css +20 -0
- package/build/browser/object-table/TableCell.js +12 -7
- package/build/browser/object-table/TableCell.js.map +1 -1
- package/build/browser/object-table/TableCell.module.css +63 -0
- package/build/browser/object-table/TableHeader.js +35 -38
- package/build/browser/object-table/TableHeader.js.map +1 -1
- package/build/browser/object-table/TableHeader.module.css +95 -0
- package/build/browser/object-table/TableHeaderContent.js +27 -0
- package/build/browser/object-table/TableHeaderContent.js.map +1 -0
- package/build/browser/object-table/TableHeaderContent.module.css +30 -0
- package/build/browser/object-table/TableHeaderWithPopover.js +155 -0
- package/build/browser/object-table/TableHeaderWithPopover.js.map +1 -0
- package/build/browser/object-table/TableHeaderWithPopover.module.css +105 -0
- package/build/browser/object-table/TableRow.js +4 -3
- package/build/browser/object-table/TableRow.js.map +1 -1
- package/build/browser/object-table/TableRow.module.css +60 -0
- package/build/browser/object-table/hooks/__tests__/useColumnPinning.test.js +266 -0
- package/build/browser/object-table/hooks/__tests__/useColumnPinning.test.js.map +1 -0
- package/build/browser/object-table/hooks/__tests__/{useDefaultTableStates.test.js → useColumnVisibility.test.js} +16 -16
- package/build/browser/object-table/hooks/__tests__/useColumnVisibility.test.js.map +1 -0
- package/build/browser/object-table/hooks/__tests__/useSelectionColumn.test.js +2 -1
- package/build/browser/object-table/hooks/__tests__/useSelectionColumn.test.js.map +1 -1
- package/build/browser/object-table/hooks/__tests__/useTableSorting.test.js +211 -0
- package/build/browser/object-table/hooks/__tests__/useTableSorting.test.js.map +1 -0
- package/build/browser/object-table/hooks/useColumnPinning.js +95 -0
- package/build/browser/object-table/hooks/useColumnPinning.js.map +1 -0
- package/build/{esm/object-table/hooks/useDefaultTableStates.js → browser/object-table/hooks/useColumnVisibility.js} +3 -5
- package/build/browser/object-table/hooks/useColumnVisibility.js.map +1 -0
- package/build/browser/object-table/hooks/useObjectTableData.js +15 -3
- package/build/browser/object-table/hooks/useObjectTableData.js.map +1 -1
- package/build/browser/object-table/hooks/useSelectionColumn.js +3 -2
- package/build/browser/object-table/hooks/useSelectionColumn.js.map +1 -1
- package/build/browser/object-table/hooks/useTableSorting.js +66 -0
- package/build/browser/object-table/hooks/useTableSorting.js.map +1 -0
- package/build/browser/object-table/utils/constants.js +18 -0
- package/build/browser/object-table/utils/constants.js.map +1 -0
- package/build/browser/object-table/utils/getColumnPinningStyles.js +27 -0
- package/build/browser/object-table/utils/getColumnPinningStyles.js.map +1 -0
- package/build/browser/public/experimental.js +4 -0
- package/build/browser/public/experimental.js.map +1 -1
- package/build/cjs/public/experimental.cjs +446 -129
- package/build/cjs/public/experimental.cjs.map +1 -1
- package/build/cjs/public/experimental.css +248 -4
- package/build/cjs/public/experimental.css.map +1 -1
- package/build/cjs/public/experimental.d.cts +26 -3
- package/build/esm/base-components/checkbox/Checkbox.module.css +11 -10
- package/build/esm/object-table/CellContextMenu.js +2 -2
- package/build/esm/object-table/CellContextMenu.js.map +1 -1
- package/build/esm/object-table/CellContextMenu.module.css +20 -0
- package/build/esm/object-table/ObjectTable.js +37 -10
- 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/Table.js +7 -16
- package/build/esm/object-table/Table.js.map +1 -1
- package/build/esm/object-table/Table.module.css +22 -0
- package/build/esm/object-table/TableBody.js +2 -2
- package/build/esm/object-table/TableBody.js.map +1 -1
- package/build/esm/object-table/TableBody.module.css +20 -0
- package/build/esm/object-table/TableCell.js +12 -7
- package/build/esm/object-table/TableCell.js.map +1 -1
- package/build/esm/object-table/TableCell.module.css +63 -0
- package/build/esm/object-table/TableHeader.js +35 -38
- package/build/esm/object-table/TableHeader.js.map +1 -1
- package/build/esm/object-table/TableHeader.module.css +95 -0
- package/build/esm/object-table/TableHeaderContent.js +27 -0
- package/build/esm/object-table/TableHeaderContent.js.map +1 -0
- package/build/esm/object-table/TableHeaderContent.module.css +30 -0
- package/build/esm/object-table/TableHeaderWithPopover.js +155 -0
- package/build/esm/object-table/TableHeaderWithPopover.js.map +1 -0
- package/build/esm/object-table/TableHeaderWithPopover.module.css +105 -0
- package/build/esm/object-table/TableRow.js +4 -3
- package/build/esm/object-table/TableRow.js.map +1 -1
- package/build/esm/object-table/TableRow.module.css +60 -0
- package/build/esm/object-table/hooks/__tests__/useColumnPinning.test.js +266 -0
- package/build/esm/object-table/hooks/__tests__/useColumnPinning.test.js.map +1 -0
- package/build/esm/object-table/hooks/__tests__/{useDefaultTableStates.test.js → useColumnVisibility.test.js} +16 -16
- package/build/esm/object-table/hooks/__tests__/useColumnVisibility.test.js.map +1 -0
- package/build/esm/object-table/hooks/__tests__/useSelectionColumn.test.js +2 -1
- package/build/esm/object-table/hooks/__tests__/useSelectionColumn.test.js.map +1 -1
- package/build/esm/object-table/hooks/__tests__/useTableSorting.test.js +211 -0
- package/build/esm/object-table/hooks/__tests__/useTableSorting.test.js.map +1 -0
- package/build/esm/object-table/hooks/useColumnPinning.js +95 -0
- package/build/esm/object-table/hooks/useColumnPinning.js.map +1 -0
- package/build/{browser/object-table/hooks/useDefaultTableStates.js → esm/object-table/hooks/useColumnVisibility.js} +3 -5
- package/build/esm/object-table/hooks/useColumnVisibility.js.map +1 -0
- package/build/esm/object-table/hooks/useObjectTableData.js +15 -3
- package/build/esm/object-table/hooks/useObjectTableData.js.map +1 -1
- package/build/esm/object-table/hooks/useSelectionColumn.js +3 -2
- package/build/esm/object-table/hooks/useSelectionColumn.js.map +1 -1
- package/build/esm/object-table/hooks/useTableSorting.js +66 -0
- package/build/esm/object-table/hooks/useTableSorting.js.map +1 -0
- package/build/esm/object-table/utils/constants.js +18 -0
- package/build/esm/object-table/utils/constants.js.map +1 -0
- package/build/esm/object-table/utils/getColumnPinningStyles.js +27 -0
- package/build/esm/object-table/utils/getColumnPinningStyles.js.map +1 -0
- package/build/esm/public/experimental.js +4 -0
- package/build/esm/public/experimental.js.map +1 -1
- package/build/types/object-table/CellContextMenu.d.ts.map +1 -1
- 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 +11 -0
- package/build/types/object-table/ObjectTableApi.d.ts.map +1 -1
- package/build/types/object-table/Table.d.ts +3 -3
- package/build/types/object-table/Table.d.ts.map +1 -1
- package/build/types/object-table/TableBody.d.ts.map +1 -1
- package/build/types/object-table/TableCell.d.ts.map +1 -1
- package/build/types/object-table/TableHeader.d.ts.map +1 -1
- package/build/types/object-table/TableHeaderContent.d.ts +7 -0
- package/build/types/object-table/TableHeaderContent.d.ts.map +1 -0
- package/build/types/object-table/TableHeaderWithPopover.d.ts +13 -0
- package/build/types/object-table/TableHeaderWithPopover.d.ts.map +1 -0
- package/build/types/object-table/TableRow.d.ts.map +1 -1
- package/build/types/object-table/hooks/__tests__/useColumnPinning.test.d.ts.map +1 -0
- package/build/types/object-table/hooks/__tests__/useColumnVisibility.test.d.ts +1 -0
- package/build/types/object-table/hooks/__tests__/useColumnVisibility.test.d.ts.map +1 -0
- package/build/types/object-table/hooks/__tests__/useTableSorting.test.d.ts +1 -0
- package/build/types/object-table/hooks/__tests__/useTableSorting.test.d.ts.map +1 -0
- package/build/types/object-table/hooks/useColumnPinning.d.ts +22 -0
- package/build/types/object-table/hooks/useColumnPinning.d.ts.map +1 -0
- package/build/types/object-table/hooks/{useDefaultTableStates.d.ts → useColumnVisibility.d.ts} +3 -6
- package/build/types/object-table/hooks/useColumnVisibility.d.ts.map +1 -0
- package/build/types/object-table/hooks/useObjectTableData.d.ts +2 -1
- package/build/types/object-table/hooks/useObjectTableData.d.ts.map +1 -1
- package/build/types/object-table/hooks/useSelectionColumn.d.ts +0 -1
- package/build/types/object-table/hooks/useSelectionColumn.d.ts.map +1 -1
- package/build/types/object-table/hooks/useTableSorting.d.ts +22 -0
- package/build/types/object-table/hooks/useTableSorting.d.ts.map +1 -0
- package/build/types/object-table/utils/constants.d.ts +1 -0
- package/build/types/object-table/utils/constants.d.ts.map +1 -0
- package/build/types/object-table/utils/getColumnPinningStyles.d.ts +7 -0
- package/build/types/object-table/utils/getColumnPinningStyles.d.ts.map +1 -0
- package/build/types/public/experimental.d.ts +2 -0
- package/build/types/public/experimental.d.ts.map +1 -1
- package/package.json +8 -8
- package/build/browser/object-table/hooks/__tests__/useDefaultTableStates.test.js.map +0 -1
- package/build/browser/object-table/hooks/useDefaultTableStates.js.map +0 -1
- package/build/esm/object-table/hooks/__tests__/useDefaultTableStates.test.js.map +0 -1
- package/build/esm/object-table/hooks/useDefaultTableStates.js.map +0 -1
- package/build/types/object-table/hooks/__tests__/useDefaultTableStates.test.d.ts.map +0 -1
- package/build/types/object-table/hooks/useDefaultTableStates.d.ts.map +0 -1
- /package/build/types/object-table/hooks/__tests__/{useDefaultTableStates.test.d.ts → useColumnPinning.test.d.ts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTableSorting.js","names":["useCallback","useMemo","useState","useTableSorting","orderBy","defaultOrderBy","onOrderByChanged","internalSorting","setInternalSorting","convertOrderByToSortingState","isControlled","undefined","sortingState","onSortingChange","updater","newSorting","newOrderBy","convertSortingStateToOrderBy","sorting","map","property","direction","id","desc"],"sources":["useTableSorting.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 ObjectTypeDefinition,\n PropertyKeys,\n QueryDefinition,\n SimplePropertyDef,\n} from \"@osdk/api\";\nimport type { OnChangeFn, SortingState } from \"@tanstack/react-table\";\nimport { useCallback, useMemo, useState } from \"react\";\nimport type { ObjectTableProps } from \"../ObjectTableApi.js\";\n\ninterface UseTableSortingProps<\n Q extends ObjectTypeDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n> {\n orderBy?: ObjectTableProps<Q, RDPs, FunctionColumns>[\"orderBy\"];\n\n defaultOrderBy?: ObjectTableProps<Q, RDPs, FunctionColumns>[\"defaultOrderBy\"];\n\n onOrderByChanged?: ObjectTableProps<\n Q,\n RDPs,\n FunctionColumns\n >[\"onOrderByChanged\"];\n}\n\ninterface UseTableSortingResults {\n sorting: SortingState;\n onSortingChange: OnChangeFn<SortingState>;\n}\n\nexport const useTableSorting = <\n Q extends ObjectTypeDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n>({\n orderBy,\n defaultOrderBy,\n onOrderByChanged,\n}: UseTableSortingProps<Q, RDPs, FunctionColumns>): UseTableSortingResults => {\n // The sorting state in uncontrolled mode\n const [internalSorting, setInternalSorting] = useState<SortingState>(() =>\n defaultOrderBy ? convertOrderByToSortingState(defaultOrderBy) : []\n );\n\n const isControlled = orderBy !== undefined;\n\n // Sorting state\n // If controlled mode, return the state from orderBy prop\n // If uncontrolled, return the internalSorting state\n const sortingState: SortingState = useMemo(\n () => (orderBy ? convertOrderByToSortingState(orderBy) : internalSorting),\n [orderBy, internalSorting],\n );\n\n const onSortingChange: OnChangeFn<SortingState> = useCallback(\n (updater) => {\n const newSorting = typeof updater === \"function\"\n ? updater(sortingState)\n : updater;\n\n // Update internal state if uncontrolled\n if (!isControlled) {\n setInternalSorting(newSorting);\n }\n\n if (onOrderByChanged) {\n const newOrderBy = convertSortingStateToOrderBy<Q>(newSorting);\n onOrderByChanged(newOrderBy);\n }\n },\n [isControlled, sortingState, onOrderByChanged],\n );\n\n return { sorting: sortingState, onSortingChange };\n};\n\nfunction convertOrderByToSortingState<Q extends ObjectTypeDefinition>(\n orderBy: Array<{\n property: PropertyKeys<Q>;\n direction: \"asc\" | \"desc\";\n }>,\n): SortingState {\n return orderBy.map(({ property, direction }) => ({\n id: property,\n desc: direction === \"desc\",\n }));\n}\n\nfunction convertSortingStateToOrderBy<Q extends ObjectTypeDefinition>(\n sorting: SortingState,\n): Array<{\n property: PropertyKeys<Q>;\n direction: \"asc\" | \"desc\";\n}> {\n return sorting.map(({ id, desc }) => ({\n property: id as PropertyKeys<Q>,\n direction: desc ? \"desc\" : \"asc\",\n }));\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA,SAASA,WAAW,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AA2BtD,OAAO,MAAMC,eAAe,GAAGA,CAO7B;EACAC,OAAO;EACPC,cAAc;EACdC;AAC8C,CAAC,KAA6B;EAC5E;EACA,MAAM,CAACC,eAAe,EAAEC,kBAAkB,CAAC,GAAGN,QAAQ,CAAe,MACnEG,cAAc,GAAGI,4BAA4B,CAACJ,cAAc,CAAC,GAAG,EAClE,CAAC;EAED,MAAMK,YAAY,GAAGN,OAAO,K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
* 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
|
+
export const SELECTION_COLUMN_ID = "__selection__";
|
|
18
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","names":["SELECTION_COLUMN_ID"],"sources":["constants.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const SELECTION_COLUMN_ID = \"__selection__\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,MAAMA,mBAAmB,GAAG,eAAe","ignoreList":[]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
export function getColumnPinningStyles(column) {
|
|
18
|
+
const isPinned = column.getIsPinned();
|
|
19
|
+
return {
|
|
20
|
+
columnStyles: {
|
|
21
|
+
left: isPinned === "left" ? `${column.getStart("left")}px` : undefined,
|
|
22
|
+
right: isPinned === "right" ? `${column.getAfter("right")}px` : undefined,
|
|
23
|
+
width: column.getSize()
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=getColumnPinningStyles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getColumnPinningStyles.js","names":["getColumnPinningStyles","column","isPinned","getIsPinned","columnStyles","left","getStart","undefined","right","getAfter","width","getSize"],"sources":["getColumnPinningStyles.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 { Column } from \"@tanstack/react-table\";\nimport type React from \"react\";\n\ninterface PinningStyles {\n columnStyles: React.CSSProperties;\n}\n\nexport function getColumnPinningStyles<TData>(\n column: Column<TData, unknown>,\n): PinningStyles {\n const isPinned = column.getIsPinned();\n\n return {\n columnStyles: {\n left: isPinned === \"left\" ? `${column.getStart(\"left\")}px` : undefined,\n right: isPinned === \"right\" ? `${column.getAfter(\"right\")}px` : undefined,\n width: column.getSize(),\n },\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA,OAAO,SAASA,sBAAsBA,CACpCC,MAA8B,EACf;EACf,MAAMC,QAAQ,GAAGD,MAAM,CAACE,WAAW,CAAC,CAAC;EAErC,OAAO;IACLC,YAAY,EAAE;MACZC,IAAI,EAAEH,QAAQ,KAAK,MAAM,GAAG,GAAGD,MAAM,CAACK,QAAQ,CAAC,MAAM,CAAC,IAAI,GAAGC,SAAS;MACtEC,KAAK,EAAEN,QAAQ,KAAK,OAAO,GAAG,GAAGD,MAAM,CAACQ,QAAQ,CAAC,OAAO,CAAC,IAAI,GAAGF,SAAS;MACzEG,KAAK,EAAET,MAAM,CAACU,OAAO,CAAC;IACxB;EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -16,4 +16,8 @@
|
|
|
16
16
|
|
|
17
17
|
// ObjectTable that loads and displays data for a given objectSet
|
|
18
18
|
export { ObjectTable } from "../object-table/ObjectTable.js";
|
|
19
|
+
|
|
20
|
+
// BaseTable that does not handle data fetching
|
|
21
|
+
|
|
22
|
+
export { BaseTable } from "../object-table/Table.js";
|
|
19
23
|
//# sourceMappingURL=experimental.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"experimental.js","names":["ObjectTable"],"sources":["experimental.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport type { FilterListProps } from \"../filter-list/FilterListApi.js\";\nexport type { FilterListItemProps } from \"../filter-list/FilterListItemApi.js\";\n\n// ObjectTable that loads and displays data for a given objectSet\nexport { ObjectTable } from \"../object-table/ObjectTable.js\";\nexport type {\n ColumnDefinition,\n ColumnDefinitionLocator,\n ObjectTableProps,\n} from \"../object-table/ObjectTableApi.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA;AACA,SAASA,WAAW,QAAQ,gCAAgC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"experimental.js","names":["ObjectTable","BaseTable"],"sources":["experimental.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport type { FilterListProps } from \"../filter-list/FilterListApi.js\";\nexport type { FilterListItemProps } from \"../filter-list/FilterListItemApi.js\";\n\n// ObjectTable that loads and displays data for a given objectSet\nexport { ObjectTable } from \"../object-table/ObjectTable.js\";\nexport type {\n ColumnDefinition,\n ColumnDefinitionLocator,\n ObjectTableProps,\n} from \"../object-table/ObjectTableApi.js\";\n\n// BaseTable that does not handle data fetching\nexport type { BaseTableProps } from \"../object-table/Table.js\";\nexport { BaseTable } from \"../object-table/Table.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA;AACA,SAASA,WAAW,QAAQ,gCAAgC;;AAO5D;;AAEA,SAASC,SAAS,QAAQ,0BAA0B","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAgBA,cAAc,MAAM,eAAe,uBAAwB;AAC3D,OAAO,WAAkC,OAAQ;
|
|
1
|
+
{"mappings":"AAgBA,cAAc,MAAM,eAAe,uBAAwB;AAC3D,OAAO,WAAkC,OAAQ;AAGjD,cAAc,uBAAuB,+BAAgC;UAE3D,qBAAqB,cAAc,SAAS;CACpD,MAAM,KAAK;CACX,UAAU;CACV;CACA,gBAAgBA,KAAK,OAAOC,MAAM,KAAK,oBAAoB,MAAM;AAClE;AAED,OAAO,iBAAS,gBAAgB,cAAc,SAAS,EACrD,MACA,UACA,SACA,eAC4B,EAA3B,qBAAqB,SAAS,MAAM","names":["row: TData","cell: Cell<TData, unknown>"],"sources":["../../../src/object-table/CellContextMenu.tsx"],"version":3,"file":"CellContextMenu.d.ts"}
|
|
@@ -13,4 +13,4 @@ export declare function ObjectTable<
|
|
|
13
13
|
Q extends ObjectTypeDefinition,
|
|
14
14
|
RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,
|
|
15
15
|
FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<string, never>
|
|
16
|
-
>({ objectSet, objectType, columnDefinitions, filter, onRowSelection, renderCellContextMenu, selectionMode, selectedRows,...props }: ObjectTableProps<Q, RDPs, FunctionColumns>): React.ReactElement;
|
|
16
|
+
>({ objectSet, objectType, columnDefinitions, filter, orderBy, defaultOrderBy, onOrderByChanged, onColumnsPinnedChanged, onRowSelection, renderCellContextMenu, selectionMode, selectedRows,...props }: ObjectTableProps<Q, RDPs, FunctionColumns>): React.ReactElement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAgBA,cACE,sBAGA,iBACA,yBACK,WAAY;
|
|
1
|
+
{"mappings":"AAgBA,cACE,sBAGA,iBACA,yBACK,WAAY;AAGnB,OAAO,WAA+C,OAAQ;AAQ9D,cAAc,wBAAwB,qBAAsB;;;;;;;;;AAa5D,OAAO,iBAAS;CACd,UAAU;CACV,aAAa,eAAe,qBAAqB;CAIjD,wBAAwB,eAAe,gBAAgB,CAAE,MAAK;EAI9D,EACA,WACA,YACA,mBACA,QACA,SACA,gBACA,kBACA,wBACA,gBACA,uBACA,eACA,aACA,GAAG,OACwC,EAA1C,iBAAiB,GAAG,MAAM,mBAAmB,MAAM","names":[],"sources":["../../../src/object-table/ObjectTable.tsx"],"version":3,"file":"ObjectTable.d.ts"}
|
|
@@ -82,8 +82,18 @@ export interface ObjectTableProps<
|
|
|
82
82
|
*/
|
|
83
83
|
orderable?: boolean;
|
|
84
84
|
/**
|
|
85
|
+
* The default order by clause to sort the objects in the table.
|
|
86
|
+
* If provided without orderBy prop, the sorting is uncontrolled.
|
|
87
|
+
* If both orderBy and defaultOrderBy are provided, orderBy takes precedence.
|
|
88
|
+
*/
|
|
89
|
+
defaultOrderBy?: Array<{
|
|
90
|
+
property: PropertyKeys<Q>
|
|
91
|
+
direction: "asc" | "desc"
|
|
92
|
+
}>;
|
|
93
|
+
/**
|
|
85
94
|
* The current order by clause to sort the objects in the table.
|
|
86
95
|
* If provided, the sorting is controlled.
|
|
96
|
+
* If both orderBy and defaultOrderBy are provided, orderBy takes precedence.
|
|
87
97
|
*/
|
|
88
98
|
orderBy?: Array<{
|
|
89
99
|
property: PropertyKeys<Q>
|
|
@@ -165,4 +175,5 @@ export interface ObjectTableProps<
|
|
|
165
175
|
* @default 40
|
|
166
176
|
*/
|
|
167
177
|
rowHeight?: number;
|
|
178
|
+
className?: string;
|
|
168
179
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAgBA,cACE,iBACA,WACA,sBACA,MACA,gBACA,cACA,iBACA,mBACA,mBACK,WAAY;AACnB,iBAAiB,WAAW,OAAQ;AAEpC,YAAY;CACV,UAAU;CACV,aAAa,eAAe,qBAAqB;CAIjD,wBAAwB,eAAe,gBAAgB,CAAE,MAAK;IAI5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q>, RDPs>","locator: ColumnDefinitionLocator<Q, RDPs, FunctionColumns>","newWhere: WhereClause<Q, RDPs>","newOrderBy: Array<{\n property: PropertyKeys<Q>;\n direction: \"asc\" | \"desc\";\n }>","newStates: Array<{\n columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns;\n isVisible: boolean;\n }>","newStates: Array<{\n columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns;\n pinned: \"left\" | \"right\" | \"none\";\n }>","columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns","newWidth: number","selectedRowIds: PrimaryKeyType<Q>[]","row: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>","cellValue: unknown"],"sources":["../../../src/object-table/ObjectTableApi.ts"],"version":3,"file":"ObjectTableApi.d.ts"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { Cell, RowData, Table } from "@tanstack/react-table";
|
|
2
2
|
import React, { type ReactElement } from "react";
|
|
3
|
-
interface
|
|
3
|
+
export interface BaseTableProps<TData extends RowData> {
|
|
4
4
|
table: Table<TData>;
|
|
5
5
|
isLoading?: boolean;
|
|
6
6
|
fetchNextPage?: () => Promise<void>;
|
|
7
7
|
onRowClick?: (row: TData) => void;
|
|
8
8
|
rowHeight?: number;
|
|
9
9
|
renderCellContextMenu?: (row: TData, cell: Cell<TData, unknown>) => React.ReactNode;
|
|
10
|
+
className?: string;
|
|
10
11
|
}
|
|
11
|
-
export declare function
|
|
12
|
-
export {};
|
|
12
|
+
export declare function BaseTable<TData extends RowData>({ table, isLoading, fetchNextPage, onRowClick, rowHeight, renderCellContextMenu, className }: BaseTableProps<TData>): ReactElement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAgBA,cAAc,MAAM,SAAS,aAAa,uBAAwB;
|
|
1
|
+
{"mappings":"AAgBA,cAAc,MAAM,SAAS,aAAa,uBAAwB;AAElE,OAAO,cAAc,oBAAyC,OAAQ;AAKtE,iBAAiB,eAAe,cAAc,SAAS;CACrD,OAAO,MAAM;CACb;CACA,sBAAsB;CACtB,cAAcA,KAAK;CACnB;CACA,yBACEA,KAAK,OACLC,MAAM,KAAK,oBACR,MAAM;CACX;AACD;AAED,OAAO,iBAAS,UAAU,cAAc,SACtC,EACE,OACA,WACA,eACA,YACA,WACA,uBACA,WACsB,EAArB,eAAe,SACjB","names":["row: TData","cell: Cell<TData, unknown>"],"sources":["../../../src/object-table/Table.tsx"],"version":3,"file":"Table.d.ts"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAgBA,cAAc,MAAM,KAAK,eAAe,uBAAwB;AAEhE,OAAO,WAAgC,OAAQ;
|
|
1
|
+
{"mappings":"AAgBA,cAAc,MAAM,KAAK,eAAe,uBAAwB;AAEhE,OAAO,WAAgC,OAAQ;UAIrC,eAAe,cAAc,SAAS;CAC9C,MAAM,MAAM,IAAI;CAChB,mBAAmB,MAAM,UAAU;CACnC,cAAcA,KAAK;CACnB;CACA,yBACEA,KAAK,OACLC,MAAM,KAAK,oBACR,MAAM;AACZ;AAED,OAAO,iBAAS,UAAU,cAAc,SAAS,EAC/C,MACA,mBACA,YACA,uBACA,WACsB,EAArB,eAAe,SAAS,MAAM","names":["row: TData","cell: Cell<TData, unknown>"],"sources":["../../../src/object-table/TableBody.tsx"],"version":3,"file":"TableBody.d.ts"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAgBA,cAAc,MAAM,eAAe,uBAAwB;AAG3D,OAAO,WAAuB,OAAQ;
|
|
1
|
+
{"mappings":"AAgBA,cAAc,MAAM,eAAe,uBAAwB;AAG3D,OAAO,WAAuB,OAAQ;UAO5B,eAAe,cAAc,SAAS;CAC9C,MAAM,KAAK;CACX,yBACEA,KAAK,OACLC,MAAM,KAAK,oBACR,MAAM;AACZ;AAED,OAAO,iBAAS,UAAU,cAAc,SACtC,EAAE,MAAM,uBAA8C,EAArB,eAAe,SAC/C,MAAM","names":["row: TData","cell: Cell<TData, unknown>"],"sources":["../../../src/object-table/TableCell.tsx"],"version":3,"file":"TableCell.d.ts"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAgBA,cAAc,SAAS,aAAa,uBAAwB;
|
|
1
|
+
{"mappings":"AAgBA,cAAc,SAAS,aAAa,uBAAwB;AAC5D,OAAO,WAAW,OAAQ;UAOhB,iBAAiB,cAAc,SAAS;CAChD,OAAO,MAAM;AACd;AAED,OAAO,iBAAS,YAAY,cAAc,SAAS,EACjD,OACwB,EAAvB,iBAAiB,SAAS,MAAM","names":[],"sources":["../../../src/object-table/TableHeader.tsx"],"version":3,"file":"TableHeader.d.ts"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Header, type RowData } from "@tanstack/react-table";
|
|
2
|
+
import React from "react";
|
|
3
|
+
interface TableHeaderContentProps<TData extends RowData> {
|
|
4
|
+
header: Header<TData, unknown>;
|
|
5
|
+
}
|
|
6
|
+
export declare function TableHeaderContent<TData extends RowData>({ header }: TableHeaderContentProps<TData>): React.ReactElement;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAgBA,cAA0B,aAAa,eAAe,uBAAwB;AAC9E,OAAO,WAAW,OAAQ;UAGhB,wBAAwB,cAAc,SAAS;CACvD,QAAQ,OAAO;AAChB;AAED,OAAO,iBAAS,mBAAmB,cAAc,SAC/C,EAAE,QAAwC,EAA9B,wBAAwB,SACnC,MAAM","names":[],"sources":["../../../src/object-table/TableHeaderContent.tsx"],"version":3,"file":"TableHeaderContent.d.ts"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ColumnPinningState, Header, RowData, SortingState } from "@tanstack/react-table";
|
|
2
|
+
import React from "react";
|
|
3
|
+
interface TableHeaderWithPopoverProps<TData extends RowData> {
|
|
4
|
+
header: Header<TData, unknown>;
|
|
5
|
+
isColumnPinned: false | "left" | "right";
|
|
6
|
+
setColumnPinning: React.Dispatch<React.SetStateAction<ColumnPinningState>>;
|
|
7
|
+
onSortChange?: (sorting: SortingState) => void;
|
|
8
|
+
onResetSize?: () => void;
|
|
9
|
+
onColumnConfig?: () => void;
|
|
10
|
+
enableColumnPinningRight?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare function TableHeaderWithPopover<TData extends RowData>({ header, isColumnPinned, setColumnPinning, onSortChange, onResetSize }: TableHeaderWithPopoverProps<TData>): React.ReactElement;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AA0BA,cACE,oBACA,QACA,SACA,oBACK,uBAAwB;AAE/B,OAAO,WAAsC,OAAQ;UAkC3C,4BAA4B,cAAc,SAAS;CAC3D,QAAQ,OAAO;CACf,gBAAgB,QAAQ,SAAS;CACjC,kBAAkB,MAAM,SAAS,MAAM,eAAe;CACtD,gBAAgBA,SAAS;CACzB;CACA;CACA;AACD;AAED,OAAO,iBAAS,uBAAuB,cAAc,SAAS,EAC5D,QACA,gBACA,kBACA,cACA,aACmC,EAAlC,4BAA4B,SAAS,MAAM","names":["sorting: SortingState"],"sources":["../../../src/object-table/TableHeaderWithPopover.tsx"],"version":3,"file":"TableHeaderWithPopover.d.ts"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAgBA,cAAc,MAAM,KAAK,eAAe,uBAAwB;AAChE,cAAc,mBAAmB,yBAA0B;AAC3D,OAAO,WAA4B,OAAQ;
|
|
1
|
+
{"mappings":"AAgBA,cAAc,MAAM,KAAK,eAAe,uBAAwB;AAChE,cAAc,mBAAmB,yBAA0B;AAC3D,OAAO,WAA4B,OAAQ;UAIjC,cAAc,cAAc,SAAS;CAC7C,KAAK,IAAI;CACT,YAAY;CACZ,cAAcA,KAAK;CACnB,yBACEA,KAAK,OACLC,MAAM,KAAK,oBACR,MAAM;AACZ;AAED,OAAO,iBAAS,SAAS,cAAc,SAAS,EAC9C,KACA,YACA,YACA,uBACqB,EAApB,cAAc,SAAS,MAAM","names":["row: TData","cell: Cell<TData, unknown>"],"sources":["../../../src/object-table/TableRow.tsx"],"version":3,"file":"TableRow.d.ts"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"","names":[],"sources":["../../../../../src/object-table/hooks/__tests__/useColumnPinning.test.tsx"],"version":3,"file":"useColumnPinning.test.d.ts"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"","names":[],"sources":["../../../../../src/object-table/hooks/__tests__/useColumnVisibility.test.tsx"],"version":3,"file":"useColumnVisibility.test.d.ts"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"","names":[],"sources":["../../../../../src/object-table/hooks/__tests__/useTableSorting.test.tsx"],"version":3,"file":"useTableSorting.test.d.ts"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ObjectTypeDefinition, QueryDefinition, SimplePropertyDef } from "@osdk/api";
|
|
2
|
+
import type { ColumnPinningState, OnChangeFn } from "@tanstack/react-table";
|
|
3
|
+
import type { ObjectTableProps } from "../ObjectTableApi.js";
|
|
4
|
+
interface UseColumnPinningProps<
|
|
5
|
+
Q extends ObjectTypeDefinition,
|
|
6
|
+
RDPs extends Record<string, SimplePropertyDef> = {},
|
|
7
|
+
FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<string, never>
|
|
8
|
+
> {
|
|
9
|
+
columnDefinitions: ObjectTableProps<Q, RDPs, FunctionColumns>["columnDefinitions"];
|
|
10
|
+
hasSelectionColumn?: boolean;
|
|
11
|
+
onColumnsPinnedChanged?: ObjectTableProps<Q, RDPs, FunctionColumns>["onColumnsPinnedChanged"];
|
|
12
|
+
}
|
|
13
|
+
interface UseColumnPinningResults {
|
|
14
|
+
columnPinning: ColumnPinningState;
|
|
15
|
+
onColumnPinningChange: OnChangeFn<ColumnPinningState>;
|
|
16
|
+
}
|
|
17
|
+
export declare const useColumnPinning: <
|
|
18
|
+
Q extends ObjectTypeDefinition,
|
|
19
|
+
RDPs extends Record<string, SimplePropertyDef> = {},
|
|
20
|
+
FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<string, never>
|
|
21
|
+
>({ columnDefinitions, hasSelectionColumn, onColumnsPinnedChanged }: UseColumnPinningProps<Q, RDPs, FunctionColumns>) => UseColumnPinningResults;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAgBA,cACE,sBACA,iBACA,yBACK,WAAY;AACnB,cAAc,oBAAoB,kBAAkB,uBAAwB;AAE5E,cAAc,wBAAwB,sBAAuB;UAGnD;CACR,UAAU;CACV,aAAa,eAAe,qBAAqB,CAAE;CACnD,wBAAwB,eAAe,gBAAgB,CAAE,MAAK;EAI9D;CACA,mBAAmB,iBACjB,GACA,MACA,iBACA;CAEF;CAEA,yBAAyB,iBACvB,GACA,MACA,iBACA;AACH;UAES,wBAAwB;CAChC,eAAe;CACf,uBAAuB,WAAW;AACnC;AAED,OAAO,cAAM;CACX,UAAU;CACV,aAAa,eAAe,qBAAqB,CAAE;CACnD,wBAAwB,eAAe,gBAAgB,CAAE,MAAK;EAI9D,EACA,mBACA,oBACA,wBAKD,EAJE,sBACD,GACA,MACA,qBACE","names":[],"sources":["../../../../src/object-table/hooks/useColumnPinning.ts"],"version":3,"file":"useColumnPinning.d.ts"}
|
package/build/types/object-table/hooks/{useDefaultTableStates.d.ts → useColumnVisibility.d.ts}
RENAMED
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
import type { ObjectTypeDefinition, QueryDefinition, SimplePropertyDef } from "@osdk/api";
|
|
2
2
|
import type { VisibilityState } from "@tanstack/react-table";
|
|
3
3
|
import type { ObjectTableProps } from "../ObjectTableApi.js";
|
|
4
|
-
interface
|
|
4
|
+
interface UseColumnVisibilityProps<
|
|
5
5
|
Q extends ObjectTypeDefinition,
|
|
6
6
|
RDPs extends Record<string, SimplePropertyDef> = {},
|
|
7
7
|
FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<string, never>
|
|
8
8
|
> {
|
|
9
9
|
columnDefinitions: ObjectTableProps<Q, RDPs, FunctionColumns>["columnDefinitions"];
|
|
10
10
|
}
|
|
11
|
-
|
|
12
|
-
columnVisibility: VisibilityState | undefined;
|
|
13
|
-
}
|
|
14
|
-
export declare const useDefaultTableStates: <
|
|
11
|
+
export declare const useColumnVisibility: <
|
|
15
12
|
Q extends ObjectTypeDefinition,
|
|
16
13
|
RDPs extends Record<string, SimplePropertyDef> = {},
|
|
17
14
|
FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<string, never>
|
|
18
|
-
>({ columnDefinitions }:
|
|
15
|
+
>({ columnDefinitions }: UseColumnVisibilityProps<Q, RDPs, FunctionColumns>) => VisibilityState | undefined;
|
|
19
16
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAgBA,cACE,sBACA,iBACA,yBACK,WAAY;AACnB,cAAc,uBAAuB,uBAAwB;AAE7D,cAAc,wBAAwB,sBAAuB;UAEnD;CACR,UAAU;CACV,aAAa,eAAe,qBAAqB,CAAE;CACnD,wBAAwB,eAAe,gBAAgB,CAAE,MAAK;EAI9D;CACA,mBAAmB,iBACjB,GACA,MACA,iBACA;AACH;AAED,OAAO,cAAM;CACX,UAAU;CACV,aAAa,eAAe,qBAAqB,CAAE;CACnD,wBAAwB,eAAe,gBAAgB,CAAE,MAAK;EAK9D,EAAE,mBAID,EAJsB,yBACrB,GACA,MACA,qBAED","names":[],"sources":["../../../../src/object-table/hooks/useColumnVisibility.ts"],"version":3,"file":"useColumnVisibility.d.ts"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ObjectSet, ObjectTypeDefinition, QueryDefinition, SimplePropertyDef, WhereClause } from "@osdk/api";
|
|
2
2
|
import { useObjectSet } from "@osdk/react/experimental";
|
|
3
|
+
import type { SortingState } from "@tanstack/react-table";
|
|
3
4
|
import type { ColumnDefinition } from "../ObjectTableApi.js";
|
|
4
5
|
/**
|
|
5
6
|
* This hook is a wrapper around useObjectSet
|
|
@@ -10,4 +11,4 @@ export declare function useObjectTableData<
|
|
|
10
11
|
Q extends ObjectTypeDefinition,
|
|
11
12
|
RDPs extends Record<string, SimplePropertyDef>,
|
|
12
13
|
FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<string, never>
|
|
13
|
-
>(objectSet: ObjectSet<Q>, columnDefinitions?: Array<ColumnDefinition<Q, RDPs, FunctionColumns>>, filter?: WhereClause<Q, RDPs
|
|
14
|
+
>(objectSet: ObjectSet<Q>, columnDefinitions?: Array<ColumnDefinition<Q, RDPs, FunctionColumns>>, filter?: WhereClause<Q, RDPs>, sorting?: SortingState): ReturnType<typeof useObjectSet<Q, never, RDPs>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAgBA,cAEE,WACA,
|
|
1
|
+
{"mappings":"AAgBA,cAEE,WACA,sBAEA,iBACA,mBACA,mBACK,WAAY;AACnB,SAAS,oBAAoB,0BAA2B;AACxD,cAAc,oBAAoB,uBAAwB;AAE1D,cAAc,wBAAwB,sBAAuB;;;;;;AAU7D,OAAO,iBAAS;CACd,UAAU;CACV,aAAa,eAAe;CAC5B,wBAAwB,eAAe,gBAAgB,CAAE,MAAK;EAK9DA,WAAW,UAAU,IACrBC,oBAAoB,MAAM,iBAAiB,GAAG,MAAM,mBACpDC,SAAS,YAAY,GAAG,OACxBC,UAAU,eACT,kBAAkB,aAAa,UAAU","names":["objectSet: ObjectSet<Q>","columnDefinitions?: Array<ColumnDefinition<Q, RDPs, FunctionColumns>>","filter?: WhereClause<Q, RDPs>","sorting?: SortingState"],"sources":["../../../../src/object-table/hooks/useObjectTableData.ts"],"version":3,"file":"useObjectTableData.d.ts"}
|
|
@@ -7,7 +7,6 @@ interface UseSelectionColumnProps {
|
|
|
7
7
|
onToggleAll: () => void;
|
|
8
8
|
onToggleRow: (id: string, rowIndex: number, isShiftClick: boolean) => void;
|
|
9
9
|
}
|
|
10
|
-
export declare const SELECTION_COLUMN_ID = "__selection__";
|
|
11
10
|
export declare const useSelectionColumn: <
|
|
12
11
|
Q extends ObjectTypeDefinition,
|
|
13
12
|
RDPs extends Record<string, SimplePropertyDef> = Record<string, never>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAgBA,cACE,sBACA,MACA,cACA,yBACK,WAAY;AACnB,cAAc,iBAAiB,uBAAwB;
|
|
1
|
+
{"mappings":"AAgBA,cACE,sBACA,MACA,cACA,yBACK,WAAY;AACnB,cAAc,iBAAiB,uBAAwB;UAK7C,wBAAwB;CAChC,gBAAgB,WAAW,aAAa;CACxC;CACA;CACA;CACA,cAAcA,YAAYC,kBAAkBC;AAC7C;AAED,OAAO,cAAM;CACX,UAAU;CACV,aAAa,eAAe,qBAAqB;EAIjD,EACA,eACA,eACA,cACA,aACA,aACwB,EAAvB,4BACC,UACA,KAAK,SAAS,GAAG,sBAAsB,aAAa,IAAI","names":["id: string","rowIndex: number","isShiftClick: boolean"],"sources":["../../../../src/object-table/hooks/useSelectionColumn.tsx"],"version":3,"file":"useSelectionColumn.d.ts"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ObjectTypeDefinition, QueryDefinition, SimplePropertyDef } from "@osdk/api";
|
|
2
|
+
import type { OnChangeFn, SortingState } from "@tanstack/react-table";
|
|
3
|
+
import type { ObjectTableProps } from "../ObjectTableApi.js";
|
|
4
|
+
interface UseTableSortingProps<
|
|
5
|
+
Q extends ObjectTypeDefinition,
|
|
6
|
+
RDPs extends Record<string, SimplePropertyDef> = {},
|
|
7
|
+
FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<string, never>
|
|
8
|
+
> {
|
|
9
|
+
orderBy?: ObjectTableProps<Q, RDPs, FunctionColumns>["orderBy"];
|
|
10
|
+
defaultOrderBy?: ObjectTableProps<Q, RDPs, FunctionColumns>["defaultOrderBy"];
|
|
11
|
+
onOrderByChanged?: ObjectTableProps<Q, RDPs, FunctionColumns>["onOrderByChanged"];
|
|
12
|
+
}
|
|
13
|
+
interface UseTableSortingResults {
|
|
14
|
+
sorting: SortingState;
|
|
15
|
+
onSortingChange: OnChangeFn<SortingState>;
|
|
16
|
+
}
|
|
17
|
+
export declare const useTableSorting: <
|
|
18
|
+
Q extends ObjectTypeDefinition,
|
|
19
|
+
RDPs extends Record<string, SimplePropertyDef> = {},
|
|
20
|
+
FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<string, never>
|
|
21
|
+
>({ orderBy, defaultOrderBy, onOrderByChanged }: UseTableSortingProps<Q, RDPs, FunctionColumns>) => UseTableSortingResults;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAgBA,cACE,sBAEA,iBACA,yBACK,WAAY;AACnB,cAAc,YAAY,oBAAoB,uBAAwB;AAEtE,cAAc,wBAAwB,sBAAuB;UAEnD;CACR,UAAU;CACV,aAAa,eAAe,qBAAqB,CAAE;CACnD,wBAAwB,eAAe,gBAAgB,CAAE,MAAK;EAI9D;CACA,UAAU,iBAAiB,GAAG,MAAM,iBAAiB;CAErD,iBAAiB,iBAAiB,GAAG,MAAM,iBAAiB;CAE5D,mBAAmB,iBACjB,GACA,MACA,iBACA;AACH;UAES,uBAAuB;CAC/B,SAAS;CACT,iBAAiB,WAAW;AAC7B;AAED,OAAO,cAAM;CACX,UAAU;CACV,aAAa,eAAe,qBAAqB,CAAE;CACnD,wBAAwB,eAAe,gBAAgB,CAAE,MAAK;EAI9D,EACA,SACA,gBACA,kBAC+C,EAA9C,qBAAqB,GAAG,MAAM,qBAAmB","names":[],"sources":["../../../../src/object-table/hooks/useTableSorting.ts"],"version":3,"file":"useTableSorting.d.ts"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SELECTION_COLUMN_ID = "__selection__";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAgBA,OAAO,cAAM,sBAAsB","names":[],"sources":["../../../../src/object-table/utils/constants.ts"],"version":3,"file":"constants.d.ts"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Column } from "@tanstack/react-table";
|
|
2
|
+
import type React from "react";
|
|
3
|
+
interface PinningStyles {
|
|
4
|
+
columnStyles: React.CSSProperties;
|
|
5
|
+
}
|
|
6
|
+
export declare function getColumnPinningStyles<TData>(column: Column<TData, unknown>): PinningStyles;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAgBA,cAAc,cAAc,uBAAwB;AACpD,YAAY,WAAW,OAAQ;UAErB,cAAc;CACtB,cAAc,MAAM;AACrB;AAED,OAAO,iBAAS,uBAAuB,OACrCA,QAAQ,OAAO,kBACd","names":["column: Column<TData, unknown>"],"sources":["../../../../src/object-table/utils/getColumnPinningStyles.ts"],"version":3,"file":"getColumnPinningStyles.d.ts"}
|
|
@@ -2,3 +2,5 @@ export type { FilterListProps } from "../filter-list/FilterListApi.js";
|
|
|
2
2
|
export type { FilterListItemProps } from "../filter-list/FilterListItemApi.js";
|
|
3
3
|
export { ObjectTable } from "../object-table/ObjectTable.js";
|
|
4
4
|
export type { ColumnDefinition, ColumnDefinitionLocator, ObjectTableProps } from "../object-table/ObjectTableApi.js";
|
|
5
|
+
export type { BaseTableProps } from "../object-table/Table.js";
|
|
6
|
+
export { BaseTable } from "../object-table/Table.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAgBA,cAAc,uBAAuB;AACrC,cAAc,2BAA2B;AAGzC,SAAS,mBAAmB;AAC5B,cACE,kBACA,yBACA,wBACK","names":[],"sources":["../../../src/public/experimental.ts"],"version":3,"file":"experimental.d.ts"}
|
|
1
|
+
{"mappings":"AAgBA,cAAc,uBAAuB;AACrC,cAAc,2BAA2B;AAGzC,SAAS,mBAAmB;AAC5B,cACE,kBACA,yBACA,wBACK;AAGP,cAAc,sBAAsB;AACpC,SAAS,iBAAiB","names":[],"sources":["../../../src/public/experimental.ts"],"version":3,"file":"experimental.d.ts"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@osdk/react-components",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.5",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -39,14 +39,14 @@
|
|
|
39
39
|
"@base-ui/react": "^1.0.0",
|
|
40
40
|
"@blueprintjs/icons": "^6.0.0",
|
|
41
41
|
"@tanstack/react-table": "^8.21.3",
|
|
42
|
-
"@tanstack/react-virtual": "^3.13.13"
|
|
43
|
-
"classnames": "^2.5.1"
|
|
42
|
+
"@tanstack/react-virtual": "^3.13.13"
|
|
44
43
|
},
|
|
45
44
|
"peerDependencies": {
|
|
46
45
|
"@osdk/api": "*",
|
|
47
46
|
"@osdk/client": "*",
|
|
48
47
|
"@osdk/react": "*",
|
|
49
48
|
"@types/react": "^17 || ^18 || ^19",
|
|
49
|
+
"classnames": "^2.0.0",
|
|
50
50
|
"react": "^17 || ^18 || ^19",
|
|
51
51
|
"react-dom": "^17 || ^18 || ^19"
|
|
52
52
|
},
|
|
@@ -58,11 +58,11 @@
|
|
|
58
58
|
"p-defer": "^4.0.1",
|
|
59
59
|
"react": "^18.3.1",
|
|
60
60
|
"typescript": "~5.5.4",
|
|
61
|
-
"@osdk/
|
|
62
|
-
"@osdk/monorepo.api-extractor": "~0.6.0-beta.1",
|
|
63
|
-
"@osdk/react": "0.9.0-beta.7",
|
|
61
|
+
"@osdk/client": "2.7.0-beta.14",
|
|
64
62
|
"@osdk/monorepo.tsconfig": "~0.6.0-beta.1",
|
|
65
|
-
"@osdk/
|
|
63
|
+
"@osdk/api": "2.7.0-beta.14",
|
|
64
|
+
"@osdk/monorepo.api-extractor": "~0.6.0-beta.1",
|
|
65
|
+
"@osdk/react": "0.9.0-beta.9"
|
|
66
66
|
},
|
|
67
67
|
"publishConfig": {
|
|
68
68
|
"access": "public"
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"fix-lint": "eslint . --fix && dprint fmt --config $(find-up dprint.json)",
|
|
89
89
|
"lint": "eslint . && dprint check --config $(find-up dprint.json)",
|
|
90
90
|
"test": "vitest run",
|
|
91
|
-
"transpileAllDeps": "pnpm --filter @osdk/api --filter @osdk/client --filter @osdk/react run
|
|
91
|
+
"transpileAllDeps": "pnpm --filter @osdk/api --filter @osdk/client --filter @osdk/react run transpileBrowser",
|
|
92
92
|
"transpileBrowser": "monorepo.tool.transpile -f esm -m normal -t browser",
|
|
93
93
|
"transpileCjs": "monorepo.tool.transpile -f cjs -m bundle -t node",
|
|
94
94
|
"transpileEsm": "monorepo.tool.transpile -f esm -m normal -t node",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useDefaultTableStates.test.js","names":["renderHook","waitFor","describe","expect","it","useDefaultTableStates","TestObjectType","type","apiName","result","columnDefinitions","undefined","current","columnVisibility","toBeUndefined","locator","id","toEqual","isVisible","creator","name","myFunction","myRdp","rerender","initialProps","email","age","not","toHaveProperty"],"sources":["useDefaultTableStates.test.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 DerivedProperty,\n ObjectTypeDefinition,\n PropertyKeys,\n QueryDefinition,\n SimplePropertyDef,\n} from \"@osdk/api\";\nimport { renderHook, waitFor } from \"@testing-library/react\";\nimport { describe, expect, it } from \"vitest\";\nimport type { ColumnDefinition } from \"../../ObjectTableApi.js\";\nimport { useDefaultTableStates } from \"../useDefaultTableStates.js\";\n\nconst TestObjectType = {\n type: \"object\",\n apiName: \"TestObject\",\n} as const satisfies ObjectTypeDefinition;\n\ntype TestObject = typeof TestObjectType;\ntype TestObjectKeys = PropertyKeys<TestObject>;\n\ndescribe(useDefaultTableStates, () => {\n it(\"returns undefined columnVisibility when no columnDefinitions provided\", () => {\n const { result } = renderHook(() =>\n useDefaultTableStates({\n columnDefinitions: undefined,\n })\n );\n\n expect(result.current.columnVisibility).toBeUndefined();\n });\n\n it(\"returns empty columnVisibility when columnDefinitions have no isVisible properties\", () => {\n const columnDefinitions: Array<ColumnDefinition<TestObject, {}, {}>> = [\n {\n locator: { type: \"property\", id: \"name\" as TestObjectKeys },\n },\n {\n locator: { type: \"property\", id: \"email\" as TestObjectKeys },\n },\n ];\n\n const { result } = renderHook(() =>\n useDefaultTableStates({\n columnDefinitions,\n })\n );\n\n expect(result.current.columnVisibility).toEqual({});\n });\n\n it(\"handles mixed column types with different visibility states\", async () => {\n const mockRdpCreator = (() => ({})) as unknown as DerivedProperty.Creator<\n TestObject,\n SimplePropertyDef\n >;\n\n const columnDefinitions: Array<\n ColumnDefinition<\n TestObject,\n { myRdp: SimplePropertyDef },\n { myFunction: QueryDefinition<{}> }\n >\n > = [\n {\n locator: { type: \"property\", id: \"name\" as TestObjectKeys },\n isVisible: true,\n },\n {\n locator: { type: \"function\", id: \"myFunction\" },\n isVisible: false,\n },\n {\n locator: { type: \"rdp\", id: \"myRdp\", creator: mockRdpCreator },\n isVisible: true,\n },\n {\n locator: { type: \"property\", id: \"email\" as TestObjectKeys },\n },\n ];\n\n const { result } = renderHook(() =>\n useDefaultTableStates({\n columnDefinitions,\n })\n );\n\n await waitFor(() => {\n expect(result.current.columnVisibility).toEqual({\n name: true,\n myFunction: false,\n myRdp: true,\n });\n });\n });\n\n it(\"updates columnVisibility when columnDefinitions change\", async () => {\n const initialColumnDefinitions: Array<\n ColumnDefinition<TestObject, {}, {}>\n > = [\n {\n locator: { type: \"property\", id: \"name\" as TestObjectKeys },\n isVisible: true,\n },\n ];\n\n const { result, rerender } = renderHook(\n ({ columnDefinitions }) =>\n useDefaultTableStates({\n columnDefinitions,\n }),\n {\n initialProps: { columnDefinitions: initialColumnDefinitions },\n },\n );\n\n await waitFor(() => {\n expect(result.current.columnVisibility).toEqual({\n name: true,\n });\n });\n\n const updatedColumnDefinitions: Array<\n ColumnDefinition<TestObject, {}, {}>\n > = [\n {\n locator: { type: \"property\", id: \"name\" as TestObjectKeys },\n isVisible: false,\n },\n {\n locator: { type: \"property\", id: \"email\" as TestObjectKeys },\n isVisible: true,\n },\n ];\n\n rerender({ columnDefinitions: updatedColumnDefinitions });\n\n await waitFor(() => {\n expect(result.current.columnVisibility).toEqual({\n name: false,\n email: true,\n });\n });\n });\n\n it(\"only includes columns with explicit isVisible in the visibility state\", async () => {\n const columnDefinitions: Array<ColumnDefinition<TestObject, {}, {}>> = [\n {\n locator: { type: \"property\", id: \"name\" as TestObjectKeys },\n isVisible: true,\n },\n {\n locator: { type: \"property\", id: \"email\" as TestObjectKeys },\n },\n {\n locator: { type: \"property\", id: \"age\" as TestObjectKeys },\n isVisible: false,\n },\n {\n locator: { type: \"property\", id: \"id\" as TestObjectKeys },\n },\n ];\n\n const { result } = renderHook(() =>\n useDefaultTableStates({\n columnDefinitions,\n })\n );\n\n await waitFor(() => {\n expect(result.current.columnVisibility).toEqual({\n name: true,\n age: false,\n });\n });\n\n // Verify that columns without isVisible are not in the state\n expect(result.current.columnVisibility).not.toHaveProperty(\"email\");\n expect(result.current.columnVisibility).not.toHaveProperty(\"id\");\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA,SAASA,UAAU,EAAEC,OAAO,QAAQ,wBAAwB;AAC5D,SAASC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAE7C,SAASC,qBAAqB,QAAQ,6BAA6B;AAEnE,MAAMC,cAAc,GAAG;EAC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|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useDefaultTableStates.js","names":["useMemo","useDefaultTableStates","columnDefinitions","columnVisibility","colVisibility","reduce","acc","colDef","isVisible","undefined","locator","colKey","id"],"sources":["useDefaultTableStates.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 ObjectTypeDefinition,\n QueryDefinition,\n SimplePropertyDef,\n} from \"@osdk/api\";\nimport type { VisibilityState } from \"@tanstack/react-table\";\nimport { useMemo } from \"react\";\nimport type { ObjectTableProps } from \"../ObjectTableApi.js\";\n\ninterface UseDefaultTableStatesProps<\n Q extends ObjectTypeDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n> {\n columnDefinitions: ObjectTableProps<\n Q,\n RDPs,\n FunctionColumns\n >[\"columnDefinitions\"];\n}\n\ninterface UseDefaultTableStatesResult {\n columnVisibility: VisibilityState | undefined;\n}\n\nexport const useDefaultTableStates = <\n Q extends ObjectTypeDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n>(\n { columnDefinitions }: UseDefaultTableStatesProps<\n Q,\n RDPs,\n FunctionColumns\n >,\n): UseDefaultTableStatesResult => {\n const columnVisibility = useMemo(() => {\n if (columnDefinitions) {\n const colVisibility: VisibilityState = columnDefinitions.reduce(\n (acc, colDef) => {\n if (colDef.isVisible !== undefined) {\n const { locator } = colDef;\n\n const colKey = locator.id;\n\n return {\n ...acc,\n [colKey]: colDef.isVisible,\n };\n }\n return acc;\n },\n {},\n );\n\n return colVisibility;\n }\n }, [columnDefinitions]);\n\n return { columnVisibility };\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,SAASA,OAAO,QAAQ,OAAO;AAsB/B,OAAO,MAAMC,qBAAqB,GAAGA,CAQnC;EAAEC;AAIF,CAAC,KAC+B;EAChC,MAAMC,gBAAgB,GAAGH,OAAO,CAAC,MAAM;IACrC,IAAIE,iBAAiB,EAAE;MACrB,MAAME,aAA8B,GAAGF,iBAAiB,CAACG,MAAM,CAC7D,CAACC,GAAG,EAAEC,MAAM,KAAK;QACf,IAAIA,MAAM,CAACC,SAAS,KAAKC,SAAS,EAAE;UAClC,MAAM;YAAEC;UAAQ,CAAC,GAAGH,MAAM;UAE1B,MAAMI,MAAM,GAAGD,OAAO,CAACE,EAAE;UAEzB,OAAO;YACL,GAAGN,GAAG;YACN,CAACK,MAAM,GAAGJ,MAAM,CAACC;UACnB,CAAC;QACH;QACA,OAAOF,GAAG;MACZ,CAAC,EACD,CAAC,CACH,CAAC;MAED,OAAOF,aAAa;IACtB;EACF,CAAC,EAAE,CAACF,iBAAiB,CAAC,CAAC;EAEvB,OAAO;IAAEC;EAAiB,CAAC;AAC7B,CAAC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useDefaultTableStates.test.js","names":["renderHook","waitFor","describe","expect","it","useDefaultTableStates","TestObjectType","type","apiName","result","columnDefinitions","undefined","current","columnVisibility","toBeUndefined","locator","id","toEqual","isVisible","creator","name","myFunction","myRdp","rerender","initialProps","email","age","not","toHaveProperty"],"sources":["useDefaultTableStates.test.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 DerivedProperty,\n ObjectTypeDefinition,\n PropertyKeys,\n QueryDefinition,\n SimplePropertyDef,\n} from \"@osdk/api\";\nimport { renderHook, waitFor } from \"@testing-library/react\";\nimport { describe, expect, it } from \"vitest\";\nimport type { ColumnDefinition } from \"../../ObjectTableApi.js\";\nimport { useDefaultTableStates } from \"../useDefaultTableStates.js\";\n\nconst TestObjectType = {\n type: \"object\",\n apiName: \"TestObject\",\n} as const satisfies ObjectTypeDefinition;\n\ntype TestObject = typeof TestObjectType;\ntype TestObjectKeys = PropertyKeys<TestObject>;\n\ndescribe(useDefaultTableStates, () => {\n it(\"returns undefined columnVisibility when no columnDefinitions provided\", () => {\n const { result } = renderHook(() =>\n useDefaultTableStates({\n columnDefinitions: undefined,\n })\n );\n\n expect(result.current.columnVisibility).toBeUndefined();\n });\n\n it(\"returns empty columnVisibility when columnDefinitions have no isVisible properties\", () => {\n const columnDefinitions: Array<ColumnDefinition<TestObject, {}, {}>> = [\n {\n locator: { type: \"property\", id: \"name\" as TestObjectKeys },\n },\n {\n locator: { type: \"property\", id: \"email\" as TestObjectKeys },\n },\n ];\n\n const { result } = renderHook(() =>\n useDefaultTableStates({\n columnDefinitions,\n })\n );\n\n expect(result.current.columnVisibility).toEqual({});\n });\n\n it(\"handles mixed column types with different visibility states\", async () => {\n const mockRdpCreator = (() => ({})) as unknown as DerivedProperty.Creator<\n TestObject,\n SimplePropertyDef\n >;\n\n const columnDefinitions: Array<\n ColumnDefinition<\n TestObject,\n { myRdp: SimplePropertyDef },\n { myFunction: QueryDefinition<{}> }\n >\n > = [\n {\n locator: { type: \"property\", id: \"name\" as TestObjectKeys },\n isVisible: true,\n },\n {\n locator: { type: \"function\", id: \"myFunction\" },\n isVisible: false,\n },\n {\n locator: { type: \"rdp\", id: \"myRdp\", creator: mockRdpCreator },\n isVisible: true,\n },\n {\n locator: { type: \"property\", id: \"email\" as TestObjectKeys },\n },\n ];\n\n const { result } = renderHook(() =>\n useDefaultTableStates({\n columnDefinitions,\n })\n );\n\n await waitFor(() => {\n expect(result.current.columnVisibility).toEqual({\n name: true,\n myFunction: false,\n myRdp: true,\n });\n });\n });\n\n it(\"updates columnVisibility when columnDefinitions change\", async () => {\n const initialColumnDefinitions: Array<\n ColumnDefinition<TestObject, {}, {}>\n > = [\n {\n locator: { type: \"property\", id: \"name\" as TestObjectKeys },\n isVisible: true,\n },\n ];\n\n const { result, rerender } = renderHook(\n ({ columnDefinitions }) =>\n useDefaultTableStates({\n columnDefinitions,\n }),\n {\n initialProps: { columnDefinitions: initialColumnDefinitions },\n },\n );\n\n await waitFor(() => {\n expect(result.current.columnVisibility).toEqual({\n name: true,\n });\n });\n\n const updatedColumnDefinitions: Array<\n ColumnDefinition<TestObject, {}, {}>\n > = [\n {\n locator: { type: \"property\", id: \"name\" as TestObjectKeys },\n isVisible: false,\n },\n {\n locator: { type: \"property\", id: \"email\" as TestObjectKeys },\n isVisible: true,\n },\n ];\n\n rerender({ columnDefinitions: updatedColumnDefinitions });\n\n await waitFor(() => {\n expect(result.current.columnVisibility).toEqual({\n name: false,\n email: true,\n });\n });\n });\n\n it(\"only includes columns with explicit isVisible in the visibility state\", async () => {\n const columnDefinitions: Array<ColumnDefinition<TestObject, {}, {}>> = [\n {\n locator: { type: \"property\", id: \"name\" as TestObjectKeys },\n isVisible: true,\n },\n {\n locator: { type: \"property\", id: \"email\" as TestObjectKeys },\n },\n {\n locator: { type: \"property\", id: \"age\" as TestObjectKeys },\n isVisible: false,\n },\n {\n locator: { type: \"property\", id: \"id\" as TestObjectKeys },\n },\n ];\n\n const { result } = renderHook(() =>\n useDefaultTableStates({\n columnDefinitions,\n })\n );\n\n await waitFor(() => {\n expect(result.current.columnVisibility).toEqual({\n name: true,\n age: false,\n });\n });\n\n // Verify that columns without isVisible are not in the state\n expect(result.current.columnVisibility).not.toHaveProperty(\"email\");\n expect(result.current.columnVisibility).not.toHaveProperty(\"id\");\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA,SAASA,UAAU,EAAEC,OAAO,QAAQ,wBAAwB;AAC5D,SAASC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAE7C,SAASC,qBAAqB,QAAQ,6BAA6B;AAEnE,MAAMC,cAAc,GAAG;EACrBC,IAAI,EAAE,QAAQ;EACdC,OAAO,EAAE;AACX,CAAyC;AAKzCN,QAAQ,CAACG,qBAAqB,EAAE,MAAM;EACpCD,EAAE,CAAC,uEAAuE,EAAE,MAAM;IAChF,MAAM;MAAEK;IAAO,CAAC,GAAGT,UAAU,CAAC,MAC5BK,qBAAqB,CAAC;MACpBK,iBAAiB,EAAEC;IACrB,CAAC,CACH,CAAC;IAEDR,MAAM,CAACM,MAAM,CAACG,OAAO,CAACC,gBAAgB,CAAC,CAACC,aAAa,CAAC,CAAC;EACzD,CAAC,CAAC;EAEFV,EAAE,CAAC,oFAAoF,EAAE,MAAM;IAC7F,MAAMM,iBAA8D,GAAG,CACrE;MACEK,OAAO,EAAE;QAAER,IAAI,EAAE,UAAU;QAAES,EAAE,EAAE;MAAyB;IAC5D,CAAC,EACD;MACED,OAAO,EAAE;QAAER,IAAI,EAAE,UAAU;QAAES,EAAE,EAAE;MAA0B;IAC7D,CAAC,CACF;IAED,MAAM;MAAEP;IAAO,CAAC,GAAGT,UAAU,CAAC,MAC5BK,qBAAqB,CAAC;MACpBK;IACF,CAAC,CACH,CAAC;IAEDP,MAAM,CAACM,MAAM,CAACG,OAAO,CAACC,gBAAgB,CAAC,CAACI,OAAO,CAAC,CAAC,CAAC,CAAC;EACrD,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T,OAAO,CAAC,MAAM;MAClBE,MAAM,CAACM,MAAM,CAACG,OAAO,CAACC,gBAAgB,CAAC,CAACI,OAAO,CAAC;QAC9CG,IAAI,EAAE,IAAI;QACVM,GAAG,EAAE;MACP,CAAC,CAAC;IACJ,CAAC,CAAC;;IAEF;IACAvB,MAAM,CAACM,MAAM,CAACG,OAAO,CAACC,gBAAgB,CAAC,CAACc,GAAG,CAACC,cAAc,CAAC,OAAO,CAAC;IACnEzB,MAAM,CAACM,MAAM,CAACG,OAAO,CAACC,gBAAgB,CAAC,CAACc,GAAG,CAACC,cAAc,CAAC,IAAI,CAAC;EAClE,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useDefaultTableStates.js","names":["useMemo","useDefaultTableStates","columnDefinitions","columnVisibility","colVisibility","reduce","acc","colDef","isVisible","undefined","locator","colKey","id"],"sources":["useDefaultTableStates.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 ObjectTypeDefinition,\n QueryDefinition,\n SimplePropertyDef,\n} from \"@osdk/api\";\nimport type { VisibilityState } from \"@tanstack/react-table\";\nimport { useMemo } from \"react\";\nimport type { ObjectTableProps } from \"../ObjectTableApi.js\";\n\ninterface UseDefaultTableStatesProps<\n Q extends ObjectTypeDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n> {\n columnDefinitions: ObjectTableProps<\n Q,\n RDPs,\n FunctionColumns\n >[\"columnDefinitions\"];\n}\n\ninterface UseDefaultTableStatesResult {\n columnVisibility: VisibilityState | undefined;\n}\n\nexport const useDefaultTableStates = <\n Q extends ObjectTypeDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n>(\n { columnDefinitions }: UseDefaultTableStatesProps<\n Q,\n RDPs,\n FunctionColumns\n >,\n): UseDefaultTableStatesResult => {\n const columnVisibility = useMemo(() => {\n if (columnDefinitions) {\n const colVisibility: VisibilityState = columnDefinitions.reduce(\n (acc, colDef) => {\n if (colDef.isVisible !== undefined) {\n const { locator } = colDef;\n\n const colKey = locator.id;\n\n return {\n ...acc,\n [colKey]: colDef.isVisible,\n };\n }\n return acc;\n },\n {},\n );\n\n return colVisibility;\n }\n }, [columnDefinitions]);\n\n return { columnVisibility };\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,SAASA,OAAO,QAAQ,OAAO;AAsB/B,OAAO,MAAMC,qBAAqB,GAAGA,CAQnC;EAAEC;AAIF,CAAC,KAC+B;EAChC,MAAMC,gBAAgB,GAAGH,OAAO,CAAC,MAAM;IACrC,IAAIE,iBAAiB,EAAE;MACrB,MAAME,aAA8B,GAAGF,iBAAiB,CAACG,MAAM,CAC7D,CAACC,GAAG,EAAEC,MAAM,KAAK;QACf,IAAIA,MAAM,CAACC,SAAS,KAAKC,SAAS,EAAE;UAClC,MAAM;YAAEC;UAAQ,CAAC,GAAGH,MAAM;UAE1B,MAAMI,MAAM,GAAGD,OAAO,CAACE,EAAE;UAEzB,OAAO;YACL,GAAGN,GAAG;YACN,CAACK,MAAM,GAAGJ,MAAM,CAACC;UACnB,CAAC;QACH;QACA,OAAOF,GAAG;MACZ,CAAC,EACD,CAAC,CACH,CAAC;MAED,OAAOF,aAAa;IACtB;EACF,CAAC,EAAE,CAACF,iBAAiB,CAAC,CAAC;EAEvB,OAAO;IAAEC;EAAiB,CAAC;AAC7B,CAAC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":"","names":[],"sources":["../../../../../src/object-table/hooks/__tests__/useDefaultTableStates.test.tsx"],"version":3,"file":"useDefaultTableStates.test.d.ts"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":"AAgBA,cACE,sBACA,iBACA,yBACK,WAAY;AACnB,cAAc,uBAAuB,uBAAwB;AAE7D,cAAc,wBAAwB,sBAAuB;UAEnD;CACR,UAAU;CACV,aAAa,eAAe,qBAAqB,CAAE;CACnD,wBAAwB,eAAe,gBAAgB,CAAE,MAAK;EAI9D;CACA,mBAAmB,iBACjB,GACA,MACA,iBACA;AACH;UAES,4BAA4B;CACpC,kBAAkB;AACnB;AAED,OAAO,cAAM;CACX,UAAU;CACV,aAAa,eAAe,qBAAqB,CAAE;CACnD,wBAAwB,eAAe,gBAAgB,CAAE,MAAK;EAK9D,EAAE,mBAID,EAJsB,2BACrB,GACA,MACA,qBAED","names":[],"sources":["../../../../src/object-table/hooks/useDefaultTableStates.ts"],"version":3,"file":"useDefaultTableStates.d.ts"}
|
|
File without changes
|