How to use the @bentley/ui-abstract.ToolbarItemType.GroupButton function in @bentley/ui-abstract

To help you get started, we’ve selected a few @bentley/ui-abstract examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github imodeljs / imodeljs / test-apps / ui-test-app / src / frontend / tools / UiProviderTool.ts View on Github external
};

      const nestedActionSpec: ActionItemInsertSpec = {
        itemType: ToolbarItemType.ActionButton,
        parentToolGroupId: "tool-formatting-setting",
        itemId: "nested-test-action-tool",
        execute: (): void => {
          // tslint:disable-next-line: no-console
          console.log("Got Here!");
        },
        icon: "icon-developer",
        label: "test action tool (nested)",
      };

      const groupSpec: GroupItemInsertSpec = {
        itemType: ToolbarItemType.GroupButton,
        itemId: "test-tool-group",
        badge: BadgeType.TechnicalPreview,
        icon: "icon-developer",
        label: "test group",
        items: [childActionSpec, simpleActionSpec],
      };

      return [simpleActionSpec, nestedActionSpec, groupSpec];

    } else if ("[ViewsFrontstage]NavigationWidget-horizontal" === toolBarId) {
      const navHorizontalSpec: ActionItemInsertSpec = {
        itemType: ToolbarItemType.ActionButton,
        itemId: "nav1-test-action-tool",
        execute: (): void => {
          // tslint:disable-next-line: no-console
          console.log("Got Here!");
github imodeljs / imodeljs / ui / framework / src / ui-framework / widgets / ToolbarWidgetBase.tsx View on Github external
private createItemDefFromInsertSpec(spec: ToolbarItemInsertSpec): ItemDefBase | undefined {
    let itemDef: ItemDefBase | undefined;

    // istanbul ignore else
    if (ToolbarItemType.ActionButton === spec.itemType) {
      const actionSpec = spec as ActionItemInsertSpec;
      itemDef = new CommandItemDef({
        commandId: actionSpec.itemId,
        iconSpec: actionSpec.icon,
        label: actionSpec.label,
        execute: actionSpec.execute,
        badgeType: actionSpec.badge,
      });
    } else if (ToolbarItemType.GroupButton === spec.itemType) {
      const groupSpec = spec as GroupItemInsertSpec;
      const childItems: AnyItemDef[] = [];
      groupSpec.items.forEach((childSpec: ToolbarItemInsertSpec) => {
        const childItem = this.createItemDefFromInsertSpec(childSpec) as AnyItemDef;
        if (childItem)
          childItems.push(childItem);
      });
      itemDef = new GroupItemDef({
        groupId: groupSpec.itemId,
        iconSpec: groupSpec.icon,
        label: groupSpec.label,
        badgeType: groupSpec.badge,
        items: childItems,
      });
    }