@openui5/sap.ui.mdc 1.94.0 → 1.95.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. package/.reuse/dep5 +1 -6
  2. package/THIRDPARTY.txt +3 -9
  3. package/package.json +4 -4
  4. package/src/sap/ui/mdc/.library +1 -1
  5. package/src/sap/ui/mdc/ActionToolbar.js +1 -1
  6. package/src/sap/ui/mdc/Chart.js +12 -5
  7. package/src/sap/ui/mdc/ChartNew.js +1 -1
  8. package/src/sap/ui/mdc/Control.js +1 -1
  9. package/src/sap/ui/mdc/Element.js +2 -2
  10. package/src/sap/ui/mdc/Field.js +2 -2
  11. package/src/sap/ui/mdc/FilterBar.js +1 -1
  12. package/src/sap/ui/mdc/FilterField.js +28 -4
  13. package/src/sap/ui/mdc/Link.js +1 -1
  14. package/src/sap/ui/mdc/MultiValueField.js +1 -1
  15. package/src/sap/ui/mdc/Table.js +44 -29
  16. package/src/sap/ui/mdc/ValueHelp.js +1459 -0
  17. package/src/sap/ui/mdc/ValueHelpDelegate.js +41 -0
  18. package/src/sap/ui/mdc/chart/ToolbarHandler.js +233 -224
  19. package/src/sap/ui/mdc/chartNew/ChartSelectionDetailsNew.js +1 -1
  20. package/src/sap/ui/mdc/chartNew/ChartToolbarNew.js +1 -1
  21. package/src/sap/ui/mdc/chartNew/ChartTypeButtonNew.js +1 -1
  22. package/src/sap/ui/mdc/chartNew/PropertyHelperNew.js +1 -1
  23. package/src/sap/ui/mdc/condition/Condition.js +1 -1
  24. package/src/sap/ui/mdc/condition/ConditionConverter.js +1 -1
  25. package/src/sap/ui/mdc/condition/ConditionModel.js +1 -1
  26. package/src/sap/ui/mdc/condition/FilterConverter.js +1 -1
  27. package/src/sap/ui/mdc/condition/FilterOperatorUtil.js +1 -1
  28. package/src/sap/ui/mdc/condition/Operator.js +1 -1
  29. package/src/sap/ui/mdc/condition/RangeOperator.js +1 -1
  30. package/src/sap/ui/mdc/enum/SelectType.js +43 -0
  31. package/src/sap/ui/mdc/field/BoolFieldHelp.js +1 -1
  32. package/src/sap/ui/mdc/field/ConditionFieldHelp.js +1 -1
  33. package/src/sap/ui/mdc/field/ConditionType.js +61 -29
  34. package/src/sap/ui/mdc/field/ConditionsType.js +2 -1
  35. package/src/sap/ui/mdc/field/CustomFieldHelp.js +1 -1
  36. package/src/sap/ui/mdc/field/CustomFieldInfo.js +1 -1
  37. package/src/sap/ui/mdc/field/DefineConditionPanel.js +13 -2
  38. package/src/sap/ui/mdc/field/FieldBase.js +81 -35
  39. package/src/sap/ui/mdc/field/FieldBaseDelegate.js +9 -2
  40. package/src/sap/ui/mdc/field/FieldHelpBase.js +64 -4
  41. package/src/sap/ui/mdc/field/FieldInfoBase.js +1 -1
  42. package/src/sap/ui/mdc/field/FieldInput.js +1 -1
  43. package/src/sap/ui/mdc/field/FieldInputRenderUtil.js +1 -1
  44. package/src/sap/ui/mdc/field/FieldMultiInput.js +1 -1
  45. package/src/sap/ui/mdc/field/FieldValueHelp.js +7 -1
  46. package/src/sap/ui/mdc/field/FieldValueHelpContentWrapperBase.js +1 -1
  47. package/src/sap/ui/mdc/field/FieldValueHelpMTableWrapper.js +1 -1
  48. package/src/sap/ui/mdc/field/FieldValueHelpMdcTableWrapper.js +1 -1
  49. package/src/sap/ui/mdc/field/FieldValueHelpTableWrapperBase.js +1 -1
  50. package/src/sap/ui/mdc/field/FieldValueHelpUITableWrapper.js +1 -1
  51. package/src/sap/ui/mdc/field/InParameter.js +1 -1
  52. package/src/sap/ui/mdc/field/ListFieldHelp.js +1 -1
  53. package/src/sap/ui/mdc/field/ListFieldHelpItem.js +1 -1
  54. package/src/sap/ui/mdc/field/MultiValueFieldItem.js +1 -1
  55. package/src/sap/ui/mdc/field/OutParameter.js +1 -1
  56. package/src/sap/ui/mdc/field/ValueHelpPanel.js +1 -1
  57. package/src/sap/ui/mdc/filterbar/FilterBarBase.js +17 -9
  58. package/src/sap/ui/mdc/filterbar/PropertyHelper.js +1 -1
  59. package/src/sap/ui/mdc/filterbar/p13n/AdaptationFilterBar.js +1 -1
  60. package/src/sap/ui/mdc/filterbar/vh/FilterBar.js +1 -1
  61. package/src/sap/ui/mdc/flexibility/Chart.flexibility.js +1 -1
  62. package/src/sap/ui/mdc/flexibility/FilterBar.flexibility.js +1 -1
  63. package/src/sap/ui/mdc/flexibility/FilterItemFlex.js +1 -1
  64. package/src/sap/ui/mdc/flexibility/ItemBaseFlex.js +203 -197
  65. package/src/sap/ui/mdc/library.js +576 -4
  66. package/src/sap/ui/mdc/link/ContactDetails.js +1 -1
  67. package/src/sap/ui/mdc/link/ContactDetailsAddressItem.js +1 -1
  68. package/src/sap/ui/mdc/link/ContactDetailsEmailItem.js +1 -1
  69. package/src/sap/ui/mdc/link/ContactDetailsItem.js +1 -1
  70. package/src/sap/ui/mdc/link/ContactDetailsPhoneItem.js +1 -1
  71. package/src/sap/ui/mdc/link/Factory.js +1 -1
  72. package/src/sap/ui/mdc/link/FakeFlpConnector.js +1 -1
  73. package/src/sap/ui/mdc/link/LinkItem.js +1 -1
  74. package/src/sap/ui/mdc/link/Panel.js +1 -1
  75. package/src/sap/ui/mdc/link/PanelItem.js +1 -1
  76. package/src/sap/ui/mdc/link/PanelListItem.js +1 -1
  77. package/src/sap/ui/mdc/link/SelectionDialog.js +1 -1
  78. package/src/sap/ui/mdc/link/SelectionDialogItem.js +1 -1
  79. package/src/sap/ui/mdc/link/SemanticObjectMapping.js +1 -1
  80. package/src/sap/ui/mdc/link/SemanticObjectMappingItem.js +1 -1
  81. package/src/sap/ui/mdc/link/SemanticObjectUnavailableAction.js +1 -1
  82. package/src/sap/ui/mdc/messagebundle.properties +10 -3
  83. package/src/sap/ui/mdc/messagebundle_ar.properties +10 -3
  84. package/src/sap/ui/mdc/messagebundle_bg.properties +9 -2
  85. package/src/sap/ui/mdc/messagebundle_ca.properties +9 -2
  86. package/src/sap/ui/mdc/messagebundle_cs.properties +11 -4
  87. package/src/sap/ui/mdc/messagebundle_cy.properties +9 -2
  88. package/src/sap/ui/mdc/messagebundle_da.properties +9 -2
  89. package/src/sap/ui/mdc/messagebundle_de.properties +9 -2
  90. package/src/sap/ui/mdc/messagebundle_el.properties +10 -3
  91. package/src/sap/ui/mdc/messagebundle_en.properties +9 -2
  92. package/src/sap/ui/mdc/messagebundle_en_GB.properties +9 -2
  93. package/src/sap/ui/mdc/messagebundle_en_US_sappsd.properties +7 -2
  94. package/src/sap/ui/mdc/messagebundle_en_US_saptrc.properties +7 -2
  95. package/src/sap/ui/mdc/messagebundle_es.properties +33 -26
  96. package/src/sap/ui/mdc/messagebundle_es_MX.properties +9 -2
  97. package/src/sap/ui/mdc/messagebundle_et.properties +9 -2
  98. package/src/sap/ui/mdc/messagebundle_fi.properties +10 -3
  99. package/src/sap/ui/mdc/messagebundle_fr.properties +16 -9
  100. package/src/sap/ui/mdc/messagebundle_fr_CA.properties +9 -2
  101. package/src/sap/ui/mdc/messagebundle_hi.properties +9 -2
  102. package/src/sap/ui/mdc/messagebundle_hr.properties +9 -2
  103. package/src/sap/ui/mdc/messagebundle_hu.properties +10 -3
  104. package/src/sap/ui/mdc/messagebundle_id.properties +9 -2
  105. package/src/sap/ui/mdc/messagebundle_it.properties +32 -25
  106. package/src/sap/ui/mdc/messagebundle_iw.properties +9 -2
  107. package/src/sap/ui/mdc/messagebundle_ja.properties +9 -2
  108. package/src/sap/ui/mdc/messagebundle_kk.properties +9 -2
  109. package/src/sap/ui/mdc/messagebundle_ko.properties +9 -2
  110. package/src/sap/ui/mdc/messagebundle_lt.properties +9 -2
  111. package/src/sap/ui/mdc/messagebundle_lv.properties +9 -2
  112. package/src/sap/ui/mdc/messagebundle_ms.properties +9 -2
  113. package/src/sap/ui/mdc/messagebundle_nl.properties +10 -3
  114. package/src/sap/ui/mdc/messagebundle_no.properties +16 -9
  115. package/src/sap/ui/mdc/messagebundle_pl.properties +13 -6
  116. package/src/sap/ui/mdc/messagebundle_pt.properties +9 -2
  117. package/src/sap/ui/mdc/messagebundle_pt_PT.properties +9 -2
  118. package/src/sap/ui/mdc/messagebundle_ro.properties +12 -5
  119. package/src/sap/ui/mdc/messagebundle_ru.properties +9 -2
  120. package/src/sap/ui/mdc/messagebundle_sh.properties +9 -2
  121. package/src/sap/ui/mdc/messagebundle_sk.properties +10 -3
  122. package/src/sap/ui/mdc/messagebundle_sl.properties +9 -2
  123. package/src/sap/ui/mdc/messagebundle_sv.properties +10 -3
  124. package/src/sap/ui/mdc/messagebundle_th.properties +15 -8
  125. package/src/sap/ui/mdc/messagebundle_tr.properties +9 -2
  126. package/src/sap/ui/mdc/messagebundle_uk.properties +9 -2
  127. package/src/sap/ui/mdc/messagebundle_vi.properties +9 -2
  128. package/src/sap/ui/mdc/messagebundle_zh_CN.properties +9 -2
  129. package/src/sap/ui/mdc/messagebundle_zh_TW.properties +9 -2
  130. package/src/sap/ui/mdc/mixin/AdaptationMixin.js +1 -1
  131. package/src/sap/ui/mdc/mixin/DelegateMixin.js +1 -1
  132. package/src/sap/ui/mdc/mixin/FilterIntegrationMixin.js +1 -1
  133. package/src/sap/ui/mdc/mixin/PromiseMixin.js +94 -0
  134. package/src/sap/ui/mdc/odata/v4/ChartPropertyHelperNew.js +1 -1
  135. package/src/sap/ui/mdc/odata/v4/ValueHelpDelegate.js +94 -0
  136. package/src/sap/ui/mdc/p13n/DefaultProviderRegistry.js +1 -1
  137. package/src/sap/ui/mdc/p13n/Engine.js +1 -1
  138. package/src/sap/ui/mdc/p13n/PropertyHelper.js +1 -1
  139. package/src/sap/ui/mdc/p13n/UIManager.js +1 -1
  140. package/src/sap/ui/mdc/p13n/panels/BasePanel.js +2 -2
  141. package/src/sap/ui/mdc/p13n/panels/GroupPanel.js +1 -1
  142. package/src/sap/ui/mdc/p13n/panels/ListView.js +1 -1
  143. package/src/sap/ui/mdc/p13n/panels/QueryPanel.js +1 -1
  144. package/src/sap/ui/mdc/p13n/panels/SortQueryPanel.js +1 -1
  145. package/src/sap/ui/mdc/p13n/panels/Wrapper.js +1 -1
  146. package/src/sap/ui/mdc/p13n/subcontroller/BaseController.js +1 -1
  147. package/src/sap/ui/mdc/table/Column.js +20 -4
  148. package/src/sap/ui/mdc/table/CreationRow.js +1 -1
  149. package/src/sap/ui/mdc/table/PropertyHelper.js +176 -4
  150. package/src/sap/ui/mdc/table/RowSettings.js +1 -1
  151. package/src/sap/ui/mdc/table/V4AnalyticsPropertyHelper.js +1 -1
  152. package/src/sap/ui/mdc/themes/base/ValueHelpDialog.less +51 -21
  153. package/src/sap/ui/mdc/ui/Container.js +2 -2
  154. package/src/sap/ui/mdc/ui/ContainerItem.js +2 -2
  155. package/src/sap/ui/mdc/util/Common.js +26 -0
  156. package/src/sap/ui/mdc/util/PromiseCache.js +266 -0
  157. package/src/sap/ui/mdc/util/PropertyHelper.js +19 -1
  158. package/src/sap/ui/mdc/valuehelp/Dialog.js +475 -0
  159. package/src/sap/ui/mdc/valuehelp/Popover.js +346 -0
  160. package/src/sap/ui/mdc/valuehelp/base/Container.js +440 -0
  161. package/src/sap/ui/mdc/valuehelp/base/Content.js +442 -0
  162. package/src/sap/ui/mdc/valuehelp/base/DialogTab.js +96 -0
  163. package/src/sap/ui/mdc/valuehelp/base/FilterableListContent.js +537 -0
  164. package/src/sap/ui/mdc/valuehelp/base/ListContent.js +105 -0
  165. package/src/sap/ui/mdc/valuehelp/content/Bool.js +232 -0
  166. package/src/sap/ui/mdc/valuehelp/content/Conditions.js +250 -0
  167. package/src/sap/ui/mdc/valuehelp/content/FixedList.js +504 -0
  168. package/src/sap/ui/mdc/valuehelp/content/MDCTable.js +619 -0
  169. package/src/sap/ui/mdc/valuehelp/content/MTable.js +881 -0
  170. package/test/sap/ui/mdc/testutils/opa/TestLibrary.js +2 -2
  171. package/test/sap/ui/mdc/testutils/opa/filterbar/Actions.js +250 -0
  172. package/test/sap/ui/mdc/testutils/opa/filterbar/Assertions.js +91 -0
  173. package/test/sap/ui/mdc/testutils/opa/filterbar/TestObjects.js +137 -0
  174. package/test/sap/ui/mdc/testutils/opa/filterbar/Util.js +25 -0
  175. package/test/sap/ui/mdc/testutils/opa/p13n/Actions.js +239 -77
  176. package/test/sap/ui/mdc/testutils/opa/p13n/Util.js +2 -1
  177. package/test/sap/ui/mdc/testutils/opa/p13n/{waitForP13nButtonWithParentAndIcon.js → waitForP13nButtonWithMatchers.js} +5 -18
  178. package/test/sap/ui/mdc/testutils/opa/table/TestObjects.js +0 -1
