@sap-ux/preview-middleware 0.19.29 → 0.19.30
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/base/flp.d.ts +2 -2
- package/dist/base/flp.js +3 -3
- package/dist/client/adp/add-fragment.js +48 -0
- package/dist/client/adp/add-fragment.ts +51 -0
- package/dist/client/adp/api-handler.js +3 -1
- package/dist/client/adp/api-handler.ts +2 -2
- package/dist/client/adp/controllers/AddFragment.controller.js +26 -86
- package/dist/client/adp/controllers/AddFragment.controller.ts +29 -113
- package/dist/client/adp/dialog-factory.js +4 -4
- package/dist/client/adp/dialog-factory.ts +21 -13
- package/dist/client/adp/extension-point.js +3 -3
- package/dist/client/adp/extension-point.ts +3 -3
- package/dist/client/adp/init-dialogs.js +33 -8
- package/dist/client/adp/init-dialogs.ts +13 -8
- package/dist/client/adp/init.js +2 -0
- package/dist/client/adp/init.ts +5 -0
- package/dist/client/cpe/additional-change-info/add-xml-additional-info.js +77 -0
- package/dist/client/cpe/additional-change-info/add-xml-additional-info.ts +84 -0
- package/dist/client/cpe/changes/service.js +5 -2
- package/dist/client/cpe/changes/service.ts +2 -0
- package/dist/client/cpe/connector-service.js +2 -1
- package/dist/client/cpe/connector-service.ts +8 -4
- package/dist/client/flp/WorkspaceConnector.js +9 -3
- package/dist/client/flp/WorkspaceConnector.ts +10 -2
- package/dist/client/flp/enableFakeConnector.js +9 -3
- package/dist/client/flp/enableFakeConnector.ts +11 -2
- package/dist/client/utils/additional-change-info.js +43 -0
- package/dist/client/utils/additional-change-info.ts +42 -0
- package/package.json +3 -3
|
@@ -84,9 +84,9 @@ export default class ExtensionPointService {
|
|
|
84
84
|
await this.fragmentHandler(overlay, info)
|
|
85
85
|
});
|
|
86
86
|
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
this.rta.setPlugins(
|
|
87
|
+
const plugins = this.rta.getPlugins();
|
|
88
|
+
plugins.addXMLAtExtensionPoint = plugin;
|
|
89
|
+
this.rta.setPlugins(plugins);
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
/**
|
|
@@ -1,12 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
sap.ui.define(["sap/ui/rta/util/hasStableId", "sap/ui/fl/Utils", "./dialog-factory", "../i18n", "./utils"], function (hasStableId, FlUtils, ___dialog_factory, ___i18n, ___utils) {
|
|
3
|
+
sap.ui.define(["sap/ui/rta/util/hasStableId", "sap/ui/fl/Utils", "./dialog-factory", "../i18n", "./utils", "../utils/version"], function (hasStableId, FlUtils, ___dialog_factory, ___i18n, ___utils, ___utils_version) {
|
|
4
4
|
"use strict";
|
|
5
5
|
|
|
6
|
+
function __ui5_require_async(path) {
|
|
7
|
+
return new Promise(function (resolve, reject) {
|
|
8
|
+
sap.ui.require([path], function (module) {
|
|
9
|
+
if (!(module && module.__esModule)) {
|
|
10
|
+
module = module === null || !(typeof module === "object" && path.endsWith("/library")) ? {
|
|
11
|
+
default: module
|
|
12
|
+
} : module;
|
|
13
|
+
Object.defineProperty(module, "__esModule", {
|
|
14
|
+
value: true
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
resolve(module);
|
|
18
|
+
}, function (err) {
|
|
19
|
+
reject(err);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
}
|
|
6
23
|
const DialogFactory = ___dialog_factory["DialogFactory"];
|
|
7
24
|
const DialogNames = ___dialog_factory["DialogNames"];
|
|
8
25
|
const getTextBundle = ___i18n["getTextBundle"];
|
|
9
26
|
const getReuseComponentChecker = ___utils["getReuseComponentChecker"];
|
|
27
|
+
const isLowerThanMinimalUi5Version = ___utils_version["isLowerThanMinimalUi5Version"];
|
|
10
28
|
/**
|
|
11
29
|
* Handler for enablement of Extend With Controller context menu entry
|
|
12
30
|
*
|
|
@@ -111,13 +129,20 @@ sap.ui.define(["sap/ui/rta/util/hasStableId", "sap/ui/fl/Utils", "./dialog-facto
|
|
|
111
129
|
const isCloud = rta.getFlexSettings().isCloud;
|
|
112
130
|
const resources = await getTextBundle();
|
|
113
131
|
const isReuseComponentChecker = await getReuseComponentChecker(ui5VersionInfo);
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
132
|
+
if (isLowerThanMinimalUi5Version(ui5VersionInfo, {
|
|
133
|
+
major: 1,
|
|
134
|
+
minor: 136
|
|
135
|
+
})) {
|
|
136
|
+
contextMenu.addMenuItem({
|
|
137
|
+
id: 'ADD_FRAGMENT',
|
|
138
|
+
text: overlay => getAddFragmentItemText(overlay, isReuseComponentChecker, isCloud, resources),
|
|
139
|
+
handler: async overlays => await DialogFactory.createDialog(overlays[0], rta, DialogNames.ADD_FRAGMENT),
|
|
140
|
+
icon: 'sap-icon://attachment-html',
|
|
141
|
+
enabled: overlays => isFragmentCommandEnabled(overlays, isReuseComponentChecker, isCloud)
|
|
142
|
+
});
|
|
143
|
+
} else {
|
|
144
|
+
(await __ui5_require_async('open/ux/preview/client/adp/add-fragment')).initAddXMLPlugin(rta);
|
|
145
|
+
}
|
|
121
146
|
contextMenu.addMenuItem({
|
|
122
147
|
id: 'EXTEND_CONTROLLER',
|
|
123
148
|
text: overlay => getExtendControllerItemText(overlay, isReuseComponentChecker, isCloud, resources),
|
|
@@ -17,6 +17,7 @@ import type { IsReuseComponentApi } from '../cpe/types';
|
|
|
17
17
|
import { getTextBundle, type TextBundle } from '../i18n';
|
|
18
18
|
import { getReuseComponentChecker } from './utils';
|
|
19
19
|
import type { Ui5VersionInfo } from '../utils/version';
|
|
20
|
+
import { isLowerThanMinimalUi5Version } from '../utils/version';
|
|
20
21
|
|
|
21
22
|
/**
|
|
22
23
|
* Handler for enablement of Extend With Controller context menu entry
|
|
@@ -138,14 +139,18 @@ export const initDialogs = async (rta: RuntimeAuthoring, syncViewsIds: string[],
|
|
|
138
139
|
const resources = await getTextBundle();
|
|
139
140
|
const isReuseComponentChecker = await getReuseComponentChecker(ui5VersionInfo);
|
|
140
141
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
142
|
+
if (isLowerThanMinimalUi5Version(ui5VersionInfo, { major: 1, minor: 136 })) {
|
|
143
|
+
contextMenu.addMenuItem({
|
|
144
|
+
id: 'ADD_FRAGMENT',
|
|
145
|
+
text: (overlay: ElementOverlay) => getAddFragmentItemText(overlay, isReuseComponentChecker, isCloud, resources),
|
|
146
|
+
handler: async (overlays: UI5Element[]) =>
|
|
147
|
+
await DialogFactory.createDialog(overlays[0], rta, DialogNames.ADD_FRAGMENT),
|
|
148
|
+
icon: 'sap-icon://attachment-html',
|
|
149
|
+
enabled: (overlays: ElementOverlay[]) => isFragmentCommandEnabled(overlays, isReuseComponentChecker, isCloud)
|
|
150
|
+
});
|
|
151
|
+
} else {
|
|
152
|
+
(await import('open/ux/preview/client/adp/add-fragment')).initAddXMLPlugin(rta);
|
|
153
|
+
}
|
|
149
154
|
|
|
150
155
|
contextMenu.addMenuItem({
|
|
151
156
|
id: 'EXTEND_CONTROLLER',
|
package/dist/client/adp/init.js
CHANGED
|
@@ -47,6 +47,8 @@ sap.ui.define([
|
|
|
47
47
|
}
|
|
48
48
|
const ui5VersionInfo = await getUi5Version();
|
|
49
49
|
const syncViewsIds = await getAllSyncViewsIds(ui5VersionInfo);
|
|
50
|
+
const defaultPlugins = rta.getDefaultPlugins();
|
|
51
|
+
rta.setPlugins(defaultPlugins);
|
|
50
52
|
await initDialogs(rta, syncViewsIds, ui5VersionInfo);
|
|
51
53
|
if (!isLowerThanMinimalUi5Version(ui5VersionInfo, {
|
|
52
54
|
major: 1,
|
package/dist/client/adp/init.ts
CHANGED
|
@@ -23,6 +23,11 @@ export default async function (rta: RuntimeAuthoring) {
|
|
|
23
23
|
const ui5VersionInfo = await getUi5Version();
|
|
24
24
|
const syncViewsIds = await getAllSyncViewsIds(ui5VersionInfo);
|
|
25
25
|
|
|
26
|
+
// Plugins need to be set before adding additional plugins to prevent overriding with the default
|
|
27
|
+
// and allow usage of getPlugins later in the flow
|
|
28
|
+
const defaultPlugins = rta.getDefaultPlugins();
|
|
29
|
+
rta.setPlugins(defaultPlugins);
|
|
30
|
+
|
|
26
31
|
await initDialogs(rta, syncViewsIds, ui5VersionInfo);
|
|
27
32
|
|
|
28
33
|
if (!isLowerThanMinimalUi5Version(ui5VersionInfo, { major: 1, minor: 78 })) {
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define(["../../utils/core", "../../adp/quick-actions/control-types"], function (____utils_core, ____adp_quick_actions_control_types) {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
const getControlById = ____utils_core["getControlById"];
|
|
7
|
+
const ANALYTICAL_TABLE_TYPE = ____adp_quick_actions_control_types["ANALYTICAL_TABLE_TYPE"];
|
|
8
|
+
const GRID_TABLE_TYPE = ____adp_quick_actions_control_types["GRID_TABLE_TYPE"];
|
|
9
|
+
const MDC_TABLE_TYPE = ____adp_quick_actions_control_types["MDC_TABLE_TYPE"];
|
|
10
|
+
const TREE_TABLE_TYPE = ____adp_quick_actions_control_types["TREE_TABLE_TYPE"];
|
|
11
|
+
function getAddXMLAdditionalInfo(change) {
|
|
12
|
+
const selectorId = change.getSelector()?.id ?? '';
|
|
13
|
+
const targetAggregation = change.getContent()?.targetAggregation ?? '';
|
|
14
|
+
const templateName = getFragmentTemplateName(selectorId, targetAggregation);
|
|
15
|
+
if (templateName) {
|
|
16
|
+
return {
|
|
17
|
+
templateName
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
function getFragmentTemplateName(selectorId, targetAggregation) {
|
|
23
|
+
const control = getControlById(selectorId);
|
|
24
|
+
if (!control) {
|
|
25
|
+
return '';
|
|
26
|
+
}
|
|
27
|
+
const controlName = control.getMetadata().getName();
|
|
28
|
+
if (controlName === 'sap.uxap.ObjectPageLayout' && targetAggregation === 'sections') {
|
|
29
|
+
return 'OBJECT_PAGE_CUSTOM_SECTION';
|
|
30
|
+
} else if (isCustomAction(controlName, targetAggregation)) {
|
|
31
|
+
return 'CUSTOM_ACTION';
|
|
32
|
+
} else if (isObjectPageHeaderField(control, controlName, targetAggregation)) {
|
|
33
|
+
return 'OBJECT_PAGE_HEADER_FIELD';
|
|
34
|
+
} else if (targetAggregation === 'columns') {
|
|
35
|
+
switch (controlName) {
|
|
36
|
+
case MDC_TABLE_TYPE:
|
|
37
|
+
return 'V4_MDC_TABLE_COLUMN';
|
|
38
|
+
case TREE_TABLE_TYPE:
|
|
39
|
+
case GRID_TABLE_TYPE:
|
|
40
|
+
return 'GRID_TREE_TABLE_COLUMN';
|
|
41
|
+
case ANALYTICAL_TABLE_TYPE:
|
|
42
|
+
return 'ANALYTICAL_TABLE_COLUMN';
|
|
43
|
+
default:
|
|
44
|
+
return '';
|
|
45
|
+
}
|
|
46
|
+
} else if (controlName === 'sap.ui.mdc.Table' && targetAggregation === 'actions') {
|
|
47
|
+
return 'TABLE_ACTION';
|
|
48
|
+
}
|
|
49
|
+
return '';
|
|
50
|
+
}
|
|
51
|
+
function isCustomAction(controlName, targetAggregation) {
|
|
52
|
+
if (['sap.f.DynamicPageTitle', 'sap.uxap.ObjectPageHeader', 'sap.uxap.ObjectPageDynamicHeaderTitle'].includes(controlName)) {
|
|
53
|
+
return targetAggregation === 'actions';
|
|
54
|
+
} else if (controlName === 'sap.m.OverflowToolbar' || controlName === 'sap.m.Toolbar') {
|
|
55
|
+
return targetAggregation === 'content';
|
|
56
|
+
}
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
function isObjectPageHeaderField(control, controlName, targetAggregation) {
|
|
60
|
+
if (controlName === 'sap.uxap.ObjectPageLayout') {
|
|
61
|
+
return targetAggregation === 'headerContent';
|
|
62
|
+
} else if (controlName === 'sap.m.FlexBox') {
|
|
63
|
+
const parentName = control.getParent()?.getMetadata().getName();
|
|
64
|
+
if (parentName === 'sap.uxap.ObjectPageDynamicHeaderContent' || parentName === 'sap.uxap.ObjectPageLayout') {
|
|
65
|
+
return targetAggregation === 'items';
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
var __exports = {
|
|
71
|
+
__esModule: true
|
|
72
|
+
};
|
|
73
|
+
__exports.getAddXMLAdditionalInfo = getAddXMLAdditionalInfo;
|
|
74
|
+
__exports.getFragmentTemplateName = getFragmentTemplateName;
|
|
75
|
+
return __exports;
|
|
76
|
+
});
|
|
77
|
+
//# sourceMappingURL=add-xml-additional-info.js.map
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import FlexChange from 'sap/ui/fl/Change';
|
|
2
|
+
import { getControlById } from '../../utils/core';
|
|
3
|
+
import {
|
|
4
|
+
ANALYTICAL_TABLE_TYPE,
|
|
5
|
+
GRID_TABLE_TYPE,
|
|
6
|
+
MDC_TABLE_TYPE,
|
|
7
|
+
TREE_TABLE_TYPE
|
|
8
|
+
} from '../../adp/quick-actions/control-types';
|
|
9
|
+
import Element from 'sap/ui/core/Element';
|
|
10
|
+
|
|
11
|
+
export type AddXMLAdditionalInfo = {
|
|
12
|
+
templateName: string;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type AddXMLChangeContent = {
|
|
16
|
+
targetAggregation?: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export function getAddXMLAdditionalInfo(change: FlexChange<AddXMLChangeContent>): AddXMLAdditionalInfo | undefined {
|
|
20
|
+
const selectorId = change.getSelector()?.id ?? '';
|
|
21
|
+
const targetAggregation = change.getContent()?.targetAggregation ?? '';
|
|
22
|
+
const templateName = getFragmentTemplateName(selectorId, targetAggregation);
|
|
23
|
+
if (templateName) {
|
|
24
|
+
return { templateName };
|
|
25
|
+
}
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function getFragmentTemplateName(selectorId: string, targetAggregation: string): string {
|
|
30
|
+
const control = getControlById(selectorId);
|
|
31
|
+
|
|
32
|
+
if (!control) {
|
|
33
|
+
return '';
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const controlName = control.getMetadata().getName();
|
|
37
|
+
if (controlName === 'sap.uxap.ObjectPageLayout' && targetAggregation === 'sections') {
|
|
38
|
+
return 'OBJECT_PAGE_CUSTOM_SECTION';
|
|
39
|
+
} else if (isCustomAction(controlName, targetAggregation)) {
|
|
40
|
+
return 'CUSTOM_ACTION';
|
|
41
|
+
} else if (isObjectPageHeaderField(control, controlName, targetAggregation)) {
|
|
42
|
+
return 'OBJECT_PAGE_HEADER_FIELD';
|
|
43
|
+
} else if (targetAggregation === 'columns') {
|
|
44
|
+
switch (controlName) {
|
|
45
|
+
case MDC_TABLE_TYPE:
|
|
46
|
+
return 'V4_MDC_TABLE_COLUMN';
|
|
47
|
+
case TREE_TABLE_TYPE:
|
|
48
|
+
case GRID_TABLE_TYPE:
|
|
49
|
+
return 'GRID_TREE_TABLE_COLUMN';
|
|
50
|
+
case ANALYTICAL_TABLE_TYPE:
|
|
51
|
+
return 'ANALYTICAL_TABLE_COLUMN';
|
|
52
|
+
default:
|
|
53
|
+
return '';
|
|
54
|
+
}
|
|
55
|
+
} else if (controlName === 'sap.ui.mdc.Table' && targetAggregation === 'actions') {
|
|
56
|
+
return 'TABLE_ACTION';
|
|
57
|
+
}
|
|
58
|
+
return '';
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function isCustomAction(controlName: string, targetAggregation: string): boolean {
|
|
62
|
+
if (
|
|
63
|
+
['sap.f.DynamicPageTitle', 'sap.uxap.ObjectPageHeader', 'sap.uxap.ObjectPageDynamicHeaderTitle'].includes(
|
|
64
|
+
controlName
|
|
65
|
+
)
|
|
66
|
+
) {
|
|
67
|
+
return targetAggregation === 'actions';
|
|
68
|
+
} else if (controlName === 'sap.m.OverflowToolbar' || controlName === 'sap.m.Toolbar') {
|
|
69
|
+
return targetAggregation === 'content';
|
|
70
|
+
}
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function isObjectPageHeaderField(control: Element, controlName: string, targetAggregation: string): boolean {
|
|
75
|
+
if (controlName === 'sap.uxap.ObjectPageLayout') {
|
|
76
|
+
return targetAggregation === 'headerContent';
|
|
77
|
+
} else if (controlName === 'sap.m.FlexBox') {
|
|
78
|
+
const parentName = control.getParent()?.getMetadata().getName();
|
|
79
|
+
if (parentName === 'sap.uxap.ObjectPageDynamicHeaderContent' || parentName === 'sap.uxap.ObjectPageLayout') {
|
|
80
|
+
return targetAggregation === 'items';
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
@@ -10,8 +10,9 @@ sap.ui.define([
|
|
|
10
10
|
'sap/m/MessageToast',
|
|
11
11
|
'../../i18n',
|
|
12
12
|
'../../utils/core',
|
|
13
|
-
'../../utils/fe-v4'
|
|
14
|
-
|
|
13
|
+
'../../utils/fe-v4',
|
|
14
|
+
'../../utils/additional-change-info'
|
|
15
|
+
], function (___sap_ux_private_control_property_editor_common, ___flex_change, Log, ___rta_service, JsControlTreeModifier, ____utils_error, ____utils_version, MessageToast, ____i18n, ____utils_core, ____utils_fe_v4, ____utils_additional_change_info) {
|
|
15
16
|
'use strict';
|
|
16
17
|
function __ui5_require_async(path) {
|
|
17
18
|
return new Promise(function (resolve, reject) {
|
|
@@ -48,6 +49,7 @@ sap.ui.define([
|
|
|
48
49
|
const getControlById = ____utils_core['getControlById'];
|
|
49
50
|
const isA = ____utils_core['isA'];
|
|
50
51
|
const getConfigMapControlIdMap = ____utils_fe_v4['getConfigMapControlIdMap'];
|
|
52
|
+
const setAdditionalChangeInfo = ____utils_additional_change_info['setAdditionalChangeInfo'];
|
|
51
53
|
const TITLE_MAP = { appdescr_app_addAnnotationsToOData: 'Add New Annotation File' };
|
|
52
54
|
const STACK_CHANGE_EVENT = 'STACK_CHANGED';
|
|
53
55
|
const PROPERTY_CHANGE = 'propertyChange';
|
|
@@ -327,6 +329,7 @@ sap.ui.define([
|
|
|
327
329
|
this.updateStack();
|
|
328
330
|
}
|
|
329
331
|
async handleCommand(command, inactiveCommandCount, index, pendingChanges) {
|
|
332
|
+
setAdditionalChangeInfo(command?.getPreparedChange?.());
|
|
330
333
|
const pendingChange = await this.prepareChangeType(command, inactiveCommandCount, index);
|
|
331
334
|
if (pendingChange) {
|
|
332
335
|
pendingChanges.push(pendingChange);
|
|
@@ -38,6 +38,7 @@ import { getTextBundle } from '../../i18n';
|
|
|
38
38
|
import { getControlById, isA } from '../../utils/core';
|
|
39
39
|
import UI5Element from 'sap/ui/core/Element';
|
|
40
40
|
import { getConfigMapControlIdMap } from '../../utils/fe-v4';
|
|
41
|
+
import { setAdditionalChangeInfo } from '../../utils/additional-change-info';
|
|
41
42
|
|
|
42
43
|
const TITLE_MAP: { [key: string]: string } = {
|
|
43
44
|
appdescr_app_addAnnotationsToOData: 'Add New Annotation File'
|
|
@@ -518,6 +519,7 @@ export class ChangeService extends EventTarget {
|
|
|
518
519
|
index: number,
|
|
519
520
|
pendingChanges: PendingChange[]
|
|
520
521
|
): Promise<void> {
|
|
522
|
+
setAdditionalChangeInfo(command?.getPreparedChange?.());
|
|
521
523
|
const pendingChange = await this.prepareChangeType(command, inactiveCommandCount, index);
|
|
522
524
|
if (pendingChange) {
|
|
523
525
|
pendingChanges.push(pendingChange);
|
|
@@ -43,6 +43,7 @@ sap.ui.define([
|
|
|
43
43
|
}
|
|
44
44
|
onChangeSaved(fileName, kind) {
|
|
45
45
|
let change = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
46
|
+
let additionalChangeInfo = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
46
47
|
const {changeType, content} = change;
|
|
47
48
|
if (changeType && ![
|
|
48
49
|
'appdescr_fe_changePageConfiguration',
|
|
@@ -50,7 +51,7 @@ sap.ui.define([
|
|
|
50
51
|
].includes(changeType) || kind === 'delete' || this.isReloadPending) {
|
|
51
52
|
this.sendAction(storageFileChanged(fileName?.replace('sap.ui.fl.', '')));
|
|
52
53
|
}
|
|
53
|
-
if (changeType === 'addXML' &&
|
|
54
|
+
if (changeType === 'addXML' && additionalChangeInfo?.templateName && content?.fragmentPath) {
|
|
54
55
|
this.sendAction(storageFileChanged(content.fragmentPath));
|
|
55
56
|
}
|
|
56
57
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ExternalAction, reloadApplication, storageFileChanged } from '@sap-ux-private/control-property-editor-common';
|
|
2
2
|
import { ActionSenderFunction, SubscribeFunction } from './types';
|
|
3
3
|
import { getUi5Version, isLowerThanMinimalUi5Version } from '../utils/version';
|
|
4
|
-
|
|
4
|
+
import { AdditionalChangeInfo } from '../utils/additional-change-info';
|
|
5
5
|
/**
|
|
6
6
|
* A Class of WorkspaceConnectorService
|
|
7
7
|
*/
|
|
@@ -35,11 +35,15 @@ export class WorkspaceConnectorService {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
private onChangeSaved(
|
|
38
|
+
private onChangeSaved(
|
|
39
|
+
fileName: string,
|
|
40
|
+
kind: 'delete' | 'create',
|
|
41
|
+
change: unknown = {},
|
|
42
|
+
additionalChangeInfo: unknown = {}
|
|
43
|
+
): void {
|
|
39
44
|
const { changeType, content } = change as {
|
|
40
45
|
changeType?: string;
|
|
41
46
|
content?: {
|
|
42
|
-
templateName?: string;
|
|
43
47
|
fragmentPath?: string;
|
|
44
48
|
};
|
|
45
49
|
};
|
|
@@ -53,7 +57,7 @@ export class WorkspaceConnectorService {
|
|
|
53
57
|
) {
|
|
54
58
|
this.sendAction(storageFileChanged(fileName?.replace('sap.ui.fl.', '')));
|
|
55
59
|
}
|
|
56
|
-
if (changeType === 'addXML' &&
|
|
60
|
+
if (changeType === 'addXML' && (additionalChangeInfo as AdditionalChangeInfo )?.templateName && content?.fragmentPath) {
|
|
57
61
|
// If there is template available, then we save and reload right away,
|
|
58
62
|
// so we should ignore the first file change event that comes for the fragment.
|
|
59
63
|
// (We don't want to show "Reload" button)
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
sap.ui.define(["sap/base/util/merge", "sap/ui/fl/write/api/connectors/ObjectStorageConnector", "sap/ui/fl/Layer", "./common", "../utils/version"], function (merge, ObjectStorageConnector, Layer, ___common, ___utils_version) {
|
|
3
|
+
sap.ui.define(["sap/base/util/merge", "sap/ui/fl/write/api/connectors/ObjectStorageConnector", "sap/ui/fl/Layer", "./common", "../utils/version", "../utils/additional-change-info"], function (merge, ObjectStorageConnector, Layer, ___common, ___utils_version, ___utils_additional_change_info) {
|
|
4
4
|
"use strict";
|
|
5
5
|
|
|
6
6
|
const CHANGES_API_PATH = ___common["CHANGES_API_PATH"];
|
|
7
7
|
const getFlexSettings = ___common["getFlexSettings"];
|
|
8
8
|
const getUi5Version = ___utils_version["getUi5Version"];
|
|
9
9
|
const isLowerThanMinimalUi5Version = ___utils_version["isLowerThanMinimalUi5Version"];
|
|
10
|
+
const getAdditionalChangeInfo = ___utils_additional_change_info["getAdditionalChangeInfo"];
|
|
10
11
|
const connector = merge({}, ObjectStorageConnector, {
|
|
11
12
|
layers: [Layer.VENDOR, Layer.CUSTOMER_BASE],
|
|
12
13
|
storage: {
|
|
@@ -18,16 +19,21 @@ sap.ui.define(["sap/base/util/merge", "sap/ui/fl/write/api/connectors/ObjectStor
|
|
|
18
19
|
change.support ??= {};
|
|
19
20
|
change.support.generator = settings.generator;
|
|
20
21
|
}
|
|
22
|
+
const additionalChangeInfo = getAdditionalChangeInfo(change);
|
|
21
23
|
if (typeof this.fileChangeRequestNotifier === 'function' && change.fileName) {
|
|
22
24
|
try {
|
|
23
|
-
this.fileChangeRequestNotifier(change.fileName, 'create', change);
|
|
25
|
+
this.fileChangeRequestNotifier(change.fileName, 'create', change, additionalChangeInfo);
|
|
24
26
|
} catch (e) {
|
|
25
27
|
// exceptions in the listener call are ignored
|
|
26
28
|
}
|
|
27
29
|
}
|
|
30
|
+
const body = {
|
|
31
|
+
change,
|
|
32
|
+
additionalChangeInfo
|
|
33
|
+
};
|
|
28
34
|
return fetch(CHANGES_API_PATH, {
|
|
29
35
|
method: 'POST',
|
|
30
|
-
body: JSON.stringify(
|
|
36
|
+
body: JSON.stringify(body, null, 2),
|
|
31
37
|
headers: {
|
|
32
38
|
'content-type': 'application/json'
|
|
33
39
|
}
|
|
@@ -3,6 +3,7 @@ import ObjectStorageConnector from 'sap/ui/fl/write/api/connectors/ObjectStorage
|
|
|
3
3
|
import Layer from 'sap/ui/fl/Layer';
|
|
4
4
|
import { CHANGES_API_PATH, FlexChange, getFlexSettings } from './common';
|
|
5
5
|
import { getUi5Version, isLowerThanMinimalUi5Version } from '../utils/version';
|
|
6
|
+
import { getAdditionalChangeInfo } from '../utils/additional-change-info';
|
|
6
7
|
|
|
7
8
|
const connector = merge({}, ObjectStorageConnector, {
|
|
8
9
|
layers: [Layer.VENDOR, Layer.CUSTOMER_BASE],
|
|
@@ -16,17 +17,24 @@ const connector = merge({}, ObjectStorageConnector, {
|
|
|
16
17
|
change.support.generator = settings.generator;
|
|
17
18
|
}
|
|
18
19
|
|
|
20
|
+
const additionalChangeInfo = getAdditionalChangeInfo(change);
|
|
21
|
+
|
|
19
22
|
if (typeof this.fileChangeRequestNotifier === 'function' && change.fileName) {
|
|
20
23
|
try {
|
|
21
|
-
this.fileChangeRequestNotifier(change.fileName, 'create', change);
|
|
24
|
+
this.fileChangeRequestNotifier(change.fileName, 'create', change, additionalChangeInfo);
|
|
22
25
|
} catch (e) {
|
|
23
26
|
// exceptions in the listener call are ignored
|
|
24
27
|
}
|
|
25
28
|
}
|
|
26
29
|
|
|
30
|
+
const body = {
|
|
31
|
+
change,
|
|
32
|
+
additionalChangeInfo
|
|
33
|
+
};
|
|
34
|
+
|
|
27
35
|
return fetch(CHANGES_API_PATH, {
|
|
28
36
|
method: 'POST',
|
|
29
|
-
body: JSON.stringify(
|
|
37
|
+
body: JSON.stringify(body, null, 2),
|
|
30
38
|
headers: {
|
|
31
39
|
'content-type': 'application/json'
|
|
32
40
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
sap.ui.define(["sap/ui/fl/LrepConnector", "sap/ui/fl/FakeLrepConnector", "./common"], function (LrepConnector, FakeLrepConnector, ___common) {
|
|
3
|
+
sap.ui.define(["sap/ui/fl/LrepConnector", "sap/ui/fl/FakeLrepConnector", "../utils/additional-change-info", "./common"], function (LrepConnector, FakeLrepConnector, ___utils_additional_change_info, ___common) {
|
|
4
4
|
"use strict";
|
|
5
5
|
|
|
6
|
+
const getAdditionalChangeInfo = ___utils_additional_change_info["getAdditionalChangeInfo"];
|
|
6
7
|
const CHANGES_API_PATH = ___common["CHANGES_API_PATH"];
|
|
7
8
|
const getFlexSettings = ___common["getFlexSettings"];
|
|
8
9
|
/**
|
|
@@ -19,16 +20,21 @@ sap.ui.define(["sap/ui/fl/LrepConnector", "sap/ui/fl/FakeLrepConnector", "./comm
|
|
|
19
20
|
change.support ??= {};
|
|
20
21
|
change.support.generator = settings.generator;
|
|
21
22
|
}
|
|
23
|
+
const additionalChangeInfo = getAdditionalChangeInfo(change);
|
|
22
24
|
if (typeof FakeLrepConnector.fileChangeRequestNotifier === 'function' && change.fileName) {
|
|
23
25
|
try {
|
|
24
|
-
FakeLrepConnector.fileChangeRequestNotifier(change.fileName, 'create', change);
|
|
26
|
+
FakeLrepConnector.fileChangeRequestNotifier(change.fileName, 'create', change, additionalChangeInfo);
|
|
25
27
|
} catch (e) {
|
|
26
28
|
// exceptions in the listener call are ignored
|
|
27
29
|
}
|
|
28
30
|
}
|
|
31
|
+
const body = {
|
|
32
|
+
change,
|
|
33
|
+
additionalChangeInfo
|
|
34
|
+
};
|
|
29
35
|
return fetch(CHANGES_API_PATH, {
|
|
30
36
|
method: 'POST',
|
|
31
|
-
body: JSON.stringify(
|
|
37
|
+
body: JSON.stringify(body, null, 2),
|
|
32
38
|
headers: {
|
|
33
39
|
'content-type': 'application/json'
|
|
34
40
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import LrepConnector from 'sap/ui/fl/LrepConnector';
|
|
2
2
|
import FakeLrepConnector from 'sap/ui/fl/FakeLrepConnector';
|
|
3
|
+
import { getAdditionalChangeInfo } from '../utils/additional-change-info';
|
|
3
4
|
|
|
4
5
|
import { CHANGES_API_PATH, FlexChange, getFlexSettings } from './common';
|
|
5
6
|
|
|
@@ -37,17 +38,25 @@ export async function create(changes: FlexChange | FlexChange[]): Promise<void>
|
|
|
37
38
|
change.support.generator = settings.generator;
|
|
38
39
|
}
|
|
39
40
|
|
|
41
|
+
const additionalChangeInfo = getAdditionalChangeInfo(change);
|
|
42
|
+
|
|
40
43
|
if (typeof FakeLrepConnector.fileChangeRequestNotifier === 'function' && change.fileName) {
|
|
41
44
|
try {
|
|
42
|
-
FakeLrepConnector.fileChangeRequestNotifier(change.fileName, 'create', change);
|
|
45
|
+
FakeLrepConnector.fileChangeRequestNotifier(change.fileName, 'create', change, additionalChangeInfo);
|
|
43
46
|
} catch (e) {
|
|
44
47
|
// exceptions in the listener call are ignored
|
|
45
48
|
}
|
|
46
49
|
}
|
|
47
50
|
|
|
51
|
+
const body = {
|
|
52
|
+
change,
|
|
53
|
+
additionalChangeInfo
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
|
|
48
57
|
return fetch(CHANGES_API_PATH, {
|
|
49
58
|
method: 'POST',
|
|
50
|
-
body: JSON.stringify(
|
|
59
|
+
body: JSON.stringify(body, null, 2),
|
|
51
60
|
headers: {
|
|
52
61
|
'content-type': 'application/json'
|
|
53
62
|
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define(["../cpe/additional-change-info/add-xml-additional-info"], function (___cpe_additional_change_info_add_xml_additional_info) {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
const getAddXMLAdditionalInfo = ___cpe_additional_change_info_add_xml_additional_info["getAddXMLAdditionalInfo"];
|
|
7
|
+
const additionalChangeInfoMap = new Map();
|
|
8
|
+
/**
|
|
9
|
+
* This function is used to set additional change information for a given change.
|
|
10
|
+
*
|
|
11
|
+
* @param change - The change object for which additional information is to be set.
|
|
12
|
+
*/
|
|
13
|
+
function setAdditionalChangeInfo(change) {
|
|
14
|
+
if (!change) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
let additionalChangeInfo;
|
|
18
|
+
if (change?.getChangeType?.() === 'addXML') {
|
|
19
|
+
additionalChangeInfo = getAddXMLAdditionalInfo(change);
|
|
20
|
+
}
|
|
21
|
+
if (additionalChangeInfo) {
|
|
22
|
+
additionalChangeInfoMap.set(change.getDefinition().fileName, additionalChangeInfo);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Retrieves additional change information for a given change.
|
|
28
|
+
*
|
|
29
|
+
* @param change - The change object containing details about a file modification.
|
|
30
|
+
* @returns The additional change information associated with the file name of the change,
|
|
31
|
+
* or `undefined` if no additional information is available.
|
|
32
|
+
*/
|
|
33
|
+
function getAdditionalChangeInfo(change) {
|
|
34
|
+
return additionalChangeInfoMap.get(change.fileName);
|
|
35
|
+
}
|
|
36
|
+
var __exports = {
|
|
37
|
+
__esModule: true
|
|
38
|
+
};
|
|
39
|
+
__exports.setAdditionalChangeInfo = setAdditionalChangeInfo;
|
|
40
|
+
__exports.getAdditionalChangeInfo = getAdditionalChangeInfo;
|
|
41
|
+
return __exports;
|
|
42
|
+
});
|
|
43
|
+
//# sourceMappingURL=additional-change-info.js.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import FlexChange from 'sap/ui/fl/Change';
|
|
2
|
+
import {
|
|
3
|
+
getAddXMLAdditionalInfo,
|
|
4
|
+
type AddXMLAdditionalInfo,
|
|
5
|
+
type AddXMLChangeContent
|
|
6
|
+
} from '../cpe/additional-change-info/add-xml-additional-info';
|
|
7
|
+
import { FlexChange as Change } from '../flp/common';
|
|
8
|
+
|
|
9
|
+
const additionalChangeInfoMap = new Map<string, AddXMLAdditionalInfo>();
|
|
10
|
+
|
|
11
|
+
export type AdditionalChangeInfo = AddXMLAdditionalInfo | undefined
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* This function is used to set additional change information for a given change.
|
|
15
|
+
*
|
|
16
|
+
* @param change - The change object for which additional information is to be set.
|
|
17
|
+
*/
|
|
18
|
+
export function setAdditionalChangeInfo(change: FlexChange<AddXMLChangeContent> | undefined): void {
|
|
19
|
+
if (!change) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
let additionalChangeInfo;
|
|
24
|
+
if(change?.getChangeType?.() === 'addXML') {
|
|
25
|
+
additionalChangeInfo = getAddXMLAdditionalInfo(change);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (additionalChangeInfo) {
|
|
29
|
+
additionalChangeInfoMap.set(change.getDefinition().fileName, additionalChangeInfo);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Retrieves additional change information for a given change.
|
|
35
|
+
*
|
|
36
|
+
* @param change - The change object containing details about a file modification.
|
|
37
|
+
* @returns The additional change information associated with the file name of the change,
|
|
38
|
+
* or `undefined` if no additional information is available.
|
|
39
|
+
*/
|
|
40
|
+
export function getAdditionalChangeInfo(change: Change): AdditionalChangeInfo {
|
|
41
|
+
return additionalChangeInfoMap.get(change.fileName);
|
|
42
|
+
}
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"bugs": {
|
|
10
10
|
"url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Apreview-middleware"
|
|
11
11
|
},
|
|
12
|
-
"version": "0.19.
|
|
12
|
+
"version": "0.19.30",
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"author": "@SAP/ux-tools-team",
|
|
15
15
|
"main": "dist/index.js",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"ejs": "3.1.10",
|
|
26
26
|
"mem-fs": "2.1.0",
|
|
27
27
|
"mem-fs-editor": "9.4.0",
|
|
28
|
-
"@sap-ux/adp-tooling": "0.13.
|
|
28
|
+
"@sap-ux/adp-tooling": "0.13.35",
|
|
29
29
|
"@sap-ux/btp-utils": "1.0.3",
|
|
30
30
|
"@sap-ux/control-property-editor-sources": "npm:@sap-ux/control-property-editor@0.6.4",
|
|
31
31
|
"@sap-ux/feature-toggle": "0.2.3",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"nock": "13.4.0",
|
|
50
50
|
"npm-run-all2": "6.2.0",
|
|
51
51
|
"supertest": "6.3.3",
|
|
52
|
-
"@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.13.
|
|
52
|
+
"@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.13.19",
|
|
53
53
|
"@sap-ux/axios-extension": "1.20.0",
|
|
54
54
|
"@sap-ux/i18n": "0.2.3",
|
|
55
55
|
"@sap-ux/store": "1.0.0",
|