@openui5/sap.ui.mdc 1.111.0 → 1.112.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 (167) hide show
  1. package/package.json +4 -4
  2. package/src/sap/ui/mdc/.library +1 -1
  3. package/src/sap/ui/mdc/ActionToolbar.js +1 -1
  4. package/src/sap/ui/mdc/Chart.js +21 -23
  5. package/src/sap/ui/mdc/ChartDelegate.js +1 -1
  6. package/src/sap/ui/mdc/ChartRenderer.js +0 -2
  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 +6 -6
  10. package/src/sap/ui/mdc/FilterBar.js +1 -1
  11. package/src/sap/ui/mdc/FilterBarDelegate.js +0 -37
  12. package/src/sap/ui/mdc/FilterField.js +4 -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 +3 -11
  16. package/src/sap/ui/mdc/TableDelegate.js +5 -3
  17. package/src/sap/ui/mdc/ValueHelp.js +28 -15
  18. package/src/sap/ui/mdc/actiontoolbar/ActionToolbarAction.js +1 -1
  19. package/src/sap/ui/mdc/chart/ChartImplementationContainer.js +1 -1
  20. package/src/sap/ui/mdc/chart/ChartImplementationContainerRenderer.js +0 -2
  21. package/src/sap/ui/mdc/chart/ChartSelectionDetails.js +1 -1
  22. package/src/sap/ui/mdc/chart/ChartToolbar.js +2 -2
  23. package/src/sap/ui/mdc/chart/ChartTypeButton.js +2 -2
  24. package/src/sap/ui/mdc/chart/PropertyHelper.js +35 -2
  25. package/src/sap/ui/mdc/condition/Condition.js +1 -1
  26. package/src/sap/ui/mdc/condition/ConditionConverter.js +1 -1
  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 +43 -1
  30. package/src/sap/ui/mdc/condition/Operator.js +1 -1
  31. package/src/sap/ui/mdc/condition/OperatorDynamicDateOption.js +10 -17
  32. package/src/sap/ui/mdc/condition/RangeOperator.js +7 -8
  33. package/src/sap/ui/mdc/field/ConditionType.js +1 -1
  34. package/src/sap/ui/mdc/field/ConditionsType.js +1 -1
  35. package/src/sap/ui/mdc/field/CustomFieldInfo.js +1 -1
  36. package/src/sap/ui/mdc/field/DefineConditionPanel.js +6 -6
  37. package/src/sap/ui/mdc/field/DynamicDateRangeConditionsType.js +49 -62
  38. package/src/sap/ui/mdc/field/FieldBase.js +93 -33
  39. package/src/sap/ui/mdc/field/FieldInfoBase.js +1 -1
  40. package/src/sap/ui/mdc/field/FieldInput.js +1 -1
  41. package/src/sap/ui/mdc/field/FieldInputRenderUtil.js +1 -1
  42. package/src/sap/ui/mdc/field/FieldMultiInput.js +1 -1
  43. package/src/sap/ui/mdc/field/ListFieldHelpItem.js +1 -1
  44. package/src/sap/ui/mdc/field/MultiValueFieldItem.js +1 -1
  45. package/src/sap/ui/mdc/field/TokenDisplay.js +1 -1
  46. package/src/sap/ui/mdc/field/TokenizerDisplay.js +1 -1
  47. package/src/sap/ui/mdc/field/content/DateContent.js +1 -2
  48. package/src/sap/ui/mdc/filterbar/FilterBarBase.js +2 -2
  49. package/src/sap/ui/mdc/filterbar/FilterBarBaseRenderer.js +3 -0
  50. package/src/sap/ui/mdc/filterbar/PropertyHelper.js +1 -1
  51. package/src/sap/ui/mdc/filterbar/p13n/AdaptationFilterBar.js +29 -2
  52. package/src/sap/ui/mdc/filterbar/vh/FilterBar.js +1 -1
  53. package/src/sap/ui/mdc/flexibility/Chart.flexibility.js +1 -1
  54. package/src/sap/ui/mdc/flexibility/FilterBar.flexibility.js +1 -1
  55. package/src/sap/ui/mdc/flexibility/FilterItemFlex.js +1 -1
  56. package/src/sap/ui/mdc/flexibility/GroupFlex.js +56 -9
  57. package/src/sap/ui/mdc/flexibility/SortFlex.js +56 -9
  58. package/src/sap/ui/mdc/flexibility/Util.js +8 -3
  59. package/src/sap/ui/mdc/library.js +108 -2
  60. package/src/sap/ui/mdc/link/ContactDetails.js +1 -1
  61. package/src/sap/ui/mdc/link/ContactDetailsAddressItem.js +1 -1
  62. package/src/sap/ui/mdc/link/ContactDetailsEmailItem.js +1 -1
  63. package/src/sap/ui/mdc/link/ContactDetailsItem.js +1 -1
  64. package/src/sap/ui/mdc/link/ContactDetailsPhoneItem.js +1 -1
  65. package/src/sap/ui/mdc/link/Factory.js +1 -1
  66. package/src/sap/ui/mdc/link/FakeFlpConnector.js +1 -1
  67. package/src/sap/ui/mdc/link/LinkItem.js +1 -1
  68. package/src/sap/ui/mdc/link/Panel.js +1 -1
  69. package/src/sap/ui/mdc/link/PanelItem.js +1 -1
  70. package/src/sap/ui/mdc/link/SemanticObjectMapping.js +1 -1
  71. package/src/sap/ui/mdc/link/SemanticObjectMappingItem.js +1 -1
  72. package/src/sap/ui/mdc/link/SemanticObjectUnavailableAction.js +1 -1
  73. package/src/sap/ui/mdc/messagebundle.properties +15 -0
  74. package/src/sap/ui/mdc/messagebundle_ar.properties +11 -1
  75. package/src/sap/ui/mdc/messagebundle_bg.properties +10 -0
  76. package/src/sap/ui/mdc/messagebundle_ca.properties +10 -0
  77. package/src/sap/ui/mdc/messagebundle_cs.properties +10 -0
  78. package/src/sap/ui/mdc/messagebundle_cy.properties +10 -0
  79. package/src/sap/ui/mdc/messagebundle_da.properties +10 -0
  80. package/src/sap/ui/mdc/messagebundle_de.properties +10 -0
  81. package/src/sap/ui/mdc/messagebundle_el.properties +13 -3
  82. package/src/sap/ui/mdc/messagebundle_en.properties +10 -0
  83. package/src/sap/ui/mdc/messagebundle_en_GB.properties +10 -0
  84. package/src/sap/ui/mdc/messagebundle_en_US_sappsd.properties +10 -0
  85. package/src/sap/ui/mdc/messagebundle_en_US_saprigi.properties +2 -0
  86. package/src/sap/ui/mdc/messagebundle_en_US_saptrc.properties +10 -0
  87. package/src/sap/ui/mdc/messagebundle_es.properties +10 -0
  88. package/src/sap/ui/mdc/messagebundle_es_MX.properties +10 -0
  89. package/src/sap/ui/mdc/messagebundle_et.properties +10 -0
  90. package/src/sap/ui/mdc/messagebundle_fi.properties +10 -0
  91. package/src/sap/ui/mdc/messagebundle_fr.properties +10 -0
  92. package/src/sap/ui/mdc/messagebundle_fr_CA.properties +10 -0
  93. package/src/sap/ui/mdc/messagebundle_hi.properties +10 -0
  94. package/src/sap/ui/mdc/messagebundle_hr.properties +10 -0
  95. package/src/sap/ui/mdc/messagebundle_hu.properties +10 -0
  96. package/src/sap/ui/mdc/messagebundle_id.properties +10 -0
  97. package/src/sap/ui/mdc/messagebundle_it.properties +10 -0
  98. package/src/sap/ui/mdc/messagebundle_iw.properties +10 -0
  99. package/src/sap/ui/mdc/messagebundle_ja.properties +11 -1
  100. package/src/sap/ui/mdc/messagebundle_kk.properties +10 -0
  101. package/src/sap/ui/mdc/messagebundle_ko.properties +10 -0
  102. package/src/sap/ui/mdc/messagebundle_lt.properties +10 -0
  103. package/src/sap/ui/mdc/messagebundle_lv.properties +10 -0
  104. package/src/sap/ui/mdc/messagebundle_ms.properties +10 -0
  105. package/src/sap/ui/mdc/messagebundle_nl.properties +10 -0
  106. package/src/sap/ui/mdc/messagebundle_no.properties +10 -0
  107. package/src/sap/ui/mdc/messagebundle_pl.properties +10 -0
  108. package/src/sap/ui/mdc/messagebundle_pt.properties +10 -0
  109. package/src/sap/ui/mdc/messagebundle_pt_PT.properties +10 -0
  110. package/src/sap/ui/mdc/messagebundle_ro.properties +10 -0
  111. package/src/sap/ui/mdc/messagebundle_ru.properties +10 -0
  112. package/src/sap/ui/mdc/messagebundle_sh.properties +10 -0
  113. package/src/sap/ui/mdc/messagebundle_sk.properties +10 -0
  114. package/src/sap/ui/mdc/messagebundle_sl.properties +10 -0
  115. package/src/sap/ui/mdc/messagebundle_sv.properties +10 -0
  116. package/src/sap/ui/mdc/messagebundle_th.properties +10 -0
  117. package/src/sap/ui/mdc/messagebundle_tr.properties +10 -0
  118. package/src/sap/ui/mdc/messagebundle_uk.properties +15 -5
  119. package/src/sap/ui/mdc/messagebundle_vi.properties +10 -0
  120. package/src/sap/ui/mdc/messagebundle_zh_CN.properties +10 -0
  121. package/src/sap/ui/mdc/messagebundle_zh_TW.properties +10 -0
  122. package/src/sap/ui/mdc/mixin/AdaptationMixin.js +1 -1
  123. package/src/sap/ui/mdc/mixin/DelegateMixin.js +1 -1
  124. package/src/sap/ui/mdc/mixin/FilterIntegrationMixin.js +4 -3
  125. package/src/sap/ui/mdc/mixin/PromiseMixin.js +1 -1
  126. package/src/sap/ui/mdc/mixin/PropertyHelperMixin.js +1 -71
  127. package/src/sap/ui/mdc/odata/v4/TableDelegate.js +7 -0
  128. package/src/sap/ui/mdc/p13n/P13nBuilder.js +382 -376
  129. package/src/sap/ui/mdc/p13n/PropertyHelper.js +1 -1
  130. package/src/sap/ui/mdc/p13n/UIManager.js +1 -1
  131. package/src/sap/ui/mdc/p13n/panels/FilterPanel.js +1 -1
  132. package/src/sap/ui/mdc/p13n/subcontroller/AdaptFiltersController.js +5 -3
  133. package/src/sap/ui/mdc/p13n/subcontroller/ColumnWidthController.js +1 -1
  134. package/src/sap/ui/mdc/p13n/subcontroller/FilterController.js +158 -11
  135. package/src/sap/ui/mdc/p13n/subcontroller/LinkPanelController.js +7 -7
  136. package/src/sap/ui/mdc/p13n/subcontroller/SelectionController.js +1 -1
  137. package/src/sap/ui/mdc/table/ColumnSettings.js +1 -1
  138. package/src/sap/ui/mdc/table/CreationRow.js +1 -1
  139. package/src/sap/ui/mdc/table/GridTableType.js +19 -0
  140. package/src/sap/ui/mdc/table/PropertyHelper.js +1 -1
  141. package/src/sap/ui/mdc/table/ResponsiveColumnSettings.js +1 -1
  142. package/src/sap/ui/mdc/table/RowActionItem.js +1 -1
  143. package/src/sap/ui/mdc/table/RowSettings.js +1 -1
  144. package/src/sap/ui/mdc/table/V4AnalyticsPropertyHelper.js +1 -1
  145. package/src/sap/ui/mdc/table/menu/Item.js +6 -0
  146. package/src/sap/ui/mdc/themes/base/Chart.less +1 -1
  147. package/src/sap/ui/mdc/themes/base/ValueHelpDialog.less +5 -1
  148. package/src/sap/ui/mdc/util/DateUtil.js +84 -95
  149. package/src/sap/ui/mdc/util/InfoBar.js +88 -60
  150. package/src/sap/ui/mdc/util/PromiseCache.js +1 -1
  151. package/src/sap/ui/mdc/util/PropertyHelper.js +5 -1
  152. package/src/sap/ui/mdc/util/TypeUtil.js +6 -3
  153. package/src/sap/ui/mdc/valuehelp/Dialog.js +67 -58
  154. package/src/sap/ui/mdc/valuehelp/Popover.js +19 -1
  155. package/src/sap/ui/mdc/valuehelp/base/Container.js +12 -1
  156. package/src/sap/ui/mdc/valuehelp/base/Content.js +1 -1
  157. package/src/sap/ui/mdc/valuehelp/base/DialogTab.js +1 -1
  158. package/src/sap/ui/mdc/valuehelp/base/FilterableListContent.js +1 -1
  159. package/src/sap/ui/mdc/valuehelp/base/ListContent.js +1 -1
  160. package/src/sap/ui/mdc/valuehelp/content/Bool.js +1 -1
  161. package/src/sap/ui/mdc/valuehelp/content/Conditions.js +1 -1
  162. package/src/sap/ui/mdc/valuehelp/content/FixedList.js +1 -1
  163. package/src/sap/ui/mdc/valuehelp/content/MDCTable.js +1 -1
  164. package/src/sap/ui/mdc/valuehelp/content/MTable.js +6 -8
  165. package/src/sap/ui/mdc/p13n/Engine.js +0 -1200
  166. package/src/sap/ui/mdc/p13n/FlexUtil.js +0 -276
  167. package/src/sap/ui/mdc/p13n/subcontroller/BaseController.js +0 -438
