Skip to content

Commit

Permalink
chore(cds-plugin-ui5): showcase formatter usage in TS running in CDS (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
petermuessig authored Mar 4, 2024
1 parent 4449224 commit 5237f66
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion showcases/cds-bookshop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"devDependencies": {
"cds-bookshop-ui5-viewer": "workspace:^",
"cds-plugin-ui5": "workspace:^",
"rimraf": "^5.0.5"
"rimraf": "^5.0.5",
"ui5-tsapp-simple": "workspace:^"
},
"scripts": {
"clean": "rimraf gen",
Expand Down
5 changes: 5 additions & 0 deletions showcases/ui5-tsapp-simple/webapp/model/Formatter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default {
formatValue: (value: string) => {
return value?.toUpperCase();
},
};
13 changes: 11 additions & 2 deletions showcases/ui5-tsapp-simple/webapp/view/Main.view.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<mvc:View controllerName="ui5.ecosystem.demo.simpletsapp.controller.Main" displayBlock="true" xmlns="sap.m" xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc">
<Page id="page" title="{i18n>appTitle}">
<mvc:View
controllerName="ui5.ecosystem.demo.simpletsapp.controller.Main"
displayBlock="true"
xmlns="sap.m"
xmlns:core="sap.ui.core"
xmlns:mvc="sap.ui.core.mvc"
core:require="{
Formatter: 'ui5/ecosystem/demo/simpletsapp/model/Formatter'
}"
>
<Page id="page" title="{formatter: 'Formatter.formatValue', path: 'i18n>appTitle'}">
<headerContent>
<core:Icon color="#1873B4" src="sap-icon://sap-ui5" size="2rem" />
</headerContent>
Expand Down

0 comments on commit 5237f66

Please sign in to comment.