@sapui5/sap.fe.core 1.99.0 → 1.100.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 (246) hide show
  1. package/package.json +4 -2
  2. package/src/sap/fe/core/.library +1 -1
  3. package/src/sap/fe/core/AnnotationHelper.js +1 -69
  4. package/src/sap/fe/core/AnnotationHelper.ts +0 -70
  5. package/src/sap/fe/core/AppComponent.js +388 -399
  6. package/src/sap/fe/core/AppComponent.ts +403 -0
  7. package/src/sap/fe/core/AppStateHandler.js +127 -158
  8. package/src/sap/fe/core/BaseController.js +82 -58
  9. package/src/sap/fe/core/BaseController.ts +68 -0
  10. package/src/sap/fe/core/CommonUtils.js +111 -20
  11. package/src/sap/fe/core/CommonUtils.ts +131 -32
  12. package/src/sap/fe/core/ExtensionAPI.js +278 -274
  13. package/src/sap/fe/core/ExtensionAPI.ts +250 -0
  14. package/src/sap/fe/core/PageController.js +157 -29
  15. package/src/sap/fe/core/PageController.ts +60 -32
  16. package/src/sap/fe/core/RouterProxy.js +694 -756
  17. package/src/sap/fe/core/RouterProxy.ts +11 -9
  18. package/src/sap/fe/core/Synchronization.js +21 -31
  19. package/src/sap/fe/core/TemplateComponent.js +1 -1
  20. package/src/sap/fe/core/TemplateComponent.ts +10 -3
  21. package/src/sap/fe/core/TemplateModel.js +20 -38
  22. package/src/sap/fe/core/TemplateModel.ts +1 -1
  23. package/src/sap/fe/core/TransactionHelper.js +1354 -1370
  24. package/src/sap/fe/core/TransactionHelper.ts +33 -22
  25. package/src/sap/fe/core/actions/collaboration/ActivitySync.js +392 -0
  26. package/src/sap/fe/core/actions/collaboration/ActivitySync.ts +355 -0
  27. package/src/sap/fe/core/actions/collaboration/CollaborationCommon.js +136 -0
  28. package/src/sap/fe/core/actions/collaboration/CollaborationCommon.ts +119 -0
  29. package/src/sap/fe/core/actions/collaboration/Manage.js +262 -0
  30. package/src/sap/fe/core/actions/collaboration/Manage.ts +244 -0
  31. package/src/sap/fe/core/actions/collaboration/ManageDialog.fragment.xml +103 -0
  32. package/src/sap/fe/core/actions/collaboration/UserDetails.fragment.xml +13 -0
  33. package/src/sap/fe/core/actions/draft.js +30 -68
  34. package/src/sap/fe/core/actions/draft.ts +44 -71
  35. package/src/sap/fe/core/actions/messageHandling.js +55 -36
  36. package/src/sap/fe/core/actions/messageHandling.ts +66 -46
  37. package/src/sap/fe/core/actions/operations.js +34 -15
  38. package/src/sap/fe/core/actions/operations.ts +48 -18
  39. package/src/sap/fe/core/actions/sticky.js +17 -4
  40. package/src/sap/fe/core/actions/sticky.ts +21 -4
  41. package/src/sap/fe/core/controllerextensions/ControllerExtensionMetadata.js +69 -66
  42. package/src/sap/fe/core/controllerextensions/ControllerExtensionMetadata.ts +65 -0
  43. package/src/sap/fe/core/controllerextensions/EditFlow.js +1593 -1669
  44. package/src/sap/fe/core/controllerextensions/EditFlow.ts +1672 -0
  45. package/src/sap/fe/core/controllerextensions/IntentBasedNavigation.js +79 -54
  46. package/src/sap/fe/core/controllerextensions/IntentBasedNavigation.ts +61 -0
  47. package/src/sap/fe/core/controllerextensions/InternalEditFlow.js +718 -779
  48. package/src/sap/fe/core/controllerextensions/InternalEditFlow.ts +783 -0
  49. package/src/sap/fe/core/controllerextensions/InternalIntentBasedNavigation.js +796 -816
  50. package/src/sap/fe/core/controllerextensions/InternalIntentBasedNavigation.ts +803 -0
  51. package/src/sap/fe/core/controllerextensions/InternalRouting.js +1004 -1005
  52. package/src/sap/fe/core/controllerextensions/InternalRouting.ts +978 -0
  53. package/src/sap/fe/core/controllerextensions/KPIManagement.js +487 -521
  54. package/src/sap/fe/core/controllerextensions/KPIManagement.ts +2 -2
  55. package/src/sap/fe/core/controllerextensions/MassEdit.js +141 -169
  56. package/src/sap/fe/core/controllerextensions/MassEdit.ts +156 -0
  57. package/src/sap/fe/core/controllerextensions/MessageHandler.js +233 -244
  58. package/src/sap/fe/core/controllerextensions/MessageHandler.ts +225 -0
  59. package/src/sap/fe/core/controllerextensions/PageReady.js +301 -336
  60. package/src/sap/fe/core/controllerextensions/PageReady.ts +12 -10
  61. package/src/sap/fe/core/controllerextensions/Paginator.js +188 -175
  62. package/src/sap/fe/core/controllerextensions/Paginator.ts +163 -0
  63. package/src/sap/fe/core/controllerextensions/Placeholder.js +157 -149
  64. package/src/sap/fe/core/controllerextensions/Placeholder.ts +151 -0
  65. package/src/sap/fe/core/controllerextensions/Routing.js +144 -125
  66. package/src/sap/fe/core/controllerextensions/Routing.ts +132 -0
  67. package/src/sap/fe/core/controllerextensions/RoutingListener.js +7 -6
  68. package/src/sap/fe/core/controllerextensions/RoutingListener.ts +3 -0
  69. package/src/sap/fe/core/controllerextensions/Share.js +230 -268
  70. package/src/sap/fe/core/controllerextensions/Share.ts +231 -0
  71. package/src/sap/fe/core/controllerextensions/SideEffects.js +592 -633
  72. package/src/sap/fe/core/controllerextensions/SideEffects.ts +8 -7
  73. package/src/sap/fe/core/controllerextensions/ViewState.js +788 -806
  74. package/src/sap/fe/core/controllerextensions/ViewState.ts +805 -0
  75. package/src/sap/fe/core/controls/ActionParameterDialog.fragment.xml +2 -2
  76. package/src/sap/fe/core/controls/ActionPartial.fragment.xml +2 -2
  77. package/src/sap/fe/core/controls/CommandExecution.js +67 -66
  78. package/src/sap/fe/core/controls/CommandExecution.ts +72 -0
  79. package/src/sap/fe/core/controls/ConditionalWrapper.js +90 -75
  80. package/src/sap/fe/core/controls/ConditionalWrapper.ts +83 -0
  81. package/src/sap/fe/core/controls/CustomQuickViewPage.js +130 -125
  82. package/src/sap/fe/core/controls/CustomQuickViewPage.ts +126 -0
  83. package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossOrDraftDiscardHandler.js +103 -112
  84. package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossOrDraftDiscardHandler.ts +101 -0
  85. package/src/sap/fe/core/controls/FieldWrapper.js +122 -135
  86. package/src/sap/fe/core/controls/FieldWrapper.ts +115 -0
  87. package/src/sap/fe/core/controls/FilterBar.js +162 -159
  88. package/src/sap/fe/core/controls/FilterBar.ts +143 -0
  89. package/src/sap/fe/core/controls/FormElementWrapper.js +45 -39
  90. package/src/sap/fe/core/controls/FormElementWrapper.ts +40 -0
  91. package/src/sap/fe/core/controls/MultiValueParameterDelegate.js +37 -42
  92. package/src/sap/fe/core/controls/MultiValueParameterDelegate.ts +31 -0
  93. package/src/sap/fe/core/controls/filterbar/FilterContainer.js +126 -116
  94. package/src/sap/fe/core/controls/filterbar/FilterContainer.ts +98 -0
  95. package/src/sap/fe/core/controls/filterbar/VisualFilter.js +241 -255
  96. package/src/sap/fe/core/controls/filterbar/VisualFilter.ts +245 -0
  97. package/src/sap/fe/core/controls/filterbar/VisualFilterContainer.js +150 -141
  98. package/src/sap/fe/core/controls/filterbar/VisualFilterContainer.ts +125 -0
  99. package/src/sap/fe/core/controls/filterbar/utils/VisualFilterUtils.js +335 -322
  100. package/src/sap/fe/core/controls/filterbar/utils/VisualFilterUtils.ts +337 -0
  101. package/src/sap/fe/core/controls/massEdit/MassEditHandlers.js +74 -74
  102. package/src/sap/fe/core/controls/massEdit/MassEditHandlers.ts +70 -0
  103. package/src/sap/fe/core/converters/ConverterContext.js +348 -379
  104. package/src/sap/fe/core/converters/ConverterContext.ts +19 -16
  105. package/src/sap/fe/core/converters/ManifestSettings.js +12 -1
  106. package/src/sap/fe/core/converters/ManifestSettings.ts +12 -1
  107. package/src/sap/fe/core/converters/ManifestWrapper.js +354 -378
  108. package/src/sap/fe/core/converters/ManifestWrapper.ts +10 -0
  109. package/src/sap/fe/core/converters/MetaModelConverter.js +6 -4
  110. package/src/sap/fe/core/converters/MetaModelConverter.ts +5 -2
  111. package/src/sap/fe/core/converters/TemplateConverter.js +1 -1
  112. package/src/sap/fe/core/converters/TemplateConverter.ts +2 -1
  113. package/src/sap/fe/core/converters/annotations/DataField.js +26 -12
  114. package/src/sap/fe/core/converters/annotations/DataField.ts +37 -13
  115. package/src/sap/fe/core/converters/controls/Common/Form.js +2 -2
  116. package/src/sap/fe/core/converters/controls/Common/Form.ts +4 -2
  117. package/src/sap/fe/core/converters/controls/Common/KPI.js +1 -1
  118. package/src/sap/fe/core/converters/controls/Common/KPI.ts +3 -2
  119. package/src/sap/fe/core/converters/controls/Common/Table.js +130 -23
  120. package/src/sap/fe/core/converters/controls/Common/Table.ts +134 -29
  121. package/src/sap/fe/core/converters/controls/Common/table/StandardActions.js +118 -53
  122. package/src/sap/fe/core/converters/controls/Common/table/StandardActions.ts +156 -93
  123. package/src/sap/fe/core/converters/controls/ListReport/FilterBar.js +161 -207
  124. package/src/sap/fe/core/converters/controls/ListReport/FilterBar.ts +148 -206
  125. package/src/sap/fe/core/converters/helpers/Aggregation.js +115 -133
  126. package/src/sap/fe/core/converters/helpers/BindingHelper.js +20 -6
  127. package/src/sap/fe/core/converters/helpers/BindingHelper.ts +16 -4
  128. package/src/sap/fe/core/converters/helpers/ConfigurableObject.js +12 -1
  129. package/src/sap/fe/core/converters/helpers/ConfigurableObject.ts +11 -0
  130. package/src/sap/fe/core/converters/helpers/Key.js +42 -57
  131. package/src/sap/fe/core/converters/helpers/Key.ts +1 -1
  132. package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.js +25 -4
  133. package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.ts +20 -3
  134. package/src/sap/fe/core/converters/templates/ListReportConverter.js +10 -4
  135. package/src/sap/fe/core/converters/templates/ListReportConverter.ts +15 -4
  136. package/src/sap/fe/core/converters/templates/ObjectPageConverter.js +7 -5
  137. package/src/sap/fe/core/converters/templates/ObjectPageConverter.ts +5 -1
  138. package/src/sap/fe/core/designtime/AppComponent.designtime.js +92 -98
  139. package/src/sap/fe/core/designtime/AppComponent.designtime.ts +91 -0
  140. package/src/sap/fe/core/formatters/CollaborationFormatter.js +104 -0
  141. package/src/sap/fe/core/formatters/CollaborationFormatter.ts +60 -0
  142. package/src/sap/fe/core/formatters/TableFormatter.js +53 -2
  143. package/src/sap/fe/core/formatters/TableFormatter.ts +51 -0
  144. package/src/sap/fe/core/fpm/Component.js +50 -54
  145. package/src/sap/fe/core/fpm/Component.ts +48 -0
  146. package/src/sap/fe/core/helpers/AppStartupHelper.js +323 -309
  147. package/src/sap/fe/core/helpers/AppStartupHelper.ts +363 -337
  148. package/src/sap/fe/core/helpers/BindingExpression.js +7 -7
  149. package/src/sap/fe/core/helpers/BindingExpression.ts +7 -7
  150. package/src/sap/fe/core/helpers/ClassSupport.js +186 -62
  151. package/src/sap/fe/core/helpers/ClassSupport.ts +168 -52
  152. package/src/sap/fe/core/helpers/DynamicAnnotationPathHelper.js +5 -4
  153. package/src/sap/fe/core/helpers/DynamicAnnotationPathHelper.ts +1 -5
  154. package/src/sap/fe/core/helpers/FPMHelper.js +1 -1
  155. package/src/sap/fe/core/helpers/FPMHelper.ts +1 -1
  156. package/src/sap/fe/core/helpers/MassEditHelper.js +601 -684
  157. package/src/sap/fe/core/helpers/MassEditHelper.ts +699 -0
  158. package/src/sap/fe/core/helpers/ModelHelper.js +25 -1
  159. package/src/sap/fe/core/helpers/ModelHelper.ts +23 -0
  160. package/src/sap/fe/core/helpers/SemanticDateOperators.js +5 -1
  161. package/src/sap/fe/core/helpers/SemanticDateOperators.ts +4 -0
  162. package/src/sap/fe/core/library.js +426 -451
  163. package/src/sap/fe/core/library.support.js +22 -33
  164. package/src/sap/fe/core/library.support.ts +23 -0
  165. package/src/sap/fe/core/library.ts +420 -0
  166. package/src/sap/fe/core/manifestMerger/ChangePageConfiguration.js +5 -3
  167. package/src/sap/fe/core/manifestMerger/ChangePageConfiguration.ts +4 -1
  168. package/src/sap/fe/core/messagebundle.properties +22 -5
  169. package/src/sap/fe/core/messagebundle_ar.properties +27 -7
  170. package/src/sap/fe/core/messagebundle_bg.properties +27 -7
  171. package/src/sap/fe/core/messagebundle_ca.properties +27 -7
  172. package/src/sap/fe/core/messagebundle_cs.properties +27 -7
  173. package/src/sap/fe/core/messagebundle_cy.properties +27 -7
  174. package/src/sap/fe/core/messagebundle_da.properties +27 -7
  175. package/src/sap/fe/core/messagebundle_de.properties +27 -7
  176. package/src/sap/fe/core/messagebundle_el.properties +27 -7
  177. package/src/sap/fe/core/messagebundle_en.properties +27 -7
  178. package/src/sap/fe/core/messagebundle_en_GB.properties +27 -7
  179. package/src/sap/fe/core/messagebundle_en_US_sappsd.properties +27 -7
  180. package/src/sap/fe/core/messagebundle_en_US_saprigi.properties +27 -7
  181. package/src/sap/fe/core/messagebundle_en_US_saptrc.properties +27 -7
  182. package/src/sap/fe/core/messagebundle_es.properties +27 -7
  183. package/src/sap/fe/core/messagebundle_es_MX.properties +27 -7
  184. package/src/sap/fe/core/messagebundle_et.properties +27 -7
  185. package/src/sap/fe/core/messagebundle_fi.properties +28 -8
  186. package/src/sap/fe/core/messagebundle_fr.properties +28 -8
  187. package/src/sap/fe/core/messagebundle_fr_CA.properties +29 -9
  188. package/src/sap/fe/core/messagebundle_hi.properties +27 -7
  189. package/src/sap/fe/core/messagebundle_hr.properties +27 -7
  190. package/src/sap/fe/core/messagebundle_hu.properties +27 -7
  191. package/src/sap/fe/core/messagebundle_id.properties +27 -7
  192. package/src/sap/fe/core/messagebundle_it.properties +27 -7
  193. package/src/sap/fe/core/messagebundle_iw.properties +27 -7
  194. package/src/sap/fe/core/messagebundle_ja.properties +26 -6
  195. package/src/sap/fe/core/messagebundle_kk.properties +27 -7
  196. package/src/sap/fe/core/messagebundle_ko.properties +27 -7
  197. package/src/sap/fe/core/messagebundle_lt.properties +27 -7
  198. package/src/sap/fe/core/messagebundle_lv.properties +28 -8
  199. package/src/sap/fe/core/messagebundle_ms.properties +27 -7
  200. package/src/sap/fe/core/messagebundle_nl.properties +27 -7
  201. package/src/sap/fe/core/messagebundle_no.properties +27 -7
  202. package/src/sap/fe/core/messagebundle_pl.properties +27 -7
  203. package/src/sap/fe/core/messagebundle_pt.properties +28 -8
  204. package/src/sap/fe/core/messagebundle_pt_PT.properties +27 -7
  205. package/src/sap/fe/core/messagebundle_ro.properties +27 -7
  206. package/src/sap/fe/core/messagebundle_ru.properties +27 -7
  207. package/src/sap/fe/core/messagebundle_sh.properties +27 -7
  208. package/src/sap/fe/core/messagebundle_sk.properties +27 -7
  209. package/src/sap/fe/core/messagebundle_sl.properties +27 -7
  210. package/src/sap/fe/core/messagebundle_sv.properties +27 -7
  211. package/src/sap/fe/core/messagebundle_th.properties +26 -6
  212. package/src/sap/fe/core/messagebundle_tr.properties +30 -10
  213. package/src/sap/fe/core/messagebundle_uk.properties +27 -7
  214. package/src/sap/fe/core/messagebundle_vi.properties +27 -7
  215. package/src/sap/fe/core/messagebundle_zh_CN.properties +27 -7
  216. package/src/sap/fe/core/messagebundle_zh_TW.properties +27 -7
  217. package/src/sap/fe/core/services/AsyncComponentServiceFactory.js +45 -71
  218. package/src/sap/fe/core/services/CacheHandlerServiceFactory.js +154 -192
  219. package/src/sap/fe/core/services/CacheHandlerServiceFactory.ts +4 -4
  220. package/src/sap/fe/core/services/EnvironmentServiceFactory.js +66 -92
  221. package/src/sap/fe/core/services/EnvironmentServiceFactory.ts +1 -1
  222. package/src/sap/fe/core/services/NavigationServiceFactory.js +284 -339
  223. package/src/sap/fe/core/services/NavigationServiceFactory.ts +10 -13
  224. package/src/sap/fe/core/services/ResourceModelServiceFactory.js +67 -102
  225. package/src/sap/fe/core/services/ResourceModelServiceFactory.ts +5 -2
  226. package/src/sap/fe/core/services/RoutingServiceFactory.js +754 -814
  227. package/src/sap/fe/core/services/RoutingServiceFactory.ts +13 -13
  228. package/src/sap/fe/core/services/ShellServicesFactory.js +649 -736
  229. package/src/sap/fe/core/services/ShellServicesFactory.ts +7 -4
  230. package/src/sap/fe/core/services/SideEffectsServiceFactory.js +567 -592
  231. package/src/sap/fe/core/services/SideEffectsServiceFactory.ts +22 -3
  232. package/src/sap/fe/core/services/TemplatedViewServiceFactory.js +354 -386
  233. package/src/sap/fe/core/services/TemplatedViewServiceFactory.ts +21 -14
  234. package/src/sap/fe/core/services/view/TemplatingErrorPage.controller.js +1 -1
  235. package/src/sap/fe/core/services/view/TemplatingErrorPage.controller.ts +1 -1
  236. package/src/sap/fe/core/support/CommonHelper.js +1 -1
  237. package/src/sap/fe/core/support/CommonHelper.ts +1 -1
  238. package/src/sap/fe/core/support/Diagnostics.js +36 -48
  239. package/src/sap/fe/core/templating/DataModelPathHelper.js +93 -85
  240. package/src/sap/fe/core/templating/DataModelPathHelper.ts +104 -95
  241. package/src/sap/fe/core/templating/FilterHelper.js +25 -32
  242. package/src/sap/fe/core/templating/FilterHelper.ts +36 -35
  243. package/src/sap/fe/core/templating/PropertyHelper.js +2 -2
  244. package/src/sap/fe/core/templating/PropertyHelper.ts +1 -1
  245. package/src/sap/fe/core/templating/UIFormatters.js +32 -26
  246. package/src/sap/fe/core/templating/UIFormatters.ts +37 -24
