From f8eed001140a4805a44382094f9302e10aa5ddc1 Mon Sep 17 00:00:00 2001 From: bsteinbk <65047615+bsteinbk@users.noreply.github.com> Date: Tue, 15 Mar 2022 17:20:23 -0400 Subject: [PATCH 1/3] fix bug where the wrong number of parameters were being passed --- ui/appui-react/src/appui-react/widgets/WidgetManager.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/appui-react/src/appui-react/widgets/WidgetManager.ts b/ui/appui-react/src/appui-react/widgets/WidgetManager.ts index f28cf8ab51e7..d11ab6d59a36 100644 --- a/ui/appui-react/src/appui-react/widgets/WidgetManager.ts +++ b/ui/appui-react/src/appui-react/widgets/WidgetManager.ts @@ -156,7 +156,7 @@ export class WidgetManager { // Consult the UiItemsManager to get any Abstract widgets if (location in StagePanelLocation) { - const widgets = UiItemsManager.getWidgets(stageId, stageUsage, location as StagePanelLocation, definedSection, frontstageApplicationData); + const widgets = UiItemsManager.getWidgets(stageId, stageUsage, location as StagePanelLocation, definedSection, undefined, frontstageApplicationData); widgets.forEach((abstractProps: AbstractWidgetProps, index: number) => { const props = WidgetDef.createWidgetPropsFromAbstractProps(abstractProps); const stableId = getAddonStableWidgetId(stageUsage, location as StagePanelLocation, definedSection, index); From 5463a81b8cfb0867fd014074478a5ef17498be4f Mon Sep 17 00:00:00 2001 From: bsteinbk <65047615+bsteinbk@users.noreply.github.com> Date: Thu, 17 Mar 2022 18:27:01 -0400 Subject: [PATCH 2/3] fix missing parameter in provide widgets --- common/api/appui-abstract.api.md | 4 ++-- ui/appui-abstract/src/appui-abstract/UiItemsManager.ts | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/common/api/appui-abstract.api.md b/common/api/appui-abstract.api.md index cd6030c73e97..59d7147c8754 100644 --- a/common/api/appui-abstract.api.md +++ b/common/api/appui-abstract.api.md @@ -253,11 +253,11 @@ export abstract class BaseQuantityDescription implements PropertyDescription { // @public export class BaseUiItemsProvider implements UiItemsProvider { - constructor(_providerId: string, isSupportedStage?: ((stageId: string, stageUsage: string, stageAppData?: any) => boolean) | undefined); + constructor(_providerId: string, isSupportedStage?: ((stageId: string, stageUsage: string, stageAppData?: any, provider?: UiItemsProvider | undefined) => boolean) | undefined); // (undocumented) get id(): string; // (undocumented) - isSupportedStage?: ((stageId: string, stageUsage: string, stageAppData?: any) => boolean) | undefined; + isSupportedStage?: ((stageId: string, stageUsage: string, stageAppData?: any, provider?: UiItemsProvider | undefined) => boolean) | undefined; // (undocumented) onUnregister(): void; provideBackstageItems(): BackstageItem[]; diff --git a/ui/appui-abstract/src/appui-abstract/UiItemsManager.ts b/ui/appui-abstract/src/appui-abstract/UiItemsManager.ts index e8425bae7a9e..dfc9ddf3ae3b 100644 --- a/ui/appui-abstract/src/appui-abstract/UiItemsManager.ts +++ b/ui/appui-abstract/src/appui-abstract/UiItemsManager.ts @@ -62,7 +62,7 @@ export class BaseUiItemsProvider implements UiItemsProvider { * @param isSupportedStage - optional function that will be called to determine if tools should be added to current stage. If not set and * the current stage's `usage` is set to `StageUsage.General` then the provider will add items to frontstage. */ - constructor(protected _providerId: string, public isSupportedStage?: (stageId: string, stageUsage: string, stageAppData?: any) => boolean) { } + constructor(protected _providerId: string, public isSupportedStage?: (stageId: string, stageUsage: string, stageAppData?: any, provider?: UiItemsProvider) => boolean) { } public get id(): string { return this._providerId; } public onUnregister(): void { } @@ -83,7 +83,7 @@ export class BaseUiItemsProvider implements UiItemsProvider { let provideToStage = false; if (this.isSupportedStage) { - provideToStage = this.isSupportedStage(stageId, stageUsage, stageAppData); + provideToStage = this.isSupportedStage(stageId, stageUsage, stageAppData, this); } else { provideToStage = (stageUsage === StageUsage.General); } @@ -98,7 +98,7 @@ export class BaseUiItemsProvider implements UiItemsProvider { let provideToStage = false; if (this.isSupportedStage) { - provideToStage = this.isSupportedStage(stageId, stageUsage, stageAppData); + provideToStage = this.isSupportedStage(stageId, stageUsage, stageAppData, this); } else { provideToStage = (stageUsage === StageUsage.General); } @@ -115,7 +115,7 @@ export class BaseUiItemsProvider implements UiItemsProvider { let provideToStage = false; if (this.isSupportedStage) { - provideToStage = this.isSupportedStage(stageId, stageUsage, stageAppData); + provideToStage = this.isSupportedStage(stageId, stageUsage, stageAppData, this); } else { provideToStage = (stageUsage === StageUsage.General); } From a869b6da8dcba259fbd3ae15f738796a82390abb Mon Sep 17 00:00:00 2001 From: bsteinbk <65047615+bsteinbk@users.noreply.github.com> Date: Thu, 17 Mar 2022 18:30:13 -0400 Subject: [PATCH 3/3] rush change --- .../appui-abstract/fixMiscUiBugs_2022-03-17-22-29.json | 10 ++++++++++ .../appui-react/fixMiscUiBugs_2022-03-17-22-29.json | 10 ++++++++++ 2 files changed, 20 insertions(+) create mode 100644 common/changes/@itwin/appui-abstract/fixMiscUiBugs_2022-03-17-22-29.json create mode 100644 common/changes/@itwin/appui-react/fixMiscUiBugs_2022-03-17-22-29.json diff --git a/common/changes/@itwin/appui-abstract/fixMiscUiBugs_2022-03-17-22-29.json b/common/changes/@itwin/appui-abstract/fixMiscUiBugs_2022-03-17-22-29.json new file mode 100644 index 000000000000..a13a2535af6c --- /dev/null +++ b/common/changes/@itwin/appui-abstract/fixMiscUiBugs_2022-03-17-22-29.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@itwin/appui-abstract", + "comment": "Fix missing parameter in UiManager.getWidgets call and pass provider to isSupportedStage function.", + "type": "none" + } + ], + "packageName": "@itwin/appui-abstract" +} \ No newline at end of file diff --git a/common/changes/@itwin/appui-react/fixMiscUiBugs_2022-03-17-22-29.json b/common/changes/@itwin/appui-react/fixMiscUiBugs_2022-03-17-22-29.json new file mode 100644 index 000000000000..bd573409beeb --- /dev/null +++ b/common/changes/@itwin/appui-react/fixMiscUiBugs_2022-03-17-22-29.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@itwin/appui-react", + "comment": "Fix missing parameter in UiManager.getWidgets call and pass provider to isSupportedStage function.", + "type": "none" + } + ], + "packageName": "@itwin/appui-react" +} \ No newline at end of file