@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":[]}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { ActionDefinition, ActionEditResponse, ActionReturnTypeForOptions, ActionValidationResponse } from "@osdk/api";
|
|
2
|
+
import type { ActionValidationError, ApplyActionOptions } from "@osdk/client";
|
|
3
|
+
import type { ActionParameters, FieldKey, FieldValueType, FormFieldDefinition } from "./FormFieldApi.js";
|
|
4
|
+
/**
|
|
5
|
+
* Props for the ActionForm component
|
|
6
|
+
*/
|
|
7
|
+
export interface ActionFormProps<Q extends ActionDefinition<unknown>> {
|
|
8
|
+
actionDefinition: Q;
|
|
9
|
+
/**
|
|
10
|
+
* If not supplied, defaults to actionDef.displayName
|
|
11
|
+
*/
|
|
12
|
+
formTitle?: string;
|
|
13
|
+
/**
|
|
14
|
+
* If not supplied, this will be constructed from ActionParameters
|
|
15
|
+
*/
|
|
16
|
+
formFieldDefinition?: Array<FormFieldDefinition<Q>>;
|
|
17
|
+
/**
|
|
18
|
+
* Called when a field value changed.
|
|
19
|
+
* Required when a field is in controlled mode, i.e. value is provided via formFieldDefinition.
|
|
20
|
+
*
|
|
21
|
+
* @param fieldKey The key of the changed field
|
|
22
|
+
* @param value the updated value of the field
|
|
23
|
+
*/
|
|
24
|
+
onFieldValueChanged?: <K extends FieldKey<Q>>(fieldKey: K, value: FieldValueType<Q, K>) => void;
|
|
25
|
+
/**
|
|
26
|
+
* Override to disable submit button
|
|
27
|
+
* If not provided, button is disabled when form is submitting or has validation errors
|
|
28
|
+
*
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
isSubmitDisabled?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* If supplied, this will override the default submit action
|
|
34
|
+
* By default, the action's applyAction will be called with $validateOnly: false
|
|
35
|
+
*
|
|
36
|
+
* @param formState all field values when onSubmit is called
|
|
37
|
+
* @param applyAction the function to execute the action. Call it with $validateOnly: true options to run validation mode onSubmit.
|
|
38
|
+
* @returns a promise of the submission response
|
|
39
|
+
*/
|
|
40
|
+
onSubmit?: <OP extends ApplyActionOptions>(formState: FormState<Q>, applyAction: (args: ActionParameters<Q>, options?: OP) => Promise<ActionReturnTypeForOptions<OP>>) => Promise<ActionReturnTypeForOptions<OP>> | void;
|
|
41
|
+
/**
|
|
42
|
+
* Called when the validation response is returned from a validateOnly submission
|
|
43
|
+
*
|
|
44
|
+
* @param results the validation response
|
|
45
|
+
*/
|
|
46
|
+
onValidationResponse?: (results: ActionValidationResponse) => void;
|
|
47
|
+
/**
|
|
48
|
+
* Called when the action is successfully executed from a non-validateOnly submission
|
|
49
|
+
*
|
|
50
|
+
* @param results the submission response
|
|
51
|
+
*/
|
|
52
|
+
onSuccess?: (results: ActionEditResponse) => void;
|
|
53
|
+
/**
|
|
54
|
+
* Called when there is an error in form submission
|
|
55
|
+
*
|
|
56
|
+
* @param error the error that occurred
|
|
57
|
+
*/
|
|
58
|
+
onError?: (error: FormError) => void;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Form values mapping parameter names to their values
|
|
62
|
+
*/
|
|
63
|
+
export type FormState<Q extends ActionDefinition<unknown>> = { [K in FieldKey<Q>] : FieldValueType<Q, K> };
|
|
64
|
+
/**
|
|
65
|
+
* Form error discriminated union
|
|
66
|
+
*/
|
|
67
|
+
export type FormError = {
|
|
68
|
+
type: "validation"
|
|
69
|
+
error: ActionValidationError
|
|
70
|
+
} | {
|
|
71
|
+
type: "submission"
|
|
72
|
+
error: Error
|
|
73
|
+
} | {
|
|
74
|
+
type: "unknown"
|
|
75
|
+
error: unknown
|
|
76
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAgBA,cACE,kBACA,oBACA,4BACA,gCACK,WAAY;AACnB,cAAc,uBAAuB,0BAA0B,cAAe;AAC9E,cACE,kBACA,UACA,gBACA,2BACK,mBAAoB;;;;AAK3B,iBAAiB,gBAAgB,UAAU,2BAA2B;CACpE,kBAAkB;;;;CAKlB;;;;CAKA,sBAAsB,MAAM,oBAAoB;;;;;;;;CAShD,uBAAuB,UAAU,SAAS,IACxCA,UAAU,GACVC,OAAO,eAAe,GAAG;;;;;;;CAS3B;;;;;;;;;CAUA,YAAY,WAAW,oBACrBC,WAAW,UAAU,IACrBC,cACEC,MAAM,iBAAiB,IACvBC,UAAU,OACP,QAAQ,2BAA2B,SACrC,QAAQ,2BAA2B;;;;;;CAOxC,wBAAwBC,SAAS;;;;;;CAOjC,aAAaC,SAAS;;;;;;CAOtB,WAAWC,OAAO;AACnB;;;;AAKD,YAAY,UAAU,UAAU,gCAC7B,KAAK,SAAS,MAAK,eAAe,GAAG;;;;AAMxC,YAAY,YACR;CAAE,MAAM;CAAc,OAAO;AAAuB,IACpD;CAAE,MAAM;CAAc,OAAO;AAAO,IACpC;CAAE,MAAM;CAAW;AAAgB","names":["fieldKey: K","value: FieldValueType<Q, K>","formState: FormState<Q>","applyAction: (\n args: ActionParameters<Q>,\n options?: OP,\n ) => Promise<ActionReturnTypeForOptions<OP>>","args: ActionParameters<Q>","options?: OP","results: ActionValidationResponse","results: ActionEditResponse","error: FormError"],"sources":["../../../src/action-form/ActionFormApi.ts"],"version":3,"file":"ActionFormApi.d.ts"}
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import type { ActionDefinition, CompileTimeMetadata, ObjectSet, ObjectTypeDefinition } from "@osdk/api";
|
|
2
|
+
import type React from "react";
|
|
3
|
+
/**
|
|
4
|
+
* A form field definition specifies configuration for a single field
|
|
5
|
+
*/
|
|
6
|
+
export interface FormFieldDefinition<
|
|
7
|
+
Q extends ActionDefinition<unknown>,
|
|
8
|
+
K extends FieldKey<Q> = FieldKey<Q>,
|
|
9
|
+
V extends FieldValueType<Q, K> = FieldValueType<Q, K>,
|
|
10
|
+
C extends ValidFormFieldForPropertyType<V> = ValidFormFieldForPropertyType<V>
|
|
11
|
+
> {
|
|
12
|
+
/**
|
|
13
|
+
* The field's unique key
|
|
14
|
+
*/
|
|
15
|
+
fieldKey: K;
|
|
16
|
+
/**
|
|
17
|
+
* Display label for the field
|
|
18
|
+
* If not provided, the form field will not show any label.
|
|
19
|
+
*/
|
|
20
|
+
label?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Current value of the field
|
|
23
|
+
* If provided, the field operates in controlled mode
|
|
24
|
+
*/
|
|
25
|
+
value?: V;
|
|
26
|
+
/**
|
|
27
|
+
* Default value of the field
|
|
28
|
+
*/
|
|
29
|
+
defaultValue?: V;
|
|
30
|
+
/**
|
|
31
|
+
* The form field component type to render
|
|
32
|
+
*/
|
|
33
|
+
fieldComponent: C;
|
|
34
|
+
/**
|
|
35
|
+
* Whether the field is required
|
|
36
|
+
*/
|
|
37
|
+
isRequired?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Placeholder text
|
|
40
|
+
*/
|
|
41
|
+
placeholder?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Additional information to display on this field
|
|
44
|
+
* The placement of helper text depends on the value of helperTextPlacement prop
|
|
45
|
+
*/
|
|
46
|
+
helperText?: string;
|
|
47
|
+
/**
|
|
48
|
+
* The placement of the helper text either below the field or in a tooltip
|
|
49
|
+
*
|
|
50
|
+
* @default "tooltip"
|
|
51
|
+
*/
|
|
52
|
+
helperTextPlacement?: "bottom" | "tooltip";
|
|
53
|
+
/**
|
|
54
|
+
* Whether the field is disabled
|
|
55
|
+
*/
|
|
56
|
+
isDisabled?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* A callback to return a custom error message if validation failed
|
|
59
|
+
*
|
|
60
|
+
* @param validationRule the validation rule that failed with the error message
|
|
61
|
+
* @returns the error message to display
|
|
62
|
+
*/
|
|
63
|
+
onValidationError?: (error: ValidationError) => string;
|
|
64
|
+
/**
|
|
65
|
+
* Additional function to validate the field
|
|
66
|
+
*
|
|
67
|
+
* @param value the current field value
|
|
68
|
+
* @returns a boolean promise indicating whether the value is valid
|
|
69
|
+
*/
|
|
70
|
+
validate?: (value: V) => Promise<boolean>;
|
|
71
|
+
/**
|
|
72
|
+
* The component props for the form field
|
|
73
|
+
* Excludes runtime props (key, onChange) which are managed by ActionForm
|
|
74
|
+
*/
|
|
75
|
+
fieldComponentProps?: Omit<FormFieldPropsByType[C], "key" | "onChange">;
|
|
76
|
+
}
|
|
77
|
+
type ValidationError = {
|
|
78
|
+
type: ValidationRule
|
|
79
|
+
error: string
|
|
80
|
+
};
|
|
81
|
+
type ValidationRule = "required" | "min" | "max" | "minLength" | "maxLength" | "pattern" | "validate";
|
|
82
|
+
/**
|
|
83
|
+
* Maps field types to their corresponding props
|
|
84
|
+
*/
|
|
85
|
+
export interface FormFieldPropsByType {
|
|
86
|
+
DATETIME_PICKER: DatetimePickerFieldProps;
|
|
87
|
+
DROPDOWN: DropdownFieldProps<unknown>;
|
|
88
|
+
FILE_PICKER: FilePickerProps;
|
|
89
|
+
NUMBER_INPUT: NumberInputFieldProps;
|
|
90
|
+
OBJECT_SET: ObjectSetFieldProps<ObjectTypeDefinition>;
|
|
91
|
+
RADIO_BUTTONS: RadioButtonsFieldProps<unknown>;
|
|
92
|
+
TEXT_AREA: TextAreaFieldProps;
|
|
93
|
+
TEXT_INPUT: TextInputFieldProps;
|
|
94
|
+
CUSTOM: CustomFieldProps<unknown>;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Datetime picker field props
|
|
98
|
+
*/
|
|
99
|
+
export interface DatetimePickerFieldProps extends BaseFormFieldProps<Date> {
|
|
100
|
+
fieldComponent: "DATETIME_PICKER";
|
|
101
|
+
/**
|
|
102
|
+
* The earliest date the user can select
|
|
103
|
+
* If provided, this will be added to the field validation
|
|
104
|
+
*/
|
|
105
|
+
min?: Date;
|
|
106
|
+
/**
|
|
107
|
+
* The latest date the user can select
|
|
108
|
+
* If provided, this will be added to the field validation
|
|
109
|
+
*/
|
|
110
|
+
max?: Date;
|
|
111
|
+
/**
|
|
112
|
+
* Whether to show time picker
|
|
113
|
+
*/
|
|
114
|
+
showTime?: boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Function to format the date string
|
|
117
|
+
*/
|
|
118
|
+
formatDate?: (date: Date) => string;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Dropdown field props with selectable options
|
|
122
|
+
*/
|
|
123
|
+
export interface DropdownFieldProps<
|
|
124
|
+
V,
|
|
125
|
+
IsMulti extends boolean = false
|
|
126
|
+
> extends BaseFormFieldProps<IsMulti extends true ? V[] : V> {
|
|
127
|
+
fieldComponent: "DROPDOWN";
|
|
128
|
+
/**
|
|
129
|
+
* Available options for the dropdown
|
|
130
|
+
*/
|
|
131
|
+
options: Option<V>[];
|
|
132
|
+
/**
|
|
133
|
+
* Whether the dropdown allows searching/filtering
|
|
134
|
+
*/
|
|
135
|
+
isSearchable?: boolean;
|
|
136
|
+
/**
|
|
137
|
+
* Whether multiple values can be selected
|
|
138
|
+
*/
|
|
139
|
+
isMulti?: boolean;
|
|
140
|
+
}
|
|
141
|
+
export interface FilePickerProps extends BaseFormFieldProps<File | File[]> {
|
|
142
|
+
fieldComponent: "FILE_PICKER";
|
|
143
|
+
/**
|
|
144
|
+
* Whether multiple files can be selected
|
|
145
|
+
*/
|
|
146
|
+
isMulti?: boolean;
|
|
147
|
+
/**
|
|
148
|
+
* Accepted file types (e.g., "image/*", ".pdf")
|
|
149
|
+
*/
|
|
150
|
+
accept?: string | string[];
|
|
151
|
+
/**
|
|
152
|
+
* Maximum file size in bytes
|
|
153
|
+
*/
|
|
154
|
+
maxSize?: number;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Text area field props
|
|
158
|
+
*/
|
|
159
|
+
export interface TextAreaFieldProps extends BaseFormFieldProps<string>, Pick<React.TextareaHTMLAttributes<HTMLTextAreaElement>, "rows" | "wrap" | "minLength" | "maxLength"> {
|
|
160
|
+
fieldComponent: "TEXT_AREA";
|
|
161
|
+
}
|
|
162
|
+
export interface TextInputFieldProps extends BaseFormFieldProps<string>, Pick<React.InputHTMLAttributes<HTMLInputElement>, "minLength" | "maxLength"> {
|
|
163
|
+
fieldComponent: "TEXT_INPUT";
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Number input field props
|
|
167
|
+
*/
|
|
168
|
+
export interface NumberInputFieldProps extends BaseFormFieldProps<number>, Pick<React.InputHTMLAttributes<HTMLInputElement>, "min" | "max" | "step"> {
|
|
169
|
+
fieldComponent: "NUMBER_INPUT";
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Radio buttons field props
|
|
173
|
+
*/
|
|
174
|
+
export interface RadioButtonsFieldProps<V> extends BaseFormFieldProps<V> {
|
|
175
|
+
fieldComponent: "RADIO_BUTTONS";
|
|
176
|
+
/**
|
|
177
|
+
* Available options for radio buttons
|
|
178
|
+
*/
|
|
179
|
+
options: Option<V>[];
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Option interface for dropdown and radio options
|
|
183
|
+
*/
|
|
184
|
+
export interface Option<V> {
|
|
185
|
+
label: string;
|
|
186
|
+
value: V;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Object set field displays the summary of the count of the given object set
|
|
190
|
+
*/
|
|
191
|
+
export interface ObjectSetFieldProps<T extends ObjectTypeDefinition> extends BaseFormFieldProps<ObjectSet<T>> {
|
|
192
|
+
fieldComponent: "OBJECT_SET";
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Custom field props for user-defined renderers
|
|
196
|
+
*/
|
|
197
|
+
export interface CustomFieldProps<V> extends BaseFormFieldProps<V> {
|
|
198
|
+
fieldComponent: "CUSTOM";
|
|
199
|
+
/**
|
|
200
|
+
* Custom renderer function
|
|
201
|
+
*/
|
|
202
|
+
customRenderer: (props: BaseFormFieldProps<V>) => React.ReactNode;
|
|
203
|
+
}
|
|
204
|
+
export interface BaseFormFieldProps<V> {
|
|
205
|
+
fieldComponent: FieldComponent;
|
|
206
|
+
/**
|
|
207
|
+
* Called when the field value changed.
|
|
208
|
+
*
|
|
209
|
+
* ActionForm internally wraps this to pass the key to onFieldValueChanged:
|
|
210
|
+
* ```
|
|
211
|
+
* <DropdownField
|
|
212
|
+
* {...fieldDef}
|
|
213
|
+
* onChange={(value) => onFieldValueChanged(fieldDef.key, value)}
|
|
214
|
+
* />
|
|
215
|
+
* ```
|
|
216
|
+
*
|
|
217
|
+
* @param value The new value of the form field
|
|
218
|
+
*/
|
|
219
|
+
onChange?: (value?: V) => void;
|
|
220
|
+
}
|
|
221
|
+
export type FieldKey<Q extends ActionDefinition<unknown>> = keyof ActionParameters<Q>;
|
|
222
|
+
/**
|
|
223
|
+
* Extracts parameters from an ActionDefinition
|
|
224
|
+
*/
|
|
225
|
+
export type ActionParameters<Q extends ActionDefinition<unknown>> = CompileTimeMetadata<Q>["parameters"];
|
|
226
|
+
/**
|
|
227
|
+
* Extracts the value type for a specific parameter
|
|
228
|
+
*/
|
|
229
|
+
export type FieldValueType<
|
|
230
|
+
Q extends ActionDefinition<unknown> = ActionDefinition<unknown>,
|
|
231
|
+
K extends keyof ActionParameters<Q> = keyof ActionParameters<Q>
|
|
232
|
+
> = ActionParameters<Q>[K]["type"];
|
|
233
|
+
/**
|
|
234
|
+
* Available form field component types
|
|
235
|
+
*/
|
|
236
|
+
export type FieldComponent = "DATETIME_PICKER" | "DROPDOWN" | "FILE_PICKER" | "NUMBER_INPUT" | "RADIO_BUTTONS" | "OBJECT_SET" | "TEXT_AREA" | "TEXT_INPUT" | "CUSTOM";
|
|
237
|
+
/**
|
|
238
|
+
* Gets valid form field types for a given property type
|
|
239
|
+
*/
|
|
240
|
+
export type ValidFormFieldForPropertyType<P extends FieldValueType> = P extends "objectSet" ? "OBJECT_SET" : P extends "object" ? "DROPDOWN" : P extends "mediaReference" | "attachment" ? "FILE_PICKER" : P extends "boolean" ? "RADIO_BUTTONS" | "DROPDOWN" : P extends "string" ? "TEXT_INPUT" | "TEXT_AREA" : P extends "datetime" | "timestamp" ? "DATETIME_PICKER" : P extends "double" | "integer" | "long" | "float" | "short" | "byte" | "decimal" ? "NUMBER_INPUT" : never;
|
|
241
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAgBA,cACE,kBACA,qBACA,WACA,4BACK,WAAY;AACnB,YAAY,WAAW,OAAQ;;;;AAK/B,iBAAiB;CACf,UAAU;CACV,UAAU,SAAS,KAAK,SAAS;CACjC,UAAU,eAAe,GAAG,KAAK,eAAe,GAAG;CACnD,UAAU,8BAA8B,KAAK,8BAA8B;EAC3E;;;;CAIA,UAAU;;;;;CAMV;;;;;CAMA,QAAQ;;;;CAKR,eAAe;;;;CAKf,gBAAgB;;;;CAKhB;;;;CAKA;;;;;CAMA;;;;;;CAOA,sBAAsB,WAAW;;;;CAKjC;;;;;;;CAQA,qBAAqBA,OAAO;;;;;;;CAQ5B,YAAYC,OAAO,MAAM;;;;;CAMzB,sBAAsB,KAAK,qBAAqB,IAAI,QAAQ;AAC7D;KAEI,kBAAkB;CAAE,MAAM;CAAgB;AAAe;KAEzD,iBACD,aACA,QACA,QACA,cACA,cACA,YACA;;;;AAKJ,iBAAiB,qBAAqB;CACpC,iBAAiB;CACjB,UAAU;CACV,aAAa;CACb,cAAc;CACd,YAAY,oBAAoB;CAChC,eAAe;CACf,WAAW;CACX,YAAY;CACZ,QAAQ;AACT;;;;AAKD,iBAAiB,iCAAiC,mBAAmB,MAAM;CACzE,gBAAgB;;;;;CAMhB,MAAM;;;;;CAMN,MAAM;;;;CAKN;;;;CAKA,cAAcC,MAAM;AACrB;;;;AAKD,iBAAiB;CAAmB;CAAG,0BAA0B;UACvD,mBAAmB,gBAAgB,OAAO,MAAM,GAC1D;CACE,gBAAgB;;;;CAKhB,SAAS,OAAO;;;;CAKhB;;;;CAKA;AACD;AAED,iBAAiB,wBAAwB,mBAAmB,OAAO,QAAQ;CACzE,gBAAgB;;;;CAKhB;;;;CAKA;;;;CAKA;AACD;;;;AAKD,iBAAiB,2BACf,4BACA,KACE,MAAM,uBAAuB,sBAC3B,SACA,SAIA,cAIA,aAEN;CACE,gBAAgB;AACjB;AAED,iBAAiB,4BACf,4BACA,KACE,MAAM,oBAAoB,mBAIxB,cAIA,aAEN;CACE,gBAAgB;AACjB;;;;AAKD,iBAAiB,8BACf,4BACA,KACE,MAAM,oBAAoB,mBAIxB,QAIA,QACA,QAEN;CACE,gBAAgB;AACjB;;;;AAKD,iBAAiB,uBAAuB,WAAW,mBAAmB,GAAG;CACvE,gBAAgB;;;;CAKhB,SAAS,OAAO;AACjB;;;;AAKD,iBAAiB,OAAO,GAAG;CACzB;CACA,OAAO;AACR;;;;AAKD,iBAAiB,oBAAoB,UAAU,8BACrC,mBAAmB,UAAU,IACvC;CACE,gBAAgB;AACjB;;;;AAKD,iBAAiB,iBAAiB,WAAW,mBAAmB,GAAG;CACjE,gBAAgB;;;;CAKhB,iBAAiBC,OAAO,mBAAmB,OAAO,MAAM;AACzD;AAED,iBAAiB,mBAAmB,GAAG;CACrC,gBAAgB;;;;;;;;;;;;;;CAehB,YAAYC,QAAQ;AACrB;AAED,YAAY,SAAS,UAAU,mCACvB,iBAAiB;;;;AAKzB,YAAY,iBAAiB,UAAU,6BACrC,oBAAoB,GAAG;;;;AAKzB,YAAY;CACV,UAAU,4BAA4B;CACtC,gBAAgB,iBAAiB,WAAW,iBAAiB;IAC3D,iBAAiB,GAAG,GAAG;;;;AAK3B,YAAY,iBACR,oBACA,aACA,gBACA,iBACA,kBACA,eACA,cACA,eACA;;;;AAKJ,YAAY,8BAA8B,UAAU,kBAAkB,UACpE,cAAc,eACZ,UAAU,WAAW,aACrB,UAAU,mBAAmB,eAAe,gBAC5C,UAAU,YAAY,kBAAkB,aACxC,UAAU,WAAW,eAAe,cACpC,UAAU,aAAa,cAAc,oBACrC,UACE,WACA,YACA,SACA,UACA,UACA,SACA,YAAY","names":["error: ValidationError","value: V","date: Date","props: BaseFormFieldProps<V>","value?: V"],"sources":["../../../src/action-form/FormFieldApi.ts"],"version":3,"file":"FormFieldApi.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>
|
|
@@ -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;IAI5D;CACF,SAAS,wBAAwB,GAAG,MAAM;;;;CAK1C;;;;CAKA,SAAS,SAAS,UAAU;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA,cACEA,QAAQ,KAAK,SAAS,GAAG,sBAAsB,aAAa,IAAI,OAChEC,SAAS,wBAAwB,GAAG,MAAM,qBACvC,MAAM;CACX,qBAAqB,MAAM;AAC5B;AAED,YAAY;CACV,UAAU;CACV,aAAa,eAAe,qBAAqB;CAIjD,wBAAwB,eAAe,gBAAgB,CAAE,MAAK;IAK5D;CACA,MAAM;CACN,IAAI,aAAa;AAClB,IACC;CACA,MAAM;CACN,UAAU;AACX,IACC;CACA,MAAM;CACN,UAAU;CACV,SAAS,gBAAgB,QAAQ,GAAG,WAAW;AAChD;AAEH,iBAAiB;CACf,UAAU;CACV,aAAa,eAAe,qBAAqB;CAIjD,wBAAwB,eAAe,gBAAgB,CAAE,MAAK;EAI9D;;;;CAIA,WAAW,UAAU;;;;CAKrB,YAAY;;;;;;CAOZ,oBAAoB,MAAM,iBAAiB,GAAG,MAAM;;;;;;CAOpD;;;;;CAMA,SAAS,YAAY,GAAG;;;;;;;CAQxB,mBAAmBC,UAAU,YAAY,GAAG;;;;;;CAO5C
|
|
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;IAI5D;CACF,SAAS,wBAAwB,GAAG,MAAM;;;;CAK1C;;;;CAKA,SAAS,SAAS,UAAU;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA,cACEA,QAAQ,KAAK,SAAS,GAAG,sBAAsB,aAAa,IAAI,OAChEC,SAAS,wBAAwB,GAAG,MAAM,qBACvC,MAAM;CACX,qBAAqB,MAAM;AAC5B;AAED,YAAY;CACV,UAAU;CACV,aAAa,eAAe,qBAAqB;CAIjD,wBAAwB,eAAe,gBAAgB,CAAE,MAAK;IAK5D;CACA,MAAM;CACN,IAAI,aAAa;AAClB,IACC;CACA,MAAM;CACN,UAAU;AACX,IACC;CACA,MAAM;CACN,UAAU;CACV,SAAS,gBAAgB,QAAQ,GAAG,WAAW;AAChD;AAEH,iBAAiB;CACf,UAAU;CACV,aAAa,eAAe,qBAAqB;CAIjD,wBAAwB,eAAe,gBAAgB,CAAE,MAAK;EAI9D;;;;CAIA,WAAW,UAAU;;;;CAKrB,YAAY;;;;;;CAOZ,oBAAoB,MAAM,iBAAiB,GAAG,MAAM;;;;;;CAOpD;;;;;CAMA,SAAS,YAAY,GAAG;;;;;;;CAQxB,mBAAmBC,UAAU,YAAY,GAAG;;;;;;CAO5C;;;;;;CAOA,iBAAiB,MAAM;EACrB,UAAU,aAAa;EACvB,WAAW,QAAQ;CACpB;;;;;;CAOD,UAAU,MAAM;EACd,UAAU,aAAa;EACvB,WAAW,QAAQ;CACpB;;;;;;;CAQD,oBACEC,YAAY,MAAM;EAChB,UAAU,aAAa;EACvB,WAAW,QAAQ;CACpB;;;;;;;;CAUH,6BACEC,WAAW,MAAM;EACf,UAAU,aAAa,WAAW,aAAa;EAC/C;CACD;;;;;;;;CAUH,0BACEC,WAAW,MAAM;EACf,UAAU,aAAa,WAAW,aAAa;EAC/C,QAAQ,SAAS,UAAU;CAC5B;;;;;;;CASH,kBACEC,UAAU,aAAa,WAAW,aAAa,iBAC/CC;;;;;;CAQF,cACEP,QAAQ,KAAK,SAAS,GAAG,sBAAsB,aAAa,IAAI;;;;;;;;;CAWlE,gBAAgB,WAAW,aAAa;;;;;CAMxC,eAAe,eAAe;;;;;;;CAS9B,kBAAkBQ,gBAAgB,eAAe;;;;CAKjD,yBACEC,KAAK,KAAK,SAAS,GAAG,sBAAsB,aAAa,IAAI,OAC7DC,uBACG,MAAM;;;;;;CAOX;CAEA;AACD","names":["object: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<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,6 +1,6 @@
|
|
|
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>;
|
|
@@ -9,5 +9,4 @@ interface TableProps<TData extends RowData> {
|
|
|
9
9
|
renderCellContextMenu?: (row: TData, cell: Cell<TData, unknown>) => React.ReactNode;
|
|
10
10
|
className?: string;
|
|
11
11
|
}
|
|
12
|
-
export declare function
|
|
13
|
-
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;AAElE,OAAO,cAAc,oBAAyC,OAAQ;
|
|
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,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"}
|