@kayord/ui 2.1.5 → 2.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -103,12 +103,15 @@
103
103
  // Set url search params
104
104
  $effect(() => {
105
105
  if (table.options.useURLSearchParams) {
106
- const tableState = table.getState();
106
+ const search = table.getState().globalFilter;
107
+ const page = table.getState().pagination.pageIndex;
108
+ const sort = encodeSorting(table.getState());
109
+ const filter = encodeColumnFilters(table.getState());
107
110
  untrack(() => {
108
- params.search = tableState.globalFilter;
109
- params.page = tableState.pagination.pageIndex;
110
- params.sort = encodeSorting(tableState);
111
- params.filter = encodeColumnFilters(tableState);
111
+ params.search = search;
112
+ params.page = page;
113
+ params.sort = sort;
114
+ params.filter = filter;
112
115
  });
113
116
  }
114
117
  });
@@ -25,10 +25,7 @@ export function createShadTable(shadOptions) {
25
25
  // enableFilters: true,
26
26
  enableGlobalFilter: true,
27
27
  onSortingChange: (updater) => {
28
- if (options.state?.sorting) {
29
- options.state.sorting = typeof updater === "function" ? updater(options.state.sorting) : updater;
30
- }
31
- else if (state.sorting) {
28
+ if (state.sorting) {
32
29
  state.sorting = typeof updater === "function" ? updater(state.sorting) : updater;
33
30
  }
34
31
  notifyTableUpdate?.();
@@ -43,49 +40,31 @@ export function createShadTable(shadOptions) {
43
40
  // columnPinning = typeof updater === "function" ? updater(columnPinning) : updater;
44
41
  // },
45
42
  onColumnVisibilityChange: (updater) => {
46
- if (options.state?.columnVisibility) {
47
- options.state.columnVisibility =
48
- typeof updater === "function" ? updater(options.state.columnVisibility) : updater;
49
- }
50
- else if (state.columnVisibility) {
43
+ if (state.columnVisibility) {
51
44
  state.columnVisibility = typeof updater === "function" ? updater(state.columnVisibility) : updater;
52
45
  }
53
46
  notifyTableUpdate?.();
54
47
  },
55
48
  onPaginationChange: (updater) => {
56
- if (options.state?.pagination) {
57
- options.state.pagination = typeof updater === "function" ? updater(options.state.pagination) : updater;
58
- }
59
- else if (state.pagination) {
49
+ if (state.pagination) {
60
50
  state.pagination = typeof updater === "function" ? updater(state.pagination) : updater;
61
51
  }
62
52
  notifyTableUpdate?.();
63
53
  },
64
54
  onColumnFiltersChange: (updater) => {
65
- if (options.state?.columnFilters) {
66
- options.state.columnFilters = typeof updater === "function" ? updater(options.state.columnFilters) : updater;
67
- }
68
- else if (state.columnFilters) {
55
+ if (state.columnFilters) {
69
56
  state.columnFilters = typeof updater === "function" ? updater(state.columnFilters) : updater;
70
57
  }
71
58
  notifyTableUpdate?.();
72
59
  },
73
60
  onRowSelectionChange: (updater) => {
74
- if (options.state?.rowSelection) {
75
- options.state.rowSelection = typeof updater === "function" ? updater(options.state.rowSelection) : updater;
76
- }
77
- else if (state.rowSelection) {
61
+ if (state.rowSelection) {
78
62
  state.rowSelection = typeof updater === "function" ? updater(state.rowSelection) : updater;
79
63
  }
80
64
  notifyTableUpdate?.();
81
65
  },
82
66
  onGlobalFilterChange: (updater) => {
83
- if (options.state?.globalFilter) {
84
- options.state.globalFilter = typeof updater === "function" ? updater(options.state.globalFilter) : updater;
85
- }
86
- else {
87
- state.globalFilter = typeof updater === "function" ? updater(state.globalFilter) : updater;
88
- }
67
+ state.globalFilter = typeof updater === "function" ? updater(state.globalFilter) : updater;
89
68
  notifyTableUpdate?.();
90
69
  },
91
70
  };
@@ -96,8 +75,6 @@ export function createShadTable(shadOptions) {
96
75
  defaultOptions.getPaginationRowModel = undefined;
97
76
  defaultOptions.manualPagination = true;
98
77
  }
99
- // Use default but extend with shadOptions, excluding data to preserve reactivity.
100
- // Using mergeObjects to keep getter in tact
101
78
  const options = mergeObjects(defaultOptions, shadOptions ?? {});
102
79
  const resolvedOptions = mergeObjects({
103
80
  state: {},
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kayord/ui",
3
3
  "private": false,
4
- "version": "2.1.5",
4
+ "version": "2.1.6",
5
5
  "exports": {
6
6
  ".": {
7
7
  "types": "./dist/index.d.ts",
@@ -110,7 +110,7 @@
110
110
  "@eslint/compat": "^2.0.1",
111
111
  "@eslint/js": "^9.39.2",
112
112
  "@internationalized/date": "^3.10.1",
113
- "@lucide/svelte": "^0.563.0",
113
+ "@lucide/svelte": "^0.563.1",
114
114
  "@sveltejs/adapter-auto": "^7.0.0",
115
115
  "@sveltejs/kit": "^2.50.1",
116
116
  "@sveltejs/package": "^2.5.7",