@sapui5/sap.ui.vk 1.136.1 → 1.136.3

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.
Files changed (185) hide show
  1. package/package.json +1 -1
  2. package/src/sap/ui/vk/.library +1 -1
  3. package/src/sap/ui/vk/AnimationPlayback.js +1 -1
  4. package/src/sap/ui/vk/AnimationPlayer.js +1 -1
  5. package/src/sap/ui/vk/AnimationSequence.js +1 -1
  6. package/src/sap/ui/vk/AnimationTimeSlider.js +1 -1
  7. package/src/sap/ui/vk/AnimationTrack.js +1 -1
  8. package/src/sap/ui/vk/Annotation.js +1 -1
  9. package/src/sap/ui/vk/BaseNodeProxy.js +1 -1
  10. package/src/sap/ui/vk/Camera.js +1 -1
  11. package/src/sap/ui/vk/ContentConnector.js +19 -15
  12. package/src/sap/ui/vk/ContentManager.js +1 -1
  13. package/src/sap/ui/vk/ContentResource.js +3 -2
  14. package/src/sap/ui/vk/Core.js +1 -1
  15. package/src/sap/ui/vk/DownloadManager.js +1 -1
  16. package/src/sap/ui/vk/DrawerToolbar.js +140 -19
  17. package/src/sap/ui/vk/DrawerToolbarButton.js +5 -1
  18. package/src/sap/ui/vk/DvlException.js +1 -1
  19. package/src/sap/ui/vk/FlexibleControl.js +1 -1
  20. package/src/sap/ui/vk/FlexibleControlLayoutData.js +1 -1
  21. package/src/sap/ui/vk/Highlight.js +1 -1
  22. package/src/sap/ui/vk/ImageContentManager.js +1 -1
  23. package/src/sap/ui/vk/JointUtils.js +1 -1
  24. package/src/sap/ui/vk/LayerProxy.js +1 -1
  25. package/src/sap/ui/vk/Loco.js +1 -1
  26. package/src/sap/ui/vk/Material.js +1 -1
  27. package/src/sap/ui/vk/NativeViewport.js +1 -1
  28. package/src/sap/ui/vk/NodeHierarchy.js +1 -1
  29. package/src/sap/ui/vk/NodeProxy.js +1 -1
  30. package/src/sap/ui/vk/NodeUtils.js +1 -1
  31. package/src/sap/ui/vk/Notifications.js +1 -1
  32. package/src/sap/ui/vk/OrthographicCamera.js +1 -1
  33. package/src/sap/ui/vk/PerspectiveCamera.js +1 -1
  34. package/src/sap/ui/vk/ProgressIndicator.js +1 -1
  35. package/src/sap/ui/vk/RedlineCollaboration.js +1 -1
  36. package/src/sap/ui/vk/RedlineConversation.js +1 -1
  37. package/src/sap/ui/vk/RedlineDesign.js +1 -1
  38. package/src/sap/ui/vk/RedlineElement.js +1 -1
  39. package/src/sap/ui/vk/RedlineElementComment.js +1 -1
  40. package/src/sap/ui/vk/RedlineElementEllipse.js +1 -1
  41. package/src/sap/ui/vk/RedlineElementFreehand.js +1 -1
  42. package/src/sap/ui/vk/RedlineElementLine.js +1 -1
  43. package/src/sap/ui/vk/RedlineElementRectangle.js +1 -1
  44. package/src/sap/ui/vk/RedlineElementText.js +1 -1
  45. package/src/sap/ui/vk/RedlineSurface.js +1 -1
  46. package/src/sap/ui/vk/SafeArea.js +1 -1
  47. package/src/sap/ui/vk/Scene.js +16 -1
  48. package/src/sap/ui/vk/SceneTree.js +3 -4
  49. package/src/sap/ui/vk/StepNavigation.js +1 -2
  50. package/src/sap/ui/vk/Texture.js +1 -1
  51. package/src/sap/ui/vk/ToggleMenuButton.js +1 -1
  52. package/src/sap/ui/vk/ToggleMenuItem.js +1 -1
  53. package/src/sap/ui/vk/Toolbar.js +68 -102
  54. package/src/sap/ui/vk/View.js +1 -1
  55. package/src/sap/ui/vk/ViewGallery.js +1 -1
  56. package/src/sap/ui/vk/ViewGalleryThumbnail.js +1 -1
  57. package/src/sap/ui/vk/ViewGroup.js +1 -1
  58. package/src/sap/ui/vk/ViewManager.js +1 -1
  59. package/src/sap/ui/vk/ViewStateManager.js +1 -1
  60. package/src/sap/ui/vk/ViewStateManagerBase.js +1 -1
  61. package/src/sap/ui/vk/Viewer.js +469 -234
  62. package/src/sap/ui/vk/Viewport.js +1 -1
  63. package/src/sap/ui/vk/ViewportBase.js +1 -1
  64. package/src/sap/ui/vk/dvl/BaseNodeProxy.js +1 -1
  65. package/src/sap/ui/vk/dvl/ContentManager.js +1 -1
  66. package/src/sap/ui/vk/dvl/GraphicsCore.js +1 -1
  67. package/src/sap/ui/vk/dvl/LayerProxy.js +1 -1
  68. package/src/sap/ui/vk/dvl/NodeHierarchy.js +1 -1
  69. package/src/sap/ui/vk/dvl/NodeProxy.js +1 -1
  70. package/src/sap/ui/vk/dvl/Scene.js +1 -1
  71. package/src/sap/ui/vk/dvl/ViewStateManager.js +1 -1
  72. package/src/sap/ui/vk/dvl/Viewport.js +2 -2
  73. package/src/sap/ui/vk/ecad/ElementsPanel.js +984 -212
  74. package/src/sap/ui/vk/ecad/LayersPanel.js +283 -145
  75. package/src/sap/ui/vk/i18n/messagebundle.properties +64 -37
  76. package/src/sap/ui/vk/i18n/messagebundle_id.properties +1 -1
  77. package/src/sap/ui/vk/i18n/messagebundle_iw.properties +1 -1
  78. package/src/sap/ui/vk/i18n/messagebundle_ja.properties +2 -2
  79. package/src/sap/ui/vk/i18n/messagebundle_no.properties +1 -1
  80. package/src/sap/ui/vk/i18n/messagebundle_vi.properties +1 -1
  81. package/src/sap/ui/vk/library.js +11 -4
  82. package/src/sap/ui/vk/measurements/Angle.js +1 -1
  83. package/src/sap/ui/vk/measurements/Area.js +1 -1
  84. package/src/sap/ui/vk/measurements/Distance.js +1 -1
  85. package/src/sap/ui/vk/measurements/Edge.js +1 -1
  86. package/src/sap/ui/vk/measurements/Face.js +1 -1
  87. package/src/sap/ui/vk/measurements/Feature.js +1 -1
  88. package/src/sap/ui/vk/measurements/Vertex.js +1 -1
  89. package/src/sap/ui/vk/pdf/ContentManager.js +1 -1
  90. package/src/sap/ui/vk/pdf/Viewport.js +5 -8
  91. package/src/sap/ui/vk/svg/BaseNodeProxy.js +1 -1
  92. package/src/sap/ui/vk/svg/ContentDeliveryService.js +1 -1
  93. package/src/sap/ui/vk/svg/ContentManager.js +3 -1
  94. package/src/sap/ui/vk/svg/Element.js +1 -0
  95. package/src/sap/ui/vk/svg/NodeHierarchy.js +1 -1
  96. package/src/sap/ui/vk/svg/NodeProxy.js +1 -1
  97. package/src/sap/ui/vk/svg/OrthographicCamera.js +1 -1
  98. package/src/sap/ui/vk/svg/Scene.js +1 -1
  99. package/src/sap/ui/vk/svg/SceneBuilder.js +44 -8
  100. package/src/sap/ui/vk/svg/ViewStateManager.js +2 -2
  101. package/src/sap/ui/vk/svg/Viewport.js +192 -2
  102. package/src/sap/ui/vk/themes/base/fonts/SAP-VE-icons-bold-v1.8.woff2 +0 -0
  103. package/src/sap/ui/vk/themes/base/fonts/SAP-VE-icons-regular-v1.8.woff2 +0 -0
  104. package/src/sap/ui/vk/themes/base/library.source.less +1 -1
  105. package/src/sap/ui/vk/themes/sap_belize_base/library.source.less +1 -1
  106. package/src/sap/ui/vk/themes/sap_bluecrystal_base/library.source.less +1 -1
  107. package/src/sap/ui/vk/themes/sap_hcb/library.source.less +1 -1
  108. package/src/sap/ui/vk/themes/sap_horizon/library.source.less +0 -5
  109. package/src/sap/ui/vk/themes/sap_horizon_dark/library.source.less +0 -5
  110. package/src/sap/ui/vk/themes/sap_horizon_hcb/library.source.less +0 -5
  111. package/src/sap/ui/vk/themes/sap_horizon_hcw/library.source.less +0 -5
  112. package/src/sap/ui/vk/thirdparty/pdf.worker.js +1 -1
  113. package/src/sap/ui/vk/threejs/AnimationHelper.js +1 -1
  114. package/src/sap/ui/vk/threejs/BaseNodeProxy.js +1 -1
  115. package/src/sap/ui/vk/threejs/Billboard.js +1 -1
  116. package/src/sap/ui/vk/threejs/Callout.js +1 -1
  117. package/src/sap/ui/vk/threejs/ContentDeliveryService.js +1 -1
  118. package/src/sap/ui/vk/threejs/ContentManager.js +1 -1
  119. package/src/sap/ui/vk/threejs/DetailView.js +1 -1
  120. package/src/sap/ui/vk/threejs/HighlightPlayer.js +1 -1
  121. package/src/sap/ui/vk/threejs/Material.js +1 -1
  122. package/src/sap/ui/vk/threejs/NodeHierarchy.js +1 -1
  123. package/src/sap/ui/vk/threejs/NodeProxy.js +1 -1
  124. package/src/sap/ui/vk/threejs/OrthographicCamera.js +1 -1
  125. package/src/sap/ui/vk/threejs/PerspectiveCamera.js +1 -1
  126. package/src/sap/ui/vk/threejs/PointCloudGroup.js +1 -1
  127. package/src/sap/ui/vk/threejs/Scene.js +1 -1
  128. package/src/sap/ui/vk/threejs/SceneBuilder.js +12 -1
  129. package/src/sap/ui/vk/threejs/Texture.js +1 -1
  130. package/src/sap/ui/vk/threejs/Thrustline.js +1 -1
  131. package/src/sap/ui/vk/threejs/ViewStateManager.js +1 -1
  132. package/src/sap/ui/vk/threejs/Viewport.js +1 -1
  133. package/src/sap/ui/vk/threejs/v2/ViewStateManager.js +1 -1
  134. package/src/sap/ui/vk/tools/AnchorPointTool.js +1 -1
  135. package/src/sap/ui/vk/tools/AnchorPointToolGizmo.js +1 -1
  136. package/src/sap/ui/vk/tools/AxisAngleRotationTool.js +1 -1
  137. package/src/sap/ui/vk/tools/AxisAngleRotationToolGizmo.js +1 -1
  138. package/src/sap/ui/vk/tools/CreateEllipseTool.js +1 -1
  139. package/src/sap/ui/vk/tools/CreateEllipseToolGizmo.js +1 -1
  140. package/src/sap/ui/vk/tools/CreateParametricGizmo.js +1 -1
  141. package/src/sap/ui/vk/tools/CreatePathTool.js +1 -1
  142. package/src/sap/ui/vk/tools/CreatePathToolGizmo.js +1 -1
  143. package/src/sap/ui/vk/tools/CreateRectangleTool.js +1 -1
  144. package/src/sap/ui/vk/tools/CreateRectangleToolGizmo.js +1 -1
  145. package/src/sap/ui/vk/tools/CreateTextTool.js +1 -1
  146. package/src/sap/ui/vk/tools/CreateTextToolGizmo.js +1 -1
  147. package/src/sap/ui/vk/tools/CrossSectionTool.js +1 -1
  148. package/src/sap/ui/vk/tools/CrossSectionToolGizmo.js +1 -1
  149. package/src/sap/ui/vk/tools/DuplicateSvgElementTool.js +1 -1
  150. package/src/sap/ui/vk/tools/DuplicateSvgElementToolGizmo.js +1 -1
  151. package/src/sap/ui/vk/tools/ExplodeTool.js +1 -1
  152. package/src/sap/ui/vk/tools/ExplodeToolGizmo.js +1 -1
  153. package/src/sap/ui/vk/tools/Gizmo.js +1 -1
  154. package/src/sap/ui/vk/tools/HitTestTool.js +1 -1
  155. package/src/sap/ui/vk/tools/MoveTool.js +1 -1
  156. package/src/sap/ui/vk/tools/MoveToolGizmo.js +1 -1
  157. package/src/sap/ui/vk/tools/PointCloudSelectionTool.js +1 -1
  158. package/src/sap/ui/vk/tools/PointCloudSelectionToolGizmo.js +1 -1
  159. package/src/sap/ui/vk/tools/RectSelectTool.js +1 -1
  160. package/src/sap/ui/vk/tools/RedlineTool.js +1 -1
  161. package/src/sap/ui/vk/tools/RedlineToolGizmo.js +1 -1
  162. package/src/sap/ui/vk/tools/RotateOrbitTool.js +1 -1
  163. package/src/sap/ui/vk/tools/RotateTool.js +1 -1
  164. package/src/sap/ui/vk/tools/RotateToolGizmo.js +1 -1
  165. package/src/sap/ui/vk/tools/RotateTurntableTool.js +1 -1
  166. package/src/sap/ui/vk/tools/ScaleTool.js +1 -1
  167. package/src/sap/ui/vk/tools/ScaleToolGizmo.js +1 -1
  168. package/src/sap/ui/vk/tools/SceneOrientationTool.js +1 -1
  169. package/src/sap/ui/vk/tools/SceneOrientationToolGizmo.js +1 -1
  170. package/src/sap/ui/vk/tools/Tool.js +1 -1
  171. package/src/sap/ui/vk/tools/TooltipTool.js +1 -1
  172. package/src/sap/ui/vk/tools/TooltipToolGizmo.js +1 -1
  173. package/src/sap/ui/vk/tools/TooltipToolHandler.js +5 -0
  174. package/src/sap/ui/vk/tools/TransformSvgElementTool.js +1 -1
  175. package/src/sap/ui/vk/tools/TransformSvgElementToolGizmo.js +1 -1
  176. package/src/sap/ui/vk/totara/TotaraLoader.js +4 -0
  177. package/src/sap/ui/vk/ve/dvl.wasm +0 -0
  178. package/src/sap/ui/vk/ve/matai.js +1 -1
  179. package/src/sap/ui/vk/ve/matai.wasm +0 -0
  180. package/src/sap/ui/vk/ToolbarRenderer.js +0 -41
  181. package/src/sap/ui/vk/ViewerRenderer.js +0 -48
  182. package/src/sap/ui/vk/ecad/ElementsPanelRenderer.js +0 -41
  183. package/src/sap/ui/vk/ecad/LayersPanelRenderer.js +0 -41
  184. package/src/sap/ui/vk/themes/base/fonts/SAP-VE-icons-bold-v1.4.woff2 +0 -0
  185. package/src/sap/ui/vk/themes/base/fonts/SAP-VE-icons-regular-v1.4.woff2 +0 -0
