@sap-ux/preview-middleware 0.19.40 → 0.19.41
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/add-fragment.js +46 -46
- package/dist/client/adp/api-handler.js +159 -159
- package/dist/client/adp/command-executor.js +75 -75
- package/dist/client/adp/control-utils.js +44 -44
- package/dist/client/adp/controllers/ControllerExtension.controller.js +210 -210
- package/dist/client/adp/controllers/ExtensionPoint.controller.js +139 -139
- package/dist/client/adp/controllers/FileExistsDialog.controller.js +66 -66
- package/dist/client/adp/dialog-factory.js +135 -135
- package/dist/client/adp/init-dialogs.js +163 -163
- package/dist/client/adp/quick-actions/add-new-subpage-quick-action-base.js +96 -96
- package/dist/client/adp/quick-actions/common/add-controller-to-page.js +60 -60
- package/dist/client/adp/quick-actions/common/create-page-action.js +54 -54
- package/dist/client/adp/quick-actions/common/op-add-custom-section.js +39 -39
- package/dist/client/adp/quick-actions/common/op-add-header-field.js +67 -67
- package/dist/client/adp/quick-actions/common/utils.js +18 -18
- package/dist/client/adp/quick-actions/control-types.js +23 -23
- 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/add-new-subpage.js +81 -81
- package/dist/client/adp/quick-actions/fe-v2/change-table-actions.js +67 -67
- 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 +107 -107
- package/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.js +99 -99
- 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 +77 -77
- package/dist/client/adp/quick-actions/fe-v2/utils.js +116 -116
- package/dist/client/adp/quick-actions/fe-v4/add-new-subpage.js +138 -138
- package/dist/client/adp/quick-actions/fe-v4/change-table-actions.js +79 -79
- package/dist/client/adp/quick-actions/fe-v4/change-table-columns.js +75 -75
- package/dist/client/adp/quick-actions/fe-v4/create-table-action.js +53 -53
- package/dist/client/adp/quick-actions/fe-v4/create-table-custom-column.js +49 -49
- 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 +84 -84
- 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 +60 -60
- package/dist/client/adp/quick-actions/fe-v4/utils.js +72 -72
- package/dist/client/adp/quick-actions/load.js +44 -44
- package/dist/client/adp/quick-actions/quick-action-base.js +64 -64
- package/dist/client/adp/utils.js +218 -218
- package/dist/client/cpe/additional-change-info/add-xml-additional-info.js +75 -75
- 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 +203 -203
- 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 +111 -111
- package/dist/client/flp/WorkspaceConnector.js +92 -92
- package/dist/client/flp/common.js +28 -28
- package/dist/client/flp/enableFakeConnector.js +89 -89
- package/dist/client/flp/homepage/Component.js +14 -14
- package/dist/client/flp/initCdm.js +117 -117
- 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/additional-change-info.js +54 -54
- package/dist/client/utils/application.js +32 -32
- package/dist/client/utils/core.js +84 -84
- package/dist/client/utils/error.js +19 -19
- package/dist/client/utils/fe-v2.js +56 -56
- package/dist/client/utils/fe-v4.js +140 -140
- package/dist/client/utils/version.js +104 -104
- package/package.json +5 -5
|
@@ -1,86 +1,86 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
sap.ui.define(["sap/ui/core/Component", "sap/ui/core/Element"], function (Component, Element) {
|
|
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?.getComponentById) {
|
|
14
|
-
return Component.getComponentById(id);
|
|
15
|
-
} else if (Component?.get) {
|
|
16
|
-
// Older version must be still supported until maintenance period.
|
|
17
|
-
return Component.get(id); // NOSONAR
|
|
18
|
-
} else {
|
|
19
|
-
// Older version must be still supported until maintenance period.
|
|
20
|
-
return sap.ui.getCore().getComponent(id); // NOSONAR
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Returns control by its global ID.
|
|
26
|
-
*
|
|
27
|
-
* @param id Id of the control.
|
|
28
|
-
* @returns Control instance if it exists.
|
|
29
|
-
*/
|
|
30
|
-
function getControlById(id) {
|
|
31
|
-
if (typeof Element.getElementById === 'function') {
|
|
32
|
-
return Element.getElementById(id);
|
|
33
|
-
} else {
|
|
34
|
-
return sap.ui.getCore().byId(id);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Checks wether this object is an instance of a ManagedObject.
|
|
40
|
-
*
|
|
41
|
-
* @param element An object.
|
|
42
|
-
* @returns True if element is an instance of a ManagedObject.
|
|
43
|
-
*/
|
|
44
|
-
function isManagedObject(element) {
|
|
45
|
-
if (typeof element?.isA === 'function') {
|
|
46
|
-
return element.isA('sap.ui.base.ManagedObject');
|
|
47
|
-
}
|
|
48
|
-
return false;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Checks whether this object is an instance of the named type.
|
|
53
|
-
*
|
|
54
|
-
* @param type - Type to check for.
|
|
55
|
-
* @param element - Object to check
|
|
56
|
-
* @returns Whether this object is an instance of the given type.
|
|
57
|
-
*/
|
|
58
|
-
function isA(type, element) {
|
|
59
|
-
return !!element?.isA(type);
|
|
60
|
-
}
|
|
61
|
-
function hasParent(component, parentIdToFind) {
|
|
62
|
-
const parent = component.getParent();
|
|
63
|
-
if (!parent) {
|
|
64
|
-
return false;
|
|
65
|
-
}
|
|
66
|
-
if (parent.getId() === parentIdToFind) {
|
|
67
|
-
return true;
|
|
68
|
-
}
|
|
69
|
-
return hasParent(parent, parentIdToFind);
|
|
70
|
-
}
|
|
71
|
-
function findNestedElements(ownerElement, candidates) {
|
|
72
|
-
const ownerId = ownerElement.getId();
|
|
73
|
-
return candidates.filter(item => hasParent(item, ownerId));
|
|
74
|
-
}
|
|
75
|
-
var __exports = {
|
|
76
|
-
__esModule: true
|
|
77
|
-
};
|
|
78
|
-
__exports.getComponent = getComponent;
|
|
79
|
-
__exports.getControlById = getControlById;
|
|
80
|
-
__exports.isManagedObject = isManagedObject;
|
|
81
|
-
__exports.isA = isA;
|
|
82
|
-
__exports.hasParent = hasParent;
|
|
83
|
-
__exports.findNestedElements = findNestedElements;
|
|
84
|
-
return __exports;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define(["sap/ui/core/Component", "sap/ui/core/Element"], function (Component, Element) {
|
|
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?.getComponentById) {
|
|
14
|
+
return Component.getComponentById(id);
|
|
15
|
+
} else if (Component?.get) {
|
|
16
|
+
// Older version must be still supported until maintenance period.
|
|
17
|
+
return Component.get(id); // NOSONAR
|
|
18
|
+
} else {
|
|
19
|
+
// Older version must be still supported until maintenance period.
|
|
20
|
+
return sap.ui.getCore().getComponent(id); // NOSONAR
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Returns control by its global ID.
|
|
26
|
+
*
|
|
27
|
+
* @param id Id of the control.
|
|
28
|
+
* @returns Control instance if it exists.
|
|
29
|
+
*/
|
|
30
|
+
function getControlById(id) {
|
|
31
|
+
if (typeof Element.getElementById === 'function') {
|
|
32
|
+
return Element.getElementById(id);
|
|
33
|
+
} else {
|
|
34
|
+
return sap.ui.getCore().byId(id);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Checks wether this object is an instance of a ManagedObject.
|
|
40
|
+
*
|
|
41
|
+
* @param element An object.
|
|
42
|
+
* @returns True if element is an instance of a ManagedObject.
|
|
43
|
+
*/
|
|
44
|
+
function isManagedObject(element) {
|
|
45
|
+
if (typeof element?.isA === 'function') {
|
|
46
|
+
return element.isA('sap.ui.base.ManagedObject');
|
|
47
|
+
}
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Checks whether this object is an instance of the named type.
|
|
53
|
+
*
|
|
54
|
+
* @param type - Type to check for.
|
|
55
|
+
* @param element - Object to check
|
|
56
|
+
* @returns Whether this object is an instance of the given type.
|
|
57
|
+
*/
|
|
58
|
+
function isA(type, element) {
|
|
59
|
+
return !!element?.isA(type);
|
|
60
|
+
}
|
|
61
|
+
function hasParent(component, parentIdToFind) {
|
|
62
|
+
const parent = component.getParent();
|
|
63
|
+
if (!parent) {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
if (parent.getId() === parentIdToFind) {
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
return hasParent(parent, parentIdToFind);
|
|
70
|
+
}
|
|
71
|
+
function findNestedElements(ownerElement, candidates) {
|
|
72
|
+
const ownerId = ownerElement.getId();
|
|
73
|
+
return candidates.filter(item => hasParent(item, ownerId));
|
|
74
|
+
}
|
|
75
|
+
var __exports = {
|
|
76
|
+
__esModule: true
|
|
77
|
+
};
|
|
78
|
+
__exports.getComponent = getComponent;
|
|
79
|
+
__exports.getControlById = getControlById;
|
|
80
|
+
__exports.isManagedObject = isManagedObject;
|
|
81
|
+
__exports.isA = isA;
|
|
82
|
+
__exports.hasParent = hasParent;
|
|
83
|
+
__exports.findNestedElements = findNestedElements;
|
|
84
|
+
return __exports;
|
|
85
85
|
});
|
|
86
86
|
//# sourceMappingURL=core.js.map
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
sap.ui.define([], function () {
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Returns the Error if the error is an instance of `Error` otherwise a new Error instance with string representation of the error.
|
|
8
|
-
*
|
|
9
|
-
* @param error {unknown} - the error instance
|
|
10
|
-
* @returns {Error} the error
|
|
11
|
-
*/
|
|
12
|
-
function getError(error) {
|
|
13
|
-
return error instanceof Error ? error : new Error(JSON.stringify(error));
|
|
14
|
-
}
|
|
15
|
-
var __exports = {
|
|
16
|
-
__esModule: true
|
|
17
|
-
};
|
|
18
|
-
__exports.getError = getError;
|
|
19
|
-
return __exports;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define([], function () {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Returns the Error if the error is an instance of `Error` otherwise a new Error instance with string representation of the error.
|
|
8
|
+
*
|
|
9
|
+
* @param error {unknown} - the error instance
|
|
10
|
+
* @returns {Error} the error
|
|
11
|
+
*/
|
|
12
|
+
function getError(error) {
|
|
13
|
+
return error instanceof Error ? error : new Error(JSON.stringify(error));
|
|
14
|
+
}
|
|
15
|
+
var __exports = {
|
|
16
|
+
__esModule: true
|
|
17
|
+
};
|
|
18
|
+
__exports.getError = getError;
|
|
19
|
+
return __exports;
|
|
20
20
|
});
|
|
21
21
|
//# sourceMappingURL=error.js.map
|
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
sap.ui.define([], function () {
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
6
|
-
const OBJECT_PAGE_COMPONENT_NAME = 'sap.suite.ui.generic.template.ObjectPage';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Returns application object page definitions found in manifest
|
|
10
|
-
*
|
|
11
|
-
* @param manifest - manifest object
|
|
12
|
-
* @returns array with page descriptors
|
|
13
|
-
*/
|
|
14
|
-
function getV2ApplicationPages(manifest) {
|
|
15
|
-
// do we need to distinguish both navigation source and target entitySets to differentiate alternative routes?
|
|
16
|
-
const rootEntry = manifest['sap.ui.generic.app'] || manifest['sap.ovp'];
|
|
17
|
-
if (rootEntry) {
|
|
18
|
-
const result = [];
|
|
19
|
-
const collectPageData = (pagesDefinitions, idPrefix) => {
|
|
20
|
-
if (!pagesDefinitions) {
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
if (Array.isArray(pagesDefinitions)) {
|
|
24
|
-
pagesDefinitions.forEach((entry, idx) => {
|
|
25
|
-
const id = `${idPrefix}-${idx}`;
|
|
26
|
-
if (entry.component.name === OBJECT_PAGE_COMPONENT_NAME) {
|
|
27
|
-
result.push({
|
|
28
|
-
id,
|
|
29
|
-
entitySet: entry.entitySet
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
collectPageData(entry.pages, id);
|
|
33
|
-
});
|
|
34
|
-
} else {
|
|
35
|
-
const pageIds = Object.keys(pagesDefinitions);
|
|
36
|
-
for (const pageId of pageIds) {
|
|
37
|
-
if (pagesDefinitions[pageId].component.name === OBJECT_PAGE_COMPONENT_NAME) {
|
|
38
|
-
result.push({
|
|
39
|
-
id: pageId,
|
|
40
|
-
entitySet: pagesDefinitions[pageId].entitySet
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
collectPageData(pagesDefinitions[pageId].pages, idPrefix);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
collectPageData(rootEntry.pages, 'page');
|
|
48
|
-
return result;
|
|
49
|
-
}
|
|
50
|
-
return [];
|
|
51
|
-
}
|
|
52
|
-
var __exports = {
|
|
53
|
-
__esModule: true
|
|
54
|
-
};
|
|
55
|
-
__exports.getV2ApplicationPages = getV2ApplicationPages;
|
|
56
|
-
return __exports;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define([], function () {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
const OBJECT_PAGE_COMPONENT_NAME = 'sap.suite.ui.generic.template.ObjectPage';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Returns application object page definitions found in manifest
|
|
10
|
+
*
|
|
11
|
+
* @param manifest - manifest object
|
|
12
|
+
* @returns array with page descriptors
|
|
13
|
+
*/
|
|
14
|
+
function getV2ApplicationPages(manifest) {
|
|
15
|
+
// do we need to distinguish both navigation source and target entitySets to differentiate alternative routes?
|
|
16
|
+
const rootEntry = manifest['sap.ui.generic.app'] || manifest['sap.ovp'];
|
|
17
|
+
if (rootEntry) {
|
|
18
|
+
const result = [];
|
|
19
|
+
const collectPageData = (pagesDefinitions, idPrefix) => {
|
|
20
|
+
if (!pagesDefinitions) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (Array.isArray(pagesDefinitions)) {
|
|
24
|
+
pagesDefinitions.forEach((entry, idx) => {
|
|
25
|
+
const id = `${idPrefix}-${idx}`;
|
|
26
|
+
if (entry.component.name === OBJECT_PAGE_COMPONENT_NAME) {
|
|
27
|
+
result.push({
|
|
28
|
+
id,
|
|
29
|
+
entitySet: entry.entitySet
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
collectPageData(entry.pages, id);
|
|
33
|
+
});
|
|
34
|
+
} else {
|
|
35
|
+
const pageIds = Object.keys(pagesDefinitions);
|
|
36
|
+
for (const pageId of pageIds) {
|
|
37
|
+
if (pagesDefinitions[pageId].component.name === OBJECT_PAGE_COMPONENT_NAME) {
|
|
38
|
+
result.push({
|
|
39
|
+
id: pageId,
|
|
40
|
+
entitySet: pagesDefinitions[pageId].entitySet
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
collectPageData(pagesDefinitions[pageId].pages, idPrefix);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
collectPageData(rootEntry.pages, 'page');
|
|
48
|
+
return result;
|
|
49
|
+
}
|
|
50
|
+
return [];
|
|
51
|
+
}
|
|
52
|
+
var __exports = {
|
|
53
|
+
__esModule: true
|
|
54
|
+
};
|
|
55
|
+
__exports.getV2ApplicationPages = getV2ApplicationPages;
|
|
56
|
+
return __exports;
|
|
57
57
|
});
|
|
58
58
|
//# sourceMappingURL=fe-v2.js.map
|
|
@@ -1,142 +1,142 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
sap.ui.define(["sap/ui/core/Component", "./core", "sap/ui/rta/command/CommandFactory", "../cpe/utils"], function (Component, ___core, CommandFactory, ___cpe_utils) {
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
6
|
-
const isA = ___core["isA"];
|
|
7
|
-
const getOverlay = ___cpe_utils["getOverlay"];
|
|
8
|
-
/**
|
|
9
|
-
* Gets app component of a v4 project.
|
|
10
|
-
*
|
|
11
|
-
* @param control - ManagedObject.
|
|
12
|
-
* @returns AppComponent.
|
|
13
|
-
*/
|
|
14
|
-
function getV4AppComponent(control) {
|
|
15
|
-
const ownerComponent = Component.getOwnerComponentFor(control);
|
|
16
|
-
if (ownerComponent?.isA('sap.fe.core.TemplateComponent')) {
|
|
17
|
-
return ownerComponent.getAppComponent();
|
|
18
|
-
}
|
|
19
|
-
return undefined;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Gets reference id of the app.
|
|
24
|
-
*
|
|
25
|
-
* @param control - ManagedObject.
|
|
26
|
-
* @returns string.
|
|
27
|
-
*/
|
|
28
|
-
function getReference(control) {
|
|
29
|
-
const manifest = getV4AppComponent(control)?.getManifest();
|
|
30
|
-
return manifest?.['sap.app']?.id ?? '';
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Determines the page type of v4 app.
|
|
35
|
-
*
|
|
36
|
-
* @param control - ManagedObject.
|
|
37
|
-
* @returns 'ObjectPage' | 'ListReport' | undefined.
|
|
38
|
-
*/
|
|
39
|
-
function getV4PageType(control) {
|
|
40
|
-
const component = Component.getOwnerComponentFor(control);
|
|
41
|
-
if (!component?.isA('sap.fe.core.TemplateComponent')) {
|
|
42
|
-
return undefined;
|
|
43
|
-
}
|
|
44
|
-
const view = component.getRootControl();
|
|
45
|
-
const name = view.getViewName();
|
|
46
|
-
if (name === 'sap.fe.templates.ObjectPage.ObjectPage') {
|
|
47
|
-
return 'ObjectPage';
|
|
48
|
-
}
|
|
49
|
-
if (name === 'sap.fe.templates.ListReport.ListReport') {
|
|
50
|
-
return 'ListReport';
|
|
51
|
-
}
|
|
52
|
-
return undefined;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Get the containing page name of a control.
|
|
57
|
-
*
|
|
58
|
-
* @param control - UI5 control instance.
|
|
59
|
-
* @returns Page name to which the control belongs.
|
|
60
|
-
*/
|
|
61
|
-
function getPageName(control) {
|
|
62
|
-
const component = Component.getOwnerComponentFor(control);
|
|
63
|
-
if (!isA('sap.fe.core.TemplateComponent', component)) {
|
|
64
|
-
return undefined;
|
|
65
|
-
}
|
|
66
|
-
const view = component.getRootControl();
|
|
67
|
-
return view.getId().split('::').pop();
|
|
68
|
-
}
|
|
69
|
-
function getConfigMapControlIdMap(page, propertyPathSegments) {
|
|
70
|
-
if (page && !propertyPathSegments.length) {
|
|
71
|
-
return page;
|
|
72
|
-
}
|
|
73
|
-
if (page) {
|
|
74
|
-
return `${page}-${propertyPathSegments.join('/')}`;
|
|
75
|
-
}
|
|
76
|
-
return propertyPathSegments.join('/');
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Get the modified value for a control.
|
|
81
|
-
* @param modifiedControl - The modified control.
|
|
82
|
-
* @param flexSettings - Flex Settings of the control.
|
|
83
|
-
* @param propertyChanges - The change object
|
|
84
|
-
* @param propertyPathExtraSegments - optional path segments which are added to the default modified control manifest path
|
|
85
|
-
*
|
|
86
|
-
* @returns A Promise resolving to an array of FlexCommand objects.
|
|
87
|
-
*/
|
|
88
|
-
async function createManifestPropertyChange(modifiedControl, flexSettings, propertyChanges, propertyPathExtraSegments) {
|
|
89
|
-
const overlay = getOverlay(modifiedControl);
|
|
90
|
-
if (!overlay) {
|
|
91
|
-
return undefined;
|
|
92
|
-
}
|
|
93
|
-
const overlayData = overlay?.getDesignTimeMetadata().getData();
|
|
94
|
-
let manifestPropertyPath = overlayData.manifestPropertyPath(modifiedControl);
|
|
95
|
-
if (propertyPathExtraSegments) {
|
|
96
|
-
manifestPropertyPath += '/' + propertyPathExtraSegments.join('/');
|
|
97
|
-
}
|
|
98
|
-
const [manifestPropertyChange] = overlayData.manifestPropertyChange(propertyChanges, manifestPropertyPath, modifiedControl);
|
|
99
|
-
const modifiedValue = {
|
|
100
|
-
reference: getReference(modifiedControl),
|
|
101
|
-
appComponent: manifestPropertyChange.appComponent,
|
|
102
|
-
changeType: manifestPropertyChange.changeSpecificData.appDescriptorChangeType,
|
|
103
|
-
parameters: manifestPropertyChange.changeSpecificData.content.parameters,
|
|
104
|
-
selector: manifestPropertyChange.selector
|
|
105
|
-
};
|
|
106
|
-
const command = await CommandFactory.getCommandFor(modifiedControl, 'appDescriptor', modifiedValue, null, flexSettings);
|
|
107
|
-
return command;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Returns application object page definitions found in manifest
|
|
112
|
-
*
|
|
113
|
-
* @param manifest - manifest object
|
|
114
|
-
* @returns array with page descriptors
|
|
115
|
-
*/
|
|
116
|
-
function getV4ApplicationPages(manifest) {
|
|
117
|
-
const result = [];
|
|
118
|
-
const targets = manifest['sap.ui5'].routing?.targets ?? {};
|
|
119
|
-
for (const target of Object.values(targets)) {
|
|
120
|
-
if (target.name === 'sap.fe.templates.ObjectPage') {
|
|
121
|
-
result.push({
|
|
122
|
-
id: target.id,
|
|
123
|
-
entitySet: target.options?.settings?.entitySet,
|
|
124
|
-
contextPath: target.options?.settings?.contextPath
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
return result;
|
|
129
|
-
}
|
|
130
|
-
var __exports = {
|
|
131
|
-
__esModule: true
|
|
132
|
-
};
|
|
133
|
-
__exports.getV4AppComponent = getV4AppComponent;
|
|
134
|
-
__exports.getReference = getReference;
|
|
135
|
-
__exports.getV4PageType = getV4PageType;
|
|
136
|
-
__exports.getPageName = getPageName;
|
|
137
|
-
__exports.getConfigMapControlIdMap = getConfigMapControlIdMap;
|
|
138
|
-
__exports.createManifestPropertyChange = createManifestPropertyChange;
|
|
139
|
-
__exports.getV4ApplicationPages = getV4ApplicationPages;
|
|
140
|
-
return __exports;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define(["sap/ui/core/Component", "./core", "sap/ui/rta/command/CommandFactory", "../cpe/utils"], function (Component, ___core, CommandFactory, ___cpe_utils) {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
const isA = ___core["isA"];
|
|
7
|
+
const getOverlay = ___cpe_utils["getOverlay"];
|
|
8
|
+
/**
|
|
9
|
+
* Gets app component of a v4 project.
|
|
10
|
+
*
|
|
11
|
+
* @param control - ManagedObject.
|
|
12
|
+
* @returns AppComponent.
|
|
13
|
+
*/
|
|
14
|
+
function getV4AppComponent(control) {
|
|
15
|
+
const ownerComponent = Component.getOwnerComponentFor(control);
|
|
16
|
+
if (ownerComponent?.isA('sap.fe.core.TemplateComponent')) {
|
|
17
|
+
return ownerComponent.getAppComponent();
|
|
18
|
+
}
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Gets reference id of the app.
|
|
24
|
+
*
|
|
25
|
+
* @param control - ManagedObject.
|
|
26
|
+
* @returns string.
|
|
27
|
+
*/
|
|
28
|
+
function getReference(control) {
|
|
29
|
+
const manifest = getV4AppComponent(control)?.getManifest();
|
|
30
|
+
return manifest?.['sap.app']?.id ?? '';
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Determines the page type of v4 app.
|
|
35
|
+
*
|
|
36
|
+
* @param control - ManagedObject.
|
|
37
|
+
* @returns 'ObjectPage' | 'ListReport' | undefined.
|
|
38
|
+
*/
|
|
39
|
+
function getV4PageType(control) {
|
|
40
|
+
const component = Component.getOwnerComponentFor(control);
|
|
41
|
+
if (!component?.isA('sap.fe.core.TemplateComponent')) {
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
const view = component.getRootControl();
|
|
45
|
+
const name = view.getViewName();
|
|
46
|
+
if (name === 'sap.fe.templates.ObjectPage.ObjectPage') {
|
|
47
|
+
return 'ObjectPage';
|
|
48
|
+
}
|
|
49
|
+
if (name === 'sap.fe.templates.ListReport.ListReport') {
|
|
50
|
+
return 'ListReport';
|
|
51
|
+
}
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Get the containing page name of a control.
|
|
57
|
+
*
|
|
58
|
+
* @param control - UI5 control instance.
|
|
59
|
+
* @returns Page name to which the control belongs.
|
|
60
|
+
*/
|
|
61
|
+
function getPageName(control) {
|
|
62
|
+
const component = Component.getOwnerComponentFor(control);
|
|
63
|
+
if (!isA('sap.fe.core.TemplateComponent', component)) {
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
const view = component.getRootControl();
|
|
67
|
+
return view.getId().split('::').pop();
|
|
68
|
+
}
|
|
69
|
+
function getConfigMapControlIdMap(page, propertyPathSegments) {
|
|
70
|
+
if (page && !propertyPathSegments.length) {
|
|
71
|
+
return page;
|
|
72
|
+
}
|
|
73
|
+
if (page) {
|
|
74
|
+
return `${page}-${propertyPathSegments.join('/')}`;
|
|
75
|
+
}
|
|
76
|
+
return propertyPathSegments.join('/');
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Get the modified value for a control.
|
|
81
|
+
* @param modifiedControl - The modified control.
|
|
82
|
+
* @param flexSettings - Flex Settings of the control.
|
|
83
|
+
* @param propertyChanges - The change object
|
|
84
|
+
* @param propertyPathExtraSegments - optional path segments which are added to the default modified control manifest path
|
|
85
|
+
*
|
|
86
|
+
* @returns A Promise resolving to an array of FlexCommand objects.
|
|
87
|
+
*/
|
|
88
|
+
async function createManifestPropertyChange(modifiedControl, flexSettings, propertyChanges, propertyPathExtraSegments) {
|
|
89
|
+
const overlay = getOverlay(modifiedControl);
|
|
90
|
+
if (!overlay) {
|
|
91
|
+
return undefined;
|
|
92
|
+
}
|
|
93
|
+
const overlayData = overlay?.getDesignTimeMetadata().getData();
|
|
94
|
+
let manifestPropertyPath = overlayData.manifestPropertyPath(modifiedControl);
|
|
95
|
+
if (propertyPathExtraSegments) {
|
|
96
|
+
manifestPropertyPath += '/' + propertyPathExtraSegments.join('/');
|
|
97
|
+
}
|
|
98
|
+
const [manifestPropertyChange] = overlayData.manifestPropertyChange(propertyChanges, manifestPropertyPath, modifiedControl);
|
|
99
|
+
const modifiedValue = {
|
|
100
|
+
reference: getReference(modifiedControl),
|
|
101
|
+
appComponent: manifestPropertyChange.appComponent,
|
|
102
|
+
changeType: manifestPropertyChange.changeSpecificData.appDescriptorChangeType,
|
|
103
|
+
parameters: manifestPropertyChange.changeSpecificData.content.parameters,
|
|
104
|
+
selector: manifestPropertyChange.selector
|
|
105
|
+
};
|
|
106
|
+
const command = await CommandFactory.getCommandFor(modifiedControl, 'appDescriptor', modifiedValue, null, flexSettings);
|
|
107
|
+
return command;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Returns application object page definitions found in manifest
|
|
112
|
+
*
|
|
113
|
+
* @param manifest - manifest object
|
|
114
|
+
* @returns array with page descriptors
|
|
115
|
+
*/
|
|
116
|
+
function getV4ApplicationPages(manifest) {
|
|
117
|
+
const result = [];
|
|
118
|
+
const targets = manifest['sap.ui5'].routing?.targets ?? {};
|
|
119
|
+
for (const target of Object.values(targets)) {
|
|
120
|
+
if (target.name === 'sap.fe.templates.ObjectPage') {
|
|
121
|
+
result.push({
|
|
122
|
+
id: target.id,
|
|
123
|
+
entitySet: target.options?.settings?.entitySet,
|
|
124
|
+
contextPath: target.options?.settings?.contextPath
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return result;
|
|
129
|
+
}
|
|
130
|
+
var __exports = {
|
|
131
|
+
__esModule: true
|
|
132
|
+
};
|
|
133
|
+
__exports.getV4AppComponent = getV4AppComponent;
|
|
134
|
+
__exports.getReference = getReference;
|
|
135
|
+
__exports.getV4PageType = getV4PageType;
|
|
136
|
+
__exports.getPageName = getPageName;
|
|
137
|
+
__exports.getConfigMapControlIdMap = getConfigMapControlIdMap;
|
|
138
|
+
__exports.createManifestPropertyChange = createManifestPropertyChange;
|
|
139
|
+
__exports.getV4ApplicationPages = getV4ApplicationPages;
|
|
140
|
+
return __exports;
|
|
141
141
|
});
|
|
142
142
|
//# sourceMappingURL=fe-v4.js.map
|