Skip to content

feat: table - export searchTerm #1561

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/lib/table/Table.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
inputClass?: string;
classInput?: string;
classSvgDiv?: string;
searchTerm?: string;
}

export let divClass: $$Props['divClass'] = 'relative overflow-x-auto';
Expand All @@ -42,8 +43,8 @@
export let inputClass: $$Props['inputClass'] = 'bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-80 p-2.5 ps-10 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500';
export let classInput: $$Props['classInput'] = '';
export let classSvgDiv: $$Props['classSvgDiv'] = '';
export let searchTerm: $$Props['searchTerm'] = '';

let searchTerm = '';
let inputCls = twMerge(inputClass, classInput);
let svgDivCls = twMerge(svgDivClass, classSvgDiv);

Expand All @@ -68,7 +69,7 @@
const filterStore = writable(filter);
setContext('searchTerm', searchTermStore);
setContext('filter', filterStore);
$: searchTermStore.set(searchTerm);
$: searchTermStore.set(searchTerm ? searchTerm : '');
$: {
if (filter) filterStore.set(filter);
}
Expand Down Expand Up @@ -120,4 +121,5 @@
@prop export let inputClass: $$Props['inputClass'] = 'bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-80 p-2.5 ps-10 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500';
@prop export let classInput: $$Props['classInput'] = '';
@prop export let classSvgDiv: $$Props['classSvgDiv'] = '';
@prop export let searchTerm: $$Props['searchTerm'] = '';
-->
3 changes: 2 additions & 1 deletion src/routes/component-data/Table.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
["svgClass?", "string", "'w-5 h-5 text-gray-500 dark:text-gray-400'"],
["inputClass?", "string", "'bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-80 p-2.5 ps-10 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500'"],
["classInput?", "string", "''"],
["classSvgDiv?", "string", "''"]
["classSvgDiv?", "string", "''"],
["searchTerm?", "string", "''"]
]
}