@onsvisual/svelte-components 0.1.34 → 0.1.36

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.
@@ -18,6 +18,7 @@ export default class Select extends SvelteComponentTyped<{
18
18
  idKey?: string;
19
19
  labelKey?: string;
20
20
  groupKey?: string;
21
+ clusterByGroup?: boolean;
21
22
  colors?: any[];
22
23
  itemFilter?: Function;
23
24
  loadOptions?: Function;
@@ -54,6 +55,7 @@ declare const __propDef: {
54
55
  idKey?: string;
55
56
  labelKey?: string;
56
57
  groupKey?: string | null;
58
+ clusterByGroup?: boolean;
57
59
  colors?: any[];
58
60
  itemFilter?: Function;
59
61
  loadOptions?: Function;
@@ -78,6 +78,11 @@
78
78
  * @type {string|null}
79
79
  */
80
80
  export let groupKey = null;
81
+ /**
82
+ * Cluster results by group. If {false}, the group name will be the suffix
83
+ * @type {boolean}
84
+ */
85
+ export let clusterByGroup = false;
81
86
  /**
82
87
  * Defines the width of the input in characters
83
88
  * @type {number}
@@ -153,7 +158,8 @@
153
158
  items="{options}"
154
159
  itemId="{idKey}"
155
160
  label="{labelKey}"
156
- showChevron="{!value}"
161
+ groupBy="{groupKey && clusterByGroup ? (item) => item[groupKey] : null}"
162
+ showChevron="{true}"
157
163
  multiple="{multiple}"
158
164
  clearable="{clearable}"
159
165
  on:change="{handleChange}"
@@ -167,7 +173,7 @@
167
173
  new RegExp(`\\b${filterText}`, "i"),
168
174
  (str) => `<b>${str}</b>`
169
175
  )}
170
- {#if groupKey}<span class="item-group">{item[groupKey]}</span>{/if}
176
+ {#if groupKey && !clusterByGroup}<span class="item-group">{item[groupKey]}</span>{/if}
171
177
  </div>
172
178
  <div slot="empty">{@html noOptionsMessage}</div>
173
179
  <div slot="chevron-icon" style:transform="{mode === "search" ? "translateY(2px)" : null}">
@@ -226,6 +232,7 @@
226
232
  --multi-item-height: 30px;
227
233
  --value-container-padding: 3px 0;
228
234
  --multi-select-padding: 0 0 0 6px;
235
+ --group-item-padding-left: 24px;
229
236
  }
230
237
  :global(.ons-themed-select > .svelte-select:focus-within) {
231
238
  outline: 3px solid #fbc900;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onsvisual/svelte-components",
3
- "version": "0.1.34",
3
+ "version": "0.1.36",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "homepage": "https://onsvisual.github.io/svelte-components",