@@ -0,0 +1,337 @@
1
+ import { InternalModelContext } from "sap/fe/core/helpers/ModelHelper";
2
+ import Condition from "sap/ui/mdc/condition/Condition";
3
+ import Log from "sap/base/Log";
4
+ import View from "sap/ui/core/mvc/View";
5
+ import Title from "sap/m/Title";
6
+ import NumberFormat from "sap/ui/core/format/NumberFormat";
7
+ import Context from "sap/ui/model/Context";
8
+ import ResourceBundle from "sap/base/i18n/ResourceBundle";
9
+ import ConditionValidated from "sap/ui/mdc/enum/ConditionValidated";
10
+ import { getOperator, getTypeCompliantValue } from "sap/fe/core/templating/FilterHelper";
11
+ import DateTimeOffset from "sap/ui/model/odata/type/DateTimeOffset";
12
+
13
+ const VisualFilterUtils = {
14
+ /**
15
+ * Applies the median scale to the chart data.
16
+ *
17
+ * @param {object} oInteractiveChart InteractiveChart in the VisualFilter control
18
+ * @param {object} oView Instance of the view
19
+ * @param {object} sVFId VisualFilter control ID
20
+ * @param {string} sInfoPath Internal model context path to store info.
21
+ */
22
+ applyMedianScaleToChartData: function(oInteractiveChart: any, oView: View, sVFId: object, sInfoPath: string) {
23
+ const oData = [];
24
+ const sMeasure = oInteractiveChart.data("measure");
25
+ const oInternalModelContext = oView.getBindingContext("internal") as InternalModelContext;
26
+ const aAggregation =
27
+ (oInteractiveChart.getPoints && oInteractiveChart.getPoints()) ||
28
+ (oInteractiveChart.getBars && oInteractiveChart.getBars()) ||
29
+ (oInteractiveChart.getSegments && oInteractiveChart.getSegments());
30
+ for (let i = 0; i < aAggregation.length; i++) {
31
+ oData.push(aAggregation[i].getBindingContext().getObject());
32
+ }
33
+ const scaleFactor = this._getMedianScaleFactor(oData, sMeasure);
34
+ if (scaleFactor && scaleFactor.iShortRefNumber && scaleFactor.scale) {
35
+ oInternalModelContext.setProperty("scalefactor/" + sInfoPath, scaleFactor.scale);
36
+ oInternalModelContext.setProperty("scalefactorNumber/" + sInfoPath, scaleFactor.iShortRefNumber);
37
+ } else {
38
+ oInternalModelContext.setProperty("scalefactor/" + sInfoPath, "");
39
+ oInternalModelContext.setProperty("scalefactorNumber/" + sInfoPath, "");
40
+ const oScaleTitle = oView.byId(sVFId + "::ScaleUoMTitle") as Title;
41
+ const oMeasureDimensionTitle = oView.byId(sVFId + "::MeasureDimensionTitle") as Title;
42
+ const sText = oScaleTitle.getText();
43
+ if (sText === " | ") {
44
+ oScaleTitle.setVisible(false);
45
+ oMeasureDimensionTitle.setTooltip(oMeasureDimensionTitle.getText());
46
+ }
47
+ }
48
+ },
49
+
50
+ /**
51
+ * Returns the median scale factor.
52
+ *
53
+ * @param {object} oData VisualFilter data
54
+ * @param {string} sMeasureField Path of the measure
55
+ * @returns {object} Object containing scale and iShortRefNumber
56
+ */
57
+ _getMedianScaleFactor: function(oData: any[], sMeasureField: string) {
58
+ let i;
59
+ let scaleFactor;
60
+ oData.sort(function(a: any, b: any) {
61
+ if (Number(a[sMeasureField]) < Number(b[sMeasureField])) {
62
+ return -1;
63
+ }
64
+ if (Number(a[sMeasureField]) > Number(b[sMeasureField])) {
65
+ return 1;
66
+ }
67
+ return 0;
68
+ });
69
+ if (oData.length > 0) {
70
+ // get median index
71
+ const iMid = oData.length / 2, // get mid of array
72
+ // if iMid is whole number, array length is even, calculate median
73
+ // if iMid is not whole number, array length is odd, take median as iMid - 1
74
+ iMedian =
75
+ iMid % 1 === 0
76
+ ? (parseFloat(oData[iMid - 1][sMeasureField]) + parseFloat(oData[iMid][sMeasureField])) / 2
77
+ : parseFloat(oData[Math.floor(iMid)][sMeasureField]),
78
+ // get scale factor on median
79
+ val = iMedian;
80
+ for (i = 0; i < 14; i++) {
81
+ scaleFactor = Math.pow(10, i);
82
+ if (Math.round(Math.abs(val) / scaleFactor) < 10) {
83
+ break;
84
+ }
85
+ }
86
+ }
87
+
88
+ const fixedInteger = NumberFormat.getIntegerInstance({
89
+ style: "short",
90
+ showScale: false,
91
+ shortRefNumber: scaleFactor
92
+ });
93
+
94
+ // apply scale factor to other values and check
95
+ for (i = 0; i < oData.length; i++) {
96
+ const aData = oData[i],
97
+ sScaledValue = fixedInteger.format(aData[sMeasureField]) as any,
98
+ aScaledValueParts = sScaledValue.split(".");
99
+ // if scaled value has only 0 before decimal or 0 after decimal (example: 0.02)
100
+ // then ignore this scale factor else proceed with this scale factor
101
+ // if scaled value divided by 1000 is >= 1000 then also ignore scale factor
102
+ if (
103
+ (!aScaledValueParts[1] && parseInt(aScaledValueParts[0], 10) === 0) ||
104
+ (aScaledValueParts[1] && parseInt(aScaledValueParts[0], 10) === 0 && aScaledValueParts[1].indexOf("0") === 0) ||
105
+ sScaledValue / 1000 >= 1000
106
+ ) {
107
+ scaleFactor = undefined;
108
+ break;
109
+ }
110
+ }
111
+ return {
112
+ iShortRefNumber: scaleFactor,
113
+ scale: scaleFactor ? (fixedInteger as any).getScale() : ""
114
+ };
115
+ },
116
+
117
+ /**
118
+ * Returns the formatted number according to the rules of VisualChartFilters.
119
+ *
120
+ * @param {string | number} value Value which needs to be formatted
121
+ * @param {number} scaleFactor ScaleFactor to which the value needs to be scaled
122
+ * @param {number} numberOfFractionalDigits NumberOfFractionalDigits digits in the decimals according to scale
123
+ * @param {string} currency Currency code
124
+ * @returns {number} The formatted number
125
+ */
126
+ getFormattedNumber: function(
127
+ value: string | number,
128
+ scaleFactor: number | undefined,
129
+ numberOfFractionalDigits: number | undefined,
130
+ currency: string | undefined
131
+ ) {
132
+ let fixedInteger;
133
+ value = typeof value === "string" ? Number(value.replace(/,/g, "")) : value;
134
+
135
+ if (currency) {
136
+ const currencyFormat = NumberFormat.getCurrencyInstance({
137
+ showMeasure: false
138
+ });
139
+ return currencyFormat.format(parseFloat(value as any), currency);
140
+ // parseFloat(value) is required otherwise -ve value are wrongly rounded off
141
+ // Example: "-1.9" rounds off to -1 instead of -2. however -1.9 rounds off to -2
142
+ } else if (scaleFactor) {
143
+ fixedInteger = NumberFormat.getFloatInstance({
144
+ style: "short",
145
+ showScale: false,
146
+ shortRefNumber: scaleFactor,
147
+ shortDecimals: numberOfFractionalDigits
148
+ });
149
+ return fixedInteger.format(parseFloat(value as any));
150
+ } else {
151
+ fixedInteger = NumberFormat.getFloatInstance({
152
+ decimals: numberOfFractionalDigits
153
+ });
154
+ return fixedInteger.format(parseFloat(value as any));
155
+ }
156
+ },
157
+
158
+ /**
159
+ * Applies the UOM to the title of the visual filter control.
160
+ *
161
+ * @param {object} oInteractiveChart InteractiveChart in the VisualFilter control
162
+ * @param {object} oContextData Data of the VisualFilter
163
+ * @param {object} oView Instance of the view
164
+ * @param {string} sInfoPath Internal model context path to store info.
165
+ */
166
+ applyUOMToTitle: function(oInteractiveChart: any, oContextData: any, oView: View, sInfoPath: string) {
167
+ const vUOM = oInteractiveChart.data("uom");
168
+ let sUOM;
169
+ let sCurrency;
170
+ if (vUOM && vUOM["ISOCurrency"]) {
171
+ sUOM = vUOM["ISOCurrency"];
172
+ sCurrency = sUOM.$Path ? oContextData[sUOM.$Path] : sUOM;
173
+ } else if (vUOM && vUOM["Unit"]) {
174
+ sUOM = vUOM["Unit"];
175
+ }
176
+ if (sUOM) {
177
+ const sUOMValue = sUOM.$Path ? oContextData[sUOM.$Path] : sUOM;
178
+ const oInternalModelContext = oView.getBindingContext("internal") as InternalModelContext;
179
+ oInternalModelContext.setProperty("uom/" + sInfoPath, sUOMValue);
180
+ if (sCurrency) {
181
+ oInternalModelContext.setProperty("currency/" + sInfoPath, sUOMValue);
182
+ }
183
+ }
184
+ },
185
+ /**
186
+ * Updates the scale factor in the title of the visual filter.
187
+ *
188
+ * @param {object} oInteractiveChart InteractiveChart in the VisualFilter control
189
+ * @param {object} oView Instance of the view
190
+ * @param {object} sVFId VisualFilter control ID
191
+ * @param {string} sInfoPath Internal model context path to store info.
192
+ */
193
+ updateChartScaleFactorTitle: function(oInteractiveChart: any, oView: View, sVFId: object, sInfoPath: string) {
194
+ if (!oInteractiveChart.data("scalefactor")) {
195
+ this.applyMedianScaleToChartData(oInteractiveChart, oView, sVFId, sInfoPath);
196
+ } else {
197
+ const fixedInteger = NumberFormat.getIntegerInstance({
198
+ style: "short",
199
+ showScale: false,
200
+ shortRefNumber: oInteractiveChart.data("scalefactor")
201
+ });
202
+ const oInternalModelContext = oView.getBindingContext("internal") as InternalModelContext;
203
+ oInternalModelContext.setProperty("scalefactor/" + sInfoPath, (fixedInteger as any).getScale());
204
+ }
205
+ },
206
+
207
+ /**
208
+ *
209
+ * @param {string} s18nMessageTitle Text of the error message title.
210
+ * @param {string} s18nMessage Text of the error message description.
211
+ * @param {string} sInfoPath Internal model context path to store info.
212
+ * @param {object} oView Instance of the view.
213
+ */
214
+ applyErrorMessageAndTitle: function(s18nMessageTitle: string, s18nMessage: string, sInfoPath: string, oView: View) {
215
+ const oInternalModelContext = oView.getBindingContext("internal") as InternalModelContext;
216
+ oInternalModelContext.setProperty(sInfoPath, {});
217
+ oInternalModelContext.setProperty(sInfoPath, {
218
+ "errorMessageTitle": s18nMessageTitle,
219
+ "errorMessage": s18nMessage,
220
+ "showError": true
221
+ });
222
+ },
223
+ /**
224
+ * Checks if multiple units are present.
225
+ *
226
+ * @param {object} oContexts Contexts of the VisualFilter
227
+ * @param {string} sUnitfield The path of the unit field
228
+ * @returns {boolean} Returns if multiple units are configured or not
229
+ */
230
+ checkMulitUnit: function(oContexts: Context[], sUnitfield: string) {
231
+ const aData = [];
232
+ if (oContexts && sUnitfield) {
233
+ for (let i = 0; i < oContexts.length; i++) {
234
+ const aContextData = oContexts[i] && (oContexts[i].getObject() as any);
235
+ aData.push(aContextData[sUnitfield]);
236
+ }
237
+ }
238
+ return !!aData.reduce(function(data: any, key: any) {
239
+ return data === key ? data : NaN;
240
+ });
241
+ },
242
+
243
+ /**
244
+ * Sets an error message if multiple UOM are present.
245
+ *
246
+ * @param {object} oData Data of the VisualFilter control
247
+ * @param {object} oInteractiveChart InteractiveChart in the VisualFilter control
248
+ * @param {string} sInfoPath Internal model context path to store info.
249
+ * @param {string} oResourceBundle The resource bundle
250
+ * @param {string} oView Instance of the view
251
+ */
252
+ setMultiUOMMessage: function(
253
+ oData: Context[],
254
+ oInteractiveChart: any,
255
+ sInfoPath: string,
256
+ oResourceBundle: ResourceBundle,
257
+ oView: View
258
+ ) {
259
+ const vUOM = oInteractiveChart.data("uom");
260
+ const sIsCurrency = vUOM && vUOM["ISOCurrency"] && vUOM["ISOCurrency"].$Path;
261
+ const sIsUnit = vUOM && vUOM["Unit"] && vUOM["Unit"].$Path;
262
+ const sUnitfield = sIsCurrency || sIsUnit;
263
+ let s18nMessageTitle, s18nMessage;
264
+ if (sUnitfield) {
265
+ if (!this.checkMulitUnit(oData, sUnitfield)) {
266
+ if (sIsCurrency) {
267
+ s18nMessageTitle = oResourceBundle.getText("M_VISUAL_FILTERS_ERROR_MESSAGE_TITLE");
268
+ s18nMessage = oResourceBundle.getText("M_VISUAL_FILTERS_MULTIPLE_CURRENCY", sUnitfield);
269
+ this.applyErrorMessageAndTitle(s18nMessageTitle, s18nMessage, sInfoPath, oView);
270
+ Log.warning("Filter is set for multiple Currency for" + sUnitfield);
271
+ } else if (sIsUnit) {
272
+ s18nMessageTitle = oResourceBundle.getText("M_VISUAL_FILTERS_ERROR_MESSAGE_TITLE");
273
+ s18nMessage = oResourceBundle.getText("M_VISUAL_FILTERS_MULTIPLE_UNIT", sUnitfield);
274
+ this.applyErrorMessageAndTitle(s18nMessageTitle, s18nMessage, sInfoPath, oView);
275
+ Log.warning("Filter is set for multiple UOMs for" + sUnitfield);
276
+ }
277
+ }
278
+ }
279
+ },
280
+
281
+ /**
282
+ * Sets an error message if response data is empty.
283
+ *
284
+ * @param {string} sInfoPath Internal model context path to store info.
285
+ * @param {string} oResourceBundle The resource bundle
286
+ * @param {string} oView Instance of the view
287
+ */
288
+ setNoDataMessage: function(sInfoPath: string, oResourceBundle: ResourceBundle, oView: View) {
289
+ const s18nMessageTitle = oResourceBundle.getText("M_VISUAL_FILTERS_ERROR_MESSAGE_TITLE");
290
+ const s18nMessage = oResourceBundle.getText("M_VISUAL_FILTER_NO_DATA_TEXT");
291
+ this.applyErrorMessageAndTitle(s18nMessageTitle, s18nMessage, sInfoPath, oView);
292
+ },
293
+ convertFilterCondions: function(oFilterConditions: any) {
294
+ const oConvertedConditions: any = {};
295
+ Object.keys(oFilterConditions).forEach(function(sKey: string) {
296
+ const aConvertedConditions = [];
297
+ const aConditions = oFilterConditions[sKey];
298
+ for (let i = 0; i < aConditions.length; i++) {
299
+ const values = aConditions[i].value2 ? [aConditions[i].value1, aConditions[i].value2] : [aConditions[i].value1];
300
+ aConvertedConditions.push(
301
+ Condition.createCondition(aConditions[i].operator, values, null, null, "Validated" as ConditionValidated)
302
+ );
303
+ }
304
+ if (aConvertedConditions.length) {
305
+ oConvertedConditions[sKey] = aConvertedConditions;
306
+ }
307
+ });
308
+ return oConvertedConditions;
309
+ },
310
+ getCustomConditions: function(Range: any, oValidProperty: any, sPropertyName: any) {
311
+ let value1, value2;
312
+ if (oValidProperty.$Type === "Edm.DateTimeOffset") {
313
+ value1 = this._parseDateTime(getTypeCompliantValue(this._formatDateTime(Range.Low), oValidProperty.$Type));
314
+ value2 = Range.High ? this._parseDateTime(getTypeCompliantValue(this._formatDateTime(Range.High), oValidProperty.$Type)) : null;
315
+ } else {
316
+ value1 = Range.Low;
317
+ value2 = Range.High ? Range.High : null;
318
+ }
319
+ return {
320
+ operator: Range.Option ? getOperator(Range.Option.$EnumMember || Range.Option) : null,
321
+ value1: value1,
322
+ value2: value2,
323
+ path: sPropertyName
324
+ };
325
+ },
326
+ _parseDateTime: function(sValue: any) {
327
+ return this._getDateTimeTypeInstance().parseValue(sValue, "string");
328
+ },
329
+ _formatDateTime: function(sValue: any) {
330
+ return this._getDateTimeTypeInstance().formatValue(sValue, "string");
331
+ },
332
+ _getDateTimeTypeInstance: function() {
333
+ return new DateTimeOffset({ pattern: "yyyy-MM-ddTHH:mm:ssZ", calendarType: "Gregorian" }, { V4: true });
334
+ }
335
+ };
336
+
337
+ export default VisualFilterUtils;
@@ -1,79 +1,79 @@
1
1
  /*!
2
2
  * SAP UI development toolkit for HTML5 (SAPUI5)
3
- (c) Copyright 2009-2021 SAP SE. All rights reserved
4
-
3
+ * (c) Copyright 2009-2021 SAP SE. All rights reserved
5
4
  */
