@itwin/appui-abstract 4.0.0-dev.52 → 4.0.0-dev.55

Sign up to get free protection for your applications and to get access to all the features.
Files changed (254) hide show
  1. package/lib/cjs/appui-abstract/BaseUiItemsProvider.d.ts +30 -30
  2. package/lib/cjs/appui-abstract/BaseUiItemsProvider.d.ts.map +1 -1
  3. package/lib/cjs/appui-abstract/BaseUiItemsProvider.js +79 -79
  4. package/lib/cjs/appui-abstract/UiAdmin.d.ts +221 -221
  5. package/lib/cjs/appui-abstract/UiAdmin.js +224 -224
  6. package/lib/cjs/appui-abstract/UiAdmin.js.map +1 -1
  7. package/lib/cjs/appui-abstract/UiItemsManager.d.ts +113 -113
  8. package/lib/cjs/appui-abstract/UiItemsManager.d.ts.map +1 -1
  9. package/lib/cjs/appui-abstract/UiItemsManager.js +193 -193
  10. package/lib/cjs/appui-abstract/UiItemsManager.js.map +1 -1
  11. package/lib/cjs/appui-abstract/UiItemsProvider.d.ts +29 -29
  12. package/lib/cjs/appui-abstract/UiItemsProvider.js +9 -9
  13. package/lib/cjs/appui-abstract/backstage/BackstageItem.d.ts +91 -91
  14. package/lib/cjs/appui-abstract/backstage/BackstageItem.d.ts.map +1 -1
  15. package/lib/cjs/appui-abstract/backstage/BackstageItem.js +70 -70
  16. package/lib/cjs/appui-abstract/backstage/BackstageItem.js.map +1 -1
  17. package/lib/cjs/appui-abstract/backstage/BackstageItemsManager.d.ts +38 -38
  18. package/lib/cjs/appui-abstract/backstage/BackstageItemsManager.js +133 -133
  19. package/lib/cjs/appui-abstract/backstage/BackstageItemsManager.js.map +1 -1
  20. package/lib/cjs/appui-abstract/common/KeyboardKey.d.ts +51 -51
  21. package/lib/cjs/appui-abstract/common/KeyboardKey.js +63 -63
  22. package/lib/cjs/appui-abstract/content/ContentLayoutProps.d.ts +62 -62
  23. package/lib/cjs/appui-abstract/content/ContentLayoutProps.js +9 -9
  24. package/lib/cjs/appui-abstract/content/StandardContentLayouts.d.ts +19 -19
  25. package/lib/cjs/appui-abstract/content/StandardContentLayouts.js +108 -108
  26. package/lib/cjs/appui-abstract/content/StandardContentLayouts.js.map +1 -1
  27. package/lib/cjs/appui-abstract/dialogs/DialogItem.d.ts +76 -76
  28. package/lib/cjs/appui-abstract/dialogs/DialogItem.js +67 -67
  29. package/lib/cjs/appui-abstract/dialogs/UiDataProvider.d.ts +55 -55
  30. package/lib/cjs/appui-abstract/dialogs/UiDataProvider.js +66 -66
  31. package/lib/cjs/appui-abstract/dialogs/UiLayoutDataProvider.d.ts +97 -97
  32. package/lib/cjs/appui-abstract/dialogs/UiLayoutDataProvider.js +175 -175
  33. package/lib/cjs/appui-abstract/dialogs/UiLayoutDataProvider.js.map +1 -1
  34. package/lib/cjs/appui-abstract/items/AbstractItemProps.d.ts +53 -53
  35. package/lib/cjs/appui-abstract/items/AbstractItemProps.d.ts.map +1 -1
  36. package/lib/cjs/appui-abstract/items/AbstractItemProps.js +9 -9
  37. package/lib/cjs/appui-abstract/items/AbstractMenuItemProps.d.ts +20 -20
  38. package/lib/cjs/appui-abstract/items/AbstractMenuItemProps.js +9 -9
  39. package/lib/cjs/appui-abstract/items/AbstractToolbarProps.d.ts +13 -13
  40. package/lib/cjs/appui-abstract/items/AbstractToolbarProps.js +9 -9
  41. package/lib/cjs/appui-abstract/items/BadgeType.d.ts +14 -14
  42. package/lib/cjs/appui-abstract/items/BadgeType.js +22 -22
  43. package/lib/cjs/appui-abstract/items/ConditionalBooleanValue.d.ts +27 -27
  44. package/lib/cjs/appui-abstract/items/ConditionalBooleanValue.js +60 -60
  45. package/lib/cjs/appui-abstract/items/ConditionalStringValue.d.ts +29 -29
  46. package/lib/cjs/appui-abstract/items/ConditionalStringValue.js +62 -62
  47. package/lib/cjs/appui-abstract/items/ProvidedItem.d.ts +11 -11
  48. package/lib/cjs/appui-abstract/items/ProvidedItem.js +9 -9
  49. package/lib/cjs/appui-abstract/items/RelativePosition.d.ts +18 -18
  50. package/lib/cjs/appui-abstract/items/RelativePosition.js +26 -26
  51. package/lib/cjs/appui-abstract/items/StageUsage.d.ts +16 -16
  52. package/lib/cjs/appui-abstract/items/StageUsage.js +24 -24
  53. package/lib/cjs/appui-abstract/notification/MessagePresenter.d.ts +42 -42
  54. package/lib/cjs/appui-abstract/notification/MessagePresenter.js +24 -24
  55. package/lib/cjs/appui-abstract/notification/MessageSeverity.d.ts +15 -15
  56. package/lib/cjs/appui-abstract/notification/MessageSeverity.js +23 -23
  57. package/lib/cjs/appui-abstract/properties/Description.d.ts +127 -127
  58. package/lib/cjs/appui-abstract/properties/Description.js +196 -196
  59. package/lib/cjs/appui-abstract/properties/EditorParams.d.ts +260 -260
  60. package/lib/cjs/appui-abstract/properties/EditorParams.d.ts.map +1 -1
  61. package/lib/cjs/appui-abstract/properties/EditorParams.js +106 -106
  62. package/lib/cjs/appui-abstract/properties/PrimitiveTypes.d.ts +60 -60
  63. package/lib/cjs/appui-abstract/properties/PrimitiveTypes.js +9 -9
  64. package/lib/cjs/appui-abstract/properties/Record.d.ts +57 -57
  65. package/lib/cjs/appui-abstract/properties/Record.js +78 -78
  66. package/lib/cjs/appui-abstract/properties/StandardEditorNames.d.ts +22 -22
  67. package/lib/cjs/appui-abstract/properties/StandardEditorNames.js +30 -30
  68. package/lib/cjs/appui-abstract/properties/StandardTypeNames.d.ts +30 -30
  69. package/lib/cjs/appui-abstract/properties/StandardTypeNames.js +39 -39
  70. package/lib/cjs/appui-abstract/properties/Value.d.ts +49 -49
  71. package/lib/cjs/appui-abstract/properties/Value.d.ts.map +1 -1
  72. package/lib/cjs/appui-abstract/properties/Value.js +20 -20
  73. package/lib/cjs/appui-abstract/quantity/BaseQuantityDescription.d.ts +22 -22
  74. package/lib/cjs/appui-abstract/quantity/BaseQuantityDescription.js +48 -48
  75. package/lib/cjs/appui-abstract/statusbar/StatusBarItem.d.ts +128 -128
  76. package/lib/cjs/appui-abstract/statusbar/StatusBarItem.d.ts.map +1 -1
  77. package/lib/cjs/appui-abstract/statusbar/StatusBarItem.js +87 -87
  78. package/lib/cjs/appui-abstract/statusbar/StatusBarItem.js.map +1 -1
  79. package/lib/cjs/appui-abstract/statusbar/StatusBarItemsManager.d.ts +39 -39
  80. package/lib/cjs/appui-abstract/statusbar/StatusBarItemsManager.js +135 -135
  81. package/lib/cjs/appui-abstract/statusbar/StatusBarItemsManager.js.map +1 -1
  82. package/lib/cjs/appui-abstract/toolbars/ToolbarItem.d.ts +121 -121
  83. package/lib/cjs/appui-abstract/toolbars/ToolbarItem.d.ts.map +1 -1
  84. package/lib/cjs/appui-abstract/toolbars/ToolbarItem.js +64 -64
  85. package/lib/cjs/appui-abstract/toolbars/ToolbarItem.js.map +1 -1
  86. package/lib/cjs/appui-abstract/toolbars/ToolbarItemsManager.d.ts +45 -45
  87. package/lib/cjs/appui-abstract/toolbars/ToolbarItemsManager.js +235 -235
  88. package/lib/cjs/appui-abstract/toolbars/ToolbarItemsManager.js.map +1 -1
  89. package/lib/cjs/appui-abstract/utils/IconSpecUtilities.d.ts +29 -29
  90. package/lib/cjs/appui-abstract/utils/IconSpecUtilities.js +51 -51
  91. package/lib/cjs/appui-abstract/utils/IconSpecUtilities.js.map +1 -1
  92. package/lib/cjs/appui-abstract/utils/PointProps.d.ts +10 -10
  93. package/lib/cjs/appui-abstract/utils/PointProps.js +9 -9
  94. package/lib/cjs/appui-abstract/utils/UiError.d.ts +12 -12
  95. package/lib/cjs/appui-abstract/utils/UiError.js +22 -22
  96. package/lib/cjs/appui-abstract/utils/UiEvent.d.ts +9 -9
  97. package/lib/cjs/appui-abstract/utils/UiEvent.js +17 -17
  98. package/lib/cjs/appui-abstract/utils/UiEventDispatcher.d.ts +46 -46
  99. package/lib/cjs/appui-abstract/utils/UiEventDispatcher.js +131 -131
  100. package/lib/cjs/appui-abstract/utils/callbacks.d.ts +20 -20
  101. package/lib/cjs/appui-abstract/utils/callbacks.d.ts.map +1 -1
  102. package/lib/cjs/appui-abstract/utils/callbacks.js +9 -9
  103. package/lib/cjs/appui-abstract/utils/filter/charCode.d.ts +416 -416
  104. package/lib/cjs/appui-abstract/utils/filter/charCode.js +6 -6
  105. package/lib/cjs/appui-abstract/utils/filter/filters.d.ts +98 -98
  106. package/lib/cjs/appui-abstract/utils/filter/filters.d.ts.map +1 -1
  107. package/lib/cjs/appui-abstract/utils/filter/filters.js +709 -709
  108. package/lib/cjs/appui-abstract/utils/filter/filters.js.map +1 -1
  109. package/lib/cjs/appui-abstract/utils/filter/map.d.ts +59 -59
  110. package/lib/cjs/appui-abstract/utils/filter/map.js +402 -402
  111. package/lib/cjs/appui-abstract/utils/filter/map.js.map +1 -1
  112. package/lib/cjs/appui-abstract/utils/filter/strings.d.ts +20 -20
  113. package/lib/cjs/appui-abstract/utils/filter/strings.js +78 -78
  114. package/lib/cjs/appui-abstract/utils/filter/strings.js.map +1 -1
  115. package/lib/cjs/appui-abstract/utils/isLetter.d.ts +9 -9
  116. package/lib/cjs/appui-abstract/utils/isLetter.js +19 -19
  117. package/lib/cjs/appui-abstract/utils/misc.d.ts +11 -11
  118. package/lib/cjs/appui-abstract/utils/misc.js +36 -36
  119. package/lib/cjs/appui-abstract/widget/AbstractWidgetProps.d.ts +86 -86
  120. package/lib/cjs/appui-abstract/widget/AbstractWidgetProps.js +9 -9
  121. package/lib/cjs/appui-abstract/widget/StagePanel.d.ts +36 -36
  122. package/lib/cjs/appui-abstract/widget/StagePanel.js +46 -46
  123. package/lib/cjs/appui-abstract/widget/WidgetState.d.ts +19 -19
  124. package/lib/cjs/appui-abstract/widget/WidgetState.js +27 -27
  125. package/lib/cjs/appui-abstract.d.ts +103 -103
  126. package/lib/cjs/appui-abstract.js +123 -119
  127. package/lib/cjs/appui-abstract.js.map +1 -1
  128. package/lib/esm/appui-abstract/BaseUiItemsProvider.d.ts +30 -30
  129. package/lib/esm/appui-abstract/BaseUiItemsProvider.d.ts.map +1 -1
  130. package/lib/esm/appui-abstract/BaseUiItemsProvider.js +75 -75
  131. package/lib/esm/appui-abstract/UiAdmin.d.ts +221 -221
  132. package/lib/esm/appui-abstract/UiAdmin.js +220 -219
  133. package/lib/esm/appui-abstract/UiAdmin.js.map +1 -1
  134. package/lib/esm/appui-abstract/UiItemsManager.d.ts +113 -113
  135. package/lib/esm/appui-abstract/UiItemsManager.d.ts.map +1 -1
  136. package/lib/esm/appui-abstract/UiItemsManager.js +190 -189
  137. package/lib/esm/appui-abstract/UiItemsManager.js.map +1 -1
  138. package/lib/esm/appui-abstract/UiItemsProvider.d.ts +29 -29
  139. package/lib/esm/appui-abstract/UiItemsProvider.js +8 -8
  140. package/lib/esm/appui-abstract/backstage/BackstageItem.d.ts +91 -91
  141. package/lib/esm/appui-abstract/backstage/BackstageItem.d.ts.map +1 -1
  142. package/lib/esm/appui-abstract/backstage/BackstageItem.js +65 -64
  143. package/lib/esm/appui-abstract/backstage/BackstageItem.js.map +1 -1
  144. package/lib/esm/appui-abstract/backstage/BackstageItemsManager.d.ts +38 -38
  145. package/lib/esm/appui-abstract/backstage/BackstageItemsManager.js +129 -129
  146. package/lib/esm/appui-abstract/backstage/BackstageItemsManager.js.map +1 -1
  147. package/lib/esm/appui-abstract/common/KeyboardKey.d.ts +51 -51
  148. package/lib/esm/appui-abstract/common/KeyboardKey.js +59 -59
  149. package/lib/esm/appui-abstract/content/ContentLayoutProps.d.ts +62 -62
  150. package/lib/esm/appui-abstract/content/ContentLayoutProps.js +8 -8
  151. package/lib/esm/appui-abstract/content/StandardContentLayouts.d.ts +19 -19
  152. package/lib/esm/appui-abstract/content/StandardContentLayouts.js +105 -104
  153. package/lib/esm/appui-abstract/content/StandardContentLayouts.js.map +1 -1
  154. package/lib/esm/appui-abstract/dialogs/DialogItem.d.ts +76 -76
  155. package/lib/esm/appui-abstract/dialogs/DialogItem.js +63 -63
  156. package/lib/esm/appui-abstract/dialogs/UiDataProvider.d.ts +55 -55
  157. package/lib/esm/appui-abstract/dialogs/UiDataProvider.js +61 -61
  158. package/lib/esm/appui-abstract/dialogs/UiLayoutDataProvider.d.ts +97 -97
  159. package/lib/esm/appui-abstract/dialogs/UiLayoutDataProvider.js +171 -170
  160. package/lib/esm/appui-abstract/dialogs/UiLayoutDataProvider.js.map +1 -1
  161. package/lib/esm/appui-abstract/items/AbstractItemProps.d.ts +53 -53
  162. package/lib/esm/appui-abstract/items/AbstractItemProps.d.ts.map +1 -1
  163. package/lib/esm/appui-abstract/items/AbstractItemProps.js +8 -8
  164. package/lib/esm/appui-abstract/items/AbstractMenuItemProps.d.ts +20 -20
  165. package/lib/esm/appui-abstract/items/AbstractMenuItemProps.js +8 -8
  166. package/lib/esm/appui-abstract/items/AbstractToolbarProps.d.ts +13 -13
  167. package/lib/esm/appui-abstract/items/AbstractToolbarProps.js +8 -8
  168. package/lib/esm/appui-abstract/items/BadgeType.d.ts +14 -14
  169. package/lib/esm/appui-abstract/items/BadgeType.js +19 -19
  170. package/lib/esm/appui-abstract/items/ConditionalBooleanValue.d.ts +27 -27
  171. package/lib/esm/appui-abstract/items/ConditionalBooleanValue.js +56 -56
  172. package/lib/esm/appui-abstract/items/ConditionalStringValue.d.ts +29 -29
  173. package/lib/esm/appui-abstract/items/ConditionalStringValue.js +58 -58
  174. package/lib/esm/appui-abstract/items/ProvidedItem.d.ts +11 -11
  175. package/lib/esm/appui-abstract/items/ProvidedItem.js +8 -8
  176. package/lib/esm/appui-abstract/items/RelativePosition.d.ts +18 -18
  177. package/lib/esm/appui-abstract/items/RelativePosition.js +23 -23
  178. package/lib/esm/appui-abstract/items/StageUsage.d.ts +16 -16
  179. package/lib/esm/appui-abstract/items/StageUsage.js +21 -21
  180. package/lib/esm/appui-abstract/notification/MessagePresenter.d.ts +42 -42
  181. package/lib/esm/appui-abstract/notification/MessagePresenter.js +21 -21
  182. package/lib/esm/appui-abstract/notification/MessageSeverity.d.ts +15 -15
  183. package/lib/esm/appui-abstract/notification/MessageSeverity.js +20 -20
  184. package/lib/esm/appui-abstract/properties/Description.d.ts +127 -127
  185. package/lib/esm/appui-abstract/properties/Description.js +192 -192
  186. package/lib/esm/appui-abstract/properties/EditorParams.d.ts +260 -260
  187. package/lib/esm/appui-abstract/properties/EditorParams.d.ts.map +1 -1
  188. package/lib/esm/appui-abstract/properties/EditorParams.js +97 -97
  189. package/lib/esm/appui-abstract/properties/PrimitiveTypes.d.ts +60 -60
  190. package/lib/esm/appui-abstract/properties/PrimitiveTypes.js +8 -8
  191. package/lib/esm/appui-abstract/properties/Record.d.ts +57 -57
  192. package/lib/esm/appui-abstract/properties/Record.js +74 -74
  193. package/lib/esm/appui-abstract/properties/StandardEditorNames.d.ts +22 -22
  194. package/lib/esm/appui-abstract/properties/StandardEditorNames.js +27 -27
  195. package/lib/esm/appui-abstract/properties/StandardTypeNames.d.ts +30 -30
  196. package/lib/esm/appui-abstract/properties/StandardTypeNames.js +36 -36
  197. package/lib/esm/appui-abstract/properties/Value.d.ts +49 -49
  198. package/lib/esm/appui-abstract/properties/Value.d.ts.map +1 -1
  199. package/lib/esm/appui-abstract/properties/Value.js +17 -17
  200. package/lib/esm/appui-abstract/quantity/BaseQuantityDescription.d.ts +22 -22
  201. package/lib/esm/appui-abstract/quantity/BaseQuantityDescription.js +44 -44
  202. package/lib/esm/appui-abstract/statusbar/StatusBarItem.d.ts +128 -128
  203. package/lib/esm/appui-abstract/statusbar/StatusBarItem.d.ts.map +1 -1
  204. package/lib/esm/appui-abstract/statusbar/StatusBarItem.js +81 -80
  205. package/lib/esm/appui-abstract/statusbar/StatusBarItem.js.map +1 -1
  206. package/lib/esm/appui-abstract/statusbar/StatusBarItemsManager.d.ts +39 -39
  207. package/lib/esm/appui-abstract/statusbar/StatusBarItemsManager.js +131 -131
  208. package/lib/esm/appui-abstract/statusbar/StatusBarItemsManager.js.map +1 -1
  209. package/lib/esm/appui-abstract/toolbars/ToolbarItem.d.ts +121 -121
  210. package/lib/esm/appui-abstract/toolbars/ToolbarItem.d.ts.map +1 -1
  211. package/lib/esm/appui-abstract/toolbars/ToolbarItem.js +61 -60
  212. package/lib/esm/appui-abstract/toolbars/ToolbarItem.js.map +1 -1
  213. package/lib/esm/appui-abstract/toolbars/ToolbarItemsManager.d.ts +45 -45
  214. package/lib/esm/appui-abstract/toolbars/ToolbarItemsManager.js +231 -231
  215. package/lib/esm/appui-abstract/toolbars/ToolbarItemsManager.js.map +1 -1
  216. package/lib/esm/appui-abstract/utils/IconSpecUtilities.d.ts +29 -29
  217. package/lib/esm/appui-abstract/utils/IconSpecUtilities.js +48 -47
  218. package/lib/esm/appui-abstract/utils/IconSpecUtilities.js.map +1 -1
  219. package/lib/esm/appui-abstract/utils/PointProps.d.ts +10 -10
  220. package/lib/esm/appui-abstract/utils/PointProps.js +8 -8
  221. package/lib/esm/appui-abstract/utils/UiError.d.ts +12 -12
  222. package/lib/esm/appui-abstract/utils/UiError.js +18 -18
  223. package/lib/esm/appui-abstract/utils/UiEvent.d.ts +9 -9
  224. package/lib/esm/appui-abstract/utils/UiEvent.js +13 -13
  225. package/lib/esm/appui-abstract/utils/UiEventDispatcher.d.ts +46 -46
  226. package/lib/esm/appui-abstract/utils/UiEventDispatcher.js +126 -126
  227. package/lib/esm/appui-abstract/utils/callbacks.d.ts +20 -20
  228. package/lib/esm/appui-abstract/utils/callbacks.d.ts.map +1 -1
  229. package/lib/esm/appui-abstract/utils/callbacks.js +8 -8
  230. package/lib/esm/appui-abstract/utils/filter/charCode.d.ts +416 -416
  231. package/lib/esm/appui-abstract/utils/filter/charCode.js +5 -5
  232. package/lib/esm/appui-abstract/utils/filter/filters.d.ts +98 -98
  233. package/lib/esm/appui-abstract/utils/filter/filters.d.ts.map +1 -1
  234. package/lib/esm/appui-abstract/utils/filter/filters.js +694 -694
  235. package/lib/esm/appui-abstract/utils/filter/filters.js.map +1 -1
  236. package/lib/esm/appui-abstract/utils/filter/map.d.ts +59 -59
  237. package/lib/esm/appui-abstract/utils/filter/map.js +397 -397
  238. package/lib/esm/appui-abstract/utils/filter/map.js.map +1 -1
  239. package/lib/esm/appui-abstract/utils/filter/strings.d.ts +20 -20
  240. package/lib/esm/appui-abstract/utils/filter/strings.js +70 -70
  241. package/lib/esm/appui-abstract/utils/filter/strings.js.map +1 -1
  242. package/lib/esm/appui-abstract/utils/isLetter.d.ts +9 -9
  243. package/lib/esm/appui-abstract/utils/isLetter.js +15 -15
  244. package/lib/esm/appui-abstract/utils/misc.d.ts +11 -11
  245. package/lib/esm/appui-abstract/utils/misc.js +31 -31
  246. package/lib/esm/appui-abstract/widget/AbstractWidgetProps.d.ts +86 -86
  247. package/lib/esm/appui-abstract/widget/AbstractWidgetProps.js +8 -8
  248. package/lib/esm/appui-abstract/widget/StagePanel.d.ts +36 -36
  249. package/lib/esm/appui-abstract/widget/StagePanel.js +43 -43
  250. package/lib/esm/appui-abstract/widget/WidgetState.d.ts +19 -19
  251. package/lib/esm/appui-abstract/widget/WidgetState.js +24 -24
  252. package/lib/esm/appui-abstract.d.ts +103 -103
  253. package/lib/esm/appui-abstract.js +107 -107
  254. package/package.json +6 -6
