@openui5/sap.ui.rta 1.133.1 → 1.135.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 (165) hide show
  1. package/.reuse/dep5 +0 -7
  2. package/THIRDPARTY.txt +2 -23
  3. package/package.json +6 -6
  4. package/src/sap/ui/rta/.library +1 -1
  5. package/src/sap/ui/rta/Client.js +1 -1
  6. package/src/sap/ui/rta/RuntimeAuthoring.js +38 -17
  7. package/src/sap/ui/rta/Utils.js +11 -1
  8. package/src/sap/ui/rta/appVariant/AppVariantManager.js +26 -26
  9. package/src/sap/ui/rta/appVariant/AppVariantUtils.js +0 -4
  10. package/src/sap/ui/rta/appVariant/Feature.js +85 -91
  11. package/src/sap/ui/rta/appVariant/Utils.js +50 -56
  12. package/src/sap/ui/rta/appVariant/manageApps/webapp/controller/ManageApps.controller.js +30 -30
  13. package/src/sap/ui/rta/appVariant/manageApps/webapp/i18n/i18n_fr_CA.properties +2 -2
  14. package/src/sap/ui/rta/command/AddIFrame.js +1 -1
  15. package/src/sap/ui/rta/command/AddProperty.js +1 -1
  16. package/src/sap/ui/rta/command/AddXML.js +1 -1
  17. package/src/sap/ui/rta/command/AddXMLAtExtensionPoint.js +1 -1
  18. package/src/sap/ui/rta/command/AnnotationCommand.js +65 -5
  19. package/src/sap/ui/rta/command/BaseCommand.js +1 -1
  20. package/src/sap/ui/rta/command/BindProperty.js +1 -1
  21. package/src/sap/ui/rta/command/Combine.js +1 -1
  22. package/src/sap/ui/rta/command/CommandFactory.js +71 -47
  23. package/src/sap/ui/rta/command/CompositeCommand.js +12 -12
  24. package/src/sap/ui/rta/command/ControlVariantConfigure.js +1 -1
  25. package/src/sap/ui/rta/command/ControlVariantSave.js +1 -1
  26. package/src/sap/ui/rta/command/ControlVariantSaveAs.js +1 -1
  27. package/src/sap/ui/rta/command/ControlVariantSetTitle.js +1 -1
  28. package/src/sap/ui/rta/command/ControlVariantSwitch.js +1 -1
  29. package/src/sap/ui/rta/command/CreateContainer.js +1 -1
  30. package/src/sap/ui/rta/command/CustomAdd.js +1 -1
  31. package/src/sap/ui/rta/command/ExtendControllerCommand.js +92 -0
  32. package/src/sap/ui/rta/command/FlexCommand.js +54 -43
  33. package/src/sap/ui/rta/command/LREPSerializer.js +23 -23
  34. package/src/sap/ui/rta/command/LocalReset.js +1 -1
  35. package/src/sap/ui/rta/command/ManifestCommand.js +112 -0
  36. package/src/sap/ui/rta/command/Move.js +1 -1
  37. package/src/sap/ui/rta/command/Property.js +1 -1
  38. package/src/sap/ui/rta/command/Remove.js +1 -1
  39. package/src/sap/ui/rta/command/Rename.js +1 -1
  40. package/src/sap/ui/rta/command/Resize.js +1 -1
  41. package/src/sap/ui/rta/command/Reveal.js +1 -1
  42. package/src/sap/ui/rta/command/Settings.js +1 -1
  43. package/src/sap/ui/rta/command/Split.js +1 -1
  44. package/src/sap/ui/rta/command/Stack.js +1 -1
  45. package/src/sap/ui/rta/command/compVariant/CompVariantContent.js +1 -1
  46. package/src/sap/ui/rta/command/compVariant/CompVariantSaveAs.js +1 -1
  47. package/src/sap/ui/rta/command/compVariant/CompVariantSwitch.js +1 -1
  48. package/src/sap/ui/rta/command/compVariant/CompVariantUpdate.js +1 -1
  49. package/src/sap/ui/rta/command/{appDescriptor → manifest}/AddLibrary.js +10 -10
  50. package/src/sap/ui/rta/enablement/elementActionTest.js +1 -7
  51. package/src/sap/ui/rta/library.js +2 -2
  52. package/src/sap/ui/rta/messagebundle.properties +22 -7
  53. package/src/sap/ui/rta/messagebundle_ar.properties +3 -1
  54. package/src/sap/ui/rta/messagebundle_bg.properties +4 -2
  55. package/src/sap/ui/rta/messagebundle_ca.properties +3 -1
  56. package/src/sap/ui/rta/messagebundle_cnr.properties +4 -2
  57. package/src/sap/ui/rta/messagebundle_cs.properties +3 -1
  58. package/src/sap/ui/rta/messagebundle_cy.properties +3 -1
  59. package/src/sap/ui/rta/messagebundle_da.properties +4 -2
  60. package/src/sap/ui/rta/messagebundle_de.properties +3 -1
  61. package/src/sap/ui/rta/messagebundle_el.properties +3 -1
  62. package/src/sap/ui/rta/messagebundle_en.properties +3 -1
  63. package/src/sap/ui/rta/messagebundle_en_GB.properties +3 -1
  64. package/src/sap/ui/rta/messagebundle_en_US_saprigi.properties +10 -2
  65. package/src/sap/ui/rta/messagebundle_es.properties +3 -1
  66. package/src/sap/ui/rta/messagebundle_es_MX.properties +4 -2
  67. package/src/sap/ui/rta/messagebundle_et.properties +3 -1
  68. package/src/sap/ui/rta/messagebundle_fi.properties +4 -2
  69. package/src/sap/ui/rta/messagebundle_fr.properties +12 -10
  70. package/src/sap/ui/rta/messagebundle_fr_CA.properties +7 -5
  71. package/src/sap/ui/rta/messagebundle_hi.properties +3 -1
  72. package/src/sap/ui/rta/messagebundle_hr.properties +34 -32
  73. package/src/sap/ui/rta/messagebundle_hu.properties +3 -1
  74. package/src/sap/ui/rta/messagebundle_id.properties +3 -1
  75. package/src/sap/ui/rta/messagebundle_it.properties +48 -46
  76. package/src/sap/ui/rta/messagebundle_iw.properties +3 -1
  77. package/src/sap/ui/rta/messagebundle_ja.properties +3 -1
  78. package/src/sap/ui/rta/messagebundle_kk.properties +3 -1
  79. package/src/sap/ui/rta/messagebundle_ko.properties +3 -1
  80. package/src/sap/ui/rta/messagebundle_lt.properties +3 -1
  81. package/src/sap/ui/rta/messagebundle_lv.properties +3 -1
  82. package/src/sap/ui/rta/messagebundle_mk.properties +3 -1
  83. package/src/sap/ui/rta/messagebundle_ms.properties +3 -1
  84. package/src/sap/ui/rta/messagebundle_nl.properties +3 -1
  85. package/src/sap/ui/rta/messagebundle_no.properties +3 -1
  86. package/src/sap/ui/rta/messagebundle_pl.properties +3 -1
  87. package/src/sap/ui/rta/messagebundle_pt.properties +3 -1
  88. package/src/sap/ui/rta/messagebundle_pt_PT.properties +3 -1
  89. package/src/sap/ui/rta/messagebundle_ro.properties +3 -1
  90. package/src/sap/ui/rta/messagebundle_ru.properties +3 -1
  91. package/src/sap/ui/rta/messagebundle_sh.properties +4 -2
  92. package/src/sap/ui/rta/messagebundle_sk.properties +3 -1
  93. package/src/sap/ui/rta/messagebundle_sl.properties +3 -1
  94. package/src/sap/ui/rta/messagebundle_sr.properties +4 -2
  95. package/src/sap/ui/rta/messagebundle_sv.properties +3 -1
  96. package/src/sap/ui/rta/messagebundle_th.properties +3 -1
  97. package/src/sap/ui/rta/messagebundle_tr.properties +3 -1
  98. package/src/sap/ui/rta/messagebundle_uk.properties +3 -1
  99. package/src/sap/ui/rta/messagebundle_vi.properties +3 -1
  100. package/src/sap/ui/rta/messagebundle_zh_CN.properties +3 -1
  101. package/src/sap/ui/rta/messagebundle_zh_TW.properties +3 -1
  102. package/src/sap/ui/rta/plugin/AddXMLAtExtensionPoint.js +41 -35
  103. package/src/sap/ui/rta/plugin/AddXMLPlugin.js +168 -0
  104. package/src/sap/ui/rta/plugin/BaseCreate.js +1 -1
  105. package/src/sap/ui/rta/plugin/Combine.js +1 -1
  106. package/src/sap/ui/rta/plugin/ControlVariant.js +1 -1
  107. package/src/sap/ui/rta/plugin/CreateContainer.js +1 -1
  108. package/src/sap/ui/rta/plugin/CutPaste.js +1 -1
  109. package/src/sap/ui/rta/plugin/DragDrop.js +1 -1
  110. package/src/sap/ui/rta/plugin/ExtendControllerPlugin.js +161 -0
  111. package/src/sap/ui/rta/plugin/LocalReset.js +1 -1
  112. package/src/sap/ui/rta/plugin/Plugin.js +7 -4
  113. package/src/sap/ui/rta/plugin/RTAElementMover.js +1 -1
  114. package/src/sap/ui/rta/plugin/Remove.js +1 -1
  115. package/src/sap/ui/rta/plugin/Rename.js +1 -1
  116. package/src/sap/ui/rta/plugin/RenameHandler.js +2 -2
  117. package/src/sap/ui/rta/plugin/Resize.js +1 -1
  118. package/src/sap/ui/rta/plugin/Selection.js +1 -1
  119. package/src/sap/ui/rta/plugin/Settings.js +71 -61
  120. package/src/sap/ui/rta/plugin/Split.js +1 -1
  121. package/src/sap/ui/rta/plugin/Stretch.js +1 -1
  122. package/src/sap/ui/rta/plugin/additionalElements/ActionExtractor.js +1 -1
  123. package/src/sap/ui/rta/plugin/additionalElements/AddElementsDialog.js +1 -1
  124. package/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsPlugin.js +1 -1
  125. package/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsUtils.js +1 -1
  126. package/src/sap/ui/rta/plugin/additionalElements/CommandBuilder.js +1 -1
  127. package/src/sap/ui/rta/plugin/annotations/AnnotationChangeDialog.fragment.xml +38 -51
  128. package/src/sap/ui/rta/plugin/annotations/AnnotationChangeDialog.js +85 -47
  129. package/src/sap/ui/rta/plugin/annotations/AnnotationChangeDialogController.js +97 -33
  130. package/src/sap/ui/rta/plugin/annotations/AnnotationPlugin.js +72 -17
  131. package/src/sap/ui/rta/plugin/iframe/AddIFrame.js +1 -1
  132. package/src/sap/ui/rta/plugin/iframe/AddIFrameDialog.js +1 -1
  133. package/src/sap/ui/rta/service/Action.js +1 -1
  134. package/src/sap/ui/rta/service/ControllerExtension.js +10 -4
  135. package/src/sap/ui/rta/service/Outline.js +1 -1
  136. package/src/sap/ui/rta/service/Property.js +1 -1
  137. package/src/sap/ui/rta/service/Selection.js +1 -1
  138. package/src/sap/ui/rta/service/SupportTools.js +1 -1
  139. package/src/sap/ui/rta/themes/base/Toolbar.adaptation.less +5 -0
  140. package/src/sap/ui/rta/toolbar/Adaptation.fragment.xml +21 -3
  141. package/src/sap/ui/rta/toolbar/Adaptation.js +33 -7
  142. package/src/sap/ui/rta/toolbar/Base.js +1 -1
  143. package/src/sap/ui/rta/toolbar/Fiori.js +4 -3
  144. package/src/sap/ui/rta/toolbar/FioriLike.js +1 -1
  145. package/src/sap/ui/rta/toolbar/OverflowToolbarButton.js +1 -1
  146. package/src/sap/ui/rta/toolbar/Standalone.js +1 -1
  147. package/src/sap/ui/rta/toolbar/contextBased/SaveAsAdaptation.js +1 -1
  148. package/src/sap/ui/rta/toolbar/translation/Translation.js +1 -1
  149. package/src/sap/ui/rta/toolbar/versioning/Versioning.js +1 -1
  150. package/src/sap/ui/rta/util/Animation.js +1 -1
  151. package/src/sap/ui/rta/util/BindingsExtractor.js +1 -1
  152. package/src/sap/ui/rta/util/PluginManager.js +5 -7
  153. package/src/sap/ui/rta/util/PopupManager.js +1 -1
  154. package/src/sap/ui/rta/util/ReloadManager.js +1 -1
  155. package/src/sap/ui/rta/util/ServiceEventBus.js +1 -1
  156. package/src/sap/ui/rta/util/ServiceManager.js +1 -1
  157. package/src/sap/ui/rta/util/changeVisualization/ChangeIndicator.js +1 -1
  158. package/src/sap/ui/rta/util/changeVisualization/ChangeIndicatorRegistry.js +1 -1
  159. package/src/sap/ui/rta/util/changeVisualization/ChangeVisualization.js +2 -2
  160. package/src/sap/ui/rta/util/isReuseComponent.js +44 -0
  161. package/src/sap/ui/rta/util/validateText.js +1 -1
  162. package/src/sap/ui/rta/util/whatsNew/WhatsNew.js +1 -1
  163. package/src/sap/ui/rta/util/whatsNew/WhatsNewUtils.js +12 -7
  164. package/LICENSES/LicenseRef-tzdata-PublicDomain.txt +0 -5
  165. package/src/sap/ui/rta/command/AppDescriptorCommand.js +0 -114
