@itwin/appui-abstract 5.0.0-dev.41 → 5.0.0-dev.49
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 +11 -1
- package/lib/cjs/appui-abstract/UiAdmin.js.map +1 -1
- package/lib/cjs/appui-abstract/common/KeyboardKey.js.map +1 -1
- package/lib/cjs/appui-abstract/content/ContentLayoutProps.js.map +1 -1
- package/lib/cjs/appui-abstract/content/StandardContentLayouts.js.map +1 -1
- package/lib/cjs/appui-abstract/dialogs/DialogItem.js.map +1 -1
- package/lib/cjs/appui-abstract/dialogs/UiDataProvider.js.map +1 -1
- package/lib/cjs/appui-abstract/dialogs/UiLayoutDataProvider.js.map +1 -1
- package/lib/cjs/appui-abstract/items/AbstractItemProps.js.map +1 -1
- package/lib/cjs/appui-abstract/items/AbstractMenuItemProps.js.map +1 -1
- package/lib/cjs/appui-abstract/items/AbstractToolbarProps.js.map +1 -1
- package/lib/cjs/appui-abstract/items/BadgeType.js.map +1 -1
- package/lib/cjs/appui-abstract/items/ConditionalBooleanValue.js.map +1 -1
- package/lib/cjs/appui-abstract/items/ConditionalStringValue.js.map +1 -1
- package/lib/cjs/appui-abstract/items/RelativePosition.js.map +1 -1
- package/lib/cjs/appui-abstract/notification/MessagePresenter.js.map +1 -1
- package/lib/cjs/appui-abstract/notification/MessageSeverity.js.map +1 -1
- package/lib/cjs/appui-abstract/properties/Description.js.map +1 -1
- package/lib/cjs/appui-abstract/properties/EditorParams.js.map +1 -1
- package/lib/cjs/appui-abstract/properties/PrimitiveTypes.js.map +1 -1
- package/lib/cjs/appui-abstract/properties/Record.js.map +1 -1
- package/lib/cjs/appui-abstract/properties/StandardEditorNames.js.map +1 -1
- package/lib/cjs/appui-abstract/properties/StandardTypeNames.js.map +1 -1
- package/lib/cjs/appui-abstract/properties/Value.js.map +1 -1
- package/lib/cjs/appui-abstract/quantity/BaseQuantityDescription.js.map +1 -1
- package/lib/cjs/appui-abstract/toolbars/ToolbarItem.d.ts +3 -27
- package/lib/cjs/appui-abstract/toolbars/ToolbarItem.d.ts.map +1 -1
- package/lib/cjs/appui-abstract/toolbars/ToolbarItem.js +1 -23
- package/lib/cjs/appui-abstract/toolbars/ToolbarItem.js.map +1 -1
- package/lib/cjs/appui-abstract/utils/IconSpecUtilities.d.ts +0 -10
- package/lib/cjs/appui-abstract/utils/IconSpecUtilities.d.ts.map +1 -1
- package/lib/cjs/appui-abstract/utils/IconSpecUtilities.js +0 -17
- package/lib/cjs/appui-abstract/utils/IconSpecUtilities.js.map +1 -1
- package/lib/cjs/appui-abstract/utils/PointProps.js.map +1 -1
- package/lib/cjs/appui-abstract/utils/UiError.js.map +1 -1
- package/lib/cjs/appui-abstract/utils/UiEvent.js.map +1 -1
- package/lib/cjs/appui-abstract/utils/UiEventDispatcher.js.map +1 -1
- package/lib/cjs/appui-abstract/utils/callbacks.js.map +1 -1
- package/lib/cjs/appui-abstract/utils/filter/filters.js.map +1 -1
- package/lib/cjs/appui-abstract/utils/misc.js.map +1 -1
- package/lib/cjs/appui-abstract.d.ts +1 -28
- package/lib/cjs/appui-abstract.d.ts.map +1 -1
- package/lib/cjs/appui-abstract.js +1 -28
- package/lib/cjs/appui-abstract.js.map +1 -1
- package/lib/esm/appui-abstract/UiAdmin.js.map +1 -1
- package/lib/esm/appui-abstract/common/KeyboardKey.js.map +1 -1
- package/lib/esm/appui-abstract/content/ContentLayoutProps.js.map +1 -1
- package/lib/esm/appui-abstract/content/StandardContentLayouts.js.map +1 -1
- package/lib/esm/appui-abstract/dialogs/DialogItem.js.map +1 -1
- package/lib/esm/appui-abstract/dialogs/UiDataProvider.js.map +1 -1
- package/lib/esm/appui-abstract/dialogs/UiLayoutDataProvider.js.map +1 -1
- package/lib/esm/appui-abstract/items/AbstractItemProps.js.map +1 -1
- package/lib/esm/appui-abstract/items/AbstractMenuItemProps.js.map +1 -1
- package/lib/esm/appui-abstract/items/AbstractToolbarProps.js.map +1 -1
- package/lib/esm/appui-abstract/items/BadgeType.js.map +1 -1
- package/lib/esm/appui-abstract/items/ConditionalBooleanValue.js.map +1 -1
- package/lib/esm/appui-abstract/items/ConditionalStringValue.js.map +1 -1
- package/lib/esm/appui-abstract/items/RelativePosition.js.map +1 -1
- package/lib/esm/appui-abstract/notification/MessagePresenter.js.map +1 -1
- package/lib/esm/appui-abstract/notification/MessageSeverity.js.map +1 -1
- package/lib/esm/appui-abstract/properties/Description.js.map +1 -1
- package/lib/esm/appui-abstract/properties/EditorParams.js.map +1 -1
- package/lib/esm/appui-abstract/properties/PrimitiveTypes.js.map +1 -1
- package/lib/esm/appui-abstract/properties/Record.js.map +1 -1
- package/lib/esm/appui-abstract/properties/StandardEditorNames.js.map +1 -1
- package/lib/esm/appui-abstract/properties/StandardTypeNames.js.map +1 -1
- package/lib/esm/appui-abstract/properties/Value.js.map +1 -1
- package/lib/esm/appui-abstract/quantity/BaseQuantityDescription.js.map +1 -1
- package/lib/esm/appui-abstract/toolbars/ToolbarItem.d.ts +3 -27
- package/lib/esm/appui-abstract/toolbars/ToolbarItem.d.ts.map +1 -1
- package/lib/esm/appui-abstract/toolbars/ToolbarItem.js +0 -22
- package/lib/esm/appui-abstract/toolbars/ToolbarItem.js.map +1 -1
- package/lib/esm/appui-abstract/utils/IconSpecUtilities.d.ts +0 -10
- package/lib/esm/appui-abstract/utils/IconSpecUtilities.d.ts.map +1 -1
- package/lib/esm/appui-abstract/utils/IconSpecUtilities.js +0 -17
- package/lib/esm/appui-abstract/utils/IconSpecUtilities.js.map +1 -1
- package/lib/esm/appui-abstract/utils/PointProps.js.map +1 -1
- package/lib/esm/appui-abstract/utils/UiError.js.map +1 -1
- package/lib/esm/appui-abstract/utils/UiEvent.js.map +1 -1
- package/lib/esm/appui-abstract/utils/UiEventDispatcher.js.map +1 -1
- package/lib/esm/appui-abstract/utils/callbacks.js.map +1 -1
- package/lib/esm/appui-abstract/utils/filter/filters.js.map +1 -1
- package/lib/esm/appui-abstract/utils/misc.js.map +1 -1
- package/lib/esm/appui-abstract.d.ts +1 -28
- package/lib/esm/appui-abstract.d.ts.map +1 -1
- package/lib/esm/appui-abstract.js +1 -28
- package/lib/esm/appui-abstract.js.map +1 -1
- package/package.json +5 -5
- package/lib/cjs/appui-abstract/BaseUiItemsProvider.d.ts +0 -31
- package/lib/cjs/appui-abstract/BaseUiItemsProvider.d.ts.map +0 -1
- package/lib/cjs/appui-abstract/BaseUiItemsProvider.js +0 -80
- package/lib/cjs/appui-abstract/BaseUiItemsProvider.js.map +0 -1
- package/lib/cjs/appui-abstract/UiItemsManager.d.ts +0 -111
- package/lib/cjs/appui-abstract/UiItemsManager.d.ts.map +0 -1
- package/lib/cjs/appui-abstract/UiItemsManager.js +0 -194
- package/lib/cjs/appui-abstract/UiItemsManager.js.map +0 -1
- package/lib/cjs/appui-abstract/UiItemsProvider.d.ts +0 -30
- package/lib/cjs/appui-abstract/UiItemsProvider.d.ts.map +0 -1
- package/lib/cjs/appui-abstract/UiItemsProvider.js +0 -10
- package/lib/cjs/appui-abstract/UiItemsProvider.js.map +0 -1
- package/lib/cjs/appui-abstract/backstage/BackstageItem.d.ts +0 -92
- package/lib/cjs/appui-abstract/backstage/BackstageItem.d.ts.map +0 -1
- package/lib/cjs/appui-abstract/backstage/BackstageItem.js +0 -69
- package/lib/cjs/appui-abstract/backstage/BackstageItem.js.map +0 -1
- package/lib/cjs/appui-abstract/backstage/BackstageItemsManager.d.ts +0 -43
- package/lib/cjs/appui-abstract/backstage/BackstageItemsManager.d.ts.map +0 -1
- package/lib/cjs/appui-abstract/backstage/BackstageItemsManager.js +0 -136
- package/lib/cjs/appui-abstract/backstage/BackstageItemsManager.js.map +0 -1
- package/lib/cjs/appui-abstract/items/ProvidedItem.d.ts +0 -12
- package/lib/cjs/appui-abstract/items/ProvidedItem.d.ts.map +0 -1
- package/lib/cjs/appui-abstract/items/ProvidedItem.js +0 -10
- package/lib/cjs/appui-abstract/items/ProvidedItem.js.map +0 -1
- package/lib/cjs/appui-abstract/items/StageUsage.d.ts +0 -17
- package/lib/cjs/appui-abstract/items/StageUsage.d.ts.map +0 -1
- package/lib/cjs/appui-abstract/items/StageUsage.js +0 -25
- package/lib/cjs/appui-abstract/items/StageUsage.js.map +0 -1
- package/lib/cjs/appui-abstract/statusbar/StatusBarItem.d.ts +0 -129
- package/lib/cjs/appui-abstract/statusbar/StatusBarItem.d.ts.map +0 -1
- package/lib/cjs/appui-abstract/statusbar/StatusBarItem.js +0 -88
- package/lib/cjs/appui-abstract/statusbar/StatusBarItem.js.map +0 -1
- package/lib/cjs/appui-abstract/statusbar/StatusBarItemsManager.d.ts +0 -40
- package/lib/cjs/appui-abstract/statusbar/StatusBarItemsManager.d.ts.map +0 -1
- package/lib/cjs/appui-abstract/statusbar/StatusBarItemsManager.js +0 -136
- package/lib/cjs/appui-abstract/statusbar/StatusBarItemsManager.js.map +0 -1
- package/lib/cjs/appui-abstract/toolbars/ToolbarItemsManager.d.ts +0 -46
- package/lib/cjs/appui-abstract/toolbars/ToolbarItemsManager.d.ts.map +0 -1
- package/lib/cjs/appui-abstract/toolbars/ToolbarItemsManager.js +0 -236
- package/lib/cjs/appui-abstract/toolbars/ToolbarItemsManager.js.map +0 -1
- package/lib/cjs/appui-abstract/widget/AbstractWidgetProps.d.ts +0 -87
- package/lib/cjs/appui-abstract/widget/AbstractWidgetProps.d.ts.map +0 -1
- package/lib/cjs/appui-abstract/widget/AbstractWidgetProps.js +0 -10
- package/lib/cjs/appui-abstract/widget/AbstractWidgetProps.js.map +0 -1
- package/lib/cjs/appui-abstract/widget/StagePanel.d.ts +0 -37
- package/lib/cjs/appui-abstract/widget/StagePanel.d.ts.map +0 -1
- package/lib/cjs/appui-abstract/widget/StagePanel.js +0 -47
- package/lib/cjs/appui-abstract/widget/StagePanel.js.map +0 -1
- package/lib/cjs/appui-abstract/widget/WidgetState.d.ts +0 -20
- package/lib/cjs/appui-abstract/widget/WidgetState.d.ts.map +0 -1
- package/lib/cjs/appui-abstract/widget/WidgetState.js +0 -28
- package/lib/cjs/appui-abstract/widget/WidgetState.js.map +0 -1
- package/lib/esm/appui-abstract/BaseUiItemsProvider.d.ts +0 -31
- package/lib/esm/appui-abstract/BaseUiItemsProvider.d.ts.map +0 -1
- package/lib/esm/appui-abstract/BaseUiItemsProvider.js +0 -76
- package/lib/esm/appui-abstract/BaseUiItemsProvider.js.map +0 -1
- package/lib/esm/appui-abstract/UiItemsManager.d.ts +0 -111
- package/lib/esm/appui-abstract/UiItemsManager.d.ts.map +0 -1
- package/lib/esm/appui-abstract/UiItemsManager.js +0 -190
- package/lib/esm/appui-abstract/UiItemsManager.js.map +0 -1
- package/lib/esm/appui-abstract/UiItemsProvider.d.ts +0 -30
- package/lib/esm/appui-abstract/UiItemsProvider.d.ts.map +0 -1
- package/lib/esm/appui-abstract/UiItemsProvider.js +0 -9
- package/lib/esm/appui-abstract/UiItemsProvider.js.map +0 -1
- package/lib/esm/appui-abstract/backstage/BackstageItem.d.ts +0 -92
- package/lib/esm/appui-abstract/backstage/BackstageItem.d.ts.map +0 -1
- package/lib/esm/appui-abstract/backstage/BackstageItem.js +0 -63
- package/lib/esm/appui-abstract/backstage/BackstageItem.js.map +0 -1
- package/lib/esm/appui-abstract/backstage/BackstageItemsManager.d.ts +0 -43
- package/lib/esm/appui-abstract/backstage/BackstageItemsManager.d.ts.map +0 -1
- package/lib/esm/appui-abstract/backstage/BackstageItemsManager.js +0 -132
- package/lib/esm/appui-abstract/backstage/BackstageItemsManager.js.map +0 -1
- package/lib/esm/appui-abstract/items/ProvidedItem.d.ts +0 -12
- package/lib/esm/appui-abstract/items/ProvidedItem.d.ts.map +0 -1
- package/lib/esm/appui-abstract/items/ProvidedItem.js +0 -9
- package/lib/esm/appui-abstract/items/ProvidedItem.js.map +0 -1
- package/lib/esm/appui-abstract/items/StageUsage.d.ts +0 -17
- package/lib/esm/appui-abstract/items/StageUsage.d.ts.map +0 -1
- package/lib/esm/appui-abstract/items/StageUsage.js +0 -22
- package/lib/esm/appui-abstract/items/StageUsage.js.map +0 -1
- package/lib/esm/appui-abstract/statusbar/StatusBarItem.d.ts +0 -129
- package/lib/esm/appui-abstract/statusbar/StatusBarItem.d.ts.map +0 -1
- package/lib/esm/appui-abstract/statusbar/StatusBarItem.js +0 -81
- package/lib/esm/appui-abstract/statusbar/StatusBarItem.js.map +0 -1
- package/lib/esm/appui-abstract/statusbar/StatusBarItemsManager.d.ts +0 -40
- package/lib/esm/appui-abstract/statusbar/StatusBarItemsManager.d.ts.map +0 -1
- package/lib/esm/appui-abstract/statusbar/StatusBarItemsManager.js +0 -132
- package/lib/esm/appui-abstract/statusbar/StatusBarItemsManager.js.map +0 -1
- package/lib/esm/appui-abstract/toolbars/ToolbarItemsManager.d.ts +0 -46
- package/lib/esm/appui-abstract/toolbars/ToolbarItemsManager.d.ts.map +0 -1
- package/lib/esm/appui-abstract/toolbars/ToolbarItemsManager.js +0 -232
- package/lib/esm/appui-abstract/toolbars/ToolbarItemsManager.js.map +0 -1
- package/lib/esm/appui-abstract/widget/AbstractWidgetProps.d.ts +0 -87
- package/lib/esm/appui-abstract/widget/AbstractWidgetProps.d.ts.map +0 -1
- package/lib/esm/appui-abstract/widget/AbstractWidgetProps.js +0 -9
- package/lib/esm/appui-abstract/widget/AbstractWidgetProps.js.map +0 -1
- package/lib/esm/appui-abstract/widget/StagePanel.d.ts +0 -37
- package/lib/esm/appui-abstract/widget/StagePanel.d.ts.map +0 -1
- package/lib/esm/appui-abstract/widget/StagePanel.js +0 -44
- package/lib/esm/appui-abstract/widget/StagePanel.js.map +0 -1
- package/lib/esm/appui-abstract/widget/WidgetState.d.ts +0 -20
- package/lib/esm/appui-abstract/widget/WidgetState.d.ts.map +0 -1
- package/lib/esm/appui-abstract/widget/WidgetState.js +0 -25
- package/lib/esm/appui-abstract/widget/WidgetState.js.map +0 -1
@@ -1,81 +0,0 @@
|
|
1
|
-
/*---------------------------------------------------------------------------------------------
|
2
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
3
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
4
|
-
*--------------------------------------------------------------------------------------------*/
|
5
|
-
/** @packageDocumentation
|
6
|
-
* @module StatusBar
|
7
|
-
*/
|
8
|
-
/** Status bar Groups/Sections from Left to Right
|
9
|
-
* @deprecated in 3.6. Use [StatusBarSection]($appui-react) instead.
|
10
|
-
* @public
|
11
|
-
*/
|
12
|
-
export var StatusBarSection;
|
13
|
-
(function (StatusBarSection) {
|
14
|
-
/** area for tool assistance and messages */
|
15
|
-
StatusBarSection[StatusBarSection["Message"] = 0] = "Message";
|
16
|
-
/** area for tool assistance and messages */
|
17
|
-
StatusBarSection[StatusBarSection["Left"] = 0] = "Left";
|
18
|
-
/** items specific to stage/task */
|
19
|
-
StatusBarSection[StatusBarSection["Stage"] = 1] = "Stage";
|
20
|
-
/** items specific to stage/task */
|
21
|
-
StatusBarSection[StatusBarSection["Center"] = 1] = "Center";
|
22
|
-
/** Select scope and selection info */
|
23
|
-
StatusBarSection[StatusBarSection["Selection"] = 2] = "Selection";
|
24
|
-
/** Select scope and selection info */
|
25
|
-
StatusBarSection[StatusBarSection["Right"] = 2] = "Right";
|
26
|
-
/** items that only show based on context */
|
27
|
-
StatusBarSection[StatusBarSection["Context"] = 3] = "Context";
|
28
|
-
})(StatusBarSection || (StatusBarSection = {}));
|
29
|
-
/** Defines which side of Icon where label is placed
|
30
|
-
* @deprecated in 3.6. Use [StatusBarLabelSide]($appui-react) instead.
|
31
|
-
* @public
|
32
|
-
*/
|
33
|
-
export var StatusBarLabelSide;
|
34
|
-
(function (StatusBarLabelSide) {
|
35
|
-
/** Label is placed left side of icon. This is the default if not specified */
|
36
|
-
StatusBarLabelSide[StatusBarLabelSide["Left"] = 0] = "Left";
|
37
|
-
/** Label is placed on right side of icon. */
|
38
|
-
StatusBarLabelSide[StatusBarLabelSide["Right"] = 1] = "Right";
|
39
|
-
})(StatusBarLabelSide || (StatusBarLabelSide = {}));
|
40
|
-
/** AbstractStatusBarActionItem type guard.
|
41
|
-
* @deprecated in 3.6. Use [isStatusBarActionItem]($appui-react) instead.
|
42
|
-
* @public
|
43
|
-
*/
|
44
|
-
export const isAbstractStatusBarActionItem = (item) => {
|
45
|
-
return item.execute !== undefined; // eslint-disable-line @typescript-eslint/no-deprecated
|
46
|
-
};
|
47
|
-
/** AbstractStatusBarLabelItem type guard.
|
48
|
-
* @deprecated in 3.6. Use [isStatusBarLabelItem]($appui-react) instead.
|
49
|
-
* @public
|
50
|
-
*/
|
51
|
-
export const isAbstractStatusBarLabelItem = (item) => {
|
52
|
-
return item.label !== undefined && item.execute === undefined; // eslint-disable-line @typescript-eslint/no-deprecated
|
53
|
-
};
|
54
|
-
/** AbstractStatusBarCustomItem type guard.
|
55
|
-
* @deprecated in 3.6. Use [isStatusBarCustomItem]($appui-react) instead.
|
56
|
-
* @public
|
57
|
-
*/
|
58
|
-
export const isAbstractStatusBarCustomItem = (item) => {
|
59
|
-
return !!item.isCustom; // eslint-disable-line @typescript-eslint/no-deprecated
|
60
|
-
};
|
61
|
-
/** Helper class to create Abstract StatusBar Item definitions.
|
62
|
-
* @deprecated in 3.6. Use [StatusBarItemUtilities]($appui-react) instead.
|
63
|
-
* @public
|
64
|
-
*/
|
65
|
-
export class AbstractStatusBarItemUtilities {
|
66
|
-
/** Creates a StatusBar item to perform an action */
|
67
|
-
static { this.createActionItem = (id, section, itemPriority, icon, tooltip, execute, overrides) => ({
|
68
|
-
id, section, itemPriority,
|
69
|
-
icon, tooltip,
|
70
|
-
execute,
|
71
|
-
...overrides,
|
72
|
-
}); }
|
73
|
-
/** Creates a StatusBar item to display a label */
|
74
|
-
static { this.createLabelItem = (id, section, itemPriority, icon, label, labelSide = StatusBarLabelSide.Right, overrides) => ({
|
75
|
-
id, section, itemPriority,
|
76
|
-
icon, label,
|
77
|
-
labelSide,
|
78
|
-
...overrides,
|
79
|
-
}); }
|
80
|
-
}
|
81
|
-
//# sourceMappingURL=StatusBarItem.js.map
|
@@ -1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AA8B;IACzC,oDAAoD;aACtC,qBAAgB,GAAG,CAAC,EAAU,EAAE,OAAyB,EAAE,YAAoB,EAAE,IAAqC,EAAE,OAAwC,EAAE,OAAmB,EAAE,SAAgD,EAA+B,EAAE,CAAC,CAAC;QACtR,EAAE,EAAE,OAAO,EAAE,YAAY;QACzB,IAAI,EAAE,OAAO;QACb,OAAO;QACP,GAAG,SAAS;KACb,CAAC,CAAC;IAEH,kDAAkD;aACpC,oBAAe,GAAG,CAAC,EAAU,EAAE,OAAyB,EAAE,YAAoB,EAAE,IAAqC,EAAE,KAAsC,EAAE,SAAS,GAAG,kBAAkB,CAAC,KAAK,EAAE,SAA+C,EAA8B,EAAE,CAAC,CAAC;QAClS,EAAE,EAAE,OAAO,EAAE,YAAY;QACzB,IAAI,EAAE,KAAK;QACX,SAAS;QACT,GAAG,SAAS;KACb,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module StatusBar\r\n */\r\n\r\nimport { BadgeType } from \"../items/BadgeType\";\r\nimport { ConditionalBooleanValue } from \"../items/ConditionalBooleanValue\";\r\nimport { ConditionalStringValue } from \"../items/ConditionalStringValue\";\r\nimport { ProvidedItem } from \"../items/ProvidedItem\";\r\n\r\n/** Status bar Groups/Sections from Left to Right\r\n * @deprecated in 3.6. Use [StatusBarSection]($appui-react) instead.\r\n * @public\r\n */\r\nexport enum StatusBarSection {\r\n /** area for tool assistance and messages */\r\n Message = 0,\r\n /** area for tool assistance and messages */\r\n Left = 0, // eslint-disable-line @typescript-eslint/no-duplicate-enum-values\r\n /** items specific to stage/task */\r\n Stage = 1,\r\n /** items specific to stage/task */\r\n Center = 1, // eslint-disable-line @typescript-eslint/no-duplicate-enum-values\r\n /** Select scope and selection info */\r\n Selection = 2,\r\n /** Select scope and selection info */\r\n Right = 2, // eslint-disable-line @typescript-eslint/no-duplicate-enum-values\r\n /** items that only show based on context */\r\n Context = 3,\r\n}\r\n\r\n/** Defines which side of Icon where label is placed\r\n * @deprecated in 3.6. Use [StatusBarLabelSide]($appui-react) instead.\r\n * @public\r\n */\r\nexport enum StatusBarLabelSide {\r\n /** Label is placed left side of icon. This is the default if not specified */\r\n Left,\r\n /** Label is placed on right side of icon. */\r\n Right,\r\n}\r\n\r\n/** Type for StatusBar Item Id\r\n * @deprecated in 3.6. Please use `CommonStatusBarItem[\"id\"]` from @itwin/appui-react.\r\n * @public\r\n */\r\nexport type StatusBarItemId = CommonStatusBarItem[\"id\"];\r\n\r\n/** Describes the data needed to insert a button into the status bar.\r\n * @deprecated in 3.6. Use [CommonStatusBarItem]($appui-react) instead.\r\n * @public\r\n */\r\nexport interface AbstractStatusBarItem extends ProvidedItem { // eslint-disable-line @typescript-eslint/no-deprecated\r\n /** can be used by application to store miscellaneous data. */\r\n applicationData?: any;\r\n /** Describes badge. Renders no badge if not specified. */\r\n readonly badgeType?: BadgeType;\r\n /** Required unique id of the item. To ensure uniqueness it is suggested that a namespace prefix of the extension name be used. */\r\n readonly id: string;\r\n /** optional data to used by item implementor. */\r\n readonly internalData?: Map<string, any>;\r\n /** Describes if the item is visible or hidden. The default is for the item to be visible. */\r\n readonly isHidden?: boolean | ConditionalBooleanValue;\r\n /** Describes if the item is enabled or disabled. The default is for the item to be enabled. */\r\n readonly isDisabled?: boolean | ConditionalBooleanValue;\r\n /** Priority within a section (recommend using values 1 through 100). */\r\n readonly itemPriority: number;\r\n /** status bar section */\r\n readonly section: StatusBarSection; // eslint-disable-line @typescript-eslint/no-deprecated\r\n}\r\n\r\n/** Describes the data needed to insert an action item into the status bar.\r\n * @deprecated in 3.6. Use [StatusBarActionItem]($appui-react) instead.\r\n * @public\r\n */\r\nexport interface AbstractStatusBarActionItem extends AbstractStatusBarItem { // eslint-disable-line @typescript-eslint/no-deprecated\r\n /** method to execute when icon is pressed */\r\n readonly execute: () => void;\r\n /** Name of icon WebFont entry or if specifying an imported SVG symbol use \"webSvg:\" prefix to imported symbol Id. */\r\n readonly icon?: string | ConditionalStringValue;\r\n /** Label. */\r\n readonly label?: string | ConditionalStringValue;\r\n /** tooltip. */\r\n readonly tooltip?: string | ConditionalStringValue;\r\n}\r\n\r\n/** Describes the data needed to insert a label item with an optional icon into the status bar.\r\n * @deprecated in 3.6. Use [StatusBarLabelItem]($appui-react) instead.\r\n * @public\r\n */\r\nexport interface AbstractStatusBarLabelItem extends AbstractStatusBarItem { // eslint-disable-line @typescript-eslint/no-deprecated\r\n /** Name of icon WebFont entry or if specifying an imported SVG symbol use \"webSvg:\" prefix to imported symbol Id. */\r\n readonly icon?: string | ConditionalStringValue;\r\n /** Label. */\r\n readonly label: string | ConditionalStringValue;\r\n /** Defines which side of icon to display label if icon is defined. */\r\n readonly labelSide?: StatusBarLabelSide; // eslint-disable-line @typescript-eslint/no-deprecated\r\n}\r\n\r\n/** Describes the data needed to insert a custom item into the status bar. This is used to allow extension\r\n * implementer to create a framework specific component.\r\n * @deprecated in 3.6. Use [StatusBarCustomItem]($appui-react) instead.\r\n * @public\r\n */\r\nexport interface AbstractStatusBarCustomItem extends AbstractStatusBarItem { // eslint-disable-line @typescript-eslint/no-deprecated\r\n readonly isCustom: true;\r\n}\r\n\r\n/** Describes the data needed to insert a button into the status bar.\r\n * @deprecated in 3.6. Use [StatusBarItem]($appui-react) instead.\r\n * @public\r\n */\r\nexport type CommonStatusBarItem = AbstractStatusBarActionItem | AbstractStatusBarLabelItem | AbstractStatusBarCustomItem; // eslint-disable-line @typescript-eslint/no-deprecated\r\n\r\n/** AbstractStatusBarActionItem type guard.\r\n * @deprecated in 3.6. Use [isStatusBarActionItem]($appui-react) instead.\r\n * @public\r\n */\r\nexport const isAbstractStatusBarActionItem = (item: CommonStatusBarItem): item is AbstractStatusBarActionItem => { // eslint-disable-line @typescript-eslint/no-deprecated\r\n return (item as AbstractStatusBarActionItem).execute !== undefined; // eslint-disable-line @typescript-eslint/no-deprecated\r\n};\r\n\r\n/** AbstractStatusBarLabelItem type guard.\r\n * @deprecated in 3.6. Use [isStatusBarLabelItem]($appui-react) instead.\r\n * @public\r\n */\r\nexport const isAbstractStatusBarLabelItem = (item: CommonStatusBarItem): item is AbstractStatusBarLabelItem => { // eslint-disable-line @typescript-eslint/no-deprecated\r\n return (item as AbstractStatusBarLabelItem).label !== undefined && (item as AbstractStatusBarActionItem).execute === undefined; // eslint-disable-line @typescript-eslint/no-deprecated\r\n};\r\n\r\n/** AbstractStatusBarCustomItem type guard.\r\n * @deprecated in 3.6. Use [isStatusBarCustomItem]($appui-react) instead.\r\n * @public\r\n */\r\nexport const isAbstractStatusBarCustomItem = (item: CommonStatusBarItem): item is AbstractStatusBarCustomItem => { // eslint-disable-line @typescript-eslint/no-deprecated\r\n return !!(item as AbstractStatusBarCustomItem).isCustom; // eslint-disable-line @typescript-eslint/no-deprecated\r\n};\r\n\r\n/** Helper class to create Abstract StatusBar Item definitions.\r\n * @deprecated in 3.6. Use [StatusBarItemUtilities]($appui-react) instead.\r\n * @public\r\n */\r\nexport class AbstractStatusBarItemUtilities {\r\n /** Creates a StatusBar item to perform an action */\r\n public static createActionItem = (id: string, section: StatusBarSection, itemPriority: number, icon: string | ConditionalStringValue, tooltip: string | ConditionalStringValue, execute: () => void, overrides?: Partial<AbstractStatusBarCustomItem>): AbstractStatusBarActionItem => ({ // eslint-disable-line @typescript-eslint/no-deprecated\r\n id, section, itemPriority,\r\n icon, tooltip,\r\n execute,\r\n ...overrides,\r\n });\r\n\r\n /** Creates a StatusBar item to display a label */\r\n public static createLabelItem = (id: string, section: StatusBarSection, itemPriority: number, icon: string | ConditionalStringValue, label: string | ConditionalStringValue, labelSide = StatusBarLabelSide.Right, overrides?: Partial<AbstractStatusBarLabelItem>): AbstractStatusBarLabelItem => ({ // eslint-disable-line @typescript-eslint/no-deprecated\r\n id, section, itemPriority,\r\n icon, label,\r\n labelSide,\r\n ...overrides,\r\n });\r\n}\r\n"]}
|
@@ -1,40 +0,0 @@
|
|
1
|
-
/** @packageDocumentation
|
2
|
-
* @module StatusBar
|
3
|
-
*/
|
4
|
-
import { BeEvent } from "@itwin/core-bentley";
|
5
|
-
import { CommonStatusBarItem, StatusBarItemId } from "./StatusBarItem";
|
6
|
-
/** Arguments of [[StatusBarItemsManager.onChanged]] event.
|
7
|
-
* @internal
|
8
|
-
*/
|
9
|
-
export interface StatusBarItemsChangedArgs {
|
10
|
-
readonly items: ReadonlyArray<CommonStatusBarItem>;
|
11
|
-
}
|
12
|
-
/**
|
13
|
-
* Controls status bar items.
|
14
|
-
* @internal
|
15
|
-
*/
|
16
|
-
export declare class StatusBarItemsManager {
|
17
|
-
private _items;
|
18
|
-
constructor(items?: ReadonlyArray<CommonStatusBarItem>);
|
19
|
-
/** Event raised when StatusBar items are changed.
|
20
|
-
* @internal
|
21
|
-
*/
|
22
|
-
readonly onItemsChanged: BeEvent<(args: StatusBarItemsChangedArgs) => void>;
|
23
|
-
private loadItemsInternal;
|
24
|
-
/** load items but do not fire onItemsChanged
|
25
|
-
* @internal
|
26
|
-
*/
|
27
|
-
loadItems(items: ReadonlyArray<CommonStatusBarItem>): void;
|
28
|
-
/** Get an array of the StatusBar items */
|
29
|
-
get items(): ReadonlyArray<CommonStatusBarItem>;
|
30
|
-
set items(items: ReadonlyArray<CommonStatusBarItem>);
|
31
|
-
add(itemOrItems: CommonStatusBarItem | ReadonlyArray<CommonStatusBarItem>): void;
|
32
|
-
/** Remove StatusBar items based on id */
|
33
|
-
remove(itemIdOrItemIds: StatusBarItemId | ReadonlyArray<StatusBarItemId>): void;
|
34
|
-
/** @internal */
|
35
|
-
removeAll(): void;
|
36
|
-
static getSyncIdsOfInterest(items: readonly CommonStatusBarItem[]): string[];
|
37
|
-
private internalRefreshAffectedItems;
|
38
|
-
refreshAffectedItems(eventIds: Set<string>): void;
|
39
|
-
}
|
40
|
-
//# sourceMappingURL=StatusBarItemsManager.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"StatusBarItemsManager.d.ts","sourceRoot":"","sources":["../../../../src/appui-abstract/statusbar/StatusBarItemsManager.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAG9C,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAUvE;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC,mBAAmB,CAAC,CAAC;CACpD;AAED;;;GAGG;AACH,qBAAa,qBAAqB;IAChC,OAAO,CAAC,MAAM,CAA0C;gBAE5C,KAAK,CAAC,EAAE,aAAa,CAAC,mBAAmB,CAAC;IAKtD;;OAEG;IACH,SAAgB,cAAc,iBAAsB,yBAAyB,KAAK,IAAI,EAAI;IAE1F,OAAO,CAAC,iBAAiB;IAiBzB;;OAEG;IACI,SAAS,CAAC,KAAK,EAAE,aAAa,CAAC,mBAAmB,CAAC;IAI1D,2CAA2C;IAC3C,IAAW,KAAK,IAAI,aAAa,CAAC,mBAAmB,CAAC,CAErD;IAED,IAAW,KAAK,CAAC,KAAK,EAAE,aAAa,CAAC,mBAAmB,CAAC,EAIzD;IAEM,GAAG,CAAC,WAAW,EAAE,mBAAmB,GAAG,aAAa,CAAC,mBAAmB,CAAC;IAiBhF,yCAAyC;IAClC,MAAM,CAAC,eAAe,EAAE,eAAe,GAAG,aAAa,CAAC,eAAe,CAC7E;IAOD,gBAAgB;IACT,SAAS;WAIF,oBAAoB,CAAC,KAAK,EAAE,SAAS,mBAAmB,EAAE,GAAG,MAAM,EAAE;IAcnF,OAAO,CAAC,4BAA4B;IA6B7B,oBAAoB,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC;CAWlD"}
|
@@ -1,132 +0,0 @@
|
|
1
|
-
/*---------------------------------------------------------------------------------------------
|
2
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
3
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
4
|
-
*--------------------------------------------------------------------------------------------*/
|
5
|
-
/** @packageDocumentation
|
6
|
-
* @module StatusBar
|
7
|
-
*/
|
8
|
-
import { BeEvent } from "@itwin/core-bentley";
|
9
|
-
import { ConditionalBooleanValue } from "../items/ConditionalBooleanValue";
|
10
|
-
import { ConditionalStringValue } from "../items/ConditionalStringValue";
|
11
|
-
const isInstance = (args) => {
|
12
|
-
return !Array.isArray(args);
|
13
|
-
};
|
14
|
-
/**
|
15
|
-
* Controls status bar items.
|
16
|
-
* @internal
|
17
|
-
*/
|
18
|
-
export class StatusBarItemsManager {
|
19
|
-
constructor(items) {
|
20
|
-
this._items = [];
|
21
|
-
/** Event raised when StatusBar items are changed.
|
22
|
-
* @internal
|
23
|
-
*/
|
24
|
-
this.onItemsChanged = new BeEvent();
|
25
|
-
if (items)
|
26
|
-
this.loadItemsInternal(items, true, false);
|
27
|
-
}
|
28
|
-
loadItemsInternal(items, processConditions, sendItemChanged) {
|
29
|
-
if (processConditions && items) {
|
30
|
-
const eventIds = StatusBarItemsManager.getSyncIdsOfInterest(items);
|
31
|
-
if (0 !== eventIds.length) {
|
32
|
-
const { itemsUpdated, updatedItems } = this.internalRefreshAffectedItems(items, new Set(eventIds));
|
33
|
-
// istanbul ignore else
|
34
|
-
if (itemsUpdated)
|
35
|
-
items = updatedItems;
|
36
|
-
}
|
37
|
-
}
|
38
|
-
this._items = items;
|
39
|
-
if (sendItemChanged)
|
40
|
-
this.onItemsChanged.raiseEvent({ items });
|
41
|
-
}
|
42
|
-
/** load items but do not fire onItemsChanged
|
43
|
-
* @internal
|
44
|
-
*/
|
45
|
-
loadItems(items) {
|
46
|
-
this.loadItemsInternal(items, true, false);
|
47
|
-
}
|
48
|
-
/** Get an array of the StatusBar items */
|
49
|
-
get items() {
|
50
|
-
return this._items;
|
51
|
-
}
|
52
|
-
set items(items) {
|
53
|
-
// istanbul ignore else
|
54
|
-
if (items !== this._items)
|
55
|
-
this.loadItemsInternal(items, true, true);
|
56
|
-
}
|
57
|
-
add(itemOrItems) {
|
58
|
-
let itemsToAdd;
|
59
|
-
if (isInstance(itemOrItems))
|
60
|
-
itemsToAdd = [itemOrItems];
|
61
|
-
else {
|
62
|
-
itemsToAdd = itemOrItems.filter((itemToAdd, index) => itemOrItems.findIndex((item) => item.id === itemToAdd.id) === index);
|
63
|
-
}
|
64
|
-
itemsToAdd = itemsToAdd.filter((itemToAdd) => this._items.find((item) => item.id === itemToAdd.id) === undefined);
|
65
|
-
if (itemsToAdd.length === 0)
|
66
|
-
return;
|
67
|
-
const items = [
|
68
|
-
...this._items,
|
69
|
-
...itemsToAdd,
|
70
|
-
];
|
71
|
-
this.items = items;
|
72
|
-
}
|
73
|
-
/** Remove StatusBar items based on id */
|
74
|
-
remove(itemIdOrItemIds) {
|
75
|
-
const items = this._items.filter((item) => {
|
76
|
-
return isInstance(itemIdOrItemIds) ? item.id !== itemIdOrItemIds : !itemIdOrItemIds.find((itemId) => itemId === item.id);
|
77
|
-
});
|
78
|
-
this.items = items;
|
79
|
-
}
|
80
|
-
/** @internal */
|
81
|
-
removeAll() {
|
82
|
-
this._items = [];
|
83
|
-
}
|
84
|
-
static getSyncIdsOfInterest(items) {
|
85
|
-
const eventIds = new Set();
|
86
|
-
items.forEach((item) => {
|
87
|
-
for (const [, entry] of Object.entries(item)) {
|
88
|
-
if (entry instanceof ConditionalBooleanValue) {
|
89
|
-
entry.syncEventIds.forEach((eventId) => eventIds.add(eventId.toLowerCase()));
|
90
|
-
}
|
91
|
-
else /* istanbul ignore else */ if (entry instanceof ConditionalStringValue) {
|
92
|
-
entry.syncEventIds.forEach((eventId) => eventIds.add(eventId.toLowerCase()));
|
93
|
-
}
|
94
|
-
}
|
95
|
-
});
|
96
|
-
return [...eventIds.values()];
|
97
|
-
}
|
98
|
-
internalRefreshAffectedItems(items, eventIds) {
|
99
|
-
// istanbul ignore next
|
100
|
-
if (0 === eventIds.size)
|
101
|
-
return { itemsUpdated: false, updatedItems: [] };
|
102
|
-
let updateRequired = false;
|
103
|
-
const newItems = [];
|
104
|
-
for (const item of items) {
|
105
|
-
const updatedItem = { ...item };
|
106
|
-
for (const [, entry] of Object.entries(updatedItem)) {
|
107
|
-
if (entry instanceof ConditionalBooleanValue) {
|
108
|
-
// istanbul ignore else
|
109
|
-
if (ConditionalBooleanValue.refreshValue(entry, eventIds))
|
110
|
-
updateRequired = true;
|
111
|
-
}
|
112
|
-
else /* istanbul ignore else */ if (entry instanceof ConditionalStringValue) {
|
113
|
-
// istanbul ignore else
|
114
|
-
if (ConditionalStringValue.refreshValue(entry, eventIds))
|
115
|
-
updateRequired = true;
|
116
|
-
}
|
117
|
-
}
|
118
|
-
newItems.push(updatedItem);
|
119
|
-
}
|
120
|
-
return { itemsUpdated: updateRequired, updatedItems: newItems };
|
121
|
-
}
|
122
|
-
refreshAffectedItems(eventIds) {
|
123
|
-
// istanbul ignore next
|
124
|
-
if (0 === eventIds.size)
|
125
|
-
return;
|
126
|
-
const { itemsUpdated, updatedItems } = this.internalRefreshAffectedItems(this.items, eventIds);
|
127
|
-
// istanbul ignore else
|
128
|
-
if (itemsUpdated)
|
129
|
-
this.loadItemsInternal(updatedItems, false, true);
|
130
|
-
}
|
131
|
-
}
|
132
|
-
//# sourceMappingURL=StatusBarItemsManager.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"StatusBarItemsManager.js","sourceRoot":"","sources":["../../../../src/appui-abstract/statusbar/StatusBarItemsManager.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAOzE,MAAM,UAAU,GAAG,CAAI,IAAwB,EAAa,EAAE;IAC5D,OAAO,CA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MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;gBACpD,IAAI,KAAK,YAAY,uBAAuB,EAAE,CAAC;oBAC7C,uBAAuB;oBACvB,IAAI,uBAAuB,CAAC,YAAY,CAAC,KAAK,EAAE,QAAQ,CAAC;wBACvD,cAAc,GAAG,IAAI,CAAC;gBAC1B,CAAC;qBAAM,0BAA0B,CAAC,IAAI,KAAK,YAAY,sBAAsB,EAAE,CAAC;oBAC9E,uBAAuB;oBACvB,IAAI,sBAAsB,CAAC,YAAY,CAAC,KAAK,EAAE,QAAQ,CAAC;wBACtD,cAAc,GAAG,IAAI,CAAC;gBAC1B,CAAC;YACH,CAAC;YAED,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC7B,CAAC;QAED,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,QAAQ,EAAE,CAAC;IAClE,CAAC;IAEM,oBAAoB,CAAC,QAAqB;QAC/C,uBAAuB;QACvB,IAAI,CAAC,KAAK,QAAQ,CAAC,IAAI;YACrB,OAAO;QAET,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC,4BAA4B,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QAE/F,uBAAuB;QACvB,IAAI,YAAY;YACd,IAAI,CAAC,iBAAiB,CAAC,YAAY,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;IACtD,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module StatusBar\r\n */\r\n\r\nimport { BeEvent } from \"@itwin/core-bentley\";\r\nimport { ConditionalBooleanValue } from \"../items/ConditionalBooleanValue\";\r\nimport { ConditionalStringValue } from \"../items/ConditionalStringValue\";\r\nimport { CommonStatusBarItem, StatusBarItemId } from \"./StatusBarItem\";\r\n\r\n/* eslint-disable @typescript-eslint/no-deprecated */\r\n\r\ntype InstanceOrArray<T> = T | ReadonlyArray<T>;\r\n\r\nconst isInstance = <T>(args: InstanceOrArray<T>): args is T => {\r\n return !Array.isArray(args);\r\n};\r\n\r\n/** Arguments of [[StatusBarItemsManager.onChanged]] event.\r\n * @internal\r\n */\r\nexport interface StatusBarItemsChangedArgs {\r\n readonly items: ReadonlyArray<CommonStatusBarItem>;\r\n}\r\n\r\n/**\r\n * Controls status bar items.\r\n * @internal\r\n */\r\nexport class StatusBarItemsManager {\r\n private _items: ReadonlyArray<CommonStatusBarItem> = [];\r\n\r\n constructor(items?: ReadonlyArray<CommonStatusBarItem>) {\r\n if (items)\r\n this.loadItemsInternal(items, true, false);\r\n }\r\n\r\n /** Event raised when StatusBar items are changed.\r\n * @internal\r\n */\r\n public readonly onItemsChanged = new BeEvent<(args: StatusBarItemsChangedArgs) => void>();\r\n\r\n private loadItemsInternal(items: ReadonlyArray<CommonStatusBarItem>, processConditions: boolean, sendItemChanged: boolean) {\r\n if (processConditions && items) {\r\n const eventIds = StatusBarItemsManager.getSyncIdsOfInterest(items);\r\n if (0 !== eventIds.length) {\r\n const { itemsUpdated, updatedItems } = this.internalRefreshAffectedItems(items, new Set(eventIds));\r\n\r\n // istanbul ignore else\r\n if (itemsUpdated)\r\n items = updatedItems;\r\n }\r\n }\r\n\r\n this._items = items;\r\n if (sendItemChanged)\r\n this.onItemsChanged.raiseEvent({ items });\r\n }\r\n\r\n /** load items but do not fire onItemsChanged\r\n * @internal\r\n */\r\n public loadItems(items: ReadonlyArray<CommonStatusBarItem>) {\r\n this.loadItemsInternal(items, true, false);\r\n }\r\n\r\n /** Get an array of the StatusBar items */\r\n public get items(): ReadonlyArray<CommonStatusBarItem> {\r\n return this._items;\r\n }\r\n\r\n public set items(items: ReadonlyArray<CommonStatusBarItem>) {\r\n // istanbul ignore else\r\n if (items !== this._items)\r\n this.loadItemsInternal(items, true, true);\r\n }\r\n\r\n public add(itemOrItems: CommonStatusBarItem | ReadonlyArray<CommonStatusBarItem>) {\r\n let itemsToAdd;\r\n if (isInstance(itemOrItems))\r\n itemsToAdd = [itemOrItems];\r\n else {\r\n itemsToAdd = itemOrItems.filter((itemToAdd, index) => itemOrItems.findIndex((item) => item.id === itemToAdd.id) === index);\r\n }\r\n itemsToAdd = itemsToAdd.filter((itemToAdd) => this._items.find((item) => item.id === itemToAdd.id) === undefined);\r\n if (itemsToAdd.length === 0)\r\n return;\r\n const items = [\r\n ...this._items,\r\n ...itemsToAdd,\r\n ];\r\n this.items = items;\r\n }\r\n\r\n /** Remove StatusBar items based on id */\r\n public remove(itemIdOrItemIds: StatusBarItemId | ReadonlyArray<StatusBarItemId\r\n >) {\r\n const items = this._items.filter((item) => {\r\n return isInstance(itemIdOrItemIds) ? item.id !== itemIdOrItemIds : !itemIdOrItemIds.find((itemId) => itemId === item.id);\r\n });\r\n this.items = items;\r\n }\r\n\r\n /** @internal */\r\n public removeAll() {\r\n this._items = [];\r\n }\r\n\r\n public static getSyncIdsOfInterest(items: readonly CommonStatusBarItem[]): string[] {\r\n const eventIds = new Set<string>();\r\n items.forEach((item) => {\r\n for (const [, entry] of Object.entries(item)) {\r\n if (entry instanceof ConditionalBooleanValue) {\r\n entry.syncEventIds.forEach((eventId: string) => eventIds.add(eventId.toLowerCase()));\r\n } else /* istanbul ignore else */ if (entry instanceof ConditionalStringValue) {\r\n entry.syncEventIds.forEach((eventId: string) => eventIds.add(eventId.toLowerCase()));\r\n }\r\n }\r\n });\r\n return [...eventIds.values()];\r\n }\r\n\r\n private internalRefreshAffectedItems(items: readonly CommonStatusBarItem[], eventIds: Set<string>): { itemsUpdated: boolean, updatedItems: CommonStatusBarItem[] } {\r\n // istanbul ignore next\r\n if (0 === eventIds.size)\r\n return { itemsUpdated: false, updatedItems: [] };\r\n\r\n let updateRequired = false;\r\n\r\n const newItems: CommonStatusBarItem[] = [];\r\n for (const item of items) {\r\n const updatedItem = { ...item };\r\n\r\n for (const [, entry] of Object.entries(updatedItem)) {\r\n if (entry instanceof ConditionalBooleanValue) {\r\n // istanbul ignore else\r\n if (ConditionalBooleanValue.refreshValue(entry, eventIds))\r\n updateRequired = true;\r\n } else /* istanbul ignore else */ if (entry instanceof ConditionalStringValue) {\r\n // istanbul ignore else\r\n if (ConditionalStringValue.refreshValue(entry, eventIds))\r\n updateRequired = true;\r\n }\r\n }\r\n\r\n newItems.push(updatedItem);\r\n }\r\n\r\n return { itemsUpdated: updateRequired, updatedItems: newItems };\r\n }\r\n\r\n public refreshAffectedItems(eventIds: Set<string>) {\r\n // istanbul ignore next\r\n if (0 === eventIds.size)\r\n return;\r\n\r\n const { itemsUpdated, updatedItems } = this.internalRefreshAffectedItems(this.items, eventIds);\r\n\r\n // istanbul ignore else\r\n if (itemsUpdated)\r\n this.loadItemsInternal(updatedItems, false, true);\r\n }\r\n}\r\n"]}
|
@@ -1,46 +0,0 @@
|
|
1
|
-
/** @packageDocumentation
|
2
|
-
* @module Toolbar
|
3
|
-
*/
|
4
|
-
import { BeEvent } from "@itwin/core-bentley";
|
5
|
-
import { CommonToolbarItem, ToolbarItemId } from "./ToolbarItem";
|
6
|
-
/** Arguments of [[ToolbarItemsManager.onChanged]] event.
|
7
|
-
* @internal
|
8
|
-
*/
|
9
|
-
export interface ToolbarItemsChangedArgs {
|
10
|
-
readonly items: ReadonlyArray<CommonToolbarItem>;
|
11
|
-
}
|
12
|
-
/**
|
13
|
-
* Controls status bar items.
|
14
|
-
* @internal
|
15
|
-
*/
|
16
|
-
export declare class ToolbarItemsManager {
|
17
|
-
protected _items: ReadonlyArray<CommonToolbarItem>;
|
18
|
-
constructor(items?: ReadonlyArray<CommonToolbarItem>);
|
19
|
-
/** Event raised when Toolbar items are changed.
|
20
|
-
* @internal
|
21
|
-
*/
|
22
|
-
readonly onItemsChanged: BeEvent<(args: ToolbarItemsChangedArgs) => void>;
|
23
|
-
private loadItemsInternal;
|
24
|
-
/** load items but do not fire onItemsChanged
|
25
|
-
* @internal
|
26
|
-
*/
|
27
|
-
loadItems(items: ReadonlyArray<CommonToolbarItem>): void;
|
28
|
-
/** Get an array of the Toolbar items */
|
29
|
-
get items(): ReadonlyArray<CommonToolbarItem>;
|
30
|
-
set items(items: ReadonlyArray<CommonToolbarItem>);
|
31
|
-
add(itemOrItems: CommonToolbarItem | ReadonlyArray<CommonToolbarItem>): void;
|
32
|
-
/** Remove Toolbar items based on id */
|
33
|
-
remove(itemIdOrItemIds: ToolbarItemId | ReadonlyArray<ToolbarItemId>): void;
|
34
|
-
/** @internal */
|
35
|
-
removeAll(): void;
|
36
|
-
private static gatherSyncIds;
|
37
|
-
static getSyncIdsOfInterest(items: readonly CommonToolbarItem[]): string[];
|
38
|
-
private static refreshChildItems;
|
39
|
-
private internalRefreshAffectedItems;
|
40
|
-
refreshAffectedItems(eventIds: Set<string>): void;
|
41
|
-
private static isActiveToolIdRefreshRequiredForChildren;
|
42
|
-
private isActiveToolIdRefreshRequired;
|
43
|
-
private static refreshActiveToolIdInChildItems;
|
44
|
-
setActiveToolId(toolId: string): void;
|
45
|
-
}
|
46
|
-
//# sourceMappingURL=ToolbarItemsManager.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"ToolbarItemsManager.d.ts","sourceRoot":"","sources":["../../../../src/appui-abstract/toolbars/ToolbarItemsManager.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAG9C,OAAO,EAAgB,iBAAiB,EAAe,aAAa,EAAwB,MAAM,eAAe,CAAC;AAUlH;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAC;CAClD;AAED;;;GAGG;AACH,qBAAa,mBAAmB;IAC9B,SAAS,CAAC,MAAM,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAM;gBAE5C,KAAK,CAAC,EAAE,aAAa,CAAC,iBAAiB,CAAC;IAKpD;;OAEG;IACH,SAAgB,cAAc,iBAAsB,uBAAuB,KAAK,IAAI,EAAI;IAExF,OAAO,CAAC,iBAAiB;IAiBzB;;OAEG;IACI,SAAS,CAAC,KAAK,EAAE,aAAa,CAAC,iBAAiB,CAAC;IAIxD,yCAAyC;IACzC,IAAW,KAAK,IAAI,aAAa,CAAC,iBAAiB,CAAC,CAEnD;IAED,IAAW,KAAK,CAAC,KAAK,EAAE,aAAa,CAAC,iBAAiB,CAAC,EAIvD;IAEM,GAAG,CAAC,WAAW,EAAE,iBAAiB,GAAG,aAAa,CAAC,iBAAiB,CAAC;IAiB5E,uCAAuC;IAChC,MAAM,CAAC,eAAe,EAAE,aAAa,GAAG,aAAa,CAAC,aAAa,CACzE;IAOD,gBAAgB;IACT,SAAS;IAIhB,OAAO,CAAC,MAAM,CAAC,aAAa;WAiBd,oBAAoB,CAAC,KAAK,EAAE,SAAS,iBAAiB,EAAE,GAAG,MAAM,EAAE;IAMjF,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAiChC,OAAO,CAAC,4BAA4B;IAsC7B,oBAAoB,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC;IAYjD,OAAO,CAAC,MAAM,CAAC,wCAAwC;IAcvD,OAAO,CAAC,6BAA6B;IAerC,OAAO,CAAC,MAAM,CAAC,+BAA+B;IAevC,eAAe,CAAC,MAAM,EAAE,MAAM;CAoBtC"}
|
@@ -1,232 +0,0 @@
|
|
1
|
-
/*---------------------------------------------------------------------------------------------
|
2
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
3
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
4
|
-
*--------------------------------------------------------------------------------------------*/
|
5
|
-
/** @packageDocumentation
|
6
|
-
* @module Toolbar
|
7
|
-
*/
|
8
|
-
import { BeEvent } from "@itwin/core-bentley";
|
9
|
-
import { ConditionalBooleanValue } from "../items/ConditionalBooleanValue";
|
10
|
-
import { ConditionalStringValue } from "../items/ConditionalStringValue";
|
11
|
-
import { ToolbarItemUtilities } from "./ToolbarItem";
|
12
|
-
const isInstance = (args) => {
|
13
|
-
return !Array.isArray(args);
|
14
|
-
};
|
15
|
-
/**
|
16
|
-
* Controls status bar items.
|
17
|
-
* @internal
|
18
|
-
*/
|
19
|
-
export class ToolbarItemsManager {
|
20
|
-
constructor(items) {
|
21
|
-
this._items = [];
|
22
|
-
/** Event raised when Toolbar items are changed.
|
23
|
-
* @internal
|
24
|
-
*/
|
25
|
-
this.onItemsChanged = new BeEvent();
|
26
|
-
if (items)
|
27
|
-
this.loadItemsInternal(items, true, false);
|
28
|
-
}
|
29
|
-
loadItemsInternal(items, processConditions, sendItemChanged) {
|
30
|
-
if (processConditions && items) {
|
31
|
-
const eventIds = ToolbarItemsManager.getSyncIdsOfInterest(items);
|
32
|
-
if (0 !== eventIds.length) {
|
33
|
-
const { itemsUpdated, updatedItems } = this.internalRefreshAffectedItems(items, new Set(eventIds));
|
34
|
-
// istanbul ignore else
|
35
|
-
if (itemsUpdated)
|
36
|
-
items = updatedItems;
|
37
|
-
}
|
38
|
-
}
|
39
|
-
this._items = items;
|
40
|
-
if (sendItemChanged)
|
41
|
-
this.onItemsChanged.raiseEvent({ items });
|
42
|
-
}
|
43
|
-
/** load items but do not fire onItemsChanged
|
44
|
-
* @internal
|
45
|
-
*/
|
46
|
-
loadItems(items) {
|
47
|
-
this.loadItemsInternal(items, true, false);
|
48
|
-
}
|
49
|
-
/** Get an array of the Toolbar items */
|
50
|
-
get items() {
|
51
|
-
return this._items;
|
52
|
-
}
|
53
|
-
set items(items) {
|
54
|
-
// istanbul ignore else
|
55
|
-
if (items !== this._items)
|
56
|
-
this.loadItemsInternal(items, true, true);
|
57
|
-
}
|
58
|
-
add(itemOrItems) {
|
59
|
-
let itemsToAdd;
|
60
|
-
if (isInstance(itemOrItems))
|
61
|
-
itemsToAdd = [itemOrItems];
|
62
|
-
else {
|
63
|
-
itemsToAdd = itemOrItems.filter((itemToAdd, index) => itemOrItems.findIndex((item) => item.id === itemToAdd.id) === index);
|
64
|
-
}
|
65
|
-
itemsToAdd = itemsToAdd.filter((itemToAdd) => this._items.find((item) => item.id === itemToAdd.id) === undefined);
|
66
|
-
if (itemsToAdd.length === 0)
|
67
|
-
return;
|
68
|
-
const items = [
|
69
|
-
...this._items,
|
70
|
-
...itemsToAdd,
|
71
|
-
];
|
72
|
-
this.items = items;
|
73
|
-
}
|
74
|
-
/** Remove Toolbar items based on id */
|
75
|
-
remove(itemIdOrItemIds) {
|
76
|
-
const items = this._items.filter((item) => {
|
77
|
-
return isInstance(itemIdOrItemIds) ? item.id !== itemIdOrItemIds : !itemIdOrItemIds.find((itemId) => itemId === item.id);
|
78
|
-
});
|
79
|
-
this.items = items;
|
80
|
-
}
|
81
|
-
/** @internal */
|
82
|
-
removeAll() {
|
83
|
-
this._items = [];
|
84
|
-
}
|
85
|
-
static gatherSyncIds(eventIds, items) {
|
86
|
-
for (const item of items) {
|
87
|
-
for (const [, entry] of Object.entries(item)) {
|
88
|
-
if (entry instanceof ConditionalBooleanValue) {
|
89
|
-
entry.syncEventIds.forEach((eventId) => eventIds.add(eventId.toLowerCase()));
|
90
|
-
}
|
91
|
-
else /* istanbul ignore else */ if (entry instanceof ConditionalStringValue) {
|
92
|
-
entry.syncEventIds.forEach((eventId) => eventIds.add(eventId.toLowerCase()));
|
93
|
-
}
|
94
|
-
}
|
95
|
-
// istanbul ignore else
|
96
|
-
if (ToolbarItemUtilities.isGroupButton(item)) {
|
97
|
-
this.gatherSyncIds(eventIds, item.items);
|
98
|
-
}
|
99
|
-
}
|
100
|
-
}
|
101
|
-
static getSyncIdsOfInterest(items) {
|
102
|
-
const eventIds = new Set();
|
103
|
-
this.gatherSyncIds(eventIds, items);
|
104
|
-
return [...eventIds.values()];
|
105
|
-
}
|
106
|
-
static refreshChildItems(parentItem, eventIds) {
|
107
|
-
const updatedItems = [];
|
108
|
-
let itemsUpdated = false;
|
109
|
-
for (const item of parentItem.items) {
|
110
|
-
const updatedItem = { ...item };
|
111
|
-
if (ToolbarItemUtilities.isGroupButton(updatedItem)) {
|
112
|
-
const { childrenUpdated, childItems } = this.refreshChildItems(updatedItem, eventIds);
|
113
|
-
// istanbul ignore else
|
114
|
-
if (childrenUpdated) {
|
115
|
-
updatedItem.items = childItems;
|
116
|
-
itemsUpdated = true;
|
117
|
-
}
|
118
|
-
}
|
119
|
-
for (const [, entry] of Object.entries(updatedItem)) {
|
120
|
-
if (entry instanceof ConditionalBooleanValue) {
|
121
|
-
// istanbul ignore else
|
122
|
-
if (ConditionalBooleanValue.refreshValue(entry, eventIds))
|
123
|
-
itemsUpdated = true;
|
124
|
-
}
|
125
|
-
else /* istanbul ignore else */ if (entry instanceof ConditionalStringValue) {
|
126
|
-
// istanbul ignore else
|
127
|
-
if (ConditionalStringValue.refreshValue(entry, eventIds))
|
128
|
-
itemsUpdated = true;
|
129
|
-
}
|
130
|
-
}
|
131
|
-
updatedItems.push(updatedItem);
|
132
|
-
}
|
133
|
-
return { childrenUpdated: itemsUpdated, childItems: updatedItems };
|
134
|
-
}
|
135
|
-
internalRefreshAffectedItems(items, eventIds) {
|
136
|
-
// istanbul ignore next
|
137
|
-
if (0 === eventIds.size)
|
138
|
-
return { itemsUpdated: false, updatedItems: [] };
|
139
|
-
let updateRequired = false;
|
140
|
-
const newItems = [];
|
141
|
-
for (const item of items) {
|
142
|
-
const updatedItem = { ...item };
|
143
|
-
if (ToolbarItemUtilities.isGroupButton(updatedItem)) {
|
144
|
-
const { childrenUpdated, childItems } = ToolbarItemsManager.refreshChildItems(updatedItem, eventIds);
|
145
|
-
// istanbul ignore else
|
146
|
-
if (childrenUpdated) {
|
147
|
-
updatedItem.items = childItems;
|
148
|
-
updateRequired = true;
|
149
|
-
}
|
150
|
-
}
|
151
|
-
for (const [, entry] of Object.entries(updatedItem)) {
|
152
|
-
if (entry instanceof ConditionalBooleanValue) {
|
153
|
-
// istanbul ignore else
|
154
|
-
if (ConditionalBooleanValue.refreshValue(entry, eventIds))
|
155
|
-
updateRequired = true;
|
156
|
-
}
|
157
|
-
else /* istanbul ignore else */ if (entry instanceof ConditionalStringValue) {
|
158
|
-
// istanbul ignore else
|
159
|
-
if (ConditionalStringValue.refreshValue(entry, eventIds))
|
160
|
-
updateRequired = true;
|
161
|
-
}
|
162
|
-
}
|
163
|
-
newItems.push(updatedItem);
|
164
|
-
}
|
165
|
-
return { itemsUpdated: updateRequired, updatedItems: newItems };
|
166
|
-
}
|
167
|
-
refreshAffectedItems(eventIds) {
|
168
|
-
// istanbul ignore next
|
169
|
-
if (0 === eventIds.size)
|
170
|
-
return;
|
171
|
-
const { itemsUpdated, updatedItems } = this.internalRefreshAffectedItems(this.items, eventIds);
|
172
|
-
// istanbul ignore else
|
173
|
-
if (itemsUpdated)
|
174
|
-
this.loadItemsInternal(updatedItems, false, true);
|
175
|
-
}
|
176
|
-
static isActiveToolIdRefreshRequiredForChildren(children, toolId) {
|
177
|
-
for (const item of children) {
|
178
|
-
if (ToolbarItemUtilities.isGroupButton(item)) {
|
179
|
-
if (this.isActiveToolIdRefreshRequiredForChildren(item.items, toolId))
|
180
|
-
return true;
|
181
|
-
}
|
182
|
-
else {
|
183
|
-
const isActive = !!item.isActive;
|
184
|
-
if ((isActive && item.id !== toolId) || (!isActive && item.id === toolId))
|
185
|
-
return true;
|
186
|
-
}
|
187
|
-
}
|
188
|
-
return false;
|
189
|
-
}
|
190
|
-
isActiveToolIdRefreshRequired(toolId) {
|
191
|
-
for (const item of this.items) {
|
192
|
-
if (ToolbarItemUtilities.isGroupButton(item)) {
|
193
|
-
if (ToolbarItemsManager.isActiveToolIdRefreshRequiredForChildren(item.items, toolId))
|
194
|
-
return true;
|
195
|
-
}
|
196
|
-
else {
|
197
|
-
const isActive = !!item.isActive;
|
198
|
-
if ((isActive && item.id !== toolId) || (!isActive && item.id === toolId))
|
199
|
-
return true;
|
200
|
-
}
|
201
|
-
}
|
202
|
-
return false;
|
203
|
-
}
|
204
|
-
static refreshActiveToolIdInChildItems(parentItem, toolId) {
|
205
|
-
const newChildren = [];
|
206
|
-
for (const item of parentItem.items) {
|
207
|
-
const updatedItem = { ...item };
|
208
|
-
if (ToolbarItemUtilities.isGroupButton(updatedItem)) {
|
209
|
-
updatedItem.items = ToolbarItemsManager.refreshActiveToolIdInChildItems(updatedItem, toolId);
|
210
|
-
}
|
211
|
-
updatedItem.isActive = (updatedItem.id === toolId);
|
212
|
-
newChildren.push(updatedItem);
|
213
|
-
}
|
214
|
-
return newChildren;
|
215
|
-
}
|
216
|
-
setActiveToolId(toolId) {
|
217
|
-
// first see if any updates are really necessary
|
218
|
-
if (!this.isActiveToolIdRefreshRequired(toolId))
|
219
|
-
return;
|
220
|
-
const newItems = [];
|
221
|
-
for (const item of this.items) {
|
222
|
-
const updatedItem = { ...item };
|
223
|
-
if (ToolbarItemUtilities.isGroupButton(updatedItem)) {
|
224
|
-
updatedItem.items = ToolbarItemsManager.refreshActiveToolIdInChildItems(updatedItem, toolId);
|
225
|
-
}
|
226
|
-
updatedItem.isActive = (updatedItem.id === toolId);
|
227
|
-
newItems.push(updatedItem);
|
228
|
-
}
|
229
|
-
this.items = newItems;
|
230
|
-
}
|
231
|
-
}
|
232
|
-
//# sourceMappingURL=ToolbarItemsManager.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"ToolbarItemsManager.js","sourceRoot":"","sources":["../../../../src/appui-abstract/toolbars/ToolbarItemsManager.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAA+D,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAMlH,MAAM,UAAU,GAAG,CAAI,IAAwB,EAAa,EAAE;IAC5D,OAA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,GAAG,QAAQ,CAAC;IACxB,CAAC;CAEF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Toolbar\r\n */\r\n\r\nimport { BeEvent } from \"@itwin/core-bentley\";\r\nimport { ConditionalBooleanValue } from \"../items/ConditionalBooleanValue\";\r\nimport { ConditionalStringValue } from \"../items/ConditionalStringValue\";\r\nimport { ActionButton, CommonToolbarItem, GroupButton, ToolbarItemId, ToolbarItemUtilities } from \"./ToolbarItem\";\r\n\r\n/* eslint-disable @typescript-eslint/no-deprecated */\r\n\r\ntype InstanceOrArray<T> = T | ReadonlyArray<T>;\r\n\r\nconst isInstance = <T>(args: InstanceOrArray<T>): args is T => {\r\n return !Array.isArray(args);\r\n};\r\n\r\n/** Arguments of [[ToolbarItemsManager.onChanged]] event.\r\n * @internal\r\n */\r\nexport interface ToolbarItemsChangedArgs {\r\n readonly items: ReadonlyArray<CommonToolbarItem>;\r\n}\r\n\r\n/**\r\n * Controls status bar items.\r\n * @internal\r\n */\r\nexport class ToolbarItemsManager {\r\n protected _items: ReadonlyArray<CommonToolbarItem> = [];\r\n\r\n constructor(items?: ReadonlyArray<CommonToolbarItem>) {\r\n if (items)\r\n this.loadItemsInternal(items, true, false);\r\n }\r\n\r\n /** Event raised when Toolbar items are changed.\r\n * @internal\r\n */\r\n public readonly onItemsChanged = new BeEvent<(args: ToolbarItemsChangedArgs) => void>();\r\n\r\n private loadItemsInternal(items: ReadonlyArray<CommonToolbarItem>, processConditions: boolean, sendItemChanged: boolean) {\r\n if (processConditions && items) {\r\n const eventIds = ToolbarItemsManager.getSyncIdsOfInterest(items);\r\n if (0 !== eventIds.length) {\r\n const { itemsUpdated, updatedItems } = this.internalRefreshAffectedItems(items, new Set(eventIds));\r\n\r\n // istanbul ignore else\r\n if (itemsUpdated)\r\n items = updatedItems;\r\n }\r\n }\r\n\r\n this._items = items;\r\n if (sendItemChanged)\r\n this.onItemsChanged.raiseEvent({ items });\r\n }\r\n\r\n /** load items but do not fire onItemsChanged\r\n * @internal\r\n */\r\n public loadItems(items: ReadonlyArray<CommonToolbarItem>) {\r\n this.loadItemsInternal(items, true, false);\r\n }\r\n\r\n /** Get an array of the Toolbar items */\r\n public get items(): ReadonlyArray<CommonToolbarItem> {\r\n return this._items;\r\n }\r\n\r\n public set items(items: ReadonlyArray<CommonToolbarItem>) {\r\n // istanbul ignore else\r\n if (items !== this._items)\r\n this.loadItemsInternal(items, true, true);\r\n }\r\n\r\n public add(itemOrItems: CommonToolbarItem | ReadonlyArray<CommonToolbarItem>) {\r\n let itemsToAdd;\r\n if (isInstance(itemOrItems))\r\n itemsToAdd = [itemOrItems];\r\n else {\r\n itemsToAdd = itemOrItems.filter((itemToAdd, index) => itemOrItems.findIndex((item) => item.id === itemToAdd.id) === index);\r\n }\r\n itemsToAdd = itemsToAdd.filter((itemToAdd) => this._items.find((item) => item.id === itemToAdd.id) === undefined);\r\n if (itemsToAdd.length === 0)\r\n return;\r\n const items = [\r\n ...this._items,\r\n ...itemsToAdd,\r\n ];\r\n this.items = items;\r\n }\r\n\r\n /** Remove Toolbar items based on id */\r\n public remove(itemIdOrItemIds: ToolbarItemId | ReadonlyArray<ToolbarItemId\r\n >) {\r\n const items = this._items.filter((item) => {\r\n return isInstance(itemIdOrItemIds) ? item.id !== itemIdOrItemIds : !itemIdOrItemIds.find((itemId) => itemId === item.id);\r\n });\r\n this.items = items;\r\n }\r\n\r\n /** @internal */\r\n public removeAll() {\r\n this._items = [];\r\n }\r\n\r\n private static gatherSyncIds(eventIds: Set<string>, items: readonly CommonToolbarItem[]) {\r\n for (const item of items) {\r\n for (const [, entry] of Object.entries(item)) {\r\n if (entry instanceof ConditionalBooleanValue) {\r\n entry.syncEventIds.forEach((eventId: string) => eventIds.add(eventId.toLowerCase()));\r\n } else /* istanbul ignore else */ if (entry instanceof ConditionalStringValue) {\r\n entry.syncEventIds.forEach((eventId: string) => eventIds.add(eventId.toLowerCase()));\r\n }\r\n }\r\n\r\n // istanbul ignore else\r\n if (ToolbarItemUtilities.isGroupButton(item)) {\r\n this.gatherSyncIds(eventIds, item.items);\r\n }\r\n }\r\n }\r\n\r\n public static getSyncIdsOfInterest(items: readonly CommonToolbarItem[]): string[] {\r\n const eventIds = new Set<string>();\r\n this.gatherSyncIds(eventIds, items);\r\n return [...eventIds.values()];\r\n }\r\n\r\n private static refreshChildItems(parentItem: GroupButton, eventIds: Set<string>): { childrenUpdated: boolean, childItems: ReadonlyArray<ActionButton | GroupButton> } {\r\n const updatedItems: Array<ActionButton | GroupButton> = [];\r\n let itemsUpdated = false;\r\n\r\n for (const item of parentItem.items) {\r\n const updatedItem = { ...item };\r\n\r\n if (ToolbarItemUtilities.isGroupButton(updatedItem)) {\r\n const { childrenUpdated, childItems } = this.refreshChildItems(updatedItem, eventIds);\r\n // istanbul ignore else\r\n if (childrenUpdated) {\r\n updatedItem.items = childItems;\r\n itemsUpdated = true;\r\n }\r\n }\r\n\r\n for (const [, entry] of Object.entries(updatedItem)) {\r\n if (entry instanceof ConditionalBooleanValue) {\r\n // istanbul ignore else\r\n if (ConditionalBooleanValue.refreshValue(entry, eventIds))\r\n itemsUpdated = true;\r\n } else /* istanbul ignore else */ if (entry instanceof ConditionalStringValue) {\r\n // istanbul ignore else\r\n if (ConditionalStringValue.refreshValue(entry, eventIds))\r\n itemsUpdated = true;\r\n }\r\n }\r\n\r\n updatedItems.push(updatedItem);\r\n }\r\n return { childrenUpdated: itemsUpdated, childItems: updatedItems };\r\n }\r\n\r\n private internalRefreshAffectedItems(items: readonly CommonToolbarItem[], eventIds: Set<string>): { itemsUpdated: boolean, updatedItems: CommonToolbarItem[] } {\r\n // istanbul ignore next\r\n if (0 === eventIds.size)\r\n return { itemsUpdated: false, updatedItems: [] };\r\n\r\n let updateRequired = false;\r\n\r\n const newItems: CommonToolbarItem[] = [];\r\n for (const item of items) {\r\n const updatedItem = { ...item };\r\n\r\n if (ToolbarItemUtilities.isGroupButton(updatedItem)) {\r\n const { childrenUpdated, childItems } = ToolbarItemsManager.refreshChildItems(updatedItem, eventIds);\r\n // istanbul ignore else\r\n if (childrenUpdated) {\r\n updatedItem.items = childItems;\r\n updateRequired = true;\r\n }\r\n }\r\n\r\n for (const [, entry] of Object.entries(updatedItem)) {\r\n if (entry instanceof ConditionalBooleanValue) {\r\n // istanbul ignore else\r\n if (ConditionalBooleanValue.refreshValue(entry, eventIds))\r\n updateRequired = true;\r\n } else /* istanbul ignore else */ if (entry instanceof ConditionalStringValue) {\r\n // istanbul ignore else\r\n if (ConditionalStringValue.refreshValue(entry, eventIds))\r\n updateRequired = true;\r\n }\r\n }\r\n\r\n newItems.push(updatedItem);\r\n }\r\n\r\n return { itemsUpdated: updateRequired, updatedItems: newItems };\r\n }\r\n\r\n public refreshAffectedItems(eventIds: Set<string>) {\r\n // istanbul ignore next\r\n if (0 === eventIds.size)\r\n return;\r\n\r\n const { itemsUpdated, updatedItems } = this.internalRefreshAffectedItems(this.items, eventIds);\r\n\r\n // istanbul ignore else\r\n if (itemsUpdated)\r\n this.loadItemsInternal(updatedItems, false, true);\r\n }\r\n\r\n private static isActiveToolIdRefreshRequiredForChildren(children: ReadonlyArray<ActionButton | GroupButton>, toolId: string): boolean {\r\n for (const item of children) {\r\n if (ToolbarItemUtilities.isGroupButton(item)) {\r\n if (this.isActiveToolIdRefreshRequiredForChildren(item.items, toolId))\r\n return true;\r\n } else {\r\n const isActive = !!item.isActive;\r\n if ((isActive && item.id !== toolId) || (!isActive && item.id === toolId))\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n private isActiveToolIdRefreshRequired(toolId: string): boolean {\r\n for (const item of this.items) {\r\n if (ToolbarItemUtilities.isGroupButton(item)) {\r\n if (ToolbarItemsManager.isActiveToolIdRefreshRequiredForChildren(item.items, toolId))\r\n return true;\r\n } else {\r\n const isActive = !!item.isActive;\r\n if ((isActive && item.id !== toolId) || (!isActive && item.id === toolId))\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n }\r\n\r\n private static refreshActiveToolIdInChildItems(parentItem: GroupButton, toolId: string): Array<ActionButton | GroupButton> {\r\n const newChildren: Array<ActionButton | GroupButton> = [];\r\n for (const item of parentItem.items) {\r\n const updatedItem = { ...item };\r\n\r\n if (ToolbarItemUtilities.isGroupButton(updatedItem)) {\r\n updatedItem.items = ToolbarItemsManager.refreshActiveToolIdInChildItems(updatedItem, toolId);\r\n }\r\n\r\n updatedItem.isActive = (updatedItem.id === toolId);\r\n newChildren.push(updatedItem);\r\n }\r\n return newChildren;\r\n }\r\n\r\n public setActiveToolId(toolId: string) {\r\n // first see if any updates are really necessary\r\n if (!this.isActiveToolIdRefreshRequired(toolId))\r\n return;\r\n\r\n const newItems: CommonToolbarItem[] = [];\r\n for (const item of this.items) {\r\n const updatedItem = { ...item };\r\n\r\n if (ToolbarItemUtilities.isGroupButton(updatedItem)) {\r\n updatedItem.items = ToolbarItemsManager.refreshActiveToolIdInChildItems(updatedItem, toolId);\r\n }\r\n\r\n updatedItem.isActive = (updatedItem.id === toolId);\r\n newItems.push(updatedItem);\r\n }\r\n\r\n this.items = newItems;\r\n }\r\n\r\n}\r\n"]}
|