fluent-svelte-extra 1.7.2 → 1.7.4
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.
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
import { externalMouseEvents, arrowNavigation } from "../internal";
|
|
5
5
|
import { tabbable } from "tabbable";
|
|
6
6
|
import MenuFlyoutSurface from "../MenuFlyout/MenuFlyoutSurface.svelte";
|
|
7
|
-
/** Controls if the flyout will be closed when clicking a standard variant item.
|
|
8
|
-
export let closeOnSelect =
|
|
7
|
+
/** Controls if the flyout will be closed when clicking a standard variant item. Set to `false` by default. */
|
|
8
|
+
export let closeOnSelect = false;
|
|
9
9
|
/** The current visibility state of the context menu. */
|
|
10
10
|
export let open = false;
|
|
11
11
|
/** Obtains a bound DOM reference to the content wrapper element. */
|
|
@@ -58,11 +58,13 @@ function mountMenu(node) {
|
|
|
58
58
|
destroy: () => node.remove()
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
if (closeOnSelect) {
|
|
62
|
+
setContext("closeFlyout", () => {
|
|
63
|
+
dispatch("select");
|
|
64
|
+
if (closeOnSelect)
|
|
65
|
+
open = false;
|
|
66
|
+
});
|
|
67
|
+
}
|
|
66
68
|
</script>
|
|
67
69
|
|
|
68
70
|
<svelte:window on:keydown={handleEscapeKey} />
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
<script >import Checkbox from "../Checkbox/Checkbox.svelte";
|
|
2
|
+
import { createEventDispatcher } from "svelte";
|
|
3
|
+
const dispatch = createEventDispatcher();
|
|
2
4
|
/** Indicates the selected state of the grid view item. */
|
|
3
5
|
export let selected = false;
|
|
4
6
|
export let singleSelect = false;
|
|
@@ -14,7 +16,10 @@ function setSelected(value) {
|
|
|
14
16
|
<div class="grid-view-item" class:selected {...$$restProps}>
|
|
15
17
|
{#if !singleSelect}
|
|
16
18
|
<div class="item-checkbox">
|
|
17
|
-
<Checkbox
|
|
19
|
+
<Checkbox
|
|
20
|
+
bind:checked={selected}
|
|
21
|
+
on:change={() => dispatch("change", { selected: !selected })}
|
|
22
|
+
></Checkbox>
|
|
18
23
|
</div>
|
|
19
24
|
{/if}
|
|
20
25
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script >import { createEventDispatcher, getContext } from "svelte";
|
|
2
2
|
import { get_current_component } from "svelte/internal";
|
|
3
|
-
import { arrowNavigation, uid, createEventForwarder } from "../internal";
|
|
3
|
+
import { arrowNavigation, uid, createEventForwarder, conditionalEvent } from "../internal";
|
|
4
4
|
import { tabbable } from "tabbable";
|
|
5
5
|
import MenuFlyoutSurface from "../MenuFlyout/MenuFlyoutSurface.svelte";
|
|
6
6
|
import TextBlock from "../TextBlock/TextBlock.svelte";
|
|
@@ -67,6 +67,8 @@ function handleKeyDown(event) {
|
|
|
67
67
|
else if (open && key === "ArrowLeft") {
|
|
68
68
|
event.stopPropagation();
|
|
69
69
|
open = false;
|
|
70
|
+
if (closeFlyout && !cascading)
|
|
71
|
+
closeFlyout(event);
|
|
70
72
|
element.focus();
|
|
71
73
|
}
|
|
72
74
|
}
|
|
@@ -79,7 +81,7 @@ function handleMouseEnter() {
|
|
|
79
81
|
open = true;
|
|
80
82
|
}, 500);
|
|
81
83
|
}
|
|
82
|
-
function handleMouseLeave() {
|
|
84
|
+
function handleMouseLeave(e) {
|
|
83
85
|
subMenuQueue.close = true;
|
|
84
86
|
subMenuQueue.open = false;
|
|
85
87
|
setTimeout(() => {
|
|
@@ -109,6 +111,13 @@ function handleMouseLeave() {
|
|
|
109
111
|
on:mouseleave={handleMouseLeave}
|
|
110
112
|
on:keydown={handleKeyDown}
|
|
111
113
|
on:click
|
|
114
|
+
use:conditionalEvent={{
|
|
115
|
+
condition: closeFlyout,
|
|
116
|
+
event: "click",
|
|
117
|
+
callback: e => {
|
|
118
|
+
if (!cascading) closeFlyout(e);
|
|
119
|
+
}
|
|
120
|
+
}}
|
|
112
121
|
{...$$restProps}
|
|
113
122
|
>
|
|
114
123
|
<slot name="icon" />
|
package/package.json
CHANGED