@itwin/appui-react 4.3.0 → 4.4.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 +14 -1
- package/lib/cjs/appui-react/UiFramework.d.ts.map +1 -1
- package/lib/cjs/appui-react/UiFramework.js +11 -10
- package/lib/cjs/appui-react/UiFramework.js.map +1 -1
- package/lib/cjs/appui-react/cursor/cursormenu/CursorMenu.d.ts +1 -1
- package/lib/cjs/appui-react/cursor/cursormenu/CursorMenu.d.ts.map +1 -1
- package/lib/cjs/appui-react/cursor/cursormenu/CursorMenu.js +4 -3
- package/lib/cjs/appui-react/cursor/cursormenu/CursorMenu.js.map +1 -1
- package/lib/cjs/appui-react/selection/HideIsolateEmphasizeManager.d.ts.map +1 -1
- package/lib/cjs/appui-react/selection/HideIsolateEmphasizeManager.js +3 -0
- package/lib/cjs/appui-react/selection/HideIsolateEmphasizeManager.js.map +1 -1
- package/lib/cjs/appui-react/selection/SelectionContextItemDef.d.ts.map +1 -1
- package/lib/cjs/appui-react/selection/SelectionContextItemDef.js +12 -8
- package/lib/cjs/appui-react/selection/SelectionContextItemDef.js.map +1 -1
- package/lib/cjs/appui-react/syncui/SyncUiEventDispatcher.d.ts +6 -4
- package/lib/cjs/appui-react/syncui/SyncUiEventDispatcher.d.ts.map +1 -1
- package/lib/cjs/appui-react/syncui/SyncUiEventDispatcher.js +49 -78
- package/lib/cjs/appui-react/syncui/SyncUiEventDispatcher.js.map +1 -1
- package/lib/cjs/appui-react/toolbar/Toolbar.d.ts +10 -0
- package/lib/cjs/appui-react/toolbar/Toolbar.d.ts.map +1 -1
- package/lib/cjs/appui-react/toolbar/Toolbar.js +3 -2
- package/lib/cjs/appui-react/toolbar/Toolbar.js.map +1 -1
- package/lib/cjs/appui-react/toolbar/ToolbarComposer.d.ts +2 -1
- package/lib/cjs/appui-react/toolbar/ToolbarComposer.d.ts.map +1 -1
- package/lib/cjs/appui-react/toolbar/ToolbarComposer.js +45 -129
- package/lib/cjs/appui-react/toolbar/ToolbarComposer.js.map +1 -1
- package/lib/cjs/appui-react/toolbar/ToolbarItem.d.ts +2 -2
- package/lib/cjs/appui-react/toolbar/ToolbarItem.d.ts.map +1 -1
- package/lib/cjs/appui-react/toolbar/ToolbarItem.js +2 -2
- package/lib/cjs/appui-react/toolbar/ToolbarItem.js.map +1 -1
- package/lib/cjs/appui-react/toolbar/ToolbarItemsManager.d.ts +1 -0
- package/lib/cjs/appui-react/toolbar/ToolbarItemsManager.d.ts.map +1 -1
- package/lib/cjs/appui-react/toolbar/ToolbarItemsManager.js +12 -2
- package/lib/cjs/appui-react/toolbar/ToolbarItemsManager.js.map +1 -1
- package/lib/cjs/appui-react/toolbar/ToolbarWithOverflow.d.ts +2 -1
- package/lib/cjs/appui-react/toolbar/ToolbarWithOverflow.d.ts.map +1 -1
- package/lib/cjs/appui-react/toolbar/ToolbarWithOverflow.js +5 -9
- package/lib/cjs/appui-react/toolbar/ToolbarWithOverflow.js.map +1 -1
- package/lib/cjs/appui-react/toolbar/useActiveStageProvidedToolbarItems.d.ts +11 -0
- package/lib/cjs/appui-react/toolbar/useActiveStageProvidedToolbarItems.d.ts.map +1 -0
- package/lib/cjs/appui-react/toolbar/useActiveStageProvidedToolbarItems.js +46 -0
- package/lib/cjs/appui-react/toolbar/useActiveStageProvidedToolbarItems.js.map +1 -0
- package/lib/cjs/appui-react/toolbar/useActiveToolIdSynchedItems.d.ts +25 -0
- package/lib/cjs/appui-react/toolbar/useActiveToolIdSynchedItems.d.ts.map +1 -0
- package/lib/cjs/appui-react/toolbar/useActiveToolIdSynchedItems.js +63 -0
- package/lib/cjs/appui-react/toolbar/useActiveToolIdSynchedItems.js.map +1 -0
- package/lib/cjs/appui-react/toolbar/useDefaultToolbarItems.d.ts +1 -0
- package/lib/cjs/appui-react/toolbar/useDefaultToolbarItems.d.ts.map +1 -1
- package/lib/cjs/appui-react/toolbar/useDefaultToolbarItems.js +4 -1
- package/lib/cjs/appui-react/toolbar/useDefaultToolbarItems.js.map +1 -1
- package/lib/cjs/appui-react/toolbar/useUiItemsProviderToolbarItems.d.ts +2 -1
- package/lib/cjs/appui-react/toolbar/useUiItemsProviderToolbarItems.d.ts.map +1 -1
- package/lib/cjs/appui-react/toolbar/useUiItemsProviderToolbarItems.js +13 -30
- package/lib/cjs/appui-react/toolbar/useUiItemsProviderToolbarItems.js.map +1 -1
- package/lib/esm/appui-react/UiFramework.d.ts.map +1 -1
- package/lib/esm/appui-react/UiFramework.js +11 -10
- package/lib/esm/appui-react/UiFramework.js.map +1 -1
- package/lib/esm/appui-react/cursor/cursormenu/CursorMenu.d.ts +1 -1
- package/lib/esm/appui-react/cursor/cursormenu/CursorMenu.d.ts.map +1 -1
- package/lib/esm/appui-react/cursor/cursormenu/CursorMenu.js +4 -3
- package/lib/esm/appui-react/cursor/cursormenu/CursorMenu.js.map +1 -1
- package/lib/esm/appui-react/selection/HideIsolateEmphasizeManager.d.ts.map +1 -1
- package/lib/esm/appui-react/selection/HideIsolateEmphasizeManager.js +3 -0
- package/lib/esm/appui-react/selection/HideIsolateEmphasizeManager.js.map +1 -1
- package/lib/esm/appui-react/selection/SelectionContextItemDef.d.ts.map +1 -1
- package/lib/esm/appui-react/selection/SelectionContextItemDef.js +12 -8
- package/lib/esm/appui-react/selection/SelectionContextItemDef.js.map +1 -1
- package/lib/esm/appui-react/syncui/SyncUiEventDispatcher.d.ts +6 -4
- package/lib/esm/appui-react/syncui/SyncUiEventDispatcher.d.ts.map +1 -1
- package/lib/esm/appui-react/syncui/SyncUiEventDispatcher.js +49 -78
- package/lib/esm/appui-react/syncui/SyncUiEventDispatcher.js.map +1 -1
- package/lib/esm/appui-react/toolbar/Toolbar.d.ts +10 -0
- package/lib/esm/appui-react/toolbar/Toolbar.d.ts.map +1 -1
- package/lib/esm/appui-react/toolbar/Toolbar.js +3 -2
- package/lib/esm/appui-react/toolbar/Toolbar.js.map +1 -1
- package/lib/esm/appui-react/toolbar/ToolbarComposer.d.ts +2 -1
- package/lib/esm/appui-react/toolbar/ToolbarComposer.d.ts.map +1 -1
- package/lib/esm/appui-react/toolbar/ToolbarComposer.js +45 -129
- package/lib/esm/appui-react/toolbar/ToolbarComposer.js.map +1 -1
- package/lib/esm/appui-react/toolbar/ToolbarItem.d.ts +2 -2
- package/lib/esm/appui-react/toolbar/ToolbarItem.d.ts.map +1 -1
- package/lib/esm/appui-react/toolbar/ToolbarItem.js +2 -2
- package/lib/esm/appui-react/toolbar/ToolbarItem.js.map +1 -1
- package/lib/esm/appui-react/toolbar/ToolbarItemsManager.d.ts +1 -0
- package/lib/esm/appui-react/toolbar/ToolbarItemsManager.d.ts.map +1 -1
- package/lib/esm/appui-react/toolbar/ToolbarItemsManager.js +12 -2
- package/lib/esm/appui-react/toolbar/ToolbarItemsManager.js.map +1 -1
- package/lib/esm/appui-react/toolbar/ToolbarWithOverflow.d.ts +2 -1
- package/lib/esm/appui-react/toolbar/ToolbarWithOverflow.d.ts.map +1 -1
- package/lib/esm/appui-react/toolbar/ToolbarWithOverflow.js +5 -9
- package/lib/esm/appui-react/toolbar/ToolbarWithOverflow.js.map +1 -1
- package/lib/esm/appui-react/toolbar/useActiveStageProvidedToolbarItems.d.ts +11 -0
- package/lib/esm/appui-react/toolbar/useActiveStageProvidedToolbarItems.d.ts.map +1 -0
- package/lib/esm/appui-react/toolbar/useActiveStageProvidedToolbarItems.js +42 -0
- package/lib/esm/appui-react/toolbar/useActiveStageProvidedToolbarItems.js.map +1 -0
- package/lib/esm/appui-react/toolbar/useActiveToolIdSynchedItems.d.ts +25 -0
- package/lib/esm/appui-react/toolbar/useActiveToolIdSynchedItems.d.ts.map +1 -0
- package/lib/esm/appui-react/toolbar/useActiveToolIdSynchedItems.js +59 -0
- package/lib/esm/appui-react/toolbar/useActiveToolIdSynchedItems.js.map +1 -0
- package/lib/esm/appui-react/toolbar/useDefaultToolbarItems.d.ts +1 -0
- package/lib/esm/appui-react/toolbar/useDefaultToolbarItems.d.ts.map +1 -1
- package/lib/esm/appui-react/toolbar/useDefaultToolbarItems.js +4 -1
- package/lib/esm/appui-react/toolbar/useDefaultToolbarItems.js.map +1 -1
- package/lib/esm/appui-react/toolbar/useUiItemsProviderToolbarItems.d.ts +2 -1
- package/lib/esm/appui-react/toolbar/useUiItemsProviderToolbarItems.d.ts.map +1 -1
- package/lib/esm/appui-react/toolbar/useUiItemsProviderToolbarItems.js +13 -30
- package/lib/esm/appui-react/toolbar/useUiItemsProviderToolbarItems.js.map +1 -1
- package/package.json +13 -14
|
@@ -18,9 +18,12 @@ function isInstance(args) {
|
|
|
18
18
|
/**
|
|
19
19
|
* Controls status bar items.
|
|
20
20
|
* @internal
|
|
21
|
+
* @deprecated in 4.4.0. This is no longer used internally, left because of an erroneous public dependency that is also deprecated.
|
|
21
22
|
*/
|
|
22
23
|
class ToolbarItemsManager {
|
|
23
24
|
constructor(items) {
|
|
25
|
+
// This class should be removed once `useDefaultToolbarItems` and `useUiItemsProviderToolbarItems` (public version) get removed.
|
|
26
|
+
// If you are attempting to fix/clean this class, it is probably an error as it is no longer used and should not be reintroduced, use Hooks instead.
|
|
24
27
|
this._items = [];
|
|
25
28
|
/** Event raised when Toolbar items are changed.
|
|
26
29
|
* @internal
|
|
@@ -31,6 +34,7 @@ class ToolbarItemsManager {
|
|
|
31
34
|
}
|
|
32
35
|
loadItemsInternal(items, processConditions, sendItemChanged) {
|
|
33
36
|
if (processConditions && items) {
|
|
37
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
34
38
|
const eventIds = ToolbarItemsManager.getSyncIdsOfInterest(items);
|
|
35
39
|
if (0 !== eventIds.length) {
|
|
36
40
|
const { itemsUpdated, updatedItems } = this.internalRefreshAffectedItems(items, new Set(eventIds));
|
|
@@ -155,7 +159,9 @@ class ToolbarItemsManager {
|
|
|
155
159
|
for (const item of items) {
|
|
156
160
|
let updatedItem = { ...item };
|
|
157
161
|
if ((0, ToolbarItem_1.isToolbarGroupItem)(updatedItem)) {
|
|
158
|
-
const { childrenUpdated, childItems } =
|
|
162
|
+
const { childrenUpdated, childItems } =
|
|
163
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
164
|
+
ToolbarItemsManager.refreshChildItems(updatedItem, eventIds);
|
|
159
165
|
// istanbul ignore else
|
|
160
166
|
if (childrenUpdated) {
|
|
161
167
|
updatedItem = {
|
|
@@ -213,7 +219,9 @@ class ToolbarItemsManager {
|
|
|
213
219
|
isActiveToolIdRefreshRequired(toolId) {
|
|
214
220
|
for (const item of this.items) {
|
|
215
221
|
if ((0, ToolbarItem_1.isToolbarGroupItem)(item)) {
|
|
216
|
-
if (
|
|
222
|
+
if (
|
|
223
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
224
|
+
ToolbarItemsManager.isActiveToolIdRefreshRequiredForChildren(item.items, toolId))
|
|
217
225
|
return true;
|
|
218
226
|
}
|
|
219
227
|
else {
|
|
@@ -232,6 +240,7 @@ class ToolbarItemsManager {
|
|
|
232
240
|
if ((0, ToolbarItem_1.isToolbarGroupItem)(updatedItem)) {
|
|
233
241
|
updatedItem = {
|
|
234
242
|
...updatedItem,
|
|
243
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
235
244
|
items: ToolbarItemsManager.refreshActiveToolIdInChildItems(updatedItem, toolId),
|
|
236
245
|
};
|
|
237
246
|
}
|
|
@@ -250,6 +259,7 @@ class ToolbarItemsManager {
|
|
|
250
259
|
if ((0, ToolbarItem_1.isToolbarGroupItem)(updatedItem)) {
|
|
251
260
|
updatedItem = {
|
|
252
261
|
...updatedItem,
|
|
262
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
253
263
|
items: ToolbarItemsManager.refreshActiveToolIdInChildItems(updatedItem, toolId),
|
|
254
264
|
};
|
|
255
265
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolbarItemsManager.js","sourceRoot":"","sources":["../../../../src/appui-react/toolbar/ToolbarItemsManager.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;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MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE;YAC7B,IAAI,WAAW,GAAG,EAAE,GAAG,IAAI,EAAE,CAAC;YAE9B,IAAI,IAAA,gCAAkB,EAAC,WAAW,CAAC,EAAE;gBACnC,WAAW,GAAG;oBACZ,GAAG,WAAW;oBACd,KAAK,EAAE,mBAAmB,CAAC,+BAA+B,CACxD,WAAW,EACX,MAAM,CACP;iBACF,CAAC;aACH;YAED,WAAW,CAAC,QAAQ,GAAG,WAAW,CAAC,EAAE,KAAK,MAAM,CAAC;YACjD,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;SAC5B;QAED,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC;IACxB,CAAC;CACF;AAhVD,kDAgVC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Toolbar\n */\n\nimport {\n ConditionalBooleanValue,\n ConditionalStringValue,\n} from \"@itwin/appui-abstract\";\nimport { ConditionalIconItem } from \"@itwin/core-react\";\nimport { BeEvent } from \"@itwin/core-bentley\";\nimport type {\n ToolbarActionItem,\n ToolbarGroupItem,\n ToolbarItem,\n} from \"./ToolbarItem\";\nimport { isToolbarGroupItem } from \"./ToolbarItem\";\n\nfunction isInstance<T>(args: T | ReadonlyArray<T>): args is T {\n return !Array.isArray(args);\n}\n\n/** Arguments of [[ToolbarItemsManager.onChanged]] event.\n * @internal\n */\nexport interface ToolbarItemsChangedArgs {\n readonly items: ReadonlyArray<ToolbarItem>;\n}\n\n/**\n * Controls status bar items.\n * @internal\n */\nexport class ToolbarItemsManager {\n protected _items: ReadonlyArray<ToolbarItem> = [];\n\n constructor(items?: ReadonlyArray<ToolbarItem>) {\n if (items) this.loadItemsInternal(items, true, false);\n }\n\n /** Event raised when Toolbar items are changed.\n * @internal\n */\n public readonly onItemsChanged = new BeEvent<\n (args: ToolbarItemsChangedArgs) => void\n >();\n\n private loadItemsInternal(\n items: ReadonlyArray<ToolbarItem>,\n processConditions: boolean,\n sendItemChanged: boolean\n ) {\n if (processConditions && items) {\n const eventIds = ToolbarItemsManager.getSyncIdsOfInterest(items);\n if (0 !== eventIds.length) {\n const { itemsUpdated, updatedItems } =\n this.internalRefreshAffectedItems(items, new Set(eventIds));\n\n // istanbul ignore else\n if (itemsUpdated) items = updatedItems;\n }\n }\n\n this._items = items;\n if (sendItemChanged) this.onItemsChanged.raiseEvent({ items });\n }\n\n /** load items but do not fire onItemsChanged\n * @internal\n */\n public loadItems(items: ReadonlyArray<ToolbarItem>) {\n this.loadItemsInternal(items, true, false);\n }\n\n /** Get an array of the Toolbar items */\n public get items(): ReadonlyArray<ToolbarItem> {\n return this._items;\n }\n\n public set items(items: ReadonlyArray<ToolbarItem>) {\n // istanbul ignore else\n if (items !== this._items) this.loadItemsInternal(items, true, true);\n }\n\n public add(itemOrItems: ToolbarItem | ReadonlyArray<ToolbarItem>) {\n let itemsToAdd;\n if (isInstance(itemOrItems)) itemsToAdd = [itemOrItems];\n else {\n itemsToAdd = itemOrItems.filter(\n (itemToAdd, index) =>\n itemOrItems.findIndex((item) => item.id === itemToAdd.id) === index\n );\n }\n itemsToAdd = itemsToAdd.filter(\n (itemToAdd) =>\n this._items.find((item) => item.id === itemToAdd.id) === undefined\n );\n if (itemsToAdd.length === 0) return;\n const items = [...this._items, ...itemsToAdd];\n this.items = items;\n }\n\n /** Remove Toolbar items based on id */\n public remove(\n itemIdOrItemIds: ToolbarItem[\"id\"] | ReadonlyArray<ToolbarItem[\"id\"]>\n ) {\n const items = this._items.filter((item) => {\n return isInstance(itemIdOrItemIds)\n ? item.id !== itemIdOrItemIds\n : !itemIdOrItemIds.find((itemId) => itemId === item.id);\n });\n this.items = items;\n }\n\n /** @internal */\n public removeAll() {\n this._items = [];\n }\n\n private static gatherSyncIds(\n eventIds: Set<string>,\n items: readonly ToolbarItem[]\n ) {\n for (const item of items) {\n for (const [, entry] of Object.entries(item)) {\n if (entry instanceof ConditionalBooleanValue) {\n entry.syncEventIds.forEach((eventId: string) =>\n eventIds.add(eventId.toLowerCase())\n );\n } else if (entry instanceof ConditionalStringValue) {\n entry.syncEventIds.forEach((eventId: string) =>\n eventIds.add(eventId.toLowerCase())\n );\n } /* istanbul ignore else */ else if (\n ConditionalIconItem.isConditionalIconItem(entry)\n ) {\n entry.syncEventIds.forEach((eventId: string) =>\n eventIds.add(eventId.toLowerCase())\n );\n }\n }\n // istanbul ignore else\n if (isToolbarGroupItem(item)) {\n this.gatherSyncIds(eventIds, item.items);\n }\n }\n }\n\n public static getSyncIdsOfInterest(items: readonly ToolbarItem[]): string[] {\n const eventIds = new Set<string>();\n this.gatherSyncIds(eventIds, items);\n return [...eventIds.values()];\n }\n\n private static refreshChildItems(\n parentItem: ToolbarGroupItem,\n eventIds: Set<string>\n ): {\n childrenUpdated: boolean;\n childItems: ReadonlyArray<ToolbarActionItem | ToolbarGroupItem>;\n } {\n const updatedItems: Array<ToolbarActionItem | ToolbarGroupItem> = [];\n let itemsUpdated = false;\n\n for (const item of parentItem.items) {\n let updatedItem;\n if (isToolbarGroupItem(item)) {\n updatedItem = { ...item };\n const { childrenUpdated, childItems } = this.refreshChildItems(\n updatedItem,\n eventIds\n );\n // istanbul ignore else\n if (childrenUpdated) {\n updatedItem.items = childItems;\n itemsUpdated = true;\n }\n } else {\n updatedItem = { ...item };\n }\n\n for (const [, entry] of Object.entries(updatedItem)) {\n if (entry instanceof ConditionalBooleanValue) {\n // istanbul ignore else\n if (ConditionalBooleanValue.refreshValue(entry, eventIds))\n itemsUpdated = true;\n } /* istanbul ignore else */ else if (\n entry instanceof ConditionalStringValue\n ) {\n // istanbul ignore else\n if (ConditionalStringValue.refreshValue(entry, eventIds))\n itemsUpdated = true;\n } /* istanbul ignore else */ else if (\n ConditionalIconItem.isConditionalIconItem(entry)\n ) {\n // istanbul ignore else\n if (\n ConditionalIconItem.refreshValue(\n entry as ConditionalIconItem,\n eventIds\n )\n )\n itemsUpdated = true;\n }\n }\n\n updatedItems.push(updatedItem);\n }\n return { childrenUpdated: itemsUpdated, childItems: updatedItems };\n }\n\n private internalRefreshAffectedItems(\n items: readonly ToolbarItem[],\n eventIds: Set<string>\n ): { itemsUpdated: boolean; updatedItems: ToolbarItem[] } {\n // istanbul ignore next\n if (0 === eventIds.size) return { itemsUpdated: false, updatedItems: [] };\n\n let updateRequired = false;\n\n const newItems: ToolbarItem[] = [];\n for (const item of items) {\n let updatedItem = { ...item };\n if (isToolbarGroupItem(updatedItem)) {\n const { childrenUpdated, childItems } =\n ToolbarItemsManager.refreshChildItems(updatedItem, eventIds);\n // istanbul ignore else\n if (childrenUpdated) {\n updatedItem = {\n ...updatedItem,\n items: childItems,\n };\n updateRequired = true;\n }\n }\n\n for (const [, entry] of Object.entries(updatedItem)) {\n if (entry instanceof ConditionalBooleanValue) {\n // istanbul ignore else\n if (ConditionalBooleanValue.refreshValue(entry, eventIds))\n updateRequired = true;\n } else if (entry instanceof ConditionalStringValue) {\n // istanbul ignore else\n if (ConditionalStringValue.refreshValue(entry, eventIds))\n updateRequired = true;\n } /* istanbul ignore else */ else if (\n ConditionalIconItem.isConditionalIconItem(entry)\n ) {\n // istanbul ignore else\n if (\n ConditionalIconItem.refreshValue(\n entry as ConditionalIconItem,\n eventIds\n )\n )\n updateRequired = true;\n }\n }\n\n newItems.push(updatedItem);\n }\n\n return { itemsUpdated: updateRequired, updatedItems: newItems };\n }\n\n public refreshAffectedItems(eventIds: Set<string>) {\n // istanbul ignore next\n if (0 === eventIds.size) return;\n\n const { itemsUpdated, updatedItems } = this.internalRefreshAffectedItems(\n this.items,\n eventIds\n );\n\n // istanbul ignore else\n if (itemsUpdated) this.loadItemsInternal(updatedItems, false, true);\n }\n\n private static isActiveToolIdRefreshRequiredForChildren(\n children: ReadonlyArray<ToolbarActionItem | ToolbarGroupItem>,\n toolId: string\n ): boolean {\n for (const item of children) {\n if (isToolbarGroupItem(item)) {\n if (this.isActiveToolIdRefreshRequiredForChildren(item.items, toolId))\n return true;\n } else {\n const isActive = !!item.isActive;\n if (\n (isActive && item.id !== toolId) ||\n (!isActive && item.id === toolId)\n )\n return true;\n }\n }\n return false;\n }\n\n private isActiveToolIdRefreshRequired(toolId: string): boolean {\n for (const item of this.items) {\n if (isToolbarGroupItem(item)) {\n if (\n ToolbarItemsManager.isActiveToolIdRefreshRequiredForChildren(\n item.items,\n toolId\n )\n )\n return true;\n } else {\n const isActive = !!item.isActive;\n if (\n (isActive && item.id !== toolId) ||\n (!isActive && item.id === toolId)\n )\n return true;\n }\n }\n\n return false;\n }\n\n private static refreshActiveToolIdInChildItems(\n parentItem: ToolbarGroupItem,\n toolId: string\n ): Array<ToolbarActionItem | ToolbarGroupItem> {\n const newChildren: Array<ToolbarActionItem | ToolbarGroupItem> = [];\n for (const item of parentItem.items) {\n let updatedItem = { ...item };\n\n if (isToolbarGroupItem(updatedItem)) {\n updatedItem = {\n ...updatedItem,\n items: ToolbarItemsManager.refreshActiveToolIdInChildItems(\n updatedItem,\n toolId\n ),\n };\n }\n\n updatedItem.isActive = updatedItem.id === toolId;\n newChildren.push(updatedItem);\n }\n return newChildren;\n }\n\n public setActiveToolId(toolId: string) {\n // first see if any updates are really necessary\n if (!this.isActiveToolIdRefreshRequired(toolId)) return;\n\n const newItems: ToolbarItem[] = [];\n for (const item of this.items) {\n let updatedItem = { ...item };\n\n if (isToolbarGroupItem(updatedItem)) {\n updatedItem = {\n ...updatedItem,\n items: ToolbarItemsManager.refreshActiveToolIdInChildItems(\n updatedItem,\n toolId\n ),\n };\n }\n\n updatedItem.isActive = updatedItem.id === toolId;\n newItems.push(updatedItem);\n }\n\n this.items = newItems;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ToolbarItemsManager.js","sourceRoot":"","sources":["../../../../src/appui-react/toolbar/ToolbarItemsManager.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;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,6BAA6B,CAAC,MAAM,CAAC;YAAE,OAAO;QAExD,MAAM,QAAQ,GAAkB,EAAE,CAAC;QACnC,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE;YAC7B,IAAI,WAAW,GAAG,EAAE,GAAG,IAAI,EAAE,CAAC;YAE9B,IAAI,IAAA,gCAAkB,EAAC,WAAW,CAAC,EAAE;gBACnC,WAAW,GAAG;oBACZ,GAAG,WAAW;oBACd,mDAAmD;oBACnD,KAAK,EAAE,mBAAmB,CAAC,+BAA+B,CACxD,WAAW,EACX,MAAM,CACP;iBACF,CAAC;aACH;YAED,WAAW,CAAC,QAAQ,GAAG,WAAW,CAAC,EAAE,KAAK,MAAM,CAAC;YACjD,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;SAC5B;QAED,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC;IACxB,CAAC;CACF;AA7UD,kDA6UC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Toolbar\n */\n\nimport {\n ConditionalBooleanValue,\n ConditionalStringValue,\n} from \"@itwin/appui-abstract\";\nimport { ConditionalIconItem } from \"@itwin/core-react\";\nimport { BeEvent } from \"@itwin/core-bentley\";\nimport type {\n ToolbarActionItem,\n ToolbarGroupItem,\n ToolbarItem,\n} from \"./ToolbarItem\";\nimport { isToolbarGroupItem } from \"./ToolbarItem\";\n\nfunction isInstance<T>(args: T | ReadonlyArray<T>): args is T {\n return !Array.isArray(args);\n}\n\n/** Arguments of [[ToolbarItemsManager.onChanged]] event.\n * @internal\n */\nexport interface ToolbarItemsChangedArgs {\n readonly items: ReadonlyArray<ToolbarItem>;\n}\n\n/**\n * Controls status bar items.\n * @internal\n * @deprecated in 4.4.0. This is no longer used internally, left because of an erroneous public dependency that is also deprecated.\n */\nexport class ToolbarItemsManager {\n // This class should be removed once `useDefaultToolbarItems` and `useUiItemsProviderToolbarItems` (public version) get removed.\n // If you are attempting to fix/clean this class, it is probably an error as it is no longer used and should not be reintroduced, use Hooks instead.\n protected _items: ReadonlyArray<ToolbarItem> = [];\n\n constructor(items?: ReadonlyArray<ToolbarItem>) {\n if (items) this.loadItemsInternal(items, true, false);\n }\n\n /** Event raised when Toolbar items are changed.\n * @internal\n */\n public readonly onItemsChanged = new BeEvent<\n (args: ToolbarItemsChangedArgs) => void\n >();\n\n private loadItemsInternal(\n items: ReadonlyArray<ToolbarItem>,\n processConditions: boolean,\n sendItemChanged: boolean\n ) {\n if (processConditions && items) {\n // eslint-disable-next-line deprecation/deprecation\n const eventIds = ToolbarItemsManager.getSyncIdsOfInterest(items);\n if (0 !== eventIds.length) {\n const { itemsUpdated, updatedItems } =\n this.internalRefreshAffectedItems(items, new Set(eventIds));\n\n // istanbul ignore else\n if (itemsUpdated) items = updatedItems;\n }\n }\n\n this._items = items;\n if (sendItemChanged) this.onItemsChanged.raiseEvent({ items });\n }\n\n /** load items but do not fire onItemsChanged\n * @internal\n */\n public loadItems(items: ReadonlyArray<ToolbarItem>) {\n this.loadItemsInternal(items, true, false);\n }\n\n /** Get an array of the Toolbar items */\n public get items(): ReadonlyArray<ToolbarItem> {\n return this._items;\n }\n\n public set items(items: ReadonlyArray<ToolbarItem>) {\n // istanbul ignore else\n if (items !== this._items) this.loadItemsInternal(items, true, true);\n }\n\n public add(itemOrItems: ToolbarItem | ReadonlyArray<ToolbarItem>) {\n let itemsToAdd;\n if (isInstance(itemOrItems)) itemsToAdd = [itemOrItems];\n else {\n itemsToAdd = itemOrItems.filter(\n (itemToAdd, index) =>\n itemOrItems.findIndex((item) => item.id === itemToAdd.id) === index\n );\n }\n itemsToAdd = itemsToAdd.filter(\n (itemToAdd) =>\n this._items.find((item) => item.id === itemToAdd.id) === undefined\n );\n if (itemsToAdd.length === 0) return;\n const items = [...this._items, ...itemsToAdd];\n this.items = items;\n }\n\n /** Remove Toolbar items based on id */\n public remove(\n itemIdOrItemIds: ToolbarItem[\"id\"] | ReadonlyArray<ToolbarItem[\"id\"]>\n ) {\n const items = this._items.filter((item) => {\n return isInstance(itemIdOrItemIds)\n ? item.id !== itemIdOrItemIds\n : !itemIdOrItemIds.find((itemId) => itemId === item.id);\n });\n this.items = items;\n }\n\n /** @internal */\n public removeAll() {\n this._items = [];\n }\n\n private static gatherSyncIds(\n eventIds: Set<string>,\n items: readonly ToolbarItem[]\n ) {\n for (const item of items) {\n for (const [, entry] of Object.entries(item)) {\n if (entry instanceof ConditionalBooleanValue) {\n entry.syncEventIds.forEach((eventId: string) =>\n eventIds.add(eventId.toLowerCase())\n );\n } else if (entry instanceof ConditionalStringValue) {\n entry.syncEventIds.forEach((eventId: string) =>\n eventIds.add(eventId.toLowerCase())\n );\n } /* istanbul ignore else */ else if (\n ConditionalIconItem.isConditionalIconItem(entry)\n ) {\n entry.syncEventIds.forEach((eventId: string) =>\n eventIds.add(eventId.toLowerCase())\n );\n }\n }\n // istanbul ignore else\n if (isToolbarGroupItem(item)) {\n this.gatherSyncIds(eventIds, item.items);\n }\n }\n }\n\n public static getSyncIdsOfInterest(items: readonly ToolbarItem[]): string[] {\n const eventIds = new Set<string>();\n this.gatherSyncIds(eventIds, items);\n return [...eventIds.values()];\n }\n\n private static refreshChildItems(\n parentItem: ToolbarGroupItem,\n eventIds: Set<string>\n ): {\n childrenUpdated: boolean;\n childItems: ReadonlyArray<ToolbarActionItem | ToolbarGroupItem>;\n } {\n const updatedItems: Array<ToolbarActionItem | ToolbarGroupItem> = [];\n let itemsUpdated = false;\n\n for (const item of parentItem.items) {\n let updatedItem;\n if (isToolbarGroupItem(item)) {\n updatedItem = { ...item };\n const { childrenUpdated, childItems } = this.refreshChildItems(\n updatedItem,\n eventIds\n );\n // istanbul ignore else\n if (childrenUpdated) {\n updatedItem.items = childItems;\n itemsUpdated = true;\n }\n } else {\n updatedItem = { ...item };\n }\n\n for (const [, entry] of Object.entries(updatedItem)) {\n if (entry instanceof ConditionalBooleanValue) {\n // istanbul ignore else\n if (ConditionalBooleanValue.refreshValue(entry, eventIds))\n itemsUpdated = true;\n } /* istanbul ignore else */ else if (\n entry instanceof ConditionalStringValue\n ) {\n // istanbul ignore else\n if (ConditionalStringValue.refreshValue(entry, eventIds))\n itemsUpdated = true;\n } /* istanbul ignore else */ else if (\n ConditionalIconItem.isConditionalIconItem(entry)\n ) {\n // istanbul ignore else\n if (ConditionalIconItem.refreshValue(entry, eventIds))\n itemsUpdated = true;\n }\n }\n\n updatedItems.push(updatedItem);\n }\n return { childrenUpdated: itemsUpdated, childItems: updatedItems };\n }\n\n private internalRefreshAffectedItems(\n items: readonly ToolbarItem[],\n eventIds: Set<string>\n ): { itemsUpdated: boolean; updatedItems: ToolbarItem[] } {\n // istanbul ignore next\n if (0 === eventIds.size) return { itemsUpdated: false, updatedItems: [] };\n\n let updateRequired = false;\n\n const newItems: ToolbarItem[] = [];\n for (const item of items) {\n let updatedItem = { ...item };\n if (isToolbarGroupItem(updatedItem)) {\n const { childrenUpdated, childItems } =\n // eslint-disable-next-line deprecation/deprecation\n ToolbarItemsManager.refreshChildItems(updatedItem, eventIds);\n // istanbul ignore else\n if (childrenUpdated) {\n updatedItem = {\n ...updatedItem,\n items: childItems,\n };\n updateRequired = true;\n }\n }\n\n for (const [, entry] of Object.entries(updatedItem)) {\n if (entry instanceof ConditionalBooleanValue) {\n // istanbul ignore else\n if (ConditionalBooleanValue.refreshValue(entry, eventIds))\n updateRequired = true;\n } else if (entry instanceof ConditionalStringValue) {\n // istanbul ignore else\n if (ConditionalStringValue.refreshValue(entry, eventIds))\n updateRequired = true;\n } /* istanbul ignore else */ else if (\n ConditionalIconItem.isConditionalIconItem(entry)\n ) {\n // istanbul ignore else\n if (ConditionalIconItem.refreshValue(entry, eventIds))\n updateRequired = true;\n }\n }\n\n newItems.push(updatedItem);\n }\n\n return { itemsUpdated: updateRequired, updatedItems: newItems };\n }\n\n public refreshAffectedItems(eventIds: Set<string>) {\n // istanbul ignore next\n if (0 === eventIds.size) return;\n\n const { itemsUpdated, updatedItems } = this.internalRefreshAffectedItems(\n this.items,\n eventIds\n );\n\n // istanbul ignore else\n if (itemsUpdated) this.loadItemsInternal(updatedItems, false, true);\n }\n\n private static isActiveToolIdRefreshRequiredForChildren(\n children: ReadonlyArray<ToolbarActionItem | ToolbarGroupItem>,\n toolId: string\n ): boolean {\n for (const item of children) {\n if (isToolbarGroupItem(item)) {\n if (this.isActiveToolIdRefreshRequiredForChildren(item.items, toolId))\n return true;\n } else {\n const isActive = !!item.isActive;\n if (\n (isActive && item.id !== toolId) ||\n (!isActive && item.id === toolId)\n )\n return true;\n }\n }\n return false;\n }\n\n private isActiveToolIdRefreshRequired(toolId: string): boolean {\n for (const item of this.items) {\n if (isToolbarGroupItem(item)) {\n if (\n // eslint-disable-next-line deprecation/deprecation\n ToolbarItemsManager.isActiveToolIdRefreshRequiredForChildren(\n item.items,\n toolId\n )\n )\n return true;\n } else {\n const isActive = !!item.isActive;\n if (\n (isActive && item.id !== toolId) ||\n (!isActive && item.id === toolId)\n )\n return true;\n }\n }\n\n return false;\n }\n\n private static refreshActiveToolIdInChildItems(\n parentItem: ToolbarGroupItem,\n toolId: string\n ): Array<ToolbarActionItem | ToolbarGroupItem> {\n const newChildren: Array<ToolbarActionItem | ToolbarGroupItem> = [];\n for (const item of parentItem.items) {\n let updatedItem = { ...item };\n\n if (isToolbarGroupItem(updatedItem)) {\n updatedItem = {\n ...updatedItem,\n // eslint-disable-next-line deprecation/deprecation\n items: ToolbarItemsManager.refreshActiveToolIdInChildItems(\n updatedItem,\n toolId\n ),\n };\n }\n\n updatedItem.isActive = updatedItem.id === toolId;\n newChildren.push(updatedItem);\n }\n return newChildren;\n }\n\n public setActiveToolId(toolId: string) {\n // first see if any updates are really necessary\n if (!this.isActiveToolIdRefreshRequired(toolId)) return;\n\n const newItems: ToolbarItem[] = [];\n for (const item of this.items) {\n let updatedItem = { ...item };\n\n if (isToolbarGroupItem(updatedItem)) {\n updatedItem = {\n ...updatedItem,\n // eslint-disable-next-line deprecation/deprecation\n items: ToolbarItemsManager.refreshActiveToolIdInChildItems(\n updatedItem,\n toolId\n ),\n };\n }\n\n updatedItem.isActive = updatedItem.id === toolId;\n newItems.push(updatedItem);\n }\n\n this.items = newItems;\n }\n}\n"]}
|
|
@@ -27,7 +27,8 @@ export interface ToolbarWithOverflowProps extends CommonProps, NoChildrenProps {
|
|
|
27
27
|
/** Optional function to call on any KeyDown events processed by toolbar */
|
|
28
28
|
onKeyDown?: (e: React.KeyboardEvent) => void;
|
|
29
29
|
}
|
|
30
|
-
/** Component that displays toolbar items
|
|
30
|
+
/** Component that displays toolbar items, displaying only the elements that can fit in the available space,
|
|
31
|
+
* and put the other items into a single panel.
|
|
31
32
|
* @beta
|
|
32
33
|
*/
|
|
33
34
|
export declare function ToolbarWithOverflow(props: ToolbarWithOverflowProps): JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolbarWithOverflow.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/toolbar/ToolbarWithOverflow.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EACV,SAAS,EACT,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"ToolbarWithOverflow.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/toolbar/ToolbarWithOverflow.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EACV,SAAS,EACT,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAGjD;;GAEG;AACH,MAAM,WAAW,wBAAyB,SAAQ,WAAW,EAAE,eAAe;IAC5E,oGAAoG;IACpG,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,4GAA4G;IAC5G,iBAAiB,CAAC,EAAE,SAAS,CAAC;IAC9B,uGAAuG;IACvG,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,8FAA8F;IAC9F,cAAc,CAAC,EAAE,qBAAqB,CAAC;IACvC,mEAAmE;IACnE,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,oFAAoF;IACpF,qBAAqB,CAAC,EAAE,qBAAqB,CAAC;IAC9C,sDAAsD;IACtD,cAAc,CAAC,EAAE,kBAAkB,CAAC;IACpC,2EAA2E;IAC3E,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,aAAa,KAAK,IAAI,CAAC;CAC9C;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,eAGlE"}
|
|
@@ -9,18 +9,14 @@
|
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.ToolbarWithOverflow = void 0;
|
|
11
11
|
const React = require("react");
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
const Toolbar_1 = require("./Toolbar");
|
|
13
|
+
/** Component that displays toolbar items, displaying only the elements that can fit in the available space,
|
|
14
|
+
* and put the other items into a single panel.
|
|
15
15
|
* @beta
|
|
16
16
|
*/
|
|
17
17
|
function ToolbarWithOverflow(props) {
|
|
18
|
-
const {
|
|
19
|
-
|
|
20
|
-
return items.map((item) => (0, toUIAToolbarItem_1.toUIAToolbarItem)(item));
|
|
21
|
-
}, [items]);
|
|
22
|
-
return (React.createElement(components_react_1.ToolbarWithOverflow // eslint-disable-line deprecation/deprecation
|
|
23
|
-
, { items: uiaItems, ...other }));
|
|
18
|
+
const { overflowExpandsTo, ...toolbarProps } = props;
|
|
19
|
+
return React.createElement(Toolbar_1.Toolbar, { enableOverflow: { overflowExpandsTo }, ...toolbarProps });
|
|
24
20
|
}
|
|
25
21
|
exports.ToolbarWithOverflow = ToolbarWithOverflow;
|
|
26
22
|
//# sourceMappingURL=ToolbarWithOverflow.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolbarWithOverflow.js","sourceRoot":"","sources":["../../../../src/appui-react/toolbar/ToolbarWithOverflow.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,+BAA+B;
|
|
1
|
+
{"version":3,"file":"ToolbarWithOverflow.js","sourceRoot":"","sources":["../../../../src/appui-react/toolbar/ToolbarWithOverflow.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,+BAA+B;AAS/B,uCAAoC;AAwBpC;;;GAGG;AACH,SAAgB,mBAAmB,CAAC,KAA+B;IACjE,MAAM,EAAE,iBAAiB,EAAE,GAAG,YAAY,EAAE,GAAG,KAAK,CAAC;IACrD,OAAO,oBAAC,iBAAO,IAAC,cAAc,EAAE,EAAE,iBAAiB,EAAE,KAAM,YAAY,GAAI,CAAC;AAC9E,CAAC;AAHD,kDAGC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Toolbar\n */\n\nimport * as React from \"react\";\nimport type { OnItemExecutedFunc } from \"@itwin/appui-abstract\";\nimport type { CommonProps, NoChildrenProps } from \"@itwin/core-react\";\nimport type {\n Direction,\n ToolbarOpacitySetting,\n ToolbarPanelAlignment,\n} from \"@itwin/components-react\";\nimport type { ToolbarItem } from \"./ToolbarItem\";\nimport { Toolbar } from \"./Toolbar\";\n\n/** Component that displays toolbar items.\n * @beta\n */\nexport interface ToolbarWithOverflowProps extends CommonProps, NoChildrenProps {\n /** Describes to which direction the popup panels are expanded. Defaults to: [[Direction.Bottom]] */\n expandsTo?: Direction;\n /** Describes to which direction the overflow popup panels are expanded. Defaults to: [[Direction.Right]] */\n overflowExpandsTo?: Direction;\n /** Definitions for items of the toolbar. Items are expected to be already sorted by group and item. */\n items: ToolbarItem[];\n /** Describes how expanded panels are aligned. Defaults to: [[ToolbarPanelAlignment.Start]] */\n panelAlignment?: ToolbarPanelAlignment;\n /** Use Drag Interaction to open popups with nest action buttons */\n useDragInteraction?: boolean;\n /** Determines whether to use mouse proximity to alter the opacity of the toolbar */\n toolbarOpacitySetting?: ToolbarOpacitySetting;\n /** Optional function to call on any item execution */\n onItemExecuted?: OnItemExecutedFunc;\n /** Optional function to call on any KeyDown events processed by toolbar */\n onKeyDown?: (e: React.KeyboardEvent) => void;\n}\n\n/** Component that displays toolbar items, displaying only the elements that can fit in the available space,\n * and put the other items into a single panel.\n * @beta\n */\nexport function ToolbarWithOverflow(props: ToolbarWithOverflowProps) {\n const { overflowExpandsTo, ...toolbarProps } = props;\n return <Toolbar enableOverflow={{ overflowExpandsTo }} {...toolbarProps} />;\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module Toolbar
|
|
3
|
+
*/
|
|
4
|
+
import type { ToolbarItem, ToolbarOrientation, ToolbarUsage } from "./ToolbarItem";
|
|
5
|
+
/**
|
|
6
|
+
* Collects the currently registered items providers toolbar item
|
|
7
|
+
* for the active stage and provided toolbar usage and orientation.
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export declare const useActiveStageProvidedToolbarItems: (toolbarUsage: ToolbarUsage, toolbarOrientation: ToolbarOrientation) => readonly ToolbarItem[];
|
|
11
|
+
//# sourceMappingURL=useActiveStageProvidedToolbarItems.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useActiveStageProvidedToolbarItems.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/toolbar/useActiveStageProvidedToolbarItems.ts"],"names":[],"mappings":"AAIA;;GAEG;AAMH,OAAO,KAAK,EACV,WAAW,EACX,kBAAkB,EAClB,YAAY,EACb,MAAM,eAAe,CAAC;AAGvB;;;;GAIG;AACH,eAAO,MAAM,kCAAkC,iBAC/B,YAAY,sBACN,kBAAkB,KACrC,SAAS,WAAW,EA+BtB,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
/** @packageDocumentation
|
|
7
|
+
* @module Toolbar
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.useActiveStageProvidedToolbarItems = void 0;
|
|
11
|
+
const React = require("react");
|
|
12
|
+
const useActiveStageId_1 = require("../hooks/useActiveStageId");
|
|
13
|
+
const useAvailableUiItemsProviders_1 = require("../hooks/useAvailableUiItemsProviders");
|
|
14
|
+
const UiFramework_1 = require("../UiFramework");
|
|
15
|
+
const UiItemsManager_1 = require("../ui-items-provider/UiItemsManager");
|
|
16
|
+
/**
|
|
17
|
+
* Collects the currently registered items providers toolbar item
|
|
18
|
+
* for the active stage and provided toolbar usage and orientation.
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
const useActiveStageProvidedToolbarItems = (toolbarUsage, toolbarOrientation) => {
|
|
22
|
+
const uiItemsProviderIds = (0, useAvailableUiItemsProviders_1.useAvailableUiItemsProviders)();
|
|
23
|
+
const stageId = (0, useActiveStageId_1.useActiveStageId)();
|
|
24
|
+
const [items, setItems] = React.useState([]);
|
|
25
|
+
const providersRef = React.useRef("");
|
|
26
|
+
const currentStageRef = React.useRef("");
|
|
27
|
+
// gathers items from registered extensions - dependent on when a uiItemsProvider is register or unregistered and if the
|
|
28
|
+
// current stage's composer allows entries from extensions.
|
|
29
|
+
React.useEffect(() => {
|
|
30
|
+
const uiProviders = uiItemsProviderIds.join("-");
|
|
31
|
+
if (providersRef.current !== uiProviders ||
|
|
32
|
+
currentStageRef.current !== stageId) {
|
|
33
|
+
const frontstageDef = UiFramework_1.UiFramework.frontstages.activeFrontstageDef;
|
|
34
|
+
if (frontstageDef) {
|
|
35
|
+
const usage = frontstageDef.usage;
|
|
36
|
+
currentStageRef.current = stageId;
|
|
37
|
+
providersRef.current = uiProviders;
|
|
38
|
+
const toolbarItems = UiItemsManager_1.UiItemsManager.getToolbarButtonItems(stageId, usage, toolbarUsage, toolbarOrientation);
|
|
39
|
+
setItems(toolbarItems);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}, [uiItemsProviderIds, stageId, toolbarUsage, toolbarOrientation]);
|
|
43
|
+
return items;
|
|
44
|
+
};
|
|
45
|
+
exports.useActiveStageProvidedToolbarItems = useActiveStageProvidedToolbarItems;
|
|
46
|
+
//# sourceMappingURL=useActiveStageProvidedToolbarItems.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useActiveStageProvidedToolbarItems.js","sourceRoot":"","sources":["../../../../src/appui-react/toolbar/useActiveStageProvidedToolbarItems.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,+BAA+B;AAC/B,gEAA6D;AAC7D,wFAAqF;AACrF,gDAA6C;AAM7C,wEAAqE;AAErE;;;;GAIG;AACI,MAAM,kCAAkC,GAAG,CAChD,YAA0B,EAC1B,kBAAsC,EACd,EAAE;IAC1B,MAAM,kBAAkB,GAAG,IAAA,2DAA4B,GAAE,CAAC;IAC1D,MAAM,OAAO,GAAG,IAAA,mCAAgB,GAAE,CAAC;IACnC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAyB,EAAE,CAAC,CAAC;IACrE,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACtC,MAAM,eAAe,GAAG,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACzC,wHAAwH;IACxH,2DAA2D;IAC3D,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,MAAM,WAAW,GAAG,kBAAkB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAEjD,IACE,YAAY,CAAC,OAAO,KAAK,WAAW;YACpC,eAAe,CAAC,OAAO,KAAK,OAAO,EACnC;YACA,MAAM,aAAa,GAAG,yBAAW,CAAC,WAAW,CAAC,mBAAmB,CAAC;YAClE,IAAI,aAAa,EAAE;gBACjB,MAAM,KAAK,GAAG,aAAa,CAAC,KAAK,CAAC;gBAClC,eAAe,CAAC,OAAO,GAAG,OAAO,CAAC;gBAClC,YAAY,CAAC,OAAO,GAAG,WAAW,CAAC;gBACnC,MAAM,YAAY,GAAG,+BAAc,CAAC,qBAAqB,CACvD,OAAO,EACP,KAAK,EACL,YAAY,EACZ,kBAAkB,CACnB,CAAC;gBACF,QAAQ,CAAC,YAAY,CAAC,CAAC;aACxB;SACF;IACH,CAAC,EAAE,CAAC,kBAAkB,EAAE,OAAO,EAAE,YAAY,EAAE,kBAAkB,CAAC,CAAC,CAAC;IACpE,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAlCW,QAAA,kCAAkC,sCAkC7C","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Toolbar\n */\n\nimport * as React from \"react\";\nimport { useActiveStageId } from \"../hooks/useActiveStageId\";\nimport { useAvailableUiItemsProviders } from \"../hooks/useAvailableUiItemsProviders\";\nimport { UiFramework } from \"../UiFramework\";\nimport type {\n ToolbarItem,\n ToolbarOrientation,\n ToolbarUsage,\n} from \"./ToolbarItem\";\nimport { UiItemsManager } from \"../ui-items-provider/UiItemsManager\";\n\n/**\n * Collects the currently registered items providers toolbar item\n * for the active stage and provided toolbar usage and orientation.\n * @internal\n */\nexport const useActiveStageProvidedToolbarItems = (\n toolbarUsage: ToolbarUsage,\n toolbarOrientation: ToolbarOrientation\n): readonly ToolbarItem[] => {\n const uiItemsProviderIds = useAvailableUiItemsProviders();\n const stageId = useActiveStageId();\n const [items, setItems] = React.useState<readonly ToolbarItem[]>([]);\n const providersRef = React.useRef(\"\");\n const currentStageRef = React.useRef(\"\");\n // gathers items from registered extensions - dependent on when a uiItemsProvider is register or unregistered and if the\n // current stage's composer allows entries from extensions.\n React.useEffect(() => {\n const uiProviders = uiItemsProviderIds.join(\"-\");\n\n if (\n providersRef.current !== uiProviders ||\n currentStageRef.current !== stageId\n ) {\n const frontstageDef = UiFramework.frontstages.activeFrontstageDef;\n if (frontstageDef) {\n const usage = frontstageDef.usage;\n currentStageRef.current = stageId;\n providersRef.current = uiProviders;\n const toolbarItems = UiItemsManager.getToolbarButtonItems(\n stageId,\n usage,\n toolbarUsage,\n toolbarOrientation\n );\n setItems(toolbarItems);\n }\n }\n }, [uiItemsProviderIds, stageId, toolbarUsage, toolbarOrientation]);\n return items;\n};\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { BeEvent } from "@itwin/core-bentley";
|
|
2
|
+
type ActiveToolIdSynchedItem<T> = {
|
|
3
|
+
id: string;
|
|
4
|
+
isActive?: boolean;
|
|
5
|
+
} | {
|
|
6
|
+
id: string;
|
|
7
|
+
items: T[];
|
|
8
|
+
};
|
|
9
|
+
interface ActiveToolIdSynchedHost {
|
|
10
|
+
activeToolId: string;
|
|
11
|
+
onToolActivatedEvent: BeEvent<(args: {
|
|
12
|
+
toolId: string;
|
|
13
|
+
}) => void>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Synch the provided items to only show the item with id === activeToolId to be
|
|
17
|
+
* active, as determined by the UiFramework.frontstages.activeToolId.
|
|
18
|
+
* @param itemsToSynch List of items to keep in synch.
|
|
19
|
+
* @param syncHost Source of information to synch to (UiFramework.frontstages)
|
|
20
|
+
* @returns Up to date itemsToSynch.
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
export declare function useActiveToolIdSynchedItems<T extends ActiveToolIdSynchedItem<T>>(itemsToSynch: readonly T[], syncHost: ActiveToolIdSynchedHost): T[];
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=useActiveToolIdSynchedItems.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useActiveToolIdSynchedItems.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/toolbar/useActiveToolIdSynchedItems.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnD,KAAK,uBAAuB,CAAC,CAAC,IAC1B;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,GAClC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,CAAC,EAAE,CAAA;CAAE,CAAC;AAE/B,UAAU,uBAAuB;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,oBAAoB,EAAE,OAAO,CAAC,CAAC,IAAI,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC,CAAC;CACnE;AAiDD;;;;;;;GAOG;AACH,wBAAgB,2BAA2B,CACzC,CAAC,SAAS,uBAAuB,CAAC,CAAC,CAAC,EACpC,YAAY,EAAE,SAAS,CAAC,EAAE,EAAE,QAAQ,EAAE,uBAAuB,GAAG,CAAC,EAAE,CAWpE"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useActiveToolIdSynchedItems = void 0;
|
|
4
|
+
/*---------------------------------------------------------------------------------------------
|
|
5
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
6
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
7
|
+
*--------------------------------------------------------------------------------------------*/
|
|
8
|
+
const React = require("react");
|
|
9
|
+
/**
|
|
10
|
+
* Recursively checks if the item with the current id of "toolId" is
|
|
11
|
+
* the only active tool.
|
|
12
|
+
* @param items list of items to validate
|
|
13
|
+
* @param toolId toolId to check
|
|
14
|
+
* @returns true if any item "isActive" must change.
|
|
15
|
+
*/
|
|
16
|
+
function mustRefresh(items, toolId) {
|
|
17
|
+
return items.some((item) => {
|
|
18
|
+
if ("items" in item) {
|
|
19
|
+
return mustRefresh(item.items, toolId);
|
|
20
|
+
}
|
|
21
|
+
return ((item.isActive && item.id !== toolId) ||
|
|
22
|
+
(!item.isActive && item.id === toolId));
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Recursively updates the isActive for the tools and only activate
|
|
27
|
+
* the one with the id equal to toolId.
|
|
28
|
+
* @param items list of items to update
|
|
29
|
+
* @param toolId toolId to check
|
|
30
|
+
* @returns updated list of items
|
|
31
|
+
*/
|
|
32
|
+
function refreshItems(items, toolId) {
|
|
33
|
+
return items.map((item) => "items" in item
|
|
34
|
+
? {
|
|
35
|
+
...item,
|
|
36
|
+
isActive: item.id === toolId,
|
|
37
|
+
items: refreshItems(item.items, toolId),
|
|
38
|
+
}
|
|
39
|
+
: {
|
|
40
|
+
...item,
|
|
41
|
+
isActive: item.id === toolId,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Synch the provided items to only show the item with id === activeToolId to be
|
|
46
|
+
* active, as determined by the UiFramework.frontstages.activeToolId.
|
|
47
|
+
* @param itemsToSynch List of items to keep in synch.
|
|
48
|
+
* @param syncHost Source of information to synch to (UiFramework.frontstages)
|
|
49
|
+
* @returns Up to date itemsToSynch.
|
|
50
|
+
* @internal
|
|
51
|
+
*/
|
|
52
|
+
function useActiveToolIdSynchedItems(itemsToSynch, syncHost) {
|
|
53
|
+
const [items, setItems] = React.useState([]);
|
|
54
|
+
React.useEffect(() => {
|
|
55
|
+
setItems(refreshItems(itemsToSynch, syncHost.activeToolId));
|
|
56
|
+
return syncHost.onToolActivatedEvent.addListener(({ toolId }) => {
|
|
57
|
+
setItems((current) => mustRefresh(current, toolId) ? refreshItems(current, toolId) : current);
|
|
58
|
+
});
|
|
59
|
+
}, [itemsToSynch, syncHost.activeToolId, syncHost.onToolActivatedEvent]);
|
|
60
|
+
return items;
|
|
61
|
+
}
|
|
62
|
+
exports.useActiveToolIdSynchedItems = useActiveToolIdSynchedItems;
|
|
63
|
+
//# sourceMappingURL=useActiveToolIdSynchedItems.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useActiveToolIdSynchedItems.js","sourceRoot":"","sources":["../../../../src/appui-react/toolbar/useActiveToolIdSynchedItems.ts"],"names":[],"mappings":";;;AAAA;;;gGAGgG;AAChG,+BAA+B;AAY/B;;;;;;GAMG;AACH,SAAS,WAAW,CAClB,KAAmB,EACnB,MAAc;IAEd,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;QACzB,IAAI,OAAO,IAAI,IAAI,EAAE;YACnB,OAAO,WAAW,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;SACxC;QACD,OAAO,CACL,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,EAAE,KAAK,MAAM,CAAC;YACrC,CAAC,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,EAAE,KAAK,MAAM,CAAC,CACvC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;GAMG;AACH,SAAS,YAAY,CACnB,KAAmB,EACnB,MAAc;IAEd,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CACxB,OAAO,IAAI,IAAI;QACb,CAAC,CAAC;YACE,GAAG,IAAI;YACP,QAAQ,EAAE,IAAI,CAAC,EAAE,KAAK,MAAM;YAC5B,KAAK,EAAE,YAAY,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC;SACxC;QACH,CAAC,CAAC;YACE,GAAG,IAAI;YACP,QAAQ,EAAE,IAAI,CAAC,EAAE,KAAK,MAAM;SAC7B,CACN,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,2BAA2B,CAEzC,YAA0B,EAAE,QAAiC;IAC7D,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAM,EAAE,CAAC,CAAC;IAClD,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,QAAQ,CAAC,YAAY,CAAC,YAAY,EAAE,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC;QAC5D,OAAO,QAAQ,CAAC,oBAAoB,CAAC,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE;YAC9D,QAAQ,CAAC,CAAC,OAAO,EAAE,EAAE,CACnB,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CACvE,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,YAAY,EAAE,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC,oBAAoB,CAAC,CAAC,CAAC;IACzE,OAAO,KAAK,CAAC;AACf,CAAC;AAbD,kEAaC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\nimport * as React from \"react\";\nimport type { BeEvent } from \"@itwin/core-bentley\";\n\ntype ActiveToolIdSynchedItem<T> =\n | { id: string; isActive?: boolean }\n | { id: string; items: T[] };\n\ninterface ActiveToolIdSynchedHost {\n activeToolId: string;\n onToolActivatedEvent: BeEvent<(args: { toolId: string }) => void>;\n}\n\n/**\n * Recursively checks if the item with the current id of \"toolId\" is\n * the only active tool.\n * @param items list of items to validate\n * @param toolId toolId to check\n * @returns true if any item \"isActive\" must change.\n */\nfunction mustRefresh<T extends ActiveToolIdSynchedItem<T>>(\n items: readonly T[],\n toolId: string\n): boolean {\n return items.some((item) => {\n if (\"items\" in item) {\n return mustRefresh(item.items, toolId);\n }\n return (\n (item.isActive && item.id !== toolId) ||\n (!item.isActive && item.id === toolId)\n );\n });\n}\n\n/**\n * Recursively updates the isActive for the tools and only activate\n * the one with the id equal to toolId.\n * @param items list of items to update\n * @param toolId toolId to check\n * @returns updated list of items\n */\nfunction refreshItems<T extends ActiveToolIdSynchedItem<T>>(\n items: readonly T[],\n toolId: string\n): T[] {\n return items.map((item) =>\n \"items\" in item\n ? {\n ...item,\n isActive: item.id === toolId,\n items: refreshItems(item.items, toolId),\n }\n : {\n ...item,\n isActive: item.id === toolId,\n }\n );\n}\n\n/**\n * Synch the provided items to only show the item with id === activeToolId to be\n * active, as determined by the UiFramework.frontstages.activeToolId.\n * @param itemsToSynch List of items to keep in synch.\n * @param syncHost Source of information to synch to (UiFramework.frontstages)\n * @returns Up to date itemsToSynch.\n * @internal\n */\nexport function useActiveToolIdSynchedItems<\n T extends ActiveToolIdSynchedItem<T>\n>(itemsToSynch: readonly T[], syncHost: ActiveToolIdSynchedHost): T[] {\n const [items, setItems] = React.useState<T[]>([]);\n React.useEffect(() => {\n setItems(refreshItems(itemsToSynch, syncHost.activeToolId));\n return syncHost.onToolActivatedEvent.addListener(({ toolId }) => {\n setItems((current) =>\n mustRefresh(current, toolId) ? refreshItems(current, toolId) : current\n );\n });\n }, [itemsToSynch, syncHost.activeToolId, syncHost.onToolActivatedEvent]);\n return items;\n}\n"]}
|
|
@@ -5,6 +5,7 @@ import type { ToolbarItem } from "./ToolbarItem";
|
|
|
5
5
|
import type { ToolbarItemsManager } from "./ToolbarItemsManager";
|
|
6
6
|
/** Hook that returns items from [[ToolbarItemsManager]].
|
|
7
7
|
* @public
|
|
8
|
+
* @deprecated in 4.4.0. Use [[Toolbar]] component instead of this hooks, ToolbarItemsManager is internal and should not be used here.
|
|
8
9
|
*/
|
|
9
10
|
export declare const useDefaultToolbarItems: (manager: ToolbarItemsManager) => readonly ToolbarItem[];
|
|
10
11
|
//# sourceMappingURL=useDefaultToolbarItems.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDefaultToolbarItems.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/toolbar/useDefaultToolbarItems.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAEjE
|
|
1
|
+
{"version":3,"file":"useDefaultToolbarItems.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/toolbar/useDefaultToolbarItems.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAEjE;;;GAGG;AACH,eAAO,MAAM,sBAAsB,YAExB,mBAAmB,KAC3B,SAAS,WAAW,EAetB,CAAC"}
|
|
@@ -11,8 +11,11 @@ exports.useDefaultToolbarItems = void 0;
|
|
|
11
11
|
const React = require("react");
|
|
12
12
|
/** Hook that returns items from [[ToolbarItemsManager]].
|
|
13
13
|
* @public
|
|
14
|
+
* @deprecated in 4.4.0. Use [[Toolbar]] component instead of this hooks, ToolbarItemsManager is internal and should not be used here.
|
|
14
15
|
*/
|
|
15
|
-
const useDefaultToolbarItems = (
|
|
16
|
+
const useDefaultToolbarItems = (
|
|
17
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
18
|
+
manager) => {
|
|
16
19
|
const [items, setItems] = React.useState(() => manager.items);
|
|
17
20
|
const isInitialMount = React.useRef(true);
|
|
18
21
|
React.useEffect(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDefaultToolbarItems.js","sourceRoot":"","sources":["../../../../src/appui-react/toolbar/useDefaultToolbarItems.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,+BAA+B;AAI/B
|
|
1
|
+
{"version":3,"file":"useDefaultToolbarItems.js","sourceRoot":"","sources":["../../../../src/appui-react/toolbar/useDefaultToolbarItems.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,+BAA+B;AAI/B;;;GAGG;AACI,MAAM,sBAAsB,GAAG;AACpC,mDAAmD;AACnD,OAA4B,EACJ,EAAE;IAC1B,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC9D,MAAM,cAAc,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC1C,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,cAAc,CAAC,OAAO;YAAE,cAAc,CAAC,OAAO,GAAG,KAAK,CAAC;aACtD;YACH,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;SACzB;IACH,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;IAC7B,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,OAAO,OAAO,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,EAAE;YACjD,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IACd,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAlBW,QAAA,sBAAsB,0BAkBjC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Toolbar\n */\n\nimport * as React from \"react\";\nimport type { ToolbarItem } from \"./ToolbarItem\";\nimport type { ToolbarItemsManager } from \"./ToolbarItemsManager\";\n\n/** Hook that returns items from [[ToolbarItemsManager]].\n * @public\n * @deprecated in 4.4.0. Use [[Toolbar]] component instead of this hooks, ToolbarItemsManager is internal and should not be used here.\n */\nexport const useDefaultToolbarItems = (\n // eslint-disable-next-line deprecation/deprecation\n manager: ToolbarItemsManager\n): readonly ToolbarItem[] => {\n const [items, setItems] = React.useState(() => manager.items);\n const isInitialMount = React.useRef(true);\n React.useEffect(() => {\n if (isInitialMount.current) isInitialMount.current = false;\n else {\n setItems(manager.items);\n }\n }, [manager, manager.items]);\n React.useEffect(() => {\n return manager.onItemsChanged.addListener((args) => {\n setItems(args.items);\n });\n }, [manager]);\n return items;\n};\n"]}
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import type { ToolbarItem, ToolbarOrientation, ToolbarUsage } from "./ToolbarItem";
|
|
5
5
|
import type { ToolbarItemsManager } from "./ToolbarItemsManager";
|
|
6
|
-
/** Hook that
|
|
6
|
+
/** Hook that retrieves active frontstage toolbar items from UiItemsProviders and manage them through [[ToolbarItemsManager]].
|
|
7
7
|
* @public
|
|
8
|
+
* @deprecated in 4.4.0. This uses ToolbarItemsManager which is internal, directly use [[ToolbarComposer]] instead.
|
|
8
9
|
*/
|
|
9
10
|
export declare const useUiItemsProviderToolbarItems: (manager: ToolbarItemsManager, toolbarUsage: ToolbarUsage, toolbarOrientation: ToolbarOrientation) => readonly ToolbarItem[];
|
|
10
11
|
//# sourceMappingURL=useUiItemsProviderToolbarItems.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useUiItemsProviderToolbarItems.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/toolbar/useUiItemsProviderToolbarItems.tsx"],"names":[],"mappings":"AAIA;;GAEG;
|
|
1
|
+
{"version":3,"file":"useUiItemsProviderToolbarItems.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/toolbar/useUiItemsProviderToolbarItems.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,KAAK,EACV,WAAW,EACX,kBAAkB,EAClB,YAAY,EACb,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAGjE;;;GAGG;AACH,eAAO,MAAM,8BAA8B,YAEhC,mBAAmB,gBACd,YAAY,sBACN,kBAAkB,KACrC,SAAS,WAAW,EAetB,CAAC"}
|
|
@@ -9,41 +9,24 @@
|
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.useUiItemsProviderToolbarItems = void 0;
|
|
11
11
|
const React = require("react");
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
const UiFramework_1 = require("../UiFramework");
|
|
15
|
-
const UiItemsManager_1 = require("../ui-items-provider/UiItemsManager");
|
|
16
|
-
/** Hook that returns items from [[ToolbarItemsManager]].
|
|
12
|
+
const useActiveStageProvidedToolbarItems_1 = require("./useActiveStageProvidedToolbarItems");
|
|
13
|
+
/** Hook that retrieves active frontstage toolbar items from UiItemsProviders and manage them through [[ToolbarItemsManager]].
|
|
17
14
|
* @public
|
|
15
|
+
* @deprecated in 4.4.0. This uses ToolbarItemsManager which is internal, directly use [[ToolbarComposer]] instead.
|
|
18
16
|
*/
|
|
19
|
-
const useUiItemsProviderToolbarItems = (
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const currentStageRef = React.useRef("");
|
|
25
|
-
// gathers items from registered extensions - dependent on when a uiItemsProvider is register or unregistered and if the
|
|
26
|
-
// current stage's composer allows entries from extensions.
|
|
17
|
+
const useUiItemsProviderToolbarItems = (
|
|
18
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
19
|
+
manager, toolbarUsage, toolbarOrientation) => {
|
|
20
|
+
const providedItems = (0, useActiveStageProvidedToolbarItems_1.useActiveStageProvidedToolbarItems)(toolbarUsage, toolbarOrientation);
|
|
21
|
+
const [items, setItems] = React.useState(providedItems);
|
|
27
22
|
React.useEffect(() => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const frontstageDef = UiFramework_1.UiFramework.frontstages.activeFrontstageDef;
|
|
33
|
-
// istanbul ignore else
|
|
34
|
-
if (frontstageDef) {
|
|
35
|
-
const usage = frontstageDef.usage;
|
|
36
|
-
currentStageRef.current = stageId;
|
|
37
|
-
providersRef.current = uiProviders;
|
|
38
|
-
const toolbarItems = UiItemsManager_1.UiItemsManager.getToolbarButtonItems(stageId, usage, toolbarUsage, toolbarOrientation);
|
|
39
|
-
manager.loadItems(toolbarItems);
|
|
40
|
-
setItems(manager.items);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
return manager.onItemsChanged.addListener((args) => {
|
|
23
|
+
var _a;
|
|
24
|
+
manager === null || manager === void 0 ? void 0 : manager.loadItems(providedItems);
|
|
25
|
+
setItems((_a = manager === null || manager === void 0 ? void 0 : manager.items) !== null && _a !== void 0 ? _a : providedItems);
|
|
26
|
+
return manager === null || manager === void 0 ? void 0 : manager.onItemsChanged.addListener((args) => {
|
|
44
27
|
setItems(args.items);
|
|
45
28
|
});
|
|
46
|
-
}, [
|
|
29
|
+
}, [manager, providedItems]);
|
|
47
30
|
return items;
|
|
48
31
|
};
|
|
49
32
|
exports.useUiItemsProviderToolbarItems = useUiItemsProviderToolbarItems;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useUiItemsProviderToolbarItems.js","sourceRoot":"","sources":["../../../../src/appui-react/toolbar/useUiItemsProviderToolbarItems.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,+BAA+B;
|
|
1
|
+
{"version":3,"file":"useUiItemsProviderToolbarItems.js","sourceRoot":"","sources":["../../../../src/appui-react/toolbar/useUiItemsProviderToolbarItems.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,+BAA+B;AAO/B,6FAA0F;AAE1F;;;GAGG;AACI,MAAM,8BAA8B,GAAG;AAC5C,mDAAmD;AACnD,OAA4B,EAC5B,YAA0B,EAC1B,kBAAsC,EACd,EAAE;IAC1B,MAAM,aAAa,GAAG,IAAA,uEAAkC,EACtD,YAAY,EACZ,kBAAkB,CACnB,CAAC;IACF,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;IACxD,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;;QACnB,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,CAAC,aAAa,CAAC,CAAC;QAClC,QAAQ,CAAC,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,mCAAI,aAAa,CAAC,CAAC;QAE1C,OAAO,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,cAAc,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,EAAE;YAClD,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC;IAC7B,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AApBW,QAAA,8BAA8B,kCAoBzC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Toolbar\n */\n\nimport * as React from \"react\";\nimport type {\n ToolbarItem,\n ToolbarOrientation,\n ToolbarUsage,\n} from \"./ToolbarItem\";\nimport type { ToolbarItemsManager } from \"./ToolbarItemsManager\";\nimport { useActiveStageProvidedToolbarItems } from \"./useActiveStageProvidedToolbarItems\";\n\n/** Hook that retrieves active frontstage toolbar items from UiItemsProviders and manage them through [[ToolbarItemsManager]].\n * @public\n * @deprecated in 4.4.0. This uses ToolbarItemsManager which is internal, directly use [[ToolbarComposer]] instead.\n */\nexport const useUiItemsProviderToolbarItems = (\n // eslint-disable-next-line deprecation/deprecation\n manager: ToolbarItemsManager,\n toolbarUsage: ToolbarUsage,\n toolbarOrientation: ToolbarOrientation\n): readonly ToolbarItem[] => {\n const providedItems = useActiveStageProvidedToolbarItems(\n toolbarUsage,\n toolbarOrientation\n );\n const [items, setItems] = React.useState(providedItems);\n React.useEffect(() => {\n manager?.loadItems(providedItems);\n setItems(manager?.items ?? providedItems);\n\n return manager?.onItemsChanged.addListener((args) => {\n setItems(args.items);\n });\n }, [manager, providedItems]);\n return items;\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UiFramework.d.ts","sourceRoot":"","sources":["../../../src/appui-react/UiFramework.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAa,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAkC,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChF,OAAO,KAAK,EAAE,c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B,EAAE,OAAO;IAQ/D;;OAEG;IACH,WAAkB,kBAAkB,YAInC;IACD;;OAEG;WACW,qBAAqB,CAAC,OAAO,EAAE,OAAO;IAQpD;;SAEK;IACL,WAAkB,iBAAiB,IAAI,OAAO,CAG7C;CACF"}
|
|
@@ -338,16 +338,17 @@ class UiFramework {
|
|
|
338
338
|
static setIModelConnection(iModelConnection, immediateSync = false) {
|
|
339
339
|
var _a;
|
|
340
340
|
const oldConnection = UiFramework.getIModelConnection();
|
|
341
|
-
if (oldConnection
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
341
|
+
if (oldConnection === iModelConnection)
|
|
342
|
+
return;
|
|
343
|
+
InternalFrontstageManager.clearFrontstageDefsForIModelId(oldConnection === null || oldConnection === void 0 ? void 0 : oldConnection.iModelId);
|
|
344
|
+
oldConnection && SyncUiEventDispatcher.clearConnectionEvents(oldConnection);
|
|
345
|
+
iModelConnection &&
|
|
346
|
+
SyncUiEventDispatcher.initializeConnectionEvents(iModelConnection);
|
|
347
|
+
UiFramework.dispatchActionToStore(SessionStateActionId.SetIModelConnection, iModelConnection, immediateSync);
|
|
348
|
+
const itemsSelected = iModelConnection
|
|
349
|
+
? iModelConnection.selectionSet.elements.size
|
|
350
|
+
: 0;
|
|
351
|
+
UiFramework.dispatchActionToStore(SessionStateActionId.SetNumItemsSelected, itemsSelected);
|
|
351
352
|
UiFramework.setActiveIModelId((_a = iModelConnection === null || iModelConnection === void 0 ? void 0 : iModelConnection.iModelId) !== null && _a !== void 0 ? _a : "");
|
|
352
353
|
}
|
|
353
354
|
static getIModelConnection() {
|