@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,881 @@
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/FilterableListContent',
9
+ 'sap/ui/mdc/condition/FilterConverter',
10
+ 'sap/ui/mdc/util/loadModules',
11
+ 'sap/m/library',
12
+ 'sap/ui/model/FilterType',
13
+ 'sap/ui/model/Filter',
14
+ 'sap/ui/model/FilterOperator',
15
+ 'sap/ui/model/FilterProcessor',
16
+ 'sap/ui/mdc/util/Common',
17
+ 'sap/base/strings/formatMessage',
18
+ 'sap/ui/mdc/enum/SelectType',
19
+ 'sap/base/Log'
20
+ ], function(
21
+ FilterableListContent,
22
+ FilterConverter,
23
+ loadModules,
24
+ library,
25
+ FilterType,
26
+ Filter,
27
+ FilterOperator,
28
+ FilterProcessor,
29
+ Common,
30
+ formatMessage,
31
+ SelectType,
32
+ Log
33
+ ) {
34
+ "use strict";
35
+
36
+ var ListMode = library.ListMode;
37
+ var Sticky = library.Sticky;
38
+
39
+ var MTable = FilterableListContent.extend("sap.ui.mdc.valuehelp.content.MTable", /** @lends sap.ui.mdc.valuehelp.content.MTable.prototype */
40
+ {
41
+ metadata: {
42
+ library: "sap.ui.mdc",
43
+ interfaces: [
44
+ "sap.ui.mdc.valuehelp.ITypeaheadContent",
45
+ "sap.ui.mdc.valuehelp.IDialogContent"
46
+ ],
47
+ properties: {
48
+
49
+ },
50
+ aggregations: {
51
+ table: {
52
+ type: "sap.m.Table",
53
+ multiple: false
54
+ }
55
+ },
56
+ events: {
57
+ contentUpdated: {} // TODO: Better way to solve missing popover maxheight? Part of ITypeahead? Or is this explicitly for IPopoverContent?
58
+ },
59
+ defaultAggregation: "table"
60
+ }
61
+ });
62
+
63
+ MTable.prototype.init = function() {
64
+ FilterableListContent.prototype.init.apply(this, arguments);
65
+
66
+ this._oObserver.observe(this, {
67
+ aggregations: ["table"]
68
+ });
69
+
70
+ this._addPromise("listBinding");
71
+ this._oResourceBundle = sap.ui.getCore().getLibraryResourceBundle("sap.ui.mdc");
72
+ this._oMResourceBundle = sap.ui.getCore().getLibraryResourceBundle("sap.m");
73
+ };
74
+
75
+ MTable.prototype.getValueHelpIcon = function() {
76
+
77
+ if (this.getUseAsValueHelp()) {
78
+ return "sap-icon://slim-arrow-down";
79
+ } else {
80
+ return null;
81
+ }
82
+
83
+ };
84
+
85
+
86
+ function _updateSelection () {
87
+ if (this._oTable) {
88
+ // var aSelectedIds = this.get_conditions().filter(function (oCondition) {
89
+ // return oCondition.operator === "EQ";
90
+ // }).map(function (oCondition) {
91
+ // return oCondition.values[0];
92
+ // });
93
+ var aItems = this._oTable.getItems();
94
+ var aConditions = this.get_conditions();
95
+
96
+ for (var iId in aItems) {
97
+ var oItem = aItems[iId];
98
+ // var oContext = oItem && oItem.getBindingContext();
99
+ // var oContextValue = oContext && oContext.getObject();
100
+ // var bSelected = oContextValue && aSelectedIds.indexOf(oContextValue[this.getKeyPath()]) >= 0;
101
+ var bSelected = this._isItemSelected(oItem, aConditions);
102
+ oItem.setSelected(bSelected);
103
+ }
104
+ }
105
+ }
106
+
107
+ // function _getListItemKey(oListItem) {
108
+ // var oContext = oListItem.getBindingContext();
109
+ // var oContextValue = oContext && oContext.getObject();
110
+ // return oContextValue && oContextValue[this.getKeyPath()];
111
+ // }
112
+ MTable.prototype.applyFilters = function(sFieldSearch) {
113
+ var oListBinding = this._getListBinding();
114
+ var bValueHelpDelegateInitialized = this._isValueHelpDelegateInitialized();
115
+
116
+ if ((!oListBinding || !bValueHelpDelegateInitialized) && (this.isContainerOpening() || this.isTypeahead())) {
117
+ Promise.all([this._retrievePromise("listBinding"), this._awaitValueHelpDelegate()]).then(function () {
118
+ this.applyFilters(sFieldSearch);
119
+ }.bind(this));
120
+ return;
121
+ }
122
+
123
+ if (!bValueHelpDelegateInitialized || (!this.isTypeahead() && !this.isContainerOpen() && oListBinding.isSuspended())) {
124
+ return;
125
+ }
126
+
127
+ var oDelegate = this._getValueHelpDelegate();
128
+ var oValueHelpModel = this.getModel("$valueHelp");
129
+ var oDelegatePayload = oValueHelpModel && oValueHelpModel.getObject("/delegate").payload;
130
+
131
+ var oFilterBar = this._getPriorityFilterBar();
132
+ var oConditions = oFilterBar ? oFilterBar.getInternalConditions() : this.getProperty("_inConditions"); // use InParameter if no FilterBar
133
+ var oConditionTypes = oConditions && this._getTypesForConditions(oConditions);
134
+ var oFilter = oConditions && FilterConverter.createFilters( oConditions, oConditionTypes, undefined, this.getCaseSensitive());
135
+ var aFilters = oFilter && [oFilter];
136
+ var sSearch = this.isTypeahead() ? sFieldSearch : oFilterBar && oFilterBar.getSearch();
137
+
138
+ var bUseFilter = true;
139
+ var oFilterInfo;
140
+
141
+ // TODO: Talk to Sebastian or Model guys why this does not work in this scenario (Cannot read property 'getAST' of undefined)
142
+ try {
143
+ oFilterInfo = oListBinding.getFilterInfo();
144
+ } catch (error) {
145
+ Log.info("ValueHelp-Filter: getFilterInfo threw error");
146
+ }
147
+
148
+ if (!aFilters) {
149
+ aFilters = [];
150
+ }
151
+
152
+ if (aFilters.length === 0 && !oFilterInfo) {
153
+ // no filter already exists and none should be set (Suggestion without In-Parameter)
154
+ bUseFilter = false;
155
+ }
156
+
157
+ if (oDelegate && oDelegate.isSearchSupported(oDelegatePayload, oListBinding)){
158
+ if (!oListBinding.isSuspended() && bUseFilter) {
159
+ // as we trigger two changes this would result to two requests therefore we suspend the binding
160
+ oListBinding.suspend();
161
+ }
162
+
163
+ oDelegate.executeSearch(oDelegatePayload, oListBinding, sSearch);
164
+ Log.info("ValueHelp-Search: " + sSearch);
165
+ }
166
+
167
+ if (bUseFilter) {
168
+ oListBinding.filter(aFilters, FilterType.Application);
169
+ Log.info("ValueHelp-Filter: " + this._prettyPrintFilters.call(this, aFilters));
170
+ }
171
+
172
+ if (oListBinding.isSuspended()) {
173
+ // if ListBinding is suspended resume it after filters are set
174
+ oListBinding.resume();
175
+ }
176
+ };
177
+
178
+ MTable.prototype._handleSelectionChange = function (oEvent) {
179
+ var bIsTypeahead = this.isTypeahead();
180
+ if (!bIsTypeahead || !this._isSingleSelect()) {
181
+ var oParams = oEvent.getParameters();
182
+ var aListItems = oParams.listItems || oParams.listItem && [oParams.listItem];
183
+ var aConditions = aListItems.map(function (oItem) {
184
+ // var sKey = _getListItemKey.call(this, oItem);
185
+ // return sKey && this._createCondition(sKey);
186
+ var oValues = this._getItemFromContext(oItem.getBindingContext());
187
+ return oValues && this._createCondition(oValues.key, oValues.description, oValues.inParameters, oValues.outParameters);
188
+ }.bind(this));
189
+ this.fireSelect({type: oParams.selected ? SelectType.Add : SelectType.Remove, conditions: aConditions});
190
+ if (bIsTypeahead) {
191
+ this.fireConfirm();
192
+ }
193
+ }
194
+ };
195
+
196
+ MTable.prototype._handleItemPress = function (oEvent) {
197
+ var oItem = oEvent.getParameter("listItem");
198
+ // var oKey = _getListItemKey.call(this, oItem);
199
+ var oValues = this._getItemFromContext(oItem.getBindingContext());
200
+ var bIsSingleSelect = this._isSingleSelect();
201
+ var bSelected = bIsSingleSelect ? true : !oItem.getSelected();
202
+ var sSelectType = SelectType.Set;
203
+
204
+ if (!bIsSingleSelect) {
205
+ oItem.setSelected(bSelected);
206
+ sSelectType = bSelected ? SelectType.Add : SelectType.Remove;
207
+ }
208
+ // var oCondition = this._createCondition(oKey);
209
+ var oCondition = this._createCondition(oValues.key, oValues.description, oValues.inParameters, oValues.outParameters);
210
+ this.fireSelect({type: sSelectType, conditions: [oCondition]});
211
+ if (this.isTypeahead()) {
212
+ this.fireConfirm({close: true});
213
+ }
214
+ };
215
+
216
+ MTable.prototype._handleUpdateFinished = function () {
217
+ _updateSelection.apply(this);
218
+ this.fireContentUpdated();
219
+ };
220
+
221
+ MTable.prototype.getContentHeight = function () { // Part of iTypeAhead? iPopover? Better solution for popover height?
222
+ var oTable = this._getTable();
223
+ var oDomRef = oTable && oTable.getDomRef();
224
+ return oDomRef && Math.round(oDomRef.getBoundingClientRect().height);
225
+ };
226
+
227
+ MTable.prototype._getTable = function () {
228
+ return this._oTable;
229
+ };
230
+
231
+ MTable.prototype.onShow = function () {
232
+ var oTable = this._getTable();
233
+ if (oTable) {
234
+ if (!oTable.hasStyleClass("sapMComboBoxList")) { // TODO: only in typeahead case?
235
+ oTable.addStyleClass("sapMComboBoxList"); // to allow focus outline in navigation
236
+ }
237
+ }
238
+
239
+ FilterableListContent.prototype.onShow.apply(this, arguments);
240
+ };
241
+
242
+ MTable.prototype.onHide = function () {
243
+ FilterableListContent.prototype.onHide.apply(this, arguments);
244
+ var oTable = this.getTable();
245
+ if (oTable) {
246
+ this.removeFocus();
247
+ if (oTable.hasStyleClass("sapMComboBoxList")) {
248
+ oTable.removeStyleClass("sapMComboBoxList");
249
+ }
250
+ }
251
+ };
252
+
253
+ MTable.prototype._handleConditionsUpdate = function(oChanges) {
254
+ _updateSelection.call(this);
255
+ };
256
+
257
+ MTable.prototype.getContent = function () {
258
+ if (!this.isTypeahead()) {
259
+ return this._retrievePromise("wrappedContent", function () {
260
+ return loadModules([
261
+ "sap/ui/layout/FixFlex",
262
+ "sap/m/VBox",
263
+ "sap/m/Panel",
264
+ "sap/m/ScrollContainer"
265
+ ]).then(function(aModules) {
266
+
267
+ var FixFlex = aModules[0];
268
+ var VBox = aModules[1];
269
+ var Panel = aModules[2];
270
+ var ScrollContainer = aModules[3];
271
+
272
+ if (!this._oContentLayout) {
273
+
274
+ this._oFilterBarVBox = new VBox(this.getId() + "-FilterBarBox", {visible: "{$this>/_filterBarVisible}"});
275
+ this._oFilterBarVBox.addStyleClass("sapMdcValueHelpPanelFilterbar");
276
+ this._oFilterBarVBox._oWrapper = this;
277
+ this._oFilterBarVBox.getItems = function () {
278
+ return [this._oWrapper._getPriorityFilterBar.call(this._oWrapper)];
279
+ };
280
+
281
+ var _formatTableTitle = function (sText) {
282
+ var iItems = 0; //TODO from where do we get the count
283
+ if (iItems === 0) {
284
+ sText = this.getModel("$i18n").getResourceBundle().getText("valuehelp.TABLETITLENONUMBER");
285
+ }
286
+ return formatMessage(sText, iItems);
287
+ };
288
+
289
+ this._oTablePanel = new Panel(this.getId() + "-TablePanel", { expanded: true, height: "100%", headerText: {parts: ['$i18n>valuehelp.TABLETITLE'], formatter: _formatTableTitle}});
290
+ this._oTablePanel.addStyleClass("sapMdcTablePanel");
291
+
292
+ this._oContentLayout = new FixFlex(this.getId() + "-FF", {minFlexSize: 200, fixContent: this._oFilterBarVBox, flexContent: this._oTablePanel});
293
+
294
+ this._oScrollContainer = new ScrollContainer(this.getId() + "-SC", {
295
+ height: "100%",
296
+ width: "100%",
297
+ vertical: true
298
+ });
299
+
300
+ this._oScrollContainer._oWrapper = this;
301
+ this._oScrollContainer.getContent = function() {
302
+ var aContent = [];
303
+ var oTable = this._oWrapper && this._oWrapper._oTable;
304
+ if (oTable) {
305
+ aContent.push(oTable);
306
+ }
307
+ return aContent;
308
+ };
309
+
310
+ this._oTablePanel.addContent(this._oScrollContainer);
311
+ }
312
+
313
+ this.setAggregation("_displayContent", this._oContentLayout);
314
+
315
+ var oFilterBar = this._getPriorityFilterBar();
316
+ if (!oFilterBar) {
317
+ return this._createDefaultFilterBar().then(function () {
318
+ return this._oContentLayout;
319
+ }.bind(this));
320
+ }
321
+ return this._oContentLayout;
322
+ }.bind(this));
323
+ }.bind(this));
324
+ }
325
+ return this._oTable;
326
+ };
327
+
328
+ MTable.prototype.getFooterContent = function () {
329
+ return this._retrievePromise("footer", function () {
330
+ return this._retrievePromise("listBinding").then(function (oListBinding) {
331
+ var oBindingInfo = this._getListBindingInfo();
332
+ if (oBindingInfo && oBindingInfo.length) {
333
+ return loadModules(["sap/m/Button", "sap/m/Toolbar", "sap/m/ToolbarSpacer"]).then(function (aModules) {
334
+ var Button = aModules[0];
335
+ var Toolbar = aModules[1];
336
+ var ToolbarSpacer = aModules[2];
337
+ var oShowAllItemsButton = new Button(this.getId() + "-showAllItems", {
338
+ text: this._oMResourceBundle.getText("INPUT_SUGGESTIONS_SHOW_ALL"),
339
+ press: function () {
340
+ this.fireRequestSwitchToDialog();
341
+ }.bind(this)
342
+ });
343
+ var aToolbarContent = [new ToolbarSpacer(this.getId() + "-Spacer")].concat(oShowAllItemsButton);
344
+ var oFooter = new Toolbar(this.getId() + "-TB", {
345
+ content: aToolbarContent
346
+ });
347
+ return oFooter;
348
+ }.bind(this));
349
+ }
350
+ }.bind(this));
351
+ }.bind(this));
352
+ };
353
+
354
+ MTable.prototype.getItemForValue = function (oConfig) {
355
+
356
+ if (!oConfig.checkKey && oConfig.parsedValue && !oConfig.checkDescription) {
357
+ return null;
358
+ }
359
+
360
+ /* load data from model if nothing is found in the current items / contexts
361
+ / steps:
362
+ 0. determine if key or desc entered ??
363
+ 1. wait for table binding
364
+ 2. consider existing inparameters
365
+ */
366
+ oConfig.caseSensitive = oConfig.caseSensitive || this.getCaseSensitive();
367
+
368
+ return _checkListBindingPending.call(this).then(function(bReady) {
369
+ var oResult;
370
+
371
+ if (bReady) {
372
+ var oTable = this.getTable();
373
+ oResult = _filterItems.call(this, oConfig, oTable.getItems());
374
+ }
375
+
376
+ if (!oResult) {
377
+ oResult = this._loadItemForValue(oConfig);
378
+ }
379
+
380
+ return oResult;
381
+ }.bind(this));
382
+
383
+ };
384
+
385
+ function _checkListBindingPending() {
386
+ return this._retrievePromise("listBinding").then(function (oListBinding) {
387
+ var oDelegate = this._getValueHelpDelegate();
388
+ var oValueHelpModel = this.getModel("$valueHelp");
389
+ var oDelegatePayload = oValueHelpModel && oValueHelpModel.getObject("/delegate").payload;
390
+ var oListBindingInfo = this._getListBindingInfo();
391
+ if (oListBinding && oDelegate){
392
+ return oDelegate.checkListBindingPending(oDelegatePayload, oListBinding, oListBindingInfo);
393
+ } else {
394
+ return false;
395
+ }
396
+ }.bind(this));
397
+ }
398
+
399
+ function _filterItems(oConfig, aItems) {
400
+
401
+ var aFields = [];
402
+
403
+ if (oConfig.checkKey && oConfig.hasOwnProperty("parsedValue")) { // empty string or false could be key too
404
+ aFields.push({path: this.getKeyPath(), value: oConfig.parsedValue});
405
+ }
406
+ if (oConfig.checkDescription && oConfig.value) {
407
+ aFields.push({path: this.getDescriptionPath(), value: oConfig.value});
408
+ }
409
+
410
+ var _getFilterValue = function(oItem, sPath) {
411
+ var oBindingContext = oItem.isA("sap.ui.model.Context") ? oItem : oItem.getBindingContext();
412
+ return oBindingContext.getProperty(sPath);
413
+ };
414
+
415
+ var oFilter;
416
+ var aFilters = [];
417
+ var aInParameters;
418
+ var aOutParameters;
419
+ var i = 0;
420
+
421
+ for (i = 0; i < aFields.length; i++) {
422
+ if (!aFields[i].path) {
423
+ throw new Error("path for filter missing"); // as we cannot filter key or description without path
424
+ }
425
+ aFilters.push(new Filter({path: aFields[i].path, operator: FilterOperator.EQ, value1: aFields[i].value, caseSensitive: oConfig.caseSensitive}));
426
+ }
427
+ if (aFilters.length === 1) {
428
+ oFilter = aFilters[0];
429
+ } else {
430
+ oFilter = new Filter({filters: aFilters, and: false}); // key OR description
431
+ }
432
+
433
+ if (oConfig.inParameters/* || oConfig.outParameters*/) {
434
+ aFilters = [oFilter];
435
+ if (oConfig.inParameters) {
436
+ aFilters.push(oConfig.inParameters);
437
+ aInParameters = []; // TODO: maybe provide paths from outside? No need to analyze Filters backwards
438
+ if (!oConfig.inParameters.aFilters) {
439
+ aInParameters.push(oConfig.inParameters.sPath);
440
+ } else {
441
+ for (var i = 0; i < oConfig.inParameters.aFilters.length; i++) {
442
+ if (aInParameters.indexOf(oConfig.inParameters.aFilters[i].sPath) < 0) {
443
+ aInParameters.push(oConfig.inParameters.aFilters[i].sPath);
444
+ }
445
+ }
446
+ }
447
+ }
448
+ // if (oConfig.outParameters) {
449
+ // aFilters.push(oConfig.outParameters);
450
+ // }
451
+ oFilter = new Filter({filters: aFilters, and: true});
452
+ }
453
+
454
+ var aFilteredItems = FilterProcessor.apply(aItems, oFilter, _getFilterValue);
455
+ if (aFilteredItems.length === 1) {
456
+ var oValue = this._getItemFromContext(aFilteredItems[0].getBindingContext(), {inParameters: aInParameters, outParameters: aOutParameters});
457
+ return {key: oValue.key, description: oValue.description, inParameters: oValue.inParameters, outParameters: oValue.outParameters};
458
+ } else if (aFilteredItems.length > 1) {
459
+ if (!oConfig.caseSensitive) {
460
+ // try with case sensitive search
461
+ return _filterItems.call(this, oConfig, aItems);
462
+ }
463
+ throw _createException.call(this, oConfig.exception, true, aFields[0].value);
464
+ }
465
+
466
+ }
467
+
468
+ MTable.prototype._getListBinding = function () {
469
+ var oTable = this._getTable();
470
+ return oTable && oTable.getBinding("items");
471
+ };
472
+
473
+ MTable.prototype._getListBindingInfo = function () {
474
+ var oTable = this._getTable();
475
+ return oTable && oTable.getBindingInfo("items");
476
+ };
477
+
478
+ MTable.prototype._loadItemForValue = function (oConfig) {
479
+
480
+ if (!oConfig.checkKey && oConfig.parsedValue && !oConfig.checkDescription) {
481
+ return null;
482
+ }
483
+
484
+ /* steps:
485
+ TODO: 1. wait for table binding
486
+ 2. consider existing inparameters
487
+ */
488
+ var sKeyPath = this.getKeyPath();
489
+ var sDescriptionPath = this.getDescriptionPath();
490
+ var bUseFirstMatch = this.getUseFirstMatch();
491
+ var bCaseSensitive = oConfig.caseSensitive;
492
+
493
+ var oTable = this._getTable();
494
+ var oListBinding = oTable && oTable.getBinding("items"); //this.getListBinding();
495
+ var oBindingContext = oListBinding && oListBinding.getContext();
496
+ var oModel = oListBinding && oListBinding.getModel();
497
+ var sPath = oListBinding && oListBinding.getPath();
498
+
499
+ var oDelegate = this._getValueHelpDelegate();
500
+ var oValueHelpModel = this.getModel("$valueHelp");
501
+ var oDelegatePayload = oValueHelpModel && oValueHelpModel.getObject("/delegate").payload;
502
+
503
+ var sPromiseKey = ["loadItemForValue", sPath, sKeyPath, oConfig.parsedValue || oConfig.value].join("_");
504
+
505
+ return this._retrievePromise(sPromiseKey, function () {
506
+
507
+ var aFilters = [];
508
+
509
+ if (oConfig.checkKey && oConfig.hasOwnProperty("parsedValue")) { // empty string or false could be key too
510
+ aFilters.push(new Filter({ path: sKeyPath, operator: FilterOperator.EQ, value1: oConfig.parsedValue, caseSensitive: bCaseSensitive}));
511
+ }
512
+ if (oConfig.checkDescription && oConfig.value) {
513
+ aFilters.push(new Filter({path: sDescriptionPath, operator: FilterOperator.EQ, value1: oConfig.value, caseSensitive: bCaseSensitive}));
514
+ }
515
+
516
+ var oFilter = aFilters.length > 1 ? new Filter({filters: aFilters, and: false}) : aFilters[0];
517
+ aFilters = [oFilter];
518
+
519
+ if (oConfig.inParameters) {
520
+ // use in-parameters as additional filters
521
+ aFilters.push(oConfig.inParameters);
522
+ }
523
+
524
+ // if (oConfig.oOutParameters) {
525
+ // // use out-parameters as additional filters (only if not already set by InParameter
526
+ // if (oConfig.oInParameters) {
527
+ // var aOutFilters = oConfig.oOutParameters.aFilters ? oConfig.oOutParameters.aFilters : [oConfig.oOutParameters];
528
+ // var aInFilters = oConfig.oInParameters.aFilters ? oConfig.oInParameters.aFilters : [oConfig.oInParameters];
529
+ // for (var i = 0; i < aOutFilters.length; i++) {
530
+ // var oOutFilter = aOutFilters[i];
531
+ // var bFound = false;
532
+ // for (var j = 0; j < aInFilters.length; j++) {
533
+ // var oInFilter = aInFilters[j];
534
+ // if (oInFilter.sPath === oOutFilter.sPath && oInFilter.oValue1 === oOutFilter.oValue1 && oInFilter.oValue2 === oOutFilter.oValue2) {
535
+ // bFound = true;
536
+ // break;
537
+ // }
538
+ // }
539
+ // if (!bFound) {
540
+ // aFilters.push(oOutFilter);
541
+ // }
542
+ // }
543
+ // } else {
544
+ // aFilters.push(oConfig.oOutParameters);
545
+ // }
546
+ // }
547
+
548
+ oFilter = aFilters.length > 1 ? new Filter({filters: aFilters, and: true}) : aFilters[0];
549
+ var oFilterListBinding = oModel.bindList(sPath, oBindingContext);
550
+
551
+ return oDelegate.executeFilter(oDelegatePayload, oFilterListBinding, oFilter, 2).then(function (oBinding) {
552
+ var aContexts = oBinding.getContexts();
553
+
554
+ setTimeout(function() { // as Binding might process other steps after event was fired - destroy it lazy
555
+ oFilterListBinding.destroy();
556
+ }, 0);
557
+
558
+ if (aContexts.length && (aContexts.length < 2 || bUseFirstMatch)) {
559
+ return this._getItemFromContext(aContexts[0], {keyPath: sKeyPath, descriptionPath: sDescriptionPath});
560
+ } else if (oConfig.checkKey && oConfig.parsedValue === "" && aContexts.length === 0) {
561
+ // nothing found for empty key -> this is not an error
562
+ return null;
563
+ } else {
564
+ var oException = _createException.call(this, oConfig.exception, aContexts.length > 1, oConfig.value);
565
+ throw oException;
566
+ }
567
+ }.bind(this));
568
+ }.bind(this));
569
+ };
570
+
571
+ function _createException(Exception, bNotUnique, vValue) {
572
+
573
+ var sError;
574
+ if (bNotUnique) {
575
+ sError = this._oResourceBundle.getText("valuehelp.VALUE_NOT_UNIQUE", [vValue]);
576
+ } else {
577
+ sError = this._oResourceBundle.getText("valuehelp.VALUE_NOT_EXIST", [vValue]);
578
+ }
579
+ var oException = new Exception(sError);
580
+ oException._bNotUnique = bNotUnique; // TODO: better solution?
581
+ return oException;
582
+
583
+ }
584
+
585
+ MTable.prototype.isValidationSupported = function(oConfig) {
586
+ return true;
587
+ };
588
+
589
+ MTable.prototype._isTableReady = function () {
590
+ var oTable = this._getTable();
591
+ var oListBinding = oTable && oTable.getBinding("items");
592
+
593
+ if (!oTable || !oListBinding) {
594
+ return false;
595
+ }
596
+
597
+ if (oListBinding && (oListBinding.isSuspended() || oListBinding.getLength() === 0)) {
598
+ return false; // if no context exist, Table is not ready
599
+ }
600
+
601
+ return true;
602
+ };
603
+
604
+
605
+ MTable.prototype.navigate = function (iStep) {
606
+
607
+ var oListBinding = this._getListBinding();
608
+
609
+ if (!oListBinding) { // collect navigates until listbinding is available
610
+ return this._retrievePromise("listBinding").then(function (oAsyncListBinding) {
611
+ return this.navigate(iStep);
612
+ }.bind(this));
613
+ }
614
+
615
+ if (!oListBinding.getLength()) {
616
+ return _checkListBindingPending.call(this).then(function (bReady) {
617
+ if (bReady) {
618
+ return this.navigate(iStep);
619
+ }
620
+ return false;
621
+ }.bind(this));
622
+ }
623
+
624
+ var oTable = this._getTable();
625
+ oTable.addStyleClass("sapMListFocus"); // to show focus outline on navigated item
626
+
627
+ var aItems = this._oTable.getItems();
628
+ var oSelectedItem = oTable.getSelectedItem();
629
+ var iItems = aItems.length;
630
+ var iSelectedIndex = 0;
631
+ var bLeaveFocus = false;
632
+
633
+ if (oSelectedItem) {
634
+ iSelectedIndex = aItems.indexOf(oSelectedItem);
635
+ iSelectedIndex = iSelectedIndex + iStep;
636
+ } else if (iStep >= 0){
637
+ iSelectedIndex = iStep - 1;
638
+ } else {
639
+ iSelectedIndex = iItems + iStep;
640
+ }
641
+
642
+ if (this._getMaxConditions() !== 1) { // || (oFirstSelectedItem && !oTableItemForFirstSelection) prevent navigation if selected item noch present in table?
643
+ if (this.getParent().isOpen()) {
644
+ oTable.focus();
645
+ return;
646
+ }
647
+ }
648
+
649
+ var bSearchForNext;
650
+ if (iSelectedIndex < 0) {
651
+ iSelectedIndex = 0;
652
+ bSearchForNext = true;
653
+ bLeaveFocus = true;
654
+ } else if (iSelectedIndex >= iItems - 1) {
655
+ iSelectedIndex = iItems - 1;
656
+ bSearchForNext = false;
657
+ } else {
658
+ bSearchForNext = iStep >= 0;
659
+ }
660
+
661
+ while (aItems[iSelectedIndex] && aItems[iSelectedIndex].isA("sap.m.GroupHeaderListItem")) { // ignore group headers
662
+ if (bSearchForNext) {
663
+ iSelectedIndex++;
664
+ } else {
665
+ iSelectedIndex--;
666
+ }
667
+ }
668
+
669
+ var oItem = aItems[iSelectedIndex];
670
+ if (oItem) {
671
+ var oCondition;
672
+ if (oItem !== oSelectedItem) {
673
+ oItem.setSelected(true);
674
+
675
+ var oValues = this._getItemFromContext(oItem.getBindingContext());
676
+ oCondition = oValues && this._createCondition(oValues.key, oValues.description, oValues.inParameters, oValues.outParameters);
677
+ this.setProperty("_conditions", [oCondition], true);
678
+
679
+ if (this._bVisible) {
680
+ this._handleScrolling(oItem);
681
+ }
682
+ this.fireNavigated({condition: oCondition, itemId: oItem.getId(), leaveFocus: false});
683
+ } else if (bLeaveFocus) {
684
+ this.fireNavigated({condition: undefined, itemId: undefined, leaveFocus: bLeaveFocus});
685
+ }
686
+ }
687
+ };
688
+
689
+ MTable.prototype._handleScrolling = function (oItem) {
690
+ var oScrollDelegate = this.getScrollDelegate();
691
+ if (oScrollDelegate) {
692
+ var oTable = this._getTable();
693
+ var iIndex = !isNaN(oItem) ? oItem : oTable.indexOfItem(oItem);
694
+ oTable.scrollToIndex(iIndex).catch(function (oError) {
695
+ // TODO: Handle scroll error?
696
+ });
697
+ return true;
698
+ }
699
+ return false;
700
+ };
701
+
702
+ // Table needs to know the ScrollDelegate of the parent, so we provide it here.
703
+ MTable.prototype.getScrollDelegate = function() {
704
+ if (/* !this.isTypeahead() && */ this._oScrollContainer) {
705
+ return this._oScrollContainer.getScrollDelegate();
706
+ }
707
+ return FilterableListContent.prototype.getScrollDelegate.apply(this, arguments);
708
+ };
709
+
710
+
711
+ MTable.prototype.removeFocus = function() {
712
+
713
+ var oTable = this.getTable();
714
+ if (oTable) {
715
+ oTable.removeStyleClass("sapMListFocus");
716
+ }
717
+
718
+ };
719
+
720
+ MTable.prototype.getAriaAttributes = function(iMaxConditions) {
721
+
722
+ var oTable = this.getTable();
723
+
724
+ return { // return default values, but needs to be implemented by specific content
725
+ contentId: oTable && oTable.getId(), // if open, table should be there; if closed, not needed
726
+ ariaHasPopup: "listbox",
727
+ roleDescription: null // TODO: no multi-selection
728
+ };
729
+ };
730
+
731
+ function _adjustTable () {
732
+ if (this._oTable && this.getParent()) {
733
+
734
+ var aSticky = this._oTable.getSticky();
735
+ if (!aSticky || aSticky.length === 0) {
736
+ // make headers sticky
737
+ this._oTable.setSticky([Sticky.ColumnHeaders]);
738
+ }
739
+
740
+ if (this.isTypeahead()) {
741
+ if (this._isSingleSelect()) {
742
+ this._oTable.setMode(ListMode.SingleSelectMaster);
743
+ } else {
744
+ this._oTable.setMode(ListMode.MultiSelect);
745
+ }
746
+ } else if (this._isSingleSelect()) {
747
+ this._oTable.setMode(ListMode.SingleSelectLeft);
748
+ } else {
749
+ this._oTable.setMode(ListMode.MultiSelect);
750
+ }
751
+ }
752
+ }
753
+ MTable.prototype.setParent = function(oParent) {
754
+ FilterableListContent.prototype.setParent.apply(this, arguments);
755
+ _adjustTable.call(this);
756
+ };
757
+
758
+ var _handleSearch = function () {
759
+ return this.applyFilters(this.get_filterValue());
760
+ };
761
+
762
+ MTable.prototype._observeChanges = function (oChanges) {
763
+
764
+ var oFilterBar, oDefaultFilterBar;
765
+ if (oChanges.name === "_defaultFilterBar") {
766
+ oDefaultFilterBar = oChanges.child;
767
+ if (oChanges.mutation === "insert") {
768
+ oFilterBar = this.getFilterBar();
769
+ if (!oFilterBar) {
770
+ oDefaultFilterBar.attachSearch(_handleSearch, this);
771
+ }
772
+ } else {
773
+ oDefaultFilterBar.detachSearch(_handleSearch, this);
774
+ }
775
+ }
776
+
777
+ if (oChanges.name === "filterBar") {
778
+ oFilterBar = oChanges.child;
779
+ oDefaultFilterBar = this.get_defaultFilterBar();
780
+ if (oChanges.mutation === "insert") {
781
+ if (oDefaultFilterBar) {
782
+ oDefaultFilterBar.detachSearch(_handleSearch, this);
783
+ }
784
+ oFilterBar.attachSearch(_handleSearch, this);
785
+ } else {
786
+ if (oDefaultFilterBar) {
787
+ oDefaultFilterBar.attachSearch(_handleSearch, this);
788
+ }
789
+ oFilterBar.detachSearch(_handleSearch, this);
790
+ }
791
+ }
792
+
793
+ if (oChanges.name === "_config") {
794
+ _adjustTable.call(this);
795
+ }
796
+
797
+ if (oChanges.name === "items" && oChanges.mutation === "ready") {
798
+ this._resolvePromise("listBinding", oChanges.bindingInfo.binding);
799
+ }
800
+
801
+ if (oChanges.name === "table") {
802
+ var oTable = oChanges.child;
803
+
804
+ if (oChanges.mutation === "remove") {
805
+ this._oObserver.unobserve(oTable);
806
+ oTable.removeDelegate(this._oTableDelegate);
807
+ this._oTable.detachItemPress(this._handleItemPress, this);
808
+ this._oTable.detachSelectionChange(this._handleSelectionChange, this);
809
+ this._oTable.detachUpdateFinished(this._handleUpdateFinished, this);
810
+ this._oTable = null;
811
+ this._removePromise("footer");
812
+ this._addPromise("listBinding");
813
+ } else {
814
+ this._oTable = oTable;
815
+ _adjustTable.call(this);
816
+ this._oTable.attachItemPress(this._handleItemPress, this);
817
+ this._oTable.attachSelectionChange(this._handleSelectionChange, this);
818
+ this._oTable.attachUpdateFinished(this._handleUpdateFinished, this);
819
+ this._oTableDelegate = this._oTableDelegate || {
820
+ onsapprevious: this._handleTableEvent,
821
+ onsapnext: this._handleTableEvent,
822
+ cellClick: this._handleTableEvent
823
+ };
824
+ oTable.addDelegate(this._oTableDelegate, true, this);
825
+
826
+ var oListBinding = oTable.getBinding("items"); // TODO: wait for binding ready??
827
+ if (oListBinding) {
828
+ this._resolvePromise("listBinding", oListBinding);
829
+ } else {
830
+ this._oObserver.observe(oChanges.child, {bindings: ["items"]});
831
+ }
832
+ }
833
+ }
834
+
835
+ FilterableListContent.prototype._observeChanges.apply(this, arguments);
836
+ };
837
+
838
+ MTable.prototype._handleTableEvent = function (oEvent) {
839
+
840
+ if (!this.isTypeahead()) {
841
+ return;
842
+ }
843
+
844
+ var oTable = this._getTable();
845
+ var oItem = jQuery(oEvent.target).control(0);
846
+
847
+ switch (oEvent.type) {
848
+ case "sapprevious":
849
+ if (oItem.isA("sap.m.ListItemBase")) {
850
+ if (oTable.indexOfItem(oItem) === 0) {
851
+ this.fireNavigated({condition: undefined, itemId: undefined, leaveFocus: true});
852
+ oEvent.preventDefault();
853
+ oEvent.stopPropagation();
854
+ oEvent.stopImmediatePropagation(true);
855
+ }
856
+ }
857
+ break;
858
+ default:
859
+ break;
860
+ }
861
+ };
862
+
863
+ MTable.prototype.isQuickSelectSupported = function() {
864
+ return true;
865
+ };
866
+
867
+ MTable.prototype.shouldOpenOnNavigate = function() {
868
+ return true;
869
+ };
870
+
871
+ MTable.prototype.exit = function () {
872
+
873
+ Common.cleanup(this, [
874
+ "_sTableWidth", "_oTable", "_oScrollContainer", "_oContentLayout", "_oTablePanel", "_oFilterBarVBox", "_oMResourceBundle", "_oResourceBundle"
875
+ ]);
876
+
877
+ FilterableListContent.prototype.exit.apply(this, arguments);
878
+ };
879
+
880
+ return MTable;
881
+ });