From 14e84b32f2cbb369cb40145314d419515e8c04c3 Mon Sep 17 00:00:00 2001 From: Ben Grynhaus Date: Mon, 13 Aug 2018 16:13:31 +0300 Subject: [PATCH] Fix wrong type for renderIcon --- libs/fabric/package.json | 2 +- .../command-bar/command-bar.component.ts | 34 ++++--------------- 2 files changed, 8 insertions(+), 28 deletions(-) diff --git a/libs/fabric/package.json b/libs/fabric/package.json index 0baeef8e..aba167a0 100644 --- a/libs/fabric/package.json +++ b/libs/fabric/package.json @@ -1,7 +1,7 @@ { "$schema": "../../node_modules/ng-packagr/package.schema.json", "name": "@angular-react/fabric", - "version": "0.3.0", + "version": "0.3.1", "ngPackage": { "lib": { "entryFile": "public-api.ts", diff --git a/libs/fabric/src/lib/components/command-bar/command-bar.component.ts b/libs/fabric/src/lib/components/command-bar/command-bar.component.ts index f652442c..0a90bd22 100644 --- a/libs/fabric/src/lib/components/command-bar/command-bar.component.ts +++ b/libs/fabric/src/lib/components/command-bar/command-bar.component.ts @@ -1,31 +1,13 @@ import { InputRendererOptions, Omit, ReactWrapperComponent } from '@angular-react/core'; -import { - AfterContentInit, - ChangeDetectionStrategy, - ChangeDetectorRef, - Component, - ContentChild, - ElementRef, - EventEmitter, - Input, - OnDestroy, - Output, - QueryList, - ViewChild, -} from '@angular/core'; +import { AfterContentInit, ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChild, ElementRef, EventEmitter, Input, OnDestroy, Output, QueryList, ViewChild } from '@angular/core'; import { ICommandBarItemProps, ICommandBarProps } from 'office-ui-fabric-react/lib/CommandBar'; -import { IContextualMenuItemProps } from 'office-ui-fabric-react/lib/ContextualMenu'; +import { IContextualMenuItem } from 'office-ui-fabric-react/lib/ContextualMenu'; import { Subscription } from 'rxjs'; import { OnChanges, TypedChanges } from '../../declarations/angular/typed-changes'; import omit from '../../utils/omit'; import { mergeItemChanges } from '../core/declarative/item-changed'; import { CommandBarItemChangedPayload, CommandBarItemDirective } from './directives/command-bar-item.directives'; -import { - CommandBarFarItemsDirective, - CommandBarItemsDirective, - CommandBarItemsDirectiveBase, - CommandBarOverflowItemsDirective, -} from './directives/command-bar-items.directives'; +import { CommandBarFarItemsDirective, CommandBarItemsDirective, CommandBarItemsDirectiveBase, CommandBarOverflowItemsDirective } from './directives/command-bar-items.directives'; @Component({ selector: 'fab-command-bar', @@ -210,11 +192,9 @@ export class FabCommandBarComponent extends ReactWrapperComponent iconRenderer({ contextualMenuItemProps: props }) } as Pick< - ICommandBarItemProps, - 'onRenderIcon' - >), + iconRenderer && { + onRenderIcon: (item: IContextualMenuItem) => iconRenderer({ contextualMenuItem: item }), + } as any /* NOTE: Fix for wrong typings of `onRenderIcon` in office-ui-fabric-react */, renderer && ({ onRender: (item, dismissMenu) => renderer({ item, dismissMenu }) } as Pick) ) as ICommandBarItemProps; @@ -234,5 +214,5 @@ export interface ICommandBarItemOptionsRenderContext { } export interface ICommandBarItemOptionsRenderIconContext { - readonly contextualMenuItemProps: IContextualMenuItemProps; + readonly contextualMenuItem: IContextualMenuItem; }