@openui5/sap.ui.rta 1.135.0 → 1.136.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 (213) hide show
  1. package/REUSE.toml +649 -0
  2. package/THIRDPARTY.txt +22 -22
  3. package/package.json +6 -6
  4. package/src/sap/ui/rta/.library +2 -2
  5. package/src/sap/ui/rta/Client.js +2 -2
  6. package/src/sap/ui/rta/RuntimeAuthoring.js +92 -19
  7. package/src/sap/ui/rta/Utils.js +19 -2
  8. package/src/sap/ui/rta/api/startAdaptation.js +1 -1
  9. package/src/sap/ui/rta/api/startKeyUserAdaptation.js +1 -1
  10. package/src/sap/ui/rta/appVariant/AppVariantDialog.js +1 -1
  11. package/src/sap/ui/rta/appVariant/AppVariantManager.js +2 -2
  12. package/src/sap/ui/rta/appVariant/AppVariantOverviewDialog.js +1 -1
  13. package/src/sap/ui/rta/appVariant/AppVariantUtils.js +1 -1
  14. package/src/sap/ui/rta/appVariant/Feature.js +1 -1
  15. package/src/sap/ui/rta/appVariant/S4HanaCloudBackend.js +1 -1
  16. package/src/sap/ui/rta/appVariant/Utils.js +8 -15
  17. package/src/sap/ui/rta/appVariant/manageApps/webapp/Component.js +1 -1
  18. package/src/sap/ui/rta/appVariant/manageApps/webapp/controller/ManageApps.controller.js +30 -44
  19. package/src/sap/ui/rta/appVariant/manageApps/webapp/index.js +1 -1
  20. package/src/sap/ui/rta/appVariant/manageApps/webapp/model/models.js +1 -1
  21. package/src/sap/ui/rta/command/AddIFrame.js +2 -2
  22. package/src/sap/ui/rta/command/AddProperty.js +2 -2
  23. package/src/sap/ui/rta/command/AddXML.js +2 -2
  24. package/src/sap/ui/rta/command/AddXMLAtExtensionPoint.js +2 -2
  25. package/src/sap/ui/rta/command/AnnotationCommand.js +2 -2
  26. package/src/sap/ui/rta/command/BaseCommand.js +2 -2
  27. package/src/sap/ui/rta/command/BindProperty.js +2 -2
  28. package/src/sap/ui/rta/command/Combine.js +2 -2
  29. package/src/sap/ui/rta/command/CommandFactory.js +2 -2
  30. package/src/sap/ui/rta/command/CompositeCommand.js +2 -2
  31. package/src/sap/ui/rta/command/ControlVariantConfigure.js +2 -2
  32. package/src/sap/ui/rta/command/ControlVariantSave.js +2 -2
  33. package/src/sap/ui/rta/command/ControlVariantSaveAs.js +2 -2
  34. package/src/sap/ui/rta/command/ControlVariantSetTitle.js +2 -2
  35. package/src/sap/ui/rta/command/ControlVariantSwitch.js +2 -2
  36. package/src/sap/ui/rta/command/CreateContainer.js +2 -2
  37. package/src/sap/ui/rta/command/CustomAdd.js +2 -2
  38. package/src/sap/ui/rta/command/ExtendControllerCommand.js +4 -3
  39. package/src/sap/ui/rta/command/FlexCommand.js +2 -2
  40. package/src/sap/ui/rta/command/LREPSerializer.js +2 -2
  41. package/src/sap/ui/rta/command/LocalReset.js +2 -2
  42. package/src/sap/ui/rta/command/ManifestCommand.js +2 -2
  43. package/src/sap/ui/rta/command/Move.js +2 -2
  44. package/src/sap/ui/rta/command/Property.js +2 -2
  45. package/src/sap/ui/rta/command/Remove.js +2 -2
  46. package/src/sap/ui/rta/command/Rename.js +2 -2
  47. package/src/sap/ui/rta/command/Resize.js +2 -2
  48. package/src/sap/ui/rta/command/Reveal.js +2 -2
  49. package/src/sap/ui/rta/command/Settings.js +2 -2
  50. package/src/sap/ui/rta/command/Split.js +2 -2
  51. package/src/sap/ui/rta/command/Stack.js +20 -5
  52. package/src/sap/ui/rta/command/compVariant/CompVariantContent.js +2 -2
  53. package/src/sap/ui/rta/command/compVariant/CompVariantSaveAs.js +2 -2
  54. package/src/sap/ui/rta/command/compVariant/CompVariantSwitch.js +2 -2
  55. package/src/sap/ui/rta/command/compVariant/CompVariantUpdate.js +2 -2
  56. package/src/sap/ui/rta/command/manifest/AddLibrary.js +2 -2
  57. package/src/sap/ui/rta/enablement/TestDelegate.js +1 -1
  58. package/src/sap/ui/rta/enablement/elementActionTest.js +2 -2
  59. package/src/sap/ui/rta/library.js +3 -3
  60. package/src/sap/ui/rta/messagebundle.properties +170 -9
  61. package/src/sap/ui/rta/messagebundle_ar.properties +104 -6
  62. package/src/sap/ui/rta/messagebundle_bg.properties +104 -6
  63. package/src/sap/ui/rta/messagebundle_ca.properties +107 -9
  64. package/src/sap/ui/rta/messagebundle_cnr.properties +105 -7
  65. package/src/sap/ui/rta/messagebundle_cs.properties +102 -4
  66. package/src/sap/ui/rta/messagebundle_cy.properties +104 -6
  67. package/src/sap/ui/rta/messagebundle_da.properties +103 -5
  68. package/src/sap/ui/rta/messagebundle_de.properties +113 -15
  69. package/src/sap/ui/rta/messagebundle_el.properties +101 -3
  70. package/src/sap/ui/rta/messagebundle_en.properties +104 -6
  71. package/src/sap/ui/rta/messagebundle_en_GB.properties +104 -6
  72. package/src/sap/ui/rta/messagebundle_en_US_saprigi.properties +2 -0
  73. package/src/sap/ui/rta/messagebundle_es.properties +108 -10
  74. package/src/sap/ui/rta/messagebundle_es_MX.properties +112 -14
  75. package/src/sap/ui/rta/messagebundle_et.properties +102 -4
  76. package/src/sap/ui/rta/messagebundle_fi.properties +105 -7
  77. package/src/sap/ui/rta/messagebundle_fr.properties +113 -15
  78. package/src/sap/ui/rta/messagebundle_fr_CA.properties +105 -7
  79. package/src/sap/ui/rta/messagebundle_hi.properties +104 -6
  80. package/src/sap/ui/rta/messagebundle_hr.properties +114 -16
  81. package/src/sap/ui/rta/messagebundle_hu.properties +103 -5
  82. package/src/sap/ui/rta/messagebundle_id.properties +112 -14
  83. package/src/sap/ui/rta/messagebundle_it.properties +102 -4
  84. package/src/sap/ui/rta/messagebundle_iw.properties +104 -6
  85. package/src/sap/ui/rta/messagebundle_ja.properties +116 -18
  86. package/src/sap/ui/rta/messagebundle_kk.properties +103 -5
  87. package/src/sap/ui/rta/messagebundle_ko.properties +104 -6
  88. package/src/sap/ui/rta/messagebundle_lt.properties +104 -6
  89. package/src/sap/ui/rta/messagebundle_lv.properties +103 -5
  90. package/src/sap/ui/rta/messagebundle_mk.properties +107 -9
  91. package/src/sap/ui/rta/messagebundle_ms.properties +114 -16
  92. package/src/sap/ui/rta/messagebundle_nl.properties +103 -5
  93. package/src/sap/ui/rta/messagebundle_no.properties +107 -9
  94. package/src/sap/ui/rta/messagebundle_pl.properties +103 -5
  95. package/src/sap/ui/rta/messagebundle_pt.properties +102 -4
  96. package/src/sap/ui/rta/messagebundle_pt_PT.properties +102 -4
  97. package/src/sap/ui/rta/messagebundle_ro.properties +102 -4
  98. package/src/sap/ui/rta/messagebundle_ru.properties +106 -8
  99. package/src/sap/ui/rta/messagebundle_sh.properties +105 -7
  100. package/src/sap/ui/rta/messagebundle_sk.properties +102 -4
  101. package/src/sap/ui/rta/messagebundle_sl.properties +102 -4
  102. package/src/sap/ui/rta/messagebundle_sr.properties +105 -7
  103. package/src/sap/ui/rta/messagebundle_sv.properties +103 -5
  104. package/src/sap/ui/rta/messagebundle_th.properties +103 -5
  105. package/src/sap/ui/rta/messagebundle_tr.properties +102 -4
  106. package/src/sap/ui/rta/messagebundle_uk.properties +104 -6
  107. package/src/sap/ui/rta/messagebundle_vi.properties +104 -6
  108. package/src/sap/ui/rta/messagebundle_zh_CN.properties +103 -5
  109. package/src/sap/ui/rta/messagebundle_zh_TW.properties +104 -6
  110. package/src/sap/ui/rta/plugin/AddXMLAtExtensionPoint.js +2 -2
  111. package/src/sap/ui/rta/plugin/AddXMLPlugin.js +54 -32
  112. package/src/sap/ui/rta/plugin/BaseCreate.js +2 -2
  113. package/src/sap/ui/rta/plugin/Combine.js +2 -2
  114. package/src/sap/ui/rta/plugin/CompVariant.js +114 -114
  115. package/src/sap/ui/rta/plugin/ControlVariant.js +37 -54
  116. package/src/sap/ui/rta/plugin/CreateContainer.js +2 -2
  117. package/src/sap/ui/rta/plugin/CutPaste.js +2 -2
  118. package/src/sap/ui/rta/plugin/DragDrop.js +2 -2
  119. package/src/sap/ui/rta/plugin/ExtendControllerPlugin.js +62 -38
  120. package/src/sap/ui/rta/plugin/LocalReset.js +4 -3
  121. package/src/sap/ui/rta/plugin/Plugin.js +30 -12
  122. package/src/sap/ui/rta/plugin/RTAElementMover.js +2 -2
  123. package/src/sap/ui/rta/plugin/Remove.js +2 -2
  124. package/src/sap/ui/rta/plugin/Resize.js +2 -2
  125. package/src/sap/ui/rta/plugin/Selection.js +2 -2
  126. package/src/sap/ui/rta/plugin/Settings.js +5 -2
  127. package/src/sap/ui/rta/plugin/Split.js +2 -2
  128. package/src/sap/ui/rta/plugin/Stretch.js +2 -2
  129. package/src/sap/ui/rta/plugin/additionalElements/ActionExtractor.js +2 -2
  130. package/src/sap/ui/rta/plugin/additionalElements/AddElementsDialog.js +2 -2
  131. package/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsAnalyzer.js +1 -1
  132. package/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsPlugin.js +2 -2
  133. package/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsUtils.js +2 -2
  134. package/src/sap/ui/rta/plugin/additionalElements/CommandBuilder.js +2 -2
  135. package/src/sap/ui/rta/plugin/annotations/AnnotationChangeDialog.fragment.xml +4 -4
  136. package/src/sap/ui/rta/plugin/annotations/AnnotationChangeDialog.js +26 -13
  137. package/src/sap/ui/rta/plugin/annotations/AnnotationChangeDialogController.js +30 -31
  138. package/src/sap/ui/rta/plugin/annotations/AnnotationPlugin.js +13 -7
  139. package/src/sap/ui/rta/plugin/annotations/AnnotationTypes.js +1 -1
  140. package/src/sap/ui/rta/plugin/iframe/AddIFrame.js +8 -2
  141. package/src/sap/ui/rta/plugin/iframe/AddIFrameDialog.js +2 -2
  142. package/src/sap/ui/rta/plugin/iframe/AddIFrameDialogController.js +1 -1
  143. package/src/sap/ui/rta/plugin/iframe/urlCleaner.js +1 -1
  144. package/src/sap/ui/rta/plugin/{Rename.js → rename/Rename.js} +29 -67
  145. package/src/sap/ui/rta/plugin/rename/RenameDialog.fragment.xml +63 -0
  146. package/src/sap/ui/rta/plugin/rename/RenameDialog.js +140 -0
  147. package/src/sap/ui/rta/service/Action.js +2 -2
  148. package/src/sap/ui/rta/service/ControllerExtension.js +2 -2
  149. package/src/sap/ui/rta/service/Outline.js +2 -2
  150. package/src/sap/ui/rta/service/Property.js +2 -2
  151. package/src/sap/ui/rta/service/Receiver.js +1 -1
  152. package/src/sap/ui/rta/service/Selection.js +2 -2
  153. package/src/sap/ui/rta/service/SupportTools.js +2 -2
  154. package/src/sap/ui/rta/service/index.js +1 -1
  155. package/src/sap/ui/rta/themes/base/library.source.less +1 -1
  156. package/src/sap/ui/rta/themes/sap_hcb/library.source.less +1 -1
  157. package/src/sap/ui/rta/toolbar/ActionsMenu.fragment.xml +6 -0
  158. package/src/sap/ui/rta/toolbar/Adaptation.fragment.xml +1 -6
  159. package/src/sap/ui/rta/toolbar/Adaptation.js +12 -3
  160. package/src/sap/ui/rta/toolbar/AdaptationRenderer.js +1 -1
  161. package/src/sap/ui/rta/toolbar/Base.js +2 -2
  162. package/src/sap/ui/rta/toolbar/BaseRenderer.js +1 -1
  163. package/src/sap/ui/rta/toolbar/Fiori.js +20 -10
  164. package/src/sap/ui/rta/toolbar/FioriLike.js +7 -5
  165. package/src/sap/ui/rta/toolbar/OverflowToolbarButton.js +2 -2
  166. package/src/sap/ui/rta/toolbar/Standalone.js +2 -2
  167. package/src/sap/ui/rta/toolbar/contextBased/ManageAdaptations.js +1 -1
  168. package/src/sap/ui/rta/toolbar/contextBased/SaveAsAdaptation.js +2 -2
  169. package/src/sap/ui/rta/toolbar/translation/Translation.js +2 -2
  170. package/src/sap/ui/rta/toolbar/versioning/Versioning.js +2 -2
  171. package/src/sap/ui/rta/util/Animation.js +1 -1
  172. package/src/sap/ui/rta/util/BindingsExtractor.js +1 -1
  173. package/src/sap/ui/rta/util/PluginManager.js +8 -6
  174. package/src/sap/ui/rta/util/PopupManager.js +2 -2
  175. package/src/sap/ui/rta/util/ReloadManager.js +2 -2
  176. package/src/sap/ui/rta/util/ServiceEventBus.js +2 -2
  177. package/src/sap/ui/rta/util/ServiceManager.js +2 -2
  178. package/src/sap/ui/rta/util/adaptationStarter.js +1 -1
  179. package/src/sap/ui/rta/util/changeVisualization/ChangeCategories.js +1 -1
  180. package/src/sap/ui/rta/util/changeVisualization/ChangeIndicator.js +2 -2
  181. package/src/sap/ui/rta/util/changeVisualization/ChangeIndicatorRegistry.js +2 -2
  182. package/src/sap/ui/rta/util/changeVisualization/ChangeStates.js +1 -1
  183. package/src/sap/ui/rta/util/changeVisualization/ChangeVisualization.js +3 -3
  184. package/src/sap/ui/rta/util/changeVisualization/ChangeVisualizationUtils.js +1 -1
  185. package/src/sap/ui/rta/util/changeVisualization/commands/CombineVisualization.js +1 -1
  186. package/src/sap/ui/rta/util/changeVisualization/commands/CreateContainerVisualization.js +1 -1
  187. package/src/sap/ui/rta/util/changeVisualization/commands/MoveVisualization.js +1 -1
  188. package/src/sap/ui/rta/util/changeVisualization/commands/RenameVisualization.js +1 -1
  189. package/src/sap/ui/rta/util/changeVisualization/commands/SplitVisualization.js +1 -1
  190. package/src/sap/ui/rta/util/changeVisualization/commands/getCommandVisualization.js +1 -1
  191. package/src/sap/ui/rta/util/guidedTour/GuidedTour.js +242 -0
  192. package/src/sap/ui/rta/util/guidedTour/TourMarker.fragment.xml +50 -0
  193. package/src/sap/ui/rta/util/guidedTour/content/GeneralTour.js +205 -0
  194. package/src/sap/ui/rta/util/hasStableId.js +1 -1
  195. package/src/sap/ui/rta/util/isReuseComponent.js +1 -1
  196. package/src/sap/ui/rta/util/showMessageBox.js +1 -1
  197. package/src/sap/ui/rta/util/validateFlexEnabled.js +1 -1
  198. package/src/sap/ui/rta/util/validateStableIds.js +1 -1
  199. package/src/sap/ui/rta/util/validateText.js +1 -1
  200. package/src/sap/ui/rta/util/whatsNew/WhatsNew.js +8 -4
  201. package/src/sap/ui/rta/util/whatsNew/WhatsNewDialog.fragment.xml +1 -1
  202. package/src/sap/ui/rta/util/whatsNew/WhatsNewOverview.js +1 -1
  203. package/src/sap/ui/rta/util/whatsNew/WhatsNewUtils.js +1 -1
  204. package/src/sap/ui/rta/util/whatsNew/whatsNewContent/WhatsNewFeatures.js +85 -1
  205. package/src/sap/ui/rta/util/whatsNew/whatsNewContent/whatsNewImages/ChangeLabelsAction.png +0 -0
  206. package/src/sap/ui/rta/util/whatsNew/whatsNewContent/whatsNewImages/DisplayBehavior.png +0 -0
  207. package/src/sap/ui/rta/util/whatsNew/whatsNewContent/whatsNewImages/ExtendedActions.png +0 -0
  208. package/src/sap/ui/rta/util/whatsNew/whatsNewContent/whatsNewImages/GuidedTour.png +0 -0
  209. package/src/sap/ui/rta/util/whatsNew/whatsNewContent/whatsNewImages/ReloadButtonToolbar.png +0 -0
  210. package/src/sap/ui/rta/util/whatsNew/whatsNewContent/whatsNewImages/RenameDialog.png +0 -0
  211. package/ui5.yaml +1 -1
  212. package/.reuse/dep5 +0 -471
  213. package/src/sap/ui/rta/plugin/RenameHandler.js +0 -477