@@ -9,25 +9,10 @@
9
9
  resizable="false"
10
10
  draggable="true"
11
11
  contentWidth="50rem"
12
- contentHeight="25rem"
12
+ contentHeight="{= ${/singleRename} === true ? 'auto' : '25rem'}"
13
+ title="{/title}"
14
+ class="sapUiContentPadding"
13
15
  >
14
- <customHeader>
15
- <Bar>
16
- <contentLeft>
17
- <Label
18
- id="sapUiRtaChangeAnnotationDialog_title"
19
- class="sapUiSmallMargin"
20
- text="{/title}"/>
21
- </contentLeft>
22
- <contentRight>
23
- <Button
24
- id="sapUiRtaChangeAnnotationDialog_toggleShowAllPropertiesButton"
25
- class="sapUiSmallMargin"
26
- text="{= ${/showChangedPropertiesOnly} ? ${i18n>ANNOTATION_CHANGE_DIALOG_BUTTON_ALL_PROPERTIES} : ${i18n>ANNOTATION_CHANGE_DIALOG_BUTTON_CHANGED_PROPERTIES}}"
27
- press="switchDisplayMode"/>
28
- </contentRight>
29
- </Bar>
30
- </customHeader>
31
16
  <content>
32
17
  <VBox>
33
18
  <MessageStrip
