@sap/ux-specification
Advanced tools
Comparing version 1.76.17 to 1.76.18
@@ -7,2 +7,15 @@ # Change Log | ||
## [1.76.18] - 2020-08-xx | ||
### Added | ||
- Support UI Flex binding change for header action | ||
### Changed | ||
### Deprecated | ||
### Removed | ||
### Fixed | ||
## [1.76.17] - 2020-08-07 | ||
@@ -9,0 +22,0 @@ |
@@ -324,3 +324,3 @@ { | ||
"$ref": "#/definitions/LoadDataOnAppLaunchSettings", | ||
"description": "Change the default behavior for autoloading of data.\nFor multi-view scenarios, you can also change the manifest setting enableAutobinding to False under quickVariantSelectionX instead of using the loadDataOnAppLaunch setting." | ||
"description": "Change the default behavior for autoloading of data.\nFor multi-view scenarios, you can also change the setting enableAutobinding to False under quickVariantSelectionX instead of using the loadDataOnAppLaunch setting." | ||
} | ||
@@ -327,0 +327,0 @@ }, |
@@ -314,3 +314,3 @@ { | ||
"$ref": "#/definitions/LoadDataOnAppLaunchSettings", | ||
"description": "Change the default behavior for autoloading of data.\nFor multi-view scenarios, you can also change the manifest setting enableAutobinding to False under quickVariantSelectionX instead of using the loadDataOnAppLaunch setting." | ||
"description": "Change the default behavior for autoloading of data.\nFor multi-view scenarios, you can also change the setting enableAutobinding to False under quickVariantSelectionX instead of using the loadDataOnAppLaunch setting." | ||
} | ||
@@ -317,0 +317,0 @@ }, |
@@ -21,3 +21,3 @@ { | ||
"header": { | ||
"$ref": "#/definitions/ObjectPageHeader" | ||
"$ref": "#/definitions/ObjectPageHeader<GenericActions>" | ||
}, | ||
@@ -43,3 +43,3 @@ "layout": { | ||
"definitions": { | ||
"ObjectPageHeader": { | ||
"ObjectPageHeader<GenericActions>": { | ||
"type": "object", | ||
@@ -62,2 +62,6 @@ "properties": { | ||
"description": "With displayShape you can define the shape of the avatar." | ||
}, | ||
"actions": { | ||
"$ref": "#/definitions/GenericActions", | ||
"description": "Set properties of actions on Object Page Header" | ||
} | ||
@@ -74,2 +78,25 @@ }, | ||
}, | ||
"GenericActions": { | ||
"type": "object", | ||
"additionalProperties": { | ||
"$ref": "#/definitions/Action" | ||
} | ||
}, | ||
"Action": { | ||
"type": "object", | ||
"properties": { | ||
"visible": { | ||
"enum": [ | ||
false, | ||
true, | ||
"{= !${ui>/editable}}", | ||
"{ui>/editable}" | ||
] | ||
} | ||
}, | ||
"additionalProperties": false, | ||
"required": [ | ||
"visible" | ||
] | ||
}, | ||
"ObjectPageLayout": { | ||
@@ -76,0 +103,0 @@ "type": "object", |
@@ -0,1 +1,2 @@ | ||
import { Action } from '../controls/ObjectPageHeaderAction'; | ||
export declare enum AvatarShape { | ||
@@ -5,3 +6,6 @@ Circle = "Circle", | ||
} | ||
export interface ObjectPageHeader { | ||
export interface GenericActions { | ||
[id: string]: Action; | ||
} | ||
export interface ObjectPageHeader<ACT = GenericActions> { | ||
/** | ||
@@ -23,2 +27,6 @@ * Set showRelatedApps to true to show the navigation button for related apps. | ||
displayShape?: AvatarShape; | ||
/** | ||
* Set properties of actions on Object Page Header | ||
*/ | ||
actions?: ACT; | ||
} |
@@ -28,5 +28,2 @@ export declare enum HAlign { | ||
} | ||
export interface Action { | ||
visible: boolean; | ||
} | ||
export declare enum PopinLayout { | ||
@@ -138,3 +135,3 @@ Block = "Block", | ||
* Change the default behavior for autoloading of data. | ||
* For multi-view scenarios, you can also change the manifest setting enableAutobinding to False under quickVariantSelectionX instead of using the loadDataOnAppLaunch setting. | ||
* For multi-view scenarios, you can also change the setting enableAutobinding to False under quickVariantSelectionX instead of using the loadDataOnAppLaunch setting. | ||
*/ | ||
@@ -141,0 +138,0 @@ loadDataOnAppLaunch: LoadDataOnAppLaunchSettings; |
@@ -37,3 +37,4 @@ import { Manifest } from '../../specification/common/webapp/manifest'; | ||
property: string; | ||
newValue: boolean | number | string | object; | ||
newValue?: boolean | number | string | object; | ||
newBinding?: string | object; | ||
} | ||
@@ -40,0 +41,0 @@ /** |
@@ -1,4 +0,4 @@ | ||
import { ObjectPageHeader as ObjectPageHeaderConfig } from '../../../../specification/v2/controls/ObjectPageHeader'; | ||
import { ObjectPageHeader as ObjectPageHeaderConfig, GenericActions } from '../../../../specification/v2/controls/ObjectPageHeader'; | ||
import { AvatarShape } from '../../../../specification/v2/controls/ObjectPageHeader'; | ||
export declare class ObjectPageHeader implements ObjectPageHeaderConfig { | ||
export declare class ObjectPageHeader<ACT = GenericActions> implements ObjectPageHeaderConfig<ACT> { | ||
showRelatedApps?: boolean; | ||
@@ -8,2 +8,3 @@ editableHeaderContent?: boolean; | ||
displayShape?: AvatarShape; | ||
actions?: ACT; | ||
} |
@@ -14,2 +14,3 @@ "use strict"; | ||
const common_1 = require("../../common"); | ||
const ObjectPageHeaderAction_1 = require("../../../sync/v2/export/controls/ObjectPageHeaderAction"); | ||
/** | ||
@@ -203,2 +204,3 @@ * Returns a fresh export results object with default values | ||
let localBreadcrumbs; | ||
let flexChange; | ||
//eliminate subsections' hierarchy | ||
@@ -219,10 +221,23 @@ let index = breadcrumbs.indexOf('subsections'); | ||
} | ||
const flexChange = { | ||
controlId: exportPropertyRule.flex.controlId(baseId, ids, localBreadcrumbs, exportPropertyRule.flex.controlType, title), | ||
controlType: exportPropertyRule.flex.controlType(), | ||
content: { | ||
property: key, | ||
newValue: configObject | ||
} | ||
}; | ||
if (typeof configObject !== 'boolean' && breadcrumbs.includes('actions')) { | ||
flexChange = { | ||
controlId: exportPropertyRule.flex.controlId(baseId, ids, localBreadcrumbs, exportPropertyRule.flex.controlType, title), | ||
controlType: exportPropertyRule.flex.controlType(), | ||
content: { | ||
property: key, | ||
newBinding: configObject | ||
}, | ||
type: 'propertyBindingChange' | ||
}; | ||
} | ||
else { | ||
flexChange = { | ||
controlId: exportPropertyRule.flex.controlId(baseId, ids, localBreadcrumbs, exportPropertyRule.flex.controlType, title), | ||
controlType: exportPropertyRule.flex.controlType(), | ||
content: { | ||
property: key, | ||
newValue: configObject | ||
} | ||
}; | ||
} | ||
exportResults.flexChanges.push(exportPropertyRule.flex.exportFunction(flexChange, fullManifest)); | ||
@@ -544,2 +559,11 @@ } | ||
objectPage.header = Object.assign(new controls_1.ObjectPageHeader(), objectPage.header); | ||
for (const headerId in objectPageConfig.header) { | ||
if (headerId === 'actions') { | ||
objectPage.header.actions = Object.assign(new controls_1.ObjectPageHeader(), objectPage.header.actions); | ||
for (const actionId in objectPageConfig.header.actions) { | ||
const action = objectPage.header.actions; | ||
action[actionId] = Object.assign(new ObjectPageHeaderAction_1.Action(), action[actionId]); | ||
} | ||
} | ||
} | ||
objectPage.layout = Object.assign(new controls_1.ObjectPageLayout(), objectPage.layout); | ||
@@ -546,0 +570,0 @@ const pageLayoutInformation = decorators_1.getPageLayoutInformation(objectPage); |
@@ -85,8 +85,8 @@ "use strict"; | ||
'#/definitions/' + facetId; | ||
appSchema['definitions'][schemaIdForOpAnalyticalTable] = JSON.parse(JSON.stringify(appSchema['definitions']['ObjectPageResponsiveTable<GenericColumns>'])); | ||
appSchema['definitions'][schemaIdForOpAnalyticalTable] = JSON.parse(JSON.stringify(appSchema['definitions']['ObjectPageAnalyticalTable<GenericColumns>'])); | ||
appSchema['definitions'][schemaIdForOpAnalyticalTable]['properties']['columns']['$ref'] = | ||
'#/definitions/' + facetId; | ||
appSchema['definitions'][schemaIdForOpGridTable] = JSON.parse(JSON.stringify(appSchema['definitions']['ObjectPageResponsiveTable<GenericColumns>'])); | ||
appSchema['definitions'][schemaIdForOpGridTable] = JSON.parse(JSON.stringify(appSchema['definitions']['ObjectPageGridTable<GenericColumns>'])); | ||
appSchema['definitions'][schemaIdForOpGridTable]['properties']['columns']['$ref'] = '#/definitions/' + facetId; | ||
appSchema['definitions'][schemaIdForOpTreeTable] = JSON.parse(JSON.stringify(appSchema['definitions']['ObjectPageResponsiveTable<GenericColumns>'])); | ||
appSchema['definitions'][schemaIdForOpTreeTable] = JSON.parse(JSON.stringify(appSchema['definitions']['ObjectPageTreeTable<GenericColumns>'])); | ||
appSchema['definitions'][schemaIdForOpTreeTable]['properties']['columns']['$ref'] = '#/definitions/' + facetId; | ||
@@ -170,2 +170,45 @@ for (const facetKey in facets) { | ||
/** | ||
* Add Object Page Header Action Buttons to app-specific schema | ||
* | ||
* @param {object} appSchema Schema of the app | ||
* @param {string} entitySet Entityset of the app | ||
* @param {EntityType[]} entityTypes | ||
*/ | ||
function addActions(appSchema, entitySet, entityTypes) { | ||
appSchema['definitions']['ObjectPageHeader'] = JSON.parse(JSON.stringify(appSchema['definitions']['ObjectPageHeader<GenericActions>'])); | ||
delete appSchema['definitions']['ObjectPageHeader']['properties']['actions']; | ||
// initialize header actions | ||
const actions = (appSchema['definitions']['HeaderActions'] = { | ||
type: 'object', | ||
properties: {}, | ||
additionalProperties: false | ||
}); | ||
const entityType = entityTypes.find((et) => et.name === entitySet); | ||
if (!entityType) { | ||
return; | ||
} | ||
const actionAnnotation = entityType.annotations.UI.Identification; | ||
if (actionAnnotation) { | ||
// Add action to configuration | ||
actionAnnotation.forEach((item) => { | ||
if (!item['Determining'] && item.$Type === 'com.sap.vocabularies.UI.v1.DataFieldForAction') { | ||
const actionName = item.Action.split('.')[1].split('/'); | ||
const entityName = entityType.fullyQualifiedName.split('.'); | ||
const actionId = entityName[0] + '.' + actionName[0] + '::' + actionName[1]; | ||
appSchema['definitions']['ObjectPageHeader'].properties['actions'] = { | ||
$ref: '#/definitions/HeaderActions' | ||
}; | ||
actions.properties[actionId] = { | ||
$ref: '#/definitions/ObjectPageActionV2<' + actionId + '>' | ||
}; | ||
appSchema['definitions']['ObjectPageActionV2<' + actionId + '>'] = { | ||
$ref: '#/definitions/Action', | ||
type: 'object' | ||
}; | ||
appSchema['definitions']['ObjectPageActionV2<' + actionId + '>'].properties = JSON.parse(JSON.stringify(appSchema['definitions']['Action'].properties)); | ||
} | ||
}); | ||
} | ||
} | ||
/** | ||
* Adds the related facets keys 'enum' to the app schema | ||
@@ -205,5 +248,13 @@ * @param schema - app specific schema that potentially gets enhanced | ||
}; | ||
// Change reference to header actions | ||
appSchema['properties']['header'] = { | ||
$ref: '#/definitions/ObjectPageHeader' | ||
}; | ||
// Add sections | ||
addSections(appSchema, entitySet, manifest['sap.ui.generic.app'].pages, entityTypes); | ||
delete appSchema['definitions']['ObjectPageTable<GenericColumns>']; | ||
// Add actions | ||
addActions(appSchema, entitySet, entityTypes); | ||
delete appSchema['definitions']['GenericActions']; | ||
delete appSchema['definitions']['ObjectPageHeader<GenericActions>']; | ||
// Custom Section facets | ||
@@ -210,0 +261,0 @@ addRelatedFacetKeysType(appSchema, entitySet, entityTypes); |
@@ -9,2 +9,3 @@ "use strict"; | ||
const ObjectPage_1 = require("../../export/pages/ObjectPage"); | ||
const ObjectPageHeaderAction_1 = require("../../../../sync/v2/export/controls/ObjectPageHeaderAction"); | ||
/** | ||
@@ -79,3 +80,3 @@ * Prepares the list of flex changes | ||
facetId: facetID, | ||
newValue: change.content.newValue, | ||
newValue: change.content.newBinding ? change.content.newBinding : change.content.newValue, | ||
controlType: change.controlType | ||
@@ -129,3 +130,5 @@ }; | ||
for (const selector in flexChanges) { | ||
if (flexChanges[selector].propertyId === propertyKey && !flexChanges[selector].facetId) { | ||
if ((flexChanges[selector].propertyId === propertyKey && !flexChanges[selector].facetId) || | ||
(flexChanges[selector].propertyId === propertyKey && | ||
flexChanges[selector].facetId === 'action')) { | ||
configPart[propertyKey] = flexChanges[selector].newValue; | ||
@@ -224,2 +227,31 @@ break; | ||
/** | ||
* Fills the action of the configuration | ||
* @param actionProperties - current properties' list (of action) | ||
* @param configPart - the given part of the object page config | ||
* @param manifest - manifest.json of the app | ||
* @param jsonSchema - app specific schema | ||
* @param pageKeys - list of page keys (comprises the one entry describing the given page) | ||
* @param flexChanges - list of flex changes (pre-processed by prepareFlexChanges) | ||
*/ | ||
function fillActions(actionProperties, configPart, manifest, jsonSchema, pageKeys, flexChanges) { | ||
let actionId; | ||
for (const actionProperty in actionProperties) { | ||
actionId = actionProperty.replace(/\/@/g, '::'); | ||
let schemaAction = actionProperties[actionProperty]; | ||
if (schemaAction['$ref'] && schemaAction['$ref'].startsWith('#/definitions/ObjectPageActionV2')) { | ||
schemaAction = jsonSchema['definitions']['ObjectPageActionV2<' + actionId + '>']; | ||
if (flexChanges) { | ||
for (const flexChange in flexChanges) { | ||
if (flexChange.startsWith('action')) { | ||
// const ActionIdSchema: string; | ||
const ActionIdSchema = 'ObjectPageActionV2<' + actionId + '>'; | ||
configPart['actions'] = { [actionId]: new ObjectPageHeaderAction_1.Action() }; | ||
transferSettingsAndFlexChanges(configPart['actions'][actionId], manifest, jsonSchema['definitions'][ActionIdSchema], pageKeys, flexChanges); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
/** | ||
* Fill properties of object page confg based on manifest settings | ||
@@ -240,2 +272,6 @@ * @param objectPageConfig - Object page config (file content) | ||
transferSettingsAndFlexChanges(objectPageConfig.header, manifest, jsonSchema['definitions']['ObjectPageHeader'], pageKeys, flexChangesForTransfer); | ||
const action = jsonSchema['definitions']['HeaderActions']; | ||
if (action) { | ||
fillActions(action.properties, objectPageConfig.header, manifest, jsonSchema, pageKeys, flexChangesForTransfer); | ||
} | ||
if (Object.keys(objectPageConfig.header).length === 0) { | ||
@@ -242,0 +278,0 @@ delete objectPageConfig.header; |
{ | ||
"name": "@sap/ux-specification", | ||
"version": "1.76.17", | ||
"version": "1.76.18", | ||
"displayName": "SAP Fiori tools - Specification", | ||
@@ -34,3 +34,3 @@ "description": "Specification for Fiori elements", | ||
"iXiaSoftV4": "node dist/scripts/extractDocu.js --version=v4 --format=iXiaSoft", | ||
"postpublish": "npm dist-tag add @sap/ux-specification@1.76.17 UI5-1.77" | ||
"postpublish": "npm dist-tag add @sap/ux-specification@1.76.18 UI5-1.77" | ||
}, | ||
@@ -37,0 +37,0 @@ "publisher": "SAPSE", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
1964386
520
35422