@osdk/react-components 0.1.0-beta.4 → 0.1.0-beta.6
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 +26 -0
- package/build/browser/action-form/ActionFormApi.js +2 -0
- package/build/browser/action-form/ActionFormApi.js.map +1 -0
- package/build/browser/action-form/FormFieldApi.js +2 -0
- package/build/browser/action-form/FormFieldApi.js.map +1 -0
- package/build/browser/base-components/checkbox/Checkbox.module.css +1 -2
- package/build/browser/object-table/ObjectTable.js +35 -9
- 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 +1 -1
- package/build/browser/object-table/Table.js.map +1 -1
- package/build/browser/object-table/Table.module.css +1 -0
- package/build/browser/object-table/TableCell.js +7 -4
- package/build/browser/object-table/TableCell.js.map +1 -1
- package/build/browser/object-table/TableCell.module.css +18 -1
- package/build/browser/object-table/TableHeader.js +28 -13
- package/build/browser/object-table/TableHeader.js.map +1 -1
- package/build/browser/object-table/TableHeader.module.css +17 -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/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 +412 -85
- package/build/cjs/public/experimental.cjs.map +1 -1
- package/build/cjs/public/experimental.css +113 -1
- package/build/cjs/public/experimental.css.map +1 -1
- package/build/cjs/public/experimental.d.cts +25 -3
- package/build/esm/action-form/ActionFormApi.js +2 -0
- package/build/esm/action-form/ActionFormApi.js.map +1 -0
- package/build/esm/action-form/FormFieldApi.js +2 -0
- package/build/esm/action-form/FormFieldApi.js.map +1 -0
- package/build/esm/base-components/checkbox/Checkbox.module.css +1 -2
- package/build/esm/object-table/ObjectTable.js +35 -9
- 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 +1 -1
- package/build/esm/object-table/Table.js.map +1 -1
- package/build/esm/object-table/Table.module.css +1 -0
- package/build/esm/object-table/TableCell.js +7 -4
- package/build/esm/object-table/TableCell.js.map +1 -1
- package/build/esm/object-table/TableCell.module.css +18 -1
- package/build/esm/object-table/TableHeader.js +28 -13
- package/build/esm/object-table/TableHeader.js.map +1 -1
- package/build/esm/object-table/TableHeader.module.css +17 -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/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/action-form/ActionFormApi.d.ts +76 -0
- package/build/types/action-form/ActionFormApi.d.ts.map +1 -0
- package/build/types/action-form/FormFieldApi.d.ts +241 -0
- package/build/types/action-form/FormFieldApi.d.ts.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 +10 -0
- package/build/types/object-table/ObjectTableApi.d.ts.map +1 -1
- package/build/types/object-table/Table.d.ts +2 -3
- package/build/types/object-table/Table.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/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 +5 -5
- 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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useObjectTableData.js","names":["useObjectSet","useMemo","PAGE_SIZE","useObjectTableData","objectSet","columnDefinitions","filter","
|
|
1
|
+
{"version":3,"file":"useObjectTableData.js","names":["useObjectSet","useMemo","PAGE_SIZE","useObjectTableData","objectSet","columnDefinitions","filter","sorting","orderBy","length","undefined","reduce","acc","sort","id","desc","withProperties","rdpColumns","map","colDef","locator","colLocator","type","cur","creator","pageSize","where"],"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 ObjectSet,\n ObjectTypeDefinition,\n PropertyKeys,\n QueryDefinition,\n SimplePropertyDef,\n WhereClause,\n} from \"@osdk/api\";\nimport { useObjectSet } from \"@osdk/react/experimental\";\nimport type { SortingState } from \"@tanstack/react-table\";\nimport { useMemo } from \"react\";\nimport type { ColumnDefinition } from \"../ObjectTableApi.js\";\n\nconst PAGE_SIZE = 50;\n\n/**\n * This hook is a wrapper around useObjectSet\n * It extracts RDP locators from columnDefinitions and calls useObjectSet + withProperties\n * to return data containing the derived properties.\n */\n\nexport function useObjectTableData<\n Q extends ObjectTypeDefinition,\n RDPs extends Record<string, SimplePropertyDef>,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n>(\n objectSet: ObjectSet<Q>,\n columnDefinitions?: Array<ColumnDefinition<Q, RDPs, FunctionColumns>>,\n filter?: WhereClause<Q, RDPs>,\n sorting?: SortingState,\n): ReturnType<typeof useObjectSet<Q, never, RDPs>> {\n // Convert React Table sorting state to OSDK orderBy format\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 return rdpColumns.reduce<\n { [K in keyof RDPs]: DerivedProperty.Creator<Q, RDPs[K]> }\n >(\n (acc, cur) => {\n return {\n ...acc,\n [cur.id]: cur.creator,\n };\n },\n {} as {\n [K in keyof RDPs]: DerivedProperty.Creator<Q, RDPs[K]>;\n },\n );\n }, [columnDefinitions]);\n\n return useObjectSet<Q, never, RDPs>(\n objectSet,\n {\n withProperties,\n pageSize: PAGE_SIZE,\n where: filter,\n orderBy,\n },\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAWA,SAASA,YAAY,QAAQ,0BAA0B;AAEvD,SAASC,OAAO,QAAQ,OAAO;AAG/B,MAAMC,SAAS,GAAG,EAAE;;AAEpB;AACA;AACA;AACA;AACA;;AAEA,OAAO,SAASC,kBAAkBA,CAQhCC,SAAuB,EACvBC,iBAAqE,EACrEC,MAA6B,EAC7BC,OAAsB,EAC2B;EACjD;EACA,MAAMC,OAAO,GAAGP,OAAO,CAAC,MAAM;IAC5B,IAAI,CAACM,OAAO,IAAIA,OAAO,CAACE,MAAM,KAAK,CAAC,EAAE;MACpC,OAAOC,SAAS;IAClB;IAEA,OAAOH,OAAO,CAACI,MAAM,CACnB,CAACC,GAAG,EAAEC,IAAI,KAAK;MACbD,GAAG,CAACC,IAAI,CAACC,EAAE,CAAoB,GAAGD,IAAI,CAACE,IAAI,GAAG,MAAM,GAAG,KAAK;MAC5D,OAAOH,GAAG;IACZ,CAAC,EACD,CAAC,CACH,CAAC;EACH,CAAC,EAAE,CAACL,OAAO,CAAC,CAAC;;EAEb;EACA,MAAMS,cAAc,GAAGf,OAAO,CAAC,MAAM;IACnC,IAAI,CAACI,iBAAiB,EAAE;MACtB;IACF;IAEA,MAAMY,UAAU,GAAGZ,iBAAiB,CAACa,GAAG,CAACC,MAAM,IAAIA,MAAM,CAACC,OAAO,CAAC,CAACd,MAAM,CACtEe,UAAU,IAAK;MACd,OAAOA,UAAU,CAACC,IAAI,KAAK,KAAK;IAClC,CACF,CAAC;IAED,OAAOL,UAAU,CAACN,MAAM,CAGtB,CAACC,GAAG,EAAEW,GAAG,KAAK;MACZ,OAAO;QACL,GAAGX,GAAG;QACN,CAACW,GAAG,CAACT,EAAE,GAAGS,GAAG,CAACC;MAChB,CAAC;IACH,CAAC,EACD,CAAC,CAGH,CAAC;EACH,CAAC,EAAE,CAACnB,iBAAiB,CAAC,CAAC;EAEvB,OAAOL,YAAY,CACjBI,SAAS,EACT;IACEY,cAAc;IACdS,QAAQ,EAAEvB,SAAS;IACnBwB,KAAK,EAAEpB,MAAM;IACbE;EACF,CACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
import React, { useMemo } from "react";
|
|
18
18
|
import { SelectionCell, SelectionHeaderCell } from "../SelectionCells.js";
|
|
19
|
-
|
|
19
|
+
import { SELECTION_COLUMN_ID } from "../utils/constants.js";
|
|
20
20
|
export const useSelectionColumn = ({
|
|
21
21
|
selectionMode,
|
|
22
22
|
isAllSelected,
|
|
@@ -43,7 +43,8 @@ export const useSelectionColumn = ({
|
|
|
43
43
|
minSize: 50,
|
|
44
44
|
maxSize: 50,
|
|
45
45
|
enableSorting: false,
|
|
46
|
-
enableResizing: false
|
|
46
|
+
enableResizing: false,
|
|
47
|
+
enablePinning: false
|
|
47
48
|
};
|
|
48
49
|
}, [selectionMode, isAllSelected, hasSelection, onToggleAll, onToggleRow]);
|
|
49
50
|
return selectionColumn;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSelectionColumn.js","names":["React","useMemo","SelectionCell","SelectionHeaderCell","SELECTION_COLUMN_ID","useSelectionColumn","selectionMode","isAllSelected","hasSelection","onToggleAll","onToggleRow","selectionColumn","id","header","createElement","cell","row","size","minSize","maxSize","enableSorting","enableResizing"],"sources":["useSelectionColumn.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 ObjectTypeDefinition,\n Osdk,\n PropertyKeys,\n SimplePropertyDef,\n} from \"@osdk/api\";\nimport type { ColumnDef } from \"@tanstack/react-table\";\nimport React, { useMemo } from \"react\";\nimport { SelectionCell, SelectionHeaderCell } from \"../SelectionCells.js\";\n\ninterface UseSelectionColumnProps {\n selectionMode?: \"single\" | \"multiple\" | \"none\";\n isAllSelected: boolean;\n hasSelection: boolean;\n onToggleAll: () => void;\n onToggleRow: (id: string, rowIndex: number, isShiftClick: boolean) => void;\n}\n\nexport const
|
|
1
|
+
{"version":3,"file":"useSelectionColumn.js","names":["React","useMemo","SelectionCell","SelectionHeaderCell","SELECTION_COLUMN_ID","useSelectionColumn","selectionMode","isAllSelected","hasSelection","onToggleAll","onToggleRow","selectionColumn","id","header","createElement","cell","row","size","minSize","maxSize","enableSorting","enableResizing","enablePinning"],"sources":["useSelectionColumn.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 ObjectTypeDefinition,\n Osdk,\n PropertyKeys,\n SimplePropertyDef,\n} from \"@osdk/api\";\nimport type { ColumnDef } from \"@tanstack/react-table\";\nimport React, { useMemo } from \"react\";\nimport { SelectionCell, SelectionHeaderCell } from \"../SelectionCells.js\";\nimport { SELECTION_COLUMN_ID } from \"../utils/constants.js\";\n\ninterface UseSelectionColumnProps {\n selectionMode?: \"single\" | \"multiple\" | \"none\";\n isAllSelected: boolean;\n hasSelection: boolean;\n onToggleAll: () => void;\n onToggleRow: (id: string, rowIndex: number, isShiftClick: boolean) => void;\n}\n\nexport const useSelectionColumn = <\n Q extends ObjectTypeDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<\n string,\n never\n >,\n>({\n selectionMode,\n isAllSelected,\n hasSelection,\n onToggleAll,\n onToggleRow,\n}: UseSelectionColumnProps):\n | ColumnDef<\n Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>\n >\n | null =>\n{\n const selectionColumn = useMemo(() => {\n if (selectionMode === \"none\") return null;\n\n const colDef: ColumnDef<\n Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>\n > = {\n id: SELECTION_COLUMN_ID,\n header: () => (\n selectionMode === \"multiple\"\n ? (\n <SelectionHeaderCell\n isAllSelected={isAllSelected}\n hasSelection={hasSelection}\n onToggleAll={onToggleAll}\n />\n )\n : null\n ),\n cell: ({ row }: { row: any }) => (\n <SelectionCell\n row={row}\n onToggleRow={onToggleRow}\n />\n ),\n size: 50,\n minSize: 50,\n maxSize: 50,\n enableSorting: false,\n enableResizing: false,\n enablePinning: false,\n };\n\n return colDef;\n }, [\n selectionMode,\n isAllSelected,\n hasSelection,\n onToggleAll,\n onToggleRow,\n ]);\n\n return selectionColumn;\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA,OAAOA,KAAK,IAAIC,OAAO,QAAQ,OAAO;AACtC,SAASC,aAAa,EAAEC,mBAAmB,QAAQ,sBAAsB;AACzE,SAASC,mBAAmB,QAAQ,uBAAuB;AAU3D,OAAO,MAAMC,kBAAkB,GAAGA,CAMhC;EACAC,aAAa;EACbC,aAAa;EACbC,YAAY;EACZC,WAAW;EACXC;AACuB,CAAC,KAK1B;EACE,MAAMC,eAAe,GAAGV,OAAO,CAAC,MAAM;IACpC,IAAIK,aAAa,KAAK,MAAM,EAAE,OAAO,IAAI;IA+BzC,OA3BI;MACFM,EAAE,EAAER,mBAAmB;MACvBS,MAAM,EAAEA,CAAA,KACNP,aAAa,KAAK,UAAU,gBAExBN,KAAA,CAAAc,aAAA,CAACX,mBAAmB;QAClBI,aAAa,EAAEA,aAAc;QAC7BC,YAAY,EAAEA,YAAa;QAC3BC,WAAW,EAAEA;MAAY,CAC1B,CAAC,GAEF,IACL;MACDM,IAAI,EAAEA,CAAC;QAAEC;MAAkB,CAAC,kBAC1BhB,KAAA,CAAAc,aAAA,CAACZ,aAAa;QACZc,GAAG,EAAEA,GAAI;QACTN,WAAW,EAAEA;MAAY,CAC1B,CACF;MACDO,IAAI,EAAE,EAAE;MACRC,OAAO,EAAE,EAAE;MACXC,OAAO,EAAE,EAAE;MACXC,aAAa,EAAE,KAAK;MACpBC,cAAc,EAAE,KAAK;MACrBC,aAAa,EAAE;IACjB,CAAC;EAGH,CAAC,EAAE,CACDhB,aAAa,EACbC,aAAa,EACbC,YAAY,EACZC,WAAW,EACXC,WAAW,CACZ,CAAC;EAEF,OAAOC,eAAe;AACxB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,66 @@
|
|
|
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
|
+
import { useCallback, useMemo, useState } from "react";
|
|
18
|
+
export const useTableSorting = ({
|
|
19
|
+
orderBy,
|
|
20
|
+
defaultOrderBy,
|
|
21
|
+
onOrderByChanged
|
|
22
|
+
}) => {
|
|
23
|
+
// The sorting state in uncontrolled mode
|
|
24
|
+
const [internalSorting, setInternalSorting] = useState(() => defaultOrderBy ? convertOrderByToSortingState(defaultOrderBy) : []);
|
|
25
|
+
const isControlled = orderBy !== undefined;
|
|
26
|
+
|
|
27
|
+
// Sorting state
|
|
28
|
+
// If controlled mode, return the state from orderBy prop
|
|
29
|
+
// If uncontrolled, return the internalSorting state
|
|
30
|
+
const sortingState = useMemo(() => orderBy ? convertOrderByToSortingState(orderBy) : internalSorting, [orderBy, internalSorting]);
|
|
31
|
+
const onSortingChange = useCallback(updater => {
|
|
32
|
+
const newSorting = typeof updater === "function" ? updater(sortingState) : updater;
|
|
33
|
+
|
|
34
|
+
// Update internal state if uncontrolled
|
|
35
|
+
if (!isControlled) {
|
|
36
|
+
setInternalSorting(newSorting);
|
|
37
|
+
}
|
|
38
|
+
if (onOrderByChanged) {
|
|
39
|
+
const newOrderBy = convertSortingStateToOrderBy(newSorting);
|
|
40
|
+
onOrderByChanged(newOrderBy);
|
|
41
|
+
}
|
|
42
|
+
}, [isControlled, sortingState, onOrderByChanged]);
|
|
43
|
+
return {
|
|
44
|
+
sorting: sortingState,
|
|
45
|
+
onSortingChange
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
function convertOrderByToSortingState(orderBy) {
|
|
49
|
+
return orderBy.map(({
|
|
50
|
+
property,
|
|
51
|
+
direction
|
|
52
|
+
}) => ({
|
|
53
|
+
id: property,
|
|
54
|
+
desc: direction === "desc"
|
|
55
|
+
}));
|
|
56
|
+
}
|
|
57
|
+
function convertSortingStateToOrderBy(sorting) {
|
|
58
|
+
return sorting.map(({
|
|
59
|
+
id,
|
|
60
|
+
desc
|
|
61
|
+
}) => ({
|
|
62
|
+
property: id,
|
|
63
|
+
direction: desc ? "desc" : "asc"
|
|
64
|
+
}));
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=useTableSorting.js.map
|
|
@@ -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,KAAKO,SAAS;;EAE1C;EACA;EACA;EACA,MAAMC,YAA0B,GAAGX,OAAO,CACxC,MAAOG,OAAO,GAAGK,4BAA4B,CAACL,OAAO,CAAC,GAAGG,eAAgB,EACzE,CAACH,OAAO,EAAEG,eAAe,CAC3B,CAAC;EAED,MAAMM,eAAyC,GAAGb,WAAW,CAC1Dc,OAAO,IAAK;IACX,MAAMC,UAAU,GAAG,OAAOD,OAAO,KAAK,UAAU,GAC5CA,OAAO,CAACF,YAAY,CAAC,GACrBE,OAAO;;IAEX;IACA,IAAI,CAACJ,YAAY,EAAE;MACjBF,kBAAkB,CAACO,UAAU,CAAC;IAChC;IAEA,IAAIT,gBAAgB,EAAE;MACpB,MAAMU,UAAU,GAAGC,4BAA4B,CAAIF,UAAU,CAAC;MAC9DT,gBAAgB,CAACU,UAAU,CAAC;IAC9B;EACF,CAAC,EACD,CAACN,YAAY,EAAEE,YAAY,EAAEN,gBAAgB,CAC/C,CAAC;EAED,OAAO;IAAEY,OAAO,EAAEN,YAAY;IAAEC;EAAgB,CAAC;AACnD,CAAC;AAED,SAASJ,4BAA4BA,CACnCL,OAGE,EACY;EACd,OAAOA,OAAO,CAACe,GAAG,CAAC,CAAC;IAAEC,QAAQ;IAAEC;EAAU,CAAC,MAAM;IAC/CC,EAAE,EAAEF,QAAQ;IACZG,IAAI,EAAEF,SAAS,KAAK;EACtB,CAAC,CAAC,CAAC;AACL;AAEA,SAASJ,4BAA4BA,CACnCC,OAAqB,EAIpB;EACD,OAAOA,OAAO,CAACC,GAAG,CAAC,CAAC;IAAEG,EAAE;IAAEC;EAAK,CAAC,MAAM;IACpCH,QAAQ,EAAEE,EAAqB;IAC/BD,SAAS,EAAEE,IAAI,GAAG,MAAM,GAAG;EAC7B,CAAC,CAAC,CAAC;AACL","ignoreList":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
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 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":[]}
|