@@ -45,56 +30,58 @@
45
30
  id="sapUiRtaChangeAnnotationDialog_description"
46
31
  visible="{= ${/description}.length > 0}"
47
32
  text="{/description}"/>
48
- <SearchField
49
- id="sapUiRtaChangeAnnotationDialog_propertiesFilter"
50
- placeholder="{i18n>ANNOTATION_CHANGE_DIALOG_PROPERTY_SEARCH}"
51
- width="100%"
52
- value="{/filterText}"
53
- liveChange="onFilterProperties"/>
54
- <f:Form editable="false">
33
+ <HBox
34
+ id="sapUiRtaChangeAnnotationDialog_filterHBox"
35
+ fitContainer="true"
36
+ visible="{= ${/singleRename} === false}"
37
+ >
38
+ <SearchField
39
+ id="sapUiRtaChangeAnnotationDialog_propertiesFilter"
40
+ placeholder="{i18n>ANNOTATION_CHANGE_DIALOG_PROPERTY_SEARCH}"
41
+ value="{/filterText}"
42
+ liveChange="onFilterProperties">
43
+ <layoutData>
44
+ <FlexItemData growFactor="1" styleClass="sapUiSmallMarginEnd"/>
45
+ </layoutData>
46
+ </SearchField>
47
+ <HBox alignItems="Center">
48
+ <Label
49
+ text="{i18n>ANNOTATION_CHANGE_DIALOG_BUTTON_CHANGED_PROPERTIES}"/>
50
+ <Switch
51
+ id="sapUiRtaChangeAnnotationDialog_toggleShowAllPropertiesSwitch"
52
+ state="{/showChangedPropertiesOnly}"
53
+ change="switchDisplayMode"
54
+ customTextOn=" "
55
+ customTextOff=" "/>
56
+ </HBox>
57
+ </HBox>
58
+ <f:Form editable="true">
55
59
  <f:layout>
