@likable-hair/svelte 3.0.20 → 3.0.22
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 +3 -2
- package/dist/components/composed/common/MenuOrDrawer.svelte.d.ts +2 -1
- package/dist/components/composed/common/MenuOrDrawerOptions.svelte +2 -2
- package/dist/components/composed/common/MenuOrDrawerOptions.svelte.d.ts +1 -1
- package/dist/components/composed/forms/Dropdown.svelte +6 -4
- package/dist/components/composed/forms/Dropdown.svelte.d.ts +3 -0
- package/dist/components/composed/list/PaginatedTable.svelte +62 -10
- package/dist/components/composed/list/PaginatedTable.svelte.d.ts +3 -0
- package/dist/components/composed/search/FilterEditor.svelte +260 -0
- package/dist/components/composed/search/FilterEditor.svelte.d.ts +29 -0
- package/dist/components/composed/search/Filters.svelte +445 -42
- package/dist/components/composed/search/Filters.svelte.d.ts +24 -4
- package/dist/components/composed/search/MobileFilterEditor.svelte +342 -0
- package/dist/components/composed/search/MobileFilterEditor.svelte.d.ts +34 -0
- package/dist/components/composed/search/SearchBar.svelte +12 -11
- package/dist/components/composed/search/SearchBar.svelte.d.ts +1 -0
- package/dist/components/simple/buttons/Button.svelte +4 -0
- package/dist/components/simple/common/Menu.svelte +29 -10
- package/dist/components/simple/common/Menu.svelte.d.ts +2 -0
- package/dist/components/simple/dates/DatePicker.css +1 -0
- package/dist/components/simple/dates/DatePicker.svelte +4 -0
- package/dist/components/simple/dates/DatePickerTextField.svelte +95 -62
- package/dist/components/simple/dates/DatePickerTextField.svelte.d.ts +2 -0
- package/dist/components/simple/dialogs/Dialog.svelte.d.ts +1 -1
- package/dist/components/simple/forms/Autocomplete.css +1 -0
- package/dist/components/simple/forms/Autocomplete.svelte +96 -46
- package/dist/components/simple/forms/Autocomplete.svelte.d.ts +3 -0
- package/dist/components/simple/lists/SelectableVerticalList.svelte +52 -9
- package/dist/components/simple/lists/SelectableVerticalList.svelte.d.ts +9 -0
- package/dist/components/simple/lists/SimpleTable.svelte.d.ts +2 -2
- package/dist/components/simple/lists/columnTypes.d.ts +1 -1
- package/dist/components/simple/media/DescriptiveAvatar.svelte.d.ts +1 -1
- package/dist/components/simple/navigation/Chip.css +2 -1
- package/dist/components/simple/navigation/Chip.svelte +16 -5
- package/dist/components/simple/navigation/Chip.svelte.d.ts +1 -0
- package/dist/components/simple/navigation/Drawer.svelte +10 -0
- package/dist/components/simple/navigation/Drawer.svelte.d.ts +1 -0
- package/dist/utils/filters/builder.d.ts +1 -1
- package/dist/utils/filters/builder.js +1 -1
- package/dist/utils/filters/filters.d.ts +67 -4
- package/dist/utils/filters/filters.js +73 -0
- package/dist/utils/filters/modifiers/where.d.ts +1 -1
- package/dist/utils/filters/validator.d.ts +4 -0
- package/dist/utils/filters/validator.js +30 -0
- package/package.json +2 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import Drawer from "../../simple/navigation/Drawer.svelte";
|
|
3
3
|
import Menu from "../../simple/common/Menu.svelte";
|
|
4
4
|
import MediaQuery from "../../simple/common/MediaQuery.svelte";
|
|
5
|
-
export let open = false, activator, drawerPosition = "bottom", menuAnchor = "bottom-center", _boxShadow = "rgb(var(--global-color-grey-900), .5) 0px 2px 4px", _height = "fit-content", _maxHeight = void 0, _minWidth = "100px",
|
|
5
|
+
export let open = false, activator, drawerPosition = "bottom", menuAnchor = "bottom-center", _boxShadow = "rgb(var(--global-color-grey-900), .5) 0px 2px 4px", _height = "fit-content", _maxHeight = void 0, _minWidth = "100px", _borderRadius = "5px";
|
|
6
6
|
</script>
|
|
7
7
|
|
|
8
8
|
<MediaQuery let:mAndDown>
|
|
@@ -10,6 +10,7 @@ export let open = false, activator, drawerPosition = "bottom", menuAnchor = "bot
|
|
|
10
10
|
<Drawer
|
|
11
11
|
bind:open={open}
|
|
12
12
|
bind:position={drawerPosition}
|
|
13
|
+
on:close
|
|
13
14
|
on:item-click
|
|
14
15
|
>
|
|
15
16
|
<slot isDrawer={true} isMenu={false}></slot>
|
|
@@ -23,7 +24,7 @@ export let open = false, activator, drawerPosition = "bottom", menuAnchor = "bot
|
|
|
23
24
|
_height={_height}
|
|
24
25
|
_maxHeight={_maxHeight}
|
|
25
26
|
_minWidth={_minWidth}
|
|
26
|
-
_borderRadius={
|
|
27
|
+
_borderRadius={_borderRadius}
|
|
27
28
|
anchor={menuAnchor}
|
|
28
29
|
>
|
|
29
30
|
<slot isDrawer={false} isMenu={true}></slot>
|
|
@@ -13,9 +13,10 @@ declare const __propDef: {
|
|
|
13
13
|
_height?: string | undefined;
|
|
14
14
|
_maxHeight?: string | undefined;
|
|
15
15
|
_minWidth?: string | undefined;
|
|
16
|
-
|
|
16
|
+
_borderRadius?: string | undefined;
|
|
17
17
|
};
|
|
18
18
|
events: {
|
|
19
|
+
close: CustomEvent<{}>;
|
|
19
20
|
'item-click': CustomEvent<{
|
|
20
21
|
item: import("../../simple/navigation/Navigator.svelte").Item;
|
|
21
22
|
}>;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<script>import "../../../css/main.css";
|
|
4
4
|
import MenuOrDrawer from "./MenuOrDrawer.svelte";
|
|
5
5
|
import SelectableVerticalList from "../../simple/lists/SelectableVerticalList.svelte";
|
|
6
|
-
export let open = false, activator, drawerPosition = "bottom", menuAnchor = "bottom-center", elements = [], _boxShadow = "rgb(var(--global-color-grey-900), .5) 0px 2px 4px", _height = "fit-content", _maxHeight = void 0, _minWidth = "100px",
|
|
6
|
+
export let open = false, activator, drawerPosition = "bottom", menuAnchor = "bottom-center", elements = [], _boxShadow = "rgb(var(--global-color-grey-900), .5) 0px 2px 4px", _height = "fit-content", _maxHeight = void 0, _minWidth = "100px", _borderRadius = "5px";
|
|
7
7
|
let selected;
|
|
8
8
|
let focused;
|
|
9
9
|
$:
|
|
@@ -23,7 +23,7 @@ $:
|
|
|
23
23
|
{_height}
|
|
24
24
|
{_maxHeight}
|
|
25
25
|
{_minWidth}
|
|
26
|
-
{
|
|
26
|
+
{_borderRadius}
|
|
27
27
|
let:isDrawer
|
|
28
28
|
--drawer-default-space={`${Math.min(elements?.length || 0, 5) * 56}px`}
|
|
29
29
|
>
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<script>import Autocomplete from "../../../components/simple/forms/Autocomplete.svelte";
|
|
4
4
|
import Button from "../../simple/buttons/Button.svelte";
|
|
5
5
|
import Icon from "../../simple/media/Icon.svelte";
|
|
6
|
-
export let items = [], values = [], multiple = false, searchText = void 0, maxVisibleChips = void 0, placeholder = "Seleziona", clearable = true, mandatory = true, icon = void 0;
|
|
6
|
+
export let items = [], values = [], multiple = false, lang = "en", searchText = void 0, maxVisibleChips = void 0, placeholder = lang == "en" ? "Select" : "Seleziona", clearable = true, mandatory = true, icon = void 0, menuOpened = false, openingId = void 0;
|
|
7
7
|
$:
|
|
8
8
|
generatedLabel = values.length == 1 ? values[0].label : `${values.length} Selezionati`;
|
|
9
9
|
function handleCloseClick(event) {
|
|
@@ -22,9 +22,11 @@ function handleCloseClick(event) {
|
|
|
22
22
|
bind:mandatory
|
|
23
23
|
searchFunction={() => true}
|
|
24
24
|
on:change
|
|
25
|
+
bind:menuOpened
|
|
26
|
+
bind:openingId
|
|
25
27
|
>
|
|
26
28
|
<svelte:fragment slot="selection-container" let:openMenu let:handleKeyDown>
|
|
27
|
-
<Button
|
|
29
|
+
<Button
|
|
28
30
|
--button-default-background-color="transparent"
|
|
29
31
|
--button-default-focus-background-color="rgb(var(--global-color-primary-400), .3)"
|
|
30
32
|
--button-default-focus-color="rgb(var(--global-color-contrast-900))"
|
|
@@ -52,8 +54,8 @@ function handleCloseClick(event) {
|
|
|
52
54
|
{:else}
|
|
53
55
|
<div class="space-between">
|
|
54
56
|
<div>{generatedLabel}</div>
|
|
55
|
-
{#if clearable}
|
|
56
|
-
<Icon
|
|
57
|
+
{#if clearable}
|
|
58
|
+
<Icon
|
|
57
59
|
name="mdi-close"
|
|
58
60
|
click
|
|
59
61
|
on:click={handleCloseClick}
|
|
@@ -6,12 +6,15 @@ declare const __propDef: {
|
|
|
6
6
|
items?: Item[] | undefined;
|
|
7
7
|
values?: Item[] | undefined;
|
|
8
8
|
multiple?: boolean | undefined;
|
|
9
|
+
lang?: "it" | "en" | undefined;
|
|
9
10
|
searchText?: string | undefined;
|
|
10
11
|
maxVisibleChips?: number | undefined;
|
|
11
12
|
placeholder?: string | undefined;
|
|
12
13
|
clearable?: boolean | undefined;
|
|
13
14
|
mandatory?: boolean | undefined;
|
|
14
15
|
icon?: string | undefined;
|
|
16
|
+
menuOpened?: boolean | undefined;
|
|
17
|
+
openingId?: string | undefined;
|
|
15
18
|
};
|
|
16
19
|
events: {
|
|
17
20
|
change: CustomEvent<any>;
|
|
@@ -5,13 +5,17 @@ import Dropdown from "../forms/Dropdown.svelte";
|
|
|
5
5
|
import { createEventDispatcher } from "svelte";
|
|
6
6
|
</script>
|
|
7
7
|
|
|
8
|
-
<script>
|
|
8
|
+
<script>import Filters from "../search/Filters.svelte";
|
|
9
|
+
import SearchBar from "../search/SearchBar.svelte";
|
|
10
|
+
import Converter from "../../../utils/filters/filters";
|
|
11
|
+
let clazz = {};
|
|
9
12
|
export { clazz as class };
|
|
10
13
|
export let headers = [], items = [], sortedBy = void 0, sortDirection = void 0, page = 1, maxPage = void 0, rowsPerPageOptions = [
|
|
11
14
|
{ label: "20", value: 20 },
|
|
12
15
|
{ label: "50", value: 50 },
|
|
13
16
|
{ label: "100", value: 100 }
|
|
14
|
-
], hideRowsPerPage = false, totalElements = void 0, rowsPerPage = 20;
|
|
17
|
+
], hideRowsPerPage = false, totalElements = void 0, rowsPerPage = 20, filters = [], searchBarColumns = void 0;
|
|
18
|
+
let searchBarInput, searchText = void 0;
|
|
15
19
|
let dispatch = createEventDispatcher();
|
|
16
20
|
let rowsPerPageSelection = [];
|
|
17
21
|
$:
|
|
@@ -31,9 +35,47 @@ function handlePaginationChange() {
|
|
|
31
35
|
page
|
|
32
36
|
});
|
|
33
37
|
}
|
|
38
|
+
function handleSearchChange(searchText2) {
|
|
39
|
+
let converter = new Converter();
|
|
40
|
+
let builder;
|
|
41
|
+
builder = converter.createBuilder({
|
|
42
|
+
filters: filters || []
|
|
43
|
+
});
|
|
44
|
+
if (!!searchText2 && !!searchBarColumns && searchBarColumns.length > 0) {
|
|
45
|
+
builder.where((b) => {
|
|
46
|
+
b.where(searchBarColumns[0], "like", searchText2);
|
|
47
|
+
for (let i = 1; i < searchBarColumns.length; i += 1) {
|
|
48
|
+
b.orWhere(searchBarColumns[i], "like", searchText2);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
dispatch("filtersChange", {
|
|
53
|
+
builder
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
$:
|
|
57
|
+
handleSearchChange(searchText);
|
|
58
|
+
function handleFiltersChange() {
|
|
59
|
+
handleSearchChange(searchText);
|
|
60
|
+
}
|
|
34
61
|
</script>
|
|
35
62
|
|
|
36
63
|
<div class="paginated-table">
|
|
64
|
+
|
|
65
|
+
<SearchBar
|
|
66
|
+
placeholder="Type something to search..."
|
|
67
|
+
bind:input={searchBarInput}
|
|
68
|
+
bind:value={searchText}
|
|
69
|
+
>
|
|
70
|
+
</SearchBar>
|
|
71
|
+
<div class="filter-container">
|
|
72
|
+
<Filters
|
|
73
|
+
bind:filters
|
|
74
|
+
on:applyFilter={handleFiltersChange}
|
|
75
|
+
on:removeFilter={handleFiltersChange}
|
|
76
|
+
>
|
|
77
|
+
</Filters>
|
|
78
|
+
</div>
|
|
37
79
|
<SimpleTable
|
|
38
80
|
bind:headers
|
|
39
81
|
bind:class={clazz.simpleTable}
|
|
@@ -50,7 +92,7 @@ function handlePaginationChange() {
|
|
|
50
92
|
</slot>
|
|
51
93
|
</span>
|
|
52
94
|
{#if head.sortable}
|
|
53
|
-
<span
|
|
95
|
+
<span
|
|
54
96
|
class="header-sort-icon"
|
|
55
97
|
class:active={sortedBy == head.value}
|
|
56
98
|
class:asc={sortDirection == 'asc'}
|
|
@@ -65,11 +107,11 @@ function handlePaginationChange() {
|
|
|
65
107
|
{/if}
|
|
66
108
|
</slot>
|
|
67
109
|
</svelte:fragment>
|
|
68
|
-
<svelte:fragment
|
|
69
|
-
slot="custom"
|
|
70
|
-
let:columnIndex
|
|
71
|
-
let:index
|
|
72
|
-
let:header
|
|
110
|
+
<svelte:fragment
|
|
111
|
+
slot="custom"
|
|
112
|
+
let:columnIndex
|
|
113
|
+
let:index
|
|
114
|
+
let:header
|
|
73
115
|
let:item
|
|
74
116
|
>
|
|
75
117
|
<slot name="custom" {index} {columnIndex} {header} {item}/>
|
|
@@ -81,8 +123,9 @@ function handlePaginationChange() {
|
|
|
81
123
|
<slot name="append" {index} {item} />
|
|
82
124
|
</svelte:fragment>
|
|
83
125
|
</SimpleTable>
|
|
126
|
+
|
|
84
127
|
<div class="footer">
|
|
85
|
-
<slot
|
|
128
|
+
<slot
|
|
86
129
|
name="footer"
|
|
87
130
|
{hideRowsPerPage}
|
|
88
131
|
{rowsPerPageOptions}
|
|
@@ -126,7 +169,6 @@ function handlePaginationChange() {
|
|
|
126
169
|
display: flex;
|
|
127
170
|
flex-direction: column;
|
|
128
171
|
gap: 24px;
|
|
129
|
-
align-items: center;
|
|
130
172
|
}
|
|
131
173
|
|
|
132
174
|
.header-sort-icon {
|
|
@@ -147,4 +189,14 @@ function handlePaginationChange() {
|
|
|
147
189
|
align-items: center;
|
|
148
190
|
width: 100%;
|
|
149
191
|
}
|
|
192
|
+
|
|
193
|
+
.filter-container {
|
|
194
|
+
margin-top: 10px;
|
|
195
|
+
display: flex;
|
|
196
|
+
align-items: left;
|
|
197
|
+
flex-direction: row;
|
|
198
|
+
gap: 10px;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
|
|
150
202
|
</style>
|
|
@@ -5,6 +5,7 @@ import Dropdown from "../forms/Dropdown.svelte";
|
|
|
5
5
|
import { type ComponentProps } from "svelte";
|
|
6
6
|
type ArrayElement<ArrayType extends readonly unknown[]> = ArrayType extends readonly (infer ElementType)[] ? ElementType : never;
|
|
7
7
|
export type Header = ArrayElement<NonNullable<ComponentProps<SimpleTable>['headers']>>;
|
|
8
|
+
import Filters from "../search/Filters.svelte";
|
|
8
9
|
declare const __propDef: {
|
|
9
10
|
props: {
|
|
10
11
|
class?: {
|
|
@@ -20,6 +21,8 @@ declare const __propDef: {
|
|
|
20
21
|
hideRowsPerPage?: boolean | undefined;
|
|
21
22
|
totalElements?: number | undefined;
|
|
22
23
|
rowsPerPage?: number | undefined;
|
|
24
|
+
filters?: ComponentProps<Filters>['filters'];
|
|
25
|
+
searchBarColumns?: string[] | undefined;
|
|
23
26
|
};
|
|
24
27
|
events: {
|
|
25
28
|
sort: CustomEvent<{
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
<script>import Dropdown, {} from "../forms/Dropdown.svelte";
|
|
2
|
+
import { GenericModes, SelectModes, StringModes } from "../../../utils/filters/filters";
|
|
3
|
+
import SimpleTextField from "../../simple/forms/SimpleTextField.svelte";
|
|
4
|
+
import DatePickerTextField from "../../simple/dates/DatePickerTextField.svelte";
|
|
5
|
+
import Button from "../../simple/buttons/Button.svelte";
|
|
6
|
+
import { createEventDispatcher } from "svelte";
|
|
7
|
+
import Validator from "../../../utils/filters/validator";
|
|
8
|
+
import Autocomplete from "../../simple/forms/Autocomplete.svelte";
|
|
9
|
+
import Checkbox from "../../simple/forms/Checkbox.svelte";
|
|
10
|
+
export let filter = void 0, lang = "en", cancelFilterLabel = lang == "en" ? "Cancel" : "Annulla", applyFilterLabel = lang == "en" ? "Apply filter" : "Applica filter", betweenFromLabel = lang == "en" ? "From" : "Da", betweenToLabel = lang == "en" ? "To" : "A", labelsMapper;
|
|
11
|
+
let tmpFilter;
|
|
12
|
+
let advancedModeOptions, advancedModeSelectedOptions;
|
|
13
|
+
function initTmpFilter() {
|
|
14
|
+
tmpFilter = structuredClone(filter);
|
|
15
|
+
if (!!tmpFilter && ["string", "number", "date", "select"].includes(tmpFilter.type) && Object.keys(tmpFilter).includes("mode")) {
|
|
16
|
+
if (tmpFilter.mode == "between" && tmpFilter.from !== void 0 && tmpFilter.to !== void 0 || tmpFilter.value !== void 0 || tmpFilter.type == "select" && tmpFilter.values !== void 0 && tmpFilter.values.length > 0) {
|
|
17
|
+
advancedModeSelectedOptions = [{
|
|
18
|
+
//@ts-ignore
|
|
19
|
+
value: tmpFilter.mode,
|
|
20
|
+
label: labelsMapper[tmpFilter.mode].short || tmpFilter.mode
|
|
21
|
+
}];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function closeDropDown() {
|
|
26
|
+
dropdownOpened = false;
|
|
27
|
+
}
|
|
28
|
+
$:
|
|
29
|
+
if (!!filter) {
|
|
30
|
+
initTmpFilter();
|
|
31
|
+
closeDropDown();
|
|
32
|
+
}
|
|
33
|
+
let dispatch = createEventDispatcher();
|
|
34
|
+
function handleCancelFilterClick(e) {
|
|
35
|
+
dispatch("cancel");
|
|
36
|
+
}
|
|
37
|
+
function handleApplyFilterClick() {
|
|
38
|
+
if (!!filter && !!tmpFilter) {
|
|
39
|
+
filter = structuredClone(tmpFilter);
|
|
40
|
+
filter.active = true;
|
|
41
|
+
dispatch("apply");
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
$:
|
|
45
|
+
if (!!tmpFilter) {
|
|
46
|
+
let modes;
|
|
47
|
+
if (tmpFilter.type == "string") {
|
|
48
|
+
modes = StringModes;
|
|
49
|
+
} else if (tmpFilter.type == "date") {
|
|
50
|
+
modes = GenericModes;
|
|
51
|
+
} else if (tmpFilter.type == "number") {
|
|
52
|
+
modes = GenericModes;
|
|
53
|
+
} else if (tmpFilter.type == "select") {
|
|
54
|
+
modes = SelectModes;
|
|
55
|
+
} else if (tmpFilter.type == "bool") {
|
|
56
|
+
modes = void 0;
|
|
57
|
+
}
|
|
58
|
+
if (!!modes) {
|
|
59
|
+
advancedModeOptions = modes.map((mode) => {
|
|
60
|
+
return {
|
|
61
|
+
value: mode,
|
|
62
|
+
label: labelsMapper[mode].short || mode
|
|
63
|
+
};
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
$:
|
|
68
|
+
if (!tmpFilter?.advanced) {
|
|
69
|
+
advancedModeSelectedOptions = void 0;
|
|
70
|
+
}
|
|
71
|
+
let dropdownOpened = false, calendarOpened = false, calendarOpened2 = false;
|
|
72
|
+
function handleAdvancedModeSelection() {
|
|
73
|
+
if (!!advancedModeSelectedOptions && advancedModeSelectedOptions.length > 0 && !!tmpFilter) {
|
|
74
|
+
if (tmpFilter.type == "date")
|
|
75
|
+
tmpFilter.mode = advancedModeSelectedOptions[0].value;
|
|
76
|
+
else if (tmpFilter.type == "number")
|
|
77
|
+
tmpFilter.mode = advancedModeSelectedOptions[0].value;
|
|
78
|
+
else if (tmpFilter.type == "string")
|
|
79
|
+
tmpFilter.mode = advancedModeSelectedOptions[0].value;
|
|
80
|
+
else if (tmpFilter.type == "select")
|
|
81
|
+
tmpFilter.mode = advancedModeSelectedOptions[0].value;
|
|
82
|
+
}
|
|
83
|
+
dropdownOpened = false;
|
|
84
|
+
}
|
|
85
|
+
$:
|
|
86
|
+
applyFilterDisabled = !Validator.isValid(tmpFilter);
|
|
87
|
+
$:
|
|
88
|
+
if (!!tmpFilter && tmpFilter.type == "bool") {
|
|
89
|
+
if (tmpFilter.value === void 0) {
|
|
90
|
+
tmpFilter.value = false;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
</script>
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
{#if !!filter && !!tmpFilter}
|
|
97
|
+
<div class="filter-editor">
|
|
98
|
+
{#if filter.advanced}
|
|
99
|
+
<div class="advanced-mode">
|
|
100
|
+
<div class="label">
|
|
101
|
+
{filter.label[0].toUpperCase() + filter.label.slice(1)}
|
|
102
|
+
</div>
|
|
103
|
+
<div class="advaced-mode-selector" on:click|stopPropagation on:keypress>
|
|
104
|
+
<Dropdown
|
|
105
|
+
items={advancedModeOptions}
|
|
106
|
+
bind:values={advancedModeSelectedOptions}
|
|
107
|
+
on:change={handleAdvancedModeSelection}
|
|
108
|
+
bind:menuOpened={dropdownOpened}
|
|
109
|
+
openingId="advanced-filter"
|
|
110
|
+
></Dropdown>
|
|
111
|
+
</div>
|
|
112
|
+
</div>
|
|
113
|
+
{/if}
|
|
114
|
+
|
|
115
|
+
<div class="fields" style:width="100%" on:click|stopPropagation on:keypress>
|
|
116
|
+
{#if !tmpFilter.advanced || (!!advancedModeSelectedOptions && advancedModeSelectedOptions.length > 0)}
|
|
117
|
+
{#if tmpFilter.type === "string" }
|
|
118
|
+
<SimpleTextField
|
|
119
|
+
bind:value={tmpFilter.value}
|
|
120
|
+
type="text"
|
|
121
|
+
placeholder={tmpFilter?.label}
|
|
122
|
+
--simple-textfield-width="100%"
|
|
123
|
+
></SimpleTextField>
|
|
124
|
+
{:else if tmpFilter.type === "date" && tmpFilter.mode !== 'between'}
|
|
125
|
+
<div>
|
|
126
|
+
<DatePickerTextField
|
|
127
|
+
bind:selectedDate={tmpFilter.value}
|
|
128
|
+
openingId="advanced-filter"
|
|
129
|
+
bind:menuOpened={calendarOpened}
|
|
130
|
+
on:day-click={() => {calendarOpened = false}}
|
|
131
|
+
--simple-textfield-width="100%"
|
|
132
|
+
></DatePickerTextField>
|
|
133
|
+
</div>
|
|
134
|
+
{:else if tmpFilter.type === "number" && tmpFilter.mode !== 'between'}
|
|
135
|
+
<div>
|
|
136
|
+
<SimpleTextField
|
|
137
|
+
bind:value={tmpFilter.value}
|
|
138
|
+
type="number"
|
|
139
|
+
placeholder={tmpFilter?.label}
|
|
140
|
+
--simple-textfield-width="100%"
|
|
141
|
+
></SimpleTextField>
|
|
142
|
+
</div>
|
|
143
|
+
{:else if tmpFilter.type === "select"}
|
|
144
|
+
<div
|
|
145
|
+
style:width="100%"
|
|
146
|
+
>
|
|
147
|
+
<Autocomplete
|
|
148
|
+
bind:values={tmpFilter.values}
|
|
149
|
+
items={tmpFilter.items}
|
|
150
|
+
multiple
|
|
151
|
+
maxVisibleChips={2}
|
|
152
|
+
--simple-textfield-width="0px"
|
|
153
|
+
--simple-text-field-margin-left="0px"
|
|
154
|
+
></Autocomplete>
|
|
155
|
+
</div>
|
|
156
|
+
{:else if tmpFilter.type === "date" && tmpFilter.mode === 'between'}
|
|
157
|
+
<div>
|
|
158
|
+
<DatePickerTextField
|
|
159
|
+
bind:selectedDate={tmpFilter.from}
|
|
160
|
+
openingId="advanced-filter"
|
|
161
|
+
placeholder={betweenFromLabel}
|
|
162
|
+
bind:menuOpened={calendarOpened}
|
|
163
|
+
on:day-click={() => {calendarOpened = false}}
|
|
164
|
+
--simple-textfield-width="100%"
|
|
165
|
+
></DatePickerTextField>
|
|
166
|
+
</div>
|
|
167
|
+
<div>
|
|
168
|
+
<DatePickerTextField
|
|
169
|
+
bind:selectedDate={tmpFilter.to}
|
|
170
|
+
openingId="advanced-filter"
|
|
171
|
+
placeholder={betweenToLabel}
|
|
172
|
+
bind:menuOpened={calendarOpened2}
|
|
173
|
+
on:day-click={() => {calendarOpened2 = false}}
|
|
174
|
+
--simple-textfield-width="100%"
|
|
175
|
+
></DatePickerTextField>
|
|
176
|
+
</div>
|
|
177
|
+
{:else if tmpFilter.type === "number" && tmpFilter.mode === 'between'}
|
|
178
|
+
<div>
|
|
179
|
+
<SimpleTextField
|
|
180
|
+
bind:value={tmpFilter.from}
|
|
181
|
+
type="number"
|
|
182
|
+
placeholder={betweenFromLabel}
|
|
183
|
+
--simple-textfield-width="100%"
|
|
184
|
+
></SimpleTextField>
|
|
185
|
+
</div>
|
|
186
|
+
<div>
|
|
187
|
+
<SimpleTextField
|
|
188
|
+
bind:value={tmpFilter.to}
|
|
189
|
+
type="number"
|
|
190
|
+
placeholder={betweenToLabel}
|
|
191
|
+
--simple-textfield-width="100%"
|
|
192
|
+
></SimpleTextField>
|
|
193
|
+
</div>
|
|
194
|
+
{:else if tmpFilter.type == 'bool'}
|
|
195
|
+
<div class="bool-filter">
|
|
196
|
+
<Checkbox
|
|
197
|
+
bind:value={tmpFilter.value}
|
|
198
|
+
></Checkbox>
|
|
199
|
+
<span style:margin-left="10px">
|
|
200
|
+
{tmpFilter.desctiprion}
|
|
201
|
+
</span>
|
|
202
|
+
</div>
|
|
203
|
+
{/if}
|
|
204
|
+
{/if}
|
|
205
|
+
</div>
|
|
206
|
+
|
|
207
|
+
<div class="sub-filter-button">
|
|
208
|
+
<Button
|
|
209
|
+
--button-background-color="transparent"
|
|
210
|
+
--button-hover-background-color="rgb(var(--global-color-primary-500))"
|
|
211
|
+
--button-hover-box-shadow="0 0 0.5rem rgba(0, 0, 0, 0.3)"
|
|
212
|
+
--button-box-shadow="none"
|
|
213
|
+
on:click={handleCancelFilterClick}
|
|
214
|
+
>
|
|
215
|
+
{cancelFilterLabel}
|
|
216
|
+
</Button>
|
|
217
|
+
|
|
218
|
+
<Button
|
|
219
|
+
--button-min-width="100px"
|
|
220
|
+
on:click={handleApplyFilterClick}
|
|
221
|
+
disabled={applyFilterDisabled}
|
|
222
|
+
>
|
|
223
|
+
{applyFilterLabel}
|
|
224
|
+
|
|
225
|
+
</Button>
|
|
226
|
+
</div>
|
|
227
|
+
</div>
|
|
228
|
+
{/if}
|
|
229
|
+
|
|
230
|
+
<style>
|
|
231
|
+
.filter-editor {
|
|
232
|
+
display: flex;
|
|
233
|
+
flex-direction: column;
|
|
234
|
+
align-items: left;
|
|
235
|
+
gap:10px;
|
|
236
|
+
margin: 5%;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.sub-filter-button {
|
|
240
|
+
display: flex;
|
|
241
|
+
column-gap: 10px;
|
|
242
|
+
flex-direction: row;
|
|
243
|
+
align-items: start;
|
|
244
|
+
margin-top: 10px;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.advanced-mode {
|
|
248
|
+
display: flex;
|
|
249
|
+
gap: 10px;
|
|
250
|
+
align-items: center;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.label {
|
|
254
|
+
max-width: 200px;
|
|
255
|
+
text-overflow: ellipsis;
|
|
256
|
+
overflow: hidden;
|
|
257
|
+
white-space: nowrap;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
</style>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { Filter } from "../../../utils/filters/filters";
|
|
3
|
+
import type { LabelMapper } from "./Filters.svelte";
|
|
4
|
+
declare const __propDef: {
|
|
5
|
+
props: {
|
|
6
|
+
filter?: Filter | undefined;
|
|
7
|
+
lang?: "it" | "en" | undefined;
|
|
8
|
+
cancelFilterLabel?: string | undefined;
|
|
9
|
+
applyFilterLabel?: string | undefined;
|
|
10
|
+
betweenFromLabel?: string | undefined;
|
|
11
|
+
betweenToLabel?: string | undefined;
|
|
12
|
+
labelsMapper: LabelMapper;
|
|
13
|
+
};
|
|
14
|
+
events: {
|
|
15
|
+
click: MouseEvent;
|
|
16
|
+
keypress: KeyboardEvent;
|
|
17
|
+
apply: CustomEvent<undefined>;
|
|
18
|
+
cancel: CustomEvent<undefined>;
|
|
19
|
+
} & {
|
|
20
|
+
[evt: string]: CustomEvent<any>;
|
|
21
|
+
};
|
|
22
|
+
slots: {};
|
|
23
|
+
};
|
|
24
|
+
export type FilterEditorProps = typeof __propDef.props;
|
|
25
|
+
export type FilterEditorEvents = typeof __propDef.events;
|
|
26
|
+
export type FilterEditorSlots = typeof __propDef.slots;
|
|
27
|
+
export default class FilterEditor extends SvelteComponentTyped<FilterEditorProps, FilterEditorEvents, FilterEditorSlots> {
|
|
28
|
+
}
|
|
29
|
+
export {};
|