@sap-ux/fe-fpm-writer 0.29.6 → 0.31.0

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.
@@ -16,5 +16,5 @@ export declare function enhanceManifestAndGetActionsElementReference(manifest: a
16
16
  * @param {Editor} [fs] - the memfs editor instance
17
17
  * @returns {Promise<Editor>} the updated memfs editor instance
18
18
  */
19
- export declare function generateCustomAction(basePath: string, actionConfig: CustomAction, fs?: Editor): Editor;
19
+ export declare function generateCustomAction(basePath: string, actionConfig: CustomAction, fs?: Editor): Promise<Editor>;
20
20
  //# sourceMappingURL=index.d.ts.map
@@ -4,13 +4,13 @@ exports.generateCustomAction = exports.enhanceManifestAndGetActionsElementRefere
4
4
  const mem_fs_1 = require("mem-fs");
5
5
  const mem_fs_editor_1 = require("mem-fs-editor");
6
6
  const types_1 = require("./types");
7
- const path_1 = require("path");
8
7
  const ejs_1 = require("ejs");
9
8
  const validate_1 = require("../common/validate");
10
9
  const defaults_1 = require("../common/defaults");
11
10
  const event_handler_1 = require("../common/event-handler");
12
11
  const templates_1 = require("../templates");
13
12
  const file_1 = require("../common/file");
13
+ const utils_1 = require("../common/utils");
14
14
  /**
15
15
  * Enhances the provided custom action configuration with default data.
16
16
  *
@@ -86,14 +86,13 @@ exports.enhanceManifestAndGetActionsElementReference = enhanceManifestAndGetActi
86
86
  * @param {Editor} [fs] - the memfs editor instance
87
87
  * @returns {Promise<Editor>} the updated memfs editor instance
88
88
  */
89
- function generateCustomAction(basePath, actionConfig, fs) {
89
+ async function generateCustomAction(basePath, actionConfig, fs) {
90
90
  (0, validate_1.validateVersion)(actionConfig.minUI5Version);
91
91
  if (!fs) {
92
92
  fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
93
93
  }
94
94
  (0, validate_1.validateBasePath)(basePath, fs);
95
- const manifestPath = (0, path_1.join)(basePath, 'webapp/manifest.json');
96
- const manifest = fs.readJSON(manifestPath);
95
+ const { path: manifestPath, content: manifest } = await (0, utils_1.getManifest)(basePath, fs);
97
96
  const config = enhanceConfig(actionConfig, manifestPath, manifest);
98
97
  // Apply event handler
99
98
  if (config.eventHandler) {
@@ -27,5 +27,5 @@ export declare const MIN_VERSION = "1.94.0";
27
27
  * @param {Editor} [fs] - the mem-fs editor instance
28
28
  * @returns {Promise<Editor>} the updated mem-fs editor instance
29
29
  */
30
- export declare function enableFPM(basePath: string, config?: FPMConfig, fs?: Editor): Editor;
30
+ export declare function enableFPM(basePath: string, config?: FPMConfig, fs?: Editor): Promise<Editor>;
31
31
  //# sourceMappingURL=index.d.ts.map
package/dist/app/index.js CHANGED
@@ -58,15 +58,11 @@ function adaptMinUI5Version(manifest, fs, manifestPath) {
58
58
  * @param {Editor} [fs] - the mem-fs editor instance
59
59
  * @returns {Promise<Editor>} the updated mem-fs editor instance
60
60
  */
61
- function enableFPM(basePath, config = {}, fs) {
61
+ async function enableFPM(basePath, config = {}, fs) {
62
62
  if (!fs) {
63
63
  fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
64
64
  }
65
- const manifestPath = (0, path_1.join)(basePath, 'webapp/manifest.json');
66
- if (!fs.exists(manifestPath)) {
67
- throw new Error(`Invalid project folder. Cannot find required file ${manifestPath}`);
68
- }
69
- const manifest = fs.readJSON(manifestPath);
65
+ const { path: manifestPath, content: manifest } = await (0, utils_1.getManifest)(basePath, fs);
70
66
  // add FE libs is not yet added
71
67
  if (!manifest['sap.ui5']?.dependencies?.libs?.['sap.fe.templates']) {
72
68
  fs.extendJSON(manifestPath, {
@@ -41,32 +41,12 @@ const types_2 = require("../prompts/types");
41
41
  const semver_1 = require("semver");
42
42
  const project_access_1 = require("@sap-ux/project-access");
43
43
  const file_1 = require("../common/file");
44
+ const utils_1 = require("../common/utils");
44
45
  const PLACEHOLDERS = {
45
46
  'id': 'REPLACE_WITH_BUILDING_BLOCK_ID',
46
47
  'entitySet': 'REPLACE_WITH_ENTITY',
47
48
  'qualifier': 'REPLACE_WITH_A_QUALIFIER'
48
49
  };
49
- /**
50
- * Gets manifest path.
51
- *
52
- * @param {string} basePath the base path
53
- * @param {Editor} fs the memfs editor instance
54
- * @returns {Manifest | undefined} path to manifest file
55
- */
56
- async function getManifestPath(basePath, fs) {
57
- return (0, path_1.join)(await (0, project_access_1.getWebappPath)(basePath, fs), 'manifest.json');
58
- }
59
- /**
60
- * Gets manifest content.
61
- *
62
- * @param {string} basePath the base path
63
- * @param {Editor} fs the memfs editor instance
64
- * @returns {Manifest | undefined} the manifest content
65
- */
66
- async function getManifest(basePath, fs) {
67
- const manifestPath = await getManifestPath(basePath, fs);
68
- return fs.readJSON(manifestPath);
69
- }
70
50
  /**
71
51
  * Generates a building block into the provided xml view file.
72
52
  *
@@ -86,12 +66,12 @@ async function generateBuildingBlock(basePath, config, fs) {
86
66
  }
87
67
  // Read the view xml and template files and update contents of the view xml file
88
68
  const xmlDocument = getUI5XmlDocument(basePath, config.viewOrFragmentPath, fs);
89
- const manifest = await getManifest(basePath, fs);
69
+ const { content: manifest } = await (0, utils_1.getManifest)(basePath, fs);
90
70
  const templateDocument = getTemplateDocument(config.buildingBlockData, xmlDocument, fs, manifest);
91
71
  fs = updateViewFile(basePath, config.viewOrFragmentPath, config.aggregationPath, xmlDocument, templateDocument, fs);
92
72
  if (manifest && !(0, validate_1.validateDependenciesLibs)(manifest, ['sap.fe.macros'])) {
93
73
  // "sap.fe.macros" is missing - enhance manifest.json for missing "sap.fe.macros"
94
- const manifestPath = await getManifestPath(basePath, fs);
74
+ const manifestPath = await (0, utils_1.getManifestPath)(basePath, fs);
95
75
  const templatePath = (0, templates_1.getTemplatePath)('/building-block/common/manifest.json');
96
76
  const content = fs.read(manifestPath);
97
77
  const tabInfo = (0, file_1.detectTabSpacing)(content);
@@ -320,7 +300,7 @@ async function getSerializedFileContent(basePath, config, fs) {
320
300
  const xmlDocument = config.viewOrFragmentPath
321
301
  ? getUI5XmlDocument(basePath, config.viewOrFragmentPath, fs)
322
302
  : undefined;
323
- const manifest = await getManifest(basePath, fs);
303
+ const { content: manifest } = await (0, utils_1.getManifest)(basePath, fs, false);
324
304
  const content = getTemplateContent(config.buildingBlockData, xmlDocument, manifest, fs, true);
325
305
  const filePathProps = getFilePathProps(basePath, config.viewOrFragmentPath);
326
306
  return {
@@ -1,7 +1,13 @@
1
- import type { Answers, Prompts, PromptsType } from '../../../prompts/types';
1
+ import type { Answers, Prompts, PromptsGroup, PromptsType } from '../../../prompts/types';
2
2
  export interface BuildingBlockTypePromptsAnswer extends Answers {
3
3
  buildingBlockType: PromptsType;
4
4
  }
5
+ /**
6
+ * Returns the manifest prompts group, the same for all available building blocks.
7
+ *
8
+ * @returns The manifest prompts group.
9
+ */
10
+ export declare const getManifestPromptsGroup: () => PromptsGroup;
5
11
  /**
6
12
  * Returns a list of prompts required to generate building blocks.
7
13
  *
@@ -1,8 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getBuildingBlockTypePrompts = void 0;
3
+ exports.getBuildingBlockTypePrompts = exports.getManifestPromptsGroup = void 0;
4
4
  const i18n_1 = require("../../../i18n");
5
5
  const types_1 = require("../../types");
6
+ /**
7
+ * Returns the manifest prompts group, the same for all available building blocks.
8
+ *
9
+ * @returns The manifest prompts group.
10
+ */
11
+ const getManifestPromptsGroup = () => {
12
+ const t = (0, i18n_1.translate)(i18n_1.i18nNamespaces.buildingBlock, 'prompts.super.manifestGroup.');
13
+ return {
14
+ id: 'manifestLibraries',
15
+ title: t('manifestLibrariesTitle'),
16
+ description: t('manifestLibrariesDescription', { returnObjects: true })
17
+ };
18
+ };
19
+ exports.getManifestPromptsGroup = getManifestPromptsGroup;
6
20
  /**
7
21
  * Returns a list of prompts required to generate building blocks.
8
22
  *
@@ -4,10 +4,17 @@ exports.getChartBuildingBlockPrompts = void 0;
4
4
  const i18n_1 = require("../../../i18n");
5
5
  const utils_1 = require("../utils");
6
6
  const types_1 = require("../../types");
7
+ const building_blocks_1 = require("./building-blocks");
8
+ const MANIFEST_LIBRARIES_GROUP = (0, building_blocks_1.getManifestPromptsGroup)();
7
9
  const defaultAnswers = {
8
10
  id: 'Chart',
9
11
  bindingContextType: 'absolute'
10
12
  };
13
+ const groupIds = {
14
+ commonChartBuildingBlockProperties: 'chartBuildingBlockProperties',
15
+ chartVisualizationProperties: 'chartVisualizationProperties',
16
+ chartConfigureEvents: 'chartConfigureEvents'
17
+ };
11
18
  /**
12
19
  * Returns a list of prompts required to generate a chart building block.
13
20
  *
@@ -17,11 +24,31 @@ const defaultAnswers = {
17
24
  async function getChartBuildingBlockPrompts(context) {
18
25
  const { project } = context;
19
26
  const t = (0, i18n_1.translate)(i18n_1.i18nNamespaces.buildingBlock, 'prompts.chart.');
27
+ const groups = [
28
+ {
29
+ id: groupIds.commonChartBuildingBlockProperties,
30
+ title: t('chartBuildingBlockPropertiesTitle'),
31
+ description: t('chartBuildingBlockPropertiesDescription', { returnObjects: true })
32
+ },
33
+ {
34
+ id: groupIds.chartVisualizationProperties,
35
+ title: t('chartVisualizationPropertiesTitle'),
36
+ description: t('chartVisualizationPropertiesDescription', { returnObjects: true })
37
+ },
38
+ {
39
+ id: groupIds.chartConfigureEvents,
40
+ title: t('chartConfigureEventsTitle'),
41
+ description: t('chartConfigureEventsDescription', { returnObjects: true })
42
+ },
43
+ MANIFEST_LIBRARIES_GROUP
44
+ ];
20
45
  return {
46
+ groups,
21
47
  questions: [
22
48
  (0, utils_1.getViewOrFragmentPathPrompt)(context, t('viewOrFragmentPath.validate'), {
23
49
  message: t('viewOrFragmentPath.message'),
24
50
  guiOptions: {
51
+ groupId: groupIds.commonChartBuildingBlockProperties,
25
52
  mandatory: true,
26
53
  dependantPromptNames: ['aggregationPath', 'buildingBlockData.filterBar']
27
54
  }
@@ -29,14 +56,13 @@ async function getChartBuildingBlockPrompts(context) {
29
56
  (0, utils_1.getBuildingBlockIdPrompt)(context, t('id.validation'), {
30
57
  message: t('id.message'),
31
58
  default: defaultAnswers.id,
32
- guiOptions: {
33
- mandatory: true
34
- }
59
+ guiOptions: { groupId: groupIds.commonChartBuildingBlockProperties, mandatory: true }
35
60
  }),
36
61
  (0, utils_1.getBindingContextTypePrompt)({
37
62
  message: t('bindingContextType'),
38
63
  default: defaultAnswers.bindingContextType,
39
64
  guiOptions: {
65
+ groupId: groupIds.commonChartBuildingBlockProperties,
40
66
  mandatory: true,
41
67
  dependantPromptNames: ['buildingBlockData.metaPath.qualifier']
42
68
  }
@@ -46,6 +72,7 @@ async function getChartBuildingBlockPrompts(context) {
46
72
  await (0, utils_1.getCAPServicePrompt)(context, {
47
73
  message: t('service'),
48
74
  guiOptions: {
75
+ groupId: groupIds.commonChartBuildingBlockProperties,
49
76
  mandatory: true,
50
77
  dependantPromptNames: []
51
78
  }
@@ -55,6 +82,7 @@ async function getChartBuildingBlockPrompts(context) {
55
82
  (0, utils_1.getEntityPrompt)(context, {
56
83
  message: t('entity'),
57
84
  guiOptions: {
85
+ groupId: groupIds.commonChartBuildingBlockProperties,
58
86
  mandatory: true,
59
87
  dependantPromptNames: ['buildingBlockData.metaPath.qualifier']
60
88
  }
@@ -62,6 +90,7 @@ async function getChartBuildingBlockPrompts(context) {
62
90
  (0, utils_1.getAnnotationPathQualifierPrompt)(context, {
63
91
  message: t('qualifier'),
64
92
  guiOptions: {
93
+ groupId: groupIds.commonChartBuildingBlockProperties,
65
94
  mandatory: true,
66
95
  placeholder: t('qualifierPlaceholder'),
67
96
  hint: t('valuesDependentOnEntityTypeInfo')
@@ -69,14 +98,13 @@ async function getChartBuildingBlockPrompts(context) {
69
98
  }, ["com.sap.vocabularies.UI.v1.Chart" /* UIAnnotationTerms.Chart */]),
70
99
  (0, utils_1.getAggregationPathPrompt)(context, {
71
100
  message: t('aggregation'),
72
- guiOptions: {
73
- mandatory: true
74
- }
101
+ guiOptions: { groupId: groupIds.commonChartBuildingBlockProperties, mandatory: true }
75
102
  }),
76
103
  (0, utils_1.getFilterBarIdPrompt)(context, {
77
104
  message: t('filterBar.message'),
78
105
  type: 'list',
79
106
  guiOptions: {
107
+ groupId: groupIds.commonChartBuildingBlockProperties,
80
108
  placeholder: t('filterBar.placeholder'),
81
109
  creation: { placeholder: t('filterBar.inputPlaceholder') }
82
110
  }
@@ -91,6 +119,7 @@ async function getChartBuildingBlockPrompts(context) {
91
119
  { name: t('personalization.choices.sort'), value: 'Sort' }
92
120
  ],
93
121
  guiOptions: {
122
+ groupId: groupIds.chartVisualizationProperties,
94
123
  placeholder: t('personalization.placeholder'),
95
124
  selectType: 'static'
96
125
  }
@@ -103,17 +132,13 @@ async function getChartBuildingBlockPrompts(context) {
103
132
  { name: t('selectionMode.choices.single'), value: 'Single' },
104
133
  { name: t('selectionMode.choices.multiple'), value: 'Multiple' }
105
134
  ],
106
- guiOptions: {
107
- selectType: 'static'
108
- }
135
+ guiOptions: { groupId: groupIds.chartConfigureEvents, selectType: 'static' }
109
136
  },
110
137
  {
111
138
  type: 'input',
112
139
  name: 'buildingBlockData.selectionChange',
113
140
  message: t('selectionChange'),
114
- guiOptions: {
115
- placeholder: t('selectionChangePlaceholder')
116
- }
141
+ guiOptions: { groupId: groupIds.chartConfigureEvents, placeholder: t('selectionChangePlaceholder') }
117
142
  }
118
143
  ],
119
144
  initialAnswers: {
@@ -4,10 +4,16 @@ exports.getFilterBarBuildingBlockPrompts = void 0;
4
4
  const i18n_1 = require("../../../i18n");
5
5
  const utils_1 = require("../utils");
6
6
  const types_1 = require("../../types");
7
+ const building_blocks_1 = require("./building-blocks");
8
+ const MANIFEST_LIBRARIES_GROUP = (0, building_blocks_1.getManifestPromptsGroup)();
7
9
  const defaultAnswers = {
8
10
  id: 'FilterBar',
9
11
  bindingContextType: 'absolute'
10
12
  };
13
+ const groupIds = {
14
+ commonFilterBarBuildingBlockProperties: 'filterBarBuildingBlockProperties',
15
+ filterConfigureEvents: 'filterConfigureEvents'
16
+ };
11
17
  /**
12
18
  * Returns a list of prompts required to generate a filterbar building block.
13
19
  *
@@ -17,11 +23,26 @@ const defaultAnswers = {
17
23
  async function getFilterBarBuildingBlockPrompts(context) {
18
24
  const { project } = context;
19
25
  const t = (0, i18n_1.translate)(i18n_1.i18nNamespaces.buildingBlock, 'prompts.filterBar.');
26
+ const groups = [
27
+ {
28
+ id: groupIds.commonFilterBarBuildingBlockProperties,
29
+ title: t('filterBarBuildingBlockPropertiesTitle'),
30
+ description: t('filterBarBuildingBlockPropertiesDescription', { returnObjects: true })
31
+ },
32
+ {
33
+ id: groupIds.filterConfigureEvents,
34
+ title: t('filterBarConfigureEventsTitle'),
35
+ description: t('filterBarConfigureEventsDescription', { returnObjects: true })
36
+ },
37
+ MANIFEST_LIBRARIES_GROUP
38
+ ];
20
39
  return {
40
+ groups,
21
41
  questions: [
22
42
  (0, utils_1.getViewOrFragmentPathPrompt)(context, t('viewOrFragmentPath.validate'), {
23
43
  message: t('viewOrFragmentPath.message'),
24
44
  guiOptions: {
45
+ groupId: groupIds.commonFilterBarBuildingBlockProperties,
25
46
  mandatory: true,
26
47
  dependantPromptNames: ['aggregationPath']
27
48
  }
@@ -29,14 +50,13 @@ async function getFilterBarBuildingBlockPrompts(context) {
29
50
  (0, utils_1.getBuildingBlockIdPrompt)(context, t('id.validation'), {
30
51
  message: t('id.message'),
31
52
  default: defaultAnswers.id,
32
- guiOptions: {
33
- mandatory: true
34
- }
53
+ guiOptions: { groupId: groupIds.commonFilterBarBuildingBlockProperties, mandatory: true }
35
54
  }),
36
55
  (0, utils_1.getBindingContextTypePrompt)({
37
56
  message: t('bindingContextType'),
38
57
  default: defaultAnswers.bindingContextType,
39
58
  guiOptions: {
59
+ groupId: groupIds.commonFilterBarBuildingBlockProperties,
40
60
  mandatory: true,
41
61
  dependantPromptNames: ['buildingBlockData.metaPath.qualifier']
42
62
  }
@@ -46,6 +66,7 @@ async function getFilterBarBuildingBlockPrompts(context) {
46
66
  await (0, utils_1.getCAPServicePrompt)(context, {
47
67
  message: t('service'),
48
68
  guiOptions: {
69
+ groupId: groupIds.commonFilterBarBuildingBlockProperties,
49
70
  mandatory: true,
50
71
  dependantPromptNames: []
51
72
  }
@@ -54,13 +75,12 @@ async function getFilterBarBuildingBlockPrompts(context) {
54
75
  : []),
55
76
  (0, utils_1.getAggregationPathPrompt)(context, {
56
77
  message: t('aggregation'),
57
- guiOptions: {
58
- mandatory: true
59
- }
78
+ guiOptions: { groupId: groupIds.commonFilterBarBuildingBlockProperties, mandatory: true }
60
79
  }),
61
80
  (0, utils_1.getEntityPrompt)(context, {
62
81
  message: t('entity'),
63
82
  guiOptions: {
83
+ groupId: groupIds.commonFilterBarBuildingBlockProperties,
64
84
  mandatory: true,
65
85
  dependantPromptNames: ['buildingBlockData.metaPath.qualifier']
66
86
  }
@@ -68,6 +88,7 @@ async function getFilterBarBuildingBlockPrompts(context) {
68
88
  (0, utils_1.getAnnotationPathQualifierPrompt)(context, {
69
89
  message: t('qualifier'),
70
90
  guiOptions: {
91
+ groupId: groupIds.commonFilterBarBuildingBlockProperties,
71
92
  mandatory: true,
72
93
  placeholder: t('qualifierPlaceholder'),
73
94
  hint: t('valuesDependentOnEntityTypeInfo')
@@ -76,12 +97,14 @@ async function getFilterBarBuildingBlockPrompts(context) {
76
97
  {
77
98
  type: 'input',
78
99
  name: 'buildingBlockData.filterChanged',
79
- message: t('filterChanged')
100
+ message: t('filterChanged'),
101
+ guiOptions: { groupId: groupIds.filterConfigureEvents, placeholder: t('filterChangedPlaceholder') }
80
102
  },
81
103
  {
82
104
  type: 'input',
83
105
  name: 'buildingBlockData.search',
84
- message: t('search')
106
+ message: t('search'),
107
+ guiOptions: { groupId: groupIds.filterConfigureEvents, placeholder: t('searchPlaceholder') }
85
108
  }
86
109
  ],
87
110
  initialAnswers: {
@@ -4,8 +4,10 @@ exports.getTableBuildingBlockPrompts = void 0;
4
4
  const i18n_1 = require("../../../i18n");
5
5
  const utils_1 = require("../utils");
6
6
  const types_1 = require("../../types");
7
+ const building_blocks_1 = require("./building-blocks");
8
+ const MANIFEST_LIBRARIES_GROUP = (0, building_blocks_1.getManifestPromptsGroup)();
7
9
  const groupIds = {
8
- commonBlockProperties: 'tableBuildingBlockProperties',
10
+ commonTableBuildingBlockProperties: 'tableBuildingBlockProperties',
9
11
  visualisationProperties: 'tableVisualizationProperties'
10
12
  };
11
13
  const defaultAnswers = {
@@ -33,7 +35,7 @@ async function getTableBuildingBlockPrompts(context) {
33
35
  const t = (0, i18n_1.translate)(i18n_1.i18nNamespaces.buildingBlock, 'prompts.table.');
34
36
  const groups = [
35
37
  {
36
- id: groupIds.commonBlockProperties,
38
+ id: groupIds.commonTableBuildingBlockProperties,
37
39
  title: t('tableBuildingBlockPropertiesTitle'),
38
40
  description: t('tableBuildingBlockPropertiesDescription', { returnObjects: true })
39
41
  },
@@ -41,7 +43,8 @@ async function getTableBuildingBlockPrompts(context) {
41
43
  id: groupIds.visualisationProperties,
42
44
  title: t('tableVisualizationPropertiesTitle'),
43
45
  description: t('tableVisualizationPropertiesDescription', { returnObjects: true })
44
- }
46
+ },
47
+ MANIFEST_LIBRARIES_GROUP
45
48
  ];
46
49
  return {
47
50
  groups,
@@ -50,7 +53,7 @@ async function getTableBuildingBlockPrompts(context) {
50
53
  (0, utils_1.getViewOrFragmentPathPrompt)(context, t('viewOrFragmentPath.validate'), {
51
54
  message: t('viewOrFragmentPath.message'),
52
55
  guiOptions: {
53
- groupId: groupIds.commonBlockProperties,
56
+ groupId: groupIds.commonTableBuildingBlockProperties,
54
57
  mandatory: true,
55
58
  dependantPromptNames: ['aggregationPath', 'buildingBlockData.filterBar']
56
59
  }
@@ -59,7 +62,7 @@ async function getTableBuildingBlockPrompts(context) {
59
62
  message: t('id.message'),
60
63
  default: defaultAnswers.id,
61
64
  guiOptions: {
62
- groupId: groupIds.commonBlockProperties,
65
+ groupId: groupIds.commonTableBuildingBlockProperties,
63
66
  mandatory: true
64
67
  }
65
68
  }),
@@ -67,7 +70,7 @@ async function getTableBuildingBlockPrompts(context) {
67
70
  message: t('bindingContextType'),
68
71
  default: defaultAnswers.bindingContextType,
69
72
  guiOptions: {
70
- groupId: groupIds.commonBlockProperties,
73
+ groupId: groupIds.commonTableBuildingBlockProperties,
71
74
  mandatory: true,
72
75
  dependantPromptNames: ['buildingBlockData.metaPath.qualifier']
73
76
  }
@@ -77,7 +80,7 @@ async function getTableBuildingBlockPrompts(context) {
77
80
  await (0, utils_1.getCAPServicePrompt)(context, {
78
81
  message: t('service'),
79
82
  guiOptions: {
80
- groupId: groupIds.commonBlockProperties,
83
+ groupId: groupIds.commonTableBuildingBlockProperties,
81
84
  mandatory: true,
82
85
  dependantPromptNames: []
83
86
  }
@@ -87,7 +90,7 @@ async function getTableBuildingBlockPrompts(context) {
87
90
  (0, utils_1.getEntityPrompt)(context, {
88
91
  message: t('entity'),
89
92
  guiOptions: {
90
- groupId: groupIds.commonBlockProperties,
93
+ groupId: groupIds.commonTableBuildingBlockProperties,
91
94
  mandatory: true,
92
95
  dependantPromptNames: ['buildingBlockData.metaPath.qualifier']
93
96
  }
@@ -96,7 +99,7 @@ async function getTableBuildingBlockPrompts(context) {
96
99
  message: t('qualifier'),
97
100
  guiOptions: {
98
101
  hint: t('valuesDependentOnEntityTypeInfo'),
99
- groupId: groupIds.commonBlockProperties,
102
+ groupId: groupIds.commonTableBuildingBlockProperties,
100
103
  mandatory: true,
101
104
  placeholder: t('qualifierPlaceholder')
102
105
  }
@@ -104,7 +107,7 @@ async function getTableBuildingBlockPrompts(context) {
104
107
  (0, utils_1.getAggregationPathPrompt)(context, {
105
108
  message: t('aggregation'),
106
109
  guiOptions: {
107
- groupId: groupIds.commonBlockProperties,
110
+ groupId: groupIds.commonTableBuildingBlockProperties,
108
111
  mandatory: true
109
112
  }
110
113
  }),
@@ -112,7 +115,7 @@ async function getTableBuildingBlockPrompts(context) {
112
115
  message: t('filterBar.message'),
113
116
  type: 'list',
114
117
  guiOptions: {
115
- groupId: groupIds.commonBlockProperties,
118
+ groupId: groupIds.commonTableBuildingBlockProperties,
116
119
  placeholder: t('filterBar.placeholder'),
117
120
  creation: { placeholder: t('filterBar.inputPlaceholder') }
118
121
  }
@@ -13,7 +13,7 @@ export declare function getManifestRoot(ui5Version?: string): string;
13
13
  * @returns {Promise<Editor>} the updated mem-fs editor instance
14
14
  * @param {string} basePath - the base path
15
15
  * @param {CustomTableColumn} customColumn - the custom column configuration
16
- * @param {Editor} [fs] - the mem-fs editor instance
16
+ * @param {Promise<Editor>} [fs] - the mem-fs editor instance
17
17
  */
18
- export declare function generateCustomColumn(basePath: string, customColumn: CustomTableColumn, fs?: Editor): Editor;
18
+ export declare function generateCustomColumn(basePath: string, customColumn: CustomTableColumn, fs?: Editor): Promise<Editor>;
19
19
  //# sourceMappingURL=index.d.ts.map
@@ -11,6 +11,7 @@ const event_handler_1 = require("../common/event-handler");
11
11
  const file_1 = require("../common/file");
12
12
  const templates_1 = require("../templates");
13
13
  const semver_1 = require("semver");
14
+ const utils_1 = require("../common/utils");
14
15
  /**
15
16
  * Get the template folder for the given UI5 version.
16
17
  *
@@ -63,16 +64,15 @@ function enhanceConfig(fs, data, manifestPath, manifest) {
63
64
  * @returns {Promise<Editor>} the updated mem-fs editor instance
64
65
  * @param {string} basePath - the base path
65
66
  * @param {CustomTableColumn} customColumn - the custom column configuration
66
- * @param {Editor} [fs] - the mem-fs editor instance
67
+ * @param {Promise<Editor>} [fs] - the mem-fs editor instance
67
68
  */
68
- function generateCustomColumn(basePath, customColumn, fs) {
69
+ async function generateCustomColumn(basePath, customColumn, fs) {
69
70
  (0, validate_1.validateVersion)(customColumn.minUI5Version);
70
71
  if (!fs) {
71
72
  fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
72
73
  }
73
74
  (0, validate_1.validateBasePath)(basePath, fs);
74
- const manifestPath = (0, path_1.join)(basePath, 'webapp/manifest.json');
75
- const manifest = fs.readJSON(manifestPath);
75
+ const { path: manifestPath, content: manifest } = await (0, utils_1.getManifest)(basePath, fs);
76
76
  // merge with defaults
77
77
  const completeColumn = enhanceConfig(fs, customColumn, manifestPath, manifest);
78
78
  // enhance manifest with column definition
@@ -177,4 +177,17 @@ export interface FragmentContentData {
177
177
  content: string;
178
178
  requireAttribute?: string;
179
179
  }
180
+ /**
181
+ * Interface contain information about application manifest.
182
+ */
183
+ export interface ManifestData {
184
+ /**
185
+ * Path to manifest.json file.
186
+ */
187
+ path: string;
188
+ /**
189
+ * Parsed content of manifest.json file.
190
+ */
191
+ content: Manifest;
192
+ }
180
193
  //# sourceMappingURL=types.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import type { Editor } from 'mem-fs-editor';
2
- import type { FileContentPosition } from '../common/types';
2
+ import type { FileContentPosition, ManifestData } from './types';
3
3
  /**
4
4
  * Method inserts passed text into content by char index position.
5
5
  * In case if position is out of range, then whitespaces would be created.
@@ -31,4 +31,21 @@ export declare function insertTextAtPosition(text: string, content: string, posi
31
31
  * @param fs - the memfs editor instance
32
32
  */
33
33
  export declare function addExtensionTypes(basePath: string, minUI5Version: string | undefined, fs: Editor): void;
34
+ /**
35
+ * Gets manifest path.
36
+ *
37
+ * @param {string} basePath the base path
38
+ * @param {Editor} fs the memfs editor instance
39
+ * @returns {Manifest | undefined} path to manifest file
40
+ */
41
+ export declare function getManifestPath(basePath: string, fs: Editor): Promise<string>;
42
+ /**
43
+ * Gets content and path of the manifest.
44
+ *
45
+ * @param {string} basePath the base path
46
+ * @param {Editor} fs the memfs editor instance
47
+ * @param {boolean} [validate] validate if 'manifest.json' file exists - throw error if file does not exist
48
+ * @returns {Manifest | undefined} The content and path of the manifest
49
+ */
50
+ export declare function getManifest(basePath: string, fs: Editor, validate?: boolean): Promise<ManifestData>;
34
51
  //# sourceMappingURL=utils.d.ts.map
@@ -3,10 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.addExtensionTypes = exports.insertTextAtPosition = exports.insertTextAtAbsolutePosition = void 0;
6
+ exports.getManifest = exports.getManifestPath = exports.addExtensionTypes = exports.insertTextAtPosition = exports.insertTextAtAbsolutePosition = void 0;
7
7
  const os_1 = __importDefault(require("os"));
8
8
  const path_1 = require("path");
9
9
  const semver_1 = require("semver");
10
+ const project_access_1 = require("@sap-ux/project-access");
10
11
  const templates_1 = require("../templates");
11
12
  /**
12
13
  * Method inserts passed text into content by char index position.
@@ -72,4 +73,34 @@ function addExtensionTypes(basePath, minUI5Version, fs) {
72
73
  }
73
74
  }
74
75
  exports.addExtensionTypes = addExtensionTypes;
76
+ /**
77
+ * Gets manifest path.
78
+ *
79
+ * @param {string} basePath the base path
80
+ * @param {Editor} fs the memfs editor instance
81
+ * @returns {Manifest | undefined} path to manifest file
82
+ */
83
+ async function getManifestPath(basePath, fs) {
84
+ return (0, path_1.join)(await (0, project_access_1.getWebappPath)(basePath, fs), 'manifest.json');
85
+ }
86
+ exports.getManifestPath = getManifestPath;
87
+ /**
88
+ * Gets content and path of the manifest.
89
+ *
90
+ * @param {string} basePath the base path
91
+ * @param {Editor} fs the memfs editor instance
92
+ * @param {boolean} [validate] validate if 'manifest.json' file exists - throw error if file does not exist
93
+ * @returns {Manifest | undefined} The content and path of the manifest
94
+ */
95
+ async function getManifest(basePath, fs, validate = true) {
96
+ const path = await getManifestPath(basePath, fs);
97
+ if (validate && !fs.exists(path)) {
98
+ throw new Error(`Invalid project folder. Cannot find required file ${path}`);
99
+ }
100
+ return {
101
+ path,
102
+ content: fs.readJSON(path)
103
+ };
104
+ }
105
+ exports.getManifest = getManifest;
75
106
  //# sourceMappingURL=utils.js.map
@@ -8,7 +8,7 @@ export declare const UI5_CONTROLLER_EXTENSION_OBJECT_PAGE = "sap.fe.templates.Ob
8
8
  * @param {string} basePath - the base path
9
9
  * @param {ControllerExtension} controllerConfig - the controller extension configuration
10
10
  * @param {Editor} [fs] - the memfs editor instance
11
- * @returns {Editor} the updated memfs editor instance
11
+ * @returns {Promise<Editor>} the updated memfs editor instance
12
12
  */
13
- export declare function generateControllerExtension(basePath: string, controllerConfig: ControllerExtension, fs?: Editor): Editor;
13
+ export declare function generateControllerExtension(basePath: string, controllerConfig: ControllerExtension, fs?: Editor): Promise<Editor>;
14
14
  //# sourceMappingURL=index.d.ts.map
@@ -171,16 +171,15 @@ function getManifestReplacer(config) {
171
171
  * @param {string} basePath - the base path
172
172
  * @param {ControllerExtension} controllerConfig - the controller extension configuration
173
173
  * @param {Editor} [fs] - the memfs editor instance
174
- * @returns {Editor} the updated memfs editor instance
174
+ * @returns {Promise<Editor>} the updated memfs editor instance
175
175
  */
176
- function generateControllerExtension(basePath, controllerConfig, fs) {
176
+ async function generateControllerExtension(basePath, controllerConfig, fs) {
177
177
  // Validate the base and view paths
178
178
  if (!fs) {
179
179
  fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
180
180
  }
181
181
  (0, validate_1.validateBasePath)(basePath, fs);
182
- const manifestPath = (0, path_1.join)(basePath, 'webapp/manifest.json');
183
- const manifest = fs.readJSON(manifestPath);
182
+ const { path: manifestPath, content: manifest } = await (0, utils_1.getManifest)(basePath, fs);
184
183
  // merge with defaults
185
184
  const internalConfig = enhanceConfig(controllerConfig, manifestPath, manifest);
186
185
  // enhance manifest with view definition
@@ -8,5 +8,5 @@ import type { CustomFilter } from './types';
8
8
  * @param {Editor} [fs] - the memfs editor instance
9
9
  * @returns {Promise<Editor>} the updated memfs editor instance
10
10
  */
11
- export declare function generateCustomFilter(basePath: string, filterConfig: CustomFilter, fs?: Editor): Editor;
11
+ export declare function generateCustomFilter(basePath: string, filterConfig: CustomFilter, fs?: Editor): Promise<Editor>;
12
12
  //# sourceMappingURL=index.d.ts.map
@@ -10,6 +10,7 @@ const defaults_1 = require("../common/defaults");
10
10
  const templates_1 = require("../templates");
11
11
  const file_1 = require("../common/file");
12
12
  const event_handler_1 = require("../common/event-handler");
13
+ const utils_1 = require("../common/utils");
13
14
  /**
14
15
  * Enhances the provided custom filter configuration with default data.
15
16
  *
@@ -42,13 +43,12 @@ function enhanceConfig(data, manifestPath, manifest) {
42
43
  * @param {Editor} [fs] - the memfs editor instance
43
44
  * @returns {Promise<Editor>} the updated memfs editor instance
44
45
  */
45
- function generateCustomFilter(basePath, filterConfig, fs) {
46
+ async function generateCustomFilter(basePath, filterConfig, fs) {
46
47
  if (!fs) {
47
48
  fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
48
49
  }
49
50
  (0, validate_1.validateBasePath)(basePath, fs);
50
- const manifestPath = (0, path_1.join)(basePath, 'webapp/manifest.json');
51
- const manifest = fs.readJSON(manifestPath);
51
+ const { path: manifestPath, content: manifest } = await (0, utils_1.getManifest)(basePath, fs);
52
52
  const config = enhanceConfig(filterConfig, manifestPath, manifest);
53
53
  // Apply event handler
54
54
  if (config.eventHandler) {
@@ -66,7 +66,7 @@ export declare function initializeTargetSettings(data: FpmPage, addSettings?: Re
66
66
  * @param dependencies - expected dependencies
67
67
  * @returns the updated memfs editor instance
68
68
  */
69
- export declare function validatePageConfig(basePath: string, config: CustomPage | ObjectPage, fs: Editor, dependencies?: never[]): Editor;
69
+ export declare function validatePageConfig(basePath: string, config: CustomPage | ObjectPage, fs: Editor, dependencies?: never[]): Promise<Editor>;
70
70
  /**
71
71
  * Add an generic page to an existing UI5 application.
72
72
  * Supported pages - ListReport or ObjectPage.
@@ -78,6 +78,6 @@ export declare function validatePageConfig(basePath: string, config: CustomPage
78
78
  * @param fs - the memfs editor instance
79
79
  * @returns the updated memfs editor instance
80
80
  */
81
- export declare function extendPageJSON(basePath: string, data: ObjectPage, enhanceDataFn: EnhancePageConfigFunction, templatePath: string, fs?: Editor): Editor;
81
+ export declare function extendPageJSON(basePath: string, data: ObjectPage, enhanceDataFn: EnhancePageConfigFunction, templatePath: string, fs?: Editor): Promise<Editor>;
82
82
  export {};
83
83
  //# sourceMappingURL=common.d.ts.map
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.extendPageJSON = exports.validatePageConfig = exports.initializeTargetSettings = exports.getLibraryDependencies = exports.getFclConfig = exports.getManifestJsonExtensionHelper = exports.generateRouteTarget = exports.generateRoutePattern = exports.PATTERN_SUFFIX = void 0;
4
4
  const mem_fs_1 = require("mem-fs");
5
5
  const mem_fs_editor_1 = require("mem-fs-editor");
6
- const path_1 = require("path");
7
6
  const ejs_1 = require("ejs");
8
7
  const validate_1 = require("../common/validate");
9
8
  const types_1 = require("./types");
@@ -11,6 +10,7 @@ const defaults_1 = require("../common/defaults");
11
10
  const file_1 = require("../common/file");
12
11
  const templates_1 = require("../templates");
13
12
  const semver_1 = require("semver");
13
+ const utils_1 = require("../common/utils");
14
14
  /**
15
15
  * Suffix for patterns to support arbitrary paramters
16
16
  */
@@ -174,12 +174,12 @@ exports.initializeTargetSettings = initializeTargetSettings;
174
174
  * @param dependencies - expected dependencies
175
175
  * @returns the updated memfs editor instance
176
176
  */
177
- function validatePageConfig(basePath, config, fs, dependencies = []) {
177
+ async function validatePageConfig(basePath, config, fs, dependencies = []) {
178
178
  // common validators
179
179
  (0, validate_1.validateBasePath)(basePath, fs, dependencies);
180
180
  // validate config against the manifest
181
181
  if (config.navigation?.sourcePage) {
182
- const manifest = fs.readJSON((0, path_1.join)(basePath, 'webapp/manifest.json'));
182
+ const { content: manifest } = await (0, utils_1.getManifest)(basePath, fs);
183
183
  if (!manifest['sap.ui5']?.routing?.targets?.[config.navigation.sourcePage]) {
184
184
  throw new Error(`Could not find navigation source ${config.navigation.sourcePage}!`);
185
185
  }
@@ -211,13 +211,12 @@ exports.validatePageConfig = validatePageConfig;
211
211
  * @param fs - the memfs editor instance
212
212
  * @returns the updated memfs editor instance
213
213
  */
214
- function extendPageJSON(basePath, data, enhanceDataFn, templatePath, fs) {
214
+ async function extendPageJSON(basePath, data, enhanceDataFn, templatePath, fs) {
215
215
  if (!fs) {
216
216
  fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
217
217
  }
218
- validatePageConfig(basePath, data, fs);
219
- const manifestPath = (0, path_1.join)(basePath, 'webapp/manifest.json');
220
- const manifest = fs.readJSON(manifestPath);
218
+ await validatePageConfig(basePath, data, fs);
219
+ const { path: manifestPath, content: manifest } = await (0, utils_1.getManifest)(basePath, fs);
221
220
  const config = enhanceDataFn(data, manifest);
222
221
  // enhance manifest.json
223
222
  (0, file_1.extendJSON)(fs, {
@@ -24,5 +24,5 @@ export declare function getTemplateRoot(ui5Version?: string): string;
24
24
  * @param {Editor} [fs] - the memfs editor instance
25
25
  * @returns {Promise<Editor>} the updated memfs editor instance
26
26
  */
27
- export declare function generate(basePath: string, data: CustomPage, fs?: Editor): Editor;
27
+ export declare function generate(basePath: string, data: CustomPage, fs?: Editor): Promise<Editor>;
28
28
  //# sourceMappingURL=custom.d.ts.map
@@ -64,13 +64,13 @@ exports.getTemplateRoot = getTemplateRoot;
64
64
  * @param {Editor} [fs] - the memfs editor instance
65
65
  * @returns {Promise<Editor>} the updated memfs editor instance
66
66
  */
67
- function generate(basePath, data, fs) {
67
+ async function generate(basePath, data, fs) {
68
68
  if (!fs) {
69
69
  fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
70
70
  }
71
71
  (0, validate_1.validateVersion)(data.minUI5Version);
72
- (0, common_1.validatePageConfig)(basePath, data, fs, []);
73
- const manifestPath = (0, path_1.join)(basePath, 'webapp/manifest.json');
72
+ await (0, common_1.validatePageConfig)(basePath, data, fs, []);
73
+ const manifestPath = await (0, utils_1.getManifestPath)(basePath, fs);
74
74
  const config = enhanceData(data, manifestPath, fs);
75
75
  // merge content into existing files
76
76
  const root = getTemplateRoot(data.minUI5Version);
@@ -8,5 +8,5 @@ import type { ListReport } from './types';
8
8
  * @param fs - the memfs editor instance
9
9
  * @returns the updated memfs editor instance
10
10
  */
11
- export declare function generate(basePath: string, data: ListReport, fs?: Editor): Editor;
11
+ export declare function generate(basePath: string, data: ListReport, fs?: Editor): Promise<Editor>;
12
12
  //# sourceMappingURL=list.d.ts.map
package/dist/page/list.js CHANGED
@@ -41,7 +41,7 @@ function enhanceData(data, manifest) {
41
41
  * @param fs - the memfs editor instance
42
42
  * @returns the updated memfs editor instance
43
43
  */
44
- function generate(basePath, data, fs) {
44
+ async function generate(basePath, data, fs) {
45
45
  return (0, common_1.extendPageJSON)(basePath, data, enhanceData, 'page/list/manifest.json', fs);
46
46
  }
47
47
  exports.generate = generate;
@@ -8,5 +8,5 @@ import type { ObjectPage } from './types';
8
8
  * @param fs - the memfs editor instance
9
9
  * @returns the updated memfs editor instance
10
10
  */
11
- export declare function generate(basePath: string, data: ObjectPage, fs?: Editor): Editor;
11
+ export declare function generate(basePath: string, data: ObjectPage, fs?: Editor): Promise<Editor>;
12
12
  //# sourceMappingURL=object.d.ts.map
@@ -33,7 +33,7 @@ function enhanceData(data, manifest) {
33
33
  * @param fs - the memfs editor instance
34
34
  * @returns the updated memfs editor instance
35
35
  */
36
- function generate(basePath, data, fs) {
36
+ async function generate(basePath, data, fs) {
37
37
  return (0, common_1.extendPageJSON)(basePath, data, enhanceData, '/page/object/manifest.json', fs);
38
38
  }
39
39
  exports.generate = generate;
@@ -8,6 +8,12 @@
8
8
  "filterBar": "Filter Bar",
9
9
  "table": "Table"
10
10
  }
11
+ },
12
+ "manifestGroup": {
13
+ "manifestLibrariesTitle": "Manifest Libraries",
14
+ "manifestLibrariesDescription": [
15
+ "In order for macros to work, we need to ensure that the sap.fe.macros library is maintained in manifest.json. Please see the code snippet."
16
+ ]
11
17
  }
12
18
  },
13
19
  "common": {
@@ -44,6 +50,18 @@
44
50
  }
45
51
  },
46
52
  "chart": {
53
+ "chartBuildingBlockPropertiesTitle": "Chart Building Block Properties",
54
+ "chartBuildingBlockPropertiesDescription": [
55
+ "Select the `View or Fragment File` where you would like to insert the chart building block and provide a `Building Block ID` to identify the chart.",
56
+ "Select an `Entity Set`, and a `Chart Annotation` you would like to use for the chart building block.",
57
+ "Select an `Aggregation Path` to determine where you would like the chart to be placed on the page."
58
+ ],
59
+ "chartVisualizationPropertiesTitle": "Chart Visualization Properties",
60
+ "chartVisualizationPropertiesDescription": ["Configure your chart using the properties below."],
61
+ "chartConfigureEventsTitle": "Configure Events",
62
+ "chartConfigureEventsDescription": [
63
+ "Configure the below properties to react to events. Event handler methods are invoked when an event occurs."
64
+ ],
47
65
  "id": {
48
66
  "message": "Building Block ID",
49
67
  "validation": "An ID is required to generate the chart building block"
@@ -80,13 +98,23 @@
80
98
  "multiple": "Multiple"
81
99
  }
82
100
  },
83
- "selectionChange": "Selection Change Function",
84
- "selectionChangePlaceholder": "Enter a selecton change function",
85
- "qualifier": "Chart Qualifier",
86
- "qualifierPlaceholder": "Select chart qualifier",
87
- "valuesDependentOnEntityTypeInfo": "Values are dependent on entity type"
101
+ "selectionChange": "Selection Change Event",
102
+ "selectionChangePlaceholder": "Enter a function to be executed",
103
+ "qualifier": "Chart Annotation Path",
104
+ "qualifierPlaceholder": "Select a chart annotation path",
105
+ "valuesDependentOnEntityTypeInfo": "Values are dependent on entity set"
88
106
  },
89
107
  "filterBar": {
108
+ "filterBarBuildingBlockPropertiesTitle": "Filter Bar Building Block Properties",
109
+ "filterBarBuildingBlockPropertiesDescription": [
110
+ "Select the `View or Fragment File` where you would like to insert the filter bar building block and provide a `Building Block ID` to identify the filter bar.",
111
+ "Select an `Entity Set`, and a `Selection Field Annotation` you would like to use for the filter bar building block.",
112
+ "Select an `Aggregation Path` to determine where you would like the filter bar to be placed on the page."
113
+ ],
114
+ "filterBarConfigureEventsTitle": "Configure Events",
115
+ "filterBarConfigureEventsDescription": [
116
+ "Configure the below properties to react to events. Event handler methods are invoked when an event occurs."
117
+ ],
90
118
  "id": {
91
119
  "message": "Building Block ID",
92
120
  "validation": "An ID is required to generate the filter bar building block"
@@ -98,21 +126,23 @@
98
126
  "entity": "Entity",
99
127
  "service": "Service",
100
128
  "metaPath": "Enter the relative path of the property in the meta model",
101
- "filterChanged": "Filter Function",
102
- "search": "Search Function",
103
- "qualifier": "Selection Fields Qualifier",
104
- "qualifierPlaceholder": "Select selection fields qualifier",
129
+ "filterChanged": "Filter Changed Event",
130
+ "filterChangedPlaceholder": "Enter a function to be executed",
131
+ "search": "Search Event",
132
+ "searchPlaceholder": "Enter a function to be executed",
133
+ "qualifier": "Selection Field Annotation Path",
134
+ "qualifierPlaceholder": "Select a selection field annotation path",
105
135
  "aggregation": "Aggregation Path",
106
- "valuesDependentOnEntityTypeInfo": "Values are dependent on entity type",
136
+ "valuesDependentOnEntityTypeInfo": "Values are dependent on entity set",
107
137
  "bindingContextType": "Binding Context Path Type"
108
138
  },
109
139
  "table": {
110
140
  "tableBuildingBlockPropertiesTitle": "Table Building Block Properties",
111
141
  "tableBuildingBlockPropertiesDescription": [
112
142
  "Select the `View or Fragment File` where you would like to insert the table building block and provide a `Building Block ID` to identify the table.",
113
- "Select an `Entity Type`, and a `Line Item Qualifier` you would like to use for the table building block.",
114
- "Select an `Aggregation Path` to determine where you would like the table to be placed on the page.",
115
- "If you would like to link the table to an existing filter bar, provide the `Associated Filter Bar ID`."
143
+ "Select an `Entity Set`, and a `Line Item Annotation` you would like to use for the table building block.",
144
+ "Select an `Aggregation Path` to determine where you would like the table to appear on the page.",
145
+ "Provide the Associated Filter Bar ID if you want to link the table to an existing filter bar."
116
146
  ],
117
147
  "tableVisualizationPropertiesTitle": "Table Visualization Properties",
118
148
  "tableVisualizationPropertiesDescription": ["Configure your table using the properties below."],
@@ -127,8 +157,8 @@
127
157
  "bindingContextType": "Binding Context Path Type",
128
158
  "entity": "Entity",
129
159
  "service": "Service",
130
- "qualifier": "Line Item Qualifier",
131
- "qualifierPlaceholder": "Select a line item qualifier",
160
+ "qualifier": "Line Item Annotation Path",
161
+ "qualifierPlaceholder": "Select a line item annotation path",
132
162
  "aggregation": "Aggregation Path",
133
163
  "filterBar": {
134
164
  "message": "Associated Filter Bar ID",
@@ -165,7 +195,7 @@
165
195
  "fullScreenMode": "Enable Full Screen Mode",
166
196
  "pasteFromClipboard": "Enable Paste From Clipboard",
167
197
  "tableSearchableToggle": "Table Searchable Toggle",
168
- "valuesDependentOnEntityTypeInfo": "Values are dependent on entity type"
198
+ "valuesDependentOnEntityTypeInfo": "Values are dependent on entity set"
169
199
  }
170
200
  }
171
201
  }
@@ -16,7 +16,7 @@ export declare function getManifestRoot(folderName: string, ui5Version?: string)
16
16
  * @param {Editor} [fs] - the mem-fs editor instance
17
17
  * @returns {Promise<Editor>} the updated mem-fs editor instance
18
18
  */
19
- export declare function generateCustomHeaderSection(basePath: string, customHeaderSection: CustomHeaderSection, fs?: Editor): Editor;
19
+ export declare function generateCustomHeaderSection(basePath: string, customHeaderSection: CustomHeaderSection, fs?: Editor): Promise<Editor>;
20
20
  /**
21
21
  * Add a custom section to an existing UI5 application.
22
22
  *
@@ -25,7 +25,7 @@ export declare function generateCustomHeaderSection(basePath: string, customHead
25
25
  * @param {Editor} [fs] - the mem-fs editor instance
26
26
  * @returns {Promise<Editor>} the updated mem-fs editor instance
27
27
  */
28
- export declare function generateCustomSection(basePath: string, customSection: CustomSection, fs?: Editor): Editor;
28
+ export declare function generateCustomSection(basePath: string, customSection: CustomSection, fs?: Editor): Promise<Editor>;
29
29
  /**
30
30
  * Add a custom sub section to an existing UI5 application.
31
31
  *
@@ -34,5 +34,5 @@ export declare function generateCustomSection(basePath: string, customSection: C
34
34
  * @param {Editor} [fs] - the mem-fs editor instance
35
35
  * @returns {Promise<Editor>} the updated mem-fs editor instance
36
36
  */
37
- export declare function generateCustomSubSection(basePath: string, customSubSection: CustomSubSection, fs?: Editor): Editor;
37
+ export declare function generateCustomSubSection(basePath: string, customSubSection: CustomSubSection, fs?: Editor): Promise<Editor>;
38
38
  //# sourceMappingURL=index.d.ts.map
@@ -11,6 +11,7 @@ const event_handler_1 = require("../common/event-handler");
11
11
  const file_1 = require("../common/file");
12
12
  const templates_1 = require("../templates");
13
13
  const semver_1 = require("semver");
14
+ const utils_1 = require("../common/utils");
14
15
  /**
15
16
  * Get the template folder for the given UI5 version.
16
17
  *
@@ -77,14 +78,13 @@ function enhanceConfig(fs, data, manifestPath, manifest) {
77
78
  * @param {Editor} [fs] - the mem-fs editor instance
78
79
  * @returns {Promise<Editor>} the updated mem-fs editor instance
79
80
  */
80
- function generate(basePath, customSection, manifestTemplateRoot, fs) {
81
+ async function generate(basePath, customSection, manifestTemplateRoot, fs) {
81
82
  (0, validate_1.validateVersion)(customSection.minUI5Version);
82
83
  if (!fs) {
83
84
  fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
84
85
  }
85
86
  (0, validate_1.validateBasePath)(basePath, fs);
86
- const manifestPath = (0, path_1.join)(basePath, 'webapp/manifest.json');
87
- const manifest = fs.readJSON(manifestPath);
87
+ const { path: manifestPath, content: manifest } = await (0, utils_1.getManifest)(basePath, fs);
88
88
  // merge with defaults
89
89
  const completeSection = enhanceConfig(fs, customSection, manifestPath, manifest);
90
90
  // enhance manifest with section definition
@@ -109,7 +109,7 @@ function generate(basePath, customSection, manifestTemplateRoot, fs) {
109
109
  * @param {Editor} [fs] - the mem-fs editor instance
110
110
  * @returns {Promise<Editor>} the updated mem-fs editor instance
111
111
  */
112
- function generateCustomHeaderSection(basePath, customHeaderSection, fs) {
112
+ async function generateCustomHeaderSection(basePath, customHeaderSection, fs) {
113
113
  if (!fs) {
114
114
  fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
115
115
  }
@@ -119,13 +119,12 @@ function generateCustomHeaderSection(basePath, customHeaderSection, fs) {
119
119
  // Prepare 'templateEdit' - apply namespace and folder path resolution
120
120
  if (customHeaderSection.edit && (!minVersion || (0, semver_1.gte)(minVersion, '1.86.0'))) {
121
121
  editSection = customHeaderSection.edit;
122
- const manifestPath = (0, path_1.join)(basePath, 'webapp/manifest.json');
123
- const manifest = fs.readJSON(manifestPath);
122
+ const { path: manifestPath, content: manifest } = await (0, utils_1.getManifest)(basePath, fs);
124
123
  // Set folder, ns and path for edit fragment
125
124
  (0, defaults_1.setCommonDefaults)(editSection, manifestPath, manifest);
126
125
  }
127
126
  // Call standard custom section generation
128
- const { editor, section } = generate(basePath, customHeaderSection, manifestRoot, fs);
127
+ const { editor, section } = await generate(basePath, customHeaderSection, manifestRoot, fs);
129
128
  // Handle 'templateEdit' - edit fragment details
130
129
  if (editSection) {
131
130
  // Apply event handler for edit fragment
@@ -161,9 +160,9 @@ exports.generateCustomHeaderSection = generateCustomHeaderSection;
161
160
  * @param {Editor} [fs] - the mem-fs editor instance
162
161
  * @returns {Promise<Editor>} the updated mem-fs editor instance
163
162
  */
164
- function generateCustomSection(basePath, customSection, fs) {
163
+ async function generateCustomSection(basePath, customSection, fs) {
165
164
  const manifestRoot = getManifestRoot('section', customSection.minUI5Version);
166
- return generate(basePath, customSection, manifestRoot, fs).editor;
165
+ return (await generate(basePath, customSection, manifestRoot, fs)).editor;
167
166
  }
168
167
  exports.generateCustomSection = generateCustomSection;
169
168
  /**
@@ -174,9 +173,9 @@ exports.generateCustomSection = generateCustomSection;
174
173
  * @param {Editor} [fs] - the mem-fs editor instance
175
174
  * @returns {Promise<Editor>} the updated mem-fs editor instance
176
175
  */
177
- function generateCustomSubSection(basePath, customSubSection, fs) {
176
+ async function generateCustomSubSection(basePath, customSubSection, fs) {
178
177
  const manifestRoot = getManifestRoot('subsection', customSubSection.minUI5Version);
179
- return generate(basePath, customSubSection, manifestRoot, fs).editor;
178
+ return (await generate(basePath, customSubSection, manifestRoot, fs)).editor;
180
179
  }
181
180
  exports.generateCustomSubSection = generateCustomSubSection;
182
181
  //# sourceMappingURL=index.js.map
@@ -8,5 +8,5 @@ import type { CustomView } from './types';
8
8
  * @param {Editor} [fs] - the mem-fs editor instance
9
9
  * @returns {Promise<Editor>} the updated mem-fs editor instance
10
10
  */
11
- export declare function generateCustomView(basePath: string, customView: CustomView, fs?: Editor): Editor;
11
+ export declare function generateCustomView(basePath: string, customView: CustomView, fs?: Editor): Promise<Editor>;
12
12
  //# sourceMappingURL=index.d.ts.map
@@ -10,6 +10,7 @@ const defaults_1 = require("../common/defaults");
10
10
  const event_handler_1 = require("../common/event-handler");
11
11
  const file_1 = require("../common/file");
12
12
  const templates_1 = require("../templates");
13
+ const utils_1 = require("../common/utils");
13
14
  /**
14
15
  * Merge the new view into the list of existing views (if any).
15
16
  *
@@ -79,14 +80,13 @@ function enhanceConfig(fs, data, manifestPath, manifest) {
79
80
  * @param {Editor} [fs] - the mem-fs editor instance
80
81
  * @returns {Promise<Editor>} the updated mem-fs editor instance
81
82
  */
82
- function generateCustomView(basePath, customView, fs) {
83
+ async function generateCustomView(basePath, customView, fs) {
83
84
  (0, validate_1.validateVersion)(customView.minUI5Version);
84
85
  if (!fs) {
85
86
  fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
86
87
  }
87
88
  (0, validate_1.validateBasePath)(basePath, fs);
88
- const manifestPath = (0, path_1.join)(basePath, 'webapp/manifest.json');
89
- const manifest = fs.readJSON(manifestPath);
89
+ const { path: manifestPath, content: manifest } = await (0, utils_1.getManifest)(basePath, fs);
90
90
  // merge with defaults
91
91
  const completeView = enhanceConfig(fs, customView, manifestPath, manifest);
92
92
  // enhance manifest with view definition
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sap-ux/fe-fpm-writer",
3
3
  "description": "SAP Fiori elements flexible programming model writer",
4
- "version": "0.29.6",
4
+ "version": "0.31.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",