@likable-hair/svelte 3.1.52 → 3.2.0
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.
|
@@ -32,33 +32,42 @@ function handleRowsPerPageChange(e) {
|
|
|
32
32
|
handlePaginationChange();
|
|
33
33
|
}
|
|
34
34
|
function handlePaginationChange() {
|
|
35
|
+
let builder = buildFilters();
|
|
35
36
|
dispatch("paginationChange", {
|
|
36
37
|
rowsPerPage,
|
|
37
|
-
page
|
|
38
|
+
page,
|
|
39
|
+
builder
|
|
38
40
|
});
|
|
39
41
|
}
|
|
40
42
|
function handleSearchChange(searchText2) {
|
|
43
|
+
let builder = buildFilters({ searchText: searchText2 });
|
|
44
|
+
dispatch("filtersChange", {
|
|
45
|
+
builder
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
$:
|
|
49
|
+
handleSearchChange(searchText);
|
|
50
|
+
function handleFiltersChange() {
|
|
51
|
+
let builder = buildFilters({ searchText });
|
|
52
|
+
dispatch("filtersChange", {
|
|
53
|
+
builder
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
function buildFilters(params) {
|
|
41
57
|
let converter = new Converter();
|
|
42
58
|
let builder;
|
|
43
59
|
builder = converter.createBuilder({
|
|
44
60
|
filters: filters || []
|
|
45
61
|
});
|
|
46
|
-
if (!!
|
|
62
|
+
if (!!params?.searchText && !!searchBarColumns && searchBarColumns.length > 0) {
|
|
47
63
|
builder.where((b) => {
|
|
48
|
-
b.where(searchBarColumns[0], "ilike", "%" +
|
|
64
|
+
b.where(searchBarColumns[0], "ilike", "%" + params?.searchText + "%");
|
|
49
65
|
for (let i = 1; i < searchBarColumns.length; i += 1) {
|
|
50
|
-
b.orWhere(searchBarColumns[i], "ilike", "%" +
|
|
66
|
+
b.orWhere(searchBarColumns[i], "ilike", "%" + params?.searchText + "%");
|
|
51
67
|
}
|
|
52
68
|
});
|
|
53
69
|
}
|
|
54
|
-
|
|
55
|
-
builder
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
$:
|
|
59
|
-
handleSearchChange(searchText);
|
|
60
|
-
function handleFiltersChange() {
|
|
61
|
-
handleSearchChange(searchText);
|
|
70
|
+
return builder;
|
|
62
71
|
}
|
|
63
72
|
</script>
|
|
64
73
|
|
|
@@ -105,6 +114,7 @@ function handleFiltersChange() {
|
|
|
105
114
|
bind:items
|
|
106
115
|
bind:sortedBy
|
|
107
116
|
bind:sortDirection
|
|
117
|
+
on:sort={handleFiltersChange}
|
|
108
118
|
on:sort
|
|
109
119
|
on:rowClick
|
|
110
120
|
{calculateRowStyles}
|