How to use the @bentley/ui-abstract.ToolbarItemType.ActionButton 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
// console.log(`Requesting tools for toolbar ${toolBarId}`);

    if ("[ViewsFrontstage]ToolWidget-horizontal" === toolBarId) {
      const simpleActionSpec: ActionItemInsertSpec = {
        itemType: ToolbarItemType.ActionButton,
        itemId: "simple-test-action-tool",
        execute: (): void => {
          // tslint:disable-next-line: no-console
          console.log("Got Here!");
        },
        icon: "icon-developer",
        label: "simple-test-action-tool",
      };

      const childActionSpec: ActionItemInsertSpec = {
        itemType: ToolbarItemType.ActionButton,
        itemId: "child-test-action-tool",
        condition: {
          type: ConditionalDisplayType.Visibility,
          testFunc: (): boolean => SampleAppIModelApp.getTestProperty() !== "HIDE",
          syncEventIds: [SampleAppUiActionId.setTestProperty],
        },
        execute: (): void => {
          // tslint:disable-next-line: no-console
          console.log("Got Here!");
        },
        icon: "icon-developer",
        label: "child-test-action-tool",
      };

      const nestedActionSpec: ActionItemInsertSpec = {
        itemType: ToolbarItemType.ActionButton,
github imodeljs / imodeljs / test-apps / ui-test-app / src / frontend / tools / UiProviderTool.ts View on Github external
} 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!");
        },
        icon: "icon-developer",
        label: "test action tool (navH)",
      };
      return [navHorizontalSpec];
    } else if ("[ViewsFrontstage]NavigationWidget-vertical" === toolBarId) {
      const navVerticalSpec: ActionItemInsertSpec = {
        itemType: ToolbarItemType.ActionButton,
        itemId: "nav2-test-action-tool",
        execute: (): void => {
          // tslint:disable-next-line: no-console
          console.log("Got Here!");
        },
        icon: "icon-developer",
        label: "test action tool (navV)",
      };
      return [navVerticalSpec];
    }

    return [];
  }
}
github imodeljs / imodeljs / plugins / iot-demo / src / ui / IotUiProvider.tsx View on Github external
public provideToolbarItems(toolBarId: string, _itemIds: UiItemNode): ToolbarItemInsertSpec[] {
    // For 9-zone apps the toolbarId will be in form -[stageName]ToolWidget|NavigationWidget-horizontal|vertical
    // examples:"[ViewsFrontstage]ToolWidget-horizontal" "[ViewsFrontstage]NavigationWidget-vertical"
    if (toolBarId.includes("ToolWidget-horizontal")) {
      const lastActionSpec: ActionItemInsertSpec = {
        itemType: ToolbarItemType.ActionButton,
        itemId: "iotPlugin:openDialog",
        execute: this.showIotDialog,
        icon: `svg:${iotButtonSvg}`,
        label: "Show IoT Dialog",
      };
      return [lastActionSpec];
    }
    return [];
  }
github imodeljs / imodeljs / plugins / geo-photo / src / ui / GPDialogUiProvider.tsx View on Github external
public provideToolbarItems(toolBarId: string, _itemIds: UiItemNode): ToolbarItemInsertSpec[] {
    // For 9-zone apps the toolbarId will be in form -[stageName]ToolWidget|NavigationWidget-horizontal|vertical
    // examples:"[ViewsFrontstage]ToolWidget-horizontal" "[ViewsFrontstage]NavigationWidget-vertical"
    if (toolBarId.includes("ToolWidget-horizontal")) {
      const lastActionSpec: ActionItemInsertSpec = {
        itemType: ToolbarItemType.ActionButton,
        itemId: "geoPhotoPlugin:openDialog",
        execute: this.showGeoPhotoDialog,
        icon: `svg:${geoPhotoButtonSvg}`,
        label: "Show GeoPhoto Markers",
      };
      return [lastActionSpec];
    }
    return [];
  }
}
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);
      });