@kws3/ui 1.2.1 → 1.2.2
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/forms/select/MultiSelect.svelte +32 -0
- package/package.json +2 -2
- package/styles/Panel.scss +0 -1
|
@@ -244,6 +244,18 @@ Default value: `<span>{option[search_key] || option}</span>`
|
|
|
244
244
|
throw new TypeError(`max must be null or positive integer, got ${max}`);
|
|
245
245
|
}
|
|
246
246
|
|
|
247
|
+
//ensure we have a root container for all our hoisitng related stuff
|
|
248
|
+
let rootContainerId = "kws-overlay-root";
|
|
249
|
+
let rootContainer = document.getElementById(rootContainerId);
|
|
250
|
+
if (!rootContainer) {
|
|
251
|
+
rootContainer = document.createElement("div");
|
|
252
|
+
rootContainer.id = rootContainerId;
|
|
253
|
+
document.body.appendChild(rootContainer);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
//this is the container that will hold the dropdown
|
|
257
|
+
let container;
|
|
258
|
+
|
|
247
259
|
const fire = createEventDispatcher();
|
|
248
260
|
|
|
249
261
|
let el, //whole wrapping element
|
|
@@ -372,9 +384,25 @@ Default value: `<span>{option[search_key] || option}</span>`
|
|
|
372
384
|
POPPER && POPPER.update();
|
|
373
385
|
}
|
|
374
386
|
|
|
387
|
+
/**
|
|
388
|
+
* Moves dropdown to rootContainer, so that
|
|
389
|
+
* overflows etc do not mess with it
|
|
390
|
+
*/
|
|
391
|
+
function hoistDropdown() {
|
|
392
|
+
if (!container) {
|
|
393
|
+
container = document.createElement("div");
|
|
394
|
+
container.className = "searchableselect";
|
|
395
|
+
rootContainer.appendChild(container);
|
|
396
|
+
container.appendChild(dropdown);
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
|
|
375
400
|
onMount(() => {
|
|
401
|
+
hoistDropdown();
|
|
402
|
+
|
|
376
403
|
POPPER = createPopper(el, dropdown, {
|
|
377
404
|
strategy: "fixed",
|
|
405
|
+
placement: "bottom-start",
|
|
378
406
|
modifiers: [sameWidthPopperModifier],
|
|
379
407
|
});
|
|
380
408
|
|
|
@@ -386,6 +414,10 @@ Default value: `<span>{option[search_key] || option}</span>`
|
|
|
386
414
|
|
|
387
415
|
return () => {
|
|
388
416
|
POPPER.destroy();
|
|
417
|
+
//remove hoisted items
|
|
418
|
+
container &&
|
|
419
|
+
container.parentNode &&
|
|
420
|
+
container.parentNode.removeChild(container);
|
|
389
421
|
};
|
|
390
422
|
});
|
|
391
423
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kws3/ui",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"description": "UI components for use with Svelte v3 applications.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -27,5 +27,5 @@
|
|
|
27
27
|
"text-mask-core": "^5.1.2",
|
|
28
28
|
"tippy.js": "^6.3.1"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "1f87ee1cde62bfc3f4fd94e41c3141dd9eec688c"
|
|
31
31
|
}
|