@likable-hair/svelte 3.2.12 → 3.3.1
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.
- package/dist/components/composed/common/MenuOrDrawer.svelte +2 -1
- package/dist/components/composed/common/MenuOrDrawer.svelte.d.ts +1 -0
- package/dist/components/composed/common/QuickActions.css +12 -0
- package/dist/components/composed/common/QuickActions.svelte +362 -0
- package/dist/components/composed/common/QuickActions.svelte.d.ts +37 -0
- package/dist/components/composed/forms/ConfirmOrCancelButtons.svelte +5 -0
- package/dist/components/composed/forms/CountriesAutocomplete.svelte +1 -2
- package/dist/components/composed/forms/CountriesAutocomplete.svelte.d.ts +1 -0
- package/dist/components/composed/forms/LabelAndSelect.svelte +66 -0
- package/dist/components/composed/forms/LabelAndSelect.svelte.d.ts +38 -0
- package/dist/components/composed/forms/LabelAndTextField.svelte +87 -0
- package/dist/components/composed/forms/LabelAndTextField.svelte.d.ts +44 -0
- package/dist/components/composed/list/DynamicTable.css +18 -0
- package/dist/components/composed/list/DynamicTable.svelte +1717 -0
- package/dist/components/composed/list/DynamicTable.svelte.d.ts +406 -0
- package/dist/components/composed/search/DynamicFilters.svelte +182 -0
- package/dist/components/composed/search/DynamicFilters.svelte.d.ts +29 -0
- package/dist/components/composed/search/FilterEditor.svelte +12 -8
- package/dist/components/composed/search/Filters.svelte +18 -3
- package/dist/components/composed/search/Filters.svelte.d.ts +3 -2
- package/dist/components/composed/search/MobileFilterEditor.svelte +5 -5
- package/dist/components/simple/common/Divider.css +3 -0
- package/dist/components/simple/common/Divider.svelte +13 -0
- package/dist/components/simple/common/Divider.svelte.d.ts +22 -0
- package/dist/components/simple/common/InfiniteScroll.svelte +37 -0
- package/dist/components/simple/common/InfiniteScroll.svelte.d.ts +21 -0
- package/dist/components/simple/common/VerticalDraggableList.svelte +52 -0
- package/dist/components/simple/common/VerticalDraggableList.svelte.d.ts +34 -0
- package/dist/components/simple/forms/Checkbox.svelte +24 -1
- package/dist/components/simple/forms/Checkbox.svelte.d.ts +3 -1
- package/dist/components/simple/forms/Select.css +14 -0
- package/dist/components/simple/forms/Select.svelte +92 -0
- package/dist/components/simple/forms/Select.svelte.d.ts +28 -0
- package/dist/components/simple/forms/Switch.css +14 -0
- package/dist/components/simple/forms/Switch.svelte +85 -72
- package/dist/components/simple/forms/Switch.svelte.d.ts +7 -10
- package/dist/index.d.ts +7 -0
- package/dist/index.js +7 -0
- package/dist/utils/filters/filters.d.ts +11 -7
- package/dist/utils/filters/filters.js +15 -3
- package/dist/utils/filters/quickFilters.d.ts +109 -0
- package/dist/utils/filters/quickFilters.js +1 -0
- package/package.json +3 -2
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import { FilterBuilder } from "../../..";
|
|
3
|
+
import { type ComponentProps } from "svelte";
|
|
4
|
+
import Filters from "../search/Filters.svelte";
|
|
5
|
+
import type { Filter } from "../../../utils/filters/filters";
|
|
6
|
+
import { type Action } from "../common/QuickActions.svelte";
|
|
7
|
+
import './DynamicTable.css';
|
|
8
|
+
import type { QuickFilter } from "../../../utils/filters/quickFilters";
|
|
9
|
+
declare const __propDef: {
|
|
10
|
+
props: {
|
|
11
|
+
class?: {
|
|
12
|
+
container?: string | undefined;
|
|
13
|
+
header?: string | undefined;
|
|
14
|
+
row?: string | undefined;
|
|
15
|
+
cell?: string | undefined;
|
|
16
|
+
} | undefined;
|
|
17
|
+
headers?: (import("../../simple/lists/SimpleTable.svelte").Header & {
|
|
18
|
+
cellEditorInfo?: {
|
|
19
|
+
title: string;
|
|
20
|
+
description: string;
|
|
21
|
+
type: {
|
|
22
|
+
key: "string";
|
|
23
|
+
} | {
|
|
24
|
+
key: "number";
|
|
25
|
+
params?: {
|
|
26
|
+
min?: number | undefined;
|
|
27
|
+
max?: number | undefined;
|
|
28
|
+
} | undefined;
|
|
29
|
+
} | {
|
|
30
|
+
key: "date";
|
|
31
|
+
} | {
|
|
32
|
+
key: "select";
|
|
33
|
+
params: {
|
|
34
|
+
options: {
|
|
35
|
+
icon?: string;
|
|
36
|
+
value: string | number | undefined;
|
|
37
|
+
id?: number | undefined;
|
|
38
|
+
text: string;
|
|
39
|
+
}[];
|
|
40
|
+
};
|
|
41
|
+
} | {
|
|
42
|
+
key: "boolean";
|
|
43
|
+
};
|
|
44
|
+
column: string;
|
|
45
|
+
info?: string | undefined;
|
|
46
|
+
} | undefined;
|
|
47
|
+
info?: string | undefined;
|
|
48
|
+
})[] | undefined;
|
|
49
|
+
headersToShowInTable?: (import("../../simple/lists/SimpleTable.svelte").Header & {
|
|
50
|
+
cellEditorInfo?: {
|
|
51
|
+
title: string;
|
|
52
|
+
description: string;
|
|
53
|
+
type: {
|
|
54
|
+
key: "string";
|
|
55
|
+
} | {
|
|
56
|
+
key: "number";
|
|
57
|
+
params?: {
|
|
58
|
+
min?: number | undefined;
|
|
59
|
+
max?: number | undefined;
|
|
60
|
+
} | undefined;
|
|
61
|
+
} | {
|
|
62
|
+
key: "date";
|
|
63
|
+
} | {
|
|
64
|
+
key: "select";
|
|
65
|
+
params: {
|
|
66
|
+
options: {
|
|
67
|
+
icon?: string;
|
|
68
|
+
value: string | number | undefined;
|
|
69
|
+
id?: number | undefined;
|
|
70
|
+
text: string;
|
|
71
|
+
}[];
|
|
72
|
+
};
|
|
73
|
+
} | {
|
|
74
|
+
key: "boolean";
|
|
75
|
+
};
|
|
76
|
+
column: string;
|
|
77
|
+
info?: string | undefined;
|
|
78
|
+
} | undefined;
|
|
79
|
+
info?: string | undefined;
|
|
80
|
+
})[] | undefined;
|
|
81
|
+
subHeaders?: (import("../../simple/lists/SimpleTable.svelte").Header & {
|
|
82
|
+
cellEditorInfo?: {
|
|
83
|
+
title: string;
|
|
84
|
+
description: string;
|
|
85
|
+
type: {
|
|
86
|
+
key: "string";
|
|
87
|
+
} | {
|
|
88
|
+
key: "number";
|
|
89
|
+
params?: {
|
|
90
|
+
min?: number | undefined;
|
|
91
|
+
max?: number | undefined;
|
|
92
|
+
} | undefined;
|
|
93
|
+
} | {
|
|
94
|
+
key: "date";
|
|
95
|
+
} | {
|
|
96
|
+
key: "select";
|
|
97
|
+
params: {
|
|
98
|
+
options: {
|
|
99
|
+
icon?: string;
|
|
100
|
+
value: string | number | undefined;
|
|
101
|
+
id?: number | undefined;
|
|
102
|
+
text: string;
|
|
103
|
+
}[];
|
|
104
|
+
};
|
|
105
|
+
} | {
|
|
106
|
+
key: "boolean";
|
|
107
|
+
};
|
|
108
|
+
column: string;
|
|
109
|
+
info?: string | undefined;
|
|
110
|
+
} | undefined;
|
|
111
|
+
info?: string | undefined;
|
|
112
|
+
})[] | undefined;
|
|
113
|
+
customizeHeaders?: boolean | undefined;
|
|
114
|
+
rows?: {
|
|
115
|
+
item: {
|
|
116
|
+
[key: string]: any;
|
|
117
|
+
disableEdit?: boolean | undefined;
|
|
118
|
+
rowDisableBackgroundColor?: string | undefined;
|
|
119
|
+
};
|
|
120
|
+
subItems: {
|
|
121
|
+
[key: string]: any;
|
|
122
|
+
disableEdit?: boolean | undefined;
|
|
123
|
+
rowDisableBackgroundColor?: string | undefined;
|
|
124
|
+
}[];
|
|
125
|
+
}[] | undefined;
|
|
126
|
+
sortedBy?: string | undefined;
|
|
127
|
+
sortDirection?: "desc" | "asc" | undefined;
|
|
128
|
+
cellEdit?: boolean | undefined;
|
|
129
|
+
noItemsText?: string | undefined;
|
|
130
|
+
showSelect?: boolean | undefined;
|
|
131
|
+
showSelectContainer?: boolean | undefined;
|
|
132
|
+
selectMode?: "multiple" | "single" | undefined;
|
|
133
|
+
selectedItems?: {
|
|
134
|
+
[key: string]: any;
|
|
135
|
+
disableEdit?: boolean | undefined;
|
|
136
|
+
rowDisableBackgroundColor?: string | undefined;
|
|
137
|
+
}[] | undefined;
|
|
138
|
+
showExpand?: boolean | undefined;
|
|
139
|
+
loading?: boolean | undefined;
|
|
140
|
+
disabled?: boolean | undefined;
|
|
141
|
+
filters?: ComponentProps<Filters>["filters"];
|
|
142
|
+
searchBarColumns?: string[] | undefined;
|
|
143
|
+
searchBarVisible?: boolean | undefined;
|
|
144
|
+
searchBarPlaceholder?: string | undefined;
|
|
145
|
+
filtersVisible?: boolean | undefined;
|
|
146
|
+
quickFiltersVisible?: boolean | undefined;
|
|
147
|
+
lang?: "it" | "en" | undefined;
|
|
148
|
+
editFilterMode?: "one-edit" | "multi-edit" | undefined;
|
|
149
|
+
showActiveFilters?: boolean | undefined;
|
|
150
|
+
quickFilters?: QuickFilter[] | undefined;
|
|
151
|
+
actionsForSelectedItems?: Action[] | undefined;
|
|
152
|
+
hasMoreToLoad?: boolean | undefined;
|
|
153
|
+
totalRows?: number | undefined;
|
|
154
|
+
};
|
|
155
|
+
events: {
|
|
156
|
+
click: MouseEvent;
|
|
157
|
+
sort: CustomEvent<{
|
|
158
|
+
sortedBy: string | undefined;
|
|
159
|
+
sortDirection: string;
|
|
160
|
+
}>;
|
|
161
|
+
rowClick: CustomEvent<{
|
|
162
|
+
item: {
|
|
163
|
+
[key: string]: any;
|
|
164
|
+
disableEdit?: boolean | undefined;
|
|
165
|
+
rowDisableBackgroundColor?: string | undefined;
|
|
166
|
+
};
|
|
167
|
+
}>;
|
|
168
|
+
cellClick: CustomEvent<{
|
|
169
|
+
item: {
|
|
170
|
+
[key: string]: any;
|
|
171
|
+
disableEdit?: boolean | undefined;
|
|
172
|
+
rowDisableBackgroundColor?: string | undefined;
|
|
173
|
+
};
|
|
174
|
+
}>;
|
|
175
|
+
saveCellEdit: CustomEvent<{
|
|
176
|
+
item: any;
|
|
177
|
+
}>;
|
|
178
|
+
saveHeadersToShow: CustomEvent<{
|
|
179
|
+
headersToShow: {
|
|
180
|
+
id: string;
|
|
181
|
+
name: string;
|
|
182
|
+
}[];
|
|
183
|
+
}>;
|
|
184
|
+
filtersChange: CustomEvent<{
|
|
185
|
+
builder: FilterBuilder;
|
|
186
|
+
}>;
|
|
187
|
+
fetchData: CustomEvent<{}>;
|
|
188
|
+
removeFilter: CustomEvent<{
|
|
189
|
+
filter: Filter;
|
|
190
|
+
}>;
|
|
191
|
+
removeAllFilters: CustomEvent<{}>;
|
|
192
|
+
removeCustomQuickFilter: CustomEvent<{
|
|
193
|
+
quickFilter: QuickFilter;
|
|
194
|
+
}>;
|
|
195
|
+
applyCustomQuickFilter: CustomEvent<{
|
|
196
|
+
quickFilter: QuickFilter;
|
|
197
|
+
setQuickFilterValue: (quickFilter: QuickFilter, value?: any) => void;
|
|
198
|
+
}>;
|
|
199
|
+
} & {
|
|
200
|
+
[evt: string]: CustomEvent<any>;
|
|
201
|
+
};
|
|
202
|
+
slots: {
|
|
203
|
+
'search-bar': {
|
|
204
|
+
handleSearchChange: (searchText: string | undefined) => void;
|
|
205
|
+
};
|
|
206
|
+
'filter-append': {};
|
|
207
|
+
'custom-filter-chip': {
|
|
208
|
+
filter: Filter;
|
|
209
|
+
};
|
|
210
|
+
'custom-filter': {
|
|
211
|
+
filter: Filter | undefined;
|
|
212
|
+
updateMultiFilterValues: (filterName: string, newValue: any, newValid: boolean, mode?: "equal" | "like" | "ilike" | "contains" | "greater" | "lower" | "between" | "different" | undefined) => void;
|
|
213
|
+
mAndDown: boolean;
|
|
214
|
+
};
|
|
215
|
+
header: {
|
|
216
|
+
subHeader: import("../../simple/lists/SimpleTable.svelte").Header & {
|
|
217
|
+
cellEditorInfo?: {
|
|
218
|
+
title: string;
|
|
219
|
+
description: string;
|
|
220
|
+
type: {
|
|
221
|
+
key: "string";
|
|
222
|
+
} | {
|
|
223
|
+
key: "number";
|
|
224
|
+
params?: {
|
|
225
|
+
min?: number | undefined;
|
|
226
|
+
max?: number | undefined;
|
|
227
|
+
} | undefined;
|
|
228
|
+
} | {
|
|
229
|
+
key: "date";
|
|
230
|
+
} | {
|
|
231
|
+
key: "select";
|
|
232
|
+
params: {
|
|
233
|
+
options: {
|
|
234
|
+
icon?: string;
|
|
235
|
+
value: string | number | undefined;
|
|
236
|
+
id?: number | undefined;
|
|
237
|
+
text: string;
|
|
238
|
+
}[];
|
|
239
|
+
};
|
|
240
|
+
} | {
|
|
241
|
+
key: "boolean";
|
|
242
|
+
};
|
|
243
|
+
column: string;
|
|
244
|
+
info?: string | undefined;
|
|
245
|
+
} | undefined;
|
|
246
|
+
info?: string | undefined;
|
|
247
|
+
};
|
|
248
|
+
};
|
|
249
|
+
headerLabel: {};
|
|
250
|
+
append: {
|
|
251
|
+
index: any;
|
|
252
|
+
row: {
|
|
253
|
+
item: {
|
|
254
|
+
[key: string]: any;
|
|
255
|
+
disableEdit?: boolean | undefined;
|
|
256
|
+
rowDisableBackgroundColor?: string | undefined;
|
|
257
|
+
};
|
|
258
|
+
subItems: {
|
|
259
|
+
[key: string]: any;
|
|
260
|
+
disableEdit?: boolean | undefined;
|
|
261
|
+
rowDisableBackgroundColor?: string | undefined;
|
|
262
|
+
}[];
|
|
263
|
+
};
|
|
264
|
+
};
|
|
265
|
+
custom: {
|
|
266
|
+
index: any;
|
|
267
|
+
columnIndex: any;
|
|
268
|
+
header: import("../../simple/lists/SimpleTable.svelte").Header & {
|
|
269
|
+
cellEditorInfo?: {
|
|
270
|
+
title: string;
|
|
271
|
+
description: string;
|
|
272
|
+
type: {
|
|
273
|
+
key: "string";
|
|
274
|
+
} | {
|
|
275
|
+
key: "number";
|
|
276
|
+
params?: {
|
|
277
|
+
min?: number | undefined;
|
|
278
|
+
max?: number | undefined;
|
|
279
|
+
} | undefined;
|
|
280
|
+
} | {
|
|
281
|
+
key: "date";
|
|
282
|
+
} | {
|
|
283
|
+
key: "select";
|
|
284
|
+
params: {
|
|
285
|
+
options: {
|
|
286
|
+
icon?: string;
|
|
287
|
+
value: string | number | undefined;
|
|
288
|
+
id?: number | undefined;
|
|
289
|
+
text: string;
|
|
290
|
+
}[];
|
|
291
|
+
};
|
|
292
|
+
} | {
|
|
293
|
+
key: "boolean";
|
|
294
|
+
};
|
|
295
|
+
column: string;
|
|
296
|
+
info?: string | undefined;
|
|
297
|
+
} | undefined;
|
|
298
|
+
info?: string | undefined;
|
|
299
|
+
};
|
|
300
|
+
row: {
|
|
301
|
+
item: {
|
|
302
|
+
[key: string]: any;
|
|
303
|
+
disableEdit?: boolean | undefined;
|
|
304
|
+
rowDisableBackgroundColor?: string | undefined;
|
|
305
|
+
};
|
|
306
|
+
subItems: {
|
|
307
|
+
[key: string]: any;
|
|
308
|
+
disableEdit?: boolean | undefined;
|
|
309
|
+
rowDisableBackgroundColor?: string | undefined;
|
|
310
|
+
}[];
|
|
311
|
+
};
|
|
312
|
+
};
|
|
313
|
+
rowActions: {
|
|
314
|
+
index: any;
|
|
315
|
+
row: {
|
|
316
|
+
item: {
|
|
317
|
+
[key: string]: any;
|
|
318
|
+
disableEdit?: boolean | undefined;
|
|
319
|
+
rowDisableBackgroundColor?: string | undefined;
|
|
320
|
+
};
|
|
321
|
+
subItems: {
|
|
322
|
+
[key: string]: any;
|
|
323
|
+
disableEdit?: boolean | undefined;
|
|
324
|
+
rowDisableBackgroundColor?: string | undefined;
|
|
325
|
+
}[];
|
|
326
|
+
};
|
|
327
|
+
};
|
|
328
|
+
subAppend: {
|
|
329
|
+
index: any;
|
|
330
|
+
subItem: {
|
|
331
|
+
[key: string]: any;
|
|
332
|
+
disableEdit?: boolean | undefined;
|
|
333
|
+
rowDisableBackgroundColor?: string | undefined;
|
|
334
|
+
};
|
|
335
|
+
};
|
|
336
|
+
'custom-subheader': {
|
|
337
|
+
index: any;
|
|
338
|
+
columnIndex: any;
|
|
339
|
+
subHeader: import("../../simple/lists/SimpleTable.svelte").Header & {
|
|
340
|
+
cellEditorInfo?: {
|
|
341
|
+
title: string;
|
|
342
|
+
description: string;
|
|
343
|
+
type: {
|
|
344
|
+
key: "string";
|
|
345
|
+
} | {
|
|
346
|
+
key: "number";
|
|
347
|
+
params?: {
|
|
348
|
+
min?: number | undefined;
|
|
349
|
+
max?: number | undefined;
|
|
350
|
+
} | undefined;
|
|
351
|
+
} | {
|
|
352
|
+
key: "date";
|
|
353
|
+
} | {
|
|
354
|
+
key: "select";
|
|
355
|
+
params: {
|
|
356
|
+
options: {
|
|
357
|
+
icon?: string;
|
|
358
|
+
value: string | number | undefined;
|
|
359
|
+
id?: number | undefined;
|
|
360
|
+
text: string;
|
|
361
|
+
}[];
|
|
362
|
+
};
|
|
363
|
+
} | {
|
|
364
|
+
key: "boolean";
|
|
365
|
+
};
|
|
366
|
+
column: string;
|
|
367
|
+
info?: string | undefined;
|
|
368
|
+
} | undefined;
|
|
369
|
+
info?: string | undefined;
|
|
370
|
+
};
|
|
371
|
+
subItem: {
|
|
372
|
+
[key: string]: any;
|
|
373
|
+
disableEdit?: boolean | undefined;
|
|
374
|
+
rowDisableBackgroundColor?: string | undefined;
|
|
375
|
+
};
|
|
376
|
+
};
|
|
377
|
+
subRowActions: {
|
|
378
|
+
index: any;
|
|
379
|
+
subItem: {
|
|
380
|
+
[key: string]: any;
|
|
381
|
+
disableEdit?: boolean | undefined;
|
|
382
|
+
rowDisableBackgroundColor?: string | undefined;
|
|
383
|
+
};
|
|
384
|
+
};
|
|
385
|
+
'custom-quick-filter': {
|
|
386
|
+
quickFilter: QuickFilter;
|
|
387
|
+
setQuickFilterMissingValue: (quickFilter: QuickFilter) => void;
|
|
388
|
+
};
|
|
389
|
+
selection: {
|
|
390
|
+
selection: import("../../simple/forms/Autocomplete.svelte").Item;
|
|
391
|
+
unselect: (item: import("../../simple/forms/Autocomplete.svelte").Item) => void;
|
|
392
|
+
};
|
|
393
|
+
'chip-label': {
|
|
394
|
+
selection: import("../../simple/forms/Autocomplete.svelte").Item;
|
|
395
|
+
};
|
|
396
|
+
'item-label': {
|
|
397
|
+
item: import("../../simple/forms/Autocomplete.svelte").Item;
|
|
398
|
+
};
|
|
399
|
+
};
|
|
400
|
+
};
|
|
401
|
+
export type DynamicTableProps = typeof __propDef.props;
|
|
402
|
+
export type DynamicTableEvents = typeof __propDef.events;
|
|
403
|
+
export type DynamicTableSlots = typeof __propDef.slots;
|
|
404
|
+
export default class DynamicTable extends SvelteComponent<DynamicTableProps, DynamicTableEvents, DynamicTableSlots> {
|
|
405
|
+
}
|
|
406
|
+
export {};
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
<script>import { FilterEditor, Icon } from "../../..";
|
|
2
|
+
import { createEventDispatcher } from "svelte";
|
|
3
|
+
export let filters = [], lang = "en", mAndDown = false;
|
|
4
|
+
let selectedFilter;
|
|
5
|
+
let tmpFilters = filters.reduce((acc, f) => {
|
|
6
|
+
if (f.active) {
|
|
7
|
+
acc[f.name] = f;
|
|
8
|
+
}
|
|
9
|
+
return acc;
|
|
10
|
+
}, {});
|
|
11
|
+
const dispatch = createEventDispatcher();
|
|
12
|
+
let activeFilter = Object.values(tmpFilters).reduce((count, filter) => {
|
|
13
|
+
if (filter.value !== void 0 || filter.from !== void 0 || filter.to !== void 0 || filter.values !== void 0 && filter.values.length > 0)
|
|
14
|
+
count++;
|
|
15
|
+
return count;
|
|
16
|
+
}, 0);
|
|
17
|
+
let labelsMapper = {
|
|
18
|
+
equal: { extended: "equal to", short: "equal" },
|
|
19
|
+
like: { short: "includes" },
|
|
20
|
+
ilike: { short: "includes" },
|
|
21
|
+
contains: { short: "contains" },
|
|
22
|
+
greater: { short: "greater", extended: "greater than" },
|
|
23
|
+
lower: { short: "lower", extended: "lower than" },
|
|
24
|
+
between: { short: "between", extended: "is between" },
|
|
25
|
+
different: { short: "different", extended: "different from" }
|
|
26
|
+
};
|
|
27
|
+
function selectFilter(filter) {
|
|
28
|
+
selectedFilter = filter === selectedFilter ? void 0 : filter;
|
|
29
|
+
}
|
|
30
|
+
function handleKeyPress(event, filter) {
|
|
31
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
32
|
+
selectFilter(filter);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function clearFilters() {
|
|
36
|
+
tmpFilters = {};
|
|
37
|
+
dispatch("removeAllFilters", {});
|
|
38
|
+
}
|
|
39
|
+
function handleFilterChange() {
|
|
40
|
+
if (!!selectedFilter) {
|
|
41
|
+
dispatch("change", { filter: tmpFilters[selectedFilter.name] });
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<div class="custom-filters-container">
|
|
47
|
+
<div class="filters-selection">
|
|
48
|
+
|
|
49
|
+
{#if activeFilter > 0}
|
|
50
|
+
<div class="filter-info">
|
|
51
|
+
{activeFilter} applied
|
|
52
|
+
<button class="clear-button" on:click={clearFilters}>✕</button>
|
|
53
|
+
</div>
|
|
54
|
+
{/if}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
{#each filters as filter}
|
|
58
|
+
<div
|
|
59
|
+
tabindex="0"
|
|
60
|
+
role="button"
|
|
61
|
+
class="filters-selection-item"
|
|
62
|
+
class:selected={filter === selectedFilter}
|
|
63
|
+
on:click={() => selectFilter(filter)}
|
|
64
|
+
on:keydown={(event) => handleKeyPress(event, filter)}
|
|
65
|
+
aria-pressed={filter === selectedFilter}
|
|
66
|
+
>
|
|
67
|
+
<div class="filters-selection-title">
|
|
68
|
+
{filter.label}
|
|
69
|
+
<Icon name="mdi-chevron-right-circle-outline" />
|
|
70
|
+
</div>
|
|
71
|
+
</div>
|
|
72
|
+
{/each}
|
|
73
|
+
</div>
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
<div class="filters-content">
|
|
77
|
+
{#if selectedFilter}
|
|
78
|
+
<div class="filters-content-box">
|
|
79
|
+
<h2>{selectedFilter.label}</h2>
|
|
80
|
+
<FilterEditor
|
|
81
|
+
bind:filter={selectedFilter}
|
|
82
|
+
{lang}
|
|
83
|
+
{labelsMapper}
|
|
84
|
+
editFilterMode="one-edit"
|
|
85
|
+
bind:tmpFilter={tmpFilters[selectedFilter.name]}
|
|
86
|
+
mobile={mAndDown}
|
|
87
|
+
on:change={handleFilterChange}
|
|
88
|
+
--simple-textfield-border-radius="5px"
|
|
89
|
+
--chip-default-color="rgb(var(--global-color-primary-foreground))"
|
|
90
|
+
>
|
|
91
|
+
<svelte:fragment slot="custom" let:filter>
|
|
92
|
+
<slot name="custom" {filter} {mAndDown}></slot>
|
|
93
|
+
</svelte:fragment>
|
|
94
|
+
</FilterEditor>
|
|
95
|
+
</div>
|
|
96
|
+
{:else}
|
|
97
|
+
<div class="filters-content-box">
|
|
98
|
+
<p>Please select a filter to display content.</p>
|
|
99
|
+
</div>
|
|
100
|
+
{/if}
|
|
101
|
+
</div>
|
|
102
|
+
</div>
|
|
103
|
+
|
|
104
|
+
<style>
|
|
105
|
+
|
|
106
|
+
.custom-filters-container {
|
|
107
|
+
display: flex;
|
|
108
|
+
height: 70vh;
|
|
109
|
+
overflow-y: scroll;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.filters-selection {
|
|
113
|
+
width: 40%;
|
|
114
|
+
padding: 1rem;
|
|
115
|
+
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.filters-selection-item {
|
|
119
|
+
margin-bottom: 0.5rem;
|
|
120
|
+
padding: 0.5rem;
|
|
121
|
+
cursor: pointer;
|
|
122
|
+
border: 1px solid transparent;
|
|
123
|
+
transition: background-color 0.3s, border 0.3s;
|
|
124
|
+
border-radius: 5px;
|
|
125
|
+
|
|
126
|
+
}
|
|
127
|
+
.filters-selection-title{
|
|
128
|
+
display: flex;
|
|
129
|
+
flex-direction: row;
|
|
130
|
+
justify-content: space-between;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.filters-selection-item.selected {
|
|
134
|
+
border: 1px solid rgb(var(--global-color-primary-500));
|
|
135
|
+
background-color: rgb(var(--global-color-background-500));
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.filters-content {
|
|
139
|
+
width: 60%;
|
|
140
|
+
}
|
|
141
|
+
.filters-content-box {
|
|
142
|
+
padding: 1rem;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.filters-content-box>h2 {
|
|
146
|
+
font-size: larger;
|
|
147
|
+
text-align: center;
|
|
148
|
+
font-weight: bold;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.filter-info {
|
|
152
|
+
display: inline-flex;
|
|
153
|
+
align-items: center;
|
|
154
|
+
padding: 0.25rem 0.5rem;
|
|
155
|
+
background-color: rgb(var(--global-color-background-700));
|
|
156
|
+
color: rgb(var(--global-color-primary-600));
|
|
157
|
+
border-radius: 1rem;
|
|
158
|
+
font-weight: bold;
|
|
159
|
+
font-size: 0.9rem;
|
|
160
|
+
margin-bottom: 10px;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.clear-button {
|
|
164
|
+
display: inline-flex;
|
|
165
|
+
justify-content: center;
|
|
166
|
+
align-items: center;
|
|
167
|
+
width: 1rem;
|
|
168
|
+
height: 1rem;
|
|
169
|
+
margin-left: 0.5rem;
|
|
170
|
+
border-radius: 50%;
|
|
171
|
+
background-color: rgb(var(--global-color-background-700));
|
|
172
|
+
color: rgb(var(--global-color-primary-600));
|
|
173
|
+
font-weight: bold;
|
|
174
|
+
cursor: pointer;
|
|
175
|
+
font-size: 0.8rem;
|
|
176
|
+
border: none;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.clear-button:hover {
|
|
180
|
+
background-color: rgb(var(--global-color-background-500));
|
|
181
|
+
}
|
|
182
|
+
</style>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { Filter } from "../../../utils/filters/filters";
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
filters?: Filter[] | undefined;
|
|
6
|
+
lang?: "it" | "en" | undefined;
|
|
7
|
+
mAndDown?: boolean | undefined;
|
|
8
|
+
};
|
|
9
|
+
events: {
|
|
10
|
+
removeAllFilters: CustomEvent<{}>;
|
|
11
|
+
change: CustomEvent<{
|
|
12
|
+
filter: Filter;
|
|
13
|
+
}>;
|
|
14
|
+
} & {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
};
|
|
17
|
+
slots: {
|
|
18
|
+
custom: {
|
|
19
|
+
filter: Filter | undefined;
|
|
20
|
+
mAndDown: boolean;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export type DynamicFiltersProps = typeof __propDef.props;
|
|
25
|
+
export type DynamicFiltersEvents = typeof __propDef.events;
|
|
26
|
+
export type DynamicFiltersSlots = typeof __propDef.slots;
|
|
27
|
+
export default class DynamicFilters extends SvelteComponent<DynamicFiltersProps, DynamicFiltersEvents, DynamicFiltersSlots> {
|
|
28
|
+
}
|
|
29
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script>import Dropdown, {} from "../forms/Dropdown.svelte";
|
|
2
|
-
import {
|
|
2
|
+
import { GENERIC_MODES, SELECT_MODES, STRING_MODES } from "../../../utils/filters/filters";
|
|
3
3
|
import SimpleTextField from "../../simple/forms/SimpleTextField.svelte";
|
|
4
4
|
import DatePickerTextField from "../forms/DatePickerTextField.svelte";
|
|
5
5
|
import Validator from "../../../utils/filters/validator";
|
|
@@ -34,13 +34,13 @@ $:
|
|
|
34
34
|
if (!!tmpFilter) {
|
|
35
35
|
let modes;
|
|
36
36
|
if (tmpFilter.type == "string") {
|
|
37
|
-
modes =
|
|
37
|
+
modes = STRING_MODES;
|
|
38
38
|
} else if (tmpFilter.type == "date") {
|
|
39
|
-
modes =
|
|
39
|
+
modes = GENERIC_MODES;
|
|
40
40
|
} else if (tmpFilter.type == "number") {
|
|
41
|
-
modes =
|
|
41
|
+
modes = GENERIC_MODES;
|
|
42
42
|
} else if (tmpFilter.type == "select") {
|
|
43
|
-
modes =
|
|
43
|
+
modes = SELECT_MODES;
|
|
44
44
|
} else if (tmpFilter.type == "bool") {
|
|
45
45
|
modes = void 0;
|
|
46
46
|
}
|
|
@@ -108,6 +108,7 @@ function handleChangeValue() {
|
|
|
108
108
|
bind:menuOpened={dropdownOpened}
|
|
109
109
|
openingId="advanced-filter"
|
|
110
110
|
mobileDrawer={mobile}
|
|
111
|
+
{lang}
|
|
111
112
|
></Dropdown>
|
|
112
113
|
</div>
|
|
113
114
|
</div>
|
|
@@ -132,7 +133,8 @@ function handleChangeValue() {
|
|
|
132
133
|
on:day-click={() => {calendarOpened = false}}
|
|
133
134
|
--simple-textfield-width="100%"
|
|
134
135
|
flipOnOverflow
|
|
135
|
-
on:
|
|
136
|
+
on:input={handleChangeValue}
|
|
137
|
+
on:day-click={handleChangeValue}
|
|
136
138
|
>
|
|
137
139
|
<svelte:fragment slot="append-inner">
|
|
138
140
|
<Icon
|
|
@@ -191,7 +193,8 @@ function handleChangeValue() {
|
|
|
191
193
|
bind:menuOpened={calendarOpened}
|
|
192
194
|
on:day-click={() => {calendarOpened = false}}
|
|
193
195
|
--simple-textfield-width="100%"
|
|
194
|
-
on:
|
|
196
|
+
on:input={handleChangeValue}
|
|
197
|
+
on:day-click={handleChangeValue}
|
|
195
198
|
>
|
|
196
199
|
<svelte:fragment slot="append-inner">
|
|
197
200
|
<Icon
|
|
@@ -215,7 +218,8 @@ function handleChangeValue() {
|
|
|
215
218
|
on:day-click={() => {calendarOpened2 = false}}
|
|
216
219
|
--simple-textfield-width="100%"
|
|
217
220
|
flipOnOverflow
|
|
218
|
-
on:
|
|
221
|
+
on:input={handleChangeValue}
|
|
222
|
+
on:day-click={handleChangeValue}
|
|
219
223
|
>
|
|
220
224
|
<svelte:fragment slot="append-inner">
|
|
221
225
|
<Icon
|