tanstack-table-vue 0.1.0 → 0.1.1
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/dist/index.mjs +7 -15
- package/dist/plugins/index.d.mts +13 -13
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as valueUpdater, t as processColumns } from "./utils-BGsLZVAI.mjs";
|
|
2
|
-
import { computed, defineComponent, renderSlot, unref, useSlots
|
|
2
|
+
import { computed, defineComponent, renderSlot, unref, useSlots } from "vue";
|
|
3
3
|
import { createColumnHelper, getCoreRowModel, useVueTable } from "@tanstack/vue-table";
|
|
4
4
|
|
|
5
5
|
//#region src/components/TSTable.vue
|
|
@@ -18,23 +18,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
18
18
|
return processColumns(columnHelper, props.columns, slots);
|
|
19
19
|
});
|
|
20
20
|
const table = useVueTable({
|
|
21
|
-
columns
|
|
22
|
-
|
|
21
|
+
get columns() {
|
|
22
|
+
return processedColumns.value;
|
|
23
|
+
},
|
|
24
|
+
get data() {
|
|
25
|
+
return props.data;
|
|
26
|
+
},
|
|
23
27
|
getCoreRowModel: getCoreRowModel(),
|
|
24
28
|
...props.tableOptions
|
|
25
29
|
});
|
|
26
|
-
watch(() => props.data, (newData) => {
|
|
27
|
-
table.setOptions((old) => ({
|
|
28
|
-
...old,
|
|
29
|
-
data: newData
|
|
30
|
-
}));
|
|
31
|
-
}, { flush: "sync" });
|
|
32
|
-
watch(processedColumns, (newColumns) => {
|
|
33
|
-
table.setOptions((old) => ({
|
|
34
|
-
...old,
|
|
35
|
-
columns: newColumns
|
|
36
|
-
}));
|
|
37
|
-
}, { flush: "sync" });
|
|
38
30
|
return (_ctx, _cache) => {
|
|
39
31
|
return renderSlot(_ctx.$slots, "default", { table: unref(table) });
|
|
40
32
|
};
|
package/dist/plugins/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import * as
|
|
1
|
+
import * as vue2 from "vue";
|
|
2
|
+
import * as _tanstack_vue_table0 from "@tanstack/vue-table";
|
|
3
3
|
import { PaginationState, RowSelectionState, SortingState } from "@tanstack/vue-table";
|
|
4
4
|
|
|
5
5
|
//#region src/plugins/use-pagination-state.d.ts
|
|
@@ -7,11 +7,11 @@ declare function usePaginationState(options?: {
|
|
|
7
7
|
defaultPage?: number;
|
|
8
8
|
defaultPageSize?: number;
|
|
9
9
|
}): {
|
|
10
|
-
page:
|
|
11
|
-
pageSize:
|
|
12
|
-
paginationState:
|
|
13
|
-
paginationOptions:
|
|
14
|
-
getPaginationRowModel: (table:
|
|
10
|
+
page: vue2.Ref<number, number>;
|
|
11
|
+
pageSize: vue2.Ref<number, number>;
|
|
12
|
+
paginationState: vue2.ComputedRef<PaginationState>;
|
|
13
|
+
paginationOptions: vue2.ComputedRef<{
|
|
14
|
+
getPaginationRowModel: (table: _tanstack_vue_table0.Table<unknown>) => () => _tanstack_vue_table0.RowModel<unknown>;
|
|
15
15
|
onPaginationChange: (updater: any) => void;
|
|
16
16
|
state: {
|
|
17
17
|
readonly pagination: PaginationState;
|
|
@@ -24,15 +24,15 @@ declare function usePaginationState(options?: {
|
|
|
24
24
|
//#endregion
|
|
25
25
|
//#region src/plugins/use-table-sorting.d.ts
|
|
26
26
|
declare function useTableSorting(defaultSorting?: SortingState): {
|
|
27
|
-
sorting:
|
|
27
|
+
sorting: vue2.Ref<{
|
|
28
28
|
desc: boolean;
|
|
29
29
|
id: string;
|
|
30
30
|
}[], SortingState | {
|
|
31
31
|
desc: boolean;
|
|
32
32
|
id: string;
|
|
33
33
|
}[]>;
|
|
34
|
-
sortingOptions:
|
|
35
|
-
getSortedRowModel: (table:
|
|
34
|
+
sortingOptions: vue2.ComputedRef<{
|
|
35
|
+
getSortedRowModel: (table: _tanstack_vue_table0.Table<unknown>) => () => _tanstack_vue_table0.RowModel<unknown>;
|
|
36
36
|
onSortingChange: (updater: any) => void;
|
|
37
37
|
state: {
|
|
38
38
|
readonly sorting: {
|
|
@@ -46,15 +46,15 @@ declare function useTableSorting(defaultSorting?: SortingState): {
|
|
|
46
46
|
//#endregion
|
|
47
47
|
//#region src/plugins/use-table-selection.d.ts
|
|
48
48
|
declare function useTableSelection(): {
|
|
49
|
-
rowSelection:
|
|
50
|
-
selectionOptions:
|
|
49
|
+
rowSelection: vue2.Ref<RowSelectionState, RowSelectionState>;
|
|
50
|
+
selectionOptions: vue2.ComputedRef<{
|
|
51
51
|
enableRowSelection: boolean;
|
|
52
52
|
onRowSelectionChange: (updater: any) => void;
|
|
53
53
|
state: {
|
|
54
54
|
readonly rowSelection: RowSelectionState;
|
|
55
55
|
};
|
|
56
56
|
}>;
|
|
57
|
-
selectedCount:
|
|
57
|
+
selectedCount: vue2.ComputedRef<number>;
|
|
58
58
|
clearSelection: () => void;
|
|
59
59
|
};
|
|
60
60
|
//#endregion
|