@itwin/appui-react 4.2.1 → 4.3.0
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/CHANGELOG.md +12 -4
- package/lib/cjs/appui-react/UiFramework.d.ts +0 -7
- package/lib/cjs/appui-react/UiFramework.d.ts.map +1 -1
- package/lib/cjs/appui-react/UiFramework.js +0 -22
- package/lib/cjs/appui-react/UiFramework.js.map +1 -1
- package/lib/cjs/appui-react/_variables.scss +3 -3
- package/lib/cjs/appui-react/accudraw/AccuDrawFieldContainer.scss +3 -3
- package/lib/cjs/appui-react/accudraw/AccuDrawInputField.scss +3 -3
- package/lib/cjs/appui-react/childwindow/InternalChildWindowManager.d.ts.map +1 -1
- package/lib/cjs/appui-react/childwindow/InternalChildWindowManager.js +1 -2
- package/lib/cjs/appui-react/childwindow/InternalChildWindowManager.js.map +1 -1
- package/lib/cjs/appui-react/childwindow/InternalChildWindowManager.scss +3 -3
- package/lib/cjs/appui-react/configurableui/configurableui.scss +3 -3
- package/lib/cjs/appui-react/content/DefaultViewOverlay.scss +3 -3
- package/lib/cjs/appui-react/feedback/ValidationTextbox.scss +3 -3
- package/lib/cjs/appui-react/frontstage/FrontstageDef.d.ts.map +1 -1
- package/lib/cjs/appui-react/frontstage/FrontstageDef.js +25 -5
- package/lib/cjs/appui-react/frontstage/FrontstageDef.js.map +1 -1
- package/lib/cjs/appui-react/navigationaids/SheetNavigationAid.scss +3 -3
- package/lib/cjs/appui-react/navigationaids/StandardRotationNavigationAid.scss +3 -3
- package/lib/cjs/appui-react/pickers/ViewSelector.d.ts.map +1 -1
- package/lib/cjs/appui-react/pickers/ViewSelector.js +3 -1
- package/lib/cjs/appui-react/pickers/ViewSelector.js.map +1 -1
- package/lib/cjs/appui-react/popup/CardPopup.scss +3 -3
- package/lib/cjs/appui-react/selection/HideIsolateEmphasizeManager.d.ts.map +1 -1
- package/lib/cjs/appui-react/selection/HideIsolateEmphasizeManager.js +0 -53
- package/lib/cjs/appui-react/selection/HideIsolateEmphasizeManager.js.map +1 -1
- package/lib/cjs/appui-react/settings/quantityformatting/QuantityFormat.scss +3 -3
- package/lib/cjs/appui-react/settings/ui/UiSettingsPage.scss +3 -3
- package/lib/cjs/appui-react/statusbar/Separator.scss +3 -3
- package/lib/cjs/appui-react/statusfields/SectionsField.scss +3 -3
- package/lib/cjs/appui-react/statusfields/SelectionCount.scss +3 -3
- package/lib/cjs/appui-react/statusfields/SelectionScope.scss +3 -3
- package/lib/cjs/appui-react/statusfields/ViewAttributes.scss +3 -3
- package/lib/cjs/appui-react/statusfields/tileloading/TileLoadingIndicator.scss +3 -3
- package/lib/cjs/appui-react/statusfields/toolassistance/ToolAssistanceField.scss +3 -3
- package/lib/cjs/appui-react/widget-panels/Frontstage.d.ts +3 -1
- package/lib/cjs/appui-react/widget-panels/Frontstage.d.ts.map +1 -1
- package/lib/cjs/appui-react/widget-panels/Frontstage.js +93 -77
- package/lib/cjs/appui-react/widget-panels/Frontstage.js.map +1 -1
- package/lib/cjs/appui-react/widget-panels/Frontstage.scss +3 -3
- package/lib/cjs/appui-react/widget-panels/Tab.scss +3 -3
- package/lib/cjs/appui-react/widget-panels/ToolSettings.d.ts +1 -1
- package/lib/cjs/appui-react/widget-panels/ToolSettings.d.ts.map +1 -1
- package/lib/cjs/appui-react/widget-panels/ToolSettings.js +23 -29
- package/lib/cjs/appui-react/widget-panels/ToolSettings.js.map +1 -1
- package/lib/cjs/appui-react/widget-panels/ToolSettings.scss +3 -3
- package/lib/cjs/appui-react/widget-panels/Toolbars.scss +3 -3
- package/lib/cjs/appui-react/widgets/WidgetDef.d.ts +1 -1
- package/lib/cjs/appui-react/widgets/WidgetDef.d.ts.map +1 -1
- package/lib/cjs/appui-react/widgets/WidgetDef.js +12 -11
- package/lib/cjs/appui-react/widgets/WidgetDef.js.map +1 -1
- package/lib/esm/appui-react/UiFramework.d.ts +0 -7
- package/lib/esm/appui-react/UiFramework.d.ts.map +1 -1
- package/lib/esm/appui-react/UiFramework.js +0 -22
- package/lib/esm/appui-react/UiFramework.js.map +1 -1
- package/lib/esm/appui-react/_variables.scss +3 -3
- package/lib/esm/appui-react/accudraw/AccuDrawFieldContainer.scss +3 -3
- package/lib/esm/appui-react/accudraw/AccuDrawInputField.scss +3 -3
- package/lib/esm/appui-react/childwindow/InternalChildWindowManager.d.ts.map +1 -1
- package/lib/esm/appui-react/childwindow/InternalChildWindowManager.js +1 -2
- package/lib/esm/appui-react/childwindow/InternalChildWindowManager.js.map +1 -1
- package/lib/esm/appui-react/childwindow/InternalChildWindowManager.scss +3 -3
- package/lib/esm/appui-react/configurableui/configurableui.scss +3 -3
- package/lib/esm/appui-react/content/DefaultViewOverlay.scss +3 -3
- package/lib/esm/appui-react/feedback/ValidationTextbox.scss +3 -3
- package/lib/esm/appui-react/frontstage/FrontstageDef.d.ts.map +1 -1
- package/lib/esm/appui-react/frontstage/FrontstageDef.js +25 -5
- package/lib/esm/appui-react/frontstage/FrontstageDef.js.map +1 -1
- package/lib/esm/appui-react/navigationaids/SheetNavigationAid.scss +3 -3
- package/lib/esm/appui-react/navigationaids/StandardRotationNavigationAid.scss +3 -3
- package/lib/esm/appui-react/pickers/ViewSelector.d.ts.map +1 -1
- package/lib/esm/appui-react/pickers/ViewSelector.js +3 -1
- package/lib/esm/appui-react/pickers/ViewSelector.js.map +1 -1
- package/lib/esm/appui-react/popup/CardPopup.scss +3 -3
- package/lib/esm/appui-react/selection/HideIsolateEmphasizeManager.d.ts.map +1 -1
- package/lib/esm/appui-react/selection/HideIsolateEmphasizeManager.js +0 -53
- package/lib/esm/appui-react/selection/HideIsolateEmphasizeManager.js.map +1 -1
- package/lib/esm/appui-react/settings/quantityformatting/QuantityFormat.scss +3 -3
- package/lib/esm/appui-react/settings/ui/UiSettingsPage.scss +3 -3
- package/lib/esm/appui-react/statusbar/Separator.scss +3 -3
- package/lib/esm/appui-react/statusfields/SectionsField.scss +3 -3
- package/lib/esm/appui-react/statusfields/SelectionCount.scss +3 -3
- package/lib/esm/appui-react/statusfields/SelectionScope.scss +3 -3
- package/lib/esm/appui-react/statusfields/ViewAttributes.scss +3 -3
- package/lib/esm/appui-react/statusfields/tileloading/TileLoadingIndicator.scss +3 -3
- package/lib/esm/appui-react/statusfields/toolassistance/ToolAssistanceField.scss +3 -3
- package/lib/esm/appui-react/widget-panels/Frontstage.d.ts +3 -1
- package/lib/esm/appui-react/widget-panels/Frontstage.d.ts.map +1 -1
- package/lib/esm/appui-react/widget-panels/Frontstage.js +90 -74
- package/lib/esm/appui-react/widget-panels/Frontstage.js.map +1 -1
- package/lib/esm/appui-react/widget-panels/Frontstage.scss +3 -3
- package/lib/esm/appui-react/widget-panels/Tab.scss +3 -3
- package/lib/esm/appui-react/widget-panels/ToolSettings.d.ts +1 -1
- package/lib/esm/appui-react/widget-panels/ToolSettings.d.ts.map +1 -1
- package/lib/esm/appui-react/widget-panels/ToolSettings.js +23 -29
- package/lib/esm/appui-react/widget-panels/ToolSettings.js.map +1 -1
- package/lib/esm/appui-react/widget-panels/ToolSettings.scss +3 -3
- package/lib/esm/appui-react/widget-panels/Toolbars.scss +3 -3
- package/lib/esm/appui-react/widgets/WidgetDef.d.ts +1 -1
- package/lib/esm/appui-react/widgets/WidgetDef.d.ts.map +1 -1
- package/lib/esm/appui-react/widgets/WidgetDef.js +12 -11
- package/lib/esm/appui-react/widgets/WidgetDef.js.map +1 -1
- package/lib/public/locales/en/UiFramework.json +3 -1
- package/package.json +12 -12
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* @module Frontstage
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.useItemsManager = exports.useFrontstageManager = exports.getFrontstageStateSettingName = exports.FRONTSTAGE_SETTINGS_NAMESPACE = exports.useSaveFrontstageSettings = exports.useSavedFrontstageState = exports.setWidgetLabel = exports.expandWidget = exports.showWidget = exports.setWidgetState = exports.isPanelCollapsed = exports.packNineZoneState = exports.restoreNineZoneState = exports.initializeNineZoneState = exports.initializePanel = exports.isFrontstageStateSettingResult = exports.addPanelWidgets = exports.getPanelSectionWidgets = exports.getWidgetId = exports.removeMissingWidgets = exports.addMissingWidgets = exports.appendWidgets = exports.addWidgets = exports.useLabels = exports.ActiveFrontstageDefProvider = exports.WidgetPanelsFrontstage = exports.useNineZoneDispatch = exports.FrameworkStateReducer = exports.useUpdateNineZoneSize = exports.useLayoutStore = void 0;
|
|
10
|
+
exports.useItemsManager = exports.useFrontstageManager = exports.getFrontstageStateSettingName = exports.FRONTSTAGE_SETTINGS_NAMESPACE = exports.useSaveFrontstageSettings = exports.useSavedFrontstageState = exports.setWidgetLabel = exports.expandWidget = exports.showWidget = exports.setWidgetState = exports.isPanelCollapsed = exports.packNineZoneState = exports.restoreNineZoneState = exports.initializeNineZoneState = exports.stateVersion = exports.initializePanel = exports.isFrontstageStateSettingResult = exports.addPanelWidgets = exports.getPanelSectionWidgets = exports.getWidgetId = exports.removeMissingWidgets = exports.addMissingWidgets = exports.appendWidgets = exports.addWidgets = exports.useLabels = exports.ActiveFrontstageDefProvider = exports.WidgetPanelsFrontstage = exports.useNineZoneDispatch = exports.FrameworkStateReducer = exports.useUpdateNineZoneSize = exports.useLayoutStore = void 0;
|
|
11
11
|
// cSpell:ignore popout
|
|
12
12
|
require("./Frontstage.scss");
|
|
13
13
|
const immer_1 = require("immer");
|
|
@@ -126,14 +126,6 @@ function useNineZoneDispatch(frontstageDef) {
|
|
|
126
126
|
if (action.type === "RESIZE") {
|
|
127
127
|
InternalFrontstageManager_1.InternalFrontstageManager.nineZoneSize = core_react_1.Size.create(action.size);
|
|
128
128
|
}
|
|
129
|
-
// istanbul ignore if
|
|
130
|
-
if (action.type === "TOOL_SETTINGS_DRAG_START") {
|
|
131
|
-
void UiFramework_1.UiFramework.postTelemetry("Tool Settings Undocking", "28B04E07-AE73-4533-A0BA-8E2A8DC99ADF");
|
|
132
|
-
}
|
|
133
|
-
// istanbul ignore if
|
|
134
|
-
if (action.type === "TOOL_SETTINGS_DOCK") {
|
|
135
|
-
void UiFramework_1.UiFramework.postTelemetry("Tool Settings Docking to Settings Bar", "BEDE684B-B3DB-4637-B3AF-DC3CBA223F94");
|
|
136
|
-
}
|
|
137
129
|
if (action.type === "WIDGET_TAB_POPOUT") {
|
|
138
130
|
const tabId = action.id;
|
|
139
131
|
frontstageDef.popoutWidget(tabId);
|
|
@@ -214,25 +206,28 @@ function useLabels() {
|
|
|
214
206
|
}), []);
|
|
215
207
|
}
|
|
216
208
|
exports.useLabels = useLabels;
|
|
209
|
+
function toTabArgs(widget) {
|
|
210
|
+
var _a;
|
|
211
|
+
const label = getWidgetLabel(widget.label);
|
|
212
|
+
return {
|
|
213
|
+
allowedPanelTargets: (_a = widget.allowedPanelTargets) === null || _a === void 0 ? void 0 : _a.map((location) => (0, StagePanelDef_1.toPanelSide)(location)),
|
|
214
|
+
hideWithUiWhenFloating: !!widget.hideWithUiWhenFloating,
|
|
215
|
+
canPopout: widget.canPopout,
|
|
216
|
+
iconSpec: widget.iconSpec,
|
|
217
|
+
isFloatingStateWindowResizable: widget.isFloatingStateWindowResizable,
|
|
218
|
+
label,
|
|
219
|
+
preferredFloatingWidgetSize: widget.defaultFloatingSize,
|
|
220
|
+
preferredPanelWidgetSize: widget.preferredPanelSize,
|
|
221
|
+
};
|
|
222
|
+
}
|
|
217
223
|
/** @internal */
|
|
218
224
|
function addWidgets(state, widgets, side, widgetId) {
|
|
219
|
-
var _a;
|
|
220
225
|
const visibleWidgets = widgets.filter((w) => w.isVisible && w.defaultState !== WidgetState_1.WidgetState.Floating);
|
|
221
226
|
if (visibleWidgets.length === 0)
|
|
222
227
|
return state;
|
|
223
228
|
const tabs = new Array();
|
|
224
229
|
for (const widget of visibleWidgets) {
|
|
225
|
-
|
|
226
|
-
state = (0, appui_layout_react_1.addTab)(state, widget.id, {
|
|
227
|
-
label,
|
|
228
|
-
iconSpec: widget.iconSpec,
|
|
229
|
-
preferredPanelWidgetSize: widget.preferredPanelSize,
|
|
230
|
-
preferredFloatingWidgetSize: widget.defaultFloatingSize,
|
|
231
|
-
canPopout: widget.canPopout,
|
|
232
|
-
isFloatingStateWindowResizable: widget.isFloatingStateWindowResizable,
|
|
233
|
-
hideWithUiWhenFloating: !!widget.hideWithUiWhenFloating,
|
|
234
|
-
allowedPanelTargets: (_a = widget.allowedPanelTargets) === null || _a === void 0 ? void 0 : _a.map((location) => (0, StagePanelDef_1.toPanelSide)(location)),
|
|
235
|
-
});
|
|
230
|
+
state = (0, appui_layout_react_1.addTab)(state, widget.id, toTabArgs(widget));
|
|
236
231
|
tabs.push(widget.id);
|
|
237
232
|
}
|
|
238
233
|
const activeWidget = visibleWidgets.find((widget) => widget.isActive);
|
|
@@ -250,13 +245,10 @@ exports.addWidgets = addWidgets;
|
|
|
250
245
|
/** @internal */
|
|
251
246
|
// istanbul ignore next
|
|
252
247
|
function appendWidgets(state, widgetDefs, location, section) {
|
|
253
|
-
var _a
|
|
254
|
-
if (widgetDefs.length === 0)
|
|
255
|
-
return state;
|
|
248
|
+
var _a;
|
|
256
249
|
const side = (0, StagePanelDef_1.toPanelSide)(location);
|
|
257
250
|
// Add missing widget tabs.
|
|
258
251
|
for (const widgetDef of widgetDefs) {
|
|
259
|
-
const label = getWidgetLabel(widgetDef.label);
|
|
260
252
|
const saveTab = state.tabs[widgetDef.id];
|
|
261
253
|
const preferredPanelWidgetSize = saveTab
|
|
262
254
|
? saveTab.preferredPanelWidgetSize
|
|
@@ -271,19 +263,14 @@ function appendWidgets(state, widgetDefs, location, section) {
|
|
|
271
263
|
!!saveTab.preferredFloatingWidgetSize)
|
|
272
264
|
: !!widgetDef.defaultFloatingSize;
|
|
273
265
|
state = (0, appui_layout_react_1.addTab)(state, widgetDef.id, {
|
|
274
|
-
|
|
275
|
-
iconSpec: widgetDef.iconSpec,
|
|
276
|
-
canPopout: widgetDef.canPopout,
|
|
277
|
-
preferredPanelWidgetSize,
|
|
266
|
+
...toTabArgs(widgetDef),
|
|
278
267
|
preferredFloatingWidgetSize,
|
|
268
|
+
preferredPanelWidgetSize,
|
|
279
269
|
userSized,
|
|
280
|
-
isFloatingStateWindowResizable: widgetDef.isFloatingStateWindowResizable,
|
|
281
|
-
hideWithUiWhenFloating: !!widgetDef.hideWithUiWhenFloating,
|
|
282
|
-
allowedPanelTargets: (_a = widgetDef.allowedPanelTargets) === null || _a === void 0 ? void 0 : _a.map((l) => (0, StagePanelDef_1.toPanelSide)(l)),
|
|
283
270
|
});
|
|
284
271
|
if (widgetDef.isFloatingStateSupported &&
|
|
285
272
|
widgetDef.defaultState === WidgetState_1.WidgetState.Floating) {
|
|
286
|
-
const floatingContainerId = (
|
|
273
|
+
const floatingContainerId = (_a = widgetDef.floatingContainerId) !== null && _a !== void 0 ? _a : (0, appui_layout_react_1.getUniqueId)();
|
|
287
274
|
const widgetContainerId = getWidgetId(location, section);
|
|
288
275
|
const home = {
|
|
289
276
|
side,
|
|
@@ -371,6 +358,12 @@ function addMissingWidgets(frontstageDef, initialState) {
|
|
|
371
358
|
state = appendWidgets(state, determineNewWidgets((_f = frontstageDef.topPanel) === null || _f === void 0 ? void 0 : _f.getPanelSectionDef(StagePanelSection_1.StagePanelSection.End).widgetDefs, state), StagePanelLocation_1.StagePanelLocation.Top, StagePanelSection_1.StagePanelSection.End);
|
|
372
359
|
state = appendWidgets(state, determineNewWidgets((_g = frontstageDef.bottomPanel) === null || _g === void 0 ? void 0 : _g.getPanelSectionDef(StagePanelSection_1.StagePanelSection.Start).widgetDefs, state), StagePanelLocation_1.StagePanelLocation.Bottom, StagePanelSection_1.StagePanelSection.Start);
|
|
373
360
|
state = appendWidgets(state, determineNewWidgets((_h = frontstageDef.bottomPanel) === null || _h === void 0 ? void 0 : _h.getPanelSectionDef(StagePanelSection_1.StagePanelSection.End).widgetDefs, state), StagePanelLocation_1.StagePanelLocation.Bottom, StagePanelSection_1.StagePanelSection.End);
|
|
361
|
+
if (frontstageDef.toolSettings) {
|
|
362
|
+
const newToolSettingsWidgets = determineNewWidgets([frontstageDef.toolSettings], state);
|
|
363
|
+
for (const newToolSettingsWidget of newToolSettingsWidgets) {
|
|
364
|
+
state = (0, appui_layout_react_1.addTab)(state, newToolSettingsWidget.id, toTabArgs(newToolSettingsWidget));
|
|
365
|
+
}
|
|
366
|
+
}
|
|
374
367
|
return state;
|
|
375
368
|
}
|
|
376
369
|
exports.addMissingWidgets = addMissingWidgets;
|
|
@@ -390,10 +383,11 @@ function hideWidgets(state, frontstageDef) {
|
|
|
390
383
|
/** Removes NineZoneState widgets that are missing in frontstageDef.
|
|
391
384
|
* @internal
|
|
392
385
|
*/
|
|
393
|
-
function removeMissingWidgets(frontstageDef,
|
|
394
|
-
|
|
386
|
+
function removeMissingWidgets(frontstageDef, state) {
|
|
387
|
+
var _a;
|
|
388
|
+
const toolSettingsTabId = (_a = state.toolSettings) === null || _a === void 0 ? void 0 : _a.tabId;
|
|
395
389
|
for (const [, tab] of Object.entries(state.tabs)) {
|
|
396
|
-
if (tab.id ===
|
|
390
|
+
if (tab.id === toolSettingsTabId)
|
|
397
391
|
continue;
|
|
398
392
|
const widgetDef = frontstageDef.findWidgetDef(tab.id);
|
|
399
393
|
if (widgetDef)
|
|
@@ -502,7 +496,8 @@ function getPanelMaxSize(maxSizeSpec, panel, nineZoneSize) {
|
|
|
502
496
|
: nineZoneSize.width;
|
|
503
497
|
return (maxSizeSpec.percentage / 100) * size;
|
|
504
498
|
}
|
|
505
|
-
|
|
499
|
+
/** @internal */
|
|
500
|
+
exports.stateVersion = 14; // this needs to be bumped when NineZoneState is changed (to recreate the layout).
|
|
506
501
|
/** @internal */
|
|
507
502
|
function initializeNineZoneState(frontstageDef) {
|
|
508
503
|
let nineZone = defaultNineZone;
|
|
@@ -519,30 +514,27 @@ function initializeNineZoneState(frontstageDef) {
|
|
|
519
514
|
nineZone = initializePanel(nineZone, frontstageDef, StagePanelLocation_1.StagePanelLocation.Right);
|
|
520
515
|
nineZone = initializePanel(nineZone, frontstageDef, StagePanelLocation_1.StagePanelLocation.Top);
|
|
521
516
|
nineZone = initializePanel(nineZone, frontstageDef, StagePanelLocation_1.StagePanelLocation.Bottom);
|
|
522
|
-
nineZone = (0, immer_1.default)(nineZone, (
|
|
517
|
+
nineZone = (0, immer_1.default)(nineZone, (draft) => {
|
|
523
518
|
var _a, _b, _c, _d;
|
|
524
|
-
for (const [, panel] of Object.entries(
|
|
525
|
-
const expanded = panel.widgets.find((widgetId) =>
|
|
526
|
-
const firstWidget = panel.widgets.length > 0
|
|
527
|
-
? stateDraft.widgets[panel.widgets[0]]
|
|
528
|
-
: undefined;
|
|
519
|
+
for (const [, panel] of Object.entries(draft.panels)) {
|
|
520
|
+
const expanded = panel.widgets.find((widgetId) => draft.widgets[widgetId].minimized === false);
|
|
521
|
+
const firstWidget = panel.widgets.length > 0 ? draft.widgets[panel.widgets[0]] : undefined;
|
|
529
522
|
// istanbul ignore next
|
|
530
523
|
if (!expanded && firstWidget) {
|
|
531
524
|
firstWidget.minimized = false;
|
|
532
525
|
}
|
|
533
526
|
}
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
const toolSettingsWidgetDef = frontstageDef.toolSettings;
|
|
539
|
-
if (toolSettingsWidgetDef) {
|
|
540
|
-
const toolSettingsTab = stateDraft.tabs[appui_layout_react_1.toolSettingsTabId];
|
|
541
|
-
toolSettingsTab.preferredPanelWidgetSize =
|
|
542
|
-
toolSettingsWidgetDef.preferredPanelSize;
|
|
543
|
-
}
|
|
527
|
+
draft.panels.left.collapsed = isPanelCollapsed((_a = frontstageDef.leftPanel) === null || _a === void 0 ? void 0 : _a.panelState);
|
|
528
|
+
draft.panels.right.collapsed = isPanelCollapsed((_b = frontstageDef.rightPanel) === null || _b === void 0 ? void 0 : _b.panelState);
|
|
529
|
+
draft.panels.top.collapsed = isPanelCollapsed((_c = frontstageDef.topPanel) === null || _c === void 0 ? void 0 : _c.panelState);
|
|
530
|
+
draft.panels.bottom.collapsed = isPanelCollapsed((_d = frontstageDef.bottomPanel) === null || _d === void 0 ? void 0 : _d.panelState);
|
|
544
531
|
});
|
|
545
532
|
nineZone = addMissingWidgets(frontstageDef, nineZone);
|
|
533
|
+
const toolSettingsWidgetDef = frontstageDef.toolSettings;
|
|
534
|
+
if (toolSettingsWidgetDef) {
|
|
535
|
+
const toolSettingsTabId = toolSettingsWidgetDef.id;
|
|
536
|
+
nineZone = (0, appui_layout_react_1.addDockedToolSettings)(nineZone, toolSettingsTabId);
|
|
537
|
+
}
|
|
546
538
|
nineZone = hideWidgets(nineZone, frontstageDef);
|
|
547
539
|
nineZone = processPopoutWidgets(nineZone, frontstageDef);
|
|
548
540
|
return nineZone;
|
|
@@ -556,7 +548,7 @@ exports.initializeNineZoneState = initializeNineZoneState;
|
|
|
556
548
|
function restoreNineZoneState(frontstageDef, saved) {
|
|
557
549
|
let restored = {
|
|
558
550
|
...saved,
|
|
559
|
-
tabs:
|
|
551
|
+
tabs: {},
|
|
560
552
|
};
|
|
561
553
|
for (const [, tab] of Object.entries(saved.tabs)) {
|
|
562
554
|
// Re-add the placeholder tab in order to correctly remove it from the state if WidgetDef is not found.
|
|
@@ -571,15 +563,11 @@ function restoreNineZoneState(frontstageDef, saved) {
|
|
|
571
563
|
continue;
|
|
572
564
|
}
|
|
573
565
|
restored = (0, immer_1.default)(restored, (draft) => {
|
|
574
|
-
var _a;
|
|
575
566
|
draft.tabs[tab.id] = {
|
|
576
567
|
...tab,
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
canPopout: widgetDef.canPopout,
|
|
581
|
-
isFloatingStateWindowResizable: widgetDef.isFloatingStateWindowResizable,
|
|
582
|
-
allowedPanelTargets: (_a = widgetDef.allowedPanelTargets) === null || _a === void 0 ? void 0 : _a.map((location) => (0, StagePanelDef_1.toPanelSide)(location)),
|
|
568
|
+
...toTabArgs(widgetDef),
|
|
569
|
+
preferredFloatingWidgetSize: tab.preferredFloatingWidgetSize,
|
|
570
|
+
preferredPanelWidgetSize: tab.preferredPanelWidgetSize,
|
|
583
571
|
};
|
|
584
572
|
});
|
|
585
573
|
}
|
|
@@ -637,12 +625,9 @@ function packNineZoneState(state) {
|
|
|
637
625
|
};
|
|
638
626
|
packed = (0, immer_1.default)(packed, (draft) => {
|
|
639
627
|
for (const [, tab] of Object.entries(state.tabs)) {
|
|
640
|
-
if (tab.id === appui_layout_react_1.toolSettingsTabId)
|
|
641
|
-
continue;
|
|
642
628
|
draft.tabs[tab.id] = {
|
|
643
629
|
id: tab.id,
|
|
644
630
|
preferredFloatingWidgetSize: tab.preferredFloatingWidgetSize,
|
|
645
|
-
allowedPanelTargets: tab.allowedPanelTargets,
|
|
646
631
|
userSized: tab.userSized,
|
|
647
632
|
};
|
|
648
633
|
}
|
|
@@ -737,16 +722,26 @@ function addHiddenWidget(state, widgetDef) {
|
|
|
737
722
|
}
|
|
738
723
|
/** @internal */
|
|
739
724
|
function setWidgetState(state, widgetDef, widgetState) {
|
|
740
|
-
var _a, _b;
|
|
725
|
+
var _a, _b, _c, _d, _e;
|
|
741
726
|
if (widgetState === WidgetState_1.WidgetState.Hidden) {
|
|
742
727
|
return hideWidget(state, widgetDef);
|
|
743
728
|
}
|
|
744
729
|
else if (widgetState === WidgetState_1.WidgetState.Open) {
|
|
745
730
|
const id = widgetDef.id;
|
|
731
|
+
if (widgetDef.isToolSettings) {
|
|
732
|
+
if (!state.toolSettings && !widgetDef.tabLocation) {
|
|
733
|
+
state = (0, appui_layout_react_1.addDockedToolSettings)(state, id);
|
|
734
|
+
}
|
|
735
|
+
if (((_a = state.toolSettings) === null || _a === void 0 ? void 0 : _a.type) === "docked")
|
|
736
|
+
return state;
|
|
737
|
+
}
|
|
746
738
|
let location = (0, appui_layout_react_1.getTabLocation)(state, id);
|
|
747
739
|
if (!location) {
|
|
748
740
|
state = addHiddenWidget(state, widgetDef);
|
|
749
741
|
location = (0, appui_layout_react_1.getTabLocation)(state, id);
|
|
742
|
+
if (widgetDef.isToolSettings) {
|
|
743
|
+
state = (0, appui_layout_react_1.addWidgetToolSettings)(state, id);
|
|
744
|
+
}
|
|
750
745
|
}
|
|
751
746
|
return (0, immer_1.default)(state, (draft) => {
|
|
752
747
|
var _a;
|
|
@@ -771,6 +766,9 @@ function setWidgetState(state, widgetDef, widgetState) {
|
|
|
771
766
|
}
|
|
772
767
|
else if (widgetState === WidgetState_1.WidgetState.Closed) {
|
|
773
768
|
const id = widgetDef.id;
|
|
769
|
+
if (widgetDef.isToolSettings && ((_b = state.toolSettings) === null || _b === void 0 ? void 0 : _b.type) !== "widget") {
|
|
770
|
+
return state;
|
|
771
|
+
}
|
|
774
772
|
let location = (0, appui_layout_react_1.getTabLocation)(state, id);
|
|
775
773
|
if (!location) {
|
|
776
774
|
state = addHiddenWidget(state, widgetDef);
|
|
@@ -799,14 +797,32 @@ function setWidgetState(state, widgetDef, widgetState) {
|
|
|
799
797
|
return state;
|
|
800
798
|
// Widget is not floating.
|
|
801
799
|
state = (0, appui_layout_react_1.removeTabFromWidget)(state, id);
|
|
802
|
-
const bounds = (
|
|
800
|
+
const bounds = (_d = (_c = widgetDef.tabLocation) === null || _c === void 0 ? void 0 : _c.floatingWidget) === null || _d === void 0 ? void 0 : _d.bounds;
|
|
803
801
|
state = (0, appui_layout_react_1.addFloatingWidget)(state, (0, appui_layout_react_1.getUniqueId)(), [id], { bounds });
|
|
802
|
+
if (widgetDef.isToolSettings) {
|
|
803
|
+
if (((_e = state.toolSettings) === null || _e === void 0 ? void 0 : _e.type) === "docked") {
|
|
804
|
+
state = (0, appui_layout_react_1.removeToolSettings)(state);
|
|
805
|
+
}
|
|
806
|
+
if (!state.toolSettings) {
|
|
807
|
+
state = (0, appui_layout_react_1.addWidgetToolSettings)(state, id);
|
|
808
|
+
}
|
|
809
|
+
}
|
|
804
810
|
}
|
|
805
811
|
return state;
|
|
806
812
|
}
|
|
807
813
|
exports.setWidgetState = setWidgetState;
|
|
808
814
|
/** Stores widget location and hides it in the UI. */
|
|
809
815
|
function hideWidget(state, widgetDef) {
|
|
816
|
+
var _a, _b;
|
|
817
|
+
const toolSettingsTabId = (_a = state.toolSettings) === null || _a === void 0 ? void 0 : _a.tabId;
|
|
818
|
+
if (widgetDef.id === toolSettingsTabId) {
|
|
819
|
+
widgetDef.tabLocation = undefined;
|
|
820
|
+
state = (0, immer_1.default)(state, (draft) => {
|
|
821
|
+
draft.toolSettings = undefined;
|
|
822
|
+
});
|
|
823
|
+
if (((_b = state.toolSettings) === null || _b === void 0 ? void 0 : _b.type) === "docked")
|
|
824
|
+
return state;
|
|
825
|
+
}
|
|
810
826
|
const location = (0, appui_layout_react_1.getTabLocation)(state, widgetDef.id);
|
|
811
827
|
if (!location)
|
|
812
828
|
return state;
|
|
@@ -913,8 +929,8 @@ function useSavedFrontstageState(frontstageDef) {
|
|
|
913
929
|
return;
|
|
914
930
|
if (isFrontstageStateSettingResult(settingResult)) {
|
|
915
931
|
const setting = settingResult.setting;
|
|
916
|
-
if (setting.version
|
|
917
|
-
setting.stateVersion
|
|
932
|
+
if (setting.version === version &&
|
|
933
|
+
setting.stateVersion === exports.stateVersion) {
|
|
918
934
|
const restored = restoreNineZoneState(frontstageDef, setting.nineZone);
|
|
919
935
|
frontstageDef.savedWidgetDefs = setting.widgets;
|
|
920
936
|
restoreSavedWidgets(frontstageDef);
|
|
@@ -942,7 +958,7 @@ function useSaveFrontstageSettings(frontstageDef, store) {
|
|
|
942
958
|
const setting = {
|
|
943
959
|
id,
|
|
944
960
|
version: frontstage.version,
|
|
945
|
-
stateVersion,
|
|
961
|
+
stateVersion: exports.stateVersion,
|
|
946
962
|
nineZone: packNineZoneState(state),
|
|
947
963
|
widgets,
|
|
948
964
|
};
|
|
@@ -1004,14 +1020,11 @@ const createListener = (frontstageDef, listener) => {
|
|
|
1004
1020
|
/** @internal */
|
|
1005
1021
|
function useFrontstageManager(frontstageDef, useToolAsToolSettingsLabel) {
|
|
1006
1022
|
React.useEffect(() => {
|
|
1007
|
-
|
|
1008
|
-
|
|
1023
|
+
return UiFramework_1.UiFramework.frontstages.onWidgetStateChangedEvent.addListener(({ widgetDef, widgetState }) => {
|
|
1024
|
+
if (!frontstageDef.nineZoneState)
|
|
1025
|
+
return;
|
|
1009
1026
|
frontstageDef.nineZoneState = setWidgetState(frontstageDef.nineZoneState, widgetDef, widgetState);
|
|
1010
1027
|
});
|
|
1011
|
-
UiFramework_1.UiFramework.frontstages.onWidgetStateChangedEvent.addListener(listener);
|
|
1012
|
-
return () => {
|
|
1013
|
-
UiFramework_1.UiFramework.frontstages.onWidgetStateChangedEvent.removeListener(listener);
|
|
1014
|
-
};
|
|
1015
1028
|
}, [frontstageDef]);
|
|
1016
1029
|
React.useEffect(() => {
|
|
1017
1030
|
const listener = createListener(frontstageDef, ({ widgetDef }) => {
|
|
@@ -1069,13 +1082,16 @@ function useFrontstageManager(frontstageDef, useToolAsToolSettingsLabel) {
|
|
|
1069
1082
|
const defaultLabel = React.useMemo(() => UiFramework_1.UiFramework.translate("widget.labels.toolSettings"), []);
|
|
1070
1083
|
React.useEffect(() => {
|
|
1071
1084
|
const updateLabel = createListener(frontstageDef, () => {
|
|
1072
|
-
var _a;
|
|
1085
|
+
var _a, _b;
|
|
1073
1086
|
const toolId = UiFramework_1.UiFramework.frontstages.activeToolId;
|
|
1074
1087
|
(0, core_bentley_1.assert)(!!frontstageDef.nineZoneState);
|
|
1075
1088
|
const label = useToolAsToolSettingsLabel
|
|
1076
1089
|
? ((_a = core_frontend_1.IModelApp.tools.find(toolId)) === null || _a === void 0 ? void 0 : _a.flyover) || defaultLabel
|
|
1077
1090
|
: defaultLabel;
|
|
1078
|
-
|
|
1091
|
+
const toolSettingsTabId = (_b = frontstageDef.nineZoneState.toolSettings) === null || _b === void 0 ? void 0 : _b.tabId;
|
|
1092
|
+
if (!toolSettingsTabId)
|
|
1093
|
+
return;
|
|
1094
|
+
frontstageDef.nineZoneState = setWidgetLabel(frontstageDef.nineZoneState, toolSettingsTabId, label);
|
|
1079
1095
|
});
|
|
1080
1096
|
// Whenever the frontstageDef or the useTool... changes, keep the label up to date.
|
|
1081
1097
|
updateLabel();
|