@sap-ux/fe-fpm-writer 0.37.3 → 0.38.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.
|
@@ -4,6 +4,7 @@ exports.getPageBuildingBlockPrompts = getPageBuildingBlockPrompts;
|
|
|
4
4
|
const i18n_1 = require("../../../i18n");
|
|
5
5
|
const utils_1 = require("../utils");
|
|
6
6
|
const types_1 = require("../../types");
|
|
7
|
+
const i18n_2 = require("@sap-ux/i18n");
|
|
7
8
|
/**
|
|
8
9
|
* Returns a list of prompts required to generate a page building block.
|
|
9
10
|
*
|
|
@@ -39,13 +40,23 @@ async function getPageBuildingBlockPrompts(context) {
|
|
|
39
40
|
name: 'buildingBlockData.title',
|
|
40
41
|
message: t('title.message'),
|
|
41
42
|
guiOptions: {
|
|
42
|
-
mandatory: true
|
|
43
|
+
mandatory: true,
|
|
44
|
+
translationProperties: {
|
|
45
|
+
type: i18n_2.SapShortTextType.Heading,
|
|
46
|
+
annotation: t('title.translationAnnotation')
|
|
47
|
+
}
|
|
43
48
|
}
|
|
44
49
|
},
|
|
45
50
|
{
|
|
46
51
|
type: 'input',
|
|
47
52
|
name: 'buildingBlockData.description',
|
|
48
|
-
message: t('description.message')
|
|
53
|
+
message: t('description.message'),
|
|
54
|
+
guiOptions: {
|
|
55
|
+
translationProperties: {
|
|
56
|
+
type: i18n_2.SapLongTextType.Description,
|
|
57
|
+
annotation: t('description.translationAnnotation')
|
|
58
|
+
}
|
|
59
|
+
}
|
|
49
60
|
}
|
|
50
61
|
],
|
|
51
62
|
initialAnswers: {
|
|
@@ -8,6 +8,14 @@ import type { Editor } from 'mem-fs-editor';
|
|
|
8
8
|
* @returns true if passed id is available.
|
|
9
9
|
*/
|
|
10
10
|
export declare function isElementIdAvailable(fs: Editor, viewOrFragmentPath: string, id: string): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Converts the provided xpath string from `/mvc:View/Page/content` to
|
|
13
|
+
* `/mvc:View/*[local-name()='Page']/*[local-name()='content']`.
|
|
14
|
+
*
|
|
15
|
+
* @param path - the xpath string
|
|
16
|
+
* @returns the augmented xpath string.
|
|
17
|
+
*/
|
|
18
|
+
export declare const augmentXpathWithLocalNames: (path: string) => string;
|
|
11
19
|
/**
|
|
12
20
|
* Returns a list of xpath strings for each element of the xml file provided.
|
|
13
21
|
*
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.augmentXpathWithLocalNames = void 0;
|
|
3
4
|
exports.isElementIdAvailable = isElementIdAvailable;
|
|
4
5
|
exports.getXPathStringsForXmlFile = getXPathStringsForXmlFile;
|
|
5
6
|
exports.getFilterBarIdsInFile = getFilterBarIdsInFile;
|
|
@@ -32,6 +33,7 @@ const augmentXpathWithLocalNames = (path) => {
|
|
|
32
33
|
}
|
|
33
34
|
return result.join('/');
|
|
34
35
|
};
|
|
36
|
+
exports.augmentXpathWithLocalNames = augmentXpathWithLocalNames;
|
|
35
37
|
/**
|
|
36
38
|
* Returns a list of xpath strings for each element of the xml file provided.
|
|
37
39
|
*
|
|
@@ -64,7 +66,7 @@ function getXPathStringsForXmlFile(xmlFilePath, fs) {
|
|
|
64
66
|
child.localName === 'Page' &&
|
|
65
67
|
child.nodeName === pageMacroDefinition);
|
|
66
68
|
if (!hasPageMacroChild) {
|
|
67
|
-
result[`${parentNode}/${node.nodeName}`] = augmentXpathWithLocalNames(`${parentNode}/${node.nodeName}`);
|
|
69
|
+
result[`${parentNode}/${node.nodeName}`] = (0, exports.augmentXpathWithLocalNames)(`${parentNode}/${node.nodeName}`);
|
|
68
70
|
}
|
|
69
71
|
const childNodes = Array.from(node.childNodes);
|
|
70
72
|
for (const childNode of childNodes) {
|
package/dist/page/custom.js
CHANGED
|
@@ -15,6 +15,9 @@ const templates_1 = require("../templates");
|
|
|
15
15
|
const semver_1 = require("semver");
|
|
16
16
|
const utils_1 = require("../common/utils");
|
|
17
17
|
const file_1 = require("../common/file");
|
|
18
|
+
const building_block_1 = require("../building-block");
|
|
19
|
+
const types_2 = require("../building-block/types");
|
|
20
|
+
const xml_1 = require("../building-block/prompts/utils/xml");
|
|
18
21
|
/**
|
|
19
22
|
* Enhances the provided custom page configuration with default data.
|
|
20
23
|
*
|
|
@@ -100,6 +103,18 @@ async function generate(basePath, data, fs) {
|
|
|
100
103
|
fs.copyTpl(i18TemplatePath, i18nPath, config);
|
|
101
104
|
}
|
|
102
105
|
}
|
|
106
|
+
if (data.pageBuildingBlockTitle) {
|
|
107
|
+
await (0, building_block_1.generateBuildingBlock)(basePath, {
|
|
108
|
+
viewOrFragmentPath: (0, path_1.relative)(basePath, viewPath),
|
|
109
|
+
aggregationPath: (0, xml_1.augmentXpathWithLocalNames)(`/mvc:View/Page`),
|
|
110
|
+
replace: true,
|
|
111
|
+
buildingBlockData: {
|
|
112
|
+
id: 'Page',
|
|
113
|
+
buildingBlockType: types_2.BuildingBlockType.Page,
|
|
114
|
+
title: data.pageBuildingBlockTitle
|
|
115
|
+
}
|
|
116
|
+
}, fs);
|
|
117
|
+
}
|
|
103
118
|
const ext = data.typescript ? 'ts' : 'js';
|
|
104
119
|
const controllerPath = (0, path_1.join)(config.path, `${config.name}.controller.${ext}`);
|
|
105
120
|
if (!fs.exists(controllerPath)) {
|
package/dist/page/types.d.ts
CHANGED
|
@@ -107,6 +107,10 @@ export interface CustomPage extends FpmPage, CustomElement {
|
|
|
107
107
|
*/
|
|
108
108
|
title?: string;
|
|
109
109
|
};
|
|
110
|
+
/**
|
|
111
|
+
* If page building block title is defined then it will be used to automatically add a macro page to the generated custom page.
|
|
112
|
+
*/
|
|
113
|
+
pageBuildingBlockTitle?: string;
|
|
110
114
|
}
|
|
111
115
|
export interface FCL {
|
|
112
116
|
/**
|
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.
|
|
4
|
+
"version": "0.38.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@types/semver": "7.5.2",
|
|
42
42
|
"@types/vinyl": "2.0.7",
|
|
43
43
|
"@sap-ux/i18n": "0.3.3",
|
|
44
|
-
"@sap-ux/ui-prompting": "0.4.
|
|
44
|
+
"@sap-ux/ui-prompting": "0.4.2"
|
|
45
45
|
},
|
|
46
46
|
"engines": {
|
|
47
47
|
"node": ">=20.x"
|