@@ -7,58 +7,186 @@
7
7
 
8
8
  // Provides control sap.ui.vk.ecad.ElementsPanel
9
9
  sap.ui.define([
10
+ "sap/m/VBox",
10
11
  "sap/m/Button",
11
12
  "sap/m/SearchField",
12
13
  "sap/m/OverflowToolbar",
13
14
  "sap/m/ToolbarLayoutData",
14
15
  "sap/m/ToolbarSpacer",
15
- "sap/m/Text",
16
+ "sap/m/Label",
17
+ "sap/m/Input",
16
18
  "sap/m/Table",
19
+ "sap/m/table/ColumnWidthController",
20
+ "sap/m/table/columnmenu/Menu",
21
+ "sap/m/table/columnmenu/QuickGroup",
22
+ "sap/m/table/columnmenu/QuickGroupItem",
23
+ "sap/m/table/columnmenu/QuickSort",
24
+ "sap/m/table/columnmenu/QuickSortItem",
17
25
  "sap/m/Column",
18
26
  "sap/m/Sticky",
19
27
  "sap/m/ScrollContainer",
20
28
  "sap/m/ColumnListItem",
29
+ "sap/m/plugins/ColumnResizer",
30
+ "sap/m/MultiComboBox",
31
+ "sap/m/IllustratedMessage",
32
+ "sap/m/IllustratedMessageType",
33
+ "sap/m/p13n/Engine",
34
+ "sap/m/p13n/SelectionController",
35
+ "sap/m/p13n/GroupController",
36
+ "sap/m/p13n/SortController",
37
+ "sap/m/p13n/MetadataHelper",
38
+ "sap/f/DynamicPage",
39
+ "sap/f/DynamicPageTitle",
40
+ "sap/f/DynamicPageHeader",
41
+ "sap/ui/comp/filterbar/FilterBar",
42
+ "sap/ui/comp/filterbar/FilterGroupItem",
21
43
  "sap/ui/core/Core",
22
44
  "sap/ui/core/Control",
45
+ "sap/ui/core/CustomData",
23
46
  "sap/ui/core/Element",
24
47
  "sap/ui/core/Icon",
48
+ "sap/ui/core/Lib",
25
49
  "sap/ui/core/library",
26
- "sap/ui/core/ResizeHandler",
27
50
  "sap/ui/model/json/JSONModel",
51
+ "sap/ui/model/Filter",
52
+ "sap/ui/model/FilterOperator",
53
+ "sap/ui/model/Sorter",
28
54
  "../Core",
29
55
  "../library",
30
56
  "../ViewStateManager",
31
- "./ElementsPanelRenderer",
32
57
  "./VisibilityType",
33
- "../getResourceBundle"
58
+ "../getResourceBundle",
59
+ "sap/m/library"
34
60
  ], function(
61
+ VBox,
35
62
  Button,
36
63
  SearchField,
37
64
  OverflowToolbar,
38
65
  ToolbarLayoutData,
39
66
  ToolbarSpacer,
40
- Text,
67
+ Label,
68
+ Input,
41
69
  Table,
70
+ ColumnWidthController,
71
+ Menu,
72
+ QuickGroup,
73
+ QuickGroupItem,
74
+ QuickSort,
75
+ QuickSortItem,
42
76
  Column,
43
77
  Sticky,
44
78
  ScrollContainer,
45
79
  ColumnListItem,
80
+ ColumnResizer,
81
+ MultiComboBox,
82
+ IllustratedMessage,
83
+ IllustratedMessageType,
84
+ Engine,
85
+ SelectionController,
86
+ GroupController,
87
+ SortController,
88
+ MetadataHelper,
89
+ DynamicPage,
90
+ DynamicPageTitle,
91
+ DynamicPageHeader,
92
+ FilterBar,
93
+ FilterGroupItem,
46
94
  Core,
47
95
  Control,
96
+ CustomData,
48
97
  Element,
49
98
  Icon,
50
- Library,
51
- ResizeHandler,
99
+ Lib,
100
+ CoreLibrary,
52
101
  JSONModel,
102
+ Filter,
103
+ FilterOperator,
104
+ Sorter,
53
105
  vkCore,
54
106
  vkLibrary,
55
107
  ViewStateManager,
56
- ElementsPanelRenderer,
57
108
  VisibilityType,
58
- getResourceBundle
109
+ getResourceBundle,
110
+ SapMLibrary
59
111
  ) {
60
112
  "use strict";
61
113
 
114
+ const SortOrder = CoreLibrary.SortOrder;
115
+
116
+ const IconType = {
117
+ Hidden: "sap-icon://hide",
118
+ Partial: "sap-icon://vk-icons/partially-visible-element",
119
+ Visible: "sap-icon://show"
120
+ };
121
+
122
+ const ColumnName = {
123
+ RefDes: "refdes",
124
+ Type: "type",
125
+ Device: "deviceref",
126
+ Visibility: "visibility"
127
+ };
128
+
129
+ const ElementType = {
130
+ Component: "2",
131
+ Net: "4"
132
+ };
133
+
134
+ const ModelName = {
135
+ FilterSummary: "FilterSummary",
136
+ ElementType: "ElementType"
137
+ };
138
+
139
+ function getKeyForItem(element) {
140
+ return element.data("key");
141
+ }
142
+
143
+ function findItemByKey(items, key) {
144
+ return items.find(element => getKeyForItem(element) === key);
145
+ }
146
+
147
+ function isAncestorOf(ancestor, descendant) {
148
+ for (let current = descendant.getParent(); current != null; current = current.getParent()) {
149
+ if (current === ancestor) {
150
+ return true;
151
+ }
152
+ }
153
+ return false;
154
+ }
155
+
156
+ function getVisibility(element) {
157
+ if (element.hiddenParts.size === 0) {
158
+ return VisibilityType.Visible;
159
+ } else if (element.hiddenParts.size < element.parts.size) {
160
+ return VisibilityType.Partial;
161
+ }
162
+ return VisibilityType.Hidden;
163
+ }
164
+
165
+ function extractMetadata(nodeRef) {
166
+ const metadata = nodeRef?.userData?.metadata ?? {};
167
+ if (metadata.length != undefined) {
168
+ const map = new Map();
169
+ metadata.forEach(entry => {
170
+ if (entry.category === "ecad") {
171
+ map.set(entry.tag, entry.value);
172
+ }
173
+ });
174
+ return map;
175
+ }
176
+ return null;
177
+ }
178
+
179
+ function formatElementType(element) {
180
+ switch (element.type) {
181
+ case ElementType.Component:
182
+ return getResourceBundle().getText("ELEMENTS_PANEL_TYPE_COMPONENT");
183
+ case ElementType.Net:
184
+ return getResourceBundle().getText("ELEMENTS_PANEL_TYPE_NET");
185
+ default:
186
+ return getResourceBundle().getText("ELEMENTS_PANEL_TYPE_UNKNOWN");
187
+ }
188
+ }
189
+
62
190
  /**
63
191
  * Constructor for a new ElementsPanel.
64
192
  *
@@ -69,7 +197,7 @@ sap.ui.define([
69
197
  * @extends sap.ui.core.Control
70
198
  *
71
199
  * @author SAP SE
72
- * @version 1.136.1
200
+ * @version 1.136.3
73
201
  *
74
202
  * @constructor
75
203
  * @private
@@ -80,10 +208,21 @@ sap.ui.define([
80
208
  var ElementsPanel = Control.extend("sap.ui.vk.ecad.ElementsPanel", /** @lends sap.ui.vk.ecad.ElementsPanel.prototype */ {
81
209
  metadata: {
82
210
  library: "sap.ui.vk",
211
+ properties: {
212
+ width: {
213
+ type: "sap.ui.core.CSSSize",
214
+ defaultValue: "auto"
215
+ },
216
+ height: {
217
+ type: "sap.ui.core.CSSSize",
218
+ defaultValue: "100%"
219
+ }
220
+ },
83
221
  aggregations: {
84
222
  content: {
85
- type: "sap.m.ScrollContainer",
86
- multiple: false
223
+ type: "sap.ui.core.Control",
224
+ multiple: false,
225
+ visibility: "hidden"
87
226
  }
88
227
  },
89
228
  associations: {
@@ -112,224 +251,508 @@ sap.ui.define([
112
251
  }
113
252
  }
114
253
  },
115
-
116
- renderer: ElementsPanelRenderer,
117
-
254
+ renderer: {
255
+ apiVersion: 2,
256
+ render: function(oRm, oControl) {
257
+ oRm.openStart("div", oControl);
258
+ oRm.class("sapUiSizeCompact");
259
+ const width = oControl.getWidth();
260
+ if (width != null) {
261
+ oRm.style("width", width);
262
+ }
263
+ const height = oControl.getHeight();
264
+ if (height != null) {
265
+ oRm.style("height", height);
266
+ }
267
+ oRm.openEnd();
268
+ oRm.renderControl(oControl.getAggregation("content"));
269
+ oRm.close("div");
270
+ }
271
+ },
118
272
  constructor: function(sId, mSettings) {
119
273
  Control.apply(this, arguments);
120
274
  vkCore.observeAssociations(this);
121
275
  }
122
276
  });
123
277
 
124
- var iconHidden = "sap-icon://hide";
125
- var iconPartial = "sap-icon://hide";
126
- var iconVisible = "sap-icon://show";
127
-
128
278
  ElementsPanel.prototype.onSetViewStateManager = function(manager) {
129
279
  this._manager = manager;
280
+ manager.attachSelectionChanged(this._onViewportSelectionChanged, this);
130
281
  manager.attachVisibilityChanged(this._onVisibilityChanged, this);
131
- this.refresh();
282
+ this._refresh();
132
283
  };
133
284
 
134
285
  ElementsPanel.prototype.onUnsetViewStateManager = function(manager) {
135
286
  this._manager = null;
287
+ manager.detachSelectionChanged(this._onViewportSelectionChanged, this);
136
288
  manager.detachVisibilityChanged(this._onVisibilityChanged, this);
137
- this.refresh();
289
+ this._refresh();
138
290
  };
139
291
 
140
292
  ElementsPanel.prototype.onSetContentConnector = function(connector) {
141
293
  connector.attachContentReplaced(this._onContentReplaced, this);
142
- connector.attachContentChangesFinished(this._onContentChangesFinished, this);
143
294
  this._setContent(connector.getContent());
144
295
  };
145
296
 
146
297
  ElementsPanel.prototype.onUnsetContentConnector = function(connector) {
147
298
  this._setContent(null);
148
299
  connector.detachContentReplaced(this._onContentReplaced, this);
149
- connector.detachContentChangesFinished(this._onContentChangesFinished, this);
150
300
  };
151
301
 
152
302
  ElementsPanel.prototype.init = function() {
153
- if (Control.prototype.init) {
154
- Control.prototype.init.apply(this);
155
- }
156
- var that = this;
157
-
158
- this._showButton = new Button({
159
- enabled: false,
160
- iconFirst: true,
161
- icon: iconVisible,
162
- text: getResourceBundle().getText("ELEMENTS_PANEL_SHOW_BUTTON"),
163
- tooltip: getResourceBundle().getText("ELEMENTS_PANEL_SHOW_BUTTON_TOOLTIP"),
164
- press: this._onShowElements.bind(this)
165
- });
303
+ Control.prototype.init?.apply(this);
166
304
 
167
- this._hideButton = new Button({
168
- enabled: false,
169
- iconFirst: true,
170
- icon: iconHidden,
171
- text: getResourceBundle().getText("ELEMENTS_PANEL_HIDE_BUTTON"),
172
- tooltip: getResourceBundle().getText("ELEMENTS_PANEL_HIDE_BUTTON_TOOLTIP"),
173
- press: this._onHideElements.bind(this)
174
- });
305
+ const filterSummaryData = {
306
+ expandedFilterSummary: "",
307
+ snappedFilterSummary: ""
308
+ };
175
309
 
176
- this._settingsButton = new Button({
177
- icon: "sap-icon://settings",
178
- tooltip: getResourceBundle().getText("ELEMENTS_PANEL_SETTINGS_BUTTON_TOOLTIP"),
179
- press: this._onSettings.bind(this)
180
- });
310
+ const elementTypeData = [ElementType.Component, ElementType.Net];
311
+
312
+ this._scene = null;
313
+ this._model = new JSONModel();
314
+ this._skipEvent = false;
315
+ this._filterSummaryModel = new JSONModel(filterSummaryData);
316
+ this._elementTypeModel = new JSONModel(elementTypeData);
181
317
 
182
- this._table = new Table({
183
- mode: "MultiSelect",
184
- sticky: [Sticky.HeaderToolbar, Sticky.ColumnHeaders],
185
- selectionChange: this._onSelectionChanged.bind(this),
186
- headerToolbar: new OverflowToolbar({
187
- content: [
188
- this._showButton,
189
- this._hideButton,
190
- new ToolbarSpacer(),
191
- this._settingsButton
192
- ]
193
- }),
194
- columns: [
195
- new Column({
196
- hAlign: Library.TextAlign.Begin,
197
- header: new Text({ text: getResourceBundle().getText("ELEMENTS_PANEL_NAME_COLUMN") })
318
+ this.setModel(this._filterSummaryModel, ModelName.FilterSummary);
319
+ this.setModel(this._elementTypeModel, ModelName.ElementType);
198
320
 
199
- }),
200
- new Column({
201
- hAlign: Library.TextAlign.Begin,
202
- header: new Text({ text: getResourceBundle().getText("ELEMENTS_PANEL_TYPE_COLUMN") })
203
- }),
204
- new Column({
205
- hAlign: Library.TextAlign.Begin,
206
- header: new Text({
207
- text: getResourceBundle().getText("ELEMENTS_PANEL_DEVICE_REFERENCE_COLUMN")
208
- })
209
- }),
210
- new Column({
211
- hAlign: Library.TextAlign.Center,
212
- header: new Text({ text: getResourceBundle().getText("ELEMENTS_PANEL_VISIBLE_COLUMN") })
213
- })
214
- ],
215
- items: {
216
- path: "/",
217
- template: new ColumnListItem({
321
+ // show no data message before libraries loaded
322
+ this.setAggregation("content", new IllustratedMessage({
323
+ illustrationType: IllustratedMessageType.NoData,
324
+ enableVerticalResponsiveness: true
325
+ }));
326
+
327
+ this._promise = Promise.all([
328
+ Lib.load("sap.f"),
329
+ Lib.load("sap.ui.comp")
330
+ ]).then(() => new Promise(resolve => {
331
+ sap.ui.require([
332
+ "sap/f/DynamicPage",
333
+ "sap/f/DynamicPageTitle",
334
+ "sap/f/DynamicPageHeader",
335
+ "sap/ui/comp/filterbar/FilterBar",
336
+ "sap/ui/comp/filterbar/FilterGroupItem"
337
+ ], (
338
+ DynamicPage,
339
+ DynamicPageTitle,
340
+ DynamicPageHeader,
341
+ FilterBar,
342
+ FilterGroupItem
343
+ ) => {
344
+ this._showButton = new Button({
345
+ enabled: false,
346
+ icon: IconType.Visible,
347
+ text: getResourceBundle().getText("ELEMENTS_PANEL_SHOW_BUTTON"),
348
+ tooltip: getResourceBundle().getText("ELEMENTS_PANEL_SHOW_BUTTON_TOOLTIP"),
349
+ press: this._onShowElements.bind(this)
350
+ });
351
+
352
+ this._hideButton = new Button({
353
+ enabled: false,
354
+ icon: IconType.Hidden,
355
+ text: getResourceBundle().getText("ELEMENTS_PANEL_HIDE_BUTTON"),
356
+ tooltip: getResourceBundle().getText("ELEMENTS_PANEL_HIDE_BUTTON_TOOLTIP"),
357
+ press: this._onHideElements.bind(this)
358
+ });
359
+
360
+ this._settingsButton = new Button({
361
+ icon: "sap-icon://action-settings",
362
+ tooltip: getResourceBundle().getText("ELEMENTS_PANEL_SETTINGS_BUTTON_TOOLTIP"),
363
+ press: this._onSettings.bind(this)
364
+ });
365
+
366
+ // Menu with sorting
367
+ const sortMenu = new Menu({
368
+ showTableSettingsButton: true,
369
+ beforeOpen: this._onBeforeOpenColumnMenu.bind(this),
370
+ tableSettingsPressed: this._onSettings.bind(this),
371
+ quickActions: [
372
+ new QuickSort({
373
+ change: this._onSort.bind(this), items: [new QuickSortItem()]
374
+ })
375
+ ]
376
+ });
377
+
378
+ // Menu with sorting and grouping
379
+ const sortGroupMenu = new Menu({
380
+ showTableSettingsButton: true,
381
+ beforeOpen: this._onBeforeOpenColumnMenu.bind(this),
382
+ tableSettingsPressed: this._onSettings.bind(this),
383
+ quickActions: [
384
+ new QuickSort({
385
+ change: this._onSort.bind(this),
386
+ items: [new QuickSortItem()]
387
+ }),
388
+ new QuickGroup({
389
+ change: this._onGroup.bind(this),
390
+ items: [new QuickGroupItem()]
391
+ })
392
+ ]
393
+ });
394
+
395
+ this._rowTemplate = new ColumnListItem({
218
396
  vAlign: "Middle",
219
397
  cells: [
220
- new Text({
221
- text: "{refdes}"
398
+ new Label({
399
+ text: "{refdes}",
400
+ customData: new CustomData({ key: "key", value: ColumnName.RefDes })
222
401
  }),
223
- new Text({
402
+ new Label({
224
403
  text: {
225
404
  path: "",
226
- formatter: function(element) {
227
- if (element.type === "2") {
228
- return getResourceBundle().getText("ELEMENTS_PANEL_TYPE_COMPONENT");
229
- } else if (element.type === "4") {
230
- return getResourceBundle().getText("ELEMENTS_PANEL_TYPE_NET");
231
- } else {
232
- return getResourceBundle().getText("ELEMENTS_PANEL_TYPE_UNKNOWN");
233
- }
234
- }
405
+ formatter: formatElementType,
406
+ customData: new CustomData({ key: "key", value: ColumnName.Type })
235
407
  }
236
408
  }),
237
- new Text({
238
- text: "{deviceref}"
409
+ new Label({
410
+ text: "{deviceref}",
411
+ customData: new CustomData({ key: "key", value: ColumnName.Device })
239
412
  }),
240
413
  new Icon({
241
414
  src: {
242
415
  path: "",
243
416
  formatter: function(element) {
244
- var type = that._getVisibility(element);
245
- if (type === VisibilityType.Hidden) {
246
- return iconHidden;
247
- } else if (type === VisibilityType.Partial) {
248
- return iconPartial;
417
+ switch (getVisibility(element)) {
418
+ case VisibilityType.Hidden:
419
+ return IconType.Hidden;
420
+ case VisibilityType.Partial:
421
+ return IconType.Partial;
422
+ default:
423
+ return IconType.Visible;
249
424
  }
250
- return iconVisible;
251
425
  }
252
426
  },
253
427
  tooltip: {
254
428
  path: "",
255
429
  formatter: function(element) {
256
- var type = that._getVisibility(element);
257
- if (type === VisibilityType.Hidden) {
258
- return getResourceBundle().getText("ELEMENTS_PANEL_VISIBLE_COLUMN_HIDDEN_TOOLTIP");
259
- } else if (type === VisibilityType.Partial) {
260
- return getResourceBundle().getText("ELEMENTS_PANEL_VISIBLE_COLUMN_PARTIAL_TOOLTIP");
430
+ switch (getVisibility(element)) {
431
+ case VisibilityType.Hidden:
432
+ return getResourceBundle().getText("ELEMENTS_PANEL_VISIBLE_COLUMN_HIDDEN_TOOLTIP");
433
+ case VisibilityType.Partial:
434
+ return getResourceBundle().getText("ELEMENTS_PANEL_VISIBLE_COLUMN_PARTIAL_TOOLTIP");
435
+ default:
436
+ return getResourceBundle().getText("ELEMENTS_PANEL_VISIBLE_COLUMN_VISIBLE_TOOLTIP");
261
437
  }
262
- return getResourceBundle().getText("ELEMENTS_PANEL_VISIBLE_COLUMN_VISIBLE_TOOLTIP");
263
438
  }
264
- }
439
+ },
440
+ customData: new CustomData({ key: "key", value: ColumnName.Visibility })
265
441
  })
266
442
  ]
267
- })
268
- }
269
- });
443
+ });
444
+
445
+ this._table = new Table({
446
+ id: "elements-table",
447
+ mode: "MultiSelect",
448
+ fixedLayout: "Strict",
449
+ autoPopinMode: true,
450
+ popinLayout: "GridSmall",
451
+ includeItemInSelection: true,
452
+ sticky: [SapMLibrary.Sticky.HeaderToolbar, SapMLibrary.Sticky.ColumnHeaders],
453
+ selectionChange: this._onTableSelectionChanged.bind(this),
454
+ headerToolbar: new OverflowToolbar({
455
+ content: [
456
+ new ToolbarSpacer(),
457
+ this._showButton,
458
+ this._hideButton,
459
+ this._settingsButton
460
+ ]
461
+ }),
462
+ dependents: [
463
+ new ColumnResizer({
464
+ columnResize: this._onColumnResize.bind(this)
465
+ })
466
+ ],
467
+ columns: [
468
+ new Column({
469
+ headerMenu: sortMenu,
470
+ hAlign: CoreLibrary.TextAlign.Begin,
471
+ customData: new CustomData({ key: "key", value: ColumnName.RefDes }),
472
+ header: new Label({ text: getResourceBundle().getText("ELEMENTS_PANEL_NAME_COLUMN") })
473
+
474
+ }),
475
+ new Column({
476
+ headerMenu: sortGroupMenu,
477
+ hAlign: CoreLibrary.TextAlign.Begin,
478
+ customData: new CustomData({ key: "key", value: ColumnName.Type }),
479
+ header: new Label({ text: getResourceBundle().getText("ELEMENTS_PANEL_TYPE_COLUMN") })
480
+ }),
481
+ new Column({
482
+ headerMenu: sortGroupMenu,
483
+ hAlign: CoreLibrary.TextAlign.Begin,
484
+ customData: new CustomData({ key: "key", value: ColumnName.Device }),
485
+ header: new Label({ text: getResourceBundle().getText("ELEMENTS_PANEL_DEVICE_REFERENCE_COLUMN") })
486
+ }),
487
+ new Column({
488
+ hAlign: CoreLibrary.TextAlign.Center,
489
+ customData: new CustomData({ key: "key", value: ColumnName.Visibility }),
490
+ header: new Label({ text: getResourceBundle().getText("ELEMENTS_PANEL_VISIBLE_COLUMN") })
491
+ })
492
+ ],
493
+ items: {
494
+ path: "/",
495
+ template: this._rowTemplate
496
+ }
497
+ });
498
+
499
+ this._table.setModel(this._model);
500
+
501
+ this._filterBar = new FilterBar({
502
+ useToolbar: false,
503
+ persistencyKey: "Filters",
504
+ search: this._onSearch.bind(this),
505
+ filterChange: this._onFilterChange.bind(this),
506
+ assignedFiltersChanged: this._onAssignedFiltersChanged.bind(this),
507
+ filterGroupItems: [
508
+ new FilterGroupItem({
509
+ name: ColumnName.RefDes,
510
+ label: getResourceBundle().getText("REFDES_FILTER_LABEL"),
511
+ groupName: "basic",
512
+ visible: true,
513
+ visibleInFilterBar: true,
514
+ control: new Input({
515
+ change: this._onFilterChange.bind(this)
516
+ })
517
+ }),
518
+ new FilterGroupItem({
519
+ name: ColumnName.Type,
520
+ label: getResourceBundle().getText("TYPE_FILTER_LABEL"),
521
+ groupName: "basic",
522
+ visible: true,
523
+ visibleInFilterBar: true,
524
+ control: new MultiComboBox({
525
+ selectionChange: this._onFilterChange.bind(this),
526
+ items: {
527
+ path: ModelName.ElementType + ">/",
528
+ templateShareable: false,
529
+ template: new sap.ui.core.Item({
530
+ key: "{" + ModelName.ElementType + ">}",
531
+ text: {
532
+ path: ModelName.ElementType + ">",
533
+ formatter: function(type) {
534
+ switch (type) {
535
+ case ElementType.Component:
536
+ return getResourceBundle().getText("ELEMENTS_PANEL_TYPE_COMPONENT");
537
+ case ElementType.Net:
538
+ return getResourceBundle().getText("ELEMENTS_PANEL_TYPE_NET");
539
+ default:
540
+ return getResourceBundle().getText("ELEMENTS_TYPE_FILTER_ALL");
541
+ }
542
+ }
543
+ }
544
+ })
545
+ }
546
+ })
547
+ }),
548
+ new FilterGroupItem({
549
+ name: ColumnName.Device,
550
+ label: getResourceBundle().getText("DEVICE_REF_FILTER_LABEL"),
551
+ groupName: "basic",
552
+ visible: true,
553
+ visibleInFilterBar: true,
554
+ control: new Input({
555
+ change: this._onFilterChange.bind(this)
556
+ })
557
+ })
558
+ ]
559
+ });
560
+
561
+ this._page = new DynamicPage({
562
+ visible: false,
563
+ fitContent: true,
564
+ showFooter: false,
565
+ headerExpanded: false,
566
+ title: new DynamicPageTitle({
567
+ heading: this._filterTitle,
568
+ expandedContent: new Label({
569
+ text: "{" + ModelName.FilterSummary + ">/expandedFilterSummary}"
570
+ }),
571
+ snappedContent: new Label({
572
+ text: "{" + ModelName.FilterSummary + ">/snappedFilterSummary}"
573
+ })
574
+ }),
575
+ header: new DynamicPageHeader({
576
+ content: this._filterBar
577
+ }),
578
+ content: this._table
579
+ });
580
+
581
+ this._message = new IllustratedMessage({
582
+ illustrationType: IllustratedMessageType.NoData,
583
+ enableVerticalResponsiveness: true
584
+ });
585
+
586
+ const content = new VBox({
587
+ height: "100%",
588
+ renderType: SapMLibrary.FlexRendertype.Bare,
589
+ items: [
590
+ this._page,
591
+ this._message
592
+ ]
593
+ });
594
+
595
+ this.destroyAggregation("content");
596
+ this.setAggregation("content", content);
597
+
598
+ this._p13nEngine = Engine.getInstance();
599
+
600
+ // Register the elements table for personalization
601
+ this._registerForP13n();
602
+
603
+ // Set up filter bar data handlers
604
+ this._filterBar.addEventDelegate({
605
+ // When the user hits the `Enter` key in any of the filter bar controls, we trigger the
606
+ // search. This handler covers all the filter group items. The basic search field is handled separately.
607
+ onsapenter: event => {
608
+ const control = event.srcControl;
609
+ // If `control` itself or its ancestor is a part of the `filterGroupItems` aggregation of
610
+ // the `FilterBar` control, then we can trigger the search.
611
+ if (this._filterBar.getFilterGroupItems().some(item => {
612
+ const itemControl = item.getControl();
613
+ return itemControl === control || isAncestorOf(itemControl, control);
614
+ })) {
615
+ this._onAssignedFiltersChanged();
616
+ this._updateFilterBarToolbarText();
617
+ this._onSearch();
618
+ }
619
+ }
620
+ });
621
+
622
+ this._filterBar.registerGetFiltersWithValues(this._getFiltersWithValues.bind(this));
270
623
 
271
- this._scrollContainer = new ScrollContainer({
272
- vertical: true,
273
- horizontal: false,
274
- height: "100%",
275
- content: this._table
624
+ this._onAssignedFiltersChanged();
625
+ this._updateFilterBarToolbarText();
626
+
627
+ resolve();
628
+ });
629
+ }));
630
+ };
631
+
632
+ ElementsPanel.prototype.exit = function() {
633
+ this._promise = this._promise.then(() => {
634
+ this._p13nEngine.detachStateChange(this._onTableStateChange);
635
+ this._p13nEngine.deregister(this._table);
636
+ this._p13nEngine = null;
637
+
638
+ this._metadataHelper.destroy();
639
+ this._metadataHelper = null;
640
+
641
+ this._model.destroy();
642
+ this._model = null;
643
+
644
+ this._elementTypeModel.destroy();
645
+ this._elementTypeModel = null;
646
+
647
+ this._filterSummaryModel.destroy();
648
+ this._filterSummaryModel = null;
649
+
650
+ Control.prototype.exit?.apply(this);
276
651
  });
652
+ };
277
653
 
278
- this.setAggregation("content", this._scrollContainer);
654
+ ElementsPanel.prototype._updateMessage = function(filtering) {
655
+ const hasData = this._table.getItems().length > 0;
656
+ const control = filtering === true ? this._table : this._page;
279
657
 
280
- this._scene = null;
281
- this._model = new JSONModel();
282
- this._model.setSizeLimit(100000);
283
- this._table.setModel(this._model);
658
+ control.setVisible(hasData);
659
+
660
+ this._message.setVisible(!hasData);
661
+ this._message.setIllustrationType(filtering === true ? IllustratedMessageType.NoFilterResults : sap.m.IllustratedMessageType.NoData);
284
662
  };
285
663
 
286
- ElementsPanel.prototype.refresh = function() {
287
- if (!this._scene || !this._manager || !this._manager.getNodeHierarchy()) {
288
- this._model.setData([]);
664
+ ElementsPanel.prototype._refresh = async function() {
665
+ await this._promise;
666
+
667
+ if (!this._scene || !this._manager) {
668
+ // This method may be called indirectly from the exit method after _model is destroyed
669
+ this._model?.setData([]);
670
+ this._updateMessage(false);
289
671
  return;
290
672
  }
291
673
  // scan the tree and collect elements info
292
- var elements = new Map();
293
- this._scanTree(elements, this._manager.getNodeHierarchy().getSceneRef());
294
-
295
- this._model.setData(elements.values().toArray());
674
+ const elements = new Map();
675
+ this._scanTree(elements, this._scene.getRootElement());
676
+ const data = elements.values().toArray();
677
+ this._model.setSizeLimit(data.length);
678
+ this._model.setData(data);
296
679
  this._table.setModel(this._model);
680
+
681
+ this._updateMessage(false);
297
682
  this.fireContentChanged();
298
683
  };
299
684
 
300
- ElementsPanel.prototype.onBeforeRendering = function() {
301
- this._table.setVisible(true);
302
- if (!this._resizeListenerId) {
303
- this._resizeListenerId = ResizeHandler.register(this, this._handleResize.bind(this));
304
- }
305
- };
685
+ ElementsPanel.prototype._registerForP13n = function() {
686
+ this._metadataHelper = new MetadataHelper([
687
+ {
688
+ groupable: false,
689
+ key: ColumnName.RefDes,
690
+ path: ColumnName.RefDes,
691
+ label: getResourceBundle().getText("ELEMENTS_PANEL_NAME_COLUMN")
692
+ },
693
+ {
694
+ key: ColumnName.Type,
695
+ path: ColumnName.Type,
696
+ label: getResourceBundle().getText("ELEMENTS_PANEL_TYPE_COLUMN")
697
+ },
698
+ {
699
+ key: ColumnName.Device,
700
+ path: ColumnName.Device,
701
+ label: getResourceBundle().getText("ELEMENTS_PANEL_DEVICE_REFERENCE_COLUMN")
702
+ },
703
+ {
704
+ sortable: false,
705
+ groupable: false,
706
+ key: ColumnName.Visibility,
707
+ path: ColumnName.Visibility,
708
+ label: getResourceBundle().getText("ELEMENTS_PANEL_VISIBLE_COLUMN")
709
+ }
710
+ ]);
306
711
 
307
- ElementsPanel.prototype._setScene = function(scene) {
308
- this._scene = scene;
309
- this.refresh();
712
+ this._p13nEngine.register(this._table, {
713
+ helper: this._metadataHelper,
714
+ controller: {
715
+ columnStates: new SelectionController({
716
+ control: this._table,
717
+ targetAggregation: "columns",
718
+ getKeyForItem
719
+ }),
720
+ columnWidthStates: new ColumnWidthController({
721
+ control: this._table
722
+ }),
723
+ sortStates: new SortController({
724
+ control: this._table
725
+ }),
726
+ groupStates: new GroupController({
727
+ control: this._table
728
+ })
729
+ }
730
+ });
731
+
732
+ this._p13nEngine.attachStateChange(this._onTableStateChange.bind(this));
733
+
734
+ // Set up default column visibility and sorting for the table.
735
+ const state = {
736
+ columnStates: this._metadataHelper.getProperties().map(({ key }) => ({ key })),
737
+ sortStates: [{ key: ColumnName.RefDes, descending: false }]
738
+ };
739
+
740
+ this._p13nEngine.applyState(this._table, state);
310
741
  };
311
742
 
312
- ElementsPanel.prototype._getVisibility = function(element) {
313
- return VisibilityType.Visible;
743
+ ElementsPanel.prototype._onSettings = function() {
744
+ this._p13nEngine.show(this._table, ["columnStates", "sortStates", "groupStates"], { source: this._table });
314
745
  };
315
746
 
316
- ElementsPanel.prototype._extractMetadata = function(metadata) {
317
- if (metadata.length != undefined) {
318
- var map = new Map();
319
- metadata.forEach(function(entry) {
320
- if (entry.category === "ecad") {
321
- map.set(entry.tag, entry.value);
322
- }
323
- });
324
- return map;
325
- }
326
- return null;
747
+ ElementsPanel.prototype._setScene = function(scene) {
748
+ this._scene = scene?.isECADScene() ? scene : null;
749
+ this._refresh();
327
750
  };
328
751
 
329
- ElementsPanel.prototype._addElement = function(elements, metadata, nodeRef, nodeVisibility) {
330
- var type = metadata.get("type");
331
- var refdes = metadata.get("refdes");
332
- var deviceref = metadata.get("deviceref");
752
+ ElementsPanel.prototype._addElement = function(elements, nodeRef, metadata) {
753
+ const type = metadata.get("type");
754
+ const refdes = metadata.get("refdes");
755
+ const deviceref = metadata.get("deviceref");
333
756
 
334
757
  var element = elements.get(refdes);
335
758
  if (!element) {
@@ -337,55 +760,99 @@ sap.ui.define([
337
760
  refdes: refdes,
338
761
  type: type,
339
762
  deviceref: deviceref,
340
- elements: new Map(),
341
- hiddenElements: 0
763
+ parts: new Map(),
764
+ hiddenParts: new Set()
342
765
  };
343
766
  elements.set(refdes, element);
344
767
  }
345
768
 
346
- if (nodeVisibility == false) {
347
- // layer.hiddenElements++;
769
+ switch (type) {
770
+ case ElementType.Component:
771
+ element.parts.set(nodeRef.uid, nodeRef);
772
+ if (this._manager.getVisibilityState(nodeRef) === false) {
773
+ element.hiddenParts.add(nodeRef.uid);
774
+ }
775
+ break;
776
+ case ElementType.Net:
777
+ nodeRef.children.forEach(child => {
778
+ element.parts.set(child.uid, child);
779
+ if (this._manager.getVisibilityState(child) === false) {
780
+ element.hiddenParts.add(child.uid);
781
+ }
782
+ });
783
+ break;
784
+ default:
785
+ break;
348
786
  }
349
- element.elements.set(nodeRef.uid, nodeRef);
350
787
  };
351
788
 
352
789
  ElementsPanel.prototype._scanTree = function(elements, nodeRef) {
353
- var hierarchy = this._manager.getNodeHierarchy();
354
- var node = hierarchy.createNodeProxy(nodeRef);
355
- var metadata = this._extractMetadata(node.getNodeMetadata());
356
- hierarchy.destroyNodeProxy(node);
357
-
790
+ const metadata = extractMetadata(nodeRef);
358
791
  if (metadata) {
359
- var name = metadata.get("refdes");
792
+ const name = metadata.get("refdes");
360
793
  if (name) {
361
- this._addElement(elements, metadata, nodeRef, this._manager.getVisibilityState(nodeRef));
794
+ this._addElement(elements, nodeRef, metadata);
362
795
  return; // don't go further down the hierarchy
363
796
  }
364
797
  }
365
-
366
- hierarchy.getChildren(nodeRef).forEach(function(ref) {
367
- this._scanTree(elements, ref);
368
- }, this);
798
+ nodeRef.children.forEach(child => this._scanTree(elements, child));
369
799
  };
370
800
 
371
- ElementsPanel.prototype._onSelectionChanged = function(event) {
801
+ ElementsPanel.prototype._onTableSelectionChanged = function(event) {
802
+ const items = event.getParameter("listItems");
803
+ const selected = event.getParameter("selected");
804
+ const output = [];
805
+
806
+ items.forEach(item => {
807
+ const element = item.getBindingContext().getObject();
808
+ switch (element.type) {
809
+ case ElementType.Component:
810
+ output.push(element.parts.values().toArray()[0]);
811
+ break;
812
+ case ElementType.Net:
813
+ output.push(element.parts.values().toArray()[0].parent);
814
+ break;
815
+ default:
816
+ break;
817
+ }
818
+ });
819
+
820
+ this._manager.setSelectionState(output, selected, true, true);
372
821
  this._updateButtons();
373
822
  };
374
823
 
375
- ElementsPanel.prototype._onVisibilityChanged = function(event) {
376
- //
377
- };
824
+ ElementsPanel.prototype._onViewportSelectionChanged = function(event) {
825
+ const items = this._table.getItems();
826
+ const selected = event.getParameter("selected");
827
+ const unselected = event.getParameter("unselected");
828
+
829
+ const process = (list, item, select) => {
830
+ const element = item.getBindingContext().getObject();
831
+
832
+ list.forEach(nodeRef => {
833
+ const metadata = extractMetadata(nodeRef);
834
+ const refdes = metadata?.get("refdes");
378
835
 
379
- ElementsPanel.prototype._handleResize = function(event) {
380
- // this._updateSelection();
836
+ if (refdes === element.refdes) {
837
+ this._table.setSelectedItem(item, select, false);
838
+ }
839
+ });
840
+ };
841
+
842
+ items.forEach(item => {
843
+ process(selected, item, true);
844
+ process(unselected, item, false);
845
+ });
846
+
847
+ this._updateButtons();
381
848
  };
382
849
 
383
850
  ElementsPanel.prototype._setContent = function(content) {
384
851
  // If there is no explicitly assigned view state manager then use the content connector's default one.
385
852
  if (content && !this.getViewStateManager()) {
386
- var connector = Element.getElementById(this.getContentConnector());
853
+ const connector = Element.getElementById(this.getContentConnector());
387
854
  if (connector) {
388
- var defaultManager = connector.getDefaultViewStateManager();
855
+ const defaultManager = connector.getDefaultViewStateManager();
389
856
  if (defaultManager) {
390
857
  this.setViewStateManager(defaultManager);
391
858
  }
@@ -399,17 +866,14 @@ sap.ui.define([
399
866
  this._setContent(event.getParameter("newContent"));
400
867
  };
401
868
 
402
- ElementsPanel.prototype._onContentChangesFinished = function(event) {
403
- this.refresh();
404
- };
405
-
406
869
  ElementsPanel.prototype._updateButtons = function() {
407
- var canShow = false, canHide = false;
408
- var selected = this._table.getSelectedItems();
870
+ let canHide = false;
871
+ let canShow = false;
872
+ const selected = this._table.getSelectedItems();
409
873
 
410
- selected.forEach(function(item) {
411
- var element = item.getBindingContext().getObject();
412
- var visibility = this._getVisibility(element);
874
+ selected.forEach(item => {
875
+ const element = item.getBindingContext().getObject();
876
+ const visibility = getVisibility(element);
413
877
 
414
878
  if (visibility === VisibilityType.Visible) {
415
879
  canHide = true;
@@ -419,50 +883,358 @@ sap.ui.define([
419
883
  canHide = canShow = true;
420
884
  }
421
885
 
422
- }, this);
886
+ });
423
887
 
424
888
  this._showButton.setEnabled(canShow);
425
889
  this._hideButton.setEnabled(canHide);
426
890
  };
427
891
 
428
892
  ElementsPanel.prototype._onShowElements = function() {
429
- var toShow = [];
430
- var selected = this._table.getSelectedItems();
431
-
432
- selected.forEach(function(item) {
433
- var layer = item.getBindingContext().getObject();
434
- if (layer.hiddenElements !== 0) {
435
- layer.hiddenElements = 0;
436
- layer.elements.forEach(function(nodeRef) {
437
- toShow.push(nodeRef);
438
- });
893
+ const toShow = [];
894
+ const selected = this._table.getSelectedItems();
895
+
896
+ selected.forEach(item => {
897
+ const element = item.getBindingContext().getObject();
898
+
899
+ if (element.hiddenParts.size > 0) {
900
+ const ref = element.parts.values().toArray()[0];
901
+ element.hiddenParts.clear();
902
+
903
+ if (element.type === ElementType.Component) {
904
+ toShow.push(ref);
905
+ } else if (element.type === ElementType.Net) {
906
+ toShow.push(ref.parent);
907
+ }
439
908
  }
440
909
  });
910
+
911
+ this._skipEvent = true;
441
912
  this._manager.setVisibilityState(toShow, true, true, true);
442
913
  this._model.updateBindings(true);
443
914
  this._updateButtons();
444
915
  };
445
916
 
446
917
  ElementsPanel.prototype._onHideElements = function() {
447
- var toHide = [];
448
- var selected = this._table.getSelectedItems();
449
-
450
- selected.forEach(function(item) {
451
- var layer = item.getBindingContext().getObject();
452
- if (layer.hiddenElements !== layer.elements.size) {
453
- layer.hiddenElements = layer.elements.size;
454
- layer.elements.forEach(function(nodeRef) {
455
- toHide.push(nodeRef);
456
- });
918
+ const toHide = [];
919
+ const selected = this._table.getSelectedItems();
920
+
921
+ selected.forEach(item => {
922
+ const element = item.getBindingContext().getObject();
923
+
924
+ if (element.hiddenParts.size < element.parts.size) {
925
+ const ref = element.parts.values().toArray()[0];
926
+ element.parts.forEach(part => element.hiddenParts.add(part.uid));
927
+
928
+ if (element.type === ElementType.Component) {
929
+ toHide.push(ref);
930
+ } else if (element.type === ElementType.Net) {
931
+ toHide.push(ref.parent);
932
+ }
457
933
  }
458
934
  });
935
+
936
+ this._skipEvent = true;
459
937
  this._manager.setVisibilityState(toHide, false, true, true);
460
938
  this._model.updateBindings(true);
461
939
  this._updateButtons();
462
940
  };
463
941
 
464
- ElementsPanel.prototype._onSettings = function() {
942
+ ElementsPanel.prototype._onVisibilityChanged = async function(event) {
943
+ if (this._skipEvent) {
944
+ this._skipEvent = false;
945
+ return;
946
+ }
947
+ const hidden = event.getParameter("hidden");
948
+ const visible = event.getParameter("visible");
949
+
950
+ await this._promise;
951
+
952
+ const process = (list, element, show) => {
953
+ list.forEach(ref => {
954
+ const metadata = extractMetadata(ref);
955
+ const refdes = metadata?.get("refdes");
956
+
957
+ if (refdes === element.refdes) {
958
+ switch (metadata.get("type")) {
959
+ case ElementType.Component:
960
+ if (show) {
961
+ element.hiddenParts.delete(ref.uid);
962
+ } else {
963
+ element.hiddenParts.add(ref.uid);
964
+ }
965
+ break;
966
+ case ElementType.Net:
967
+ if (show) {
968
+ ref.children.forEach(child => element.hiddenParts.delete(child.uid));
969
+ } else {
970
+ ref.children.forEach(child => element.hiddenParts.add(child.uid));
971
+ }
972
+ break;
973
+ default:
974
+ break;
975
+ }
976
+ } else {
977
+ const layer = metadata?.get("layer");
978
+ if (layer) {
979
+ if (element.parts.has(ref.uid)) {
980
+ if (show) {
981
+ element.hiddenParts.delete(ref.uid);
982
+ } else {
983
+ element.hiddenParts.add(ref.uid);
984
+ }
985
+ }
986
+ }
987
+ }
988
+ });
989
+ };
990
+
991
+ this._model.getData().forEach(element => {
992
+ process(hidden, element, false);
993
+ process(visible, element, true);
994
+ });
995
+
996
+ this._model.updateBindings(true);
997
+ this._updateButtons();
998
+ };
999
+
1000
+ // Go button on the filter bar
1001
+ ElementsPanel.prototype._onSearch = function() {
1002
+ this._table.setShowOverlay(true);
1003
+
1004
+ const filters = this._getFiltersWithValues().reduce((result, filterGroupItem) => {
1005
+ var control = filterGroupItem.getControl();
1006
+ const filterName = filterGroupItem.getName();
1007
+ var filters = [];
1008
+
1009
+ switch (filterName) {
1010
+ case ColumnName.RefDes:
1011
+ case ColumnName.Device:
1012
+ const value = control.getValue();
1013
+ filters.push(new Filter({
1014
+ path: filterGroupItem.getName(),
1015
+ operator: FilterOperator.Contains,
1016
+ value1: value
1017
+ }));
1018
+ break;
1019
+ case ColumnName.Type:
1020
+ const selected = control.getSelectedKeys();
1021
+ selected.forEach(key => filters.push(new Filter({
1022
+ path: filterGroupItem.getName(),
1023
+ operator: FilterOperator.Contains,
1024
+ value1: key
1025
+ })));
1026
+ break;
1027
+ default:
1028
+ break;
1029
+ }
1030
+
1031
+ if (filters.length > 0) {
1032
+ result.push(new Filter({
1033
+ filters: filters,
1034
+ and: false
1035
+ }));
1036
+ }
1037
+ return result;
1038
+ }, []);
1039
+
1040
+ this._table.getBinding("items").filter(filters);
1041
+ this._table.setShowOverlay(false);
1042
+
1043
+ this._updateMessage(true);
1044
+ };
1045
+
1046
+ ElementsPanel.prototype._onFilterChange = function() {
1047
+ this._table.setShowOverlay(true);
1048
+ };
1049
+
1050
+ ElementsPanel.prototype._onAssignedFiltersChanged = function() {
1051
+ this._filterSummaryModel.setProperty("/snappedFilterSummary", this._filterBar.retrieveFiltersWithValuesAsText());
1052
+ this._filterSummaryModel.setProperty("/expandedFilterSummary", this._filterBar.retrieveFiltersWithValuesAsTextExpanded());
1053
+ };
1054
+
1055
+ // Returns the filter items with non-empty values from the filter bar.
1056
+ ElementsPanel.prototype._getFiltersWithValues = function() {
1057
+ return this._filterBar
1058
+ .getFilterGroupItems()
1059
+ .filter(filterGroupItem => {
1060
+ const control = filterGroupItem.getControl();
1061
+
1062
+ if (control instanceof MultiComboBox) {
1063
+ return control.getSelectedItems().length > 0;
1064
+ } else if (control instanceof Input) {
1065
+ return control.getValue().length > 0;
1066
+ } else {
1067
+ return false;
1068
+ }
1069
+ });
1070
+ };
1071
+
1072
+ // Currently there is no way to programmatically update
1073
+ // text next to Go button, it's a FilterBar bug,
1074
+ // so check for private function and call it
1075
+ ElementsPanel.prototype._updateFilterBarToolbarText = function() {
1076
+ this._filterBar._updateToolbarText?.();
1077
+ };
1078
+
1079
+ ElementsPanel.prototype._onBeforeOpenColumnMenu = function(event) {
1080
+ const menu = event.getSource();
1081
+ const column = event.getParameter("openBy");
1082
+ const quickActions = menu.getQuickActions();
1083
+
1084
+ // Handle sorting
1085
+ const sortQuickAction = quickActions.find(quickAction => quickAction instanceof QuickSort);
1086
+ if (sortQuickAction != null) {
1087
+ const sortItem = sortQuickAction.getItems()[0];
1088
+ sortItem.setKey(getKeyForItem(column));
1089
+ sortItem.setLabel(column.getHeader().getText(false));
1090
+ sortItem.setSortOrder(column.getSortIndicator());
1091
+ }
1092
+
1093
+ // Handle grouping, if available - not all columns are groupable
1094
+ const groupQuickAction = quickActions.find(quickAction => quickAction instanceof QuickGroup);
1095
+ if (groupQuickAction != null) {
1096
+ const groupItem = groupQuickAction.getItems()[0];
1097
+ groupItem.setKey(getKeyForItem(column));
1098
+ groupItem.setLabel(column.getHeader().getText(false));
1099
+ groupItem.setGrouped(column.data("grouped"));
1100
+ }
1101
+ };
1102
+
1103
+ ElementsPanel.prototype._onColumnResize = function(event) {
1104
+ };
1105
+
1106
+ ElementsPanel.prototype._onSort = function(event) {
1107
+ this._p13nEngine.retrieveState(this._table).then(state => {
1108
+ const sortStates = state.sortStates;
1109
+
1110
+ for (const state of sortStates) {
1111
+ state.sorted = false;
1112
+ }
1113
+
1114
+ const item = event.getParameter("item");
1115
+ const key = item.getKey();
1116
+ const sortOrder = item.getSortOrder();
1117
+
1118
+ if (sortOrder !== SortOrder.None) {
1119
+ sortStates.push({ key, descending: sortOrder === SortOrder.Descending });
1120
+ }
1121
+
1122
+ this._p13nEngine.applyState(this._table, state);
1123
+ });
1124
+ };
1125
+
1126
+ ElementsPanel.prototype._onGroup = function(event) {
1127
+ this._p13nEngine.retrieveState(this._table).then(state => {
1128
+ const groupStates = state.groupStates;
1129
+
1130
+ for (const state of groupStates) {
1131
+ state.grouped = false;
1132
+ }
1133
+
1134
+ const groupItem = event.getParameter("item");
1135
+ const key = groupItem.getKey();
1136
+
1137
+ if (groupItem.getGrouped()) {
1138
+ groupStates.push({ key });
1139
+ }
1140
+
1141
+ this._p13nEngine.applyState(this._table, state);
1142
+ });
1143
+ };
1144
+
1145
+ ElementsPanel.prototype._onTableStateChange = function(event) {
1146
+ if (event.getParameter("control") !== this._table) {
1147
+ return;
1148
+ }
1149
+ const state = event.getParameter("state");
1150
+ // NOTE: There is a bug in UI5 1.120 - this event should not be fired with `null` state.
1151
+ // TODO(fix): Remove this check once the bug is fixed in later versions of UI5.
1152
+ if (state == null) {
1153
+ return;
1154
+ }
1155
+
1156
+ const info = this._table.getBindingInfo("items");
1157
+ const bindingInfo = {
1158
+ path: info.path,
1159
+ model: info.model,
1160
+ factory: info.factory
1161
+ };
1162
+
1163
+ const columns = this._table.getColumns();
1164
+
1165
+ // Reset all columns to be invisible, unsorted and ungrouped
1166
+ for (const column of columns) {
1167
+ column.setVisible(false);
1168
+ column.setSortIndicator(SortOrder.None);
1169
+ column.data("grouped", false);
1170
+
1171
+ const width = state.columnWidthStates[getKeyForItem(column)];
1172
+
1173
+ if (width !== undefined) {
1174
+ column.setWidth();
1175
+ }
1176
+ }
1177
+
1178
+ const cellTemplates = this._rowTemplate.getCells();
1179
+
1180
+ // Make column visible and in right order
1181
+ state.columnStates.forEach((columnState, index) => {
1182
+ const column = findItemByKey(this._table.getColumns(), columnState.key);
1183
+ column.setVisible(true);
1184
+
1185
+ this._table.removeColumn(column);
1186
+ this._table.insertColumn(column, index);
1187
+
1188
+ const template = findItemByKey(cellTemplates, columnState.key);
1189
+
1190
+ this._rowTemplate.removeCell(template);
1191
+ this._rowTemplate.insertCell(template, index);
1192
+ });
1193
+
1194
+ // Create sorters
465
1195
  //
1196
+ // If there is a column used for grouping, we need to create a sorter for it as well and that
1197
+ // sorter must be the first in the list of sorters. The column used for grouping can also be one
1198
+ // of the columns used for sorting but it is not mandatory. Only one column can be used for grouping
1199
+ bindingInfo.sorter = [];
1200
+
1201
+ if (state.groupStates.length === 1) {
1202
+ const key = state.groupStates[0].key;
1203
+ const path = this._metadataHelper.getProperty(key).path;
1204
+
1205
+ // If this column is also used for sorting, we need to take its sorting order from the corresponding item in state.sortStates
1206
+ const sortState = state.sortStates.find(sortState => sortState.key === key);
1207
+ const descending = sortState?.descending ?? false;
1208
+
1209
+ const getGroupHeader = context => {
1210
+ switch (path) {
1211
+ case ColumnName.Type:
1212
+ return formatElementType(context.getObject());
1213
+ default:
1214
+ return context.getProperty(path);
1215
+ }
1216
+ };
1217
+
1218
+ bindingInfo.sorter.push(new Sorter(path, descending, getGroupHeader));
1219
+
1220
+ const column = findItemByKey(columns, key);
1221
+ column.data("grouped", true);
1222
+ }
1223
+
1224
+ for (let sortState of state.sortStates) {
1225
+ const column = findItemByKey(columns, sortState.key);
1226
+ column.setSortIndicator(sortState.descending ? SortOrder.Descending : SortOrder.Ascending);
1227
+
1228
+ if (state.groupStates[0]?.key === sortState.key) {
1229
+ continue;
1230
+ }
1231
+
1232
+ const path = this._metadataHelper.getProperty(sortState.key).path;
1233
+ bindingInfo.sorter.push(new Sorter(path, sortState.descending));
1234
+ }
1235
+
1236
+ // Apply new binding info to the table
1237
+ this._table.bindItems(bindingInfo);
466
1238
  };
467
1239
 
468
1240
  return ElementsPanel;