@canonical/dataviews-react 0.45.0 → 0.47.0
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/LICENSE +166 -0
- package/package.json +11 -10
- package/dist/esm/lib/DataTable/DataTable.js +0 -128
- package/dist/esm/lib/DataTable/DataTable.js.map +0 -1
- package/dist/esm/lib/DataTable/columnKeys.js +0 -64
- package/dist/esm/lib/DataTable/columnKeys.js.map +0 -1
- package/dist/esm/lib/DataTable/common/BodyCell/BodyCell.js +0 -45
- package/dist/esm/lib/DataTable/common/BodyCell/BodyCell.js.map +0 -1
- package/dist/esm/lib/DataTable/common/BodyCell/index.js +0 -2
- package/dist/esm/lib/DataTable/common/BodyCell/index.js.map +0 -1
- package/dist/esm/lib/DataTable/common/BodyCell/types.js +0 -2
- package/dist/esm/lib/DataTable/common/BodyCell/types.js.map +0 -1
- package/dist/esm/lib/DataTable/common/HeaderCell/HeaderCell.js +0 -47
- package/dist/esm/lib/DataTable/common/HeaderCell/HeaderCell.js.map +0 -1
- package/dist/esm/lib/DataTable/common/HeaderCell/index.js +0 -2
- package/dist/esm/lib/DataTable/common/HeaderCell/index.js.map +0 -1
- package/dist/esm/lib/DataTable/common/HeaderCell/types.js +0 -2
- package/dist/esm/lib/DataTable/common/HeaderCell/types.js.map +0 -1
- package/dist/esm/lib/DataTable/common/ResizeHandle/ResizeHandle.js +0 -142
- package/dist/esm/lib/DataTable/common/ResizeHandle/ResizeHandle.js.map +0 -1
- package/dist/esm/lib/DataTable/common/ResizeHandle/index.js +0 -2
- package/dist/esm/lib/DataTable/common/ResizeHandle/index.js.map +0 -1
- package/dist/esm/lib/DataTable/common/ResizeHandle/types.js +0 -2
- package/dist/esm/lib/DataTable/common/ResizeHandle/types.js.map +0 -1
- package/dist/esm/lib/DataTable/common/Row/Row.js +0 -28
- package/dist/esm/lib/DataTable/common/Row/Row.js.map +0 -1
- package/dist/esm/lib/DataTable/common/Row/index.js +0 -2
- package/dist/esm/lib/DataTable/common/Row/index.js.map +0 -1
- package/dist/esm/lib/DataTable/common/Row/types.js +0 -2
- package/dist/esm/lib/DataTable/common/Row/types.js.map +0 -1
- package/dist/esm/lib/DataTable/common/SelectAllCell/SelectAllCell.js +0 -45
- package/dist/esm/lib/DataTable/common/SelectAllCell/SelectAllCell.js.map +0 -1
- package/dist/esm/lib/DataTable/common/SelectAllCell/index.js +0 -2
- package/dist/esm/lib/DataTable/common/SelectAllCell/index.js.map +0 -1
- package/dist/esm/lib/DataTable/common/SelectAllCell/types.js +0 -2
- package/dist/esm/lib/DataTable/common/SelectAllCell/types.js.map +0 -1
- package/dist/esm/lib/DataTable/common/SelectionCell/SelectionCell.js +0 -17
- package/dist/esm/lib/DataTable/common/SelectionCell/SelectionCell.js.map +0 -1
- package/dist/esm/lib/DataTable/common/SelectionCell/index.js +0 -2
- package/dist/esm/lib/DataTable/common/SelectionCell/index.js.map +0 -1
- package/dist/esm/lib/DataTable/common/SelectionCell/types.js +0 -2
- package/dist/esm/lib/DataTable/common/SelectionCell/types.js.map +0 -1
- package/dist/esm/lib/DataTable/common/TableBody/TableBody.js +0 -30
- package/dist/esm/lib/DataTable/common/TableBody/TableBody.js.map +0 -1
- package/dist/esm/lib/DataTable/common/TableBody/index.js +0 -2
- package/dist/esm/lib/DataTable/common/TableBody/index.js.map +0 -1
- package/dist/esm/lib/DataTable/common/TableBody/types.js +0 -2
- package/dist/esm/lib/DataTable/common/TableBody/types.js.map +0 -1
- package/dist/esm/lib/DataTable/common/index.js +0 -8
- package/dist/esm/lib/DataTable/common/index.js.map +0 -1
- package/dist/esm/lib/DataTable/defaultStatusText.js +0 -16
- package/dist/esm/lib/DataTable/defaultStatusText.js.map +0 -1
- package/dist/esm/lib/DataTable/hooks/index.js +0 -6
- package/dist/esm/lib/DataTable/hooks/index.js.map +0 -1
- package/dist/esm/lib/DataTable/hooks/types.js +0 -6
- package/dist/esm/lib/DataTable/hooks/types.js.map +0 -1
- package/dist/esm/lib/DataTable/hooks/usePreferredWidths.js +0 -95
- package/dist/esm/lib/DataTable/hooks/usePreferredWidths.js.map +0 -1
- package/dist/esm/lib/DataTable/hooks/useRowScopes.js +0 -25
- package/dist/esm/lib/DataTable/hooks/useRowScopes.js.map +0 -1
- package/dist/esm/lib/DataTable/hooks/useStableCallback.js +0 -17
- package/dist/esm/lib/DataTable/hooks/useStableCallback.js.map +0 -1
- package/dist/esm/lib/DataTable/hooks/useStableValue.js +0 -18
- package/dist/esm/lib/DataTable/hooks/useStableValue.js.map +0 -1
- package/dist/esm/lib/DataTable/hooks/useTableGeometry.js +0 -124
- package/dist/esm/lib/DataTable/hooks/useTableGeometry.js.map +0 -1
- package/dist/esm/lib/DataTable/index.js +0 -2
- package/dist/esm/lib/DataTable/index.js.map +0 -1
- package/dist/esm/lib/DataTable/styles.css +0 -261
- package/dist/esm/lib/DataTable/tableStatus.js +0 -28
- package/dist/esm/lib/DataTable/tableStatus.js.map +0 -1
- package/dist/esm/lib/DataTable/types.js +0 -2
- package/dist/esm/lib/DataTable/types.js.map +0 -1
- package/dist/esm/lib/DataViews/CellScopeContext.js +0 -8
- package/dist/esm/lib/DataViews/CellScopeContext.js.map +0 -1
- package/dist/esm/lib/DataViews/Context.js +0 -9
- package/dist/esm/lib/DataViews/Context.js.map +0 -1
- package/dist/esm/lib/DataViews/Provider.js +0 -30
- package/dist/esm/lib/DataViews/Provider.js.map +0 -1
- package/dist/esm/lib/DataViews/common/Actions/Actions.js +0 -60
- package/dist/esm/lib/DataViews/common/Actions/Actions.js.map +0 -1
- package/dist/esm/lib/DataViews/common/Actions/index.js +0 -2
- package/dist/esm/lib/DataViews/common/Actions/index.js.map +0 -1
- package/dist/esm/lib/DataViews/common/Actions/styles.css +0 -42
- package/dist/esm/lib/DataViews/common/Actions/types.js +0 -2
- package/dist/esm/lib/DataViews/common/Actions/types.js.map +0 -1
- package/dist/esm/lib/DataViews/common/Filters/Filters.js +0 -39
- package/dist/esm/lib/DataViews/common/Filters/Filters.js.map +0 -1
- package/dist/esm/lib/DataViews/common/Filters/common/BoundFilter/BoundFilter.js +0 -56
- package/dist/esm/lib/DataViews/common/Filters/common/BoundFilter/BoundFilter.js.map +0 -1
- package/dist/esm/lib/DataViews/common/Filters/common/BoundFilter/index.js +0 -2
- package/dist/esm/lib/DataViews/common/Filters/common/BoundFilter/index.js.map +0 -1
- package/dist/esm/lib/DataViews/common/Filters/common/BoundFilter/types.js +0 -2
- package/dist/esm/lib/DataViews/common/Filters/common/BoundFilter/types.js.map +0 -1
- package/dist/esm/lib/DataViews/common/Filters/common/ChoicesFilter/ChoicesFilter.js +0 -31
- package/dist/esm/lib/DataViews/common/Filters/common/ChoicesFilter/ChoicesFilter.js.map +0 -1
- package/dist/esm/lib/DataViews/common/Filters/common/ChoicesFilter/index.js +0 -2
- package/dist/esm/lib/DataViews/common/Filters/common/ChoicesFilter/index.js.map +0 -1
- package/dist/esm/lib/DataViews/common/Filters/common/ChoicesFilter/types.js +0 -2
- package/dist/esm/lib/DataViews/common/Filters/common/ChoicesFilter/types.js.map +0 -1
- package/dist/esm/lib/DataViews/common/Filters/common/FlagFilter/FlagFilter.js +0 -23
- package/dist/esm/lib/DataViews/common/Filters/common/FlagFilter/FlagFilter.js.map +0 -1
- package/dist/esm/lib/DataViews/common/Filters/common/FlagFilter/index.js +0 -2
- package/dist/esm/lib/DataViews/common/Filters/common/FlagFilter/index.js.map +0 -1
- package/dist/esm/lib/DataViews/common/Filters/common/FlagFilter/types.js +0 -2
- package/dist/esm/lib/DataViews/common/Filters/common/FlagFilter/types.js.map +0 -1
- package/dist/esm/lib/DataViews/common/Filters/common/index.js +0 -4
- package/dist/esm/lib/DataViews/common/Filters/common/index.js.map +0 -1
- package/dist/esm/lib/DataViews/common/Filters/handleFor.js +0 -13
- package/dist/esm/lib/DataViews/common/Filters/handleFor.js.map +0 -1
- package/dist/esm/lib/DataViews/common/Filters/index.js +0 -2
- package/dist/esm/lib/DataViews/common/Filters/index.js.map +0 -1
- package/dist/esm/lib/DataViews/common/Filters/types.js +0 -2
- package/dist/esm/lib/DataViews/common/Filters/types.js.map +0 -1
- package/dist/esm/lib/DataViews/common/Pagination/Pagination.js +0 -20
- package/dist/esm/lib/DataViews/common/Pagination/Pagination.js.map +0 -1
- package/dist/esm/lib/DataViews/common/Pagination/index.js +0 -2
- package/dist/esm/lib/DataViews/common/Pagination/index.js.map +0 -1
- package/dist/esm/lib/DataViews/common/Pagination/types.js +0 -2
- package/dist/esm/lib/DataViews/common/Pagination/types.js.map +0 -1
- package/dist/esm/lib/DataViews/common/Views/Views.js +0 -157
- package/dist/esm/lib/DataViews/common/Views/Views.js.map +0 -1
- package/dist/esm/lib/DataViews/common/Views/common/DeleteConfirm/DeleteConfirm.js +0 -24
- package/dist/esm/lib/DataViews/common/Views/common/DeleteConfirm/DeleteConfirm.js.map +0 -1
- package/dist/esm/lib/DataViews/common/Views/common/DeleteConfirm/index.js +0 -2
- package/dist/esm/lib/DataViews/common/Views/common/DeleteConfirm/index.js.map +0 -1
- package/dist/esm/lib/DataViews/common/Views/common/DeleteConfirm/types.js +0 -2
- package/dist/esm/lib/DataViews/common/Views/common/DeleteConfirm/types.js.map +0 -1
- package/dist/esm/lib/DataViews/common/Views/common/NameForm/NameForm.js +0 -40
- package/dist/esm/lib/DataViews/common/Views/common/NameForm/NameForm.js.map +0 -1
- package/dist/esm/lib/DataViews/common/Views/common/NameForm/index.js +0 -2
- package/dist/esm/lib/DataViews/common/Views/common/NameForm/index.js.map +0 -1
- package/dist/esm/lib/DataViews/common/Views/common/NameForm/types.js +0 -2
- package/dist/esm/lib/DataViews/common/Views/common/NameForm/types.js.map +0 -1
- package/dist/esm/lib/DataViews/common/Views/common/index.js +0 -3
- package/dist/esm/lib/DataViews/common/Views/common/index.js.map +0 -1
- package/dist/esm/lib/DataViews/common/Views/index.js +0 -2
- package/dist/esm/lib/DataViews/common/Views/index.js.map +0 -1
- package/dist/esm/lib/DataViews/common/Views/styles.css +0 -57
- package/dist/esm/lib/DataViews/common/Views/types.js +0 -2
- package/dist/esm/lib/DataViews/common/Views/types.js.map +0 -1
- package/dist/esm/lib/DataViews/common/Views/viewStatusText.js +0 -61
- package/dist/esm/lib/DataViews/common/Views/viewStatusText.js.map +0 -1
- package/dist/esm/lib/DataViews/common/index.js +0 -5
- package/dist/esm/lib/DataViews/common/index.js.map +0 -1
- package/dist/esm/lib/DataViews/hooks/index.js +0 -5
- package/dist/esm/lib/DataViews/hooks/index.js.map +0 -1
- package/dist/esm/lib/DataViews/hooks/types.js +0 -2
- package/dist/esm/lib/DataViews/hooks/types.js.map +0 -1
- package/dist/esm/lib/DataViews/hooks/useDataViews.js +0 -35
- package/dist/esm/lib/DataViews/hooks/useDataViews.js.map +0 -1
- package/dist/esm/lib/DataViews/hooks/useDataViewsCell.js +0 -25
- package/dist/esm/lib/DataViews/hooks/useDataViewsCell.js.map +0 -1
- package/dist/esm/lib/DataViews/hooks/useDataViewsField.js +0 -18
- package/dist/esm/lib/DataViews/hooks/useDataViewsField.js.map +0 -1
- package/dist/esm/lib/DataViews/hooks/useDataViewsState.js +0 -14
- package/dist/esm/lib/DataViews/hooks/useDataViewsState.js.map +0 -1
- package/dist/esm/lib/DataViews/hooks/useDataViewsValue.js +0 -9
- package/dist/esm/lib/DataViews/hooks/useDataViewsValue.js.map +0 -1
- package/dist/esm/lib/DataViews/index.js +0 -3
- package/dist/esm/lib/DataViews/index.js.map +0 -1
- package/dist/esm/lib/DataViews/plural.js +0 -5
- package/dist/esm/lib/DataViews/plural.js.map +0 -1
- package/dist/esm/lib/DataViews/sentenceOf.js +0 -8
- package/dist/esm/lib/DataViews/sentenceOf.js.map +0 -1
- package/dist/esm/lib/DataViews/types.js +0 -2
- package/dist/esm/lib/DataViews/types.js.map +0 -1
- package/dist/esm/lib/PaginationBar/PaginationBar.js +0 -104
- package/dist/esm/lib/PaginationBar/PaginationBar.js.map +0 -1
- package/dist/esm/lib/PaginationBar/index.js +0 -2
- package/dist/esm/lib/PaginationBar/index.js.map +0 -1
- package/dist/esm/lib/PaginationBar/paginationState.js +0 -32
- package/dist/esm/lib/PaginationBar/paginationState.js.map +0 -1
- package/dist/esm/lib/PaginationBar/styles.css +0 -105
- package/dist/esm/lib/PaginationBar/types.js +0 -2
- package/dist/esm/lib/PaginationBar/types.js.map +0 -1
- package/dist/types/lib/DataTable/DataTable.d.ts +0 -24
- package/dist/types/lib/DataTable/DataTable.d.ts.map +0 -1
- package/dist/types/lib/DataTable/columnKeys.d.ts +0 -45
- package/dist/types/lib/DataTable/columnKeys.d.ts.map +0 -1
- package/dist/types/lib/DataTable/common/BodyCell/BodyCell.d.ts +0 -17
- package/dist/types/lib/DataTable/common/BodyCell/BodyCell.d.ts.map +0 -1
- package/dist/types/lib/DataTable/common/BodyCell/index.d.ts +0 -3
- package/dist/types/lib/DataTable/common/BodyCell/index.d.ts.map +0 -1
- package/dist/types/lib/DataTable/common/BodyCell/types.d.ts +0 -16
- package/dist/types/lib/DataTable/common/BodyCell/types.d.ts.map +0 -1
- package/dist/types/lib/DataTable/common/HeaderCell/HeaderCell.d.ts +0 -12
- package/dist/types/lib/DataTable/common/HeaderCell/HeaderCell.d.ts.map +0 -1
- package/dist/types/lib/DataTable/common/HeaderCell/index.d.ts +0 -3
- package/dist/types/lib/DataTable/common/HeaderCell/index.d.ts.map +0 -1
- package/dist/types/lib/DataTable/common/HeaderCell/types.d.ts +0 -44
- package/dist/types/lib/DataTable/common/HeaderCell/types.d.ts.map +0 -1
- package/dist/types/lib/DataTable/common/ResizeHandle/ResizeHandle.d.ts +0 -14
- package/dist/types/lib/DataTable/common/ResizeHandle/ResizeHandle.d.ts.map +0 -1
- package/dist/types/lib/DataTable/common/ResizeHandle/index.d.ts +0 -3
- package/dist/types/lib/DataTable/common/ResizeHandle/index.d.ts.map +0 -1
- package/dist/types/lib/DataTable/common/ResizeHandle/types.d.ts +0 -21
- package/dist/types/lib/DataTable/common/ResizeHandle/types.d.ts.map +0 -1
- package/dist/types/lib/DataTable/common/Row/Row.d.ts +0 -15
- package/dist/types/lib/DataTable/common/Row/Row.d.ts.map +0 -1
- package/dist/types/lib/DataTable/common/Row/index.d.ts +0 -3
- package/dist/types/lib/DataTable/common/Row/index.d.ts.map +0 -1
- package/dist/types/lib/DataTable/common/Row/types.d.ts +0 -18
- package/dist/types/lib/DataTable/common/Row/types.d.ts.map +0 -1
- package/dist/types/lib/DataTable/common/SelectAllCell/SelectAllCell.d.ts +0 -9
- package/dist/types/lib/DataTable/common/SelectAllCell/SelectAllCell.d.ts.map +0 -1
- package/dist/types/lib/DataTable/common/SelectAllCell/index.d.ts +0 -3
- package/dist/types/lib/DataTable/common/SelectAllCell/index.d.ts.map +0 -1
- package/dist/types/lib/DataTable/common/SelectAllCell/types.d.ts +0 -23
- package/dist/types/lib/DataTable/common/SelectAllCell/types.d.ts.map +0 -1
- package/dist/types/lib/DataTable/common/SelectionCell/SelectionCell.d.ts +0 -8
- package/dist/types/lib/DataTable/common/SelectionCell/SelectionCell.d.ts.map +0 -1
- package/dist/types/lib/DataTable/common/SelectionCell/index.d.ts +0 -3
- package/dist/types/lib/DataTable/common/SelectionCell/index.d.ts.map +0 -1
- package/dist/types/lib/DataTable/common/SelectionCell/types.d.ts +0 -15
- package/dist/types/lib/DataTable/common/SelectionCell/types.d.ts.map +0 -1
- package/dist/types/lib/DataTable/common/TableBody/TableBody.d.ts +0 -15
- package/dist/types/lib/DataTable/common/TableBody/TableBody.d.ts.map +0 -1
- package/dist/types/lib/DataTable/common/TableBody/index.d.ts +0 -3
- package/dist/types/lib/DataTable/common/TableBody/index.d.ts.map +0 -1
- package/dist/types/lib/DataTable/common/TableBody/types.d.ts +0 -27
- package/dist/types/lib/DataTable/common/TableBody/types.d.ts.map +0 -1
- package/dist/types/lib/DataTable/common/index.d.ts +0 -8
- package/dist/types/lib/DataTable/common/index.d.ts.map +0 -1
- package/dist/types/lib/DataTable/defaultStatusText.d.ts +0 -4
- package/dist/types/lib/DataTable/defaultStatusText.d.ts.map +0 -1
- package/dist/types/lib/DataTable/hooks/index.d.ts +0 -7
- package/dist/types/lib/DataTable/hooks/index.d.ts.map +0 -1
- package/dist/types/lib/DataTable/hooks/types.d.ts +0 -27
- package/dist/types/lib/DataTable/hooks/types.d.ts.map +0 -1
- package/dist/types/lib/DataTable/hooks/usePreferredWidths.d.ts +0 -25
- package/dist/types/lib/DataTable/hooks/usePreferredWidths.d.ts.map +0 -1
- package/dist/types/lib/DataTable/hooks/useRowScopes.d.ts +0 -12
- package/dist/types/lib/DataTable/hooks/useRowScopes.d.ts.map +0 -1
- package/dist/types/lib/DataTable/hooks/useStableCallback.d.ts +0 -12
- package/dist/types/lib/DataTable/hooks/useStableCallback.d.ts.map +0 -1
- package/dist/types/lib/DataTable/hooks/useStableValue.d.ts +0 -11
- package/dist/types/lib/DataTable/hooks/useStableValue.d.ts.map +0 -1
- package/dist/types/lib/DataTable/hooks/useTableGeometry.d.ts +0 -21
- package/dist/types/lib/DataTable/hooks/useTableGeometry.d.ts.map +0 -1
- package/dist/types/lib/DataTable/index.d.ts +0 -3
- package/dist/types/lib/DataTable/index.d.ts.map +0 -1
- package/dist/types/lib/DataTable/tableStatus.d.ts +0 -15
- package/dist/types/lib/DataTable/tableStatus.d.ts.map +0 -1
- package/dist/types/lib/DataTable/types.d.ts +0 -119
- package/dist/types/lib/DataTable/types.d.ts.map +0 -1
- package/dist/types/lib/DataViews/CellScopeContext.d.ts +0 -29
- package/dist/types/lib/DataViews/CellScopeContext.d.ts.map +0 -1
- package/dist/types/lib/DataViews/Context.d.ts +0 -9
- package/dist/types/lib/DataViews/Context.d.ts.map +0 -1
- package/dist/types/lib/DataViews/Provider.d.ts +0 -19
- package/dist/types/lib/DataViews/Provider.d.ts.map +0 -1
- package/dist/types/lib/DataViews/common/Actions/Actions.d.ts +0 -19
- package/dist/types/lib/DataViews/common/Actions/Actions.d.ts.map +0 -1
- package/dist/types/lib/DataViews/common/Actions/index.d.ts +0 -3
- package/dist/types/lib/DataViews/common/Actions/index.d.ts.map +0 -1
- package/dist/types/lib/DataViews/common/Actions/types.d.ts +0 -27
- package/dist/types/lib/DataViews/common/Actions/types.d.ts.map +0 -1
- package/dist/types/lib/DataViews/common/Filters/Filters.d.ts +0 -14
- package/dist/types/lib/DataViews/common/Filters/Filters.d.ts.map +0 -1
- package/dist/types/lib/DataViews/common/Filters/common/BoundFilter/BoundFilter.d.ts +0 -12
- package/dist/types/lib/DataViews/common/Filters/common/BoundFilter/BoundFilter.d.ts.map +0 -1
- package/dist/types/lib/DataViews/common/Filters/common/BoundFilter/index.d.ts +0 -3
- package/dist/types/lib/DataViews/common/Filters/common/BoundFilter/index.d.ts.map +0 -1
- package/dist/types/lib/DataViews/common/Filters/common/BoundFilter/types.d.ts +0 -24
- package/dist/types/lib/DataViews/common/Filters/common/BoundFilter/types.d.ts.map +0 -1
- package/dist/types/lib/DataViews/common/Filters/common/ChoicesFilter/ChoicesFilter.d.ts +0 -10
- package/dist/types/lib/DataViews/common/Filters/common/ChoicesFilter/ChoicesFilter.d.ts.map +0 -1
- package/dist/types/lib/DataViews/common/Filters/common/ChoicesFilter/index.d.ts +0 -3
- package/dist/types/lib/DataViews/common/Filters/common/ChoicesFilter/index.d.ts.map +0 -1
- package/dist/types/lib/DataViews/common/Filters/common/ChoicesFilter/types.d.ts +0 -22
- package/dist/types/lib/DataViews/common/Filters/common/ChoicesFilter/types.d.ts.map +0 -1
- package/dist/types/lib/DataViews/common/Filters/common/FlagFilter/FlagFilter.d.ts +0 -9
- package/dist/types/lib/DataViews/common/Filters/common/FlagFilter/FlagFilter.d.ts.map +0 -1
- package/dist/types/lib/DataViews/common/Filters/common/FlagFilter/index.d.ts +0 -3
- package/dist/types/lib/DataViews/common/Filters/common/FlagFilter/index.d.ts.map +0 -1
- package/dist/types/lib/DataViews/common/Filters/common/FlagFilter/types.d.ts +0 -20
- package/dist/types/lib/DataViews/common/Filters/common/FlagFilter/types.d.ts.map +0 -1
- package/dist/types/lib/DataViews/common/Filters/common/index.d.ts +0 -4
- package/dist/types/lib/DataViews/common/Filters/common/index.d.ts.map +0 -1
- package/dist/types/lib/DataViews/common/Filters/handleFor.d.ts +0 -11
- package/dist/types/lib/DataViews/common/Filters/handleFor.d.ts.map +0 -1
- package/dist/types/lib/DataViews/common/Filters/index.d.ts +0 -3
- package/dist/types/lib/DataViews/common/Filters/index.d.ts.map +0 -1
- package/dist/types/lib/DataViews/common/Filters/types.d.ts +0 -23
- package/dist/types/lib/DataViews/common/Filters/types.d.ts.map +0 -1
- package/dist/types/lib/DataViews/common/Pagination/Pagination.d.ts +0 -12
- package/dist/types/lib/DataViews/common/Pagination/Pagination.d.ts.map +0 -1
- package/dist/types/lib/DataViews/common/Pagination/index.d.ts +0 -3
- package/dist/types/lib/DataViews/common/Pagination/index.d.ts.map +0 -1
- package/dist/types/lib/DataViews/common/Pagination/types.d.ts +0 -8
- package/dist/types/lib/DataViews/common/Pagination/types.d.ts.map +0 -1
- package/dist/types/lib/DataViews/common/Views/Views.d.ts +0 -25
- package/dist/types/lib/DataViews/common/Views/Views.d.ts.map +0 -1
- package/dist/types/lib/DataViews/common/Views/common/DeleteConfirm/DeleteConfirm.d.ts +0 -8
- package/dist/types/lib/DataViews/common/Views/common/DeleteConfirm/DeleteConfirm.d.ts.map +0 -1
- package/dist/types/lib/DataViews/common/Views/common/DeleteConfirm/index.d.ts +0 -3
- package/dist/types/lib/DataViews/common/Views/common/DeleteConfirm/index.d.ts.map +0 -1
- package/dist/types/lib/DataViews/common/Views/common/DeleteConfirm/types.d.ts +0 -14
- package/dist/types/lib/DataViews/common/Views/common/DeleteConfirm/types.d.ts.map +0 -1
- package/dist/types/lib/DataViews/common/Views/common/NameForm/NameForm.d.ts +0 -11
- package/dist/types/lib/DataViews/common/Views/common/NameForm/NameForm.d.ts.map +0 -1
- package/dist/types/lib/DataViews/common/Views/common/NameForm/index.d.ts +0 -3
- package/dist/types/lib/DataViews/common/Views/common/NameForm/index.d.ts.map +0 -1
- package/dist/types/lib/DataViews/common/Views/common/NameForm/types.d.ts +0 -22
- package/dist/types/lib/DataViews/common/Views/common/NameForm/types.d.ts.map +0 -1
- package/dist/types/lib/DataViews/common/Views/common/index.d.ts +0 -3
- package/dist/types/lib/DataViews/common/Views/common/index.d.ts.map +0 -1
- package/dist/types/lib/DataViews/common/Views/index.d.ts +0 -3
- package/dist/types/lib/DataViews/common/Views/index.d.ts.map +0 -1
- package/dist/types/lib/DataViews/common/Views/types.d.ts +0 -16
- package/dist/types/lib/DataViews/common/Views/types.d.ts.map +0 -1
- package/dist/types/lib/DataViews/common/Views/viewStatusText.d.ts +0 -9
- package/dist/types/lib/DataViews/common/Views/viewStatusText.d.ts.map +0 -1
- package/dist/types/lib/DataViews/common/index.d.ts +0 -5
- package/dist/types/lib/DataViews/common/index.d.ts.map +0 -1
- package/dist/types/lib/DataViews/hooks/index.d.ts +0 -6
- package/dist/types/lib/DataViews/hooks/index.d.ts.map +0 -1
- package/dist/types/lib/DataViews/hooks/types.d.ts +0 -48
- package/dist/types/lib/DataViews/hooks/types.d.ts.map +0 -1
- package/dist/types/lib/DataViews/hooks/useDataViews.d.ts +0 -11
- package/dist/types/lib/DataViews/hooks/useDataViews.d.ts.map +0 -1
- package/dist/types/lib/DataViews/hooks/useDataViewsCell.d.ts +0 -11
- package/dist/types/lib/DataViews/hooks/useDataViewsCell.d.ts.map +0 -1
- package/dist/types/lib/DataViews/hooks/useDataViewsField.d.ts +0 -8
- package/dist/types/lib/DataViews/hooks/useDataViewsField.d.ts.map +0 -1
- package/dist/types/lib/DataViews/hooks/useDataViewsState.d.ts +0 -11
- package/dist/types/lib/DataViews/hooks/useDataViewsState.d.ts.map +0 -1
- package/dist/types/lib/DataViews/hooks/useDataViewsValue.d.ts +0 -7
- package/dist/types/lib/DataViews/hooks/useDataViewsValue.d.ts.map +0 -1
- package/dist/types/lib/DataViews/index.d.ts +0 -9
- package/dist/types/lib/DataViews/index.d.ts.map +0 -1
- package/dist/types/lib/DataViews/plural.d.ts +0 -3
- package/dist/types/lib/DataViews/plural.d.ts.map +0 -1
- package/dist/types/lib/DataViews/sentenceOf.d.ts +0 -6
- package/dist/types/lib/DataViews/sentenceOf.d.ts.map +0 -1
- package/dist/types/lib/DataViews/types.d.ts +0 -18
- package/dist/types/lib/DataViews/types.d.ts.map +0 -1
- package/dist/types/lib/PaginationBar/PaginationBar.d.ts +0 -17
- package/dist/types/lib/PaginationBar/PaginationBar.d.ts.map +0 -1
- package/dist/types/lib/PaginationBar/index.d.ts +0 -3
- package/dist/types/lib/PaginationBar/index.d.ts.map +0 -1
- package/dist/types/lib/PaginationBar/paginationState.d.ts +0 -37
- package/dist/types/lib/PaginationBar/paginationState.d.ts.map +0 -1
- package/dist/types/lib/PaginationBar/types.d.ts +0 -24
- package/dist/types/lib/PaginationBar/types.d.ts.map +0 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
GNU LESSER GENERAL PUBLIC LICENSE
|
|
2
|
+
Version 3, 29 June 2007
|
|
3
|
+
|
|
4
|
+
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
|
5
|
+
Everyone is permitted to copy and distribute verbatim copies
|
|
6
|
+
of this license document, but changing it is not allowed.
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
This version of the GNU Lesser General Public License incorporates
|
|
10
|
+
the terms and conditions of version 3 of the GNU General Public
|
|
11
|
+
License, supplemented by the additional permissions listed below.
|
|
12
|
+
|
|
13
|
+
0. Additional Definitions.
|
|
14
|
+
|
|
15
|
+
As used herein, "this License" refers to version 3 of the GNU Lesser
|
|
16
|
+
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
|
17
|
+
General Public License.
|
|
18
|
+
|
|
19
|
+
"The Library" refers to a covered work governed by this License,
|
|
20
|
+
other than an Application or a Combined Work as defined below.
|
|
21
|
+
|
|
22
|
+
An "Application" is any work that makes use of an interface provided
|
|
23
|
+
by the Library, but which is not otherwise based on the Library.
|
|
24
|
+
Defining a subclass of a class defined by the Library is deemed a mode
|
|
25
|
+
of using an interface provided by the Library.
|
|
26
|
+
|
|
27
|
+
A "Combined Work" is a work produced by combining or linking an
|
|
28
|
+
Application with the Library. The particular version of the Library
|
|
29
|
+
with which the Combined Work was made is also called the "Linked
|
|
30
|
+
Version".
|
|
31
|
+
|
|
32
|
+
The "Minimal Corresponding Source" for a Combined Work means the
|
|
33
|
+
Corresponding Source for the Combined Work, excluding any source code
|
|
34
|
+
for portions of the Combined Work that, considered in isolation, are
|
|
35
|
+
based on the Application, and not on the Linked Version.
|
|
36
|
+
|
|
37
|
+
The "Corresponding Application Code" for a Combined Work means the
|
|
38
|
+
object code and/or source code for the Application, including any data
|
|
39
|
+
and utility programs needed for reproducing the Combined Work from the
|
|
40
|
+
Application, but excluding the System Libraries of the Combined Work.
|
|
41
|
+
|
|
42
|
+
1. Exception to Section 3 of the GNU GPL.
|
|
43
|
+
|
|
44
|
+
You may convey a covered work under sections 3 and 4 of this License
|
|
45
|
+
without being bound by section 3 of the GNU GPL.
|
|
46
|
+
|
|
47
|
+
2. Conveying Modified Versions.
|
|
48
|
+
|
|
49
|
+
If you modify a copy of the Library, and, in your modifications, a
|
|
50
|
+
facility refers to a function or data to be supplied by an Application
|
|
51
|
+
that uses the facility (other than as an argument passed when the
|
|
52
|
+
facility is invoked), then you may convey a copy of the modified
|
|
53
|
+
version:
|
|
54
|
+
|
|
55
|
+
a) under this License, provided that you make a good faith effort to
|
|
56
|
+
ensure that, in the event an Application does not supply the
|
|
57
|
+
function or data, the facility still operates, and performs
|
|
58
|
+
whatever part of its purpose remains meaningful, or
|
|
59
|
+
|
|
60
|
+
b) under the GNU GPL, with none of the additional permissions of
|
|
61
|
+
this License applicable to that copy.
|
|
62
|
+
|
|
63
|
+
3. Object Code Incorporating Material from Library Header Files.
|
|
64
|
+
|
|
65
|
+
The object code form of an Application may incorporate material from
|
|
66
|
+
a header file that is part of the Library. You may convey such object
|
|
67
|
+
code under terms of your choice, provided that, if the incorporated
|
|
68
|
+
material is not limited to numerical parameters, data structure
|
|
69
|
+
layouts and accessors, or small macros, inline functions and templates
|
|
70
|
+
(ten or fewer lines in length), you do both of the following:
|
|
71
|
+
|
|
72
|
+
a) Give prominent notice with each copy of the object code that the
|
|
73
|
+
Library is used in it and that the Library and its use are
|
|
74
|
+
covered by this License.
|
|
75
|
+
|
|
76
|
+
b) Accompany the object code with a copy of the GNU GPL and this license
|
|
77
|
+
document.
|
|
78
|
+
|
|
79
|
+
4. Combined Works.
|
|
80
|
+
|
|
81
|
+
You may convey a Combined Work under terms of your choice that,
|
|
82
|
+
taken together, effectively do not restrict modification of the
|
|
83
|
+
portions of the Library contained in the Combined Work and reverse
|
|
84
|
+
engineering for debugging such modifications, if you also do each of
|
|
85
|
+
the following:
|
|
86
|
+
|
|
87
|
+
a) Give prominent notice with each copy of the Combined Work that
|
|
88
|
+
the Library is used in it and that the Library and its use are
|
|
89
|
+
covered by this License.
|
|
90
|
+
|
|
91
|
+
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
|
92
|
+
document.
|
|
93
|
+
|
|
94
|
+
c) For a Combined Work that displays copyright notices during
|
|
95
|
+
execution, include the copyright notice for the Library among
|
|
96
|
+
these notices, as well as a reference directing the user to the
|
|
97
|
+
copies of the GNU GPL and this license document.
|
|
98
|
+
|
|
99
|
+
d) Do one of the following:
|
|
100
|
+
|
|
101
|
+
0) Convey the Minimal Corresponding Source under the terms of this
|
|
102
|
+
License, and the Corresponding Application Code in a form
|
|
103
|
+
suitable for, and under terms that permit, the user to
|
|
104
|
+
recombine or relink the Application with a modified version of
|
|
105
|
+
the Linked Version to produce a modified Combined Work, in the
|
|
106
|
+
manner specified by section 6 of the GNU GPL for conveying
|
|
107
|
+
Corresponding Source.
|
|
108
|
+
|
|
109
|
+
1) Use a suitable shared library mechanism for linking with the
|
|
110
|
+
Library. A suitable mechanism is one that (a) uses at run time
|
|
111
|
+
a copy of the Library already present on the user's computer
|
|
112
|
+
system, and (b) will operate properly with a modified version
|
|
113
|
+
of the Library that is interface-compatible with the Linked
|
|
114
|
+
Version.
|
|
115
|
+
|
|
116
|
+
e) Provide Installation Information, but only if you would otherwise
|
|
117
|
+
be required to provide such information under section 6 of the
|
|
118
|
+
GNU GPL, and only to the extent that such information is
|
|
119
|
+
necessary to install and execute a modified version of the
|
|
120
|
+
Combined Work produced by recombining or relinking the
|
|
121
|
+
Application with a modified version of the Linked Version. (If
|
|
122
|
+
you use option 4d0, the Installation Information must accompany
|
|
123
|
+
the Minimal Corresponding Source and Corresponding Application
|
|
124
|
+
Code. If you use option 4d1, you must provide the Installation
|
|
125
|
+
Information in the manner specified by section 6 of the GNU GPL
|
|
126
|
+
for conveying Corresponding Source.)
|
|
127
|
+
|
|
128
|
+
5. Combined Libraries.
|
|
129
|
+
|
|
130
|
+
You may place library facilities that are a work based on the
|
|
131
|
+
Library side by side in a single library together with other library
|
|
132
|
+
facilities that are not Applications and are not covered by this
|
|
133
|
+
License, and convey such a combined library under terms of your
|
|
134
|
+
choice, if you do both of the following:
|
|
135
|
+
|
|
136
|
+
a) Accompany the combined library with a copy of the same work based
|
|
137
|
+
on the Library, uncombined with any other library facilities,
|
|
138
|
+
conveyed under the terms of this License.
|
|
139
|
+
|
|
140
|
+
b) Give prominent notice with the combined library that part of it
|
|
141
|
+
is a work based on the Library, and explaining where to find the
|
|
142
|
+
accompanying uncombined form of the same work.
|
|
143
|
+
|
|
144
|
+
6. Revised Versions of the GNU Lesser General Public License.
|
|
145
|
+
|
|
146
|
+
The Free Software Foundation may publish revised and/or new versions
|
|
147
|
+
of the GNU Lesser General Public License from time to time. Such new
|
|
148
|
+
versions will be similar in spirit to the present version, but may
|
|
149
|
+
differ in detail to address new problems or concerns.
|
|
150
|
+
|
|
151
|
+
Each version is given a distinguishing version number. If the
|
|
152
|
+
Library as you received it specifies that a certain numbered version
|
|
153
|
+
of the GNU Lesser General Public License "or any later version"
|
|
154
|
+
applies to it, you have the option of following the terms and
|
|
155
|
+
conditions either of that published version or of any later version
|
|
156
|
+
published by the Free Software Foundation. If the Library as you
|
|
157
|
+
received it does not specify a version number of the GNU Lesser
|
|
158
|
+
General Public License, you may choose any version of the GNU Lesser
|
|
159
|
+
General Public License ever published by the Free Software Foundation.
|
|
160
|
+
|
|
161
|
+
If the Library as you received it specifies that a proxy can decide
|
|
162
|
+
whether future versions of the GNU Lesser General Public License shall
|
|
163
|
+
apply, that proxy's public statement of acceptance of any version is
|
|
164
|
+
permanent authorization for you to choose that version for the
|
|
165
|
+
Library.
|
|
166
|
+
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canonical/dataviews-react",
|
|
3
3
|
"description": "React bindings for @canonical/dataviews-core: the DataViews root with its connected Search, Filters, SortPanel, Actions, Pagination and SavedViews parts, provider context, the four scoped observation hooks, the DataTable renderer with its explicitly imported row virtualization, and the PaginationBar",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.47.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
7
7
|
"types": "dist/types/index.d.ts",
|
|
@@ -59,10 +59,10 @@
|
|
|
59
59
|
"test:watch": "vitest"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@canonical/dataviews-core": "^0.
|
|
63
|
-
"@canonical/react-ds-global": "^0.
|
|
64
|
-
"@canonical/react-ds-global-form": "^0.
|
|
65
|
-
"@canonical/styles": "^0.
|
|
62
|
+
"@canonical/dataviews-core": "^0.47.0",
|
|
63
|
+
"@canonical/react-ds-global": "^0.47.0",
|
|
64
|
+
"@canonical/react-ds-global-form": "^0.47.0",
|
|
65
|
+
"@canonical/styles": "^0.47.0",
|
|
66
66
|
"react": "^19.2.4",
|
|
67
67
|
"react-dom": "^19.2.4"
|
|
68
68
|
},
|
|
@@ -70,11 +70,11 @@
|
|
|
70
70
|
"@biomejs/biome": "2.5.15",
|
|
71
71
|
"@canonical/biome-config": "0.43.0",
|
|
72
72
|
"@canonical/design-tokens": "0.44.0",
|
|
73
|
-
"@canonical/storybook-addon-msw": "^0.
|
|
74
|
-
"@canonical/storybook-config": "^0.
|
|
73
|
+
"@canonical/storybook-addon-msw": "^0.47.0",
|
|
74
|
+
"@canonical/storybook-config": "^0.47.0",
|
|
75
75
|
"@canonical/typescript-config": "0.44.0",
|
|
76
|
-
"@canonical/typescript-config-react": "^0.
|
|
77
|
-
"@canonical/vitest-config-react": "^0.
|
|
76
|
+
"@canonical/typescript-config-react": "^0.47.0",
|
|
77
|
+
"@canonical/vitest-config-react": "^0.47.0",
|
|
78
78
|
"@canonical/webarchitect": "0.44.0",
|
|
79
79
|
"@chromatic-com/storybook": "^5.0.1",
|
|
80
80
|
"@storybook/addon-docs": "^10.6.0",
|
|
@@ -97,5 +97,6 @@
|
|
|
97
97
|
"typescript": "^7.0.2",
|
|
98
98
|
"vite": "^8.0.1",
|
|
99
99
|
"vitest": "^5.0.0"
|
|
100
|
-
}
|
|
100
|
+
},
|
|
101
|
+
"gitHead": "f846e7e21001a0fcbc4cd9f28c14a55cea7f4974"
|
|
101
102
|
}
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { createGridInteraction, createPresentation, isIdentity, } from "@canonical/dataviews-core";
|
|
3
|
-
import { useCallback, useEffect, useId, useMemo, useRef } from "react";
|
|
4
|
-
import useDataViewsValue from "../DataViews/hooks/useDataViewsValue.js";
|
|
5
|
-
import { boundsOf, sameColumnModel, sameColumns, sizingOf, } from "./columnKeys.js";
|
|
6
|
-
import { HeaderCell, SelectAllCell, TableBody } from "./common/index.js";
|
|
7
|
-
import defaultStatusText from "./defaultStatusText.js";
|
|
8
|
-
import { usePreferredWidths, useRowScopes, useStableCallback, useStableValue, useTableGeometry, } from "./hooks/index.js";
|
|
9
|
-
import tableStatus from "./tableStatus.js";
|
|
10
|
-
import "./styles.css";
|
|
11
|
-
/**
|
|
12
|
-
* `dense` is the design system's own density class: it sets the channel the
|
|
13
|
-
* stylesheet reads for row height and cell padding, so the table is dense
|
|
14
|
-
* wherever it sits.
|
|
15
|
-
*/
|
|
16
|
-
const componentCssClassName = "ds data-table dense";
|
|
17
|
-
/** A record answers to its own identity until the caller names it better. */
|
|
18
|
-
const defaultRowLabel = (_row, rowId) => rowId;
|
|
19
|
-
/**
|
|
20
|
-
* Hand the container to the caller's ref, in whichever form it arrives, and
|
|
21
|
-
* report back the cleanup a callback ref returned. React 19 ref callbacks
|
|
22
|
-
* may return one, and a caller that does gets it called on detach instead of
|
|
23
|
-
* the `null` call React 19 no longer makes on its own.
|
|
24
|
-
*/
|
|
25
|
-
const applyRef = (ref, node) => {
|
|
26
|
-
if (typeof ref === "function") {
|
|
27
|
-
const cleanup = ref(node);
|
|
28
|
-
return typeof cleanup === "function" ? cleanup : undefined;
|
|
29
|
-
}
|
|
30
|
-
if (ref) {
|
|
31
|
-
ref.current = node;
|
|
32
|
-
}
|
|
33
|
-
return undefined;
|
|
34
|
-
};
|
|
35
|
-
/**
|
|
36
|
-
* DataTable renders the rows of one collection.
|
|
37
|
-
*
|
|
38
|
-
* It renders rows and nothing else: it does not fetch, own the URL or decide
|
|
39
|
-
* where views persist. The provider is explicit, so the same table works
|
|
40
|
-
* standalone and inside a DataViews root, and never changes behaviour
|
|
41
|
-
* because some optional context happened to be present.
|
|
42
|
-
*
|
|
43
|
-
* Its rows are divs consuming one shared track list, published once on the
|
|
44
|
-
* container as a custom property. Fixed columns keep their declared width,
|
|
45
|
-
* flexible ones compress within their bounds, the last column takes whatever
|
|
46
|
-
* width the others leave, and the container scrolls when the remainder no
|
|
47
|
-
* longer fits — there is no automatic hiding, pairing or renderer switching.
|
|
48
|
-
* The selection column is not among them: its width is the stylesheet's,
|
|
49
|
-
* and the columns share what it leaves.
|
|
50
|
-
*
|
|
51
|
-
* @implements ds:apps.pattern.data_table
|
|
52
|
-
*/
|
|
53
|
-
export default function DataTable({ provider, columns, label, presentation, selectable = false, rowLabel = defaultRowLabel, renderStatus = defaultStatusText, className, style, ref, ...rest }) {
|
|
54
|
-
if (!isIdentity(provider?.identity)) {
|
|
55
|
-
throw new Error("DataTable requires a provider created by createDataViewsProvider");
|
|
56
|
-
}
|
|
57
|
-
// Sorting is offered from the same declaration Filters reads, so a
|
|
58
|
-
// provider not given one cannot offer it.
|
|
59
|
-
const declared = provider.capabilities;
|
|
60
|
-
if (declared === null && columns.some((column) => column.sortable === true)) {
|
|
61
|
-
throw new Error("DataTable requires a provider given the source's capabilities to offer a sortable column; pass them to createDataViewsProvider");
|
|
62
|
-
}
|
|
63
|
-
const sortableFields = declared === null || declared.sortTerms === 0 ? [] : declared.sort;
|
|
64
|
-
const baseId = useId();
|
|
65
|
-
// Both derivations are keyed on content, not on array identity: a caller
|
|
66
|
-
// who rebuilds its column array on every render must not re-mint the
|
|
67
|
-
// presentation, the interaction or one row scope, nor re-render one cell.
|
|
68
|
-
// The two keys are separate because they answer different questions — a
|
|
69
|
-
// caller's inline `header` node must not cost anyone a new presentation.
|
|
70
|
-
const model = useStableValue(columns, sameColumnModel);
|
|
71
|
-
const rendered = useStableValue(columns, sameColumns);
|
|
72
|
-
const fields = useMemo(() => model.map((column) => column.field ?? column.id), [model]);
|
|
73
|
-
const declaredTracks = useMemo(() => model.map((column) => ({ id: column.id, sizing: sizingOf(column) })), [model]);
|
|
74
|
-
const columnIds = useMemo(() => declaredTracks.map((track) => track.id), [declaredTracks]);
|
|
75
|
-
const ownPresentation = useMemo(() => createPresentation(declaredTracks), [declaredTracks]);
|
|
76
|
-
const activePresentation = presentation ?? ownPresentation;
|
|
77
|
-
const interaction = useMemo(() => createGridInteraction(activePresentation), [activePresentation]);
|
|
78
|
-
// Subscribed from an effect, never from the render that built it: React
|
|
79
|
-
// may discard a render — StrictMode double-invokes the body, and a
|
|
80
|
-
// concurrent render can be thrown away — and a subscription taken at
|
|
81
|
-
// construction would outlive the interaction nothing else holds.
|
|
82
|
-
useEffect(() => interaction.observe(), [interaction]);
|
|
83
|
-
usePreferredWidths(activePresentation, provider.views);
|
|
84
|
-
const geometry = useTableGeometry(activePresentation, interaction, columnIds);
|
|
85
|
-
const scopes = useRowScopes(provider, fields);
|
|
86
|
-
const result = useDataViewsValue(provider.result);
|
|
87
|
-
const status = tableStatus(result);
|
|
88
|
-
const busy = result.result.status === "pending" || result.result.status === "refreshing";
|
|
89
|
-
// The container ref is the table's own — the solver measures it — so a
|
|
90
|
-
// caller's ref is merged onto it rather than dropped, as className and
|
|
91
|
-
// style are. React sees one callback returning one cleanup, which detaches
|
|
92
|
-
// the geometry and then releases the caller's ref: its own cleanup when it
|
|
93
|
-
// returned one, the pre-19 `null` call when it did not. The caller's ref is
|
|
94
|
-
// read through a latest-ref so an inline callback ref cannot change this
|
|
95
|
-
// one's identity — a ref React re-ran per render would rebuild the resize
|
|
96
|
-
// observer and re-measure the container on every frame of a drag.
|
|
97
|
-
const callerRef = useRef(ref);
|
|
98
|
-
callerRef.current = ref;
|
|
99
|
-
const attachGeometry = geometry.attach;
|
|
100
|
-
const attach = useCallback((node) => {
|
|
101
|
-
const detachGeometry = attachGeometry(node);
|
|
102
|
-
const attached = callerRef.current;
|
|
103
|
-
const releaseCaller = applyRef(attached, node);
|
|
104
|
-
return () => {
|
|
105
|
-
detachGeometry?.();
|
|
106
|
-
if (releaseCaller === undefined) {
|
|
107
|
-
applyRef(attached, null);
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
releaseCaller();
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
}, [attachGeometry]);
|
|
114
|
-
// Held behind one identity apiece: the README's own examples pass these
|
|
115
|
-
// as lambdas, and a new function per render would re-render every row
|
|
116
|
-
// and every cell of the body for nothing.
|
|
117
|
-
const nameRow = useStableCallback(rowLabel);
|
|
118
|
-
const showStatus = useStableCallback(renderStatus);
|
|
119
|
-
const geometryStyle = {
|
|
120
|
-
...style,
|
|
121
|
-
"--data-table-columns": geometry.template,
|
|
122
|
-
};
|
|
123
|
-
return (
|
|
124
|
-
// biome-ignore lint/a11y/useSemanticElements: a <table> resolves each row's widths from its own content, which is exactly what this grid replaces with one shared track list
|
|
125
|
-
_jsxs("div", { ...rest, ref: attach, className: [componentCssClassName, className].filter(Boolean).join(" "), style: geometryStyle, role: "table", "aria-label": label, "aria-busy": busy, children: [_jsx("div", { role: "rowgroup", className: "ds data-table-row-group header", children: _jsxs("div", { role: "row", className: "ds data-table-row", children: [selectable ? (_jsx(SelectAllCell, { selection: provider.selection, ids: scopes.ids, reserve: geometry.reserve })) : null, rendered.map((column, position) => (_jsx(HeaderCell, { column: column, field: fields[position], sortable: column.sortable === true &&
|
|
126
|
-
sortableFields.includes(fields[position]), sort: result.slice.sort.find((term) => term.field === fields[position]), setSort: provider.setSort, interaction: interaction, resizable: column.resizable === true && position < rendered.length - 1, bounds: boundsOf(activePresentation.state.declared[column.id]), width: geometry.widths[position], labelId: `${baseId}-${column.id}` }, column.id)))] }) }), _jsx(TableBody, { provider: provider, scopes: scopes, columns: rendered, fields: fields, selectable: selectable, rowLabel: nameRow, status: status, renderStatus: showStatus })] }));
|
|
127
|
-
}
|
|
128
|
-
//# sourceMappingURL=DataTable.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DataTable.js","sourceRoot":"","sources":["../../../../src/lib/DataTable/DataTable.tsx"],"names":[],"mappings":";AAIA,OAAO,EACL,qBAAqB,EACrB,kBAAkB,EAClB,UAAU,GACX,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACvE,OAAO,iBAAiB,MAAM,yCAAyC,CAAC;AACxE,OAAO,EACL,QAAQ,EACR,eAAe,EACf,WAAW,EACX,QAAQ,GACT,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,iBA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
|
|
5
|
-
* A caller writing its columns as a literal rebuilds the array on every
|
|
6
|
-
* render, and none of the table's machinery may notice: re-minting the
|
|
7
|
-
* presentation would drop every user-resized width, and a new array
|
|
8
|
-
* reference alone would re-render every cell of every row. So the table
|
|
9
|
-
* keys on content — and on two different readings of it, because an inline
|
|
10
|
-
* `header` node must not cost anyone a new presentation.
|
|
11
|
-
*/
|
|
12
|
-
/** Declared sizing when a column names none: flexible, with a 96px floor. */
|
|
13
|
-
export const defaultSizing = {
|
|
14
|
-
kind: "flex",
|
|
15
|
-
weight: 1,
|
|
16
|
-
minPx: 96,
|
|
17
|
-
};
|
|
18
|
-
/** One column's declared sizing, defaulted. */
|
|
19
|
-
export const sizingOf = (column) => column.sizing ?? defaultSizing;
|
|
20
|
-
/**
|
|
21
|
-
* The widths a resize may leave a column at, from its declared sizing —
|
|
22
|
-
* never from a user override, so a column resized once is held to the same
|
|
23
|
-
* bounds the next time. A flexible column is held to its minimum and
|
|
24
|
-
* maximum; a fixed one may go anywhere from zero.
|
|
25
|
-
*/
|
|
26
|
-
export const boundsOf = (sizing) => sizing.kind === "flex"
|
|
27
|
-
? { min: sizing.minPx, max: sizing.maxPx ?? Number.POSITIVE_INFINITY }
|
|
28
|
-
: { min: 0, max: Number.POSITIVE_INFINITY };
|
|
29
|
-
/**
|
|
30
|
-
* The column facts everything below the rendered tree is derived from: the
|
|
31
|
-
* presentation's declared tracks, the observed field names, the solved
|
|
32
|
-
* geometry and one row scope per identity.
|
|
33
|
-
*/
|
|
34
|
-
export const sameColumnModel = (a, b) => a.length === b.length &&
|
|
35
|
-
a.every((column, position) => {
|
|
36
|
-
const other = b[position];
|
|
37
|
-
return (column.id === other.id &&
|
|
38
|
-
(column.field ?? column.id) === (other.field ?? other.id) &&
|
|
39
|
-
sizingEquals(sizingOf(column), sizingOf(other)));
|
|
40
|
-
});
|
|
41
|
-
/**
|
|
42
|
-
* Everything the rendered tree reads, the model included. `header` and
|
|
43
|
-
* `cell` are compared by reference: one is a node and the other a
|
|
44
|
-
* component, and neither has content this could compare.
|
|
45
|
-
*/
|
|
46
|
-
export const sameColumns = (a, b) => sameColumnModel(a, b) &&
|
|
47
|
-
a.every((column, position) => {
|
|
48
|
-
const other = b[position];
|
|
49
|
-
return (column.sortable === other.sortable &&
|
|
50
|
-
column.resizable === other.resizable &&
|
|
51
|
-
column.header === other.header &&
|
|
52
|
-
column.cell === other.cell);
|
|
53
|
-
});
|
|
54
|
-
/**
|
|
55
|
-
* Two solved track lists say the same thing. The tracks are read through
|
|
56
|
-
* the presentation record on every render, so this is what keeps the
|
|
57
|
-
* solver from running again for an unchanged arrangement.
|
|
58
|
-
*/
|
|
59
|
-
export const sameTracks = (a, b) => a.length === b.length &&
|
|
60
|
-
a.every((track, position) => {
|
|
61
|
-
const other = b[position];
|
|
62
|
-
return track.id === other.id && sizingEquals(track.sizing, other.sizing);
|
|
63
|
-
});
|
|
64
|
-
//# sourceMappingURL=columnKeys.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"columnKeys.js","sourceRoot":"","sources":["../../../../src/lib/DataTable/columnKeys.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGzD;;;;;;;;;GASG;AAEH,6EAA6E;AAC7E,MAAM,CAAC,MAAM,aAAa,GAAiB;IACzC,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,CAAC;IACT,KAAK,EAAE,EAAE;CACV,CAAC;AAEF,+CAA+C;AAC/C,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,MAAuB,EAAgB,EAAE,CAChE,MAAM,CAAC,MAAM,IAAI,aAAa,CAAC;AAEjC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CACtB,MAAoB,EAC4B,EAAE,CAClD,MAAM,CAAC,IAAI,KAAK,MAAM;IACpB,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,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AAM,UAAU,GAAG,CACxB,CAA0B,EAC1B,CAA0B,EACjB,EAAE,CACX,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;IACrB,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE;QAC1B,MAAM,KAAK,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC;QAC1B,OAAO,KAAK,CAAC,EAAE,KAAK,KAAK,CAAC,EAAE,IAAI,YAAY,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC3E,CAAC,CAAC,CAAC"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { memo, useMemo } from "react";
|
|
3
|
-
import CellScopeContext from "../../../DataViews/CellScopeContext.js";
|
|
4
|
-
import useDataViewsValue from "../../../DataViews/hooks/useDataViewsValue.js";
|
|
5
|
-
const componentCssClassName = "ds data-table-body-cell";
|
|
6
|
-
/** Primitive values render as text; anything else needs the column's `cell`. */
|
|
7
|
-
const defaultContent = (value) => {
|
|
8
|
-
switch (typeof value) {
|
|
9
|
-
case "string":
|
|
10
|
-
return value;
|
|
11
|
-
case "number":
|
|
12
|
-
case "bigint":
|
|
13
|
-
case "boolean":
|
|
14
|
-
return String(value);
|
|
15
|
-
default:
|
|
16
|
-
return null;
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
function BodyCell({ provider, scope, column, field, }) {
|
|
20
|
-
const channel = scope.fields[field];
|
|
21
|
-
const value = useDataViewsValue(channel);
|
|
22
|
-
const cellScope = useMemo(() => ({
|
|
23
|
-
provider,
|
|
24
|
-
rowId: scope.id,
|
|
25
|
-
columnId: column.id,
|
|
26
|
-
row: scope.row,
|
|
27
|
-
fields: scope.fields,
|
|
28
|
-
selected: scope.selected,
|
|
29
|
-
}), [provider, scope, column.id]);
|
|
30
|
-
const Content = column.cell;
|
|
31
|
-
return (_jsx(CellScopeContext.Provider, { value: cellScope, children: _jsx("div", { role: "cell", className: componentCssClassName, children: Content === undefined ? (defaultContent(value)) : (_jsx(Content, { value: value, rowId: scope.id, columnId: column.id })) }) }));
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* One body cell. It subscribes to its own field's channel, so a record
|
|
35
|
-
* update re-renders only the cells whose values actually changed, and it
|
|
36
|
-
* installs the cell scope its column's own renderer reads.
|
|
37
|
-
*
|
|
38
|
-
* Memoised: without it the claim above would hold for the channel and be
|
|
39
|
-
* undone by the row, which would re-render every cell it has whenever it
|
|
40
|
-
* rendered at all.
|
|
41
|
-
*
|
|
42
|
-
* @implements ds:apps.subcomponent.data_table-body_cell
|
|
43
|
-
*/
|
|
44
|
-
export default memo(BodyCell);
|
|
45
|
-
//# sourceMappingURL=BodyCell.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BodyCell.js","sourceRoot":"","sources":["../../../../../../src/lib/DataTable/common/BodyCell/BodyCell.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,gBAAgB,MAAM,wCAAwC,CAAC;AACtE,OAAO,iBAAiB,MAAM,+CAA+C,CAAC;AAG9E,MAAM,qBAAqB,GAAG,yBAAyB,CAAC;AAExD,gFAAgF;AAChF,MAAM,cAAc,GAAG,CAAC,KAAc,EAAa,EAAE;IACnD,QAAQ,OAAO,KAAK,EAAE,CAAC;QACrB,KAAK,QAAQ;YACX,OAAO,KAAK,CAAC;QACf,KAAK,QAAQ,CAAC;QACd,KAAK,QAAQ,CAAC;QACd,KAAK,SAAS;YACZ,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;QACvB;YACE,OAAO,IAAI,CAAC;IAChB,CAAC;AACH,CAAC,CAAC;AAEF,SAAS,QAAQ,CAAsB,EACrC,QAAQ,EACR,KAAK,EACL,MAAM,EACN,KAAK,GACe;IACpB,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACpC,MAAM,KAAK,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;IACzC,MAAM,SAAS,GAAG,OAAO,CACvB,GAAG,EAAE,CAAC,CAAC;QACL,QAAQ;QACR,KAAK,EAAE,KAAK,CAAC,EAAE;QACf,QAAQ,EAAE,MAAM,CAAC,EAAE;QACnB,GAAG,EAAE,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,QAAQ,EAAE,KAAK,CAAC,QAAQ;KACzB,CAAC,EACF,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAM,CAAC,EAAE,CAAC,CAC7B,CAAC;IACF,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC;IAC5B,OAAO,CACL,KAAC,gBAAgB,CAAC,QAAQ,IAAC,KAAK,EAAE,SAAS,YAEzC,cAAK,IAAI,EAAC,MAAM,EAAC,SAAS,EAAE,qBAAqB,YAC9C,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,CACvB,cAAc,CAAC,KAAK,CAAC,CACtB,CAAC,CAAC,CAAC,CACF,KAAC,OAAO,IAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,EAAE,QAAQ,EAAE,MAAM,CAAC,EAAE,GAAI,CAChE,GACG,GACoB,CAC7B,CAAC;AACJ,CAAC;AAED;;;;;;;;;;GAUG;AACH,eAAe,IAAI,CAAC,QAAQ,CAAoB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/lib/DataTable/common/BodyCell/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../src/lib/DataTable/common/BodyCell/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Icon } from "@canonical/react-ds-global";
|
|
3
|
-
import { ResizeHandle } from "../ResizeHandle/index.js";
|
|
4
|
-
const componentCssClassName = "ds data-table-header-cell";
|
|
5
|
-
/** The applied ordering's icon. A column at rest shows none. */
|
|
6
|
-
const sortIcon = {
|
|
7
|
-
asc: "chevron-up",
|
|
8
|
-
desc: "chevron-down",
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* The next ordering for one column: unsorted becomes ascending, ascending
|
|
12
|
-
* becomes descending, and descending clears the ordering. Enabling sort
|
|
13
|
-
* never lands on descending by accident.
|
|
14
|
-
*/
|
|
15
|
-
const nextSort = (field, current) => {
|
|
16
|
-
if (current === undefined) {
|
|
17
|
-
return [{ field, direction: "asc" }];
|
|
18
|
-
}
|
|
19
|
-
if (current.direction === "asc") {
|
|
20
|
-
return [{ field, direction: "desc" }];
|
|
21
|
-
}
|
|
22
|
-
return [];
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* One header cell. `aria-sort` describes the applied ordering, so it is
|
|
26
|
-
* absent on a column that does not offer sorting rather than claiming
|
|
27
|
-
* "none" about an ordering it cannot change. The chevron beside the label
|
|
28
|
-
* repeats it for the eye and is hidden from assistive technology.
|
|
29
|
-
*
|
|
30
|
-
* @implements ds:apps.subcomponent.data_table-header_cell
|
|
31
|
-
*/
|
|
32
|
-
export default function HeaderCell({ column, field, sortable, sort, setSort, interaction, resizable, bounds, width, labelId, }) {
|
|
33
|
-
const ariaSort = !sortable
|
|
34
|
-
? undefined
|
|
35
|
-
: sort === undefined
|
|
36
|
-
? "none"
|
|
37
|
-
: sort.direction === "asc"
|
|
38
|
-
? "ascending"
|
|
39
|
-
: "descending";
|
|
40
|
-
return (
|
|
41
|
-
// biome-ignore lint/a11y/useSemanticElements: <th> is only valid inside a <table>, and this grid is deliberately not one
|
|
42
|
-
// biome-ignore lint/a11y/useFocusableInteractive: the header is structure, not a widget — its sort button and resize handle carry the focus
|
|
43
|
-
_jsxs("div", { role: "columnheader", className: componentCssClassName, "aria-sort": ariaSort, children: [sortable ? (_jsxs("button", { type: "button", id: labelId, className: "sort", onClick: () => {
|
|
44
|
-
setSort(nextSort(field, sort));
|
|
45
|
-
}, children: [_jsx("span", { className: "label", children: column.header }), sort === undefined ? null : _jsx(Icon, { icon: sortIcon[sort.direction] })] })) : (_jsx("span", { id: labelId, className: "label", children: column.header })), resizable ? (_jsx(ResizeHandle, { interaction: interaction, columnId: column.id, width: width, ...bounds, labelledBy: labelId })) : null] }));
|
|
46
|
-
}
|
|
47
|
-
//# sourceMappingURL=HeaderCell.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HeaderCell.js","sourceRoot":"","sources":["../../../../../../src/lib/DataTable/common/HeaderCell/HeaderCell.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAElD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAGxD,MAAM,qBAAqB,GAAG,2BAA2B,CAAC;AAE1D,gEAAgE;AAChE,MAAM,QAAQ,GAA+D;IAC3E,GAAG,EAAE,YAAY;IACjB,IAAI,EAAE,cAAc;CACrB,CAAC;AAEF;;;;GAIG;AACH,MAAM,QAAQ,GAAG,CACf,KAAa,EACb,OAA6B,EACR,EAAE;IACvB,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC;IACvC,CAAC;IACD,IAAI,OAAO,CAAC,SAAS,KAAK,KAAK,EAAE,CAAC;QAChC,OAAO,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,CAAC;IACxC,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AAEF;;;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AAI,IACJ,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/lib/DataTable/common/HeaderCell/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../src/lib/DataTable/common/HeaderCell/types.ts"],"names":[],"mappings":""}
|