@likable-hair/svelte 3.0.31 → 3.0.32

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.
@@ -37,4 +37,5 @@ $:
37
37
  bind:multiple
38
38
  bind:maxVisibleChips
39
39
  searchFunction={() => true}
40
+ on:change
40
41
  ></Autocomplete>
@@ -17,6 +17,8 @@ declare const __propDef: {
17
17
  maxVisibleChips?: number | undefined;
18
18
  };
19
19
  events: {
20
+ change: CustomEvent<any>;
21
+ } & {
20
22
  [evt: string]: CustomEvent<any>;
21
23
  };
22
24
  slots: {};
@@ -14,7 +14,7 @@ export let headers = [], items = [], sortedBy = void 0, sortDirection = void 0,
14
14
  { label: "20", value: 20 },
15
15
  { label: "50", value: 50 },
16
16
  { label: "100", value: 100 }
17
- ], hideRowsPerPage = false, totalElements = void 0, rowsPerPage = 20, filters = [], searchBarColumns = void 0, lang = "en";
17
+ ], hideRowsPerPage = false, totalElements = void 0, rowsPerPage = 20, filters = [], searchBarColumns = void 0, searchBarVisible = true, lang = "en";
18
18
  let searchBarInput, searchText = void 0;
19
19
  let dispatch = createEventDispatcher();
20
20
  let rowsPerPageSelection = [];
