@openui5/sap.ui.mdc 1.111.6 → 1.112.1

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 +4 -4
  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 +7 -1
  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
@@ -5,18 +5,22 @@
5
5
  */
6
6
  sap.ui.define([
7
7
  "./PropertyHelper",
8
- "sap/m/Button",
9
- "sap/m/Bar",
10
- "sap/m/Title",
11
- "sap/base/util/merge",
12
- "sap/m/MessageBox",
13
- "sap/ui/Device",
14
- "sap/ui/fl/write/api/FieldExtensibility",
15
- "sap/ui/core/Configuration"
16
- ], function(P13nPropertyHelper, Button, Bar, Title, merge, MessageBox, Device, FieldExtensibility, Configuration) {
17
- "use strict";
18
-
19
- var oRB = sap.ui.getCore().getLibraryResourceBundle("sap.ui.mdc");
8
+ "sap/m/Button",
9
+ "sap/m/Bar",
10
+ "sap/m/Title",
11
+ "sap/base/util/merge",
12
+ "sap/m/MessageBox",
13
+ "sap/ui/Device",
14
+ "sap/ui/fl/write/api/FieldExtensibility",
15
+ "sap/ui/core/Configuration",
16
+ "sap/ui/core/library"
17
+ ], function(P13nPropertyHelper, Button, Bar, Title, merge, MessageBox, Device, FieldExtensibility, Configuration, coreLibrary) {
18
+ "use strict";
19
+
20
+ var oRB = sap.ui.getCore().getLibraryResourceBundle("sap.ui.mdc");
21
+
22
+ //Shortcut to sap.ui.core.TitleLevel
23
+ var TitleLevel = coreLibrary.TitleLevel;
20
24
 
21
25
  /**
22
26
  * Internal Utility class to create personalization UI's
@@ -28,378 +32,380 @@ sap.ui.define([
28
32
  */
29
33
  var P13nBuilder = {
30
34
 
31
- /**
32
- *
33
- * @param {object} oP13nUI Control displayed in the content area
34
- * @param {object} mDialogSettings Settings to overwrite popover default properties, such as: <code>contentHeight</code>
35
- * @param {object} [mDialogSettings.reset] Reset settings for the custom header creation
36
- * @param {function} [mDialogSettings.reset.onExecute] Callback executed upon triggering a reset
37
- * @param {string} [mDialogSettings.reset.warningText] Warning which is displyed prior to executing the reset
38
- *
39
- * @returns {Promise} promise resolving in the Popover instance
40
- */
41
- createP13nPopover: function(oP13nUI, mDialogSettings) {
42
-
43
- return new Promise(function(resolve, reject){
44
-
45
- sap.ui.require(["sap/m/ResponsivePopover"], function(ResponsivePopover){
46
- P13nBuilder["_checkSettings"](oP13nUI, mDialogSettings, reject);
47
-
48
- var oPopover = new ResponsivePopover({
49
- title: mDialogSettings.title,
50
- horizontalScrolling: mDialogSettings.hasOwnProperty("horizontalScrolling") ? mDialogSettings.horizontalScrolling : false,
51
- verticalScrolling: mDialogSettings.hasOwnProperty("verticalScrolling") ? mDialogSettings.verticalScrolling : false,
52
- contentWidth: mDialogSettings.contentWidth ? mDialogSettings.contentWidth : "24rem",
53
- resizable: mDialogSettings.hasOwnProperty("resizable") ? mDialogSettings.resizable : true,
54
- contentHeight: mDialogSettings.contentHeight ? mDialogSettings.contentHeight : "35rem",
55
- placement: mDialogSettings.placement ? mDialogSettings.placement : "Bottom",
56
- content: oP13nUI,
57
- afterClose: mDialogSettings.afterClose ? mDialogSettings.afterClose : function(){}
58
- });
59
-
60
- if (mDialogSettings.reset) {
61
- var oCustomHeader = P13nBuilder._createResetHeader({
62
- title: mDialogSettings.title,
63
- reset: mDialogSettings.reset.onExecute,
64
- idResetButton: mDialogSettings.reset.idButton,
65
- warningText: mDialogSettings.reset.warningText
66
- });
67
- oPopover.setCustomHeader(oCustomHeader);
68
- }
69
-
70
- resolve(oPopover);
71
- },reject);
72
- });
73
-
74
- },
75
-
76
- /**
77
- *
78
- * @param {object} oP13nUI Control displayed in the content area
79
- * @param {object} mDialogSettings Settings to overwrite dialog default properties, such as: <code>contentHeight</code>
80
- * @param {object} [mDialogSettings.reset] Reset settings for the custom header creation
81
- * @param {function} [mDialogSettings.reset.onExecute] Callback executed upon triggering a reset
82
- * @param {string} [mDialogSettings.reset.warningText] Warning which is displyed prior to executing the reset
83
- *
84
- * @returns {Promise} Promise resolving in the Dialog instance
85
- */
86
- createP13nDialog: function(oP13nUI, mDialogSettings) {
87
-
88
- return new Promise(function(resolve, reject){
89
-
90
- P13nBuilder["_checkSettings"](oP13nUI, mDialogSettings, reject);
91
-
92
- var sId = mDialogSettings.id;
93
-
94
- sap.ui.require(["sap/m/Dialog", "sap/m/Button"], function(Dialog, Button){
95
- var oResourceBundle = sap.ui.getCore().getLibraryResourceBundle("sap.ui.mdc");
96
- var oContainer = new Dialog(sId, {
97
- title: mDialogSettings.title,
98
- horizontalScrolling: mDialogSettings.hasOwnProperty("horizontalScrolling") ? mDialogSettings.horizontalScrolling : false,
99
- verticalScrolling: mDialogSettings.hasOwnProperty("verticalScrolling") ? mDialogSettings.verticalScrolling : true,
100
- contentWidth: mDialogSettings.contentWidth ? mDialogSettings.contentWidth : "40rem",
101
- contentHeight: mDialogSettings.contentHeight ? mDialogSettings.contentHeight : "55rem",
102
- draggable: true,
103
- resizable: true,
104
- stretch: Device.system.phone,
105
- content: oP13nUI,
106
- afterClose: mDialogSettings.afterClose ? mDialogSettings.afterClose : function(){},
107
- buttons: [
108
- new Button(sId ? sId + "-confirmBtn" : undefined, {
109
- text: mDialogSettings.confirm && mDialogSettings.confirm.text ? mDialogSettings.confirm.text : oResourceBundle.getText("p13nDialog.OK"),
110
- type: "Emphasized",
111
- press: function() {
112
- if (mDialogSettings.confirm && mDialogSettings.confirm.handler) {
113
- mDialogSettings.confirm.handler.apply(oContainer, arguments);
114
- }
115
- }
116
-
117
- }), new Button(sId ? sId + "-cancelBtn" : undefined, {
118
- text: oResourceBundle.getText("p13nDialog.CANCEL"),
119
- press: function () {
120
- mDialogSettings.cancel.apply(oContainer, arguments);
121
- }
122
- })
123
- ]
124
- });
125
-
126
- if (mDialogSettings.reset) {
127
- var oCustomHeader = P13nBuilder._createResetHeader({
128
- title: mDialogSettings.title,
129
- idResetButton: mDialogSettings.reset.idButton,
130
- reset: mDialogSettings.reset.onExecute,
131
- warningText: mDialogSettings.reset.warningText
132
- });
133
- oContainer.setCustomHeader(oCustomHeader);
134
- }
135
-
136
- var aAdditionalButtons = mDialogSettings.additionalButtons;
137
- if (aAdditionalButtons instanceof Array) {
138
- aAdditionalButtons.forEach(function(oButton){
139
- if (!oButton.isA("sap.m.Button")) {
140
- reject("Please only provide sap.m.Button instances as 'additionalButtons'");
141
- }
142
- oContainer.addButton(oButton);
143
- });
144
- }
145
- resolve(oContainer);
146
- }, reject);
147
- });
148
-
149
- },
150
-
151
- /**
152
- *
153
- * @param {object} mSettings Settings object to create a customHeader including a reset Button
154
- * @param {string} mSettings.title Title for the custom reset header
155
- * @param {function} mSettings.reset Control specific reset handling
156
- * @param {string} [mSettings.warningText] Text which is displayed prior to executing to reset execution
157
- *
158
- * @returns {sap.m.Bar} The created custom header Bar
159
- */
160
- _createResetHeader: function(mSettings) {
161
-
162
- var oBar = new Bar({
163
- contentLeft: [
164
- new Title({
165
- text: mSettings.title
166
- })
167
- ]
168
- });
169
-
170
- if (mSettings.reset) {
171
- var sId = mSettings.idResetButton;
172
- oBar.addContentRight(new Button( sId, {
173
- text: sap.ui.getCore().getLibraryResourceBundle("sap.ui.mdc").getText("p13nDialog.RESET"),
174
- press: function(oEvt) {
175
-
176
- var oDialog = oEvt.getSource().getParent().getParent();
177
- var oControl = oDialog.getParent();
178
-
179
- var sResetText = mSettings.warningText ? mSettings.warningText : sap.ui.getCore().getLibraryResourceBundle("sap.ui.mdc").getText("filterbar.ADAPT_RESET_WARNING");
180
- MessageBox.warning(sResetText, {
181
- actions: [MessageBox.Action.OK, MessageBox.Action.CANCEL],
182
- emphasizedAction: MessageBox.Action.OK,
183
- onClose: function (sAction) {
184
- if (sAction === MessageBox.Action.OK) {
185
- // --> focus "OK" button after 'reset' has been triggered
186
- oDialog.getButtons()[0].focus();
187
- mSettings.reset(oControl);
188
- }
189
- }
190
- });
191
- }
192
- }));
193
- }
194
-
195
- return oBar;
196
- },
197
-
198
- prepareAdaptationData: function(vProperties, fnEnhace, bGroupData) {
35
+ /**
36
+ *
37
+ * @param {object} oP13nUI Control displayed in the content area
38
+ * @param {object} mDialogSettings Settings to overwrite popover default properties, such as: <code>contentHeight</code>
39
+ * @param {object} [mDialogSettings.reset] Reset settings for the custom header creation
40
+ * @param {function} [mDialogSettings.reset.onExecute] Callback executed upon triggering a reset
41
+ * @param {string} [mDialogSettings.reset.warningText] Warning which is displyed prior to executing the reset
42
+ *
43
+ * @returns {Promise} promise resolving in the Popover instance
44
+ */
45
+ createP13nPopover: function(oP13nUI, mDialogSettings) {
46
+
47
+ return new Promise(function(resolve, reject){
48
+
49
+ sap.ui.require(["sap/m/ResponsivePopover"], function(ResponsivePopover){
50
+ P13nBuilder["_checkSettings"](oP13nUI, mDialogSettings, reject);
51
+
52
+ var oPopover = new ResponsivePopover({
53
+ title: mDialogSettings.title,
54
+ horizontalScrolling: mDialogSettings.hasOwnProperty("horizontalScrolling") ? mDialogSettings.horizontalScrolling : false,
55
+ verticalScrolling: mDialogSettings.hasOwnProperty("verticalScrolling") ? mDialogSettings.verticalScrolling : false,
56
+ contentWidth: mDialogSettings.contentWidth ? mDialogSettings.contentWidth : "24rem",
57
+ resizable: mDialogSettings.hasOwnProperty("resizable") ? mDialogSettings.resizable : true,
58
+ contentHeight: mDialogSettings.contentHeight ? mDialogSettings.contentHeight : "35rem",
59
+ placement: mDialogSettings.placement ? mDialogSettings.placement : "Bottom",
60
+ content: oP13nUI,
61
+ afterClose: mDialogSettings.afterClose ? mDialogSettings.afterClose : function(){}
62
+ });
63
+
64
+ if (mDialogSettings.reset) {
65
+ var oCustomHeader = P13nBuilder._createResetHeader({
66
+ title: mDialogSettings.title,
67
+ reset: mDialogSettings.reset.onExecute,
68
+ idResetButton: mDialogSettings.reset.idButton,
69
+ warningText: mDialogSettings.reset.warningText
70
+ });
71
+ oPopover.setCustomHeader(oCustomHeader);
72
+ }
73
+
74
+ resolve(oPopover);
75
+ },reject);
76
+ });
77
+
78
+ },
79
+
80
+ /**
81
+ *
82
+ * @param {object} oP13nUI Control displayed in the content area
83
+ * @param {object} mDialogSettings Settings to overwrite dialog default properties, such as: <code>contentHeight</code>
84
+ * @param {object} [mDialogSettings.reset] Reset settings for the custom header creation
85
+ * @param {function} [mDialogSettings.reset.onExecute] Callback executed upon triggering a reset
86
+ * @param {string} [mDialogSettings.reset.warningText] Warning which is displyed prior to executing the reset
87
+ *
88
+ * @returns {Promise} Promise resolving in the Dialog instance
89
+ */
90
+ createP13nDialog: function(oP13nUI, mDialogSettings) {
91
+
92
+ return new Promise(function(resolve, reject){
93
+
94
+ P13nBuilder["_checkSettings"](oP13nUI, mDialogSettings, reject);
95
+
96
+ var sId = mDialogSettings.id;
97
+
98
+ sap.ui.require(["sap/m/Dialog", "sap/m/Button"], function(Dialog, Button){
99
+ var oResourceBundle = sap.ui.getCore().getLibraryResourceBundle("sap.ui.mdc");
100
+ var oContainer = new Dialog(sId, {
101
+ title: mDialogSettings.title,
102
+ horizontalScrolling: mDialogSettings.hasOwnProperty("horizontalScrolling") ? mDialogSettings.horizontalScrolling : false,
103
+ verticalScrolling: mDialogSettings.hasOwnProperty("verticalScrolling") ? mDialogSettings.verticalScrolling : true,
104
+ contentWidth: mDialogSettings.contentWidth ? mDialogSettings.contentWidth : "40rem",
105
+ contentHeight: mDialogSettings.contentHeight ? mDialogSettings.contentHeight : "55rem",
106
+ draggable: true,
107
+ resizable: true,
108
+ stretch: Device.system.phone,
109
+ content: oP13nUI,
110
+ afterClose: mDialogSettings.afterClose ? mDialogSettings.afterClose : function(){},
111
+ buttons: [
112
+ new Button(sId ? sId + "-confirmBtn" : undefined, {
113
+ text: mDialogSettings.confirm && mDialogSettings.confirm.text ? mDialogSettings.confirm.text : oResourceBundle.getText("p13nDialog.OK"),
114
+ type: "Emphasized",
115
+ press: function() {
116
+ if (mDialogSettings.confirm && mDialogSettings.confirm.handler) {
117
+ mDialogSettings.confirm.handler.apply(oContainer, arguments);
118
+ }
119
+ }
120
+
121
+ }), new Button(sId ? sId + "-cancelBtn" : undefined, {
122
+ text: oResourceBundle.getText("p13nDialog.CANCEL"),
123
+ press: function () {
124
+ mDialogSettings.cancel.apply(oContainer, arguments);
125
+ }
126
+ })
127
+ ]
128
+ });
129
+
130
+ if (mDialogSettings.reset) {
131
+ var oCustomHeader = P13nBuilder._createResetHeader({
132
+ title: mDialogSettings.title,
133
+ idResetButton: mDialogSettings.reset.idButton,
134
+ reset: mDialogSettings.reset.onExecute,
135
+ warningText: mDialogSettings.reset.warningText
136
+ });
137
+ oContainer.setCustomHeader(oCustomHeader);
138
+ }
139
+
140
+ var aAdditionalButtons = mDialogSettings.additionalButtons;
141
+ if (aAdditionalButtons instanceof Array) {
142
+ aAdditionalButtons.forEach(function(oButton){
143
+ if (!oButton.isA("sap.m.Button")) {
144
+ reject("Please only provide sap.m.Button instances as 'additionalButtons'");
145
+ }
146
+ oContainer.addButton(oButton);
147
+ });
148
+ }
149
+ resolve(oContainer);
150
+ }, reject);
151
+ });
152
+
153
+ },
154
+
155
+ /**
156
+ *
157
+ * @param {object} mSettings Settings object to create a customHeader including a reset Button
158
+ * @param {string} mSettings.title Title for the custom reset header
159
+ * @param {function} mSettings.reset Control specific reset handling
160
+ * @param {string} [mSettings.warningText] Text which is displayed prior to executing to reset execution
161
+ *
162
+ * @returns {sap.m.Bar} The created custom header Bar
163
+ */
164
+ _createResetHeader: function(mSettings) {
165
+
166
+ var oBar = new Bar({
167
+ contentLeft: [
168
+ new Title({
169
+ text: mSettings.title,
170
+ level: TitleLevel.H1
171
+ })
172
+ ]
173
+ });
174
+
175
+ if (mSettings.reset) {
176
+ var sId = mSettings.idResetButton;
177
+ oBar.addContentRight(new Button( sId, {
178
+ text: sap.ui.getCore().getLibraryResourceBundle("sap.ui.mdc").getText("p13nDialog.RESET"),
179
+ press: function(oEvt) {
180
+
181
+ var oDialog = oEvt.getSource().getParent().getParent();
182
+ var oControl = oDialog.getParent();
183
+
184
+ var sResetText = mSettings.warningText ? mSettings.warningText : sap.ui.getCore().getLibraryResourceBundle("sap.ui.mdc").getText("filterbar.ADAPT_RESET_WARNING");
185
+ MessageBox.warning(sResetText, {
186
+ actions: [MessageBox.Action.OK, MessageBox.Action.CANCEL],
187
+ emphasizedAction: MessageBox.Action.OK,
188
+ onClose: function (sAction) {
189
+ if (sAction === MessageBox.Action.OK) {
190
+ // --> focus "OK" button after 'reset' has been triggered
191
+ oDialog.getButtons()[0].focus();
192
+ mSettings.reset(oControl);
193
+ }
194
+ }
195
+ });
196
+ }
197
+ }));
198
+ }
199
+
200
+ return oBar;
201
+ },
202
+
203
+ prepareAdaptationData: function(vProperties, fnEnhace, bGroupData) {
199
204
 
200
205
  var oPropertyHelper =
201
- vProperties && vProperties.getProperties instanceof Function ?
206
+ vProperties && vProperties.getProperties instanceof Function ?
202
207
  vProperties : new P13nPropertyHelper(vProperties);
203
208
 
204
- var aItems = [];
205
- var mItemsGrouped = bGroupData ? {} : null;
209
+ var aItems = [];
210
+ var mItemsGrouped = bGroupData ? {} : null;
206
211
 
207
- var bEnhance = fnEnhace instanceof Function;
212
+ var bEnhance = fnEnhace instanceof Function;
208
213
 
209
214
  oPropertyHelper.getProperties().forEach(function(oProperty) {
210
215
 
211
- var mItem = {};
212
- mItem.name = oProperty.name;
213
-
214
- if (bEnhance) {
215
- var bIsValid = fnEnhace(mItem, oProperty);
216
- if (!bIsValid) {
217
- return;
218
- }
219
- }
220
-
221
- mItem.label = oProperty.label || oProperty.name;
222
- mItem.tooltip = oProperty.tooltip;
223
-
224
- if (mItemsGrouped) {
225
- mItem.group = oProperty.group ? oProperty.group : "BASIC";
226
- mItem.groupLabel = oProperty.groupLabel;
227
- mItemsGrouped[mItem.group] = mItemsGrouped[mItem.group] ? mItemsGrouped[mItem.group] : [];
228
- mItemsGrouped[mItem.group].push(mItem);
229
- }
230
-
231
- aItems.push(mItem);
232
-
233
- });
234
-
235
- var oAdaptationData = {
236
- items: aItems
237
- };
238
-
239
- if (mItemsGrouped) {
240
- oAdaptationData.itemsGrouped = this._buildGroupStructure(mItemsGrouped);
241
- }
242
-
243
- return oAdaptationData;
244
-
245
- },
246
-
247
- //TODO: generify
248
- sortP13nData: function (oSorting, aItems) {
249
-
250
- var mP13nTypeSorting = oSorting;
251
-
252
- var sPositionAttribute = mP13nTypeSorting.position;
253
- var sSelectedAttribute = mP13nTypeSorting.visible;
254
-
255
- var sLocale = Configuration.getLocale().toString();
256
-
257
- var oCollator = window.Intl.Collator(sLocale, {});
258
-
259
- // group selected / unselected --> sort alphabetically in each group
260
- aItems.sort(function (mField1, mField2) {
261
- if (mField1[sSelectedAttribute] && mField2[sSelectedAttribute]) {
262
- return (mField1[sPositionAttribute] || 0) - (mField2[sPositionAttribute] || 0);
263
- } else if (mField1[sSelectedAttribute]) {
264
- return -1;
265
- } else if (mField2[sSelectedAttribute]) {
266
- return 1;
267
- } else if (!mField1[sSelectedAttribute] && !mField2[sSelectedAttribute]) {
268
- return oCollator.compare(mField1.label, mField2.label);
269
- }
270
- });
271
-
272
- },
273
-
274
- _buildGroupStructure: function(mItemsGrouped) {
275
- var aGroupedItems = [];
276
- Object.keys(mItemsGrouped).forEach(function(sGroupKey){
277
- this.sortP13nData("generic", mItemsGrouped[sGroupKey]);
278
- aGroupedItems.push({
279
- group: sGroupKey,
280
- groupLabel: mItemsGrouped[sGroupKey][0].groupLabel || oRB.getText("p13nDialog.FILTER_DEFAULT_GROUP"),//Grouplabel might not be necessarily be propagated to every item
281
- groupVisible: true,
282
- items: mItemsGrouped[sGroupKey]
283
- });
284
- }.bind(this));
285
- return aGroupedItems;
286
-
287
- },
288
-
289
- _isExcludeProperty: function(oProperty, aIgnoreAttributes){
290
-
291
- return aIgnoreAttributes.some(function(oKeyValuePair){
292
- var sIgnoreKey = oKeyValuePair.ignoreKey;
293
- var vIgnoreValue = oKeyValuePair.ignoreValue;
294
- return oProperty[sIgnoreKey] === vIgnoreValue;
295
- });
296
-
297
- },
298
-
299
- _checkSettings: function(oP13nUI, mDialogSettings, fnOnError) {
300
- if (!mDialogSettings) {
301
- fnOnError("Please provide a settings object for p13n creation");
302
- }
303
-
304
- if (!mDialogSettings.title && !mDialogSettings.customHeader) {
305
- fnOnError("Please provide a title or customHeader in the settings object for p13n creation");
306
- }
307
- },
308
-
309
- arrayToMap: function(aArray) {
310
- return aArray.reduce(function(mMap, oProp, iIndex){
311
- mMap[oProp.name] = oProp;
312
- mMap[oProp.name].position = iIndex;
313
- return mMap;
314
- }, {});
315
- },
316
-
317
- /**
318
- *
319
- * @param {object} oDialog AdaptFiltersDialog
320
- * @param {object} [oParent] An optional parent object to chain if necessary
321
- *
322
- * @returns {Promise} Promise resolving in the Dialog instance
323
- */
324
- addRTACustomFieldButton: function (oDialog, oParent) {
325
-
326
- var bExtensibilityEnabled = false,
327
- oDialogParent = oDialog.getParent();
328
-
329
- // cover SmartTable scenario
330
- if (oParent && oParent.isA('sap.ui.comp.smarttable.SmartTable')) {
331
- oDialogParent = oParent;
332
- }
333
-
334
- return sap.ui.getCore().loadLibrary('sap.ui.rta', {
335
- async: true
336
- }).then(function() {
337
- return new Promise(function(resolve) {
338
- sap.ui.require([
339
- "sap/ui/rta/Utils"
340
- ], function(rtaUtils) {
341
- var oHandleExtensibility = Promise.all([
342
- rtaUtils.isServiceUpToDate(oDialogParent),
343
- FieldExtensibility.isExtensibilityEnabled(oDialogParent)
344
- ]);
345
-
346
- return oHandleExtensibility.then(function (aResult) {
347
- bExtensibilityEnabled = !!aResult[1];
348
- })
349
- .then(function() {
350
- var oCustomHeader = oDialog.getCustomHeader(),
351
- sId = oDialogParent && oDialogParent.getId ? oDialogParent.getId() : undefined,
352
- oResourceBundle = sap.ui.getCore().getLibraryResourceBundle("sap.ui.mdc");
353
-
354
- if (!oCustomHeader) {
355
- var oBar = new Bar({
356
- contentLeft: [
357
- new Title({
358
- text: oDialog.getTitle()
359
- })
360
- ]
361
- });
362
- oDialog.setCustomHeader(oBar);
363
- oCustomHeader = oDialog.getCustomHeader();
364
- }
365
-
366
- if (bExtensibilityEnabled) {
367
- oCustomHeader.addContentRight(new Button( sId + "-addCustomField", {
368
- icon: "sap-icon://add",
369
- enabled: bExtensibilityEnabled,
370
- tooltip: oResourceBundle.getText("p13nDialog.rtaAddTooltip"),
371
- press: function (oEvt) {
372
- var sRtaStyleClassName = rtaUtils.getRtaStyleClassName(),
373
- oAdaptDialog = oEvt.getSource().getParent().getParent(),
374
- oControl = oAdaptDialog.getParent();
375
-
376
- // cover SmartTable scenario
377
- if (oParent && oParent.isA('sap.ui.comp.smarttable.SmartTable')) {
378
- oControl = oParent;
379
- }
380
-
381
- FieldExtensibility.onControlSelected(oControl).then(function (oRetVal) {
382
- FieldExtensibility.getExtensionData().then(function (oExtensibilityInfo) {
383
- FieldExtensibility.onTriggerCreateExtensionData(oExtensibilityInfo, sRtaStyleClassName);
384
- oAdaptDialog.close(); // close as if there is newly created custom field, next time user tries to open it - it checks for service outdated and shows correct information
385
- });
386
- });
387
-
388
- }
389
- }));
390
-
391
- oDialog.setCustomHeader(oCustomHeader);
392
- resolve(oDialog);
393
- }
394
-
395
- });
396
-
397
- });
398
- });
399
- });
400
- }
401
-
402
- };
216
+ var mItem = {};
217
+ mItem.name = oProperty.name;
218
+
219
+ if (bEnhance) {
220
+ var bIsValid = fnEnhace(mItem, oProperty);
221
+ if (!bIsValid) {
222
+ return;
223
+ }
224
+ }
225
+
226
+ mItem.label = oProperty.label || oProperty.name;
227
+ mItem.tooltip = oProperty.tooltip;
228
+
229
+ if (mItemsGrouped) {
230
+ mItem.group = oProperty.group ? oProperty.group : "BASIC";
231
+ mItem.groupLabel = oProperty.groupLabel;
232
+ mItemsGrouped[mItem.group] = mItemsGrouped[mItem.group] ? mItemsGrouped[mItem.group] : [];
233
+ mItemsGrouped[mItem.group].push(mItem);
234
+ }
235
+
236
+ aItems.push(mItem);
237
+
238
+ });
239
+
240
+ var oAdaptationData = {
241
+ items: aItems
242
+ };
243
+
244
+ if (mItemsGrouped) {
245
+ oAdaptationData.itemsGrouped = this._buildGroupStructure(mItemsGrouped);
246
+ }
247
+
248
+ return oAdaptationData;
249
+
250
+ },
251
+
252
+ //TODO: generify
253
+ sortP13nData: function (oSorting, aItems) {
254
+
255
+ var mP13nTypeSorting = oSorting;
256
+
257
+ var sPositionAttribute = mP13nTypeSorting.position;
258
+ var sSelectedAttribute = mP13nTypeSorting.visible;
259
+
260
+ var sLocale = Configuration.getLocale().toString();
261
+
262
+ var oCollator = window.Intl.Collator(sLocale, {});
263
+
264
+ // group selected / unselected --> sort alphabetically in each group
265
+ aItems.sort(function (mField1, mField2) {
266
+ if (mField1[sSelectedAttribute] && mField2[sSelectedAttribute]) {
267
+ return (mField1[sPositionAttribute] || 0) - (mField2[sPositionAttribute] || 0);
268
+ } else if (mField1[sSelectedAttribute]) {
269
+ return -1;
270
+ } else if (mField2[sSelectedAttribute]) {
271
+ return 1;
272
+ } else if (!mField1[sSelectedAttribute] && !mField2[sSelectedAttribute]) {
273
+ return oCollator.compare(mField1.label, mField2.label);
274
+ }
275
+ });
276
+
277
+ },
278
+
279
+ _buildGroupStructure: function(mItemsGrouped) {
280
+ var aGroupedItems = [];
281
+ Object.keys(mItemsGrouped).forEach(function(sGroupKey){
282
+ this.sortP13nData("generic", mItemsGrouped[sGroupKey]);
283
+ aGroupedItems.push({
284
+ group: sGroupKey,
285
+ groupLabel: mItemsGrouped[sGroupKey][0].groupLabel || oRB.getText("p13nDialog.FILTER_DEFAULT_GROUP"),//Grouplabel might not be necessarily be propagated to every item
286
+ groupVisible: true,
287
+ items: mItemsGrouped[sGroupKey]
288
+ });
289
+ }.bind(this));
290
+ return aGroupedItems;
291
+
292
+ },
293
+
294
+ _isExcludeProperty: function(oProperty, aIgnoreAttributes){
295
+
296
+ return aIgnoreAttributes.some(function(oKeyValuePair){
297
+ var sIgnoreKey = oKeyValuePair.ignoreKey;
298
+ var vIgnoreValue = oKeyValuePair.ignoreValue;
299
+ return oProperty[sIgnoreKey] === vIgnoreValue;
300
+ });
301
+
302
+ },
303
+
304
+ _checkSettings: function(oP13nUI, mDialogSettings, fnOnError) {
305
+ if (!mDialogSettings) {
306
+ fnOnError("Please provide a settings object for p13n creation");
307
+ }
308
+
309
+ if (!mDialogSettings.title && !mDialogSettings.customHeader) {
310
+ fnOnError("Please provide a title or customHeader in the settings object for p13n creation");
311
+ }
312
+ },
313
+
314
+ arrayToMap: function(aArray) {
315
+ return aArray.reduce(function(mMap, oProp, iIndex){
316
+ mMap[oProp.name] = oProp;
317
+ mMap[oProp.name].position = iIndex;
318
+ return mMap;
319
+ }, {});
320
+ },
321
+
322
+ /**
323
+ *
324
+ * @param {object} oDialog AdaptFiltersDialog
325
+ * @param {object} [oParent] An optional parent object to chain if necessary
326
+ *
327
+ * @returns {Promise} Promise resolving in the Dialog instance
328
+ */
329
+ addRTACustomFieldButton: function (oDialog, oParent) {
330
+
331
+ var bExtensibilityEnabled = false,
332
+ oDialogParent = oDialog.getParent();
333
+
334
+ // cover SmartTable scenario
335
+ if (oParent && oParent.isA('sap.ui.comp.smarttable.SmartTable')) {
336
+ oDialogParent = oParent;
337
+ }
338
+
339
+ return sap.ui.getCore().loadLibrary('sap.ui.rta', {
340
+ async: true
341
+ }).then(function() {
342
+ return new Promise(function(resolve) {
343
+ sap.ui.require([
344
+ "sap/ui/rta/Utils"
345
+ ], function(rtaUtils) {
346
+ var oHandleExtensibility = Promise.all([
347
+ rtaUtils.isServiceUpToDate(oDialogParent),
348
+ FieldExtensibility.isExtensibilityEnabled(oDialogParent)
349
+ ]);
350
+
351
+ return oHandleExtensibility.then(function (aResult) {
352
+ bExtensibilityEnabled = !!aResult[1];
353
+ })
354
+ .then(function() {
355
+ var oCustomHeader = oDialog.getCustomHeader(),
356
+ sId = oDialogParent && oDialogParent.getId ? oDialogParent.getId() : undefined,
357
+ oResourceBundle = sap.ui.getCore().getLibraryResourceBundle("sap.ui.mdc");
358
+
359
+ if (!oCustomHeader) {
360
+ var oBar = new Bar({
361
+ contentLeft: [
362
+ new Title({
363
+ text: oDialog.getTitle(),
364
+ level: TitleLevel.H1
365
+ })
366
+ ]
367
+ });
368
+ oDialog.setCustomHeader(oBar);
369
+ oCustomHeader = oDialog.getCustomHeader();
370
+ }
371
+
372
+ if (bExtensibilityEnabled) {
373
+ oCustomHeader.addContentRight(new Button( sId + "-addCustomField", {
374
+ icon: "sap-icon://add",
375
+ enabled: bExtensibilityEnabled,
376
+ tooltip: oResourceBundle.getText("p13nDialog.rtaAddTooltip"),
377
+ press: function (oEvt) {
378
+ var sRtaStyleClassName = rtaUtils.getRtaStyleClassName(),
379
+ oAdaptDialog = oEvt.getSource().getParent().getParent(),
380
+ oControl = oAdaptDialog.getParent();
381
+
382
+ // cover SmartTable scenario
383
+ if (oParent && oParent.isA('sap.ui.comp.smarttable.SmartTable')) {
384
+ oControl = oParent;
385
+ }
386
+
387
+ FieldExtensibility.onControlSelected(oControl).then(function (oRetVal) {
388
+ FieldExtensibility.getExtensionData().then(function (oExtensibilityInfo) {
389
+ FieldExtensibility.onTriggerCreateExtensionData(oExtensibilityInfo, sRtaStyleClassName);
390
+ oAdaptDialog.close(); // close as if there is newly created custom field, next time user tries to open it - it checks for service outdated and shows correct information
391
+ });
392
+ });
393
+
394
+ }
395
+ }));
396
+
397
+ oDialog.setCustomHeader(oCustomHeader);
398
+ resolve(oDialog);
399
+ }
400
+
401
+ });
402
+
403
+ });
404
+ });
405
+ });
406
+ }
407
+
408
+ };
403
409
 
404
410
  return P13nBuilder;
405
411
  });