@kayord/ui 2.1.6 → 2.1.8

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.
@@ -11,16 +11,8 @@
11
11
  import { TableStore } from "./table.svelte";
12
12
  import DataTableHeader from "./DataTableHeader.svelte";
13
13
  import DataTableFooter from "./DataTableFooter.svelte";
14
- import { beforeNavigate, goto } from "$app/navigation";
15
- import {
16
- decodeColumnFilters,
17
- decodeGlobalFilter,
18
- decodePageIndex,
19
- decodeSorting,
20
- encodeColumnFilters,
21
- encodeSorting,
22
- encodeTableState,
23
- } from "./table-search-params";
14
+ import { beforeNavigate } from "$app/navigation";
15
+ import { decodeColumnFilters, decodeSorting, encodeColumnFilters, encodeSorting } from "./table-search-params";
24
16
  import { useSearchParams } from "runed/kit";
25
17
  import { defaultSearchParamSchema } from "./types";
26
18
  import DataTableView from "./DataTableView.svelte";
@@ -63,16 +55,6 @@
63
55
  // svelte-ignore state_referenced_locally
64
56
  const isPaginationEnabled = table.options.getPaginationRowModel !== undefined;
65
57
 
66
- // Load Default Values from Page Params
67
- // onMount(() => {
68
- // if (table.options.useURLSearchParams) {
69
- // table.setPageIndex(decodePageIndex());
70
- // table.setSorting(decodeSorting() ?? []);
71
- // table.setGlobalFilter(decodeGlobalFilter());
72
- // table.setColumnFilters(decodeColumnFilters() ?? []);
73
- // }
74
- // });
75
-
76
58
  const params = useSearchParams(defaultSearchParamSchema, { pushHistory: false });
77
59
  // Load current url search params
78
60
  onMount(() => {
@@ -90,9 +72,8 @@
90
72
  if (Number(navigation.to?.url.searchParams.get("page") ?? "0") > 0) {
91
73
  if (
92
74
  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")
75
+ navigation.from?.url.searchParams.get("search") != navigation.to?.url.searchParams.get("search") ||
76
+ navigation.from?.url.searchParams.get("filter") != navigation.to?.url.searchParams.get("filter")
96
77
  ) {
97
78
  table.resetPageIndex();
98
79
  }
@@ -116,20 +97,6 @@
116
97
  }
117
98
  });
118
99
 
119
- // Set URL Page Params
120
- // $effect(() => {
121
- // if (table.options.useURLSearchParams) {
122
- // const params = encodeTableState(table.getState());
123
- // goto(params, {
124
- // replaceState: true,
125
- // keepFocus: true,
126
- // noScroll: true,
127
- // }).catch(() => {
128
- // // Ignore navigation errors in test environments
129
- // });
130
- // }
131
- // });
132
-
133
100
  let end: HTMLElement | undefined = $state();
134
101
  </script>
135
102
 
@@ -18,7 +18,7 @@ export const encodeGlobalFilter = (state) => {
18
18
  return state.globalFilter;
19
19
  };
20
20
  export const decodeGlobalFilter = () => {
21
- const globalFilter = page.url.searchParams.get("globalFilter");
21
+ const globalFilter = page.url.searchParams.get("search");
22
22
  return globalFilter != null ? globalFilter : undefined;
23
23
  };
24
24
  export const encodePageIndex = (state) => {
@@ -34,7 +34,7 @@ export const encodeColumnFilters = (state) => {
34
34
  };
35
35
  export const decodeColumnFilters = () => {
36
36
  return page.url.searchParams
37
- .get("columnFilters")
37
+ .get("filter")
38
38
  ?.split(",")
39
39
  .map((v) => {
40
40
  const [id, stringValue] = v.split(".");
@@ -75,13 +75,13 @@ export const encodeTableState = (state, options, searchParams) => {
75
75
  searchParams.set("page", encodePageIndex(state));
76
76
  }
77
77
  if (options.globalFilter && state.globalFilter?.length > 0) {
78
- searchParams.set("globalFilter", encodeGlobalFilter(state));
78
+ searchParams.set("search", encodeGlobalFilter(state));
79
79
  }
80
80
  if (options.sorting && (state.sorting?.length ?? 0) > 0) {
81
81
  searchParams.set("sort", encodeSorting(state));
82
82
  }
83
83
  if (options.columnFilter && (state.columnFilters?.length ?? 0) > 0) {
84
- searchParams.set("columnFilters", encodeColumnFilters(state));
84
+ searchParams.set("filter", encodeColumnFilters(state));
85
85
  }
86
86
  return `?${searchParams.toString()}`;
87
87
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kayord/ui",
3
3
  "private": false,
4
- "version": "2.1.6",
4
+ "version": "2.1.8",
5
5
  "exports": {
6
6
  ".": {
7
7
  "types": "./dist/index.d.ts",
@@ -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",