@sap-ux/preview-middleware 0.13.7 → 0.13.9
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/api-handler.js +141 -141
- package/dist/client/adp/api-handler.ts +2 -2
- package/dist/client/adp/command-executor.js +54 -54
- package/dist/client/adp/control-utils.js +44 -44
- package/dist/client/adp/controllers/AddFragment.controller.js +206 -206
- package/dist/client/adp/controllers/BaseDialog.controller.js +57 -57
- package/dist/client/adp/controllers/ControllerExtension.controller.js +179 -179
- package/dist/client/adp/controllers/ExtensionPoint.controller.js +100 -100
- package/dist/client/adp/controllers/ExtensionPoint.controller.ts +2 -2
- package/dist/client/adp/init-dialogs.js +74 -74
- package/dist/client/adp/init.js +1 -1
- package/dist/client/adp/init.ts +1 -1
- package/dist/client/adp/ui5-version-utils.js +63 -63
- package/dist/client/adp/utils.js +33 -33
- package/dist/client/cpe/changes/flex-change.js +51 -51
- package/dist/client/cpe/changes/index.js +10 -10
- package/dist/client/cpe/changes/service.ts +3 -1
- package/dist/client/cpe/changes/validator.js +35 -35
- package/dist/client/cpe/control-data.ts +1 -0
- package/dist/client/cpe/documentation.js +164 -164
- package/dist/client/cpe/documentation.ts +5 -3
- package/dist/client/cpe/logger.js +30 -30
- package/dist/client/cpe/logger.ts +1 -1
- package/dist/client/cpe/outline/nodes.js +84 -84
- package/dist/client/cpe/outline/nodes.ts +1 -1
- package/dist/client/cpe/outline/utils.js +37 -37
- package/dist/client/cpe/selection.js +1 -1
- package/dist/client/cpe/selection.ts +3 -1
- package/dist/client/cpe/types.js +4 -4
- package/dist/client/cpe/ui5-utils.js +49 -49
- package/dist/client/cpe/utils.js +48 -48
- package/dist/client/flp/WorkspaceConnector.js +84 -84
- package/dist/client/flp/WorkspaceConnector.ts +2 -2
- package/dist/client/flp/common.js +28 -28
- package/dist/client/flp/common.ts +2 -2
- package/dist/client/flp/enableFakeConnector.js +77 -77
- package/dist/client/flp/init.js +220 -220
- package/dist/client/flp/initConnectors.js +33 -33
- package/dist/client/flp/initRta.js +178 -178
- package/package.json +4 -4
- package/templates/test/qunit.js +6 -4
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
sap.ui.define(["../control-data", "../utils", "sap/ui/dt/OverlayUtil", "sap/ui/dt/OverlayRegistry", "../ui5-utils"], function (___control_data, ___utils, OverlayUtil, OverlayRegistry, ___ui5_utils) {
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
6
|
-
const buildControlData = ___control_data["buildControlData"];
|
|
7
|
-
const getRuntimeControl = ___utils["getRuntimeControl"];
|
|
8
|
-
const getComponent = ___ui5_utils["getComponent"];
|
|
9
|
-
const isEditable = function () {
|
|
10
|
-
let id = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
11
|
-
let editable = false;
|
|
12
|
-
const control = sap.ui.getCore().byId(id);
|
|
13
|
-
if (!control) {
|
|
14
|
-
const component = getComponent(id);
|
|
15
|
-
if (component) {
|
|
16
|
-
return editable;
|
|
17
|
-
}
|
|
18
|
-
} else {
|
|
19
|
-
let controlOverlay = OverlayRegistry.getOverlay(control);
|
|
20
|
-
if (!controlOverlay?.getDomRef()) {
|
|
21
|
-
//look for closest control
|
|
22
|
-
controlOverlay = OverlayUtil.getClosestOverlayFor(control);
|
|
23
|
-
}
|
|
24
|
-
if (controlOverlay) {
|
|
25
|
-
const runtimeControl = getRuntimeControl(controlOverlay);
|
|
26
|
-
const controlData = buildControlData(runtimeControl, controlOverlay);
|
|
27
|
-
const prop = controlData.properties.find(item => item.isEnabled === true);
|
|
28
|
-
editable = prop !== undefined;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return editable;
|
|
32
|
-
};
|
|
33
|
-
var __exports = {
|
|
34
|
-
__esModule: true
|
|
35
|
-
};
|
|
36
|
-
__exports.isEditable = isEditable;
|
|
37
|
-
return __exports;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define(["../control-data", "../utils", "sap/ui/dt/OverlayUtil", "sap/ui/dt/OverlayRegistry", "../ui5-utils"], function (___control_data, ___utils, OverlayUtil, OverlayRegistry, ___ui5_utils) {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
const buildControlData = ___control_data["buildControlData"];
|
|
7
|
+
const getRuntimeControl = ___utils["getRuntimeControl"];
|
|
8
|
+
const getComponent = ___ui5_utils["getComponent"];
|
|
9
|
+
const isEditable = function () {
|
|
10
|
+
let id = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
11
|
+
let editable = false;
|
|
12
|
+
const control = sap.ui.getCore().byId(id);
|
|
13
|
+
if (!control) {
|
|
14
|
+
const component = getComponent(id);
|
|
15
|
+
if (component) {
|
|
16
|
+
return editable;
|
|
17
|
+
}
|
|
18
|
+
} else {
|
|
19
|
+
let controlOverlay = OverlayRegistry.getOverlay(control);
|
|
20
|
+
if (!controlOverlay?.getDomRef()) {
|
|
21
|
+
//look for closest control
|
|
22
|
+
controlOverlay = OverlayUtil.getClosestOverlayFor(control);
|
|
23
|
+
}
|
|
24
|
+
if (controlOverlay) {
|
|
25
|
+
const runtimeControl = getRuntimeControl(controlOverlay);
|
|
26
|
+
const controlData = buildControlData(runtimeControl, controlOverlay);
|
|
27
|
+
const prop = controlData.properties.find(item => item.isEnabled === true);
|
|
28
|
+
editable = prop !== undefined;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return editable;
|
|
32
|
+
};
|
|
33
|
+
var __exports = {
|
|
34
|
+
__esModule: true
|
|
35
|
+
};
|
|
36
|
+
__exports.isEditable = isEditable;
|
|
37
|
+
return __exports;
|
|
38
38
|
});
|
|
39
39
|
//# sourceMappingURL=utils.js.map
|
|
@@ -54,7 +54,7 @@ sap.ui.define([
|
|
|
54
54
|
constructor(rta) {
|
|
55
55
|
this.rta = rta;
|
|
56
56
|
}
|
|
57
|
-
|
|
57
|
+
init(sendAction, subscribe) {
|
|
58
58
|
const eventOrigin = new Set();
|
|
59
59
|
const onselectionChange = this.createOnSelectionChangeHandler(sendAction, eventOrigin);
|
|
60
60
|
this.rta.attachSelectionChange(event => {
|
|
@@ -101,7 +101,7 @@ export class SelectionService implements Service {
|
|
|
101
101
|
* @param sendAction action sender function
|
|
102
102
|
* @param subscribe subscriber function
|
|
103
103
|
*/
|
|
104
|
-
public
|
|
104
|
+
public init(sendAction: ActionSenderFunction, subscribe: SubscribeFunction): void {
|
|
105
105
|
const eventOrigin: Set<string> = new Set();
|
|
106
106
|
const onselectionChange = this.createOnSelectionChangeHandler(sendAction, eventOrigin);
|
|
107
107
|
this.rta.attachSelectionChange((event) => {
|
|
@@ -185,8 +185,10 @@ export class SelectionService implements Service {
|
|
|
185
185
|
const isOutline = eventOrigin.has('outline');
|
|
186
186
|
const name = controlName.toLowerCase().startsWith('sap') ? controlName : 'Other Control Types';
|
|
187
187
|
if (isOutline) {
|
|
188
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
188
189
|
reportTelemetry({ category: 'Outline Selection', controlName: name });
|
|
189
190
|
} else {
|
|
191
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
190
192
|
reportTelemetry({ category: 'Overlay Selection', controlName: name });
|
|
191
193
|
}
|
|
192
194
|
} catch (error) {
|
package/dist/client/cpe/types.js
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
sap.ui.define(["sap/ui/core/Component", "sap/ui/core/IconPool"], function (Component, IconPool) {
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Gets Component by id.
|
|
8
|
-
*
|
|
9
|
-
* @param id - unique identifier for control
|
|
10
|
-
* @returns Component | undefined
|
|
11
|
-
*/
|
|
12
|
-
function getComponent(id) {
|
|
13
|
-
if (Component?.get) {
|
|
14
|
-
return Component.get(id);
|
|
15
|
-
} else {
|
|
16
|
-
// Older version must be still supported until maintenance period.
|
|
17
|
-
return sap.ui.getCore().getComponent(id); // NOSONAR
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Get ui5 icons.
|
|
23
|
-
*
|
|
24
|
-
* @returns IconDetails[]
|
|
25
|
-
*/
|
|
26
|
-
function getIcons() {
|
|
27
|
-
return IconPool.getIconNames('undefined').map(icon => {
|
|
28
|
-
const iconInfo = IconPool.getIconInfo(icon);
|
|
29
|
-
return {
|
|
30
|
-
name: icon.toLowerCase(),
|
|
31
|
-
content: iconInfo.content,
|
|
32
|
-
fontFamily: iconInfo.fontFamily
|
|
33
|
-
};
|
|
34
|
-
}).sort((item1, item2) => {
|
|
35
|
-
if (item1.name < item2.name) {
|
|
36
|
-
return -1;
|
|
37
|
-
}
|
|
38
|
-
if (item1.name > item2.name) {
|
|
39
|
-
return 1;
|
|
40
|
-
}
|
|
41
|
-
return 0;
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
var __exports = {
|
|
45
|
-
__esModule: true
|
|
46
|
-
};
|
|
47
|
-
__exports.getComponent = getComponent;
|
|
48
|
-
__exports.getIcons = getIcons;
|
|
49
|
-
return __exports;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define(["sap/ui/core/Component", "sap/ui/core/IconPool"], function (Component, IconPool) {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Gets Component by id.
|
|
8
|
+
*
|
|
9
|
+
* @param id - unique identifier for control
|
|
10
|
+
* @returns Component | undefined
|
|
11
|
+
*/
|
|
12
|
+
function getComponent(id) {
|
|
13
|
+
if (Component?.get) {
|
|
14
|
+
return Component.get(id);
|
|
15
|
+
} else {
|
|
16
|
+
// Older version must be still supported until maintenance period.
|
|
17
|
+
return sap.ui.getCore().getComponent(id); // NOSONAR
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Get ui5 icons.
|
|
23
|
+
*
|
|
24
|
+
* @returns IconDetails[]
|
|
25
|
+
*/
|
|
26
|
+
function getIcons() {
|
|
27
|
+
return IconPool.getIconNames('undefined').map(icon => {
|
|
28
|
+
const iconInfo = IconPool.getIconInfo(icon);
|
|
29
|
+
return {
|
|
30
|
+
name: icon.toLowerCase(),
|
|
31
|
+
content: iconInfo.content,
|
|
32
|
+
fontFamily: iconInfo.fontFamily
|
|
33
|
+
};
|
|
34
|
+
}).sort((item1, item2) => {
|
|
35
|
+
if (item1.name < item2.name) {
|
|
36
|
+
return -1;
|
|
37
|
+
}
|
|
38
|
+
if (item1.name > item2.name) {
|
|
39
|
+
return 1;
|
|
40
|
+
}
|
|
41
|
+
return 0;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
var __exports = {
|
|
45
|
+
__esModule: true
|
|
46
|
+
};
|
|
47
|
+
__exports.getComponent = getComponent;
|
|
48
|
+
__exports.getIcons = getIcons;
|
|
49
|
+
return __exports;
|
|
50
50
|
});
|
|
51
51
|
//# sourceMappingURL=ui5-utils.js.map
|
package/dist/client/cpe/utils.js
CHANGED
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
sap.ui.define([], function () {
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Get runtime control.
|
|
8
|
-
*
|
|
9
|
-
* @param overlayControl - element overlay.
|
|
10
|
-
* @returns ManagedObject
|
|
11
|
-
*/
|
|
12
|
-
function getRuntimeControl(overlayControl) {
|
|
13
|
-
let runtimeControl;
|
|
14
|
-
if (overlayControl.getElementInstance) {
|
|
15
|
-
runtimeControl = overlayControl.getElementInstance();
|
|
16
|
-
} else {
|
|
17
|
-
runtimeControl = overlayControl.getElement();
|
|
18
|
-
}
|
|
19
|
-
return runtimeControl;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Get library of a control name.
|
|
24
|
-
*
|
|
25
|
-
* @param controlName - name of the ui5 control eg: sap.m.Button.
|
|
26
|
-
* @returns Promise<string>
|
|
27
|
-
*/
|
|
28
|
-
async function getLibrary(controlName) {
|
|
29
|
-
return new Promise(resolve => {
|
|
30
|
-
const controlPath = controlName.replace(/\./g, '/');
|
|
31
|
-
sap.ui.require([controlPath], control => {
|
|
32
|
-
const contMetadata = control.getMetadata();
|
|
33
|
-
// getLibraryName method does not exist on events
|
|
34
|
-
if (contMetadata?.getLibraryName) {
|
|
35
|
-
const contLibName = contMetadata.getLibraryName();
|
|
36
|
-
resolve(contLibName);
|
|
37
|
-
} else {
|
|
38
|
-
resolve(''); // return empty for events
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
var __exports = {
|
|
44
|
-
__esModule: true
|
|
45
|
-
};
|
|
46
|
-
__exports.getRuntimeControl = getRuntimeControl;
|
|
47
|
-
__exports.getLibrary = getLibrary;
|
|
48
|
-
return __exports;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define([], function () {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Get runtime control.
|
|
8
|
+
*
|
|
9
|
+
* @param overlayControl - element overlay.
|
|
10
|
+
* @returns ManagedObject
|
|
11
|
+
*/
|
|
12
|
+
function getRuntimeControl(overlayControl) {
|
|
13
|
+
let runtimeControl;
|
|
14
|
+
if (overlayControl.getElementInstance) {
|
|
15
|
+
runtimeControl = overlayControl.getElementInstance();
|
|
16
|
+
} else {
|
|
17
|
+
runtimeControl = overlayControl.getElement();
|
|
18
|
+
}
|
|
19
|
+
return runtimeControl;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Get library of a control name.
|
|
24
|
+
*
|
|
25
|
+
* @param controlName - name of the ui5 control eg: sap.m.Button.
|
|
26
|
+
* @returns Promise<string>
|
|
27
|
+
*/
|
|
28
|
+
async function getLibrary(controlName) {
|
|
29
|
+
return new Promise(resolve => {
|
|
30
|
+
const controlPath = controlName.replace(/\./g, '/');
|
|
31
|
+
sap.ui.require([controlPath], control => {
|
|
32
|
+
const contMetadata = control.getMetadata();
|
|
33
|
+
// getLibraryName method does not exist on events
|
|
34
|
+
if (contMetadata?.getLibraryName) {
|
|
35
|
+
const contLibName = contMetadata.getLibraryName();
|
|
36
|
+
resolve(contLibName);
|
|
37
|
+
} else {
|
|
38
|
+
resolve(''); // return empty for events
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
var __exports = {
|
|
44
|
+
__esModule: true
|
|
45
|
+
};
|
|
46
|
+
__exports.getRuntimeControl = getRuntimeControl;
|
|
47
|
+
__exports.getLibrary = getLibrary;
|
|
48
|
+
return __exports;
|
|
49
49
|
});
|
|
50
50
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1,86 +1,86 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
sap.ui.define(["sap/base/util/merge", "sap/ui/fl/write/api/connectors/ObjectStorageConnector", "sap/ui/fl/Layer", "sap/ui/VersionInfo", "./common"], function (merge, ObjectStorageConnector, Layer, VersionInfo, ___common) {
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
6
|
-
const CHANGES_API_PATH = ___common["CHANGES_API_PATH"];
|
|
7
|
-
const getFlexSettings = ___common["getFlexSettings"];
|
|
8
|
-
const connector = merge({}, ObjectStorageConnector, {
|
|
9
|
-
layers: [Layer.VENDOR, Layer.CUSTOMER_BASE],
|
|
10
|
-
storage: {
|
|
11
|
-
_itemsStoredAsObjects: true,
|
|
12
|
-
fileChangeRequestNotifier: undefined,
|
|
13
|
-
setItem: function (_key, change) {
|
|
14
|
-
const settings = getFlexSettings();
|
|
15
|
-
if (settings) {
|
|
16
|
-
change.support ??= {};
|
|
17
|
-
change.support.generator = settings.generator;
|
|
18
|
-
}
|
|
19
|
-
if (typeof this.fileChangeRequestNotifier === 'function' && change.fileName) {
|
|
20
|
-
try {
|
|
21
|
-
this.fileChangeRequestNotifier(change.fileName, 'create', change.changeType);
|
|
22
|
-
} catch (e) {
|
|
23
|
-
// exceptions in the listener call are ignored
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
return fetch(CHANGES_API_PATH, {
|
|
27
|
-
method: 'POST',
|
|
28
|
-
body: JSON.stringify(change, null, 2),
|
|
29
|
-
headers: {
|
|
30
|
-
'content-type': 'application/json'
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
},
|
|
34
|
-
removeItem: function (key) {
|
|
35
|
-
if (typeof this.fileChangeRequestNotifier === 'function') {
|
|
36
|
-
try {
|
|
37
|
-
this.fileChangeRequestNotifier(key, 'delete');
|
|
38
|
-
} catch (e) {
|
|
39
|
-
// exceptions in the listener call are ignored
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return fetch(CHANGES_API_PATH, {
|
|
43
|
-
method: 'DELETE',
|
|
44
|
-
body: JSON.stringify({
|
|
45
|
-
fileName: key
|
|
46
|
-
}),
|
|
47
|
-
headers: {
|
|
48
|
-
'content-type': 'application/json'
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
},
|
|
52
|
-
clear: function () {
|
|
53
|
-
// not implemented
|
|
54
|
-
},
|
|
55
|
-
getItem: function (_key) {
|
|
56
|
-
// not implemented
|
|
57
|
-
},
|
|
58
|
-
getItems: async function () {
|
|
59
|
-
const response = await fetch(CHANGES_API_PATH, {
|
|
60
|
-
method: 'GET',
|
|
61
|
-
headers: {
|
|
62
|
-
'content-type': 'application/json'
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
const changes = await response.json();
|
|
66
|
-
return changes;
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
loadFeatures: async function () {
|
|
70
|
-
const features = await ObjectStorageConnector.loadFeatures();
|
|
71
|
-
const ui5Version = await VersionInfo.load();
|
|
72
|
-
const [majorVersion, minorVersion] = ui5Version.version.split('.').map(v => parseInt(v, 10));
|
|
73
|
-
features.isVariantAdaptationEnabled = majorVersion >= 1 && minorVersion >= 90;
|
|
74
|
-
const settings = getFlexSettings();
|
|
75
|
-
if (settings?.developerMode) {
|
|
76
|
-
features.isVariantAdaptationEnabled = false;
|
|
77
|
-
}
|
|
78
|
-
if (settings?.scenario === 'ADAPTATION_PROJECT') {
|
|
79
|
-
features.isVariantAdaptationEnabled = true;
|
|
80
|
-
}
|
|
81
|
-
return features;
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
return connector;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define(["sap/base/util/merge", "sap/ui/fl/write/api/connectors/ObjectStorageConnector", "sap/ui/fl/Layer", "sap/ui/VersionInfo", "./common"], function (merge, ObjectStorageConnector, Layer, VersionInfo, ___common) {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
const CHANGES_API_PATH = ___common["CHANGES_API_PATH"];
|
|
7
|
+
const getFlexSettings = ___common["getFlexSettings"];
|
|
8
|
+
const connector = merge({}, ObjectStorageConnector, {
|
|
9
|
+
layers: [Layer.VENDOR, Layer.CUSTOMER_BASE],
|
|
10
|
+
storage: {
|
|
11
|
+
_itemsStoredAsObjects: true,
|
|
12
|
+
fileChangeRequestNotifier: undefined,
|
|
13
|
+
setItem: function (_key, change) {
|
|
14
|
+
const settings = getFlexSettings();
|
|
15
|
+
if (settings) {
|
|
16
|
+
change.support ??= {};
|
|
17
|
+
change.support.generator = settings.generator;
|
|
18
|
+
}
|
|
19
|
+
if (typeof this.fileChangeRequestNotifier === 'function' && change.fileName) {
|
|
20
|
+
try {
|
|
21
|
+
this.fileChangeRequestNotifier(change.fileName, 'create', change.changeType);
|
|
22
|
+
} catch (e) {
|
|
23
|
+
// exceptions in the listener call are ignored
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return fetch(CHANGES_API_PATH, {
|
|
27
|
+
method: 'POST',
|
|
28
|
+
body: JSON.stringify(change, null, 2),
|
|
29
|
+
headers: {
|
|
30
|
+
'content-type': 'application/json'
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
},
|
|
34
|
+
removeItem: function (key) {
|
|
35
|
+
if (typeof this.fileChangeRequestNotifier === 'function') {
|
|
36
|
+
try {
|
|
37
|
+
this.fileChangeRequestNotifier(key, 'delete');
|
|
38
|
+
} catch (e) {
|
|
39
|
+
// exceptions in the listener call are ignored
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return fetch(CHANGES_API_PATH, {
|
|
43
|
+
method: 'DELETE',
|
|
44
|
+
body: JSON.stringify({
|
|
45
|
+
fileName: key
|
|
46
|
+
}),
|
|
47
|
+
headers: {
|
|
48
|
+
'content-type': 'application/json'
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
},
|
|
52
|
+
clear: function () {
|
|
53
|
+
// not implemented
|
|
54
|
+
},
|
|
55
|
+
getItem: function (_key) {
|
|
56
|
+
// not implemented
|
|
57
|
+
},
|
|
58
|
+
getItems: async function () {
|
|
59
|
+
const response = await fetch(CHANGES_API_PATH, {
|
|
60
|
+
method: 'GET',
|
|
61
|
+
headers: {
|
|
62
|
+
'content-type': 'application/json'
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
const changes = await response.json();
|
|
66
|
+
return changes;
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
loadFeatures: async function () {
|
|
70
|
+
const features = await ObjectStorageConnector.loadFeatures();
|
|
71
|
+
const ui5Version = await VersionInfo.load();
|
|
72
|
+
const [majorVersion, minorVersion] = ui5Version.version.split('.').map(v => parseInt(v, 10));
|
|
73
|
+
features.isVariantAdaptationEnabled = majorVersion >= 1 && minorVersion >= 90;
|
|
74
|
+
const settings = getFlexSettings();
|
|
75
|
+
if (settings?.developerMode) {
|
|
76
|
+
features.isVariantAdaptationEnabled = false;
|
|
77
|
+
}
|
|
78
|
+
if (settings?.scenario === 'ADAPTATION_PROJECT') {
|
|
79
|
+
features.isVariantAdaptationEnabled = true;
|
|
80
|
+
}
|
|
81
|
+
return features;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
return connector;
|
|
85
85
|
});
|
|
86
86
|
//# sourceMappingURL=WorkspaceConnector.js.map
|
|
@@ -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',
|
|
21
|
+
this.fileChangeRequestNotifier(change.fileName, 'create', change.changeType);
|
|
22
22
|
} catch (e) {
|
|
23
23
|
// exceptions in the listener call are ignored
|
|
24
24
|
}
|
|
@@ -62,7 +62,7 @@ const connector = merge({}, ObjectStorageConnector, {
|
|
|
62
62
|
'content-type': 'application/json'
|
|
63
63
|
}
|
|
64
64
|
});
|
|
65
|
-
const changes = await response.json();
|
|
65
|
+
const changes = await response.json() as unknown as FlexChange[];
|
|
66
66
|
return changes;
|
|
67
67
|
}
|
|
68
68
|
} as typeof ObjectStorageConnector.storage,
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
sap.ui.define([], function () {
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
6
|
-
const CHANGES_API_PATH = '/preview/api/changes';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Retrieves Flex settings from a 'sap-ui-bootstrap' element's data attribute.
|
|
10
|
-
* Parses the 'data-open-ux-preview-flex-settings' attribute as JSON.
|
|
11
|
-
*
|
|
12
|
-
* @returns {FlexSettings | undefined} The parsed Flex settings if available, otherwise undefined.
|
|
13
|
-
*/
|
|
14
|
-
function getFlexSettings() {
|
|
15
|
-
let result;
|
|
16
|
-
const bootstrapConfig = document.getElementById('sap-ui-bootstrap');
|
|
17
|
-
const flexSetting = bootstrapConfig?.getAttribute('data-open-ux-preview-flex-settings');
|
|
18
|
-
if (flexSetting) {
|
|
19
|
-
result = JSON.parse(flexSetting);
|
|
20
|
-
}
|
|
21
|
-
return result;
|
|
22
|
-
}
|
|
23
|
-
var __exports = {
|
|
24
|
-
__esModule: true
|
|
25
|
-
};
|
|
26
|
-
__exports.CHANGES_API_PATH = CHANGES_API_PATH;
|
|
27
|
-
__exports.getFlexSettings = getFlexSettings;
|
|
28
|
-
return __exports;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define([], function () {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
const CHANGES_API_PATH = '/preview/api/changes';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Retrieves Flex settings from a 'sap-ui-bootstrap' element's data attribute.
|
|
10
|
+
* Parses the 'data-open-ux-preview-flex-settings' attribute as JSON.
|
|
11
|
+
*
|
|
12
|
+
* @returns {FlexSettings | undefined} The parsed Flex settings if available, otherwise undefined.
|
|
13
|
+
*/
|
|
14
|
+
function getFlexSettings() {
|
|
15
|
+
let result;
|
|
16
|
+
const bootstrapConfig = document.getElementById('sap-ui-bootstrap');
|
|
17
|
+
const flexSetting = bootstrapConfig?.getAttribute('data-open-ux-preview-flex-settings');
|
|
18
|
+
if (flexSetting) {
|
|
19
|
+
result = JSON.parse(flexSetting);
|
|
20
|
+
}
|
|
21
|
+
return result;
|
|
22
|
+
}
|
|
23
|
+
var __exports = {
|
|
24
|
+
__esModule: true
|
|
25
|
+
};
|
|
26
|
+
__exports.CHANGES_API_PATH = CHANGES_API_PATH;
|
|
27
|
+
__exports.getFlexSettings = getFlexSettings;
|
|
28
|
+
return __exports;
|
|
29
29
|
});
|
|
30
30
|
//# sourceMappingURL=common.js.map
|
|
@@ -18,11 +18,11 @@ export const CHANGES_API_PATH = '/preview/api/changes';
|
|
|
18
18
|
* @returns {FlexSettings | undefined} The parsed Flex settings if available, otherwise undefined.
|
|
19
19
|
*/
|
|
20
20
|
export function getFlexSettings(): FlexSettings | undefined {
|
|
21
|
-
let result;
|
|
21
|
+
let result: FlexSettings | undefined;
|
|
22
22
|
const bootstrapConfig = document.getElementById('sap-ui-bootstrap');
|
|
23
23
|
const flexSetting = bootstrapConfig?.getAttribute('data-open-ux-preview-flex-settings');
|
|
24
24
|
if (flexSetting) {
|
|
25
|
-
result = JSON.parse(flexSetting);
|
|
25
|
+
result = JSON.parse(flexSetting) as FlexSettings;
|
|
26
26
|
}
|
|
27
27
|
return result;
|
|
28
28
|
}
|