@sap-ux/preview-middleware 0.16.79 → 0.16.80
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/config.js +8 -8
- package/dist/base/flex.d.ts +0 -1
- package/dist/base/flex.js +3 -4
- package/dist/base/flp.d.ts +0 -1
- package/dist/base/flp.js +2 -2
- package/dist/base/test.d.ts +0 -1
- package/dist/base/test.js +2 -3
- package/dist/client/adp/api-handler.js +142 -142
- package/dist/client/adp/command-executor.js +58 -58
- package/dist/client/adp/control-utils.js +44 -44
- package/dist/client/adp/controllers/BaseDialog.controller.js +105 -105
- package/dist/client/adp/controllers/ControllerExtension.controller.js +213 -213
- package/dist/client/adp/controllers/ExtensionPoint.controller.js +138 -138
- package/dist/client/adp/init-dialogs.js +159 -159
- package/dist/client/adp/quick-actions/common/add-controller-to-page.js +54 -54
- package/dist/client/adp/quick-actions/common/op-add-custom-section.js +35 -35
- package/dist/client/adp/quick-actions/common/op-add-header-field.js +47 -47
- package/dist/client/adp/quick-actions/fe-v2/change-table-columns.js +98 -98
- package/dist/client/adp/quick-actions/fe-v2/create-page-action.js +35 -35
- package/dist/client/adp/quick-actions/fe-v2/create-table-action.js +69 -69
- package/dist/client/adp/quick-actions/fe-v2/lr-toggle-clear-filter-bar.js +57 -57
- package/dist/client/adp/quick-actions/fe-v2/registry.js +60 -60
- package/dist/client/adp/quick-actions/fe-v4/lr-toggle-clear-filter-bar.js +79 -79
- package/dist/client/adp/quick-actions/fe-v4/registry.js +50 -50
- package/dist/client/adp/quick-actions/fe-v4/utils.js +52 -52
- package/dist/client/adp/quick-actions/load.js +48 -48
- package/dist/client/adp/utils.js +160 -160
- 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 +34 -34
- package/dist/client/cpe/documentation.js +164 -164
- package/dist/client/cpe/logger.js +30 -30
- package/dist/client/cpe/outline/editable.js +37 -37
- package/dist/client/cpe/outline/nodes.js +187 -187
- package/dist/client/cpe/quick-actions/quick-action-definition.js +4 -4
- package/dist/client/cpe/quick-actions/registry.js +143 -143
- package/dist/client/cpe/quick-actions/utils.js +92 -92
- package/dist/client/cpe/types.js +4 -4
- package/dist/client/cpe/ui5-utils.js +33 -33
- package/dist/client/cpe/utils.js +97 -97
- package/dist/client/flp/WorkspaceConnector.js +87 -87
- package/dist/client/flp/common.js +28 -28
- package/dist/client/flp/enableFakeConnector.js +84 -84
- package/dist/client/flp/initConnectors.js +30 -30
- package/dist/client/flp/initRta.js +178 -178
- package/dist/client/i18n.js +56 -56
- package/dist/client/thirdparty/@sap-ux-private/control-property-editor-common.js +5 -8
- package/dist/client/tsconfig.tsbuildinfo +1 -0
- package/dist/client/utils/application.js +32 -32
- package/dist/client/utils/core.js +68 -68
- package/dist/client/utils/error.js +19 -19
- package/dist/client/utils/version.js +68 -68
- package/package.json +4 -4
package/dist/client/cpe/utils.js
CHANGED
|
@@ -1,99 +1,99 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
sap.ui.define(["sap/ui/core/mvc/XMLView", "sap/ui/core/UIComponent", "../utils/core", "../utils/version"], function (XMLView, UIComponent, ___utils_core, ___utils_version) {
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
6
|
-
const getComponent = ___utils_core["getComponent"];
|
|
7
|
-
const isLowerThanMinimalUi5Version = ___utils_version["isLowerThanMinimalUi5Version"];
|
|
8
|
-
/**
|
|
9
|
-
* Get runtime control.
|
|
10
|
-
*
|
|
11
|
-
* @param overlayControl - element overlay.
|
|
12
|
-
* @returns ManagedObject
|
|
13
|
-
*/
|
|
14
|
-
function getRuntimeControl(overlayControl) {
|
|
15
|
-
let runtimeControl;
|
|
16
|
-
if (overlayControl.getElementInstance) {
|
|
17
|
-
runtimeControl = overlayControl.getElementInstance();
|
|
18
|
-
} else {
|
|
19
|
-
runtimeControl = overlayControl.getElement();
|
|
20
|
-
}
|
|
21
|
-
return runtimeControl;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Get library of a control name.
|
|
26
|
-
*
|
|
27
|
-
* @param controlName - name of the ui5 control eg: sap.m.Button.
|
|
28
|
-
* @returns Promise<string>
|
|
29
|
-
*/
|
|
30
|
-
async function getLibrary(controlName) {
|
|
31
|
-
return new Promise(resolve => {
|
|
32
|
-
const controlPath = controlName.replace(/\./g, '/');
|
|
33
|
-
sap.ui.require([controlPath], control => {
|
|
34
|
-
const contMetadata = control.getMetadata();
|
|
35
|
-
// getLibraryName method does not exist on events
|
|
36
|
-
if (contMetadata?.getLibraryName) {
|
|
37
|
-
const contLibName = contMetadata.getLibraryName();
|
|
38
|
-
resolve(contLibName);
|
|
39
|
-
} else {
|
|
40
|
-
resolve(''); // return empty for events
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Function that checks if control is reuse component
|
|
48
|
-
*
|
|
49
|
-
* @param controlId id control
|
|
50
|
-
* @param ui5VersionInfo UI5 version information
|
|
51
|
-
* @returns boolean if control is from reused component view
|
|
52
|
-
*/
|
|
53
|
-
function isReuseComponent(controlId, ui5VersionInfo) {
|
|
54
|
-
if (isLowerThanMinimalUi5Version(ui5VersionInfo, {
|
|
55
|
-
major: 1,
|
|
56
|
-
minor: 115
|
|
57
|
-
})) {
|
|
58
|
-
return false;
|
|
59
|
-
}
|
|
60
|
-
const component = getComponent(controlId);
|
|
61
|
-
if (!component) {
|
|
62
|
-
return false;
|
|
63
|
-
}
|
|
64
|
-
const manifest = component.getManifest();
|
|
65
|
-
if (!manifest) {
|
|
66
|
-
return false;
|
|
67
|
-
}
|
|
68
|
-
return manifest['sap.app']?.type === 'component';
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Gets the root view of component for the provided ComponentContainer control.
|
|
73
|
-
*
|
|
74
|
-
* @param container ComponentContainer control.
|
|
75
|
-
* @returns XMLView which is the root control of the component if it exists.
|
|
76
|
-
*/
|
|
77
|
-
function getRootControlFromComponentContainer(container) {
|
|
78
|
-
if (container) {
|
|
79
|
-
const componentId = container.getComponent();
|
|
80
|
-
const component = getComponent(componentId);
|
|
81
|
-
if (component instanceof UIComponent) {
|
|
82
|
-
const rootControl = component.getRootControl();
|
|
83
|
-
if (rootControl instanceof XMLView) {
|
|
84
|
-
return rootControl;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
return undefined;
|
|
89
|
-
}
|
|
90
|
-
var __exports = {
|
|
91
|
-
__esModule: true
|
|
92
|
-
};
|
|
93
|
-
__exports.getRuntimeControl = getRuntimeControl;
|
|
94
|
-
__exports.getLibrary = getLibrary;
|
|
95
|
-
__exports.isReuseComponent = isReuseComponent;
|
|
96
|
-
__exports.getRootControlFromComponentContainer = getRootControlFromComponentContainer;
|
|
97
|
-
return __exports;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define(["sap/ui/core/mvc/XMLView", "sap/ui/core/UIComponent", "../utils/core", "../utils/version"], function (XMLView, UIComponent, ___utils_core, ___utils_version) {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
const getComponent = ___utils_core["getComponent"];
|
|
7
|
+
const isLowerThanMinimalUi5Version = ___utils_version["isLowerThanMinimalUi5Version"];
|
|
8
|
+
/**
|
|
9
|
+
* Get runtime control.
|
|
10
|
+
*
|
|
11
|
+
* @param overlayControl - element overlay.
|
|
12
|
+
* @returns ManagedObject
|
|
13
|
+
*/
|
|
14
|
+
function getRuntimeControl(overlayControl) {
|
|
15
|
+
let runtimeControl;
|
|
16
|
+
if (overlayControl.getElementInstance) {
|
|
17
|
+
runtimeControl = overlayControl.getElementInstance();
|
|
18
|
+
} else {
|
|
19
|
+
runtimeControl = overlayControl.getElement();
|
|
20
|
+
}
|
|
21
|
+
return runtimeControl;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Get library of a control name.
|
|
26
|
+
*
|
|
27
|
+
* @param controlName - name of the ui5 control eg: sap.m.Button.
|
|
28
|
+
* @returns Promise<string>
|
|
29
|
+
*/
|
|
30
|
+
async function getLibrary(controlName) {
|
|
31
|
+
return new Promise(resolve => {
|
|
32
|
+
const controlPath = controlName.replace(/\./g, '/');
|
|
33
|
+
sap.ui.require([controlPath], control => {
|
|
34
|
+
const contMetadata = control.getMetadata();
|
|
35
|
+
// getLibraryName method does not exist on events
|
|
36
|
+
if (contMetadata?.getLibraryName) {
|
|
37
|
+
const contLibName = contMetadata.getLibraryName();
|
|
38
|
+
resolve(contLibName);
|
|
39
|
+
} else {
|
|
40
|
+
resolve(''); // return empty for events
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Function that checks if control is reuse component
|
|
48
|
+
*
|
|
49
|
+
* @param controlId id control
|
|
50
|
+
* @param ui5VersionInfo UI5 version information
|
|
51
|
+
* @returns boolean if control is from reused component view
|
|
52
|
+
*/
|
|
53
|
+
function isReuseComponent(controlId, ui5VersionInfo) {
|
|
54
|
+
if (isLowerThanMinimalUi5Version(ui5VersionInfo, {
|
|
55
|
+
major: 1,
|
|
56
|
+
minor: 115
|
|
57
|
+
})) {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
const component = getComponent(controlId);
|
|
61
|
+
if (!component) {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
const manifest = component.getManifest();
|
|
65
|
+
if (!manifest) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
return manifest['sap.app']?.type === 'component';
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Gets the root view of component for the provided ComponentContainer control.
|
|
73
|
+
*
|
|
74
|
+
* @param container ComponentContainer control.
|
|
75
|
+
* @returns XMLView which is the root control of the component if it exists.
|
|
76
|
+
*/
|
|
77
|
+
function getRootControlFromComponentContainer(container) {
|
|
78
|
+
if (container) {
|
|
79
|
+
const componentId = container.getComponent();
|
|
80
|
+
const component = getComponent(componentId);
|
|
81
|
+
if (component instanceof UIComponent) {
|
|
82
|
+
const rootControl = component.getRootControl();
|
|
83
|
+
if (rootControl instanceof XMLView) {
|
|
84
|
+
return rootControl;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return undefined;
|
|
89
|
+
}
|
|
90
|
+
var __exports = {
|
|
91
|
+
__esModule: true
|
|
92
|
+
};
|
|
93
|
+
__exports.getRuntimeControl = getRuntimeControl;
|
|
94
|
+
__exports.getLibrary = getLibrary;
|
|
95
|
+
__exports.isReuseComponent = isReuseComponent;
|
|
96
|
+
__exports.getRootControlFromComponentContainer = getRootControlFromComponentContainer;
|
|
97
|
+
return __exports;
|
|
98
98
|
});
|
|
99
99
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1,89 +1,89 @@
|
|
|
1
|
-
"use strict";
|
|
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) {
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
6
|
-
const CHANGES_API_PATH = ___common["CHANGES_API_PATH"];
|
|
7
|
-
const getFlexSettings = ___common["getFlexSettings"];
|
|
8
|
-
const getUi5Version = ___utils_version["getUi5Version"];
|
|
9
|
-
const isLowerThanMinimalUi5Version = ___utils_version["isLowerThanMinimalUi5Version"];
|
|
10
|
-
const connector = merge({}, ObjectStorageConnector, {
|
|
11
|
-
layers: [Layer.VENDOR, Layer.CUSTOMER_BASE],
|
|
12
|
-
storage: {
|
|
13
|
-
_itemsStoredAsObjects: true,
|
|
14
|
-
fileChangeRequestNotifier: undefined,
|
|
15
|
-
setItem: function (_key, change) {
|
|
16
|
-
const settings = getFlexSettings();
|
|
17
|
-
if (settings) {
|
|
18
|
-
change.support ??= {};
|
|
19
|
-
change.support.generator = settings.generator;
|
|
20
|
-
}
|
|
21
|
-
if (typeof this.fileChangeRequestNotifier === 'function' && change.fileName) {
|
|
22
|
-
try {
|
|
23
|
-
this.fileChangeRequestNotifier(change.fileName, 'create', change);
|
|
24
|
-
} catch (e) {
|
|
25
|
-
// exceptions in the listener call are ignored
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return fetch(CHANGES_API_PATH, {
|
|
29
|
-
method: 'POST',
|
|
30
|
-
body: JSON.stringify(change, null, 2),
|
|
31
|
-
headers: {
|
|
32
|
-
'content-type': 'application/json'
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
},
|
|
36
|
-
removeItem: function (key) {
|
|
37
|
-
if (typeof this.fileChangeRequestNotifier === 'function') {
|
|
38
|
-
try {
|
|
39
|
-
this.fileChangeRequestNotifier(key, 'delete');
|
|
40
|
-
} catch (e) {
|
|
41
|
-
// exceptions in the listener call are ignored
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
return fetch(CHANGES_API_PATH, {
|
|
45
|
-
method: 'DELETE',
|
|
46
|
-
body: JSON.stringify({
|
|
47
|
-
fileName: key
|
|
48
|
-
}),
|
|
49
|
-
headers: {
|
|
50
|
-
'content-type': 'application/json'
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
},
|
|
54
|
-
clear: function () {
|
|
55
|
-
// not implemented
|
|
56
|
-
},
|
|
57
|
-
getItem: function (_key) {
|
|
58
|
-
// not implemented
|
|
59
|
-
},
|
|
60
|
-
getItems: async function () {
|
|
61
|
-
const response = await fetch(CHANGES_API_PATH, {
|
|
62
|
-
method: 'GET',
|
|
63
|
-
headers: {
|
|
64
|
-
'content-type': 'application/json'
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
const changes = await response.json();
|
|
68
|
-
return changes;
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
loadFeatures: async function () {
|
|
72
|
-
const features = await ObjectStorageConnector.loadFeatures();
|
|
73
|
-
features.isVariantAdaptationEnabled = !isLowerThanMinimalUi5Version(await getUi5Version(), {
|
|
74
|
-
major: 1,
|
|
75
|
-
minor: 90
|
|
76
|
-
});
|
|
77
|
-
const settings = getFlexSettings();
|
|
78
|
-
if (settings?.developerMode) {
|
|
79
|
-
features.isVariantAdaptationEnabled = false;
|
|
80
|
-
}
|
|
81
|
-
if (settings?.scenario === 'ADAPTATION_PROJECT') {
|
|
82
|
-
features.isVariantAdaptationEnabled = true;
|
|
83
|
-
}
|
|
84
|
-
return features;
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
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", "./common", "../utils/version"], function (merge, ObjectStorageConnector, Layer, ___common, ___utils_version) {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
const CHANGES_API_PATH = ___common["CHANGES_API_PATH"];
|
|
7
|
+
const getFlexSettings = ___common["getFlexSettings"];
|
|
8
|
+
const getUi5Version = ___utils_version["getUi5Version"];
|
|
9
|
+
const isLowerThanMinimalUi5Version = ___utils_version["isLowerThanMinimalUi5Version"];
|
|
10
|
+
const connector = merge({}, ObjectStorageConnector, {
|
|
11
|
+
layers: [Layer.VENDOR, Layer.CUSTOMER_BASE],
|
|
12
|
+
storage: {
|
|
13
|
+
_itemsStoredAsObjects: true,
|
|
14
|
+
fileChangeRequestNotifier: undefined,
|
|
15
|
+
setItem: function (_key, change) {
|
|
16
|
+
const settings = getFlexSettings();
|
|
17
|
+
if (settings) {
|
|
18
|
+
change.support ??= {};
|
|
19
|
+
change.support.generator = settings.generator;
|
|
20
|
+
}
|
|
21
|
+
if (typeof this.fileChangeRequestNotifier === 'function' && change.fileName) {
|
|
22
|
+
try {
|
|
23
|
+
this.fileChangeRequestNotifier(change.fileName, 'create', change);
|
|
24
|
+
} catch (e) {
|
|
25
|
+
// exceptions in the listener call are ignored
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return fetch(CHANGES_API_PATH, {
|
|
29
|
+
method: 'POST',
|
|
30
|
+
body: JSON.stringify(change, null, 2),
|
|
31
|
+
headers: {
|
|
32
|
+
'content-type': 'application/json'
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
},
|
|
36
|
+
removeItem: function (key) {
|
|
37
|
+
if (typeof this.fileChangeRequestNotifier === 'function') {
|
|
38
|
+
try {
|
|
39
|
+
this.fileChangeRequestNotifier(key, 'delete');
|
|
40
|
+
} catch (e) {
|
|
41
|
+
// exceptions in the listener call are ignored
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return fetch(CHANGES_API_PATH, {
|
|
45
|
+
method: 'DELETE',
|
|
46
|
+
body: JSON.stringify({
|
|
47
|
+
fileName: key
|
|
48
|
+
}),
|
|
49
|
+
headers: {
|
|
50
|
+
'content-type': 'application/json'
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
},
|
|
54
|
+
clear: function () {
|
|
55
|
+
// not implemented
|
|
56
|
+
},
|
|
57
|
+
getItem: function (_key) {
|
|
58
|
+
// not implemented
|
|
59
|
+
},
|
|
60
|
+
getItems: async function () {
|
|
61
|
+
const response = await fetch(CHANGES_API_PATH, {
|
|
62
|
+
method: 'GET',
|
|
63
|
+
headers: {
|
|
64
|
+
'content-type': 'application/json'
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
const changes = await response.json();
|
|
68
|
+
return changes;
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
loadFeatures: async function () {
|
|
72
|
+
const features = await ObjectStorageConnector.loadFeatures();
|
|
73
|
+
features.isVariantAdaptationEnabled = !isLowerThanMinimalUi5Version(await getUi5Version(), {
|
|
74
|
+
major: 1,
|
|
75
|
+
minor: 90
|
|
76
|
+
});
|
|
77
|
+
const settings = getFlexSettings();
|
|
78
|
+
if (settings?.developerMode) {
|
|
79
|
+
features.isVariantAdaptationEnabled = false;
|
|
80
|
+
}
|
|
81
|
+
if (settings?.scenario === 'ADAPTATION_PROJECT') {
|
|
82
|
+
features.isVariantAdaptationEnabled = true;
|
|
83
|
+
}
|
|
84
|
+
return features;
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
return connector;
|
|
88
88
|
});
|
|
89
89
|
//# sourceMappingURL=WorkspaceConnector.js.map
|
|
@@ -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
|
|
@@ -1,86 +1,86 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
sap.ui.define(["sap/ui/fl/LrepConnector", "sap/ui/fl/FakeLrepConnector", "./common"], function (LrepConnector, FakeLrepConnector, ___common) {
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
6
|
-
const CHANGES_API_PATH = ___common["CHANGES_API_PATH"];
|
|
7
|
-
const getFlexSettings = ___common["getFlexSettings"];
|
|
8
|
-
/**
|
|
9
|
-
* Processes an array of FlexChange objects.
|
|
10
|
-
* It updates each change object with settings and sends them to a API endpoint.
|
|
11
|
-
*
|
|
12
|
-
* @param {FlexChange[]} changes - Array of FlexChange objects to be processed.
|
|
13
|
-
* @returns {Promise<void>} A promise that resolves when all changes are processed.
|
|
14
|
-
*/
|
|
15
|
-
async function create(changes) {
|
|
16
|
-
const settings = getFlexSettings();
|
|
17
|
-
await Promise.all(changes.map(change => {
|
|
18
|
-
if (settings) {
|
|
19
|
-
change.support ??= {};
|
|
20
|
-
change.support.generator = settings.generator;
|
|
21
|
-
}
|
|
22
|
-
if (typeof FakeLrepConnector.fileChangeRequestNotifier === 'function' && change.fileName) {
|
|
23
|
-
try {
|
|
24
|
-
FakeLrepConnector.fileChangeRequestNotifier(change.fileName, 'create', change);
|
|
25
|
-
} catch (e) {
|
|
26
|
-
// exceptions in the listener call are ignored
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return fetch(CHANGES_API_PATH, {
|
|
30
|
-
method: 'POST',
|
|
31
|
-
body: JSON.stringify(change, null, 2),
|
|
32
|
-
headers: {
|
|
33
|
-
'content-type': 'application/json'
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
}));
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Loads changes from a given path and processes them using an LrepConnector instance.
|
|
41
|
-
* The changes are then formatted and returned in a specified structure.
|
|
42
|
-
*
|
|
43
|
-
* @returns {Promise<LoadChangesResult>} A promise that resolves to an object of type LoadChangesResult.
|
|
44
|
-
*/
|
|
45
|
-
async function loadChanges() {
|
|
46
|
-
const lrep = new LrepConnector();
|
|
47
|
-
const response = await fetch(CHANGES_API_PATH, {
|
|
48
|
-
method: 'GET',
|
|
49
|
-
headers: {
|
|
50
|
-
'content-type': 'application/json'
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
const changes = await response.json();
|
|
54
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
55
|
-
args[_key] = arguments[_key];
|
|
56
|
-
}
|
|
57
|
-
return LrepConnector.prototype.loadChanges.apply(lrep, args).then(res => {
|
|
58
|
-
const flexChanges = Object.values(changes);
|
|
59
|
-
res.changes.changes = flexChanges;
|
|
60
|
-
return res;
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Configures and enables the FakeLrepConnector based on the SAP UI5 version.
|
|
66
|
-
* If the minor version of the SAP UI5 is less than 72, this function extends
|
|
67
|
-
* the FakeLrepConnector's prototype with specific methods and enables the fake connector.
|
|
68
|
-
*
|
|
69
|
-
* Assumes the existence of a global 'sap' object with a 'ui.version' property,
|
|
70
|
-
* and global jQuery object with 'extend' method.
|
|
71
|
-
*
|
|
72
|
-
* @returns {void}
|
|
73
|
-
*/
|
|
74
|
-
var __exports = function () {
|
|
75
|
-
jQuery.extend(FakeLrepConnector.prototype, {
|
|
76
|
-
create,
|
|
77
|
-
loadChanges,
|
|
78
|
-
loadSettings: () => Promise.resolve()
|
|
79
|
-
});
|
|
80
|
-
FakeLrepConnector.enableFakeConnector();
|
|
81
|
-
};
|
|
82
|
-
__exports.create = create;
|
|
83
|
-
__exports.loadChanges = loadChanges;
|
|
84
|
-
return __exports;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define(["sap/ui/fl/LrepConnector", "sap/ui/fl/FakeLrepConnector", "./common"], function (LrepConnector, FakeLrepConnector, ___common) {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
const CHANGES_API_PATH = ___common["CHANGES_API_PATH"];
|
|
7
|
+
const getFlexSettings = ___common["getFlexSettings"];
|
|
8
|
+
/**
|
|
9
|
+
* Processes an array of FlexChange objects.
|
|
10
|
+
* It updates each change object with settings and sends them to a API endpoint.
|
|
11
|
+
*
|
|
12
|
+
* @param {FlexChange[]} changes - Array of FlexChange objects to be processed.
|
|
13
|
+
* @returns {Promise<void>} A promise that resolves when all changes are processed.
|
|
14
|
+
*/
|
|
15
|
+
async function create(changes) {
|
|
16
|
+
const settings = getFlexSettings();
|
|
17
|
+
await Promise.all(changes.map(change => {
|
|
18
|
+
if (settings) {
|
|
19
|
+
change.support ??= {};
|
|
20
|
+
change.support.generator = settings.generator;
|
|
21
|
+
}
|
|
22
|
+
if (typeof FakeLrepConnector.fileChangeRequestNotifier === 'function' && change.fileName) {
|
|
23
|
+
try {
|
|
24
|
+
FakeLrepConnector.fileChangeRequestNotifier(change.fileName, 'create', change);
|
|
25
|
+
} catch (e) {
|
|
26
|
+
// exceptions in the listener call are ignored
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return fetch(CHANGES_API_PATH, {
|
|
30
|
+
method: 'POST',
|
|
31
|
+
body: JSON.stringify(change, null, 2),
|
|
32
|
+
headers: {
|
|
33
|
+
'content-type': 'application/json'
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Loads changes from a given path and processes them using an LrepConnector instance.
|
|
41
|
+
* The changes are then formatted and returned in a specified structure.
|
|
42
|
+
*
|
|
43
|
+
* @returns {Promise<LoadChangesResult>} A promise that resolves to an object of type LoadChangesResult.
|
|
44
|
+
*/
|
|
45
|
+
async function loadChanges() {
|
|
46
|
+
const lrep = new LrepConnector();
|
|
47
|
+
const response = await fetch(CHANGES_API_PATH, {
|
|
48
|
+
method: 'GET',
|
|
49
|
+
headers: {
|
|
50
|
+
'content-type': 'application/json'
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
const changes = await response.json();
|
|
54
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
55
|
+
args[_key] = arguments[_key];
|
|
56
|
+
}
|
|
57
|
+
return LrepConnector.prototype.loadChanges.apply(lrep, args).then(res => {
|
|
58
|
+
const flexChanges = Object.values(changes);
|
|
59
|
+
res.changes.changes = flexChanges;
|
|
60
|
+
return res;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Configures and enables the FakeLrepConnector based on the SAP UI5 version.
|
|
66
|
+
* If the minor version of the SAP UI5 is less than 72, this function extends
|
|
67
|
+
* the FakeLrepConnector's prototype with specific methods and enables the fake connector.
|
|
68
|
+
*
|
|
69
|
+
* Assumes the existence of a global 'sap' object with a 'ui.version' property,
|
|
70
|
+
* and global jQuery object with 'extend' method.
|
|
71
|
+
*
|
|
72
|
+
* @returns {void}
|
|
73
|
+
*/
|
|
74
|
+
var __exports = function () {
|
|
75
|
+
jQuery.extend(FakeLrepConnector.prototype, {
|
|
76
|
+
create,
|
|
77
|
+
loadChanges,
|
|
78
|
+
loadSettings: () => Promise.resolve()
|
|
79
|
+
});
|
|
80
|
+
FakeLrepConnector.enableFakeConnector();
|
|
81
|
+
};
|
|
82
|
+
__exports.create = create;
|
|
83
|
+
__exports.loadChanges = loadChanges;
|
|
84
|
+
return __exports;
|
|
85
85
|
});
|
|
86
86
|
//# sourceMappingURL=enableFakeConnector.js.map
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
sap.ui.define(["../utils/version"], function (___utils_version) {
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
6
|
-
const getUi5Version = ___utils_version["getUi5Version"];
|
|
7
|
-
const isLowerThanMinimalUi5Version = ___utils_version["isLowerThanMinimalUi5Version"];
|
|
8
|
-
/**
|
|
9
|
-
* Initializes UI5 connectors based on the current UI5 version.
|
|
10
|
-
*
|
|
11
|
-
* For UI5 versions below 1.72, this function dynamically requires and executes a FakeLrepConnector.
|
|
12
|
-
* For UI5 versions 1.72 and above, it defines a local connector that reuses the WorkspaceConnector.
|
|
13
|
-
* This setup allows for flexibility in using different connectors based on the UI5 version.
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* intiConnectors(); // Simply call the function without any arguments.
|
|
17
|
-
*/
|
|
18
|
-
async function initConnectors() {
|
|
19
|
-
if (isLowerThanMinimalUi5Version(await getUi5Version(), {
|
|
20
|
-
major: 1,
|
|
21
|
-
minor: 72
|
|
22
|
-
})) {
|
|
23
|
-
sap.ui.require(['open/ux/preview/client/flp/enableFakeConnector'], function (enableFakeConnector) {
|
|
24
|
-
enableFakeConnector();
|
|
25
|
-
});
|
|
26
|
-
} else {
|
|
27
|
-
sap.ui.define('custom.connectors.WorkspaceConnector', ['open/ux/preview/client/flp/WorkspaceConnector'], connector => connector, true);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
return initConnectors;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define(["../utils/version"], function (___utils_version) {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
const getUi5Version = ___utils_version["getUi5Version"];
|
|
7
|
+
const isLowerThanMinimalUi5Version = ___utils_version["isLowerThanMinimalUi5Version"];
|
|
8
|
+
/**
|
|
9
|
+
* Initializes UI5 connectors based on the current UI5 version.
|
|
10
|
+
*
|
|
11
|
+
* For UI5 versions below 1.72, this function dynamically requires and executes a FakeLrepConnector.
|
|
12
|
+
* For UI5 versions 1.72 and above, it defines a local connector that reuses the WorkspaceConnector.
|
|
13
|
+
* This setup allows for flexibility in using different connectors based on the UI5 version.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* intiConnectors(); // Simply call the function without any arguments.
|
|
17
|
+
*/
|
|
18
|
+
async function initConnectors() {
|
|
19
|
+
if (isLowerThanMinimalUi5Version(await getUi5Version(), {
|
|
20
|
+
major: 1,
|
|
21
|
+
minor: 72
|
|
22
|
+
})) {
|
|
23
|
+
sap.ui.require(['open/ux/preview/client/flp/enableFakeConnector'], function (enableFakeConnector) {
|
|
24
|
+
enableFakeConnector();
|
|
25
|
+
});
|
|
26
|
+
} else {
|
|
27
|
+
sap.ui.define('custom.connectors.WorkspaceConnector', ['open/ux/preview/client/flp/WorkspaceConnector'], connector => connector, true);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return initConnectors;
|
|
31
31
|
});
|
|
32
32
|
//# sourceMappingURL=initConnectors.js.map
|