Skip to content

Add 5 new samples: CustomData, event arguments, wizard transitions - #10

Merged
oblomov-dev merged 4 commits into
mainfrom
claude/zealous-gauss-xq5d3a
Oct 1, 2026
Merged

oblomov-dev merged 4 commits into
mainfrom
claude/zealous-gauss-xq5d3a

Conversation

@oblomov-dev

Copy link
Copy Markdown
Member

Summary

Adds five new sample applications demonstrating advanced UI5 features: CustomData with writeToDom for CSS styling and test anchors, custom data attached to controls, event argument expressions and formatters, wizard page transitions, and popup-as-app dialogs. Also updates two existing samples with enhanced metadata-driven templating and nested view re-rendering.

Key Changes

New Samples:

  • Z2UI5_CL_SMP_APP_535: Demonstrates core:CustomData with writeToDom="true" to write bound values as HTML data-* attributes for CSS styling and stable test selectors
  • Z2UI5_CL_SMP_APP_536: Shows how to attach data objects to controls using the app: namespace shortcut and read them back with data() in event handlers
  • Z2UI5_CL_SMP_APP_537: Illustrates event argument expressions evaluated in the browser—field bindings, arithmetic/comparisons, formatters, and object literals—before sending to ABAP
  • Z2UI5_CL_SMP_APP_533: Wizard with multi-step navigation using view_display(transition_back = true) to reverse animations when going backward
  • Z2UI5_CL_SMP_APP_534: Popup-as-app pattern showing a dialog without its own view, allowing the caller's page to remain on screen

Updated Samples:

  • Z2UI5_CL_SMP_APP_173: Reworked to demonstrate metadata-driven UI with template:with, nested template:repeat, and template:if/elseif/else for dynamic form generation from a field catalogue
  • Z2UI5_CL_SMP_APP_176: Enhanced with a button to toggle column visibility and re-render only the nested view via nest_view_display() while keeping the main view on screen; moved to handwritten samples due to ASSIGN/FIELD-SYMBOL limitations in abap2js

Infrastructure:

  • Updated ABAP2UI5_SAMPLES_PIN to 2e998ef (2026-09-30)
  • Moved Z2UI5_CL_SMP_APP_176 from generated to handwritten in samples.json
  • Added orphan detection in generate.mjs to catch unlisted sample modules
  • Updated README.md sample count from 71/129 to 76/138
  • Added package-lock.json to .gitignore (no lockfile per cap2UI5 practice)

Notable Implementation Details

  • CustomData writeToDom requires expanded notation (core:CustomData elements) rather than the app:key="value" shortcut to reach the DOM
  • Event argument expressions use full binding syntax with $ or { prefix; results arrive as strings in ABAP (numbers as digits, booleans as "X" or empty)
  • Nested view re-rendering with nest_view_display() only updates the nested content, leaving the main view and page state unchanged
  • Wizard transitions use transition: this.client.cs_transition.slide and transition_back flag to control animation direction

https://claude.ai/code/session_01NVQ3JnU7R1QFQVgSoMK9RE

claude added 4 commits October 1, 2026 01:57
samples.test.mjs and the consumer test take the samples from the directory,
the differential test from scripts/samples.json. A module that is in the
directory but not in the file - left behind when a sample is dropped from
the list, or written by hand without an entry - is therefore packed, served
and started like any other, and never held to its ABAP original. generate
(and its --check, the CI gate) now names such a module and exits 1, as it
already does for a sample listed as generated and handwritten at once.

Two error paths say what is wrong instead of failing on the read: a listed
sample the checkout at the pin does not have (a mistyped name) is reported
as missing and counted as a failure rather than ending the run with ENOENT,
and originals.mjs says how to clone the checkout when there is none, as
generate.mjs does.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NVQ3JnU7R1QFQVgSoMK9RE
…originals

The pin was six commits behind abap2UI5/samples' main. Of the 71 samples
here, two originals changed since: Z2UI5_CL_SMP_APP_173 was reworked into a
metadata-driven table and form (template:with, a nested template:repeat,
template:if/elseif/else) and is translated again by abap2js, as before.
Z2UI5_CL_SMP_APP_176 gained a button that changes the layout table and
re-renders only the nested view - through ASSIGN mt_layout[ fname = `AGE` ]
TO FIELD-SYMBOL( ), which abap2js refuses - so it moves to the handwritten
list and follows its original's diff by hand, written as abap2js would
write it: the row is read as a copy and written back whole, as
Z2UI5_CL_SMP_APP_011 does for its LOOP ... REFERENCE INTO.

Both pass the differential test against their transpiled originals: 71
samples, now 240 roundtrips (the new TOGGLE_AGE event), no difference. The
README's status and table follow - abap2UI5/samples has 138 samples at this
commit; the nine new ones (531 to 539) are not translated here yet. abap2js
translates 533 to 537 of them and refuses 531, 532, 538 and 539.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NVQ3JnU7R1QFQVgSoMK9RE
The repository ships no lockfile on purpose - test.yml says so: the run
tests what an install gets today, as cap2UI5 and cap2UI5/samples-stack do.
But every `npm install` writes one, and it then sits in `git status` as an
untracked file waiting to be committed by mistake. samples-stack ignores it
already; this does the same.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NVQ3JnU7R1QFQVgSoMK9RE
abap2UI5/samples added nine samples between the old pin and 2e998ef. abap2js
translates five of them as they are, so they come in the generated way -
listed in samples.json, written by `npm run generate`, held to their
originals by the differential test (76 samples, 260 roundtrips, no
difference): 535 colours controls by their data with CustomData writeToDom,
536 attaches custom data to controls and reads it back on an event, 537
shows what an event argument can compute in the browser, and two are
helper apps of samples abap2js refuses - 533, the wizard with page
transitions that 531 calls, and 534, the popup-as-app that 532 calls. Like
469 and 489, the helpers are listed with the app that calls them.

534 shows a dialog and no view of its own, so the start test lists it with
186 as a sample that displays no MAIN view - in ABAP as here.

The other four wait for abap2js: 531 reads a constant of another class,
532 uses NEW outside the navigation, 538 VALUE #( OPTIONAL ), 539 SPLIT.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NVQ3JnU7R1QFQVgSoMK9RE
@oblomov-dev
oblomov-dev merged commit 5f181c8 into main Oct 1, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants