@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,50 @@
1
+ import type { JSONSchema4 } from 'json-schema';
2
+ import type { ObjectAggregation, PageEditAggregationData } from '../ObjectAggregation';
3
+ import type { ModelParserParams, PageData, PageAnnotations, PropertyPath } from '../types';
4
+ import { SectionsAggregation } from './SectionsAggregation';
5
+ import type { PageConfig, PageType } from '@sap/ux-specification/dist/types/src';
6
+ /**
7
+ * Represents an aggregation for sections objects.
8
+ */
9
+ export declare class SectionsObjectAggregation extends SectionsAggregation {
10
+ /**
11
+ * Creates an instance of `SectionsObjectAggregation`.
12
+ *
13
+ * @param data Optional aggregation data object used to initialize properties.
14
+ * @param schema Optional JSON schema fragment associated with this aggregation.
15
+ */
16
+ constructor(data?: PageEditAggregationData, schema?: JSONSchema4);
17
+ /**
18
+ * Overwritten method for data update of object page sections
19
+ * Method receives current values for sections - loops through custom sections object and appends existing/standard aggregations with custom section aggregations.
20
+ *
21
+ * @param data Data which should be used for value population.
22
+ * @param page Page config data.
23
+ * @param pageType Page type.
24
+ * @param path Aggregation path.
25
+ * @param annotations Page annotations.
26
+ * @param parser Model parser parameters.
27
+ */
28
+ updatePropertiesValues(data: PageData, page: PageConfig, pageType: PageType, path: PropertyPath, annotations?: PageAnnotations, parser?: ModelParserParams<ObjectAggregation>): void;
29
+ /**
30
+ * Method removes aggregations that are not part of schema properties.
31
+ */
32
+ private removeObsoleteAggregations;
33
+ /**
34
+ * Method parses building blocks for passed custom section.
35
+ *
36
+ * @param parseData Schema parse data and parser.
37
+ * @param section Section to parse.
38
+ * @param id Section id.
39
+ * @param sections Sections data.
40
+ * @param path Aggregation path.
41
+ */
42
+ private parseBuildingBlocks;
43
+ /**
44
+ * Public method checks if annotation sections are merged by 'sap.fe' in runtime.
45
+ *
46
+ * @returns Annotation sections are merged by 'sap.fe' in runtime.
47
+ */
48
+ isSectionsMerged(): boolean;
49
+ }
50
+ //# sourceMappingURL=SectionsObjectAggregation.d.ts.map
@@ -0,0 +1,119 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SectionsObjectAggregation = void 0;
4
+ const types_1 = require("../types");
5
+ const utils_1 = require("../utils");
6
+ const SectionsAggregation_1 = require("./SectionsAggregation");
7
+ const macros_1 = require("../macros");
8
+ /**
9
+ * Represents an aggregation for sections objects.
10
+ */
11
+ class SectionsObjectAggregation extends SectionsAggregation_1.SectionsAggregation {
12
+ /**
13
+ * Creates an instance of `SectionsObjectAggregation`.
14
+ *
15
+ * @param data Optional aggregation data object used to initialize properties.
16
+ * @param schema Optional JSON schema fragment associated with this aggregation.
17
+ */
18
+ constructor(data, schema) {
19
+ super(data, schema);
20
+ const additionalProperties = schema?.additionalProperties;
21
+ if (typeof additionalProperties === 'object' && additionalProperties.$ref) {
22
+ this.schemaCreationForms = [
23
+ {
24
+ name: types_1.AggregationCreationForm.CustomSection,
25
+ kind: types_1.SCHEMA_CREATION_FORM,
26
+ title: 'PAGE_EDITOR_OUTLINE_ADD_CUSTOM_SECTIONS_TITLE',
27
+ disabled: false
28
+ }
29
+ ];
30
+ }
31
+ }
32
+ /**
33
+ * Overwritten method for data update of object page sections
34
+ * Method receives current values for sections - loops through custom sections object and appends existing/standard aggregations with custom section aggregations.
35
+ *
36
+ * @param data Data which should be used for value population.
37
+ * @param page Page config data.
38
+ * @param pageType Page type.
39
+ * @param path Aggregation path.
40
+ * @param annotations Page annotations.
41
+ * @param parser Model parser parameters.
42
+ */
43
+ updatePropertiesValues(data, page, pageType, path, annotations, parser) {
44
+ super.updatePropertiesValues(data, page, pageType, path, annotations, parser);
45
+ this.formSchema = this.additionalProperties?.aggregations?.['sections'];
46
+ const sections = data || {};
47
+ // Remove obsolete aggregations
48
+ this.removeObsoleteAggregations();
49
+ for (const id in sections) {
50
+ const section = this.aggregations[id];
51
+ if (section?.schema && !section.schema.annotationPath) {
52
+ section.markAsCustomSection();
53
+ if (parser) {
54
+ this.parseBuildingBlocks({ parser, page, pageType }, section, id, sections, path);
55
+ }
56
+ }
57
+ }
58
+ const sortDisabled = this.isSectionsMerged();
59
+ if (sortDisabled) {
60
+ for (const id in this.aggregations) {
61
+ if (this.aggregations[id].custom) {
62
+ this.aggregations[id].sortableItem = types_1.SortingOptions.Excluded;
63
+ }
64
+ }
65
+ }
66
+ }
67
+ /**
68
+ * Method removes aggregations that are not part of schema properties.
69
+ */
70
+ removeObsoleteAggregations() {
71
+ const schemaSections = this.schema?.properties || {};
72
+ for (const id in this.aggregations) {
73
+ if (!(id in schemaSections)) {
74
+ delete this.aggregations[id];
75
+ }
76
+ }
77
+ }
78
+ /**
79
+ * Method parses building blocks for passed custom section.
80
+ *
81
+ * @param parseData Schema parse data and parser.
82
+ * @param section Section to parse.
83
+ * @param id Section id.
84
+ * @param sections Sections data.
85
+ * @param path Aggregation path.
86
+ */
87
+ parseBuildingBlocks(parseData, section, id, sections, path) {
88
+ const { parser, page, pageType } = parseData;
89
+ const fragmentData = sections[id];
90
+ const { fragmentName } = fragmentData;
91
+ // Get custom sections fragment from definitions schema
92
+ const customSectionFragmentDefinition = parser?.definitions[`CustomExtensionFragment<${fragmentName}>`];
93
+ // Check if custom section has controls aggregation
94
+ if (customSectionFragmentDefinition && section.aggregations.controls) {
95
+ // Create macros aggregation and add it to subsection
96
+ const macrosAggregation = new macros_1.MacrosRootAggregation(undefined, customSectionFragmentDefinition);
97
+ section.addAggregation('controls', macrosAggregation, path.concat(section.path[section.path.length - 1], 'controls'), 0, true);
98
+ // parse schema using attached fragment file's macros schema definition
99
+ parser.parse(macrosAggregation, customSectionFragmentDefinition, undefined, undefined, macrosAggregation.path, {
100
+ filePath: customSectionFragmentDefinition.metadata?.filePath
101
+ });
102
+ // Update values of properties inside macros aggregation
103
+ const macrosConfigData = (0, utils_1.getProperty)(section.value || {}, ['controls']);
104
+ if (macrosConfigData && typeof macrosConfigData === 'object') {
105
+ macrosAggregation.updatePropertiesValues(macrosConfigData, page, pageType, path, parser?.annotations);
106
+ }
107
+ }
108
+ }
109
+ /**
110
+ * Public method checks if annotation sections are merged by 'sap.fe' in runtime.
111
+ *
112
+ * @returns Annotation sections are merged by 'sap.fe' in runtime.
113
+ */
114
+ isSectionsMerged() {
115
+ return false;
116
+ }
117
+ }
118
+ exports.SectionsObjectAggregation = SectionsObjectAggregation;
119
+ //# sourceMappingURL=SectionsObjectAggregation.js.map
@@ -0,0 +1,39 @@
1
+ import type { JSONSchema4 } from 'json-schema';
2
+ import type { ObjectAggregation, PageEditAggregationData } from '../ObjectAggregation';
3
+ import type { ModelParserParams, PageData, PageAnnotations, PropertyPath } from '../types';
4
+ import { SectionsObjectAggregation } from './SectionsObjectAggregation';
5
+ import type { PageConfig, PageType } from '@sap/ux-specification/dist/types/src';
6
+ /**
7
+ * Represents an aggregation for sub-sections objects.
8
+ */
9
+ export declare class SubSectionsAggregation extends SectionsObjectAggregation {
10
+ /**
11
+ * Creates an instance of `SubSectionsAggregation`.
12
+ *
13
+ * @param data Optional aggregation data object used to initialize properties.
14
+ * @param schema Optional JSON schema fragment associated with this aggregation.
15
+ */
16
+ constructor(data?: PageEditAggregationData, schema?: JSONSchema4);
17
+ /**
18
+ * Overwritten method for data update of object page sections
19
+ * Method receives current values for sections - loops custom sections array and appends existing/standard aggregations with custom section aggregations.
20
+ *
21
+ * @param data Data which should be used for value population.
22
+ * @param page Page config data.
23
+ * @param pageType Page type.
24
+ * @param path Aggregation path.
25
+ * @param annotations Page annotations.
26
+ * @param parser Model parser parameters.
27
+ */
28
+ updatePropertiesValues(data: PageData, page: PageConfig, pageType: PageType, path: PropertyPath, annotations?: PageAnnotations, parser?: ModelParserParams<ObjectAggregation>): void;
29
+ /**
30
+ * Public method checks if annotation sections are merged by 'sap.fe' in runtime.
31
+ * There is two reordering approaches:
32
+ * 1. When annotations sections are merged into one. There no any collection section in such case.
33
+ * 2. When sections are separated. There is at least one collection section in such case.
34
+ *
35
+ * @returns Annotation sections are merged by 'sap.fe' in runtime.
36
+ */
37
+ isSectionsMerged(): boolean;
38
+ }
39
+ //# sourceMappingURL=SubSectionsAggregation.d.ts.map
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SubSectionsAggregation = void 0;
4
+ const types_1 = require("../types");
5
+ const SectionsObjectAggregation_1 = require("./SectionsObjectAggregation");
6
+ /**
7
+ * Represents an aggregation for sub-sections objects.
8
+ */
9
+ class SubSectionsAggregation extends SectionsObjectAggregation_1.SectionsObjectAggregation {
10
+ /**
11
+ * Creates an instance of `SubSectionsAggregation`.
12
+ *
13
+ * @param data Optional aggregation data object used to initialize properties.
14
+ * @param schema Optional JSON schema fragment associated with this aggregation.
15
+ */
16
+ constructor(data, schema) {
17
+ super(data, schema);
18
+ const additionalProperties = schema?.additionalProperties;
19
+ if (typeof additionalProperties === 'object' && additionalProperties.$ref) {
20
+ this.schemaCreationForms = [
21
+ {
22
+ name: types_1.AggregationCreationForm.CustomSubSection,
23
+ kind: types_1.SCHEMA_CREATION_FORM,
24
+ title: 'PAGE_EDITOR_OUTLINE_ADD_CUSTOM_SECTIONS_TITLE',
25
+ disabled: false
26
+ }
27
+ ];
28
+ }
29
+ }
30
+ /**
31
+ * Overwritten method for data update of object page sections
32
+ * Method receives current values for sections - loops custom sections array and appends existing/standard aggregations with custom section aggregations.
33
+ *
34
+ * @param data Data which should be used for value population.
35
+ * @param page Page config data.
36
+ * @param pageType Page type.
37
+ * @param path Aggregation path.
38
+ * @param annotations Page annotations.
39
+ * @param parser Model parser parameters.
40
+ */
41
+ updatePropertiesValues(data, page, pageType, path, annotations, parser) {
42
+ super.updatePropertiesValues(data, page, pageType, path, annotations, parser);
43
+ this.formSchema = this.additionalProperties?.aggregations?.['subsections'];
44
+ }
45
+ /**
46
+ * Public method checks if annotation sections are merged by 'sap.fe' in runtime.
47
+ * There is two reordering approaches:
48
+ * 1. When annotations sections are merged into one. There no any collection section in such case.
49
+ * 2. When sections are separated. There is at least one collection section in such case.
50
+ *
51
+ * @returns Annotation sections are merged by 'sap.fe' in runtime.
52
+ */
53
+ isSectionsMerged() {
54
+ let mergedAnnotationNodes = 0;
55
+ for (const key in this.aggregations) {
56
+ const aggregation = this.aggregations[key];
57
+ if ('subsections' in aggregation.aggregations) {
58
+ // Collection facet - sections are not merged in runtime by 'sap.fe'
59
+ return false;
60
+ }
61
+ else if (!aggregation.custom) {
62
+ mergedAnnotationNodes++;
63
+ }
64
+ }
65
+ // If there is at least one annotation node - sections are merged
66
+ return mergedAnnotationNodes > 0;
67
+ }
68
+ }
69
+ exports.SubSectionsAggregation = SubSectionsAggregation;
70
+ //# sourceMappingURL=SubSectionsAggregation.js.map
@@ -0,0 +1,6 @@
1
+ export * from './SectionsAggregation';
2
+ export * from './HeaderSectionsAggregation';
3
+ export * from './SectionAggregation';
4
+ export * from './SectionsObjectAggregation';
5
+ export * from './SubSectionsAggregation';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,22 @@
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("./SectionsAggregation"), exports);
18
+ __exportStar(require("./HeaderSectionsAggregation"), exports);
19
+ __exportStar(require("./SectionAggregation"), exports);
20
+ __exportStar(require("./SectionsObjectAggregation"), exports);
21
+ __exportStar(require("./SubSectionsAggregation"), exports);
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,89 @@
1
+ import { ObjectAggregation } from '../ObjectAggregation';
2
+ import type { PageData, PropertyPath, PageAnnotations } from '../types';
3
+ import { SortingOptions, AggregationActions, TableColumnExtensionType } from '../types';
4
+ import { PageType } from '@sap/ux-specification/dist/types/src';
5
+ import type { PageConfig } from '@sap/ux-specification/dist/types/src';
6
+ /**
7
+ * Represents an aggregation for column objects.
8
+ */
9
+ export declare class ColumnAggregation extends ObjectAggregation {
10
+ private title?;
11
+ originalIndex?: number;
12
+ isViewNode: boolean;
13
+ actions: AggregationActions[];
14
+ sortableItem: SortingOptions;
15
+ private readonly criticality?;
16
+ /**
17
+ * Setter for title.
18
+ *
19
+ * @param title Title.
20
+ */
21
+ setTitle(title?: string): void;
22
+ /**
23
+ * Method returns display name of aggregation without applying i18n translation.
24
+ * Overwritten for column handling.
25
+ *
26
+ * @returns Display name of aggregation.
27
+ */
28
+ protected getRawDisplayName(): string;
29
+ /**
30
+ * Method validates column positioning by checking anchoring.
31
+ */
32
+ private validateColumnPositioning;
33
+ /**
34
+ * Public method to mark section as custom section.
35
+ *
36
+ * @param params Parameters used to configure the custom column.
37
+ * @param params.pageType Page type
38
+ * @param params.originalIndex Original element index - data to store and use on reordering.
39
+ * @param params.columnExtension Column extension type.
40
+ * @param params.isExtensionTypeSupported Whether column extension type is supported.
41
+ * @param params.i18nKey I18n custom key.
42
+ * @param params.tableExtension Target table extension type.
43
+ * @param params.isV4 Whether Custom column is for V4.
44
+ * @param params.tabkey Tab/view key identificator.
45
+ */
46
+ markAsCustomColumn(params: {
47
+ pageType: PageType;
48
+ originalIndex: number;
49
+ columnExtension: TableColumnExtensionType;
50
+ isExtensionTypeSupported: boolean;
51
+ i18nKey?: string;
52
+ tableExtension?: TableColumnExtensionType;
53
+ isV4?: boolean;
54
+ tabkey?: string;
55
+ }): void;
56
+ /**
57
+ * Method parses object path key and returns field name / technical id.
58
+ *
59
+ * @returns Field name / technical id.
60
+ */
61
+ getTechnicalName(): string | undefined;
62
+ /**
63
+ * Overwritten method for aggregation update.
64
+ *
65
+ * @param data Data which should be used for value population.
66
+ * @param page Page config data.
67
+ * @param pageType Page type.
68
+ * @param path Aggregation path.
69
+ * @param annotations Annotation data.
70
+ */
71
+ updatePropertiesValues(data: PageData, page: PageConfig, pageType: PageType, path: PropertyPath, annotations?: PageAnnotations): void;
72
+ /**
73
+ * Method updates column move settings according to column state.
74
+ */
75
+ private updateMoveProperties;
76
+ /**
77
+ * Checks if this column represents an action column.
78
+ *
79
+ * @returns true if this is an action column.
80
+ */
81
+ isActionColumn(): boolean;
82
+ /**
83
+ * Checks if this column represents a navigation column.
84
+ *
85
+ * @returns true if this is a navigation column.
86
+ */
87
+ isNavigationColumn(): boolean;
88
+ }
89
+ //# sourceMappingURL=ColumnAggregation.d.ts.map
@@ -0,0 +1,175 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ColumnAggregation = void 0;
7
+ const ObjectAggregation_1 = require("../ObjectAggregation");
8
+ const i18next_1 = __importDefault(require("i18next"));
9
+ const types_1 = require("../types");
10
+ const utils_1 = require("../utils");
11
+ const src_1 = require("@sap/ux-specification/dist/types/src");
12
+ /**
13
+ * Represents an aggregation for column objects.
14
+ */
15
+ class ColumnAggregation extends ObjectAggregation_1.ObjectAggregation {
16
+ title;
17
+ originalIndex;
18
+ isViewNode = true;
19
+ actions = [types_1.AggregationActions.Delete];
20
+ sortableItem = types_1.SortingOptions.Enabled;
21
+ criticality;
22
+ /**
23
+ * Setter for title.
24
+ *
25
+ * @param title Title.
26
+ */
27
+ setTitle(title) {
28
+ this.title = title;
29
+ }
30
+ /**
31
+ * Method returns display name of aggregation without applying i18n translation.
32
+ * Overwritten for column handling.
33
+ *
34
+ * @returns Display name of aggregation.
35
+ */
36
+ getRawDisplayName() {
37
+ return this.title || super.getRawDisplayName();
38
+ }
39
+ /**
40
+ * Method validates column positioning by checking anchoring.
41
+ */
42
+ validateColumnPositioning() {
43
+ const value = this.value && typeof this.value === 'object' ? this.value : {};
44
+ const anchorEnum = this.aggregations.position?.schema?.properties?.anchor?.enum;
45
+ const anchorOneOf = this.schema?.properties?.anchor?.oneOf;
46
+ let anchorMatches = false;
47
+ if (this.isMacrosNode()) {
48
+ // validate column key
49
+ (0, utils_1.validateMacrosExtension)(this, value);
50
+ const relatedAnchors = anchorOneOf ?? [];
51
+ // no positioning property for macros anchor
52
+ const anchor = (0, utils_1.getProperty)(value, ['anchor']);
53
+ anchorMatches = anchor
54
+ ? relatedAnchors.some((relatedAnchor) => {
55
+ return relatedAnchor['const'] === anchor;
56
+ })
57
+ : true;
58
+ }
59
+ else {
60
+ const relatedAnchors = anchorEnum ?? [];
61
+ const anchor = (0, utils_1.getProperty)(value, ['position', 'anchor']);
62
+ anchorMatches = anchor ? relatedAnchors.includes(anchor) : true;
63
+ }
64
+ // validate columns by checking related anchors
65
+ (0, utils_1.validateExtension)(this, anchorMatches, i18next_1.default.t('PAGE_EDITOR_CUSTOM_EXTENSION_NO_ANCHOR'));
66
+ }
67
+ /**
68
+ * Public method to mark section as custom section.
69
+ *
70
+ * @param params Parameters used to configure the custom column.
71
+ * @param params.pageType Page type
72
+ * @param params.originalIndex Original element index - data to store and use on reordering.
73
+ * @param params.columnExtension Column extension type.
74
+ * @param params.isExtensionTypeSupported Whether column extension type is supported.
75
+ * @param params.i18nKey I18n custom key.
76
+ * @param params.tableExtension Target table extension type.
77
+ * @param params.isV4 Whether Custom column is for V4.
78
+ * @param params.tabkey Tab/view key identificator.
79
+ */
80
+ markAsCustomColumn(params) {
81
+ const { pageType, originalIndex, columnExtension, isExtensionTypeSupported, i18nKey, tableExtension = "ResponsiveTableColumnsExtension" /* TableColumnExtensionType.ResponsiveTableColumnsExtension */, isV4 = false, tabkey } = params;
82
+ this.custom = true;
83
+ this.actions = [types_1.AggregationActions.OpenSource];
84
+ if (!this.isMacrosNode()) {
85
+ this.actions.push(types_1.AggregationActions.Delete);
86
+ }
87
+ this.sortableItem =
88
+ !isExtensionTypeSupported || tableExtension === columnExtension
89
+ ? types_1.SortingOptions.Enabled
90
+ : types_1.SortingOptions.Excluded;
91
+ const columnExtensionText = columnExtension ?? 'Unknown';
92
+ if (tabkey && pageType === src_1.PageType.ListReport) {
93
+ this.additionalText = isExtensionTypeSupported
94
+ ? i18next_1.default.t('PAGE_EDITOR_OUTLINE_NODE_DESC_CUSTOM_COLUMN_WITH_EXTENSION_TAB', {
95
+ tabkey,
96
+ extension: i18next_1.default.t(`PAGE_EDITOR_OUTLINE_NODE_DESC_CUSTOM_COLUMN_${columnExtensionText}`)
97
+ })
98
+ : i18next_1.default.t('PAGE_EDITOR_OUTLINE_NODE_DESC_CUSTOM_COLUMN_TAB', { tabkey });
99
+ }
100
+ else {
101
+ this.additionalText = isExtensionTypeSupported
102
+ ? i18next_1.default.t('PAGE_EDITOR_OUTLINE_NODE_DESC_CUSTOM_COLUMN_WITH_EXTENSION', {
103
+ extension: i18next_1.default.t(`PAGE_EDITOR_OUTLINE_NODE_DESC_CUSTOM_COLUMN_${columnExtensionText}`)
104
+ })
105
+ : i18next_1.default.t('PAGE_EDITOR_OUTLINE_NODE_DESC_CUSTOM_COLUMN');
106
+ }
107
+ this.originalIndex = originalIndex;
108
+ this.i18nKey = i18nKey;
109
+ if (isExtensionTypeSupported && tableExtension !== columnExtensionText) {
110
+ // Column with different extension that target table
111
+ this.state = types_1.ValidationState.Invalid;
112
+ this.messages = [
113
+ {
114
+ text: i18next_1.default.t('PAGE_EDITOR_CUSTOM_COLUMN_UNUSED_COLUMN', {
115
+ tableType: types_1.EXTENSION_TABLE_TYPE_MAP.get(tableExtension)
116
+ }),
117
+ type: types_1.PropertyMessageType.Info
118
+ }
119
+ ];
120
+ this.inactive = true;
121
+ }
122
+ // anchor positioning is only supported for V4 columns
123
+ if (isV4) {
124
+ this.validateColumnPositioning();
125
+ }
126
+ }
127
+ /**
128
+ * Method parses object path key and returns field name / technical id.
129
+ *
130
+ * @returns Field name / technical id.
131
+ */
132
+ getTechnicalName() {
133
+ return (0, utils_1.getTechnicalIdFromPath)(this.path);
134
+ }
135
+ /**
136
+ * Overwritten method for aggregation update.
137
+ *
138
+ * @param data Data which should be used for value population.
139
+ * @param page Page config data.
140
+ * @param pageType Page type.
141
+ * @param path Aggregation path.
142
+ * @param annotations Annotation data.
143
+ */
144
+ updatePropertiesValues(data, page, pageType, path, annotations) {
145
+ super.updatePropertiesValues(data, page, pageType, path, annotations);
146
+ this.updateMoveProperties();
147
+ }
148
+ /**
149
+ * Method updates column move settings according to column state.
150
+ */
151
+ updateMoveProperties() {
152
+ if (this.isActionColumn() || this.isNavigationColumn()) {
153
+ this.sortableCollection = !this.criticality || this.criticality === 'None' ? 'actions' : undefined;
154
+ this.additionalText = i18next_1.default.t(`PAGE_EDITOR_OUTLINE_NODE_DESC_ACTION_COLUMN`);
155
+ }
156
+ }
157
+ /**
158
+ * Checks if this column represents an action column.
159
+ *
160
+ * @returns true if this is an action column.
161
+ */
162
+ isActionColumn() {
163
+ return !!this.name?.startsWith(`${types_1.DATA_FIELD_ACTION}${types_1.ANNOTATION_TYPES_SEPARATOR}`);
164
+ }
165
+ /**
166
+ * Checks if this column represents a navigation column.
167
+ *
168
+ * @returns true if this is a navigation column.
169
+ */
170
+ isNavigationColumn() {
171
+ return !!this.name?.startsWith(`${types_1.DATA_FIELD_FOR_INTENT_BASED_NAVIGATION}${types_1.ANNOTATION_TYPES_SEPARATOR}`);
172
+ }
173
+ }
174
+ exports.ColumnAggregation = ColumnAggregation;
175
+ //# sourceMappingURL=ColumnAggregation.js.map