@openui5/sap.ui.mdc 1.100.0 → 1.101.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 (204) hide show
  1. package/THIRDPARTY.txt +5 -5
  2. package/package.json +4 -4
  3. package/src/sap/ui/mdc/.library +1 -1
  4. package/src/sap/ui/mdc/ActionToolbar.js +1 -1
  5. package/src/sap/ui/mdc/Chart.js +28 -46
  6. package/src/sap/ui/mdc/ChartDelegate.js +10 -0
  7. package/src/sap/ui/mdc/Control.js +1 -1
  8. package/src/sap/ui/mdc/Element.js +1 -1
  9. package/src/sap/ui/mdc/Field.js +2 -2
  10. package/src/sap/ui/mdc/FilterBar.js +1 -1
  11. package/src/sap/ui/mdc/FilterField.js +2 -2
  12. package/src/sap/ui/mdc/Link.js +1 -1
  13. package/src/sap/ui/mdc/LinkDelegate.js +7 -5
  14. package/src/sap/ui/mdc/MultiValueField.js +1 -1
  15. package/src/sap/ui/mdc/Table.js +255 -284
  16. package/src/sap/ui/mdc/TableDelegate.js +96 -23
  17. package/src/sap/ui/mdc/ValueHelp.js +131 -624
  18. package/src/sap/ui/mdc/ValueHelpDelegate.js +152 -6
  19. package/src/sap/ui/mdc/actiontoolbar/ActionToolbarAction.js +1 -1
  20. package/src/sap/ui/mdc/chart/ChartSelectionDetails.js +1 -1
  21. package/src/sap/ui/mdc/chart/ChartToolbar.js +5 -3
  22. package/src/sap/ui/mdc/chart/ChartTypeButton.js +11 -2
  23. package/src/sap/ui/mdc/chart/DrillBreadcrumbs.js +2 -0
  24. package/src/sap/ui/mdc/chart/PropertyHelper.js +1 -1
  25. package/src/sap/ui/mdc/condition/Condition.js +14 -9
  26. package/src/sap/ui/mdc/condition/ConditionConverter.js +58 -6
  27. package/src/sap/ui/mdc/condition/ConditionModel.js +1 -1
  28. package/src/sap/ui/mdc/condition/FilterConverter.js +1 -1
  29. package/src/sap/ui/mdc/condition/FilterOperatorUtil.js +6 -2
  30. package/src/sap/ui/mdc/condition/Operator.js +11 -1
  31. package/src/sap/ui/mdc/condition/OperatorDynamicDateOption.js +1 -1
  32. package/src/sap/ui/mdc/condition/RangeOperator.js +1 -1
  33. package/src/sap/ui/mdc/designtime/filterbar/FilterBar.designtime.js +3 -1
  34. package/src/sap/ui/mdc/designtime/table/Table.designtime.js +1 -1
  35. package/src/sap/ui/mdc/enum/PropagationReason.js +43 -0
  36. package/src/sap/ui/mdc/field/BoolFieldHelp.js +1 -1
  37. package/src/sap/ui/mdc/field/ConditionFieldHelp.js +1 -1
  38. package/src/sap/ui/mdc/field/ConditionType.js +28 -8
  39. package/src/sap/ui/mdc/field/ConditionsType.js +2 -1
  40. package/src/sap/ui/mdc/field/CustomFieldHelp.js +1 -1
  41. package/src/sap/ui/mdc/field/CustomFieldInfo.js +1 -1
  42. package/src/sap/ui/mdc/field/DefineConditionPanel.js +1 -1
  43. package/src/sap/ui/mdc/field/DynamicDateRangeConditionsType.js +1 -1
  44. package/src/sap/ui/mdc/field/FieldBase.js +12 -10
  45. package/src/sap/ui/mdc/field/FieldBaseDelegate.js +41 -19
  46. package/src/sap/ui/mdc/field/FieldHelpBase.js +1 -1
  47. package/src/sap/ui/mdc/field/FieldInfoBase.js +1 -1
  48. package/src/sap/ui/mdc/field/FieldInput.js +1 -1
  49. package/src/sap/ui/mdc/field/FieldInputRenderUtil.js +1 -1
  50. package/src/sap/ui/mdc/field/FieldMultiInput.js +1 -1
  51. package/src/sap/ui/mdc/field/FieldValueHelp.js +6 -4
  52. package/src/sap/ui/mdc/field/FieldValueHelpContentWrapperBase.js +1 -1
  53. package/src/sap/ui/mdc/field/FieldValueHelpMTableWrapper.js +1 -1
  54. package/src/sap/ui/mdc/field/FieldValueHelpMdcTableWrapper.js +1 -1
  55. package/src/sap/ui/mdc/field/FieldValueHelpTableWrapperBase.js +1 -1
  56. package/src/sap/ui/mdc/field/FieldValueHelpUITableWrapper.js +1 -1
  57. package/src/sap/ui/mdc/field/InParameter.js +1 -1
  58. package/src/sap/ui/mdc/field/ListFieldHelp.js +1 -1
  59. package/src/sap/ui/mdc/field/ListFieldHelpItem.js +1 -1
  60. package/src/sap/ui/mdc/field/MultiValueFieldItem.js +1 -1
  61. package/src/sap/ui/mdc/field/OutParameter.js +1 -1
  62. package/src/sap/ui/mdc/field/TokenDisplay.js +1 -1
  63. package/src/sap/ui/mdc/field/TokenizerDisplay.js +1 -1
  64. package/src/sap/ui/mdc/field/ValueHelpPanel.js +1 -1
  65. package/src/sap/ui/mdc/filterbar/FilterBarBase.js +90 -69
  66. package/src/sap/ui/mdc/filterbar/IFilterContainer.js +5 -0
  67. package/src/sap/ui/mdc/filterbar/PropertyHelper.js +1 -1
  68. package/src/sap/ui/mdc/filterbar/aligned/FilterContainer.js +1 -0
  69. package/src/sap/ui/mdc/filterbar/aligned/FilterItemLayout.js +1 -0
  70. package/src/sap/ui/mdc/filterbar/p13n/AdaptationFilterBar.js +21 -11
  71. package/src/sap/ui/mdc/filterbar/vh/FilterBar.js +37 -5
  72. package/src/sap/ui/mdc/flexibility/Chart.flexibility.js +4 -41
  73. package/src/sap/ui/mdc/flexibility/ChartTypeFlex.js +54 -0
  74. package/src/sap/ui/mdc/flexibility/ConditionFlex.js +2 -2
  75. package/src/sap/ui/mdc/flexibility/FilterBar.flexibility.js +1 -1
  76. package/src/sap/ui/mdc/flexibility/FilterItemFlex.js +1 -1
  77. package/src/sap/ui/mdc/library.js +19 -23
  78. package/src/sap/ui/mdc/link/ContactDetails.js +107 -23
  79. package/src/sap/ui/mdc/link/ContactDetailsAddressItem.js +1 -1
  80. package/src/sap/ui/mdc/link/ContactDetailsEmailItem.js +1 -1
  81. package/src/sap/ui/mdc/link/ContactDetailsItem.js +1 -1
  82. package/src/sap/ui/mdc/link/ContactDetailsPhoneItem.js +1 -1
  83. package/src/sap/ui/mdc/link/ContactDetailsRenderer.js +26 -0
  84. package/src/sap/ui/mdc/link/Factory.js +1 -1
  85. package/src/sap/ui/mdc/link/FakeFlpConnector.js +1 -1
  86. package/src/sap/ui/mdc/link/LinkItem.js +1 -1
  87. package/src/sap/ui/mdc/link/Panel.js +197 -22
  88. package/src/sap/ui/mdc/link/PanelItem.js +1 -1
  89. package/src/sap/ui/mdc/link/PanelRenderer.js +26 -0
  90. package/src/sap/ui/mdc/link/SemanticObjectMapping.js +1 -1
  91. package/src/sap/ui/mdc/link/SemanticObjectMappingItem.js +1 -1
  92. package/src/sap/ui/mdc/link/SemanticObjectUnavailableAction.js +1 -1
  93. package/src/sap/ui/mdc/messagebundle.properties +8 -4
  94. package/src/sap/ui/mdc/messagebundle_ar.properties +6 -4
  95. package/src/sap/ui/mdc/messagebundle_bg.properties +6 -4
  96. package/src/sap/ui/mdc/messagebundle_ca.properties +6 -4
  97. package/src/sap/ui/mdc/messagebundle_cs.properties +6 -4
  98. package/src/sap/ui/mdc/messagebundle_cy.properties +6 -4
  99. package/src/sap/ui/mdc/messagebundle_da.properties +6 -4
  100. package/src/sap/ui/mdc/messagebundle_de.properties +6 -4
  101. package/src/sap/ui/mdc/messagebundle_el.properties +5 -3
  102. package/src/sap/ui/mdc/messagebundle_en.properties +6 -4
  103. package/src/sap/ui/mdc/messagebundle_en_GB.properties +6 -4
  104. package/src/sap/ui/mdc/messagebundle_en_US_sappsd.properties +6 -4
  105. package/src/sap/ui/mdc/messagebundle_en_US_saprigi.properties +7 -5
  106. package/src/sap/ui/mdc/messagebundle_en_US_saptrc.properties +7 -5
  107. package/src/sap/ui/mdc/messagebundle_es.properties +6 -4
  108. package/src/sap/ui/mdc/messagebundle_es_MX.properties +6 -4
  109. package/src/sap/ui/mdc/messagebundle_et.properties +6 -4
  110. package/src/sap/ui/mdc/messagebundle_fi.properties +6 -4
  111. package/src/sap/ui/mdc/messagebundle_fr.properties +6 -4
  112. package/src/sap/ui/mdc/messagebundle_fr_CA.properties +6 -4
  113. package/src/sap/ui/mdc/messagebundle_hi.properties +6 -4
  114. package/src/sap/ui/mdc/messagebundle_hr.properties +6 -4
  115. package/src/sap/ui/mdc/messagebundle_hu.properties +6 -4
  116. package/src/sap/ui/mdc/messagebundle_id.properties +6 -4
  117. package/src/sap/ui/mdc/messagebundle_it.properties +6 -4
  118. package/src/sap/ui/mdc/messagebundle_iw.properties +5 -3
  119. package/src/sap/ui/mdc/messagebundle_ja.properties +7 -5
  120. package/src/sap/ui/mdc/messagebundle_kk.properties +6 -4
  121. package/src/sap/ui/mdc/messagebundle_ko.properties +5 -3
  122. package/src/sap/ui/mdc/messagebundle_lt.properties +6 -4
  123. package/src/sap/ui/mdc/messagebundle_lv.properties +6 -4
  124. package/src/sap/ui/mdc/messagebundle_ms.properties +6 -4
  125. package/src/sap/ui/mdc/messagebundle_nl.properties +6 -4
  126. package/src/sap/ui/mdc/messagebundle_no.properties +6 -4
  127. package/src/sap/ui/mdc/messagebundle_pl.properties +6 -4
  128. package/src/sap/ui/mdc/messagebundle_pt.properties +7 -5
  129. package/src/sap/ui/mdc/messagebundle_pt_PT.properties +6 -4
  130. package/src/sap/ui/mdc/messagebundle_ro.properties +6 -4
  131. package/src/sap/ui/mdc/messagebundle_ru.properties +6 -4
  132. package/src/sap/ui/mdc/messagebundle_sh.properties +9 -7
  133. package/src/sap/ui/mdc/messagebundle_sk.properties +6 -4
  134. package/src/sap/ui/mdc/messagebundle_sl.properties +7 -5
  135. package/src/sap/ui/mdc/messagebundle_sv.properties +7 -5
  136. package/src/sap/ui/mdc/messagebundle_th.properties +6 -4
  137. package/src/sap/ui/mdc/messagebundle_tr.properties +7 -5
  138. package/src/sap/ui/mdc/messagebundle_uk.properties +6 -4
  139. package/src/sap/ui/mdc/messagebundle_vi.properties +6 -4
  140. package/src/sap/ui/mdc/messagebundle_zh_CN.properties +6 -4
  141. package/src/sap/ui/mdc/messagebundle_zh_TW.properties +6 -4
  142. package/src/sap/ui/mdc/mixin/AdaptationMixin.js +4 -11
  143. package/src/sap/ui/mdc/mixin/DelegateMixin.js +1 -1
  144. package/src/sap/ui/mdc/mixin/FilterIntegrationMixin.js +1 -1
  145. package/src/sap/ui/mdc/mixin/PromiseMixin.js +1 -1
  146. package/src/sap/ui/mdc/mixin/PropertyHelperMixin.js +7 -1
  147. package/src/sap/ui/mdc/odata/v4/ChartPropertyHelper.js +1 -1
  148. package/src/sap/ui/mdc/odata/v4/FieldBaseDelegate.js +8 -6
  149. package/src/sap/ui/mdc/odata/v4/TableDelegate.js +18 -33
  150. package/src/sap/ui/mdc/odata/v4/ValueHelpDelegate.js +63 -3
  151. package/src/sap/ui/mdc/odata/v4/vizChart/ChartDelegate.js +57 -0
  152. package/src/sap/ui/mdc/p13n/Engine.js +147 -51
  153. package/src/sap/ui/mdc/p13n/FlexUtil.js +26 -14
  154. package/src/sap/ui/mdc/p13n/PropertyHelper.js +1 -1
  155. package/src/sap/ui/mdc/p13n/StateUtil.js +30 -51
  156. package/src/sap/ui/mdc/p13n/UIManager.js +6 -2
  157. package/src/sap/ui/mdc/p13n/modification/ModificationHandler.js +0 -178
  158. package/src/sap/ui/mdc/p13n/modules/DefaultProviderRegistry.js +2 -2
  159. package/src/sap/ui/mdc/p13n/modules/xConfigAPI.js +219 -0
  160. package/src/sap/ui/mdc/p13n/panels/ChartItemPanel.js +73 -14
  161. package/src/sap/ui/mdc/p13n/subcontroller/AggregateController.js +2 -2
  162. package/src/sap/ui/mdc/p13n/subcontroller/BaseController.js +30 -2
  163. package/src/sap/ui/mdc/p13n/subcontroller/ChartTypeController.js +46 -0
  164. package/src/sap/ui/mdc/p13n/subcontroller/ColumnWidthController.js +37 -6
  165. package/src/sap/ui/mdc/p13n/subcontroller/FilterController.js +24 -6
  166. package/src/sap/ui/mdc/p13n/subcontroller/GroupController.js +9 -2
  167. package/src/sap/ui/mdc/p13n/subcontroller/SortController.js +2 -2
  168. package/src/sap/ui/mdc/table/Column.js +271 -132
  169. package/src/sap/ui/mdc/table/CreationRow.js +1 -1
  170. package/src/sap/ui/mdc/table/PropertyHelper.js +59 -90
  171. package/src/sap/ui/mdc/table/ResponsiveTableType.js +35 -27
  172. package/src/sap/ui/mdc/table/RowActionItem.js +1 -1
  173. package/src/sap/ui/mdc/table/RowSettings.js +1 -1
  174. package/src/sap/ui/mdc/table/TableSettings.js +10 -22
  175. package/src/sap/ui/mdc/table/V4AnalyticsPropertyHelper.js +1 -1
  176. package/src/sap/ui/mdc/table/menu/Item.js +78 -0
  177. package/src/sap/ui/mdc/table/menu/ItemContainer.js +60 -0
  178. package/src/sap/ui/mdc/table/menu/QuickActionContainer.js +151 -0
  179. package/src/sap/ui/mdc/themes/base/Chart.less +4 -0
  180. package/src/sap/ui/mdc/ui/Container.js +0 -0
  181. package/src/sap/ui/mdc/util/FilterUtil.js +1 -1
  182. package/src/sap/ui/mdc/util/IdentifierUtil.js +3 -3
  183. package/src/sap/ui/mdc/util/PromiseCache.js +6 -2
  184. package/src/sap/ui/mdc/util/PropertyHelper.js +5 -1
  185. package/src/sap/ui/mdc/valuehelp/Dialog.js +234 -44
  186. package/src/sap/ui/mdc/valuehelp/Popover.js +3 -2
  187. package/src/sap/ui/mdc/valuehelp/base/Container.js +63 -48
  188. package/src/sap/ui/mdc/valuehelp/base/Content.js +35 -16
  189. package/src/sap/ui/mdc/valuehelp/base/DialogTab.js +1 -1
  190. package/src/sap/ui/mdc/valuehelp/base/FilterableListContent.js +158 -281
  191. package/src/sap/ui/mdc/valuehelp/base/ListContent.js +4 -4
  192. package/src/sap/ui/mdc/valuehelp/content/Bool.js +4 -4
  193. package/src/sap/ui/mdc/valuehelp/content/Conditions.js +4 -4
  194. package/src/sap/ui/mdc/valuehelp/content/FixedList.js +4 -4
  195. package/src/sap/ui/mdc/valuehelp/content/ListCollection.js +205 -0
  196. package/src/sap/ui/mdc/valuehelp/content/MDCTable.js +59 -57
  197. package/src/sap/ui/mdc/valuehelp/content/MTable.js +89 -182
  198. package/test/sap/ui/mdc/testutils/opa/chart/TestObjects.js +2 -3
  199. package/test/sap/ui/mdc/testutils/opa/chartNew/TestObjects.js +2 -3
  200. package/test/sap/ui/mdc/testutils/opa/p13n/Actions.js +17 -3
  201. package/src/sap/ui/mdc/link/ContactDetails.control.xml +0 -29
  202. package/src/sap/ui/mdc/link/Panel.control.xml +0 -36
  203. package/src/sap/ui/mdc/link/PanelListItem.control.xml +0 -24
  204. package/src/sap/ui/mdc/link/PanelListItem.js +0 -101
