@itwin/appui-react 3.2.0-dev.20 → 3.2.0-dev.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/appui-react/backstage/BackstageComposerItem.d.ts.map +1 -1
- package/lib/cjs/appui-react/backstage/BackstageComposerItem.js +4 -2
- package/lib/cjs/appui-react/backstage/BackstageComposerItem.js.map +1 -1
- package/lib/cjs/appui-react/frontstage/Frontstage.d.ts +5 -0
- package/lib/cjs/appui-react/frontstage/Frontstage.d.ts.map +1 -1
- package/lib/cjs/appui-react/frontstage/Frontstage.js +9 -1
- package/lib/cjs/appui-react/frontstage/Frontstage.js.map +1 -1
- package/lib/cjs/appui-react/frontstage/FrontstageComposer.d.ts.map +1 -1
- package/lib/cjs/appui-react/frontstage/FrontstageComposer.js +2 -0
- package/lib/cjs/appui-react/frontstage/FrontstageComposer.js.map +1 -1
- package/lib/cjs/appui-react/frontstage/FrontstageDef.d.ts.map +1 -1
- package/lib/cjs/appui-react/frontstage/FrontstageDef.js +9 -4
- package/lib/cjs/appui-react/frontstage/FrontstageDef.js.map +1 -1
- package/lib/cjs/appui-react/stagepanels/StagePanel.d.ts +1 -1
- package/lib/cjs/appui-react/stagepanels/StagePanel.d.ts.map +1 -1
- package/lib/cjs/appui-react/stagepanels/StagePanel.js.map +1 -1
- package/lib/cjs/appui-react/stagepanels/StagePanelDef.d.ts +6 -4
- package/lib/cjs/appui-react/stagepanels/StagePanelDef.d.ts.map +1 -1
- package/lib/cjs/appui-react/stagepanels/StagePanelDef.js +6 -10
- package/lib/cjs/appui-react/stagepanels/StagePanelDef.js.map +1 -1
- package/lib/cjs/appui-react/statusfields/Indicator.d.ts +3 -3
- package/lib/cjs/appui-react/statusfields/Indicator.d.ts.map +1 -1
- package/lib/cjs/appui-react/statusfields/Indicator.js.map +1 -1
- package/lib/cjs/appui-react/ui-items-provider/StandardStatusbarItemsProvider.d.ts +2 -2
- package/lib/cjs/appui-react/ui-items-provider/StandardStatusbarItemsProvider.js +4 -3
- package/lib/cjs/appui-react/ui-items-provider/StandardStatusbarItemsProvider.js.map +1 -1
- package/lib/cjs/appui-react/utils/PropsHelper.d.ts +3 -1
- package/lib/cjs/appui-react/utils/PropsHelper.d.ts.map +1 -1
- package/lib/cjs/appui-react/utils/PropsHelper.js +10 -0
- package/lib/cjs/appui-react/utils/PropsHelper.js.map +1 -1
- package/lib/cjs/appui-react/utils/UiShowHideManager.d.ts.map +1 -1
- package/lib/cjs/appui-react/utils/UiShowHideManager.js +1 -0
- package/lib/cjs/appui-react/utils/UiShowHideManager.js.map +1 -1
- package/lib/cjs/appui-react/widget-panels/Frontstage.d.ts +17 -1
- package/lib/cjs/appui-react/widget-panels/Frontstage.d.ts.map +1 -1
- package/lib/cjs/appui-react/widget-panels/Frontstage.js +124 -123
- package/lib/cjs/appui-react/widget-panels/Frontstage.js.map +1 -1
- package/lib/cjs/appui-react/widget-panels/ToolSettings.scss +10 -0
- package/lib/cjs/appui-react/widgets/WidgetDef.d.ts +8 -1
- package/lib/cjs/appui-react/widgets/WidgetDef.d.ts.map +1 -1
- package/lib/cjs/appui-react/widgets/WidgetDef.js +13 -3
- package/lib/cjs/appui-react/widgets/WidgetDef.js.map +1 -1
- package/lib/cjs/appui-react/widgets/WidgetHost.d.ts +1 -1
- package/lib/cjs/appui-react/widgets/WidgetHost.d.ts.map +1 -1
- package/lib/cjs/appui-react/widgets/WidgetHost.js +56 -7
- package/lib/cjs/appui-react/widgets/WidgetHost.js.map +1 -1
- package/lib/cjs/appui-react/widgets/WidgetManager.d.ts.map +1 -1
- package/lib/cjs/appui-react/widgets/WidgetManager.js +1 -0
- package/lib/cjs/appui-react/widgets/WidgetManager.js.map +1 -1
- package/lib/esm/appui-react/backstage/BackstageComposerItem.d.ts.map +1 -1
- package/lib/esm/appui-react/backstage/BackstageComposerItem.js +5 -3
- package/lib/esm/appui-react/backstage/BackstageComposerItem.js.map +1 -1
- package/lib/esm/appui-react/frontstage/Frontstage.d.ts +5 -0
- package/lib/esm/appui-react/frontstage/Frontstage.d.ts.map +1 -1
- package/lib/esm/appui-react/frontstage/Frontstage.js +7 -0
- package/lib/esm/appui-react/frontstage/Frontstage.js.map +1 -1
- package/lib/esm/appui-react/frontstage/FrontstageComposer.d.ts.map +1 -1
- package/lib/esm/appui-react/frontstage/FrontstageComposer.js +2 -0
- package/lib/esm/appui-react/frontstage/FrontstageComposer.js.map +1 -1
- package/lib/esm/appui-react/frontstage/FrontstageDef.d.ts.map +1 -1
- package/lib/esm/appui-react/frontstage/FrontstageDef.js +9 -4
- package/lib/esm/appui-react/frontstage/FrontstageDef.js.map +1 -1
- package/lib/esm/appui-react/stagepanels/StagePanel.d.ts +1 -1
- package/lib/esm/appui-react/stagepanels/StagePanel.d.ts.map +1 -1
- package/lib/esm/appui-react/stagepanels/StagePanel.js.map +1 -1
- package/lib/esm/appui-react/stagepanels/StagePanelDef.d.ts +6 -4
- package/lib/esm/appui-react/stagepanels/StagePanelDef.d.ts.map +1 -1
- package/lib/esm/appui-react/stagepanels/StagePanelDef.js +6 -10
- package/lib/esm/appui-react/stagepanels/StagePanelDef.js.map +1 -1
- package/lib/esm/appui-react/statusfields/Indicator.d.ts +3 -3
- package/lib/esm/appui-react/statusfields/Indicator.d.ts.map +1 -1
- package/lib/esm/appui-react/statusfields/Indicator.js.map +1 -1
- package/lib/esm/appui-react/ui-items-provider/StandardStatusbarItemsProvider.d.ts +2 -2
- package/lib/esm/appui-react/ui-items-provider/StandardStatusbarItemsProvider.js +4 -3
- package/lib/esm/appui-react/ui-items-provider/StandardStatusbarItemsProvider.js.map +1 -1
- package/lib/esm/appui-react/utils/PropsHelper.d.ts +3 -1
- package/lib/esm/appui-react/utils/PropsHelper.d.ts.map +1 -1
- package/lib/esm/appui-react/utils/PropsHelper.js +11 -1
- package/lib/esm/appui-react/utils/PropsHelper.js.map +1 -1
- package/lib/esm/appui-react/utils/UiShowHideManager.d.ts.map +1 -1
- package/lib/esm/appui-react/utils/UiShowHideManager.js +1 -0
- package/lib/esm/appui-react/utils/UiShowHideManager.js.map +1 -1
- package/lib/esm/appui-react/widget-panels/Frontstage.d.ts +17 -1
- package/lib/esm/appui-react/widget-panels/Frontstage.d.ts.map +1 -1
- package/lib/esm/appui-react/widget-panels/Frontstage.js +125 -124
- package/lib/esm/appui-react/widget-panels/Frontstage.js.map +1 -1
- package/lib/esm/appui-react/widget-panels/ToolSettings.scss +10 -0
- package/lib/esm/appui-react/widgets/WidgetDef.d.ts +8 -1
- package/lib/esm/appui-react/widgets/WidgetDef.d.ts.map +1 -1
- package/lib/esm/appui-react/widgets/WidgetDef.js +13 -3
- package/lib/esm/appui-react/widgets/WidgetDef.js.map +1 -1
- package/lib/esm/appui-react/widgets/WidgetHost.d.ts +1 -1
- package/lib/esm/appui-react/widgets/WidgetHost.d.ts.map +1 -1
- package/lib/esm/appui-react/widgets/WidgetHost.js +56 -7
- package/lib/esm/appui-react/widgets/WidgetHost.js.map +1 -1
- package/lib/esm/appui-react/widgets/WidgetManager.d.ts.map +1 -1
- package/lib/esm/appui-react/widgets/WidgetManager.js +1 -0
- package/lib/esm/appui-react/widgets/WidgetManager.js.map +1 -1
- package/package.json +33 -32
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WidgetDef.js","sourceRoot":"","sources":["../../../../src/appui-react/widgets/WidgetDef.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EAAoF,OAAO,EAAE,OAAO,EAAmB,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEzK,OAAO,EAAE,sBAAsB,EAAoC,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AAC9I,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAChF,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAGpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,WAAW,EA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I,OAAO,GAAG,KAAK,EAAE,OAAO,GAAG,KAAK,CAAC;YACrC,IAAI,IAAI,CAAC,aAAa;gBACpB,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,qBAAqB,EAAE,CAAC;YACvD,IAAI,IAAI,CAAC,sBAAsB;gBAC7B,OAAO,GAAG,IAAI,CAAC,sBAAsB,EAAE,CAAC;YAC1C,MAAM,GAAG,CAAC,CAAC,OAAO,IAAI,OAAO,CAAC,CAAC;SAChC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;;OAGG;IACI,IAAI;QACT,iBAAiB,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAChE,CAAC;IAED;;OAEG;IACI,MAAM;QACX,iBAAiB,CAAC,mBAAmB,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAClE,CAAC;;AA3Wc,cAAI,GAAG,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Widget\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { AbstractWidgetProps, BadgeType, ConditionalStringValue, PointProps, StringGetter, UiError, UiEvent, UiSyncEventArgs, WidgetState } from \"@itwin/appui-abstract\";\r\nimport { Direction, PanelSide } from \"@itwin/appui-layout-react\";\r\nimport { ConfigurableCreateInfo, ConfigurableUiControlConstructor, ConfigurableUiControlType } from \"../configurableui/ConfigurableUiControl\";\r\nimport { ConfigurableUiManager } from \"../configurableui/ConfigurableUiManager\";\r\nimport { FrontstageManager } from \"../frontstage/FrontstageManager\";\r\nimport { CommandItemDef } from \"../shared/CommandItemDef\";\r\nimport { ItemList } from \"../shared/ItemMap\";\r\nimport { SyncUiEventDispatcher } from \"../syncui/SyncUiEventDispatcher\";\r\nimport { UiFramework } from \"../UiFramework\";\r\nimport { PropsHelper } from \"../utils/PropsHelper\";\r\nimport { WidgetControl } from \"./WidgetControl\";\r\nimport { WidgetProps } from \"./WidgetProps\";\r\nimport { StatusBarWidgetComposerControl } from \"./StatusBarWidgetComposerControl\";\r\n\r\nconst widgetStateNameMap = new Map<WidgetState, string>([\r\n [WidgetState.Closed, \"Closed\"],\r\n [WidgetState.Floating, \"Floating\"],\r\n [WidgetState.Hidden, \"Hidden\"],\r\n [WidgetState.Open, \"Open\"],\r\n [WidgetState.Unloaded, \"Unloaded\"],\r\n]);\r\n\r\n/** Widget State Changed Event Args interface.\r\n * @public\r\n */\r\nexport interface WidgetStateChangedEventArgs {\r\n widgetDef: WidgetDef;\r\n widgetState: WidgetState;\r\n}\r\n\r\n/** Widget State Changed Event class.\r\n * @public\r\n */\r\nexport class WidgetStateChangedEvent extends UiEvent<WidgetStateChangedEventArgs> { }\r\n\r\n/** @internal */\r\nexport interface WidgetChangedEventArgs {\r\n widgetDef: WidgetDef;\r\n}\r\n\r\n/** @internal */\r\nexport interface WidgetEventArgs {\r\n widgetDef: WidgetDef;\r\n}\r\n\r\n/** Widget type enum.\r\n * @public\r\n */\r\nexport enum WidgetType {\r\n Tool,\r\n Navigation,\r\n FreeFrom,\r\n Rectangular,\r\n ToolSettings,\r\n StatusBar,\r\n}\r\n\r\n/** Properties for a Toolbar Widget.\r\n * @public\r\n */\r\nexport interface ToolbarWidgetProps extends WidgetProps {\r\n horizontalDirection?: Direction; // eslint-disable-line deprecation/deprecation\r\n verticalDirection?: Direction; // eslint-disable-line deprecation/deprecation\r\n\r\n horizontalItems?: ItemList;\r\n verticalItems?: ItemList;\r\n}\r\n\r\n/** Properties for a Tool Widget.\r\n * @public\r\n */\r\nexport interface ToolWidgetProps extends ToolbarWidgetProps {\r\n appButton?: CommandItemDef;\r\n}\r\n\r\n/** Properties for a Navigation Widget.\r\n * @public\r\n */\r\nexport interface NavigationWidgetProps extends ToolbarWidgetProps {\r\n navigationAidId?: string;\r\n}\r\n\r\n/** Union of all Widget properties.\r\n * @public\r\n */\r\nexport type AnyWidgetProps = WidgetProps | ToolWidgetProps | NavigationWidgetProps;\r\n\r\n/** Prototype for WidgetDef StateFunc (UI 1.0 only deprecate ???)\r\n * @public\r\n */\r\nexport type WidgetStateFunc = (state: Readonly<WidgetState>) => WidgetState;\r\n\r\n/** @internal */\r\nexport interface TabLocation {\r\n widgetId: string;\r\n widgetIndex: number;\r\n side: PanelSide;\r\n tabIndex: number;\r\n}\r\n\r\n// -----------------------------------------------------------------------------\r\n\r\n/** A Widget Definition in the 9-Zone Layout system.\r\n * @public\r\n */\r\nexport class WidgetDef {\r\n private static _sId = 0;\r\n private _label: string | ConditionalStringValue | StringGetter = \"\";\r\n private _tooltip: string | ConditionalStringValue | StringGetter = \"\";\r\n private _widgetReactNode: React.ReactNode;\r\n private _widgetControl!: WidgetControl;\r\n private _defaultState: WidgetState = WidgetState.Unloaded;\r\n private _state: WidgetState = WidgetState.Unloaded;\r\n private _id: string;\r\n private _classId: string | ConfigurableUiControlConstructor | undefined = undefined;\r\n private _priority: number = 0;\r\n private _isFreeform: boolean = false;\r\n private _isFloatingStateSupported: boolean = false;\r\n private _isFloatingStateWindowResizable: boolean = true;\r\n private _isToolSettings: boolean = false;\r\n private _isStatusBar: boolean = false;\r\n private _stateChanged: boolean = false;\r\n private _fillZone: boolean = false;\r\n private _syncEventIds: string[] = [];\r\n private _stateFunc?: WidgetStateFunc;\r\n private _widgetType: WidgetType = WidgetType.Rectangular;\r\n private _applicationData?: any;\r\n private _iconSpec?: string | ConditionalStringValue | React.ReactNode;\r\n private _badgeType?: BadgeType;\r\n private _onWidgetStateChanged?: () => void;\r\n private _saveTransientState?: () => void;\r\n private _restoreTransientState?: () => boolean;\r\n private _preferredPanelSize: \"fit-content\" | undefined;\r\n private _canPopout?: boolean;\r\n private _floatingContainerId?: string;\r\n private _defaultFloatingPosition: PointProps | undefined;\r\n private _initialProps?: WidgetProps;\r\n\r\n private _tabLocation: TabLocation = {\r\n side: \"left\",\r\n tabIndex: 0,\r\n widgetId: \"\",\r\n widgetIndex: 0,\r\n };\r\n\r\n public get state(): WidgetState {\r\n if (\"1\" === UiFramework.uiVersion)\r\n return this._state;\r\n\r\n const frontstageDef = FrontstageManager.activeFrontstageDef;\r\n if (frontstageDef?.findWidgetDef(this.id)) {\r\n const currentState = frontstageDef.getWidgetCurrentState(this);\r\n if (undefined !== currentState)\r\n return currentState;\r\n }\r\n return this.defaultState;\r\n }\r\n\r\n public get id(): string { return this._id; }\r\n public get classId(): string | ConfigurableUiControlConstructor | undefined { return this._classId; }\r\n public get priority(): number { return this._priority; }\r\n public get isFreeform(): boolean { return this._isFreeform; }\r\n public get isFloatingStateSupported(): boolean { return this._isFloatingStateSupported; }\r\n public get isFloatingStateWindowResizable(): boolean { return this._isFloatingStateWindowResizable; }\r\n public get isToolSettings(): boolean { return this._isToolSettings; }\r\n public get isStatusBar(): boolean { return this._isStatusBar; }\r\n public get stateChanged(): boolean { return this._stateChanged; }\r\n public get fillZone(): boolean { return this._fillZone; }\r\n public get syncEventIds(): string[] { return this._syncEventIds; }\r\n public get stateFunc(): WidgetStateFunc | undefined { return this._stateFunc; }\r\n public get applicationData(): any | undefined { return this._applicationData; }\r\n public get isFloating(): boolean { return this.state === WidgetState.Floating; }\r\n public get iconSpec(): string | ConditionalStringValue | React.ReactNode { return this._iconSpec; }\r\n public get badgeType(): BadgeType | undefined { return this._badgeType; }\r\n public get initialProps(): WidgetProps | undefined { return this._initialProps; }\r\n\r\n public get widgetType(): WidgetType { return this._widgetType; }\r\n public set widgetType(type: WidgetType) { this._widgetType = type; }\r\n\r\n /** @internal */\r\n public get tabLocation() { return this._tabLocation; }\r\n public set tabLocation(tabLocation: TabLocation) { this._tabLocation = tabLocation; }\r\n\r\n /** @internal */\r\n public get defaultFloatingPosition() { return this._defaultFloatingPosition; }\r\n public set defaultFloatingPosition(position: PointProps | undefined) { this._defaultFloatingPosition = position; }\r\n\r\n /** @internal */\r\n public get defaultState() { return this._defaultState; }\r\n\r\n constructor(widgetProps: WidgetProps) {\r\n if (widgetProps.id !== undefined)\r\n this._id = widgetProps.id;\r\n else {\r\n WidgetDef._sId++;\r\n this._id = `Widget-${WidgetDef._sId}`;\r\n }\r\n\r\n WidgetDef.initializeFromWidgetProps(widgetProps, this);\r\n }\r\n\r\n public static initializeFromWidgetProps(widgetProps: WidgetProps, me: WidgetDef) {\r\n me._initialProps = widgetProps;\r\n if (widgetProps.label)\r\n me.setLabel(widgetProps.label);\r\n else if (widgetProps.labelKey)\r\n me._label = UiFramework.localization.getLocalizedString(widgetProps.labelKey);\r\n\r\n me.setCanPopout(widgetProps.canPopout);\r\n me.setFloatingContainerId(widgetProps.floatingContainerId);\r\n me.defaultFloatingPosition = widgetProps.defaultFloatingPosition ? widgetProps.defaultFloatingPosition as PointProps : undefined;\r\n\r\n if (widgetProps.priority !== undefined)\r\n me._priority = widgetProps.priority;\r\n\r\n if (widgetProps.tooltip)\r\n me.setTooltip(widgetProps.tooltip);\r\n else if (widgetProps.tooltipKey)\r\n me._tooltip = UiFramework.localization.getLocalizedString(widgetProps.tooltipKey);\r\n\r\n if (widgetProps.control !== undefined)\r\n me._classId = widgetProps.control;\r\n else if (widgetProps.classId !== undefined)\r\n me._classId = widgetProps.classId;\r\n\r\n if (widgetProps.defaultState !== undefined) {\r\n me._defaultState = widgetProps.defaultState;\r\n if (\"1\" === UiFramework.uiVersion)\r\n me._state = widgetProps.defaultState === WidgetState.Floating ? WidgetState.Open : widgetProps.defaultState;\r\n }\r\n\r\n if (widgetProps.isFreeform !== undefined) {\r\n me._isFreeform = widgetProps.isFreeform;\r\n me._widgetType = me.isFreeform ? WidgetType.FreeFrom : WidgetType.Rectangular;\r\n }\r\n\r\n if (widgetProps.isFloatingStateSupported !== undefined)\r\n me._isFloatingStateSupported = widgetProps.isFloatingStateSupported;\r\n if (widgetProps.isFloatingStateWindowResizable !== undefined)\r\n me._isFloatingStateWindowResizable = widgetProps.isFloatingStateWindowResizable;\r\n if (widgetProps.isToolSettings !== undefined)\r\n me._isToolSettings = widgetProps.isToolSettings;\r\n if (widgetProps.isStatusBar !== undefined)\r\n me._isStatusBar = widgetProps.isStatusBar;\r\n if (widgetProps.fillZone !== undefined)\r\n me._fillZone = widgetProps.fillZone;\r\n\r\n if (widgetProps.applicationData !== undefined)\r\n me._applicationData = widgetProps.applicationData;\r\n\r\n if (widgetProps.element !== undefined)\r\n me._widgetReactNode = widgetProps.element;\r\n\r\n if (widgetProps.iconSpec !== undefined)\r\n me._iconSpec = widgetProps.iconSpec;\r\n // istanbul ignore if\r\n if (widgetProps.icon !== undefined)\r\n me._iconSpec = widgetProps.icon;\r\n\r\n if (widgetProps.badgeType !== undefined)\r\n me._badgeType = widgetProps.badgeType;\r\n\r\n me._preferredPanelSize = widgetProps.preferredPanelSize;\r\n me._onWidgetStateChanged = widgetProps.onWidgetStateChanged;\r\n me._saveTransientState = widgetProps.saveTransientState;\r\n me._restoreTransientState = widgetProps.restoreTransientState;\r\n\r\n me.setUpSyncSupport(widgetProps);\r\n }\r\n\r\n public static createWidgetPropsFromAbstractProps(abstractWidgetProps: AbstractWidgetProps): WidgetProps {\r\n const widgetProps: WidgetProps = abstractWidgetProps;\r\n widgetProps.element = abstractWidgetProps.getWidgetContent();\r\n return widgetProps;\r\n }\r\n\r\n public setUpSyncSupport(props: WidgetProps) {\r\n if (props.stateFunc && props.syncEventIds && props.syncEventIds.length > 0) {\r\n this._syncEventIds = props.syncEventIds;\r\n this._stateFunc = props.stateFunc;\r\n SyncUiEventDispatcher.onSyncUiEvent.addListener(this._handleSyncUiEvent);\r\n }\r\n }\r\n\r\n private _handleSyncUiEvent = (args: UiSyncEventArgs): void => {\r\n if ((this.syncEventIds.length > 0) && this.syncEventIds.some((value: string): boolean => args.eventIds.has(value.toLowerCase()))) {\r\n // istanbul ignore else\r\n if (this.stateFunc) {\r\n let newState = this.state;\r\n newState = this.stateFunc(newState);\r\n this.setWidgetState(newState);\r\n }\r\n }\r\n };\r\n\r\n /** @alpha */\r\n public get preferredPanelSize() {\r\n return this._preferredPanelSize;\r\n }\r\n\r\n /** Get the label string */\r\n public get label(): string {\r\n return PropsHelper.getStringFromSpec(this._label);\r\n }\r\n\r\n /** Set the label.\r\n * @param v A string or a function to get the string.\r\n */\r\n public setLabel(v: string | ConditionalStringValue | StringGetter) {\r\n if (this._label === v)\r\n return;\r\n this._label = v;\r\n FrontstageManager.onWidgetLabelChangedEvent.emit({ widgetDef: this });\r\n }\r\n\r\n /** Get the tooltip string */\r\n public get tooltip(): string {\r\n return PropsHelper.getStringFromSpec(this._tooltip);\r\n }\r\n\r\n /** Set the tooltip.\r\n * @param v A string or a function to get the string.\r\n */\r\n public setTooltip(v: string | ConditionalStringValue | StringGetter) {\r\n this._tooltip = v;\r\n }\r\n\r\n public get widgetControl(): WidgetControl | undefined {\r\n return this._widgetControl;\r\n }\r\n\r\n public getWidgetControl(type: ConfigurableUiControlType): WidgetControl | undefined {\r\n if (!this._widgetControl && this.classId) {\r\n let usedClassId: string = \"\";\r\n\r\n if (typeof this.classId === \"string\") {\r\n // istanbul ignore else\r\n if (this.classId)\r\n this._widgetControl = ConfigurableUiManager.createControl(this.classId, this.id, this.applicationData) as WidgetControl;\r\n usedClassId = this.classId;\r\n } else {\r\n const info = new ConfigurableCreateInfo(this.classId.name, this.id, this.id);\r\n usedClassId = this.classId.name;\r\n this._widgetControl = new this.classId(info, this.applicationData) as WidgetControl;\r\n }\r\n\r\n // istanbul ignore else\r\n if (this._widgetControl) {\r\n if (this._widgetControl.getType() !== type) {\r\n throw new UiError(UiFramework.loggerCategory(this), `getWidgetControl: '${usedClassId}' is NOT a ${type}; it is a ${this._widgetControl.getType()}`);\r\n }\r\n\r\n this._widgetControl.widgetDef = this;\r\n this._widgetControl.initialize();\r\n }\r\n }\r\n\r\n // istanbul ignore next - To avoid breaking API changes, if a WidgetControl is not specified for a status bar use Default one.\r\n if (!this._widgetControl && this.isStatusBar) {\r\n const info = new ConfigurableCreateInfo(\"StatusBarWidgetComposerControl\", StatusBarWidgetComposerControl.controlId, StatusBarWidgetComposerControl.controlId);\r\n this._widgetControl = new StatusBarWidgetComposerControl(info, undefined);\r\n this._widgetControl.widgetDef = this;\r\n this._widgetControl.initialize();\r\n }\r\n\r\n return this._widgetControl;\r\n }\r\n\r\n public get reactNode(): React.ReactNode {\r\n if (!this._widgetReactNode) {\r\n const widgetControl = this.getWidgetControl(ConfigurableUiControlType.Widget);\r\n\r\n // istanbul ignore else\r\n if (widgetControl && widgetControl.reactNode)\r\n this._widgetReactNode = widgetControl.reactNode;\r\n }\r\n\r\n return this._widgetReactNode;\r\n }\r\n\r\n public set reactNode(node: React.ReactNode) {\r\n this._widgetReactNode = node;\r\n }\r\n\r\n public setWidgetState(newState: WidgetState): void {\r\n if (this.state === newState)\r\n return;\r\n if (\"1\" === UiFramework.uiVersion)\r\n this._state = newState;\r\n this._stateChanged = true;\r\n FrontstageManager.onWidgetStateChangedEvent.emit({ widgetDef: this, widgetState: newState });\r\n this.onWidgetStateChanged();\r\n }\r\n\r\n public setCanPopout(value: boolean | undefined) {\r\n this._canPopout = value;\r\n }\r\n\r\n public get canPopout(): boolean | undefined {\r\n return (this._canPopout);\r\n }\r\n\r\n public setFloatingContainerId(value: string | undefined) {\r\n this._floatingContainerId = value;\r\n }\r\n\r\n public get floatingContainerId(): string | undefined {\r\n return (this._floatingContainerId);\r\n }\r\n\r\n public canOpen(): boolean {\r\n return (this.isFloating || this.isActive);\r\n }\r\n\r\n public get isVisible(): boolean {\r\n return WidgetState.Hidden !== this.state;\r\n }\r\n\r\n public get activeState(): WidgetState {\r\n return this.state;\r\n }\r\n\r\n public get isActive(): boolean {\r\n return WidgetState.Open === this.activeState;\r\n }\r\n\r\n public onWidgetStateChanged(): void {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this.widgetControl && UiFramework.postTelemetry(`Widget ${this.widgetControl.classId} state set to ${widgetStateNameMap.get(this.state)}`, \"35402486-9839-441E-A5C7-46D546142D11\");\r\n this.widgetControl && this.widgetControl.onWidgetStateChanged();\r\n // istanbul ignore next\r\n this._onWidgetStateChanged && this._onWidgetStateChanged();\r\n }\r\n\r\n /** Overwrite to save transient DOM state (i.e. scroll offset). */\r\n public saveTransientState(): void {\r\n this.widgetControl && this.widgetControl.saveTransientState();\r\n this._saveTransientState && this._saveTransientState();\r\n }\r\n\r\n /** Overwrite to restore transient DOM state.\r\n * @note Return true if the state is restored or the Widget will remount.\r\n */\r\n public restoreTransientState(): boolean {\r\n let result = true;\r\n if (this.widgetControl || this._restoreTransientState) {\r\n let result1 = false, result2 = false;\r\n if (this.widgetControl)\r\n result1 = this.widgetControl.restoreTransientState();\r\n if (this._restoreTransientState)\r\n result2 = this._restoreTransientState();\r\n result = !(result1 || result2);\r\n }\r\n return result;\r\n }\r\n\r\n /** Opens the widget and makes it visible to the user.\r\n * I.e. opens the stage panel or brings the floating widget to front of the screen.\r\n * @alpha\r\n */\r\n public show() {\r\n FrontstageManager.onWidgetShowEvent.emit({ widgetDef: this });\r\n }\r\n\r\n /** Opens the widget and expands it to fill full size of the stage panel.\r\n * @alpha\r\n */\r\n public expand() {\r\n FrontstageManager.onWidgetExpandEvent.emit({ widgetDef: this });\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"WidgetDef.js","sourceRoot":"","sources":["../../../../src/appui-react/widgets/WidgetDef.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EAAoF,OAAO,EAAE,OAAO,EAAmB,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEzK,OAAO,EAAE,sBAAsB,EAAoC,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AAC9I,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAChF,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAGpE,OAAO,EAAE,qBAAqB,EAAE,M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E,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAChE,CAAC;IAED;;OAEG;IACI,MAAM;QACX,iBAAiB,CAAC,mBAAmB,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAClE,CAAC;;AAvXc,cAAI,GAAG,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Widget\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { AbstractWidgetProps, BadgeType, ConditionalStringValue, PointProps, StringGetter, UiError, UiEvent, UiSyncEventArgs, WidgetState } from \"@itwin/appui-abstract\";\r\nimport { Direction, PanelSide } from \"@itwin/appui-layout-react\";\r\nimport { ConfigurableCreateInfo, ConfigurableUiControlConstructor, ConfigurableUiControlType } from \"../configurableui/ConfigurableUiControl\";\r\nimport { ConfigurableUiManager } from \"../configurableui/ConfigurableUiManager\";\r\nimport { FrontstageManager } from \"../frontstage/FrontstageManager\";\r\nimport { CommandItemDef } from \"../shared/CommandItemDef\";\r\nimport { ItemList } from \"../shared/ItemMap\";\r\nimport { SyncUiEventDispatcher } from \"../syncui/SyncUiEventDispatcher\";\r\nimport { UiFramework } from \"../UiFramework\";\r\nimport { PropsHelper } from \"../utils/PropsHelper\";\r\nimport { WidgetControl } from \"./WidgetControl\";\r\nimport { WidgetProps } from \"./WidgetProps\";\r\nimport { StatusBarWidgetComposerControl } from \"./StatusBarWidgetComposerControl\";\r\nimport { IconHelper, IconSpec, SizeProps } from \"@itwin/core-react\";\r\n\r\nconst widgetStateNameMap = new Map<WidgetState, string>([\r\n [WidgetState.Closed, \"Closed\"],\r\n [WidgetState.Floating, \"Floating\"],\r\n [WidgetState.Hidden, \"Hidden\"],\r\n [WidgetState.Open, \"Open\"],\r\n [WidgetState.Unloaded, \"Unloaded\"],\r\n]);\r\n\r\n/** Widget State Changed Event Args interface.\r\n * @public\r\n */\r\nexport interface WidgetStateChangedEventArgs {\r\n widgetDef: WidgetDef;\r\n widgetState: WidgetState;\r\n}\r\n\r\n/** Widget State Changed Event class.\r\n * @public\r\n */\r\nexport class WidgetStateChangedEvent extends UiEvent<WidgetStateChangedEventArgs> { }\r\n\r\n/** @internal */\r\nexport interface WidgetChangedEventArgs {\r\n widgetDef: WidgetDef;\r\n}\r\n\r\n/** @internal */\r\nexport interface WidgetEventArgs {\r\n widgetDef: WidgetDef;\r\n}\r\n\r\n/** Widget type enum.\r\n * @public\r\n */\r\nexport enum WidgetType {\r\n Tool,\r\n Navigation,\r\n FreeFrom,\r\n Rectangular,\r\n ToolSettings,\r\n StatusBar,\r\n}\r\n\r\n/** Properties for a Toolbar Widget.\r\n * @public\r\n */\r\nexport interface ToolbarWidgetProps extends WidgetProps {\r\n horizontalDirection?: Direction; // eslint-disable-line deprecation/deprecation\r\n verticalDirection?: Direction; // eslint-disable-line deprecation/deprecation\r\n\r\n horizontalItems?: ItemList;\r\n verticalItems?: ItemList;\r\n}\r\n\r\n/** Properties for a Tool Widget.\r\n * @public\r\n */\r\nexport interface ToolWidgetProps extends ToolbarWidgetProps {\r\n appButton?: CommandItemDef;\r\n}\r\n\r\n/** Properties for a Navigation Widget.\r\n * @public\r\n */\r\nexport interface NavigationWidgetProps extends ToolbarWidgetProps {\r\n navigationAidId?: string;\r\n}\r\n\r\n/** Union of all Widget properties.\r\n * @public\r\n */\r\nexport type AnyWidgetProps = WidgetProps | ToolWidgetProps | NavigationWidgetProps;\r\n\r\n/** Prototype for WidgetDef StateFunc (UI 1.0 only deprecate ???)\r\n * @public\r\n */\r\nexport type WidgetStateFunc = (state: Readonly<WidgetState>) => WidgetState;\r\n\r\n/** @internal */\r\nexport interface TabLocation {\r\n widgetId: string;\r\n widgetIndex: number;\r\n side: PanelSide;\r\n tabIndex: number;\r\n}\r\n\r\n// -----------------------------------------------------------------------------\r\n\r\n/** A Widget Definition in the 9-Zone Layout system.\r\n * @public\r\n */\r\nexport class WidgetDef {\r\n private static _sId = 0;\r\n private _label: string | ConditionalStringValue | StringGetter = \"\";\r\n private _tooltip: string | ConditionalStringValue | StringGetter = \"\";\r\n private _widgetReactNode: React.ReactNode;\r\n private _widgetControl!: WidgetControl;\r\n private _defaultState: WidgetState = WidgetState.Unloaded;\r\n private _state: WidgetState = WidgetState.Unloaded;\r\n private _id: string;\r\n private _classId: string | ConfigurableUiControlConstructor | undefined = undefined;\r\n private _priority: number = 0;\r\n private _isFreeform: boolean = false;\r\n private _isFloatingStateSupported: boolean = false;\r\n private _isFloatingStateWindowResizable: boolean = true;\r\n private _isToolSettings: boolean = false;\r\n private _isStatusBar: boolean = false;\r\n private _stateChanged: boolean = false;\r\n private _fillZone: boolean = false;\r\n private _syncEventIds: string[] = [];\r\n private _stateFunc?: WidgetStateFunc;\r\n private _widgetType: WidgetType = WidgetType.Rectangular;\r\n private _applicationData?: any;\r\n private _iconSpec?: string | ConditionalStringValue | React.ReactNode;\r\n private _internalData?: Map<string,any>;\r\n private _badgeType?: BadgeType;\r\n private _onWidgetStateChanged?: () => void;\r\n private _saveTransientState?: () => void;\r\n private _restoreTransientState?: () => boolean;\r\n private _preferredPanelSize: \"fit-content\" | undefined;\r\n private _defaultFloatingSize: SizeProps | undefined;\r\n private _canPopout?: boolean;\r\n private _floatingContainerId?: string;\r\n private _defaultFloatingPosition: PointProps | undefined;\r\n private _initialProps?: WidgetProps;\r\n\r\n private _tabLocation: TabLocation = {\r\n side: \"left\",\r\n tabIndex: 0,\r\n widgetId: \"\",\r\n widgetIndex: 0,\r\n };\r\n\r\n public get state(): WidgetState {\r\n if (\"1\" === UiFramework.uiVersion)\r\n return this._state;\r\n\r\n const frontstageDef = FrontstageManager.activeFrontstageDef;\r\n if (frontstageDef && frontstageDef.findWidgetDef(this.id)) {\r\n const currentState = frontstageDef.getWidgetCurrentState(this);\r\n // istanbul ignore else\r\n if (undefined !== currentState)\r\n return currentState;\r\n }\r\n return this.defaultState;\r\n }\r\n\r\n public get id(): string { return this._id; }\r\n public get classId(): string | ConfigurableUiControlConstructor | undefined { return this._classId; }\r\n public get priority(): number { return this._priority; }\r\n public get isFreeform(): boolean { return this._isFreeform; }\r\n public get isFloatingStateSupported(): boolean { return this._isFloatingStateSupported; }\r\n public get isFloatingStateWindowResizable(): boolean { return this._isFloatingStateWindowResizable; }\r\n public get isToolSettings(): boolean { return this._isToolSettings; }\r\n public get isStatusBar(): boolean { return this._isStatusBar; }\r\n public get stateChanged(): boolean { return this._stateChanged; }\r\n public get fillZone(): boolean { return this._fillZone; }\r\n public get syncEventIds(): string[] { return this._syncEventIds; }\r\n public get stateFunc(): WidgetStateFunc | undefined { return this._stateFunc; }\r\n public get applicationData(): any | undefined { return this._applicationData; }\r\n public get isFloating(): boolean { return this.state === WidgetState.Floating; }\r\n public get iconSpec(): IconSpec { return this._iconSpec === IconHelper.reactIconKey ? IconHelper.getIconReactNode(this._iconSpec, this._internalData) : this._iconSpec; }\r\n public set iconSpec(spec: IconSpec ) { this._iconSpec = this._internalData ? IconHelper.getIconData(spec, this._internalData) : spec; }\r\n public get badgeType(): BadgeType | undefined { return this._badgeType; }\r\n public get initialProps(): WidgetProps | undefined { return this._initialProps; }\r\n\r\n public get widgetType(): WidgetType { return this._widgetType; }\r\n public set widgetType(type: WidgetType) { this._widgetType = type; }\r\n\r\n /** @internal */\r\n public get tabLocation() { return this._tabLocation; }\r\n public set tabLocation(tabLocation: TabLocation) { this._tabLocation = tabLocation; }\r\n\r\n /** @internal */\r\n public get defaultFloatingPosition() { return this._defaultFloatingPosition; }\r\n public set defaultFloatingPosition(position: PointProps | undefined) { this._defaultFloatingPosition = position; }\r\n\r\n /** @internal */\r\n public get defaultFloatingSize() { return this._defaultFloatingSize; }\r\n public set defaultFloatingSize(size: SizeProps | undefined) { this._defaultFloatingSize = size; }\r\n\r\n /** @internal */\r\n public get defaultState() { return this._defaultState; }\r\n\r\n constructor(widgetProps: WidgetProps) {\r\n if (widgetProps.id !== undefined)\r\n this._id = widgetProps.id;\r\n else {\r\n WidgetDef._sId++;\r\n this._id = `Widget-${WidgetDef._sId}`;\r\n }\r\n\r\n WidgetDef.initializeFromWidgetProps(widgetProps, this);\r\n }\r\n\r\n public static initializeFromWidgetProps(widgetProps: WidgetProps, me: WidgetDef) {\r\n me._initialProps = widgetProps;\r\n if (widgetProps.label)\r\n me.setLabel(widgetProps.label);\r\n else if (widgetProps.labelKey)\r\n me._label = UiFramework.localization.getLocalizedString(widgetProps.labelKey);\r\n\r\n me.setCanPopout(widgetProps.canPopout);\r\n me.setFloatingContainerId(widgetProps.floatingContainerId);\r\n me.defaultFloatingPosition = widgetProps.defaultFloatingPosition ? widgetProps.defaultFloatingPosition as PointProps : undefined;\r\n\r\n if (widgetProps.priority !== undefined)\r\n me._priority = widgetProps.priority;\r\n\r\n if (widgetProps.tooltip)\r\n me.setTooltip(widgetProps.tooltip);\r\n else if (widgetProps.tooltipKey)\r\n me._tooltip = UiFramework.localization.getLocalizedString(widgetProps.tooltipKey);\r\n\r\n if (widgetProps.control !== undefined)\r\n me._classId = widgetProps.control;\r\n else if (widgetProps.classId !== undefined)\r\n me._classId = widgetProps.classId;\r\n\r\n if (widgetProps.defaultState !== undefined) {\r\n me._defaultState = widgetProps.defaultState;\r\n // istanbul ignore next\r\n if (\"1\" === UiFramework.uiVersion)\r\n me._state = widgetProps.defaultState === WidgetState.Floating ? WidgetState.Open : widgetProps.defaultState;\r\n }\r\n\r\n if (widgetProps.isFreeform !== undefined) {\r\n me._isFreeform = widgetProps.isFreeform;\r\n me._widgetType = me.isFreeform ? WidgetType.FreeFrom : WidgetType.Rectangular;\r\n }\r\n\r\n if (widgetProps.isFloatingStateSupported !== undefined)\r\n me._isFloatingStateSupported = widgetProps.isFloatingStateSupported;\r\n if (widgetProps.isFloatingStateWindowResizable !== undefined)\r\n me._isFloatingStateWindowResizable = widgetProps.isFloatingStateWindowResizable;\r\n if (widgetProps.isToolSettings !== undefined)\r\n me._isToolSettings = widgetProps.isToolSettings;\r\n if (widgetProps.isStatusBar !== undefined)\r\n me._isStatusBar = widgetProps.isStatusBar;\r\n if (widgetProps.fillZone !== undefined)\r\n me._fillZone = widgetProps.fillZone;\r\n\r\n if (widgetProps.applicationData !== undefined)\r\n me._applicationData = widgetProps.applicationData;\r\n\r\n if (widgetProps.element !== undefined)\r\n me._widgetReactNode = widgetProps.element;\r\n\r\n if (widgetProps.iconSpec !== undefined)\r\n me._iconSpec = widgetProps.iconSpec;\r\n if (widgetProps.internalData)\r\n me._internalData = widgetProps.internalData;\r\n // istanbul ignore if\r\n if (widgetProps.icon !== undefined && me._iconSpec === undefined)\r\n me._iconSpec = widgetProps.icon;\r\n\r\n if (widgetProps.badgeType !== undefined)\r\n me._badgeType = widgetProps.badgeType;\r\n\r\n me._preferredPanelSize = widgetProps.preferredPanelSize;\r\n me._defaultFloatingSize = widgetProps.defaultFloatingSize;\r\n me._onWidgetStateChanged = widgetProps.onWidgetStateChanged;\r\n me._saveTransientState = widgetProps.saveTransientState;\r\n me._restoreTransientState = widgetProps.restoreTransientState;\r\n\r\n me.setUpSyncSupport(widgetProps);\r\n }\r\n\r\n public static createWidgetPropsFromAbstractProps(abstractWidgetProps: AbstractWidgetProps): WidgetProps {\r\n const widgetProps: WidgetProps = abstractWidgetProps;\r\n widgetProps.element = abstractWidgetProps.getWidgetContent();\r\n return widgetProps;\r\n }\r\n\r\n public setUpSyncSupport(props: WidgetProps) {\r\n if (props.stateFunc && props.syncEventIds && props.syncEventIds.length > 0) {\r\n this._syncEventIds = props.syncEventIds;\r\n this._stateFunc = props.stateFunc;\r\n SyncUiEventDispatcher.onSyncUiEvent.addListener(this._handleSyncUiEvent);\r\n }\r\n }\r\n\r\n private _handleSyncUiEvent = (args: UiSyncEventArgs): void => {\r\n if ((this.syncEventIds.length > 0) && this.syncEventIds.some((value: string): boolean => args.eventIds.has(value.toLowerCase()))) {\r\n // istanbul ignore else\r\n if (this.stateFunc) {\r\n let newState = this.state;\r\n newState = this.stateFunc(newState);\r\n this.setWidgetState(newState);\r\n }\r\n }\r\n };\r\n\r\n /** @alpha */\r\n public get preferredPanelSize() {\r\n return this._preferredPanelSize;\r\n }\r\n\r\n /** Get the label string */\r\n public get label(): string {\r\n return PropsHelper.getStringFromSpec(this._label);\r\n }\r\n\r\n /** Set the label.\r\n * @param v A string or a function to get the string.\r\n */\r\n public setLabel(v: string | ConditionalStringValue | StringGetter) {\r\n if (this._label === v)\r\n return;\r\n this._label = v;\r\n FrontstageManager.onWidgetLabelChangedEvent.emit({ widgetDef: this });\r\n }\r\n\r\n /** Get the tooltip string */\r\n public get tooltip(): string {\r\n return PropsHelper.getStringFromSpec(this._tooltip);\r\n }\r\n\r\n /** Set the tooltip.\r\n * @param v A string or a function to get the string.\r\n */\r\n public setTooltip(v: string | ConditionalStringValue | StringGetter) {\r\n this._tooltip = v;\r\n }\r\n\r\n public get widgetControl(): WidgetControl | undefined {\r\n return this._widgetControl;\r\n }\r\n\r\n public getWidgetControl(type: ConfigurableUiControlType): WidgetControl | undefined {\r\n if (!this._widgetControl && this.classId) {\r\n let usedClassId: string = \"\";\r\n\r\n if (typeof this.classId === \"string\") {\r\n // istanbul ignore else\r\n if (this.classId)\r\n this._widgetControl = ConfigurableUiManager.createControl(this.classId, this.id, this.applicationData) as WidgetControl;\r\n usedClassId = this.classId;\r\n } else {\r\n const info = new ConfigurableCreateInfo(this.classId.name, this.id, this.id);\r\n usedClassId = this.classId.name;\r\n this._widgetControl = new this.classId(info, this.applicationData) as WidgetControl;\r\n }\r\n\r\n // istanbul ignore else\r\n if (this._widgetControl) {\r\n if (this._widgetControl.getType() !== type) {\r\n throw new UiError(UiFramework.loggerCategory(this), `getWidgetControl: '${usedClassId}' is NOT a ${type}; it is a ${this._widgetControl.getType()}`);\r\n }\r\n\r\n this._widgetControl.widgetDef = this;\r\n this._widgetControl.initialize();\r\n }\r\n }\r\n\r\n // istanbul ignore next - To avoid breaking API changes, if a WidgetControl is not specified for a status bar use Default one.\r\n if (!this._widgetControl && this.isStatusBar) {\r\n const info = new ConfigurableCreateInfo(\"StatusBarWidgetComposerControl\", StatusBarWidgetComposerControl.controlId, StatusBarWidgetComposerControl.controlId);\r\n this._widgetControl = new StatusBarWidgetComposerControl(info, undefined);\r\n this._widgetControl.widgetDef = this;\r\n this._widgetControl.initialize();\r\n }\r\n\r\n return this._widgetControl;\r\n }\r\n\r\n public get reactNode(): React.ReactNode {\r\n if (!this._widgetReactNode) {\r\n const widgetControl = this.getWidgetControl(ConfigurableUiControlType.Widget);\r\n\r\n // istanbul ignore else\r\n if (widgetControl && widgetControl.reactNode)\r\n this._widgetReactNode = widgetControl.reactNode;\r\n }\r\n\r\n return this._widgetReactNode;\r\n }\r\n\r\n public set reactNode(node: React.ReactNode) {\r\n this._widgetReactNode = node;\r\n }\r\n\r\n public setWidgetState(newState: WidgetState): void {\r\n if (this.state === newState)\r\n return;\r\n if (\"1\" === UiFramework.uiVersion)\r\n this._state = newState;\r\n this._stateChanged = true;\r\n FrontstageManager.onWidgetStateChangedEvent.emit({ widgetDef: this, widgetState: newState });\r\n this.onWidgetStateChanged();\r\n }\r\n\r\n public setCanPopout(value: boolean | undefined) {\r\n this._canPopout = value;\r\n }\r\n\r\n public get canPopout(): boolean | undefined {\r\n return (this._canPopout);\r\n }\r\n\r\n public setFloatingContainerId(value: string | undefined) {\r\n this._floatingContainerId = value;\r\n }\r\n\r\n public get floatingContainerId(): string | undefined {\r\n return (this._floatingContainerId);\r\n }\r\n\r\n public canOpen(): boolean {\r\n return (this.isFloating || this.isActive);\r\n }\r\n\r\n public get isVisible(): boolean {\r\n return WidgetState.Hidden !== this.state;\r\n }\r\n\r\n public get activeState(): WidgetState {\r\n return this.state;\r\n }\r\n\r\n public get isActive(): boolean {\r\n return WidgetState.Open === this.activeState;\r\n }\r\n\r\n public onWidgetStateChanged(): void {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this.widgetControl && UiFramework.postTelemetry(`Widget ${this.widgetControl.classId} state set to ${widgetStateNameMap.get(this.state)}`, \"35402486-9839-441E-A5C7-46D546142D11\");\r\n this.widgetControl && this.widgetControl.onWidgetStateChanged();\r\n // istanbul ignore next\r\n this._onWidgetStateChanged && this._onWidgetStateChanged();\r\n }\r\n\r\n /** Overwrite to save transient DOM state (i.e. scroll offset). */\r\n public saveTransientState(): void {\r\n this.widgetControl && this.widgetControl.saveTransientState();\r\n this._saveTransientState && this._saveTransientState();\r\n }\r\n\r\n /** Overwrite to restore transient DOM state.\r\n * @note Return true if the state is restored or the Widget will remount.\r\n */\r\n public restoreTransientState(): boolean {\r\n let result = true;\r\n if (this.widgetControl || this._restoreTransientState) {\r\n let result1 = false, result2 = false;\r\n if (this.widgetControl)\r\n result1 = this.widgetControl.restoreTransientState();\r\n if (this._restoreTransientState)\r\n result2 = this._restoreTransientState();\r\n result = !(result1 || result2);\r\n }\r\n return result;\r\n }\r\n\r\n /** Opens the widget and makes it visible to the user.\r\n * I.e. opens the stage panel or brings the floating widget to front of the screen.\r\n * @alpha\r\n */\r\n public show() {\r\n FrontstageManager.onWidgetShowEvent.emit({ widgetDef: this });\r\n }\r\n\r\n /** Opens the widget and expands it to fill full size of the stage panel.\r\n * @alpha\r\n */\r\n public expand() {\r\n FrontstageManager.onWidgetExpandEvent.emit({ widgetDef: this });\r\n }\r\n}\r\n"]}
|
|
@@ -35,7 +35,7 @@ export declare class WidgetHost {
|
|
|
35
35
|
/** Updates the WidgetHost with dynamic widgets
|
|
36
36
|
* @internal
|
|
37
37
|
*/
|
|
38
|
-
updateDynamicWidgetDefs(stageId: string, stageUsage: string, location: ZoneLocation | StagePanelLocation, section: StagePanelSection | undefined,
|
|
38
|
+
updateDynamicWidgetDefs(stageId: string, stageUsage: string, location: ZoneLocation | StagePanelLocation, section: StagePanelSection | undefined, allStageWidgetDefs: WidgetDef[], frontstageApplicationData?: any): void;
|
|
39
39
|
/** Sorts all widgets */
|
|
40
40
|
private sortWidgetDefs;
|
|
41
41
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WidgetHost.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/widgets/WidgetHost.tsx"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE9E,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC;;;GAGG;AACH,qBAAa,UAAU;IAErB,OAAO,CAAC,WAAW,CAAuC;IAC1D,OAAO,CAAC,kBAAkB,CAAuC;IACjE,OAAO,CAAC,iBAAiB,CAAgC;IAEzD;OACG;;IAGH;;OAEG;IACI,YAAY,CAAC,SAAS,EAAE,SAAS;IAKxC,gCAAgC;IAChC,IAAW,UAAU,IAAI,aAAa,CAAC,SAAS,CAAC,CAEhD;IAED,kCAAkC;IAClC,IAAW,WAAW,IAAI,MAAM,CAE/B;IAED;;OAEG;IACI,kBAAkB,IAAI,SAAS,GAAG,SAAS;IAOlD;;;OAGG;IACI,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS;IAIvD;;OAEG;IACI,uBAAuB,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,GAAG,kBAAkB,EAAE,OAAO,EAAE,iBAAiB,GAAG,SAAS,EACrJ,
|
|
1
|
+
{"version":3,"file":"WidgetHost.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/widgets/WidgetHost.tsx"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE9E,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC;;;GAGG;AACH,qBAAa,UAAU;IAErB,OAAO,CAAC,WAAW,CAAuC;IAC1D,OAAO,CAAC,kBAAkB,CAAuC;IACjE,OAAO,CAAC,iBAAiB,CAAgC;IAEzD;OACG;;IAGH;;OAEG;IACI,YAAY,CAAC,SAAS,EAAE,SAAS;IAKxC,gCAAgC;IAChC,IAAW,UAAU,IAAI,aAAa,CAAC,SAAS,CAAC,CAEhD;IAED,kCAAkC;IAClC,IAAW,WAAW,IAAI,MAAM,CAE/B;IAED;;OAEG;IACI,kBAAkB,IAAI,SAAS,GAAG,SAAS;IAOlD;;;OAGG;IACI,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS;IAIvD;;OAEG;IACI,uBAAuB,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,GAAG,kBAAkB,EAAE,OAAO,EAAE,iBAAiB,GAAG,SAAS,EACrJ,kBAAkB,EAAE,SAAS,EAAE,EAAE,yBAAyB,CAAC,EAAE,GAAG,GAC/D,IAAI;IA6DP,wBAAwB;IACxB,OAAO,CAAC,cAAc;CAWvB"}
|
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
/** @packageDocumentation
|
|
7
7
|
* @module Widget
|
|
8
8
|
*/
|
|
9
|
+
import { StagePanelLocation, StagePanelSection } from "@itwin/appui-abstract";
|
|
9
10
|
import { UiFramework } from "../UiFramework";
|
|
11
|
+
import { ZoneLocation } from "../zones/Zone";
|
|
10
12
|
/**
|
|
11
13
|
* A WidgetHost represents a definition that hosts one or most Widgets in a Frontstage.
|
|
12
14
|
* @public
|
|
@@ -52,14 +54,61 @@ export class WidgetHost {
|
|
|
52
54
|
/** Updates the WidgetHost with dynamic widgets
|
|
53
55
|
* @internal
|
|
54
56
|
*/
|
|
55
|
-
updateDynamicWidgetDefs(stageId, stageUsage, location, section,
|
|
56
|
-
var _a;
|
|
57
|
-
widgetDefs
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return !duplicate;
|
|
57
|
+
updateDynamicWidgetDefs(stageId, stageUsage, location, section, allStageWidgetDefs, frontstageApplicationData) {
|
|
58
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
59
|
+
// get widgetDefs not already in allStageWidgetDefs and add them
|
|
60
|
+
const uniqueWidgets = this._widgetDefs.filter((widgetDef) => {
|
|
61
|
+
return !allStageWidgetDefs.find((wDef) => wDef.id === widgetDef.id);
|
|
61
62
|
});
|
|
62
|
-
|
|
63
|
+
allStageWidgetDefs.push(...uniqueWidgets);
|
|
64
|
+
let dynamicWidgetDefs;
|
|
65
|
+
if (location in ZoneLocation) {
|
|
66
|
+
switch (location) {
|
|
67
|
+
case ZoneLocation.CenterLeft:
|
|
68
|
+
break; // added to BottomLeft
|
|
69
|
+
case ZoneLocation.BottomLeft:
|
|
70
|
+
{
|
|
71
|
+
const middleDynamicWidgetDefs = (_a = UiFramework.widgetManager.getWidgetDefs(stageId, stageUsage, ZoneLocation.CenterLeft, section, frontstageApplicationData)) !== null && _a !== void 0 ? _a : [];
|
|
72
|
+
const bottomDynamicWidgetDefs = (_b = UiFramework.widgetManager.getWidgetDefs(stageId, stageUsage, ZoneLocation.BottomLeft, section, frontstageApplicationData)) !== null && _b !== void 0 ? _b : [];
|
|
73
|
+
dynamicWidgetDefs = [...middleDynamicWidgetDefs, ...bottomDynamicWidgetDefs];
|
|
74
|
+
}
|
|
75
|
+
break;
|
|
76
|
+
case ZoneLocation.CenterRight:
|
|
77
|
+
break; // added to BottomRight
|
|
78
|
+
case ZoneLocation.BottomRight:
|
|
79
|
+
{
|
|
80
|
+
const middleDynamicWidgetDefs = (_c = UiFramework.widgetManager.getWidgetDefs(stageId, stageUsage, ZoneLocation.CenterRight, section, frontstageApplicationData)) !== null && _c !== void 0 ? _c : [];
|
|
81
|
+
const bottomDynamicWidgetDefs = (_d = UiFramework.widgetManager.getWidgetDefs(stageId, stageUsage, ZoneLocation.BottomRight, section, frontstageApplicationData)) !== null && _d !== void 0 ? _d : [];
|
|
82
|
+
dynamicWidgetDefs = [...middleDynamicWidgetDefs, ...bottomDynamicWidgetDefs];
|
|
83
|
+
}
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
else if ((location in StagePanelLocation) && undefined !== section) {
|
|
88
|
+
switch (section) {
|
|
89
|
+
case StagePanelSection.Start: {
|
|
90
|
+
dynamicWidgetDefs = (_e = UiFramework.widgetManager.getWidgetDefs(stageId, stageUsage, location, StagePanelSection.Start, frontstageApplicationData)) !== null && _e !== void 0 ? _e : [];
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
case StagePanelSection.Middle:
|
|
94
|
+
break; // added to BottomLeft
|
|
95
|
+
case StagePanelSection.End: {
|
|
96
|
+
const middleDynamicWidgetDefs = (_f = UiFramework.widgetManager.getWidgetDefs(stageId, stageUsage, location, StagePanelSection.Middle, frontstageApplicationData)) !== null && _f !== void 0 ? _f : [];
|
|
97
|
+
const bottomDynamicWidgetDefs = (_g = UiFramework.widgetManager.getWidgetDefs(stageId, stageUsage, location, StagePanelSection.End, frontstageApplicationData)) !== null && _g !== void 0 ? _g : [];
|
|
98
|
+
dynamicWidgetDefs = [...middleDynamicWidgetDefs, ...bottomDynamicWidgetDefs];
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
const uniqueDynamicWidgetDefs = dynamicWidgetDefs === null || dynamicWidgetDefs === void 0 ? void 0 : dynamicWidgetDefs.filter((widgetDef) => {
|
|
104
|
+
return ((!allStageWidgetDefs.find((wDef) => wDef.id === widgetDef.id)));
|
|
105
|
+
});
|
|
106
|
+
// Now that we no longer support a middle panel section, yet we have existing API that allows a middle section to be
|
|
107
|
+
// defined, the following is needed to combining middle and end panel section widgets into a single set of widgets
|
|
108
|
+
if (uniqueDynamicWidgetDefs) {
|
|
109
|
+
allStageWidgetDefs.push(...uniqueDynamicWidgetDefs);
|
|
110
|
+
this._dynamicWidgetDefs = [...uniqueDynamicWidgetDefs];
|
|
111
|
+
}
|
|
63
112
|
this.sortWidgetDefs();
|
|
64
113
|
}
|
|
65
114
|
/** Sorts all widgets */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WidgetHost.js","sourceRoot":"","sources":["../../../../src/appui-react/widgets/WidgetHost.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,4CAA4C;AAC5C;;GAEG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAI7C;;;GAGG;AACH,MAAM,OAAO,UAAU;IAMrB;OACG;IACH;QANQ,gBAAW,GAAgB,IAAI,KAAK,EAAa,CAAC;QAElD,sBAAiB,GAA6B,EAAE,CAAC;IAIzC,CAAC;IAEjB;;OAEG;IACI,YAAY,CAAC,SAAoB;QACtC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACjC,IAAI,CAAC,cAAc,EAAE,CAAC;IACxB,CAAC;IAED,gCAAgC;IAChC,IAAW,UAAU;QACnB,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAChC,CAAC;IAED,kCAAkC;IAClC,IAAW,WAAW;QACpB,OAAO,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;IAChC,CAAC;IAED;;OAEG;IACI,kBAAkB;QACvB,IAAI,IAAI,CAAC,WAAW,KAAK,CAAC,EAAE;YAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;SAC3B;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;;OAGG;IACI,aAAa,CAAC,EAAU;QAC7B,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,SAAoB,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IAC7E,CAAC;IAED;;OAEG;IACI,uBAAuB,CAAC,OAAe,EAAE,UAAkB,EAAE,QAA2C,EAAE,OAAsC,EACrJ,UAAuB,EAAE,yBAA+B;;QAExD,UAAU,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC;QACrC,IAAI,CAAC,kBAAkB,GAAG,MAAA,WAAW,CAAC,aAAa,CAAC,aAAa,CAAC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,yBAAyB,CAAC,0CAChI,MAAM,CAAC,CAAC,SAAS,EAAE,EAAE;YACrB,MAAM,SAAS,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,SAAS,CAAC,EAAE,CAAC,CAAC;YACtE,OAAO,CAAC,SAAS,CAAC;QACpB,CAAC,CAAC,CAAC;QACL,IAAI,CAAC,kBAAkB,IAAI,UAAU,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,kBAAkB,CAAC,CAAC;QACvE,IAAI,CAAC,cAAc,EAAE,CAAC;IACxB,CAAC;IAED,wBAAwB;IAChB,cAAc;QACpB,IAAI,gBAAgB,GAAG,EAAE,CAAC;QAC1B,IAAI,IAAI,CAAC,kBAAkB;YACzB,gBAAgB,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;;YAEpE,gBAAgB,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;QAE9C,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC;QAEzD,IAAI,CAAC,iBAAiB,GAAG,gBAAgB,CAAC;IAC5C,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/* eslint-disable deprecation/deprecation */\r\n/** @packageDocumentation\r\n * @module Widget\r\n */\r\n\r\nimport { StagePanelLocation, StagePanelSection } from \"@itwin/appui-abstract\";\r\nimport { UiFramework } from \"../UiFramework\";\r\nimport { ZoneLocation } from \"../zones/Zone\";\r\nimport { WidgetDef } from \"./WidgetDef\";\r\n\r\n/**\r\n * A WidgetHost represents a definition that hosts one or most Widgets in a Frontstage.\r\n * @public\r\n */\r\nexport class WidgetHost {\r\n\r\n private _widgetDefs: WidgetDef[] = new Array<WidgetDef>();\r\n private _dynamicWidgetDefs: ReadonlyArray<WidgetDef> | undefined;\r\n private _sortedWidgetDefs: ReadonlyArray<WidgetDef> = [];\r\n\r\n /** Constructor for WidgetHost.\r\n */\r\n constructor() { }\r\n\r\n /** Adds a WidgetDef to the list of Widgets.\r\n * @param widgetDef Definition of the Widget to add\r\n */\r\n public addWidgetDef(widgetDef: WidgetDef) {\r\n this._widgetDefs.push(widgetDef);\r\n this.sortWidgetDefs();\r\n }\r\n\r\n /** Gets the list of Widgets. */\r\n public get widgetDefs(): ReadonlyArray<WidgetDef> {\r\n return this._sortedWidgetDefs;\r\n }\r\n\r\n /** Gets the number of Widgets. */\r\n public get widgetCount(): number {\r\n return this.widgetDefs.length;\r\n }\r\n\r\n /** If there is only one Widget in the Panel, gets the single WidgetDef.\r\n * @returns The single WidgetDef if there is only one Widget; otherwise, undefined is returned.\r\n */\r\n public getSingleWidgetDef(): WidgetDef | undefined {\r\n if (this.widgetCount === 1) {\r\n return this.widgetDefs[0];\r\n }\r\n return undefined;\r\n }\r\n\r\n /** Finds a WidgetDef with a given Id.\r\n * @param id Id of the WidgetDef to find\r\n * @returns The WidgetDef if found; otherwise, undefined is returned.\r\n */\r\n public findWidgetDef(id: string): WidgetDef | undefined {\r\n return this.widgetDefs.find((widgetDef: WidgetDef) => widgetDef.id === id);\r\n }\r\n\r\n /** Updates the WidgetHost with dynamic widgets\r\n * @internal\r\n */\r\n public updateDynamicWidgetDefs(stageId: string, stageUsage: string, location: ZoneLocation | StagePanelLocation, section: StagePanelSection | undefined,\r\n widgetDefs: WidgetDef[], frontstageApplicationData?: any\r\n ): void {\r\n widgetDefs.push(...this._widgetDefs);\r\n this._dynamicWidgetDefs = UiFramework.widgetManager.getWidgetDefs(stageId, stageUsage, location, section, frontstageApplicationData)\r\n ?.filter((widgetDef) => {\r\n const duplicate = widgetDefs.find((wDef) => wDef.id === widgetDef.id);\r\n return !duplicate;\r\n });\r\n this._dynamicWidgetDefs && widgetDefs.push(...this._dynamicWidgetDefs);\r\n this.sortWidgetDefs();\r\n }\r\n\r\n /** Sorts all widgets */\r\n private sortWidgetDefs(): void {\r\n let sortedWidgetDefs = [];\r\n if (this._dynamicWidgetDefs)\r\n sortedWidgetDefs = this._widgetDefs.concat(this._dynamicWidgetDefs);\r\n else\r\n sortedWidgetDefs = this._widgetDefs.slice();\r\n\r\n sortedWidgetDefs.sort((a, b) => a.priority - b.priority);\r\n\r\n this._sortedWidgetDefs = sortedWidgetDefs;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"WidgetHost.js","sourceRoot":"","sources":["../../../../src/appui-react/widgets/WidgetHost.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,4CAA4C;AAC5C;;GAEG;AAEH,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAG7C;;;GAGG;AACH,MAAM,OAAO,UAAU;IAMrB;OACG;IACH;QANQ,gBAAW,GAAgB,IAAI,KAAK,EAAa,CAAC;QAElD,sBAAiB,GAA6B,EAAE,CAAC;IAIzC,CAAC;IAEjB;;OAEG;IACI,YAAY,CAAC,SAAoB;QACtC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACjC,IAAI,CAAC,cAAc,EAAE,CAAC;IACxB,CAAC;IAED,gCAAgC;IAChC,IAAW,UAAU;QACnB,OAAO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AAgB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC;QAEzD,IAAI,CAAC,iBAAiB,GAAG,gBAAgB,CAAC;IAC5C,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/* eslint-disable deprecation/deprecation */\r\n/** @packageDocumentation\r\n * @module Widget\r\n */\r\n\r\nimport { StagePanelLocation, StagePanelSection } from \"@itwin/appui-abstract\";\r\nimport { UiFramework } from \"../UiFramework\";\r\nimport { ZoneLocation } from \"../zones/Zone\";\r\nimport { WidgetDef } from \"./WidgetDef\";\r\n\r\n/**\r\n * A WidgetHost represents a definition that hosts one or most Widgets in a Frontstage.\r\n * @public\r\n */\r\nexport class WidgetHost {\r\n\r\n private _widgetDefs: WidgetDef[] = new Array<WidgetDef>();\r\n private _dynamicWidgetDefs: ReadonlyArray<WidgetDef> | undefined;\r\n private _sortedWidgetDefs: ReadonlyArray<WidgetDef> = [];\r\n\r\n /** Constructor for WidgetHost.\r\n */\r\n constructor() { }\r\n\r\n /** Adds a WidgetDef to the list of Widgets.\r\n * @param widgetDef Definition of the Widget to add\r\n */\r\n public addWidgetDef(widgetDef: WidgetDef) {\r\n this._widgetDefs.push(widgetDef);\r\n this.sortWidgetDefs();\r\n }\r\n\r\n /** Gets the list of Widgets. */\r\n public get widgetDefs(): ReadonlyArray<WidgetDef> {\r\n return this._sortedWidgetDefs;\r\n }\r\n\r\n /** Gets the number of Widgets. */\r\n public get widgetCount(): number {\r\n return this.widgetDefs.length;\r\n }\r\n\r\n /** If there is only one Widget in the Panel, gets the single WidgetDef.\r\n * @returns The single WidgetDef if there is only one Widget; otherwise, undefined is returned.\r\n */\r\n public getSingleWidgetDef(): WidgetDef | undefined {\r\n if (this.widgetCount === 1) {\r\n return this.widgetDefs[0];\r\n }\r\n return undefined;\r\n }\r\n\r\n /** Finds a WidgetDef with a given Id.\r\n * @param id Id of the WidgetDef to find\r\n * @returns The WidgetDef if found; otherwise, undefined is returned.\r\n */\r\n public findWidgetDef(id: string): WidgetDef | undefined {\r\n return this.widgetDefs.find((widgetDef: WidgetDef) => widgetDef.id === id);\r\n }\r\n\r\n /** Updates the WidgetHost with dynamic widgets\r\n * @internal\r\n */\r\n public updateDynamicWidgetDefs(stageId: string, stageUsage: string, location: ZoneLocation | StagePanelLocation, section: StagePanelSection | undefined,\r\n allStageWidgetDefs: WidgetDef[], frontstageApplicationData?: any\r\n ): void {\r\n // get widgetDefs not already in allStageWidgetDefs and add them\r\n const uniqueWidgets = this._widgetDefs.filter((widgetDef) => {\r\n return !allStageWidgetDefs.find((wDef) => wDef.id === widgetDef.id);\r\n });\r\n\r\n allStageWidgetDefs.push(...uniqueWidgets);\r\n\r\n let dynamicWidgetDefs: readonly WidgetDef[] | undefined;\r\n\r\n if (location in ZoneLocation) {\r\n switch (location) {\r\n case ZoneLocation.CenterLeft:\r\n break; // added to BottomLeft\r\n case ZoneLocation.BottomLeft:\r\n {\r\n const middleDynamicWidgetDefs = UiFramework.widgetManager.getWidgetDefs(stageId, stageUsage, ZoneLocation.CenterLeft, section, frontstageApplicationData) ?? [];\r\n const bottomDynamicWidgetDefs = UiFramework.widgetManager.getWidgetDefs(stageId, stageUsage, ZoneLocation.BottomLeft, section, frontstageApplicationData) ?? [];\r\n dynamicWidgetDefs = [...middleDynamicWidgetDefs, ...bottomDynamicWidgetDefs];\r\n }\r\n break;\r\n case ZoneLocation.CenterRight:\r\n break; // added to BottomRight\r\n case ZoneLocation.BottomRight:\r\n {\r\n const middleDynamicWidgetDefs = UiFramework.widgetManager.getWidgetDefs(stageId, stageUsage, ZoneLocation.CenterRight, section, frontstageApplicationData) ?? [];\r\n const bottomDynamicWidgetDefs = UiFramework.widgetManager.getWidgetDefs(stageId, stageUsage, ZoneLocation.BottomRight, section, frontstageApplicationData) ?? [];\r\n dynamicWidgetDefs = [...middleDynamicWidgetDefs, ...bottomDynamicWidgetDefs];\r\n }\r\n break;\r\n }\r\n } else if ((location in StagePanelLocation) && undefined !== section) {\r\n switch (section) {\r\n case StagePanelSection.Start: {\r\n dynamicWidgetDefs = UiFramework.widgetManager.getWidgetDefs(stageId, stageUsage, location, StagePanelSection.Start, frontstageApplicationData) ?? [];\r\n break;\r\n }\r\n case StagePanelSection.Middle:\r\n break; // added to BottomLeft\r\n case StagePanelSection.End: {\r\n const middleDynamicWidgetDefs = UiFramework.widgetManager.getWidgetDefs(stageId, stageUsage, location, StagePanelSection.Middle, frontstageApplicationData) ?? [];\r\n const bottomDynamicWidgetDefs = UiFramework.widgetManager.getWidgetDefs(stageId, stageUsage, location, StagePanelSection.End, frontstageApplicationData) ?? [];\r\n dynamicWidgetDefs = [...middleDynamicWidgetDefs, ...bottomDynamicWidgetDefs];\r\n break;\r\n }\r\n }\r\n }\r\n\r\n const uniqueDynamicWidgetDefs = dynamicWidgetDefs?.filter((widgetDef) => {\r\n return ((!allStageWidgetDefs.find((wDef) => wDef.id === widgetDef.id)));\r\n });\r\n\r\n // Now that we no longer support a middle panel section, yet we have existing API that allows a middle section to be\r\n // defined, the following is needed to combining middle and end panel section widgets into a single set of widgets\r\n if (uniqueDynamicWidgetDefs) {\r\n allStageWidgetDefs.push(...uniqueDynamicWidgetDefs);\r\n this._dynamicWidgetDefs = [...uniqueDynamicWidgetDefs];\r\n }\r\n this.sortWidgetDefs();\r\n }\r\n\r\n /** Sorts all widgets */\r\n private sortWidgetDefs(): void {\r\n let sortedWidgetDefs = [];\r\n if (this._dynamicWidgetDefs)\r\n sortedWidgetDefs = this._widgetDefs.concat(this._dynamicWidgetDefs);\r\n else\r\n sortedWidgetDefs = this._widgetDefs.slice();\r\n\r\n sortedWidgetDefs.sort((a, b) => a.priority - b.priority);\r\n\r\n this._sortedWidgetDefs = sortedW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G,SAAS,EAAE,UAAU,EAAE,MAAM,GAAG,SAAS,EAAE,QAAQ,EAAE,YAAY,GAAG,kBAAkB,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO;IA0BzL;OACG;IACI,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAcjD,OAAO,CAAC,qCAAqC;IAgB7C;OACG;IACI,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,GAAG,kBAAkB,EAAE,OAAO,CAAC,EAAE,iBAAiB,EAChI,yBAAyB,CAAC,EAAE,GAAG,GAAG,aAAa,CAAC,SAAS,CAAC,GAAG,SAAS;CA0CzE"}
|
|
@@ -89,6 +89,7 @@ export class WidgetManager {
|
|
|
89
89
|
return result;
|
|
90
90
|
}
|
|
91
91
|
// Used when WidgetDefs are requested from UiItemProviders when uiVersion="1"
|
|
92
|
+
// istanbul ignore next
|
|
92
93
|
getStagePanelLocationFromZoneLocation(location) {
|
|
93
94
|
switch (location) {
|
|
94
95
|
case ZoneLocation.BottomCenter:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WidgetManager.js","sourceRoot":"","sources":["../../../../src/appui-react/widgets/WidgetManager.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,4CAA4C;AAC5C;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAuB,oBAAoB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACzI,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAoB1D;;GA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B,IAAI,aAAa,IAAI,QAAQ,IAAI,oBAAoB,EAAE;oBACrD,MAAM,OAAO,GAAG,cAAc,CAAC,UAAU,CAAC,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,SAAS,EAAE,QAA2C,EAAE,yBAAyB,CAAC,CAAC;oBACjK,OAAO,CAAC,OAAO,CAAC,CAAC,aAAkC,EAAE,KAAa,EAAE,EAAE;wBACpE,MAAM,KAAK,GAAG,SAAS,CAAC,kCAAkC,CAAC,aAAa,CAAC,CAAC;wBAC1E,MAAM,QAAQ,GAAG,sBAAsB,CAAC,UAAU,EAAE,QAA8B,EAAE,cAAc,EAAE,KAAK,CAAC,CAAC;wBAC3G,MAAM,WAAW,GAAG,oBAAoB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;wBAC1D,MAAM,EAAE,GAAG,IAAI,SAAS,CAAC,WAAW,CAAC,CAAC;wBACtC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;oBACtB,CAAC,CAAC,CAAC;iBACJ;aACF;SACF;QAED,OAAO,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC;IACxD,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/* eslint-disable deprecation/deprecation */\r\n/** @packageDocumentation\r\n * @module Widget\r\n */\r\n\r\nimport { BeUiEvent, Logger } from \"@itwin/core-bentley\";\r\nimport { AbstractWidgetProps, AbstractZoneLocation, StagePanelLocation, StagePanelSection, UiItemsManager } from \"@itwin/appui-abstract\";\r\nimport { UiFramework } from \"../UiFramework\";\r\nimport { getStableWidgetProps, ZoneLocation } from \"../zones/Zone\";\r\nimport { WidgetDef } from \"./WidgetDef\";\r\nimport { createStableWidgetDef } from \"./StableWidgetDef\";\r\n\r\n/** Information about WidgetDefs in the WidgetManager\r\n * @internal\r\n */\r\nexport interface WidgetInfo {\r\n widgetDef: WidgetDef;\r\n stageId?: string;\r\n stageUsage?: string;\r\n location: ZoneLocation | StagePanelLocation;\r\n section: StagePanelSection;\r\n}\r\n\r\n/** Arguments of [[this.onWidgetsChanged]] event.\r\n * @internal\r\n */\r\nexport interface WidgetsChangedEventArgs {\r\n readonly items: ReadonlyArray<WidgetInfo>;\r\n}\r\n\r\n/** Event class for [[this.onWidgetsChanged]].\r\n * @internal\r\n */\r\nexport class WidgetsChangedEvent extends BeUiEvent<WidgetsChangedEventArgs> { }\r\n\r\nfunction isZoneLocation(location: ZoneLocation | StagePanelLocation): location is ZoneLocation {\r\n return location >= ZoneLocation.TopLeft && location <= ZoneLocation.BottomRight;\r\n}\r\n\r\nfunction getLocationName(location: ZoneLocation | StagePanelLocation) {\r\n return isZoneLocation(location) ? ZoneLocation[location] : StagePanelLocation[location];\r\n}\r\n\r\nfunction getWidgetManagerStableWidgetId(stageUsage: string | undefined, location: ZoneLocation | StagePanelLocation, section: StagePanelSection,\r\n index: number) {\r\n return `uifw-wm-${stageUsage || \"\"}-${getLocationName(location)}-${StagePanelSection[section]}-${index}`;\r\n}\r\n\r\nfunction getAddonStableWidgetId(stageUsage: string, location: StagePanelLocation, section: StagePanelSection, index: number) {\r\n return `uifw-addon-${stageUsage}-${StagePanelLocation[location]}-${StagePanelSection[section]}-${index}`;\r\n}\r\n\r\n/** Widget Manager class.\r\n * @beta\r\n */\r\nexport class WidgetManager {\r\n private _widgets: ReadonlyArray<WidgetInfo> = [];\r\n\r\n /** Event raised when Widgets are changed.\r\n * @internal\r\n */\r\n public readonly onWidgetsChanged = new WidgetsChangedEvent();\r\n\r\n /** @internal */\r\n public get widgetCount(): number {\r\n return this._widgets.length;\r\n }\r\n\r\n /** @internal */\r\n public get widgets(): ReadonlyArray<WidgetInfo> { return this._widgets; }\r\n public set widgets(w: ReadonlyArray<WidgetInfo>) {\r\n this._widgets = w;\r\n this.onWidgetsChanged.emit({ items: w });\r\n }\r\n\r\n /** Adds a WidgetDef for use in a Frontstage.\r\n * @note Added `widgetDef` must return unique id to correctly save/restore App layout.\r\n * Semi-stable id is generated when auto-generated `widgetDef` id is detected,\r\n * but correctness of such id depends on `addWidgetDef` call order and widget location.\r\n */\r\n public addWidgetDef(widgetDef: WidgetDef, stageId: string | undefined, stageUsage: string | undefined, location: ZoneLocation | StagePanelLocation, section?: StagePanelSection): boolean {\r\n if (stageId === undefined && stageUsage === undefined) {\r\n Logger.logError(UiFramework.loggerCategory(this), `addWidgetDef: stageId or stageUsage param must be specified`);\r\n return false;\r\n }\r\n\r\n section = (section !== undefined) ? section : StagePanelSection.Start;\r\n const index = this._widgets.reduce((acc, info) => {\r\n if (info.stageId === stageId && info.stageUsage === stageUsage && info.location === location && info.section === section)\r\n return acc + 1;\r\n return acc;\r\n }, 0);\r\n const stableId = getWidgetManagerStableWidgetId(stageUsage, location, section, index);\r\n const stableWidget = createStableWidgetDef(widgetDef, stableId);\r\n const newWidget: WidgetInfo = { widgetDef: stableWidget, stageId, stageUsage, location, section };\r\n\r\n const oldWidgets = this._widgets.filter((info) => info.widgetDef.id !== newWidget.widgetDef.id);\r\n const updatedWidgets = [\r\n ...oldWidgets,\r\n newWidget,\r\n ];\r\n this.widgets = updatedWidgets;\r\n\r\n return true;\r\n }\r\n\r\n /** Removes a WidgetDef.\r\n */\r\n public removeWidgetDef(widgetId: string): boolean {\r\n let result = false;\r\n const updatedWidgets = this._widgets.filter((info) => info.widgetDef.id !== widgetId);\r\n\r\n if (updatedWidgets.length !== this._widgets.length) {\r\n this.widgets = updatedWidgets;\r\n result = true;\r\n }\r\n\r\n return result;\r\n }\r\n\r\n // Used when WidgetDefs are requested from UiItemProviders when uiVersion=\"1\"\r\n private getStagePanelLocationFromZoneLocation(location: ZoneLocation): StagePanelLocation | undefined {\r\n switch (location) {\r\n case ZoneLocation.BottomCenter:\r\n case ZoneLocation.TopCenter:\r\n case ZoneLocation.TopRight:\r\n case ZoneLocation.TopLeft:\r\n return undefined; // an existing stage does not support appending widgets to these zones\r\n case ZoneLocation.BottomLeft:\r\n case ZoneLocation.CenterLeft:\r\n return StagePanelLocation.Left;\r\n case ZoneLocation.BottomRight:\r\n case ZoneLocation.CenterRight:\r\n return StagePanelLocation.Right;\r\n }\r\n }\r\n\r\n /** Gets WidgetDefs for a Frontstage location.\r\n */\r\n public getWidgetDefs(stageId: string, stageUsage: string, location: ZoneLocation | StagePanelLocation, section?: StagePanelSection,\r\n frontstageApplicationData?: any): ReadonlyArray<WidgetDef> | undefined {\r\n const definedSection = section === undefined ? StagePanelSection.Start : section;\r\n\r\n const widgetInfos = this._widgets.filter((info) => {\r\n return (!info.stageId || info.stageId === stageId)\r\n && (!info.stageUsage || info.stageUsage === stageUsage)\r\n && info.location === location\r\n && info.section === definedSection;\r\n });\r\n\r\n const widgetDefs = widgetInfos.map((info) => info.widgetDef);\r\n\r\n // Consult the UiItemsManager to get any Abstract widgets\r\n if (location in StagePanelLocation) {\r\n const widgets = UiItemsManager.getWidgets(stageId, stageUsage, location as StagePanelLocation, definedSection, undefined, frontstageApplicationData);\r\n widgets.forEach((abstractProps: AbstractWidgetProps, index: number) => {\r\n const props = WidgetDef.createWidgetPropsFromAbstractProps(abstractProps);\r\n const stableId = getAddonStableWidgetId(stageUsage, location as StagePanelLocation, definedSection, index);\r\n const stableProps = getStableWidgetProps(props, stableId);\r\n const wd = new WidgetDef(stableProps);\r\n widgetDefs.push(wd);\r\n });\r\n } else {\r\n // istanbul ignore else\r\n if (location in ZoneLocation) {\r\n const panelLocation = this.getStagePanelLocationFromZoneLocation(location as ZoneLocation);\r\n // istanbul ignore else\r\n if (panelLocation && location in AbstractZoneLocation) {\r\n const widgets = UiItemsManager.getWidgets(stageId, stageUsage, panelLocation, undefined, location as unknown as AbstractZoneLocation, frontstageApplicationData);\r\n widgets.forEach((abstractProps: AbstractWidgetProps, index: number) => {\r\n const props = WidgetDef.createWidgetPropsFromAbstractProps(abstractProps);\r\n const stableId = getAddonStableWidgetId(stageUsage, location as StagePanelLocation, definedSection, index);\r\n const stableProps = getStableWidgetProps(props, stableId);\r\n const wd = new WidgetDef(stableProps);\r\n widgetDefs.push(wd);\r\n });\r\n }\r\n }\r\n }\r\n\r\n return widgetDefs.length > 0 ? widgetDefs : undefined;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"WidgetManager.js","sourceRoot":"","sources":["../../../../src/appui-react/widgets/WidgetManager.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,4CAA4C;AAC5C;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAuB,oBAAoB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACzI,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAoB1D;;GAEG;AACH,MAAM,OAAO,mBAAoB,SAAQ,SAAkC;CAAI;AAE/E,SAAS,cAAc,CAAC,QAA2C;IACjE,OAAO,QAAQ,IAAI,YAAY,CAAC,OAAO,IAAI,QAAQ,IAAI,YAAY,CAAC,WAAW,CAAC;AAClF,CAAC;AAED,SAAS,eAAe,CAAC,QAA2C;IAClE,OAAO,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;AAC1F,CAAC;AAED,SAAS,8BAA8B,CAAC,UAA8B,EAAE,QAA2C,EAAE,OAA0B,EAC7I,KAAa;IACb,OAAO,WAAW,UAAU,IAAI,EAAE,IAAI,eAAe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K,EAAE,QAAQ,CAAC,CAAC;wBAC1D,MAAM,EAAE,GAAG,IAAI,SAAS,CAAC,WAAW,CAAC,CAAC;wBACtC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;oBACtB,CAAC,CAAC,CAAC;iBACJ;aACF;SACF;QAED,OAAO,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC;IACxD,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/* eslint-disable deprecation/deprecation */\r\n/** @packageDocumentation\r\n * @module Widget\r\n */\r\n\r\nimport { BeUiEvent, Logger } from \"@itwin/core-bentley\";\r\nimport { AbstractWidgetProps, AbstractZoneLocation, StagePanelLocation, StagePanelSection, UiItemsManager } from \"@itwin/appui-abstract\";\r\nimport { UiFramework } from \"../UiFramework\";\r\nimport { getStableWidgetProps, ZoneLocation } from \"../zones/Zone\";\r\nimport { WidgetDef } from \"./WidgetDef\";\r\nimport { createStableWidgetDef } from \"./StableWidgetDef\";\r\n\r\n/** Information about WidgetDefs in the WidgetManager\r\n * @internal\r\n */\r\nexport interface WidgetInfo {\r\n widgetDef: WidgetDef;\r\n stageId?: string;\r\n stageUsage?: string;\r\n location: ZoneLocation | StagePanelLocation;\r\n section: StagePanelSection;\r\n}\r\n\r\n/** Arguments of [[this.onWidgetsChanged]] event.\r\n * @internal\r\n */\r\nexport interface WidgetsChangedEventArgs {\r\n readonly items: ReadonlyArray<WidgetInfo>;\r\n}\r\n\r\n/** Event class for [[this.onWidgetsChanged]].\r\n * @internal\r\n */\r\nexport class WidgetsChangedEvent extends BeUiEvent<WidgetsChangedEventArgs> { }\r\n\r\nfunction isZoneLocation(location: ZoneLocation | StagePanelLocation): location is ZoneLocation {\r\n return location >= ZoneLocation.TopLeft && location <= ZoneLocation.BottomRight;\r\n}\r\n\r\nfunction getLocationName(location: ZoneLocation | StagePanelLocation) {\r\n return isZoneLocation(location) ? ZoneLocation[location] : StagePanelLocation[location];\r\n}\r\n\r\nfunction getWidgetManagerStableWidgetId(stageUsage: string | undefined, location: ZoneLocation | StagePanelLocation, section: StagePanelSection,\r\n index: number) {\r\n return `uifw-wm-${stageUsage || \"\"}-${getLocationName(location)}-${StagePanelSection[section]}-${index}`;\r\n}\r\n\r\nfunction getAddonStableWidgetId(stageUsage: string, location: StagePanelLocation, section: StagePanelSection, index: number) {\r\n return `uifw-addon-${stageUsage}-${StagePanelLocation[location]}-${StagePanelSection[section]}-${index}`;\r\n}\r\n\r\n/** Widget Manager class.\r\n * @beta\r\n */\r\nexport class WidgetManager {\r\n private _widgets: ReadonlyArray<WidgetInfo> = [];\r\n\r\n /** Event raised when Widgets are changed.\r\n * @internal\r\n */\r\n public readonly onWidgetsChanged = new WidgetsChangedEvent();\r\n\r\n /** @internal */\r\n public get widgetCount(): number {\r\n return this._widgets.length;\r\n }\r\n\r\n /** @internal */\r\n public get widgets(): ReadonlyArray<WidgetInfo> { return this._widgets; }\r\n public set widgets(w: ReadonlyArray<WidgetInfo>) {\r\n this._widgets = w;\r\n this.onWidgetsChanged.emit({ items: w });\r\n }\r\n\r\n /** Adds a WidgetDef for use in a Frontstage.\r\n * @note Added `widgetDef` must return unique id to correctly save/restore App layout.\r\n * Semi-stable id is generated when auto-generated `widgetDef` id is detected,\r\n * but correctness of such id depends on `addWidgetDef` call order and widget location.\r\n */\r\n public addWidgetDef(widgetDef: WidgetDef, stageId: string | undefined, stageUsage: string | undefined, location: ZoneLocation | StagePanelLocation, section?: StagePanelSection): boolean {\r\n if (stageId === undefined && stageUsage === undefined) {\r\n Logger.logError(UiFramework.loggerCategory(this), `addWidgetDef: stageId or stageUsage param must be specified`);\r\n return false;\r\n }\r\n\r\n section = (section !== undefined) ? section : StagePanelSection.Start;\r\n const index = this._widgets.reduce((acc, info) => {\r\n if (info.stageId === stageId && info.stageUsage === stageUsage && info.location === location && info.section === section)\r\n return acc + 1;\r\n return acc;\r\n }, 0);\r\n const stableId = getWidgetManagerStableWidgetId(stageUsage, location, section, index);\r\n const stableWidget = createStableWidgetDef(widgetDef, stableId);\r\n const newWidget: WidgetInfo = { widgetDef: stableWidget, stageId, stageUsage, location, section };\r\n\r\n const oldWidgets = this._widgets.filter((info) => info.widgetDef.id !== newWidget.widgetDef.id);\r\n const updatedWidgets = [\r\n ...oldWidgets,\r\n newWidget,\r\n ];\r\n this.widgets = updatedWidgets;\r\n\r\n return true;\r\n }\r\n\r\n /** Removes a WidgetDef.\r\n */\r\n public removeWidgetDef(widgetId: string): boolean {\r\n let result = false;\r\n const updatedWidgets = this._widgets.filter((info) => info.widgetDef.id !== widgetId);\r\n\r\n if (updatedWidgets.length !== this._widgets.length) {\r\n this.widgets = updatedWidgets;\r\n result = true;\r\n }\r\n\r\n return result;\r\n }\r\n\r\n // Used when WidgetDefs are requested from UiItemProviders when uiVersion=\"1\"\r\n // istanbul ignore next\r\n private getStagePanelLocationFromZoneLocation(location: ZoneLocation): StagePanelLocation | undefined {\r\n switch (location) {\r\n case ZoneLocation.BottomCenter:\r\n case ZoneLocation.TopCenter:\r\n case ZoneLocation.TopRight:\r\n case ZoneLocation.TopLeft:\r\n return undefined; // an existing stage does not support appending widgets to these zones\r\n case ZoneLocation.BottomLeft:\r\n case ZoneLocation.CenterLeft:\r\n return StagePanelLocation.Left;\r\n case ZoneLocation.BottomRight:\r\n case ZoneLocation.CenterRight:\r\n return StagePanelLocation.Right;\r\n }\r\n }\r\n\r\n /** Gets WidgetDefs for a Frontstage location.\r\n */\r\n public getWidgetDefs(stageId: string, stageUsage: string, location: ZoneLocation | StagePanelLocation, section?: StagePanelSection,\r\n frontstageApplicationData?: any): ReadonlyArray<WidgetDef> | undefined {\r\n const definedSection = section === undefined ? StagePanelSection.Start : section;\r\n\r\n const widgetInfos = this._widgets.filter((info) => {\r\n return (!info.stageId || info.stageId === stageId)\r\n && (!info.stageUsage || info.stageUsage === stageUsage)\r\n && info.location === location\r\n && info.section === definedSection;\r\n });\r\n\r\n const widgetDefs = widgetInfos.map((info) => info.widgetDef);\r\n\r\n // Consult the UiItemsManager to get any Abstract widgets\r\n if (location in StagePanelLocation) {\r\n const widgets = UiItemsManager.getWidgets(stageId, stageUsage, location as StagePanelLocation, definedSection, undefined, frontstageApplicationData);\r\n widgets.forEach((abstractProps: AbstractWidgetProps, index: number) => {\r\n const props = WidgetDef.createWidgetPropsFromAbstractProps(abstractProps);\r\n const stableId = getAddonStableWidgetId(stageUsage, location as StagePanelLocation, definedSection, index);\r\n const stableProps = getStableWidgetProps(props, stableId);\r\n const wd = new WidgetDef(stableProps);\r\n widgetDefs.push(wd);\r\n });\r\n } else {\r\n // istanbul ignore else\r\n if (location in ZoneLocation) {\r\n const panelLocation = this.getStagePanelLocationFromZoneLocation(location as ZoneLocation);\r\n // istanbul ignore else\r\n if (panelLocation && location in AbstractZoneLocation) {\r\n const widgets = UiItemsManager.getWidgets(stageId, stageUsage, panelLocation, undefined, location as unknown as AbstractZoneLocation, frontstageApplicationData);\r\n widgets.forEach((abstractProps: AbstractWidgetProps, index: number) => {\r\n const props = WidgetDef.createWidgetPropsFromAbstractProps(abstractProps);\r\n const stableId = getAddonStableWidgetId(stageUsage, location as StagePanelLocation, definedSection, index);\r\n const stableProps = getStableWidgetProps(props, stableId);\r\n const wd = new WidgetDef(stableProps);\r\n widgetDefs.push(wd);\r\n });\r\n }\r\n }\r\n }\r\n\r\n return widgetDefs.length > 0 ? widgetDefs : undefined;\r\n }\r\n}\r\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/appui-react",
|
|
3
|
-
"version": "3.2.0-dev.
|
|
3
|
+
"version": "3.2.0-dev.23",
|
|
4
4
|
"description": "UI framework",
|
|
5
5
|
"main": "lib/cjs/appui-react.js",
|
|
6
6
|
"module": "lib/esm/appui-react.js",
|
|
@@ -20,19 +20,19 @@
|
|
|
20
20
|
"url": "http://www.bentley.com"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
|
-
"@itwin/appui-abstract": "^3.2.0-dev.
|
|
24
|
-
"@itwin/appui-layout-react": "^3.2.0-dev.
|
|
25
|
-
"@itwin/components-react": "^3.2.0-dev.
|
|
26
|
-
"@itwin/core-bentley": "^3.2.0-dev.
|
|
27
|
-
"@itwin/core-common": "^3.2.0-dev.
|
|
28
|
-
"@itwin/core-frontend": "^3.2.0-dev.
|
|
29
|
-
"@itwin/core-geometry": "^3.2.0-dev.
|
|
30
|
-
"@itwin/core-markup": "^3.2.0-dev.
|
|
31
|
-
"@itwin/core-quantity": "^3.2.0-dev.
|
|
32
|
-
"@itwin/core-react": "^3.2.0-dev.
|
|
33
|
-
"@itwin/imodel-components-react": "^3.2.0-dev.
|
|
34
|
-
"@itwin/presentation-common": "^3.2.0-dev.
|
|
35
|
-
"@itwin/presentation-frontend": "^3.2.0-dev.
|
|
23
|
+
"@itwin/appui-abstract": "^3.2.0-dev.23",
|
|
24
|
+
"@itwin/appui-layout-react": "^3.2.0-dev.23",
|
|
25
|
+
"@itwin/components-react": "^3.2.0-dev.23",
|
|
26
|
+
"@itwin/core-bentley": "^3.2.0-dev.23",
|
|
27
|
+
"@itwin/core-common": "^3.2.0-dev.23",
|
|
28
|
+
"@itwin/core-frontend": "^3.2.0-dev.23",
|
|
29
|
+
"@itwin/core-geometry": "^3.2.0-dev.23",
|
|
30
|
+
"@itwin/core-markup": "^3.2.0-dev.23",
|
|
31
|
+
"@itwin/core-quantity": "^3.2.0-dev.23",
|
|
32
|
+
"@itwin/core-react": "^3.2.0-dev.23",
|
|
33
|
+
"@itwin/imodel-components-react": "^3.2.0-dev.23",
|
|
34
|
+
"@itwin/presentation-common": "^3.2.0-dev.23",
|
|
35
|
+
"@itwin/presentation-frontend": "^3.2.0-dev.23",
|
|
36
36
|
"react": "^17.0.0",
|
|
37
37
|
"react-dom": "^17.0.0",
|
|
38
38
|
"react-redux": "^7.2.2",
|
|
@@ -43,22 +43,22 @@
|
|
|
43
43
|
"NOTE: All tools used by scripts in this package must be listed as devDependencies"
|
|
44
44
|
],
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@itwin/appui-abstract": "3.2.0-dev.
|
|
47
|
-
"@itwin/appui-layout-react": "3.2.0-dev.
|
|
48
|
-
"@itwin/build-tools": "3.2.0-dev.
|
|
49
|
-
"@itwin/components-react": "3.2.0-dev.
|
|
50
|
-
"@itwin/core-bentley": "3.2.0-dev.
|
|
51
|
-
"@itwin/core-common": "3.2.0-dev.
|
|
52
|
-
"@itwin/core-frontend": "3.2.0-dev.
|
|
53
|
-
"@itwin/core-geometry": "3.2.0-dev.
|
|
54
|
-
"@itwin/core-markup": "3.2.0-dev.
|
|
55
|
-
"@itwin/core-quantity": "3.2.0-dev.
|
|
56
|
-
"@itwin/core-react": "3.2.0-dev.
|
|
57
|
-
"@itwin/eslint-plugin": "3.2.0-dev.
|
|
58
|
-
"@itwin/imodel-components-react": "3.2.0-dev.
|
|
59
|
-
"@itwin/presentation-common": "3.2.0-dev.
|
|
60
|
-
"@itwin/presentation-frontend": "3.2.0-dev.
|
|
61
|
-
"@itwin/presentation-testing": "3.2.0-dev.
|
|
46
|
+
"@itwin/appui-abstract": "3.2.0-dev.23",
|
|
47
|
+
"@itwin/appui-layout-react": "3.2.0-dev.23",
|
|
48
|
+
"@itwin/build-tools": "3.2.0-dev.23",
|
|
49
|
+
"@itwin/components-react": "3.2.0-dev.23",
|
|
50
|
+
"@itwin/core-bentley": "3.2.0-dev.23",
|
|
51
|
+
"@itwin/core-common": "3.2.0-dev.23",
|
|
52
|
+
"@itwin/core-frontend": "3.2.0-dev.23",
|
|
53
|
+
"@itwin/core-geometry": "3.2.0-dev.23",
|
|
54
|
+
"@itwin/core-markup": "3.2.0-dev.23",
|
|
55
|
+
"@itwin/core-quantity": "3.2.0-dev.23",
|
|
56
|
+
"@itwin/core-react": "3.2.0-dev.23",
|
|
57
|
+
"@itwin/eslint-plugin": "3.2.0-dev.23",
|
|
58
|
+
"@itwin/imodel-components-react": "3.2.0-dev.23",
|
|
59
|
+
"@itwin/presentation-common": "3.2.0-dev.23",
|
|
60
|
+
"@itwin/presentation-frontend": "3.2.0-dev.23",
|
|
61
|
+
"@itwin/presentation-testing": "3.2.0-dev.23",
|
|
62
62
|
"@testing-library/react": "^12.0.0",
|
|
63
63
|
"@testing-library/react-hooks": "^7.0.2",
|
|
64
64
|
"@types/chai": "^4.1.4",
|
|
@@ -113,10 +113,11 @@
|
|
|
113
113
|
"dependencies": {
|
|
114
114
|
"@bentley/icons-generic": "^1.0.15",
|
|
115
115
|
"@bentley/icons-generic-webfont": "^1.0.15",
|
|
116
|
-
"@itwin/core-telemetry": "3.2.0-dev.
|
|
117
|
-
"@itwin/presentation-components": "3.2.0-dev.
|
|
116
|
+
"@itwin/core-telemetry": "3.2.0-dev.23",
|
|
117
|
+
"@itwin/presentation-components": "3.2.0-dev.23",
|
|
118
118
|
"@itwin/itwinui-css": "0.x",
|
|
119
119
|
"@itwin/itwinui-react": "^1.32.0",
|
|
120
|
+
"@itwin/itwinui-icons-react": "^1.8.0",
|
|
120
121
|
"classnames": "^2.3.1",
|
|
121
122
|
"immer": "9.0.6",
|
|
122
123
|
"lodash": "^4.17.10",
|