@osdk/react-components 0.2.0-beta.1 → 0.2.0-beta.3
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 +35 -0
- package/README.md +21 -5
- package/build/browser/base-components/action-button/ActionButton.js +31 -0
- package/build/browser/base-components/action-button/ActionButton.js.map +1 -0
- package/build/browser/base-components/action-button/ActionButton.module.css +70 -0
- package/build/browser/base-components/action-button/ActionButton.module.css.js +8 -0
- package/build/browser/base-components/checkbox/Checkbox.js +27 -32
- package/build/browser/base-components/checkbox/Checkbox.module.css +79 -0
- package/build/browser/base-components/checkbox/Checkbox.module.css.js +7 -0
- package/build/browser/base-components/combobox/Combobox.js +124 -0
- package/build/browser/base-components/combobox/Combobox.js.map +1 -0
- package/build/browser/base-components/combobox/Combobox.module.css +177 -0
- package/build/browser/base-components/combobox/Combobox.module.css.js +16 -0
- package/build/browser/base-components/dialog/Dialog.js +52 -0
- package/build/browser/base-components/dialog/Dialog.js.map +1 -0
- package/build/browser/base-components/dialog/Dialog.module.css +101 -0
- package/build/browser/base-components/dialog/Dialog.module.css.js +13 -0
- package/build/browser/base-components/draggable-list/DraggableList.js +155 -0
- package/build/browser/base-components/draggable-list/DraggableList.js.map +1 -0
- package/build/browser/base-components/draggable-list/DraggableList.module.css +108 -0
- package/build/browser/base-components/draggable-list/DraggableList.module.css.js +11 -0
- package/build/browser/base-components/search-bar/SearchBar.js +44 -0
- package/build/browser/base-components/search-bar/SearchBar.js.map +1 -0
- package/build/browser/base-components/search-bar/SearchBar.module.css +53 -0
- package/build/browser/base-components/search-bar/SearchBar.module.css.js +8 -0
- package/build/browser/base-components/select/Select.js +89 -0
- package/build/browser/base-components/select/Select.js.map +1 -0
- package/build/browser/base-components/select/Select.module.css +138 -0
- package/build/browser/base-components/select/Select.module.css.js +11 -0
- package/build/browser/base-components/switch/Switch.js +33 -0
- package/build/browser/base-components/switch/Switch.js.map +1 -0
- package/build/browser/base-components/switch/Switch.module.css +91 -0
- package/build/browser/base-components/switch/Switch.module.css.js +7 -0
- package/build/browser/filter-list/FilterListApi.js.map +1 -1
- package/build/browser/filter-list/FilterListItemApi.js.map +1 -1
- package/build/browser/filter-list/__tests__/filterStateToWhereClause.test.js +296 -0
- package/build/browser/filter-list/__tests__/filterStateToWhereClause.test.js.map +1 -0
- package/build/browser/filter-list/__tests__/getFilterKey.test.js +53 -0
- package/build/browser/filter-list/__tests__/getFilterKey.test.js.map +1 -0
- package/build/browser/filter-list/__tests__/testUtils.js +192 -0
- package/build/browser/filter-list/__tests__/testUtils.js.map +1 -0
- package/build/browser/filter-list/hooks/__tests__/useFilterListState.test.js +128 -0
- package/build/browser/filter-list/hooks/__tests__/useFilterListState.test.js.map +1 -0
- package/build/browser/filter-list/hooks/useDebouncedValue.js +52 -0
- package/build/browser/filter-list/hooks/useDebouncedValue.js.map +1 -0
- package/build/browser/filter-list/hooks/useFilterListState.js +119 -0
- package/build/browser/filter-list/hooks/useFilterListState.js.map +1 -0
- package/build/browser/filter-list/hooks/usePropertyAggregation.js +92 -0
- package/build/browser/filter-list/hooks/usePropertyAggregation.js.map +1 -0
- package/build/browser/filter-list/types/AddFilterMenuTypes.js +2 -0
- package/build/browser/filter-list/types/AddFilterMenuTypes.js.map +1 -0
- package/build/browser/filter-list/types/CustomRendererTypes.js +2 -0
- package/build/browser/filter-list/types/CustomRendererTypes.js.map +1 -0
- package/build/browser/filter-list/types/KeywordSearchTypes.js +2 -0
- package/build/browser/filter-list/types/KeywordSearchTypes.js.map +1 -0
- package/build/browser/filter-list/types/LinkedFilterTypes.js +2 -0
- package/build/browser/filter-list/types/LinkedFilterTypes.js.map +1 -0
- package/build/browser/filter-list/types/index.js +21 -0
- package/build/browser/filter-list/types/index.js.map +1 -0
- package/build/browser/filter-list/utils/assertUnreachable.js +25 -0
- package/build/browser/filter-list/utils/assertUnreachable.js.map +1 -0
- package/build/browser/filter-list/utils/coerceFilterValue.js +33 -0
- package/build/browser/filter-list/utils/coerceFilterValue.js.map +1 -0
- package/build/browser/filter-list/utils/filterStateToWhereClause.js +337 -0
- package/build/browser/filter-list/utils/filterStateToWhereClause.js.map +1 -0
- package/build/browser/filter-list/utils/filterValues.js +55 -0
- package/build/browser/filter-list/utils/filterValues.js.map +1 -0
- package/build/browser/filter-list/utils/getFilterKey.js +34 -0
- package/build/browser/filter-list/utils/getFilterKey.js.map +1 -0
- package/build/browser/object-table/CellContextMenu.js +23 -20
- package/build/browser/object-table/CellContextMenu.module.css +20 -0
- package/build/browser/object-table/CellContextMenu.module.css.js +6 -0
- package/build/browser/object-table/ColumnConfigDialog.js +259 -0
- package/build/browser/object-table/ColumnConfigDialog.js.map +1 -0
- package/build/browser/object-table/ColumnConfigDialog.module.css +247 -0
- package/build/browser/object-table/ColumnConfigDialog.module.css.js +29 -0
- package/build/browser/object-table/LoadingCell.js +24 -29
- package/build/browser/object-table/LoadingCell.module.css +48 -0
- package/build/browser/object-table/LoadingCell.module.css.js +8 -0
- package/build/browser/object-table/LoadingRow.js +24 -50
- package/build/browser/object-table/LoadingStateTable.js +49 -343
- package/build/browser/object-table/LoadingStateTable.js.map +1 -1
- package/build/browser/object-table/MultiColumnSortDialog.js +178 -0
- package/build/browser/object-table/MultiColumnSortDialog.js.map +1 -0
- package/build/browser/object-table/MultiColumnSortDialog.module.css +195 -0
- package/build/browser/object-table/MultiColumnSortDialog.module.css.js +22 -0
- package/build/browser/object-table/NonIdealState.js +23 -20
- package/build/browser/object-table/NonIdealState.module.css +27 -0
- package/build/browser/object-table/NonIdealState.module.css.js +7 -0
- package/build/browser/object-table/ObjectTable.js +43 -13
- 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/SortableItemsList.js +35 -0
- package/build/browser/object-table/SortableItemsList.js.map +1 -0
- package/build/browser/object-table/Table.js +54 -934
- package/build/browser/object-table/Table.js.map +1 -1
- package/build/browser/object-table/Table.module.css +29 -0
- package/build/browser/object-table/Table.module.css.js +6 -0
- package/build/browser/object-table/TableBody.js +36 -260
- package/build/browser/object-table/TableBody.module.css +20 -0
- package/build/browser/object-table/TableBody.module.css.js +6 -0
- package/build/browser/object-table/TableCell.js +31 -111
- package/build/browser/object-table/TableCell.module.css +73 -0
- package/build/browser/object-table/TableCell.module.css.js +8 -0
- package/build/browser/object-table/TableHeader.js +126 -216
- package/build/browser/object-table/TableHeader.js.map +1 -1
- package/build/browser/object-table/TableHeader.module.css +106 -0
- package/build/browser/object-table/TableHeader.module.css.js +10 -0
- package/build/browser/object-table/TableHeaderContent.js +21 -18
- package/build/browser/object-table/TableHeaderContent.module.css +30 -0
- package/build/browser/object-table/TableHeaderContent.module.css.js +6 -0
- package/build/browser/object-table/TableHeaderWithPopover.js +110 -93
- package/build/browser/object-table/TableHeaderWithPopover.js.map +1 -1
- package/build/browser/object-table/TableHeaderWithPopover.module.css +141 -0
- package/build/browser/object-table/TableHeaderWithPopover.module.css.js +17 -0
- package/build/browser/object-table/TableRow.js +26 -144
- package/build/browser/object-table/TableRow.module.css +60 -0
- package/build/browser/object-table/TableRow.module.css.js +6 -0
- package/build/browser/object-table/hooks/__tests__/useColumnVisibility.test.js +160 -138
- package/build/browser/object-table/hooks/__tests__/useColumnVisibility.test.js.map +1 -1
- package/build/browser/object-table/hooks/__tests__/useRowSelection.test.js +3 -0
- package/build/browser/object-table/hooks/__tests__/useRowSelection.test.js.map +1 -1
- package/build/browser/object-table/hooks/__tests__/useSelectionColumn.test.js +27 -82
- package/build/browser/object-table/hooks/__tests__/useSelectionColumn.test.js.map +1 -1
- package/build/browser/object-table/hooks/__tests__/useTableSorting.test.js +290 -0
- package/build/browser/object-table/hooks/__tests__/useTableSorting.test.js.map +1 -1
- package/build/browser/object-table/hooks/useColumnDefs.js +7 -2
- package/build/browser/object-table/hooks/useColumnDefs.js.map +1 -1
- package/build/browser/object-table/hooks/useColumnResize.js +45 -0
- package/build/browser/object-table/hooks/useColumnResize.js.map +1 -0
- package/build/browser/object-table/hooks/useColumnVisibility.js +52 -20
- package/build/browser/object-table/hooks/useColumnVisibility.js.map +1 -1
- package/build/browser/object-table/hooks/useRowSelection.js +8 -7
- package/build/browser/object-table/hooks/useRowSelection.js.map +1 -1
- package/build/browser/object-table/hooks/useSelectionColumn.js +15 -6
- package/build/browser/object-table/hooks/useSelectionColumn.js.map +1 -1
- package/build/browser/object-table/utils/types.js +2 -0
- package/build/browser/object-table/utils/types.js.map +1 -0
- package/build/browser/public/experimental.js +1 -0
- package/build/browser/public/experimental.js.map +1 -1
- package/build/browser/styles.css +1875 -0
- package/build/cjs/public/experimental.cjs +1036 -197
- package/build/cjs/public/experimental.cjs.map +1 -1
- package/build/cjs/public/experimental.css +659 -29
- package/build/cjs/public/experimental.css.map +1 -1
- package/build/cjs/public/experimental.d.cts +435 -44
- package/build/esm/base-components/action-button/ActionButton.js +31 -0
- package/build/esm/base-components/action-button/ActionButton.js.map +1 -0
- package/build/esm/base-components/action-button/ActionButton.module.css +70 -0
- package/build/esm/base-components/checkbox/Checkbox.module.css +1 -1
- package/build/esm/base-components/combobox/Combobox.js +124 -0
- package/build/esm/base-components/combobox/Combobox.js.map +1 -0
- package/build/esm/base-components/combobox/Combobox.module.css +177 -0
- package/build/esm/base-components/dialog/Dialog.js +52 -0
- package/build/esm/base-components/dialog/Dialog.js.map +1 -0
- package/build/esm/base-components/dialog/Dialog.module.css +101 -0
- package/build/esm/base-components/draggable-list/DraggableList.js +155 -0
- package/build/esm/base-components/draggable-list/DraggableList.js.map +1 -0
- package/build/esm/base-components/draggable-list/DraggableList.module.css +108 -0
- package/build/esm/base-components/search-bar/SearchBar.js +44 -0
- package/build/esm/base-components/search-bar/SearchBar.js.map +1 -0
- package/build/esm/base-components/search-bar/SearchBar.module.css +53 -0
- package/build/esm/base-components/select/Select.js +89 -0
- package/build/esm/base-components/select/Select.js.map +1 -0
- package/build/esm/base-components/select/Select.module.css +138 -0
- package/build/esm/base-components/switch/Switch.js +33 -0
- package/build/esm/base-components/switch/Switch.js.map +1 -0
- package/build/esm/base-components/switch/Switch.module.css +91 -0
- package/build/esm/filter-list/FilterListApi.js.map +1 -1
- package/build/esm/filter-list/FilterListItemApi.js.map +1 -1
- package/build/esm/filter-list/__tests__/filterStateToWhereClause.test.js +296 -0
- package/build/esm/filter-list/__tests__/filterStateToWhereClause.test.js.map +1 -0
- package/build/esm/filter-list/__tests__/getFilterKey.test.js +53 -0
- package/build/esm/filter-list/__tests__/getFilterKey.test.js.map +1 -0
- package/build/esm/filter-list/__tests__/testUtils.js +192 -0
- package/build/esm/filter-list/__tests__/testUtils.js.map +1 -0
- package/build/esm/filter-list/hooks/__tests__/useFilterListState.test.js +128 -0
- package/build/esm/filter-list/hooks/__tests__/useFilterListState.test.js.map +1 -0
- package/build/esm/filter-list/hooks/useDebouncedValue.js +52 -0
- package/build/esm/filter-list/hooks/useDebouncedValue.js.map +1 -0
- package/build/esm/filter-list/hooks/useFilterListState.js +119 -0
- package/build/esm/filter-list/hooks/useFilterListState.js.map +1 -0
- package/build/esm/filter-list/hooks/usePropertyAggregation.js +92 -0
- package/build/esm/filter-list/hooks/usePropertyAggregation.js.map +1 -0
- package/build/esm/filter-list/types/AddFilterMenuTypes.js +2 -0
- package/build/esm/filter-list/types/AddFilterMenuTypes.js.map +1 -0
- package/build/esm/filter-list/types/CustomRendererTypes.js +2 -0
- package/build/esm/filter-list/types/CustomRendererTypes.js.map +1 -0
- package/build/esm/filter-list/types/KeywordSearchTypes.js +2 -0
- package/build/esm/filter-list/types/KeywordSearchTypes.js.map +1 -0
- package/build/esm/filter-list/types/LinkedFilterTypes.js +2 -0
- package/build/esm/filter-list/types/LinkedFilterTypes.js.map +1 -0
- package/build/esm/filter-list/types/index.js +21 -0
- package/build/esm/filter-list/types/index.js.map +1 -0
- package/build/esm/filter-list/utils/assertUnreachable.js +25 -0
- package/build/esm/filter-list/utils/assertUnreachable.js.map +1 -0
- package/build/esm/filter-list/utils/coerceFilterValue.js +33 -0
- package/build/esm/filter-list/utils/coerceFilterValue.js.map +1 -0
- package/build/esm/filter-list/utils/filterStateToWhereClause.js +337 -0
- package/build/esm/filter-list/utils/filterStateToWhereClause.js.map +1 -0
- package/build/esm/filter-list/utils/filterValues.js +55 -0
- package/build/esm/filter-list/utils/filterValues.js.map +1 -0
- package/build/esm/filter-list/utils/getFilterKey.js +34 -0
- package/build/esm/filter-list/utils/getFilterKey.js.map +1 -0
- package/build/esm/object-table/ColumnConfigDialog.js +259 -0
- package/build/esm/object-table/ColumnConfigDialog.js.map +1 -0
- package/build/esm/object-table/ColumnConfigDialog.module.css +247 -0
- package/build/esm/object-table/LoadingStateTable.js +4 -4
- package/build/esm/object-table/LoadingStateTable.js.map +1 -1
- package/build/esm/object-table/MultiColumnSortDialog.js +178 -0
- package/build/esm/object-table/MultiColumnSortDialog.js.map +1 -0
- package/build/esm/object-table/MultiColumnSortDialog.module.css +195 -0
- package/build/esm/object-table/NonIdealState.module.css +2 -3
- package/build/esm/object-table/ObjectTable.js +43 -13
- 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/SortableItemsList.js +35 -0
- package/build/esm/object-table/SortableItemsList.js.map +1 -0
- package/build/esm/object-table/Table.js +9 -7
- package/build/esm/object-table/Table.js.map +1 -1
- package/build/esm/object-table/Table.module.css +9 -2
- package/build/esm/object-table/TableCell.module.css +11 -0
- package/build/esm/object-table/TableHeader.js +93 -6
- package/build/esm/object-table/TableHeader.js.map +1 -1
- package/build/esm/object-table/TableHeader.module.css +7 -2
- package/build/esm/object-table/TableHeaderWithPopover.js +53 -22
- package/build/esm/object-table/TableHeaderWithPopover.js.map +1 -1
- package/build/esm/object-table/TableHeaderWithPopover.module.css +54 -23
- package/build/esm/object-table/hooks/__tests__/useColumnVisibility.test.js +160 -138
- package/build/esm/object-table/hooks/__tests__/useColumnVisibility.test.js.map +1 -1
- package/build/esm/object-table/hooks/__tests__/useRowSelection.test.js +3 -0
- package/build/esm/object-table/hooks/__tests__/useRowSelection.test.js.map +1 -1
- package/build/esm/object-table/hooks/__tests__/useSelectionColumn.test.js +27 -82
- package/build/esm/object-table/hooks/__tests__/useSelectionColumn.test.js.map +1 -1
- package/build/esm/object-table/hooks/__tests__/useTableSorting.test.js +290 -0
- package/build/esm/object-table/hooks/__tests__/useTableSorting.test.js.map +1 -1
- package/build/esm/object-table/hooks/useColumnDefs.js +7 -2
- package/build/esm/object-table/hooks/useColumnDefs.js.map +1 -1
- package/build/esm/object-table/hooks/useColumnResize.js +45 -0
- package/build/esm/object-table/hooks/useColumnResize.js.map +1 -0
- package/build/esm/object-table/hooks/useColumnVisibility.js +52 -20
- package/build/esm/object-table/hooks/useColumnVisibility.js.map +1 -1
- package/build/esm/object-table/hooks/useRowSelection.js +8 -7
- package/build/esm/object-table/hooks/useRowSelection.js.map +1 -1
- package/build/esm/object-table/hooks/useSelectionColumn.js +15 -6
- package/build/esm/object-table/hooks/useSelectionColumn.js.map +1 -1
- package/build/esm/object-table/utils/types.js +2 -0
- package/build/esm/object-table/utils/types.js.map +1 -0
- package/build/esm/public/experimental.js +1 -0
- package/build/esm/public/experimental.js.map +1 -1
- package/build/types/base-components/action-button/ActionButton.d.ts +5 -0
- package/build/types/base-components/action-button/ActionButton.d.ts.map +1 -0
- package/build/types/base-components/combobox/Combobox.d.ts +52 -0
- package/build/types/base-components/combobox/Combobox.d.ts.map +1 -0
- package/build/types/base-components/dialog/Dialog.d.ts +10 -0
- package/build/types/base-components/dialog/Dialog.d.ts.map +1 -0
- package/build/types/base-components/draggable-list/DraggableList.d.ts +17 -0
- package/build/types/base-components/draggable-list/DraggableList.d.ts.map +1 -0
- package/build/types/base-components/search-bar/SearchBar.d.ts +11 -0
- package/build/types/base-components/search-bar/SearchBar.d.ts.map +1 -0
- package/build/types/base-components/select/Select.d.ts +34 -0
- package/build/types/base-components/select/Select.d.ts.map +1 -0
- package/build/types/base-components/switch/Switch.d.ts +10 -0
- package/build/types/base-components/switch/Switch.d.ts.map +1 -0
- package/build/types/filter-list/FilterListApi.d.ts +63 -12
- package/build/types/filter-list/FilterListApi.d.ts.map +1 -1
- package/build/types/filter-list/FilterListItemApi.d.ts +101 -53
- package/build/types/filter-list/FilterListItemApi.d.ts.map +1 -1
- package/build/types/filter-list/__tests__/filterStateToWhereClause.test.d.ts +1 -0
- package/build/types/filter-list/__tests__/filterStateToWhereClause.test.d.ts.map +1 -0
- package/build/types/filter-list/__tests__/getFilterKey.test.d.ts +1 -0
- package/build/types/filter-list/__tests__/getFilterKey.test.d.ts.map +1 -0
- package/build/types/filter-list/__tests__/testUtils.d.ts +59 -0
- package/build/types/filter-list/__tests__/testUtils.d.ts.map +1 -0
- package/build/types/filter-list/hooks/__tests__/useFilterListState.test.d.ts +1 -0
- package/build/types/filter-list/hooks/__tests__/useFilterListState.test.d.ts.map +1 -0
- package/build/types/filter-list/hooks/useDebouncedValue.d.ts +11 -0
- package/build/types/filter-list/hooks/useDebouncedValue.d.ts.map +1 -0
- package/build/types/filter-list/hooks/useFilterListState.d.ts +11 -0
- package/build/types/filter-list/hooks/useFilterListState.d.ts.map +1 -0
- package/build/types/filter-list/hooks/usePropertyAggregation.d.ts +20 -0
- package/build/types/filter-list/hooks/usePropertyAggregation.d.ts.map +1 -0
- package/build/types/filter-list/types/AddFilterMenuTypes.d.ts +61 -0
- package/build/types/filter-list/types/AddFilterMenuTypes.d.ts.map +1 -0
- package/build/types/filter-list/types/CustomRendererTypes.d.ts +76 -0
- package/build/types/filter-list/types/CustomRendererTypes.d.ts.map +1 -0
- package/build/types/filter-list/types/KeywordSearchTypes.d.ts +56 -0
- package/build/types/filter-list/types/KeywordSearchTypes.d.ts.map +1 -0
- package/build/types/filter-list/types/LinkedFilterTypes.d.ts +70 -0
- package/build/types/filter-list/types/LinkedFilterTypes.d.ts.map +1 -0
- package/build/types/filter-list/types/index.d.ts +4 -0
- package/build/types/filter-list/types/index.d.ts.map +1 -0
- package/build/types/filter-list/utils/assertUnreachable.d.ts +6 -0
- package/build/types/filter-list/utils/assertUnreachable.d.ts.map +1 -0
- package/build/types/filter-list/utils/coerceFilterValue.d.ts +11 -0
- package/build/types/filter-list/utils/coerceFilterValue.d.ts.map +1 -0
- package/build/types/filter-list/utils/filterStateToWhereClause.d.ts +16 -0
- package/build/types/filter-list/utils/filterStateToWhereClause.d.ts.map +1 -0
- package/build/types/filter-list/utils/filterValues.d.ts +5 -0
- package/build/types/filter-list/utils/filterValues.d.ts.map +1 -0
- package/build/types/filter-list/utils/getFilterKey.d.ts +3 -0
- package/build/types/filter-list/utils/getFilterKey.d.ts.map +1 -0
- package/build/types/object-table/ColumnConfigDialog.d.ts +18 -0
- package/build/types/object-table/ColumnConfigDialog.d.ts.map +1 -0
- package/build/types/object-table/LoadingStateTable.d.ts.map +1 -1
- package/build/types/object-table/MultiColumnSortDialog.d.ts +15 -0
- package/build/types/object-table/MultiColumnSortDialog.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 +41 -6
- package/build/types/object-table/ObjectTableApi.d.ts.map +1 -1
- package/build/types/object-table/SortableItemsList.d.ts +13 -0
- package/build/types/object-table/SortableItemsList.d.ts.map +1 -0
- package/build/types/object-table/Table.d.ts +12 -1
- package/build/types/object-table/Table.d.ts.map +1 -1
- package/build/types/object-table/TableHeader.d.ts +3 -1
- package/build/types/object-table/TableHeader.d.ts.map +1 -1
- package/build/types/object-table/TableHeaderWithPopover.d.ts +30 -6
- package/build/types/object-table/TableHeaderWithPopover.d.ts.map +1 -1
- package/build/types/object-table/hooks/useColumnResize.d.ts +10 -0
- package/build/types/object-table/hooks/useColumnResize.d.ts.map +1 -0
- package/build/types/object-table/hooks/useColumnVisibility.d.ts +18 -7
- package/build/types/object-table/hooks/useColumnVisibility.d.ts.map +1 -1
- package/build/types/object-table/hooks/useRowSelection.d.ts +5 -4
- package/build/types/object-table/hooks/useRowSelection.d.ts.map +1 -1
- package/build/types/object-table/utils/types.d.ts +5 -0
- package/build/types/object-table/utils/types.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 +16 -8
|
@@ -0,0 +1,128 @@
|
|
|
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 { act, renderHook } from "@testing-library/react";
|
|
18
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
19
|
+
import { createPropertyFilterDef, createSelectState, createToggleState, MockObjectType } from "../../__tests__/testUtils.js";
|
|
20
|
+
import { getFilterKey } from "../../utils/getFilterKey.js";
|
|
21
|
+
import { useFilterListState } from "../useFilterListState.js";
|
|
22
|
+
function createMockObjectSet() {
|
|
23
|
+
return {
|
|
24
|
+
$objectSetInternals: {
|
|
25
|
+
def: MockObjectType
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
function createProps(overrides = {}) {
|
|
30
|
+
return {
|
|
31
|
+
objectSet: createMockObjectSet(),
|
|
32
|
+
...overrides
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
describe("useFilterListState", () => {
|
|
36
|
+
beforeEach(() => {
|
|
37
|
+
vi.clearAllMocks();
|
|
38
|
+
});
|
|
39
|
+
afterEach(() => {
|
|
40
|
+
vi.clearAllMocks();
|
|
41
|
+
});
|
|
42
|
+
it("initializes with empty filter states when no definitions", () => {
|
|
43
|
+
const props = createProps({
|
|
44
|
+
filterDefinitions: undefined
|
|
45
|
+
});
|
|
46
|
+
const {
|
|
47
|
+
result
|
|
48
|
+
} = renderHook(() => useFilterListState(props));
|
|
49
|
+
expect(result.current.filterStates.size).toBe(0);
|
|
50
|
+
});
|
|
51
|
+
it("initializes filter states from filterState for property filters", () => {
|
|
52
|
+
const initialState = createSelectState([]);
|
|
53
|
+
const nameDef = createPropertyFilterDef("name", "CHECKBOX_LIST", initialState);
|
|
54
|
+
const props = createProps({
|
|
55
|
+
filterDefinitions: [nameDef]
|
|
56
|
+
});
|
|
57
|
+
const {
|
|
58
|
+
result
|
|
59
|
+
} = renderHook(() => useFilterListState(props));
|
|
60
|
+
expect(result.current.filterStates.get(getFilterKey(nameDef))).toEqual(initialState);
|
|
61
|
+
});
|
|
62
|
+
it("updates filter state via setFilterState", () => {
|
|
63
|
+
const nameDef = createPropertyFilterDef("name", "CHECKBOX_LIST", createSelectState([]));
|
|
64
|
+
const props = createProps({
|
|
65
|
+
filterDefinitions: [nameDef]
|
|
66
|
+
});
|
|
67
|
+
const {
|
|
68
|
+
result
|
|
69
|
+
} = renderHook(() => useFilterListState(props));
|
|
70
|
+
act(() => {
|
|
71
|
+
result.current.setFilterState(getFilterKey(nameDef), createSelectState(["selected"]));
|
|
72
|
+
});
|
|
73
|
+
expect(result.current.filterStates.get(getFilterKey(nameDef))).toEqual(createSelectState(["selected"]));
|
|
74
|
+
});
|
|
75
|
+
it("calls onFilterStateChanged callback", () => {
|
|
76
|
+
const onFilterStateChanged = vi.fn();
|
|
77
|
+
const nameDef = createPropertyFilterDef("name", "CHECKBOX_LIST", createSelectState([]));
|
|
78
|
+
const props = createProps({
|
|
79
|
+
filterDefinitions: [nameDef],
|
|
80
|
+
onFilterStateChanged
|
|
81
|
+
});
|
|
82
|
+
const {
|
|
83
|
+
result
|
|
84
|
+
} = renderHook(() => useFilterListState(props));
|
|
85
|
+
const newState = createSelectState(["selected"]);
|
|
86
|
+
act(() => {
|
|
87
|
+
result.current.setFilterState(getFilterKey(nameDef), newState);
|
|
88
|
+
});
|
|
89
|
+
expect(onFilterStateChanged).toHaveBeenCalledWith(nameDef, newState);
|
|
90
|
+
});
|
|
91
|
+
it("builds whereClause from filter states", () => {
|
|
92
|
+
const nameDef = createPropertyFilterDef("name", "CHECKBOX_LIST", createSelectState([]));
|
|
93
|
+
const props = createProps({
|
|
94
|
+
filterDefinitions: [nameDef]
|
|
95
|
+
});
|
|
96
|
+
const {
|
|
97
|
+
result
|
|
98
|
+
} = renderHook(() => useFilterListState(props));
|
|
99
|
+
act(() => {
|
|
100
|
+
result.current.setFilterState(getFilterKey(nameDef), createSelectState(["John"]));
|
|
101
|
+
});
|
|
102
|
+
expect(result.current.whereClause).toEqual({
|
|
103
|
+
name: "John"
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
it("handles multiple filter definitions", () => {
|
|
107
|
+
const nameDef = createPropertyFilterDef("name", "CHECKBOX_LIST", createSelectState([]));
|
|
108
|
+
const activeDef = createPropertyFilterDef("active", "TOGGLE", createToggleState(false));
|
|
109
|
+
const props = createProps({
|
|
110
|
+
filterDefinitions: [nameDef, activeDef]
|
|
111
|
+
});
|
|
112
|
+
const {
|
|
113
|
+
result
|
|
114
|
+
} = renderHook(() => useFilterListState(props));
|
|
115
|
+
act(() => {
|
|
116
|
+
result.current.setFilterState(getFilterKey(nameDef), createSelectState(["John"]));
|
|
117
|
+
result.current.setFilterState(getFilterKey(activeDef), createToggleState(true));
|
|
118
|
+
});
|
|
119
|
+
expect(result.current.whereClause).toEqual({
|
|
120
|
+
$and: [{
|
|
121
|
+
name: "John"
|
|
122
|
+
}, {
|
|
123
|
+
active: true
|
|
124
|
+
}]
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
//# sourceMappingURL=useFilterListState.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFilterListState.test.js","names":["act","renderHook","afterEach","beforeEach","describe","expect","it","vi","createPropertyFilterDef","createSelectState","createToggleState","MockObjectType","getFilterKey","useFilterListState","createMockObjectSet","$objectSetInternals","def","createProps","overrides","objectSet","clearAllMocks","props","filterDefinitions","undefined","result","current","filterStates","size","toBe","initialState","nameDef","get","toEqual","setFilterState","onFilterStateChanged","fn","newState","toHaveBeenCalledWith","whereClause","name","activeDef","$and","active"],"sources":["useFilterListState.test.tsx"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ObjectSet } from \"@osdk/api\";\nimport { act, renderHook } from \"@testing-library/react\";\nimport { afterEach, beforeEach, describe, expect, it, vi } from \"vitest\";\nimport {\n createPropertyFilterDef,\n createSelectState,\n createToggleState,\n MockObjectType,\n} from \"../../__tests__/testUtils.js\";\nimport type { FilterListProps } from \"../../FilterListApi.js\";\nimport { getFilterKey } from \"../../utils/getFilterKey.js\";\nimport { useFilterListState } from \"../useFilterListState.js\";\n\nfunction createMockObjectSet(): ObjectSet<typeof MockObjectType> {\n return {\n $objectSetInternals: {\n def: MockObjectType,\n },\n } as ObjectSet<typeof MockObjectType>;\n}\n\nfunction createProps(\n overrides: Partial<FilterListProps<typeof MockObjectType>> = {},\n): FilterListProps<typeof MockObjectType> {\n return {\n objectSet: createMockObjectSet(),\n ...overrides,\n };\n}\n\ndescribe(\"useFilterListState\", () => {\n beforeEach(() => {\n vi.clearAllMocks();\n });\n\n afterEach(() => {\n vi.clearAllMocks();\n });\n\n it(\"initializes with empty filter states when no definitions\", () => {\n const props = createProps({ filterDefinitions: undefined });\n const { result } = renderHook(() => useFilterListState(props));\n expect(result.current.filterStates.size).toBe(0);\n });\n\n it(\"initializes filter states from filterState for property filters\", () => {\n const initialState = createSelectState([]);\n const nameDef = createPropertyFilterDef(\n \"name\",\n \"CHECKBOX_LIST\",\n initialState,\n );\n const props = createProps({\n filterDefinitions: [nameDef],\n });\n const { result } = renderHook(() => useFilterListState(props));\n expect(result.current.filterStates.get(getFilterKey(nameDef))).toEqual(\n initialState,\n );\n });\n\n it(\"updates filter state via setFilterState\", () => {\n const nameDef = createPropertyFilterDef(\n \"name\",\n \"CHECKBOX_LIST\",\n createSelectState([]),\n );\n const props = createProps({\n filterDefinitions: [nameDef],\n });\n const { result } = renderHook(() => useFilterListState(props));\n act(() => {\n result.current.setFilterState(\n getFilterKey(nameDef),\n createSelectState([\"selected\"]),\n );\n });\n expect(result.current.filterStates.get(getFilterKey(nameDef))).toEqual(\n createSelectState([\"selected\"]),\n );\n });\n\n it(\"calls onFilterStateChanged callback\", () => {\n const onFilterStateChanged = vi.fn();\n const nameDef = createPropertyFilterDef(\n \"name\",\n \"CHECKBOX_LIST\",\n createSelectState([]),\n );\n const props = createProps({\n filterDefinitions: [nameDef],\n onFilterStateChanged,\n });\n const { result } = renderHook(() => useFilterListState(props));\n const newState = createSelectState([\"selected\"]);\n act(() => {\n result.current.setFilterState(getFilterKey(nameDef), newState);\n });\n expect(onFilterStateChanged).toHaveBeenCalledWith(nameDef, newState);\n });\n\n it(\"builds whereClause from filter states\", () => {\n const nameDef = createPropertyFilterDef(\n \"name\",\n \"CHECKBOX_LIST\",\n createSelectState([]),\n );\n const props = createProps({\n filterDefinitions: [nameDef],\n });\n const { result } = renderHook(() => useFilterListState(props));\n act(() => {\n result.current.setFilterState(\n getFilterKey(nameDef),\n createSelectState([\"John\"]),\n );\n });\n expect(result.current.whereClause).toEqual({ name: \"John\" });\n });\n\n it(\"handles multiple filter definitions\", () => {\n const nameDef = createPropertyFilterDef(\n \"name\",\n \"CHECKBOX_LIST\",\n createSelectState([]),\n );\n const activeDef = createPropertyFilterDef(\n \"active\",\n \"TOGGLE\",\n createToggleState(false),\n );\n const props = createProps({\n filterDefinitions: [nameDef, activeDef],\n });\n const { result } = renderHook(() => useFilterListState(props));\n act(() => {\n result.current.setFilterState(\n getFilterKey(nameDef),\n createSelectState([\"John\"]),\n );\n result.current.setFilterState(\n getFilterKey(activeDef),\n createToggleState(true),\n );\n });\n expect(result.current.whereClause).toEqual({\n $and: [{ name: \"John\" }, { active: true }],\n });\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,GAAG,EAAEC,UAAU,QAAQ,wBAAwB;AACxD,SAASC,SAAS,EAAEC,UAAU,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,EAAEC,EAAE,QAAQ,QAAQ;AACxE,SACEC,uBAAuB,EACvBC,iBAAiB,EACjBC,iBAAiB,EACjBC,cAAc,QACT,8BAA8B;AAErC,SAASC,YAAY,QAAQ,6BAA6B;AAC1D,SAASC,kBAAkB,QAAQ,0BAA0B;AAE7D,SAASC,mBAAmBA,CAAA,EAAqC;EAC/D,OAAO;IACLC,mBAAmB,EAAE;MACnBC,GAAG,EAAEL;IACP;EACF,CAAC;AACH;AAEA,SAASM,WAAWA,CAClBC,SAA0D,GAAG,CAAC,CAAC,EACvB;EACxC,OAAO;IACLC,SAAS,EAAEL,mBAAmB,CAAC,CAAC;IAChC,GAAGI;EACL,CAAC;AACH;AAEAd,QAAQ,CAAC,oBAAoB,EAAE,MAAM;EACnCD,UAAU,CAAC,MAAM;IACfI,EAAE,CAACa,aAAa,CAAC,CAAC;EACpB,CAAC,CAAC;EAEFlB,SAAS,CAAC,MAAM;IACdK,EAAE,CAACa,aAAa,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,IAAI,EAAE,CAAC;QAAEF,IAAI,EAAE;MAAO,CAAC,EAAE;QAAEG,MAAM,EAAE;MAAK,CAAC;IAC3C,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,52 @@
|
|
|
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 { debounce } from "lodash-es";
|
|
18
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* A hook that manages a local value with debounced updates to the parent.
|
|
22
|
+
* Useful for inputs where we want immediate visual feedback but delayed
|
|
23
|
+
* propagation of changes (e.g., search inputs, numeric inputs).
|
|
24
|
+
*
|
|
25
|
+
* @param externalValue The controlled value from the parent
|
|
26
|
+
* @param onChange Callback to propagate changes to the parent
|
|
27
|
+
* @param debounceMs Debounce delay in milliseconds
|
|
28
|
+
* @returns Tuple of [localValue, setLocalValue] where setLocalValue triggers debounced onChange
|
|
29
|
+
*/
|
|
30
|
+
export function useDebouncedValue(externalValue, onChange, debounceMs = 300) {
|
|
31
|
+
const [localValue, setLocalValue] = useState(externalValue);
|
|
32
|
+
const onChangeRef = useRef(onChange);
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
onChangeRef.current = onChange;
|
|
35
|
+
}, [onChange]);
|
|
36
|
+
const debouncedOnChange = useMemo(() => debounce(value => onChangeRef.current(value), debounceMs), [debounceMs]);
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
setLocalValue(externalValue);
|
|
39
|
+
debouncedOnChange.cancel();
|
|
40
|
+
}, [externalValue, debouncedOnChange]);
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
return () => {
|
|
43
|
+
debouncedOnChange.cancel();
|
|
44
|
+
};
|
|
45
|
+
}, [debouncedOnChange]);
|
|
46
|
+
const setDebouncedValue = useCallback(newValue => {
|
|
47
|
+
setLocalValue(newValue);
|
|
48
|
+
debouncedOnChange(newValue);
|
|
49
|
+
}, [debouncedOnChange]);
|
|
50
|
+
return [localValue, setDebouncedValue];
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=useDebouncedValue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDebouncedValue.js","names":["debounce","useCallback","useEffect","useMemo","useRef","useState","useDebouncedValue","externalValue","onChange","debounceMs","localValue","setLocalValue","onChangeRef","current","debouncedOnChange","value","cancel","setDebouncedValue","newValue"],"sources":["useDebouncedValue.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 { debounce } from \"lodash-es\";\nimport { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\n\n/**\n * A hook that manages a local value with debounced updates to the parent.\n * Useful for inputs where we want immediate visual feedback but delayed\n * propagation of changes (e.g., search inputs, numeric inputs).\n *\n * @param externalValue The controlled value from the parent\n * @param onChange Callback to propagate changes to the parent\n * @param debounceMs Debounce delay in milliseconds\n * @returns Tuple of [localValue, setLocalValue] where setLocalValue triggers debounced onChange\n */\nexport function useDebouncedValue<T>(\n externalValue: T,\n onChange: (value: T) => void,\n debounceMs: number = 300,\n): [T, (value: T) => void] {\n const [localValue, setLocalValue] = useState<T>(externalValue);\n const onChangeRef = useRef(onChange);\n\n useEffect(() => {\n onChangeRef.current = onChange;\n }, [onChange]);\n\n const debouncedOnChange = useMemo(\n () => debounce((value: T) => onChangeRef.current(value), debounceMs),\n [debounceMs],\n );\n\n useEffect(() => {\n setLocalValue(externalValue);\n debouncedOnChange.cancel();\n }, [externalValue, debouncedOnChange]);\n\n useEffect(() => {\n return () => {\n debouncedOnChange.cancel();\n };\n }, [debouncedOnChange]);\n\n const setDebouncedValue = useCallback(\n (newValue: T) => {\n setLocalValue(newValue);\n debouncedOnChange(newValue);\n },\n [debouncedOnChange],\n );\n\n return [localValue, setDebouncedValue];\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,QAAQ,WAAW;AACpC,SAASC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;;AAEzE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,iBAAiBA,CAC/BC,aAAgB,EAChBC,QAA4B,EAC5BC,UAAkB,GAAG,GAAG,EACC;EACzB,MAAM,CAACC,UAAU,EAAEC,aAAa,CAAC,GAAGN,QAAQ,CAAIE,aAAa,CAAC;EAC9D,MAAMK,WAAW,GAAGR,MAAM,CAACI,QAAQ,CAAC;EAEpCN,SAAS,CAAC,MAAM;IACdU,WAAW,CAACC,OAAO,GAAGL,QAAQ;EAChC,CAAC,EAAE,CAACA,QAAQ,CAAC,CAAC;EAEd,MAAMM,iBAAiB,GAAGX,OAAO,CAC/B,MAAMH,QAAQ,CAAEe,KAAQ,IAAKH,WAAW,CAACC,OAAO,CAACE,KAAK,CAAC,EAAEN,UAAU,CAAC,EACpE,CAACA,UAAU,CACb,CAAC;EAEDP,SAAS,CAAC,MAAM;IACdS,aAAa,CAACJ,aAAa,CAAC;IAC5BO,iBAAiB,CAACE,MAAM,CAAC,CAAC;EAC5B,CAAC,EAAE,CAACT,aAAa,EAAEO,iBAAiB,CAAC,CAAC;EAEtCZ,SAAS,CAAC,MAAM;IACd,OAAO,MAAM;MACXY,iBAAiB,CAACE,MAAM,CAAC,CAAC;IAC5B,CAAC;EACH,CAAC,EAAE,CAACF,iBAAiB,CAAC,CAAC;EAEvB,MAAMG,iBAAiB,GAAGhB,WAAW,CAClCiB,QAAW,IAAK;IACfP,aAAa,CAACO,QAAQ,CAAC;IACvBJ,iBAAiB,CAACI,QAAQ,CAAC;EAC7B,CAAC,EACD,CAACJ,iBAAiB,CACpB,CAAC;EAED,OAAO,CAACJ,UAAU,EAAEO,iBAAiB,CAAC;AACxC","ignoreList":[]}
|
|
@@ -0,0 +1,119 @@
|
|
|
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, useEffect, useMemo, useRef, useState } from "react";
|
|
18
|
+
import { assertUnreachable } from "../utils/assertUnreachable.js";
|
|
19
|
+
import { buildWhereClause } from "../utils/filterStateToWhereClause.js";
|
|
20
|
+
import { filterHasActiveState } from "../utils/filterValues.js";
|
|
21
|
+
import { getFilterKey } from "../utils/getFilterKey.js";
|
|
22
|
+
/**
|
|
23
|
+
* Build initial states from filter definitions.
|
|
24
|
+
* Uses string keys derived from getFilterKey() for stable lookups.
|
|
25
|
+
*/
|
|
26
|
+
function buildInitialStates(definitions) {
|
|
27
|
+
const states = new Map();
|
|
28
|
+
if (!definitions) {
|
|
29
|
+
return states;
|
|
30
|
+
}
|
|
31
|
+
for (const definition of definitions) {
|
|
32
|
+
const key = getFilterKey(definition);
|
|
33
|
+
switch (definition.type) {
|
|
34
|
+
case "PROPERTY":
|
|
35
|
+
{
|
|
36
|
+
const state = definition.filterState;
|
|
37
|
+
if (state) {
|
|
38
|
+
states.set(key, state);
|
|
39
|
+
}
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
case "HAS_LINK":
|
|
43
|
+
case "KEYWORD_SEARCH":
|
|
44
|
+
case "CUSTOM":
|
|
45
|
+
{
|
|
46
|
+
const state = definition.defaultFilterState;
|
|
47
|
+
if (state) {
|
|
48
|
+
states.set(key, state);
|
|
49
|
+
}
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
case "LINKED_PROPERTY":
|
|
53
|
+
{
|
|
54
|
+
const innerState = definition.defaultLinkedFilterState;
|
|
55
|
+
if (innerState) {
|
|
56
|
+
states.set(key, {
|
|
57
|
+
type: "linkedProperty",
|
|
58
|
+
linkedFilterState: innerState
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
default:
|
|
64
|
+
assertUnreachable(definition);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return states;
|
|
68
|
+
}
|
|
69
|
+
export function useFilterListState(props) {
|
|
70
|
+
const {
|
|
71
|
+
objectSet,
|
|
72
|
+
filterDefinitions,
|
|
73
|
+
filterOperator = "and",
|
|
74
|
+
onFilterStateChanged,
|
|
75
|
+
onFilterClauseChanged
|
|
76
|
+
} = props;
|
|
77
|
+
const objectType = objectSet.$objectSetInternals.def;
|
|
78
|
+
const [filterStates, setFilterStates] = useState(() => buildInitialStates(filterDefinitions));
|
|
79
|
+
const setFilterState = useCallback((filterKey, state) => {
|
|
80
|
+
setFilterStates(prev => {
|
|
81
|
+
const next = new Map(prev);
|
|
82
|
+
next.set(filterKey, state);
|
|
83
|
+
return next;
|
|
84
|
+
});
|
|
85
|
+
const definition = filterDefinitions?.find(d => getFilterKey(d) === filterKey);
|
|
86
|
+
if (definition) {
|
|
87
|
+
onFilterStateChanged?.(definition, state);
|
|
88
|
+
}
|
|
89
|
+
}, [filterDefinitions, onFilterStateChanged]);
|
|
90
|
+
const whereClause = useMemo(() => buildWhereClause(filterDefinitions, filterStates, filterOperator, objectType), [filterDefinitions, filterStates, filterOperator, objectType]);
|
|
91
|
+
const isFirstRender = useRef(true);
|
|
92
|
+
useEffect(() => {
|
|
93
|
+
if (isFirstRender.current) {
|
|
94
|
+
isFirstRender.current = false;
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
onFilterClauseChanged?.(whereClause);
|
|
98
|
+
}, [whereClause, onFilterClauseChanged]);
|
|
99
|
+
const activeFilterCount = useMemo(() => {
|
|
100
|
+
let count = 0;
|
|
101
|
+
for (const state of filterStates.values()) {
|
|
102
|
+
if (filterHasActiveState(state)) {
|
|
103
|
+
count++;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return count;
|
|
107
|
+
}, [filterStates]);
|
|
108
|
+
const reset = useCallback(() => {
|
|
109
|
+
setFilterStates(buildInitialStates(filterDefinitions));
|
|
110
|
+
}, [filterDefinitions]);
|
|
111
|
+
return useMemo(() => ({
|
|
112
|
+
filterStates,
|
|
113
|
+
setFilterState,
|
|
114
|
+
whereClause,
|
|
115
|
+
activeFilterCount,
|
|
116
|
+
reset
|
|
117
|
+
}), [filterStates, setFilterState, whereClause, activeFilterCount, reset]);
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=useFilterListState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFilterListState.js","names":["useCallback","useEffect","useMemo","useRef","useState","assertUnreachable","buildWhereClause","filterHasActiveState","getFilterKey","buildInitialStates","definitions","states","Map","definition","key","type","state","filterState","set","defaultFilterState","innerState","defaultLinkedFilterState","linkedFilterState","useFilterListState","props","objectSet","filterDefinitions","filterOperator","onFilterStateChanged","onFilterClauseChanged","objectType","$objectSetInternals","def","filterStates","setFilterStates","setFilterState","filterKey","prev","next","find","d","whereClause","isFirstRender","current","activeFilterCount","count","values","reset"],"sources":["useFilterListState.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 { ObjectTypeDefinition, WhereClause } from \"@osdk/api\";\nimport { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport type { FilterListProps } from \"../FilterListApi.js\";\nimport type { FilterState } from \"../FilterListItemApi.js\";\nimport type { LinkedPropertyFilterState } from \"../types/LinkedFilterTypes.js\";\nimport { assertUnreachable } from \"../utils/assertUnreachable.js\";\nimport { buildWhereClause } from \"../utils/filterStateToWhereClause.js\";\nimport { filterHasActiveState } from \"../utils/filterValues.js\";\nimport { getFilterKey } from \"../utils/getFilterKey.js\";\n\nexport interface UseFilterListStateResult<Q extends ObjectTypeDefinition> {\n filterStates: Map<string, FilterState>;\n setFilterState: (\n filterKey: string,\n state: FilterState,\n ) => void;\n whereClause: WhereClause<Q>;\n activeFilterCount: number;\n reset: () => void;\n}\n\n/**\n * Build initial states from filter definitions.\n * Uses string keys derived from getFilterKey() for stable lookups.\n */\nfunction buildInitialStates<Q extends ObjectTypeDefinition>(\n definitions: FilterListProps<Q>[\"filterDefinitions\"],\n): Map<string, FilterState> {\n const states = new Map<string, FilterState>();\n\n if (!definitions) {\n return states;\n }\n\n for (const definition of definitions) {\n const key = getFilterKey(definition);\n switch (definition.type) {\n case \"PROPERTY\": {\n const state = definition.filterState;\n if (state) {\n states.set(key, state);\n }\n break;\n }\n case \"HAS_LINK\":\n case \"KEYWORD_SEARCH\":\n case \"CUSTOM\": {\n const state = definition.defaultFilterState;\n if (state) {\n states.set(key, state);\n }\n break;\n }\n case \"LINKED_PROPERTY\": {\n const innerState = definition.defaultLinkedFilterState;\n if (innerState) {\n const state: LinkedPropertyFilterState = {\n type: \"linkedProperty\",\n linkedFilterState: innerState,\n };\n states.set(key, state);\n }\n break;\n }\n default:\n assertUnreachable(definition);\n }\n }\n\n return states;\n}\n\nexport function useFilterListState<Q extends ObjectTypeDefinition>(\n props: FilterListProps<Q>,\n): UseFilterListStateResult<Q> {\n const {\n objectSet,\n filterDefinitions,\n filterOperator = \"and\",\n onFilterStateChanged,\n onFilterClauseChanged,\n } = props;\n\n const objectType = objectSet.$objectSetInternals.def;\n\n const [filterStates, setFilterStates] = useState<\n Map<string, FilterState>\n >(() => buildInitialStates(filterDefinitions));\n\n const setFilterState = useCallback(\n (filterKey: string, state: FilterState) => {\n setFilterStates((prev) => {\n const next = new Map(prev);\n next.set(filterKey, state);\n return next;\n });\n const definition = filterDefinitions?.find(\n (d) => getFilterKey(d) === filterKey,\n );\n if (definition) {\n onFilterStateChanged?.(definition, state);\n }\n },\n [filterDefinitions, onFilterStateChanged],\n );\n\n const whereClause = useMemo(\n () =>\n buildWhereClause(\n filterDefinitions,\n filterStates,\n filterOperator,\n objectType,\n ),\n [filterDefinitions, filterStates, filterOperator, objectType],\n );\n\n const isFirstRender = useRef(true);\n useEffect(() => {\n if (isFirstRender.current) {\n isFirstRender.current = false;\n return;\n }\n onFilterClauseChanged?.(whereClause);\n }, [whereClause, onFilterClauseChanged]);\n\n const activeFilterCount = useMemo(() => {\n let count = 0;\n for (const state of filterStates.values()) {\n if (filterHasActiveState(state)) {\n count++;\n }\n }\n return count;\n }, [filterStates]);\n\n const reset = useCallback(() => {\n setFilterStates(buildInitialStates(filterDefinitions));\n }, [filterDefinitions]);\n\n return useMemo(() => ({\n filterStates,\n setFilterState,\n whereClause,\n activeFilterCount,\n reset,\n }), [filterStates, setFilterState, whereClause, activeFilterCount, reset]);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAIzE,SAASC,iBAAiB,QAAQ,+BAA+B;AACjE,SAASC,gBAAgB,QAAQ,sCAAsC;AACvE,SAASC,oBAAoB,QAAQ,0BAA0B;AAC/D,SAASC,YAAY,QAAQ,0BAA0B;AAavD;AACA;AACA;AACA;AACA,SAASC,kBAAkBA,CACzBC,WAAoD,EAC1B;EAC1B,MAAMC,MAAM,GAAG,IAAIC,GAAG,CAAsB,CAAC;EAE7C,IAAI,CAACF,WAAW,EAAE;IAChB,OAAOC,MAAM;EACf;EAEA,KAAK,MAAME,UAAU,IAAIH,WAAW,EAAE;IACpC,MAAMI,GAAG,GAAGN,YAAY,CAACK,UAAU,CAAC;IACpC,QAAQA,UAAU,CAACE,IAAI;MACrB,KAAK,UAAU;QAAE;UACf,MAAMC,KAAK,GAAGH,UAAU,CAACI,WAAW;UACpC,IAAID,KAAK,EAAE;YACTL,MAAM,CAACO,GAAG,CAACJ,GAAG,EAAEE,KAAK,CAAC;UACxB;UACA;QACF;MACA,KAAK,UAAU;MACf,KAAK,gBAAgB;MACrB,KAAK,QAAQ;QAAE;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, 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 { useOsdkAggregation } from "@osdk/react/experimental";
|
|
18
|
+
import { useMemo } from "react";
|
|
19
|
+
export function usePropertyAggregation(objectType, propertyKey, options) {
|
|
20
|
+
// AggregateOpts requires specific property keys from Q, but we're dynamically
|
|
21
|
+
// using propertyKey. The cast is unavoidable for this dynamic filter pattern.
|
|
22
|
+
const aggregateOptions = useMemo(() => ({
|
|
23
|
+
$select: {
|
|
24
|
+
$count: "unordered"
|
|
25
|
+
},
|
|
26
|
+
$groupBy: {
|
|
27
|
+
[propertyKey]: {
|
|
28
|
+
$exact: {
|
|
29
|
+
$includeNullValue: true
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}), [propertyKey]);
|
|
34
|
+
const {
|
|
35
|
+
data: countData,
|
|
36
|
+
isLoading,
|
|
37
|
+
error
|
|
38
|
+
} = useOsdkAggregation(objectType, {
|
|
39
|
+
aggregate: aggregateOptions,
|
|
40
|
+
where: options?.where
|
|
41
|
+
});
|
|
42
|
+
const result = useMemo(() => {
|
|
43
|
+
if (!countData) {
|
|
44
|
+
return {
|
|
45
|
+
data: [],
|
|
46
|
+
maxCount: 0
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
const values = [];
|
|
50
|
+
let maxCount = 0;
|
|
51
|
+
|
|
52
|
+
// The aggregation result type varies by query structure. Since we're building
|
|
53
|
+
// the query dynamically based on propertyKey, we cast to a known shape that
|
|
54
|
+
// matches the $groupBy + $count aggregation pattern.
|
|
55
|
+
|
|
56
|
+
for (const item of countData) {
|
|
57
|
+
const rawValue = item.$group[propertyKey];
|
|
58
|
+
const count = item.$count ?? 0;
|
|
59
|
+
if (rawValue == null) {
|
|
60
|
+
values.push({
|
|
61
|
+
value: "",
|
|
62
|
+
count,
|
|
63
|
+
isNull: true
|
|
64
|
+
});
|
|
65
|
+
} else {
|
|
66
|
+
values.push({
|
|
67
|
+
value: String(rawValue),
|
|
68
|
+
count
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
maxCount = Math.max(maxCount, count);
|
|
72
|
+
}
|
|
73
|
+
values.sort((a, b) => a.value.localeCompare(b.value));
|
|
74
|
+
if (options?.limit && values.length > options.limit) {
|
|
75
|
+
return {
|
|
76
|
+
data: values.slice(0, options.limit),
|
|
77
|
+
maxCount
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
data: values,
|
|
82
|
+
maxCount
|
|
83
|
+
};
|
|
84
|
+
}, [countData, propertyKey, options?.limit]);
|
|
85
|
+
return {
|
|
86
|
+
data: result.data,
|
|
87
|
+
maxCount: result.maxCount,
|
|
88
|
+
isLoading,
|
|
89
|
+
error: error ?? null
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=usePropertyAggregation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePropertyAggregation.js","names":["useOsdkAggregation","useMemo","usePropertyAggregation","objectType","propertyKey","options","aggregateOptions","$select","$count","$groupBy","$exact","$includeNullValue","data","countData","isLoading","error","aggregate","where","result","maxCount","values","item","rawValue","$group","count","push","value","isNull","String","Math","max","sort","a","b","localeCompare","limit","length","slice"],"sources":["usePropertyAggregation.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 AggregateOpts,\n ObjectTypeDefinition,\n PropertyKeys,\n WhereClause,\n} from \"@osdk/api\";\nimport { useOsdkAggregation } from \"@osdk/react/experimental\";\nimport { useMemo } from \"react\";\n\nexport interface PropertyAggregationValue {\n value: string;\n count: number;\n isNull?: boolean;\n}\n\nexport interface UsePropertyAggregationResult {\n data: PropertyAggregationValue[];\n maxCount: number;\n isLoading: boolean;\n error: Error | null;\n}\n\nexport interface UsePropertyAggregationOptions<\n Q extends ObjectTypeDefinition = ObjectTypeDefinition,\n> {\n limit?: number;\n where?: WhereClause<Q>;\n}\n\nexport function usePropertyAggregation<\n Q extends ObjectTypeDefinition,\n K extends PropertyKeys<Q>,\n>(\n objectType: Q,\n propertyKey: K,\n options?: UsePropertyAggregationOptions<Q>,\n): UsePropertyAggregationResult {\n // AggregateOpts requires specific property keys from Q, but we're dynamically\n // using propertyKey. The cast is unavoidable for this dynamic filter pattern.\n const aggregateOptions = useMemo(\n () =>\n ({\n $select: { $count: \"unordered\" as const },\n $groupBy: {\n [propertyKey as string]: {\n $exact: { $includeNullValue: true },\n },\n },\n }) as AggregateOpts<Q>,\n [propertyKey],\n );\n\n const { data: countData, isLoading, error } = useOsdkAggregation(objectType, {\n aggregate: aggregateOptions,\n where: options?.where,\n });\n\n const result = useMemo(\n (): { data: PropertyAggregationValue[]; maxCount: number } => {\n if (!countData) {\n return { data: [], maxCount: 0 };\n }\n\n const values: PropertyAggregationValue[] = [];\n let maxCount = 0;\n\n // The aggregation result type varies by query structure. Since we're building\n // the query dynamically based on propertyKey, we cast to a known shape that\n // matches the $groupBy + $count aggregation pattern.\n const dataArray = countData as Iterable<{\n $group: Record<string, unknown>;\n $count?: number;\n }>;\n\n for (const item of dataArray) {\n const rawValue = item.$group[propertyKey as string];\n const count = item.$count ?? 0;\n\n if (rawValue == null) {\n values.push({ value: \"\", count, isNull: true });\n } else {\n values.push({ value: String(rawValue), count });\n }\n maxCount = Math.max(maxCount, count);\n }\n\n values.sort((a, b) => a.value.localeCompare(b.value));\n\n if (options?.limit && values.length > options.limit) {\n return { data: values.slice(0, options.limit), maxCount };\n }\n\n return { data: values, maxCount };\n },\n [countData, propertyKey, options?.limit],\n );\n\n return {\n data: result.data,\n maxCount: result.maxCount,\n isLoading,\n error: error ?? null,\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,SAASA,kBAAkB,QAAQ,0BAA0B;AAC7D,SAASC,OAAO,QAAQ,OAAO;AAsB/B,OAAO,SAASC,sBAAsBA,CAIpCC,UAAa,EACbC,WAAc,EACdC,OAA0C,EACZ;EAC9B;EACA;EACA,MAAMC,gBAAgB,GAAGL,OAAO,CAC9B,OACG;IACCM,OAAO,EAAE;MAAEC,MAAM,EAAE;IAAqB,CAAC;IACzCC,QAAQ,EAAE;MACR,CAACL,WAAW,GAAa;QACvBM,MAAM,EAAE;UAAEC,iBAAiB,EAAE;QAAK;MACpC;IACF;EACF,CAAC,CAAqB,EACxB,CAACP,WAAW,CACd,CAAC;EAED,MAAM;IAAEQ,IAAI,EAAEC,SAAS;IAAEC,SAAS;IAAEC;EAAM,CAAC,GAAGf,kBAAkB,CAACG,UAAU,EAAE;IAC3Ea,SAAS,EAAEV,gBAAgB;IAC3BW,KAAK,EAAEZ,OAAO,EAAEY;EAClB,CAAC,CAAC;EAEF,MAAMC,MAAM,GAAGjB,OAAO,CACpB,MAA8D;IAC5D,IAAI,CAACY,SAAS,EAAE;MACd,OAAO;QAAED,IAAI,EAA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ACzBL,SAAS;IACTC,KAAK,EAAEA,KAAK,IAAI;EAClB,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AddFilterMenuTypes.js","names":[],"sources":["AddFilterMenuTypes.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 { ReactNode } from \"react\";\nimport type { FilterComponentType } from \"../FilterListItemApi.js\";\n\n/**\n * Category for organizing filters in the add filter menu\n */\nexport type FilterCategory =\n | \"ALL_PROPERTIES\"\n | \"SINGLE_PROPERTY\"\n | \"LINKED_OBJECT\";\n\n/**\n * Template for a filter that can be added via the add filter menu\n */\nexport interface FilterTemplate {\n /**\n * Unique identifier for the template\n */\n id: string;\n\n /**\n * Display label for the filter\n */\n label: string;\n\n /**\n * Property key this filter applies to\n */\n key: string;\n\n /**\n * The type of filter component to use\n */\n filterComponent: FilterComponentType;\n\n /**\n * Icon to display next to the filter label.\n * Can be a string (icon name) or a ReactNode for custom icons.\n */\n icon: string | ReactNode;\n\n /**\n * Whether multiple instances of this filter can be added\n */\n allowMultiple: boolean;\n\n /**\n * Category for grouping in the add filter menu\n */\n category: FilterCategory;\n}\n\n/**\n * Props for the add filter menu component\n */\nexport interface AddFilterMenuProps {\n /**\n * Available filter templates to display\n */\n templates: FilterTemplate[];\n\n /**\n * Current count of active filters by key\n */\n activeCounts: Record<string, number>;\n\n /**\n * Called when a filter template is selected\n */\n onSelectFilter: (template: FilterTemplate) => void;\n\n /**\n * Called when the menu should be closed\n */\n onClose: () => void;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CustomRendererTypes.js","names":[],"sources":["CustomRendererTypes.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 { ObjectSet, ObjectTypeDefinition, WhereClause } from \"@osdk/api\";\nimport type { ReactNode } from \"react\";\nimport type { BaseFilterState } from \"../FilterListItemApi.js\";\n\n/**\n * State for custom filter\n */\nexport interface CustomFilterState<T = Record<string, unknown>>\n extends BaseFilterState\n{\n type: \"custom\";\n customState: T;\n}\n\n/**\n * Props passed to custom filter input renderer\n */\nexport interface CustomFilterInputRendererProps<\n Q extends ObjectTypeDefinition,\n State extends BaseFilterState,\n> {\n objectSet: ObjectSet<Q>;\n filterState: State;\n onFilterStateChanged: (newState: State) => void;\n}\n\n/**\n * Props passed to custom filter item renderer\n * Includes full item context in addition to input renderer props\n */\nexport interface CustomFilterItemRendererProps<\n Q extends ObjectTypeDefinition,\n State extends BaseFilterState,\n> extends CustomFilterInputRendererProps<Q, State> {\n label: string;\n onRemove?: () => void;\n}\n\n/**\n * Filter definition for custom filters\n * Provides full control over rendering and filter logic\n */\nexport interface CustomFilterDefinition<\n Q extends ObjectTypeDefinition,\n State extends BaseFilterState = CustomFilterState,\n> {\n type: \"CUSTOM\";\n /**\n * Optional unique identifier for stable keying across filter reorders.\n * If provided, takes precedence over `key` for state keying.\n */\n id?: string;\n /**\n * Unique key for this custom filter\n */\n key: string;\n label?: string;\n filterComponent: \"CUSTOM\";\n filterState: State;\n defaultFilterState?: State;\n /**\n * Render the input portion of the filter\n * Used when rendering within a filter item wrapper\n */\n renderInput?: (\n props: CustomFilterInputRendererProps<Q, State>,\n ) => ReactNode;\n /**\n * Render the complete filter item\n * Used when you need full control over the item appearance\n */\n renderItem?: (\n props: CustomFilterItemRendererProps<Q, State>,\n ) => ReactNode;\n /**\n * Convert filter state to a WhereClause for filtering\n * Required for the filter to affect the object set\n */\n toWhereClause: (state: State) => WhereClause<Q> | undefined;\n /**\n * Controls whether this filter is rendered.\n * When false, the filter is hidden but its state is preserved.\n * @default true\n */\n isVisible?: boolean;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KeywordSearchTypes.js","names":[],"sources":["KeywordSearchTypes.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 { ObjectTypeDefinition, PropertyKeys } from \"@osdk/api\";\nimport type { BaseFilterState } from \"../FilterListItemApi.js\";\n\n/**\n * Keys of string properties on an object type\n */\nexport type StringPropertyKeys<Q extends ObjectTypeDefinition> =\n PropertyKeys.Filtered<Q, \"string\">;\n\n/**\n * State for keyword search filter\n */\nexport interface KeywordSearchFilterState extends BaseFilterState {\n type: \"keywordSearch\";\n searchTerm: string;\n /**\n * How multiple terms are combined\n * - \"AND\": All terms must match\n * - \"OR\": Any term must match\n */\n operator: \"AND\" | \"OR\";\n}\n\n/**\n * Filter definition for keyword search across string properties\n */\nexport interface KeywordSearchFilterDefinition<\n Q extends ObjectTypeDefinition,\n K extends StringPropertyKeys<Q> = StringPropertyKeys<Q>,\n> {\n type: \"KEYWORD_SEARCH\";\n /**\n * Optional unique identifier for stable keying across filter reorders.\n */\n id?: string;\n /**\n * Properties to search within\n * - \"all\": Search all string properties\n * - K[]: Search specific string properties\n */\n properties: \"all\" | K[];\n label?: string;\n /**\n * Controlled state for the filter.\n * When provided, the filter becomes controlled and changes should be\n * handled via onFilterStateChanged callback.\n */\n filterState?: KeywordSearchFilterState;\n /**\n * Default state for uncontrolled mode.\n * Used when filterState is not provided.\n */\n defaultFilterState?: KeywordSearchFilterState;\n /**\n * Controls whether this filter is rendered.\n * When false, the filter is hidden but its state is preserved.\n * @default true\n */\n isVisible?: boolean;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LinkedFilterTypes.js","names":[],"sources":["LinkedFilterTypes.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 LinkedType,\n LinkNames,\n ObjectTypeDefinition,\n PropertyKeys,\n} from \"@osdk/api\";\nimport type {\n BaseFilterState,\n FilterState,\n FilterStateByComponentType,\n PropertyTypeFromKey,\n ValidComponentsForPropertyType,\n} from \"../FilterListItemApi.js\";\n\n/**\n * State for \"has link\" filter\n */\nexport interface HasLinkFilterState extends BaseFilterState {\n type: \"hasLink\";\n hasLink: boolean;\n}\n\n/**\n * State for linked property filter\n * Wraps the filter state of the linked property\n */\nexport interface LinkedPropertyFilterState<S extends FilterState = FilterState>\n extends BaseFilterState\n{\n type: \"linkedProperty\";\n linkedFilterState: S;\n}\n\n/**\n * Filter definition for \"Has Link\" filter\n * Filters objects based on whether they have any linked objects of the specified type\n */\nexport interface HasLinkFilterDefinition<\n Q extends ObjectTypeDefinition,\n L extends LinkNames<Q> = LinkNames<Q>,\n> {\n type: \"HAS_LINK\";\n /**\n * Optional unique identifier for stable keying across filter reorders.\n */\n id?: string;\n linkName: L;\n label?: string;\n filterState: HasLinkFilterState;\n defaultFilterState?: HasLinkFilterState;\n /**\n * Controls whether this filter is rendered.\n * When false, the filter is hidden but its state is preserved.\n * @default true\n */\n isVisible?: boolean;\n}\n\n/**\n * Filter definition for filtering on a property of linked objects\n */\nexport interface LinkedPropertyFilterDefinition<\n Q extends ObjectTypeDefinition,\n L extends LinkNames<Q>,\n LinkedQ extends ObjectTypeDefinition = LinkedType<Q, L>,\n LinkedK extends PropertyKeys<LinkedQ> = PropertyKeys<LinkedQ>,\n LinkedC extends ValidComponentsForPropertyType<\n PropertyTypeFromKey<LinkedQ, LinkedK>\n > = ValidComponentsForPropertyType<PropertyTypeFromKey<LinkedQ, LinkedK>>,\n> {\n type: \"LINKED_PROPERTY\";\n /**\n * Optional unique identifier for stable keying across filter reorders.\n */\n id?: string;\n linkName: L;\n linkedPropertyKey: LinkedK;\n linkedFilterComponent: LinkedC;\n linkedFilterState: FilterStateByComponentType[LinkedC];\n defaultLinkedFilterState?: FilterStateByComponentType[LinkedC];\n filterState: LinkedPropertyFilterState<FilterStateByComponentType[LinkedC]>;\n label?: string;\n /**\n * Controls whether this filter is rendered.\n * When false, the filter is hidden but its state is preserved.\n * @default true\n */\n isVisible?: boolean;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,21 @@
|
|
|
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 * from "./AddFilterMenuTypes.js";
|
|
18
|
+
export * from "./CustomRendererTypes.js";
|
|
19
|
+
export * from "./KeywordSearchTypes.js";
|
|
20
|
+
export * from "./LinkedFilterTypes.js";
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["index.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 * from \"./AddFilterMenuTypes.js\";\nexport * from \"./CustomRendererTypes.js\";\nexport * from \"./KeywordSearchTypes.js\";\nexport * from \"./LinkedFilterTypes.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,cAAc,yBAAyB;AACvC,cAAc,0BAA0B;AACxC,cAAc,yBAAyB;AACvC,cAAc,wBAAwB","ignoreList":[]}
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
/**
|
|
18
|
+
* Exhaustive type checking helper.
|
|
19
|
+
* Use in default cases of switch statements to ensure all cases are handled.
|
|
20
|
+
* TypeScript will error if a case is missing.
|
|
21
|
+
*/
|
|
22
|
+
export function assertUnreachable(value) {
|
|
23
|
+
throw new Error(`Unhandled value: ${String(value)}`);
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=assertUnreachable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assertUnreachable.js","names":["assertUnreachable","value","Error","String"],"sources":["assertUnreachable.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\n/**\n * Exhaustive type checking helper.\n * Use in default cases of switch statements to ensure all cases are handled.\n * TypeScript will error if a case is missing.\n */\nexport function assertUnreachable(value: never): never {\n throw new Error(`Unhandled value: ${String(value)}`);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,iBAAiBA,CAACC,KAAY,EAAS;EACrD,MAAM,IAAIC,KAAK,CAAC,oBAAoBC,MAAM,CAACF,KAAK,CAAC,EAAE,CAAC;AACtD","ignoreList":[]}
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
/**
|
|
18
|
+
* Coerces a filter value to a string for display.
|
|
19
|
+
* Returns undefined if the value is undefined.
|
|
20
|
+
*/
|
|
21
|
+
export function coerceToString(value) {
|
|
22
|
+
if (value === undefined) return undefined;
|
|
23
|
+
return String(value);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Coerces an array of filter values to string[] for display.
|
|
28
|
+
*/
|
|
29
|
+
export function coerceToStringArray(values) {
|
|
30
|
+
if (values === undefined) return [];
|
|
31
|
+
return values.map(v => String(v));
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=coerceFilterValue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coerceFilterValue.js","names":["coerceToString","value","undefined","String","coerceToStringArray","values","map","v"],"sources":["coerceFilterValue.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\ntype FilterValue = string | boolean | number;\n\n/**\n * Coerces a filter value to a string for display.\n * Returns undefined if the value is undefined.\n */\nexport function coerceToString(\n value: FilterValue | undefined,\n): string | undefined {\n if (value === undefined) return undefined;\n return String(value);\n}\n\n/**\n * Coerces an array of filter values to string[] for display.\n */\nexport function coerceToStringArray(\n values: FilterValue[] | undefined,\n): string[] {\n if (values === undefined) return [];\n return values.map((v) => String(v));\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA,OAAO,SAASA,cAAcA,CAC5BC,KAA8B,EACV;EACpB,IAAIA,KAAK,KAAKC,SAAS,EAAE,OAAOA,SAAS;EACzC,OAAOC,MAAM,CAACF,KAAK,CAAC;AACtB;;AAEA;AACA;AACA;AACA,OAAO,SAASG,mBAAmBA,CACjCC,MAAiC,EACvB;EACV,IAAIA,MAAM,KAAKH,SAAS,EAAE,OAAO,EAAE;EACnC,OAAOG,MAAM,CAACC,GAAG,CAAEC,CAAC,IAAKJ,MAAM,CAACI,CAAC,CAAC,CAAC;AACrC","ignoreList":[]}
|