56
60
  <f:ResponsiveGridLayout
57
- labelSpanXL="3"
58
- labelSpanL="3"
59
- labelSpanM="3"
61
+ labelSpanXL="4"
62
+ labelSpanL="4"
63
+ labelSpanM="4"
60
64
  labelSpanS="12"
61
65
  adjustLabelSpan="false"
62
- emptySpanXL="4"
63
- emptySpanL="4"
64
- emptySpanM="4"
66
+ emptySpanXL="0"
67
+ emptySpanL="0"
68
+ emptySpanM="0"
65
69
  emptySpanS="0"
66
70
  columnsXL="1"
67
71
  columnsL="1"
68
72
  columnsM="1"
69
- singleContainerFullSize="false"/>
73
+ singleContainerFullSize="true"/>
70
74
  </f:layout>
71
75
  <f:FormContainer
72
76
  id="sapUiRtaChangeAnnotationDialog_propertyList"
73
- formElements="{path: '/propertiesToDisplay', templateShareable: false}">
74
- <f:FormElement label="{propertyName}">
75
- <Select
76
- visible="{path: '/valueType', formatter: '.formatters.isValueList'}"
77
- selectedKey="{currentValue}"
78
- change="onValueListChange"
79
- items="{path: '/possibleValues', templateShareable: false}">
80
- <core:Item key="{key}" text="{text}" />
81
- </Select>
82
- <Input
83
- visible="{path: '/valueType', formatter: '.formatters.isString'}"
84
- value="{currentValue}"
85
- change="onStringChange"/>
86
- <CheckBox
87
- visible="{path: '/valueType', formatter: '.formatters.isBoolean'}"
88
- selected="{=!!${currentValue}}"
89
- select="onBooleanChange"/>
90
- </f:FormElement>
91
- </f:FormContainer>
77
+ formElements="{path: '/propertiesToDisplay', factory: '.editorFactory'}" />
92
78
  </f:Form>
93
79
  </VBox>
94
80
  </content>
95
81
  <beginButton>
96
82
  <Button
97
83
  id="sapUiRtaChangeAnnotationDialog_saveButton"
84
+ enabled="{= ${path: '/properties', formatter: '.hasChangesFormatter'}}"
98
85
  type="Emphasized"
99
86
  text="{i18n>ANNOTATION_CHANGE_DIALOG_SAVE}"
100
87
  press="onSavePress"
