@sap-ux/preview-middleware 0.16.69 → 0.16.70
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/dist/client/adp/controllers/AddFragment.controller.js +216 -234
- package/dist/client/adp/controllers/AddFragment.controller.ts +28 -7
- package/dist/client/adp/extension-point.js +5 -3
- package/dist/client/adp/extension-point.ts +3 -4
- package/dist/client/adp/init-dialogs.js +10 -4
- package/dist/client/adp/init-dialogs.ts +9 -9
- package/dist/client/adp/init.js +6 -20
- package/dist/client/adp/init.ts +7 -31
- package/dist/client/adp/quick-actions/common/op-add-custom-section.js +4 -1
- package/dist/client/adp/quick-actions/common/op-add-custom-section.ts +4 -1
- package/dist/client/adp/quick-actions/common/op-add-header-field.js +8 -2
- package/dist/client/adp/quick-actions/common/op-add-header-field.ts +8 -2
- package/dist/client/adp/ui/AddFragment.fragment.xml +7 -6
- package/dist/client/cpe/changes/service.js +4 -4
- package/dist/client/cpe/changes/service.ts +4 -4
- package/dist/client/cpe/communication-service.js +31 -0
- package/dist/client/cpe/communication-service.ts +40 -0
- package/dist/client/cpe/connector-service.js +6 -1
- package/dist/client/cpe/connector-service.ts +14 -1
- package/dist/client/cpe/init.js +8 -19
- package/dist/client/cpe/init.ts +6 -22
- package/dist/client/flp/WorkspaceConnector.js +1 -1
- package/dist/client/flp/WorkspaceConnector.ts +1 -1
- package/dist/client/flp/enableFakeConnector.js +1 -1
- package/dist/client/flp/enableFakeConnector.ts +1 -1
- package/dist/client/i18n.js +16 -1
- package/dist/client/i18n.ts +15 -0
- package/dist/client/messagebundle.properties +7 -0
- package/dist/client/thirdparty/@sap-ux-private/control-property-editor-common.js +2 -2
- package/dist/client/tsconfig.tsbuildinfo +1 -0
- package/package.json +4 -4
|
@@ -14,13 +14,14 @@ import FlUtils from 'sap/ui/fl/Utils';
|
|
|
14
14
|
/** sap.ui.dt */
|
|
15
15
|
import type ElementOverlay from 'sap/ui/dt/ElementOverlay';
|
|
16
16
|
|
|
17
|
-
import AddFragment from './controllers/AddFragment.controller';
|
|
17
|
+
import AddFragment, { AddFragmentOptions } from './controllers/AddFragment.controller';
|
|
18
18
|
import ControllerExtension from './controllers/ControllerExtension.controller';
|
|
19
19
|
import { ExtensionPointData } from './extension-point';
|
|
20
20
|
import ExtensionPoint from './controllers/ExtensionPoint.controller';
|
|
21
21
|
import ManagedObject from 'sap/ui/base/ManagedObject';
|
|
22
22
|
import { isReuseComponent } from '../cpe/utils';
|
|
23
23
|
import { Ui5VersionInfo } from '../utils/version';
|
|
24
|
+
import { getTextBundle } from '../i18n';
|
|
24
25
|
|
|
25
26
|
export const enum DialogNames {
|
|
26
27
|
ADD_FRAGMENT = 'AddFragment',
|
|
@@ -118,25 +119,24 @@ export const getAddFragmentItemText = (overlay: ElementOverlay) => {
|
|
|
118
119
|
* @param rta Runtime Authoring
|
|
119
120
|
* @param dialogName Dialog name
|
|
120
121
|
* @param extensionPointData Control ID
|
|
121
|
-
* @param
|
|
122
|
+
* @param options Dialog options
|
|
122
123
|
*/
|
|
123
124
|
export async function handler(
|
|
124
125
|
overlay: UI5Element,
|
|
125
126
|
rta: RuntimeAuthoring,
|
|
126
127
|
dialogName: DialogNames,
|
|
127
128
|
extensionPointData?: ExtensionPointData,
|
|
128
|
-
|
|
129
|
+
options: Partial<AddFragmentOptions> = {}
|
|
129
130
|
): Promise<void> {
|
|
130
131
|
let controller: Controller;
|
|
132
|
+
const resources = await getTextBundle();
|
|
131
133
|
|
|
132
134
|
switch (dialogName) {
|
|
133
135
|
case DialogNames.ADD_FRAGMENT:
|
|
134
|
-
controller = new AddFragment(
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
aggregation
|
|
139
|
-
);
|
|
136
|
+
controller = new AddFragment(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta, {
|
|
137
|
+
aggregation: options.aggregation,
|
|
138
|
+
title: resources.getText(options.title ?? 'ADP_ADD_FRAGMENT_DIALOG_TITLE')
|
|
139
|
+
});
|
|
140
140
|
break;
|
|
141
141
|
case DialogNames.CONTROLLER_EXTENSION:
|
|
142
142
|
controller = new ControllerExtension(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta);
|
package/dist/client/adp/init.js
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
sap.ui.define([
|
|
3
3
|
'sap/base/Log',
|
|
4
4
|
'open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common',
|
|
5
|
-
'../utils/error',
|
|
6
5
|
'../utils/version',
|
|
6
|
+
'../cpe/communication-service',
|
|
7
7
|
'../cpe/init',
|
|
8
8
|
'../utils/application',
|
|
9
9
|
'../i18n',
|
|
10
10
|
'./quick-actions/load',
|
|
11
11
|
'./utils',
|
|
12
12
|
'./init-dialogs'
|
|
13
|
-
], function (log, ___sap_ux_private_control_property_editor_common,
|
|
13
|
+
], function (log, ___sap_ux_private_control_property_editor_common, ___utils_version, ___cpe_communication_service, __init, ___utils_application, ___i18n, ___quick_actions_load, ___utils, ___init_dialogs) {
|
|
14
14
|
'use strict';
|
|
15
15
|
function _interopRequireDefault(obj) {
|
|
16
16
|
return obj && obj.__esModule && typeof obj.default !== 'undefined' ? obj.default : obj;
|
|
@@ -29,12 +29,11 @@ sap.ui.define([
|
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
31
|
const showMessage = ___sap_ux_private_control_property_editor_common['showMessage'];
|
|
32
|
-
const startPostMessageCommunication = ___sap_ux_private_control_property_editor_common['startPostMessageCommunication'];
|
|
33
32
|
const enableTelemetry = ___sap_ux_private_control_property_editor_common['enableTelemetry'];
|
|
34
|
-
const getError = ___utils_error['getError'];
|
|
35
33
|
const getUi5Version = ___utils_version['getUi5Version'];
|
|
36
34
|
const getUI5VersionValidationMessage = ___utils_version['getUI5VersionValidationMessage'];
|
|
37
35
|
const isLowerThanMinimalUi5Version = ___utils_version['isLowerThanMinimalUi5Version'];
|
|
36
|
+
const CommunicationService = ___cpe_communication_service['CommunicationService'];
|
|
38
37
|
const init = _interopRequireDefault(__init);
|
|
39
38
|
const getApplicationType = ___utils_application['getApplicationType'];
|
|
40
39
|
const getTextBundle = ___i18n['getTextBundle'];
|
|
@@ -46,19 +45,6 @@ sap.ui.define([
|
|
|
46
45
|
if (flexSettings.telemetry === true) {
|
|
47
46
|
enableTelemetry();
|
|
48
47
|
}
|
|
49
|
-
const actionHandlers = [];
|
|
50
|
-
function subscribe(handler) {
|
|
51
|
-
actionHandlers.push(handler);
|
|
52
|
-
}
|
|
53
|
-
const {sendAction} = startPostMessageCommunication(window.parent, async function onAction(action) {
|
|
54
|
-
for (const handler of actionHandlers) {
|
|
55
|
-
try {
|
|
56
|
-
await handler(action);
|
|
57
|
-
} catch (error) {
|
|
58
|
-
log.error('Handler Failed: ', getError(error));
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
48
|
const ui5VersionInfo = await getUi5Version();
|
|
63
49
|
const syncViewsIds = await getAllSyncViewsIds(ui5VersionInfo);
|
|
64
50
|
initDialogs(rta, syncViewsIds, ui5VersionInfo);
|
|
@@ -68,13 +54,13 @@ sap.ui.define([
|
|
|
68
54
|
})) {
|
|
69
55
|
const ExtensionPointService = (await __ui5_require_async('open/ux/preview/client/adp/extension-point')).default;
|
|
70
56
|
const extPointService = new ExtensionPointService(rta);
|
|
71
|
-
extPointService.init(
|
|
57
|
+
extPointService.init();
|
|
72
58
|
}
|
|
73
59
|
const applicationType = getApplicationType(rta.getRootControlInstance().getManifest());
|
|
74
60
|
const quickActionRegistries = await loadDefinitions(applicationType);
|
|
75
61
|
await init(rta, quickActionRegistries);
|
|
76
62
|
if (isLowerThanMinimalUi5Version(ui5VersionInfo)) {
|
|
77
|
-
sendAction(showMessage({
|
|
63
|
+
CommunicationService.sendAction(showMessage({
|
|
78
64
|
message: getUI5VersionValidationMessage(ui5VersionInfo),
|
|
79
65
|
shouldHideIframe: true
|
|
80
66
|
}));
|
|
@@ -82,7 +68,7 @@ sap.ui.define([
|
|
|
82
68
|
}
|
|
83
69
|
if (syncViewsIds.length > 0) {
|
|
84
70
|
const bundle = await getTextBundle();
|
|
85
|
-
sendAction(showMessage({
|
|
71
|
+
CommunicationService.sendAction(showMessage({
|
|
86
72
|
message: bundle.getText('ADP_SYNC_VIEWS_MESSAGE'),
|
|
87
73
|
shouldHideIframe: false
|
|
88
74
|
}));
|
package/dist/client/adp/init.ts
CHANGED
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
import log from 'sap/base/Log';
|
|
2
2
|
import type RuntimeAuthoring from 'sap/ui/rta/RuntimeAuthoring';
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
ExternalAction,
|
|
6
|
-
showMessage,
|
|
7
|
-
startPostMessageCommunication,
|
|
8
|
-
enableTelemetry
|
|
9
|
-
} from '@sap-ux-private/control-property-editor-common';
|
|
4
|
+
import { showMessage, enableTelemetry } from '@sap-ux-private/control-property-editor-common';
|
|
10
5
|
|
|
11
|
-
import { ActionHandler } from '../cpe/types';
|
|
12
|
-
import { getError } from '../utils/error';
|
|
13
6
|
import { getUi5Version, getUI5VersionValidationMessage, isLowerThanMinimalUi5Version } from '../utils/version';
|
|
14
7
|
|
|
8
|
+
import { CommunicationService } from '../cpe/communication-service';
|
|
15
9
|
import init from '../cpe/init';
|
|
16
10
|
import { getApplicationType } from '../utils/application';
|
|
17
11
|
import { getTextBundle } from '../i18n';
|
|
@@ -25,27 +19,7 @@ export default async function (rta: RuntimeAuthoring) {
|
|
|
25
19
|
if (flexSettings.telemetry === true) {
|
|
26
20
|
enableTelemetry();
|
|
27
21
|
}
|
|
28
|
-
const actionHandlers: ActionHandler[] = [];
|
|
29
|
-
/**
|
|
30
|
-
*
|
|
31
|
-
* @param handler action handler
|
|
32
|
-
*/
|
|
33
|
-
function subscribe(handler: ActionHandler): void {
|
|
34
|
-
actionHandlers.push(handler);
|
|
35
|
-
}
|
|
36
22
|
|
|
37
|
-
const { sendAction } = startPostMessageCommunication<ExternalAction>(
|
|
38
|
-
window.parent,
|
|
39
|
-
async function onAction(action: ExternalAction) {
|
|
40
|
-
for (const handler of actionHandlers) {
|
|
41
|
-
try {
|
|
42
|
-
await handler(action);
|
|
43
|
-
} catch (error) {
|
|
44
|
-
log.error('Handler Failed: ', getError(error));
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
);
|
|
49
23
|
|
|
50
24
|
const ui5VersionInfo = await getUi5Version();
|
|
51
25
|
const syncViewsIds = await getAllSyncViewsIds(ui5VersionInfo);
|
|
@@ -54,7 +28,7 @@ export default async function (rta: RuntimeAuthoring) {
|
|
|
54
28
|
if (!isLowerThanMinimalUi5Version(ui5VersionInfo, { major: 1, minor: 78 })) {
|
|
55
29
|
const ExtensionPointService = (await import('open/ux/preview/client/adp/extension-point')).default;
|
|
56
30
|
const extPointService = new ExtensionPointService(rta);
|
|
57
|
-
extPointService.init(
|
|
31
|
+
extPointService.init();
|
|
58
32
|
}
|
|
59
33
|
|
|
60
34
|
const applicationType = getApplicationType(rta.getRootControlInstance().getManifest());
|
|
@@ -63,13 +37,15 @@ export default async function (rta: RuntimeAuthoring) {
|
|
|
63
37
|
await init(rta, quickActionRegistries);
|
|
64
38
|
|
|
65
39
|
if (isLowerThanMinimalUi5Version(ui5VersionInfo)) {
|
|
66
|
-
sendAction(
|
|
40
|
+
CommunicationService.sendAction(
|
|
41
|
+
showMessage({ message: getUI5VersionValidationMessage(ui5VersionInfo), shouldHideIframe: true })
|
|
42
|
+
);
|
|
67
43
|
return;
|
|
68
44
|
}
|
|
69
45
|
|
|
70
46
|
if (syncViewsIds.length > 0) {
|
|
71
47
|
const bundle = await getTextBundle();
|
|
72
|
-
sendAction(
|
|
48
|
+
CommunicationService.sendAction(
|
|
73
49
|
showMessage({
|
|
74
50
|
message: bundle.getText('ADP_SYNC_VIEWS_MESSAGE'),
|
|
75
51
|
shouldHideIframe: false
|
|
@@ -20,7 +20,10 @@ sap.ui.define(["sap/ui/dt/OverlayRegistry", "../../init-dialogs", "../../../cpe/
|
|
|
20
20
|
async execute() {
|
|
21
21
|
const objectPageLayout = getRelevantControlFromActivePage(this.context.controlIndex, this.context.view, CONTROL_TYPES)[0];
|
|
22
22
|
const overlay = OverlayRegistry.getOverlay(objectPageLayout) || [];
|
|
23
|
-
await handler(overlay, this.context.rta, DialogNames.ADD_FRAGMENT, undefined,
|
|
23
|
+
await handler(overlay, this.context.rta, DialogNames.ADD_FRAGMENT, undefined, {
|
|
24
|
+
aggregation: 'sections',
|
|
25
|
+
title: 'QUICK_ACTION_OP_ADD_CUSTOM_SECTION'
|
|
26
|
+
});
|
|
24
27
|
return [];
|
|
25
28
|
}
|
|
26
29
|
}
|
|
@@ -29,7 +29,10 @@ export class AddCustomSectionQuickAction
|
|
|
29
29
|
)[0] as ObjectPageLayout;
|
|
30
30
|
|
|
31
31
|
const overlay = OverlayRegistry.getOverlay(objectPageLayout) || [];
|
|
32
|
-
await handler(overlay, this.context.rta, DialogNames.ADD_FRAGMENT, undefined,
|
|
32
|
+
await handler(overlay, this.context.rta, DialogNames.ADD_FRAGMENT, undefined, {
|
|
33
|
+
aggregation: 'sections',
|
|
34
|
+
title: 'QUICK_ACTION_OP_ADD_CUSTOM_SECTION'
|
|
35
|
+
});
|
|
33
36
|
return [];
|
|
34
37
|
}
|
|
35
38
|
}
|
|
@@ -25,10 +25,16 @@ sap.ui.define(["sap/ui/dt/OverlayRegistry", "../../../adp/init-dialogs", "../../
|
|
|
25
25
|
// check if only flex box exist in the headerContent.
|
|
26
26
|
if (headerContent.length === 1 && isA('sap.m.FlexBox', headerContent[0])) {
|
|
27
27
|
const overlay = OverlayRegistry.getOverlay(headerContent[0]) || [];
|
|
28
|
-
await handler(overlay, this.context.rta, DialogNames.ADD_FRAGMENT, undefined,
|
|
28
|
+
await handler(overlay, this.context.rta, DialogNames.ADD_FRAGMENT, undefined, {
|
|
29
|
+
aggregation: 'items',
|
|
30
|
+
title: 'QUICK_ACTION_OP_ADD_HEADER_FIELD'
|
|
31
|
+
});
|
|
29
32
|
} else if (this.control) {
|
|
30
33
|
const overlay = OverlayRegistry.getOverlay(this.control) || [];
|
|
31
|
-
await handler(overlay, this.context.rta, DialogNames.ADD_FRAGMENT, undefined,
|
|
34
|
+
await handler(overlay, this.context.rta, DialogNames.ADD_FRAGMENT, undefined, {
|
|
35
|
+
aggregation: 'headerContent',
|
|
36
|
+
title: 'QUICK_ACTION_OP_ADD_HEADER_FIELD'
|
|
37
|
+
});
|
|
32
38
|
}
|
|
33
39
|
return [];
|
|
34
40
|
}
|
|
@@ -32,10 +32,16 @@ export class AddHeaderFieldQuickAction extends SimpleQuickActionDefinitionBase i
|
|
|
32
32
|
// check if only flex box exist in the headerContent.
|
|
33
33
|
if (headerContent.length === 1 && isA<FlexBox>('sap.m.FlexBox', headerContent[0])) {
|
|
34
34
|
const overlay = OverlayRegistry.getOverlay(headerContent[0]) || [];
|
|
35
|
-
await handler(overlay, this.context.rta, DialogNames.ADD_FRAGMENT, undefined,
|
|
35
|
+
await handler(overlay, this.context.rta, DialogNames.ADD_FRAGMENT, undefined, {
|
|
36
|
+
aggregation: 'items',
|
|
37
|
+
title: 'QUICK_ACTION_OP_ADD_HEADER_FIELD'
|
|
38
|
+
});
|
|
36
39
|
} else if (this.control) {
|
|
37
40
|
const overlay = OverlayRegistry.getOverlay(this.control) || [];
|
|
38
|
-
await handler(overlay, this.context.rta, DialogNames.ADD_FRAGMENT, undefined,
|
|
41
|
+
await handler(overlay, this.context.rta, DialogNames.ADD_FRAGMENT, undefined, {
|
|
42
|
+
aggregation: 'headerContent',
|
|
43
|
+
title: 'QUICK_ACTION_OP_ADD_HEADER_FIELD'
|
|
44
|
+
});
|
|
39
45
|
}
|
|
40
46
|
return [];
|
|
41
47
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
xmlns="sap.m"
|
|
3
3
|
xmlns:core="sap.ui.core"
|
|
4
4
|
xmlns:f="sap.ui.layout.form"
|
|
5
|
-
title="
|
|
5
|
+
title="{/title}"
|
|
6
6
|
contentWidth="500px"
|
|
7
7
|
class="sapUiRTABorder">
|
|
8
8
|
<content>
|
|
@@ -12,10 +12,11 @@
|
|
|
12
12
|
labelSpanS="4"
|
|
13
13
|
singleContainerFullSize="false">
|
|
14
14
|
<f:content>
|
|
15
|
-
<Label text="
|
|
16
|
-
<Text text="{/selectedControlName}" />
|
|
17
|
-
<Label
|
|
15
|
+
<Label visible="{/completeView}" text="{i18n>ADP_ADD_FRAGMENT_DIALOG_CONTROL_TYPE_LABEL}" />
|
|
16
|
+
<Text visible="{/completeView}" text="{/selectedControlName}" />
|
|
17
|
+
<Label visible="{/completeView}" text="{i18n>ADP_ADD_FRAGMENT_DIALOG_AGGREGATION_LABEL}" />
|
|
18
18
|
<Select
|
|
19
|
+
visible="{/completeView}"
|
|
19
20
|
change="onAggregationChanged"
|
|
20
21
|
selectedKey="{/selectedAggregation/key}"
|
|
21
22
|
items="{
|
|
@@ -24,7 +25,7 @@
|
|
|
24
25
|
}">
|
|
25
26
|
<core:Item key="{key}" text="{value}" />
|
|
26
27
|
</Select>
|
|
27
|
-
<Label text="
|
|
28
|
+
<Label text="{i18n>ADP_ADD_FRAGMENT_DIALOG_INDEX_LABEL}" />
|
|
28
29
|
<HBox alignItems="Center">
|
|
29
30
|
<Select
|
|
30
31
|
enabled="{/indexHandlingFlag}"
|
|
@@ -42,7 +43,7 @@
|
|
|
42
43
|
class= "sapUiTinyMarginBegin"
|
|
43
44
|
tooltip="{/iconTooltip}" />
|
|
44
45
|
</HBox>
|
|
45
|
-
<Label text="
|
|
46
|
+
<Label text="{i18n>ADP_ADD_FRAGMENT_DIALOG_FRAGMENT_NAME_LABEL}" />
|
|
46
47
|
<Input
|
|
47
48
|
description=".fragment.xml"
|
|
48
49
|
value="{/newFragmentName}"
|
|
@@ -15,7 +15,7 @@ sap.ui.define([
|
|
|
15
15
|
const propertyChangeFailed = ___sap_ux_private_control_property_editor_common['propertyChangeFailed'];
|
|
16
16
|
const FlexChangesEndPoints = ___sap_ux_private_control_property_editor_common['FlexChangesEndPoints'];
|
|
17
17
|
const reloadApplication = ___sap_ux_private_control_property_editor_common['reloadApplication'];
|
|
18
|
-
const
|
|
18
|
+
const setApplicationRequiresReload = ___sap_ux_private_control_property_editor_common['setApplicationRequiresReload'];
|
|
19
19
|
const save = ___sap_ux_private_control_property_editor_common['save'];
|
|
20
20
|
const applyChange = ___flex_change['applyChange'];
|
|
21
21
|
const modeAndStackChangeHandler = ___rta_service['modeAndStackChangeHandler'];
|
|
@@ -75,10 +75,10 @@ sap.ui.define([
|
|
|
75
75
|
} else if (deletePropertyChanges.match(action)) {
|
|
76
76
|
await this.deleteChange(action.payload.controlId, action.payload.propertyName, action.payload.fileName);
|
|
77
77
|
} else if (reloadApplication.match(action)) {
|
|
78
|
-
this.sendAction(
|
|
78
|
+
this.sendAction(setApplicationRequiresReload(false));
|
|
79
79
|
} else if (save.match(action)) {
|
|
80
80
|
this.changesRequiringReload = 0;
|
|
81
|
-
this.sendAction(
|
|
81
|
+
this.sendAction(setApplicationRequiresReload(false));
|
|
82
82
|
}
|
|
83
83
|
});
|
|
84
84
|
await this.fetchSavedChanges();
|
|
@@ -181,7 +181,7 @@ sap.ui.define([
|
|
|
181
181
|
if (changesRequiringReload > this.changesRequiringReload) {
|
|
182
182
|
const resourceBundle = await getTextBundle();
|
|
183
183
|
MessageToast.show(resourceBundle.getText('CPE_CHANGES_VISIBLE_AFTER_SAVE_AND_RELOAD_MESSAGE'), { duration: 8000 });
|
|
184
|
-
this.sendAction(
|
|
184
|
+
this.sendAction(setApplicationRequiresReload(changesRequiringReload > 0));
|
|
185
185
|
}
|
|
186
186
|
this.changesRequiringReload = changesRequiringReload;
|
|
187
187
|
if (Array.isArray(allCommands) && allCommands.length === 0) {
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
propertyChangeFailed,
|
|
12
12
|
FlexChangesEndPoints,
|
|
13
13
|
reloadApplication,
|
|
14
|
-
|
|
14
|
+
setApplicationRequiresReload,
|
|
15
15
|
save
|
|
16
16
|
} from '@sap-ux-private/control-property-editor-common';
|
|
17
17
|
import { applyChange } from './flex-change';
|
|
@@ -141,10 +141,10 @@ export class ChangeService {
|
|
|
141
141
|
} else if (deletePropertyChanges.match(action)) {
|
|
142
142
|
await this.deleteChange(action.payload.controlId, action.payload.propertyName, action.payload.fileName);
|
|
143
143
|
} else if (reloadApplication.match(action)) {
|
|
144
|
-
this.sendAction(
|
|
144
|
+
this.sendAction(setApplicationRequiresReload(false));
|
|
145
145
|
} else if (save.match(action)) {
|
|
146
146
|
this.changesRequiringReload = 0;
|
|
147
|
-
this.sendAction(
|
|
147
|
+
this.sendAction(setApplicationRequiresReload(false));
|
|
148
148
|
}
|
|
149
149
|
});
|
|
150
150
|
|
|
@@ -298,7 +298,7 @@ export class ChangeService {
|
|
|
298
298
|
MessageToast.show(resourceBundle.getText('CPE_CHANGES_VISIBLE_AFTER_SAVE_AND_RELOAD_MESSAGE'), {
|
|
299
299
|
duration: 8000
|
|
300
300
|
});
|
|
301
|
-
this.sendAction(
|
|
301
|
+
this.sendAction(setApplicationRequiresReload(changesRequiringReload > 0));
|
|
302
302
|
}
|
|
303
303
|
this.changesRequiringReload = changesRequiringReload;
|
|
304
304
|
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
sap.ui.define([
|
|
3
|
+
'sap/base/Log',
|
|
4
|
+
'open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common',
|
|
5
|
+
'../utils/error'
|
|
6
|
+
], function (Log, ___sap_ux_private_control_property_editor_common, ___utils_error) {
|
|
7
|
+
'use strict';
|
|
8
|
+
const startPostMessageCommunication = ___sap_ux_private_control_property_editor_common['startPostMessageCommunication'];
|
|
9
|
+
const getError = ___utils_error['getError'];
|
|
10
|
+
class CommunicationService {
|
|
11
|
+
static actionHandlers = [];
|
|
12
|
+
static #_ = ((() => {
|
|
13
|
+
const {sendAction} = startPostMessageCommunication(window.parent, async action => {
|
|
14
|
+
for (const handler of this.actionHandlers) {
|
|
15
|
+
try {
|
|
16
|
+
await handler(action);
|
|
17
|
+
} catch (error) {
|
|
18
|
+
Log.error('Handler Failed: ', getError(error));
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
this.sendAction = sendAction;
|
|
23
|
+
})());
|
|
24
|
+
static subscribe(handler) {
|
|
25
|
+
this.actionHandlers.push(handler);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
var __exports = { __esModule: true };
|
|
29
|
+
__exports.CommunicationService = CommunicationService;
|
|
30
|
+
return __exports;
|
|
31
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import Log from 'sap/base/Log';
|
|
2
|
+
|
|
3
|
+
import { ExternalAction, startPostMessageCommunication } from '@sap-ux-private/control-property-editor-common';
|
|
4
|
+
|
|
5
|
+
import { getError } from '../utils/error';
|
|
6
|
+
|
|
7
|
+
import { ActionHandler } from './types';
|
|
8
|
+
|
|
9
|
+
export class CommunicationService {
|
|
10
|
+
/**
|
|
11
|
+
* Sends an action to the CPE.
|
|
12
|
+
*/
|
|
13
|
+
static sendAction: (action: ExternalAction) => void;
|
|
14
|
+
private static actionHandlers: ActionHandler[] = [];
|
|
15
|
+
|
|
16
|
+
static {
|
|
17
|
+
const { sendAction } = startPostMessageCommunication<ExternalAction>(
|
|
18
|
+
window.parent,
|
|
19
|
+
async (action: ExternalAction) => {
|
|
20
|
+
for (const handler of this.actionHandlers) {
|
|
21
|
+
try {
|
|
22
|
+
await handler(action);
|
|
23
|
+
} catch (error) {
|
|
24
|
+
Log.error('Handler Failed: ', getError(error));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
this.sendAction = sendAction;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Creates a listener to receive actions from the CPE.
|
|
34
|
+
*
|
|
35
|
+
* @param handler - Action handler.
|
|
36
|
+
*/
|
|
37
|
+
static subscribe(handler: ActionHandler): void {
|
|
38
|
+
this.actionHandlers.push(handler);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -41,10 +41,15 @@ sap.ui.define([
|
|
|
41
41
|
connector.storage.fileChangeRequestNotifier = this.onChangeSaved.bind(this);
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
onChangeSaved(fileName, kind
|
|
44
|
+
onChangeSaved(fileName, kind) {
|
|
45
|
+
let change = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
46
|
+
const {changeType, content} = change;
|
|
45
47
|
if (changeType && changeType !== 'appdescr_fe_changePageConfiguration' || kind === 'delete' || this.isReloadPending) {
|
|
46
48
|
this.sendAction(storageFileChanged(fileName?.replace('sap.ui.fl.', '')));
|
|
47
49
|
}
|
|
50
|
+
if (changeType === 'addXML' && content?.templateName !== undefined && content?.fragmentPath !== undefined) {
|
|
51
|
+
this.sendAction(storageFileChanged(content.fragmentPath));
|
|
52
|
+
}
|
|
48
53
|
}
|
|
49
54
|
}
|
|
50
55
|
var __exports = { __esModule: true };
|
|
@@ -35,7 +35,14 @@ export class WorkspaceConnectorService {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
private onChangeSaved(fileName: string, kind: 'delete' | 'create',
|
|
38
|
+
private onChangeSaved(fileName: string, kind: 'delete' | 'create', change: unknown = {}) {
|
|
39
|
+
const { changeType, content } = change as {
|
|
40
|
+
changeType?: string;
|
|
41
|
+
content?: {
|
|
42
|
+
templateName?: string;
|
|
43
|
+
fragmentPath?: string;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
39
46
|
if (
|
|
40
47
|
(changeType && changeType !== 'appdescr_fe_changePageConfiguration') ||
|
|
41
48
|
kind === 'delete' ||
|
|
@@ -43,5 +50,11 @@ export class WorkspaceConnectorService {
|
|
|
43
50
|
) {
|
|
44
51
|
this.sendAction(storageFileChanged(fileName?.replace('sap.ui.fl.', '')));
|
|
45
52
|
}
|
|
53
|
+
if (changeType === 'addXML' && content?.templateName !== undefined && content?.fragmentPath !== undefined) {
|
|
54
|
+
// If there is template available, then we save and reload right away,
|
|
55
|
+
// so we should ignore the first file change event that comes for the fragment.
|
|
56
|
+
// (We don't want to show "Reload" button)
|
|
57
|
+
this.sendAction(storageFileChanged(content.fragmentPath));
|
|
58
|
+
}
|
|
46
59
|
}
|
|
47
60
|
}
|
package/dist/client/cpe/init.js
CHANGED
|
@@ -6,15 +6,14 @@ sap.ui.define([
|
|
|
6
6
|
'./selection',
|
|
7
7
|
'./changes/service',
|
|
8
8
|
'./documentation',
|
|
9
|
-
'./logger',
|
|
10
9
|
'./ui5-utils',
|
|
11
10
|
'./connector-service',
|
|
12
11
|
'./rta-service',
|
|
13
12
|
'../utils/error',
|
|
14
|
-
'./quick-actions/quick-action-service'
|
|
15
|
-
|
|
13
|
+
'./quick-actions/quick-action-service',
|
|
14
|
+
'./communication-service'
|
|
15
|
+
], function (Log, ___sap_ux_private_control_property_editor_common, ___outline_service, ___selection, ___changes_service, ___documentation, ___ui5_utils, ___connector_service, ___rta_service, ___utils_error, ___quick_actions_quick_action_service, ___communication_service) {
|
|
16
16
|
'use strict';
|
|
17
|
-
const startPostMessageCommunication = ___sap_ux_private_control_property_editor_common['startPostMessageCommunication'];
|
|
18
17
|
const iconsLoaded = ___sap_ux_private_control_property_editor_common['iconsLoaded'];
|
|
19
18
|
const enableTelemetry = ___sap_ux_private_control_property_editor_common['enableTelemetry'];
|
|
20
19
|
const appLoaded = ___sap_ux_private_control_property_editor_common['appLoaded'];
|
|
@@ -22,12 +21,12 @@ sap.ui.define([
|
|
|
22
21
|
const SelectionService = ___selection['SelectionService'];
|
|
23
22
|
const ChangeService = ___changes_service['ChangeService'];
|
|
24
23
|
const loadDefaultLibraries = ___documentation['loadDefaultLibraries'];
|
|
25
|
-
const logger = ___logger['logger'];
|
|
26
24
|
const getIcons = ___ui5_utils['getIcons'];
|
|
27
25
|
const WorkspaceConnectorService = ___connector_service['WorkspaceConnectorService'];
|
|
28
26
|
const RtaService = ___rta_service['RtaService'];
|
|
29
27
|
const getError = ___utils_error['getError'];
|
|
30
28
|
const QuickActionService = ___quick_actions_quick_action_service['QuickActionService'];
|
|
29
|
+
const CommunicationService = ___communication_service['CommunicationService'];
|
|
31
30
|
function init(rta) {
|
|
32
31
|
let registries = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
33
32
|
Log.info('Initializing Control Property Editor');
|
|
@@ -35,9 +34,8 @@ sap.ui.define([
|
|
|
35
34
|
if (flexSettings.telemetry === true) {
|
|
36
35
|
enableTelemetry();
|
|
37
36
|
}
|
|
38
|
-
const actionHandlers = [];
|
|
39
37
|
function subscribe(handler) {
|
|
40
|
-
|
|
38
|
+
CommunicationService.subscribe(handler);
|
|
41
39
|
}
|
|
42
40
|
const selectionService = new SelectionService(rta);
|
|
43
41
|
const changesService = new ChangeService({ rta }, selectionService);
|
|
@@ -55,21 +53,12 @@ sap.ui.define([
|
|
|
55
53
|
];
|
|
56
54
|
try {
|
|
57
55
|
loadDefaultLibraries();
|
|
58
|
-
const {sendAction} = startPostMessageCommunication(window.parent, async function onAction(action) {
|
|
59
|
-
for (const handler of actionHandlers) {
|
|
60
|
-
try {
|
|
61
|
-
await handler(action);
|
|
62
|
-
} catch (error) {
|
|
63
|
-
Log.error('Handler Failed: ', getError(error));
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}, logger);
|
|
67
56
|
for (const service of services) {
|
|
68
|
-
service.init(sendAction, subscribe)?.catch(reason => Log.error('Service
|
|
57
|
+
service.init(CommunicationService.sendAction, subscribe)?.catch(reason => Log.error('Service Initialization Failed: ', getError(reason)));
|
|
69
58
|
}
|
|
70
59
|
const icons = getIcons();
|
|
71
|
-
sendAction(iconsLoaded(icons));
|
|
72
|
-
sendAction(appLoaded());
|
|
60
|
+
CommunicationService.sendAction(iconsLoaded(icons));
|
|
61
|
+
CommunicationService.sendAction(appLoaded());
|
|
73
62
|
} catch (error) {
|
|
74
63
|
Log.error('Error during initialization of Control Property Editor', getError(error));
|
|
75
64
|
}
|
package/dist/client/cpe/init.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import Log from 'sap/base/Log';
|
|
2
2
|
import type RuntimeAuthoring from 'sap/ui/rta/RuntimeAuthoring';
|
|
3
3
|
|
|
4
|
-
import type { ExternalAction } from '@sap-ux-private/control-property-editor-common';
|
|
5
4
|
import {
|
|
6
|
-
startPostMessageCommunication,
|
|
7
5
|
iconsLoaded,
|
|
8
6
|
enableTelemetry,
|
|
9
7
|
appLoaded
|
|
@@ -14,13 +12,13 @@ import { OutlineService } from './outline/service';
|
|
|
14
12
|
import { SelectionService } from './selection';
|
|
15
13
|
import { ChangeService } from './changes/service';
|
|
16
14
|
import { loadDefaultLibraries } from './documentation';
|
|
17
|
-
import { logger } from './logger';
|
|
18
15
|
import { getIcons } from './ui5-utils';
|
|
19
16
|
import { WorkspaceConnectorService } from './connector-service';
|
|
20
17
|
import { RtaService } from './rta-service';
|
|
21
18
|
import { getError } from '../utils/error';
|
|
22
19
|
import { QuickActionService } from './quick-actions/quick-action-service';
|
|
23
20
|
import type { QuickActionDefinitionRegistry } from './quick-actions/registry';
|
|
21
|
+
import { CommunicationService } from './communication-service';
|
|
24
22
|
|
|
25
23
|
export default function init(
|
|
26
24
|
rta: RuntimeAuthoring,
|
|
@@ -34,13 +32,12 @@ export default function init(
|
|
|
34
32
|
enableTelemetry();
|
|
35
33
|
}
|
|
36
34
|
|
|
37
|
-
const actionHandlers: ActionHandler[] = [];
|
|
38
35
|
/**
|
|
39
36
|
*
|
|
40
37
|
* @param handler action handler
|
|
41
38
|
*/
|
|
42
39
|
function subscribe(handler: ActionHandler): void {
|
|
43
|
-
|
|
40
|
+
CommunicationService.subscribe(handler);
|
|
44
41
|
}
|
|
45
42
|
|
|
46
43
|
const selectionService = new SelectionService(rta);
|
|
@@ -61,30 +58,17 @@ export default function init(
|
|
|
61
58
|
|
|
62
59
|
try {
|
|
63
60
|
loadDefaultLibraries();
|
|
64
|
-
const { sendAction } = startPostMessageCommunication<ExternalAction>(
|
|
65
|
-
window.parent,
|
|
66
|
-
async function onAction(action) {
|
|
67
|
-
for (const handler of actionHandlers) {
|
|
68
|
-
try {
|
|
69
|
-
await handler(action);
|
|
70
|
-
} catch (error) {
|
|
71
|
-
Log.error('Handler Failed: ', getError(error));
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
logger
|
|
76
|
-
);
|
|
77
61
|
|
|
78
62
|
for (const service of services) {
|
|
79
63
|
service
|
|
80
|
-
.init(sendAction, subscribe)
|
|
81
|
-
?.catch((reason) => Log.error('Service
|
|
64
|
+
.init(CommunicationService.sendAction, subscribe)
|
|
65
|
+
?.catch((reason) => Log.error('Service Initialization Failed: ', getError(reason)));
|
|
82
66
|
}
|
|
83
67
|
|
|
84
68
|
const icons = getIcons();
|
|
85
69
|
|
|
86
|
-
sendAction(iconsLoaded(icons));
|
|
87
|
-
sendAction(appLoaded());
|
|
70
|
+
CommunicationService.sendAction(iconsLoaded(icons));
|
|
71
|
+
CommunicationService.sendAction(appLoaded());
|
|
88
72
|
} catch (error) {
|
|
89
73
|
Log.error('Error during initialization of Control Property Editor', getError(error));
|
|
90
74
|
}
|
|
@@ -20,7 +20,7 @@ sap.ui.define(["sap/base/util/merge", "sap/ui/fl/write/api/connectors/ObjectStor
|
|
|
20
20
|
}
|
|
21
21
|
if (typeof this.fileChangeRequestNotifier === 'function' && change.fileName) {
|
|
22
22
|
try {
|
|
23
|
-
this.fileChangeRequestNotifier(change.fileName, 'create', change
|
|
23
|
+
this.fileChangeRequestNotifier(change.fileName, 'create', change);
|
|
24
24
|
} catch (e) {
|
|
25
25
|
// exceptions in the listener call are ignored
|
|
26
26
|
}
|
|
@@ -18,7 +18,7 @@ const connector = merge({}, ObjectStorageConnector, {
|
|
|
18
18
|
|
|
19
19
|
if (typeof this.fileChangeRequestNotifier === 'function' && change.fileName) {
|
|
20
20
|
try {
|
|
21
|
-
this.fileChangeRequestNotifier(change.fileName, 'create', change
|
|
21
|
+
this.fileChangeRequestNotifier(change.fileName, 'create', change);
|
|
22
22
|
} catch (e) {
|
|
23
23
|
// exceptions in the listener call are ignored
|
|
24
24
|
}
|