@sap-ux/fe-fpm-writer
Advanced tools
Comparing version 0.18.7 to 0.18.8
@@ -22,6 +22,6 @@ "use strict"; | ||
const minVersion = (0, semver_1.coerce)(ui5Version); | ||
if (!minVersion || minVersion.minor >= 86) { | ||
if (!minVersion || (0, semver_1.gte)(minVersion, '1.86.0')) { | ||
return (0, templates_1.getTemplatePath)('/column/1.86'); | ||
} | ||
else if (minVersion.minor >= 85) { | ||
else if ((0, semver_1.gte)(minVersion, '1.85.0')) { | ||
return (0, templates_1.getTemplatePath)('/column/1.85'); | ||
@@ -28,0 +28,0 @@ } |
@@ -16,3 +16,3 @@ "use strict"; | ||
const minVersion = (0, semver_1.coerce)(ui5Version); | ||
if (minVersion && minVersion.minor < 84) { | ||
if (minVersion && (0, semver_1.lt)(minVersion, '1.84.0')) { | ||
throw new Error('SAP Fiori elements for OData v4 is only supported starting with SAPUI5 1.84.'); | ||
@@ -19,0 +19,0 @@ } |
import type { Editor } from 'mem-fs-editor'; | ||
import type { ManifestNamespace } from '@sap-ux/project-access'; | ||
import type { CustomPage, FCL, InternalCustomPage, InternalObjectPage, ObjectPage, ListReport, Navigation, InternalListReport } from './types'; | ||
import type { CustomPage, FCL, FpmPage, InternalCustomPage, InternalObjectPage, ObjectPage, ListReport, Navigation, InternalListReport } from './types'; | ||
import type { Manifest } from '../common/types'; | ||
@@ -45,2 +45,10 @@ type EnhancePageConfigFunction = (data: ObjectPage | ListReport, manifest: Manifest) => InternalObjectPage | InternalListReport; | ||
/** | ||
* Create target settings for a Fiori elements page. | ||
* | ||
* @param data - incoming configuration | ||
* @param addSettings - optional arbitrary settings | ||
* @returns version aware settings object | ||
*/ | ||
export declare function initializeTargetSettings(data: FpmPage, addSettings?: Record<string, unknown>): Record<string, unknown>; | ||
/** | ||
* Validate the input parameters for the generation of a custom or an object page. | ||
@@ -47,0 +55,0 @@ * |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.extendPageJSON = exports.validatePageConfig = exports.getFclConfig = exports.getManifestJsonExtensionHelper = exports.generateRouteTarget = exports.generateRoutePattern = exports.PATTERN_SUFFIX = void 0; | ||
exports.extendPageJSON = exports.validatePageConfig = exports.initializeTargetSettings = exports.getFclConfig = exports.getManifestJsonExtensionHelper = exports.generateRouteTarget = exports.generateRoutePattern = exports.PATTERN_SUFFIX = void 0; | ||
const mem_fs_1 = require("mem-fs"); | ||
@@ -12,2 +12,3 @@ const mem_fs_editor_1 = require("mem-fs-editor"); | ||
const templates_1 = require("../templates"); | ||
const semver_1 = require("semver"); | ||
/** | ||
@@ -129,2 +130,24 @@ * Suffix for patterns to support arbitrary paramters | ||
/** | ||
* Create target settings for a Fiori elements page. | ||
* | ||
* @param data - incoming configuration | ||
* @param addSettings - optional arbitrary settings | ||
* @returns version aware settings object | ||
*/ | ||
function initializeTargetSettings(data, addSettings) { | ||
var _a, _b; | ||
const settings = addSettings ? Object.assign({}, addSettings) : {}; | ||
(_a = settings.navigation) !== null && _a !== void 0 ? _a : (settings.navigation = {}); | ||
// starting with UI5 v1.94.0, contextPath is the preferred setting | ||
const minVersion = (0, semver_1.coerce)(data.minUI5Version); | ||
if (!minVersion || (0, semver_1.gte)(minVersion, '1.94.0')) { | ||
settings.contextPath = (_b = data.contextPath) !== null && _b !== void 0 ? _b : `/${data.entity}`; | ||
} | ||
else { | ||
settings.entitySet = data.entity; | ||
} | ||
return settings; | ||
} | ||
exports.initializeTargetSettings = initializeTargetSettings; | ||
/** | ||
* Validate the input parameters for the generation of a custom or an object page. | ||
@@ -131,0 +154,0 @@ * |
@@ -27,2 +27,3 @@ "use strict"; | ||
const config = (0, defaults_1.setCommonDefaults)(data, manifestPath, manifest); | ||
config.settings = (0, common_1.initializeTargetSettings)(data); | ||
// set FCL configuration | ||
@@ -48,3 +49,3 @@ const fclConfig = (0, common_1.getFclConfig)(manifest, config.navigation); | ||
const minVersion = (0, semver_1.coerce)(ui5Version); | ||
if (!minVersion || minVersion.minor >= 94) { | ||
if (!minVersion || (0, semver_1.gte)(minVersion, '1.94.0')) { | ||
return (0, templates_1.getTemplatePath)('/page/custom/1.94'); | ||
@@ -51,0 +52,0 @@ } |
@@ -14,6 +14,4 @@ "use strict"; | ||
var _a, _b; | ||
const config = Object.assign(Object.assign(Object.assign({ settings: {} }, data), { name: 'ListReport' }), (0, common_1.getFclConfig)(manifest)); | ||
// move settings into correct possition in the manifest | ||
config.settings.entitySet = data.entity; | ||
config.settings.navigation = {}; | ||
var _c; | ||
const config = Object.assign(Object.assign(Object.assign({}, data), { settings: (0, common_1.initializeTargetSettings)(data, data.settings), name: 'ListReport' }), (0, common_1.getFclConfig)(manifest)); | ||
// use standard file name if i18n enhancement required | ||
@@ -25,7 +23,6 @@ if (config.settings.enhanceI18n === true) { | ||
if (config.settings.tableSettings) { | ||
config.settings.controlConfiguration = (_a = config.settings.controlConfiguration) !== null && _a !== void 0 ? _a : {}; | ||
config.settings.controlConfiguration['@com.sap.vocabularies.UI.v1.LineItem'] = | ||
(_b = config.settings.controlConfiguration['@com.sap.vocabularies.UI.v1.LineItem']) !== null && _b !== void 0 ? _b : {}; | ||
config.settings.controlConfiguration['@com.sap.vocabularies.UI.v1.LineItem'].tableSettings = | ||
config.settings.tableSettings; | ||
(_a = (_c = config.settings).controlConfiguration) !== null && _a !== void 0 ? _a : (_c.controlConfiguration = {}); | ||
const controlConfig = config.settings.controlConfiguration; | ||
(_b = controlConfig['@com.sap.vocabularies.UI.v1.LineItem']) !== null && _b !== void 0 ? _b : (controlConfig['@com.sap.vocabularies.UI.v1.LineItem'] = {}); | ||
controlConfig['@com.sap.vocabularies.UI.v1.LineItem'].tableSettings = config.settings.tableSettings; | ||
delete config.settings.tableSettings; | ||
@@ -32,0 +29,0 @@ } |
@@ -13,6 +13,3 @@ "use strict"; | ||
function enhanceData(data, manifest) { | ||
const config = Object.assign(Object.assign(Object.assign({ settings: {} }, data), { name: 'ObjectPage' }), (0, common_1.getFclConfig)(manifest)); | ||
// move settings into correct possition in the manifest | ||
config.settings.entitySet = data.entity; | ||
config.settings.navigation = {}; | ||
const config = Object.assign(Object.assign(Object.assign({}, data), { settings: (0, common_1.initializeTargetSettings)(data, data.settings), name: 'ObjectPage' }), (0, common_1.getFclConfig)(manifest)); | ||
// use standard file name if i18n enhancement required | ||
@@ -19,0 +16,0 @@ if (config.settings.enhanceI18n === true) { |
@@ -19,10 +19,10 @@ import type { CustomElement, InternalCustomElement, WriterConfig } from '../common/types'; | ||
} | ||
export interface StandardPageSettings { | ||
export type StandardPageSettings = { | ||
enhanceI18n?: string | true; | ||
variantManagement?: 'Page' | 'None'; | ||
} | ||
}; | ||
/** | ||
* Support list of settings for a ListReport page | ||
*/ | ||
export interface ListReportSettings extends StandardPageSettings { | ||
export type ListReportSettings = StandardPageSettings & { | ||
tableSettings?: { | ||
@@ -33,7 +33,7 @@ type?: 'ResponsiveTable' | 'GridTable'; | ||
}; | ||
} | ||
}; | ||
/** | ||
* Configuration options for adding a list report page. | ||
* Common settings for any page supporting the Fiori elements flexible programming model. | ||
*/ | ||
export interface ListReport extends WriterConfig { | ||
export interface FpmPage { | ||
/** | ||
@@ -44,2 +44,17 @@ * Name of the entity used for the custom page. | ||
/** | ||
* With template or UI5 version 1.94 you can alternatively specify a contextPath that shall be inserted as page option, instead of the entitySet. | ||
*/ | ||
contextPath?: string; | ||
/** | ||
* Optional property to define the minimum UI5 version that the generated code must support. | ||
* If undefined then the latest version of the template is used. | ||
* If nothing can be generated for the given version then an exception is thrown. | ||
*/ | ||
minUI5Version?: string; | ||
} | ||
/** | ||
* Configuration options for adding a list report page. | ||
*/ | ||
export interface ListReport extends FpmPage, WriterConfig { | ||
/** | ||
* Optional settings for the ListReport page | ||
@@ -52,8 +67,4 @@ */ | ||
*/ | ||
export interface ObjectPage extends WriterConfig { | ||
export interface ObjectPage extends FpmPage, WriterConfig { | ||
/** | ||
* Name of the entity used for the custom page. | ||
*/ | ||
entity: string; | ||
/** | ||
* Optional settings for the object page | ||
@@ -70,8 +81,4 @@ */ | ||
*/ | ||
export interface CustomPage extends CustomElement { | ||
export interface CustomPage extends FpmPage, CustomElement { | ||
/** | ||
* Name of the entity used for the custom page. | ||
*/ | ||
entity: string; | ||
/** | ||
* Optional incoming navigation configuration. If provided then a navigation configuration is added to an existing page navigating to this custom page. | ||
@@ -107,14 +114,18 @@ */ | ||
/** | ||
* Common settings for Fiori elements pages | ||
*/ | ||
export type InternalFpmPage = FCL & { | ||
settings: Record<string, unknown | undefined>; | ||
}; | ||
/** | ||
* Additional internal configuration options that will be calculated based on the provided input as well as the target application. | ||
*/ | ||
export type InternalCustomPage = CustomPage & InternalCustomElement & FCL; | ||
export type InternalListReport = ListReport & FCL & { | ||
export type InternalCustomPage = CustomPage & InternalFpmPage & InternalCustomElement; | ||
export type InternalListReport = ListReport & InternalFpmPage & { | ||
name: 'ListReport'; | ||
navigation?: Navigation; | ||
settings: any; | ||
}; | ||
export type InternalObjectPage = ObjectPage & FCL & { | ||
export type InternalObjectPage = ObjectPage & InternalFpmPage & { | ||
name: 'ObjectPage'; | ||
settings: any; | ||
}; | ||
//# sourceMappingURL=types.d.ts.map |
@@ -22,3 +22,3 @@ "use strict"; | ||
const minVersion = (0, semver_1.coerce)(ui5Version); | ||
if (!minVersion || minVersion.minor >= 86) { | ||
if (!minVersion || (0, semver_1.gte)(minVersion, '1.86.0')) { | ||
return (0, templates_1.getTemplatePath)('/section/1.86'); | ||
@@ -39,3 +39,3 @@ } | ||
const minVersion = (0, semver_1.coerce)(ui5Version); | ||
return !minVersion || minVersion.minor >= 90 ? { 'xmlns:macros': 'sap.fe.macros' } : undefined; | ||
return !minVersion || (0, semver_1.gte)(minVersion, '1.90.0') ? { 'xmlns:macros': 'sap.fe.macros' } : undefined; | ||
} | ||
@@ -42,0 +42,0 @@ /** |
{ | ||
"name": "@sap-ux/fe-fpm-writer", | ||
"description": "SAP Fiori elements flexible programming model writer", | ||
"version": "0.18.7", | ||
"version": "0.18.8", | ||
"repository": { | ||
@@ -32,3 +32,3 @@ "type": "git", | ||
"devDependencies": { | ||
"@sap-ux/project-access": "1.1.3", | ||
"@sap-ux/project-access": "1.3.0", | ||
"@types/ejs": "3.1.0", | ||
@@ -35,0 +35,0 @@ "@types/mem-fs": "1.1.2", |
@@ -10,6 +10,3 @@ { | ||
"options": { | ||
"settings": { | ||
"entitySet": "<%- entity %>", | ||
"navigation": { } | ||
} | ||
"settings": <%- JSON.stringify(settings) %> | ||
} | ||
@@ -16,0 +13,0 @@ }<%if (locals.navigation) {%>, |
@@ -11,7 +11,3 @@ { | ||
"options": { | ||
"settings": { | ||
"viewName": "<%- ns %>.<%- name %>", | ||
"entitySet": "<%- entity %>", | ||
"navigation": { } | ||
} | ||
"settings": <%- JSON.stringify({ ...settings, viewName: `${ns}.${name}`}) %> | ||
} | ||
@@ -18,0 +14,0 @@ }<%if (locals.navigation) {%>, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
163668
3552