(
+ useKottiStandardTable(
computed(() => ({
filters: filters.value,
id: 'example-remote-data',
- isLoading: isLoadingRecipes.value,
- options: {
- hideControls: settings.value.hideControls,
- },
- pagination: {
+ initialPagination: {
pageSize: 5,
// eslint-disable-next-line no-magic-numbers
pageSizeOptions: [5, 10, 15, 30, 50, 100],
rowCount: recipesRowCount.value,
- type: Kotti.StandardTable.PaginationType.REMOTE,
+ type: 'remote',
+ },
+ isLoading: isLoadingRecipes.value,
+ options: {
+ hideControls: settings.value.hideControls,
+ popoversSize: {
+ columns: settings.value.columnsPopoverSize,
+ filters: settings.value.filtersPopoverSize,
+ },
+ searchPlaceholder: settings.value.searchPlaceholder ?? undefined,
},
storageAdapter: null,
table: {
columns: recipesColumns.value,
data: recipesData.value,
+ expandMode: settings.value.slots.tableSlot ? 'single' : undefined,
getRowBehavior: ({ row }: { row: RecipeRow }) => ({
id: String(row.id),
}),
diff --git a/packages/kotti-ui/source/kotti-table/KtStandardTable.vue b/packages/kotti-ui/source/kotti-table/KtStandardTable.vue
index 59372087a..2b0c6fd18 100644
--- a/packages/kotti-ui/source/kotti-table/KtStandardTable.vue
+++ b/packages/kotti-ui/source/kotti-table/KtStandardTable.vue
@@ -77,7 +77,12 @@
-
+
standardTableContext.value.internal.filters)
- const table = computed(() => tableContext.value.internal.table.value)
- const tablePagination = computed(() => table.value.getState().pagination)
+ const tablePagination = computed(
+ () => standardTableContext.value.internal.pagination,
+ )
const options = computed(() => standardTableContext.value.internal.options)
watch(
@@ -180,8 +186,7 @@ export default defineComponent({
})),
),
columnVisibility: computed(
- () =>
- tableContext.value.internal.table.value.getState().columnVisibility,
+ () => tableContext.value.internal.visibleColumns,
),
filterTags: computed(() =>
appliedFilters.value
@@ -217,31 +222,24 @@ export default defineComponent({
onUpdateAppliedFilters: (value: KottiStandardTable.AppliedFilter[]) => {
standardTableContext.value.internal.setAppliedFilters(value)
},
- onUpdateColumnVisivility: (
- value: KottiStandardTable.TableColumns.Props['value'],
- ) => {
+ onUpdateColumnVisivility: (value: Record) => {
tableContext.value.internal.table.value.setColumnVisibility(value)
},
- onUpdatePageIndex: (value: number) => {
- table.value.setPageIndex(value)
- },
- onUpdatePageSize: (value: number) => {
- table.value.setPageSize(value)
- },
+ onUpdatePageIndex: standardTableContext.value.internal.setPageIndex,
+ onUpdatePageSize: standardTableContext.value.internal.setPageSize,
onUpdateSearchValue: (value: string | null) => {
standardTableContext.value.internal.setSearchValue(value)
},
options,
- pageIndex: computed(() => tablePagination.value.pageIndex),
- pageSize: computed(() => tablePagination.value.pageSize),
pageSizeOptions: computed(
() => standardTableContext.value.internal.pageSizeOptions,
),
popoverFilters: computed(() =>
filters.value.filter((filter) => !filter.displayInline),
),
- rowCount: computed(() => table.value.getRowCount()),
+ rowCount: computed(() => standardTableContext.value.internal.rowCount),
searchValue,
+ tablePagination,
}
},
})
diff --git a/packages/kotti-ui/source/kotti-table/standard-table/api.md b/packages/kotti-ui/source/kotti-table/standard-table/api.md
index 770cf8606..1cd996de4 100644
--- a/packages/kotti-ui/source/kotti-table/standard-table/api.md
+++ b/packages/kotti-ui/source/kotti-table/standard-table/api.md
@@ -2,18 +2,18 @@
## Review Comments
-- [ ] make sure it wraps properly
-- [ ] consider display-noning sorting indicator when inactive and showing animation when toggling making it appear
-- [ ] table looses scroll position when loading
-- [ ] should have a simpler loading state if datat is already present
-- [ ] check search placeholder and popover sizes in documentation
-- [ ] use api/internal pattern for return
-- [ ] sync pagination schema
-- [ ] simplify forwarding properties from standard table to table, some properties are not forwarded yet
-- [ ] remove local pagination
-- [ ] check useComputedRef for reactivity bugs
+- [x] make sure it wraps properly
+- [x] consider display-noning sorting indicator when inactive and showing animation when toggling making it appear
+- [x] table looses scroll position when loading
+- [x] should have a simpler loading state if datat is already present
+- [x] check search placeholder and popover sizes in documentation
+- [x] use api/internal pattern for return
+- [x] sync pagination schema
+- [x] simplify forwarding properties from standard table to table, some properties are not forwarded yet
+- [x] remove local pagination
+- [x] check useComputedRef for reactivity bugs
- [ ] FIXMEs/TODOs
-- [ ] double-check all calls to table.getState() and other direct calls to tanstack api
+- [x] double-check all calls to table.getState() and other direct calls to tanstack api
- [ ] prune out schemas from types.ts that don't need
## Kinds
diff --git a/packages/kotti-ui/source/kotti-table/standard-table/components/Columns.vue b/packages/kotti-ui/source/kotti-table/standard-table/components/Columns.vue
index 823cc420b..6d56ad894 100644
--- a/packages/kotti-ui/source/kotti-table/standard-table/components/Columns.vue
+++ b/packages/kotti-ui/source/kotti-table/standard-table/components/Columns.vue
@@ -30,17 +30,26 @@