6
- sap.ui.define(
7
- [],
8
- function() {
9
- "use strict";
5
+ sap.ui.define([], function () {
6
+ "use strict";
10
7
 
11
- /**
12
- * Static class used by MDC Field during runtime
13
- *
14
- * @private
15
- * @experimental This module is only for internal/experimental use!
16
- */
17
- var MassEditHandlers = {
18
- handleMassEditChange: function(oEvent) {
19
- var oSource = oEvent && oEvent.getSource();
20
- var aParams = oSource && oSource.getSelectedKey() && oSource.getSelectedKey().split("/");
21
- var oDialog =
22
- oSource &&
23
- oSource
24
- .getParent()
25
- .getParent()
26
- .getParent()
27
- .getParent();
28
- var oFieldsInfoData = oDialog && oDialog.getModel("fieldsInfo").getData();
29
- var oDataObject;
30
- //TODO - Value Help Handling Load Value Help when respective value is selected in combo Box in dialog
31
- /*
32
- if (aParams[0] === "ValueHelp") {
33
- } */
34
- if (aParams[0] === "Default") {
35
- oDataObject = { keyValue: aParams[1], value: aParams[0] };
36
- } else if (aParams[0] === "ClearFieldValue") {
37
- oDataObject = { keyValue: aParams[1], value: "" };
38
- } else if (!aParams) {
39
- var sPropertyName = oSource.getId().substring(oSource.getId().lastIndexOf(":") + 1);
40
- oDataObject = {
41
- keyValue: sPropertyName,
42
- value: oSource.getValue()
43
- };
44
- } else {
45
- var aRelatedField =
46
- aParams[0] &&
47
- oFieldsInfoData.values &&
48
- oFieldsInfoData.values[aParams[0]].filter(function(oFieldData) {
49
- return oFieldData.text === oSource.getValue();
50
- });
51
- var iValueIndex = oFieldsInfoData.values[aParams[0]].findIndex(function(data) {
52
- return typeof data.text === "boolean" && data.text === Boolean(oSource.getValue());
53
- });
54
- oDataObject =
55
- aRelatedField && aRelatedField[0] && aRelatedField[0].textInfo
56
- ? { keyValue: aParams[0], value: aRelatedField[0].textInfo.value }
57
- : {
58
- keyValue: aParams[0],
59
- value: iValueIndex !== -1 ? oFieldsInfoData.values[aParams[0]][iValueIndex].text : oSource.getValue()
60
- };
61
- }
62
- var bExistingElementindex = false;
63
- for (var i = 0; i < oFieldsInfoData.results.length; i++) {
64
- if (oFieldsInfoData.results[i].keyValue === oDataObject.keyValue) {
65
- bExistingElementindex = i;
66
- }
67
- }
68
- if (bExistingElementindex !== false) {
69
- oFieldsInfoData.results[bExistingElementindex] = oDataObject;
70
- } else {
71
- oFieldsInfoData.results.push(oDataObject);
72
- }
73
- }
74
- };
8
+ /**
9
+ * Constructor for a new Visual Filter Container.
10
+ * Used for visual filters
11
+ *
12
+ * @param {string} [sId] ID for the new control, generated automatically if no ID is given
13
+ * @extends sap.ui.mdc.filterbar.IFilterContainer
14
+ * @class
15
+ * @private
16
+ * @alias sap.fe.core.controls.filterbar.VisualFilterContainer
17
+ */
18
+ var MassEditHandlers = {
19
+ handleMassEditChange: function (oEvent) {
20
+ var oSource = oEvent && oEvent.getSource();
21
+ var aParams = oSource && oSource.getSelectedKey() && oSource.getSelectedKey().split("/");
22
+ var oDialog = oSource && oSource.getParent().getParent().getParent().getParent();
23
+ var oFieldsInfoData = oDialog && oDialog.getModel("fieldsInfo").getData();
24
+ var oDataObject; //TODO - Value Help Handling Load Value Help when respective value is selected in combo Box in dialog
75
25
 
76
- return MassEditHandlers;
77
- },
78
- /* bExport= */ true
79
- );
26
+ /*
27
+ if (aParams[0] === "ValueHelp") {
28
+ } */
29
+
30
+ if (aParams[0] === "Default") {
31
+ oDataObject = {
32
+ keyValue: aParams[1],
33
+ value: aParams[0]
34
+ };
35
+ } else if (aParams[0] === "ClearFieldValue") {
36
+ oDataObject = {
37
+ keyValue: aParams[1],
38
+ value: ""
39
+ };
40
+ } else if (!aParams) {
41
+ var sPropertyName = oSource.getId().substring(oSource.getId().lastIndexOf(":") + 1);
42
+ oDataObject = {
43
+ keyValue: sPropertyName,
44
+ value: oSource.getValue()
45
+ };
46
+ } else {
47
+ var aRelatedField = aParams[0] && oFieldsInfoData.values && oFieldsInfoData.values[aParams[0]].filter(function (oFieldData) {
48
+ return oFieldData.text === oSource.getValue();
49
+ });
50
+ var iValueIndex = oFieldsInfoData.values[aParams[0]].findIndex(function (data) {
51
+ return typeof data.text === "boolean" && data.text === Boolean(oSource.getValue());
52
+ });
53
+ oDataObject = aRelatedField && aRelatedField[0] && aRelatedField[0].textInfo ? {
54
+ keyValue: aParams[0],
55
+ value: aRelatedField[0].textInfo.value
56
+ } : {
57
+ keyValue: aParams[0],
58
+ value: iValueIndex !== -1 ? oFieldsInfoData.values[aParams[0]][iValueIndex].text : oSource.getValue()
59
+ };
60
+ }
61
+
62
+ var bExistingElementindex = -1;
63
+
64
+ for (var i = 0; i < oFieldsInfoData.results.length; i++) {
65
+ if (oFieldsInfoData.results[i].keyValue === oDataObject.keyValue) {
66
+ bExistingElementindex = i;
67
+ }
68
+ }
69
+
70
+ if (bExistingElementindex !== -1) {
71
+ oFieldsInfoData.results[bExistingElementindex] = oDataObject;
72
+ } else {
73
+ oFieldsInfoData.results.push(oDataObject);
74
+ }
75
+ }
76
+ };
77
+ return MassEditHandlers;
78
+ }, false);
79
+ //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzI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GVtZW50aW5kZXhdID0gb0RhdGFPYmplY3Q7XG5cdFx0fSBlbHNlIHtcblx0XHRcdG9GaWVsZHNJbmZvRGF0YS5yZXN1bHRzLnB1c2gob0RhdGFPYmplY3QpO1xuXHRcdH1cblx0fVxufTtcblxuZXhwb3J0IGRlZmF1bHQgTWFzc0VkaXRIYW5kbGVycztcbiJdfQ==
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Constructor for a new Visual Filter Container.
3
+ * Used for visual filters
4
+ *
5
+ * @param {string} [sId] ID for the new control, generated automatically if no ID is given
6
+ * @extends sap.ui.mdc.filterbar.IFilterContainer
7
+ * @class
8
+ * @private
9
+ * @alias sap.fe.core.controls.filterbar.VisualFilterContainer
10
+ */
11
+ const MassEditHandlers = {
12
+ handleMassEditChange: function(oEvent: any) {
13
+ const oSource = oEvent && oEvent.getSource();
14
+ const aParams = oSource && oSource.getSelectedKey() && oSource.getSelectedKey().split("/");
15
+ const oDialog =
16
+ oSource &&
17
+ oSource
18
+ .getParent()
19
+ .getParent()
20
+ .getParent()
21
+ .getParent();
22
+ const oFieldsInfoData = oDialog && oDialog.getModel("fieldsInfo").getData();
23
+ let oDataObject;
24
+ //TODO - Value Help Handling Load Value Help when respective value is selected in combo Box in dialog
25
+ /*
26
+ if (aParams[0] === "ValueHelp") {
27
+ } */
28
+ if (aParams[0] === "Default") {
29
+ oDataObject = { keyValue: aParams[1], value: aParams[0] };
30
+ } else if (aParams[0] === "ClearFieldValue") {
31
+ oDataObject = { keyValue: aParams[1], value: "" };
32
+ } else if (!aParams) {
33
+ const sPropertyName = oSource.getId().substring(oSource.getId().lastIndexOf(":") + 1);
34
+ oDataObject = {
35
+ keyValue: sPropertyName,
36
+ value: oSource.getValue()
37
+ };
38
+ } else {
39
+ const aRelatedField =
40
+ aParams[0] &&
41
+ oFieldsInfoData.values &&
42
+ oFieldsInfoData.values[aParams[0]].filter(function(oFieldData: any) {
43
+ return oFieldData.text === oSource.getValue();
44
+ });
45
+ const iValueIndex = oFieldsInfoData.values[aParams[0]].findIndex(function(data: any) {
46
+ return typeof data.text === "boolean" && data.text === Boolean(oSource.getValue());
47
+ });
48
+ oDataObject =
49
+ aRelatedField && aRelatedField[0] && aRelatedField[0].textInfo
50
+ ? { keyValue: aParams[0], value: aRelatedField[0].textInfo.value }
51
+ : {
52
+ keyValue: aParams[0],
53
+ value: iValueIndex !== -1 ? oFieldsInfoData.values[aParams[0]][iValueIndex].text : oSource.getValue()
54
+ };
55
+ }
56
+ let bExistingElementindex = -1;
57
+ for (let i = 0; i < oFieldsInfoData.results.length; i++) {
58
+ if (oFieldsInfoData.results[i].keyValue === oDataObject.keyValue) {
59
+ bExistingElementindex = i;
60
+ }
61
+ }
62
+ if (bExistingElementindex !== -1) {
63
+ oFieldsInfoData.results[bExistingElementindex] = oDataObject;
64
+ } else {
65
+ oFieldsInfoData.results.push(oDataObject);
66
+ }
67
+ }
68
+ };
69
+
70
+ export default MassEditHandlers;