@sap-ux/fiori-mcp-server 0.0.1

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.
Files changed (181) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +99 -0
  3. package/dist/constant.d.ts +5 -0
  4. package/dist/constant.js +8 -0
  5. package/dist/index.d.ts +3 -0
  6. package/dist/index.js +7 -0
  7. package/dist/page-editor-api/api.d.ts +48 -0
  8. package/dist/page-editor-api/api.js +93 -0
  9. package/dist/page-editor-api/index.d.ts +5 -0
  10. package/dist/page-editor-api/index.js +24 -0
  11. package/dist/page-editor-api/json-helper.d.ts +11 -0
  12. package/dist/page-editor-api/json-helper.js +64 -0
  13. package/dist/page-editor-api/parser/annotations.d.ts +9 -0
  14. package/dist/page-editor-api/parser/annotations.js +13 -0
  15. package/dist/page-editor-api/parser/index.d.ts +3 -0
  16. package/dist/page-editor-api/parser/index.js +19 -0
  17. package/dist/page-editor-api/parser/model/AggregationValidator.d.ts +64 -0
  18. package/dist/page-editor-api/parser/model/AggregationValidator.js +209 -0
  19. package/dist/page-editor-api/parser/model/ArrayAggregation.d.ts +49 -0
  20. package/dist/page-editor-api/parser/model/ArrayAggregation.js +122 -0
  21. package/dist/page-editor-api/parser/model/ObjectAggregation.d.ts +374 -0
  22. package/dist/page-editor-api/parser/model/ObjectAggregation.js +802 -0
  23. package/dist/page-editor-api/parser/model/PageEditModel.d.ts +223 -0
  24. package/dist/page-editor-api/parser/model/PageEditModel.js +954 -0
  25. package/dist/page-editor-api/parser/model/PageEditProperty.d.ts +38 -0
  26. package/dist/page-editor-api/parser/model/PageEditProperty.js +49 -0
  27. package/dist/page-editor-api/parser/model/RootAggregation.d.ts +24 -0
  28. package/dist/page-editor-api/parser/model/RootAggregation.js +54 -0
  29. package/dist/page-editor-api/parser/model/actions/ActionAggregation.d.ts +34 -0
  30. package/dist/page-editor-api/parser/model/actions/ActionAggregation.js +92 -0
  31. package/dist/page-editor-api/parser/model/actions/ActionsAggregation.d.ts +96 -0
  32. package/dist/page-editor-api/parser/model/actions/ActionsAggregation.js +252 -0
  33. package/dist/page-editor-api/parser/model/actions/index.d.ts +3 -0
  34. package/dist/page-editor-api/parser/model/actions/index.js +19 -0
  35. package/dist/page-editor-api/parser/model/additionalObjects/AdditionalObjectAggregation.d.ts +17 -0
  36. package/dist/page-editor-api/parser/model/additionalObjects/AdditionalObjectAggregation.js +26 -0
  37. package/dist/page-editor-api/parser/model/additionalObjects/AdditionalObjectsAggregation.d.ts +46 -0
  38. package/dist/page-editor-api/parser/model/additionalObjects/AdditionalObjectsAggregation.js +66 -0
  39. package/dist/page-editor-api/parser/model/additionalObjects/index.d.ts +3 -0
  40. package/dist/page-editor-api/parser/model/additionalObjects/index.js +19 -0
  41. package/dist/page-editor-api/parser/model/chart/ChartAggregation.d.ts +41 -0
  42. package/dist/page-editor-api/parser/model/chart/ChartAggregation.js +94 -0
  43. package/dist/page-editor-api/parser/model/chart/index.d.ts +2 -0
  44. package/dist/page-editor-api/parser/model/chart/index.js +18 -0
  45. package/dist/page-editor-api/parser/model/fields/ConnectedFieldsAggregation.d.ts +9 -0
  46. package/dist/page-editor-api/parser/model/fields/ConnectedFieldsAggregation.js +13 -0
  47. package/dist/page-editor-api/parser/model/fields/FieldAggregation.d.ts +25 -0
  48. package/dist/page-editor-api/parser/model/fields/FieldAggregation.js +42 -0
  49. package/dist/page-editor-api/parser/model/fields/FieldsAggregation.d.ts +22 -0
  50. package/dist/page-editor-api/parser/model/fields/FieldsAggregation.js +34 -0
  51. package/dist/page-editor-api/parser/model/fields/index.d.ts +4 -0
  52. package/dist/page-editor-api/parser/model/fields/index.js +20 -0
  53. package/dist/page-editor-api/parser/model/filter-fields/FilterFieldAggregation.d.ts +39 -0
  54. package/dist/page-editor-api/parser/model/filter-fields/FilterFieldAggregation.js +94 -0
  55. package/dist/page-editor-api/parser/model/filter-fields/FilterFieldsAggregation.d.ts +36 -0
  56. package/dist/page-editor-api/parser/model/filter-fields/FilterFieldsAggregation.js +59 -0
  57. package/dist/page-editor-api/parser/model/filter-fields/index.d.ts +3 -0
  58. package/dist/page-editor-api/parser/model/filter-fields/index.js +19 -0
  59. package/dist/page-editor-api/parser/model/index.d.ts +19 -0
  60. package/dist/page-editor-api/parser/model/index.js +35 -0
  61. package/dist/page-editor-api/parser/model/macros/MacrosRoot.d.ts +48 -0
  62. package/dist/page-editor-api/parser/model/macros/MacrosRoot.js +114 -0
  63. package/dist/page-editor-api/parser/model/macros/index.d.ts +2 -0
  64. package/dist/page-editor-api/parser/model/macros/index.js +18 -0
  65. package/dist/page-editor-api/parser/model/sections/HeaderSectionsAggregation.d.ts +31 -0
  66. package/dist/page-editor-api/parser/model/sections/HeaderSectionsAggregation.js +82 -0
  67. package/dist/page-editor-api/parser/model/sections/SectionAggregation.d.ts +78 -0
  68. package/dist/page-editor-api/parser/model/sections/SectionAggregation.js +131 -0
  69. package/dist/page-editor-api/parser/model/sections/SectionsAggregation.d.ts +135 -0
  70. package/dist/page-editor-api/parser/model/sections/SectionsAggregation.js +402 -0
  71. package/dist/page-editor-api/parser/model/sections/SectionsObjectAggregation.d.ts +50 -0
  72. package/dist/page-editor-api/parser/model/sections/SectionsObjectAggregation.js +119 -0
  73. package/dist/page-editor-api/parser/model/sections/SubSectionsAggregation.d.ts +39 -0
  74. package/dist/page-editor-api/parser/model/sections/SubSectionsAggregation.js +70 -0
  75. package/dist/page-editor-api/parser/model/sections/index.d.ts +6 -0
  76. package/dist/page-editor-api/parser/model/sections/index.js +22 -0
  77. package/dist/page-editor-api/parser/model/table/ColumnAggregation.d.ts +89 -0
  78. package/dist/page-editor-api/parser/model/table/ColumnAggregation.js +175 -0
  79. package/dist/page-editor-api/parser/model/table/ColumnsAggregation.d.ts +113 -0
  80. package/dist/page-editor-api/parser/model/table/ColumnsAggregation.js +293 -0
  81. package/dist/page-editor-api/parser/model/table/TableAggregation.d.ts +13 -0
  82. package/dist/page-editor-api/parser/model/table/TableAggregation.js +21 -0
  83. package/dist/page-editor-api/parser/model/table/ToolbarAggregation.d.ts +15 -0
  84. package/dist/page-editor-api/parser/model/table/ToolbarAggregation.js +22 -0
  85. package/dist/page-editor-api/parser/model/table/index.d.ts +5 -0
  86. package/dist/page-editor-api/parser/model/table/index.js +21 -0
  87. package/dist/page-editor-api/parser/model/table/utils.d.ts +12 -0
  88. package/dist/page-editor-api/parser/model/table/utils.js +44 -0
  89. package/dist/page-editor-api/parser/model/types/annotations.d.ts +63 -0
  90. package/dist/page-editor-api/parser/model/types/annotations.js +29 -0
  91. package/dist/page-editor-api/parser/model/types/common.d.ts +13 -0
  92. package/dist/page-editor-api/parser/model/types/common.js +3 -0
  93. package/dist/page-editor-api/parser/model/types/index.d.ts +220 -0
  94. package/dist/page-editor-api/parser/model/types/index.js +149 -0
  95. package/dist/page-editor-api/parser/model/utils/annotations.d.ts +38 -0
  96. package/dist/page-editor-api/parser/model/utils/annotations.js +120 -0
  97. package/dist/page-editor-api/parser/model/utils/i18n.d.ts +33 -0
  98. package/dist/page-editor-api/parser/model/utils/i18n.js +69 -0
  99. package/dist/page-editor-api/parser/model/utils/index.d.ts +6 -0
  100. package/dist/page-editor-api/parser/model/utils/index.js +22 -0
  101. package/dist/page-editor-api/parser/model/utils/object.d.ts +25 -0
  102. package/dist/page-editor-api/parser/model/utils/object.js +68 -0
  103. package/dist/page-editor-api/parser/model/utils/sort.d.ts +31 -0
  104. package/dist/page-editor-api/parser/model/utils/sort.js +18 -0
  105. package/dist/page-editor-api/parser/model/utils/utils.d.ts +94 -0
  106. package/dist/page-editor-api/parser/model/utils/utils.js +267 -0
  107. package/dist/page-editor-api/parser/model/views/ViewAggregation.d.ts +62 -0
  108. package/dist/page-editor-api/parser/model/views/ViewAggregation.js +112 -0
  109. package/dist/page-editor-api/parser/model/views/ViewsAggregation.d.ts +54 -0
  110. package/dist/page-editor-api/parser/model/views/ViewsAggregation.js +141 -0
  111. package/dist/page-editor-api/parser/model/views/index.d.ts +3 -0
  112. package/dist/page-editor-api/parser/model/views/index.js +19 -0
  113. package/dist/page-editor-api/parser/model/visual-filters/VisualFilterAggregation.d.ts +11 -0
  114. package/dist/page-editor-api/parser/model/visual-filters/VisualFilterAggregation.js +15 -0
  115. package/dist/page-editor-api/parser/model/visual-filters/VisualFiltersAggregation.d.ts +11 -0
  116. package/dist/page-editor-api/parser/model/visual-filters/VisualFiltersAggregation.js +15 -0
  117. package/dist/page-editor-api/parser/model/visual-filters/index.d.ts +3 -0
  118. package/dist/page-editor-api/parser/model/visual-filters/index.js +19 -0
  119. package/dist/page-editor-api/parser/tree.d.ts +135 -0
  120. package/dist/page-editor-api/parser/tree.js +464 -0
  121. package/dist/page-editor-api/project.d.ts +40 -0
  122. package/dist/page-editor-api/project.js +124 -0
  123. package/dist/page-editor-api/sapuxFtfsFileIO.d.ts +84 -0
  124. package/dist/page-editor-api/sapuxFtfsFileIO.js +195 -0
  125. package/dist/server.d.ts +35 -0
  126. package/dist/server.js +120 -0
  127. package/dist/tools/execute-functionality.d.ts +19 -0
  128. package/dist/tools/execute-functionality.js +175 -0
  129. package/dist/tools/functionalities/controller-extension/index.d.ts +4 -0
  130. package/dist/tools/functionalities/controller-extension/index.js +136 -0
  131. package/dist/tools/functionalities/functionalities.d.ts +4 -0
  132. package/dist/tools/functionalities/functionalities.js +19 -0
  133. package/dist/tools/functionalities/generate-fiori-ui-app/command.d.ts +9 -0
  134. package/dist/tools/functionalities/generate-fiori-ui-app/command.js +158 -0
  135. package/dist/tools/functionalities/generate-fiori-ui-app/generate-fiori-ui-app.d.ts +4 -0
  136. package/dist/tools/functionalities/generate-fiori-ui-app/generate-fiori-ui-app.js +240 -0
  137. package/dist/tools/functionalities/generate-fiori-ui-app/index.d.ts +2 -0
  138. package/dist/tools/functionalities/generate-fiori-ui-app/index.js +7 -0
  139. package/dist/tools/functionalities/index.d.ts +2 -0
  140. package/dist/tools/functionalities/index.js +18 -0
  141. package/dist/tools/functionalities/page/add-page.d.ts +5 -0
  142. package/dist/tools/functionalities/page/add-page.js +89 -0
  143. package/dist/tools/functionalities/page/application.d.ts +212 -0
  144. package/dist/tools/functionalities/page/application.js +616 -0
  145. package/dist/tools/functionalities/page/delete-page.d.ts +4 -0
  146. package/dist/tools/functionalities/page/delete-page.js +71 -0
  147. package/dist/tools/functionalities/page/index.d.ts +3 -0
  148. package/dist/tools/functionalities/page/index.js +10 -0
  149. package/dist/tools/functionalities/page/service.d.ts +82 -0
  150. package/dist/tools/functionalities/page/service.js +114 -0
  151. package/dist/tools/functionalities/page/serviceStore.d.ts +17 -0
  152. package/dist/tools/functionalities/page/serviceStore.js +34 -0
  153. package/dist/tools/functionalities/page/types.d.ts +42 -0
  154. package/dist/tools/functionalities/page/types.js +11 -0
  155. package/dist/tools/functionalities/page/utils.d.ts +12 -0
  156. package/dist/tools/functionalities/page/utils.js +63 -0
  157. package/dist/tools/get-functionality-details.d.ts +24 -0
  158. package/dist/tools/get-functionality-details.js +142 -0
  159. package/dist/tools/index.d.ts +7 -0
  160. package/dist/tools/index.js +55 -0
  161. package/dist/tools/input-schema/execute-functionality.json +28 -0
  162. package/dist/tools/input-schema/get-functionality-details.json +24 -0
  163. package/dist/tools/input-schema/index.d.ts +5 -0
  164. package/dist/tools/input-schema/index.js +15 -0
  165. package/dist/tools/input-schema/list-fiori-apps.json +12 -0
  166. package/dist/tools/input-schema/list-functionality.json +10 -0
  167. package/dist/tools/list-fiori-apps.d.ts +10 -0
  168. package/dist/tools/list-fiori-apps.js +33 -0
  169. package/dist/tools/list-functionalities.d.ts +10 -0
  170. package/dist/tools/list-functionalities.js +145 -0
  171. package/dist/tools/output-schema/execute-functionality.json +39 -0
  172. package/dist/tools/output-schema/get-functionality-details.json +142 -0
  173. package/dist/tools/output-schema/index.d.ts +5 -0
  174. package/dist/tools/output-schema/index.js +15 -0
  175. package/dist/tools/output-schema/list-fiori-apps.json +41 -0
  176. package/dist/tools/output-schema/list-functionality.json +37 -0
  177. package/dist/tools/utils.d.ts +16 -0
  178. package/dist/tools/utils.js +74 -0
  179. package/dist/types.d.ts +170 -0
  180. package/dist/types.js +3 -0
  181. package/package.json +63 -0
