@sap-ux/preview-middleware 0.18.20 → 0.18.23
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 +153 -153
- package/dist/client/adp/api-handler.ts +2 -2
- package/dist/client/adp/command-executor.js +75 -75
- package/dist/client/adp/control-utils.js +44 -44
- package/dist/client/adp/controllers/BaseDialog.controller.js +187 -187
- package/dist/client/adp/controllers/ControllerExtension.controller.js +209 -209
- package/dist/client/adp/controllers/ExtensionPoint.controller.js +138 -138
- package/dist/client/adp/controllers/FileExistsDialog.controller.js +66 -66
- package/dist/client/adp/dialog-factory.js +133 -133
- package/dist/client/adp/init-dialogs.js +107 -107
- package/dist/client/adp/quick-actions/common/add-controller-to-page.js +55 -55
- package/dist/client/adp/quick-actions/common/add-new-annotation-file.js +24 -7
- package/dist/client/adp/quick-actions/common/add-new-annotation-file.ts +25 -7
- package/dist/client/adp/quick-actions/common/add-new-subpage.js +134 -138
- package/dist/client/adp/quick-actions/common/add-new-subpage.ts +0 -5
- package/dist/client/adp/quick-actions/common/create-page-action.js +51 -51
- package/dist/client/adp/quick-actions/common/op-add-custom-section.js +36 -36
- package/dist/client/adp/quick-actions/common/op-add-header-field.js +61 -61
- package/dist/client/adp/quick-actions/common/utils.js +18 -18
- package/dist/client/adp/quick-actions/control-types.js +21 -21
- package/dist/client/adp/quick-actions/dialog-enablement-validator.js +24 -24
- package/dist/client/adp/quick-actions/enablement-validator.js +4 -4
- package/dist/client/adp/quick-actions/fe-v2/change-table-columns.js +101 -101
- package/dist/client/adp/quick-actions/fe-v2/create-table-action.js +104 -104
- package/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.js +96 -96
- package/dist/client/adp/quick-actions/fe-v2/lr-enable-semantic-date-range-filter-bar.js +78 -78
- package/dist/client/adp/quick-actions/fe-v2/lr-enable-table-filtering.js +77 -77
- package/dist/client/adp/quick-actions/fe-v2/lr-enable-variant-management.js +69 -69
- package/dist/client/adp/quick-actions/fe-v2/lr-toggle-clear-filter-bar.js +59 -59
- package/dist/client/adp/quick-actions/fe-v2/op-enable-empty-row-mode.js +93 -93
- package/dist/client/adp/quick-actions/fe-v2/op-enable-variant-management.js +84 -84
- package/dist/client/adp/quick-actions/fe-v2/registry.js +76 -76
- package/dist/client/adp/quick-actions/fe-v2/utils.js +116 -116
- package/dist/client/adp/quick-actions/fe-v4/change-table-columns.js +73 -73
- package/dist/client/adp/quick-actions/fe-v4/create-table-action.js +50 -50
- package/dist/client/adp/quick-actions/fe-v4/create-table-custom-column.js +46 -46
- package/dist/client/adp/quick-actions/fe-v4/enable-variant-management.js +81 -81
- package/dist/client/adp/quick-actions/fe-v4/lr-enable-semantic-date-range-filter-bar.js +56 -56
- package/dist/client/adp/quick-actions/fe-v4/lr-enable-table-filtering.js +82 -82
- package/dist/client/adp/quick-actions/fe-v4/lr-toggle-clear-filter-bar.js +53 -53
- package/dist/client/adp/quick-actions/fe-v4/op-enable-empty-row-mode.js +89 -89
- package/dist/client/adp/quick-actions/fe-v4/registry.js +58 -58
- package/dist/client/adp/quick-actions/fe-v4/utils.js +47 -47
- package/dist/client/adp/quick-actions/load.js +44 -44
- package/dist/client/adp/quick-actions/quick-action-base.js +53 -53
- package/dist/client/adp/utils.js +160 -160
- package/dist/client/cpe/changes/index.js +10 -10
- package/dist/client/cpe/changes/validator.js +39 -39
- package/dist/client/cpe/documentation.js +164 -164
- package/dist/client/cpe/feature-service.js +36 -36
- package/dist/client/cpe/logger.js +30 -30
- package/dist/client/cpe/outline/editable.js +37 -37
- package/dist/client/cpe/outline/nodes.js +222 -222
- 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 +138 -138
- package/dist/client/flp/WorkspaceConnector.js +86 -86
- package/dist/client/flp/common.js +28 -28
- package/dist/client/flp/enableFakeConnector.js +83 -83
- package/dist/client/flp/initConnectors.js +28 -28
- package/dist/client/flp/initRta.js +178 -178
- package/dist/client/i18n.js +56 -56
- 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/fe-v2.js +56 -56
- package/dist/client/utils/fe-v4.js +141 -141
- package/dist/client/utils/version.js +104 -104
- package/package.json +6 -6
package/dist/client/cpe/utils.js
CHANGED
|
@@ -1,140 +1,140 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
sap.ui.define(["sap/ui/core/mvc/XMLView", "sap/ui/core/UIComponent", "../utils/core", "../utils/version", "sap/ui/dt/OverlayRegistry", "sap/ui/dt/OverlayUtil"], function (XMLView, UIComponent, ___utils_core, ___utils_version, OverlayRegistry, OverlayUtil) {
|
|
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
|
-
function getManifestProperties(control, changeService, controlOverlay) {
|
|
91
|
-
const overlayData = controlOverlay?.getDesignTimeMetadata().getData();
|
|
92
|
-
if (!controlOverlay || !overlayData?.manifestSettings) {
|
|
93
|
-
return {};
|
|
94
|
-
}
|
|
95
|
-
const manifestPropertiesValue = overlayData?.manifestSettingsValues(overlayData?.manifestSettings(control), control);
|
|
96
|
-
const manifestProperties = overlayData?.manifestSettings(control).reduce((acc, item) => {
|
|
97
|
-
const propertyId = item.id;
|
|
98
|
-
const value = changeService.getConfigurationPropertyValue(control.getId(), propertyId);
|
|
99
|
-
let propertyValue = value === 0 || value === false || value ? value : manifestPropertiesValue[propertyId];
|
|
100
|
-
if (item?.type && ['boolean', 'number', 'string'].includes(item?.type)) {
|
|
101
|
-
if (propertyValue === undefined) {
|
|
102
|
-
propertyValue = item.value; // set default value of property
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
if (!acc[propertyId]) {
|
|
106
|
-
acc[propertyId] = {
|
|
107
|
-
...item,
|
|
108
|
-
defaultValue: item.value,
|
|
109
|
-
configuration: true,
|
|
110
|
-
name: item.id,
|
|
111
|
-
readableName: item.name,
|
|
112
|
-
manifestPropertyPath: `${overlayData?.manifestPropertyPath(control)}/${propertyId}`,
|
|
113
|
-
type: item.type === 'number' ? 'int' : item.type,
|
|
114
|
-
value: propertyValue
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
return acc;
|
|
118
|
-
}, {});
|
|
119
|
-
return manifestProperties;
|
|
120
|
-
}
|
|
121
|
-
const getOverlay = control => {
|
|
122
|
-
let controlOverlay = OverlayRegistry.getOverlay(control);
|
|
123
|
-
if (!controlOverlay?.getDomRef()) {
|
|
124
|
-
//look for closest control
|
|
125
|
-
controlOverlay = OverlayUtil.getClosestOverlayFor(control);
|
|
126
|
-
}
|
|
127
|
-
return controlOverlay;
|
|
128
|
-
};
|
|
129
|
-
var __exports = {
|
|
130
|
-
__esModule: true
|
|
131
|
-
};
|
|
132
|
-
__exports.getRuntimeControl = getRuntimeControl;
|
|
133
|
-
__exports.getLibrary = getLibrary;
|
|
134
|
-
__exports.isReuseComponent = isReuseComponent;
|
|
135
|
-
__exports.getRootControlFromComponentContainer = getRootControlFromComponentContainer;
|
|
136
|
-
__exports.getManifestProperties = getManifestProperties;
|
|
137
|
-
__exports.getOverlay = getOverlay;
|
|
138
|
-
return __exports;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define(["sap/ui/core/mvc/XMLView", "sap/ui/core/UIComponent", "../utils/core", "../utils/version", "sap/ui/dt/OverlayRegistry", "sap/ui/dt/OverlayUtil"], function (XMLView, UIComponent, ___utils_core, ___utils_version, OverlayRegistry, OverlayUtil) {
|
|
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
|
+
function getManifestProperties(control, changeService, controlOverlay) {
|
|
91
|
+
const overlayData = controlOverlay?.getDesignTimeMetadata().getData();
|
|
92
|
+
if (!controlOverlay || !overlayData?.manifestSettings) {
|
|
93
|
+
return {};
|
|
94
|
+
}
|
|
95
|
+
const manifestPropertiesValue = overlayData?.manifestSettingsValues(overlayData?.manifestSettings(control), control);
|
|
96
|
+
const manifestProperties = overlayData?.manifestSettings(control).reduce((acc, item) => {
|
|
97
|
+
const propertyId = item.id;
|
|
98
|
+
const value = changeService.getConfigurationPropertyValue(control.getId(), propertyId);
|
|
99
|
+
let propertyValue = value === 0 || value === false || value ? value : manifestPropertiesValue[propertyId];
|
|
100
|
+
if (item?.type && ['boolean', 'number', 'string'].includes(item?.type)) {
|
|
101
|
+
if (propertyValue === undefined) {
|
|
102
|
+
propertyValue = item.value; // set default value of property
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
if (!acc[propertyId]) {
|
|
106
|
+
acc[propertyId] = {
|
|
107
|
+
...item,
|
|
108
|
+
defaultValue: item.value,
|
|
109
|
+
configuration: true,
|
|
110
|
+
name: item.id,
|
|
111
|
+
readableName: item.name,
|
|
112
|
+
manifestPropertyPath: `${overlayData?.manifestPropertyPath(control)}/${propertyId}`,
|
|
113
|
+
type: item.type === 'number' ? 'int' : item.type,
|
|
114
|
+
value: propertyValue
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
return acc;
|
|
118
|
+
}, {});
|
|
119
|
+
return manifestProperties;
|
|
120
|
+
}
|
|
121
|
+
const getOverlay = control => {
|
|
122
|
+
let controlOverlay = OverlayRegistry.getOverlay(control);
|
|
123
|
+
if (!controlOverlay?.getDomRef()) {
|
|
124
|
+
//look for closest control
|
|
125
|
+
controlOverlay = OverlayUtil.getClosestOverlayFor(control);
|
|
126
|
+
}
|
|
127
|
+
return controlOverlay;
|
|
128
|
+
};
|
|
129
|
+
var __exports = {
|
|
130
|
+
__esModule: true
|
|
131
|
+
};
|
|
132
|
+
__exports.getRuntimeControl = getRuntimeControl;
|
|
133
|
+
__exports.getLibrary = getLibrary;
|
|
134
|
+
__exports.isReuseComponent = isReuseComponent;
|
|
135
|
+
__exports.getRootControlFromComponentContainer = getRootControlFromComponentContainer;
|
|
136
|
+
__exports.getManifestProperties = getManifestProperties;
|
|
137
|
+
__exports.getOverlay = getOverlay;
|
|
138
|
+
return __exports;
|
|
139
139
|
});
|
|
140
140
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1,88 +1,88 @@
|
|
|
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
|
-
return await response.json();
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
loadFeatures: async function () {
|
|
71
|
-
const features = await ObjectStorageConnector.loadFeatures();
|
|
72
|
-
features.isVariantAdaptationEnabled = !isLowerThanMinimalUi5Version(await getUi5Version(), {
|
|
73
|
-
major: 1,
|
|
74
|
-
minor: 90
|
|
75
|
-
});
|
|
76
|
-
const settings = getFlexSettings();
|
|
77
|
-
if (settings?.developerMode) {
|
|
78
|
-
features.isVariantAdaptationEnabled = false;
|
|
79
|
-
}
|
|
80
|
-
if (settings?.scenario === 'ADAPTATION_PROJECT') {
|
|
81
|
-
features.isVariantAdaptationEnabled = true;
|
|
82
|
-
}
|
|
83
|
-
return features;
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
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
|
+
return await response.json();
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
loadFeatures: async function () {
|
|
71
|
+
const features = await ObjectStorageConnector.loadFeatures();
|
|
72
|
+
features.isVariantAdaptationEnabled = !isLowerThanMinimalUi5Version(await getUi5Version(), {
|
|
73
|
+
major: 1,
|
|
74
|
+
minor: 90
|
|
75
|
+
});
|
|
76
|
+
const settings = getFlexSettings();
|
|
77
|
+
if (settings?.developerMode) {
|
|
78
|
+
features.isVariantAdaptationEnabled = false;
|
|
79
|
+
}
|
|
80
|
+
if (settings?.scenario === 'ADAPTATION_PROJECT') {
|
|
81
|
+
features.isVariantAdaptationEnabled = true;
|
|
82
|
+
}
|
|
83
|
+
return features;
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
return connector;
|
|
87
87
|
});
|
|
88
88
|
//# 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
|