agjan 0.0.20 → 0.0.22
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.
- package/README.md +2 -1
- package/dist/adapters/claude-code.js +9 -3
- package/dist/auto.js +4 -0
- package/dist/baseline.js +11 -8
- package/dist/commands/check.js +65 -13
- package/dist/commands/gates.js +9 -1
- package/dist/commands/lint.js +16 -5
- package/dist/commands/new.js +4 -3
- package/dist/commands/setup.js +91 -81
- package/dist/config.js +24 -0
- package/dist/fix.js +13 -10
- package/dist/git.js +57 -9
- package/dist/launcher.js +9 -3
- package/dist/progress-view.js +35 -23
- package/dist/progress.js +103 -38
- package/dist/qa.js +18 -9
- package/dist/review-policy.js +12 -4
- package/dist/review.js +82 -35
- package/dist/schema.js +85 -0
- package/dist/scope.js +12 -4
- package/dist/tests-map.js +17 -11
- package/docs/guide.md +46 -7
- package/kit/domains/btp/domain.json +2 -2
- package/kit/hooks/guard.mjs +53 -9
- package/kit/skills/agjan-ask/SKILL.md +69 -0
- package/kit/skills/agjan-ask/references/sources.md +45 -0
- package/kit/skills/agjan-design/SKILL.md +13 -0
- package/kit/skills/agjan-fix/SKILL.md +1 -1
- package/kit/skills/agjan-spec/SKILL.md +7 -1
- package/kit/skills/agjan-spec/references/elicitation.md +135 -0
- package/kit/skills/btp-architect/SKILL.md +8 -3
- package/kit/skills/btp-architect/references/deployment.md +43 -0
- package/kit/skills/btp-architect/references/security.md +59 -4
- package/kit/skills/cap-developer/SKILL.md +20 -8
- package/kit/skills/cap-developer/references/agents.md +90 -0
- package/kit/skills/cap-developer/references/handlers.md +88 -9
- package/kit/skills/cap-developer/references/modeling.md +41 -0
- package/kit/skills/cap-developer/references/project-setup.md +57 -7
- package/kit/skills/cap-developer/references/services.md +172 -7
- package/kit/skills/cap-developer/references/testing.md +79 -6
- package/kit/skills/cap-developer/references/typescript.md +8 -7
- package/kit/skills/cap-developer/references/validation-security.md +74 -2
- package/kit/skills/fiori-developer/SKILL.md +22 -2
- package/kit/skills/fiori-developer/references/accessibility.md +65 -0
- package/kit/skills/fiori-developer/references/app-setup.md +10 -3
- package/kit/skills/fiori-developer/references/elements-cookbook.md +71 -0
- package/kit/skills/fiori-developer/references/elements.md +82 -9
- package/kit/skills/fiori-developer/references/freestyle-ts.md +27 -0
- package/kit/skills/fiori-developer/references/testing.md +5 -0
- package/kit/skills/fiori-developer/references/ui5-basics.md +34 -1
- package/kit/skills/qa-tester/SKILL.md +11 -4
- package/kit/skills/qa-tester/references/techniques.md +123 -0
- package/kit/skills/solution-reviewer/SKILL.md +10 -0
- package/kit/skills/solution-reviewer/references/defects.md +154 -0
- package/kit/templates/agents-block.md +3 -2
- package/kit/templates/agjan-ci.yml +3 -0
- package/package.json +1 -1
- package/schemas/config.schema.json +1 -1
- package/schemas/reviews.schema.json +1 -1
|
@@ -86,10 +86,8 @@ export class LeaveService extends cds.ApplicationService { override init() {
|
|
|
86
86
|
…
|
|
87
87
|
})
|
|
88
88
|
|
|
89
|
-
this.on(LeaveRequest.actions.
|
|
90
|
-
|
|
91
|
-
const n = await UPDATE(LeaveRequests, ID).where({ status_code: 'N' }).with({ status_code: 'A' })
|
|
92
|
-
if (!n) return req.reject(409, 'ONLY_NEW_REQUESTS')
|
|
89
|
+
this.on(LeaveRequest.actions.decline, async req => {
|
|
90
|
+
await UPDATE(req.subject).with({ reason: req.data.reason }) // the action's parameter
|
|
93
91
|
})
|
|
94
92
|
|
|
95
93
|
return super.init()
|
|
@@ -108,21 +106,24 @@ export class LeaveService extends cds.ApplicationService { override init() {
|
|
|
108
106
|
|
|
109
107
|
- `cds watch` detects `tsconfig.json` and runs the `.ts` files with tsx. Development only.
|
|
110
108
|
- Production: `cds build` compiles TypeScript with the `typescript` build task into
|
|
111
|
-
`gen/srv` (`.js` next to the CSN). Keep tests out of it with
|
|
109
|
+
`gen/srv` (`.js` next to the CSN). Keep tests and test tooling out of it with
|
|
110
|
+
`tsconfig.cdsbuild.json` (every `.ts` file it does not exclude is compiled and deployed;
|
|
111
|
+
a root `playwright.config.ts` ended up in `gen/srv` until it was excluded):
|
|
112
112
|
|
|
113
113
|
<!-- checked: tsconfig.cdsbuild.json -->
|
|
114
114
|
```json
|
|
115
115
|
{
|
|
116
116
|
"extends": "./tsconfig.json",
|
|
117
117
|
"compilerOptions": { "outDir": "./gen/srv" },
|
|
118
|
-
"exclude": ["node_modules", "gen", "app", "test"]
|
|
118
|
+
"exclude": ["node_modules", "gen", "app", "test", "playwright.config.ts"]
|
|
119
119
|
}
|
|
120
120
|
```
|
|
121
121
|
|
|
122
122
|
- Tests are `.ts` too, run by Node itself (type stripping, Node 22.18 or later). CAP
|
|
123
123
|
loads `.ts` service implementations only in TypeScript mode (`CDS_TYPESCRIPT`), which
|
|
124
124
|
must be set before `@sap/cds` loads: preload a setup file, and name the test files so
|
|
125
|
-
the runner does not take the setup for a test
|
|
125
|
+
the runner does not take the setup for a test. Without it the service runs without its
|
|
126
|
+
handlers and no error says so (testing.md, "Choosing the runner"):
|
|
126
127
|
|
|
127
128
|
<!-- checked: test/typescript.ts -->
|
|
128
129
|
```ts
|
|
@@ -19,7 +19,11 @@ handlers.
|
|
|
19
19
|
bound in parentheses to exclude it (`[(0), 100]`: above 0), use `_` for no bound
|
|
20
20
|
(`[(0), _]`: positive). On an `enum` element, `@assert.range` alone restricts input to
|
|
21
21
|
the enum values. (Open intervals and `_` need `@sap/cds` 8.5 or later.)
|
|
22
|
-
- `@assert.format: '<regex>'`: strings matching a pattern.
|
|
22
|
+
- `@assert.format: '<regex>'`: strings matching a pattern. Anchor it (`^…$`) and avoid
|
|
23
|
+
nested quantifiers (`(a+)+`): a regular expression that backtracks without end on a crafted
|
|
24
|
+
input is a denial of service.
|
|
25
|
+
- Lengths (`String(n)`) and decimal places (`Decimal(p,s)`) are checked by the type itself
|
|
26
|
+
(modeling.md); read-only and immutable elements are dropped from input (services.md).
|
|
23
27
|
- `@assert.target`: on a managed to-one association, checks that the referenced instance
|
|
24
28
|
exists (create and update). It validates user input; referential integrity is
|
|
25
29
|
`@assert.integrity`. A target created in the same deep insert is not found.
|
|
@@ -117,7 +121,7 @@ Default messages use the codes `ASSERT_MANDATORY`, `ASSERT_RANGE`, `ASSERT_ENUM`
|
|
|
117
121
|
service LeaveService {
|
|
118
122
|
@restrict: [
|
|
119
123
|
{ grant: ['READ', 'CREATE'], to: 'employee', where: 'employee_userId = $user' },
|
|
120
|
-
{ grant: ['READ', 'approve', '
|
|
124
|
+
{ grant: ['READ', 'approve', 'decline'], to: 'manager', where: 'employee.team.manager = $user' }
|
|
121
125
|
]
|
|
122
126
|
@odata.draft.enabled // Fiori elements creates and edits through drafts
|
|
123
127
|
entity LeaveRequests as projection on my.LeaveRequests { … };
|
|
@@ -139,6 +143,74 @@ service LeaveService {
|
|
|
139
143
|
and list them under "Run locally" in `docs/agjan/project.md`. Without the profile they also apply in production, where anyone could log in
|
|
140
144
|
with those passwords. Check: `NODE_ENV=production npx cds env get requires.auth.kind`
|
|
141
145
|
must not print `mocked` or `dummy`.
|
|
146
|
+
- Never reach rows in a handler that the user may not see: a query awaited in a handler is
|
|
147
|
+
not filtered by `@restrict` (handlers.md). Filter by the user yourself.
|
|
142
148
|
- Name roles after the spec's business roles; the same roles go into
|
|
143
149
|
`xs-security.json` (btp area). Every authorization change is a risk in the design and
|
|
144
150
|
gets its own review.
|
|
151
|
+
|
|
152
|
+
## What paths can reach (checked with @sap/cds 10.1)
|
|
153
|
+
|
|
154
|
+
`@restrict` filters the **rows** of the entity a request reads. Paths in a filter go
|
|
155
|
+
further: a projection with `*` keeps its associations, and a path follows them into
|
|
156
|
+
entities the service does not expose. In a copy of the example with a `salary` in
|
|
157
|
+
`Employees` and `Teams.members`, an employee who may read only their own request asked
|
|
158
|
+
`$filter=employee/team/members/any(m:m/salary gt 5500)`: their request came back (a
|
|
159
|
+
colleague earns more), and with 6500 not. That is an oracle on data no API returns,
|
|
160
|
+
although `$expand=employee` was refused because the target is not in `$metadata`. The
|
|
161
|
+
MCP `query` tool answered the same question (`exists employee.team.members[salary > 5500]`).
|
|
162
|
+
|
|
163
|
+
- **Expose a small projection of every association target** that a projection keeps, with
|
|
164
|
+
only the fields the service may show; CAP redirects the associations to it, so paths
|
|
165
|
+
reach only those fields:
|
|
166
|
+
|
|
167
|
+
```cds
|
|
168
|
+
@readonly @restrict: [{ grant: 'READ', where: 'userId = $user' }]
|
|
169
|
+
entity Employees as projection on my.Employees { userId, name, team }; // no salary
|
|
170
|
+
@readonly @restrict: [{ grant: 'READ', where: 'manager = $user' }]
|
|
171
|
+
entity Teams as projection on my.Teams { ID, name, manager }; // no members
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Then both questions answered 400 (`"salary" does not exist`, `"members" does not
|
|
175
|
+
exist`) and the example's tests still passed. A target's own `@restrict` applies when it
|
|
176
|
+
is read, not inside a path of another entity's filter: what the projection contains is
|
|
177
|
+
the limit.
|
|
178
|
+
- `excluding { employee }` also closes the path, but it removes the foreign key with it:
|
|
179
|
+
`@restrict` conditions and handlers that use it fail (500), and a key re-added as
|
|
180
|
+
`employee.userId as employee_userId` is read-only, so the handler could no longer set the
|
|
181
|
+
owner of a new request.
|
|
182
|
+
- Keep sensitive fields (salaries, health, ratings) out of entities that other exposed
|
|
183
|
+
entities reach by association, or reach them only through such projections. Test it:
|
|
184
|
+
a filter through each association to a sensitive field, as a user who may not see it
|
|
185
|
+
(qa-tester `techniques.md`).
|
|
186
|
+
|
|
187
|
+
## Personal data
|
|
188
|
+
|
|
189
|
+
When the spec involves people (employees, customers, contacts), the data protection rules
|
|
190
|
+
apply, and CAP automates them from annotations (CAP documentation, "Annotating Personal
|
|
191
|
+
Data"; confirm details with `search_docs`):
|
|
192
|
+
|
|
193
|
+
```cds
|
|
194
|
+
annotate my.Employees with @PersonalData : {
|
|
195
|
+
DataSubjectRole : 'Employee',
|
|
196
|
+
EntitySemantics : 'DataSubject' // or 'DataSubjectDetails', 'Other' (a request about one)
|
|
197
|
+
} {
|
|
198
|
+
userId @PersonalData.FieldSemantics : 'DataSubjectID';
|
|
199
|
+
name @PersonalData.IsPotentiallyPersonal;
|
|
200
|
+
// health data, religion, bank details: @PersonalData.IsPotentiallySensitive
|
|
201
|
+
}
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
- With the audit logging plugin (`cds add audit-logging`, `@cap-js/audit-logging`), reads of
|
|
205
|
+
sensitive and changes of personal fields are logged to the SAP Audit Log Service in
|
|
206
|
+
production and to the console in development. Adding it is a btp decision; annotating
|
|
207
|
+
the model is part of the cap design whenever the spec has personal data.
|
|
208
|
+
- Expose only the personal fields the use case needs (`excluding`), restrict who reads
|
|
209
|
+
them, and never write them to logs (`cds.log`) or error messages.
|
|
210
|
+
- The three obligations, and what CAP integrates for each (design decisions for the btp
|
|
211
|
+
area): *when was it stored or changed* is audit logging (above); *what do you store
|
|
212
|
+
about me* is personal data management; *delete what you store about me* is data
|
|
213
|
+
retention. CAP 10 adds the plugin `@cap-js/data-privacy` (beta in the CAP release of
|
|
214
|
+
June 2026) for SAP Data Privacy Integration: from the `@PersonalData` and `@ILM`
|
|
215
|
+
annotations it serves `/dpp/information` and `/dpp/retention`. Decide in the design when
|
|
216
|
+
the spec states such rights or retention periods.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: fiori-developer
|
|
3
|
-
description: Role knowledge for the fiori area of agjan (SAP Fiori elements and freestyle UI5 in TypeScript, app type decision, UI annotations, UI tests). Loaded by agjan-design and agjan-build when the fiori area is in scope.
|
|
3
|
+
description: Role knowledge for the fiori area of agjan (SAP Fiori elements and freestyle UI5 in TypeScript, app type decision, UI annotations, UI tests). Loaded by agjan-design and agjan-build when the fiori area is in scope. agjan-ask reads it to answer general questions.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# fiori-developer
|
|
@@ -66,10 +66,30 @@ then building blocks or custom sections and columns, and controller extensions l
|
|
|
66
66
|
|---|---|
|
|
67
67
|
| any UI5 code, views, i18n, `index.html`, CAP integration | `references/ui5-basics.md` |
|
|
68
68
|
| a new elements app: its files, TypeScript setup, `manifest.json`, `index.html`, serving and checking it | `references/app-setup.md` |
|
|
69
|
-
| an elements app (annotations, pages, value help, actions, side effects) | `references/elements.md` |
|
|
69
|
+
| an elements app (annotations, pages, value help, actions with confirmations and parameters, messages, side effects, draft status) | `references/elements.md` |
|
|
70
|
+
| accessibility: what Fiori elements does, what the app supplies, freestyle rules (landmarks, labels, headings, focus, shortcuts, announcements, target size), axe in the UI tests | `references/accessibility.md` |
|
|
71
|
+
| a requirement in the spec's words (default filters, required filters, tabs, highlighted rows, currencies, fields fixed after create, dependent value helps, inline rows, export, action texts and defaults) | `references/elements-cookbook.md` |
|
|
70
72
|
| a freestyle TypeScript app | `references/freestyle-ts.md` |
|
|
71
73
|
| UI tests (Playwright, optional; OPA5 in apps that have it) | `references/testing.md` |
|
|
72
74
|
|
|
75
|
+
## What every elements app gets right
|
|
76
|
+
|
|
77
|
+
Design each AC that a user does on a page down to these points, and build them; they are
|
|
78
|
+
what users notice first (`references/elements.md`):
|
|
79
|
+
|
|
80
|
+
- **Every action that changes what the page shows has a side effect**, or the page keeps the
|
|
81
|
+
old values until a reload; a button that may not run for a row is disabled per row
|
|
82
|
+
(`@Core.OperationAvailable`), not left to fail.
|
|
83
|
+
- **Hard-to-undo actions ask first** (`@Common.IsActionCritical`); **action parameters have
|
|
84
|
+
labels** (`@title`), or the dialog shows the technical name.
|
|
85
|
+
- **The service speaks to the user**: success as a toast (`req.notify`), errors with a
|
|
86
|
+
translated message and the field as target, so Fiori puts it at the field.
|
|
87
|
+
- **Users pick, they do not type** codes: value helps for every code and association,
|
|
88
|
+
readable texts next to IDs (`@Common.Text`).
|
|
89
|
+
- **Fields behave as the rules say**: mandatory, read-only, editable only on create
|
|
90
|
+
(`@Core.Immutable`), hidden; Create, Edit and Delete hidden where the service forbids them.
|
|
91
|
+
- **Every label is an i18n text**, and the app declares its locales.
|
|
92
|
+
|
|
73
93
|
## Both types
|
|
74
94
|
|
|
75
95
|
- The service comes first: the UI is built against the finished CAP service, and most ACs
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Accessibility
|
|
2
|
+
|
|
3
|
+
Distilled from the UI5 team's agent skill `ui5-best-practices-accessibility`
|
|
4
|
+
(`UI5/plugins-coding-agents`, Apache-2.0, commit `56bcdc8`) and SAP's UI5con 2026
|
|
5
|
+
accessibility hands-on (`SAP-samples/ui5con-2026-a11y-hands-on`, Apache-2.0), checked in a
|
|
6
|
+
browser with SAPUI5 1.145 on 2026-10-21. Rules restated; the UI5 API reference has the
|
|
7
|
+
details of each property.
|
|
8
|
+
|
|
9
|
+
UI5 builds most of accessibility into its controls (roles, keyboard handling, focus). What
|
|
10
|
+
it cannot know is the app's meaning: names, the outline of a page, what changed. That is
|
|
11
|
+
the app's part.
|
|
12
|
+
|
|
13
|
+
## Fiori elements: the app supplies the texts
|
|
14
|
+
|
|
15
|
+
The generated pages had no WCAG 2.2 A/AA violations in an axe scan (the example's list
|
|
16
|
+
report and object page). Their accessible names come from the annotations, so:
|
|
17
|
+
|
|
18
|
+
- every field, column, filter and action parameter has a label (`@title`, from i18n): a
|
|
19
|
+
screen reader reads the label, without one the technical name;
|
|
20
|
+
- every action has its `Label` or `@title`; `UI.HeaderInfo` has `TypeName` and `Title`;
|
|
21
|
+
- facets have a `Label` (they become the page's regions: the UI tests find them with
|
|
22
|
+
`getByRole('region', { name })`);
|
|
23
|
+
- messages come from the service in words a user understands (cap-developer
|
|
24
|
+
`handlers.md`).
|
|
25
|
+
|
|
26
|
+
Custom sections, columns and fragments are freestyle UI5: the rules below apply to them.
|
|
27
|
+
|
|
28
|
+
## Freestyle UI5: what to check
|
|
29
|
+
|
|
30
|
+
| Topic | Rule |
|
|
31
|
+
|---|---|
|
|
32
|
+
| **Landmarks** | `sap.m.Page` and `DynamicPage` get a `landmarkInfo` (`PageAccessibleLandmarkInfo`, `DynamicPageAccessibleLandmarkInfo`) with a role **and** a label for each area, so the page has one `main` and labeled regions; a sub-header of navigation (breadcrumbs) gets the role navigation; a `Panel` that is a region of its own gets `accessibleRole="Region"` (or `Complementary` for a side panel of filters). |
|
|
33
|
+
| **Labels** | Every input has a visible `Label` with `labelFor` (a `SimpleForm` or `Form` does this itself); where no visible label fits, `ariaLabelledBy` points at a text. An icon-only `Button` has a `tooltip`; an `Image` that shows content has `decorative="false"` **and** an `alt` (usually bound, `alt="{name}"`); a decorative one stays `decorative` (the default). A `Table` or `List` is named with `ariaLabelledBy` pointing at its title. A `Dialog` without a header (`showHeader="false"`) needs `ariaLabelledBy`; better, keep its `title`. |
|
|
34
|
+
| **Headings** | `sap.m.Title` renders `h2` unless `level` is set: give every title its level, one `H1` per page (the page title), sections `H2`, subsections `H3`, no level skipped. |
|
|
35
|
+
| **Focus and keyboard** | A `Dialog` or `Popover` sets `initialFocus` where the user should start; a large area that is a region of its own joins F6 navigation with `<core:CustomData key="sap-ui-fastnavgroup" value="true" writeToDom="true"/>`; never a `tabindex` above 0. |
|
|
36
|
+
| **Shortcuts** | Shortcuts for actions (Save, Delete) go through `core:CommandExecution` with the commands in `manifest.json` and buttons bound with `press="cmd:Save"`, so the button and the key do the same; always with a modifier key, never a bare letter. |
|
|
37
|
+
| **Changes the user cannot see** | A result that appears without a page change (saved, 3 results, an error) is also announced: `InvisibleMessage.getInstance().announce(text, InvisibleMessageMode.Polite)` (`Assertive` for errors), with the same text the page shows. |
|
|
38
|
+
| **Reading order** | The order in the view is the order a screen reader reads; do not reorder with CSS what should be read in another order. `ariaDescribedBy` points at elements that exist. |
|
|
39
|
+
| **Target size** | Small interactive texts (`Link`, `ObjectIdentifier`, `ObjectStatus` and similar) inside a list item or table cell get `reactiveAreaMode="Overlay"`, or spacing around them. |
|
|
40
|
+
|
|
41
|
+
All texts here come from i18n (with translator notes, `ui5-basics.md`).
|
|
42
|
+
|
|
43
|
+
## Checking it
|
|
44
|
+
|
|
45
|
+
- **The UI tests already check names:** a Playwright locator by role and name
|
|
46
|
+
(`getByRole('button', { name: 'Approve' })`) only finds a control whose accessible name
|
|
47
|
+
is that text. Locate by role and name, never by id or CSS (`testing.md`).
|
|
48
|
+
- **An axe scan per page** finds what names do not: missing landmarks, images without
|
|
49
|
+
`alt`, contrast. Where the spec has an accessibility requirement, add one to the UI
|
|
50
|
+
tests (`npm add -D @axe-core/playwright`; checked with 4.11 on the example, which had no
|
|
51
|
+
violations, and a planted image without `alt` was reported as critical):
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
import AxeBuilder from '@axe-core/playwright'
|
|
55
|
+
|
|
56
|
+
test('the request page has no accessibility violations', async ({ page }) => {
|
|
57
|
+
// … open the page as in the other tests, then:
|
|
58
|
+
const { violations } = await new AxeBuilder({ page })
|
|
59
|
+
.withTags(['wcag2a', 'wcag2aa', 'wcag21aa', 'wcag22aa']).analyze()
|
|
60
|
+
expect(violations.map(v => v.id)).toEqual([])
|
|
61
|
+
})
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
- Neither replaces a review of custom views with the topics above, and a screen reader
|
|
65
|
+
(VoiceOver, NVDA) on the main flow finds what no tool does.
|
|
@@ -95,7 +95,7 @@ builder:
|
|
|
95
95
|
"sap.app": {
|
|
96
96
|
"id": "leaves.requests",
|
|
97
97
|
"type": "application",
|
|
98
|
-
"i18n": "i18n
|
|
98
|
+
"i18n": { "bundleName": "leaves.requests.i18n.i18n", "supportedLocales": [""], "fallbackLocale": "" },
|
|
99
99
|
"applicationVersion": { "version": "1.0.0" },
|
|
100
100
|
"title": "{{appTitle}}",
|
|
101
101
|
"dataSources": {
|
|
@@ -108,7 +108,7 @@ builder:
|
|
|
108
108
|
"dependencies": { "minUI5Version": "1.136.0", "libs": { "sap.m": {}, "sap.ui.core": {}, "sap.fe.templates": {} } },
|
|
109
109
|
"contentDensities": { "compact": true, "cozy": true },
|
|
110
110
|
"models": {
|
|
111
|
-
"i18n": { "type": "sap.ui.model.resource.ResourceModel", "settings": { "bundleName": "leaves.requests.i18n.i18n" } },
|
|
111
|
+
"i18n": { "type": "sap.ui.model.resource.ResourceModel", "settings": { "bundleName": "leaves.requests.i18n.i18n", "supportedLocales": [""], "fallbackLocale": "" } },
|
|
112
112
|
"": { "dataSource": "mainService", "preload": true, "settings": { "operationMode": "Server", "autoExpandSelect": true, "earlyRequests": true } }
|
|
113
113
|
},
|
|
114
114
|
"routing": {
|
|
@@ -124,7 +124,7 @@ builder:
|
|
|
124
124
|
},
|
|
125
125
|
"LeaveRequestsObjectPage": {
|
|
126
126
|
"type": "Component", "id": "LeaveRequestsObjectPage", "name": "sap.fe.templates.ObjectPage",
|
|
127
|
-
"options": { "settings": { "contextPath": "/LeaveRequests", "editableHeaderContent": false } }
|
|
127
|
+
"options": { "settings": { "contextPath": "/LeaveRequests", "editableHeaderContent": false, "enhanceI18n": "i18n/fe-texts.properties" } }
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
}
|
|
@@ -135,7 +135,14 @@ builder:
|
|
|
135
135
|
- `_version` 2.0.0 with `minUI5Version` 1.136.0 or later: the linter rejects older
|
|
136
136
|
manifests. Do not use the deprecated `synchronizationMode` model setting.
|
|
137
137
|
- `dataSources.mainService.uri` is the service's path (`/odata/v4/<service path>/`).
|
|
138
|
+
- Say which locales the app's `webapp/i18n` has: with only `i18n.properties`,
|
|
139
|
+
`"supportedLocales": [""], "fallbackLocale": ""` in `sap.app.i18n` and in the i18n model.
|
|
140
|
+
Without it the UI5 tooling warns on every start that the fallback locale `en` is missing
|
|
141
|
+
(checked with `cds serve` and the UI5 linter, which reports no findings either way). An app
|
|
142
|
+
with `i18n_de.properties` lists `["", "de"]`.
|
|
138
143
|
- `contextPath` names the entity set; the object page route's pattern uses its name.
|
|
144
|
+
- `enhanceI18n` names a file of replaced standard texts for that page (here the
|
|
145
|
+
confirmation text of Approve, `elements-cookbook.md`).
|
|
139
146
|
|
|
140
147
|
## Component.ts
|
|
141
148
|
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Fiori elements cookbook: what the spec asks for, and how
|
|
2
|
+
|
|
3
|
+
Distilled from the SAP Fiori elements feature showcase (`SAP-samples/fiori-elements-feature-showcase`,
|
|
4
|
+
Apache-2.0, commit `ecbb43c`, 2026-06-09) and the SAPUI5 documentation behind it, written for
|
|
5
|
+
CAP CDS and the leave requests of the examples. Entries marked **checked** were tried in a
|
|
6
|
+
browser with SAPUI5 1.145 and `@sap/cds` 10.1 on 2026-10-21; every CDS snippet here
|
|
7
|
+
compiles with `cds compile srv app --to edmx`. Rules restated; the showcase README (search
|
|
8
|
+
term per feature) and `search_docs` have the details.
|
|
9
|
+
|
|
10
|
+
Read `elements.md` first. Annotations before `manifest.json`, `manifest.json` before code.
|
|
11
|
+
Manifest settings go under the page's target in `sap.ui5.routing.targets.<target>.options.settings`;
|
|
12
|
+
the Application Modeler of SAP Fiori tools writes them too.
|
|
13
|
+
|
|
14
|
+
## List report: finding the right rows
|
|
15
|
+
|
|
16
|
+
| The spec says | Use |
|
|
17
|
+
|---|---|
|
|
18
|
+
| "by default the list shows open requests" | `status @Common.FilterDefaultValue : 'N'` on the element (**checked**: the filter starts with the token `N`, the code, not its text). It is ignored once the user picks another variant; for several values or a range use a `UI.SelectionPresentationVariant`. |
|
|
19
|
+
| "the user must choose a type before searching" | `Capabilities.FilterRestrictions : { RequiredProperties : [ type_code ] }` on the entity (**checked**: the field gets a `*`, and Go without it says "Type is a required field."). Nothing loads until it is filled, so use it only where the list is too big to show unfiltered. |
|
|
20
|
+
| "fewer filters to choose from" | `@UI.HiddenFilter` on elements nobody filters by; `UI.FilterFacets : [ { Target : '@UI.FieldGroup#Request', Label : … } ]` groups the rest in Adapt Filters. |
|
|
21
|
+
| "search regardless of upper or lower case" | `annotate LeaveService with @Capabilities.FilterFunctions : [ 'tolower' ];` (the whole service: filter bar, table filters, value helps). |
|
|
22
|
+
| "filter by period: this year, last month" | Semantic dates for a `Date` field: `Capabilities.FilterRestrictions : { FilterExpressionRestrictions : [ { Property : 'startDate', AllowedExpressions : 'SingleRange' } ] }`; a default range in the manifest, `controlConfiguration["@com.sap.vocabularies.UI.v1.SelectionFields"].filterFields.startDate.settings.defaultValues: [{ "operator": "LASTYEARS", "values": [1] }]` (operators in capitals). |
|
|
23
|
+
| "tabs: open, approved, all" | One `UI.SelectionVariant #open : { Text : '{i18n>Open}', SelectOptions : [ { PropertyName : status_code, Ranges : [ { Sign : #I, Option : #EQ, Low : 'N' } ] } ] }` per view. In the manifest, `views.paths: [{ "key": "open", "annotationPath": "com.sap.vocabularies.UI.v1.SelectionVariant#open" }, …]` gives tabs with a table each (they may show other entity sets or `SelectionPresentationVariant`s with other columns), or `controlConfiguration["@com.sap.vocabularies.UI.v1.LineItem"].tableSettings.quickVariantSelection.paths` gives a segmented button over one table. `showCounts: true` costs one `$count` request per view. |
|
|
24
|
+
| "sorted by start date" | `UI.PresentationVariant : { SortOrder : [ { Property : startDate, Descending : true } ], Visualizations : [ '@UI.LineItem' ] }` |
|
|
25
|
+
|
|
26
|
+
## List report: reading the rows
|
|
27
|
+
|
|
28
|
+
| The spec says | Use |
|
|
29
|
+
|---|---|
|
|
30
|
+
| "requests that need attention stand out" | `UI.LineItem.@UI.Criticality : status.criticality` on the entity colors the row's edge (**checked**: rows get the warning highlight for criticality 2), besides the colored status cell (`Criticality` in the `DataField`). |
|
|
31
|
+
| "amount with its currency", "quantity with its unit" | `amount @Measures.ISOCurrency : currency_code`, `quantity @Measures.Unit : unit_code`, `percent @Measures.Unit : '%'`: one column shows both, and personalization cannot separate them. The decimals shown follow the type's scale. |
|
|
32
|
+
| "number and name in one column" | `@Common.Text` with `@Common.TextArrangement` (`elements.md`); several values: a `UI.FieldGroup` referenced with `UI.DataFieldForAnnotation`. |
|
|
33
|
+
| "the request number in bold, with the draft state" | `@Common.SemanticKey : [ requestNo ]` and the field in `UI.LineItem` (`elements.md`). |
|
|
34
|
+
| "a link to the document" | `{ $Type : 'UI.DataFieldWithUrl', Value : documentName, Url : documentUrl }` in `UI.LineItem`. |
|
|
35
|
+
| "select several and act on all" | `tableSettings: { "selectionMode": "Multi" }` under the `LineItem` control configuration; a bound action in the toolbar then runs for every selected row. |
|
|
36
|
+
| "many actions, one button" | `controlConfiguration["@com.sap.vocabularies.UI.v1.LineItem"].actions.<id>: { "text": "{i18n>More}", "menu": ["DataFieldForAction::LeaveService.approve", …] }`; an unbound action is `DataFieldForAction::LeaveService.EntityContainer::<name>`. |
|
|
37
|
+
|
|
38
|
+
## Creating and editing
|
|
39
|
+
|
|
40
|
+
| The spec says | Use |
|
|
41
|
+
|---|---|
|
|
42
|
+
| "the start date is set when the request is created and cannot change" | `startDate @Core.Immutable` (**checked**: Create first opens a "New Object" dialog asking for every immutable field, Continue then opens the draft; the service ignores later changes, cap-developer `services.md`). Every immutable field is in that dialog, so keep them few. |
|
|
43
|
+
| "a hint in the empty field" | `comment @UI.Placeholder : '{i18n>CommentPlaceholder}'` (**checked**: the text field shows it while empty; a path to a property also works). |
|
|
44
|
+
| "only drafts can be edited, approved ones not" | Path-based restrictions on the entity: `UI.UpdateHidden : <Boolean path or expression>` hides Edit (`Capabilities.UpdateRestrictions` would make fields read-only but keep the button), `UI.CreateHidden`, `Capabilities.DeleteRestrictions : { Deletable : <Boolean path> }`. The service still enforces it (`@restrict`). |
|
|
45
|
+
| "start and end as one field" | `UI.ConnectedFields #period : { Label : '{i18n>Period}', Template : '{startDate} – {endDate}', Data : { startDate : { $Type : 'UI.DataField', Value : startDate }, endDate : { $Type : 'UI.DataField', Value : endDate } } }`, referenced from a `UI.FieldGroup` with `{ $Type : 'UI.DataFieldForAnnotation', Target : '@UI.ConnectedFields#period' }`. Forms only, not tables or headers; `$Type` in `Data` is required. |
|
|
46
|
+
| "regions of the chosen country only" | Dependent value help: in the `@Common.ValueList` of `region`, add `{ $Type : 'Common.ValueListParameterIn', LocalDataProperty : country_code, ValueListProperty : 'country_code' }` (a `…FilterOnly` parameter keeps that column out of the dialog's filters). A fixed filter is `{ $Type : 'Common.ValueListParameterConstant', ValueListProperty : 'country_code', Constant : 'DE' }`. |
|
|
47
|
+
| "a few choices shown at once" | Radio buttons instead of a dropdown: `type @(Common : { ValueListWithFixedValues.@Common.ValueListShowValuesImmediately })` with the fixed-values value list. Pages only, not action dialogs; the CDS compiler warns that this nested annotation is experimental, so use it only when the spec asks. |
|
|
48
|
+
| "add items in the table directly" | On the object page, for a composition's table: `controlConfiguration["items/@com.sap.vocabularies.UI.v1.LineItem"].tableSettings.creationMode: { "name": "Inline", "createAtEnd": true }`. |
|
|
49
|
+
| "download the table to Excel" | List reports offer Export by default; object page tables need `tableSettings: { "enableExport": true }`. |
|
|
50
|
+
| "the header fields are not editable" | `"editableHeaderContent": false` on the object page target (the example sets it). |
|
|
51
|
+
| "a section only in edit mode" | `@UI.Hidden : IsActiveEntity` on the facet (`UI.ReferenceFacet`); `UI.Hidden` takes a Boolean path or value, no expressions. |
|
|
52
|
+
|
|
53
|
+
## Actions
|
|
54
|
+
|
|
55
|
+
| The spec says | Use |
|
|
56
|
+
|---|---|
|
|
57
|
+
| "ask before approving", with its own text | `@Common.IsActionCritical` (`elements.md`), and the text in a file the target names: `"enhanceI18n": "i18n/fe-texts.properties"` in the object page target's settings, with `C_OPERATIONS_ACTION_CONFIRM_MESSAGE\|LeaveRequests\|approve=Approve this request? The employee is informed.` (**checked**: the dialog shows that text instead of "Perform this action?"). Other standard texts can be replaced the same way (keys in the SAPUI5 documentation, "Localization of UI Texts"). |
|
|
58
|
+
| "the user enters a value for the action, with a suggestion" | Annotations on the parameter in the service's action definition: `action extend(@(title : '{i18n>Days}', UI.ParameterDefaultValue : 1) days : Integer)`; a value help for a parameter is a `@Common.ValueList` on it, written the same way, with `LocalDataProperty : days`. |
|
|
59
|
+
| "the user is told it worked" | `req.notify` in the service: a toast (`elements.md`). |
|
|
60
|
+
| "go to the related app" | `UI.DataFieldForIntentBasedNavigation` with `SemanticObject` and `Action`, and the target app's `crossNavigation.inbounds`; it works inside SAP Build Work Zone, not in a standalone `index.html` (btp-architect). |
|
|
61
|
+
|
|
62
|
+
## Layout
|
|
63
|
+
|
|
64
|
+
- **List and object side by side** (Flexible Column Layout): set it in the Application
|
|
65
|
+
Modeler (Page Map, global page settings); it changes `routing` and the targets.
|
|
66
|
+
- **Header facets** (key figures in the object page header): `UI.HeaderFacets` with
|
|
67
|
+
`UI.ReferenceFacet`s to `UI.DataPoint`s (a value with criticality, a rating, a progress
|
|
68
|
+
bar) or a `UI.FieldGroup`. Keep it to what users decide with.
|
|
69
|
+
- Micro charts, contact quick views, custom sections and columns are in the showcase
|
|
70
|
+
(search terms in its README); prefer annotations, and building blocks before controller
|
|
71
|
+
code (`elements.md`, Extensions).
|
|
@@ -8,6 +8,9 @@ Distilled from the SAPUI5 and SAP Fiori tools documentation (`SAP-docs/sapui5`,
|
|
|
8
8
|
browser with `@sap/cds` 10.1 and SAPUI5 1.14x on 2026-10-18. Rules restated; check details
|
|
9
9
|
and current syntax with `search_docs`.
|
|
10
10
|
|
|
11
|
+
For a requirement in the spec's own words ("by default only open requests", "tabs per
|
|
12
|
+
status", "regions of the chosen country"), look it up in `elements-cookbook.md`.
|
|
13
|
+
|
|
11
14
|
## Where things go
|
|
12
15
|
|
|
13
16
|
- UI annotations in the app's `annotations.cds` (`app/<app>/annotations.cds`), pulled in by
|
|
@@ -54,6 +57,15 @@ and current syntax with `search_docs`.
|
|
|
54
57
|
- Read-only, mandatory and hidden: `@readonly` and `@mandatory` in CDS first; the
|
|
55
58
|
`Common.FieldControl` and `UI.Hidden` annotations for conditions
|
|
56
59
|
(`@Common.FieldControl: #Mandatory`, or path-based to a property).
|
|
60
|
+
- Editable when created, read-only afterwards (a number, a start that must not move):
|
|
61
|
+
`@Core.Immutable` on the element; the service also ignores later changes to it
|
|
62
|
+
(cap-developer `services.md`).
|
|
63
|
+
- Code lists get a value help from CAP by themselves, labeled with the entity's name and
|
|
64
|
+
showing only the code; annotate the field as in the example for a readable column and a
|
|
65
|
+
dropdown.
|
|
66
|
+
- Draft status in lists: with `@Common.SemanticKey: [<field>]` on the entity and that field
|
|
67
|
+
in `UI.LineItem`, Fiori shows "Draft", "Locked by …" and "Unsaved changes" in that column
|
|
68
|
+
(SAPUI5 documentation); without a semantic key the place depends on the table type.
|
|
57
69
|
|
|
58
70
|
## Actions
|
|
59
71
|
|
|
@@ -62,6 +74,25 @@ and current syntax with `search_docs`.
|
|
|
62
74
|
page header). The action's authorization is the service's `@restrict`.
|
|
63
75
|
- Do not use determining actions (`Determining: true`) for new designs; they are
|
|
64
76
|
deprecated.
|
|
77
|
+
- **Critical actions ask first:** `@Common.IsActionCritical` on the action makes Fiori ask
|
|
78
|
+
"Perform this action?" (OK, Cancel) before it runs. Use it for what is hard to undo
|
|
79
|
+
(approve, delete, send). It works only for actions without a parameter dialog; an action
|
|
80
|
+
with parameters already shows a dialog.
|
|
81
|
+
- **Parameters are a dialog:** an action with parameters opens a dialog with one field per
|
|
82
|
+
parameter, named by its `@title`, or by the raw parameter name without one. In the
|
|
83
|
+
`actions { … }` block the action's own annotations come first, then the parameters:
|
|
84
|
+
`decline @Core.OperationAvailable : … (reason @title : '{i18n>Reason}' @UI.MultiLineText);`.
|
|
85
|
+
`@mandatory` on the parameter (in the service) marks it required.
|
|
86
|
+
- **What the action says back:** the service's message decides how Fiori answers:
|
|
87
|
+
`req.notify` a toast, `req.info` and `req.warn` a dialog to close, `req.reject` an error
|
|
88
|
+
dialog with its message (cap-developer `handlers.md`). A confirmation of success is a toast.
|
|
89
|
+
- **Actions of a status flow** (`@flow.status`, cap-developer `services.md`) get their
|
|
90
|
+
buttons, enablement and refresh from CAP: in the object page header and, as well, in the
|
|
91
|
+
list's table toolbar (select a row, then act). Give each action a `@title`, or the
|
|
92
|
+
buttons show `{i18n>approve}`; to keep one out of the list, put it in `UI.LineItem`
|
|
93
|
+
yourself with `![@UI.Hidden]: true`. UI tests then find a second button of that name:
|
|
94
|
+
wait for the object page (its heading) before locating it.
|
|
95
|
+
- All checked in a browser with SAPUI5 1.145 on 2026-10-21 (the example below).
|
|
65
96
|
- Paths in annotations of a bound action start with its binding parameter (`in/…`): see
|
|
66
97
|
"Paths in action annotations" below.
|
|
67
98
|
|
|
@@ -75,6 +106,41 @@ and current syntax with `search_docs`.
|
|
|
75
106
|
|
|
76
107
|
## Extensions
|
|
77
108
|
|
|
109
|
+
When annotations and `manifest.json` settings cannot do what the spec asks, extend in this
|
|
110
|
+
order, each step keeping more of what Fiori elements provides (the SAP Fiori development
|
|
111
|
+
portal, `https://ui5.sap.com/test-resources/sap/fe/core/fpmExplorer/index.html`, shows
|
|
112
|
+
each with running samples):
|
|
113
|
+
|
|
114
|
+
1. **Building blocks** (`sap.fe.macros`): `macros:Table`, `macros:FilterBar`,
|
|
115
|
+
`macros:Field`, `macros:Chart` render from the annotations with the full behavior
|
|
116
|
+
(personalization, export, value helps, draft). A `FilterBar` and a `Table` work
|
|
117
|
+
together through the table's `filterBar="<FilterBar id>"`.
|
|
118
|
+
2. **A custom section** on the object page, or a custom column or action: a fragment
|
|
119
|
+
registered in the page target's settings, which can hold building blocks. Checked in a
|
|
120
|
+
browser with SAPUI5 1.145 (the section appeared after "Decision", as a region named by
|
|
121
|
+
its title, with the field's value formatted like the page's):
|
|
122
|
+
|
|
123
|
+
```json
|
|
124
|
+
"content": { "body": { "sections": { "notes": {
|
|
125
|
+
"template": "leaves.requests.ext.fragment.Notes",
|
|
126
|
+
"position": { "placement": "After", "anchor": "decision" },
|
|
127
|
+
"title": "{i18n>Notes}" } } } }
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
```xml
|
|
131
|
+
<core:FragmentDefinition xmlns:core="sap.ui.core" xmlns:macros="sap.fe.macros">
|
|
132
|
+
<macros:Field id="startDateField" metaPath="startDate" readOnly="true"/>
|
|
133
|
+
</core:FragmentDefinition>
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
The `anchor` is the `ID` of a facet in the annotations (`UI.ReferenceFacet` with `ID`).
|
|
137
|
+
3. **A custom page** (the "Custom Page" template of the Fiori tools generator) built from
|
|
138
|
+
building blocks, inside the same app and routing.
|
|
139
|
+
4. **A controller extension** for behavior (edit flow, routing, navigation), registered in
|
|
140
|
+
`manifest.json` and working through the page's `ExtensionAPI`.
|
|
141
|
+
|
|
142
|
+
Freestyle content in sections and pages follows `ui5-basics.md` and `accessibility.md`.
|
|
143
|
+
|
|
78
144
|
- In controller extensions and custom code, use only the documented `extensionAPI` and
|
|
79
145
|
building block APIs. Never access or change controls, models or other objects the
|
|
80
146
|
framework creates internally: they change between versions.
|
|
@@ -88,10 +154,12 @@ Annotations of a bound action address the entity through its **binding parameter
|
|
|
88
154
|
CAP names `in` (`@cds.odata.bindingparameter.name: '_it'` renames it). Paths without the
|
|
89
155
|
prefix are wrong here.
|
|
90
156
|
|
|
91
|
-
- `@Core.OperationAvailable
|
|
92
|
-
|
|
157
|
+
- `@Core.OperationAvailable : ($self.canDecide)` enables the button per row (a Boolean
|
|
158
|
+
element, for example a virtual one set in an after-READ handler); CAP writes the path
|
|
159
|
+
as `in/canDecide`. Prefer this expression form to `{ $edmJson: { $Path: 'in/canDecide' } }`,
|
|
160
|
+
which a status flow replaces with its own condition (checked with `@sap/cds` 10.1).
|
|
93
161
|
- `@Common.SideEffects: { TargetProperties: ['in/status_code', 'in/canDecide'] }` refreshes
|
|
94
|
-
those fields after the action (no draft needed).
|
|
162
|
+
those fields after the action (no draft needed); a status flow adds its status itself.
|
|
95
163
|
- **Checked in a browser:** with the side effect, the status shows the new value right
|
|
96
164
|
after the click and the button disables itself; **without it, the page keeps the old
|
|
97
165
|
status and the enabled button** until a reload. An action that changes data shown on the
|
|
@@ -108,7 +176,8 @@ app may delete or create (Fiori shows Delete otherwise), path-based
|
|
|
108
176
|
|
|
109
177
|
`app/requests/annotations.cds` for the leave requests of `cap-developer`'s examples: list
|
|
110
178
|
report with filters and a colored status, object page with two sections, value helps as
|
|
111
|
-
dropdowns, Approve and Reject buttons enabled per row and refreshing the page
|
|
179
|
+
dropdowns, Approve and Reject buttons enabled per row and refreshing the page, Approve
|
|
180
|
+
confirmed by the user, Reject asking for a labeled reason.
|
|
112
181
|
|
|
113
182
|
<!-- checked: app/requests/annotations.cds -->
|
|
114
183
|
```cds
|
|
@@ -132,7 +201,7 @@ annotate service.LeaveRequests with @(
|
|
|
132
201
|
],
|
|
133
202
|
UI.Identification : [
|
|
134
203
|
{ $Type : 'UI.DataFieldForAction', Action : 'LeaveService.approve', Label : '{i18n>Approve}' },
|
|
135
|
-
{ $Type : 'UI.DataFieldForAction', Action : 'LeaveService.
|
|
204
|
+
{ $Type : 'UI.DataFieldForAction', Action : 'LeaveService.decline', Label : '{i18n>Reject}' },
|
|
136
205
|
],
|
|
137
206
|
UI.Facets : [
|
|
138
207
|
{ $Type : 'UI.ReferenceFacet', ID : 'request', Label : '{i18n>Request}', Target : '@UI.FieldGroup#Request' },
|
|
@@ -165,10 +234,14 @@ annotate service.LeaveRequests with {
|
|
|
165
234
|
};
|
|
166
235
|
|
|
167
236
|
annotate service.LeaveRequests actions {
|
|
168
|
-
approve @
|
|
169
|
-
@
|
|
170
|
-
|
|
171
|
-
@Common.SideEffects : { TargetProperties : [ 'in/
|
|
237
|
+
approve @title : '{i18n>Approve}'
|
|
238
|
+
@Core.OperationAvailable : ($self.canDecide) // the flow would only check the status
|
|
239
|
+
@Common.IsActionCritical
|
|
240
|
+
@Common.SideEffects : { TargetProperties : [ 'in/canDecide' ] }; // the flow adds the status
|
|
241
|
+
decline @title : '{i18n>Reject}' // the spec's word
|
|
242
|
+
@Core.OperationAvailable : ($self.canDecide)
|
|
243
|
+
@Common.SideEffects : { TargetProperties : [ 'in/reason', 'in/canDecide' ] }
|
|
244
|
+
(reason @title : '{i18n>Reason}' @UI.MultiLineText);
|
|
172
245
|
};
|
|
173
246
|
```
|
|
174
247
|
|
|
@@ -41,6 +41,33 @@ Distilled from the UI5 MCP server's guidelines (`get_guidelines`,
|
|
|
41
41
|
- Data comes through the OData V4 model declared in `manifest.json`, never through `fetch`
|
|
42
42
|
to the service. Navigation through the router and routes in `manifest.json`.
|
|
43
43
|
|
|
44
|
+
## Tables
|
|
45
|
+
|
|
46
|
+
In an OData V4 app, prefer a Fiori elements page or its table building block; a
|
|
47
|
+
freestyle table only where those cannot do what the spec asks. Then pick by data and
|
|
48
|
+
device (the UI5 team's table guidance):
|
|
49
|
+
|
|
50
|
+
| Table | For | Not for |
|
|
51
|
+
|---|---|---|
|
|
52
|
+
| `sap.m.Table` (`items`) | responsive and mobile layouts, pop-in columns, up to a few hundred rows with `growing` | large data sets that need virtual scrolling |
|
|
53
|
+
| `sap.ui.table.Table` (`rows`) | desktop, many rows (virtual scrolling), fixed columns, dense data | mobile-first layouts, wrapped text in cells |
|
|
54
|
+
| `sap.ui.table.TreeTable` | hierarchies (expand, collapse) | flat data or groups |
|
|
55
|
+
| `sap.ui.mdc.Table` | OData V4 freestyle with the delegate pattern | JSON-only or simple apps |
|
|
56
|
+
|
|
57
|
+
- `items` belongs to `sap.m.Table`, `rows` to `sap.ui.table.*`; never swapped. Its row
|
|
58
|
+
count is set with the `rowMode` aggregation (1.119 and later), not
|
|
59
|
+
`visibleRowCountMode`.
|
|
60
|
+
- Every table has `ariaLabelledBy` pointing at its title (`accessibility.md`).
|
|
61
|
+
- Numbers and dates right-aligned (`hAlign="End"`), text left; display cells `Text`,
|
|
62
|
+
amounts `ObjectNumber`, navigation `Link`. One interactive control per cell of a grid
|
|
63
|
+
table, and no text wrapping there (it breaks virtual scrolling).
|
|
64
|
+
- Personalization (columns, sort, filter) through `sap.m.p13n.Engine`, never a dialog of
|
|
65
|
+
your own. Spreadsheet export through `sap.ui.export.Spreadsheet`, after checking the
|
|
66
|
+
library is loaded.
|
|
67
|
+
- A row's `highlight` takes a value state (`None`, `Success`, `Warning`, `Error`,
|
|
68
|
+
`Information`): bind it to a field that holds one (the service can provide it), not a
|
|
69
|
+
formatter.
|
|
70
|
+
|
|
44
71
|
## Tests
|
|
45
72
|
|
|
46
73
|
- QUnit for logic and OPA5 for user journeys an AC needs, in TypeScript:
|
|
@@ -102,6 +102,11 @@ Rules, each learned on a Fiori elements app:
|
|
|
102
102
|
section (`getByRole('region', { name: 'Request' })`) or a dialog.
|
|
103
103
|
- **Pick values from the value help**; text typed into a value-list field is not
|
|
104
104
|
selected and the draft fails with "Provide the missing value".
|
|
105
|
+
- **Answer the dialogs the app opens**: a critical action's confirmation
|
|
106
|
+
(`getByRole('alertdialog', { name: /Confirmation/ })`, then OK), an action's parameter
|
|
107
|
+
dialog (`getByRole('dialog', { name: '<action label>' })`, then its fields by label). A
|
|
108
|
+
success toast is asserted with `getByText(<message>)`; it disappears after a few
|
|
109
|
+
seconds.
|
|
105
110
|
- **One user per `test.describe`** with `httpCredentials` (the mocked users' basic
|
|
106
111
|
authentication); never put a password in a URL.
|
|
107
112
|
- **Click Go** on a list report before reading rows; wait with `expect(...)`, never with
|
|
@@ -25,9 +25,42 @@ Distilled from the UI5 MCP server's development guidelines (`get_guidelines`,
|
|
|
25
25
|
- Format with types and format options, not with custom formatters: prefer the OData
|
|
26
26
|
types (`sap.ui.model.odata.type.Decimal`, `.String`, `.DateTime`, ...), which work with
|
|
27
27
|
every model; use `sap.ui.model.type.*` only where no OData type exists. A formatter is
|
|
28
|
-
for business logic no type covers.
|
|
28
|
+
for business logic no type covers. Checked in a browser with SAPUI5 1.145: `Decimal` on
|
|
29
|
+
a JSON model showed `1234567.5` as "1,234,567.50" and rejected a third decimal with
|
|
30
|
+
scale 2. There is no `sap.ui.model.odata.v4.type` namespace (some guidance names one).
|
|
31
|
+
- A value that the user enters gets a type too (two-way binding): the type checks and
|
|
32
|
+
converts it; a formatter cannot. For a check no type has, a custom type extends
|
|
33
|
+
`sap/ui/model/SimpleType` (`formatValue`, `parseValue`, `validateValue`).
|
|
29
34
|
- A new or changed key in `i18n.properties` goes into **every** locale file of the app
|
|
30
35
|
(`i18n_de.properties`, ...).
|
|
36
|
+
- **Every text gets a note for its translators**, the line before its key:
|
|
37
|
+
`#<type>[,<maximum length>][: what it is and where it appears]`. The type is SAP's text
|
|
38
|
+
classification, which the translation tools read (the OpenUI5 guideline "Annotations in
|
|
39
|
+
Translation Files" lists all of them):
|
|
40
|
+
|
|
41
|
+
| Type | For |
|
|
42
|
+
|---|---|
|
|
43
|
+
| `XFLD` | a field label |
|
|
44
|
+
| `XCOL` | a column header |
|
|
45
|
+
| `XBUT` | a button (give a length: buttons have little room) |
|
|
46
|
+
| `XTIT`, `XGRP` | a title; a group or section title |
|
|
47
|
+
| `XTOL` | a tooltip |
|
|
48
|
+
| `XMSG` | a message under 120 characters |
|
|
49
|
+
| `YMSG`, `YINS` | a message or an instruction of 120 characters or more |
|
|
50
|
+
| `XTXT` | any other short text |
|
|
51
|
+
| `NOTR` | a text that is not translated (a product name) |
|
|
52
|
+
|
|
53
|
+
<!-- checked: _i18n/i18n.properties -->
|
|
54
|
+
```properties
|
|
55
|
+
#XFLD: why the manager rejected the request
|
|
56
|
+
Reason=Reason
|
|
57
|
+
#XBUT,20: the manager accepts the request
|
|
58
|
+
Approve=Approve
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
The note says what a translator cannot see: "Change" as money given back is another
|
|
62
|
+
word than "Change" as edit. The same holds for the service's `_i18n` files
|
|
63
|
+
(cap-developer `project-setup.md`).
|
|
31
64
|
|
|
32
65
|
## Forms
|
|
33
66
|
|