@@ -61,22 +61,29 @@ function handleFiltersChange() {
61
61
  </script>
62
62
 
63
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>
64
+ {#if searchBarVisible}
65
+ <slot name="search-bar" {handleSearchChange}>
66
+ <SearchBar
67
+ placeholder="Type something to search..."
68
+ bind:input={searchBarInput}
69
+ bind:value={searchText}
70
+ >
71
+ </SearchBar>
72
+ </slot>
73
+ {/if}
71
74
  <div class="filter-container">
72
75
  <Filters
73
76
  bind:filters
74
77
  on:applyFilter={handleFiltersChange}
75
78
  on:removeFilter={handleFiltersChange}
79
+ --filters-default-wrapper-width="100%"
76
80
  {lang}
77
- >
78
- </Filters>
79
- </div>
81
+ >
82
+ <svelte:fragment slot="append">
83
+ <slot name="filter-append"></slot>
84
+ </svelte:fragment>
85
+ </Filters>
86
+ </div>
80
87
  <SimpleTable
81
88
  bind:headers
82
89
  bind:class={clazz.simpleTable}
@@ -138,15 +145,17 @@ function handleFiltersChange() {
138
145
  {handlePaginationChange}
139
146
  >
140
147
  {#if !hideRowsPerPage}
141
- <Dropdown
142
- placeholder="Per pagina"
143
- clearable={false}
144
- mandatory={true}
145
- bind:items={rowsPerPageOptions}
146
- bind:values={rowsPerPageSelection}
147
- --button-default-width="90px"
148
- on:change={handleRowsPerPageChange}
149
- ></Dropdown>
148
+ <div class="per-page-dropdown">
149
+ <Dropdown
150
+ placeholder="Per pagina"
151
+ clearable={false}
152
+ mandatory={true}
153
+ bind:items={rowsPerPageOptions}
154
+ bind:values={rowsPerPageSelection}
155
+ --button-default-width="90px"
156
+ on:change={handleRowsPerPageChange}
157
+ ></Dropdown>
158
+ </div>
150
159
  {/if}
151
160
  {#if totalElements !== undefined}
152
161
  <slot name="rangeDescriptor" {page} {maxPage} {rowsPerPage} {totalElements}>
@@ -194,10 +203,16 @@ function handleFiltersChange() {
194
203
  .filter-container {
195
204
  margin-top: 10px;
196
205
  display: flex;
197
- align-items: left;
206
+ align-items: center;
198
207
  flex-direction: row;
199
208
  gap: 10px;
209
+ width: 100%;
200
210
  }
201
211
 
212
+ @media only screen and (max-width: 768px) {
213
+ .per-page-dropdown {
214
+ display: none;
215
+ }
216
+ }
202
217
 
203
218
  </style>
@@ -23,6 +23,7 @@ declare const __propDef: {
23
23
  rowsPerPage?: number | undefined;
24
24
  filters?: ComponentProps<Filters>['filters'];
25
25
  searchBarColumns?: string[] | undefined;
26
+ searchBarVisible?: boolean | undefined;
26
27
  lang?: "it" | "en" | undefined;
27
28
  };
28
29
  events: {
@@ -34,6 +35,10 @@ declare const __propDef: {
34
35
  [evt: string]: CustomEvent<any>;
35
36
  };
36
37
  slots: {
38
+ 'search-bar': {
39
+ handleSearchChange: (searchText: string | undefined) => void;
40
+ };
41
+ 'filter-append': {};
37
42
  header: {
38
43
  head: import("../../simple/lists/SimpleTable.svelte").Header;
39
44
  };
@@ -42,7 +42,7 @@ $:
42
42
  page = maxPage;
43
43
  </script>
44
44
 
45
- <div class="container">
45
+ <div class="paginator-container">
46
46
  <Button
47
47
  icon="mdi-chevron-double-left"
48
48
  on:click={hardPrevious}
@@ -118,7 +118,7 @@ $:
118
118
  </div>
119
119
 
120
120
  <style>
121
- .container {
121
+ .paginator-container {
122
122
  display: flex;
123
123
  align-items: center;
124
124
  gap: 5px;
@@ -0,0 +1,3 @@
1
+ :root {
2
+ --filters-default-wrapper-width: auto;
3
+ }
@@ -276,6 +276,7 @@ function handleDeleteIconClick(e) {
276
276
 
277
277
  </div>
278
278
  {/if}
279
+ <slot name="append"></slot>
279
280
  </div>
280
281
  {#if mAndDown}
281
282
  <Drawer
@@ -429,6 +430,10 @@ function handleDeleteIconClick(e) {
429
430
  align-items: center;
430
431
  gap: 20px;
431
432
  max-width: 100%;
433
+ width: var(
434
+ --filters-wrapper-width,
435
+ var(--filters-default-wrapper-width)
436
+ )
432
437
  }
433
438
 
434
439
  .filter-button {
@@ -36,7 +36,9 @@ declare const __propDef: {
36
36
  } & {
37
37
  [evt: string]: CustomEvent<any>;
38
38
  };
39
- slots: {};
39
+ slots: {
40
+ append: {};
41
+ };
40
42
  };
41
43
  export type FiltersProps = typeof __propDef.props;
42
44
  export type FiltersEvents = typeof __propDef.events;
@@ -6,7 +6,7 @@ export let input = void 0, value = void 0, placeholder = void 0;
6
6
  </script>
7
7
 
8
8
  <div
9
- class="container {clazz.container}"
9
+ class="search-bar-container {clazz.container}"
10
10
  >
11
11
  <slot name="icon">
12
12
  <svg
@@ -47,7 +47,7 @@ export let input = void 0, value = void 0, placeholder = void 0;
47
47
  </div>
48
48
 
49
49
  <style>
50
- .container {
50
+ .search-bar-container {
51
51
  box-shadow: inset 0 0 0 1px var(
52
52
  --search-bar-ring-color,
53
53
  var(--search-bar-default-ring-color)
@@ -10,4 +10,5 @@
10
10
  --simple-table-default-row-hover-background-color: rgb(var(--global-color-background-400), .2);
11
11
  --simple-table-default-header-padding: .2rem .5rem;
12
12
  --simple-table-default-header-font-weight: 700;
13
+ --simple-table-default-overflow-x: auto;
13
14
  }
@@ -130,6 +130,10 @@ function formatDate(dateTime, dateFormat) {
130
130
  --simple-table-max-height,
131
131
  var(--simple-table-default-max-height)
132
132
  );
133
+ overflow-x: var(
134
+ --simple-table-overflow-x,
135
+ var(--simple-table-default-overflow-x)
136
+ );
133
137
  }
134
138
 
135
139
  .table {
@@ -17,6 +17,7 @@ afterUpdate(() => {
17
17
  setBookmarkPosition();
18
18
  });
19
19
  import { createEventDispatcher } from "svelte";
20
+ import Icon from "../media/Icon.svelte";
20
21
  const dispatch = createEventDispatcher();
21
22
  let bookmarkWidth = 0, bookmarkLeft = 0;
22
23
  function handleTabClick(clickedTab, nativeEvent) {
@@ -55,6 +56,9 @@ function setBookmarkPosition() {
55
56
  on:keypress={(event) => handleTabKeypress(tab, event)}
56
57
  bind:this={tabButtons[tab.name]}
57
58
  >
59
+ {#if !!tab.icon}
60
+ <Icon name={tab.icon}></Icon>
61
+ {/if}
58
62
  {tab.label}
59
63
  </div>
60
64
  {/each}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@likable-hair/svelte",
3
3
  "description": "A Svelte component for likablehair",
4
- "version": "3.0.31",
4
+ "version": "3.0.32",
5
5
  "scripts": {
6
6
  "host": "vite --host",
7
7
  "dev": "vite dev",