@itwin/appui-abstract 4.1.0-dev.6 → 4.1.0-dev.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/appui-abstract/BaseUiItemsProvider.d.ts +31 -0
- package/lib/cjs/appui-abstract/BaseUiItemsProvider.d.ts.map +1 -0
- package/lib/cjs/appui-abstract/BaseUiItemsProvider.js +80 -0
- package/lib/cjs/appui-abstract/BaseUiItemsProvider.js.map +1 -0
- package/lib/cjs/appui-abstract/UiItemsManager.d.ts +114 -0
- package/lib/cjs/appui-abstract/UiItemsManager.d.ts.map +1 -0
- package/lib/cjs/appui-abstract/UiItemsManager.js +194 -0
- package/lib/cjs/appui-abstract/UiItemsManager.js.map +1 -0
- package/lib/cjs/appui-abstract/UiItemsProvider.d.ts +30 -0
- package/lib/cjs/appui-abstract/UiItemsProvider.d.ts.map +1 -0
- package/lib/cjs/appui-abstract/UiItemsProvider.js +10 -0
- package/lib/cjs/appui-abstract/UiItemsProvider.js.map +1 -0
- package/lib/cjs/appui-abstract/backstage/BackstageItem.d.ts +92 -0
- package/lib/cjs/appui-abstract/backstage/BackstageItem.d.ts.map +1 -0
- package/lib/cjs/appui-abstract/backstage/BackstageItem.js +71 -0
- package/lib/cjs/appui-abstract/backstage/BackstageItem.js.map +1 -0
- package/lib/cjs/appui-abstract/backstage/BackstageItemsManager.d.ts +39 -0
- package/lib/cjs/appui-abstract/backstage/BackstageItemsManager.d.ts.map +1 -0
- package/lib/cjs/appui-abstract/backstage/BackstageItemsManager.js +134 -0
- package/lib/cjs/appui-abstract/backstage/BackstageItemsManager.js.map +1 -0
- package/lib/cjs/appui-abstract/items/ProvidedItem.d.ts +12 -0
- package/lib/cjs/appui-abstract/items/ProvidedItem.d.ts.map +1 -0
- package/lib/cjs/appui-abstract/items/ProvidedItem.js +10 -0
- package/lib/cjs/appui-abstract/items/ProvidedItem.js.map +1 -0
- package/lib/cjs/appui-abstract/items/StageUsage.d.ts +17 -0
- package/lib/cjs/appui-abstract/items/StageUsage.d.ts.map +1 -0
- package/lib/cjs/appui-abstract/items/StageUsage.js +25 -0
- package/lib/cjs/appui-abstract/items/StageUsage.js.map +1 -0
- package/lib/cjs/appui-abstract/statusbar/StatusBarItem.d.ts +129 -0
- package/lib/cjs/appui-abstract/statusbar/StatusBarItem.d.ts.map +1 -0
- package/lib/cjs/appui-abstract/statusbar/StatusBarItem.js +88 -0
- package/lib/cjs/appui-abstract/statusbar/StatusBarItem.js.map +1 -0
- package/lib/cjs/appui-abstract/statusbar/StatusBarItemsManager.d.ts +40 -0
- package/lib/cjs/appui-abstract/statusbar/StatusBarItemsManager.d.ts.map +1 -0
- package/lib/cjs/appui-abstract/statusbar/StatusBarItemsManager.js +136 -0
- package/lib/cjs/appui-abstract/statusbar/StatusBarItemsManager.js.map +1 -0
- package/lib/cjs/appui-abstract/toolbars/ToolbarItem.d.ts +27 -1
- package/lib/cjs/appui-abstract/toolbars/ToolbarItem.d.ts.map +1 -1
- package/lib/cjs/appui-abstract/toolbars/ToolbarItem.js +23 -1
- package/lib/cjs/appui-abstract/toolbars/ToolbarItem.js.map +1 -1
- package/lib/cjs/appui-abstract/toolbars/ToolbarItemsManager.d.ts +46 -0
- package/lib/cjs/appui-abstract/toolbars/ToolbarItemsManager.d.ts.map +1 -0
- package/lib/cjs/appui-abstract/toolbars/ToolbarItemsManager.js +236 -0
- package/lib/cjs/appui-abstract/toolbars/ToolbarItemsManager.js.map +1 -0
- package/lib/cjs/appui-abstract/utils/isLetter.d.ts +10 -0
- package/lib/cjs/appui-abstract/utils/isLetter.d.ts.map +1 -0
- package/lib/cjs/appui-abstract/utils/isLetter.js +20 -0
- package/lib/cjs/appui-abstract/utils/isLetter.js.map +1 -0
- package/lib/cjs/appui-abstract/widget/AbstractWidgetProps.d.ts +87 -0
- package/lib/cjs/appui-abstract/widget/AbstractWidgetProps.d.ts.map +1 -0
- package/lib/cjs/appui-abstract/widget/AbstractWidgetProps.js +10 -0
- package/lib/cjs/appui-abstract/widget/AbstractWidgetProps.js.map +1 -0
- package/lib/cjs/appui-abstract/widget/StagePanel.d.ts +37 -0
- package/lib/cjs/appui-abstract/widget/StagePanel.d.ts.map +1 -0
- package/lib/cjs/appui-abstract/widget/StagePanel.js +47 -0
- package/lib/cjs/appui-abstract/widget/StagePanel.js.map +1 -0
- package/lib/cjs/appui-abstract/widget/WidgetState.d.ts +20 -0
- package/lib/cjs/appui-abstract/widget/WidgetState.d.ts.map +1 -0
- package/lib/cjs/appui-abstract/widget/WidgetState.js +28 -0
- package/lib/cjs/appui-abstract/widget/WidgetState.js.map +1 -0
- package/lib/cjs/appui-abstract.d.ts +32 -0
- package/lib/cjs/appui-abstract.d.ts.map +1 -1
- package/lib/cjs/appui-abstract.js +32 -0
- package/lib/cjs/appui-abstract.js.map +1 -1
- package/lib/esm/appui-abstract/BaseUiItemsProvider.d.ts +31 -0
- package/lib/esm/appui-abstract/BaseUiItemsProvider.d.ts.map +1 -0
- package/lib/esm/appui-abstract/BaseUiItemsProvider.js +76 -0
- package/lib/esm/appui-abstract/BaseUiItemsProvider.js.map +1 -0
- package/lib/esm/appui-abstract/UiItemsManager.d.ts +114 -0
- package/lib/esm/appui-abstract/UiItemsManager.d.ts.map +1 -0
- package/lib/esm/appui-abstract/UiItemsManager.js +191 -0
- package/lib/esm/appui-abstract/UiItemsManager.js.map +1 -0
- package/lib/esm/appui-abstract/UiItemsProvider.d.ts +30 -0
- package/lib/esm/appui-abstract/UiItemsProvider.d.ts.map +1 -0
- package/lib/esm/appui-abstract/UiItemsProvider.js +9 -0
- package/lib/esm/appui-abstract/UiItemsProvider.js.map +1 -0
- package/lib/esm/appui-abstract/backstage/BackstageItem.d.ts +92 -0
- package/lib/esm/appui-abstract/backstage/BackstageItem.d.ts.map +1 -0
- package/lib/esm/appui-abstract/backstage/BackstageItem.js +66 -0
- package/lib/esm/appui-abstract/backstage/BackstageItem.js.map +1 -0
- package/lib/esm/appui-abstract/backstage/BackstageItemsManager.d.ts +39 -0
- package/lib/esm/appui-abstract/backstage/BackstageItemsManager.d.ts.map +1 -0
- package/lib/esm/appui-abstract/backstage/BackstageItemsManager.js +130 -0
- package/lib/esm/appui-abstract/backstage/BackstageItemsManager.js.map +1 -0
- package/lib/esm/appui-abstract/items/ProvidedItem.d.ts +12 -0
- package/lib/esm/appui-abstract/items/ProvidedItem.d.ts.map +1 -0
- package/lib/esm/appui-abstract/items/ProvidedItem.js +9 -0
- package/lib/esm/appui-abstract/items/ProvidedItem.js.map +1 -0
- package/lib/esm/appui-abstract/items/StageUsage.d.ts +17 -0
- package/lib/esm/appui-abstract/items/StageUsage.d.ts.map +1 -0
- package/lib/esm/appui-abstract/items/StageUsage.js +22 -0
- package/lib/esm/appui-abstract/items/StageUsage.js.map +1 -0
- package/lib/esm/appui-abstract/statusbar/StatusBarItem.d.ts +129 -0
- package/lib/esm/appui-abstract/statusbar/StatusBarItem.d.ts.map +1 -0
- package/lib/esm/appui-abstract/statusbar/StatusBarItem.js +82 -0
- package/lib/esm/appui-abstract/statusbar/StatusBarItem.js.map +1 -0
- package/lib/esm/appui-abstract/statusbar/StatusBarItemsManager.d.ts +40 -0
- package/lib/esm/appui-abstract/statusbar/StatusBarItemsManager.d.ts.map +1 -0
- package/lib/esm/appui-abstract/statusbar/StatusBarItemsManager.js +132 -0
- package/lib/esm/appui-abstract/statusbar/StatusBarItemsManager.js.map +1 -0
- package/lib/esm/appui-abstract/toolbars/ToolbarItem.d.ts +27 -1
- package/lib/esm/appui-abstract/toolbars/ToolbarItem.d.ts.map +1 -1
- package/lib/esm/appui-abstract/toolbars/ToolbarItem.js +22 -0
- package/lib/esm/appui-abstract/toolbars/ToolbarItem.js.map +1 -1
- package/lib/esm/appui-abstract/toolbars/ToolbarItemsManager.d.ts +46 -0
- package/lib/esm/appui-abstract/toolbars/ToolbarItemsManager.d.ts.map +1 -0
- package/lib/esm/appui-abstract/toolbars/ToolbarItemsManager.js +232 -0
- package/lib/esm/appui-abstract/toolbars/ToolbarItemsManager.js.map +1 -0
- package/lib/esm/appui-abstract/utils/isLetter.d.ts +10 -0
- package/lib/esm/appui-abstract/utils/isLetter.d.ts.map +1 -0
- package/lib/esm/appui-abstract/utils/isLetter.js +16 -0
- package/lib/esm/appui-abstract/utils/isLetter.js.map +1 -0
- package/lib/esm/appui-abstract/widget/AbstractWidgetProps.d.ts +87 -0
- package/lib/esm/appui-abstract/widget/AbstractWidgetProps.d.ts.map +1 -0
- package/lib/esm/appui-abstract/widget/AbstractWidgetProps.js +9 -0
- package/lib/esm/appui-abstract/widget/AbstractWidgetProps.js.map +1 -0
- package/lib/esm/appui-abstract/widget/StagePanel.d.ts +37 -0
- package/lib/esm/appui-abstract/widget/StagePanel.d.ts.map +1 -0
- package/lib/esm/appui-abstract/widget/StagePanel.js +44 -0
- package/lib/esm/appui-abstract/widget/StagePanel.js.map +1 -0
- package/lib/esm/appui-abstract/widget/WidgetState.d.ts +20 -0
- package/lib/esm/appui-abstract/widget/WidgetState.d.ts.map +1 -0
- package/lib/esm/appui-abstract/widget/WidgetState.js +25 -0
- package/lib/esm/appui-abstract/widget/WidgetState.js.map +1 -0
- package/lib/esm/appui-abstract.d.ts +32 -0
- package/lib/esm/appui-abstract.d.ts.map +1 -1
- package/lib/esm/appui-abstract.js +32 -0
- package/lib/esm/appui-abstract.js.map +1 -1
- package/package.json +5 -5
@@ -0,0 +1,88 @@
|
|
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 StatusBar
|
8
|
+
*/
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
10
|
+
exports.AbstractStatusBarItemUtilities = exports.isAbstractStatusBarCustomItem = exports.isAbstractStatusBarLabelItem = exports.isAbstractStatusBarActionItem = exports.StatusBarLabelSide = exports.StatusBarSection = void 0;
|
11
|
+
/** Status bar Groups/Sections from Left to Right
|
12
|
+
* @deprecated in 3.6. Use [StatusBarSection]($appui-react) instead.
|
13
|
+
* @public
|
14
|
+
*/
|
15
|
+
var StatusBarSection;
|
16
|
+
(function (StatusBarSection) {
|
17
|
+
/** area for tool assistance and messages */
|
18
|
+
StatusBarSection[StatusBarSection["Message"] = 0] = "Message";
|
19
|
+
/** area for tool assistance and messages */
|
20
|
+
StatusBarSection[StatusBarSection["Left"] = 0] = "Left";
|
21
|
+
/** items specific to stage/task */
|
22
|
+
StatusBarSection[StatusBarSection["Stage"] = 1] = "Stage";
|
23
|
+
/** items specific to stage/task */
|
24
|
+
StatusBarSection[StatusBarSection["Center"] = 1] = "Center";
|
25
|
+
/** Select scope and selection info */
|
26
|
+
StatusBarSection[StatusBarSection["Selection"] = 2] = "Selection";
|
27
|
+
/** Select scope and selection info */
|
28
|
+
StatusBarSection[StatusBarSection["Right"] = 2] = "Right";
|
29
|
+
/** items that only show based on context */
|
30
|
+
StatusBarSection[StatusBarSection["Context"] = 3] = "Context";
|
31
|
+
})(StatusBarSection = exports.StatusBarSection || (exports.StatusBarSection = {}));
|
32
|
+
/** Defines which side of Icon where label is placed
|
33
|
+
* @deprecated in 3.6. Use [StatusBarLabelSide]($appui-react) instead.
|
34
|
+
* @public
|
35
|
+
*/
|
36
|
+
var StatusBarLabelSide;
|
37
|
+
(function (StatusBarLabelSide) {
|
38
|
+
/** Label is placed left side of icon. This is the default if not specified */
|
39
|
+
StatusBarLabelSide[StatusBarLabelSide["Left"] = 0] = "Left";
|
40
|
+
/** Label is placed on right side of icon. */
|
41
|
+
StatusBarLabelSide[StatusBarLabelSide["Right"] = 1] = "Right";
|
42
|
+
})(StatusBarLabelSide = exports.StatusBarLabelSide || (exports.StatusBarLabelSide = {}));
|
43
|
+
/** AbstractStatusBarActionItem type guard.
|
44
|
+
* @deprecated in 3.6. Use [isStatusBarActionItem]($appui-react) instead.
|
45
|
+
* @public
|
46
|
+
*/
|
47
|
+
const isAbstractStatusBarActionItem = (item) => {
|
48
|
+
return item.execute !== undefined; // eslint-disable-line deprecation/deprecation
|
49
|
+
};
|
50
|
+
exports.isAbstractStatusBarActionItem = isAbstractStatusBarActionItem;
|
51
|
+
/** AbstractStatusBarLabelItem type guard.
|
52
|
+
* @deprecated in 3.6. Use [isStatusBarLabelItem]($appui-react) instead.
|
53
|
+
* @public
|
54
|
+
*/
|
55
|
+
const isAbstractStatusBarLabelItem = (item) => {
|
56
|
+
return item.label !== undefined && item.execute === undefined; // eslint-disable-line deprecation/deprecation
|
57
|
+
};
|
58
|
+
exports.isAbstractStatusBarLabelItem = isAbstractStatusBarLabelItem;
|
59
|
+
/** AbstractStatusBarCustomItem type guard.
|
60
|
+
* @deprecated in 3.6. Use [isStatusBarCustomItem]($appui-react) instead.
|
61
|
+
* @public
|
62
|
+
*/
|
63
|
+
const isAbstractStatusBarCustomItem = (item) => {
|
64
|
+
return !!item.isCustom; // eslint-disable-line deprecation/deprecation
|
65
|
+
};
|
66
|
+
exports.isAbstractStatusBarCustomItem = isAbstractStatusBarCustomItem;
|
67
|
+
/** Helper class to create Abstract StatusBar Item definitions.
|
68
|
+
* @deprecated in 3.6. Use [StatusBarItemUtilities]($appui-react) instead.
|
69
|
+
* @public
|
70
|
+
*/
|
71
|
+
class AbstractStatusBarItemUtilities {
|
72
|
+
}
|
73
|
+
/** Creates a StatusBar item to perform an action */
|
74
|
+
AbstractStatusBarItemUtilities.createActionItem = (id, section, itemPriority, icon, tooltip, execute, overrides) => ({
|
75
|
+
id, section, itemPriority,
|
76
|
+
icon, tooltip,
|
77
|
+
execute,
|
78
|
+
...overrides,
|
79
|
+
});
|
80
|
+
/** Creates a StatusBar item to display a label */
|
81
|
+
AbstractStatusBarItemUtilities.createLabelItem = (id, section, itemPriority, icon, label, labelSide = StatusBarLabelSide.Right, overrides) => ({
|
82
|
+
id, section, itemPriority,
|
83
|
+
icon, label,
|
84
|
+
labelSide,
|
85
|
+
...overrides,
|
86
|
+
});
|
87
|
+
exports.AbstractStatusBarItemUtilities = AbstractStatusBarItemUtilities;
|
88
|
+
//# sourceMappingURL=StatusBarItem.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"StatusBarItem.js","sourceRoot":"","sources":["../../../../src/appui-abstract/statusbar/StatusBarItem.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAOH;;;GAGG;AACH,IAAY,gBAeX;AAfD,WAAY,gBAAgB;IAC1B,4CAA4C;IAC5C,6DAAW,CAAA;IACX,4CAA4C;IAC5C,uDAAQ,CAAA;IACR,mCAAmC;IACnC,yDAAS,CAAA;IACT,mCAAmC;IACnC,2DAAU,CAAA;IACV,sCAAsC;IACtC,iEAAa,CAAA;IACb,sCAAsC;IACtC,yDAAS,CAAA;IACT,4CAA4C;IAC5C,6DAAW,CAAA;AACb,CAAC,EAfW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAe3B;AAED;;;GAGG;AACH,IAAY,kBAKX;AALD,WAAY,kBAAkB;IAC5B,8EAA8E;IAC9E,2DAAI,CAAA;IACJ,6CAA6C;IAC7C,6DAAK,CAAA;AACP,CAAC,EALW,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAK7B;AA0ED;;;GAGG;AACI,MAAM,6BAA6B,GAAG,CAAC,IAAyB,EAAuC,EAAE;IAC9G,OAAQ,IAAoC,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,8CAA8C;AACpH,CAAC,CAAC;AAFW,QAAA,6BAA6B,iCAExC;AAEF;;;GAGG;AACI,MAAM,4BAA4B,GAAG,CAAC,IAAyB,EAAsC,EAAE;IAC5G,OAAQ,IAAmC,CAAC,KAAK,KAAK,SAAS,IAAK,IAAoC,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,8CAA8C;AAChL,CAAC,CAAC;AAFW,QAAA,4BAA4B,gCAEvC;AAEF;;;GAGG;AACI,MAAM,6BAA6B,GAAG,CAAC,IAAyB,EAAuC,EAAE;IAC9G,OAAO,CAAC,CAAE,IAAoC,CAAC,QAAQ,CAAC,CAAC,8CAA8C;AACzG,CAAC,CAAC;AAFW,QAAA,6BAA6B,iCAExC;AAEF;;;GAGG;AACH,MAAa,8BAA8B;;AACzC,oDAAoD;AACtC,+CAAgB,GAAG,CAAC,EAAU,EAAE,OAAyB,EAAE,YAAoB,EAAE,IAAqC,EAAE,OAAwC,EAAE,OAAmB,EAAE,SAAgD,EAA+B,EAAE,CAAC,CAAC;IACtR,EAAE,EAAE,OAAO,EAAE,YAAY;IACzB,IAAI,EAAE,OAAO;IACb,OAAO;IACP,GAAG,SAAS;CACb,CAAC,CAAC;AAEH,kDAAkD;AACpC,8CAAe,GAAG,CAAC,EAAU,EAAE,OAAyB,EAAE,YAAoB,EAAE,IAAqC,EAAE,KAAsC,EAAE,SAAS,GAAG,kBAAkB,CAAC,KAAK,EAAE,SAA+C,EAA8B,EAAE,CAAC,CAAC;IAClS,EAAE,EAAE,OAAO,EAAE,YAAY;IACzB,IAAI,EAAE,KAAK;IACX,SAAS;IACT,GAAG,SAAS;CACb,CAAC,CAAC;AAfQ,wEAA8B","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,\r\n /** items specific to stage/task */\r\n Stage = 1,\r\n /** items specific to stage/task */\r\n Center = 1,\r\n /** Select scope and selection info */\r\n Selection = 2,\r\n /** Select scope and selection info */\r\n Right = 2,\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\"]; // eslint-disable-line deprecation/deprecation\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 deprecation/deprecation\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 deprecation/deprecation\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 deprecation/deprecation\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 deprecation/deprecation\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 deprecation/deprecation\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 deprecation/deprecation\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 deprecation/deprecation\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 deprecation/deprecation\r\n return (item as AbstractStatusBarActionItem).execute !== undefined; // eslint-disable-line deprecation/deprecation\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 deprecation/deprecation\r\n return (item as AbstractStatusBarLabelItem).label !== undefined && (item as AbstractStatusBarActionItem).execute === undefined; // eslint-disable-line deprecation/deprecation\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 deprecation/deprecation\r\n return !!(item as AbstractStatusBarCustomItem).isCustom; // eslint-disable-line deprecation/deprecation\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 deprecation/deprecation\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 deprecation/deprecation\r\n id, section, itemPriority,\r\n icon, label,\r\n labelSide,\r\n ...overrides,\r\n });\r\n}\r\n"]}
|
@@ -0,0 +1,40 @@
|
|
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
|
@@ -0,0 +1 @@
|
|
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"}
|
@@ -0,0 +1,136 @@
|
|
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 StatusBar
|
8
|
+
*/
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
10
|
+
exports.StatusBarItemsManager = void 0;
|
11
|
+
const core_bentley_1 = require("@itwin/core-bentley");
|
12
|
+
const ConditionalBooleanValue_1 = require("../items/ConditionalBooleanValue");
|
13
|
+
const ConditionalStringValue_1 = require("../items/ConditionalStringValue");
|
14
|
+
const isInstance = (args) => {
|
15
|
+
return !Array.isArray(args);
|
16
|
+
};
|
17
|
+
/**
|
18
|
+
* Controls status bar items.
|
19
|
+
* @internal
|
20
|
+
*/
|
21
|
+
class StatusBarItemsManager {
|
22
|
+
constructor(items) {
|
23
|
+
this._items = [];
|
24
|
+
/** Event raised when StatusBar items are changed.
|
25
|
+
* @internal
|
26
|
+
*/
|
27
|
+
this.onItemsChanged = new core_bentley_1.BeEvent();
|
28
|
+
if (items)
|
29
|
+
this.loadItemsInternal(items, true, false);
|
30
|
+
}
|
31
|
+
loadItemsInternal(items, processConditions, sendItemChanged) {
|
32
|
+
if (processConditions && items) {
|
33
|
+
const eventIds = StatusBarItemsManager.getSyncIdsOfInterest(items);
|
34
|
+
if (0 !== eventIds.length) {
|
35
|
+
const { itemsUpdated, updatedItems } = this.internalRefreshAffectedItems(items, new Set(eventIds));
|
36
|
+
// istanbul ignore else
|
37
|
+
if (itemsUpdated)
|
38
|
+
items = updatedItems;
|
39
|
+
}
|
40
|
+
}
|
41
|
+
this._items = items;
|
42
|
+
if (sendItemChanged)
|
43
|
+
this.onItemsChanged.raiseEvent({ items });
|
44
|
+
}
|
45
|
+
/** load items but do not fire onItemsChanged
|
46
|
+
* @internal
|
47
|
+
*/
|
48
|
+
loadItems(items) {
|
49
|
+
this.loadItemsInternal(items, true, false);
|
50
|
+
}
|
51
|
+
/** Get an array of the StatusBar items */
|
52
|
+
get items() {
|
53
|
+
return this._items;
|
54
|
+
}
|
55
|
+
set items(items) {
|
56
|
+
// istanbul ignore else
|
57
|
+
if (items !== this._items)
|
58
|
+
this.loadItemsInternal(items, true, true);
|
59
|
+
}
|
60
|
+
add(itemOrItems) {
|
61
|
+
let itemsToAdd;
|
62
|
+
if (isInstance(itemOrItems))
|
63
|
+
itemsToAdd = [itemOrItems];
|
64
|
+
else {
|
65
|
+
itemsToAdd = itemOrItems.filter((itemToAdd, index) => itemOrItems.findIndex((item) => item.id === itemToAdd.id) === index);
|
66
|
+
}
|
67
|
+
itemsToAdd = itemsToAdd.filter((itemToAdd) => this._items.find((item) => item.id === itemToAdd.id) === undefined);
|
68
|
+
if (itemsToAdd.length === 0)
|
69
|
+
return;
|
70
|
+
const items = [
|
71
|
+
...this._items,
|
72
|
+
...itemsToAdd,
|
73
|
+
];
|
74
|
+
this.items = items;
|
75
|
+
}
|
76
|
+
/** Remove StatusBar items based on id */
|
77
|
+
remove(itemIdOrItemIds) {
|
78
|
+
const items = this._items.filter((item) => {
|
79
|
+
return isInstance(itemIdOrItemIds) ? item.id !== itemIdOrItemIds : !itemIdOrItemIds.find((itemId) => itemId === item.id);
|
80
|
+
});
|
81
|
+
this.items = items;
|
82
|
+
}
|
83
|
+
/** @internal */
|
84
|
+
removeAll() {
|
85
|
+
this._items = [];
|
86
|
+
}
|
87
|
+
static getSyncIdsOfInterest(items) {
|
88
|
+
const eventIds = new Set();
|
89
|
+
items.forEach((item) => {
|
90
|
+
for (const [, entry] of Object.entries(item)) {
|
91
|
+
if (entry instanceof ConditionalBooleanValue_1.ConditionalBooleanValue) {
|
92
|
+
entry.syncEventIds.forEach((eventId) => eventIds.add(eventId.toLowerCase()));
|
93
|
+
}
|
94
|
+
else /* istanbul ignore else */ if (entry instanceof ConditionalStringValue_1.ConditionalStringValue) {
|
95
|
+
entry.syncEventIds.forEach((eventId) => eventIds.add(eventId.toLowerCase()));
|
96
|
+
}
|
97
|
+
}
|
98
|
+
});
|
99
|
+
return [...eventIds.values()];
|
100
|
+
}
|
101
|
+
internalRefreshAffectedItems(items, eventIds) {
|
102
|
+
// istanbul ignore next
|
103
|
+
if (0 === eventIds.size)
|
104
|
+
return { itemsUpdated: false, updatedItems: [] };
|
105
|
+
let updateRequired = false;
|
106
|
+
const newItems = [];
|
107
|
+
for (const item of items) {
|
108
|
+
const updatedItem = { ...item };
|
109
|
+
for (const [, entry] of Object.entries(updatedItem)) {
|
110
|
+
if (entry instanceof ConditionalBooleanValue_1.ConditionalBooleanValue) {
|
111
|
+
// istanbul ignore else
|
112
|
+
if (ConditionalBooleanValue_1.ConditionalBooleanValue.refreshValue(entry, eventIds))
|
113
|
+
updateRequired = true;
|
114
|
+
}
|
115
|
+
else /* istanbul ignore else */ if (entry instanceof ConditionalStringValue_1.ConditionalStringValue) {
|
116
|
+
// istanbul ignore else
|
117
|
+
if (ConditionalStringValue_1.ConditionalStringValue.refreshValue(entry, eventIds))
|
118
|
+
updateRequired = true;
|
119
|
+
}
|
120
|
+
}
|
121
|
+
newItems.push(updatedItem);
|
122
|
+
}
|
123
|
+
return { itemsUpdated: updateRequired, updatedItems: newItems };
|
124
|
+
}
|
125
|
+
refreshAffectedItems(eventIds) {
|
126
|
+
// istanbul ignore next
|
127
|
+
if (0 === eventIds.size)
|
128
|
+
return;
|
129
|
+
const { itemsUpdated, updatedItems } = this.internalRefreshAffectedItems(this.items, eventIds);
|
130
|
+
// istanbul ignore else
|
131
|
+
if (itemsUpdated)
|
132
|
+
this.loadItemsInternal(updatedItems, false, true);
|
133
|
+
}
|
134
|
+
}
|
135
|
+
exports.StatusBarItemsManager = StatusBarItemsManager;
|
136
|
+
//# sourceMappingURL=StatusBarItemsManager.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"StatusBarItemsManager.js","sourceRoot":"","sources":["../../../../src/appui-abstract/statusbar/StatusBarItemsManager.ts"],"names":[],"m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AI,EAAE,CAAC;YAEhC,KAAK,MAAM,CAAC,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;gBACnD,IAAI,KAAK,YAAY,iDAAuB,EAAE;oBAC5C,uBAAuB;oBACvB,IAAI,iDAAuB,CAAC,YAAY,CAAC,KAAK,EAAE,QAAQ,CAAC;wBACvD,cAAc,GAAG,IAAI,CAAC;iBACzB;qBAAM,0BAA0B,CAAC,IAAI,KAAK,YAAY,+CAAsB,EAAE;oBAC7E,uBAAuB;oBACvB,IAAI,+CAAsB,CAAC,YAAY,CAAC,KAAK,EAAE,QAAQ,CAAC;wBACtD,cAAc,GAAG,IAAI,CAAC;iBACzB;aACF;YAED,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;SAC5B;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;AArID,sDAqIC","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 deprecation/deprecation */\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"]}
|
@@ -4,10 +4,31 @@
|
|
4
4
|
import { BadgeType } from "../items/BadgeType";
|
5
5
|
import { ConditionalBooleanValue } from "../items/ConditionalBooleanValue";
|
6
6
|
import { ConditionalStringValue } from "../items/ConditionalStringValue";
|
7
|
+
import { ProvidedItem } from "../items/ProvidedItem";
|
8
|
+
/** Used to specify the usage of the toolbar which determine the toolbar position.
|
9
|
+
* @deprecated in 3.6. Use [ToolbarUsage]($appui-react) instead.
|
10
|
+
* @public
|
11
|
+
*/
|
12
|
+
export declare enum ToolbarUsage {
|
13
|
+
/** Contains tools to Create Update and Delete content - in ninezone this is in top left of content area. */
|
14
|
+
ContentManipulation = 0,
|
15
|
+
/** Manipulate view/camera - in ninezone this is in top right of content area. */
|
16
|
+
ViewNavigation = 1
|
17
|
+
}
|
18
|
+
/** Used to specify the orientation of the toolbar.
|
19
|
+
* @deprecated in 3.6. Use [ToolbarOrientation]($appui-react) instead.
|
20
|
+
* @public
|
21
|
+
*/
|
22
|
+
export declare enum ToolbarOrientation {
|
23
|
+
/** Horizontal toolbar. */
|
24
|
+
Horizontal = 0,
|
25
|
+
/** Vertical toolbar. */
|
26
|
+
Vertical = 1
|
27
|
+
}
|
7
28
|
/** Describes the data needed to insert a UI items into an existing set of UI items.
|
8
29
|
* @public
|
9
30
|
*/
|
10
|
-
export interface ToolbarItem {
|
31
|
+
export interface ToolbarItem extends ProvidedItem {
|
11
32
|
/** can be used by application to store miscellaneous data. */
|
12
33
|
readonly applicationData?: any;
|
13
34
|
/** Describes badge. Renders no badge if not specified. */
|
@@ -78,6 +99,11 @@ export interface CustomButtonDefinition extends ToolbarItem {
|
|
78
99
|
* @public
|
79
100
|
*/
|
80
101
|
export type CommonToolbarItem = ActionButton | GroupButton | CustomButtonDefinition;
|
102
|
+
/** Type for Toolbar Item Id
|
103
|
+
* @deprecated in 3.6. Please use `ToolbarItem["id"]` from @itwin/appui-react.
|
104
|
+
* @public
|
105
|
+
*/
|
106
|
+
export type ToolbarItemId = CommonToolbarItem["id"];
|
81
107
|
/** Helper class to create Abstract StatusBar Item definitions.
|
82
108
|
* @public
|
83
109
|
*/
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ToolbarItem.d.ts","sourceRoot":"","sources":["../../../../src/appui-abstract/toolbars/ToolbarItem.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;
|
1
|
+
{"version":3,"file":"ToolbarItem.d.ts","sourceRoot":"","sources":["../../../../src/appui-abstract/toolbars/ToolbarItem.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,C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;IAC9B,OAAc,iBAAiB,OAAQ,MAAM,gBAAgB,MAAM,QAAQ,MAAM,GAAG,sBAAsB,SAAS,MAAM,GAAG,sBAAsB,SAAS,cAAc,YAAY,GAAG,WAAW,CAAC,cAAc,QAAQ,WAAW,CAAC,KAAG,WAAW,CAKjP;IAEH,+BAA+B;WACjB,cAAc,CAAC,IAAI,EAAE,iBAAiB,GAAG,IAAI,IAAI,YAAY;IAI3E,8BAA8B;WAChB,aAAa,CAAC,IAAI,EAAE,iBAAiB,GAAG,IAAI,IAAI,WAAW;IAIzE,yCAAyC;WAC3B,kBAAkB,CAAC,IAAI,EAAE,iBAAiB,GAAG,IAAI,IAAI,sBAAsB;CAG1F"}
|
@@ -7,7 +7,29 @@
|
|
7
7
|
* @module Toolbar
|
8
8
|
*/
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
10
|
-
exports.ToolbarItemUtilities = void 0;
|
10
|
+
exports.ToolbarItemUtilities = exports.ToolbarOrientation = exports.ToolbarUsage = void 0;
|
11
|
+
/** Used to specify the usage of the toolbar which determine the toolbar position.
|
12
|
+
* @deprecated in 3.6. Use [ToolbarUsage]($appui-react) instead.
|
13
|
+
* @public
|
14
|
+
*/
|
15
|
+
var ToolbarUsage;
|
16
|
+
(function (ToolbarUsage) {
|
17
|
+
/** Contains tools to Create Update and Delete content - in ninezone this is in top left of content area. */
|
18
|
+
ToolbarUsage[ToolbarUsage["ContentManipulation"] = 0] = "ContentManipulation";
|
19
|
+
/** Manipulate view/camera - in ninezone this is in top right of content area. */
|
20
|
+
ToolbarUsage[ToolbarUsage["ViewNavigation"] = 1] = "ViewNavigation";
|
21
|
+
})(ToolbarUsage = exports.ToolbarUsage || (exports.ToolbarUsage = {}));
|
22
|
+
/** Used to specify the orientation of the toolbar.
|
23
|
+
* @deprecated in 3.6. Use [ToolbarOrientation]($appui-react) instead.
|
24
|
+
* @public
|
25
|
+
*/
|
26
|
+
var ToolbarOrientation;
|
27
|
+
(function (ToolbarOrientation) {
|
28
|
+
/** Horizontal toolbar. */
|
29
|
+
ToolbarOrientation[ToolbarOrientation["Horizontal"] = 0] = "Horizontal";
|
30
|
+
/** Vertical toolbar. */
|
31
|
+
ToolbarOrientation[ToolbarOrientation["Vertical"] = 1] = "Vertical";
|
32
|
+
})(ToolbarOrientation = exports.ToolbarOrientation || (exports.ToolbarOrientation = {}));
|
11
33
|
/** Helper class to create Abstract StatusBar Item definitions.
|
12
34
|
* @public
|
13
35
|
*/
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ToolbarItem.js","sourceRoot":"","sources":["../../../../src/appui-abstract/toolbars/ToolbarItem.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;
|
1
|
+
{"version":3,"file":"ToolbarItem.js","sourceRoot":"","sources":["../../../../src/appui-abstract/toolbars/ToolbarItem.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAOH;;;GAGG;AACH,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,4GAA4G;IAC5G,6EAAuB,CAAA;IACvB,iFAAiF;IACjF,mEAAkB,CAAA;AACpB,CAAC,EALW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAKvB;AAED;;;GAGG;AACH,IAAY,kBAKX;AALD,WAAY,kBAAkB;IAC5B,0BAA0B;IAC1B,uEAAc,CAAA;IACd,wBAAwB;IACxB,mEAAY,CAAA;AACd,CAAC,EALW,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAK7B;AAuFD;;GAEG;AACH,MAAa,oBAAoB;IAiB/B,+BAA+B;IACxB,MAAM,CAAC,cAAc,CAAC,IAAuB;QAClD,OAAQ,IAAqB,CAAC,OAAO,KAAK,SAAS,CAAC;IACtD,CAAC;IAED,8BAA8B;IACvB,MAAM,CAAC,aAAa,CAAC,IAAuB;QACjD,OAAQ,IAAoB,CAAC,KAAK,KAAK,SAAS,CAAC;IACnD,CAAC;IAED,yCAAyC;IAClC,MAAM,CAAC,kBAAkB,CAAC,IAAuB;QACtD,OAAO,CAAC,CAAE,IAA+B,CAAC,QAAQ,CAAC;IACrD,CAAC;;AA7BD,+BAA+B;AACjB,uCAAkB,GAAG,CAAC,EAAU,EAAE,YAAoB,EAAE,IAAqC,EAAE,KAAsC,EAAE,OAAmB,EAAE,SAAiC,EAAgB,EAAE,CAAC,CAAC;IAC7N,EAAE,EAAE,YAAY;IAChB,IAAI,EAAE,KAAK;IACX,OAAO;IACP,GAAG,SAAS;CACb,CAAC,CAAC;AAEH,8BAA8B;AAChB,sCAAiB,GAAG,CAAC,EAAU,EAAE,YAAoB,EAAE,IAAqC,EAAE,KAAsC,EAAE,KAAgD,EAAE,SAAgC,EAAe,EAAE,CAAC,CAAC;IACvP,EAAE,EAAE,YAAY;IAChB,IAAI,EAAE,KAAK;IACX,KAAK;IACL,GAAG,SAAS;CACb,CAAC,CAAC;AAfQ,oDAAoB","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 { 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/** Used to specify the usage of the toolbar which determine the toolbar position.\r\n * @deprecated in 3.6. Use [ToolbarUsage]($appui-react) instead.\r\n * @public\r\n */\r\nexport enum ToolbarUsage {\r\n /** Contains tools to Create Update and Delete content - in ninezone this is in top left of content area. */\r\n ContentManipulation = 0,\r\n /** Manipulate view/camera - in ninezone this is in top right of content area. */\r\n ViewNavigation = 1,\r\n}\r\n\r\n/** Used to specify the orientation of the toolbar.\r\n * @deprecated in 3.6. Use [ToolbarOrientation]($appui-react) instead.\r\n * @public\r\n */\r\nexport enum ToolbarOrientation {\r\n /** Horizontal toolbar. */\r\n Horizontal = 0,\r\n /** Vertical toolbar. */\r\n Vertical = 1,\r\n}\r\n\r\n/** Describes the data needed to insert a UI items into an existing set of UI items.\r\n * @public\r\n */\r\nexport interface ToolbarItem extends ProvidedItem { // eslint-disable-line deprecation/deprecation\r\n /** can be used by application to store miscellaneous data. */\r\n readonly applicationData?: any;\r\n /** Describes badge. Renders no badge if not specified. */\r\n readonly badgeType?: BadgeType;\r\n /** Optional description */\r\n readonly description?: string | ConditionalStringValue;\r\n /** Require uniqueId for 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 /** Defines if the item is active (shown with an active stripe/bar). */\r\n readonly isActive?: boolean;\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 /** Describes if the item should appear pressed (used for displaying toggle state). This property is NOT used by Toolbars\r\n * constructed using the `ToolbarWithOverflow` component, which are used in AppUi 2.0 and later. For these later toolbars\r\n * the icon is usually changed to denote the state of a toggle.\r\n */\r\n readonly isPressed?: boolean;\r\n /** Specifies the item's grouping value. Items are sorted by group and then item priority. When\r\n * group priority changes a separator is inserted. It is recommended using values 10 through 100, incrementing by 10. This\r\n * allows extensions enough gaps to insert their own groups. If the value is not specified a groupPriority of 0 is used.\r\n */\r\n readonly groupPriority?: number;\r\n /** Priority within a toolbar or group. */\r\n readonly itemPriority: number;\r\n /** Optional parent tool group to add tool. */\r\n readonly parentToolGroupId?: string;\r\n}\r\n\r\n/** Describes the data needed to insert an action button into a toolbar.\r\n * @public\r\n */\r\nexport interface ActionButton extends ToolbarItem {\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, shown as tool tip on a button or an item label in a group. */\r\n readonly label: string | ConditionalStringValue;\r\n /** function to run when the button is pressed. */\r\n readonly execute: () => void;\r\n}\r\n\r\n/** Describes the data needed to insert a group button into a toolbar.\r\n * @public\r\n */\r\nexport interface GroupButton extends ToolbarItem {\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, shown as tool tip on group button or a group button label in a group panel. */\r\n readonly label: string | ConditionalStringValue;\r\n /** label shown as the title in at top of group panel. */\r\n readonly panelLabel?: string | ConditionalStringValue;\r\n /** children of the group */\r\n readonly items: ReadonlyArray<ActionButton | GroupButton>; // eslint-disable-line deprecation/deprecation\r\n}\r\n\r\n/** Describes the data needed to insert a custom button into a toolbar.\r\n * @public\r\n */\r\nexport interface CustomButtonDefinition extends ToolbarItem {\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, shown as tool tip on group button or a group button label in a group panel. */\r\n readonly label?: string | ConditionalStringValue;\r\n /** parameter that marks data as being a custom definition. */\r\n readonly isCustom: true;\r\n}\r\n\r\n/** Any Button Type that can be inserted into a toolbar.\r\n * @public\r\n */\r\nexport type CommonToolbarItem = ActionButton | GroupButton | CustomButtonDefinition;\r\n\r\n/** Type for Toolbar Item Id\r\n * @deprecated in 3.6. Please use `ToolbarItem[\"id\"]` from @itwin/appui-react.\r\n * @public\r\n */\r\nexport type ToolbarItemId = CommonToolbarItem[\"id\"]; // eslint-disable-line deprecation/deprecation\r\n\r\n/** Helper class to create Abstract StatusBar Item definitions.\r\n * @public\r\n */\r\nexport class ToolbarItemUtilities {\r\n /** Creates an Action Button */\r\n public static createActionButton = (id: string, itemPriority: number, icon: string | ConditionalStringValue, label: string | ConditionalStringValue, execute: () => void, overrides?: Partial<ActionButton>): ActionButton => ({\r\n id, itemPriority,\r\n icon, label,\r\n execute,\r\n ...overrides,\r\n });\r\n\r\n /** Creates a Group button. */\r\n public static createGroupButton = (id: string, itemPriority: number, icon: string | ConditionalStringValue, label: string | ConditionalStringValue, items: ReadonlyArray<ActionButton | GroupButton>, overrides?: Partial<GroupButton>): GroupButton => ({\r\n id, itemPriority,\r\n icon, label,\r\n items,\r\n ...overrides,\r\n });\r\n\r\n /** ActionButton type guard. */\r\n public static isActionButton(item: CommonToolbarItem): item is ActionButton {\r\n return (item as ActionButton).execute !== undefined;\r\n }\r\n\r\n /** GroupButton type guard. */\r\n public static isGroupButton(item: CommonToolbarItem): item is GroupButton {\r\n return (item as GroupButton).items !== undefined;\r\n }\r\n\r\n /** CustomButtonDefinition type guard. */\r\n public static isCustomDefinition(item: CommonToolbarItem): item is CustomButtonDefinition {\r\n return !!(item as CustomButtonDefinition).isCustom;\r\n }\r\n}\r\n"]}
|
@@ -0,0 +1,46 @@
|
|
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
|
@@ -0,0 +1 @@
|
|
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,a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