@kws3/ui 1.6.1 → 1.6.5

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.
@@ -166,6 +166,15 @@
166
166
  qfilters[qqp[0]] = qqp[1];
167
167
  }
168
168
 
169
+ if (hasFilters) {
170
+ for (let i in _filters) {
171
+ let filter = _filters[i];
172
+ if (typeof qfilters[filter.name] == "undefined") {
173
+ qfilters[filter.name] = "";
174
+ }
175
+ }
176
+ }
177
+
169
178
  filterVals = qfilters;
170
179
  }
171
180
 
@@ -28,6 +28,10 @@ Instead of listing all the selected items inside the input., Default: `false`
28
28
  @param {string} [no_options_msg="No matching options"] - Message to display when no matching options are found, Default: `"No matching options"`
29
29
  @param {string} [remove_btn_tip="Remove"] - Tooltip text for Remove Item button. This `string` will precede the selected Item Name in the tooltip., Default: `"Remove"`
30
30
  @param {string} [remove_all_tip="Remove all"] - Tooltip text for the Clear All button, Default: `"Remove all"`
31
+ @param {HTMLElement|string} [dropdown_portal=undefined] - Where to render the dropdown list.
32
+ Can be a DOM element or a `string` with the CSS selector of the element.
33
+
34
+ By default it renders in a custom container appended to `document.body`., Default: `undefined`
31
35
  @param {string} [class=""] - CSS classes for input container, Default: `""`
32
36
 
33
37
  ### Events
@@ -106,7 +110,7 @@ Default value: `<span>{option[search_key] || option}</span>`
106
110
  style={shouldShowClearAll ? "" : "display: none;"} />
107
111
  {/if}
108
112
  {#if rootContainer}
109
- <div class="kws-searchableselect" use:portal={"#" + rootContainerId}>
113
+ <div class="kws-searchableselect" use:portal={dropdown_portal}>
110
114
  <ul
111
115
  bind:this={dropdown}
112
116
  class="options {single ? 'is-single' : 'is-multi'}"
@@ -159,6 +163,8 @@ Default value: `<span>{option[search_key] || option}</span>`
159
163
  },
160
164
  };
161
165
 
166
+ const rootContainerId = "kws-overlay-root";
167
+
162
168
  /**
163
169
  * Value of the Input
164
170
  *
@@ -236,6 +242,15 @@ Default value: `<span>{option[search_key] || option}</span>`
236
242
  * Tooltip text for the Clear All button
237
243
  */
238
244
  export let remove_all_tip = "Remove all";
245
+ /**
246
+ * Where to render the dropdown list.
247
+ * Can be a DOM element or a `string` with the CSS selector of the element.
248
+ *
249
+ * By default it renders in a custom container appended to `document.body`.
250
+ *
251
+ * @type { HTMLElement|string}
252
+ */
253
+ export let dropdown_portal = "#" + rootContainerId;
239
254
 
240
255
  /**
241
256
  * CSS classes for input container
@@ -250,7 +265,7 @@ Default value: `<span>{option[search_key] || option}</span>`
250
265
  }
251
266
 
252
267
  //ensure we have a root container for all our hoisitng related stuff
253
- const rootContainerId = "kws-overlay-root";
268
+
254
269
  let rootContainer = document.getElementById(rootContainerId);
255
270
  if (!rootContainer) {
256
271
  rootContainer = document.createElement("div");
@@ -494,6 +509,7 @@ Default value: `<span>{option[search_key] || option}</span>`
494
509
  }
495
510
 
496
511
  if (event.key === `Enter`) {
512
+ event.preventDefault();
497
513
  if (activeOption) {
498
514
  handleOptionMouseDown(activeOption);
499
515
  if (!single) {
@@ -20,6 +20,10 @@ this property of each object will be returned as the value, Default: `"id"`
20
20
  @param {string} [selected_icon="check"] - Icon used to mark selected items in dropdown list, Default: `"check"`
21
21
  @param {string} [no_options_msg="No matching options"] - Message to display when no matching options are found, Default: `"No matching options"`
22
22
  @param {string} [remove_all_tip="Clear Selection"] - Tooltip text for the Clear selection button, Default: `"Clear Selection"`
23
+ @param {HTMLElement|string} [dropdown_portal=undefined] - Where to render the dropdown list.
24
+ Can be a DOM element or a `string` with the CSS selector of the element.
25
+
26
+ By default it renders in a custom container appended to `document.body`., Default: `undefined`
23
27
  @param {string} [class=""] - CSS classes for input container, Default: `""`
24
28
 
25
29
  ### Events
@@ -48,6 +52,7 @@ Default value: `<span>{option[search_key] || option}</span>`
48
52
  {selected_icon}
49
53
  {remove_all_tip}
50
54
  {no_options_msg}
55
+ {dropdown_portal}
51
56
  on:change={change}
52
57
  on:blur={blur}
53
58
  let:option
@@ -67,6 +72,8 @@ Default value: `<span>{option[search_key] || option}</span>`
67
72
 
68
73
  const fire = createEventDispatcher();
69
74
 
75
+ const rootContainerId = "kws-overlay-root";
76
+
70
77
  /**
71
78
  * Value of the Input
72
79
  *
@@ -127,6 +134,15 @@ Default value: `<span>{option[search_key] || option}</span>`
127
134
  * Tooltip text for the Clear selection button
128
135
  */
129
136
  export let remove_all_tip = "Clear Selection";
137
+ /**
138
+ * Where to render the dropdown list.
139
+ * Can be a DOM element or a `string` with the CSS selector of the element.
140
+ *
141
+ * By default it renders in a custom container appended to `document.body`.
142
+ *
143
+ * @type { HTMLElement|string}
144
+ */
145
+ export let dropdown_portal = "#" + rootContainerId;
130
146
 
131
147
  /**
132
148
  * CSS classes for input container
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kws3/ui",
3
- "version": "1.6.1",
3
+ "version": "1.6.5",
4
4
  "description": "UI components for use with Svelte v3 applications.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -29,5 +29,5 @@
29
29
  "text-mask-core": "^5.1.2",
30
30
  "tippy.js": "^6.3.1"
31
31
  },
32
- "gitHead": "ea18e1e71037d787675491be9c0260b901bf9e7a"
32
+ "gitHead": "7bd56973e65c032a94e8285e321de06d0a89d051"
33
33
  }