@@ -1,132 +1,132 @@
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
- }
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
132
  //# sourceMappingURL=StatusBarItemsManager.js.map
@@ -1 +1 @@
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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AC,WAAW,CAAC,EAAE;gBACnD,IAAI,KAAK,YAAY,uBAAuB,EAAE;oBAC5C,uBAAuB;oBACvB,IAAI,uBAAuB,CAAC,YAAY,CAAC,KAAK,EAAE,QAAQ,CAAC;wBACvD,cAAc,GAAG,IAAI,CAAC;iBACzB;qBAAM,0BAA0B,CAAC,IAAI,KAAK,YAAY,sBAAsB,EAAE;oBAC7E,uBAAuB;oBACvB,IAAI,sBAAsB,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","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 extends any>(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
+ {"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,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC,CAAC;AASF;;;GAGG;AACH,MAAM,OAAO,qBAAqB;IAGhC,YAAY,KAA0C;QAF9C,WAAM,GAAuC,EAAE,CAAC;QAOxD;;WAEG;QACa,mBAAc,GAAG,IAAI,OAAO,EAA6C,CAAC;QAPxF,IAAI,KAAK;YACP,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;IAC/C,CAAC;IAOO,iBAAiB,CAAC,KAAyC,EAAE,iBAA0B,EAAE,eAAwB;Q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Y,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 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"]}
@@ -1,122 +1,122 @@
1
- /** @packageDocumentation
2
- * @module Toolbar
3
- */
4
- import { BadgeType } from "../items/BadgeType";
5
- import { ConditionalBooleanValue } from "../items/ConditionalBooleanValue";
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
- }
28
- /** Describes the data needed to insert a UI items into an existing set of UI items.
29
- * @public
30
- */
31
- export interface ToolbarItem extends ProvidedItem {
32
- /** can be used by application to store miscellaneous data. */
33
- readonly applicationData?: any;
34
- /** Describes badge. Renders no badge if not specified. */
35
- readonly badgeType?: BadgeType;
36
- /** Optional description */
37
- readonly description?: string | ConditionalStringValue;
38
- /** Require uniqueId for the item. To ensure uniqueness it is suggested that a namespace prefix of the extension name be used. */
39
- readonly id: string;
40
- /** optional data to used by item implementor. */
41
- readonly internalData?: Map<string, any>;
42
- /** Defines if the item is active (shown with an active stripe/bar). */
43
- readonly isActive?: boolean;
44
- /** Describes if the item is visible or hidden. The default is for the item to be visible. */
45
- readonly isHidden?: boolean | ConditionalBooleanValue;
46
- /** Describes if the item is enabled or disabled. The default is for the item to be enabled. */
47
- readonly isDisabled?: boolean | ConditionalBooleanValue;
48
- /** Describes if the item should appear pressed (used for displaying toggle state). This property is NOT used by Toolbars
49
- * constructed using the `ToolbarWithOverflow` component, which are used in AppUi 2.0 and later. For these later toolbars
50
- * the icon is usually changed to denote the state of a toggle.
51
- */
52
- readonly isPressed?: boolean;
53
- /** Specifies the item's grouping value. Items are sorted by group and then item priority. When
54
- * group priority changes a separator is inserted. It is recommended using values 10 through 100, incrementing by 10. This
55
- * allows extensions enough gaps to insert their own groups. If the value is not specified a groupPriority of 0 is used.
56
- */
57
- readonly groupPriority?: number;
58
- /** Priority within a toolbar or group. */
59
- readonly itemPriority: number;
60
- /** Optional parent tool group to add tool. */
61
- readonly parentToolGroupId?: string;
62
- }
63
- /** Describes the data needed to insert an action button into a toolbar.
64
- * @public
65
- */
66
- export interface ActionButton extends ToolbarItem {
67
- /** Name of icon WebFont entry or if specifying an imported SVG symbol use "webSvg:" prefix to imported symbol Id. */
68
- readonly icon: string | ConditionalStringValue;
69
- /** label, shown as tool tip on a button or an item label in a group. */
70
- readonly label: string | ConditionalStringValue;
71
- /** function to run when the button is pressed. */
72
- readonly execute: () => void;
73
- }
74
- /** Describes the data needed to insert a group button into a toolbar.
75
- * @public
76
- */
77
- export interface GroupButton extends ToolbarItem {
78
- /** Name of icon WebFont entry or if specifying an imported SVG symbol use "webSvg:" prefix to imported symbol Id. */
79
- readonly icon: string | ConditionalStringValue;
80
- /** label, shown as tool tip on group button or a group button label in a group panel. */
81
- readonly label: string | ConditionalStringValue;
82
- /** label shown as the title in at top of group panel. */
83
- readonly panelLabel?: string | ConditionalStringValue;
84
- /** children of the group */
85
- readonly items: ReadonlyArray<ActionButton | GroupButton>;
86
- }
87
- /** Describes the data needed to insert a custom button into a toolbar.
88
- * @public
89
- */
90
- export interface CustomButtonDefinition extends ToolbarItem {
91
- /** Name of icon WebFont entry or if specifying an imported SVG symbol use "webSvg:" prefix to imported symbol Id. */
92
- readonly icon?: string | ConditionalStringValue;
93
- /** label, shown as tool tip on group button or a group button label in a group panel. */
94
- readonly label?: string | ConditionalStringValue;
95
- /** parameter that marks data as being a custom definition. */
96
- readonly isCustom: true;
97
- }
98
- /** Any Button Type that can be inserted into a toolbar.
99
- * @public
100
- */
101
- export declare 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 declare type ToolbarItemId = CommonToolbarItem["id"];
107
- /** Helper class to create Abstract StatusBar Item definitions.
108
- * @public
109
- */
110
- export declare class ToolbarItemUtilities {
111
- /** Creates an Action Button */
112
- static createActionButton: (id: string, itemPriority: number, icon: string | ConditionalStringValue, label: string | ConditionalStringValue, execute: () => void, overrides?: Partial<ActionButton> | undefined) => ActionButton;
113
- /** Creates a Group button. */
114
- static createGroupButton: (id: string, itemPriority: number, icon: string | ConditionalStringValue, label: string | ConditionalStringValue, items: ReadonlyArray<ActionButton | GroupButton>, overrides?: Partial<GroupButton> | undefined) => GroupButton;
115
- /** ActionButton type guard. */
116
- static isActionButton(item: CommonToolbarItem): item is ActionButton;
117
- /** GroupButton type guard. */
118
- static isGroupButton(item: CommonToolbarItem): item is GroupButton;
119
- /** CustomButtonDefinition type guard. */
120
- static isCustomDefinition(item: CommonToolbarItem): item is CustomButtonDefinition;
121
- }
1
+ /** @packageDocumentation
2
+ * @module Toolbar
3
+ */
4
+ import { BadgeType } from "../items/BadgeType";
5
+ import { ConditionalBooleanValue } from "../items/ConditionalBooleanValue";
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
+ }
28
+ /** Describes the data needed to insert a UI items into an existing set of UI items.
29
+ * @public
30
+ */
31
+ export interface ToolbarItem extends ProvidedItem {
32
+ /** can be used by application to store miscellaneous data. */
33
+ readonly applicationData?: any;
34
+ /** Describes badge. Renders no badge if not specified. */
35
+ readonly badgeType?: BadgeType;
36
+ /** Optional description */
37
+ readonly description?: string | ConditionalStringValue;
38
+ /** Require uniqueId for the item. To ensure uniqueness it is suggested that a namespace prefix of the extension name be used. */
39
+ readonly id: string;
40
+ /** optional data to used by item implementor. */
41
+ readonly internalData?: Map<string, any>;
42
+ /** Defines if the item is active (shown with an active stripe/bar). */
43
+ readonly isActive?: boolean;
44
+ /** Describes if the item is visible or hidden. The default is for the item to be visible. */
45
+ readonly isHidden?: boolean | ConditionalBooleanValue;
46
+ /** Describes if the item is enabled or disabled. The default is for the item to be enabled. */
47
+ readonly isDisabled?: boolean | ConditionalBooleanValue;
48
+ /** Describes if the item should appear pressed (used for displaying toggle state). This property is NOT used by Toolbars
49
+ * constructed using the `ToolbarWithOverflow` component, which are used in AppUi 2.0 and later. For these later toolbars
50
+ * the icon is usually changed to denote the state of a toggle.
51
+ */
52
+ readonly isPressed?: boolean;
53
+ /** Specifies the item's grouping value. Items are sorted by group and then item priority. When
54
+ * group priority changes a separator is inserted. It is recommended using values 10 through 100, incrementing by 10. This
55
+ * allows extensions enough gaps to insert their own groups. If the value is not specified a groupPriority of 0 is used.
56
+ */
57
+ readonly groupPriority?: number;
58
+ /** Priority within a toolbar or group. */
59
+ readonly itemPriority: number;
60
+ /** Optional parent tool group to add tool. */
61
+ readonly parentToolGroupId?: string;
62
+ }
63
+ /** Describes the data needed to insert an action button into a toolbar.
64
+ * @public
65
+ */
66
+ export interface ActionButton extends ToolbarItem {
67
+ /** Name of icon WebFont entry or if specifying an imported SVG symbol use "webSvg:" prefix to imported symbol Id. */
68
+ readonly icon: string | ConditionalStringValue;
69
+ /** label, shown as tool tip on a button or an item label in a group. */
70
+ readonly label: string | ConditionalStringValue;
71
+ /** function to run when the button is pressed. */
72
+ readonly execute: () => void;
73
+ }
74
+ /** Describes the data needed to insert a group button into a toolbar.
75
+ * @public
76
+ */
77
+ export interface GroupButton extends ToolbarItem {
78
+ /** Name of icon WebFont entry or if specifying an imported SVG symbol use "webSvg:" prefix to imported symbol Id. */
79
+ readonly icon: string | ConditionalStringValue;
80
+ /** label, shown as tool tip on group button or a group button label in a group panel. */
81
+ readonly label: string | ConditionalStringValue;
82
+ /** label shown as the title in at top of group panel. */
83
+ readonly panelLabel?: string | ConditionalStringValue;
84
+ /** children of the group */
85
+ readonly items: ReadonlyArray<ActionButton | GroupButton>;
86
+ }
87
+ /** Describes the data needed to insert a custom button into a toolbar.
88
+ * @public
89
+ */
90
+ export interface CustomButtonDefinition extends ToolbarItem {
91
+ /** Name of icon WebFont entry or if specifying an imported SVG symbol use "webSvg:" prefix to imported symbol Id. */
92
+ readonly icon?: string | ConditionalStringValue;
93
+ /** label, shown as tool tip on group button or a group button label in a group panel. */
94
+ readonly label?: string | ConditionalStringValue;
95
+ /** parameter that marks data as being a custom definition. */
96
+ readonly isCustom: true;
97
+ }
98
+ /** Any Button Type that can be inserted into a toolbar.
99
+ * @public
100
+ */
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"];
107
+ /** Helper class to create Abstract StatusBar Item definitions.
108
+ * @public
109
+ */
110
+ export declare class ToolbarItemUtilities {
111
+ /** Creates an Action Button */
112
+ static createActionButton: (id: string, itemPriority: number, icon: string | ConditionalStringValue, label: string | ConditionalStringValue, execute: () => void, overrides?: Partial<ActionButton>) => ActionButton;
113
+ /** Creates a Group button. */
114
+ static createGroupButton: (id: string, itemPriority: number, icon: string | ConditionalStringValue, label: string | ConditionalStringValue, items: ReadonlyArray<ActionButton | GroupButton>, overrides?: Partial<GroupButton>) => GroupButton;
115
+ /** ActionButton type guard. */
116
+ static isActionButton(item: CommonToolbarItem): item is ActionButton;
117
+ /** GroupButton type guard. */
118
+ static isGroupButton(item: CommonToolbarItem): item is GroupButton;
119
+ /** CustomButtonDefinition type guard. */
120
+ static isCustomDefinition(item: CommonToolbarItem): item is CustomButtonDefinition;
121
+ }
122
122
  //# sourceMappingURL=ToolbarItem.d.ts.map
@@ -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;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD;;;GAGG;AACH,oBAAY,YAAY;IACtB,4GAA4G;IAC5G,mBAAmB,IAAI;IACvB,iFAAiF;IACjF,cAAc,IAAI;CACnB;AAED;;;GAGG;AACH,oBAAY,kBAAkB;IAC5B,0BAA0B;IAC1B,UAAU,IAAI;IACd,wBAAwB;IACxB,QAAQ,IAAI;CACb;AAED;;GAEG;AACH,MAAM,WAAW,WAAY,SAAQ,YAAY;IAC/C,8DAA8D;IAC9D,QAAQ,CAAC,eAAe,CAAC,EAAE,GAAG,CAAC;IAC/B,0DAA0D;IAC1D,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC;IAC/B,2BAA2B;IAC3B,QAAQ,CAAC,WAAW,C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