@@ -16,8 +16,11 @@ sap.ui.define([
16
16
  "sap/m/Text",
17
17
  "sap/m/Title",
18
18
  "sap/m/ColumnHeaderPopover",
19
+ "sap/m/ColumnPopoverSelectListItem",
20
+ "sap/m/ColumnPopoverActionItem",
19
21
  "sap/m/OverflowToolbar",
20
22
  "sap/m/library",
23
+ "sap/m/table/columnmenu/Menu",
21
24
  "sap/ui/core/Core",
22
25
  "sap/ui/core/format/NumberFormat",
23
26
  "sap/ui/core/dnd/DragDropInfo",
@@ -30,6 +33,7 @@ sap.ui.define([
30
33
  "sap/base/strings/capitalize",
31
34
  "sap/base/util/deepEqual",
32
35
  "sap/base/util/Deferred",
36
+ "sap/base/util/UriParameters",
33
37
  "sap/ui/core/InvisibleMessage",
34
38
  "sap/ui/core/InvisibleText",
35
39
  "sap/ui/mdc/p13n/subcontroller/ColumnController",
@@ -37,13 +41,13 @@ sap.ui.define([
37
41
  "sap/ui/mdc/p13n/subcontroller/FilterController",
38
42
  "sap/ui/mdc/p13n/subcontroller/GroupController",
39
43
  "sap/ui/mdc/p13n/subcontroller/AggregateController",
40
- "sap/m/ColumnPopoverSelectListItem",
41
- "sap/m/ColumnPopoverActionItem",
42
44
  "sap/ui/mdc/p13n/subcontroller/ColumnWidthController",
43
45
  "sap/ui/mdc/actiontoolbar/ActionToolbarAction",
44
46
  "sap/ui/mdc/table/RowActionItem",
45
- "sap/ui/base/ManagedObjectMetadata",
46
- "sap/ui/mdc/table/RowSettings"
47
+ "sap/ui/mdc/table/RowSettings",
48
+ "sap/ui/mdc/table/menu/QuickActionContainer",
49
+ "sap/ui/mdc/table/menu/ItemContainer",
50
+ "sap/ui/base/ManagedObjectMetadata"
47
51
  ], function(
48
52
  Control,
49
53
  ActionToolbar,
@@ -56,8 +60,11 @@ sap.ui.define([
56
60
  Text,
57
61
  Title,
58
62
  ColumnHeaderPopover,
63
+ ColumnPopoverSelectListItem,
64
+ ColumnPopoverActionItem,
59
65
  OverflowToolbar,
60
66
  MLibrary,
67
+ ColumnMenu,
61
68
  Core,
62
69
  NumberFormat,
63
70
  DragDropInfo,
@@ -70,6 +77,7 @@ sap.ui.define([
70
77
  capitalize,
71
78
  deepEqual,
72
79
  Deferred,
80
+ UriParameters,
73
81
  InvisibleMessage,
74
82
  InvisibleText,
75
83
  ColumnController,
@@ -77,23 +85,25 @@ sap.ui.define([
77
85
  FilterController,
78
86
  GroupController,
79
87
  AggregateController,
80
- ColumnPopoverSelectListItem,
81
- ColumnPopoverActionItem,
82
88
  ColumnWidthController,
83
89
  ActionToolbarAction,
84
90
  RowActionItem,
85
- ManagedObjectMetadata,
86
- RowSettings
91
+ RowSettings,
92
+ QuickActionContainer,
93
+ ItemContainer,
94
+ ManagedObjectMetadata
87
95
  ) {
88
96
  "use strict";
89
97
 
90
98
  var SelectionMode = library.SelectionMode;
91
99
  var TableType = library.TableType;
92
100
  var RowAction = library.RowAction;
101
+ var P13nMode = library.TableP13nMode;
93
102
  var ToolbarDesign = MLibrary.ToolbarDesign;
94
103
  var ToolbarStyle = MLibrary.ToolbarStyle;
95
104
  var MultiSelectMode = library.MultiSelectMode;
96
105
  var TitleLevel = coreLibrary.TitleLevel;
106
+ var SortOrder = coreLibrary.SortOrder;
97
107
  var internalMap = new window.WeakMap();
98
108
  var internal = function(oTable) {
99
109
  if (!internalMap.has(oTable)) {
@@ -589,6 +599,7 @@ sap.ui.define([
589
599
  constructor: function() {
590
600
  this._oTableReady = new Deferred();
591
601
  this._oFullInitialize = new Deferred();
602
+ this._bUseColumnMenu = UriParameters.fromQuery(window.location.search).get("sap-ui-xx-columnmenu") === "true";
592
603
 
593
604
  Control.apply(this, arguments);
594
605
  this.bCreated = true;
@@ -655,17 +666,18 @@ sap.ui.define([
655
666
  * @inheritDoc
656
667
  */
657
668
  Table.prototype.init = function() {
658
-
659
669
  Control.prototype.init.apply(this, arguments);
660
670
 
661
- // indicates whether binding the table is inevitable or not
662
- this._bForceRebind = true;
663
- this._updateAdaptation(this.getP13nMode());
664
-
665
671
  // Skip propagation of properties (models and bindingContexts)
666
672
  this.mSkipPropagation = {
667
673
  rowSettings: true
668
674
  };
675
+
676
+ // indicates whether binding the table is inevitable or not
677
+ this._bForceRebind = true;
678
+
679
+ this._aSupportedP13nModes = Object.keys(P13nMode);
680
+ this._updateAdaptation();
669
681
  };
670
682
 
671
683
  /**
@@ -990,35 +1002,23 @@ sap.ui.define([
990
1002
 
991
1003
  if (this.getEnableColumnResize() !== bOldEnableColumnResize) {
992
1004
  this._updateColumnResizer();
993
- this._updateAdaptation(this.getP13nMode());
1005
+ this._updateAdaptation();
994
1006
  }
995
1007
 
996
1008
  return this;
997
1009
  };
998
1010
 
999
1011
  Table.prototype._onModifications = function() {
1000
- var oMDCTable = this;
1001
- this.initialized().then(function() {
1002
- var oColumnWidth = oMDCTable.getCurrentState().xConfig;
1003
- var oColumnWidthContent = oColumnWidth.aggregations && oColumnWidth.aggregations.columns;
1004
- oMDCTable.getColumns().forEach(function(oColumn, iIndex) {
1005
- var sWidth = oColumnWidthContent && oColumnWidthContent[oColumn.getDataProperty()] && oColumnWidthContent[oColumn.getDataProperty()].width;
1006
- var oInnerColumn = oMDCTable._oTable.getColumns()[iIndex];
1007
- if (!sWidth && oInnerColumn.getWidth() !== oColumn.getWidth()) {
1008
- oInnerColumn.setWidth(oColumn.getWidth());
1009
- } else if (sWidth && sWidth !== oInnerColumn.getWidth()) {
1010
- oInnerColumn.setWidth(sWidth);
1011
- }
1012
- });
1012
+ this.getColumns().forEach(function(oColumn) {
1013
+ oColumn._onModifications();
1013
1014
  });
1014
1015
  };
1015
1016
 
1016
1017
  Table.prototype.setP13nMode = function(aMode) {
1017
1018
  var aOldP13nMode = this.getP13nMode();
1018
1019
 
1019
- var aSortedKeys = null;
1020
+ var aSortedKeys = [];
1020
1021
  if (aMode && aMode.length > 1){
1021
- aSortedKeys = [];
1022
1022
  var mKeys = aMode.reduce(function(mMap, sKey, iIndex){
1023
1023
  mMap[sKey] = true;
1024
1024
  return mMap;
@@ -1046,7 +1046,7 @@ sap.ui.define([
1046
1046
 
1047
1047
  this.setProperty("p13nMode", aSortedKeys, true);
1048
1048
 
1049
- this._updateAdaptation(this.getP13nMode());
1049
+ this._updateAdaptation();
1050
1050
 
1051
1051
  if (!deepEqual(aOldP13nMode.sort(), this.getP13nMode().sort())) {
1052
1052
  updateP13nSettings(this);
@@ -1055,11 +1055,10 @@ sap.ui.define([
1055
1055
  return this;
1056
1056
  };
1057
1057
 
1058
- Table.prototype._updateAdaptation = function(aMode) {
1058
+ Table.prototype._updateAdaptation = function() {
1059
1059
  var oRegisterConfig = {
1060
1060
  controller: {}
1061
1061
  };
1062
-
1063
1062
  var mRegistryOptions = {
1064
1063
  Column: ColumnController,
1065
1064
  Sort: SortController,
@@ -1069,9 +1068,8 @@ sap.ui.define([
1069
1068
  ColumnWidth: ColumnWidthController
1070
1069
  };
1071
1070
 
1072
- aMode.forEach(function(sMode){
1073
- var sKey = sMode;
1074
- oRegisterConfig.controller[sKey] = mRegistryOptions[sMode];
1071
+ this.getActiveP13nModes().forEach(function(sMode){
1072
+ oRegisterConfig.controller[sMode] = mRegistryOptions[sMode];
1075
1073
  });
1076
1074
 
1077
1075
  if (this.getEnableColumnResize()) {
@@ -1092,7 +1090,7 @@ sap.ui.define([
1092
1090
  if (oTable._oTable) {
1093
1091
  var oDnDColumns = oTable._oTable.getDragDropConfig()[0];
1094
1092
  if (oDnDColumns) {
1095
- oDnDColumns.setEnabled(oTable.getP13nMode().indexOf("Column") > -1);
1093
+ oDnDColumns.setEnabled(oTable.getActiveP13nModes().indexOf("Column") > -1);
1096
1094
  }
1097
1095
  }
1098
1096
 
@@ -1302,7 +1300,15 @@ sap.ui.define([
1302
1300
  return oRb.getText("table.NO_DATA");
1303
1301
  }
1304
1302
 
1305
- return oRb.getText("table.NO_RESULTS");
1303
+ // Table is bound, but does not show any data
1304
+ // If table-internal or external (for example FilterBar) filters are set, then show the message that the data not found and also ask to adjust the filters.
1305
+ var oExternalFilter = Core.byId(this.getFilter());
1306
+ if ((this.isFilteringEnabled() && getFilteredProperties(this).length > 0) || //internal filters check
1307
+ (oExternalFilter && getFilteredProperties(oExternalFilter).length > 0)) { //external filters check
1308
+ return oRb.getText("table.NO_RESULTS");
1309
+ }
1310
+ // If no filters set, show only message that the data are not found, and nothing about the filters.
1311
+ return oRb.getText("table.NO_DATA");
1306
1312
  };
1307
1313
 
1308
1314
  Table.prototype._updateRowAction = function() {
@@ -1340,6 +1346,9 @@ sap.ui.define([
1340
1346
  }
1341
1347
 
1342
1348
  var oDelegate = this.getControlDelegate();
1349
+ this._aSupportedP13nModes = oDelegate.getSupportedP13nModes(this);
1350
+ this._updateAdaptation();
1351
+
1343
1352
  if (oDelegate.preInit) {
1344
1353
  // Call after libraries are loaded, but before initializing controls.
1345
1354
  // This allows the delegate to load additional modules, e.g. from previously loaded libraries, in parallel.
@@ -1386,9 +1395,6 @@ sap.ui.define([
1386
1395
  var pTableInit = this.initialized().then(function() {
1387
1396
  this.initPropertyHelper();
1388
1397
 
1389
- //Make sure that in case of default xConfig appliance the state is initially read once
1390
- this._onModifications();
1391
-
1392
1398
  // add this to the micro task execution queue to enable consumers to handle this correctly
1393
1399
  var oCreationRow = this.getCreationRow();
1394
1400
  if (oCreationRow) {
@@ -1488,7 +1494,6 @@ sap.ui.define([
1488
1494
  // Create Toolbar
1489
1495
  this._oToolbar = new ActionToolbar(this.getId() + "-toolbar", {
1490
1496
  design: ToolbarDesign.Transparent,
1491
- style: this._isOfType(TableType.ResponsiveTable) ? ToolbarStyle.Standard : ToolbarStyle.Clear,
1492
1497
  begin: [
1493
1498
  this._oTitle
1494
1499
  ],
@@ -1499,6 +1504,7 @@ sap.ui.define([
1499
1504
  ]
1500
1505
  });
1501
1506
  }
1507
+ this._oToolbar.setStyle(this._bMobileTable ? ToolbarStyle.Standard : ToolbarStyle.Clear);
1502
1508
  return this._oToolbar;
1503
1509
  };
1504
1510
 
@@ -1544,8 +1550,9 @@ sap.ui.define([
1544
1550
  return this.getEngine().readXConfig(this);
1545
1551
  };
1546
1552
 
1547
- function getFilteredProperties(oTable) {
1548
- var mFilterConditions = oTable.getFilterConditions();
1553
+ // oControl can be a Table or FilterBar - any Control that is able to have Filter
1554
+ function getFilteredProperties(oControl) {
1555
+ var mFilterConditions = oControl.getFilterConditions();
1549
1556
 
1550
1557
  return Object.keys(mFilterConditions).filter(function(sProperty) {
1551
1558
  return mFilterConditions[sProperty].length > 0;
@@ -1561,7 +1568,7 @@ sap.ui.define([
1561
1568
  */
1562
1569
  Table.prototype.getCurrentState = function() {
1563
1570
  var oState = {};
1564
- var aP13nMode = this.getP13nMode();
1571
+ var aP13nMode = this.getActiveP13nModes();
1565
1572
 
1566
1573
  if (aP13nMode.indexOf("Column") > -1) {
1567
1574
  oState.items = this._getVisibleProperties();
@@ -1597,7 +1604,7 @@ sap.ui.define([
1597
1604
  * @returns {boolean} Whether filter personalization is enabled
1598
1605
  */
1599
1606
  Table.prototype.isFilteringEnabled = function() {
1600
- return this.getP13nMode().indexOf("Filter") > -1;
1607
+ return this.getActiveP13nModes().includes(P13nMode.Filter);
1601
1608
  };
1602
1609
 
1603
1610
  /**
@@ -1607,7 +1614,7 @@ sap.ui.define([
1607
1614
  * @returns {boolean} Whether sort personalization is enabled
1608
1615
  */
1609
1616
  Table.prototype.isSortingEnabled = function() {
1610
- return this.getP13nMode().indexOf("Sort") > -1;
1617
+ return this.getActiveP13nModes().includes(P13nMode.Sort);
1611
1618
  };
1612
1619
 
1613
1620
  /**
@@ -1617,7 +1624,7 @@ sap.ui.define([
1617
1624
  * @returns {boolean} Whether group personalization is enabled
1618
1625
  */
1619
1626
  Table.prototype.isGroupingEnabled = function () {
1620
- return this.getP13nMode().indexOf("Group") > -1;
1627
+ return this.getActiveP13nModes().includes(P13nMode.Group);
1621
1628
  };
1622
1629
 
1623
1630
  /**
@@ -1627,11 +1634,26 @@ sap.ui.define([
1627
1634
  * @returns {boolean} Whether aggregation personalization is enabled
1628
1635
  */
1629
1636
  Table.prototype.isAggregationEnabled = function () {
1630
- return this.getP13nMode().indexOf("Aggregate") > -1;
1637
+ return this.getActiveP13nModes().includes(P13nMode.Aggregate);
1638
+ };
1639
+
1640
+ Table.prototype.getSupportedP13nModes = function() {
1641
+ return this._aSupportedP13nModes || [];
1642
+ };
1643
+
1644
+ Table.prototype.getActiveP13nModes = function() {
1645
+ var aP13nModes = this.getP13nMode();
1646
+ var aSupportedP13nModes = this.getSupportedP13nModes();
1647
+
1648
+ aP13nModes = aP13nModes.filter(function(sMode) {
1649
+ return aSupportedP13nModes.includes(sMode);
1650
+ });
1651
+
1652
+ return aP13nModes;
1631
1653
  };
1632
1654
 
1633
1655
  Table.prototype._getP13nButtons = function() {
1634
- var aP13nMode = this.getP13nMode();
1656
+ var aP13nMode = this.getActiveP13nModes();
1635
1657
  var aButtons = [];
1636
1658
 
1637
1659
  // Note: 'Aggregate' does not have a p13n UI, if only 'Aggregate' is enabled no settings icon is necessary
@@ -1755,7 +1777,9 @@ sap.ui.define([
1755
1777
  var mExportSettings = {
1756
1778
  workbook: {
1757
1779
  columns: aSheetColumns,
1758
- context: {title: that.getHeader()}
1780
+ context: {
1781
+ title: that.getHeader() || mCustomConfig.fileName
1782
+ }
1759
1783
  },
1760
1784
  dataSource: oRowBinding,
1761
1785
  fileType: mCustomConfig.selectedFileType,
@@ -1769,7 +1793,9 @@ sap.ui.define([
1769
1793
  doEnableAccessibility: mCustomConfig.doEnableAccessibility,
1770
1794
  signature: mCustomConfig.signature,
1771
1795
  signatureReason: mCustomConfig.signatureReason,
1772
- orientation: mCustomConfig.selectedOrientation
1796
+ orientation: mCustomConfig.selectedOrientation,
1797
+ fitToPage: mCustomConfig.fitToPage,
1798
+ pdfArchive: mCustomConfig.pdfArchive
1773
1799
  };
1774
1800
 
1775
1801
  if (mExportSettings.fileType === "PDF") {
@@ -1916,7 +1942,6 @@ sap.ui.define([
1916
1942
  ]
1917
1943
  });
1918
1944
  this._oTemplate = ResponsiveTableType.createTemplate(this.getId() + "-innerTableRow", oRowSettings);
1919
- this._createColumn = Table.prototype._createMobileColumn;
1920
1945
  this._sAggregation = "items";
1921
1946
  // map bindItems to bindRows for Mobile Table to enable reuse of rebind mechanism
1922
1947
  this._oTable.bindRows = this._oTable.bindItems;
@@ -1948,7 +1973,6 @@ sap.ui.define([
1948
1973
  ],
1949
1974
  rowSettingsTemplate: oRowSettings
1950
1975
  });
1951
- this._createColumn = Table.prototype._createColumn;
1952
1976
  this._sAggregation = "rows";
1953
1977
  }
1954
1978
 
@@ -1965,7 +1989,7 @@ sap.ui.define([
1965
1989
  sourceAggregation: "columns",
1966
1990
  targetAggregation: "columns",
1967
1991
  dropPosition: "Between",
1968
- enabled: this.getP13nMode().indexOf("Column") > -1,
1992
+ enabled: this.getActiveP13nModes().includes(P13nMode.Column),
1969
1993
  drop: [
1970
1994
  this._onColumnRearrange, this
1971
1995
  ]
@@ -2001,11 +2025,6 @@ sap.ui.define([
2001
2025
  } else {
2002
2026
  oTableType.disableColumnResizer(this, this._oTable);
2003
2027
  }
2004
-
2005
- var aMDCColumns = this.getColumns();
2006
- aMDCColumns.forEach(function(oColumn) {
2007
- oColumn.updateColumnResizing(bEnableColumnResizer);
2008
- }, this);
2009
2028
  };
2010
2029
 
2011
2030
  Table.prototype._updateSelectionBehavior = function() {
@@ -2040,82 +2059,106 @@ sap.ui.define([
2040
2059
 
2041
2060
  var oParent = oColumn.getParent(),
2042
2061
  iIndex = oParent.indexOfColumn(oColumn),
2043
- oMDCColumn = this.getColumns()[iIndex],
2044
- bResizeButton = this._bMobileTable && this.getEnableColumnResize();
2062
+ oMDCColumn = this.getColumns()[iIndex];
2045
2063
 
2046
2064
  this._fullyInitialized().then(function() {
2047
- var oResourceBundle = Core.getLibraryResourceBundle("sap.ui.mdc");
2048
- var oProperty = this.getPropertyHelper().getProperty(oMDCColumn.getDataProperty());
2065
+ if (this._bUseColumnMenu) {
2066
+ if (!this._oColumnHeaderMenu) {
2067
+ this._oQuickActionContainer = new QuickActionContainer({table: this});
2068
+ this._oItemContainer = new ItemContainer({table: this});
2069
+ this._oColumnHeaderMenu = new ColumnMenu({
2070
+ _quickActions: [this._oQuickActionContainer],
2071
+ _items: [this._oItemContainer]
2072
+ });
2073
+ }
2074
+ this._oQuickActionContainer.setAssociation("column", oMDCColumn);
2075
+
2076
+ Promise.all([
2077
+ this._oQuickActionContainer.initializeQuickActions(),
2078
+ this._oItemContainer.initializeItems()
2079
+ ]).then(function() {
2080
+ if (this._oQuickActionContainer.hasQuickActions() || this._oItemContainer.hasItems()) {
2081
+ if (this._oColumnHeaderMenu._oItemsContainer) {
2082
+ this._oColumnHeaderMenu._oItemsContainer.destroy();
2083
+ this._oColumnHeaderMenu._oItemsContainer = null;
2084
+ }
2085
+ this._oColumnHeaderMenu.openBy(oColumn);
2086
+ }
2087
+ }.bind(this));
2088
+ } else {
2089
+ var oResourceBundle = Core.getLibraryResourceBundle("sap.ui.mdc"),
2090
+ bResizeButton = this._bMobileTable && this.getEnableColumnResize();
2049
2091
 
2050
- if (this._oPopover) {
2051
- this._oPopover.destroy();
2052
- this._oPopover = null;
2053
- }
2092
+ if (this._oPopover) {
2093
+ this._oPopover.destroy();
2094
+ this._oPopover = null;
2095
+ }
2096
+ if (this.isSortingEnabled()) {
2097
+ var aAscendItems = [] , aDescendItems = [];
2098
+ var aSortableProperties = this.getPropertyHelper().getProperty(oMDCColumn.getDataProperty()).getSortableProperties();
2099
+ aSortableProperties.forEach(function(oProperty) {
2100
+ aAscendItems.push(new Item({
2101
+ text: oProperty.label,
2102
+ key: oProperty.name
2103
+ }));
2104
+ aDescendItems.push(new Item({
2105
+ text: oProperty.label,
2106
+ key: oProperty.name
2107
+ }));
2108
+ });
2109
+
2110
+ // create ColumnHeaderPopover
2111
+ if (aAscendItems.length > 0) {
2112
+ this._oPopover = new ColumnHeaderPopover({
2113
+ items: [
2114
+ new ColumnPopoverSelectListItem({
2115
+ items: aAscendItems,
2116
+ label: oResourceBundle.getText("table.SETTINGS_ASCENDING"),
2117
+ icon: "sap-icon://sort-ascending",
2118
+ action: [SortOrder.Ascending, this._onCustomSort, this]
2119
+ }),
2120
+ new ColumnPopoverSelectListItem({
2121
+ items: aDescendItems,
2122
+ label: oResourceBundle.getText("table.SETTINGS_DESCENDING"),
2123
+ icon: "sap-icon://sort-descending",
2124
+ action: [SortOrder.Descending, this._onCustomSort, this]
2125
+ })
2126
+ ]
2127
+ });
2128
+ oColumn.addDependent(this._oPopover);
2129
+ }
2130
+ }
2054
2131
 
2055
- if (this.isSortingEnabled() && oProperty) {
2056
- var aAscendItems = [];
2057
- var aDescendItems = [];
2132
+ var aFilterable = [];
2133
+ var oDelegate = this.getControlDelegate();
2134
+ var aHeaderItems = (oDelegate.addColumnMenuItems && oDelegate.addColumnMenuItems(this, oMDCColumn)) || [];
2058
2135
 
2059
- oProperty.getSortableProperties().forEach(function(oProperty) {
2060
- aAscendItems.push(new Item({
2061
- text: oProperty.label,
2062
- key: oProperty.name
2063
- }));
2064
- aDescendItems.push(new Item({
2136
+ this.getPropertyHelper().getFilterableProperties(oMDCColumn.getDataProperty()).forEach(function(oProperty) {
2137
+ aFilterable.push(new Item({
2065
2138
  text: oProperty.label,
2066
2139
  key: oProperty.name
2067
2140
  }));
2068
2141
  });
2069
2142
 
2070
- // create ColumnHeaderPopover
2071
- if (aAscendItems.length > 0) {
2072
- this._oPopover = new ColumnHeaderPopover({
2073
- items: [
2074
- new ColumnPopoverSelectListItem({
2075
- items: aAscendItems,
2076
- label: oResourceBundle.getText("table.SETTINGS_ASCENDING"),
2077
- icon: "sap-icon://sort-ascending",
2078
- action: [false, this._onCustomSort, this]
2079
- }),
2080
- new ColumnPopoverSelectListItem({
2081
- items: aDescendItems,
2082
- label: oResourceBundle.getText("table.SETTINGS_DESCENDING"),
2083
- icon: "sap-icon://sort-descending",
2084
- action: [true, this._onCustomSort, this]
2085
- })
2086
- ]
2143
+ if (this.isFilteringEnabled() && aFilterable.length) {
2144
+ var oFilter = new ColumnPopoverSelectListItem({
2145
+ label: oResourceBundle.getText("table.SETTINGS_FILTER"),
2146
+ icon: "sap-icon://filter",
2147
+ action: [onShowFilterDialog, this]
2087
2148
  });
2088
- oColumn.addDependent(this._oPopover);
2149
+ aHeaderItems.unshift(oFilter);
2089
2150
  }
2090
- }
2091
- var oDelegate = this.getControlDelegate();
2092
- var aHeaderItems = (oDelegate.addColumnMenuItems && oDelegate.addColumnMenuItems(this, oMDCColumn)) || [];
2093
-
2094
- if (this.isFilteringEnabled() && oProperty && oProperty.getFilterableProperties().length > 0) {
2095
- aHeaderItems.unshift(new ColumnPopoverSelectListItem({
2096
- label: oResourceBundle.getText("table.SETTINGS_FILTER"),
2097
- icon: "sap-icon://filter",
2098
- action: [onShowFilterDialog, this]
2099
- }));
2100
- }
2101
-
2102
- if (bResizeButton) {
2103
- var oColumnResize = ResponsiveTableType.startColumnResize(this._oTable, oColumn);
2104
- oColumnResize && aHeaderItems.push(oColumnResize);
2105
- }
2106
2151
 
2107
- aHeaderItems.forEach(function(oItem) {
2108
- this._createPopover(oItem, oColumn);
2109
- }, this);
2152
+ if (bResizeButton) {
2153
+ var oColumnResize = ResponsiveTableType.startColumnResize(this._oTable, oColumn);
2154
+ oColumnResize && aHeaderItems.push(oColumnResize);
2155
+ }
2110
2156
 
2111
- if (this._oPopover) {
2112
- this._oPopover.openBy(oColumn);
2113
- this._oPopover.getAggregation("_popover").attachAfterClose(function() {
2114
- this._bSuppressOpenMenu = false;
2157
+ aHeaderItems.forEach(function(oItem) {
2158
+ this._createPopover(oItem, oColumn);
2115
2159
  }, this);
2116
- this._bSuppressOpenMenu = true;
2160
+ this._oPopover && this._oPopover.openBy(oColumn);
2117
2161
  }
2118
-
2119
2162
  }.bind(this));
2120
2163
  };
2121
2164
 
@@ -2130,10 +2173,18 @@ sap.ui.define([
2130
2173
  }
2131
2174
  };
2132
2175
 
2133
- Table.prototype._onCustomSort = function(oEvent, bDescending) {
2176
+ Table.prototype._onCustomSort = function(oEvent, sSortOrder) {
2134
2177
  var sSortProperty = oEvent.getParameter("property");
2135
2178
 
2136
- TableSettings.createSort(this, sSortProperty, bDescending, true);
2179
+ this.getCurrentState().sorters.forEach(function(oProp) {
2180
+ if (oProp.name === sSortProperty) {
2181
+ if (oProp.descending && sSortOrder === SortOrder.Descending || !oProp.descending && sSortOrder === SortOrder.Ascending) {
2182
+ sSortOrder = SortOrder.None;
2183
+ }
2184
+ }
2185
+ });
2186
+
2187
+ TableSettings.createSort(this, sSortProperty, sSortOrder, true);
2137
2188
  };
2138
2189
 
2139
2190
  Table.prototype._onColumnResize = function(oEvent) {
@@ -2154,34 +2205,20 @@ sap.ui.define([
2154
2205
  TableSettings.createAggregation(this, sSortProperty);
2155
2206
  };
2156
2207
 
2157
- Table.prototype._setColumnWidth = function(oMDCColumn) {
2158
- if (!this.getEnableAutoColumnWidth() || oMDCColumn.getWidth() || oMDCColumn.isBound("width")) {
2159
- return;
2160
- }
2161
-
2162
- var oPropertyHelper = this._oPropertyHelper;
2163
- if (oPropertyHelper) {
2164
- oPropertyHelper.setColumnWidth(oMDCColumn);
2165
- } else {
2166
- this.awaitPropertyHelper().then(this._setColumnWidth.bind(this, oMDCColumn));
2167
- }
2168
- };
2169
-
2170
- Table.prototype._insertInnerColumn = function(oMDCColumn, iIndex) {
2208
+ Table.prototype._insertInnerColumn = function(oColumn, iIndex) {
2171
2209
  if (!this._oTable) {
2172
2210
  return;
2173
2211
  }
2174
2212
 
2175
- this._setColumnWidth(oMDCColumn);
2213
+ var oInnerColumn = oColumn.getInnerColumn();
2176
2214
 
2177
- var oColumn = this._createColumn(oMDCColumn);
2178
- setColumnTemplate(this, oMDCColumn, oColumn, iIndex);
2215
+ this._setMobileColumnTemplate(oColumn, iIndex);
2179
2216
  this._bForceRebind = true;
2180
2217
 
2181
2218
  if (iIndex === undefined) {
2182
- this._oTable.addColumn(oColumn);
2219
+ this._oTable.addColumn(oInnerColumn);
2183
2220
  } else {
2184
- this._oTable.insertColumn(oColumn, iIndex);
2221
+ this._oTable.insertColumn(oInnerColumn, iIndex);
2185
2222
  }
2186
2223
  };
2187
2224
 
@@ -2206,145 +2243,82 @@ sap.ui.define([
2206
2243
  }, this);
2207
2244
  };
2208
2245
 
2209
- function setColumnTemplate(oTable, oColumn, oInnerColumn, iIndex) {
2210
- var oCellTemplate = oColumn.getTemplate(true);
2211
-
2212
- if (!oTable._bMobileTable) {
2213
- var oCreationTemplateClone = oColumn.getCreationTemplate(true);
2214
-
2215
- // Grid Table content cannot be wrapped!
2216
- [oCellTemplate, oCreationTemplateClone].forEach(function(oTemplate) {
2217
- if (!oTemplate) {
2218
- return;
2219
- }
2220
-
2221
- if (oTemplate.setWrapping) {
2222
- oTemplate.setWrapping(false);
2223
- }
2224
-
2225
- if (oTemplate.setRenderWhitespace) {
2226
- oTemplate.setRenderWhitespace(false);
2227
- }
2228
- });
2229
-
2230
- oInnerColumn.setTemplate(oCellTemplate);
2231
- oInnerColumn.setCreationTemplate(oCreationTemplateClone);
2232
- } else if (iIndex >= 0) {
2233
- oTable._oTemplate.insertCell(oCellTemplate, iIndex);
2234
- oTable._oTable.getItems().forEach(function(oItem) {
2235
- // Add lightweight placeholders that can be rendered - if they cannot be rendered, there will be errors in the console.
2236
- // The actual cells are created after rebind.
2237
- oItem.insertAggregation("cells", new InvisibleText(), iIndex, true);
2238
- });
2239
- } else {
2240
- oTable._oTemplate.addCell(oCellTemplate);
2241
- }
2242
- }
2243
-
2244
- /**
2245
- * Creates and returns a Column that can be added to the grid table, based on the provided MDCColumn
2246
- *
2247
- * @param {object} oMDCColumn - the mdc column instance using which the GridTable column will be created
2248
- * @private
2249
- * @returns {object} the column that is created
2250
- */
2251
- Table.prototype._createColumn = function(oMDCColumn) {
2252
- return GridTableType.createColumn(oMDCColumn.getId() + "-innerColumn", {
2253
- width: oMDCColumn.getWidth(),
2254
- minWidth: Math.round(oMDCColumn.getMinWidth() * parseFloat(MLibrary.BaseFontSize)),
2255
- hAlign: oMDCColumn.getHAlign(),
2256
- label: oMDCColumn.getColumnHeaderControl(this._bMobileTable, this.getEnableColumnResize()),
2257
- resizable: this.getEnableColumnResize(),
2258
- autoResizable: this.getEnableColumnResize()
2259
- });
2260
- };
2261
-
2262
- /**
2263
- * Creates and returns a MobileColumn that can be added to the mobile table, based on the provided MDCColumn
2264
- *
2265
- * @param {object} oMDCColumn - the mdc column instance using which the ResponsiveTable column will be created
2266
- * @private
2267
- * @returns {object} the column that is created
2268
- */
2269
- Table.prototype._createMobileColumn = function(oMDCColumn) {
2270
- return ResponsiveTableType.createColumn(oMDCColumn.getId() + "-innerColumn", {
2271
- width: oMDCColumn.getWidth(),
2272
- autoPopinWidth: oMDCColumn.getMinWidth(),
2273
- hAlign: oMDCColumn.getHAlign(),
2274
- header: oMDCColumn.getColumnHeaderControl(this._bMobileTable, this.getEnableColumnResize()),
2275
- importance: oMDCColumn.getImportance(),
2276
- popinDisplay: "Inline"
2277
- });
2278
- };
2279
-
2280
2246
  /**
2281
2247
  * Runtime API for JS flex change to avoid rebind.
2282
2248
  *
2283
- * @param {object} oMDCColumn - the mdc column instance which should be moved
2249
+ * @param {object} oColumn - the mdc column instance which should be moved
2284
2250
  * @param {int} iIndex - the index to which the column should be moved to
2285
2251
  * @private
2286
2252
  */
2287
- Table.prototype.moveColumn = function(oMDCColumn, iIndex) {
2288
- var oColumn;
2289
- // move column in mdc Table
2290
- this.removeAggregation("columns", oMDCColumn, true);
2291
- this.insertAggregation("columns", oMDCColumn, iIndex, true);
2253
+ Table.prototype.moveColumn = function(oColumn, iIndex) {
2254
+ oColumn._bIsBeingMoved = true;
2255
+ this.removeAggregation("columns", oColumn, true);
2256
+ this.insertAggregation("columns", oColumn, iIndex, true);
2257
+ delete oColumn._bIsBeingMoved;
2258
+
2292
2259
  if (this._oTable) {
2260
+ var oInnerColumn = oColumn.getInnerColumn();
2261
+
2293
2262
  // move column in inner table
2294
- oColumn = this._oTable.removeColumn(oMDCColumn.getId() + "-innerColumn");
2295
- this._oTable.insertColumn(oColumn, iIndex);
2263
+ this._oTable.removeColumn(oInnerColumn);
2264
+ this._oTable.insertColumn(oInnerColumn, iIndex);
2296
2265
 
2297
- if (this._bMobileTable) {
2298
- // responsive table requires the column order to be updated.
2299
- this._setMobileColumnOrder();
2300
- // update template for ResponisveTable
2301
- this._updateColumnTemplate(oMDCColumn, iIndex);
2302
- }
2266
+ this._setMobileColumnOrder();
2267
+ this._updateMobileColumnTemplate(oColumn, iIndex);
2303
2268
  }
2304
2269
  };
2305
2270
 
2306
- Table.prototype.removeColumn = function(oMDCColumn) {
2307
- oMDCColumn = this.removeAggregation("columns", oMDCColumn, true);
2308
- if (this._oTable) {
2309
- var oColumn = this._oTable.removeColumn(oMDCColumn.getId() + "-innerColumn");
2310
- oColumn.destroy("KeepDom");
2311
-
2312
- // update template for ResponsiveTable
2313
- if (this._bMobileTable) {
2314
- this._updateColumnTemplate(oMDCColumn, -1);
2315
- }
2316
- this._onModifications();
2317
- }
2318
- return oMDCColumn;
2271
+ Table.prototype.removeColumn = function(oColumn) {
2272
+ oColumn = this.removeAggregation("columns", oColumn, true);
2273
+ this._updateMobileColumnTemplate(oColumn, -1);
2274
+ return oColumn;
2319
2275
  };
2320
2276
 
2321
- Table.prototype.addColumn = function(oMDCColumn) {
2322
- this.addAggregation("columns", oMDCColumn, true);
2323
-
2324
- this._insertInnerColumn(oMDCColumn);
2277
+ Table.prototype.addColumn = function(oColumn) {
2278
+ this.addAggregation("columns", oColumn, true);
2279
+ this._insertInnerColumn(oColumn);
2280
+ return this;
2281
+ };
2325
2282
 
2283
+ Table.prototype.insertColumn = function(oColumn, iIndex) {
2284
+ this.insertAggregation("columns", oColumn, iIndex, true);
2285
+ this._insertInnerColumn(oColumn, iIndex);
2326
2286
  return this;
2327
2287
  };
2328
2288
 
2329
- Table.prototype.insertColumn = function(oMDCColumn, iIndex) {
2330
- this.insertAggregation("columns", oMDCColumn, iIndex, true);
2289
+ Table.prototype._setMobileColumnTemplate = function(oColumn, iIndex) {
2290
+ if (!this._bMobileTable) {
2291
+ return;
2292
+ }
2331
2293
 
2332
- this._insertInnerColumn(oMDCColumn, iIndex);
2333
- this._onModifications();
2334
- return this;
2294
+ var oCellTemplate = oColumn.getTemplateClone();
2295
+
2296
+ if (iIndex >= 0) {
2297
+ this._oTemplate.insertCell(oCellTemplate, iIndex);
2298
+ this._oTable.getItems().forEach(function(oItem) {
2299
+ // Add lightweight placeholders that can be rendered - if they cannot be rendered, there will be errors in the console.
2300
+ // The actual cells are created after rebind.
2301
+ oItem.insertAggregation("cells", new InvisibleText(), iIndex, true);
2302
+ });
2303
+ } else {
2304
+ this._oTemplate.addCell(oCellTemplate);
2305
+ }
2335
2306
  };
2336
2307
 
2337
- // ResponsiveTable
2338
- Table.prototype._updateColumnTemplate = function(oMDCColumn, iIndex) {
2308
+ Table.prototype._updateMobileColumnTemplate = function(oMDCColumn, iIndex) {
2309
+ if (!this._bMobileTable) {
2310
+ return;
2311
+ }
2312
+
2339
2313
  var oCellTemplate, iCellIndex;
2340
2314
  // TODO: Check if this can be moved inside the m.Table.
2341
2315
 
2342
2316
  // Remove cell template when column is hidden
2343
2317
  // Remove template cell from ColumnListItem (template)
2344
2318
  if (this._oTemplate) {
2345
- oCellTemplate = oMDCColumn.getTemplate(true);
2319
+ oCellTemplate = oMDCColumn.getTemplateClone();
2346
2320
  iCellIndex = this._oTemplate.indexOfCell(oCellTemplate);
2347
- Table._removeItemCell(this._oTemplate, iCellIndex, iIndex);
2321
+ removeMobileItemCell(this._oTemplate, iCellIndex, iIndex);
2348
2322
  }
2349
2323
 
2350
2324
  // Remove cells from actual rendered items, as this is not done automatically
@@ -2352,7 +2326,7 @@ sap.ui.define([
2352
2326
  this._oTable.getItems().forEach(function(oItem) {
2353
2327
  // Grouping row (when enabled) will not have cells
2354
2328
  if (oItem.removeCell) {
2355
- Table._removeItemCell(oItem, iCellIndex, iIndex);
2329
+ removeMobileItemCell(oItem, iCellIndex, iIndex);
2356
2330
  }
2357
2331
  });
2358
2332
  }
@@ -2363,22 +2337,25 @@ sap.ui.define([
2363
2337
  * Updating the responsive table's column order and invalidating avoid rebinds.
2364
2338
  * @private
2365
2339
  */
2366
- Table.prototype._setMobileColumnOrder = function() {
2367
- this.getColumns().forEach(function(oMDCColumn) {
2368
- var oColumn = Core.byId(oMDCColumn.getId() + "-innerColumn");
2369
- if (!oColumn) {
2340
+ Table.prototype._setMobileColumnOrder = function() {
2341
+ if (!this._bMobileTable) {
2342
+ return;
2343
+ }
2344
+
2345
+ this.getColumns().forEach(function(oColumn) {
2346
+ var oInnerColumn = oColumn.getInnerColumn();
2347
+ if (!oInnerColumn) {
2370
2348
  return;
2371
2349
  }
2372
2350
  // since we ensure correct index of the mdcColumn control we can set the same order to the inner responsive table columns
2373
- oColumn.setOrder(this.indexOfColumn(oMDCColumn));
2351
+ oInnerColumn.setOrder(this.indexOfColumn(oColumn));
2374
2352
  }, this);
2375
2353
 
2376
2354
  // invalidate the inner table to apply the correct order on the UI. See sap.m.Column#setOrder
2377
2355
  this._oTable.invalidate();
2378
2356
  };
2379
2357
 
2380
- Table._removeItemCell = function(oItem, iRemoveIndex, iInsertIndex) {
2381
- // remove cell from index
2358
+ function removeMobileItemCell(oItem, iRemoveIndex, iInsertIndex) {
2382
2359
  var oCell = oItem.removeCell(iRemoveIndex);
2383
2360
  if (oCell) {
2384
2361
  // -1 index destroys the inner content
@@ -2388,7 +2365,7 @@ sap.ui.define([
2388
2365
  oCell.destroy();
2389
2366
  }
2390
2367
  }
2391
- };
2368
+ }
2392
2369
 
2393
2370
  Table.prototype._onItemPress = function(oEvent) {
2394
2371
  this.fireRowPress({
@@ -2537,7 +2514,7 @@ sap.ui.define([
2537
2514
  Table._addBindingListener(oBindingInfo, "dataReceived", this._onDataReceived.bind(this));
2538
2515
  Table._addBindingListener(oBindingInfo, "change", this._onBindingChange.bind(this));
2539
2516
 
2540
- this._updateColumnsBeforeBinding(oBindingInfo);
2517
+ this._updateColumnsBeforeBinding();
2541
2518
  this.getControlDelegate().updateBinding(this, oBindingInfo, this._bForceRebind ? null : this.getRowBinding());
2542
2519
  this._updateInnerTableNoDataText();
2543
2520
  this._bForceRebind = false;
@@ -2631,32 +2608,27 @@ sap.ui.define([
2631
2608
  }
2632
2609
  };
2633
2610
 
2634
- Table.prototype._updateColumnsBeforeBinding = function(oBindingInfo) {
2635
- var aSorters = [].concat(oBindingInfo.sorter || []);
2636
- var aMDCColumns = this.getColumns();
2637
- var bMobileTable = this._bMobileTable;
2611
+ Table.prototype._updateColumnsBeforeBinding = function() {
2612
+ var aColumns = this.getColumns();
2638
2613
  var oPropertyHelper = this.getPropertyHelper();
2639
2614
 
2640
- aMDCColumns.forEach(function(oMDCColumn) {
2641
- var oInnerColumn = Core.byId(oMDCColumn.getId() + "-innerColumn");
2642
- var oProperty = oPropertyHelper.getProperty(oMDCColumn.getDataProperty());
2643
- var aSortablePaths = oProperty ? oProperty.getSortableProperties().map(function(oProperty) {
2644
- return oProperty.path;
2615
+ aColumns.forEach(function(oColumn) {
2616
+ var oInnerColumn = oColumn.getInnerColumn();
2617
+ var oProperty = oPropertyHelper.getProperty(oColumn.getDataProperty());
2618
+ var aSortableProperties = oProperty ? oProperty.getSortableProperties().map(function(oProperty) {
2619
+ return oProperty.name;
2645
2620
  }) : [];
2621
+ var oSortCondition = this._getSortedProperties().find(function(oSortCondition) {
2622
+ return aSortableProperties.includes(oSortCondition.name);
2623
+ });
2624
+ var sSortOrder = oSortCondition && oSortCondition.descending ? SortOrder.Descending : SortOrder.Ascending;
2646
2625
 
2647
- if (aSortablePaths.length > 0) {
2648
- var oSorter = aSorters.find(function(oSorter) {
2649
- return aSortablePaths.indexOf(oSorter.sPath) > -1;
2650
- });
2651
- var sSortOrder = oSorter && oSorter.bDescending ? "Descending" : "Ascending";
2652
-
2653
- if (bMobileTable) {
2654
- oInnerColumn.setSortIndicator(oSorter ? sSortOrder : "None");
2655
- } else {
2656
- oInnerColumn.setSorted(!!oSorter).setSortOrder(sSortOrder);
2657
- }
2626
+ if (this._bMobileTable) {
2627
+ oInnerColumn.setSortIndicator(oSortCondition ? sSortOrder : SortOrder.None);
2628
+ } else {
2629
+ oInnerColumn.setSorted(!!oSortCondition).setSortOrder(sSortOrder);
2658
2630
  }
2659
- });
2631
+ }, this);
2660
2632
  };
2661
2633
 
2662
2634
  /**
@@ -2835,5 +2807,4 @@ sap.ui.define([
2835
2807
  };
2836
2808
 
2837
2809
  return Table;
2838
-
2839
- });
2810
+ });