@kayord/ui 2.1.7 → 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(() => {
@@ -115,20 +97,6 @@
115
97
  }
116
98
  });
117
99
 
118
- // Set URL Page Params
119
- // $effect(() => {
120
- // if (table.options.useURLSearchParams) {
121
- // const params = encodeTableState(table.getState());
122
- // goto(params, {
123
- // replaceState: true,
124
- // keepFocus: true,
125
- // noScroll: true,
126
- // }).catch(() => {
127
- // // Ignore navigation errors in test environments
128
- // });
129
- // }
130
- // });
131
-
132
100
  let end: HTMLElement | undefined = $state();
133
101
  </script>
134
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.7",
4
+ "version": "2.1.8",
5
5
  "exports": {
6
6
  ".": {
7
7
  "types": "./dist/index.d.ts",