@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,619 @@
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/util/loadModules',
10
+ 'sap/base/util/deepEqual',
11
+ 'sap/ui/mdc/enum/SelectType',
12
+ 'sap/ui/mdc/library',
13
+ 'sap/m/library',
14
+ "sap/ui/table/library",
15
+ "sap/ui/mdc/p13n/Engine",
16
+ "sap/ui/mdc/enum/PersistenceMode"
17
+
18
+ ], function(
19
+ FilterableListContent,
20
+ loadModules,
21
+ deepEqual,
22
+ SelectType,
23
+ library,
24
+ mLibrary,
25
+ uiTableLibrary,
26
+ Engine,
27
+ PersistenceMode
28
+ ) {
29
+ "use strict";
30
+
31
+ var ListMode = mLibrary.ListMode;
32
+ var Sticky = mLibrary.Sticky;
33
+ var MDCSelectionMode = library.SelectionMode;
34
+
35
+ var UITableVisibleRowCountMode = uiTableLibrary.VisibleRowCountMode;
36
+ var UITableSelectionMode = uiTableLibrary.SelectionMode;
37
+ var UITableSelectionBehavior = uiTableLibrary.SelectionBehavior;
38
+
39
+ var _getMDCTableType = function(oTable) {
40
+ var sType, oType = sType = oTable && oTable.getType();
41
+ if (!oType) {
42
+ sType = "Table"; // back to the default behaviour
43
+ } else if (typeof oType === "object") {
44
+ if (oType.isA("sap.ui.mdc.table.ResponsiveTableType")) {
45
+ sType = "ResponsiveTable";
46
+ } else {
47
+ sType = "Table";
48
+ }
49
+ }
50
+ return sType;
51
+ };
52
+
53
+ var _setupTableHelper = function () {
54
+ var oTable = this._getTable();
55
+ var oInnerTable = oTable && oTable._oTable;
56
+ var oListBinding = oTable.getRowBinding();
57
+
58
+ var _getUITableSelectionHandler = function () {
59
+ return this._oUITableSelectionPlugin || oInnerTable;
60
+ }.bind(this);
61
+
62
+ var _fireSelect = function (oItem, bSelected) {
63
+ var oValues = this._getItemFromContext(oItem.getBindingContext());
64
+ var oCondition = oValues && this._createCondition(oValues.key, oValues.description, oValues.inParameters, oValues.outParameters);
65
+ var sAddRemoveType = bSelected ? SelectType.Add : SelectType.Remove;
66
+ this.fireSelect({type: this._isSingleSelect() ? SelectType.Set : sAddRemoveType, conditions: [oCondition]});
67
+ };
68
+
69
+ var MDCTableHelperConfig = {
70
+ "ResponsiveTable": {
71
+ getListBindingInfo: function () {
72
+ return oInnerTable && oInnerTable.getBindingInfo("items");
73
+ },
74
+ getItems: function () {
75
+ return oInnerTable.getItems();
76
+ },
77
+ getSelectedItems: function () {
78
+ return oInnerTable.getSelectedItems();
79
+ },
80
+ modifySelection: function (oItem, bSelected) {
81
+ if (oItem.getSelected() !== bSelected) {
82
+ oItem.setSelected(bSelected);
83
+ }
84
+ },
85
+ handleItemPress: function (oEvent) {
86
+ var oItem = oEvent.getParameter("listItem");
87
+ if (!this.isTypeahead() || !this._isSingleSelect()) {
88
+ oItem.setSelected(!oItem.getSelected());
89
+ }
90
+ _fireSelect.call(this, oItem, oItem.getSelected());
91
+ },
92
+ handleSelectionChange: function (oEvent) {
93
+ if (!this.isTypeahead() || !this._isSingleSelect()) { // single-suggestion handled in this._handleItemPress
94
+ var oParams = oEvent.getParameters();
95
+ var aListItems = oParams.listItems || oParams.listItem && [oParams.listItem];
96
+ var aConditions = aListItems.map(function (oItem) {
97
+ // var sKey = _getListItemKey.call(this, oItem);
98
+ // return sKey && this._createCondition(sKey);
99
+ var oValues = this._getItemFromContext(oItem.getBindingContext());
100
+ return oValues && this._createCondition(oValues.key, oValues.description, oValues.inParameters, oValues.outParameters);
101
+ }.bind(this));
102
+ this.fireSelect({type: oParams.selected ? SelectType.Add : SelectType.Remove, conditions: aConditions});
103
+ }
104
+ },
105
+ adjustTable: function () {
106
+ var aSticky = oInnerTable.getSticky();
107
+ if (!aSticky || aSticky.length === 0) {
108
+ // make headers sticky
109
+ oInnerTable.setSticky([Sticky.ColumnHeaders]);
110
+ }
111
+ if (this._isSingleSelect()) {
112
+ oInnerTable.setMode(ListMode.SingleSelectLeft);
113
+ } else {
114
+ oInnerTable.setMode(ListMode.MultiSelect);
115
+ }
116
+ },
117
+ handleScrolling: function (iIndex) {
118
+ var oScrollDelegate = this.getScrollDelegate();
119
+ if (oScrollDelegate) {
120
+ oInnerTable.scrollToIndex(iIndex).catch(function (oError) {
121
+ // TODO: Handle scroll error?
122
+ });
123
+ return true;
124
+ }
125
+ },
126
+ handleListBinding: function () {
127
+
128
+ }
129
+ },
130
+ "Table": {
131
+ getListBindingInfo: function () {
132
+ return oInnerTable && oInnerTable.getBindingInfo("rows");
133
+ },
134
+ getItems: function () {
135
+ return oInnerTable.getRows().filter(function (oRow) {
136
+ var oRowBindingContext = oRow.getBindingContext();
137
+ return oRowBindingContext && oRowBindingContext.getObject(); // don't return empty rows
138
+ });
139
+ },
140
+ getSelectedItems: function () {
141
+ var aSelectedIndices = _getUITableSelectionHandler().getSelectedIndices();
142
+ var aSelectedContexts = aSelectedIndices.reduce(function(aResult, iCurrent) {
143
+ var oContext = oInnerTable.getContextByIndex(iCurrent);
144
+ return oContext ? aResult.concat(oContext) : aResult;
145
+ }, []);
146
+ return MDCTableHelperConfig["Table"].getItems().filter(function (oRow) {
147
+ return aSelectedContexts.indexOf(oRow.getBindingContext()) >= 0;
148
+ });
149
+ },
150
+ modifySelection: function (oItem, bSelected) {
151
+ var oContext = oItem.getBindingContext();
152
+ var iContextIndex = MDCTableHelperConfig["Table"].getContexts().indexOf(oContext);
153
+ var bInSelectedIndices = _getUITableSelectionHandler().getSelectedIndices().indexOf(iContextIndex) >= 0;
154
+ if (bSelected && !bInSelectedIndices) {
155
+ return this._isSingleSelect() ? _getUITableSelectionHandler().setSelectedIndex(iContextIndex) : _getUITableSelectionHandler().addSelectionInterval(iContextIndex,iContextIndex);
156
+ } else if (!bSelected && bInSelectedIndices) {
157
+ return _getUITableSelectionHandler().removeSelectionInterval(iContextIndex,iContextIndex);
158
+ }
159
+ },
160
+ handleItemPress: function (oEvent) {
161
+ },
162
+ handleSelectionChange: function (oEvent) {
163
+
164
+ if (this._bScrolling || this._bBusy) {
165
+ return;
166
+ }
167
+
168
+ var aRowIndices = oEvent.getParameter("rowIndices"); // rowIndices are actually context indices
169
+ var aContexts = MDCTableHelperConfig["Table"].getContexts().filter(function (oContext, iIndex) {
170
+ return aRowIndices.indexOf(iIndex) >= 0;
171
+ });
172
+ var aRows = MDCTableHelperConfig["Table"].getItems().filter(function (oRow, iIndex) {
173
+ return aContexts.indexOf(oRow.getBindingContext()) >= 0;
174
+ });
175
+ var aAddConditions = [], aRemoveConditions = [];
176
+ var aSelectedRows = MDCTableHelperConfig["Table"].getSelectedItems();
177
+ var aCurrentConditions = this.get_conditions();
178
+ aRows.forEach(function (oRow, i) {
179
+ var bIsInSelectedConditions = this._isItemSelected(oRow, aCurrentConditions);
180
+ var bIsRowSelected = aSelectedRows.indexOf(oRow) !== -1;
181
+ if (bIsInSelectedConditions !== bIsRowSelected) {
182
+ var aBucket = aSelectedRows.indexOf(oRow) !== -1 ? aAddConditions : aRemoveConditions;
183
+ var oValues = this._getItemFromContext(oRow.getBindingContext());
184
+ var oCondition = oValues && this._createCondition(oValues.key, oValues.description, oValues.inParameters, oValues.outParameters);
185
+ aBucket.push(oCondition);
186
+ }
187
+ }.bind(this));
188
+
189
+ var bSingle = this._isSingleSelect();
190
+
191
+ if (aAddConditions.length) {
192
+ this.fireSelect({type: this._isSingleSelect() ? SelectType.Set : SelectType.Add, conditions: aAddConditions});
193
+ if (bSingle) {
194
+ return;
195
+ }
196
+ }
197
+
198
+ if (aRemoveConditions.length) {
199
+ this.fireSelect({type: this._isSingleSelect() ? SelectType.Set : SelectType.Remove, conditions: aRemoveConditions});
200
+ }
201
+ },
202
+ adjustTable: function () {
203
+ var oRowMode = oInnerTable.getRowMode();
204
+ if (!oRowMode) {
205
+ oInnerTable.setVisibleRowCountMode(UITableVisibleRowCountMode.Auto);
206
+ oInnerTable.setMinAutoRowCount(3);
207
+ } else if (oRowMode.isA("sap.ui.table.rowmodes.AutoRowMode")) {
208
+ oRowMode.setMinRowCount(3);
209
+ }
210
+ var sSelectionMode = this._isSingleSelect() ? UITableSelectionMode.Single : UITableSelectionMode.MultiToggle;
211
+ var sSelectionBehavior = this._isSingleSelect() ? UITableSelectionBehavior.RowOnly : UITableSelectionBehavior.Row;
212
+ oInnerTable.setSelectionBehavior(sSelectionBehavior);
213
+ _getUITableSelectionHandler().setSelectionMode(sSelectionMode);
214
+ },
215
+ handleScrolling: function (iIndex) {
216
+ var iFirstVisibleRowIndex = oInnerTable.getFirstVisibleRow();
217
+ if (typeof iIndex === "undefined" || iIndex < 0) {
218
+ iIndex = iFirstVisibleRowIndex - 1;
219
+ }
220
+ if (iIndex >= 0 && iIndex != iFirstVisibleRowIndex) {
221
+ oInnerTable.setFirstVisibleRow(iIndex);
222
+ return Promise.resolve();
223
+ }
224
+ return false;
225
+ },
226
+ getContexts: function () {
227
+ return oListBinding && (oListBinding.aContexts || (oListBinding.aIndices && oListBinding.aIndices.map(function (iIndex) {
228
+ return oInnerTable.getContextByIndex(iIndex);
229
+ })) || oListBinding.getContexts());
230
+ },
231
+ handleListBinding: function () {
232
+ oListBinding.attachEvent("change", this._handleUpdateFinished.bind(this));
233
+ }
234
+ }
235
+ };
236
+
237
+ return MDCTableHelperConfig[this._sTableType];
238
+ };
239
+
240
+ function _updateSelection () {
241
+ if (this._oTableHelper) {
242
+ this._bSelectionIsUpdating = true;
243
+ var aItems = this._oTableHelper.getItems();
244
+ var aConditions = this.get_conditions();
245
+ var aModifications = [];
246
+ for (var iId in aItems) {
247
+ var oItem = aItems[iId];
248
+ var bSelected = this._isItemSelected(oItem, aConditions);
249
+ aModifications.push(this._oTableHelper.modifySelection.call(this, oItem, bSelected));
250
+ }
251
+ Promise.all(aModifications).then(function() {
252
+ this._bSelectionIsUpdating = false;
253
+ }.bind(this));
254
+ }
255
+ }
256
+
257
+ var MDCTable = FilterableListContent.extend("sap.ui.mdc.valuehelp.content.MDCTable", /** @lends sap.ui.mdc.valuehelp.content.MDCTable.prototype */
258
+ {
259
+ metadata: {
260
+ library: "sap.ui.mdc",
261
+ interfaces: [
262
+ "sap.ui.mdc.valuehelp.IDialogContent"
263
+ ],
264
+ properties: {
265
+ },
266
+ aggregations: {
267
+ table: {
268
+ type: "sap.ui.mdc.Table",
269
+ multiple: false
270
+ }
271
+ },
272
+ events: {
273
+
274
+ },
275
+ defaultAggregation: "table"
276
+ }
277
+ });
278
+
279
+ MDCTable.prototype.init = function () {
280
+ FilterableListContent.prototype.init.apply(this, arguments);
281
+
282
+ this._oObserver.observe(this, {
283
+ aggregations: ["table"]
284
+ });
285
+
286
+ this._addPromise("listBinding");
287
+ };
288
+
289
+ var handleListBinding = function () {
290
+ var oListBinding = this._getTable().getRowBinding();
291
+ if (oListBinding) {
292
+ this._oTableHelper = _setupTableHelper.call(this);
293
+ this._oTableHelper.handleListBinding.call(this);
294
+ _adjustTable.call(this);
295
+ this._resolvePromise("listBinding", oListBinding);
296
+ }
297
+ };
298
+
299
+ var handleTableHeader = function () {
300
+ if (this._oTable && !this._oTable.getHeader()) {
301
+ this._oTable.setHeader( this._oResourceBundle.getText("valuehelp.TABLETITLENONUMBER"));
302
+ }
303
+ };
304
+
305
+ MDCTable.prototype._handleConditionsUpdate = function() {
306
+ _updateSelection.call(this);
307
+ };
308
+ MDCTable.prototype._handleUpdateFinished = function (oEvent) {
309
+ this._bScrolling = false;
310
+ this._bSearchTriggered = false;
311
+ _updateSelection.call(this);
312
+ };
313
+
314
+
315
+ MDCTable.prototype._handleFirstVisibleRowChanged = function (oEvent) {
316
+ this._bScrolling = true;
317
+ };
318
+
319
+ MDCTable.prototype._handleBusyStateChanged = function (oEvent) {
320
+ this._bBusy = oEvent.getParameter("busy");
321
+ };
322
+
323
+ var handleInnerTable = function (oInnerTable, sMutation) {
324
+
325
+ if (!oInnerTable) {
326
+ return;
327
+ }
328
+
329
+ if (sMutation === "remove") {
330
+ if (this._sTableType === "Table") {
331
+ oInnerTable.detachEvent("cellClick", this._handleItemPress, this);
332
+ oInnerTable.detachEvent("rowSelectionChange", this._handleSelectionChange, this);
333
+ oInnerTable.detachEvent("rowsUpdated", this._handleUpdateFinished, this);
334
+ oInnerTable.detachEvent("firstVisibleRowChanged", this._handleFirstVisibleRowChanged, this);
335
+ oInnerTable.detachEvent("busyStateChanged", this._handleBusyStateChanged, this);
336
+ if (this._oUITableSelectionPlugin) {
337
+ this._oUITableSelectionPlugin.detachEvent("selectionChange", this._handleSelectionChange, this);
338
+ }
339
+ this._oUITableSelectionPlugin = undefined;
340
+ } else if (this._sTableType === "ResponsiveTable") {
341
+ oInnerTable.detachEvent("itemPress", this._handleItemPress, this);
342
+ oInnerTable.detachEvent("selectionChange", this._handleSelectionChange, this);
343
+ oInnerTable.detachEvent("updateFinished", this._handleUpdateFinished, this);
344
+ }
345
+ this._oObserver.unobserve(oInnerTable);
346
+ } else {
347
+ // eslint-disable-next-line no-lonely-if
348
+ if (this._sTableType === "Table") {
349
+ this._oObserver.observe(oInnerTable, {bindings: ["rows"], aggregations: ["plugins"]});
350
+ oInnerTable.attachEvent("cellClick", this._handleItemPress, this);
351
+ oInnerTable.attachEvent("rowSelectionChange", this._handleSelectionChange, this);
352
+ oInnerTable.attachEvent("rowsUpdated", this._handleUpdateFinished, this);
353
+ oInnerTable.attachEvent("firstVisibleRowChanged", this._handleFirstVisibleRowChanged, this);
354
+ oInnerTable.attachEvent("busyStateChanged", this._handleBusyStateChanged, this);
355
+ this._oUITableSelectionPlugin = oInnerTable.getPlugins().find(function (oPlugin) {
356
+ return oPlugin.isA("sap.ui.table.plugins.SelectionPlugin");
357
+ });
358
+ if (this._oUITableSelectionPlugin) {
359
+ this._oUITableSelectionPlugin.attachEvent("selectionChange", this._handleSelectionChange, this);
360
+ }
361
+ } else if (this._sTableType === "ResponsiveTable") {
362
+ this._oObserver.observe(oInnerTable, {bindings: ["items"]});
363
+ oInnerTable.attachEvent("itemPress", this._handleItemPress, this);
364
+ oInnerTable.attachEvent("selectionChange", this._handleSelectionChange, this);
365
+ oInnerTable.attachEvent("updateFinished", this._handleUpdateFinished, this);
366
+ }
367
+ }
368
+ };
369
+
370
+ var _handleSearch = function () {
371
+ return this.applyFilters(this.get_filterValue());
372
+ };
373
+
374
+ MDCTable.prototype._observeChanges = function (oChanges) {
375
+
376
+ var oFilterBar, oDefaultFilterBar;
377
+ if (oChanges.name === "_defaultFilterBar") {
378
+ oDefaultFilterBar = oChanges.child;
379
+ if (oChanges.mutation === "insert") {
380
+ oFilterBar = this.getFilterBar();
381
+ if (!oFilterBar) {
382
+ oDefaultFilterBar.attachSearch(_handleSearch, this);
383
+ }
384
+ } else {
385
+ oDefaultFilterBar.detachSearch(_handleSearch, this);
386
+ }
387
+ _updateTableFilter.call(this);
388
+ }
389
+
390
+ if (oChanges.name === "filterBar") {
391
+ oFilterBar = oChanges.child;
392
+ oDefaultFilterBar = this.get_defaultFilterBar();
393
+ if (oChanges.mutation === "insert") {
394
+ if (oDefaultFilterBar) {
395
+ oDefaultFilterBar.detachSearch(_handleSearch, this);
396
+ }
397
+ oFilterBar.attachSearch(_handleSearch, this);
398
+ } else {
399
+ if (oDefaultFilterBar) {
400
+ oDefaultFilterBar.attachSearch(_handleSearch, this);
401
+ }
402
+ oFilterBar.detachSearch(_handleSearch, this);
403
+ }
404
+ _updateTableFilter.call(this);
405
+ }
406
+
407
+ if (oChanges.name === "table") { // outer table
408
+ var oTable = oChanges.child;
409
+ if (oChanges.mutation === "remove") {
410
+ Engine.getInstance().defaultProviderRegistry.detach(oTable);
411
+ this._oObserver.unobserve(oTable);
412
+ this._oTable = null;
413
+ this._oTableHelper = null;
414
+ this._addPromise("listBinding");
415
+ } else {
416
+ this._oTable = oTable;
417
+ Engine.getInstance().defaultProviderRegistry.attach(oTable, PersistenceMode.Transient);
418
+ this._oObserver.observe(oTable, {aggregations: ["_content"]});
419
+ this._sTableType = _getMDCTableType(oTable);
420
+ oTable.addDelegate({ onmouseover: function (oEvent) { // Fix m.Table itemPress
421
+ var oItem = jQuery(oEvent.target).control(0);
422
+ if (oItem && oItem.isA("sap.m.ColumnListItem")) {
423
+ oItem.setType("Active");
424
+ }
425
+ }});
426
+ handleInnerTable.call(this, this._oTable._oTable, "insert");
427
+ handleListBinding.call(this);
428
+ handleTableHeader.call(this);
429
+ _updateTableFilter.call(this);
430
+ }
431
+ return;
432
+ }
433
+
434
+ if (oChanges.name === "_content") { // inner table
435
+ handleInnerTable.call(this, oChanges.child, oChanges.mutation);
436
+ return;
437
+ }
438
+
439
+ if (["rows", "items"].indexOf(oChanges.name) !== -1 && oChanges.mutation === "ready") { // inner table's binding
440
+ handleListBinding.call(this);
441
+ return;
442
+ }
443
+
444
+ if (oChanges.name === "_config") {
445
+ _adjustTable.call(this);
446
+ }
447
+
448
+ if (oChanges.name === "plugins") {
449
+ this._oUITableSelectionPlugin = oChanges.mutation === "remove" || !oChanges.child.isA("sap.ui.table.plugins.SelectionPlugin") ? undefined : oChanges.child;
450
+ if (this._oUITableSelectionPlugin) {
451
+ this._oUITableSelectionPlugin.attachEvent("selectionChange", this._handleSelectionChange, this);
452
+ }
453
+ }
454
+
455
+ FilterableListContent.prototype._observeChanges.apply(this, arguments);
456
+ };
457
+
458
+ MDCTable.prototype._getTable = function () {
459
+ return this._oTable;
460
+ };
461
+
462
+ function _updateTableFilter () {
463
+ var oFilterBar = this._getPriorityFilterBar();
464
+
465
+ if (this._oTable && oFilterBar && this._oTable.getFilter() !== oFilterBar.getId()) {
466
+ this._oTable.setFilter(oFilterBar);
467
+ }
468
+ }
469
+
470
+ function _adjustTable () {
471
+ if (this._oTable) {
472
+ this._oTable.setSelectionMode(this._isSingleSelect() ? MDCSelectionMode.Single : MDCSelectionMode.Multi);
473
+ }
474
+
475
+ if (this._oTableHelper) {
476
+ this._oTableHelper.adjustTable.call(this);
477
+ }
478
+ }
479
+
480
+ MDCTable.prototype.getContent = function () {
481
+ return this._retrievePromise("wrappedContent", function () {
482
+ return loadModules([
483
+ "sap/ui/layout/FixFlex",
484
+ "sap/m/VBox",
485
+ "sap/m/ScrollContainer"
486
+ ]).then(function(aModules) {
487
+
488
+ var FixFlex = aModules[0];
489
+ var VBox = aModules[1];
490
+ var ScrollContainer = aModules[2];
491
+
492
+ if (!this._oContentLayout) {
493
+
494
+ this._oFilterBarVBox = new VBox(this.getId() + "-FilterBarBox", {visible: "{$this>/_filterBarVisible}"});
495
+ this._oFilterBarVBox.addStyleClass("sapMdcValueHelpPanelFilterbar");
496
+ this._oFilterBarVBox._oWrapper = this;
497
+ this._oFilterBarVBox.getItems = function () {
498
+ return [this._oWrapper._getPriorityFilterBar.call(this._oWrapper)];
499
+ };
500
+
501
+ this._oTableBox = new VBox(this.getId() + "-TB", {height: "100%"});
502
+ this._oTableBox.addStyleClass("sapMdcValueHelpPanelTableBox");
503
+ this._oTableBox._oWrapper = this;
504
+ this._oTableBox.getItems = function () {
505
+ return [this._oWrapper._sTableType === "ResponsiveTable" ? this._oWrapper._oScrollContainer : this._oWrapper._oTable];
506
+ };
507
+
508
+ this._oContentLayout = new FixFlex(this.getId() + "-FF", {minFlexSize: 200, fixContent: this._oFilterBarVBox, flexContent: this._oTableBox});
509
+
510
+ this._oScrollContainer = new ScrollContainer(this.getId() + "-SC", {
511
+ height: "calc(100% - 0.5rem)",
512
+ width: "100%",
513
+ vertical: true
514
+ });
515
+
516
+ this._oScrollContainer._oWrapper = this;
517
+ this._oScrollContainer.getContent = function() {
518
+ var aContent = [];
519
+ var oTable = this._oWrapper && this._oWrapper._oTable;
520
+ if (oTable) {
521
+ aContent.push(oTable);
522
+ }
523
+ return aContent;
524
+ };
525
+ }
526
+
527
+ this.setAggregation("_displayContent", this._oContentLayout);
528
+
529
+ if (!this._getPriorityFilterBar()) {
530
+ return this._createDefaultFilterBar().then(function () {
531
+ return this._oContentLayout;
532
+ }.bind(this));
533
+ }
534
+ return this._oContentLayout;
535
+ }.bind(this));
536
+ }.bind(this));
537
+ };
538
+
539
+ MDCTable.prototype._getListBinding = function() {
540
+ var oTable = this.getTable();
541
+ return oTable && oTable.getRowBinding();
542
+ };
543
+
544
+ MDCTable.prototype._getListBindingInfo = function () {
545
+ return this._oTableHelper && this._oTableHelper.getListBindingInfo();
546
+ };
547
+
548
+ MDCTable.prototype.applyFilters = function(sSearch) { // TODO the arguments are not passed as expected.
549
+
550
+ var oTable = this.getTable();
551
+ var oFilterBar = this._getPriorityFilterBar();
552
+
553
+ if (oTable && oFilterBar) {
554
+ var oListBinding = this._getListBinding();
555
+ var bListBindingSuspended = oListBinding && oListBinding.isSuspended();
556
+
557
+ if (oListBinding && !bListBindingSuspended && !this._bSearchTriggered) {
558
+ var sFBSearch = oFilterBar.getSearch() || "";
559
+ var sBindingSearch = oListBinding.mParameters.$search || "";
560
+ var aFBFilters = this._getFiltersForFilterBar();
561
+ var aBindingFilters = oListBinding.aApplicationFilters.reduce(function (aResult, oFilter) {
562
+ return aResult.concat(oFilter._bMultiFilter ? oFilter.aFilters : oFilter);
563
+ }, []);
564
+ var bFiltersChanged = !deepEqual(aFBFilters, aBindingFilters);
565
+ var bSearchChanged = sFBSearch !== sBindingSearch;
566
+ var bTableHasOverlay = oTable._oTable && oTable._oTable.getShowOverlay && oTable._oTable.getShowOverlay();
567
+
568
+
569
+ if (bFiltersChanged || bSearchChanged || bTableHasOverlay) {
570
+ this._handleScrolling();
571
+ oFilterBar.triggerSearch();
572
+ this._bSearchTriggered = true;
573
+ }
574
+ }
575
+
576
+ if (bListBindingSuspended) {
577
+ oListBinding.resume();
578
+ }
579
+
580
+ if (!oListBinding && oTable.getAutoBindOnInit()) {
581
+ this._retrievePromise("listBinding").then(function () {
582
+ this.applyFilters(sSearch);
583
+ }.bind(this));
584
+ }
585
+ }
586
+ };
587
+
588
+ MDCTable.prototype._handleScrolling = function (oItem) {
589
+ return this._oTableHelper && this._oTableHelper.handleScrolling.call(this, oItem);
590
+ };
591
+
592
+ MDCTable.prototype.getScrollDelegate = function() {
593
+ if (!this.isTypeahead() && this._oScrollContainer) {
594
+ return this._oScrollContainer.getScrollDelegate();
595
+ }
596
+ return FilterableListContent.prototype.getScrollDelegate.apply(this, arguments);
597
+ };
598
+
599
+ MDCTable.prototype._handleItemPress = function (oEvent) {
600
+ this._oTableHelper.handleItemPress.call(this, oEvent);
601
+ };
602
+
603
+ MDCTable.prototype._handleSelectionChange = function (oEvent) {
604
+ if (!this._bSelectionIsUpdating) {
605
+ this._oTableHelper.handleSelectionChange.call(this, oEvent);
606
+ }
607
+ };
608
+
609
+ MDCTable.prototype.isQuickSelectSupported = function() {
610
+ return true;
611
+ };
612
+
613
+ MDCTable.prototype.setParent = function(oParent) {
614
+ FilterableListContent.prototype.setParent.apply(this, arguments);
615
+ _adjustTable.call(this);
616
+ };
617
+
618
+ return MDCTable;
619
+ });