@sap-ux/fe-fpm-writer 0.24.1 → 0.24.3

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.
@@ -66,6 +66,7 @@ function enhanceConfig(fs, data, manifestPath, manifest) {
66
66
  * @param {Editor} [fs] - the mem-fs editor instance
67
67
  */
68
68
  function generateCustomColumn(basePath, customColumn, fs) {
69
+ var _a;
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)());
@@ -84,7 +85,7 @@ function generateCustomColumn(basePath, customColumn, fs) {
84
85
  tabInfo: customColumn.tabInfo
85
86
  });
86
87
  // add fragment
87
- const viewPath = (0, path_1.join)(completeColumn.path, `${completeColumn.name}.fragment.xml`);
88
+ const viewPath = (0, path_1.join)(completeColumn.path, `${(_a = completeColumn.fragmentFile) !== null && _a !== void 0 ? _a : completeColumn.name}.fragment.xml`);
88
89
  if (completeColumn.control || !fs.exists(viewPath)) {
89
90
  fs.copyTpl((0, templates_1.getTemplatePath)('common/Fragment.xml'), viewPath, completeColumn);
90
91
  }
@@ -1,4 +1,4 @@
1
- import type { CustomElement, InternalCustomElement, Position, EventHandler } from '../common/types';
1
+ import type { CustomElement, InternalCustomElement, Position, EventHandler, CustomFragment } from '../common/types';
2
2
  export declare enum Availability {
3
3
  'Default' = "Default",
4
4
  'Adaptation' = "Adaptation",
@@ -14,7 +14,7 @@ export type ColumnPropertiesType = string[];
14
14
  * Custom Column.
15
15
  *
16
16
  */
17
- export interface CustomTableColumn extends CustomElement, EventHandler {
17
+ export interface CustomTableColumn extends CustomElement, EventHandler, CustomFragment {
18
18
  /**
19
19
  * Name of the routing target
20
20
  */
@@ -160,4 +160,10 @@ export interface WriterConfig {
160
160
  */
161
161
  tabInfo?: TabInfo;
162
162
  }
163
+ export interface CustomFragment {
164
+ /**
165
+ * Name of the custom element fragment.
166
+ */
167
+ fragmentFile?: string;
168
+ }
163
169
  //# sourceMappingURL=types.d.ts.map
@@ -62,6 +62,7 @@ exports.getTemplateRoot = getTemplateRoot;
62
62
  * @returns {Promise<Editor>} the updated memfs editor instance
63
63
  */
64
64
  function generate(basePath, data, fs) {
65
+ var _a, _b, _c;
65
66
  if (!fs) {
66
67
  fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
67
68
  }
@@ -82,6 +83,18 @@ function generate(basePath, data, fs) {
82
83
  const viewPath = (0, path_1.join)(config.path, `${config.name}.view.xml`);
83
84
  if (!fs.exists(viewPath)) {
84
85
  fs.copyTpl((0, path_1.join)(root, 'ext/View.xml'), viewPath, config);
86
+ // i18n.properties
87
+ const manifest = fs.readJSON(manifestPath);
88
+ const defaultI18nPath = 'i18n/i18n.properties';
89
+ const customI18nPath = (_c = (_b = (_a = manifest === null || manifest === void 0 ? void 0 : manifest['sap.ui5']) === null || _a === void 0 ? void 0 : _a.models) === null || _b === void 0 ? void 0 : _b.i18n) === null || _c === void 0 ? void 0 : _c.uri;
90
+ const i18nPath = (0, path_1.join)(basePath, 'webapp', customI18nPath !== null && customI18nPath !== void 0 ? customI18nPath : defaultI18nPath);
91
+ const i18TemplatePath = (0, path_1.join)(root, 'i18n', 'i18n.properties');
92
+ if (fs.exists(i18nPath)) {
93
+ fs.append(i18nPath, (0, ejs_1.render)(fs.read(i18TemplatePath), config, {}));
94
+ }
95
+ else {
96
+ fs.copyTpl(i18TemplatePath, i18nPath, config);
97
+ }
85
98
  }
86
99
  const ext = data.typescript ? 'ts' : 'js';
87
100
  const controllerPath = (0, path_1.join)(config.path, `${config.name}.controller.${ext}`);
@@ -73,6 +73,7 @@ function enhanceConfig(fs, data, manifestPath, manifest) {
73
73
  * @returns {Promise<Editor>} the updated mem-fs editor instance
74
74
  */
75
75
  function generate(basePath, customSection, manifestTemplateRoot, fs) {
76
+ var _a;
76
77
  (0, validate_1.validateVersion)(customSection.minUI5Version);
77
78
  if (!fs) {
78
79
  fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
@@ -90,7 +91,7 @@ function generate(basePath, customSection, manifestTemplateRoot, fs) {
90
91
  tabInfo: customSection.tabInfo
91
92
  });
92
93
  // add fragment
93
- const viewPath = (0, path_1.join)(completeSection.path, `${completeSection.name}.fragment.xml`);
94
+ const viewPath = (0, path_1.join)(completeSection.path, `${(_a = completeSection.fragmentFile) !== null && _a !== void 0 ? _a : completeSection.name}.fragment.xml`);
94
95
  if (!fs.exists(viewPath)) {
95
96
  fs.copyTpl((0, templates_1.getTemplatePath)('common/FragmentWithVBox.xml'), viewPath, completeSection);
96
97
  }
@@ -1,5 +1,5 @@
1
- import type { CustomElement, InternalCustomElement, Position, EventHandler } from '../common/types';
2
- export interface CustomSection extends CustomElement, EventHandler {
1
+ import type { CustomElement, InternalCustomElement, Position, EventHandler, CustomFragment } from '../common/types';
2
+ export interface CustomSection extends CustomElement, EventHandler, CustomFragment {
3
3
  /**
4
4
  * Name of the routing target
5
5
  */
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.24.1",
4
+ "version": "0.24.3",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -33,7 +33,7 @@
33
33
  "@types/mem-fs": "1.1.2",
34
34
  "@types/mem-fs-editor": "7.0.1",
35
35
  "@types/semver": "7.5.2",
36
- "@sap-ux/project-access": "1.15.1"
36
+ "@sap-ux/project-access": "1.16.1"
37
37
  },
38
38
  "engines": {
39
39
  "pnpm": ">=6.26.1 < 7.0.0 || >=7.1.0",
@@ -14,7 +14,7 @@
14
14
  "width": "<%- width %>",
15
15
  <% } %>
16
16
  "position": <%- JSON.stringify(position) %>,
17
- "template": "<%- ns %>.<%- name %>"
17
+ "template": "<%- ns %>.<%- typeof fragmentFile !== 'undefined' ? fragmentFile : name %>"
18
18
  }
19
19
  }
20
20
  }
@@ -14,7 +14,7 @@
14
14
  "width": "<%- width %>",
15
15
  <% } %>
16
16
  "position": <%- JSON.stringify(position) %>,
17
- "template": "<%- ns %>.<%- name %>"
17
+ "template": "<%- ns %>.<%- typeof fragmentFile !== 'undefined' ? fragmentFile : name %>"
18
18
  <% if (locals.availability) { %>
19
19
  , "availability": "<%- availability %>"
20
20
  <% } %>
@@ -15,7 +15,7 @@
15
15
  "position": <%- JSON.stringify(position) %>,
16
16
  <% if (locals.horizontalAlign) { %> "horizontalAlign": "<%- horizontalAlign %>", <%
17
17
  } %>
18
- "template": "<%- ns %>.<%- name %>"
18
+ "template": "<%- ns %>.<%- typeof fragmentFile !== 'undefined' ? fragmentFile : name %>"
19
19
  <% if (locals.availability) { %> , "availability": "<%- availability %>" <%
20
20
  } %>
21
21
  <% if (locals.properties) { %> , "properties": [
@@ -9,7 +9,7 @@
9
9
  "header": {
10
10
  "facets": {
11
11
  "<%- name %>": {
12
- "template": "<%- ns %>.<%- name %>",
12
+ "template": "<%- ns %>.<%- typeof fragmentFile !== 'undefined' ? fragmentFile : name %>",
13
13
  <% if (typeof edit !== 'undefined') { %>
14
14
  "templateEdit": "<%- edit.ns %>.<%- edit.name %>",
15
15
  <% } %>
@@ -1,6 +1,6 @@
1
1
  <mvc:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m"
2
2
  xmlns:html="http://www.w3.org/1999/xhtml" controllerName="<%- ns %>.<%- name %>">
3
- <Page id="<%- name %>">
3
+ <Page id="<%- name %>" title="{i18n><%- name %>Title}">
4
4
  <content></content>
5
5
  </Page>
6
6
  </mvc:View>
@@ -0,0 +1,2 @@
1
+ #XTIT: Custom view title
2
+ <%=name%>Title=<%=view.title%>
@@ -1,6 +1,6 @@
1
1
  <mvc:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m" xmlns:macros="sap.fe.macros"
2
2
  xmlns:html="http://www.w3.org/1999/xhtml" controllerName="<%- ns %>.<%- name %>">
3
- <Page id="<%- name %>">
3
+ <Page id="<%- name %>" title="{i18n><%- name %>Title}">
4
4
  <content></content>
5
5
  </Page>
6
6
  </mvc:View>
@@ -0,0 +1,2 @@
1
+ #XTIT: Custom view title
2
+ <%=name%>Title=<%=view.title%>
@@ -0,0 +1,2 @@
1
+ #XTIT: Custom view title
2
+ <%=name%>Title=<%=view.title%>
@@ -9,7 +9,7 @@
9
9
  "body": {
10
10
  "sections": {
11
11
  "<%- name %>": {
12
- "template": "<%- ns %>.<%- name %>",
12
+ "template": "<%- ns %>.<%- typeof fragmentFile !== 'undefined' ? fragmentFile : name %>",
13
13
  <%if (typeof position !== 'undefined') {%>"position": {
14
14
  <% if (position.placement) { %>
15
15
  "placement": "<%- position.placement %>"<% if (position.anchor) { %>,<% } %>
@@ -11,7 +11,7 @@
11
11
  "<%- parentSection %>": {
12
12
  "subSections": {
13
13
  "<%- name %>": {
14
- "template": "<%- ns %>.<%- name %>",
14
+ "template": "<%- ns %>.<%- typeof fragmentFile !== 'undefined' ? fragmentFile : name %>",
15
15
  <%if (typeof position !== 'undefined') {%>"position": {
16
16
  <% if (position.placement) { %>
17
17
  "placement": "<%- position.placement %>"<% if (position.anchor) { %>,<% } %>