本文整理汇总了TypeScript中@ephox/alloy.TieredMenu.sketch方法的典型用法代码示例。如果您正苦于以下问题:TypeScript TieredMenu.sketch方法的具体用法?TypeScript TieredMenu.sketch怎么用?TypeScript TieredMenu.sketch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@ephox/alloy.TieredMenu
的用法示例。
在下文中一共展示了TieredMenu.sketch方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
const sketch = function (settings) {
const dataset = convert(settings.formats, function () {
return memMenu;
});
// Turn settings into a tiered menu data.
const memMenu = Memento.record(TieredMenu.sketch({
dom: {
tag: 'div',
classes: [ Styles.resolve('styles-menu') ]
},
components: [ ],
// Focus causes issues when the things being focused are offscreen.
fakeFocus: true,
// For animations, need things to stay around in the DOM (at least until animation is done)
stayInDom: true,
onExecute (tmenu, item) {
const v = Representing.getValue(item);
settings.handle(item, v.value);
},
onEscape () {
},
onOpenMenu (container, menu) {
const w = Width.get(container.element());
Width.set(menu.element(), w);
Transitioning.jumpTo(menu, 'current');
},
onOpenSubmenu (container, item, submenu) {
const w = Width.get(container.element());
const menu = SelectorFind.ancestor(item.element(), '[role="menu"]').getOrDie('hacky');
const menuComp = container.getSystem().getByDom(menu).getOrDie();
Width.set(submenu.element(), w);
Transitioning.progressTo(menuComp, 'before');
Transitioning.jumpTo(submenu, 'after');
Transitioning.progressTo(submenu, 'current');
},
onCollapseMenu (container, item, menu) {
const submenu = SelectorFind.ancestor(item.element(), '[role="menu"]').getOrDie('hacky');
const submenuComp = container.getSystem().getByDom(submenu).getOrDie();
Transitioning.progressTo(submenuComp, 'after');
Transitioning.progressTo(menu, 'current');
},
navigateOnHover: false,
openImmediately: true,
data: dataset.tmenu,
markers: {
backgroundMenu: Styles.resolve('styles-background-menu'),
menu: Styles.resolve('styles-menu'),
selectedMenu: Styles.resolve('styles-selected-menu'),
item: Styles.resolve('styles-item'),
selectedItem: Styles.resolve('styles-selected-item')
}
}));
return memMenu.asSpec();
};