@@ -7,19 +7,23 @@
7
7
  sap.ui.define([
8
8
  "sap/ui/base/ManagedObject",
9
9
  "sap/ui/core/Fragment",
10
- "sap/ui/fl/apply/api/FlexRuntimeInfoAPI",
10
+ "sap/ui/dt/ElementUtil",
11
11
  "sap/ui/fl/write/api/PersistenceWriteAPI",
12
12
  "sap/ui/model/json/JSONModel",
13
13
  "sap/ui/model/resource/ResourceModel",
14
- "sap/ui/rta/plugin/annotations/AnnotationChangeDialogController"
14
+ "sap/ui/rta/plugin/annotations/AnnotationChangeDialogController",
15
+ "sap/ui/rta/plugin/annotations/AnnotationTypes",
16
+ "sap/ui/rta/Utils"
15
17
  ], function(
16
18
  ManagedObject,
17
19
  Fragment,
18
- FlexRuntimeInfoAPI,
20
+ ElementUtil,
19
21
  PersistenceWriteAPI,
20
22
  JSONModel,
21
23
  ResourceModel,
22
- AnnotationChangeDialogController
24
+ AnnotationChangeDialogController,
25
+ AnnotationTypes,
26
+ RtaUtils
23
27
  ) {
24
28
  "use strict";
25
29
 
@@ -27,7 +31,7 @@ sap.ui.define([
27
31
  * @class Constructor for a new sap.ui.rta.plugin.annotations.AnnotationChangeDialog.
28
32
  * @extends sap.ui.base.ManagedObject
29
33
  * @author SAP SE
30
- * @version 1.133.1
34
+ * @version 1.135.0
31
35
  * @constructor
32
36
  * @since 1.132
33
37
  * @private
@@ -35,21 +39,31 @@ sap.ui.define([
35
39
  */
36
40
  const AnnotationChangeDialog = ManagedObject.extend("sap.ui.rta.plugin.annotations.AnnotationChangeDialog");
37
41
 
42
+ function replaceCurrentValueWithTextFromControl(aProperties, sPreSelectedProperty, oControl) {
43
+ const oProperty = aProperties.find((oProperty) => oProperty.annotationPath === sPreSelectedProperty);
44
+ const aNewLabel = ElementUtil.getLabelForElement(oControl);
45
+ if (oProperty && aNewLabel) {
46
+ oProperty.currentValue = aNewLabel;
47
+ oProperty.originalValue = aNewLabel;
48
+ }
49
+ }
50
+
38
51
  AnnotationChangeDialog.prototype._createDialog = async function() {
39
52
  this._oController = new AnnotationChangeDialogController();
40
- const oPopover = await Fragment.load({
53
+ const oDialog = await Fragment.load({
41
54
  name: "sap.ui.rta.plugin.annotations.AnnotationChangeDialog",
42
55
  controller: this._oController
43
56
  });
57
+ oDialog.addStyleClass(RtaUtils.getRtaStyleClassName());
44
58
  this.oChangeAnnotationModel = new JSONModel();
45
- oPopover.setModel(this.oChangeAnnotationModel);
59
+ oDialog.setModel(this.oChangeAnnotationModel);
46
60
  const oI18nModel = new ResourceModel({ bundleName: "sap.ui.rta.messagebundle" });
47
- oPopover.setModel(oI18nModel, "i18n");
48
- return oPopover;
61
+ oDialog.setModel(oI18nModel, "i18n");
62
+ return oDialog;
49
63
  };
50
64
 
51
65
  AnnotationChangeDialog.prototype._openDialog = function() {
52
- this._oPopover.open();
66
+ this._oDialog.open();
53
67
  return this._oController.initialize();
54
68
  };
55
69
 
@@ -62,12 +76,13 @@ sap.ui.define([
62
76
  * @property {string} properties.annotationPath - Path of the property
63
77
  * @property {string} properties.propertyName - Name of the property
64
78
  * @property {string} properties.currentValue - Current value of the property
79
+ * @property {string} [properties.label] - Label of the property. If not given, the property name is used
80
+ * @property {string} [properties.tooltip] - Tooltip of the property
65
81
  * @property {object[]} possibleValues - Array of possible values for value list type properties
66
82
  * @property {string} possibleValues.key - Key of the option
67
83
  * @property {string} possibleValues.text - Text of the option
68
84
  * @property {string} [preSelectedProperty] - Name of the property that should be filtered for initially
69
- * @private
70
- * @ui5-restricted
85
+ * @public
71
86
  */
72
87
 
73
88
  /**
@@ -75,8 +90,7 @@ sap.ui.define([
75
90
  * @property {sap.ui.core.Control} oControl - Control for which the annotation change is made
76
91
  * @property {string} sAnnotation - Annotation name
77
92
  * @returns {sap.ui.rta.plugin.annotations.AnnotationChangeInfo} - Annotation change info
78
- * @private
79
- * @ui5-restricted
93
+ * @public
80
94
  */
81
95
 
82
96
  /**
@@ -84,12 +98,16 @@ sap.ui.define([
84
98
  *
85
99
  * @typedef {object} sap.ui.rta.plugin.annotations.AnnotationChangeDefinition
86
100
  * @property {string} annotationChangeType - Change type
101
+ * @property {string} serviceUrl - Url of the OData service
87
102
  * @property {object} content - Change content
88
103
  * @property {string} content.annotationPath - Path of the property
89
104
  * @property {string} content.value - New value
90
- * @property {string} serviceUrl - Url of the OData service
91
- * @private
92
- * @ui5-restricted
105
+ * @property {string} content.text - New value as translatable text. If given, the value is ignored
106
+ * @property {object} [content.objectTemplateInfo] - Object template to construct a return object.
107
+ * If given the applyChange function will return an object as value, which is parsed from the template string.
108
+ * @property {string} [content.objectTemplateInfo.templateAsString] - Stringified template to be used for constructing the return object
109
+ * @property {string} [content.objectTemplateInfo.placeholder] - Placeholder in the template string. Will be replaced by the new value
110
+ * @public
93
111
  */
94
112
 
95
113
  /**
@@ -112,14 +130,31 @@ sap.ui.define([
112
130
  delegate: oDelegate,
113
131
  control: oControl,
114
132
  annotation: sAnnotation,
115
- description: sAnnotationDescription = ""
133
+ description: sAnnotationDescription,
134
+ singleRename: bSingleRename
116
135
  } = mPropertyBag;
117
136
  const {
118
137
  serviceUrl: sServiceUrl,
119
- properties: aProperties,
120
- possibleValues: aPossibleValues,
138
+ properties: aDelegateProperties,
139
+ possibleValues: aDelegatePossibleValues,
121
140
  preSelectedProperty: sPreSelectedPropertyKey
122
- } = oDelegate.getAnnotationsChangeInfo(oControl, sAnnotation);
141
+ } = await oDelegate.getAnnotationsChangeInfo(oControl, sAnnotation);
142
+
143
+ const bObjectAsKey = !!aDelegatePossibleValues?.some((oPossibleValue) => typeof oPossibleValue.key === "object");
144
+ // the key could be an object which does not work as property for the Select control
145
+ // therefore the key must be stringified and later parsed
146
+ const aProperties = aDelegateProperties.map((oProperty) => ({
147
+ ...oProperty,
148
+ currentValue: bObjectAsKey ? JSON.stringify(oProperty.currentValue) : oProperty.currentValue,
149
+ originalValue: bObjectAsKey ? JSON.stringify(oProperty.currentValue) : oProperty.currentValue,
150
+ label: oProperty.label || oProperty.propertyName
151
+ }));
152
+ const aPossibleValues = (aDelegatePossibleValues || []).map((oPossibleValue) => ({
153
+ ...oPossibleValue,
154
+ key: bObjectAsKey ? JSON.stringify(oPossibleValue.key) : oPossibleValue.key
155
+ }));
156
+
157
+ aProperties.sort((oProperty1, oProperty2) => oProperty1.label.localeCompare(oProperty2.label));
123
158
 
124
159
  const aExistingChanges = PersistenceWriteAPI._getAnnotationChanges({
125
160
  control: oControl
@@ -129,50 +164,53 @@ sap.ui.define([
129
164
  return oChange.getContent().annotationPath;
130
165
  });
131
166
 
132
- this._oPopover ||= await this._createDialog();
133
-
134
- const oOriginalProperties = {};
135
- aProperties.forEach(({ annotationPath, currentValue }) => {
136
- oOriginalProperties[annotationPath] = currentValue;
137
- });
167
+ this._oDialog ||= await this._createDialog();
138
168
 
139
169
  const sFilterText = sPreSelectedPropertyKey
140
- ? aProperties.find((oProperty) => oProperty.annotationPath === sPreSelectedPropertyKey).propertyName
170
+ ? aProperties.find((oProperty) => oProperty.annotationPath === sPreSelectedPropertyKey).label
141
171
  : "";
172
+ // default size limit is 100, but we need to display all properties.
173
+ // As the list size is not dynamic, we can set the size limit to the number of properties
174
+ // the size influences all binding sizes, so we only set it if the number of properties is greater than 100
175
+ if (aProperties.length > 100) {
176
+ this.oChangeAnnotationModel.setSizeLimit(aProperties.length);
177
+ }
178
+
179
+ if (bSingleRename) {
180
+ replaceCurrentValueWithTextFromControl(aProperties, sPreSelectedPropertyKey, oControl);
181
+ }
182
+
142
183
  this.oChangeAnnotationModel.setData({
184
+ objectAsKey: bObjectAsKey,
185
+ control: oControl,
143
186
  title: sAnnotationTitle,
144
- description: sAnnotationDescription,
187
+ description: sAnnotationDescription || "",
145
188
  properties: aProperties, // all properties
146
189
  changedProperties: aProperties.filter(({ annotationPath }) => aChangedAnnotations.includes(annotationPath)),
147
- propertiesToDisplay: aProperties, // switches dynamcially between all properties and changed properties
190
+ propertiesToDisplay: aProperties, // switches dynamically between all properties and changed properties
148
191
  showChangedPropertiesOnly: false,
149
192
  filterText: sFilterText,
193
+ singleRename: bSingleRename || false,
150
194
  possibleValues: aPossibleValues,
151
- valueType: sAnnotationValueType
195
+ valueType: sAnnotationValueType,
196
+ serviceUrl: sServiceUrl
152
197
  });
153
198
  if (sFilterText) {
154
199
  this._oController.filterProperties(sFilterText);
155
200
  }
156
- const oChangedProperties = await this._openDialog();
157
- this._oPopover.close();
158
- return Object.entries(oChangedProperties).map(([sPath, vNewValue]) => {
159
- if (oOriginalProperties[sPath] === vNewValue) {
160
- return null;
161
- }
162
- return {
163
- serviceUrl: sServiceUrl,
164
- content: {
165
- annotationPath: sPath,
166
- value: vNewValue
167
- }
168
- };
169
- }).filter(Boolean);
201
+ // Ensure that the model is fully refreshed before opening the dialog
202
+ this.oChangeAnnotationModel.refresh(true);
203
+ const aChangedProperties = await this._openDialog();
204
+ // reset filter to not have a filtered list when opening the dialog again
205
+ this._oController.filterProperties("");
206
+ this._oDialog.close();
207
+ return aChangedProperties;
170
208
  };
171
209
 
172
210
  AnnotationChangeDialog.prototype.destroy = function(...aArgs) {
173
211
  ManagedObject.prototype.destroy.apply(this, aArgs);
174
- if (this._oPopover) {
175
- this._oPopover.destroy();
212
+ if (this._oDialog) {
213
+ this._oDialog.destroy();
176
214
  }
177
215
  if (this._oController) {
178
216
  this._oController.destroy();
@@ -5,14 +5,26 @@
5
5
  * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
6
6
  */
7
7
  sap.ui.define([
8
+ "sap/m/Input",
9
+ "sap/m/Label",
10
+ "sap/m/Select",
11
+ "sap/m/Switch",
8
12
  "sap/ui/core/mvc/Controller",
9
13
  "sap/ui/core/Element",
14
+ "sap/ui/core/Item",
15
+ "sap/ui/layout/form/FormElement",
10
16
  "sap/ui/model/Filter",
11
17
  "sap/ui/model/FilterOperator",
12
18
  "sap/ui/rta/plugin/annotations/AnnotationTypes"
13
19
  ], function(
20
+ Input,
21
+ Label,
22
+ Select,
23
+ Switch,
14
24
  Controller,
15
25
  Element,
26
+ Item,
27
+ FormElement,
16
28
  Filter,
17
29
  FilterOperator,
18
30
  AnnotationTypes
@@ -23,7 +35,7 @@ sap.ui.define([
23
35
  * @class Controller for the AnnotationChangeDialog.
24
36
  * @extends sap.ui.core.mvc.Controller
25
37
  * @author SAP SE
26
- * @version 1.133.1
38
+ * @version 1.135.0
27
39
  * @constructor
28
40
  * @since 1.132
29
41
  * @private
@@ -32,7 +44,6 @@ sap.ui.define([
32
44
  const AnnotationChangeDialogController = Controller.extend("sap.ui.rta.plugin.annotations.AnnotationChangeDialogController");
33
45
 
34
46
  AnnotationChangeDialogController.prototype.initialize = function() {
35
- this._oChangedProperties = {};
36
47
  return new Promise((resolve) => {
37
48
  this._fnResolveAfterClose = resolve;
38
49
  });
@@ -41,7 +52,7 @@ sap.ui.define([
41
52
  AnnotationChangeDialogController.prototype.filterProperties = function(sQuery) {
42
53
  const aFilters = [];
43
54
  if (sQuery && sQuery.length > 0) {
44
- const filter = new Filter("propertyName", FilterOperator.Contains, sQuery);
55
+ const filter = new Filter("label", FilterOperator.Contains, sQuery);
45
56
  aFilters.push(filter);
46
57
  }
47
58
 
@@ -55,9 +66,9 @@ sap.ui.define([
55
66
  this.filterProperties(sQuery);
56
67
  };
57
68
 
58
- AnnotationChangeDialogController.prototype.switchDisplayMode = function() {
69
+ AnnotationChangeDialogController.prototype.switchDisplayMode = function(oEvent) {
70
+ const bShowChangedPropertiesOnly = oEvent.getParameter("state");
59
71
  const oList = Element.getElementById("sapUiRtaChangeAnnotationDialog_propertyList");
60
- const bShowChangedPropertiesOnly = !oList.getModel().getProperty("/showChangedPropertiesOnly");
61
72
  oList.getModel().setProperty("/showChangedPropertiesOnly", bShowChangedPropertiesOnly);
62
73
  oList.getModel().setProperty(
63
74
  "/propertiesToDisplay",
@@ -67,42 +78,95 @@ sap.ui.define([
67
78
  );
68
79
  };
69
80
 
70
- AnnotationChangeDialogController.prototype.onValueListChange = function(oEvent) {
71
- const sPath = oEvent.getSource().getBindingContext().getObject().annotationPath;
72
- const sSelectedKey = oEvent.getParameters().selectedItem.getKey();
73
- this._oChangedProperties[sPath] = sSelectedKey;
74
- };
81
+ AnnotationChangeDialogController.prototype.onSavePress = function(oEvent) {
82
+ const oModelData = oEvent.getSource().getModel().getData();
83
+ const aChanges = oModelData.properties
84
+ .map((oProperty) => {
85
+ if (oProperty.originalValue === oProperty.currentValue) {
86
+ return null;
87
+ }
88
+ const oChangeSpecificData = {
89
+ serviceUrl: oModelData.serviceUrl,
90
+ content: {
91
+ annotationPath: oProperty.annotationPath
92
+ }
93
+ };
94
+ oChangeSpecificData.content[oModelData.valueType === AnnotationTypes.StringType ? "text" : "value"] =
95
+ oModelData.objectAsKey ? JSON.parse(oProperty.currentValue) : oProperty.currentValue;
96
+ return oChangeSpecificData;
97
+ })
98
+ .filter(Boolean);
75
99
 
76
- AnnotationChangeDialogController.prototype.onBooleanChange = function(oEvent) {
77
- const sPath = oEvent.getSource().getBindingContext().getObject().annotationPath;
78
- const bSelected = oEvent.getParameters().selected;
79
- this._oChangedProperties[sPath] = bSelected;
100
+ this._fnResolveAfterClose(aChanges);
80
101
  };
81
102
 
82
- AnnotationChangeDialogController.prototype.onStringChange = function(oEvent) {
83
- const sPath = oEvent.getSource().getBindingContext().getObject().annotationPath;
84
- const sValue = oEvent.getParameters().value;
85
- this._oChangedProperties[sPath] = sValue;
103
+ AnnotationChangeDialogController.prototype.onCancelPress = function() {
104
+ this._fnResolveAfterClose([]);
86
105
  };
87
106
 
88
- AnnotationChangeDialogController.prototype.onSavePress = function() {
89
- this._fnResolveAfterClose(this._oChangedProperties);
90
- };
107
+ function createEditorField(sValueType) {
108
+ const onChange = () => {
109
+ // Property updates are handled via two-way binding
110
+ // However, the binding of the save button doesn't detect changes
111
+ // within nested object properties, so it has to be refreshed explicitly
112
+ const oSaveButton = Element.getElementById("sapUiRtaChangeAnnotationDialog_saveButton");
113
+ oSaveButton.getBinding("enabled").refresh(true);
114
+ };
91
115
 
92
- AnnotationChangeDialogController.prototype.onCancelPress = function() {
93
- this._fnResolveAfterClose({});
94
- };
116
+ if (sValueType === AnnotationTypes.ValueListType) {
117
+ const oSelect = new Select({
118
+ selectedKey: "{currentValue}",
119
+ change: onChange
120
+ });
121
+
122
+ const oItemTemplate = new Item({
123
+ key: "{key}",
124
+ text: "{text}"
125
+ });
126
+
127
+ oSelect.bindItems({
128
+ path: "/possibleValues",
129
+ template: oItemTemplate,
130
+ templateShareable: false
131
+ });
132
+
133
+ return oSelect;
134
+ }
95
135
 
96
- AnnotationChangeDialogController.prototype.formatters = {
97
- isValueList(sType) {
98
- return sType === AnnotationTypes.ValueListType;
99
- },
100
- isBoolean(sType) {
101
- return sType === AnnotationTypes.BooleanType;
102
- },
103
- isString(sType) {
104
- return sType === AnnotationTypes.StringType;
136
+ if (sValueType === AnnotationTypes.StringType) {
137
+ return new Input({
138
+ value: "{currentValue}",
139
+ change: onChange
140
+ });
105
141
  }
142
+
143
+ if (sValueType === AnnotationTypes.BooleanType) {
144
+ return new Switch({
145
+ state: "{currentValue}",
146
+ change: onChange
147
+ });
148
+ }
149
+
150
+ throw new Error(`Unsupported value type: ${sValueType}`);
151
+ }
152
+
153
+ AnnotationChangeDialogController.prototype.editorFactory = function(sId, oContext) {
154
+ const sValueType = oContext.getProperty("/valueType");
155
+
156
+ return new FormElement({
157
+ id: sId,
158
+ label: new Label({
159
+ text: "{= ${label} || ${propertyName}}",
160
+ tooltip: "{tooltip}"
161
+ }),
162
+ fields: [
163
+ createEditorField.call(this, sValueType)
164
+ ]
165
+ });
166
+ };
167
+
168
+ AnnotationChangeDialogController.prototype.hasChangesFormatter = function(aProperties) {
169
+ return aProperties?.some((oProperty) => oProperty.originalValue !== oProperty.currentValue);
106
170
  };
107
171
 
108
172
  return AnnotationChangeDialogController;