@@ -0,0 +1,113 @@
1
+ import type { PageEditAggregationData } from '../ObjectAggregation';
2
+ import { ObjectAggregation } from '../ObjectAggregation';
3
+ import type { PageData, PropertyPath, PageAnnotations, UINode } from '../types';
4
+ import { AggregationCreationForm, TableColumnExtensionType } from '../types';
5
+ import type { JSONSchema4 } from 'json-schema';
6
+ import type { PageConfig } from '@sap/ux-specification/dist/types/src';
7
+ import { PageType } from '@sap/ux-specification/dist/types/src';
8
+ export interface ColumnBase {
9
+ id?: string;
10
+ text?: string;
11
+ columnKey: string;
12
+ columnIndex?: number;
13
+ leadingProperty?: string;
14
+ fragmentName: string;
15
+ tabKey?: string;
16
+ cellsFragmentName?: string;
17
+ extensionType: TableColumnExtensionType;
18
+ }
19
+ /**
20
+ * Represents an aggregation for columns objects.
21
+ */
22
+ export declare class ColumnsAggregation extends ObjectAggregation {
23
+ formSchema?: ObjectAggregation;
24
+ customColumns: Array<ColumnBase>;
25
+ private columnKeys;
26
+ tableColumnExtensionType?: TableColumnExtensionType;
27
+ allowedAnnotationCreationForms: AggregationCreationForm[];
28
+ private readonly isV4?;
29
+ sectionId?: string;
30
+ sortableCollection: string | undefined;
31
+ /**
32
+ * Creates an instance of `ColumnsAggregation`.
33
+ *
34
+ * @param data Optional aggregation data object used to initialize properties.
35
+ * @param schema Optional JSON schema fragment associated with this aggregation.
36
+ */
37
+ constructor(data?: PageEditAggregationData, schema?: JSONSchema4);
38
+ /**
39
+ * Groups all custom table columns by their extension type.
40
+ *
41
+ * @returns {Map<TableColumnExtensionType, Array<ColumnBase>>}
42
+ */
43
+ private groupCustomColumnsByExtension;
44
+ /**
45
+ * Method ensures that 'order' property of aggregation is zero based and does not have any gap.
46
+ */
47
+ private ensureColumnOrder;
48
+ /**
49
+ * Data update of custom columns from 'custom' block, V2 scenario.
50
+ *
51
+ * @param data Data which should be used for value population.
52
+ * @param page Page config data.
53
+ * @param pageType Page type
54
+ * @param path Path of columns.
55
+ */
56
+ private updatePropertiesFromCustomAggregation;
57
+ /**
58
+ * Overwritten method for data update of table columns.
59
+ *
60
+ * @param data - Data which should be used for value population.
61
+ * @param page - Page config data.
62
+ * @param pageType - Page type
63
+ * @param path - Path of columns.
64
+ * @param annotations - Annotations
65
+ */
66
+ updatePropertiesValues(data: PageData, page: PageConfig, pageType: PageType, path: PropertyPath, annotations: PageAnnotations): void;
67
+ /**
68
+ * Method returns available column id for candidate column id.
69
+ *
70
+ * @param id Candidate id.
71
+ * @param existingIds Array of existing ids.
72
+ * @returns Available id.
73
+ */
74
+ private getFreeId;
75
+ /**
76
+ * Method detects default extension type for current page with table object.
77
+ *
78
+ * @param page Page config data.
79
+ * @param pageType Page type.
80
+ * @param path Path of columns.
81
+ */
82
+ private resolveTableColumnExtensionType;
83
+ /**
84
+ * Method returns if passed custom column matches table type.
85
+ * Table can have multiple columns with different 'extensionType', but Runtime will render only those which are matches to table type.
86
+ *
87
+ * @param column - Custom column object from 'page.json'.
88
+ * @returns True if custom column extension type matches table type.
89
+ */
90
+ private doesColumnExtensionMatchTableType;
91
+ /**
92
+ * Method checks if custom columns schema supports 'extensionType' property.
93
+ * Old 'spec' version does not support this property, but we still can support custom columns with old spec version.
94
+ *
95
+ * @returns True if 'extensionType' property exists in schema for Custom Column definition.
96
+ */
97
+ isExtensionTypeSupported(): boolean;
98
+ /**
99
+ * Method returns maximal order by looping through all aggregations and all custom columns data.
100
+ *
101
+ * @param columnData - Custom column data.
102
+ * @returns Maximal property order index.
103
+ */
104
+ private getMaxColumnIndex;
105
+ /**
106
+ * Refreshes node locations based on the annotation node data.
107
+ *
108
+ * @param annotations All page annotation nodes.
109
+ * @param currentUINode Current annotation node.
110
+ */
111
+ protected updateLocations(annotations: PageAnnotations | undefined, currentUINode?: UINode): void;
112
+ }
113
+ //# sourceMappingURL=ColumnsAggregation.d.ts.map
@@ -0,0 +1,293 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ColumnsAggregation = void 0;
4
+ const ObjectAggregation_1 = require("../ObjectAggregation");
5
+ const types_1 = require("../types");
6
+ const ColumnAggregation_1 = require("./ColumnAggregation");
7
+ const src_1 = require("@sap/ux-specification/dist/types/src");
8
+ const utils_1 = require("./utils");
9
+ const utils_2 = require("../utils");
10
+ const CUSTOM_PROPERTY_NAME = 'custom';
11
+ const PAGE_TYPE_DEFAULT_EXTENSION_MAP = new Map([
12
+ [src_1.PageType.ObjectPage, "ResponsiveTableColumnsExtension" /* TableColumnExtensionType.ResponsiveTableColumnsExtension */],
13
+ [src_1.PageType.ListReport, "ResponsiveTableColumnsExtension" /* TableColumnExtensionType.ResponsiveTableColumnsExtension */],
14
+ [src_1.PageType.AnalyticalListPage, "AnalyticalTableColumnsExtension" /* TableColumnExtensionType.AnalyticalTableColumnsExtension */]
15
+ ]);
16
+ /**
17
+ * Represents an aggregation for columns objects.
18
+ */
19
+ class ColumnsAggregation extends ObjectAggregation_1.ObjectAggregation {
20
+ // Array of end result ordered columns
21
+ customColumns = [];
22
+ columnKeys = [];
23
+ tableColumnExtensionType;
24
+ allowedAnnotationCreationForms = [
25
+ types_1.AggregationCreationForm.NativeBasicColumn,
26
+ types_1.AggregationCreationForm.NativeRatingColumn,
27
+ types_1.AggregationCreationForm.NativeChartColumn,
28
+ types_1.AggregationCreationForm.NativeProgressColumn,
29
+ types_1.AggregationCreationForm.NativeAction,
30
+ types_1.AggregationCreationForm.NativeContactColumn,
31
+ types_1.AggregationCreationForm.NativeNavigation
32
+ ];
33
+ isV4;
34
+ sectionId;
35
+ // In case if we would need connect columns and actions separately - in future it can be changed to array ['columns', 'actions']
36
+ sortableCollection = 'actions';
37
+ /**
38
+ * Creates an instance of `ColumnsAggregation`.
39
+ *
40
+ * @param data Optional aggregation data object used to initialize properties.
41
+ * @param schema Optional JSON schema fragment associated with this aggregation.
42
+ */
43
+ constructor(data, schema) {
44
+ super(data, schema);
45
+ // Child objects as column aggregation
46
+ this.childClass = ColumnAggregation_1.ColumnAggregation;
47
+ if (schema?.properties) {
48
+ let formName;
49
+ if (schema.properties?.custom) {
50
+ formName = types_1.AggregationCreationForm.CustomColumn;
51
+ }
52
+ else if (typeof schema.additionalProperties === 'object' &&
53
+ schema.additionalProperties.$ref &&
54
+ schema.additionalProperties.$ref.indexOf('TableCustomColumn') > -1) {
55
+ formName = types_1.AggregationCreationForm.CustomColumnV4;
56
+ this.isV4 = true;
57
+ }
58
+ else if (this.isMacrosNode()) {
59
+ this.isV4 = true;
60
+ }
61
+ // Custom creation form
62
+ if (formName) {
63
+ this.schemaCreationForms = [
64
+ {
65
+ name: formName,
66
+ kind: types_1.SCHEMA_CREATION_FORM,
67
+ title: 'PAGE_EDITOR_OUTLINE_ADD_CUSTOM_COLUMNS_TITLE',
68
+ disabled: false
69
+ }
70
+ ];
71
+ }
72
+ }
73
+ // Sortable
74
+ this.sortableList = true;
75
+ // i18n key
76
+ this.i18nKey = 'COLUMNS';
77
+ }
78
+ /**
79
+ * Groups all custom table columns by their extension type.
80
+ *
81
+ * @returns {Map<TableColumnExtensionType, Array<ColumnBase>>}
82
+ */
83
+ groupCustomColumnsByExtension() {
84
+ const customColumnGroups = new Map();
85
+ // Sort all columns by index
86
+ const customColumns = [...this.customColumns].sort((column1, column2) => {
87
+ const columnIndex1 = column1.columnIndex ?? 0;
88
+ const columnIndex2 = column2.columnIndex ?? 0;
89
+ if (columnIndex1 === columnIndex2) {
90
+ return 0;
91
+ }
92
+ return columnIndex1 > columnIndex2 ? 1 : -1;
93
+ });
94
+ // Group columns
95
+ for (const customColumn of customColumns) {
96
+ let columns = customColumnGroups.get(customColumn.extensionType);
97
+ if (!columns) {
98
+ columns = [];
99
+ customColumnGroups.set(customColumn.extensionType, columns);
100
+ }
101
+ columns.push(customColumn);
102
+ }
103
+ return customColumnGroups;
104
+ }
105
+ /**
106
+ * Method ensures that 'order' property of aggregation is zero based and does not have any gap.
107
+ */
108
+ ensureColumnOrder() {
109
+ const keys = this.getAggregationKeys();
110
+ for (let i = 0; i < keys.length; i++) {
111
+ const aggregation = this.aggregations[keys[i]];
112
+ if (aggregation) {
113
+ aggregation.order = i;
114
+ }
115
+ }
116
+ }
117
+ /**
118
+ * Data update of custom columns from 'custom' block, V2 scenario.
119
+ *
120
+ * @param data Data which should be used for value population.
121
+ * @param page Page config data.
122
+ * @param pageType Page type
123
+ * @param path Path of columns.
124
+ */
125
+ updatePropertiesFromCustomAggregation(data, page, pageType, path) {
126
+ const formSchema = this.formSchema;
127
+ this.customColumns = data && CUSTOM_PROPERTY_NAME in data ? data[CUSTOM_PROPERTY_NAME] : [];
128
+ if (pageType === src_1.PageTypeV2.ObjectPage) {
129
+ this.sectionId = this.parent?.parent?.schema?.keys?.reduce((key) => key.name === 'ID').value;
130
+ }
131
+ if (this.customColumns.length) {
132
+ // Ensure column order are starting with 0 and does not have any gap
133
+ this.ensureColumnOrder();
134
+ // Array with columns order
135
+ this.columnKeys = Object.keys(this.aggregations);
136
+ const customColumnsGroup = this.groupCustomColumnsByExtension();
137
+ customColumnsGroup.forEach((customColumns) => {
138
+ for (const index in customColumns) {
139
+ const customColumn = formSchema?.getCopy(ColumnAggregation_1.ColumnAggregation);
140
+ const columnData = customColumns[index];
141
+ // Original index in page config array
142
+ const originalIndex = this.customColumns.indexOf(columnData);
143
+ // Update some column specific properties by calling methods
144
+ customColumn.markAsCustomColumn({
145
+ pageType,
146
+ originalIndex,
147
+ columnExtension: columnData.extensionType,
148
+ isExtensionTypeSupported: this.isExtensionTypeSupported(),
149
+ i18nKey: this.i18nKey,
150
+ tableExtension: this.tableColumnExtensionType,
151
+ isV4: this.isV4,
152
+ tabkey: columnData.tabKey
153
+ });
154
+ customColumn.updatePropertiesValues(columnData, page, pageType, path);
155
+ customColumn.setTitle(columnData.text);
156
+ // Get unique column key
157
+ const columnKey = this.getFreeId(columnData.id || columnData.columnKey || 'customColumn', this.columnKeys);
158
+ this.columnKeys.push(columnKey);
159
+ // Add custom column into columns aggregation
160
+ const columnIndex = this.doesColumnExtensionMatchTableType(columnData)
161
+ ? columnData.columnIndex
162
+ : this.getMaxColumnIndex(this.customColumns) + 1;
163
+ this.addAggregation(columnKey, customColumn, this.path.concat([CUSTOM_PROPERTY_NAME, originalIndex]), columnIndex);
164
+ }
165
+ });
166
+ }
167
+ }
168
+ /**
169
+ * Overwritten method for data update of table columns.
170
+ *
171
+ * @param data - Data which should be used for value population.
172
+ * @param page - Page config data.
173
+ * @param pageType - Page type
174
+ * @param path - Path of columns.
175
+ * @param annotations - Annotations
176
+ */
177
+ updatePropertiesValues(data, page, pageType, path, annotations) {
178
+ super.updatePropertiesValues(data, page, pageType, path, annotations);
179
+ // Detect extension type
180
+ this.resolveTableColumnExtensionType(page, pageType, path);
181
+ // Hold custom column aggregation
182
+ if (!this.isV4) {
183
+ this.formSchema = this.aggregations[CUSTOM_PROPERTY_NAME];
184
+ delete this.aggregations[CUSTOM_PROPERTY_NAME];
185
+ // Custom block is present, V2 scenario
186
+ this.updatePropertiesFromCustomAggregation(data, page, pageType, path);
187
+ }
188
+ else {
189
+ // V4 new custom columns metadata aggregation is stored under 'additionalProperties'
190
+ this.formSchema = this.additionalProperties?.aggregations['columns'];
191
+ // V4 scenario: analyze all customs
192
+ const columns = data || {};
193
+ for (const columnKey in columns) {
194
+ const column = this.aggregations[columnKey];
195
+ if (column.schema && !column.schema.annotationPath) {
196
+ column.originalIndex = column.schema.propertyIndex;
197
+ column.markAsCustomColumn({
198
+ pageType,
199
+ originalIndex: column.schema.propertyIndex,
200
+ columnExtension: this.tableColumnExtensionType,
201
+ isExtensionTypeSupported: this.isExtensionTypeSupported(),
202
+ i18nKey: this.i18nKey,
203
+ tableExtension: this.tableColumnExtensionType,
204
+ isV4: this.isV4,
205
+ tabkey: column.properties.tabkey?.value
206
+ });
207
+ }
208
+ }
209
+ }
210
+ }
211
+ /**
212
+ * Method returns available column id for candidate column id.
213
+ *
214
+ * @param id Candidate id.
215
+ * @param existingIds Array of existing ids.
216
+ * @returns Available id.
217
+ */
218
+ getFreeId(id, existingIds) {
219
+ // Find available id
220
+ let counter = 1;
221
+ const originalId = id;
222
+ while (existingIds.includes(id)) {
223
+ id = originalId + counter;
224
+ counter++;
225
+ }
226
+ return id;
227
+ }
228
+ /**
229
+ * Method detects default extension type for current page with table object.
230
+ *
231
+ * @param page Page config data.
232
+ * @param pageType Page type.
233
+ * @param path Path of columns.
234
+ */
235
+ resolveTableColumnExtensionType(page, pageType, path) {
236
+ // Get path for table object
237
+ const tableTypePath = path.splice(0, path.length - 1);
238
+ // Read table type
239
+ tableTypePath.push('type');
240
+ const tableType = (0, utils_2.getProperty)(page, tableTypePath);
241
+ // Use mappings and detect extension type
242
+ this.tableColumnExtensionType =
243
+ typeof tableType === 'string' && tableType in src_1.v2.TableTypeV2
244
+ ? types_1.TABLE_TYPE_EXTENSION_MAP.get(tableType)
245
+ : PAGE_TYPE_DEFAULT_EXTENSION_MAP.get(pageType);
246
+ }
247
+ /**
248
+ * Method returns if passed custom column matches table type.
249
+ * Table can have multiple columns with different 'extensionType', but Runtime will render only those which are matches to table type.
250
+ *
251
+ * @param column - Custom column object from 'page.json'.
252
+ * @returns True if custom column extension type matches table type.
253
+ */
254
+ doesColumnExtensionMatchTableType(column) {
255
+ return !this.isExtensionTypeSupported() || column.extensionType === this.tableColumnExtensionType;
256
+ }
257
+ /**
258
+ * Method checks if custom columns schema supports 'extensionType' property.
259
+ * Old 'spec' version does not support this property, but we still can support custom columns with old spec version.
260
+ *
261
+ * @returns True if 'extensionType' property exists in schema for Custom Column definition.
262
+ */
263
+ isExtensionTypeSupported() {
264
+ return !!this.formSchema?.properties.extensionType;
265
+ }
266
+ /**
267
+ * Method returns maximal order by looping through all aggregations and all custom columns data.
268
+ *
269
+ * @param columnData - Custom column data.
270
+ * @returns Maximal property order index.
271
+ */
272
+ getMaxColumnIndex(columnData) {
273
+ let maxIndex = this.getMaxOrder();
274
+ for (const column of columnData) {
275
+ if (column.columnIndex !== undefined && maxIndex < column.columnIndex) {
276
+ maxIndex = column.columnIndex;
277
+ }
278
+ }
279
+ return maxIndex;
280
+ }
281
+ /**
282
+ * Refreshes node locations based on the annotation node data.
283
+ *
284
+ * @param annotations All page annotation nodes.
285
+ * @param currentUINode Current annotation node.
286
+ */
287
+ updateLocations(annotations, currentUINode) {
288
+ super.updateLocations(annotations, currentUINode);
289
+ (0, utils_1.updateTableChildNodeLocations)(this);
290
+ }
291
+ }
292
+ exports.ColumnsAggregation = ColumnsAggregation;
293
+ //# sourceMappingURL=ColumnsAggregation.js.map
@@ -0,0 +1,13 @@
1
+ import { ObjectAggregation } from '../ObjectAggregation';
2
+ /**
3
+ * Represents an aggregation for table objects.
4
+ */
5
+ export declare class TableAggregation extends ObjectAggregation {
6
+ /**
7
+ * Method parses object path key and returns table source entity name(target).
8
+ *
9
+ * @returns Table source entity name(target).
10
+ */
11
+ getTechnicalName(): string | undefined;
12
+ }
13
+ //# sourceMappingURL=TableAggregation.d.ts.map
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TableAggregation = void 0;
4
+ const ObjectAggregation_1 = require("../ObjectAggregation");
5
+ const utils_1 = require("../utils");
6
+ /**
7
+ * Represents an aggregation for table objects.
8
+ */
9
+ class TableAggregation extends ObjectAggregation_1.ObjectAggregation {
10
+ /**
11
+ * Method parses object path key and returns table source entity name(target).
12
+ *
13
+ * @returns Table source entity name(target).
14
+ */
15
+ getTechnicalName() {
16
+ const key = this.parent ? (0, utils_1.getTechnicalIdFromPath)(this.parent.path, true) : undefined;
17
+ return key || super.getTechnicalName();
18
+ }
19
+ }
20
+ exports.TableAggregation = TableAggregation;
21
+ //# sourceMappingURL=TableAggregation.js.map
@@ -0,0 +1,15 @@
1
+ import type { PageAnnotations, UINode } from '../types';
2
+ import { ObjectAggregation } from '../ObjectAggregation';
3
+ /**
4
+ * Represents an aggregation for table toolbar objects.
5
+ */
6
+ export declare class ToolbarAggregation extends ObjectAggregation {
7
+ /**
8
+ * Refreshes node locations based on the annotation node data.
9
+ *
10
+ * @param annotations All page annotation nodes.
11
+ * @param currentUINode Current annotation node.
12
+ */
13
+ protected updateLocations(annotations: PageAnnotations | undefined, currentUINode?: UINode): void;
14
+ }
15
+ //# sourceMappingURL=ToolbarAggregation.d.ts.map
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ToolbarAggregation = void 0;
4
+ const ObjectAggregation_1 = require("../ObjectAggregation");
5
+ const utils_1 = require("./utils");
6
+ /**
7
+ * Represents an aggregation for table toolbar objects.
8
+ */
9
+ class ToolbarAggregation extends ObjectAggregation_1.ObjectAggregation {
10
+ /**
11
+ * Refreshes node locations based on the annotation node data.
12
+ *
13
+ * @param annotations All page annotation nodes.
14
+ * @param currentUINode Current annotation node.
15
+ */
16
+ updateLocations(annotations, currentUINode) {
17
+ super.updateLocations(annotations, currentUINode);
18
+ (0, utils_1.updateTableChildNodeLocations)(this);
19
+ }
20
+ }
21
+ exports.ToolbarAggregation = ToolbarAggregation;
22
+ //# sourceMappingURL=ToolbarAggregation.js.map
@@ -0,0 +1,5 @@
1
+ export * from './ColumnAggregation';
2
+ export * from './ColumnsAggregation';
3
+ export * from './TableAggregation';
4
+ export * from './ToolbarAggregation';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./ColumnAggregation"), exports);
18
+ __exportStar(require("./ColumnsAggregation"), exports);
19
+ __exportStar(require("./TableAggregation"), exports);
20
+ __exportStar(require("./ToolbarAggregation"), exports);
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,12 @@
1
+ import type { ObjectAggregation } from '../ObjectAggregation';
2
+ /**
3
+ * Method updates table and table's child nodes annotation "locations" properties.
4
+ * It is used to handle different schema variations:
5
+ * 1. "AnnotationPath" can be placed in "Table" node;
6
+ * 2. "AnnotationPath" can be missed in "Table" node, but placed in child node;
7
+ * In case of 2nd scenario - we need to copy "locations" from child and apply to "Table" node.
8
+ *
9
+ * @param child Table's child aggregation/node.
10
+ */
11
+ export declare const updateTableChildNodeLocations: (child: ObjectAggregation) => void;
12
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateTableChildNodeLocations = void 0;
4
+ const src_1 = require("@sap/ux-specification/dist/types/src");
5
+ /**
6
+ * Method checks if passed location is associated with annotation source/artifact.
7
+ *
8
+ * @param location Location object.
9
+ * @returns True if passed location is associated with annotation source/artifact.
10
+ */
11
+ const isAnnotationLocation = (location) => {
12
+ return !location.type || location.type === src_1.ArtifactType.Annotation;
13
+ };
14
+ /**
15
+ * Method updates table and table's child nodes annotation "locations" properties.
16
+ * It is used to handle different schema variations:
17
+ * 1. "AnnotationPath" can be placed in "Table" node;
18
+ * 2. "AnnotationPath" can be missed in "Table" node, but placed in child node;
19
+ * In case of 2nd scenario - we need to copy "locations" from child and apply to "Table" node.
20
+ *
21
+ * @param child Table's child aggregation/node.
22
+ */
23
+ const updateTableChildNodeLocations = (child) => {
24
+ const annotationLocations = [];
25
+ const locations = child.locations ? [...child.locations] : [];
26
+ // Remove annotation locations from original aggregation
27
+ for (let i = locations.length - 1; i >= 0; i--) {
28
+ const location = locations[i];
29
+ if (isAnnotationLocation(location)) {
30
+ annotationLocations.push(location);
31
+ locations.splice(i, 1);
32
+ }
33
+ }
34
+ // Add annotation locations to parent aggregation
35
+ if (child.parent && annotationLocations.length) {
36
+ const parentLocations = child.parent.locations || [];
37
+ // Overwrite annotation locations if exists
38
+ child.parent.locations = parentLocations.filter((location) => !isAnnotationLocation(location));
39
+ child.parent.locations.unshift(...annotationLocations);
40
+ }
41
+ child.locations = locations;
42
+ };
43
+ exports.updateTableChildNodeLocations = updateTableChildNodeLocations;
44
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1,63 @@
1
+ import type { Location } from './common';
2
+ export declare const UI_NODE_TYPE_HEADER_INFO = "headerInfo";
3
+ export declare const UI_NODE_TYPE_PAGE_ACTIONS = "pageActions";
4
+ export declare const UI_NODE_TYPE_FORM = "form";
5
+ export declare const UI_NODE_TYPE_HEADER_SECTIONS = "headerSections";
6
+ export declare const UI_NODE_TYPE_SECTION = "section";
7
+ export declare const UI_NODE_TYPE_FORM_FIELD = "formField";
8
+ export declare const UI_NODE_TYPE_CONNECTED_FIELDS = "connectedFields";
9
+ export declare const UI_NODE_TYPE_ACTION = "action";
10
+ export declare const UI_NODE_TYPE_ACTION_GROUP = "actionGroup";
11
+ export declare const UI_NODE_TYPE_GENERIC_ACTIONS = "genericActions";
12
+ export declare const UI_NODE_TYPE_GENERIC_ACTION = "genericAction";
13
+ export declare const UI_NODE_TYPE_CHART = "chart";
14
+ export declare const UI_NODE_TYPE_CONTACT = "contact";
15
+ export declare const UI_NODE_TYPE_DATA_POINT = "dataPoint";
16
+ export declare const UI_NODE_TYPE_ANALYTICAL_CHART = "analyticalChart";
17
+ export declare const UI_NODE_TYPE_NAVIGATION = "navigation";
18
+ export declare const UI_NODE_TYPE_VIEWS = "views";
19
+ export declare const UI_NODE_TYPE_LIST = "list";
20
+ export declare const UI_NODE_TYPE_COLUMN = "column";
21
+ export declare const UI_NODE_TYPE_FILTER_FIELDS = "filterFields";
22
+ export declare const UI_NODE_TYPE_FILTER_FIELD = "filterField";
23
+ export declare const UI_NODE_TYPE_VISUAL_FILTERS = "visualFilters";
24
+ export declare const UI_NODE_TYPE_VISUAL_FILTER = "visualFilter";
25
+ export interface TooComplexData extends UINodeCore {
26
+ tooComplex?: boolean;
27
+ tooComplexLocations?: Location[];
28
+ }
29
+ export type UINodeId = number[];
30
+ export interface UINodeCore {
31
+ nodeType: string;
32
+ nodeId: UINodeId;
33
+ annotationPath: string;
34
+ macroNodeId?: string;
35
+ allowedParentNodes?: Record<string, boolean>;
36
+ allowedSubnodeTypes?: string[];
37
+ suppressedSubnodeTypes?: {
38
+ subNodeType: string;
39
+ tooltip: string;
40
+ }[];
41
+ }
42
+ export interface UINodeValue extends UINodeCore {
43
+ nodeType: string;
44
+ readonly?: boolean;
45
+ readonlyTooltip?: string;
46
+ location: Location;
47
+ subnodes: UINode[];
48
+ info?: string;
49
+ sectionType?: string;
50
+ }
51
+ export type UINode = UINodeValue | TooComplexData;
52
+ export interface UIDialogsContext {
53
+ analyticalChartSupport?: {
54
+ creationEnabled: boolean;
55
+ creationTooltip: string;
56
+ deletionEnabled?: boolean;
57
+ deletionTooltip?: string;
58
+ addToMultiViewEnabled?: boolean;
59
+ addToMultiViewTooltip?: string;
60
+ };
61
+ suppressTableViewDeletionNodeId?: UINodeId;
62
+ }
63
+ //# sourceMappingURL=annotations.d.ts.map
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UI_NODE_TYPE_VISUAL_FILTER = exports.UI_NODE_TYPE_VISUAL_FILTERS = exports.UI_NODE_TYPE_FILTER_FIELD = exports.UI_NODE_TYPE_FILTER_FIELDS = exports.UI_NODE_TYPE_COLUMN = exports.UI_NODE_TYPE_LIST = exports.UI_NODE_TYPE_VIEWS = exports.UI_NODE_TYPE_NAVIGATION = exports.UI_NODE_TYPE_ANALYTICAL_CHART = exports.UI_NODE_TYPE_DATA_POINT = exports.UI_NODE_TYPE_CONTACT = exports.UI_NODE_TYPE_CHART = exports.UI_NODE_TYPE_GENERIC_ACTION = exports.UI_NODE_TYPE_GENERIC_ACTIONS = exports.UI_NODE_TYPE_ACTION_GROUP = exports.UI_NODE_TYPE_ACTION = exports.UI_NODE_TYPE_CONNECTED_FIELDS = exports.UI_NODE_TYPE_FORM_FIELD = exports.UI_NODE_TYPE_SECTION = exports.UI_NODE_TYPE_HEADER_SECTIONS = exports.UI_NODE_TYPE_FORM = exports.UI_NODE_TYPE_PAGE_ACTIONS = exports.UI_NODE_TYPE_HEADER_INFO = void 0;
4
+ // UI Node Types (OP)
5
+ exports.UI_NODE_TYPE_HEADER_INFO = 'headerInfo';
6
+ exports.UI_NODE_TYPE_PAGE_ACTIONS = 'pageActions';
7
+ exports.UI_NODE_TYPE_FORM = 'form';
8
+ exports.UI_NODE_TYPE_HEADER_SECTIONS = 'headerSections';
9
+ exports.UI_NODE_TYPE_SECTION = 'section';
10
+ exports.UI_NODE_TYPE_FORM_FIELD = 'formField';
11
+ exports.UI_NODE_TYPE_CONNECTED_FIELDS = 'connectedFields';
12
+ exports.UI_NODE_TYPE_ACTION = 'action';
13
+ exports.UI_NODE_TYPE_ACTION_GROUP = 'actionGroup';
14
+ exports.UI_NODE_TYPE_GENERIC_ACTIONS = 'genericActions';
15
+ exports.UI_NODE_TYPE_GENERIC_ACTION = 'genericAction';
16
+ exports.UI_NODE_TYPE_CHART = 'chart';
17
+ exports.UI_NODE_TYPE_CONTACT = 'contact';
18
+ exports.UI_NODE_TYPE_DATA_POINT = 'dataPoint';
19
+ exports.UI_NODE_TYPE_ANALYTICAL_CHART = 'analyticalChart';
20
+ exports.UI_NODE_TYPE_NAVIGATION = 'navigation';
21
+ // UI Node Types (LR)
22
+ exports.UI_NODE_TYPE_VIEWS = 'views'; // for multi view LR: parent node containing views listed in manifest json (views/paths) - could be of type 'list' or 'analyticalChart'
23
+ exports.UI_NODE_TYPE_LIST = 'list';
24
+ exports.UI_NODE_TYPE_COLUMN = 'column';
25
+ exports.UI_NODE_TYPE_FILTER_FIELDS = 'filterFields';
26
+ exports.UI_NODE_TYPE_FILTER_FIELD = 'filterField';
27
+ exports.UI_NODE_TYPE_VISUAL_FILTERS = 'visualFilters';
28
+ exports.UI_NODE_TYPE_VISUAL_FILTER = 'visualFilter';
29
+ //# sourceMappingURL=annotations.js.map