@openui5/sap.ui.rta 1.145.0 → 1.146.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.
- package/THIRDPARTY.txt +7 -7
- package/package.json +6 -6
- package/src/sap/ui/rta/.library +1 -1
- package/src/sap/ui/rta/Client.js +1 -1
- package/src/sap/ui/rta/RuntimeAuthoring.js +18 -1
- package/src/sap/ui/rta/Utils.js +1 -1
- package/src/sap/ui/rta/appVariant/AppVariantManager.js +1 -1
- package/src/sap/ui/rta/command/AddIFrame.js +1 -1
- package/src/sap/ui/rta/command/AddProperty.js +1 -1
- package/src/sap/ui/rta/command/AddXML.js +1 -1
- package/src/sap/ui/rta/command/AddXMLAtExtensionPoint.js +1 -1
- package/src/sap/ui/rta/command/AnnotationCommand.js +1 -1
- package/src/sap/ui/rta/command/BaseCommand.js +1 -1
- package/src/sap/ui/rta/command/BindProperty.js +1 -1
- package/src/sap/ui/rta/command/Combine.js +1 -1
- package/src/sap/ui/rta/command/CommandFactory.js +1 -1
- package/src/sap/ui/rta/command/CompositeCommand.js +1 -1
- package/src/sap/ui/rta/command/ControlVariantConfigure.js +1 -1
- package/src/sap/ui/rta/command/ControlVariantSave.js +1 -1
- package/src/sap/ui/rta/command/ControlVariantSaveAs.js +1 -1
- package/src/sap/ui/rta/command/ControlVariantSetTitle.js +1 -1
- package/src/sap/ui/rta/command/ControlVariantSwitch.js +1 -1
- package/src/sap/ui/rta/command/CreateContainer.js +1 -1
- package/src/sap/ui/rta/command/CustomAdd.js +1 -1
- package/src/sap/ui/rta/command/ExtendControllerCommand.js +1 -1
- package/src/sap/ui/rta/command/FlexCommand.js +1 -1
- package/src/sap/ui/rta/command/LREPSerializer.js +1 -1
- package/src/sap/ui/rta/command/LocalReset.js +1 -1
- package/src/sap/ui/rta/command/ManifestCommand.js +1 -1
- package/src/sap/ui/rta/command/Move.js +1 -1
- package/src/sap/ui/rta/command/Property.js +1 -1
- package/src/sap/ui/rta/command/Remove.js +1 -1
- package/src/sap/ui/rta/command/Rename.js +1 -1
- package/src/sap/ui/rta/command/Resize.js +1 -1
- package/src/sap/ui/rta/command/Reveal.js +1 -1
- package/src/sap/ui/rta/command/Settings.js +1 -1
- package/src/sap/ui/rta/command/Split.js +1 -1
- package/src/sap/ui/rta/command/Stack.js +1 -1
- package/src/sap/ui/rta/command/compVariant/CompVariantContent.js +1 -1
- package/src/sap/ui/rta/command/compVariant/CompVariantSaveAs.js +1 -1
- package/src/sap/ui/rta/command/compVariant/CompVariantSwitch.js +1 -1
- package/src/sap/ui/rta/command/compVariant/CompVariantUpdate.js +1 -1
- package/src/sap/ui/rta/command/manifest/AddLibrary.js +1 -1
- package/src/sap/ui/rta/enablement/elementActionTest.js +1 -1
- package/src/sap/ui/rta/library.js +2 -2
- package/src/sap/ui/rta/messagebundle.properties +5 -3
- package/src/sap/ui/rta/messagebundle_ar.properties +3 -3
- package/src/sap/ui/rta/messagebundle_bg.properties +3 -3
- package/src/sap/ui/rta/messagebundle_ca.properties +3 -3
- package/src/sap/ui/rta/messagebundle_cnr.properties +3 -3
- package/src/sap/ui/rta/messagebundle_cs.properties +2 -2
- package/src/sap/ui/rta/messagebundle_cy.properties +3 -3
- package/src/sap/ui/rta/messagebundle_da.properties +3 -3
- package/src/sap/ui/rta/messagebundle_de.properties +3 -3
- package/src/sap/ui/rta/messagebundle_el.properties +3 -3
- package/src/sap/ui/rta/messagebundle_en.properties +3 -3
- package/src/sap/ui/rta/messagebundle_en_GB.properties +3 -3
- package/src/sap/ui/rta/messagebundle_en_US_saprigi.properties +2 -1
- package/src/sap/ui/rta/messagebundle_es.properties +2 -2
- package/src/sap/ui/rta/messagebundle_es_MX.properties +3 -3
- package/src/sap/ui/rta/messagebundle_et.properties +3 -3
- package/src/sap/ui/rta/messagebundle_fi.properties +3 -3
- package/src/sap/ui/rta/messagebundle_fr.properties +3 -3
- package/src/sap/ui/rta/messagebundle_fr_CA.properties +3 -3
- package/src/sap/ui/rta/messagebundle_hi.properties +3 -3
- package/src/sap/ui/rta/messagebundle_hr.properties +3 -3
- package/src/sap/ui/rta/messagebundle_hu.properties +2 -2
- package/src/sap/ui/rta/messagebundle_id.properties +4 -4
- package/src/sap/ui/rta/messagebundle_it.properties +4 -4
- package/src/sap/ui/rta/messagebundle_iw.properties +3 -3
- package/src/sap/ui/rta/messagebundle_ja.properties +3 -3
- package/src/sap/ui/rta/messagebundle_kk.properties +3 -3
- package/src/sap/ui/rta/messagebundle_ko.properties +3 -3
- package/src/sap/ui/rta/messagebundle_lt.properties +3 -3
- package/src/sap/ui/rta/messagebundle_lv.properties +3 -3
- package/src/sap/ui/rta/messagebundle_mk.properties +3 -3
- package/src/sap/ui/rta/messagebundle_ms.properties +3 -3
- package/src/sap/ui/rta/messagebundle_nl.properties +3 -3
- package/src/sap/ui/rta/messagebundle_no.properties +4 -4
- package/src/sap/ui/rta/messagebundle_pl.properties +3 -3
- package/src/sap/ui/rta/messagebundle_pt.properties +3 -3
- package/src/sap/ui/rta/messagebundle_pt_PT.properties +3 -3
- package/src/sap/ui/rta/messagebundle_ro.properties +3 -3
- package/src/sap/ui/rta/messagebundle_ru.properties +5 -5
- package/src/sap/ui/rta/messagebundle_sh.properties +3 -3
- package/src/sap/ui/rta/messagebundle_sk.properties +3 -3
- package/src/sap/ui/rta/messagebundle_sl.properties +3 -3
- package/src/sap/ui/rta/messagebundle_sr.properties +3 -3
- package/src/sap/ui/rta/messagebundle_sv.properties +3 -3
- package/src/sap/ui/rta/messagebundle_th.properties +3 -3
- package/src/sap/ui/rta/messagebundle_tr.properties +3 -3
- package/src/sap/ui/rta/messagebundle_uk.properties +3 -3
- package/src/sap/ui/rta/messagebundle_vi.properties +3 -3
- package/src/sap/ui/rta/messagebundle_zh_CN.properties +3 -3
- package/src/sap/ui/rta/messagebundle_zh_TW.properties +3 -3
- package/src/sap/ui/rta/plugin/AddXMLAtExtensionPoint.js +1 -1
- package/src/sap/ui/rta/plugin/AddXMLPlugin.js +1 -1
- package/src/sap/ui/rta/plugin/BaseCreate.js +1 -1
- package/src/sap/ui/rta/plugin/Combine.js +1 -1
- package/src/sap/ui/rta/plugin/ControlVariant.js +1 -1
- package/src/sap/ui/rta/plugin/CreateContainer.js +1 -1
- package/src/sap/ui/rta/plugin/CutPaste.js +1 -1
- package/src/sap/ui/rta/plugin/DragDrop.js +1 -1
- package/src/sap/ui/rta/plugin/ExtendControllerPlugin.js +1 -1
- package/src/sap/ui/rta/plugin/LocalReset.js +1 -1
- package/src/sap/ui/rta/plugin/Plugin.js +1 -1
- package/src/sap/ui/rta/plugin/RTAElementMover.js +1 -1
- package/src/sap/ui/rta/plugin/Remove.js +1 -1
- package/src/sap/ui/rta/plugin/Resize.js +1 -1
- package/src/sap/ui/rta/plugin/Selection.js +1 -1
- package/src/sap/ui/rta/plugin/Settings.js +1 -1
- package/src/sap/ui/rta/plugin/Split.js +1 -1
- package/src/sap/ui/rta/plugin/Stretch.js +1 -1
- package/src/sap/ui/rta/plugin/additionalElements/ActionExtractor.js +1 -1
- package/src/sap/ui/rta/plugin/additionalElements/AddElementsDialog.fragment.xml +2 -0
- package/src/sap/ui/rta/plugin/additionalElements/AddElementsDialog.js +1 -1
- package/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsPlugin.js +1 -1
- package/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsUtils.js +1 -1
- package/src/sap/ui/rta/plugin/additionalElements/CommandBuilder.js +1 -1
- package/src/sap/ui/rta/plugin/annotations/AnnotationChangeDialog.js +1 -1
- package/src/sap/ui/rta/plugin/annotations/AnnotationChangeDialogController.js +1 -1
- package/src/sap/ui/rta/plugin/annotations/AnnotationPlugin.js +1 -1
- package/src/sap/ui/rta/plugin/iframe/AddIFrame.js +1 -1
- package/src/sap/ui/rta/plugin/iframe/AddIFrameDialog.fragment.xml +12 -91
- package/src/sap/ui/rta/plugin/iframe/AddIFrameDialog.js +15 -3
- package/src/sap/ui/rta/plugin/iframe/AddIFrameDialogController.js +257 -89
- package/src/sap/ui/rta/plugin/rename/Rename.js +1 -1
- package/src/sap/ui/rta/plugin/rename/RenameDialog.fragment.xml +1 -0
- package/src/sap/ui/rta/plugin/rename/RenameDialog.js +1 -1
- package/src/sap/ui/rta/service/Action.js +1 -1
- package/src/sap/ui/rta/service/ControllerExtension.js +1 -1
- package/src/sap/ui/rta/service/Outline.js +1 -1
- package/src/sap/ui/rta/service/Property.js +1 -1
- package/src/sap/ui/rta/service/Selection.js +1 -1
- package/src/sap/ui/rta/service/SupportTools.js +1 -1
- package/src/sap/ui/rta/themes/base/ContextMenu.less +1 -1
- package/src/sap/ui/rta/toolbar/Adaptation.fragment.xml +9 -4
- package/src/sap/ui/rta/toolbar/Adaptation.js +54 -2
- package/src/sap/ui/rta/toolbar/AdaptationRenderer.js +7 -9
- package/src/sap/ui/rta/toolbar/Base.js +1 -1
- package/src/sap/ui/rta/toolbar/BaseRenderer.js +12 -17
- package/src/sap/ui/rta/toolbar/Fiori.js +5 -1
- package/src/sap/ui/rta/toolbar/FioriLike.js +1 -1
- package/src/sap/ui/rta/toolbar/OverflowToolbarButton.js +1 -1
- package/src/sap/ui/rta/toolbar/Standalone.js +1 -1
- package/src/sap/ui/rta/toolbar/contextBased/SaveAsAdaptation.js +1 -1
- package/src/sap/ui/rta/toolbar/translation/Translation.js +1 -1
- package/src/sap/ui/rta/toolbar/versioning/Versioning.js +1 -1
- package/src/sap/ui/rta/util/PluginManager.js +1 -1
- package/src/sap/ui/rta/util/PopupManager.js +1 -1
- package/src/sap/ui/rta/util/ReloadManager.js +15 -12
- package/src/sap/ui/rta/util/ServiceEventBus.js +1 -1
- package/src/sap/ui/rta/util/ServiceManager.js +1 -1
- package/src/sap/ui/rta/util/changeVisualization/ChangeIndicator.js +1 -1
- package/src/sap/ui/rta/util/changeVisualization/ChangeIndicatorRegistry.js +1 -1
- package/src/sap/ui/rta/util/changeVisualization/ChangeVisualization.js +1 -1
- package/src/sap/ui/rta/util/changeVisualization/resolveBinding.js +1 -1
- package/src/sap/ui/rta/util/guidedTour/GuidedTour.js +3 -1
- package/src/sap/ui/rta/util/whatsNew/WhatsNew.js +1 -1
- package/src/sap/ui/rta/util/whatsNew/whatsNewContent/whatsNewImages/ExtendedActions.png +0 -0
|
@@ -6,7 +6,12 @@
|
|
|
6
6
|
sap.ui.define([
|
|
7
7
|
"sap/base/util/Deferred",
|
|
8
8
|
"sap/base/Log",
|
|
9
|
+
"sap/m/HBox",
|
|
10
|
+
"sap/m/Label",
|
|
11
|
+
"sap/m/MultiInput",
|
|
12
|
+
"sap/m/Switch",
|
|
9
13
|
"sap/m/Token",
|
|
14
|
+
"sap/m/VBox",
|
|
10
15
|
"sap/ui/core/mvc/Controller",
|
|
11
16
|
"sap/ui/core/Element",
|
|
12
17
|
"sap/ui/core/Lib",
|
|
@@ -19,7 +24,12 @@ sap.ui.define([
|
|
|
19
24
|
], function(
|
|
20
25
|
Deferred,
|
|
21
26
|
Log,
|
|
27
|
+
HBox,
|
|
28
|
+
Label,
|
|
29
|
+
MultiInput,
|
|
30
|
+
Switch,
|
|
22
31
|
Token,
|
|
32
|
+
VBox,
|
|
23
33
|
Controller,
|
|
24
34
|
Element,
|
|
25
35
|
Lib,
|
|
@@ -33,13 +43,14 @@ sap.ui.define([
|
|
|
33
43
|
"use strict";
|
|
34
44
|
|
|
35
45
|
// shortcut for sap.ui.core.ValueState
|
|
36
|
-
|
|
46
|
+
const { ValueState } = coreLibrary;
|
|
37
47
|
|
|
38
48
|
const _oTextResources = Lib.getResourceBundleFor("sap.ui.rta");
|
|
39
49
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
50
|
+
const _aTextInputFields = ["frameUrl", "title"];
|
|
51
|
+
const _aNumericInputFields = ["frameWidth", "frameHeight"];
|
|
52
|
+
const _aUnitInputFields = ["frameWidthUnit", "frameHeightUnit"];
|
|
53
|
+
const _aAllConfigFields = _aTextInputFields.concat(_aNumericInputFields, _aUnitInputFields, ["advancedSettings"]);
|
|
43
54
|
|
|
44
55
|
function isValidUrl(sUrl) {
|
|
45
56
|
if (
|
|
@@ -67,6 +78,17 @@ sap.ui.define([
|
|
|
67
78
|
oIFramePreview.setProperty(sIFramePropertyName, sValue + sUnit);
|
|
68
79
|
}
|
|
69
80
|
|
|
81
|
+
function setURLErrorMessage(sError) {
|
|
82
|
+
const sErrorKey = {
|
|
83
|
+
[IFrame.VALIDATION_ERROR.UNSAFE_PROTOCOL]: "IFRAME_ADDIFRAME_ERROR_UNSAFE_PROTOCOL",
|
|
84
|
+
[IFrame.VALIDATION_ERROR.MIXED_CONTENT]: "IFRAME_ADDIFRAME_ERROR_MIXED_CONTENT",
|
|
85
|
+
[IFrame.VALIDATION_ERROR.FORBIDDEN_URL]: "IFRAME_ADDIFRAME_ERROR_FORBIDDEN_URL",
|
|
86
|
+
[IFrame.VALIDATION_ERROR.INVALID_URL]: "IFRAME_ADDIFRAME_ERROR_INVALID_URL"
|
|
87
|
+
}[sError];
|
|
88
|
+
const sErrorText = _oTextResources.getText(sErrorKey);
|
|
89
|
+
this._oJSONModel.setProperty("/frameUrlError/value", sErrorText);
|
|
90
|
+
}
|
|
91
|
+
|
|
70
92
|
return Controller.extend("sap.ui.rta.plugin.iframe.AddIFrameDialogController", {
|
|
71
93
|
constructor: function(oJSONModel, mSettings) {
|
|
72
94
|
this._oJSONModel = oJSONModel;
|
|
@@ -75,17 +97,84 @@ sap.ui.define([
|
|
|
75
97
|
|
|
76
98
|
onBeforeOpen() {
|
|
77
99
|
this._oJSONModel.setProperty("/initialFrameUrl/value", this._oJSONModel.getProperty("/frameUrl/value"));
|
|
100
|
+
this._storeInitialConfiguration();
|
|
78
101
|
// Configure the MultiInput field
|
|
79
102
|
// This syntax is the suggested way by the UI5 documentation to trigger a submit on the input field on focus loss
|
|
80
103
|
const oMultiInput = Element.getElementById("sapUiRtaAddIFrameDialog_AddAdditionalParametersInput");
|
|
81
104
|
oMultiInput.addValidator(multiInputValidator);
|
|
82
105
|
},
|
|
83
106
|
|
|
107
|
+
/**
|
|
108
|
+
* Factory function to create controls for advanced settings Grid content
|
|
109
|
+
* @param {string} sId - Generated ID for the control
|
|
110
|
+
* @param {sap.ui.model.Context} oContext - Binding context
|
|
111
|
+
* @returns {sap.ui.core.Control} Control (HBox with Switch or VBox with MultiInput)
|
|
112
|
+
*/
|
|
113
|
+
createAdvancedSettingsControl(sId, oContext) {
|
|
114
|
+
const oSetting = oContext.getObject();
|
|
115
|
+
|
|
116
|
+
// MultiInput for additional sandbox parameters
|
|
117
|
+
if (oSetting.isMultiInput) {
|
|
118
|
+
const oLabel = new Label("sapUiRtaAddIFrameDialog_AddAdditionalParametersLabel", {
|
|
119
|
+
text: "{i18n>IFRAME_ADDIFRAME_ADD_ADDITIONAL_SANDBOX_PARAMETERS_LABEL}",
|
|
120
|
+
labelFor: "sapUiRtaAddIFrameDialog_AddAdditionalParametersInput"
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
const oMultiInput = new MultiInput("sapUiRtaAddIFrameDialog_AddAdditionalParametersInput", {
|
|
124
|
+
placeholder: "{i18n>IFRAME_ADDIFRAME_ADD_ADDITIONAL_SANDBOX_PARAMETERS_PLACEHOLDER}",
|
|
125
|
+
showValueHelp: false,
|
|
126
|
+
tokenUpdate: this.onTokenUpdate.bind(this)
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
// Set up token binding programmatically
|
|
130
|
+
oMultiInput.bindAggregation("tokens", {
|
|
131
|
+
path: "dialogInfo>/advancedSettings/value/additionalSandboxParameters",
|
|
132
|
+
template: new Token({
|
|
133
|
+
text: "{dialogInfo>}",
|
|
134
|
+
key: "{dialogInfo>}"
|
|
135
|
+
}),
|
|
136
|
+
templateShareable: false
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
return new VBox(sId, {
|
|
140
|
+
items: [oLabel, oMultiInput]
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// Switch for boolean settings
|
|
145
|
+
const oSwitch = new Switch(`sapUiRtaAddIFrameDialog_${oSetting.key}Switch`, {
|
|
146
|
+
state: `{dialogInfo>/advancedSettings/value/${oSetting.key}}`,
|
|
147
|
+
customTextOn: " ",
|
|
148
|
+
customTextOff: " ",
|
|
149
|
+
change: this.onSwitchChange.bind(this)
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
const oLabel = new Label({
|
|
153
|
+
text: oSetting.label
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
return new HBox(sId, {
|
|
157
|
+
alignItems: "Center",
|
|
158
|
+
items: [oSwitch, oLabel]
|
|
159
|
+
});
|
|
160
|
+
},
|
|
161
|
+
|
|
84
162
|
onSwitchChange() {
|
|
85
|
-
this.
|
|
163
|
+
this._checkIfSaveIsEnabled(true);
|
|
86
164
|
this._oJSONModel.setProperty("/settingsUpdate/value", true);
|
|
87
165
|
},
|
|
88
166
|
|
|
167
|
+
/**
|
|
168
|
+
* Event handler for URL live change
|
|
169
|
+
* Enables the Save button immediately when content is typed
|
|
170
|
+
*/
|
|
171
|
+
onUrlLiveChange() {
|
|
172
|
+
// Clear any previous URL error to make typing user friendly
|
|
173
|
+
this._oJSONModel.setProperty("/frameUrlError/value", "");
|
|
174
|
+
// Check if save should be enabled based on changes (without full URL validation)
|
|
175
|
+
this._checkIfSaveIsEnabled(true);
|
|
176
|
+
},
|
|
177
|
+
|
|
89
178
|
/**
|
|
90
179
|
* Event handler for token update
|
|
91
180
|
* @param {sap.ui.base.Event} oEvent - Event
|
|
@@ -94,20 +183,18 @@ sap.ui.define([
|
|
|
94
183
|
let aSandboxParameters = this._oJSONModel.getProperty("/advancedSettings/value/additionalSandboxParameters");
|
|
95
184
|
|
|
96
185
|
if (oEvent.getParameter("type") === "added") {
|
|
97
|
-
oEvent.getParameter("addedTokens").forEach(
|
|
186
|
+
oEvent.getParameter("addedTokens").forEach((oToken) => {
|
|
98
187
|
aSandboxParameters = [...aSandboxParameters, oToken.getText()];
|
|
99
188
|
});
|
|
100
189
|
} else if (oEvent.getParameter("type") === "removed") {
|
|
101
|
-
oEvent.getParameter("removedTokens").forEach(
|
|
102
|
-
aSandboxParameters = aSandboxParameters.filter(
|
|
103
|
-
return sText !== oToken.getText();
|
|
104
|
-
});
|
|
190
|
+
oEvent.getParameter("removedTokens").forEach((oToken) => {
|
|
191
|
+
aSandboxParameters = aSandboxParameters.filter((sText) => sText !== oToken.getText());
|
|
105
192
|
});
|
|
106
193
|
}
|
|
107
194
|
|
|
108
195
|
this._oJSONModel.setProperty("/advancedSettings/value/additionalSandboxParameters", aSandboxParameters);
|
|
109
196
|
this._oJSONModel.setProperty("/settingsUpdate/value", true);
|
|
110
|
-
this.
|
|
197
|
+
this._checkIfSaveIsEnabled(true);
|
|
111
198
|
},
|
|
112
199
|
|
|
113
200
|
/**
|
|
@@ -116,7 +203,7 @@ sap.ui.define([
|
|
|
116
203
|
*/
|
|
117
204
|
onValidationSuccess(oEvent) {
|
|
118
205
|
oEvent.getSource().setValueState(ValueState.None);
|
|
119
|
-
this.
|
|
206
|
+
this._checkIfSaveIsEnabled(true);
|
|
120
207
|
},
|
|
121
208
|
|
|
122
209
|
/**
|
|
@@ -125,16 +212,25 @@ sap.ui.define([
|
|
|
125
212
|
*/
|
|
126
213
|
onValidationError(oEvent) {
|
|
127
214
|
oEvent.getSource().setValueState(ValueState.Error);
|
|
128
|
-
this.
|
|
215
|
+
this._checkIfSaveIsEnabled(false);
|
|
129
216
|
this._setFocusOnInvalidInput();
|
|
130
217
|
},
|
|
131
218
|
|
|
132
219
|
/**
|
|
133
220
|
* Event handler for save button
|
|
221
|
+
* Validates the URL before saving - if invalid, shows error and disables Save button
|
|
134
222
|
*/
|
|
135
223
|
async onSavePress() {
|
|
136
224
|
const sUrl = await this._buildPreviewURL();
|
|
137
|
-
|
|
225
|
+
const { result: bResult, error: sError } = isValidUrl(sUrl);
|
|
226
|
+
|
|
227
|
+
if (!bResult) {
|
|
228
|
+
setURLErrorMessage.call(this, sError);
|
|
229
|
+
this._checkIfSaveIsEnabled(false);
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
if (this._areAllTextFieldsValid() && this._areAllValueStateNones()) {
|
|
138
234
|
this._close(this._buildReturnedSettings());
|
|
139
235
|
} else {
|
|
140
236
|
this._setFocusOnInvalidInput();
|
|
@@ -191,8 +287,8 @@ sap.ui.define([
|
|
|
191
287
|
* @param {sap.ui.base.Event} oEvent - Event
|
|
192
288
|
*/
|
|
193
289
|
onLiveChange(oEvent) {
|
|
194
|
-
|
|
195
|
-
|
|
290
|
+
const oFilter = new Filter("label", FilterOperator.Contains, oEvent.getParameter("newValue"));
|
|
291
|
+
const oBinding = Element.getElementById("sapUiRtaAddIFrameDialog_ParameterTable").getBinding("items");
|
|
196
292
|
oBinding.filter([oFilter]);
|
|
197
293
|
},
|
|
198
294
|
|
|
@@ -208,7 +304,7 @@ sap.ui.define([
|
|
|
208
304
|
// Extract "/frameWidth" or "/frameHeight" from the binding path (e.g. /frameWidth/value)
|
|
209
305
|
const sPropertyName = sPropertyPath.replace(/\/value$/, "");
|
|
210
306
|
setNewPreviewSize.call(this, sPropertyName);
|
|
211
|
-
this.
|
|
307
|
+
this._checkIfSaveIsEnabled(true);
|
|
212
308
|
},
|
|
213
309
|
|
|
214
310
|
/**
|
|
@@ -223,7 +319,7 @@ sap.ui.define([
|
|
|
223
319
|
// Extract "/frameWidth" or "/frameHeight" from the binding path (e.g. /frameWidthUnit/value)
|
|
224
320
|
const sPropertyName = sPropertyPath.replace(/Unit\/value$/, "");
|
|
225
321
|
setNewPreviewSize.call(this, sPropertyName);
|
|
226
|
-
this.
|
|
322
|
+
this._checkIfSaveIsEnabled(true);
|
|
227
323
|
},
|
|
228
324
|
|
|
229
325
|
/**
|
|
@@ -272,13 +368,17 @@ sap.ui.define([
|
|
|
272
368
|
_addURLParameter(oObject) {
|
|
273
369
|
const sParameterKey = oObject.key;
|
|
274
370
|
let sParameterString;
|
|
275
|
-
|
|
276
|
-
// to the URL to prevent it from being resolved to a localized value.
|
|
277
|
-
// E.g. boolean is resolved to "yes/no" in a system with English locale - but we need to add "true/false" to the URL
|
|
278
|
-
// The only type that does not require this special handling is Edm.String
|
|
371
|
+
const [, sParameter] = sParameterKey.match(/\{(.+?)\}/);
|
|
279
372
|
if (oObject.type && oObject.type !== "Edm.String") {
|
|
280
|
-
|
|
373
|
+
// If the type is available, this is an OData V4 Model and the target type must be set to 'any' when adding the parameter
|
|
374
|
+
// to the URL to prevent it from being resolved to a localized value.
|
|
375
|
+
// E.g. boolean is resolved to "yes/no" in a system with English locale - but we need to add "true/false" to the URL
|
|
376
|
+
// The only type that does not require this special handling is Edm.String
|
|
281
377
|
sParameterString = `{path:'${sParameter}',targetType:'any'}`;
|
|
378
|
+
} else if (sParameter.startsWith("@")) {
|
|
379
|
+
// Parameters starting with "@" (e.g. @odata.context) need special handling
|
|
380
|
+
// to avoid issues with the binding syntax
|
|
381
|
+
sParameterString = `{=%{${sParameter}}}`;
|
|
282
382
|
} else {
|
|
283
383
|
sParameterString = sParameterKey;
|
|
284
384
|
}
|
|
@@ -300,19 +400,101 @@ sap.ui.define([
|
|
|
300
400
|
},
|
|
301
401
|
|
|
302
402
|
/**
|
|
303
|
-
*
|
|
304
|
-
* This
|
|
403
|
+
* Stores the initial configuration values when the dialog opens.
|
|
404
|
+
* This is used to detect if any changes were made.
|
|
405
|
+
*
|
|
406
|
+
* @private
|
|
407
|
+
*/
|
|
408
|
+
_storeInitialConfiguration() {
|
|
409
|
+
this._mInitialConfiguration = {};
|
|
410
|
+
const aAdvancedSettingsConfig = this._oJSONModel.getProperty("/advancedSettingsConfig");
|
|
411
|
+
_aAllConfigFields.forEach((sFieldName) => {
|
|
412
|
+
const vValue = this._oJSONModel.getProperty(`/${sFieldName}/value`);
|
|
413
|
+
// For advancedSettings, store each property individually to avoid reference issues
|
|
414
|
+
if (sFieldName === "advancedSettings") {
|
|
415
|
+
const mStoredSettings = {};
|
|
416
|
+
// Use explicit false for undefined boolean values since switches default to false
|
|
417
|
+
aAdvancedSettingsConfig.forEach((oSetting) => {
|
|
418
|
+
mStoredSettings[oSetting.key] = vValue[oSetting.key] ?? false;
|
|
419
|
+
});
|
|
420
|
+
mStoredSettings.additionalSandboxParameters = vValue.additionalSandboxParameters
|
|
421
|
+
? [...vValue.additionalSandboxParameters]
|
|
422
|
+
: [];
|
|
423
|
+
this._mInitialConfiguration.advancedSettings = mStoredSettings;
|
|
424
|
+
} else if (vValue !== null && typeof vValue === "object") {
|
|
425
|
+
// Deep copy for other objects using JSON parse/stringify
|
|
426
|
+
this._mInitialConfiguration[sFieldName] = JSON.parse(JSON.stringify(vValue));
|
|
427
|
+
} else {
|
|
428
|
+
this._mInitialConfiguration[sFieldName] = vValue;
|
|
429
|
+
}
|
|
430
|
+
});
|
|
431
|
+
},
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* Checks if any configuration field has been modified compared to the initial state.
|
|
435
|
+
*
|
|
436
|
+
* @returns {boolean} True if any configuration was modified
|
|
437
|
+
* @private
|
|
438
|
+
*/
|
|
439
|
+
_hasConfigurationChanged() {
|
|
440
|
+
if (!this._mInitialConfiguration) {
|
|
441
|
+
return true; // No initial config stored (e.g. new iframe)
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
const aAdvancedSettingsConfig = this._oJSONModel.getProperty("/advancedSettingsConfig");
|
|
445
|
+
return _aAllConfigFields.some((sFieldName) => {
|
|
446
|
+
const vCurrentValue = this._oJSONModel.getProperty(`/${sFieldName}/value`);
|
|
447
|
+
const vInitialValue = this._mInitialConfiguration[sFieldName];
|
|
448
|
+
|
|
449
|
+
// Handle advancedSettings by comparing each property individually
|
|
450
|
+
if (sFieldName === "advancedSettings") {
|
|
451
|
+
// Compare boolean switches using nullish coalescing to handle undefined values
|
|
452
|
+
const bSwitchChanged = aAdvancedSettingsConfig.some((oSetting) => {
|
|
453
|
+
if (oSetting.key === "additionalSandboxParameters") {
|
|
454
|
+
return false; // Array comparison is handled below
|
|
455
|
+
}
|
|
456
|
+
return (vCurrentValue[oSetting.key] ?? false) !== vInitialValue[oSetting.key];
|
|
457
|
+
});
|
|
458
|
+
if (bSwitchChanged) {
|
|
459
|
+
return true;
|
|
460
|
+
}
|
|
461
|
+
// Compare additionalSandboxParameters array
|
|
462
|
+
const aCurrentParams = vCurrentValue.additionalSandboxParameters || [];
|
|
463
|
+
const aInitialParams = vInitialValue.additionalSandboxParameters || [];
|
|
464
|
+
if (aCurrentParams.length !== aInitialParams.length) {
|
|
465
|
+
return true;
|
|
466
|
+
}
|
|
467
|
+
return aCurrentParams.some((vParam, iCounter) => vParam !== aInitialParams[iCounter]);
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
// Handle other objects by comparing JSON strings
|
|
471
|
+
if (vCurrentValue !== null && typeof vCurrentValue === "object") {
|
|
472
|
+
return JSON.stringify(vCurrentValue) !== JSON.stringify(vInitialValue);
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
return vCurrentValue !== vInitialValue;
|
|
476
|
+
});
|
|
477
|
+
},
|
|
478
|
+
|
|
479
|
+
/**
|
|
480
|
+
* Triggers the validation of all fields and updates the "saveEnabled" property in the model
|
|
481
|
+
* This property is used to enable/disable the Save button
|
|
482
|
+
* The Save button is only enabled if:
|
|
483
|
+
* 1. All validation checks pass
|
|
484
|
+
* 2. At least one configuration field was modified
|
|
305
485
|
*
|
|
306
486
|
* @param {boolean} bExternalValidationSuccess - Whether external validation was successful
|
|
307
487
|
*/
|
|
308
|
-
|
|
309
|
-
const
|
|
488
|
+
_checkIfSaveIsEnabled(bExternalValidationSuccess) {
|
|
489
|
+
const bAllValidationsPass = (
|
|
310
490
|
bExternalValidationSuccess
|
|
311
491
|
&& !this._oJSONModel.getProperty("/frameUrlError/value")
|
|
312
492
|
&& this._areAllTextFieldsValid()
|
|
313
493
|
&& this._areAllValueStateNones()
|
|
314
494
|
);
|
|
315
|
-
this.
|
|
495
|
+
const bHasChanges = this._hasConfigurationChanged();
|
|
496
|
+
const bSaveEnabled = bAllValidationsPass && bHasChanges;
|
|
497
|
+
this._oJSONModel.setProperty("/saveEnabled", bSaveEnabled);
|
|
316
498
|
},
|
|
317
499
|
|
|
318
500
|
async onValidateUrl() {
|
|
@@ -321,16 +503,9 @@ sap.ui.define([
|
|
|
321
503
|
if (bResult) {
|
|
322
504
|
this._oJSONModel.setProperty("/frameUrlError/value", "");
|
|
323
505
|
} else {
|
|
324
|
-
|
|
325
|
-
[IFrame.VALIDATION_ERROR.UNSAFE_PROTOCOL]: "IFRAME_ADDIFRAME_ERROR_UNSAFE_PROTOCOL",
|
|
326
|
-
[IFrame.VALIDATION_ERROR.MIXED_CONTENT]: "IFRAME_ADDIFRAME_ERROR_MIXED_CONTENT",
|
|
327
|
-
[IFrame.VALIDATION_ERROR.FORBIDDEN_URL]: "IFRAME_ADDIFRAME_ERROR_FORBIDDEN_URL",
|
|
328
|
-
[IFrame.VALIDATION_ERROR.INVALID_URL]: "IFRAME_ADDIFRAME_ERROR_INVALID_URL"
|
|
329
|
-
}[sError];
|
|
330
|
-
const sErrorText = _oTextResources.getText(sErrorKey);
|
|
331
|
-
this._oJSONModel.setProperty("/frameUrlError/value", sErrorText);
|
|
506
|
+
setURLErrorMessage.call(this, sError);
|
|
332
507
|
}
|
|
333
|
-
this.
|
|
508
|
+
this._checkIfSaveIsEnabled(bResult);
|
|
334
509
|
},
|
|
335
510
|
|
|
336
511
|
/**
|
|
@@ -341,28 +516,25 @@ sap.ui.define([
|
|
|
341
516
|
},
|
|
342
517
|
|
|
343
518
|
onContainerTitleChange(oEvent) {
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
var sValue = oInput.getValue();
|
|
519
|
+
const oInput = oEvent.getSource();
|
|
520
|
+
const sValue = oInput.getValue();
|
|
521
|
+
let sValueState = ValueState.None;
|
|
348
522
|
|
|
349
523
|
if (sValue.trim() === "") {
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
this._oJSONModel.setProperty("/areAllFieldsValid", false);
|
|
524
|
+
oInput.setValueState(ValueState.Error);
|
|
525
|
+
this._oJSONModel.setProperty("/saveEnabled", false);
|
|
353
526
|
return true;
|
|
354
527
|
}
|
|
355
528
|
|
|
356
529
|
try {
|
|
357
530
|
validateText(sValue);
|
|
358
531
|
} catch (oException) {
|
|
359
|
-
sValueState =
|
|
360
|
-
bValidationError = true;
|
|
532
|
+
sValueState = ValueState.Error;
|
|
361
533
|
}
|
|
362
534
|
|
|
363
|
-
this._checkIfAllFieldsValid(!bValidationError);
|
|
364
535
|
oInput.setValueState(sValueState);
|
|
365
|
-
|
|
536
|
+
this._checkIfSaveIsEnabled(sValueState === ValueState.None);
|
|
537
|
+
return sValueState === ValueState.Error;
|
|
366
538
|
},
|
|
367
539
|
|
|
368
540
|
/**
|
|
@@ -372,7 +544,7 @@ sap.ui.define([
|
|
|
372
544
|
* @private
|
|
373
545
|
*/
|
|
374
546
|
_close(mSettings) {
|
|
375
|
-
|
|
547
|
+
const oAddIFrameDialog = Element.getElementById("sapUiRtaAddIFrameDialog");
|
|
376
548
|
this._mSettings = mSettings;
|
|
377
549
|
oAddIFrameDialog.close();
|
|
378
550
|
},
|
|
@@ -388,37 +560,33 @@ sap.ui.define([
|
|
|
388
560
|
},
|
|
389
561
|
|
|
390
562
|
_areAllValueStateNones() {
|
|
391
|
-
|
|
392
|
-
return _aTextInputFields.concat(_aNumericInputFields).every(
|
|
563
|
+
const oData = this._oJSONModel.getData();
|
|
564
|
+
return _aTextInputFields.concat(_aNumericInputFields).every((sFieldName) => {
|
|
393
565
|
return oData[sFieldName].valueState === ValueState.None;
|
|
394
|
-
}
|
|
566
|
+
});
|
|
395
567
|
},
|
|
396
568
|
|
|
397
569
|
_areAllTextFieldsValid() {
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
return _aTextInputFields.reduce(function(bAllValid, sFieldName) {
|
|
570
|
+
const bAsContainer = this._oJSONModel.getProperty("asContainer/value");
|
|
571
|
+
return _aTextInputFields.every((sFieldName) => {
|
|
401
572
|
// The title field is only available on add as Section
|
|
402
573
|
if (sFieldName === "title" && !bAsContainer) {
|
|
403
574
|
return true;
|
|
404
575
|
}
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
oJSONModel.setProperty(`${sValuePath}State`, sValueState);
|
|
413
|
-
return bAllValid && sValueState === ValueState.None;
|
|
414
|
-
}, true);
|
|
576
|
+
const sValuePath = `/${sFieldName}/value`;
|
|
577
|
+
const sValueState = this._oJSONModel.getProperty(sValuePath).trim() === ""
|
|
578
|
+
? ValueState.Error
|
|
579
|
+
: ValueState.None;
|
|
580
|
+
this._oJSONModel.setProperty(`${sValuePath}State`, sValueState);
|
|
581
|
+
return sValueState === ValueState.None;
|
|
582
|
+
});
|
|
415
583
|
},
|
|
416
584
|
|
|
417
585
|
_buildReturnedSettings() {
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
586
|
+
const mSettings = {};
|
|
587
|
+
const oData = this._oJSONModel.getData();
|
|
588
|
+
_aAllConfigFields.forEach((sFieldName) => {
|
|
589
|
+
let sValue = oData[sFieldName].value;
|
|
422
590
|
if (sFieldName === "frameUrl") {
|
|
423
591
|
sValue = urlCleaner(sValue);
|
|
424
592
|
}
|
|
@@ -434,29 +602,30 @@ sap.ui.define([
|
|
|
434
602
|
* @private
|
|
435
603
|
*/
|
|
436
604
|
_importSettings(mSettings) {
|
|
437
|
-
if (mSettings) {
|
|
438
|
-
|
|
439
|
-
if (sFieldName === "frameWidth" || sFieldName === "frameHeight") {
|
|
440
|
-
this._importIFrameSize(sFieldName, mSettings[sFieldName]);
|
|
441
|
-
// legacy iframes do not have advancedSettings properties so we need to skip the setProperty
|
|
442
|
-
// on the json model to not overwrite the default values with undefined
|
|
443
|
-
} else if (sFieldName === "advancedSettings" && !mSettings[sFieldName]) {
|
|
444
|
-
return;
|
|
445
|
-
} else {
|
|
446
|
-
this._oJSONModel.setProperty(`/${sFieldName}/value`, mSettings[sFieldName]);
|
|
447
|
-
}
|
|
448
|
-
}, this);
|
|
605
|
+
if (!mSettings) {
|
|
606
|
+
return;
|
|
449
607
|
}
|
|
608
|
+
Object.keys(mSettings).forEach((sFieldName) => {
|
|
609
|
+
if (sFieldName === "frameWidth" || sFieldName === "frameHeight") {
|
|
610
|
+
this._importIFrameSize(sFieldName, mSettings[sFieldName]);
|
|
611
|
+
// Legacy iframes do not have advancedSettings properties so we need to skip the setProperty
|
|
612
|
+
// on the json model to not overwrite the default values with undefined
|
|
613
|
+
} else if (sFieldName === "advancedSettings" && !mSettings[sFieldName]) {
|
|
614
|
+
return;
|
|
615
|
+
} else {
|
|
616
|
+
this._oJSONModel.setProperty(`/${sFieldName}/value`, mSettings[sFieldName]);
|
|
617
|
+
}
|
|
618
|
+
});
|
|
450
619
|
},
|
|
451
620
|
|
|
452
621
|
/**
|
|
453
622
|
* Import IFrame size
|
|
454
623
|
*
|
|
455
|
-
* @param
|
|
456
|
-
* @param
|
|
624
|
+
* @param {string} sFieldName - Field name
|
|
625
|
+
* @param {string} sSize - Size to import
|
|
457
626
|
*/
|
|
458
627
|
_importIFrameSize(sFieldName, sSize) {
|
|
459
|
-
|
|
628
|
+
const aResults = sSize.split(/(px|rem|%|vh)/);
|
|
460
629
|
if (aResults.length >= 2) {
|
|
461
630
|
this._oJSONModel.setProperty(`/${sFieldName}/value`, parseFloat(aResults[0]));
|
|
462
631
|
this._oJSONModel.setProperty(`/${sFieldName}Unit/value`, aResults[1]);
|
|
@@ -468,18 +637,17 @@ sap.ui.define([
|
|
|
468
637
|
* Processed on saving the dialog
|
|
469
638
|
* Only numerical values are checked
|
|
470
639
|
* An empty URL field disables the Save button and does not need to be checked
|
|
471
|
-
*
|
|
472
640
|
*/
|
|
473
641
|
_setFocusOnInvalidInput() {
|
|
474
|
-
|
|
475
|
-
_aNumericInputFields.some(
|
|
642
|
+
const oData = this._oJSONModel.getData();
|
|
643
|
+
_aNumericInputFields.some((sFieldName) => {
|
|
476
644
|
if (oData[sFieldName].valueState === ValueState.Error) {
|
|
477
|
-
|
|
645
|
+
const oElement = Element.getElementById(oData[sFieldName].id);
|
|
478
646
|
oElement.focus();
|
|
479
647
|
return true;
|
|
480
648
|
}
|
|
481
649
|
return false;
|
|
482
|
-
}
|
|
650
|
+
});
|
|
483
651
|
}
|
|
484
652
|
});
|
|
485
653
|
});
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
@_sap_ui_rta_ContextMenu_BorderDarkColor 0.25rem,
|
|
17
17
|
@_sap_ui_rta_ContextMenu_BorderLightColor 0.25rem,
|
|
18
18
|
@_sap_ui_rta_ContextMenu_BorderLightColor 0.375rem) 4;
|
|
19
|
-
box-shadow: var(--
|
|
19
|
+
box-shadow: var(--sapContent_Shadow1);
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
}
|