SAP CAP Fiori Elements 应用配置 UI 的两种方式以及自定义 index.html

简介: SAP CAP Fiori Elements 应用配置 UI 的两种方式以及自定义 index.html

第一种方法

编辑 app 里的 manifest.json 文件:

37.png

{
    "_version": "1.32.0",
    "sap.app": {
    ...
    "sap.ui5": {
        ...
        "routing": {
            ...
            "targets": {
                ...
                "RisksObjectPage": {
                    ...
                    "options": {
                        "settings": {
                            "editableHeaderContent": true,
                            "entitySet": "Risks"
                        }
                    }
                }
            }
        },
        ...
}

第二种方法:修改 .cds 文件

给对应的 Fiori Elements 字段(forms 中的)添加 Label,以及 table column 字段添加 header

using RiskService from './risk-service';
annotate RiskService.Risks with {
    title       @title: 'Title';
    prio        @title: 'Priority';
    descr       @title: 'Description';
    miti        @title: 'Mitigation';
    impact      @title: 'Impact';
}

添加 value help:

annotate RiskService.Mitigations with {
ID @(
    UI.Hidden,
    Common: {
    Text: description
    }
);
description  @title: 'Description';
owner        @title: 'Owner';
timeline     @title: 'Timeline';
risks        @title: 'Risks';
}

SAP CAP 提供了一个本地实现的仿 Fiori Launchpad 的 container:

38.png

在一个 CAP Java 应用的 app 文件夹里放置一个自定义 index.html 会怎么样?

首先直接执行 cds watch 是无法工作的。

在应用的 app 文件夹里新建一个 index.html:

39.png

重启 SpringBoot 应用,这个 index.html 就生效了:

image.png

cds watch 默认在 app 文件夹中查找 index.html 文件。 如果 cds watch 找到这样的文件,它会将包含服务链接的默认页面替换为文件夹中的链接。 虽然这在许多情况下是有意义的,但出于开发目的,我们坚持使用 CDS 的索引页面并为我们的索引文件提供不同的名称。

但是在 Business Application Studio 环境里测试不通过:

image.png

看不到自定义 index.html 里的内容:

40.png

另外举一些例子,假设我想在 Fiori Elements List report 的表格控件里,将 table column 的文本进行自定义:

41.png

需要修改 web 应用里 fiori-service.cds 文件里对应的注解。

可以使用语法 annotate AdminService.Orders with 后面加实际的注解值。

42.png

Object Page 里的 tab 标签:

image.png

对应的注解源代码:

Facets                      : [
            {
                $Type  : 'UI.ReferenceFacet',
                Label  : '发货地址',
                Target : '@UI.FieldGroup#ShippingAddress'
            },
            {
                $Type  : 'UI.ReferenceFacet',
                Label  : '明细',
                Target : '@UI.FieldGroup#Details'
            },
            {
                $Type  : 'UI.ReferenceFacet',
                Label  : '{i18n>OrderItems}',
                Target : 'Items/@UI.LineItem'
            },
        ],

43.png



image.png

目录
相关文章
|
1月前
|
JavaScript
自定义全能搜索HTML源码
自定义全能搜索HTML源码
25 1
自定义全能搜索HTML源码
|
1月前
|
前端开发 搜索推荐 开发者
SAP UI5 sap.m.Column 控件的 minScreenWidth 属性介绍
SAP UI5 sap.m.Column 控件的 minScreenWidth 属性介绍
27 0
|
1月前
|
JavaScript 前端开发 开发者
SAP UI5 控件 sap.m.ListBase 的 inset 属性的作用介绍
SAP UI5 控件 sap.m.ListBase 的 inset 属性的作用介绍
15 0
|
1月前
|
Web App开发 数据采集 前端开发
纯技术讨论:如何让 SAP UI5 应用无法被别人在浏览器里调试 - 这种做法不推荐试读版
纯技术讨论:如何让 SAP UI5 应用无法被别人在浏览器里调试 - 这种做法不推荐试读版
15 0
|
16天前
element-ui中Form表单使用自定义验证规则
element-ui中Form表单使用自定义验证规则
10 0
|
20天前
什么是 SAP ABAP 里的 Subscreen
什么是 SAP ABAP 里的 Subscreen
15 1
什么是 SAP ABAP 里的 Subscreen
|
1月前
|
开发者 UED
关于 SAP UI5 sap.m.Column 的 demandPopin 属性
关于 SAP UI5 sap.m.Column 的 demandPopin 属性
15 0
|
1月前
SAP UI5 Link 控件的使用方法介绍 - 后续学习 Fiori Elements Smart Link 的基础试读版
SAP UI5 Link 控件的使用方法介绍 - 后续学习 Fiori Elements Smart Link 的基础试读版
15 0
|
1月前
|
UED
什么是 SAP Fiori 的 Technical Catalog 和 Business Catalog
什么是 SAP Fiori 的 Technical Catalog 和 Business Catalog
30 0
|
1月前
|
前端开发 UED
SAP Fiori 到底指什么
SAP Fiori 到底指什么
38 0