@@ -0,0 +1,475 @@
1
+ /*
2
+ * ! OpenUI5
3
+ * (c) Copyright 2009-2021 SAP SE or an SAP affiliate company.
4
+ * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
5
+ */
6
+
7
+ sap.ui.define([
8
+ 'sap/ui/mdc/valuehelp/base/Container',
9
+ 'sap/ui/mdc/valuehelp/base/DialogTab',
10
+ 'sap/ui/mdc/util/loadModules',
11
+ 'sap/ui/Device',
12
+ 'sap/m/VBox',
13
+ 'sap/m/FlexItemData',
14
+ 'sap/ui/model/resource/ResourceModel',
15
+ 'sap/ui/mdc/util/Common',
16
+ 'sap/ui/mdc/enum/SelectType'
17
+ ], function(
18
+ Container,
19
+ DialogTab,
20
+ loadModules,
21
+ Device,
22
+ VBox,
23
+ FlexItemData,
24
+ ResourceModel,
25
+ Common,
26
+ SelectType
27
+ ) {
28
+ "use strict";
29
+
30
+ var MDialog, MLibrary, Button, ManagedObjectModel, IconTabBar, IconTabFilter;
31
+ var Panel, HBox, Tokenizer, Token, formatMessage;
32
+ var Dialog = Container.extend("sap.ui.mdc.valuehelp.Dialog", /** @lends sap.ui.mdc.valuehelp.Dialog.prototype */
33
+ {
34
+ metadata: {
35
+ library: "sap.ui.mdc",
36
+ interfaces: [
37
+ "sap.ui.mdc.valuehelp.IDialogContainer"
38
+ ],
39
+ properties: {
40
+ title: {
41
+ type: "string",
42
+ group: "Appearance",
43
+ defaultValue: ""
44
+ },
45
+ _selectedContentKey: {
46
+ type: "string",
47
+ visibility: "hidden"
48
+ },
49
+ _quickSelectEnabled: {
50
+ type: "boolean",
51
+ visibility: "hidden",
52
+ defaultValue: false
53
+ }
54
+ },
55
+ defaultAggregation: "content"
56
+ }
57
+ });
58
+
59
+ function _getContentHeight() {
60
+ if (Device.system.desktop) {
61
+ return "700px";
62
+ }
63
+ if (Device.system.tablet) {
64
+ return Device.orientation.landscape ? "600px" : "600px";
65
+ }
66
+ }
67
+
68
+ function _getContentWidth() {
69
+ if (Device.system.desktop) {
70
+ return "1080px";
71
+ }
72
+ if (Device.system.tablet) {
73
+ return Device.orientation.landscape ? "920px" : "600px";
74
+ }
75
+ }
76
+ Dialog.prototype.invalidate = function(oOrigin) {
77
+
78
+ if (oOrigin) {
79
+ var aContent = this.getContent();
80
+ var iIndex = aContent.indexOf(oOrigin);
81
+ if (this._oIconTabBar && iIndex !== -1 && !this._bIsBeingDestroyed) {
82
+ // Content invalidated -> invalidate corresponding IconTabFilter
83
+ var aItems = this._oIconTabBar.getItems();
84
+ if (aItems[iIndex]) {
85
+ aItems[iIndex].invalidate(oOrigin);
86
+ }
87
+ } else { // standard logic
88
+ Container.prototype.invalidate.apply(this, arguments);
89
+ }
90
+ }
91
+
92
+ };
93
+
94
+ Dialog.prototype._getUIAreaForContent = function() {
95
+ var oDialog = this.getAggregation("_container");
96
+ if (oDialog) {
97
+ return oDialog.getUIArea();
98
+ }
99
+ return Container.prototype._getUIAreaForContent.apply(this, arguments);
100
+ };
101
+
102
+ Dialog.prototype._handleConfirmed = function (oEvent) {
103
+ this.fireConfirm({close: true});
104
+ };
105
+
106
+
107
+ Dialog.prototype._getContainer = function () {
108
+ if (!this.getModel("$i18n")) {
109
+ // if ResourceModel not provided from outside create own one
110
+ this.setModel(new ResourceModel({ bundleName: "sap/ui/mdc/messagebundle", async: false }), "$i18n");
111
+ }
112
+
113
+ var oDialog = this.getAggregation("_container");
114
+
115
+ if (!oDialog) {
116
+ return this._retrievePromise("dialog", function (){
117
+ return loadModules([
118
+ "sap/m/Dialog",
119
+ "sap/m/Button",
120
+ "sap/ui/model/base/ManagedObjectModel",
121
+ 'sap/m/library'
122
+ ]).then(function (aModules) {
123
+
124
+ MDialog = aModules[0];
125
+ Button = aModules[1];
126
+ ManagedObjectModel = aModules[2];
127
+ MLibrary = aModules[3];
128
+
129
+ var ButtonType = MLibrary.ButtonType;
130
+
131
+ if (!this._oResourceBundle) {
132
+ this._oResourceBundle = sap.ui.getCore().getLibraryResourceBundle("sap.ui.mdc");
133
+ }
134
+
135
+ this.oButtonOK = new Button(this.getId() + "-ok", {
136
+ text: this._oResourceBundle.getText("valuehelp.OK"),
137
+ enabled: "{$valueHelp>/_valid}",
138
+ type: ButtonType.Emphasized,
139
+ press: this._handleConfirmed.bind(this),
140
+ visible: { parts: ['$valueHelp>/_config/maxConditions', '$help>/_quickSelectEnabled'], formatter: function(iMaxConditions, bQuickSelectEnabled) {
141
+ return iMaxConditions === -1 || !bQuickSelectEnabled;
142
+ }}
143
+ });
144
+
145
+ this.oButtonCancel = new Button(this.getId() + "-cancel", {
146
+ text: this._oResourceBundle.getText("valuehelp.CANCEL"),
147
+ press: this._handleCanceled.bind(this)
148
+ });
149
+
150
+ this._oManagedObjectModel = new ManagedObjectModel(this);
151
+
152
+ var oDialog = new MDialog(this.getId() + "-dialog", {
153
+ contentHeight: _getContentHeight(),
154
+ contentWidth: _getContentWidth(),
155
+ horizontalScrolling: false,
156
+ verticalScrolling: false,
157
+ title: {parts: ['$help>/title', '$help>/content', '$help>/_selectedContentKey', '$valueHelp>/conditions'], formatter:
158
+ function(sTitle, aContent, sSelectedContent, aConditions) {
159
+ if (this._oIconTabBar && aContent.length == 1) {
160
+ var iIndex = 0;
161
+ if (!sSelectedContent || this._oIconTabBar.getItems().some(function(oItem, i) {
162
+ iIndex = i;
163
+ return oItem.getKey() === sSelectedContent;
164
+ })) {
165
+ var oContent = aContent[iIndex];
166
+ var sDlgTitle = oContent.getFormattedSubTitle() ? oContent.getFormattedSubTitle() : oContent.getTitle();
167
+ if (sDlgTitle) {
168
+ sTitle = this._oResourceBundle.getText("valuehelp.DIALOGSUBTITLECOLONTITLE", [sDlgTitle, sTitle]);
169
+ }
170
+ }
171
+ }
172
+
173
+ return sTitle;
174
+ }.bind(this)
175
+ },
176
+ stretch: Device.system.phone,
177
+ resizable: true,
178
+ draggable: true,
179
+ afterOpen: this._handleOpened.bind(this),
180
+ afterClose: this._handleClosed.bind(this),
181
+ buttons: [this.oButtonOK, this.oButtonCancel]
182
+ });
183
+
184
+ oDialog.setModel(this._oManagedObjectModel, "$help");
185
+ this.setAggregation("_container", oDialog, true);
186
+
187
+ oDialog.isPopupAdaptationAllowed = function () {
188
+ return false;
189
+ };
190
+ oDialog.addStyleClass("sapMdcValueHelp");
191
+ oDialog.addStyleClass("sapMdcValueHelpTitle");
192
+ oDialog.addStyleClass("sapMdcValueHelpTitleShadow");
193
+
194
+ var oVBox = new VBox({ fitContainer: true});
195
+ oVBox.addStyleClass("sapMdcValueHelpPanel");
196
+ oDialog.addContent(oVBox);
197
+
198
+ var oIconTabBar = this._getIconTabBar(oDialog);
199
+ var oTokenizer = this._getTokenizerPanel();
200
+
201
+ return Promise.all([oIconTabBar, oTokenizer]).then(function (aControls) {
202
+ aControls.forEach(function (oControl) {
203
+ oVBox.addItem(oControl);
204
+ });
205
+ return oDialog;
206
+ });
207
+ }.bind(this));
208
+ }.bind(this));
209
+ }
210
+
211
+ return oDialog;
212
+ };
213
+
214
+ Dialog.prototype._handleSelect = function (oEvent) {
215
+ Container.prototype._handleSelect.apply(this, arguments);
216
+
217
+ if (this.getProperty("_quickSelectEnabled") && this._isSingleSelect()) {
218
+ this.fireConfirm({close: true});
219
+ }
220
+ };
221
+
222
+ Dialog.prototype._observeChanges = function (oChanges) {
223
+ if (oChanges.name === "content") {
224
+ var aContent = this.getContent();
225
+ this.setProperty("_quickSelectEnabled", aContent && aContent.every(function (oContent) {
226
+ return oContent.isQuickSelectSupported && oContent.isQuickSelectSupported();
227
+ }));
228
+ }
229
+ Container.prototype._observeChanges.apply(this, arguments);
230
+ };
231
+
232
+ Dialog.prototype._onTabBarSelect = function (oEvent) {
233
+ var aContents = this.getContent();
234
+ var oNextKey = oEvent && oEvent.getParameter("key");
235
+ var oPreviouslyShownContent = this._sSelectedKey && aContents && aContents.find(function (oContent) {
236
+ return oContent.getId() === this._sSelectedKey;
237
+ }.bind(this));
238
+ if (oPreviouslyShownContent) {
239
+ oPreviouslyShownContent.onHide();
240
+ }
241
+ this._sSelectedKey = oNextKey || this._oIconTabBar && this._oIconTabBar.getSelectedKey();
242
+ if (!this._sSelectedKey) {
243
+ // in the initial usecase the selectedKey is undefined
244
+ var oFirstItem = this._oIconTabBar.getItems()[0];
245
+ this._sSelectedKey = oFirstItem && oFirstItem.getKey();
246
+ if (this._sSelectedKey) {
247
+ this.setProperty("_selectedContentKey", this._sSelectedKey);
248
+ }
249
+ }
250
+ var oShownContent = this._sSelectedKey ? aContents && aContents.find(function (oContent) {
251
+ return oContent.getId() === this._sSelectedKey;
252
+ }.bind(this)) : aContents[0];
253
+ if (oShownContent) {
254
+ Promise.all([this._retrievePromise("open"), oShownContent.getContent()]).then(function () {
255
+ oShownContent.onShow();
256
+ });
257
+ }
258
+ };
259
+
260
+ Dialog.prototype._getIconTabBar = function (oDialog) {
261
+ if (!this._oIconTabBar) {
262
+ return loadModules([
263
+ "sap/m/IconTabBar",
264
+ "sap/m/IconTabFilter"]).then(function(aModules){
265
+ IconTabBar = aModules[0];
266
+ IconTabFilter = aModules[1];
267
+
268
+ this._oIconTabBar = new IconTabBar(this.getId() + "-ITB", {
269
+ expandable: false,
270
+ upperCase: false,
271
+ stretchContentHeight: true,
272
+ headerMode: "Inline",
273
+ select: this._onTabBarSelect.bind(this),
274
+ layoutData: new FlexItemData({growFactor: 1}),
275
+ selectedKey: "{$help>/_selectedContentKey}",
276
+ visible: {parts : ['$help>/content'], formatter:
277
+ function(aContent) {
278
+ if (aContent && aContent.length == 1) {
279
+ this.addStyleClass("sapMdcNoHeader"); // hide the IconTabBar header
280
+ oDialog.removeStyleClass("sapMdcValueHelpTitleShadow"); // make the Header border visible
281
+ } else {
282
+ this.removeStyleClass("sapMdcNoHeader");
283
+ oDialog.addStyleClass("sapMdcValueHelpTitleShadow"); // make the Header border invisible
284
+ }
285
+ return true;
286
+ }
287
+ }
288
+ });
289
+ this._oIconTabBar.setModel(this._oManagedObjectModel, "$help");
290
+ this._oIconTabBar.addStyleClass("sapUiNoContentPadding");
291
+
292
+ var oITF = new IconTabFilter(this.getId() + "-ITF", {
293
+ key: {path: "$help>id"},
294
+ content: new DialogTab(this.getId() + "-DT", {content: {path: "$help>_displayContent"}}),
295
+ text: {parts: ['$help>', '$valueHelp>/conditions'], formatter:
296
+ function(oContent, aConditions) {
297
+ return oContent ? oContent.getFormattedTitle(oContent.getCount(aConditions)) : "none";
298
+ }
299
+ }
300
+ });
301
+
302
+ this._oIconTabBar.bindAggregation("items", {path: "/content", model: "$help", templateShareable: false, template: oITF});
303
+ return this._oIconTabBar;
304
+ }.bind(this));
305
+ }
306
+ return this._oIconTabBar;
307
+ };
308
+
309
+ Dialog.prototype._getTokenizerPanel = function (oDialog) {
310
+ if (!this.oTokenizerPanel) {
311
+ return loadModules([
312
+ 'sap/m/Panel',
313
+ 'sap/m/HBox',
314
+ 'sap/m/VBox',
315
+ 'sap/m/Tokenizer',
316
+ 'sap/m/Token',
317
+ 'sap/base/strings/formatMessage',
318
+ 'sap/ui/model/Filter',
319
+ 'sap/ui/mdc/field/ConditionType'
320
+ ]).then(function (aModules) {
321
+
322
+ Panel = aModules[0];
323
+ HBox = aModules[1];
324
+ VBox = aModules[2];
325
+ Tokenizer = aModules[3];
326
+ Token = aModules[4];
327
+ formatMessage = aModules[5];
328
+ var Filter = aModules[6];
329
+ var ConditionType = aModules[7];
330
+
331
+ this.oTokenizerPanel = new Panel( {
332
+ backgroundDesign: "Transparent",
333
+ expanded: true,
334
+ visible: { parts: ['$valueHelp>/_config/maxConditions', '$help>/content'], formatter:
335
+ function(iMaxConditions, aContent) {
336
+ var bVisible = false;
337
+
338
+ if (aContent && aContent.some(function(oContent) {
339
+ // make the tokenizer visible when at least one content request the tokenizer
340
+ return oContent.getRequiresTokenizer();
341
+ })) {
342
+ bVisible = true;
343
+ }
344
+
345
+ return bVisible && iMaxConditions === -1;
346
+ }},
347
+ headerText: {parts: ['$i18n>valuehelp.TOKENIZERTITLE', '$valueHelp>/conditions'], formatter:
348
+ function(sText, aConditions) {
349
+ var iCount = 0;
350
+ for (var i = 0; i < aConditions.length; i++) {
351
+ var oCondition = aConditions[i];
352
+ if (oCondition.isEmpty !== true) {
353
+ iCount++;
354
+ }
355
+ }
356
+ if (iCount === 0) {
357
+ // in case of no items do not show a number
358
+ sText = this._oResourceBundle.getText("valuehelp.TOKENIZERTITLENONUMBER");
359
+ }
360
+ return formatMessage(sText, iCount);
361
+ }.bind(this)
362
+ }
363
+ });
364
+ this.oTokenizerPanel.addStyleClass("sapMdcTokenizerPanel");
365
+
366
+ var oHBox = new HBox({fitContainer: true, width: "100%"});
367
+
368
+ var oFilter = new Filter({path:'isEmpty', operator:'NE', value1:true});
369
+
370
+ var oConfig = this.getModel("$valueHelp").getProperty("/_config");
371
+ var oFormatOptions = { // TODO: is more needed?
372
+ maxConditions: -1, // as for tokens there should not be a limit on type side
373
+ valueType: oConfig.dataType,
374
+ operators: oConfig.operators,
375
+ display: oConfig.display
376
+ };
377
+ var oTokenTemplate = new Token({text: {path: '$valueHelp>', type: new ConditionType(oFormatOptions)}});
378
+ this.oTokenizer = new Tokenizer({
379
+ width: "100%",
380
+ tokenDelete: function(oEvent) {
381
+ if (oEvent.getParameter("tokens")) {
382
+ var aRemovedTokens = oEvent.getParameter("tokens");
383
+ var aConditions = this.getModel("$valueHelp").getObject("/conditions");
384
+ var aRemovedConditions = [];
385
+
386
+ aRemovedTokens.forEach(function(oRemovedToken, i) {
387
+ var sPath = oRemovedToken.getBindingContext("$valueHelp").sPath;
388
+ var iIndex = parseInt(sPath.slice(sPath.lastIndexOf("/") + 1));
389
+ aRemovedConditions.push(aConditions[iIndex]);
390
+ });
391
+
392
+ this.fireSelect({type: SelectType.Remove, conditions: aRemovedConditions});
393
+ }
394
+
395
+ }.bind(this),
396
+ tokens: {path: '/conditions', model: "$valueHelp", templateShareable: false, template: oTokenTemplate, filters: oFilter},
397
+ layoutData: new FlexItemData({growFactor: 1, maxWidth: "calc(100% - 2rem)"})
398
+ });
399
+ this.oTokenizer.addStyleClass("sapMdcTokenizer");
400
+
401
+ this.oRemoveAllBtn = new Button({
402
+ press: function(oEvent) {
403
+ this.fireSelect({type: SelectType.Set, conditions: []});
404
+
405
+ }.bind(this),
406
+ type: "Transparent",
407
+ icon: "sap-icon://decline",
408
+ tooltip: "{$i18n>valuehelp.REMOVEALLTOKEN}",
409
+ layoutData: new FlexItemData({growFactor: 0, baseSize: "2rem"})
410
+ });
411
+ this.oRemoveAllBtn.addStyleClass("sapUiTinyMarginBegin");
412
+
413
+ oHBox.addItem(this.oTokenizer);
414
+ oHBox.addItem(this.oRemoveAllBtn);
415
+ this.oTokenizerPanel.addContent(oHBox);
416
+
417
+ return this.oTokenizerPanel;
418
+ }.bind(this));
419
+ }
420
+ return this.oTokenizerPanel;
421
+ };
422
+
423
+ Dialog.prototype._open = function (oContainer) {
424
+ this._onTabBarSelect();
425
+ if (oContainer) {
426
+ oContainer.open();
427
+ }
428
+ };
429
+
430
+ Dialog.prototype._close = function () {
431
+ var oContainer = this.getAggregation("_container");
432
+ if (oContainer) {
433
+ oContainer.close();
434
+ }
435
+ };
436
+
437
+ Dialog.prototype.getValueHelpIcon = function() {
438
+ return "sap-icon://value-help";
439
+ };
440
+
441
+ Dialog.prototype.getAriaAttributes = function(iMaxConditions) {
442
+
443
+ // var aContent = this.getContent();
444
+ // var oContentAttributes = oContent && oContent.getAriaAttributes(iMaxConditions);
445
+ //
446
+ return {
447
+ contentId: null, // as in Dialog case focus is not in field, it is not needed
448
+ ariaHasPopup: "dialog",
449
+ role: null, // TODO: use "combobox" role here? But Input and MultiInput don't set a role if valueHelp is available
450
+ roleDescription: null // TODO: is it needed in multiselect case?
451
+ };
452
+
453
+ };
454
+
455
+ Dialog.prototype.isMultiSelect = function() {
456
+
457
+ return this.getMaxConditions() !== 1; // TODO: ask content?
458
+
459
+ };
460
+
461
+ Dialog.prototype.exit = function () {
462
+ Common.cleanup(this, [
463
+ "_oManagedObjectModel",
464
+ "_oResourceBundle",
465
+ "oButtonOK",
466
+ "oButtonCancel",
467
+ "oTokenizerPanel",
468
+ "oTokenizer",
469
+ "_oIconTabBar"
470
+ ]);
471
+ };
472
+
473
+ return Dialog;
474
+
475
+ });