@txstate-mws/svelte-components 1.5.10 → 1.5.11
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.
|
@@ -62,6 +62,7 @@ export let menuItemHilitedClass = '';
|
|
|
62
62
|
export let menuItemSelectedClass = '';
|
|
63
63
|
export let menuDividerClass = '';
|
|
64
64
|
export let hideSelectedIndicator = false;
|
|
65
|
+
export let hideEmptyText = false;
|
|
65
66
|
export let usemenurole = false;
|
|
66
67
|
let menuelement;
|
|
67
68
|
const itemelements = [];
|
|
@@ -118,7 +119,7 @@ function isSelectable(itm) {
|
|
|
118
119
|
return 'value' in itm && !itm.disabled && !hiddenItem(itm);
|
|
119
120
|
}
|
|
120
121
|
function onkeydown(e) {
|
|
121
|
-
if (modifierKey(e)
|
|
122
|
+
if (modifierKey(e))
|
|
122
123
|
return;
|
|
123
124
|
if (e.key === 'ArrowDown') {
|
|
124
125
|
e.preventDefault();
|
|
@@ -207,8 +208,7 @@ let blurTimer;
|
|
|
207
208
|
function onbuttonclick(e) {
|
|
208
209
|
e.preventDefault();
|
|
209
210
|
cancelAnimationFrame(blurTimer);
|
|
210
|
-
|
|
211
|
-
menushown = !menushown;
|
|
211
|
+
menushown = !menushown;
|
|
212
212
|
}
|
|
213
213
|
function onblur(e) {
|
|
214
214
|
// tabindex=-1 on our menu elements means e.relatedTarget will be set
|
|
@@ -276,7 +276,7 @@ const onclick = (item) => (e) => {
|
|
|
276
276
|
$: hasSelected = showSelected && !hideSelectedIndicator && items.some(itm => 'value' in itm && itm.value === value);
|
|
277
277
|
</script>
|
|
278
278
|
|
|
279
|
-
{#if menushown}
|
|
279
|
+
{#if menushown && !loading && (hasMeaningfulItems || !hideEmptyText)}
|
|
280
280
|
<div use:portal={usePortal === true ? undefined : (usePortal || null)}
|
|
281
281
|
use:glue={{ target: buttonelement, align, cover, gap, adjustparentheight, store: computedalign }}
|
|
282
282
|
class={menuContainerClass}>
|