@hypericon/mico 0.5.12 → 0.5.13
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/cjs/components/menu/Menu.d.ts +3 -0
- package/dist/cjs/components/menu/menu-manager.d.ts +5 -0
- package/dist/cjs/components/menu/menu-manager.js +21 -0
- package/dist/esm/components/menu/Menu.d.ts +3 -0
- package/dist/esm/components/menu/menu-manager.d.ts +5 -0
- package/dist/esm/components/menu/menu-manager.js +21 -0
- package/package.json +1 -1
|
@@ -27,6 +27,9 @@ export interface MenuOptions {
|
|
|
27
27
|
* Keep menu open when clicking within it. Useful for menus with toggle switches
|
|
28
28
|
* or radio buttons where users want to try multiple options without reopening the menu.
|
|
29
29
|
* The menu will still close when clicking outside or pressing Escape.
|
|
30
|
+
*
|
|
31
|
+
* N.B.: the menu will not be redrawn automatically, as it is not mounted using Mithril.
|
|
32
|
+
* Use `menuMgr.redraw()` to redraw the menu.
|
|
30
33
|
* @default false
|
|
31
34
|
*/
|
|
32
35
|
keepOpenOnClick?: boolean;
|
|
@@ -21,6 +21,11 @@ export declare class MenuManager {
|
|
|
21
21
|
* @param menuContents
|
|
22
22
|
*/
|
|
23
23
|
show(ev: MouseEvent | undefined, menuContents: m.ChildArrayOrPrimitive, options?: MenuOptions): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* Manually redraw the currently open menu. Useful when menu content needs to update
|
|
26
|
+
* while the menu remains open (e.g., when using keepOpenOnClick with changing state).
|
|
27
|
+
*/
|
|
28
|
+
redraw(): void;
|
|
24
29
|
hide(): void;
|
|
25
30
|
/**
|
|
26
31
|
* Set the default behavior for whether menus are added as children of the element that raised the event.
|
|
@@ -160,6 +160,27 @@ class MenuManager {
|
|
|
160
160
|
menu_settings_1.MENU_SETTINGS.DEBUG_MENU && console.log("Added menu");
|
|
161
161
|
});
|
|
162
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* Manually redraw the currently open menu. Useful when menu content needs to update
|
|
165
|
+
* while the menu remains open (e.g., when using keepOpenOnClick with changing state).
|
|
166
|
+
*/
|
|
167
|
+
redraw() {
|
|
168
|
+
var _a;
|
|
169
|
+
if (!this.isOpen || !this.menuVnode) {
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
// Re-render the menu in whichever container it's currently mounted
|
|
173
|
+
if ((_a = this.currentOptions) === null || _a === void 0 ? void 0 : _a.asDialog) {
|
|
174
|
+
mithril_1.default.render(this.dialogEl, this.menuVnode);
|
|
175
|
+
}
|
|
176
|
+
else if (this.directParentWrapperEl) {
|
|
177
|
+
mithril_1.default.render(this.directParentWrapperEl, this.menuVnode);
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
mithril_1.default.render(this.containerEl, this.menuVnode);
|
|
181
|
+
}
|
|
182
|
+
menu_settings_1.MENU_SETTINGS.DEBUG_MENU && console.log("Redrawn menu");
|
|
183
|
+
}
|
|
163
184
|
hide() {
|
|
164
185
|
var _a, _b;
|
|
165
186
|
this._menuVnode.next(undefined);
|
|
@@ -27,6 +27,9 @@ export interface MenuOptions {
|
|
|
27
27
|
* Keep menu open when clicking within it. Useful for menus with toggle switches
|
|
28
28
|
* or radio buttons where users want to try multiple options without reopening the menu.
|
|
29
29
|
* The menu will still close when clicking outside or pressing Escape.
|
|
30
|
+
*
|
|
31
|
+
* N.B.: the menu will not be redrawn automatically, as it is not mounted using Mithril.
|
|
32
|
+
* Use `menuMgr.redraw()` to redraw the menu.
|
|
30
33
|
* @default false
|
|
31
34
|
*/
|
|
32
35
|
keepOpenOnClick?: boolean;
|
|
@@ -21,6 +21,11 @@ export declare class MenuManager {
|
|
|
21
21
|
* @param menuContents
|
|
22
22
|
*/
|
|
23
23
|
show(ev: MouseEvent | undefined, menuContents: m.ChildArrayOrPrimitive, options?: MenuOptions): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* Manually redraw the currently open menu. Useful when menu content needs to update
|
|
26
|
+
* while the menu remains open (e.g., when using keepOpenOnClick with changing state).
|
|
27
|
+
*/
|
|
28
|
+
redraw(): void;
|
|
24
29
|
hide(): void;
|
|
25
30
|
/**
|
|
26
31
|
* Set the default behavior for whether menus are added as children of the element that raised the event.
|
|
@@ -160,6 +160,27 @@ class MenuManager {
|
|
|
160
160
|
menu_settings_1.MENU_SETTINGS.DEBUG_MENU && console.log("Added menu");
|
|
161
161
|
});
|
|
162
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* Manually redraw the currently open menu. Useful when menu content needs to update
|
|
165
|
+
* while the menu remains open (e.g., when using keepOpenOnClick with changing state).
|
|
166
|
+
*/
|
|
167
|
+
redraw() {
|
|
168
|
+
var _a;
|
|
169
|
+
if (!this.isOpen || !this.menuVnode) {
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
// Re-render the menu in whichever container it's currently mounted
|
|
173
|
+
if ((_a = this.currentOptions) === null || _a === void 0 ? void 0 : _a.asDialog) {
|
|
174
|
+
mithril_1.default.render(this.dialogEl, this.menuVnode);
|
|
175
|
+
}
|
|
176
|
+
else if (this.directParentWrapperEl) {
|
|
177
|
+
mithril_1.default.render(this.directParentWrapperEl, this.menuVnode);
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
mithril_1.default.render(this.containerEl, this.menuVnode);
|
|
181
|
+
}
|
|
182
|
+
menu_settings_1.MENU_SETTINGS.DEBUG_MENU && console.log("Redrawn menu");
|
|
183
|
+
}
|
|
163
184
|
hide() {
|
|
164
185
|
var _a, _b;
|
|
165
186
|
this._menuVnode.next(undefined);
|