@@ -1,477 +0,0 @@
1
- /*!
2
- * OpenUI5
3
- * (c) Copyright 2009-2025 SAP SE or an SAP affiliate company.
4
- * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
5
- */
6
-
7
- // Provides class sap.ui.rta.plugin.RenameHandler.
8
- sap.ui.define([
9
- "sap/ui/thirdparty/jquery",
10
- "sap/ui/Device",
11
- "sap/ui/core/Element",
12
- "sap/ui/core/EventBus",
13
- "sap/ui/rta/plugin/Plugin",
14
- "sap/ui/rta/util/validateText",
15
- "sap/ui/dt/Overlay",
16
- "sap/ui/dt/ElementUtil",
17
- "sap/ui/dt/OverlayRegistry",
18
- "sap/ui/rta/Utils",
19
- "sap/ui/dt/DOMUtil",
20
- "sap/ui/events/KeyCodes",
21
- "sap/ui/dt/OverlayUtil"
22
- ], function(
23
- jQuery,
24
- Device,
25
- Element,
26
- EventBus,
27
- Plugin,
28
- validateText,
29
- Overlay,
30
- ElementUtil,
31
- OverlayRegistry,
32
- Utils,
33
- DOMUtil,
34
- KeyCodes,
35
- OverlayUtil
36
- ) {
37
- "use strict";
38
-
39
- // this key is used as replacement for an empty string to not break anything. It's the same as &nbsp (no-break space)
40
- var sEmptyTextKey = "\xa0";
41
-
42
- /**
43
- * Provides Rename handling functionality
44
- *
45
- * @author SAP SE
46
- * @version 1.135.0
47
- *
48
- * @constructor
49
- * @private
50
- * @since 1.52
51
- * @alias sap.ui.rta.plugin.RenameHandler
52
- */
53
-
54
- var RenameHandler = {
55
-
56
- errorStyleClass: "sapUiRtaErrorBg",
57
-
58
- /**
59
- * @override
60
- */
61
- async _manageClickEvent(vEventOrElement) {
62
- const oOverlay = vEventOrElement.getSource ? vEventOrElement.getSource() : vEventOrElement;
63
- const oResponsibleElementOverlay = this.getResponsibleElementOverlay(oOverlay) || oOverlay;
64
- if (this._isEditableByPlugin(oResponsibleElementOverlay) === undefined) {
65
- // The responsibleElement editableByPlugin state was not evaluated yet e.g. because it
66
- // has no visible geometry, thus evaluateEditable now
67
- // This async check leads to a slight delay where the second click is not registered
68
- // which shouldn't be a problem since a human user needs > 100ms to click twice
69
- await this.evaluateEditable([oResponsibleElementOverlay], { onRegistration: false });
70
- }
71
- if (
72
- oOverlay.isSelected()
73
- && this.isRenameAvailable(oOverlay)
74
- && this.isRenameAvailable(oResponsibleElementOverlay)
75
- && this.isRenameEnabled([oOverlay])
76
- ) {
77
- oOverlay.attachBrowserEvent("click", RenameHandler._onClick, this);
78
- }
79
- },
80
-
81
- _setEditableFieldPosition() {
82
- if (this._oEditableField) {
83
- jQuery(this._oEditableField).offset({left: DOMUtil.getOffset(this._oEditableControlDomRef).left});
84
- jQuery(this._oEditableField).offset({top: DOMUtil.getOffset(this._oEditableControlDomRef).top});
85
- this._oEditedOverlay.setSelected(true);
86
- this._oEditableField.focus();
87
- }
88
- },
89
-
90
- /**
91
- * @param {map} mPropertyBag - (required) contains required properties
92
- * @public
93
- */
94
- startEdit(mPropertyBag) {
95
- if (this.getBusy()) {
96
- return;
97
- }
98
- this.setBusy(true);
99
- this._oEditedOverlay = mPropertyBag.overlay;
100
-
101
- this._bPreviouslyMovable = this._oEditedOverlay.getMovable();
102
- // This prevents a bug in firefox where the element can be dragged during rename
103
- this._oEditedOverlay.setMovable(false);
104
- OverlayUtil.setFirstParentMovable(this._oEditedOverlay, false);
105
-
106
- var oElement = mPropertyBag.overlay.getElement();
107
-
108
- var oDesignTimeMetadata = this._oEditedOverlay.getDesignTimeMetadata();
109
-
110
- var oEditableControlDomRef = oDesignTimeMetadata.getAssociatedDomRef(oElement, mPropertyBag.domRef);
111
-
112
- // if the Control is currently not visible on the screen, we have to scroll it into view
113
- if (!DOMUtil.isElementInViewport(oEditableControlDomRef)) {
114
- oEditableControlDomRef.scrollIntoView();
115
- }
116
-
117
- this._oEditableControlDomRef = oEditableControlDomRef; /* Text Control */
118
- var mMutators = typeof mPropertyBag.getTextMutators === "function"
119
- ? mPropertyBag.getTextMutators(oElement)
120
- : {
121
- getText: function() {
122
- return this._oEditableControlDomRef.textContent;
123
- }.bind(this),
124
- setText: function(sNewText) {
125
- this._oEditableControlDomRef.textContent = sNewText;
126
- }.bind(this)
127
- };
128
- this._fnGetControlText = mMutators.getText;
129
- this._fnSetControlText = mMutators.setText;
130
- var iWidthDifference = 0;
131
-
132
- // case where the editable control has it's own overlay
133
- var oOverlayForWrapper = OverlayRegistry.getOverlay(oEditableControlDomRef.id);
134
-
135
- // if the editable control overlay could not be found, then the passed overlay should be considered
136
- // for this purpose the width of the editable control should be adjusted
137
- if (!oOverlayForWrapper) {
138
- oOverlayForWrapper = this._oEditedOverlay;
139
- var _oControlForWrapperDomRef = ElementUtil.getDomRef(oElement); /* Main Control */
140
- var _oEditableControlParentDomRef = this._oEditableControlDomRef.parentNode; /* Text Control parent */
141
- var iControlForWrapperWidth = _oControlForWrapperDomRef ? parseInt(_oControlForWrapperDomRef.offsetWidth) : "NaN"; /* Main Control Width */
142
-
143
- if (!isNaN(iControlForWrapperWidth)) {
144
- var iEditableControlWidth = parseInt(this._oEditableControlDomRef.offsetWidth);
145
- var iEditableControlParentWidth = parseInt(_oEditableControlParentDomRef.offsetWidth);
146
- iWidthDifference = iControlForWrapperWidth - iEditableControlWidth;
147
-
148
- var aCHildren = Array.from(_oEditableControlParentDomRef.children);
149
- var aVisibleChildren = aCHildren.filter(function(oNode) {
150
- return DOMUtil.isVisible(oNode);
151
- });
152
-
153
- if (iWidthDifference < 0 && iEditableControlParentWidth) {
154
- if (_oEditableControlParentDomRef.id !== _oControlForWrapperDomRef.id
155
- && aVisibleChildren.length === 1
156
- && aVisibleChildren[0].id === this._oEditableControlDomRef.id
157
- && iControlForWrapperWidth > iEditableControlParentWidth) {
158
- iWidthDifference = iControlForWrapperWidth - iEditableControlParentWidth;
159
- } else {
160
- iWidthDifference = 0;
161
- }
162
- }
163
- }
164
- }
165
-
166
- var _oWrapperDomRef = document.createElement("div");
167
- _oWrapperDomRef.classList.add("sapUiRtaEditableField");
168
- _oWrapperDomRef.style.whiteSpace = "nowrap";
169
- _oWrapperDomRef.style.overflow = "hidden";
170
- _oWrapperDomRef.style.width = `calc(100% - (${iWidthDifference}px))`;
171
- oOverlayForWrapper.getDomRef().append(_oWrapperDomRef);
172
- var _oEditableFieldDomRef = document.createElement("div");
173
- _oEditableFieldDomRef.setAttribute("contentEditable", "true");
174
- _oWrapperDomRef.append(_oEditableFieldDomRef);
175
- this._oEditableField = _oEditableFieldDomRef;
176
-
177
- // if label is empty, set a preliminary dummy text at the control to get an overlay
178
- var sCurrentText = this._fnGetControlText();
179
- if (sCurrentText === "") {
180
- this._fnSetControlText("_?_");
181
- this._oEditableField.textContent = "";
182
- } else {
183
- this._oEditableField.textContent = sCurrentText;
184
- }
185
-
186
- this.setOldValue(RenameHandler._getCurrentEditableFieldText.call(this));
187
-
188
- DOMUtil.copyComputedStyle(this._oEditableControlDomRef, this._oEditableField);
189
- while (this._oEditableField.lastElementChild) {
190
- this._oEditableField.removeChild(this._oEditableField.lastElementChild);
191
- }
192
-
193
- this._oEditableField.style.visibility = "hidden";
194
- this._oEditableField.style["-moz-user-modify"] = "read-write";
195
- this._oEditableField.style["-webkit-user-modify"] = "read-write";
196
- this._oEditableField.style["-ms-user-modify"] = "read-write";
197
- this._oEditableField.style["user-modify"] = "read-write";
198
- this._oEditableField.style.userSelect = "text";
199
- this._oEditableField.style["-webkit-user-select"] = "text";
200
- this._oEditableField.style.textOverflow = "clip";
201
- this._oEditableField.style.whiteSpace = "nowrap";
202
-
203
- // only for renaming variants in edge browser [SPECIAL CASE]
204
- if (
205
- Device.browser.name === "ed"
206
- && oElement.getMetadata().getName() === "sap.ui.fl.variants.VariantManagement"
207
- ) {
208
- this._oEditableField.style.lineHeight = "normal";
209
- }
210
-
211
- Overlay.getMutationObserver().ignoreOnce({
212
- target: this._oEditableControlDomRef
213
- });
214
-
215
- this._FocusHandler = RenameHandler._onEditableFieldFocus.bind(this);
216
- this._oBlurHandler = RenameHandler._onEditableFieldBlur.bind(this);
217
- this._oKeyDownHandler = RenameHandler._onEditableFieldKeydown.bind(this);
218
- this._oStopPropagationHandler = RenameHandler._stopPropagation.bind(this);
219
-
220
- this._oEditableField.addEventListener("focus", this._FocusHandler, {once: true});
221
- this._oEditableField.addEventListener("blur", this._oBlurHandler);
222
- this._oEditableField.addEventListener("keydown", this._oKeyDownHandler);
223
- this._oEditableField.addEventListener("dragstart", this._oStopPropagationHandler);
224
- this._oEditableField.addEventListener("drag", this._oStopPropagationHandler);
225
- this._oEditableField.addEventListener("dragend", this._oStopPropagationHandler);
226
- this._oEditableField.addEventListener("click", this._oStopPropagationHandler);
227
- this._oEditableField.addEventListener("mousedown", this._oStopPropagationHandler);
228
-
229
- this._oEditableControlDomRef.style.visibility = "hidden";
230
- jQuery(_oWrapperDomRef).offset({left: DOMUtil.getOffset(this._oEditableControlDomRef).left});
231
- RenameHandler._setEditableFieldPosition.apply(this);
232
- this._oEditableField.style.visibility = "";
233
-
234
- // If scrolling happens during startEdit, the position of the editable field can be wrong
235
- // To avoid this, the position is recalculated after the scrollbar synchronization is ready
236
- this._aOverlaysWithScrollbar = OverlayUtil.findParentOverlaysWithScrollbar(oOverlayForWrapper);
237
- this._aOverlaysWithScrollbar.forEach(function(oOverlayWithScrollbar) {
238
- oOverlayWithScrollbar.attachScrollSynced(RenameHandler._setEditableFieldPosition, this);
239
- }.bind(this));
240
-
241
- // The focus can trigger an immediate blur event (e.g. when the "discard draft" pop-up is opened),
242
- // therefore the entire editable field preparation has to be finalized before the focus is set.
243
- this._oEditableField.focus();
244
-
245
- // keep Overlay selected while renaming
246
- mPropertyBag.overlay.setSelected(true);
247
- EventBus.getInstance().publish("sap.ui.rta", mPropertyBag.pluginMethodName, {
248
- overlay: mPropertyBag.overlay,
249
- editableField: this._oEditableField
250
- });
251
- },
252
-
253
- _setDesignTime(...aArgs) {
254
- const [oDesignTime] = aArgs;
255
- this._aSelection = [];
256
- var oOldDesignTime = this.getDesignTime();
257
-
258
- if (oOldDesignTime) {
259
- oOldDesignTime.getSelectionManager().detachChange(RenameHandler._onDesignTimeSelectionChange, this);
260
- }
261
- Plugin.prototype.setDesignTime.apply(this, aArgs);
262
-
263
- if (oDesignTime) {
264
- oDesignTime.getSelectionManager().attachChange(RenameHandler._onDesignTimeSelectionChange, this);
265
- this._aSelection = this.getSelectedOverlays();
266
- }
267
- },
268
-
269
- /**
270
- * @override
271
- */
272
- _onDesignTimeSelectionChange(oEvent) {
273
- var aSelection = oEvent.getParameter("selection");
274
-
275
- // detach events from previous selection
276
- this._aSelection.forEach((vSelection) => {
277
- const oOverlay = vSelection.getSource ? vSelection.getSource() : vSelection;
278
- oOverlay.detachBrowserEvent("click", RenameHandler._onClick, this);
279
- });
280
- // attach events to the new selection
281
- aSelection.forEach(RenameHandler._manageClickEvent, this);
282
-
283
- this._aSelection = aSelection;
284
- },
285
-
286
- /**
287
- * @param {sap.ui.base.Event} oEvent - event object
288
- * @private
289
- */
290
- _stopPropagation(oEvent) {
291
- oEvent.stopPropagation();
292
- },
293
-
294
- /**
295
- * @param {sap.ui.base.Event} oEvent - event object
296
- * @private
297
- */
298
- _preventDefault(oEvent) {
299
- oEvent.preventDefault();
300
- },
301
-
302
- /**
303
- * @param {sap.ui.base.Event} oEvent - event object
304
- * @private
305
- */
306
- _onEditableFieldFocus(oEvent) {
307
- var el = oEvent.target;
308
- var range = document.createRange();
309
- range.selectNodeContents(el);
310
- var sel = window.getSelection();
311
- sel.removeAllRanges();
312
- sel.addRange(range);
313
- },
314
-
315
- /**
316
- * @param {boolean} bRestoreFocus - true if the focus should be restored on overlay after rename
317
- * @param {string} sPluginMethodName - method name of the plugin
318
- * @private
319
- */
320
- _stopEdit(bRestoreFocus, sPluginMethodName) {
321
- var oOverlay;
322
- this.setBusy(false);
323
- this._oEditableField.removeEventListener("blur", this._oBlurHandler);
324
- this._oEditableField.removeEventListener("focus", this._FocusHandler);
325
- this._oEditableField.removeEventListener("keydown", this._oKeyDownHandler);
326
- this._oEditableField.removeEventListener("dragstart", this._oStopPropagationHandler);
327
- this._oEditableField.removeEventListener("drag", this._oStopPropagationHandler);
328
- this._oEditableField.removeEventListener("dragend", this._oStopPropagationHandler);
329
- this._oEditableField.removeEventListener("click", this._oStopPropagationHandler);
330
- this._oEditableField.removeEventListener("mousedown", this._oStopPropagationHandler);
331
-
332
- // exchange the dummy text at the label with the genuine empty text (see start_edit function)
333
- if (this._fnGetControlText() === "_?_") {
334
- this._fnSetControlText("");
335
- }
336
-
337
- Overlay.getMutationObserver().ignoreOnce({
338
- target: this._oEditableControlDomRef
339
- });
340
- this._oEditableControlDomRef.style.visibility = "visible";
341
-
342
- if (bRestoreFocus) {
343
- oOverlay = this._oEditedOverlay;
344
- oOverlay.setSelected(true);
345
- oOverlay.focus();
346
- }
347
-
348
- this._aOverlaysWithScrollbar.forEach(function(oOverlayWithScrollbar) {
349
- oOverlayWithScrollbar.detachScrollSynced(RenameHandler._setEditableFieldPosition, this);
350
- }.bind(this));
351
- delete this._oEditableField;
352
- var oEditField = this._oEditedOverlay.getDomRef() && this._oEditedOverlay.getDomRef().querySelector(".sapUiRtaEditableField");
353
- if (oEditField) {
354
- oEditField.remove();
355
- }
356
- this._oEditedOverlay.setMovable(this._bPreviouslyMovable);
357
- OverlayUtil.setFirstParentMovable(this._oEditedOverlay, true);
358
- delete this._oEditableControlDomRef;
359
- delete this._oEditedOverlay;
360
- delete this._bBlurOrKeyDownStarted;
361
- delete this._fnGetControlText;
362
- delete this._fnSetControlText;
363
-
364
- EventBus.getInstance().publish("sap.ui.rta", sPluginMethodName, {
365
- overlay: oOverlay
366
- });
367
- },
368
-
369
- _onEditableFieldBlur(oEvent) {
370
- // Destroying the overlay (or removing it from a parent) also triggers a "blur" event
371
- // coming from the remove() call, but we should not react on it
372
- if (!this._oEditedOverlay.isDestroyStarted() && this._oEditedOverlay.getParentElementOverlay()) {
373
- RenameHandler._handlePostRename.call(this, false, oEvent);
374
- }
375
- },
376
-
377
- async _handlePostRename(bRestoreFocus, oEvent) {
378
- let fnErrorHandler;
379
- if (!this._bBlurOrKeyDownStarted) {
380
- this._oEditedOverlay.removeStyleClass(RenameHandler.errorStyleClass);
381
- this._bBlurOrKeyDownStarted = true;
382
- if (oEvent) {
383
- RenameHandler._preventDefault.call(this, oEvent);
384
- RenameHandler._stopPropagation.call(this, oEvent);
385
- }
386
- try {
387
- try {
388
- RenameHandler._validateNewText.call(this);
389
- fnErrorHandler = await this._emitLabelChangeEvent();
390
- } catch (oError) {
391
- if (oError.message !== "sameTextError") {
392
- throw oError;
393
- }
394
- }
395
- this.stopEdit(bRestoreFocus);
396
- // ControlVariant rename handles the validation itself
397
- if (typeof fnErrorHandler === "function") {
398
- fnErrorHandler(); // contains startEdit()
399
- }
400
- } catch (oError) {
401
- await RenameHandler._handleInvalidRename.call(this, oError.message, bRestoreFocus);
402
- }
403
- }
404
- },
405
-
406
- _handleInvalidRename(sErrorMessage, bRestoreFocus) {
407
- return Utils.showMessageBox("error", sErrorMessage, {
408
- titleKey: "RENAME_ERROR_TITLE"
409
- })
410
- .then(function() {
411
- var oOverlay = this._oEditedOverlay;
412
- oOverlay.setIgnoreEnterKeyUpOnce(false);
413
- oOverlay.addStyleClass(RenameHandler.errorStyleClass);
414
- this.stopEdit(bRestoreFocus);
415
- this.startEdit(oOverlay);
416
- }.bind(this));
417
- },
418
-
419
- _validateNewText() {
420
- var oResponsibleOverlay = this.getResponsibleElementOverlay(this._oEditedOverlay);
421
- var oRenameAction = this.getAction(oResponsibleOverlay);
422
- var sNewText = RenameHandler._getCurrentEditableFieldText.call(this);
423
- validateText(sNewText, this.getOldValue(), oRenameAction);
424
- },
425
-
426
- _onEditableFieldKeydown(oEvent) {
427
- switch (oEvent.keyCode) {
428
- case KeyCodes.ENTER:
429
- // to prevent context menu from opening when rename is finished
430
- this._oEditedOverlay.setIgnoreEnterKeyUpOnce(true);
431
- return RenameHandler._handlePostRename.call(this, true, oEvent);
432
- case KeyCodes.ESCAPE:
433
- this._oEditedOverlay.removeStyleClass(RenameHandler.errorStyleClass);
434
- this.stopEdit(true);
435
- RenameHandler._preventDefault.call(this, oEvent);
436
- break;
437
- case KeyCodes.DELETE:
438
- case KeyCodes.BACKSPACE:
439
- // Incident IDs: #1680315103, #2380033173
440
- RenameHandler._stopPropagation.call(this, oEvent);
441
- break;
442
- default:
443
- }
444
- return Promise.resolve();
445
- },
446
-
447
- /**
448
- * @returns {string} current editable field text
449
- * @private
450
- */
451
- _getCurrentEditableFieldText() {
452
- // Rename to empty string should not be possible
453
- // to prevent issues with disappearing elements
454
- var sText = this._oEditableField ? this._oEditableField.textContent.trim() : "";
455
- return sText === "" ? sEmptyTextKey : sText;
456
- },
457
-
458
- /**
459
- * @param {sap.ui.base.Event} oEvent - event object
460
- * @private
461
- */
462
- _onClick(oEvent) {
463
- var oOverlay = Element.getElementById(oEvent.currentTarget.id);
464
- if (this.isRenameEnabled([oOverlay]) && !oEvent.metaKey && !oEvent.ctrlKey && !oEvent.shiftKey) {
465
- this.startEdit(oOverlay);
466
- RenameHandler._preventDefault.call(this, oEvent);
467
- }
468
- },
469
-
470
- _exit() {
471
- if (this._oEditableControlDomRef) {
472
- this.stopEdit(false);
473
- }
474
- }
475
- };
476
- return RenameHandler;
477
- });