@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,232 @@
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/content/FixedList",
9
+ "sap/ui/mdc/util/loadModules",
10
+ "sap/ui/model/BindingMode"
11
+ ], function(
12
+ FixedList,
13
+ loadModules,
14
+ BindingMode
15
+ ) {
16
+ "use strict";
17
+
18
+ var Bool = FixedList.extend("sap.ui.mdc.valuehelp.content.Bool", /** @lends sap.ui.mdc.valuehelp.content.Bool.prototype */
19
+ {
20
+ metadata: {
21
+ library: "sap.ui.mdc",
22
+ interfaces: [
23
+ "sap.ui.mdc.valuehelp.ITypeaheadContent"
24
+ ]
25
+ }
26
+ });
27
+
28
+ Bool.prototype.init = function() {
29
+
30
+ FixedList.prototype.init.apply(this, arguments);
31
+
32
+ this._oObserver.observe(this, {
33
+ properties: ["_config"]
34
+ });
35
+
36
+ };
37
+
38
+ Bool.prototype.exit = function() {
39
+
40
+ if (this._oModel) {
41
+ this._oModel.destroy();
42
+ this._oModel = undefined;
43
+ }
44
+
45
+ FixedList.prototype.exit.apply(this, arguments);
46
+ };
47
+
48
+ Bool.prototype.getContent = function () {
49
+ return this._retrievePromise("boolContent", function () {
50
+ return loadModules([
51
+ "sap/ui/mdc/field/ListFieldHelpItem",
52
+ "sap/ui/model/json/JSONModel"
53
+ ]).then(function (aModules) {
54
+ var ListFieldHelpItem = aModules[0];
55
+ var JSONModel = aModules[1];
56
+ this._oModel = new JSONModel({
57
+ "type": "",
58
+ "items": [
59
+ {
60
+ "key": true,
61
+ "text": "true"
62
+ },
63
+ {
64
+ "key": false,
65
+ "text": "false"
66
+ }
67
+ ]
68
+ });
69
+ _updateModel.call(this);
70
+
71
+ var oItem = new ListFieldHelpItem(this.getId() + "-Item", {
72
+ key: {path: "$Bool>key"},
73
+ text: {path: "$Bool>text"}
74
+ });
75
+
76
+ this.setUseFirstMatch(true);
77
+ this.setUseAsValueHelp(true);
78
+ this.setFilterList(false);
79
+ this.bindAggregation("items", {path: "$Bool>/items", template: oItem});
80
+ this.setModel(this._oModel, "$Bool");
81
+
82
+ return FixedList.prototype.getContent.apply(this, arguments);
83
+ }.bind(this));
84
+ }.bind(this));
85
+
86
+ };
87
+
88
+ Bool.prototype.getItemForValue = function (oConfig) {
89
+
90
+ // as in bool case the description is comming from the type, search for description (first match) if parsing fails
91
+ if (!oConfig.checkKey && oConfig.parsedValue === undefined && oConfig.value) {
92
+ oConfig.checkDescription = true;
93
+ }
94
+
95
+ return FixedList.prototype.getItemForValue.call(this, oConfig);
96
+
97
+ };
98
+
99
+ Bool.prototype.getValueHelpIcon = function() {
100
+
101
+ return "sap-icon://slim-arrow-down"; // need to be known before Content is created
102
+
103
+ };
104
+
105
+ Bool.prototype.getAriaAttributes = function(iMaxConditions) {
106
+
107
+ return { // return default values, but needs to be implemented by specific content
108
+ contentId: this.getId() + "-FL-List", // as list might be created async, use fix ID
109
+ ariaHasPopup: "listbox",
110
+ roleDescription: null // no multi-selection
111
+ };
112
+
113
+ };
114
+
115
+ Bool.prototype.shouldOpenOnClick = function() {
116
+
117
+ return false;
118
+
119
+ };
120
+
121
+ Bool.prototype._observeChanges = function(oChanges) {
122
+
123
+ if (oChanges.type === "property" && oChanges.name === "_config") {
124
+ _updateModel.call(this);
125
+ }
126
+
127
+ FixedList.prototype._observeChanges.apply(this, arguments);
128
+ };
129
+
130
+ function _updateModel() {
131
+ if (this._oModel) {
132
+ var oValueHelpModel = this.getModel("$valueHelp");
133
+ var oConfig = oValueHelpModel && oValueHelpModel.getProperty("/_config");
134
+
135
+ if (oConfig) {
136
+ // use texts of used type
137
+ var oType = oConfig.dataType;
138
+ var oData = this._oModel.getData();
139
+ if (oType && oData["type"] !== oType.getMetadata().getName()) {
140
+ oData["type"] = oType.getMetadata().getName();
141
+ var aItems = oData["items"];
142
+ for (var i = 0; i < aItems.length; i++) {
143
+ var oItem = aItems[i];
144
+ oItem["text"] = oType.formatValue(oItem["key"], "string");
145
+ }
146
+ this._oModel.checkUpdate(true);
147
+ }
148
+ }
149
+ }
150
+ }
151
+
152
+ /**
153
+ * Adds some item to the aggregation <code>items</code>.
154
+ *
155
+ * <b>Note:</b> Do not add items to the <code>Bool</code> content. The items will be filled by itself
156
+ *
157
+ * @param {sap.ui.mdc.field.ListFieldHelpItem} oItem The item to add; if empty, nothing is inserted
158
+ * @returns {this} Reference to <code>this</code> to allow method chaining
159
+ * @private
160
+ * @ui5-restricted sap.fe
161
+ * @MDC_PUBLIC_CANDIDATE
162
+ * @deprecated Not supported, the items are automatically set.
163
+ * @ui5-not-supported
164
+ * @name sap.ui.mdc.valuehelp.content.Bool#addItem
165
+ * @function
166
+ */
167
+
168
+ /**
169
+ * Inserts a item to the aggregation <code>items</code>.
170
+ *
171
+ * <b>Note:</b> Do not add items to the <code>Bool</code> content. The items will be filled by itself
172
+ *
173
+ * @param {sap.ui.mdc.field.ListFieldHelpItem} oItem The item to add; if empty, nothing is inserted
174
+ * @param {int} iIndex The 0-based index the item should be inserted at; for a negative value of iIndex, the item is inserted at position 0; for a value greater than the current size of the aggregation, the item is inserted at the last position
175
+ * @returns {this} Reference to <code>this</code> to allow method chaining
176
+ * @private
177
+ * @ui5-restricted sap.fe
178
+ * @MDC_PUBLIC_CANDIDATE
179
+ * @deprecated Not supported, the items are automatically set.
180
+ * @ui5-not-supported
181
+ * @name sap.ui.mdc.valuehelp.content.Bool#insertItem
182
+ * @function
183
+ */
184
+
185
+ /**
186
+ * Destroys all the items in the aggregation <code>items</code>.
187
+ *
188
+ * <b>Note:</b> Do not change items to the <code>Bool</code> content. The items will be filled by itself
189
+ *
190
+ * @returns {this} Reference to <code>this</code> to allow method chaining
191
+ * @private
192
+ * @ui5-restricted sap.fe
193
+ * @MDC_PUBLIC_CANDIDATE
194
+ * @deprecated Not supported, the items are automatically set.
195
+ * @ui5-not-supported
196
+ * @name sap.ui.mdc.valuehelp.content.Bool#destroyItems
197
+ * @function
198
+ */
199
+
200
+ /**
201
+ * Removes all the controls from the aggregation <code>items</code>.
202
+ *
203
+ * <b>Note:</b> Do not change items to the <code>Bool</code> content. The items will be filled by itself
204
+ *
205
+ * @returns {sap.ui.mdc.field.ListFieldHelpItem[]} An array of the removed elements (might be empty)
206
+ * @private
207
+ * @ui5-restricted sap.fe
208
+ * @MDC_PUBLIC_CANDIDATE
209
+ * @deprecated Not supported, the items are automatically set.
210
+ * @ui5-not-supported
211
+ * @name sap.ui.mdc.valuehelp.content.Bool#removeAllItems
212
+ * @function
213
+ */
214
+
215
+ /**
216
+ * Removes a item from the aggregation <code>items</code>.
217
+ *
218
+ * <b>Note:</b> Do not change items to the <code>Bool</code> content. The items will be filled by itself
219
+ *
220
+ * @param {int|string|sap.ui.mdc.field.ListFieldHelpItem} vItem The item to remove or its index or id
221
+ * @returns {sap.ui.mdc.field.ListFieldHelpItem} The removed item or null
222
+ * @private
223
+ * @ui5-restricted sap.fe
224
+ * @MDC_PUBLIC_CANDIDATE
225
+ * @deprecated Not supported, the items are automatically set.
226
+ * @ui5-not-supported
227
+ * @name sap.ui.mdc.valuehelp.content.Bool#removeItem
228
+ * @function
229
+ */
230
+
231
+ return Bool;
232
+ });
@@ -0,0 +1,250 @@
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/Content',
9
+ 'sap/ui/mdc/util/loadModules',
10
+ 'sap/ui/mdc/enum/SelectType',
11
+ 'sap/ui/mdc/enum/ConditionValidated',
12
+ 'sap/ui/mdc/util/Common'
13
+ ], function(
14
+ Content,
15
+ loadModules,
16
+ SelectType,
17
+ ConditionValidated,
18
+ Common
19
+ ) {
20
+ "use strict";
21
+ var Conditions = Content.extend(
22
+ "sap.ui.mdc.valuehelp.content.Conditions" /** @lends sap.ui.mdc.valuehelp.content.Conditions.prototype */,
23
+ {
24
+ metadata: {
25
+ library: "sap.ui.mdc",
26
+ interfaces: [
27
+ "sap.ui.mdc.valuehelp.ITypeaheadContent",
28
+ "sap.ui.mdc.valuehelp.IDialogContent"
29
+ ],
30
+ properties: {
31
+ // /**
32
+ // * Internal property to bind the OK button to enable or disable it.
33
+ // */
34
+ // _enableOK: {
35
+ // type: "boolean",
36
+ // group: "Appearance",
37
+ // defaultValue: true,
38
+ // visibility: "hidden"
39
+ // }
40
+ label: {
41
+ type: "string"
42
+ }
43
+ },
44
+ aggregations: {
45
+ _defineConditionPanel: {
46
+ type: "sap.ui.mdc.field.DefineConditionPanel",
47
+ multiple: false,
48
+ visibility: "hidden"
49
+ }
50
+ },
51
+ events: {}
52
+ }
53
+ }
54
+ );
55
+
56
+ // var FilterOperatorUtil;
57
+
58
+ Conditions.prototype.init = function () {
59
+ Content.prototype.init.apply(this, arguments);
60
+ this._oResourceBundle = sap.ui.getCore().getLibraryResourceBundle("sap.ui.mdc");
61
+ };
62
+
63
+ Conditions.prototype.exit = function () {
64
+
65
+ Common.cleanup(this, [
66
+ "_oScrollContainer", "_oDefineConditionPanel"
67
+ ]);
68
+
69
+ Content.prototype.exit.apply(this, arguments);
70
+ };
71
+
72
+ Conditions.prototype.getContent = function () {
73
+ return this._retrievePromise("content", function () {
74
+ return loadModules([
75
+ "sap/ui/mdc/field/DefineConditionPanel",
76
+ "sap/ui/model/base/ManagedObjectModel", // TODO use on ValueHelp level? But then how to bind local properties?
77
+ // "sap/ui/mdc/condition/FilterOperatorUtil"
78
+ "sap/m/ScrollContainer"
79
+ ]).then(function (aModules) {
80
+ var DefineConditionPanel = aModules[0];
81
+ var ManagedObjectModel = aModules[1];
82
+ // FilterOperatorUtil = aModules[2];
83
+ var ScrollContainer = aModules[2];
84
+
85
+ this._oManagedObjectModel = new ManagedObjectModel(this);
86
+ this._oDefineConditionPanel = new DefineConditionPanel(
87
+ this.getId() + "-DCP",
88
+ {
89
+ label: "{$help>/label}",
90
+ conditions: "{$help>/_conditions}",
91
+ inputOK: "{$valueHelp>/_valid}",
92
+ formatOptions: {path: "$help>/_config", formatter: _convertConfig}, // TODO: change DefineConditionPanel to use Config
93
+ conditionProcessed: _handleConditionProcessed.bind(this)
94
+ }
95
+ ).setModel(this._oManagedObjectModel, "$help");
96
+ this.setAggregation("_defineConditionPanel", this._oDefineConditionPanel, true); // to have in control tree
97
+
98
+ this._oScrollContainer = new ScrollContainer(this.getId() + "-SC", {
99
+ height: "100%",
100
+ width: "100%",
101
+ vertical: true
102
+ });
103
+
104
+ this._oScrollContainer._oWrapper = this;
105
+ this._oScrollContainer.getContent = function() {
106
+ var aContent = [];
107
+ var oDefineConditionPanel = this._oWrapper && this._oWrapper._oDefineConditionPanel;
108
+ if (oDefineConditionPanel) {
109
+ aContent.push(oDefineConditionPanel);
110
+ }
111
+ return aContent;
112
+ };
113
+ this.setAggregation("_displayContent", this._oScrollContainer);
114
+ return this._oScrollContainer;
115
+ }.bind(this));
116
+ }.bind(this));
117
+ };
118
+
119
+ Conditions.prototype.getFooterContent = function () {
120
+ return this._retrievePromise("footerContent", function () {
121
+ return loadModules(["sap/m/library", "sap/m/Button"]).then(function (aModules) {
122
+ var oMLibrary = aModules[0];
123
+ var ButtonType = oMLibrary.ButtonType;
124
+ var Button = aModules[1];
125
+ var oButtonOK = new Button(this.getId() + "-ok", {
126
+ text: this._oResourceBundle.getText("valuehelp.OK"),
127
+ enabled: "{$valueHelp>/_valid}",
128
+ type: ButtonType.Emphasized,
129
+ press: _handleOK.bind(this)
130
+ });
131
+ var oButtonCancel = new Button(this.getId() + "-cancel", {
132
+ text: this._oResourceBundle.getText("valuehelp.CANCEL"),
133
+ press: this.fireCancel.bind(this)
134
+ });
135
+ return [oButtonOK, oButtonCancel];
136
+ }.bind(this));
137
+ }.bind(this));
138
+ };
139
+
140
+ Conditions.prototype.getCount = function (aConditions) {
141
+ var iCount = 0;
142
+ // var aConditions = arguments[0] || this.get_conditions();
143
+ for (var i = 0; i < aConditions.length; i++) {
144
+ var oCondition = aConditions[i];
145
+ if (oCondition.isEmpty !== true && oCondition.validated === ConditionValidated.NotValidated) {
146
+ iCount++;
147
+ }
148
+ }
149
+ return iCount;
150
+ };
151
+
152
+ Conditions.prototype.getUseAsValueHelp = function() {
153
+ return false;
154
+ };
155
+
156
+ Conditions.prototype.getValueHelpIcon = function() {
157
+
158
+ return "sap-icon://value-help";
159
+
160
+ };
161
+
162
+ Conditions.prototype.getRequiresTokenizer = function() {
163
+ // when only the conditions content is on the dialog the tokenizer should be hidden.
164
+ return false;
165
+ };
166
+
167
+ Conditions.prototype.getFormattedTitle = function(iCount) {
168
+ var sTitle = Content.prototype.getFormattedTitle.apply(this, arguments);
169
+ if (!sTitle) {
170
+ sTitle = this._oResourceBundle.getText(iCount ? "valuehelp.DEFINECONDITIONS" : "valuehelp.DEFINECONDITIONSNONUMBER", iCount);
171
+ }
172
+ return sTitle;
173
+ };
174
+
175
+ Conditions.prototype.getFormattedSubTitle = function() {
176
+ var sSubTitle = this.getSubTitle();
177
+ if (!sSubTitle) {
178
+ sSubTitle = this._oResourceBundle.getText("valuehelp.DEFINECONDITIONS.Subtitle");
179
+ }
180
+ return sSubTitle;
181
+ };
182
+
183
+ Conditions.prototype.getAriaAttributes = function(iMaxConditions) {
184
+
185
+ return { // return default values, but needs to be implemented by specific content
186
+ contentId: this.getId() + "-DCP", // as DefineConditionPanel might be created async, use fix ID
187
+ ariaHasPopup: "dialog",
188
+ roleDescription: null // no multi-selection
189
+ };
190
+
191
+ };
192
+
193
+ //Part of IPopover?
194
+ Conditions.prototype.getPopoverConfiguration = function () {
195
+ return {
196
+ showArrow: true,
197
+ showHeader: true
198
+ };
199
+ };
200
+
201
+ function _handleOK(oEvent) {
202
+ // var aConditions = this.get_conditions();
203
+ //
204
+ // // remove empty conditions
205
+ // aConditions = Condition._removeEmptyConditions(aConditions);
206
+ // aConditions = Condition._removeInitialFlags(aConditions);
207
+ // FilterOperatorUtil.updateConditionsValues(aConditions); // to remove static text from static conditions
208
+ //
209
+ // this.fireSetConditions({conditions: aConditions});
210
+ this.fireConfirm();
211
+ }
212
+
213
+ function _handleConditionProcessed(oEvent) {
214
+ var aNextConditions = this.get_conditions();
215
+
216
+ if (this._getMaxConditions() === 1) { // TODO: Better treatment of conditions? DefineConditionPanel currently hijacks conditions
217
+ aNextConditions = aNextConditions.filter(function(oCondition){
218
+ return oCondition.validated === "NotValidated";
219
+ });
220
+ }
221
+
222
+ // remove empty conditions
223
+ // aConditions = Condition._removeEmptyConditions(aConditions);
224
+ // aConditions = Condition._removeInitialFlags(aConditions);
225
+ // FilterOperatorUtil.updateConditionsValues(aConditions); // to remove static text from static conditions
226
+
227
+ this.fireSelect({type: SelectType.Set, conditions: aNextConditions});
228
+
229
+ }
230
+
231
+ function _convertConfig(oConfig) {
232
+
233
+ // return formatOptions used by DefineConditionPanel
234
+ var oFormatOptions = {};
235
+ if (oConfig) {
236
+ oFormatOptions.valueType = oConfig.dataType;
237
+ oFormatOptions.maxConditions = oConfig.maxConditions;
238
+ oFormatOptions.delegate = oConfig.delegate;
239
+ oFormatOptions.delegateName = oConfig.delegateName;
240
+ oFormatOptions.payload = oConfig.paylod;
241
+ oFormatOptions.operators = oConfig.operators;
242
+ oFormatOptions.display = oConfig.display;
243
+ }
244
+
245
+ return oFormatOptions;
246
+
247
+ }
248
+
249
+ return Conditions;
250
+ });