@intechstudio/grid-uikit 1.20260116.1329 → 1.20260206.1447
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/dist/context-target.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { Action } from "svelte/action";
|
|
2
|
-
import
|
|
2
|
+
import { type ContextMenuItem } from "./ContextMenu.svelte";
|
|
3
3
|
import { type Writable } from "svelte/store";
|
|
4
4
|
export interface ContextMenuOptions {
|
|
5
5
|
items: ContextMenuItem[];
|
|
6
6
|
}
|
|
7
|
-
interface
|
|
7
|
+
interface ContextMenuStore extends Writable<Record<string, any> | undefined> {
|
|
8
8
|
close: () => void;
|
|
9
9
|
}
|
|
10
|
-
export declare
|
|
10
|
+
export declare const contextMenu: ContextMenuStore;
|
|
11
11
|
export declare const contextTarget: Action<HTMLElement, ContextMenuOptions>;
|
|
12
12
|
export {};
|
package/dist/context-target.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import ContextMenu, {} from "./ContextMenu.svelte";
|
|
2
|
+
import { mount, unmount } from "svelte";
|
|
2
3
|
import { get, writable } from "svelte/store";
|
|
3
|
-
export let contextMenu = createContextMenuStore();
|
|
4
4
|
function createContextMenuStore() {
|
|
5
5
|
const store = writable(undefined);
|
|
6
6
|
const close = () => {
|
|
7
7
|
const cm = get(store);
|
|
8
8
|
if (cm) {
|
|
9
|
-
cm
|
|
9
|
+
unmount(cm);
|
|
10
10
|
store.set(undefined);
|
|
11
11
|
}
|
|
12
12
|
};
|
|
@@ -15,6 +15,7 @@ function createContextMenuStore() {
|
|
|
15
15
|
close,
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
|
+
export const contextMenu = createContextMenuStore();
|
|
18
19
|
export const contextTarget = (node, options) => {
|
|
19
20
|
const handleContextMenu = (e) => {
|
|
20
21
|
e.preventDefault();
|
|
@@ -25,7 +26,7 @@ export const contextTarget = (node, options) => {
|
|
|
25
26
|
const createContextMenu = async (x, y) => {
|
|
26
27
|
// If a context menu is already open, destroy it
|
|
27
28
|
contextMenu.close();
|
|
28
|
-
contextMenu.set(
|
|
29
|
+
contextMenu.set(mount(ContextMenu, {
|
|
29
30
|
target: document.body,
|
|
30
31
|
props: {
|
|
31
32
|
target: node,
|