@sap-ux/fe-fpm-writer 0.34.3 → 0.35.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.
@@ -15,23 +15,13 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
35
25
  var __importDefault = (this && this.__importDefault) || function (mod) {
36
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
37
27
  };
@@ -8,6 +8,10 @@ type EnhancePageConfigFunction = (data: ObjectPage | ListReport, manifest: Manif
8
8
  * Suffix for patterns to support arbitrary paramters
9
9
  */
10
10
  export declare const PATTERN_SUFFIX = ":?query:";
11
+ /**
12
+ * List of special page templates that differs from the standard 'sap.fe.templates'.
13
+ */
14
+ export declare const SPECIAL_PAGE_TEMPLATES: string[];
11
15
  /**
12
16
  * Generates the pattern for a new route based on the input.
13
17
  *
@@ -79,5 +83,14 @@ export declare function validatePageConfig(basePath: string, config: CustomPage
79
83
  * @returns the updated memfs editor instance
80
84
  */
81
85
  export declare function extendPageJSON(basePath: string, data: ObjectPage, enhanceDataFn: EnhancePageConfigFunction, templatePath: string, fs?: Editor): Promise<Editor>;
86
+ /**
87
+ * Returns the template name prefix based on the provided manifest.
88
+ * If the dependencies in manifest matches any of the special page templates, that template is returned.
89
+ * Otherwise, it defaults to 'sap.fe.templates'.
90
+ *
91
+ * @param manifest The application manifest to check against special templates.
92
+ * @returns The matched template prefix or the default 'sap.fe.templates'.
93
+ */
94
+ export declare function getTemplateNamePrefix(manifest: Manifest): string;
82
95
  export {};
83
96
  //# sourceMappingURL=common.d.ts.map
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PATTERN_SUFFIX = void 0;
3
+ exports.SPECIAL_PAGE_TEMPLATES = exports.PATTERN_SUFFIX = void 0;
4
4
  exports.generateRoutePattern = generateRoutePattern;
5
5
  exports.generateRouteTarget = generateRouteTarget;
6
6
  exports.getManifestJsonExtensionHelper = getManifestJsonExtensionHelper;
@@ -9,6 +9,7 @@ exports.getLibraryDependencies = getLibraryDependencies;
9
9
  exports.initializeTargetSettings = initializeTargetSettings;
10
10
  exports.validatePageConfig = validatePageConfig;
11
11
  exports.extendPageJSON = extendPageJSON;
12
+ exports.getTemplateNamePrefix = getTemplateNamePrefix;
12
13
  const mem_fs_1 = require("mem-fs");
13
14
  const mem_fs_editor_1 = require("mem-fs-editor");
14
15
  const ejs_1 = require("ejs");
@@ -23,6 +24,10 @@ const utils_1 = require("../common/utils");
23
24
  * Suffix for patterns to support arbitrary paramters
24
25
  */
25
26
  exports.PATTERN_SUFFIX = ':?query:';
27
+ /**
28
+ * List of special page templates that differs from the standard 'sap.fe.templates'.
29
+ */
30
+ exports.SPECIAL_PAGE_TEMPLATES = ['sap.fe.ariba'];
26
31
  /**
27
32
  * Generates the pattern for a new route based on the input.
28
33
  *
@@ -228,4 +233,20 @@ async function extendPageJSON(basePath, data, enhanceDataFn, templatePath, fs) {
228
233
  });
229
234
  return fs;
230
235
  }
236
+ /**
237
+ * Returns the template name prefix based on the provided manifest.
238
+ * If the dependencies in manifest matches any of the special page templates, that template is returned.
239
+ * Otherwise, it defaults to 'sap.fe.templates'.
240
+ *
241
+ * @param manifest The application manifest to check against special templates.
242
+ * @returns The matched template prefix or the default 'sap.fe.templates'.
243
+ */
244
+ function getTemplateNamePrefix(manifest) {
245
+ for (const template of exports.SPECIAL_PAGE_TEMPLATES) {
246
+ if ((0, validate_1.validateDependenciesLibs)(manifest, [template])) {
247
+ return template;
248
+ }
249
+ }
250
+ return 'sap.fe.templates';
251
+ }
231
252
  //# sourceMappingURL=common.js.map
@@ -27,6 +27,8 @@ function enhanceData(data, manifestPath, fs) {
27
27
  const manifest = fs.readJSON(manifestPath);
28
28
  // set common defaults
29
29
  const config = (0, defaults_1.setCommonDefaults)(data, manifestPath, manifest);
30
+ // currently the custom page template is always the same
31
+ config.template = 'sap.fe.core.fpm';
30
32
  config.settings = (0, common_1.initializeTargetSettings)(data);
31
33
  // set library dependencies
32
34
  config.libraries = (0, common_1.getLibraryDependencies)(types_1.PageType.CustomPage);
package/dist/page/list.js CHANGED
@@ -15,6 +15,7 @@ function enhanceData(data, manifest) {
15
15
  ...data,
16
16
  settings: (0, common_1.initializeTargetSettings)(data, data.settings),
17
17
  name: types_1.PageType.ListReport,
18
+ template: `${(0, common_1.getTemplateNamePrefix)(manifest)}.ListReport`,
18
19
  ...(0, common_1.getFclConfig)(manifest)
19
20
  };
20
21
  // set library dependencies
@@ -14,7 +14,8 @@ function enhanceData(data, manifest) {
14
14
  const config = {
15
15
  ...data,
16
16
  settings: (0, common_1.initializeTargetSettings)(data, data.settings),
17
- name: types_1.PageType.ObjectPage
17
+ name: types_1.PageType.ObjectPage,
18
+ template: `${(0, common_1.getTemplateNamePrefix)(manifest)}.ObjectPage`
18
19
  };
19
20
  // set FCL configuration
20
21
  const fclConfig = (0, common_1.getFclConfig)(manifest, config.navigation);
@@ -124,6 +124,10 @@ export interface FCL {
124
124
  */
125
125
  export type InternalFpmPage = FCL & {
126
126
  settings: Record<string, unknown | undefined>;
127
+ /**
128
+ * Allows setting a non-standard template (sets the "name" property in manifest.json for the page).
129
+ */
130
+ template: string;
127
131
  };
128
132
  export declare enum PageType {
129
133
  ListReport = "ListReport",
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.34.3",
4
+ "version": "0.35.1",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -31,7 +31,7 @@
31
31
  "semver": "7.5.4",
32
32
  "xml-formatter": "2.6.1",
33
33
  "xpath": "0.0.33",
34
- "@sap-ux/fiori-annotation-api": "0.5.7",
34
+ "@sap-ux/fiori-annotation-api": "0.5.8",
35
35
  "@sap-ux/project-access": "1.30.2"
36
36
  },
37
37
  "devDependencies": {
@@ -43,7 +43,7 @@
43
43
  "@types/semver": "7.5.2",
44
44
  "@types/vinyl": "2.0.7",
45
45
  "@sap-ux/i18n": "0.3.0",
46
- "@sap-ux/ui-prompting": "0.3.31"
46
+ "@sap-ux/ui-prompting": "0.3.32"
47
47
  },
48
48
  "engines": {
49
49
  "node": ">=20.x"
@@ -8,7 +8,7 @@
8
8
  "<% if (typeof id !== 'undefined') { %><%- id %><% } else { %><%- entity %><%- name %><% } %>": {
9
9
  "type": "Component",
10
10
  "id": "<% if (typeof id !== 'undefined') { %><%- id %><% } else { %><%- entity %><%- name %><% } %>",
11
- "name": "sap.fe.core.fpm",<%if (locals.controlAggregation) {%>
11
+ "name": "<%- template %>",<%if (locals.controlAggregation) {%>
12
12
  "controlAggregation": "<%- locals.controlAggregation %>",<% } %>
13
13
  "options": {
14
14
  "settings": <%- JSON.stringify({ ...settings, viewName: `${ns}.${name}`}) %>
@@ -8,7 +8,7 @@
8
8
  "<% if (typeof id !== 'undefined') { %><%- id %><% } else { %><%- entity %>ListReport<% } %>": {
9
9
  "type": "Component",
10
10
  "id": "<% if (typeof id !== 'undefined') { %><%- id %><% } else { %><%- entity %>ListReport<% } %>",
11
- "name": "sap.fe.templates.ListReport",<%if (locals.controlAggregation) {%>
11
+ "name": "<%- template %>",<%if (locals.controlAggregation) {%>
12
12
  "controlAggregation": "<%- locals.controlAggregation %>",<% } %>
13
13
  "options": {
14
14
  "settings": <%- JSON.stringify(settings) %>
@@ -8,7 +8,7 @@
8
8
  "<% if (typeof id !== 'undefined') { %><%- id %><% } else { %><%- entity %>ObjectPage<% } %>": {
9
9
  "type": "Component",
10
10
  "id": "<% if (typeof id !== 'undefined') { %><%- id %><% } else { %><%- entity %>ObjectPage<% } %>",
11
- "name": "sap.fe.templates.ObjectPage",<%if (locals.controlAggregation) {%>
11
+ "name": "<%- template %>",<%if (locals.controlAggregation) {%>
12
12
  "controlAggregation": "<%- locals.controlAggregation %>",<% } %>
13
13
  "options": {
14
14
  "settings": <%- JSON.stringify(settings) %>