@smartbit4all/ng-client 7.3.0 → 7.3.2

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/HTML-WIDGET.md CHANGED
@@ -461,6 +461,7 @@ megy le, és egy újra-feloldás már a leküldött erőforrások közül válas
461
461
  ```html
462
462
  <div class="card" data-sb4-action="OPEN_ENTRY">…</div>
463
463
  <li data-sb4-action="REMOVE_MEMBER" data-sb4-action-identifier="{{id}}">…</li>
464
+ <div data-sb4-action="OPEN_MEMBER" data-sb4-action-identifier="{{id}}" data-sb4-action-direct>…</div>
464
465
  ```
465
466
 
466
467
  Bármely elem hordozhat triggert: a kattintás (vagy Enter / Space) azt az akciót futtatja, amelynek
@@ -487,6 +488,11 @@ függetlenül**. Hiányzó `data-sb4-action-identifier` = identifier nélküli a
487
488
  állapot a lista változását a html újraírása nélkül követi.
488
489
  - **Nem kínált akció** (a sor / nézet nem adja): az elem nem interaktív, `sb4-action-inert` osztályt
489
490
  kap, a kliens egyszer warn-ol, a kattintás a körülötte lévő triggerre vagy a kártyára jut.
491
+ - **Direkt trigger** (`data-sb4-action-direct`): akkor is lő, ha a lista nem kínálja az akciót —
492
+ ilyenkor a kliens maga rakja össze a `{ code, identifier }` akciót az attribútumokból. Ha a lista
493
+ kínál egyező akciót, az nyer (letiltás, descriptor a listából jön). Nem inert és nem warn-ol.
494
+ Mivel a kínált-akció lista már nem kapuzza, **a szerver handlere maga ellenőrizze a
495
+ jogosultságot**. Java: `Tag.directAction(code)` / `Tag.directAction(code, identifier)`.
490
496
  - Paraméter-attribútum nincs: az identifier és a sor-scope (`params.model` = a sor) fedi az
491
497
  eseteket.
492
498
 
package/MIGRATION-7.0.md CHANGED
@@ -2070,8 +2070,84 @@ selection carried are not sent again and late responses are always applied.
2070
2070
  not the array. `SmarttreeGenericService` writes a reload into the node objects a host holds
2071
2071
  (same objects, new data) and sets `treeFromBackend` to the merged nodes.
2072
2072
 
