Keep open button menu with checkboxes
This commit is contained in:
parent
bb632f4208
commit
7833a5c13a
@ -19,6 +19,7 @@ export type ButtonMenuItemOptions = {
|
|||||||
element?: HTMLElement,
|
element?: HTMLElement,
|
||||||
options?: AttachClickOptions,
|
options?: AttachClickOptions,
|
||||||
checkboxField?: CheckboxField,
|
checkboxField?: CheckboxField,
|
||||||
|
keepOpen?: boolean
|
||||||
/* , cancelEvent?: true */
|
/* , cancelEvent?: true */
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -40,11 +41,16 @@ const ButtonMenuItem = (options: ButtonMenuItemOptions) => {
|
|||||||
}, options.options);
|
}, options.options);
|
||||||
}
|
}
|
||||||
|
|
||||||
// * cancel keyboard close
|
const keepOpen = !!options.checkboxField || !!options.keepOpen;
|
||||||
attachClickEvent(el, CLICK_EVENT_NAME !== 'click' ? (e) => {
|
|
||||||
|
// * cancel mobile keyboard close
|
||||||
|
attachClickEvent(el, CLICK_EVENT_NAME !== 'click' || keepOpen ? (e) => {
|
||||||
cancelEvent(e);
|
cancelEvent(e);
|
||||||
onClick(e);
|
onClick(e);
|
||||||
closeBtnMenu();
|
|
||||||
|
if(!keepOpen) {
|
||||||
|
closeBtnMenu();
|
||||||
|
}
|
||||||
} : onClick, options.options);
|
} : onClick, options.options);
|
||||||
|
|
||||||
return options.element = el;
|
return options.element = el;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user