@sap/ux-specification 1.136.21 → 1.136.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/CHANGELOG.md +45 -9
- package/dist/documentation/runDocu-min.mjs +28 -0
- package/dist/documentation/{runDocu-min.js.map → runDocu-min.mjs.map} +2 -2
- package/dist/documentation/v2/v2-AnalyticalListPage.html +4 -4
- package/dist/documentation/v2/v2-ApplicationV2.html +4 -4
- package/dist/documentation/v2/v2-ListReport.html +4 -4
- package/dist/documentation/v2/v2-ListReportNew.html +4 -4
- package/dist/documentation/v2/v2-ObjectPage.html +4 -4
- package/dist/documentation/v2/v2-OverviewPage.html +4 -4
- package/dist/documentation/v4/v4-ApplicationV4.html +4 -4
- package/dist/documentation/v4/v4-BuildingBlocks.html +4 -4
- package/dist/documentation/v4/v4-FreestylePage.html +4 -4
- package/dist/documentation/v4/v4-ListReport.html +4 -4
- package/dist/documentation/v4/v4-ObjectPage.html +4 -4
- package/dist/index-min.mjs +1372 -0
- package/dist/index-min.mjs.map +7 -0
- package/dist/schemas/v4/ApplicationV4.json +37 -0
- package/dist/schemas/v4/BuildingBlocksConfig.json +0 -1
- package/dist/schemas/v4/ListReportConfig.json +18 -4
- package/dist/schemas/v4/ObjectPageConfig.json +83 -1
- package/dist/specification/package.json +22 -15
- package/dist/specification/scripts/macros/corrections.d.ts.map +1 -1
- package/dist/specification/scripts/macros/corrections.js +0 -6
- package/dist/specification/scripts/macros/corrections.js.map +1 -1
- package/dist/specification/src/api.d.ts.map +1 -1
- package/dist/specification/src/api.js +6 -6
- package/dist/specification/src/api.js.map +1 -1
- package/dist/specification/src/ftfs/ftfs.d.ts.map +1 -1
- package/dist/specification/src/ftfs/ftfs.js +25 -1
- package/dist/specification/src/ftfs/ftfs.js.map +1 -1
- package/dist/specification/src/i18n/i18n.js +35 -2
- package/dist/specification/src/i18n/i18n.js.map +1 -1
- package/dist/specification/src/index.d.ts +1 -0
- package/dist/specification/src/index.d.ts.map +1 -1
- package/dist/specification/src/index.js +4 -0
- package/dist/specification/src/index.js.map +1 -1
- package/dist/specification/src/sync/common/DataFieldStrategy.d.ts +11 -3
- package/dist/specification/src/sync/common/DataFieldStrategy.d.ts.map +1 -1
- package/dist/specification/src/sync/common/DataFieldStrategy.js +35 -7
- package/dist/specification/src/sync/common/DataFieldStrategy.js.map +1 -1
- package/dist/specification/src/sync/common/decoration/decorator-paths.d.ts +37 -2
- package/dist/specification/src/sync/common/decoration/decorator-paths.d.ts.map +1 -1
- package/dist/specification/src/sync/common/decoration/decorator-paths.js +18 -1
- package/dist/specification/src/sync/common/decoration/decorator-paths.js.map +1 -1
- package/dist/specification/src/sync/common/decoration/decorators.d.ts +8 -5
- package/dist/specification/src/sync/common/decoration/decorators.d.ts.map +1 -1
- package/dist/specification/src/sync/common/decoration/decorators.js +4 -1
- package/dist/specification/src/sync/common/decoration/decorators.js.map +1 -1
- package/dist/specification/src/sync/common/decoration/steps/Enums.d.ts.map +1 -1
- package/dist/specification/src/sync/common/decoration/steps/Enums.js +47 -8
- package/dist/specification/src/sync/common/decoration/steps/Enums.js.map +1 -1
- package/dist/specification/src/sync/common/i18n.json +3 -1
- package/dist/specification/src/sync/v4/application.d.ts +2 -0
- package/dist/specification/src/sync/v4/application.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/application.js +21 -0
- package/dist/specification/src/sync/v4/application.js.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/ObjectPageCustomSection.d.ts +13 -0
- package/dist/specification/src/sync/v4/export/controls/ObjectPageCustomSection.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/ObjectPageCustomSection.js +92 -1
- package/dist/specification/src/sync/v4/export/controls/ObjectPageCustomSection.js.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/ObjectPageTable.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/ObjectPageTable.js +25 -11
- package/dist/specification/src/sync/v4/export/controls/ObjectPageTable.js.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/Table.d.ts +5 -2
- package/dist/specification/src/sync/v4/export/controls/Table.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/Table.js +43 -7
- package/dist/specification/src/sync/v4/export/controls/Table.js.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/ToolBar.d.ts +8 -1
- package/dist/specification/src/sync/v4/export/controls/ToolBar.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/ToolBar.js +7 -1
- package/dist/specification/src/sync/v4/export/controls/ToolBar.js.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/ToolBarAction.d.ts +4 -2
- package/dist/specification/src/sync/v4/export/controls/ToolBarAction.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/ToolBarAction.js +21 -7
- package/dist/specification/src/sync/v4/export/controls/ToolBarAction.js.map +1 -1
- package/dist/specification/src/sync/v4/export/export.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/export/export.js +21 -6
- package/dist/specification/src/sync/v4/export/export.js.map +1 -1
- package/dist/specification/src/sync/v4/export/factory.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/export/factory.js +1 -0
- package/dist/specification/src/sync/v4/export/factory.js.map +1 -1
- package/dist/specification/src/sync/v4/export/pages/ListReport.d.ts +2 -2
- package/dist/specification/src/sync/v4/export/pages/ListReport.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/export/pages/ListReport.js.map +1 -1
- package/dist/specification/src/sync/v4/generate/actions.d.ts +2 -2
- package/dist/specification/src/sync/v4/generate/actions.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/generate/actions.js +4 -2
- package/dist/specification/src/sync/v4/generate/actions.js.map +1 -1
- package/dist/specification/src/sync/v4/generate/fpm-custom-page/annotations.js +4 -4
- package/dist/specification/src/sync/v4/generate/fpm-custom-page/annotations.js.map +1 -1
- package/dist/specification/src/sync/v4/generate/generate.d.ts +4 -2
- package/dist/specification/src/sync/v4/generate/generate.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/generate/generate.js +8 -4
- package/dist/specification/src/sync/v4/generate/generate.js.map +1 -1
- package/dist/specification/src/sync/v4/generate/list-report/ListReportUtils.d.ts +3 -3
- package/dist/specification/src/sync/v4/generate/list-report/ListReportUtils.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/generate/list-report/ListReportUtils.js +12 -13
- package/dist/specification/src/sync/v4/generate/list-report/ListReportUtils.js.map +1 -1
- package/dist/specification/src/sync/v4/generate/list-report/listReport.d.ts +27 -13
- package/dist/specification/src/sync/v4/generate/list-report/listReport.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/generate/list-report/listReport.js +197 -94
- package/dist/specification/src/sync/v4/generate/list-report/listReport.js.map +1 -1
- package/dist/specification/src/sync/v4/generate/objectPage.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/generate/objectPage.js +106 -6
- package/dist/specification/src/sync/v4/generate/objectPage.js.map +1 -1
- package/dist/specification/src/sync/v4/generate/utils/inlineEdit.d.ts +3 -3
- package/dist/specification/src/sync/v4/generate/utils/inlineEdit.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/generate/utils/inlineEdit.js +3 -3
- package/dist/specification/src/sync/v4/generate/utils/inlineEdit.js.map +1 -1
- package/dist/specification/src/sync/v4/import/pages/listReport.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/import/pages/listReport.js +66 -3
- package/dist/specification/src/sync/v4/import/pages/listReport.js.map +1 -1
- package/dist/specification/src/sync/v4/import/pages/objectPage.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/import/pages/objectPage.js +14 -0
- package/dist/specification/src/sync/v4/import/pages/objectPage.js.map +1 -1
- package/dist/specification/src/sync/v4/sync-rules/Page.d.ts +6 -0
- package/dist/specification/src/sync/v4/sync-rules/Page.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/sync-rules/Page.js +8 -0
- package/dist/specification/src/sync/v4/sync-rules/Page.js.map +1 -1
- package/dist/specification/src/sync/v4/utils/utils.d.ts +186 -51
- package/dist/specification/src/sync/v4/utils/utils.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/utils/utils.js +359 -90
- package/dist/specification/src/sync/v4/utils/utils.js.map +1 -1
- package/dist/templates/action/manifest.action-menu.json +10 -0
- package/dist/templates/action/manifest.action.json +13 -0
- package/dist/templates/app/Component.js +13 -0
- package/dist/templates/app/Component.ts +11 -0
- package/dist/templates/building-block/action/View.xml +30 -0
- package/dist/templates/building-block/chart/View.xml +9 -0
- package/dist/templates/building-block/common/manifest.json +7 -0
- package/dist/templates/building-block/custom-column/View.xml +5 -0
- package/dist/templates/building-block/custom-filter-field/View.xml +12 -0
- package/dist/templates/building-block/custom-form-field/View.xml +12 -0
- package/dist/templates/building-block/field/View.xml +8 -0
- package/dist/templates/building-block/filter-bar/View.xml +10 -0
- package/dist/templates/building-block/form/View.xml +4 -0
- package/dist/templates/building-block/page/View.xml +5 -0
- package/dist/templates/building-block/rich-text-editor/View.xml +3 -0
- package/dist/templates/building-block/rich-text-editor-button-groups/View.xml +18 -0
- package/dist/templates/building-block/table/View.xml +19 -0
- package/dist/templates/column/1.84/manifest.json +28 -0
- package/dist/templates/column/1.85/manifest.json +31 -0
- package/dist/templates/column/1.86/manifest.json +43 -0
- package/dist/templates/common/EventHandler.js +25 -0
- package/dist/templates/common/EventHandler.ts +28 -0
- package/dist/templates/common/Fragment.xml +3 -0
- package/dist/templates/common/FragmentWithForm.xml +7 -0
- package/dist/templates/common/FragmentWithVBox.xml +5 -0
- package/dist/templates/common/sap.fe.d.ts +43 -0
- package/dist/templates/controller-extension/Controller.js +18 -0
- package/dist/templates/controller-extension/Controller.ts +20 -0
- package/dist/templates/controller-extension/ControllerExtension.d.ts +11 -0
- package/dist/templates/controller-extension/manifest.json +14 -0
- package/dist/templates/field/manifest.json +32 -0
- package/dist/templates/filter/Controller.js +21 -0
- package/dist/templates/filter/Controller.ts +24 -0
- package/dist/templates/filter/fragment.xml +15 -0
- package/dist/templates/filter/manifest.json +12 -0
- package/dist/templates/header-section/1.85/manifest.json +43 -0
- package/dist/templates/header-section/1.86/manifest.json +45 -0
- package/dist/templates/page/custom/1.84/ext/Controller.js +45 -0
- package/dist/templates/page/custom/1.84/ext/Controller.ts +42 -0
- package/dist/templates/page/custom/1.84/ext/View.xml +6 -0
- package/dist/templates/page/custom/1.84/i18n/i18n.properties +2 -0
- package/dist/templates/page/custom/1.84/manifest.json +32 -0
- package/dist/templates/page/custom/1.94/ext/Controller.js +45 -0
- package/dist/templates/page/custom/1.94/ext/Controller.ts +42 -0
- package/dist/templates/page/custom/1.94/ext/View.xml +6 -0
- package/dist/templates/page/custom/1.94/i18n/i18n.properties +2 -0
- package/dist/templates/page/custom/1.94/manifest.json +33 -0
- package/dist/templates/page/custom/i18n/i18n.properties +2 -0
- package/dist/templates/page/list/manifest.json +20 -0
- package/dist/templates/page/object/manifest.json +33 -0
- package/dist/templates/section/1.85/manifest.json +33 -0
- package/dist/templates/section/1.86/manifest.json +32 -0
- package/dist/templates/subsection/1.85/manifest.json +37 -0
- package/dist/templates/subsection/1.86/manifest.json +36 -0
- package/dist/templates/view/ext/CustomViewWithTable.xml +3 -0
- package/dist/templates/view/manifest.json +41 -0
- package/dist/types/src/apiTypes.d.ts +3 -0
- package/dist/types/src/apiTypes.d.ts.map +1 -1
- package/dist/types/src/apiTypes.js.map +1 -1
- package/dist/types/src/common/types.d.ts +5 -1
- package/dist/types/src/common/types.d.ts.map +1 -1
- package/dist/types/src/common/types.js +4 -0
- package/dist/types/src/common/types.js.map +1 -1
- package/dist/types/src/v4/application.d.ts +13 -1
- package/dist/types/src/v4/application.d.ts.map +1 -1
- package/dist/types/src/v4/application.js.map +1 -1
- package/dist/types/src/v4/controls/ObjectPageSection.d.ts +52 -1
- package/dist/types/src/v4/controls/ObjectPageSection.d.ts.map +1 -1
- package/dist/types/src/v4/controls/ToolBar.d.ts +10 -1
- package/dist/types/src/v4/controls/ToolBar.d.ts.map +1 -1
- package/dist/types/src/v4/webapp/manifest/sapUi5.d.ts +9 -0
- package/dist/types/src/v4/webapp/manifest/sapUi5.d.ts.map +1 -1
- package/dist/types/src/v4/webapp/manifest/sapUi5.js.map +1 -1
- package/dist/types/src/v4/webapp/manifest/sapUiPageV4.d.ts +23 -3
- package/dist/types/src/v4/webapp/manifest/sapUiPageV4.d.ts.map +1 -1
- package/dist/types/src/v4/webapp/manifest/sapUiPageV4.js.map +1 -1
- package/package.json +22 -15
- package/dist/documentation/runDocu-min.js +0 -28
- package/dist/index-min.js +0 -655
- package/dist/index-min.js.map +0 -7
|
@@ -36,7 +36,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
36
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.QUALIFIER_SEPARATOR = exports.FIELD_SEPARATOR = exports.DATA_FIELD_FOR_ACTION_GROUP = void 0;
|
|
39
|
+
exports.QUALIFIER_SEPARATOR = exports.FIELD_SEPARATOR = exports.DATA_FIELD_FOR_ACTION_GROUP = exports.MIN_UI5_VERSION_FOR_TABLE_TYPE_RESTRICTIONS = void 0;
|
|
40
|
+
exports.hasEmbeddedComponent = hasEmbeddedComponent;
|
|
40
41
|
exports.addExtensionToArray = addExtensionToArray;
|
|
41
42
|
exports.getColumnsEnum = getColumnsEnum;
|
|
42
43
|
exports.addEnumForProperties = addEnumForProperties;
|
|
@@ -70,8 +71,13 @@ exports.importActionSettingsOfReference = importActionSettingsOfReference;
|
|
|
70
71
|
exports.addCustomFieldDefinition = addCustomFieldDefinition;
|
|
71
72
|
exports.addManifestPathsToProperties = addManifestPathsToProperties;
|
|
72
73
|
exports.getInsertableForEntitySet = getInsertableForEntitySet;
|
|
74
|
+
exports.getDefaultTableType = getDefaultTableType;
|
|
75
|
+
exports.getTableTypeOptions = getTableTypeOptions;
|
|
76
|
+
exports.ensureEntitySetWithCorrectType = ensureEntitySetWithCorrectType;
|
|
77
|
+
exports.getTableTypeOptionsByContext = getTableTypeOptionsByContext;
|
|
73
78
|
exports.getPageManifestPath = getPageManifestPath;
|
|
74
79
|
const utils_1 = require("../../common/utils");
|
|
80
|
+
const importProject_1 = require("../../common/importProject");
|
|
75
81
|
const StableIdHelper_1 = require("./StableIdHelper");
|
|
76
82
|
const common_1 = require("../../common");
|
|
77
83
|
const i18next_1 = __importDefault(require("i18next"));
|
|
@@ -83,8 +89,75 @@ const utils_2 = require("../import/utils");
|
|
|
83
89
|
const src_1 = require("@sap/ux-specification-types/src");
|
|
84
90
|
const v4controls = __importStar(require("../export/controls"));
|
|
85
91
|
const pages = __importStar(require("../export/pages"));
|
|
92
|
+
const v4_1 = require("@sap/ux-specification-types/src/v4");
|
|
93
|
+
const project_access_1 = require("@sap-ux/project-access");
|
|
86
94
|
const application_1 = require("../application");
|
|
87
95
|
const propertiesForEdit_1 = require("../generate/utils/propertiesForEdit");
|
|
96
|
+
const utils_3 = require("../sync-rules/utils");
|
|
97
|
+
/**
|
|
98
|
+
* Map of table type options based on the detected default table type.
|
|
99
|
+
* Each table type has a predefined set of compatible options and a default type.
|
|
100
|
+
*/
|
|
101
|
+
const TABLE_TYPE_OPTIONS_MAP = {
|
|
102
|
+
[v4_1.TableTypeV4.AnalyticalTable]: {
|
|
103
|
+
options: [v4_1.TableTypeV4.AnalyticalTable, v4_1.TableTypeV4.ResponsiveTable, v4_1.TableTypeV4.GridTable],
|
|
104
|
+
defaultType: v4_1.TableTypeV4.AnalyticalTable
|
|
105
|
+
},
|
|
106
|
+
[v4_1.TableTypeV4.TreeTable]: {
|
|
107
|
+
options: [v4_1.TableTypeV4.TreeTable, v4_1.TableTypeV4.ResponsiveTable, v4_1.TableTypeV4.GridTable],
|
|
108
|
+
defaultType: v4_1.TableTypeV4.TreeTable
|
|
109
|
+
},
|
|
110
|
+
[v4_1.TableTypeV4.ResponsiveTable]: {
|
|
111
|
+
options: [v4_1.TableTypeV4.ResponsiveTable, v4_1.TableTypeV4.GridTable],
|
|
112
|
+
defaultType: v4_1.TableTypeV4.ResponsiveTable
|
|
113
|
+
},
|
|
114
|
+
[v4_1.TableTypeV4.GridTable]: {
|
|
115
|
+
options: [v4_1.TableTypeV4.ResponsiveTable, v4_1.TableTypeV4.GridTable],
|
|
116
|
+
defaultType: v4_1.TableTypeV4.ResponsiveTable
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* Default table type used as a fallback when entity set is undefined or capabilities cannot be determined.
|
|
121
|
+
* ResponsiveTable is chosen as the safest and most universally applicable option.
|
|
122
|
+
*/
|
|
123
|
+
const FALLBACK_TABLE_TYPE = v4_1.TableTypeV4.ResponsiveTable;
|
|
124
|
+
/**
|
|
125
|
+
* Fallback table type options used when entity set capabilities cannot be determined.
|
|
126
|
+
* Derives from FALLBACK_TABLE_TYPE to ensure consistency across fallback scenarios.
|
|
127
|
+
*/
|
|
128
|
+
const FALLBACK_TABLE_TYPE_OPTIONS = TABLE_TYPE_OPTIONS_MAP[FALLBACK_TABLE_TYPE];
|
|
129
|
+
/**
|
|
130
|
+
* Minimum UI5 version that supports capability-based table type restrictions.
|
|
131
|
+
*
|
|
132
|
+
* Before 1.142.0:
|
|
133
|
+
* - Table type was optional
|
|
134
|
+
* - All table types were available regardless of service capabilities
|
|
135
|
+
* - No warning messages for missing table type or type-dependent properties
|
|
136
|
+
*
|
|
137
|
+
* From 1.142.0 onwards:
|
|
138
|
+
* - Table type options are restricted based on entity set capabilities (analytical/hierarchical/standard)
|
|
139
|
+
* - Warning messages are shown when table type is missing but type-dependent properties exist
|
|
140
|
+
* - Schema enum values are dynamically restricted to match detected capabilities
|
|
141
|
+
*/
|
|
142
|
+
exports.MIN_UI5_VERSION_FOR_TABLE_TYPE_RESTRICTIONS = '1.142.0';
|
|
143
|
+
/**
|
|
144
|
+
* Returns true when the given manifest section object contains an `embeddedComponent` property,
|
|
145
|
+
* i.e. it is an HDM-style reuse component section rather than an XML-fragment custom section.
|
|
146
|
+
*
|
|
147
|
+
* @param section - The manifest section object to test.
|
|
148
|
+
* @returns `true` if the section has an `embeddedComponent` property.
|
|
149
|
+
*/
|
|
150
|
+
function hasEmbeddedComponent(section) {
|
|
151
|
+
return typeof section === 'object' && section !== null && ux_specification_types_1.TemplatePropertyName.EmbeddedComponent in section;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Table type options for UI5 versions before 1.142.0, where capability-based restrictions
|
|
155
|
+
* are not supported. All table types are available, with ResponsiveTable as the default.
|
|
156
|
+
*/
|
|
157
|
+
const LEGACY_VERSION_TABLE_TYPE_OPTIONS = {
|
|
158
|
+
options: [v4_1.TableTypeV4.ResponsiveTable, v4_1.TableTypeV4.GridTable, v4_1.TableTypeV4.AnalyticalTable, v4_1.TableTypeV4.TreeTable],
|
|
159
|
+
defaultType: v4_1.TableTypeV4.ResponsiveTable
|
|
160
|
+
};
|
|
88
161
|
exports.DATA_FIELD_FOR_ACTION_GROUP = 'DataFieldForActionGroup';
|
|
89
162
|
const UI_ANNOTATION_KEY = 'UI';
|
|
90
163
|
exports.FIELD_SEPARATOR = '::';
|
|
@@ -742,19 +815,22 @@ function addCustomColumnDefinition(appSchema, v4Page, logger, customColumnDefini
|
|
|
742
815
|
appSchema.definitions[lineItemId].properties = sortedColumnsAsObject;
|
|
743
816
|
}
|
|
744
817
|
/**
|
|
745
|
-
* Determines the appropriate action definition name based on the provided
|
|
818
|
+
* Determines the appropriate action definition name based on the provided annotation data and record type.
|
|
746
819
|
*
|
|
747
|
-
* @param {
|
|
748
|
-
* @param {DataFieldAbstractTypes}
|
|
820
|
+
* @param {AnnotationSchemaContext} data - The schema data for the annotation, including its identifier and metadata.
|
|
821
|
+
* @param {DataFieldAbstractTypes} annotationRecord - The record representing a data field or action within the annotation collection.
|
|
749
822
|
* @returns {DefinitionName} The determined action definition name based on the provided data and group type.
|
|
750
823
|
*/
|
|
751
|
-
function determineActionDefinitionName(data,
|
|
752
|
-
const isGrouped =
|
|
824
|
+
function determineActionDefinitionName(data, annotationRecord) {
|
|
825
|
+
const isGrouped = annotationRecord.$Type === "com.sap.vocabularies.UI.v1.DataFieldForActionGroup" /* UIAnnotationTypes.DataFieldForActionGroup */;
|
|
753
826
|
let actionDefinitionName;
|
|
754
|
-
if (data.
|
|
827
|
+
if (data.annotation['term'] === "com.sap.vocabularies.UI.v1.Chart" /* UIAnnotationTerms.Chart */) {
|
|
828
|
+
actionDefinitionName = isGrouped ? ux_specification_types_1.DefinitionName.ViewToolBarActionGroup : ux_specification_types_1.DefinitionName.ChartToolBarAction;
|
|
829
|
+
}
|
|
830
|
+
else if (data.annotationId.startsWith(ux_specification_types_1.DefinitionName.LineItemsOfView)) {
|
|
755
831
|
actionDefinitionName = isGrouped ? ux_specification_types_1.DefinitionName.ViewToolBarActionGroup : ux_specification_types_1.DefinitionName.ViewToolBarAction;
|
|
756
832
|
}
|
|
757
|
-
else if (data.
|
|
833
|
+
else if (data.annotationId.startsWith(ux_specification_types_1.DefinitionName.LineItems)) {
|
|
758
834
|
actionDefinitionName = isGrouped ? ux_specification_types_1.DefinitionName.ToolBarActionGroup : ux_specification_types_1.DefinitionName.ToolBarAction;
|
|
759
835
|
}
|
|
760
836
|
else {
|
|
@@ -786,32 +862,32 @@ function addTargetAndKeysOfAction(actionDefinition, lineItemRecord, actionId) {
|
|
|
786
862
|
}
|
|
787
863
|
}
|
|
788
864
|
/**
|
|
789
|
-
* Adds an action record to a schema definition based on the provided
|
|
865
|
+
* Adds an action record to a schema definition based on the provided annotation record definition parameters.
|
|
790
866
|
* This involves defining action-specific properties, references, and metadata, and updating the schema accordingly.
|
|
791
867
|
*
|
|
792
|
-
* @param {
|
|
868
|
+
* @param {AddAnnotationRecordDefinitionParams} annotationRecordParams - The parameters describing the annotation record definition, including data, actions, path, record, and index.
|
|
793
869
|
* @param {boolean} [createRef] - A flag indicating whether to create a reference for the action definition.
|
|
794
870
|
* @returns {void} This function does not return a value.
|
|
795
871
|
*/
|
|
796
|
-
function addActionRecordToSchema(
|
|
797
|
-
const {
|
|
872
|
+
function addActionRecordToSchema(annotationRecordParams, createRef = true) {
|
|
873
|
+
const { schemaContext: data, actions: actionsDefinition, annotationPath, annotationRecord, index: recordIndex } = annotationRecordParams;
|
|
798
874
|
// Action but not inline action
|
|
799
|
-
if (
|
|
875
|
+
if (annotationRecord.Determining === true) {
|
|
800
876
|
return;
|
|
801
877
|
}
|
|
802
878
|
//no footer bar -> toolbar action
|
|
803
|
-
const actionDefinitionName = determineActionDefinitionName(data,
|
|
804
|
-
const description = (0, common_1.getDataFieldDescription)(
|
|
879
|
+
const actionDefinitionName = determineActionDefinitionName(data, annotationRecord);
|
|
880
|
+
const description = (0, common_1.getDataFieldDescription)(annotationRecord, data.entityType);
|
|
805
881
|
// Generate stable ID using strategy pattern to ensure correct key format for all action types.
|
|
806
882
|
// This is crucial for IBN actions, which need the full key including SemanticObject and RequiresContext
|
|
807
883
|
// (e.g., "DataFieldForIntentBasedNavigation::v4Freestyle::Inbound::RequiresContext")
|
|
808
884
|
// to be properly matched when referenced in manifest-based action menus.
|
|
809
|
-
const strategy = DataFieldStrategy_1.dataFieldStrategyContext.getStrategy(
|
|
810
|
-
const stableId = strategy.generateStableId(
|
|
885
|
+
const strategy = DataFieldStrategy_1.dataFieldStrategyContext.getStrategy(annotationRecord.$Type);
|
|
886
|
+
const stableId = strategy.generateStableId(annotationRecord);
|
|
811
887
|
// Extract Action property for keys generation (used by addTargetAndKeysOfAction).
|
|
812
888
|
// For IBN actions, this is just the action name (e.g., "Inbound").
|
|
813
889
|
// For bound actions, this may include namespace (e.g., "com.sap.Action/MyAction").
|
|
814
|
-
const actionId = typeof
|
|
890
|
+
const actionId = typeof annotationRecord.Action === 'string' ? annotationRecord.Action : annotationRecord.Action['path'];
|
|
815
891
|
// Remove type prefix from stable ID for use in $ref generation.
|
|
816
892
|
// This ensures getUniqueFacetDefinitionLink can properly detect duplicates based on full action identity,
|
|
817
893
|
// not just the Action property. For example, two IBN actions with different SemanticObjects but same Action
|
|
@@ -823,7 +899,7 @@ function addActionRecordToSchema(lineItemDefinitionParams, createRef = true) {
|
|
|
823
899
|
description
|
|
824
900
|
});
|
|
825
901
|
if (createRef) {
|
|
826
|
-
actionDefinition.$ref = (0, common_1.getUniqueFacetDefinitionLink)(actionDefinitionName, (0, common_1.prepareRef)(stableIdWithoutPrefix), data.appSchema,
|
|
902
|
+
actionDefinition.$ref = (0, common_1.getUniqueFacetDefinitionLink)(actionDefinitionName, (0, common_1.prepareRef)(stableIdWithoutPrefix), data.appSchema, annotationPath);
|
|
827
903
|
}
|
|
828
904
|
else {
|
|
829
905
|
actionDefinition.properties = {};
|
|
@@ -831,152 +907,156 @@ function addActionRecordToSchema(lineItemDefinitionParams, createRef = true) {
|
|
|
831
907
|
actionDefinition.isViewNode = true;
|
|
832
908
|
}
|
|
833
909
|
actionDefinition[ux_specification_types_1.SchemaTag.propertyIndex] = recordIndex;
|
|
834
|
-
actionDefinition[ux_specification_types_1.SchemaTag.dataType] = (0, common_1.determineDataType)(
|
|
910
|
+
actionDefinition[ux_specification_types_1.SchemaTag.dataType] = (0, common_1.determineDataType)(annotationRecord);
|
|
835
911
|
//keys
|
|
836
|
-
addTargetAndKeysOfAction(actionDefinition,
|
|
837
|
-
actionDefinition[ux_specification_types_1.SchemaTag.annotationType] =
|
|
912
|
+
addTargetAndKeysOfAction(actionDefinition, annotationRecord, actionId);
|
|
913
|
+
actionDefinition[ux_specification_types_1.SchemaTag.annotationType] = annotationRecord.$Type;
|
|
838
914
|
if (createRef) {
|
|
839
915
|
// Using previously computed ref instead of generating new one to support action duplication
|
|
840
916
|
const previouslyComputedRef = actionDefinition.$ref.replace(utils_1.DEFINITION_LINK_PREFIX, '');
|
|
841
917
|
const action = (0, common_1.parseSchemaDefinition)(actionDefinitionName, previouslyComputedRef, data.appSchema, false);
|
|
842
|
-
action[ux_specification_types_1.SchemaTag.annotationPath] = `${
|
|
918
|
+
action[ux_specification_types_1.SchemaTag.annotationPath] = `${annotationPath}/${recordIndex}`;
|
|
843
919
|
}
|
|
844
920
|
else {
|
|
845
|
-
actionDefinition[ux_specification_types_1.SchemaTag.annotationPath] = `${
|
|
921
|
+
actionDefinition[ux_specification_types_1.SchemaTag.annotationPath] = `${annotationPath}/${recordIndex}`;
|
|
846
922
|
}
|
|
847
923
|
}
|
|
848
924
|
/**
|
|
849
925
|
* Adds a group action record to the schema based on the given parameters. This involves determining
|
|
850
926
|
* action definitions, creating or referencing schema properties, and setting metadata fields.
|
|
851
927
|
*
|
|
852
|
-
* @param {
|
|
928
|
+
* @param {AddAnnotationRecordDefinitionParams} annotationRecordParams - Parameters that define the annotation record, including data, record, path, index, and actions.
|
|
853
929
|
* @param {boolean} [createRef] - Indicates whether to create a reference for the action definition or to use an inline object.
|
|
854
930
|
*/
|
|
855
|
-
function addGroupActionRecordToSchema(
|
|
856
|
-
const {
|
|
931
|
+
function addGroupActionRecordToSchema(annotationRecordParams, createRef = true) {
|
|
932
|
+
const { schemaContext, annotationRecord, annotationPath, index, actions } = annotationRecordParams;
|
|
857
933
|
//no footer bar -> toolbar action
|
|
858
|
-
const actionDefinitionName = determineActionDefinitionName(
|
|
859
|
-
const propertyKey = (0, StableIdHelper_1.getStableIdPartFromDataField)(
|
|
934
|
+
const actionDefinitionName = determineActionDefinitionName(schemaContext, annotationRecord);
|
|
935
|
+
const propertyKey = (0, StableIdHelper_1.getStableIdPartFromDataField)(annotationRecord);
|
|
860
936
|
let actionDefinition = {};
|
|
861
937
|
if (createRef) {
|
|
862
938
|
actions.properties[`${propertyKey}`] = {
|
|
863
939
|
$ref: (0, common_1.getFacetDefinitionLink)(actionDefinitionName, (0, common_1.prepareRef)(propertyKey))
|
|
864
940
|
};
|
|
865
|
-
actionDefinition = (0, common_1.parseSchemaDefinition)(actionDefinitionName, (0, common_1.prepareRef)(propertyKey),
|
|
941
|
+
actionDefinition = (0, common_1.parseSchemaDefinition)(actionDefinitionName, (0, common_1.prepareRef)(propertyKey), schemaContext.appSchema);
|
|
866
942
|
}
|
|
867
943
|
else {
|
|
868
944
|
actions.properties[`${propertyKey}`] = actionDefinition;
|
|
869
945
|
}
|
|
870
946
|
actionDefinition.properties = {};
|
|
871
|
-
actionDefinition.description = (0, common_1.getDataFieldDescription)(
|
|
947
|
+
actionDefinition.description = (0, common_1.getDataFieldDescription)(annotationRecord, schemaContext.entityType);
|
|
872
948
|
actionDefinition.type = 'object';
|
|
873
949
|
actionDefinition.isViewNode = true;
|
|
874
950
|
actionDefinition[ux_specification_types_1.SchemaTag.propertyIndex] = index;
|
|
875
|
-
actionDefinition[ux_specification_types_1.SchemaTag.dataType] = (0, common_1.determineDataType)(
|
|
876
|
-
actionDefinition[ux_specification_types_1.SchemaTag.annotationPath] = `${
|
|
877
|
-
(
|
|
878
|
-
const
|
|
879
|
-
...
|
|
880
|
-
|
|
881
|
-
|
|
951
|
+
actionDefinition[ux_specification_types_1.SchemaTag.dataType] = (0, common_1.determineDataType)(annotationRecord);
|
|
952
|
+
actionDefinition[ux_specification_types_1.SchemaTag.annotationPath] = `${annotationPath}/${index}`;
|
|
953
|
+
(annotationRecord['Actions'] ?? []).forEach((action, index) => {
|
|
954
|
+
const innerActionParams = {
|
|
955
|
+
...annotationRecordParams,
|
|
956
|
+
annotationRecord: action,
|
|
957
|
+
annotationPath: `${actionDefinition[ux_specification_types_1.SchemaTag.annotationPath]}/Actions`,
|
|
882
958
|
actions: actionDefinition,
|
|
883
959
|
index
|
|
884
960
|
};
|
|
885
|
-
addActionRecordToSchema(
|
|
961
|
+
addActionRecordToSchema(innerActionParams, createRef);
|
|
886
962
|
});
|
|
887
963
|
}
|
|
888
964
|
/**
|
|
889
965
|
* Adds a line item action definition to the schema based on the provided parameters.
|
|
890
|
-
* Handles determining which action to take based on specific conditions of the
|
|
966
|
+
* Handles determining which action to take based on specific conditions of the annotation record.
|
|
891
967
|
*
|
|
892
|
-
* @param {
|
|
893
|
-
* @param {object}
|
|
894
|
-
* @param {boolean}
|
|
895
|
-
* @param {boolean}
|
|
896
|
-
* @param {boolean}
|
|
968
|
+
* @param {AddAnnotationRecordDefinitionParams} annotationRecordParams - An object containing the details of the annotation record and the inline definition.
|
|
969
|
+
* @param {object} annotationRecordParams.annotationRecord - The annotation record to be processed, containing relevant properties.
|
|
970
|
+
* @param {boolean} annotationRecordParams.annotationRecord.Inline - Indicates whether the record is inline.
|
|
971
|
+
* @param {boolean} annotationRecordParams.annotationRecord.Determining - Indicates if the record is determining.
|
|
972
|
+
* @param {boolean} annotationRecordParams.inlineDefinition - Indicates whether the inline definition is present.
|
|
897
973
|
*/
|
|
898
|
-
function addLineItemActionDefinition(
|
|
899
|
-
const {
|
|
900
|
-
if (
|
|
901
|
-
addActionRecordToSchema(
|
|
974
|
+
function addLineItemActionDefinition(annotationRecordParams) {
|
|
975
|
+
const { annotationRecord, inlineDefinition } = annotationRecordParams;
|
|
976
|
+
if (annotationRecord.Inline !== true || annotationRecord.Determining === true) {
|
|
977
|
+
addActionRecordToSchema(annotationRecordParams, !inlineDefinition);
|
|
902
978
|
}
|
|
903
979
|
else {
|
|
904
|
-
addLineItemRecordToSchema(
|
|
980
|
+
addLineItemRecordToSchema(annotationRecordParams);
|
|
905
981
|
}
|
|
906
982
|
}
|
|
907
983
|
/**
|
|
908
984
|
* Adds a line item record to the provided schema based on the definition parameters.
|
|
909
985
|
*
|
|
910
|
-
* @param {
|
|
986
|
+
* @param {AddAnnotationRecordDefinitionParams} annotationRecordParams - The parameters defining the annotation data, schema information, and record.
|
|
911
987
|
*/
|
|
912
|
-
function addLineItemRecordToSchema(
|
|
913
|
-
const {
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
lineItemRecord['Target']['value'] = lineItemRecord['Target']['value'].replace(regex, '@');
|
|
988
|
+
function addLineItemRecordToSchema(annotationRecordParams) {
|
|
989
|
+
const { schemaContext, annotationRecord, inlineDefinition, annotationPath, index, definitionName } = annotationRecordParams;
|
|
990
|
+
let columnDefinition;
|
|
991
|
+
if (definitionName) {
|
|
992
|
+
columnDefinition =
|
|
993
|
+
annotationRecord.$Type === "com.sap.vocabularies.UI.v1.DataFieldForAction" /* UIAnnotationTypes.DataFieldForAction */
|
|
994
|
+
? `${definitionName}Action`
|
|
995
|
+
: definitionName;
|
|
921
996
|
}
|
|
922
|
-
const
|
|
997
|
+
const lineItemId = schemaContext.annotationId;
|
|
998
|
+
if (annotationRecord['Target']?.['value']) {
|
|
999
|
+
const regex = `@${(0, utils_1.findAlias)(ux_specification_types_1.UIVOCABULARY, schemaContext.oDataServiceAVT)}.`;
|
|
1000
|
+
annotationRecord['Target']['value'] = annotationRecord['Target']['value'].replace(regex, '@');
|
|
1001
|
+
}
|
|
1002
|
+
const schemaKey = (0, StableIdHelper_1.getStableIdPartFromDataField)(annotationRecord).replace(/\//g, exports.FIELD_SEPARATOR);
|
|
923
1003
|
if (schemaKey) {
|
|
924
|
-
let columnsDefinition =
|
|
1004
|
+
let columnsDefinition = inlineDefinition;
|
|
925
1005
|
if (!columnsDefinition) {
|
|
926
|
-
columnsDefinition =
|
|
1006
|
+
columnsDefinition = schemaContext.appSchema.definitions[lineItemId];
|
|
927
1007
|
}
|
|
928
1008
|
const properties = columnsDefinition.properties;
|
|
929
1009
|
const property = {
|
|
930
|
-
description: (0, common_1.getDataFieldDescription)(
|
|
1010
|
+
description: (0, common_1.getDataFieldDescription)(annotationRecord, schemaContext.entityType)
|
|
931
1011
|
};
|
|
932
|
-
if (
|
|
1012
|
+
if (inlineDefinition) {
|
|
933
1013
|
property.properties = {};
|
|
934
1014
|
property.type = 'object';
|
|
935
1015
|
property.isViewNode = true;
|
|
936
1016
|
}
|
|
937
|
-
else {
|
|
1017
|
+
else if (columnDefinition) {
|
|
938
1018
|
property.$ref = utils_1.DEFINITION_LINK_PREFIX + columnDefinition;
|
|
939
1019
|
}
|
|
940
|
-
property[ux_specification_types_1.SchemaTag.annotationType] =
|
|
941
|
-
property[ux_specification_types_1.SchemaTag.annotationPath] = `${
|
|
1020
|
+
property[ux_specification_types_1.SchemaTag.annotationType] = annotationRecord?.$Type;
|
|
1021
|
+
property[ux_specification_types_1.SchemaTag.annotationPath] = `${annotationPath}/${index}`;
|
|
942
1022
|
property[ux_specification_types_1.SchemaTag.propertyIndex] = index;
|
|
943
|
-
property[ux_specification_types_1.SchemaTag.dataType] = (0, common_1.determineDataType)(
|
|
1023
|
+
property[ux_specification_types_1.SchemaTag.dataType] = (0, common_1.determineDataType)(annotationRecord);
|
|
944
1024
|
properties[schemaKey] = property;
|
|
945
|
-
(0, common_1.addKeyToDefinition)(
|
|
1025
|
+
(0, common_1.addKeyToDefinition)(annotationRecord, properties, schemaKey);
|
|
946
1026
|
}
|
|
947
1027
|
}
|
|
948
1028
|
/**
|
|
949
|
-
* Appends
|
|
1029
|
+
* Appends annotation record columns and actions to the app schema (for the list report, custom page or an object page section comprising a table).
|
|
950
1030
|
*
|
|
951
|
-
* @param {
|
|
1031
|
+
* @param {AnnotationSchemaContext} data structure comprising
|
|
952
1032
|
* - appSchema - the app specific schema that shall get enhanced
|
|
953
|
-
* -
|
|
1033
|
+
* - annotation - the UI.LineItem annotation, comprising all records
|
|
954
1034
|
* - entityType - the entity type as part of the AVT ConvertedMetadata
|
|
955
1035
|
* - oDataServiceAVT - complete service information, as returned by Annotation Vocabularies Tool
|
|
956
|
-
* -
|
|
957
|
-
*
|
|
1036
|
+
* - annotationId - in case of OP the parameter must be passed to distinguish the OP tables;
|
|
1037
|
+
* in case of LR or ALP 'LineItems' is passed.
|
|
958
1038
|
* @param {Definition} actions - actions definition in schema, parent object
|
|
959
1039
|
* @param {string} lineItemPath - annotation path to the line item
|
|
960
1040
|
* @param {Definition | undefined} lineItemDefinition - line item definition
|
|
961
1041
|
* @param {string} columnDefinitionName - line item definition name
|
|
962
1042
|
*/
|
|
963
1043
|
function appendLineItemsToSchema(data, actions, lineItemPath, lineItemDefinition, columnDefinitionName = ux_specification_types_1.DefinitionName.TableColumn) {
|
|
964
|
-
if (!data.
|
|
1044
|
+
if (!data.annotation) {
|
|
965
1045
|
return;
|
|
966
1046
|
}
|
|
967
1047
|
let i = 0;
|
|
968
|
-
data.
|
|
969
|
-
const
|
|
970
|
-
|
|
1048
|
+
data.annotation.forEach((lineItemRecord) => {
|
|
1049
|
+
const params = {
|
|
1050
|
+
schemaContext: data,
|
|
971
1051
|
actions,
|
|
972
|
-
lineItemPath,
|
|
973
|
-
|
|
1052
|
+
annotationPath: lineItemPath,
|
|
1053
|
+
annotationRecord: lineItemRecord,
|
|
974
1054
|
index: i,
|
|
975
|
-
lineItemDefinition,
|
|
976
|
-
columnDefinitionName
|
|
1055
|
+
inlineDefinition: lineItemDefinition,
|
|
1056
|
+
definitionName: columnDefinitionName
|
|
977
1057
|
};
|
|
978
1058
|
const strategy = DataFieldStrategy_1.dataFieldStrategyContext.getStrategy(lineItemRecord.$Type);
|
|
979
|
-
strategy.addLineItemDefinition(
|
|
1059
|
+
strategy.addLineItemDefinition(params);
|
|
980
1060
|
i++;
|
|
981
1061
|
});
|
|
982
1062
|
}
|
|
@@ -986,17 +1066,17 @@ function appendLineItemsToSchema(data, actions, lineItemPath, lineItemDefinition
|
|
|
986
1066
|
* @param data structure comprising
|
|
987
1067
|
* - isObjectPage - indicates that the page is an object page
|
|
988
1068
|
* - appSchema - the app specific schema that shall get enhanced
|
|
989
|
-
* -
|
|
1069
|
+
* - annotation - the UI.LineItem annotation, comprising all records
|
|
990
1070
|
* - entityType - the entity type as part of the AVT ConvertedMetadata
|
|
991
1071
|
* - oDataServiceAVT - complete service information, as returned by Annotation Vocabularies Tool
|
|
992
|
-
* -
|
|
1072
|
+
* - annotationId - in case of OP the parameter must be passed to distinguish the OP tables;
|
|
993
1073
|
* in case of LR or ALP 'LineItems' is passed.
|
|
994
1074
|
* @param columnDefinitionName - name of the column definition, i.e. TableColumn or ObjectPageTableColumn
|
|
995
1075
|
* @param customColumnDefinitionName - name of the custom column definition
|
|
996
1076
|
* @param customActionDefinitionName - name of the custom action definition
|
|
997
1077
|
*/
|
|
998
1078
|
function addLineItemsTypeToSchema(data, columnDefinitionName = ux_specification_types_1.DefinitionName.TableColumn, customColumnDefinitionName = ux_specification_types_1.DefinitionName.CustomColumn, customActionDefinitionName = ux_specification_types_1.DefinitionName.CustomTableAction) {
|
|
999
|
-
const { actions, lineItemPath } = (0, common_1.addCommonLineItemDefinitions)(data.isObjectPage, data.appSchema, data.
|
|
1079
|
+
const { actions, lineItemPath } = (0, common_1.addCommonLineItemDefinitions)(data.isObjectPage, data.appSchema, data.annotation, data.entityType, data.annotationId, customColumnDefinitionName, customActionDefinitionName);
|
|
1000
1080
|
appendLineItemsToSchema(data, actions, lineItemPath, undefined, columnDefinitionName);
|
|
1001
1081
|
}
|
|
1002
1082
|
/**
|
|
@@ -1691,11 +1771,11 @@ function addCustomSectionDefinition(appSchema, definition, v4Page, customSection
|
|
|
1691
1771
|
}
|
|
1692
1772
|
}
|
|
1693
1773
|
else {
|
|
1694
|
-
// body custom section extensions
|
|
1774
|
+
// body custom section extensions — accept both fragment-based (template) and
|
|
1775
|
+
// embeddedComponent-based (e.g. HDM attachment reuse) sections
|
|
1695
1776
|
const sections = v4Page.options?.settings?.content?.body?.sections;
|
|
1696
1777
|
if (sections) {
|
|
1697
|
-
|
|
1698
|
-
sortedSectionsArray = addExtensionToArray(sections, sortedSectionsArray, customSectionRef, ux_specification_types_1.TemplatePropertyName.Template, logger, isMergedSections);
|
|
1778
|
+
sortedSectionsArray = addExtensionToArray(sections, sortedSectionsArray, customSectionRef, [ux_specification_types_1.TemplatePropertyName.Template, ux_specification_types_1.TemplatePropertyName.EmbeddedComponent], logger, isMergedSections);
|
|
1699
1779
|
}
|
|
1700
1780
|
}
|
|
1701
1781
|
// Adjust propertyIndex
|
|
@@ -1997,6 +2077,195 @@ function getInsertableForEntitySet(entitySet, navigationPath) {
|
|
|
1997
2077
|
}
|
|
1998
2078
|
return entitySetInsertable;
|
|
1999
2079
|
}
|
|
2080
|
+
/**
|
|
2081
|
+
* Determines the default OData V4 table type for an entity set based on its metadata capabilities.
|
|
2082
|
+
*
|
|
2083
|
+
* The decision follows a strict priority order:
|
|
2084
|
+
* 1) Analytical tables take precedence when aggregate transformations are present and the
|
|
2085
|
+
* analytical requirements are satisfied.
|
|
2086
|
+
* 2) Hierarchical tables are selected when a recursive hierarchy is defined and analytical
|
|
2087
|
+
* conditions are not met.
|
|
2088
|
+
* 3) Responsive tables are used as a safe fallback when neither analytical nor hierarchical
|
|
2089
|
+
* characteristics apply.
|
|
2090
|
+
*
|
|
2091
|
+
* The evaluation of analytical suitability differs between CAP and non-CAP services:
|
|
2092
|
+
* - **CAP services**: Require both service-level AND entity-level aggregation annotations.
|
|
2093
|
+
* - **Non-CAP services**: Service-level aggregation annotations are sufficient.
|
|
2094
|
+
*
|
|
2095
|
+
* @param entitySet The entity set whose annotations are evaluated.
|
|
2096
|
+
* @param isCapService Indicates whether the service is a CAP service, affecting analytical requirements.
|
|
2097
|
+
* @returns The default {@link TableTypeV4} to be used for the entity set.
|
|
2098
|
+
*/
|
|
2099
|
+
function getDefaultTableType(entitySet, isCapService) {
|
|
2100
|
+
if (!entitySet) {
|
|
2101
|
+
// Fallback when entitySet is not provided
|
|
2102
|
+
return FALLBACK_TABLE_TYPE;
|
|
2103
|
+
}
|
|
2104
|
+
const { hasRecursiveHierarchyForEntitySet, hasAggregateTransformations, hasAggregateTransformationsForEntitySet } = (0, project_access_1.getTableCapabilitiesByEntitySet)(entitySet);
|
|
2105
|
+
// Check for analytical capabilities first (highest priority)
|
|
2106
|
+
// Requires service-level aggregate transformations (hasAggregateTransformations) as a prerequisite
|
|
2107
|
+
// For CAP services: both service-level and entity-level transformations must be present
|
|
2108
|
+
// For non-CAP services: service-level transformations alone are sufficient
|
|
2109
|
+
if (hasAggregateTransformations && (hasAggregateTransformationsForEntitySet || !isCapService)) {
|
|
2110
|
+
return v4_1.TableTypeV4.AnalyticalTable;
|
|
2111
|
+
}
|
|
2112
|
+
// Check for hierarchical data only (no analytical data or analytical requirements not met)
|
|
2113
|
+
if (hasRecursiveHierarchyForEntitySet) {
|
|
2114
|
+
return v4_1.TableTypeV4.TreeTable;
|
|
2115
|
+
}
|
|
2116
|
+
// Default for standard entity sets without analytical or hierarchical capabilities
|
|
2117
|
+
return v4_1.TableTypeV4.ResponsiveTable;
|
|
2118
|
+
}
|
|
2119
|
+
/**
|
|
2120
|
+
* Determines the available table type options and recommended default type for an entity set
|
|
2121
|
+
* based on its metadata capabilities.
|
|
2122
|
+
*
|
|
2123
|
+
* This function analyzes the entity set's capabilities and returns both the list of suitable
|
|
2124
|
+
* table types and the recommended default type. The available options are restricted based
|
|
2125
|
+
* on the detected service characteristics:
|
|
2126
|
+
*
|
|
2127
|
+
* - **Analytical services**: AnalyticalTable, ResponsiveTable, GridTable (default: AnalyticalTable).
|
|
2128
|
+
* - **Hierarchical services**: TreeTable, ResponsiveTable, GridTable (default: TreeTable).
|
|
2129
|
+
* - **Standard services**: ResponsiveTable, GridTable (default: ResponsiveTable).
|
|
2130
|
+
*
|
|
2131
|
+
* **Version gating**: Capability-based restrictions are only applied for UI5 1.142.0+.
|
|
2132
|
+
* For earlier versions, all table types are available (ResponsiveTable, GridTable, AnalyticalTable, TreeTable)
|
|
2133
|
+
* with ResponsiveTable as the default.
|
|
2134
|
+
*
|
|
2135
|
+
* @param entitySet The entity set whose capabilities determine the available table types.
|
|
2136
|
+
* @param isCapService Indicates whether the service is a CAP service, affecting analytical
|
|
2137
|
+
* capability detection.
|
|
2138
|
+
* @param minUI5Version The minimum UI5 version from manifest. Capability-based restrictions
|
|
2139
|
+
* require UI5 1.142.0+.
|
|
2140
|
+
* @returns An object containing:
|
|
2141
|
+
* - `options`: Array of suitable {@link TableTypeV4} values for the entity set
|
|
2142
|
+
* - `defaultType`: The recommended {@link TableTypeV4} as the default choice
|
|
2143
|
+
* @example
|
|
2144
|
+
* // For an entity set with analytical capabilities (UI5 1.142+)
|
|
2145
|
+
* const result = getTableTypeOptions(analyticalEntitySet, true, '1.142.0');
|
|
2146
|
+
* // Returns: { options: [AnalyticalTable, ResponsiveTable, GridTable], defaultType: AnalyticalTable }
|
|
2147
|
+
*
|
|
2148
|
+
* // For the same entity set on UI5 1.120 (all types available, no restrictions)
|
|
2149
|
+
* const result = getTableTypeOptions(analyticalEntitySet, true, '1.120.0');
|
|
2150
|
+
* // Returns: { options: [ResponsiveTable, GridTable, AnalyticalTable, TreeTable], defaultType: ResponsiveTable }
|
|
2151
|
+
*/
|
|
2152
|
+
function getTableTypeOptions(entitySet, isCapService, minUI5Version) {
|
|
2153
|
+
// Capability-based restrictions are only available in UI5 1.142.0+
|
|
2154
|
+
// For earlier versions, all table types are available
|
|
2155
|
+
if (minUI5Version && !(0, utils_3.compareUI5Versions)(minUI5Version, exports.MIN_UI5_VERSION_FOR_TABLE_TYPE_RESTRICTIONS)) {
|
|
2156
|
+
return LEGACY_VERSION_TABLE_TYPE_OPTIONS;
|
|
2157
|
+
}
|
|
2158
|
+
const detectedType = getDefaultTableType(entitySet, isCapService);
|
|
2159
|
+
return TABLE_TYPE_OPTIONS_MAP[detectedType];
|
|
2160
|
+
}
|
|
2161
|
+
/**
|
|
2162
|
+
* Creates a virtual EntitySet for capability detection when the entitySet.entityType
|
|
2163
|
+
* doesn't match the actual target EntityType (e.g., for contained navigation).
|
|
2164
|
+
*
|
|
2165
|
+
* This is needed for contained navigation (ContainsTarget=true) where there is no
|
|
2166
|
+
* physical EntitySet in the metadata, but the target EntityType has important
|
|
2167
|
+
* annotations like RecursiveHierarchy.
|
|
2168
|
+
*
|
|
2169
|
+
* @param entitySet - The base entity set (may have wrong entityType for contained navigation)
|
|
2170
|
+
* @param targetEntityType - The actual entity type with correct annotations
|
|
2171
|
+
* @returns EntitySet with correct entityType for capability detection, or original if types match
|
|
2172
|
+
* @example
|
|
2173
|
+
* // For contained navigation "/ZZZC_FINANCIAL_TREE/Set"
|
|
2174
|
+
* const entitySetForCapabilities = ensureEntitySetWithCorrectType(
|
|
2175
|
+
* entitySet, // ZZZC_FINANCIAL_TREE (type: Parameters)
|
|
2176
|
+
* lineItemFacet.entityType // ZZZC_FINANCIAL_TREEType (with RecursiveHierarchy)
|
|
2177
|
+
* );
|
|
2178
|
+
* const options = getTableTypeOptions(entitySetForCapabilities, isCapService);
|
|
2179
|
+
*/
|
|
2180
|
+
function ensureEntitySetWithCorrectType(entitySet, targetEntityType) {
|
|
2181
|
+
if (!entitySet || !targetEntityType) {
|
|
2182
|
+
return entitySet;
|
|
2183
|
+
}
|
|
2184
|
+
// If entityType already matches, return as-is
|
|
2185
|
+
if (entitySet.entityType === targetEntityType) {
|
|
2186
|
+
return entitySet;
|
|
2187
|
+
}
|
|
2188
|
+
// Create virtual EntitySet with correct entityType and its annotations
|
|
2189
|
+
return {
|
|
2190
|
+
...entitySet,
|
|
2191
|
+
entityType: targetEntityType,
|
|
2192
|
+
annotations: targetEntityType.annotations || entitySet.annotations
|
|
2193
|
+
};
|
|
2194
|
+
}
|
|
2195
|
+
/**
|
|
2196
|
+
* Returns the appropriate fallback table type options based on UI5 version.
|
|
2197
|
+
* For UI5 < 1.142.0, returns all table types (legacy behavior).
|
|
2198
|
+
* For UI5 >= 1.142.0, returns restricted fallback options.
|
|
2199
|
+
*
|
|
2200
|
+
* @param minUI5Version - Optional minimum UI5 version
|
|
2201
|
+
* @returns Table type options with all types for legacy versions, or restricted options for modern versions
|
|
2202
|
+
*/
|
|
2203
|
+
function getFallbackTableTypeOptions(minUI5Version) {
|
|
2204
|
+
if (minUI5Version && !(0, utils_3.compareUI5Versions)(minUI5Version, exports.MIN_UI5_VERSION_FOR_TABLE_TYPE_RESTRICTIONS)) {
|
|
2205
|
+
return LEGACY_VERSION_TABLE_TYPE_OPTIONS;
|
|
2206
|
+
}
|
|
2207
|
+
return FALLBACK_TABLE_TYPE_OPTIONS;
|
|
2208
|
+
}
|
|
2209
|
+
/**
|
|
2210
|
+
* Determines table type options based on context path by resolving the entity set internally.
|
|
2211
|
+
*
|
|
2212
|
+
* This is a wrapper function that handles the complexity of entity set resolution from annotation files.
|
|
2213
|
+
* It parses the annotation files, resolves the entity set from the context path, and returns the
|
|
2214
|
+
* appropriate table type options.
|
|
2215
|
+
*
|
|
2216
|
+
* **Version gating**: Capability-based restrictions are only applied for UI5 1.142.0+.
|
|
2217
|
+
* For earlier versions, all table types are available.
|
|
2218
|
+
*
|
|
2219
|
+
* @param annotationFiles - Array of annotation files containing metadata
|
|
2220
|
+
* @param contextPath - Context path or navigation property. Can be:
|
|
2221
|
+
* - Full path starting with "/" (e.g., "/Travel", "/Travel/to_Booking")
|
|
2222
|
+
* - Navigation property without "/" (e.g., "to_Booking") - requires entitySetName
|
|
2223
|
+
* - Entity set name (e.g., "Travel")
|
|
2224
|
+
* @param entitySetName - Optional entity set name. Required when contextPath is a navigation property without "/"
|
|
2225
|
+
* @param isCapService - Indicates whether the service is a CAP service
|
|
2226
|
+
* @param logger - Optional logger for debugging
|
|
2227
|
+
* @param minUI5Version - Optional minimum UI5 version. Capability-based restrictions require UI5 1.142.0+
|
|
2228
|
+
* @returns An object containing:
|
|
2229
|
+
* - `options`: Array of suitable {@link TableTypeV4} values for the entity set
|
|
2230
|
+
* - `defaultType`: The recommended {@link TableTypeV4} as the default choice
|
|
2231
|
+
* @example
|
|
2232
|
+
* // For an analytical service with full path (UI5 1.142+)
|
|
2233
|
+
* const result = getTableTypeOptionsByContext(annotationFiles, "/Travel/to_Booking", undefined, true, logger, '1.142.0');
|
|
2234
|
+
* // Returns: { options: [AnalyticalTable, ResponsiveTable, GridTable], defaultType: AnalyticalTable }
|
|
2235
|
+
* @example
|
|
2236
|
+
* // For navigation property with entity set name (UI5 1.120)
|
|
2237
|
+
* const result = getTableTypeOptionsByContext(annotationFiles, "to_Booking", "Travel", true, logger, '1.120.0');
|
|
2238
|
+
* // Returns: { options: [ResponsiveTable, GridTable, AnalyticalTable, TreeTable], defaultType: ResponsiveTable }
|
|
2239
|
+
*/
|
|
2240
|
+
function getTableTypeOptionsByContext(annotationFiles, contextPath, entitySetName, isCapService, logger, minUI5Version) {
|
|
2241
|
+
try {
|
|
2242
|
+
// 1. Parse and convert annotation files to ConvertedMetadata
|
|
2243
|
+
const convertedMetadata = (0, utils_1.parseAndMergeAndConvert)(annotationFiles, logger);
|
|
2244
|
+
if (!convertedMetadata) {
|
|
2245
|
+
logger?.info('Could not parse annotation files, returning default table type options');
|
|
2246
|
+
return getFallbackTableTypeOptions(minUI5Version);
|
|
2247
|
+
}
|
|
2248
|
+
// 2. Build full context path if needed
|
|
2249
|
+
// If contextPath doesn't start with "/" and entitySetName is provided, combine them
|
|
2250
|
+
let fullContextPath = contextPath;
|
|
2251
|
+
if (entitySetName && contextPath && !contextPath.startsWith('/')) {
|
|
2252
|
+
fullContextPath = `/${entitySetName}/${contextPath}`;
|
|
2253
|
+
}
|
|
2254
|
+
// 3. Resolve entity set from context path
|
|
2255
|
+
const { entitySet } = (0, importProject_1.getEntityTypeEntitySetFromContextPath)(convertedMetadata, fullContextPath, entitySetName, logger);
|
|
2256
|
+
if (!entitySet) {
|
|
2257
|
+
logger?.info(`Could not resolve entity set for context path: ${fullContextPath}, returning default table type options`);
|
|
2258
|
+
return getFallbackTableTypeOptions(minUI5Version);
|
|
2259
|
+
}
|
|
2260
|
+
// 4. Call existing getTableTypeOptions with resolved entitySet
|
|
2261
|
+
return getTableTypeOptions(entitySet, isCapService, minUI5Version);
|
|
2262
|
+
}
|
|
2263
|
+
catch (error) {
|
|
2264
|
+
logger?.error('Error in getTableTypeOptionsByContext', error);
|
|
2265
|
+
// Fallback to default options on error
|
|
2266
|
+
return getFallbackTableTypeOptions(minUI5Version);
|
|
2267
|
+
}
|
|
2268
|
+
}
|
|
2000
2269
|
/**
|
|
2001
2270
|
* Returns the manifest path for a given page based on the provided path parameters.
|
|
2002
2271
|
*
|