2073
+ ### New in 7.3.2: keybindings (#19122)
2074
+
2075
+ Additive: a host without a keymap gets one binding, Escape closes a dialog that offers
2076
+ `DEFAULT_CLOSE`. Needs the matching platform (`Keybinding`, `View.keybindings`,
2077
+ `ComponentModel.keybindings`); release the two together.
2078
+
2079
+ - **The keymap.** Properties files on the server, `CODE=chord[,chord]` binds every action of
2080
+ that code, `viewName.CODE=chord[,chord]` only in that view and wins over `CODE`; an empty
2081
+ `viewName.CODE=` disables the chord in that view. The host lists its own file before the
2082
+ platform's, the first file with the key wins:
2083
+ `spring.keybindings.basename=keybindings-<app>,keybindings-platform`. The platform's file binds
2084
+ Escape to `DEFAULT_CLOSE`, `CANCEL` and `CLOSE_SEARCH_PAGE`, which close the view on every
2085
+ platform page offering them; without the property only that file is read.
2086
+ - **Chord grammar.** Modifiers, then one key, joined by `+`: `Mod+Shift+S`. `Mod` is Cmd on a Mac
2087
+ and Ctrl elsewhere, so one chord serves both; `Ctrl`, `Alt`, `Shift`, `Meta` are the literal
2088
+ keys. The server writes every chord canonically (modifier order `Mod`, `Ctrl`, `Alt`, `Shift`,
2089
+ `Meta`, letters upper case), so the order and case in the file do not matter. The key is the
2090
+ browser's `KeyboardEvent.key` name (`Escape`, `Enter`, `ArrowUp`, `F2`, `Delete`), the space
2091
+ bar is `Space`. A letter or digit also matches by its physical key when a modifier changes the
2092
+ character (Option+N on a Mac). Chords the browser keeps for itself (`Mod`/`Ctrl` with `W`,
2093
+ `T`, `N`, `Q`, `R`, `Tab`, and `F5`) and unparsable ones are dropped with an ERROR log.
2094
+ - **Bindings in code.** A page binds its own actions on the view, typically in `initModel`:
2095
+ ```java
2096
+ view.addKeybindingsItem(new Keybinding()
2097
+ .chord(KeyChord.of(KeyboardKeys.MOD, KeyboardKeys.SHIFT, KeyboardKeys.ARROW_UP))
2098
+ .uiActionCode(MOVE_UP)
2099
+ .uiActionIdentifier(rowId)); // optional: without it every MOVE_UP action is bound
2100
+ ```
2101
+ Per action the code level wins over `viewName.CODE`, which wins over `CODE`; a code-level entry
2102
+ replaces the keymap of its action, they are not merged. Only the code level can name an
2103
+ identifier. When two actions of a view share a chord, the more specific source keeps it, then
2104
+ the earlier action, with a WARN log. The server resolves all this into
2105
+ `ComponentModel.keybindings`; a keymap entry of an action the view does not offer yields
2106
+ nothing.
2107
+ - **Which view gets the key.** One document listener serves every view. The key goes to the view
2108
+ holding the focus, the innermost one when views are nested; when nothing has the focus, to the
2109
+ view that had it last (the focus is lost when a pushed layout re-renders the field), else the
2110
+ top-most dialog, else the current page. If that view has no enabled binding for the chord, the key
2111
+ bubbles to the enclosing views, but never out of a dialog: the page behind it does not react
2112
+ while a dialog is open. A NORMAL view opened by the user's action takes the focus, a view
2113
+ restored on reload does not.
2114
+ - **What does not fire.** Unmodified typing in an editable element (text inputs, textareas,
2115
+ selects, contenteditable): letters, digits, editing and caret keys, and `Enter` in a multi-line
2116
+ field stay the element's; `Escape`, the function keys, chords with Ctrl, Alt or Cmd, and `Enter`
2117
+ in a single-line input reach the bindings. A disabled or not offered action does not fire: the
2118
+ key bubbles on and reaches the browser when nothing takes it. Auto-repeated keys, a key a panel
2119
+ already handled (`defaultPrevented`) and a key pressed in an overlay of no view (an open select
2120
+ or menu panel) fire nothing. An unmodified `Enter` or `Space` on a focused button, link or
2121
+ ARIA-interactive control stays with that control (the browser activates it), and the `Enter`
2122
+ that confirms an IME composition fires nothing. A fired chord is `preventDefault`ed.
2123
+ - **Tooltip and accessibility.** A toolbar button shows its chords in its tooltip, formatted for
2124
+ the platform (`⌘⇧S` on a Mac, `Ctrl+Shift+S` elsewhere), after the server tooltip or alone; the
2125
+ tooltip also opens on keyboard focus. The button names them in `aria-keyshortcuts`.
2126
+ - **Two host rules.** Do not bind `Enter` on a view whose form uses `SmartForm.submitOnEnter`:
2127
+ both would run. With `dialogDisableClose: false` MatDialog closes the dialog on Escape itself,
2128
+ as before; the `DEFAULT_CLOSE=Escape` binding is what closes it under the default `true`.
2129
+ - **Focus survives a push.** When a push re-renders the field being edited, the view focuses it
2130
+ again: the field with the same widget key (`data-testid`) at the same position within the view,
2131
+ with the caret or selection of a native input or textarea and of a Quill editor. Nothing
2132
+ happens when the field left the layout or the focus moved elsewhere meanwhile (a dialog, a click).
2133
+ - **Pending edits are saved first.** A fired action (a key, a toolbar click, an HTML trigger)
2134
+ waits until the view's widgets have saved what was typed into them — today the filter editor,
2135
+ which saves its fields on blur — so a query bound to `Enter` runs with the value just typed. If
2136
+ that save fails, the action is not sent.
2137
+ - **Messages.** A message with a single option focuses it and sends it on Escape. Otherwise the
2138
+ first `confirm`-typed option gets the initial focus (Enter presses it) and Escape sends the first
2139
+ `cancel`-typed option. A `reject` option is never chosen by a key, and untyped options (a YES/NO
2140
+ without types) get neither: Escape does nothing, the focus stays on the first button.
2141
+ - **Out of scope.** Row actions (grid, table, card rows) and actions inside widgets have no
2142
+ keybindings; only the view's own actions do.
2143
+ - **New in the public API:** model `Keybinding`, `View.keybindings`,
2144
+ `ComponentModel.keybindings`; Java `KeyChord`, `KeyboardKeys`, `KeybindingSettingApi`.
2145
+
2073
2146
  ### Bugfixes shipped with 7.0
2074
2147
 
2148
+ - (7.3.2) A view dialog no longer disappears on the browser's back button. MatDialog's default
2149
+ `closeOnNavigation` disposed every dialog on a Location change without any action, so the
2150
+ backend kept the views open and a reload brought them back; view dialogs now open with it off.
2075
2151
  - `SmartformwidgetComponent.ngAfterViewInit` no longer crashes with
2076
2152
  `Cannot read properties of undefined (reading 'valueChanges')` when the form
2077
2153
  contains a `MONTH_PICKER` widget (it wrongly subscribed to the non-existent
package/README.md CHANGED
@@ -165,6 +165,13 @@ A `UiActionModel` is **frozen**: build an entry, never edit one. To change how a
165
165
  looks, rebuild the array — `actions.map(a => a.uiAction.code === c ? { ...a, cssClass: 'x' } : a)`
166
166
  — because it is the array reference changing that re-renders the toolbar.
167
167
 
168
+ ### Keybindings
169
+
170
+ The server binds key chords (`Mod+Shift+S`, `Mod` = Cmd/Ctrl) to a view's actions, from a
171
+ keymap file and from code; the client fires them in the focused view and shows them in the
172
+ button's tooltip. Nothing to wire on the client. The keymap format, the chord grammar and the
173
+ rules for which view gets a key: `MIGRATION-7.0.md`, *New in 7.3.2: keybindings*.
174
+
168
175
  ## Change detection
169
176
 
170
177
  7.0 runs without zone.js and every library component is `OnPush`. Nothing forces your host to