@@ -1,438 +0,0 @@
1
- /*!
2
- * OpenUI5
3
- * (c) Copyright 2009-2023 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/base/util/array/diff',
9
- 'sap/ui/base/Object',
10
- 'sap/ui/mdc/p13n/FlexUtil',
11
- 'sap/ui/mdc/p13n/P13nBuilder',
12
- 'sap/base/util/merge',
13
- 'sap/base/util/deepEqual',
14
- 'sap/ui/model/json/JSONModel',
15
- 'sap/m/p13n/SelectionPanel'
16
- ], function (diff, BaseObject, FlexUtil, P13nBuilder, merge, deepEqual, JSONModel, SelectionPanel) {
17
- "use strict";
18
-
19
- /**
20
- * Constructor for a new <code>BaseController</code>.
21
- *
22
- * @param {string} [sId] ID for the new control, generated automatically if no ID is given
23
- * @param {object} [mSettings] Initial settings for the new control
24
- *
25
- * @class
26
- * The <code>BaseController</code> serves as base class to create control specific personalization implementations.
27
- *
28
- * @extends sap.ui.base.Object
29
- *
30
- * @author SAP SE
31
- * @version 1.111.0
32
- *
33
- * @private
34
- * @ui5-restricted sap.ui.mdc
35
- * @experimental
36
- * @since 1.87
37
- * @alias sap.ui.mdc.p13n.subcontroller.BaseController
38
- */
39
- var BaseController = BaseObject.extend("sap.ui.mdc.p13n.subcontroller.BaseController",{
40
- constructor: function(oControl) {
41
- BaseObject.call(this);
42
-
43
- this._oAdaptationControl = oControl;
44
- this._oP13nData = null;
45
- this._bLiveMode = false;
46
- this._bResetEnabled = false;
47
- }
48
- });
49
-
50
- /**
51
- * Customize the p13n container UI.
52
- *
53
- * @returns {object} The configuration for the Dialog/Popover
54
- */
55
- BaseController.prototype.getUISettings = function() {
56
- //Should always be overruled
57
- return {
58
- title: "Adaptation Dialog"
59
- };
60
- };
61
-
62
- /**
63
- * The control that is being personalized via this controller.
64
- *
65
- * @returns {sap.ui.mdc.Control} The control which is being adapted.
66
- */
67
- BaseController.prototype.getAdaptationControl = function(){
68
- return this._oAdaptationControl;
69
- };
70
-
71
- /**
72
- * Defines whether a Dialog (Change creation on 'OK') or a Popover (liveChanges) should be used.
73
- *
74
- * @returns {boolean} Determines if the livemode should be enabled
75
- */
76
- BaseController.prototype.getLiveMode = function(){
77
- return this._bLiveMode;
78
- };
79
-
80
- /**
81
- * Defines the available ChangeTypes (should be in sync with 'getDelta').
82
- *
83
- * @returns {object} A map of legal change types.
84
- */
85
- BaseController.prototype.getChangeOperations = function(){
86
- return {
87
- add: null,
88
- remove: null,
89
- move: null
90
- };
91
- };
92
-
93
- /**
94
- * Defines whether the container should include a reset.
95
- *
96
- * @returns {boolean} Determines if the reset should be enabled
97
- */
98
- BaseController.prototype.getResetEnabled = function() {
99
- return this._bResetEnabled;
100
- };
101
-
102
- /**
103
- * Defines which control(s) are considered for the reset.
104
- *
105
- * @returns {sap.ui.core.Control|sap.ui.core.Control[]}
106
- */
107
- BaseController.prototype.getSelectorForReset = function() {
108
- return this._oAdaptationControl;
109
- };
110
-
111
- BaseController.prototype.sanityCheck = function(oState) {
112
- return oState;
113
- };
114
-
115
- /**
116
- * The actual UI used for personalization.
117
- *
118
- * @param {sap.ui.mdc.util.PropertyHelper} oPropertyHelper The property helper instance
119
- * @returns {sap.ui.core.Control|string|Promise} The control which is going to be used in the p13n container.
120
- */
121
- BaseController.prototype.getAdaptationUI = function(oPropertyHelper){
122
-
123
- var oSelectionPanel = new SelectionPanel();
124
- var oAdaptationData = this.mixInfoAndState(oPropertyHelper);
125
- oSelectionPanel.setP13nData(oAdaptationData.items);
126
- this._oPanel = oSelectionPanel;
127
- return Promise.resolve(oSelectionPanel);
128
- };
129
-
130
- BaseController.prototype.getCurrentState = function(){
131
- return this._oAdaptationControl.getCurrentState()[this.getStateKey()];
132
- };
133
-
134
- BaseController.prototype.getStateKey = function(){
135
- return "items";
136
- };
137
-
138
- BaseController.prototype.getDelta = function(mPropertyBag) {
139
- var sPresenceAttribute = this._getPresenceAttribute(mPropertyBag.externalAppliance);
140
- var aNewStatePrepared;
141
-
142
- var fnFilterUnselected = function (oItem) {
143
- return oItem.hasOwnProperty(sPresenceAttribute) && oItem[sPresenceAttribute] === false ? false : true;
144
- };
145
- aNewStatePrepared = mPropertyBag.applyAbsolute
146
- ? mPropertyBag.changedState.filter(fnFilterUnselected) :
147
- this._getFilledArray(mPropertyBag.existingState, mPropertyBag.changedState, sPresenceAttribute).filter(fnFilterUnselected);
148
-
149
- mPropertyBag.changedState = aNewStatePrepared;
150
-
151
- //Example: Dialog Ok --> don't trigger unnecessary flex change processing
152
- if (deepEqual(mPropertyBag.existingState, aNewStatePrepared)){
153
- return [];
154
- } else {
155
- return this.getArrayDeltaChanges(mPropertyBag);
156
- }
157
-
158
- };
159
-
160
- /**
161
- * Generates a set of changes based on the given arrays for a specified control
162
- *
163
- * @public
164
- *
165
- * @param {object} mDeltaInfo Map containing the necessary information to calculate the diff as change objects
166
- * @param {array} mDeltaInfo.existingState An array describing the control state before a adaptation
167
- * @param {array} mDeltaInfo.changedState An array describing the control state after a certain adaptation
168
- * @param {object} mDeltaInfo.control Control instance which is being used to generate the changes
169
- * @param {object} mDeltaInfo.changeOperations Map containing the changeOperations for the given Control instance
170
- * @param {string} mDeltaInfo.changeOperations.add Name of the control specific 'add' changehandler
171
- * @param {string} mDeltaInfo.changeOperations.remove Name of the control specific 'remove' changehandler
172
- * @param {string} [mDeltaInfo.changeOperations.move] Name of the control specific 'move' changehandler
173
- * @param {string} [mDeltaInfo.generator] Name of the change generator (E.g. the namespace of the UI creating the change object)
174
- *
175
- * @returns {array} Array containing the delta based created changes
176
- */
177
- BaseController.prototype.getArrayDeltaChanges = function (mDeltaInfo) {
178
-
179
- var aExistingArray = mDeltaInfo.existingState;
180
- var aChangedArray = mDeltaInfo.changedState;
181
- var oControl = mDeltaInfo.control;
182
- var sInsertOperation = mDeltaInfo.changeOperations.add;
183
- var sRemoveOperation = mDeltaInfo.changeOperations.remove;
184
- var sMoveOperation = mDeltaInfo.changeOperations.move;
185
- var sGenerator = mDeltaInfo.generator;
186
-
187
- var aDeltaAttributes = mDeltaInfo.deltaAttributes || [];
188
-
189
- var fnSymbol = function(o) {
190
- var sDiff = "";
191
- aDeltaAttributes.forEach(function(sAttribute){
192
- sDiff = sDiff + o[sAttribute];
193
- });
194
- return sDiff;
195
- };
196
-
197
- var aResults = diff(aExistingArray, aChangedArray, fnSymbol);
198
- // Function to match field with exising field in the given array
199
- var fMatch = function (oField, aArray) {
200
- return aArray.filter(function (oExistingField) {
201
- return oExistingField && (oExistingField.name === oField.name);
202
- })[0];
203
- };
204
-
205
- var aChanges = [];
206
- var aProcessedArray = aExistingArray.slice(0);
207
-
208
- aResults.forEach(function (oResult) {
209
- // Begin --> hack for handling result returned by diff
210
- if (oResult.type === "delete" && aProcessedArray[oResult.index] === undefined) {
211
- aProcessedArray.splice(oResult.index, 1);
212
- return;
213
- }
214
-
215
- var oProp, oExistingProp, iLength;
216
- if (oResult.type === "insert") {
217
- oExistingProp = fMatch(aChangedArray[oResult.index], aProcessedArray);
218
- if (oExistingProp) {
219
- oExistingProp.index = aProcessedArray.indexOf(oExistingProp);
220
- aProcessedArray.splice(oExistingProp.index, 1, undefined);
221
- aChanges = aChanges.concat(this._createAddRemoveChange(oControl, sRemoveOperation, FlexUtil._getChangeContent(oExistingProp, aDeltaAttributes), sGenerator));
222
- }
223
- }
224
- // End hack
225
- oProp = oResult.type === "delete" ? aProcessedArray[oResult.index] : aChangedArray[oResult.index];
226
- oProp.index = oResult.index;
227
- if (oResult.type === "delete") {
228
- aProcessedArray.splice(oProp.index, 1);
229
- } else {
230
- aProcessedArray.splice(oProp.index, 0, oProp);
231
- }
232
- // Move operation shows up as insert followed by delete OR delete followed by insert
233
- if (sMoveOperation) {
234
- iLength = aChanges.length;
235
- // Get the last added change
236
- if (iLength) {
237
- oExistingProp = aChanges[iLength - 1];
238
- oExistingProp = oExistingProp ? oExistingProp.changeSpecificData.content : undefined;
239
- }
240
- // Matching property exists with a different index --> then this is a move operation
241
- if (oExistingProp && oExistingProp.name === oProp.name && oResult.index != oExistingProp.index) {
242
- // remove the last insert/delete operation
243
- aChanges.pop();
244
- aChanges = aChanges.concat(this._createMoveChange(oExistingProp.id, oExistingProp.name, oResult.index, sMoveOperation, oControl, sMoveOperation !== "moveSort", sGenerator));
245
- return;
246
- }
247
- }
248
-
249
- aChanges = aChanges.concat(this._createAddRemoveChange(oControl, oResult.type === "delete" ? sRemoveOperation : sInsertOperation, FlexUtil._getChangeContent(oProp, aDeltaAttributes), sGenerator));
250
-
251
- }.bind(this));
252
- return aChanges;
253
- };
254
-
255
- BaseController.prototype._createAddRemoveChange = function(oControl, sOperation, oContent){
256
- var oAddRemoveChange = {
257
- selectorElement: oControl,
258
- changeSpecificData: {
259
- changeType: sOperation,
260
- content: oContent
261
- }
262
- };
263
- return oAddRemoveChange;
264
- };
265
-
266
- BaseController.prototype._createMoveChange = function(sId, sPropertyName, iNewIndex, sMoveOperation, oControl, bPersistId){
267
- var oMoveChange = {
268
- selectorElement: oControl,
269
- changeSpecificData: {
270
- changeType: sMoveOperation,
271
- content: {
272
- id: sId,
273
- name: sPropertyName,
274
- index: iNewIndex
275
- }
276
- }
277
- };
278
-
279
- if (!bPersistId) {
280
- delete oMoveChange.changeSpecificData.content.id;
281
- }
282
-
283
- return oMoveChange;
284
- };
285
-
286
- BaseController.prototype._getPresenceAttribute = function(bexternalAppliance){
287
- return "visible";
288
- };
289
-
290
- /**
291
- * Allows calculations prior to applying a set of changes.
292
- * This can be used to mix additional changes to auto-created changes.
293
- *
294
- * @returns {Promise} A Promise that should resolve with an array of additional changes.
295
- */
296
- BaseController.prototype.getBeforeApply = function(){
297
- return Promise.resolve();
298
- };
299
-
300
- /**
301
- * Initialized the inner model for the Personalization.
302
- *
303
- * @param {sap.ui.mdc.util.PropertyHelper} oPropertyHelper The propertyhelper that should be utilized for property determination.
304
- * @returns {object} The personalization model data
305
- */
306
- BaseController.prototype.mixInfoAndState = function(oPropertyHelper) {
307
-
308
- var aItemState = this.getCurrentState();
309
- var mItemState = P13nBuilder.arrayToMap(aItemState);
310
-
311
- var oP13nData = P13nBuilder.prepareAdaptationData(oPropertyHelper, function(mItem, oProperty){
312
- var oExisting = mItemState[oProperty.name];
313
- mItem.visible = !!oExisting;
314
- mItem.position = oExisting ? oExisting.position : -1;
315
- return oProperty.visible;
316
- });
317
-
318
- P13nBuilder.sortP13nData({
319
- visible: "visible",
320
- position: "position"
321
- }, oP13nData.items);
322
-
323
- oP13nData.items.forEach(function(oItem){delete oItem.position;});
324
- return oP13nData;
325
- };
326
-
327
- /**
328
- * @returns {object} The personalization data.
329
- *
330
- */
331
- BaseController.prototype.getP13nData = function() {
332
- return this._oPanel ? this._oPanel.getP13nData() : this._oAdaptationModel.getProperty("/items");
333
- };
334
-
335
- BaseController.prototype.model2State = false;
336
-
337
- /**
338
- * Can be used to trigger update after UI interactions such as "Ok" and "Reset"
339
- *
340
- * @param {sap.ui.mdc.util.PropertyHelper} oPropertyHelper The property helper instance
341
- */
342
- BaseController.prototype.update = function(oPropertyHelper) {
343
- if (this._oPanel) {
344
- var oAdaptationData = this.mixInfoAndState(oPropertyHelper);
345
- this._oPanel.setP13nData(oAdaptationData.items);
346
- } else if (this._oAdaptationModel){
347
- //'setData' causes unnecessary rerendering in some cases
348
- var oP13nData = this.mixInfoAndState(oPropertyHelper);
349
- this._oAdaptationModel.setProperty("/items", oP13nData.items);
350
- this._oAdaptationModel.setProperty("/itemsGrouped", oP13nData.itemsGrouped);
351
- }
352
- };
353
-
354
- BaseController.prototype._getFilledArray = function(aPreviousItems, aNewItems, sRemoveProperty) {
355
- var aNewItemsPrepared = merge([], aPreviousItems);
356
- var aNewItemState = merge([], aNewItems);
357
-
358
- var mExistingItems = P13nBuilder.arrayToMap(aPreviousItems);
359
-
360
- aNewItemState.forEach(function (oItem) {
361
- var oExistingItem = mExistingItems[oItem.name];
362
- if (!oItem.hasOwnProperty(sRemoveProperty) || oItem[sRemoveProperty]) {
363
- var iNewPosition = oItem.position;
364
- if (oExistingItem){//move if it exists
365
- // do not reorder it in case it exists and no position is provided
366
- iNewPosition = iNewPosition > -1 ? iNewPosition : oExistingItem.position;
367
- var iOldPosition = oExistingItem.position;
368
- aNewItemsPrepared.splice(iNewPosition, 0, aNewItemsPrepared.splice(iOldPosition, 1)[0]);
369
- } else {//add if it does not exist the item will be inserted at the end
370
- iNewPosition = iNewPosition > -1 ? iNewPosition : aNewItemsPrepared.length;
371
- aNewItemsPrepared.splice(iNewPosition, 0, oItem);
372
- }
373
- aNewItemsPrepared[iNewPosition] = oItem;//overwrite existing item with new item (for correct values such as 'descending')
374
- } else if (oExistingItem) {//check if exists before delete
375
- aNewItemsPrepared[oExistingItem.position][sRemoveProperty] = false;
376
- }
377
- });
378
-
379
- return aNewItemsPrepared;
380
- };
381
-
382
- /**
383
- *
384
- * Getter for the personalization model
385
- *
386
- * @param {sap.ui.mdc.util.PropertyHelper} oPropertyHelper The property helper instance
387
- * @returns {sap.ui.model.json.JSONModel} The personalization model.
388
- *
389
- */
390
- BaseController.prototype._getP13nModel = function(oPropertyHelper) {
391
- if (!this._oAdaptationModel) {
392
- this._oAdaptationModel = new JSONModel(this.mixInfoAndState(oPropertyHelper));
393
- this._oP13nData = this._oAdaptationModel.getData();
394
- this._oAdaptationModel.setSizeLimit(10000);
395
- } else {
396
- this.update(oPropertyHelper);
397
- }
398
-
399
- return this._oAdaptationModel;
400
- };
401
-
402
- BaseController.prototype.changesToState = function(aChanges) {
403
-
404
- var aState = [];
405
-
406
- aChanges.forEach(function(oChange){
407
- var oStateDiffContent = merge({}, oChange.changeSpecificData.content);
408
- var iIndex = oStateDiffContent.index;
409
- delete oStateDiffContent.index;
410
-
411
- //set the position attribute in case to an explicit move
412
- if (oChange.changeSpecificData.changeType === this.getChangeOperations()["move"]) {
413
- oStateDiffContent.position = iIndex;
414
- }
415
-
416
- //set the presence attribute to false in case of an explicit remove
417
- if (oChange.changeSpecificData.changeType === this.getChangeOperations()["remove"]) {
418
- oStateDiffContent[this._getPresenceAttribute()] = false;
419
- }
420
-
421
- aState.push(oStateDiffContent);
422
- }.bind(this));
423
-
424
- return aState;
425
- };
426
-
427
- BaseController.prototype.destroy = function() {
428
- BaseObject.prototype.destroy.apply(this, arguments);
429
- this._oAdaptationControl = null;
430
- this._bLiveMode = null;
431
- this._oPanel = null;
432
- this._bResetEnabled = null;
433
- this._oAdaptationModel = null;
434
- };
435
-
436
- return BaseController;
437
-
438
- });