@kayord/ui 2.1.5 → 2.1.7

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.
@@ -90,9 +90,8 @@
90
90
  if (Number(navigation.to?.url.searchParams.get("page") ?? "0") > 0) {
91
91
  if (
92
92
  navigation.from?.url.searchParams.get("sort") != navigation.to?.url.searchParams.get("sort") ||
93
- navigation.from?.url.searchParams.get("globalFilter") !=
94
- navigation.to?.url.searchParams.get("globalFilter") ||
95
- navigation.from?.url.searchParams.get("columnFilters") != navigation.to?.url.searchParams.get("columnFilters")
93
+ navigation.from?.url.searchParams.get("search") != navigation.to?.url.searchParams.get("search") ||
94
+ navigation.from?.url.searchParams.get("filter") != navigation.to?.url.searchParams.get("filter")
96
95
  ) {
97
96
  table.resetPageIndex();
98
97
  }
@@ -103,12 +102,15 @@
103
102
  // Set url search params
104
103
  $effect(() => {
105
104
  if (table.options.useURLSearchParams) {
106
- const tableState = table.getState();
105
+ const search = table.getState().globalFilter;
106
+ const page = table.getState().pagination.pageIndex;
107
+ const sort = encodeSorting(table.getState());
108
+ const filter = encodeColumnFilters(table.getState());
107
109
  untrack(() => {
108
- params.search = tableState.globalFilter;
109
- params.page = tableState.pagination.pageIndex;
110
- params.sort = encodeSorting(tableState);
111
- params.filter = encodeColumnFilters(tableState);
110
+ params.search = search;
111
+ params.page = page;
112
+ params.sort = sort;
113
+ params.filter = filter;
112
114
  });
113
115
  }
114
116
  });
@@ -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.7",
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",
@@ -136,7 +136,7 @@
136
136
  "prettier-plugin-tailwindcss": "^0.7.2",
137
137
  "publint": "^0.3.17",
138
138
  "runed": "^0.37.1",
139
- "svelte": "5.48.0",
139
+ "svelte": "5.48.1",
140
140
  "svelte-check": "^4.3.5",
141
141
  "svelte-sonner": "^1.0.7",
142
142
  "sveltekit-superforms": "^2.29.1",