@sap-ux/fe-fpm-writer 1.4.0 → 1.5.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.
- package/dist/building-block/types.d.ts +2 -0
- package/dist/building-block/types.js +2 -0
- package/dist/index.d.ts +6 -5
- package/dist/index.js +4 -3
- package/dist/page/common.d.ts +18 -0
- package/dist/page/common.js +53 -4
- package/dist/page/custom.js +11 -3
- package/dist/page/index.d.ts +6 -6
- package/dist/page/index.js +5 -5
- package/dist/page/object.js +9 -1
- package/dist/page/outboundNavigation.d.ts +21 -0
- package/dist/page/outboundNavigation.js +70 -0
- package/dist/page/types.d.ts +47 -1
- package/package.json +2 -2
- package/templates/outboundNavigation/manifest.json +33 -0
- package/templates/page/custom/1.84/manifest.json +2 -2
- package/templates/page/custom/1.94/manifest.json +2 -2
- package/templates/page/object/manifest.json +2 -2
|
@@ -10,6 +10,8 @@ export type PageTemplateType = (typeof PageTemplateType)[keyof typeof PageTempla
|
|
|
10
10
|
export declare const MIN_UI5_VERSION_PAGE_BUILDING_BLOCK: "1.136.0";
|
|
11
11
|
/** Minimum UI5 version required for full layout page building blocks. */
|
|
12
12
|
export declare const MIN_UI5_VERSION_PAGE_BUILDING_BLOCK_FULL_LAYOUT: "1.145.0";
|
|
13
|
+
/** Minimum UI5 version required for RichTextEditor and RichTextEditorButtonGroups building blocks. */
|
|
14
|
+
export declare const MIN_UI5_VERSION_RICH_TEXT_EDITOR: "1.117.0";
|
|
13
15
|
/**
|
|
14
16
|
* Building block type.
|
|
15
17
|
*
|
|
@@ -6,6 +6,8 @@ export const PageTemplateType = {
|
|
|
6
6
|
export const MIN_UI5_VERSION_PAGE_BUILDING_BLOCK = '1.136.0';
|
|
7
7
|
/** Minimum UI5 version required for full layout page building blocks. */
|
|
8
8
|
export const MIN_UI5_VERSION_PAGE_BUILDING_BLOCK_FULL_LAYOUT = '1.145.0';
|
|
9
|
+
/** Minimum UI5 version required for RichTextEditor and RichTextEditorButtonGroups building blocks. */
|
|
10
|
+
export const MIN_UI5_VERSION_RICH_TEXT_EDITOR = '1.117.0';
|
|
9
11
|
/**
|
|
10
12
|
* Building block type.
|
|
11
13
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export type { CustomPage, ObjectPage, ListReport } from './page/types.js';
|
|
2
|
-
export { generateCustomPage, generateObjectPage, generateListReport } from './page/index.js';
|
|
1
|
+
export type { CustomPage, ObjectPage, ListReport, OutboundNavigation } from './page/types.js';
|
|
2
|
+
export { generateCustomPage, generateObjectPage, generateListReport, generateOutboundNavigation, deleteOutboundNavigation } from './page/index.js';
|
|
3
3
|
export type { CustomAction } from './action/types.js';
|
|
4
4
|
export { TargetControl } from './action/types.js';
|
|
5
5
|
export { generateCustomAction } from './action/index.js';
|
|
@@ -20,9 +20,10 @@ export { generateCustomView } from './view/index.js';
|
|
|
20
20
|
export { enableFPM } from './app/index.js';
|
|
21
21
|
export type { FPMConfig } from './app/index.js';
|
|
22
22
|
export { validateBasePath, validateVersion } from './common/validate.js';
|
|
23
|
-
export { createIdGenerator, type IdGeneratorFunction, getRelativeTemplateComponentPath } from './common/file.js';
|
|
24
|
-
export {
|
|
25
|
-
export
|
|
23
|
+
export { createIdGenerator, type IdGeneratorFunction, getRelativeTemplateComponentPath, getFragmentAndViewFiles } from './common/file.js';
|
|
24
|
+
export { getXPathStringsForXmlFile } from './building-block/prompts/utils/xml.js';
|
|
25
|
+
export { BuildingBlockType, PageTemplateType, PAGE_AGGREGATIONS, MIN_UI5_VERSION_PAGE_BUILDING_BLOCK, MIN_UI5_VERSION_PAGE_BUILDING_BLOCK_FULL_LAYOUT, MIN_UI5_VERSION_RICH_TEXT_EDITOR } from './building-block/types.js';
|
|
26
|
+
export type { BuildingBlock, FilterBar, Form, Chart, Field, FieldFormatOptions, Table, BuildingBlockConfig, Page, CustomColumn, CustomFilterField, CustomFormField, RichTextEditor, ButtonGroupConfig, Action } from './building-block/types.js';
|
|
26
27
|
export type { PageAggregationName, GenerateBuildingBlockAggregationConfig } from './building-block/types.js';
|
|
27
28
|
export { generateBuildingBlock, getSerializedFileContent, generateBuildingBlockAggregation } from './building-block/index.js';
|
|
28
29
|
export type { ChartPromptsAnswer, FilterBarPromptsAnswer, FormPromptsAnswer, TablePromptsAnswer, PagePromptsAnswer, RichTextEditorPromptsAnswer, RichTextEditorButtonGroupsPromptsAnswer, BuildingBlockTypePromptsAnswer } from './building-block/prompts/questions/index.js';
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { generateCustomPage, generateObjectPage, generateListReport } from './page/index.js';
|
|
1
|
+
export { generateCustomPage, generateObjectPage, generateListReport, generateOutboundNavigation, deleteOutboundNavigation } from './page/index.js';
|
|
2
2
|
export { TargetControl } from './action/types.js';
|
|
3
3
|
export { generateCustomAction } from './action/index.js';
|
|
4
4
|
export { TargetControl as ActionMenuTargetControl } from './action-menu/types.js';
|
|
@@ -11,8 +11,9 @@ export { generateCustomFilter } from './filter/index.js';
|
|
|
11
11
|
export { generateCustomView } from './view/index.js';
|
|
12
12
|
export { enableFPM } from './app/index.js';
|
|
13
13
|
export { validateBasePath, validateVersion } from './common/validate.js';
|
|
14
|
-
export { createIdGenerator, getRelativeTemplateComponentPath } from './common/file.js';
|
|
15
|
-
export {
|
|
14
|
+
export { createIdGenerator, getRelativeTemplateComponentPath, getFragmentAndViewFiles } from './common/file.js';
|
|
15
|
+
export { getXPathStringsForXmlFile } from './building-block/prompts/utils/xml.js';
|
|
16
|
+
export { BuildingBlockType, PageTemplateType, PAGE_AGGREGATIONS, MIN_UI5_VERSION_PAGE_BUILDING_BLOCK, MIN_UI5_VERSION_PAGE_BUILDING_BLOCK_FULL_LAYOUT, MIN_UI5_VERSION_RICH_TEXT_EDITOR } from './building-block/types.js';
|
|
16
17
|
export { generateBuildingBlock, getSerializedFileContent, generateBuildingBlockAggregation } from './building-block/index.js';
|
|
17
18
|
export { PromptsType, PromptsAPI } from './prompts/index.js';
|
|
18
19
|
export { ControllerExtensionPageType } from './controller-extension/types.js';
|
package/dist/page/common.d.ts
CHANGED
|
@@ -71,6 +71,24 @@ export declare function initializeTargetSettings(data: FpmPage, addSettings?: Re
|
|
|
71
71
|
* @returns the updated memfs editor instance
|
|
72
72
|
*/
|
|
73
73
|
export declare function validatePageConfig(basePath: string, config: CustomPage | ObjectPage, fs: Editor, dependencies?: never[]): Promise<Editor>;
|
|
74
|
+
/**
|
|
75
|
+
* Removes "outbound" manifest entry for the given target and navigation entity.
|
|
76
|
+
*
|
|
77
|
+
* @param manifestPath - manifest path
|
|
78
|
+
* @param manifest - manifest content
|
|
79
|
+
* @param data - change data
|
|
80
|
+
* @param fs - fs editor instance
|
|
81
|
+
*/
|
|
82
|
+
export declare function deleteOutboundNavigationDetail(manifestPath: string, manifest: Manifest, data: ObjectPage, fs: Editor): void;
|
|
83
|
+
/**
|
|
84
|
+
* Validates necessary input data and removes existing target navigation (outbound) to substitude it with navigation to an existing page.
|
|
85
|
+
*
|
|
86
|
+
* @param manifestPath - manifest path
|
|
87
|
+
* @param manifest - manifest content
|
|
88
|
+
* @param data - change data
|
|
89
|
+
* @param fs - fs editor instance
|
|
90
|
+
*/
|
|
91
|
+
export declare function prepareToReuseExistingPage(manifestPath: string, manifest: Manifest, data: ObjectPage, fs: Editor): void;
|
|
74
92
|
/**
|
|
75
93
|
* Add an generic page to an existing UI5 application.
|
|
76
94
|
* Supported pages - ListReport or ObjectPage.
|
package/dist/page/common.js
CHANGED
|
@@ -4,7 +4,7 @@ import { render } from 'ejs';
|
|
|
4
4
|
import { validateBasePath, validateDependenciesLibs } from '../common/validate.js';
|
|
5
5
|
import { PageType } from './types.js';
|
|
6
6
|
import { FCL_ROUTER } from '../common/defaults.js';
|
|
7
|
-
import { extendJSON } from '../common/file.js';
|
|
7
|
+
import { extendJSON, getJsonSpace } from '../common/file.js';
|
|
8
8
|
import { getTemplatePath } from '../templates.js';
|
|
9
9
|
import { coerce, gte } from 'semver';
|
|
10
10
|
import { getManifest } from '../common/utils.js';
|
|
@@ -195,6 +195,55 @@ export async function validatePageConfig(basePath, config, fs, dependencies = []
|
|
|
195
195
|
}
|
|
196
196
|
return fs;
|
|
197
197
|
}
|
|
198
|
+
/**
|
|
199
|
+
* Removes "outbound" manifest entry for the given target and navigation entity.
|
|
200
|
+
*
|
|
201
|
+
* @param manifestPath - manifest path
|
|
202
|
+
* @param manifest - manifest content
|
|
203
|
+
* @param data - change data
|
|
204
|
+
* @param fs - fs editor instance
|
|
205
|
+
*/
|
|
206
|
+
export function deleteOutboundNavigationDetail(manifestPath, manifest, data, fs) {
|
|
207
|
+
const { sourcePage, navEntity } = data.navigation ?? {};
|
|
208
|
+
if (sourcePage && navEntity) {
|
|
209
|
+
const sourceTarget = manifest['sap.ui5']?.routing?.targets?.[sourcePage];
|
|
210
|
+
const detail = sourceTarget?.options?.settings?.navigation?.[navEntity]?.detail;
|
|
211
|
+
if (detail?.['outbound'] !== undefined) {
|
|
212
|
+
delete detail['outbound'];
|
|
213
|
+
fs.writeJSON(manifestPath, manifest, undefined, getJsonSpace(fs, manifestPath, data.tabInfo));
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Validates necessary input data and removes existing target navigation (outbound) to substitude it with navigation to an existing page.
|
|
219
|
+
*
|
|
220
|
+
* @param manifestPath - manifest path
|
|
221
|
+
* @param manifest - manifest content
|
|
222
|
+
* @param data - change data
|
|
223
|
+
* @param fs - fs editor instance
|
|
224
|
+
*/
|
|
225
|
+
export function prepareToReuseExistingPage(manifestPath, manifest, data, fs) {
|
|
226
|
+
if (!data.id) {
|
|
227
|
+
throw new Error(`Invalid data. Navigation target page name is missing!`);
|
|
228
|
+
}
|
|
229
|
+
let page = manifest['sap.ui5']?.routing?.targets?.[data.id];
|
|
230
|
+
if (!page) {
|
|
231
|
+
throw new Error(`Could not find existing target page ${data.id}!`);
|
|
232
|
+
}
|
|
233
|
+
page = manifest['sap.ui5']?.routing?.targets?.[data.navigation?.sourcePage ?? ''];
|
|
234
|
+
if (!page) {
|
|
235
|
+
throw new Error(`Could not find navigation source ${data.navigation?.sourcePage}!`);
|
|
236
|
+
}
|
|
237
|
+
const navigation = page.options?.settings?.navigation;
|
|
238
|
+
const navEntity = data.navigation?.navEntity;
|
|
239
|
+
if (!navEntity) {
|
|
240
|
+
throw new Error(`Invalid data. Navigation entity name is missing!`);
|
|
241
|
+
}
|
|
242
|
+
if (navigation?.[navEntity]) {
|
|
243
|
+
delete navigation[navEntity];
|
|
244
|
+
fs.writeJSON(manifestPath, manifest, undefined, getJsonSpace(fs, manifestPath, data.tabInfo));
|
|
245
|
+
}
|
|
246
|
+
}
|
|
198
247
|
/**
|
|
199
248
|
* Add an generic page to an existing UI5 application.
|
|
200
249
|
* Supported pages - ListReport or ObjectPage.
|
|
@@ -207,12 +256,12 @@ export async function validatePageConfig(basePath, config, fs, dependencies = []
|
|
|
207
256
|
* @returns the updated memfs editor instance
|
|
208
257
|
*/
|
|
209
258
|
export async function extendPageJSON(basePath, data, enhanceDataFn, templatePath, fs) {
|
|
210
|
-
|
|
211
|
-
fs = create(createStorage());
|
|
212
|
-
}
|
|
259
|
+
fs ??= create(createStorage());
|
|
213
260
|
await validatePageConfig(basePath, data, fs);
|
|
214
261
|
const { path: manifestPath, content: manifest } = await getManifest(basePath, fs);
|
|
215
262
|
const config = enhanceDataFn(data, manifest);
|
|
263
|
+
// clean up outbound detail in the navigation settings if outbound link is already defined
|
|
264
|
+
deleteOutboundNavigationDetail(manifestPath, manifest, data, fs);
|
|
216
265
|
// enhance manifest.json
|
|
217
266
|
extendJSON(fs, {
|
|
218
267
|
filepath: manifestPath,
|
package/dist/page/custom.js
CHANGED
|
@@ -3,12 +3,12 @@ import { create as createStorage } from 'mem-fs';
|
|
|
3
3
|
import { create } from 'mem-fs-editor';
|
|
4
4
|
import { render } from 'ejs';
|
|
5
5
|
import { PageType } from './types.js';
|
|
6
|
-
import { initializeTargetSettings, getFclConfig, getManifestJsonExtensionHelper, validatePageConfig, getLibraryDependencies } from './common.js';
|
|
6
|
+
import { initializeTargetSettings, getFclConfig, getManifestJsonExtensionHelper, validatePageConfig, getLibraryDependencies, deleteOutboundNavigationDetail, prepareToReuseExistingPage } from './common.js';
|
|
7
7
|
import { setCommonDefaults } from '../common/defaults.js';
|
|
8
8
|
import { validateVersion } from '../common/validate.js';
|
|
9
9
|
import { getTemplatePath } from '../templates.js';
|
|
10
10
|
import { coerce, gte, lt } from 'semver';
|
|
11
|
-
import { addExtensionTypes,
|
|
11
|
+
import { addExtensionTypes, getManifest } from '../common/utils.js';
|
|
12
12
|
import { copyTpl, extendJSON, createIdGenerator } from '../common/file.js';
|
|
13
13
|
import { generateBuildingBlock } from '../building-block/index.js';
|
|
14
14
|
import { BuildingBlockType, PageTemplateType, MIN_UI5_VERSION_PAGE_BUILDING_BLOCK, MIN_UI5_VERSION_PAGE_BUILDING_BLOCK_FULL_LAYOUT } from '../building-block/types.js';
|
|
@@ -127,9 +127,14 @@ export async function generate(basePath, data, fs, log) {
|
|
|
127
127
|
fs ??= create(createStorage());
|
|
128
128
|
validateVersion(data.minUI5Version);
|
|
129
129
|
await validatePageConfig(basePath, data, fs, []);
|
|
130
|
-
const manifestPath = await
|
|
130
|
+
const { path: manifestPath, content: manifest } = await getManifest(basePath, fs);
|
|
131
131
|
const fnGenerateId = await createIdGenerator({ basePath, fsEditor: fs });
|
|
132
132
|
const config = enhanceData(data, manifestPath, fs);
|
|
133
|
+
// clean up outbound detail in the navigation settings if outbound link is already defined
|
|
134
|
+
deleteOutboundNavigationDetail(manifestPath, manifest, data, fs);
|
|
135
|
+
if (data.reuseExisting) {
|
|
136
|
+
prepareToReuseExistingPage(manifestPath, manifest, data, fs);
|
|
137
|
+
}
|
|
133
138
|
// merge content into existing files
|
|
134
139
|
const root = getTemplateRoot(data.minUI5Version);
|
|
135
140
|
// enhance manifest.json
|
|
@@ -139,6 +144,9 @@ export async function generate(basePath, data, fs, log) {
|
|
|
139
144
|
replacer: getManifestJsonExtensionHelper(config),
|
|
140
145
|
tabInfo: data.tabInfo
|
|
141
146
|
});
|
|
147
|
+
if (data.reuseExisting) {
|
|
148
|
+
return fs;
|
|
149
|
+
}
|
|
142
150
|
// add extension content
|
|
143
151
|
const viewPath = join(config.path, `${config.name}.view.xml`);
|
|
144
152
|
if (!fs.exists(viewPath)) {
|
package/dist/page/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export {
|
|
1
|
+
export { type CustomPage, type ObjectPage, type ListReport, type Navigation } from './types.js';
|
|
2
|
+
export { validatePageConfig } from './common.js';
|
|
3
|
+
export { generate as generateCustomPage } from './custom.js';
|
|
4
|
+
export { generate as generateObjectPage } from './object.js';
|
|
5
|
+
export { generate as generateListReport } from './list.js';
|
|
6
|
+
export { generate as generateOutboundNavigation, deleteOutboundNavigation } from './outboundNavigation.js';
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/page/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export {
|
|
1
|
+
export { validatePageConfig } from './common.js';
|
|
2
|
+
export { generate as generateCustomPage } from './custom.js';
|
|
3
|
+
export { generate as generateObjectPage } from './object.js';
|
|
4
|
+
export { generate as generateListReport } from './list.js';
|
|
5
|
+
export { generate as generateOutboundNavigation, deleteOutboundNavigation } from './outboundNavigation.js';
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
package/dist/page/object.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { create as createStorage } from 'mem-fs';
|
|
2
|
+
import { create } from 'mem-fs-editor';
|
|
3
|
+
import { getFclConfig, extendPageJSON, initializeTargetSettings, getLibraryDependencies, getTemplateNamePrefix, prepareToReuseExistingPage } from './common.js';
|
|
2
4
|
import { PageType } from './types.js';
|
|
5
|
+
import { getManifest } from '../common/utils.js';
|
|
3
6
|
/**
|
|
4
7
|
* Enhances the provided list report configuration with default data.
|
|
5
8
|
*
|
|
@@ -35,6 +38,11 @@ function enhanceData(data, manifest) {
|
|
|
35
38
|
* @returns the updated memfs editor instance
|
|
36
39
|
*/
|
|
37
40
|
export async function generate(basePath, data, fs) {
|
|
41
|
+
if (data.reuseExisting) {
|
|
42
|
+
fs ??= create(createStorage());
|
|
43
|
+
const { path: manifestPath, content: manifest } = await getManifest(basePath, fs);
|
|
44
|
+
prepareToReuseExistingPage(manifestPath, manifest, data, fs);
|
|
45
|
+
}
|
|
38
46
|
return extendPageJSON(basePath, data, enhanceData, '/page/object/manifest.json', fs);
|
|
39
47
|
}
|
|
40
48
|
//# sourceMappingURL=object.js.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Editor } from 'mem-fs-editor';
|
|
2
|
+
import type { OutboundNavigation } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Add an Outbound Navigation Link to a page of a UI5 application.
|
|
5
|
+
*
|
|
6
|
+
* @param basePath - the base path
|
|
7
|
+
* @param data - the object page configuration
|
|
8
|
+
* @param fs - the memfs editor instance
|
|
9
|
+
* @returns the updated memfs editor instance
|
|
10
|
+
*/
|
|
11
|
+
export declare function generate(basePath: string, data: OutboundNavigation, fs?: Editor): Promise<Editor>;
|
|
12
|
+
/**
|
|
13
|
+
* Delete an Outbound Navigation Link.
|
|
14
|
+
*
|
|
15
|
+
* @param basePath - the base path
|
|
16
|
+
* @param data - the object page configuration
|
|
17
|
+
* @param fs - the memfs editor instance
|
|
18
|
+
* @returns the updated memfs editor instance
|
|
19
|
+
*/
|
|
20
|
+
export declare function deleteOutboundNavigation(basePath: string, data: OutboundNavigation, fs?: Editor): Promise<Editor>;
|
|
21
|
+
//# sourceMappingURL=outboundNavigation.d.ts.map
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { create as createStorage } from 'mem-fs';
|
|
2
|
+
import { create } from 'mem-fs-editor';
|
|
3
|
+
import { getManifest } from '../common/utils.js';
|
|
4
|
+
import { extendJSON, getJsonSpace } from '../common/file.js';
|
|
5
|
+
import { render } from 'ejs';
|
|
6
|
+
import { getTemplatePath } from '../templates.js';
|
|
7
|
+
/**
|
|
8
|
+
* Add an Outbound Navigation Link to a page of a UI5 application.
|
|
9
|
+
*
|
|
10
|
+
* @param basePath - the base path
|
|
11
|
+
* @param data - the object page configuration
|
|
12
|
+
* @param fs - the memfs editor instance
|
|
13
|
+
* @returns the updated memfs editor instance
|
|
14
|
+
*/
|
|
15
|
+
export async function generate(basePath, data, fs) {
|
|
16
|
+
if (!data.navigation?.sourcePage) {
|
|
17
|
+
throw new Error(`Invalid data. Navigation source page name is missing!`);
|
|
18
|
+
}
|
|
19
|
+
fs ??= create(createStorage());
|
|
20
|
+
const { path: manifestPath, content: manifest } = await getManifest(basePath, fs);
|
|
21
|
+
const page = manifest['sap.ui5']?.routing?.targets?.[data.navigation.sourcePage];
|
|
22
|
+
if (!page) {
|
|
23
|
+
throw new Error(`Could not find navigation source ${data.navigation.sourcePage}!`);
|
|
24
|
+
}
|
|
25
|
+
if (data.settings.crossNavigation && manifest['sap.app'].crossNavigation?.outbounds?.[data.settings.outboundKey]) {
|
|
26
|
+
throw new Error(`The outbound with the key ${data.settings.outboundKey} already exists!`);
|
|
27
|
+
}
|
|
28
|
+
const navigation = page.options?.settings?.navigation;
|
|
29
|
+
// if navigation already exists, delete it
|
|
30
|
+
if (navigation?.[data.entity]) {
|
|
31
|
+
delete navigation[data.entity];
|
|
32
|
+
fs.writeJSON(manifestPath, manifest, undefined, getJsonSpace(fs, manifestPath, data.tabInfo));
|
|
33
|
+
}
|
|
34
|
+
extendJSON(fs, {
|
|
35
|
+
filepath: manifestPath,
|
|
36
|
+
content: render(fs.read(getTemplatePath('outboundNavigation/manifest.json')), data, {}),
|
|
37
|
+
replacer: undefined,
|
|
38
|
+
tabInfo: data.tabInfo
|
|
39
|
+
});
|
|
40
|
+
return fs;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Delete an Outbound Navigation Link.
|
|
44
|
+
*
|
|
45
|
+
* @param basePath - the base path
|
|
46
|
+
* @param data - the object page configuration
|
|
47
|
+
* @param fs - the memfs editor instance
|
|
48
|
+
* @returns the updated memfs editor instance
|
|
49
|
+
*/
|
|
50
|
+
export async function deleteOutboundNavigation(basePath, data, fs) {
|
|
51
|
+
fs ??= create(createStorage());
|
|
52
|
+
const { path: manifestPath, content: manifest } = await getManifest(basePath, fs);
|
|
53
|
+
if (data.navigation?.sourcePage) {
|
|
54
|
+
const page = manifest['sap.ui5']?.routing?.targets?.[data.navigation.sourcePage];
|
|
55
|
+
if (!page) {
|
|
56
|
+
throw new Error(`Could not find navigation source ${data.navigation.sourcePage}!`);
|
|
57
|
+
}
|
|
58
|
+
const navigation = page.options?.settings?.navigation;
|
|
59
|
+
if (navigation?.[data.entity]) {
|
|
60
|
+
delete navigation[data.entity];
|
|
61
|
+
fs.writeJSON(manifestPath, manifest, undefined, getJsonSpace(fs, manifestPath, data.tabInfo));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (data.settings.outboundKey && manifest['sap.app'].crossNavigation?.outbounds?.[data.settings.outboundKey]) {
|
|
65
|
+
delete manifest['sap.app'].crossNavigation.outbounds[data.settings.outboundKey];
|
|
66
|
+
fs.writeJSON(manifestPath, manifest, undefined, getJsonSpace(fs, manifestPath, data.tabInfo));
|
|
67
|
+
}
|
|
68
|
+
return fs;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=outboundNavigation.js.map
|
package/dist/page/types.d.ts
CHANGED
|
@@ -70,11 +70,15 @@ export interface FpmPage {
|
|
|
70
70
|
* UI5 Libraries that should be added to the application.
|
|
71
71
|
*/
|
|
72
72
|
libraries?: Libraries;
|
|
73
|
+
/**
|
|
74
|
+
* If set to true then instead of creation of a new page the existing page with the provided id is relinked to the parent one
|
|
75
|
+
*/
|
|
76
|
+
reuseExisting?: boolean;
|
|
73
77
|
}
|
|
74
78
|
/**
|
|
75
79
|
* Configuration options for adding a list report page.
|
|
76
80
|
*/
|
|
77
|
-
export interface ListReport extends FpmPage, WriterConfig {
|
|
81
|
+
export interface ListReport extends Omit<FpmPage, 'reuseExisting'>, WriterConfig {
|
|
78
82
|
/**
|
|
79
83
|
* Optional settings for the ListReport page
|
|
80
84
|
*/
|
|
@@ -150,6 +154,38 @@ export declare enum PageType {
|
|
|
150
154
|
ObjectPage = "ObjectPage",
|
|
151
155
|
CustomPage = "CustomPage"
|
|
152
156
|
}
|
|
157
|
+
interface OutboundNavigationSettings {
|
|
158
|
+
/**
|
|
159
|
+
* Specifies outbound unique key or alias to describe intents that can be triggered from the application to navigate
|
|
160
|
+
*/
|
|
161
|
+
outboundKey: string;
|
|
162
|
+
/**
|
|
163
|
+
* Intent details
|
|
164
|
+
*/
|
|
165
|
+
crossNavigation?: {
|
|
166
|
+
/**
|
|
167
|
+
* Represents a business entity (such as 'Employee')
|
|
168
|
+
*/
|
|
169
|
+
semanticObject: string;
|
|
170
|
+
/**
|
|
171
|
+
* Represents the action to perform on the business entity (such as 'display')
|
|
172
|
+
*/
|
|
173
|
+
action: string;
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Configuration options for adding/replacing an outbound navigation of a page.
|
|
178
|
+
*/
|
|
179
|
+
export interface OutboundNavigation extends FpmPage, WriterConfig {
|
|
180
|
+
/**
|
|
181
|
+
* Provides app outbound configuration information
|
|
182
|
+
*/
|
|
183
|
+
settings: OutboundNavigationSettings;
|
|
184
|
+
/**
|
|
185
|
+
* Optional incoming navigation configuration. sourcePage and navEntity are used to create or delete outbound navigation links for pages.
|
|
186
|
+
*/
|
|
187
|
+
navigation?: Navigation;
|
|
188
|
+
}
|
|
153
189
|
/**
|
|
154
190
|
* Additional internal configuration options that will be calculated based on the provided input as well as the target application.
|
|
155
191
|
*/
|
|
@@ -161,4 +197,14 @@ export type InternalListReport = ListReport & InternalFpmPage & {
|
|
|
161
197
|
export type InternalObjectPage = ObjectPage & InternalFpmPage & {
|
|
162
198
|
name: PageType.ObjectPage;
|
|
163
199
|
};
|
|
200
|
+
export type TargetOptionsAddition = {
|
|
201
|
+
options?: {
|
|
202
|
+
settings?: {
|
|
203
|
+
navigation?: {
|
|
204
|
+
[key: string]: unknown;
|
|
205
|
+
};
|
|
206
|
+
};
|
|
207
|
+
};
|
|
208
|
+
};
|
|
209
|
+
export {};
|
|
164
210
|
//# sourceMappingURL=types.d.ts.map
|
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": "1.
|
|
4
|
+
"version": "1.5.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@types/mem-fs-editor": "7.0.1",
|
|
45
45
|
"@types/semver": "7.8.0",
|
|
46
46
|
"@types/vinyl": "2.0.12",
|
|
47
|
-
"@sap-ux/ui-prompting": "1.0.
|
|
47
|
+
"@sap-ux/ui-prompting": "1.0.26"
|
|
48
48
|
},
|
|
49
49
|
"engines": {
|
|
50
50
|
"node": ">=22.x"
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
<% if (settings.crossNavigation) { %>
|
|
3
|
+
"sap.app": {
|
|
4
|
+
"crossNavigation": {
|
|
5
|
+
"outbounds": {
|
|
6
|
+
"<%- settings.outboundKey %>": {
|
|
7
|
+
"semanticObject": "<%- settings.crossNavigation.semanticObject %>",
|
|
8
|
+
"action": "<%- settings.crossNavigation.action %>"
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
<% } %>
|
|
14
|
+
"sap.ui5": {
|
|
15
|
+
"routing": {
|
|
16
|
+
"targets": {
|
|
17
|
+
"<%- navigation.sourcePage %>": {
|
|
18
|
+
"options": {
|
|
19
|
+
"settings": {
|
|
20
|
+
"navigation": {
|
|
21
|
+
"<%- entity %>": {
|
|
22
|
+
"detail": {
|
|
23
|
+
"outbound": "<%- settings.outboundKey%>"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
},
|
|
6
6
|
"routing": {
|
|
7
7
|
"targets": {
|
|
8
|
-
"<% if (typeof id !== 'undefined') { %><%- id %><% } else { %><%- entity %><%- name %><% } %>": {
|
|
8
|
+
<%if (!locals.reuseExisting) {%>"<% if (typeof id !== 'undefined') { %><%- id %><% } else { %><%- entity %><%- name %><% } %>": {
|
|
9
9
|
"viewId": "<%- name %>View",
|
|
10
10
|
"viewName": "<%- ns %>.<%- name %>",<%if (locals.controlAggregation) {%>
|
|
11
11
|
"controlAggregation": "<%- locals.controlAggregation %>",<% } %>
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"settings": <%- JSON.stringify(settings) %>
|
|
14
14
|
}
|
|
15
15
|
}<%if (locals.navigation) {%>,
|
|
16
|
-
"<%- navigation.sourcePage %>": {
|
|
16
|
+
<% } %><% } %><%if (locals.navigation) {%>"<%- navigation.sourcePage %>": {
|
|
17
17
|
"options": {
|
|
18
18
|
"settings": {
|
|
19
19
|
"navigation": {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
},
|
|
6
6
|
"routing": {
|
|
7
7
|
"targets": {
|
|
8
|
-
"<% if (typeof id !== 'undefined') { %><%- id %><% } else { %><%- entity %><%- name %><% } %>": {
|
|
8
|
+
<%if (!locals.reuseExisting) {%>"<% if (typeof id !== 'undefined') { %><%- id %><% } else { %><%- entity %><%- name %><% } %>": {
|
|
9
9
|
"type": "Component",
|
|
10
10
|
"id": "<% if (typeof id !== 'undefined') { %><%- id %><% } else { %><%- entity %><%- name %><% } %>",
|
|
11
11
|
"name": "<%- template %>",<%if (locals.controlAggregation) {%>
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"settings": <%- JSON.stringify({ ...settings, viewName: `${ns}.${name}`}) %>
|
|
15
15
|
}
|
|
16
16
|
}<%if (locals.navigation) {%>,
|
|
17
|
-
"<%- navigation.sourcePage %>": {
|
|
17
|
+
<% } %><% } %><%if (locals.navigation) {%>"<%- navigation.sourcePage %>": {
|
|
18
18
|
"options": {
|
|
19
19
|
"settings": {
|
|
20
20
|
"navigation": {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
},
|
|
6
6
|
"routing": {
|
|
7
7
|
"targets": {
|
|
8
|
-
"<% if (typeof id !== 'undefined') { %><%- id %><% } else { %><%- entity %>ObjectPage<% } %>": {
|
|
8
|
+
<%if (!locals.reuseExisting) {%>"<% if (typeof id !== 'undefined') { %><%- id %><% } else { %><%- entity %>ObjectPage<% } %>": {
|
|
9
9
|
"type": "Component",
|
|
10
10
|
"id": "<% if (typeof id !== 'undefined') { %><%- id %><% } else { %><%- entity %>ObjectPage<% } %>",
|
|
11
11
|
"name": "<%- template %>",<%if (locals.controlAggregation) {%>
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"settings": <%- JSON.stringify(settings) %>
|
|
15
15
|
}
|
|
16
16
|
}<%if (locals.navigation) {%>,
|
|
17
|
-
"<%- navigation.sourcePage %>": {
|
|
17
|
+
<% } %><% } %><%if (locals.navigation) {%>"<%- navigation.sourcePage %>": {
|
|
18
18
|
"options": {
|
|
19
19
|
"settings": {
|
|
20
20
|
"navigation": {
|