@sap-ux/preview-middleware 0.11.34 → 0.11.36
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/command-executor.js +41 -41
- package/dist/client/adp/control-utils.js +44 -44
- package/dist/client/adp/controllers/AddFragment.controller.js +203 -203
- package/dist/client/adp/controllers/BaseDialog.controller.js +57 -57
- package/dist/client/adp/controllers/ControllerExtension.controller.js +173 -173
- package/dist/client/adp/controllers/ExtensionPoint.controller.js +100 -100
- package/dist/client/adp/init-dialogs.js +73 -73
- 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/validator.js +35 -35
- package/dist/client/cpe/documentation.js +164 -164
- package/dist/client/cpe/logger.js +30 -30
- package/dist/client/cpe/outline/nodes.js +84 -84
- package/dist/client/cpe/outline/utils.js +37 -37
- 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 +77 -77
- package/dist/client/flp/init.js +204 -204
- package/package.json +3 -2
|
@@ -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,79 +1,79 @@
|
|
|
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"], function (merge, ObjectStorageConnector, Layer, VersionInfo) {
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
6
|
-
const path = '/preview/api/changes';
|
|
7
|
-
function getFlexSettings() {
|
|
8
|
-
let result;
|
|
9
|
-
const bootstrapConfig = document.getElementById('sap-ui-bootstrap');
|
|
10
|
-
const flexSetting = bootstrapConfig?.getAttribute('data-open-ux-preview-flex-settings');
|
|
11
|
-
if (flexSetting) {
|
|
12
|
-
result = JSON.parse(flexSetting);
|
|
13
|
-
}
|
|
14
|
-
return result;
|
|
15
|
-
}
|
|
16
|
-
const connector = merge({}, ObjectStorageConnector, {
|
|
17
|
-
layers: [Layer.VENDOR, Layer.CUSTOMER_BASE],
|
|
18
|
-
storage: {
|
|
19
|
-
_itemsStoredAsObjects: true,
|
|
20
|
-
setItem: function (_key, change) {
|
|
21
|
-
const settings = getFlexSettings();
|
|
22
|
-
if (settings) {
|
|
23
|
-
change.support ??= {};
|
|
24
|
-
change.support.generator = settings.generator;
|
|
25
|
-
}
|
|
26
|
-
return fetch(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
|
-
return fetch(path, {
|
|
36
|
-
method: 'DELETE',
|
|
37
|
-
body: JSON.stringify({
|
|
38
|
-
fileName: key
|
|
39
|
-
}),
|
|
40
|
-
headers: {
|
|
41
|
-
'content-type': 'application/json'
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
},
|
|
45
|
-
clear: function () {
|
|
46
|
-
// not implemented
|
|
47
|
-
},
|
|
48
|
-
getItem: function (_key) {
|
|
49
|
-
// not implemented
|
|
50
|
-
},
|
|
51
|
-
getItems: async function () {
|
|
52
|
-
const response = await fetch(path, {
|
|
53
|
-
method: 'GET',
|
|
54
|
-
headers: {
|
|
55
|
-
'content-type': 'application/json'
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
const changes = await response.json();
|
|
59
|
-
return changes;
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
loadFeatures: async function () {
|
|
63
|
-
const features = await ObjectStorageConnector.loadFeatures();
|
|
64
|
-
const ui5Version = await VersionInfo.load();
|
|
65
|
-
const [majorVersion, minorVersion] = ui5Version.version.split('.').map(v => parseInt(v, 10));
|
|
66
|
-
features.isVariantAdaptationEnabled = majorVersion >= 1 && minorVersion >= 90;
|
|
67
|
-
const settings = getFlexSettings();
|
|
68
|
-
if (settings?.developerMode) {
|
|
69
|
-
features.isVariantAdaptationEnabled = false;
|
|
70
|
-
}
|
|
71
|
-
if (settings?.scenario === 'ADAPTATION_PROJECT') {
|
|
72
|
-
features.isVariantAdaptationEnabled = true;
|
|
73
|
-
}
|
|
74
|
-
return features;
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
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"], function (merge, ObjectStorageConnector, Layer, VersionInfo) {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
const path = '/preview/api/changes';
|
|
7
|
+
function getFlexSettings() {
|
|
8
|
+
let result;
|
|
9
|
+
const bootstrapConfig = document.getElementById('sap-ui-bootstrap');
|
|
10
|
+
const flexSetting = bootstrapConfig?.getAttribute('data-open-ux-preview-flex-settings');
|
|
11
|
+
if (flexSetting) {
|
|
12
|
+
result = JSON.parse(flexSetting);
|
|
13
|
+
}
|
|
14
|
+
return result;
|
|
15
|
+
}
|
|
16
|
+
const connector = merge({}, ObjectStorageConnector, {
|
|
17
|
+
layers: [Layer.VENDOR, Layer.CUSTOMER_BASE],
|
|
18
|
+
storage: {
|
|
19
|
+
_itemsStoredAsObjects: true,
|
|
20
|
+
setItem: function (_key, change) {
|
|
21
|
+
const settings = getFlexSettings();
|
|
22
|
+
if (settings) {
|
|
23
|
+
change.support ??= {};
|
|
24
|
+
change.support.generator = settings.generator;
|
|
25
|
+
}
|
|
26
|
+
return fetch(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
|
+
return fetch(path, {
|
|
36
|
+
method: 'DELETE',
|
|
37
|
+
body: JSON.stringify({
|
|
38
|
+
fileName: key
|
|
39
|
+
}),
|
|
40
|
+
headers: {
|
|
41
|
+
'content-type': 'application/json'
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
},
|
|
45
|
+
clear: function () {
|
|
46
|
+
// not implemented
|
|
47
|
+
},
|
|
48
|
+
getItem: function (_key) {
|
|
49
|
+
// not implemented
|
|
50
|
+
},
|
|
51
|
+
getItems: async function () {
|
|
52
|
+
const response = await fetch(path, {
|
|
53
|
+
method: 'GET',
|
|
54
|
+
headers: {
|
|
55
|
+
'content-type': 'application/json'
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
const changes = await response.json();
|
|
59
|
+
return changes;
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
loadFeatures: async function () {
|
|
63
|
+
const features = await ObjectStorageConnector.loadFeatures();
|
|
64
|
+
const ui5Version = await VersionInfo.load();
|
|
65
|
+
const [majorVersion, minorVersion] = ui5Version.version.split('.').map(v => parseInt(v, 10));
|
|
66
|
+
features.isVariantAdaptationEnabled = majorVersion >= 1 && minorVersion >= 90;
|
|
67
|
+
const settings = getFlexSettings();
|
|
68
|
+
if (settings?.developerMode) {
|
|
69
|
+
features.isVariantAdaptationEnabled = false;
|
|
70
|
+
}
|
|
71
|
+
if (settings?.scenario === 'ADAPTATION_PROJECT') {
|
|
72
|
+
features.isVariantAdaptationEnabled = true;
|
|
73
|
+
}
|
|
74
|
+
return features;
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
return connector;
|
|
78
78
|
});
|
|
79
79
|
//# sourceMappingURL=WorkspaceConnector.js.map
|