@smartsoft001/claude-plugins 2.202.0 → 2.203.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartsoft001/claude-plugins",
3
- "version": "2.202.0",
3
+ "version": "2.203.0",
4
4
  "description": "Installs the smartsoft Claude Code plugins into a project: smart-core (hooks and framework-neutral skills) plus smart-angular or smart-react (the component and CRUD skills and agents of one framework).",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "smart-angular",
3
3
  "description": "Smartsoft for Angular projects - the @smartsoft001/angular component skills and their angular-components agent, the Angular CRUD skill and the Nx + Angular SSR workspace scaffold",
4
- "version": "2.201.0",
4
+ "version": "2.202.0",
5
5
  "dependencies": ["smart-core"]
6
6
  }
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: angular-components-details
3
- description: Details component API with InjectionToken pattern for custom implementations. Renders a list of model fields via <smart-detail>.
3
+ description: Details component API with InjectionToken pattern for custom implementations. Renders a list of model fields via <smart-detail>; DetailsPage, the [smartDetails] directive and showDetailsModal show it in a modal.
4
4
  user-invocable: false
5
5
  ---
6
6
 
@@ -13,6 +13,7 @@ The `<smart-details>` component renders a list of model fields decorated with `@
13
13
  - Developer wants to render a read-only summary of an entity using model decorators
14
14
  - Developer asks about `<smart-details>` or `DetailsComponent`
15
15
  - Developer wants to provide a custom layout for the standard details rendering
16
+ - Developer wants to show the details of a record in a modal (`[smartDetails]`, `DetailsPage`, `showDetailsModal`)
16
17
 
17
18
  ## Components
18
19
 
@@ -53,9 +54,9 @@ Abstract base directive. Extend it to build custom details implementations. It e
53
54
  | `cellPipe` | `ICellPipe<T>` | - | Formats the values of the `text` and `phoneNumberPl` fields (see `angular-components-detail`). |
54
55
  | `componentFactories` | `IDetailsComponentFactories<T>` | - | Components created above (`top`) and below (`bottom`) the fields. |
55
56
  | `loading` | `Signal<boolean>` | - | Passed to every `<smart-detail>`; not read by the built-in implementations; available to a custom implementation. |
56
- | `title` | `string` | - | Not read by `<smart-details>`; `DetailsPage` uses it as the page title. |
57
- | `itemHandler` | `((id: string) => void) \| null` | - | Not read by `<smart-details>`; `DetailsPage` adds a forward button that calls it with the item's `id`. |
58
- | `removeHandler` | `((item: T) => void) \| null` | - | Not read by `<smart-details>`; `DetailsPage` adds a remove button that calls it with the item. |
57
+ | `title` | `string` | - | Not read by `<smart-details>`; `DetailsPage` uses it as the title of its `pageOptions()`. |
58
+ | `itemHandler` | `((id: string) => void) \| null` | - | Not read by `<smart-details>`; `DetailsPage` turns it into a forward button of its `pageOptions()`. |
59
+ | `removeHandler` | `((item: T) => void) \| null` | - | Not read by `<smart-details>`; `DetailsPage` turns it into a remove button of its `pageOptions()`. |
59
60
 
60
61
  `IDetailsComponentFactories<T>` has two optional fields, `top` and `bottom`, each a `Type<any>` created without inputs.
61
62
 
@@ -132,6 +133,31 @@ export class MyCustomDetailsComponent extends DetailsBaseComponent<any> {}
132
133
  ></smart-details>
133
134
  ```
134
135
 
136
+ ## Details in a modal
137
+
138
+ `DetailsPage` (`SharedPagesModule`) renders `<smart-details>` of its `value` input full width, with the application style (`StyleService.init`) applied to its element; without a `value` it renders nothing. `pageOptions()` gives the page options for a page layout around it: the `title` (default `details`), a `trash` button for `removeHandler` and an `arrow-forward-outline` button for `itemHandler`; both call their handler with the current item and close the modal through `ModalService.dismiss()`. The page layout moved out of the library (FRA-121), so the page does not render these buttons itself.
139
+
140
+ The `[smartDetails]` directive (`DetailsDirective`) opens a component in a modal on click, through `ModalService` (see `angular-components-modal`), with its `params` as the `value` input. It emits `smartDetailsShowed` once the modal is open and `smartDetailsDismissed` once it is closed; the browser's back button (`HardwareService.onBackButtonClick`, the window's `popstate`) closes the modal as well. `showDetailsModal(services, options, callbacks)` does the same from code, and is what `<smart-list>` uses for its `details` option (see `angular-components-list`).
141
+
142
+ | `[smartDetails]` field | Type | Default | Description |
143
+ | ---------------------- | ----------------------- | ---------- | --------------------------------------------- |
144
+ | `component` | `any` | required | Rendered in the modal, e.g. `DetailsPage`. |
145
+ | `params` | `any` | required | Its `value` input, e.g. an `IDetailsOptions`. |
146
+ | `mode` | `'bottom' \| 'default'` | `'bottom'` | Passed to `ModalService.show` as `mode`. |
147
+
148
+ ```html
149
+ <button
150
+ type="button"
151
+ [smartDetails]="{ component: DetailsPage, params: detailsOptions }"
152
+ (smartDetailsShowed)="load(user.id)"
153
+ (smartDetailsDismissed)="clear()"
154
+ >
155
+ Show
156
+ </button>
157
+ ```
158
+
159
+ `IDetailsOptions.item` is a signal, so the page shows skeletons until the item is loaded and the fields once it is.
160
+
135
161
  ## Field Rendering
136
162
 
137
163
  Each field is rendered via `<smart-detail>`. The actual rendering of a single field by `FieldType` (text, email, address, image, attachment, …) is dispatched inside `<smart-detail>` itself. See the `angular-components-detail` skill for per-field details.
@@ -143,4 +169,6 @@ Each field is rendered via `<smart-detail>`. The actual rendering of a single fi
143
169
  - Base class: `packages/shared/angular/src/lib/components/details/base/base.component.ts`
144
170
  - Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`DETAILS_STANDARD_COMPONENT_TOKEN`)
145
171
  - Interface: `packages/shared/angular/src/lib/models/interfaces.ts` (`IDetailsOptions`)
172
+ - Page: `packages/shared/angular/src/lib/pages/details/details.page.ts` (`DetailsPage`)
173
+ - Directive: `packages/shared/angular/src/lib/directives/details/details.directive.ts` (`DetailsDirective`, `[smartDetails]`) and `details-modal.ts` (`showDetailsModal`, `IDetailsModalOptions`)
146
174
  - Stories: `packages/shared/angular/src/lib/components/details/details.component.stories.ts`
@@ -33,7 +33,15 @@ Abstract base directive for all input sub-components. Provides:
33
33
 
34
34
  ### InputPossibilitiesBaseComponent (abstract)
35
35
 
36
- Extends `InputBaseComponent` for sub-components that need list possibilities: the radio and check components (standard and preset) and the enum preset. Its `afterSetOptionsHandler()` asks `MODEL_POSSIBILITIES_PROVIDER` for the possibilities and asks again 500 ms after the parent form's value changes. The built-in radio, check and enum preset components override that hook without calling it, so they never consult the provider: they show `options.possibilities`, else the `possibilities` of the field's `@Field()` metadata. A custom component that keeps the inherited hook gets the provider behaviour.
36
+ Extends `InputBaseComponent` for sub-components that need list possibilities: the radio and check components (standard and preset) and the enum preset. Its `possibilities` signal holds, in this order of precedence:
37
+
38
+ 1. the list in the signal `MODEL_POSSIBILITIES_PROVIDER` returns from `get({ type, key, instance })` (the model's class, the field key and the parent form's value), while that signal's value is not `null`;
39
+ 2. else `options.possibilities`;
40
+ 3. else the `possibilities` of the field's `@Field()` metadata (read through the first item of an array model): an object map `{ text: id }`, such as an enum, as a list for the radio components and the enum preset, a list as it is for the check components.
41
+
42
+ The provider is asked when the options are set and again 500 ms after the parent form's value last changed, so the list can depend on other fields; a provider signal filled later (after an HTTP call, for instance) updates the field, and after a new question the former list stays until the new signal holds one. The token is optional: without a provider the field shows the input options, else the field's own possibilities. The check components keep each possibility's `checked` in line with the control value (an `id` in the value, or equal to it) whenever the list or the value changes.
43
+
44
+ A subclass that overrides `afterSetOptionsHandler()` calls `super.afterSetOptionsHandler()` first. Two more protected hooks are there to override: `afterPossibilitiesChange()`, which runs whenever the list may have changed, and `getModelPossibilities()`, the fallback read from the field's metadata.
37
45
 
38
46
  ### InputFileBaseComponent (abstract)
39
47
 
@@ -91,15 +99,15 @@ The validation messages `<smart-input>` renders under a touched field. Its only
91
99
 
92
100
  `InputOptions<T>` is `IInputOptions & IInputFromFieldOptions<T>`.
93
101
 
94
- | Field | Type | Default | Description |
95
- | --------------- | --------------------------------------------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------- |
96
- | `treeLevel` | `number` | required | Nesting depth (0 at the top; nested object / array forms go one deeper). |
97
- | `control` | `UntypedFormControl \| UntypedFormArray` | required | The control of the field. |
98
- | `possibilities` | `WritableSignal<{ id: any; text: string; checked: boolean }[]>` | — | The options of a radio, check or enum preset field; wins over the field's own `possibilities`. Other field types do not read it. |
99
- | `component` | `Type<InputBaseComponent<any>>` | — | A field component used instead of the one of the field type (wins over the token). |
100
- | `model` | `T` | required | The model instance whose `@Field()` metadata is read. |
101
- | `fieldKey` | `string` | required | The field's key; a `<key>Confirm` key reads the metadata of `<key>`. |
102
- | `mode` | `'create' \| 'update' \| string` | — | Merges the `@Field({ create })` / `@Field({ update })` overrides into the field options. |
102
+ | Field | Type | Default | Description |
103
+ | --------------- | --------------------------------------------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
104
+ | `treeLevel` | `number` | required | Nesting depth (0 at the top; nested object / array forms go one deeper). |
105
+ | `control` | `UntypedFormControl \| UntypedFormArray` | required | The control of the field. |
106
+ | `possibilities` | `WritableSignal<{ id: any; text: string; checked: boolean }[]>` | — | The options of a radio, check or enum preset field: the `MODEL_POSSIBILITIES_PROVIDER` list wins over them, they win over the field's own `possibilities`. The standard enum (the enum's keys) and the other field types do not read it. |
107
+ | `component` | `Type<InputBaseComponent<any>>` | — | A field component used instead of the one of the field type (wins over the token). |
108
+ | `model` | `T` | required | The model instance whose `@Field()` metadata is read. |
109
+ | `fieldKey` | `string` | required | The field's key; a `<key>Confirm` key reads the metadata of `<key>`. |
110
+ | `mode` | `'create' \| 'update' \| string` | — | Merges the `@Field({ create })` / `@Field({ update })` overrides into the field options. |
103
111
 
104
112
  ```typescript
105
113
  type InputOptions<T> = IInputOptions & IInputFromFieldOptions<T>;
@@ -187,12 +195,12 @@ the most recently added ones:
187
195
 
188
196
  Where a preset behaves differently from the standard component of its type:
189
197
 
190
- | FieldType | Standard | Preset |
191
- | --------- | -------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
192
- | `enum` | Checkboxes of the enum's keys; value: list of keys | A `<select>` of the possibilities (`options.possibilities`, else the field's); value: one possibility `id` |
193
- | `file` | Keeps the picked `File` as the value (no upload) | Uploads through `FileService` (`InputFileBaseComponent`); value: the API result |
194
- | `logo` | Stores a base64 `data:` URL (no upload) | Uploads like `image` (`.jpg,.png,.jpeg`) |
195
- | `pesel` | No validator of its own | Adds an `invalidPesel` check (shown with the same message as `pesel`) |
198
+ | FieldType | Standard | Preset |
199
+ | --------- | -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
200
+ | `enum` | Checkboxes of the enum's keys; value: list of keys | A `<select>` of the possibilities (the provider's, else `options.possibilities`, else the field's); value: one possibility `id` |
201
+ | `file` | Keeps the picked `File` as the value (no upload) | Uploads through `FileService` (`InputFileBaseComponent`); value: the API result |
202
+ | `logo` | Stores a base64 `data:` URL (no upload) | Uploads like `image` (`.jpg,.png,.jpeg`) |
203
+ | `pesel` | No validator of its own | Adds an `invalidPesel` check (shown with the same message as `pesel`) |
196
204
 
197
205
  Notes:
198
206
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: angular-components-list
3
- description: List component API with InjectionToken map pattern for custom implementations per mode (desktop/mobile/masonryGrid).
3
+ description: List component API with InjectionToken map pattern for custom implementations per mode (desktop/mobile/masonryGrid), with sortable headers, details in a modal and single-page or infinite-scroll pagination.
4
4
  user-invocable: false
5
5
  ---
6
6
 
@@ -11,6 +11,7 @@ The `<smart-list>` component renders a list of entities. It is a wrapper that di
11
11
  ## When to Use This Skill
12
12
 
13
13
  - Developer wants to display a collection of entities with row actions, multi-selection or pagination
14
+ - Developer wants sortable column headers, the details of an item in a modal, or infinite scroll
14
15
  - Developer asks about `<smart-list>` or `ListComponent`
15
16
  - Developer wants to provide a custom layout for a specific list mode (desktop, mobile, or masonryGrid)
16
17
 
@@ -22,15 +23,15 @@ Main wrapper. Resolves the list `fields` of `options.type` (the `@Field({ list }
22
23
 
23
24
  ### ListDesktopComponent (`<smart-list-desktop>`)
24
25
 
25
- Default desktop implementation. A CDK table with a sticky header row, one column per list field, plus the multi-select checkbox column (`select: 'multi'`), the remove column (`remove`) and the item action column (`item`); the `top` component factory above it and `<smart-paging>` below it when `pagination.mode` is `PaginationMode.singlePage`. It renders no sort controls.
26
+ Default desktop implementation. A CDK table with a sticky header row, one column per list field, plus the multi-select checkbox column (`select: 'multi'`), the details column (`details`), the remove column (`remove`) and the item action column (`item`); the `top` component factory above it and `<smart-paging>` below it when `pagination.mode` is `PaginationMode.singlePage`. With `sort` the field headers are sort buttons (see [Sorting](#sorting)).
26
27
 
27
28
  ### ListMobileComponent (`<smart-list-mobile>`)
28
29
 
29
- Default mobile implementation. Renders a `<ul role="list">` with flex rows, one paragraph per cell, plus the remove and item action buttons; the `top` component factory above it and `<smart-paging>` below it (`PaginationMode.singlePage`).
30
+ Default mobile implementation. Renders a `<ul role="list">` with flex rows, one paragraph per cell, plus the details, remove and item action buttons; the `top` component factory above it and `<smart-paging>` below it (`PaginationMode.singlePage`).
30
31
 
31
32
  ### ListMasonryGridComponent (`<smart-list-masonry-grid>`)
32
33
 
33
- Default masonry-grid implementation. Renders a grid of tiles with the item's image (the model's first `FieldType.image` field) over its other cells; the `top` component factory above it and `<smart-paging>` below it (`PaginationMode.singlePage`). It has no row actions.
34
+ Default masonry-grid implementation. Renders a grid of tiles with the item's image (the model's first `FieldType.image` field) over its other cells; the `top` component factory above it and `<smart-paging>` below it (`PaginationMode.singlePage`). Its only row action is the details button (`details`).
34
35
 
35
36
  ### ListBaseComponent (abstract)
36
37
 
@@ -41,9 +42,12 @@ Abstract base directive. Extend it to build custom list implementations for any
41
42
  - `loading` — `Signal<boolean>` from the provider
42
43
  - `page`, `totalPages` — `Signal<number | null>` from the pagination options
43
44
  - `type` — the model class, `sort`, `selectMode` (`options.sort ?? {}`, `options.select`)
45
+ - `sortable` — `Signal<boolean>`, `true` with `options.sort`; `activeSort` — `WritableSignal<IListSortState | null>`, the sort the headers show (`sort.default` / `sort.defaultDesc` at first, then the last header clicked; it starts over when `options.sort` changes)
44
46
  - `itemHandler` — resolved item navigation (`Router.navigate([routingPrefix, id])`) or select handler, `null` without `item`
45
47
  - `removeHandler` — confirms with `AlertService` (`OBJECT.confirmDelete`) and calls `remove.provider.invoke(id)`, `null` without `remove`; `checkRemoveHandler` is `remove.provider.check`
46
- - `detailsComponent`, `detailsComponentProps`, `select`, `unselect` — set from `details` for a custom implementation that shows details
48
+ - `detailsHandler` — opens the details of an item in a modal (`openDetails(item)`), `null` without `details`
49
+ - `detailsComponent`, `detailsComponentProps`, `select`, `unselect` — set from `details`: the custom `details.component` (else `undefined`, and `DetailsPage` opens), the `IDetailsOptions` it gets as `value`, and the provider's `getData` / `clearData`
50
+ - `infiniteScroll` — `Signal<boolean>`, `true` with `PaginationMode.infiniteScroll` while `page() < totalPages()`; `infiniteScrollAnchor` — the view query of the `#infiniteScrollAnchor` element the modes render after the items
47
51
  - `loadNextPage`, `loadPrevPage` — the pagination loaders (they scroll the window), `null` without `pagination`
48
52
  - `cellPipe` — `ICellPipe<T> | null`
49
53
  - `cssClass` — string input (alias `class`), forwarded by `<smart-list>`
@@ -53,7 +57,9 @@ The resolved fields themselves are private; read `options().fields` in a subclas
53
57
  Methods:
54
58
 
55
59
  - `initKeys()` (protected) — populates `keys` from the resolved fields
56
- - `handlePageChange(page: number)` — calls `loadNextPage()` for a later page and `loadPrevPage()` for an earlier one (it never calls `provider.getData`)
60
+ - `handlePageChange(page: number)` — calls `loadNextPage()` for a later page and `loadPrevPage()` for an earlier one
61
+ - `isSortable(key)`, `sortBy(key)`, `ariaSort(key)`, `sortIndicator(key)` — whether a header sorts (every field column with `sort`, not the `__array` columns of a `dynamic` field), sort by it (calls `provider.getData({ offset: 0, sortBy, sortDesc })`), its `aria-sort` (`'ascending'` / `'descending'` on the active header, `null` otherwise) and its arrow (`↑`, `↓`, `↕`)
62
+ - `openDetails(item)` — clears the details provider (`unselect()`), opens `detailsComponent ?? DetailsPage` in a `'bottom'` modal through `showDetailsModal` with `{ value: detailsComponentProps }`, then calls `select(item.id)`
57
63
 
58
64
  ## API
59
65
 
@@ -108,30 +114,30 @@ interface IListOptions<T> {
108
114
 
109
115
  ### IListOptions property reference
110
116
 
111
- | Property | Type | Default | Description |
112
- | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
113
- | `provider` | `IListProvider<T>` | _required_ | Where the rows come from (`list`, `loading` signals) and the multi-selection callbacks. |
114
- | `type` | `any` | _required_ | Model class decorated with `@Model`; its `@Field({ list })` fields are the columns. |
115
- | `mode` | `ListMode` | - | Force a specific mode; omit to auto-detect via `HardwareService.isMobile` (mobile or desktop). |
116
- | `pagination` | `IListPaginationOptions` | - | Paging state and loaders; the built-in modes render `<smart-paging>` for `PaginationMode.singlePage`. |
117
- | `cellPipe` | `ICellPipe<T>` | - | Formats cells: `transform(item, key, translate?)` returns the cell text (rendered as HTML through Angular's sanitiser). |
118
- | `componentFactories` | `IListComponentFactories<T>` | - | `top`: a component created above the rows. |
119
- | `sort` | `boolean \| { default?: string; defaultDesc?: boolean }` | - | Not read by the built-in implementations (they render no sort controls); available to a custom implementation as `sort`. |
120
- | `details` | `boolean \| { provider?: IDetailsProvider<T>; componentFactories?: IDetailsComponentFactories<T>; component?: Type<any> }` | - | Requires a `provider` when set (else it throws). The base exposes `select` / `unselect`, `detailsComponent` and its props; the built-in modes do not render them, so it is for a custom implementation. |
121
- | `item` | `boolean \| { options?: ItemOptions }` | - | Adds the item action: `{ options: { routingPrefix, edit } }` navigates to `routingPrefix/id`, `{ options: { select, edit } }` calls `select(id)`. Setting `item` without `options` throws. |
122
- | `remove` | `boolean \| { provider?: IRemoveProvider<T> }` | - | Adds the remove action: an alert (`OBJECT.confirmDelete`), then `provider.invoke(id)`; `provider.check(item)` hides it per row. |
123
- | `select` | `'multi'` | - | Adds a checkbox column (desktop and desktop preset); changes go to `provider.onChangeMultiSelected`. |
124
- | `presentation` | `{ variant?: 'default' \| 'striped' \| 'bordered' \| 'borderless'; hoverable?: boolean; header?: 'default' \| 'muted' \| 'none' }` | `{}` | Desktop preset only: the table `variant` (`'default'`), `hoverable` rows and the `header` look (`'default'`). The standard components ignore it. |
117
+ | Property | Type | Default | Description |
118
+ | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
119
+ | `provider` | `IListProvider<T>` | _required_ | Where the rows come from (`list`, `loading` signals) and the multi-selection callbacks. |
120
+ | `type` | `any` | _required_ | Model class decorated with `@Model`; its `@Field({ list })` fields are the columns. |
121
+ | `mode` | `ListMode` | - | Force a specific mode; omit to auto-detect via `HardwareService.isMobile` (mobile or desktop). |
122
+ | `pagination` | `IListPaginationOptions` | - | Paging state and loaders: `<smart-paging>` for `PaginationMode.singlePage`, the next page on scroll for `PaginationMode.infiniteScroll` (see [Infinite scroll](#infinite-scroll)). |
123
+ | `cellPipe` | `ICellPipe<T>` | - | Formats cells: `transform(item, key, translate?)` returns the cell text (rendered as HTML through Angular's sanitiser). |
124
+ | `componentFactories` | `IListComponentFactories<T>` | - | `top`: a component created above the rows. |
125
+ | `sort` | `boolean \| { default?: string; defaultDesc?: boolean }` | - | Makes the field headers of the desktop modes sort buttons; `default` / `defaultDesc` is the sort they show at first (see [Sorting](#sorting)). |
126
+ | `details` | `boolean \| { provider?: IDetailsProvider<T>; componentFactories?: IDetailsComponentFactories<T>; component?: Type<any> }` | - | Adds a details action (`show`) to every item that opens `component` (`DetailsPage` by default) in a modal; requires a `provider` (else it throws). See [Details](#details). |
127
+ | `item` | `boolean \| { options?: ItemOptions }` | - | Adds the item action: `{ options: { routingPrefix, edit } }` navigates to `routingPrefix/id`, `{ options: { select, edit } }` calls `select(id)`. Setting `item` without `options` throws. |
128
+ | `remove` | `boolean \| { provider?: IRemoveProvider<T> }` | - | Adds the remove action: an alert (`OBJECT.confirmDelete`), then `provider.invoke(id)`; `provider.check(item)` hides it per row. |
129
+ | `select` | `'multi'` | - | Adds a checkbox column (desktop and desktop preset); changes go to `provider.onChangeMultiSelected`. |
130
+ | `presentation` | `{ variant?: 'default' \| 'striped' \| 'bordered' \| 'borderless'; hoverable?: boolean; header?: 'default' \| 'muted' \| 'none' }` | `{}` | Desktop preset only: the table `variant` (`'default'`), `hoverable` rows and the `header` look (`'default'`). The standard components ignore it. |
125
131
 
126
132
  ### IListProvider\<T>
127
133
 
128
- | Field | Type | Default | Description |
129
- | ------------------------ | ----------------------- | -------- | ---------------------------------------------------------------------------------- |
130
- | `list` | `Signal<T[]>` | required | The records to show. |
131
- | `loading` | `Signal<boolean>` | required | Shows the loader while `true`. |
132
- | `getData` | `(filter: any) => void` | required | For the provider's owner (the CRUD facades read with it); the list never calls it. |
133
- | `onChangeMultiSelected?` | `(list: T[]) => void` | - | Called with the selected records when `select: 'multi'`. |
134
- | `onCleanMultiSelected$?` | `Observable<void>` | - | Clears the multi-selection whenever it emits. |
134
+ | Field | Type | Default | Description |
135
+ | ------------------------ | ----------------------- | -------- | ---------------------------------------------------------------------------------------------------------------- |
136
+ | `list` | `Signal<T[]>` | required | The records to show. |
137
+ | `loading` | `Signal<boolean>` | required | Shows the loader while `true`. |
138
+ | `getData` | `(filter: any) => void` | required | Reads the data again with `filter` merged in; a sortable header calls it with `{ offset: 0, sortBy, sortDesc }`. |
139
+ | `onChangeMultiSelected?` | `(list: T[]) => void` | - | Called with the selected records when `select: 'multi'`. |
140
+ | `onCleanMultiSelected$?` | `Observable<void>` | - | Clears the multi-selection whenever it emits. |
135
141
 
136
142
  ```typescript
137
143
  interface IListProvider<T> {
@@ -149,14 +155,14 @@ interface IListProvider<T> {
149
155
 
150
156
  ### IListPaginationOptions
151
157
 
152
- | Field | Type | Default | Description |
153
- | -------------- | ------------------------ | -------- | -------------------------------------------------------------------------------------------------------------------------- |
154
- | `mode?` | `PaginationMode` | - | `PaginationMode.singlePage` renders `<smart-paging>`; `PaginationMode.infiniteScroll` is not handled by the Angular modes. |
155
- | `limit` | `number` | required | Page size, for the provider's owner; the list does not read it. |
156
- | `loadNextPage` | `() => Promise<boolean>` | required | Loads the next page. |
157
- | `loadPrevPage` | `() => Promise<boolean>` | required | Loads the previous page. |
158
- | `page` | `Signal<number>` | required | Current page. |
159
- | `totalPages` | `Signal<number>` | required | Number of pages. |
158
+ | Field | Type | Default | Description |
159
+ | -------------- | ------------------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
160
+ | `mode?` | `PaginationMode` | - | `PaginationMode.singlePage` renders `<smart-paging>`; `PaginationMode.infiniteScroll` loads the next page when the end of the items scrolls into view. |
161
+ | `limit` | `number` | required | Page size, for the provider's owner; the list does not read it. |
162
+ | `loadNextPage` | `() => Promise<boolean>` | required | Loads the next page. |
163
+ | `loadPrevPage` | `() => Promise<boolean>` | required | Loads the previous page. |
164
+ | `page` | `Signal<number>` | required | Current page. |
165
+ | `totalPages` | `Signal<number>` | required | Number of pages. |
160
166
 
161
167
  `PaginationMode` is an enum: `PaginationMode.infiniteScroll` (`'infiniteScroll'`), `PaginationMode.singlePage` (`'singlePage'`).
162
168
 
@@ -171,6 +177,22 @@ interface IListProvider<T> {
171
177
  | `IDetailsProvider<T>` | `getData: (id: string) => void`, `clearData: () => void`, `item: Signal<T>`, `loading: Signal<boolean>` |
172
178
  | `ICellPipe<T>` | `transform(value: T, columnName: string, translate?: (val: string) => string): string` |
173
179
  | `IListComponentFactories<T>` | `top?: Type<any>` |
180
+ | `IListSortState` | `key: string`, `desc: boolean` (the sort a list shows) |
181
+ | `IListSortFilter` | `offset: 0`, `sortBy: string`, `sortDesc: boolean` (what a sortable header passes to `provider.getData`) |
182
+
183
+ ## Sorting
184
+
185
+ With `sort` set (`true`, or `{ default?, defaultDesc? }`), every field header of the desktop table (standard and preset) is a sort button with an arrow: `↕` on the headers that do not sort the list, `↑` / `↓` on the active one, which also carries `aria-sort` (`ascending` / `descending`). A click on another column sorts by it in ascending order, a click on the active column turns the direction around. The list does not sort the rows itself: it calls `provider.getData({ offset: 0, sortBy, sortDesc })`, and the provider reads its data again in that order, from the first page. The CRUD list page (`@smartsoft001/crud-shell-angular`) merges that filter into its `ICrudFilter`, so the request carries `sort=<field>` or `sort=-<field>`. The expanded columns of a `dynamic` field do not sort. The mobile and masonry modes have no headers, so they ignore `sort`.
186
+
187
+ `sort.default` and `sort.defaultDesc` only set the header the list shows at first; the provider loads its first data in that order on its own. The clicked sort stays while other options change, and starts over from `sort.default` when the `sort` option is a new object. The helpers behind it are exported: `getListDefaultSort`, `getNextListSort`, `getListAriaSort`, `getListSortIndicator` and `isListSortableKey`.
188
+
189
+ ## Details
190
+
191
+ With `details: { provider }`, every item gets a details action, labelled with the `show` translation (`data-role="details"`): a column of the desktop table and a button in the mobile rows and the masonry tiles (standard and presets). It clears the provider (`clearData()`), opens `details.component`, or `DetailsPage` by default, in a modal through `ModalService` (mode `'bottom'`, see `angular-components-modal`) with `{ value: detailsComponentProps }`, and asks the provider for the item (`getData(id)`). `detailsComponentProps` is an `IDetailsOptions`: `item` and `loading` from the provider (signals, so the modal shows the item once it is loaded), `type`, the list's `itemHandler` and `removeHandler` and `details.componentFactories`. The browser's back button closes the modal. Without a `provider`, setting `details` throws `Must set details provider`.
192
+
193
+ ## Infinite scroll
194
+
195
+ With `pagination.mode` set to `PaginationMode.infiniteScroll` and `page() < totalPages()`, every mode renders an empty `<div data-role="infinite-scroll" aria-hidden="true">` after its items and watches it with an `IntersectionObserver`. When it scrolls into view, the list calls `pagination.loadNextPage()` (never twice at the same time), and it watches the element again after every page, so a short page loads the next one at once. On the last page the element is gone. Without `IntersectionObserver` (server rendering) nothing loads. The provider appends the new rows to `provider.list` (the CRUD store does for a filter whose `paginationMode` is not `singlePage`). `pagination.limit` is not read by the list.
174
196
 
175
197
  ## LIST_MODE_COMPONENTS_TOKEN
176
198
 
@@ -227,7 +249,9 @@ Notes:
227
249
  primary button (label i18n key: `details`).
228
250
  - The masonryGrid preset keeps the base masonry column algorithm and image mechanism
229
251
  (`NgOptimizedImage` from the model's image field) and restyles items with the same card recipe as
230
- the mobile preset; it has no item action buttons (matching the standard masonry child).
252
+ the mobile preset; like the standard masonry child, its only action is the details button.
253
+ - The desktop preset styles its sort buttons with `getListDesktopSortButtonClasses()` and
254
+ `getListDesktopSortIndicatorClasses()`.
231
255
  - Preline "Table with search" / "with pagination" / "selectable rows" variants are covered by the
232
256
  existing `searchbar` feature, `smart-paging` (`PaginationMode.singlePage`), and `select: 'multi'`
233
257
  respectively — not by `presentation`. Table caption/footer variants are not supported (no API
@@ -301,6 +325,24 @@ providers: [
301
325
  }"
302
326
  ></smart-list>
303
327
 
328
+ <!-- Sortable headers: a click calls provider.getData({ offset: 0, sortBy, sortDesc }) -->
329
+ <smart-list
330
+ [options]="{
331
+ provider: myProvider,
332
+ type: UserModel,
333
+ sort: { default: 'lastName' }
334
+ }"
335
+ ></smart-list>
336
+
337
+ <!-- Details in a modal (DetailsPage) -->
338
+ <smart-list
339
+ [options]="{
340
+ provider: myProvider,
341
+ type: UserModel,
342
+ details: { provider: myDetailsProvider }
343
+ }"
344
+ ></smart-list>
345
+
304
346
  <!-- With a remove action -->
305
347
  <smart-list
306
348
  [options]="{
@@ -318,5 +360,6 @@ providers: [
318
360
  - Mobile child: `packages/shared/angular/src/lib/components/list/mobile/mobile.component.ts`
319
361
  - Masonry grid child: `packages/shared/angular/src/lib/components/list/masonry-grid/masonry-grid.component.ts`
320
362
  - Base class: `packages/shared/angular/src/lib/components/list/base/base.component.ts`
363
+ - Sort helpers: `packages/shared/angular/src/lib/components/list/list-sort.ts` (`IListSortState`, `IListSortFilter`, `getListDefaultSort`, `getNextListSort`, `getListAriaSort`, `getListSortIndicator`, `isListSortableKey`)
321
364
  - Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`LIST_MODE_COMPONENTS_TOKEN`)
322
365
  - Interfaces: `packages/shared/angular/src/lib/models/interfaces.ts` (`IListOptions`, `IListProvider`, `IListPaginationOptions`, `ListMode`)
@@ -12,6 +12,7 @@ The `<smart-modal>` component provides a dialog overlay with title, description,
12
12
 
13
13
  - Developer wants to use or customize the modal/dialog component
14
14
  - Developer asks about `<smart-modal>`, `ModalComponent`, `ModalStandardComponent`, or `ModalBaseComponent`
15
+ - Developer wants to open a component in a modal from code and await its result (`ModalService`)
15
16
 
16
17
  ## Components
17
18
 
@@ -27,7 +28,7 @@ Barebones placeholder concrete implementation. Renders a native `<dialog [open]
27
28
 
28
29
  Styled variation that extends `ModalBaseComponent` and is a drop-in replacement for `ModalStandardComponent`. Register it via `MODAL_STANDARD_COMPONENT_TOKEN` (or with `provideSmartPresets()`) to restyle every `<smart-modal>`, or use the `<smart-modal-preset>` selector directly. It renders a translated Preline overlay — a full-screen scrollable backdrop hosting a `rounded-xl` card with a header (`title` + optional dismiss `×`), a body (`description` + projected content), and a footer of action buttons. The look is selected through `options.variant` (default `'centered'`): `centered`/`alert` are vertically centered (`alert` is narrower), `wide` is a top-aligned large dialog, and `left-aligned-buttons` left-aligns the footer. `options.footerStyle: 'gray'` tints the footer, and action buttons are styled by their `variant` (`primary`/`secondary`/`danger`). All classes are `smart:`-prefixed Tailwind with explicit `dark:` variants; the class recipes are internal to the preset (not exported).
29
30
 
30
- > **Preline JS is NOT used.** Open/close is driven entirely by the existing `open` model signal + `@if` (no `HSOverlay`, no `data-hs-*`). The component binds its own dismiss UX: clicking the backdrop and pressing `Escape` both call `close()` (which sets `open` to `false` and emits `closed`). The dialog ARIA contract is preserved (`role="dialog"`, `aria-modal="true"`, `aria-labelledby` when `title` is set, else `aria-label` from `options.ariaLabel`). The header dismiss `×` button is only shown when `options.withDismiss` is `true`.
31
+ > **Preline JS is NOT used.** Open/close is driven entirely by the existing `open` model signal + `@if` (no `HSOverlay`, no `data-hs-*`). The component binds its own dismiss UX: clicking the backdrop and pressing `Escape` both call `close()` (which sets `open` to `false` and emits `closed`). With preset modals stacked (a modal opened from a modal), `Escape` closes only the one on top. The dialog ARIA contract is preserved (`role="dialog"`, `aria-modal="true"`, `aria-labelledby` when `title` is set, else `aria-label` from `options.ariaLabel`). The header dismiss `×` button is only shown when `options.withDismiss` is `true`.
31
32
  >
32
33
  > `ModalPresetComponent` declares `cssClass` without the `class` alias (applied to the centering wrapper): bind it as `[cssClass]` on the `<smart-modal-preset>` selector, or pass `class` on `<smart-modal>` (the wrapper forwards it).
33
34
 
@@ -181,6 +182,58 @@ The inherited `cssClass` (input alias `class`) receives the class passed to `<sm
181
182
  <smart-modal [(open)]="open" class="smart:p-4" />
182
183
  ```
183
184
 
185
+ ## Opening a component in a modal from code
186
+
187
+ `ModalService.show(options)` (provided by `SharedServicesModule`) creates `options.component` inside a `<smart-modal>` at the end of `<body>` and resolves with an `IModal`. The modal is the implementation registered for `MODAL_STANDARD_COMPONENT_TOKEN` (the preset with `provideSmartPresets()`) and shows its close button (`withDismiss`). `props` become the component's inputs (keys it does not declare as inputs are left out), and a component that declares a `dismiss` input gets the function that closes its modal. A component can also inject `ModalService` and call `dismiss(data)`: it resolves to the service that opened it. The modals stack; `ModalService.dismiss(data)` closes the one opened last. Closing a modal restores the focus to the element focused before it opened.
188
+
189
+ | Option | Type | Default | Description |
190
+ | ----------------- | ----------------------- | ----------- | -------------------------------------------------------------------------------------------------------------------------------- |
191
+ | `component` | `any` | required | The component rendered in the modal. |
192
+ | `props` | `any` | - | Its inputs, by input name. |
193
+ | `mode` | `'default' \| 'bottom'` | `'default'` | `'bottom'` adds the `smart-modal-bottom` class to the modal for the application to style; the modal element carries `data-mode`. |
194
+ | `cssClass` | `string[]` | - | Classes passed to the modal as `class`. |
195
+ | `backdropDismiss` | `boolean` | `true` | `false` keeps the modal open on a click on its backdrop and on Escape; its close button and `dismiss()` still close it. |
196
+ | `injector` | `Injector` | - | The injector the component resolves its dependencies from (e.g. the opener's `inject(Injector)`), the service's otherwise. |
197
+
198
+ | `IModal` member | Type | Description |
199
+ | ---------------- | ------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------- |
200
+ | `dismiss(data?)` | `(data?: any) => void` | Closes the modal. |
201
+ | `onDidDismiss()` | `() => Promise<{ data: any }>` | Resolves once the modal is closed, with the data it was closed with; `{ data: null }` for its close button, the backdrop or Escape. |
202
+
203
+ ```typescript
204
+ import { Component, inject, input } from '@angular/core';
205
+
206
+ import { ModalService } from '@smartsoft001/angular';
207
+
208
+ @Component({
209
+ selector: 'app-rename-form',
210
+ template: `
211
+ <input #name [value]="name()" />
212
+ <button type="button" (click)="dismiss()?.(name.value)">Save</button>
213
+ `,
214
+ })
215
+ export class RenameFormComponent {
216
+ name = input('');
217
+ dismiss = input<(data?: unknown) => void>();
218
+ }
219
+
220
+ export class RenameAction {
221
+ private modalService = inject(ModalService);
222
+
223
+ async rename(name: string): Promise<string | null> {
224
+ const modal = await this.modalService.show({
225
+ component: RenameFormComponent,
226
+ props: { name },
227
+ });
228
+ const { data } = await modal.onDidDismiss();
229
+
230
+ return typeof data === 'string' ? data : null;
231
+ }
232
+ }
233
+ ```
234
+
235
+ `[smartDetails]` and `DetailsPage` (see `angular-components-details`) open details through the same service.
236
+
184
237
  ## File Locations
185
238
 
186
239
  - Wrapper: `packages/shared/angular/src/lib/components/modal/modal.component.ts`
@@ -191,3 +244,4 @@ The inherited `cssClass` (input alias `class`) receives the class passed to `<sm
191
244
  - Stories: `packages/shared/angular/src/lib/components/modal/modal.component.stories.ts`
192
245
  - Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`MODAL_STANDARD_COMPONENT_TOKEN`)
193
246
  - Interfaces: `packages/shared/angular/src/lib/models/interfaces.ts` (`IModalAction`, `IModalOptions`)
247
+ - Service: `packages/shared/angular/src/lib/services/modal/modal.service.ts` (`ModalService`, `IModalServiceOptions`, `IModal`)
@@ -22,7 +22,7 @@ Main wrapper component. Always renders via `NgComponentOutlet`, forwarding `opti
22
22
 
23
23
  ### PageStandardComponent (`<smart-page-standard>`)
24
24
 
25
- Default concrete implementation and the value for `baseMap['standard']`. Renders a Tailwind-styled header with the translated title, optional back button, optional search input, `endButtons` via `<smart-button>`, and a body section driven by `options.bodyTpl`. It renders no wrapper element and does not apply the `class` (header and body are siblings); of the slot templates it renders only `bodyTpl`.
25
+ Default concrete implementation and the value for `baseMap['standard']`. Renders a Tailwind-styled header with the translated title, optional back button, optional search input, `endButtons` via `<smart-button>`, and a body section driven by `options.bodyTpl`. Header and body sit in one root element (`data-role="page"`) that takes the `class` (`cssClass`, declared without the alias like the preset's); of the slot templates it renders only `bodyTpl`.
26
26
 
27
27
  ### PageBaseComponent (abstract)
28
28
 
@@ -32,10 +32,10 @@ Abstract base directive for extending custom page variants. Exposes `options`, `
32
32
 
33
33
  ### Inputs
34
34
 
35
- | Input | Type | Default | Description |
36
- | --------- | --------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
37
- | `options` | `InputSignal<IPageOptions\|null>` | - | Page configuration (see `IPageOptions`) |
38
- | `class` | `InputSignal<string>` | `''` | External CSS classes (alias for `cssClass`), forwarded to the variant; the preset puts them on its root, the standard variant ignores them |
35
+ | Input | Type | Default | Description |
36
+ | --------- | --------------------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
37
+ | `options` | `InputSignal<IPageOptions\|null>` | - | Page configuration (see `IPageOptions`) |
38
+ | `class` | `InputSignal<string>` | `''` | External CSS classes (alias for `cssClass`), forwarded to the variant; the standard and preset variants put them on their root (`data-role="page"`) |
39
39
 
40
40
  ### SmartPageVariant
41
41
 
@@ -217,6 +217,8 @@ export class MyCustomPageComponent extends PageBaseComponent {}
217
217
  </smart-page>
218
218
  ```
219
219
 
220
+ The class lands on the root element of the variant (`data-role="page"`), in the standard page and in the preset alike.
221
+
220
222
  ## Preset
221
223
 
222
224
  `PagePresetComponent` (`<smart-page-preset>`) is a styled `'preset'` variant that extends `PageStandardComponent`. It renders a full application-shell layout instead of the plain standard header: a bordered `<header>`, a gray page body and a content card. Every utility is `smart:`-prefixed with explicit `smart:dark:*` twins.
@@ -21,11 +21,11 @@ Main wrapper. Delegates to `VerticalNavigationStandardComponent` by default. Whe
21
21
 
22
22
  ### VerticalNavigationStandardComponent (`<smart-vertical-navigation-standard>`)
23
23
 
24
- Barebones placeholder using native HTML. Renders an outer wrapper with `cssClass`, a `<nav class="vertical-navigation">` (with `aria-label` from `options.ariaLabel` or default `"Sidebar"`), and a `<ul class="groups">` with one `<li class="group">` per group. Each group renders an optional `<div class="group-title">` and a `<ul class="items">`; each item renders as `<a class="item-link">` (when `href` is provided; a click follows the link) or `<button class="item-button">` (otherwise, emitting `itemClick`). Items get the `current` class and `aria-current="page"` when `item.current === true`. Inside an item: `iconTpl` (or, without it, `initial`), `label` and `badge`. The standard does not read `options.layout` and adds no styles: the class hooks are for your CSS.
24
+ Barebones placeholder using native HTML. Renders an outer wrapper with `cssClass`, a `<nav class="vertical-navigation">` (with `aria-label` from `options.ariaLabel` or default `"Sidebar"`), and a `<ul class="groups">` with one `<li class="group">` per group. Each group renders an optional `<div class="group-title">` and a `<ul class="items">`, which the title names (`aria-labelledby`); each item renders as `<a class="item-link">` (when `href` is provided; a click follows the link) or `<button class="item-button">` (otherwise, emitting `itemClick`). Items get the `current` class and `aria-current="page"` when `item.current === true`. Inside an item: `iconTpl` (or, without it, `initial`), `label` and `badge`. The standard does not read `options.layout` and adds no styles: the class hooks are for your CSS.
25
25
 
26
26
  ### VerticalNavigationPresetComponent (`<smart-vertical-navigation-preset>`)
27
27
 
28
- Fully-styled, drop-in concrete implementation extending `VerticalNavigationBaseComponent`. Register it through `VERTICAL_NAVIGATION_STANDARD_COMPONENT_TOKEN` (or every preset at once with `provideSmartPresets()`) to restyle every `<smart-vertical-navigation>`, or use the `<smart-vertical-navigation-preset>` selector directly. Renders the Preline vertical-tabs look: each group is its own `<nav>` (all with the `aria-label` from `options.ariaLabel`, default `"Sidebar"`), preceded by its title when set, with a trailing border (`border-e-2`); each item is a tab (`<a>` for `href`, `<button>` emitting `itemClick` otherwise) with its own trailing border. The `current` item gains the primary accent (`border-blue-600`, `text-blue-600`, `font-medium`) and `aria-current="page"`; inactive items are muted gray with a primary hover/focus. Supports `iconTpl`, `initial`, `label` and `badge`. It does not read `options.layout` either. All classes are `smart:`-prefixed Tailwind with explicit `dark:` variants; the class recipes are internal to the preset and not exported.
28
+ Fully-styled, drop-in concrete implementation extending `VerticalNavigationBaseComponent`. Register it through `VERTICAL_NAVIGATION_STANDARD_COMPONENT_TOKEN` (or every preset at once with `provideSmartPresets()`) to restyle every `<smart-vertical-navigation>`, or use the `<smart-vertical-navigation-preset>` selector directly. Renders the Preline vertical-tabs look: one `<nav>` landmark (named by `options.ariaLabel`, default `"Sidebar"`) with a trailing border (`border-e-2`) holds every group; a group is its title, when set, followed by a `<ul role="list">` of the items that the title names (`aria-labelledby`), so a screen reader announces one navigation and a list per group ("Workspace", "Account"). Each item is a tab (`<a>` for `href`, `<button>` emitting `itemClick` otherwise) with its own trailing border, inside an `<li>`. The `current` item gains the primary accent (`border-blue-600`, `text-blue-600`, `font-medium`) and `aria-current="page"`; inactive items are muted gray with a primary hover/focus. Supports `iconTpl`, `initial`, `label` and `badge`. It does not read `options.layout` either. All classes are `smart:`-prefixed Tailwind with explicit `dark:` variants; the class recipes are internal to the preset and not exported.
29
29
 
30
30
  > `VerticalNavigationPresetComponent` declares `cssClass` as `input<string>('')` **without** the `class` alias. Bind it as `[cssClass]` when using the `<smart-vertical-navigation-preset>` selector directly, or just pass `class` on `<smart-vertical-navigation>` (the wrapper forwards it). With the preset registered through the token, `(itemClick)` on `<smart-vertical-navigation>` works as with the standard.
31
31
 
@@ -59,7 +59,7 @@ Abstract base directive. Exposes:
59
59
  | ----------- | ------------------------ | ----------- | ----------------------------------------------------------------------------------------------------- |
60
60
  | `items` | `IVerticalNavItem[]` | `[]` | Items of a first, untitled group. |
61
61
  | `groups` | `IVerticalNavGroup[]` | `[]` | Further groups, rendered after `items`. |
62
- | `ariaLabel` | `string` | `'Sidebar'` | Accessible name of the navigation (in the preset, of every group's `<nav>`). |
62
+ | `ariaLabel` | `string` | `'Sidebar'` | Accessible name of the navigation's one `<nav>` landmark (the groups are lists named by their title). |
63
63
  | `layout` | `SmartVerticalNavLayout` | - | Not read by the built-in implementations (standard and preset); available to a custom implementation. |
64
64
 
65
65
  `SmartVerticalNavLayout` is `'simple' | 'with-badges' | 'with-icons' | 'with-icons-and-badges' | 'with-secondary-navigation' | 'on-gray'`.
@@ -63,13 +63,16 @@ registers the NgRx reducer (`NgrxStoreService.addReducer(config.entity, …)`) a
63
63
  ### `CrudFullConfig<T>` (extends `CrudConfig<T>`)
64
64
 
65
65
  - `title: string`
66
- - `details?` / `edit?` — `boolean | { cellPipe?; components?: { top?; bottom? } }`
66
+ - `details?` / `edit?` — `boolean | { cellPipe?; components?: { top?; bottom? } }`; with `details`
67
+ every row of the list also gets a details action that opens the record in a modal (`DetailsPage`)
67
68
  - `add?` — `boolean | { components?: { top?; bottom? } }`
68
69
  - `remove?` / `search?` / `export?` — `boolean`
69
70
  - `pagination?: { limit: number }` — the backend (`CrudShellNestjsModule.forRoot`) caps a page at
70
71
  `maxQueryLimit` (default 100), so a list without `pagination` shows at most that many rows;
71
72
  exports use `maxExportLimit` (default 10000) and are refused with 400 rather than truncated
72
- - `sort?` — `boolean | { default?: string; defaultDesc?: boolean }`
73
+ - `sort?` — `boolean | { default?: string; defaultDesc?: boolean }`: the first read sorts by
74
+ `default`, and the desktop list headers sort the list (a click reads again with `sortBy` /
75
+ `sortDesc` from the first page)
73
76
  - `list?` — `{ cellPipe?; components?: { top?; multi? }; mode?: ListMode; paginationMode?: PaginationMode; resetQuery?: 'beforeInit'; groups?: Array<ICrudListGroup> }`
74
77
  - `buttons?: Array<IIconButtonOptions>`
75
78
  - `inputComponents?: { [key: string]: Type<InputBaseComponent<T>> }`
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "smart-core",
3
3
  "description": "Smartsoft core for every project - safety validation, audit logging and auto-formatting hooks, plus the framework-neutral skills (audit-log, format-code, project-conventions, safety-check)",
4
- "version": "2.201.0"
4
+ "version": "2.202.0"
5
5
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "smart-react",
3
3
  "description": "Smartsoft for React projects - the @smartsoft001/react component, provider and forms skills, their react-components agent, and the React CRUD skill (@smartsoft001/crud-shell-react)",
4
- "version": "2.201.0",
4
+ "version": "2.202.0",
5
5
  "dependencies": ["smart-core"]
6
6
  }
@@ -40,11 +40,11 @@ All from `@smartsoft001/react`.
40
40
 
41
41
  What `useDetailsModal` opens: a component and its params.
42
42
 
43
- | Field | Type | Default | Description |
44
- | ----------- | ----------------------- | ---------- | ---------------------------------------------------------------- |
45
- | `component` | `ComponentType<any>` | required | Rendered in the modal, with `params` as its `value` prop. |
46
- | `params` | `any` | required | Passed to the component as its `value` prop. |
47
- | `mode?` | `'bottom' \| 'default'` | `'bottom'` | Passed to `ModalService.show` (the modal host does not read it). |
43
+ | Field | Type | Default | Description |
44
+ | ----------- | ----------------------- | ---------- | ------------------------------------------------------------------------------------------- |
45
+ | `component` | `ComponentType<any>` | required | Rendered in the modal, with `params` as its `value` prop. |
46
+ | `params` | `any` | required | Passed to the component as its `value` prop. |
47
+ | `mode?` | `'bottom' \| 'default'` | `'bottom'` | Passed to `ModalService.show`; `'bottom'` adds the `smart-modal-bottom` class to the modal. |
48
48
 
49
49
  ### `IDetailsOptions<T extends IEntity<string>>`
50
50
 
@@ -100,7 +100,7 @@ Formats a value: `transform(item, key, translate?)` returns text (sanitised) or
100
100
 
101
101
  ## In a modal
102
102
 
103
- `useDetailsModal({ component, params, mode? }, { onShowed?, onDismissed? })` returns a click handler that opens `component` in a modal through `ModalService`, with `{ value: params }` as its props, and resolves once the modal closed. `SmartDetailsPage` is the component made for it: it renders `SmartDetails` of `value` full width, with the application style applied. `useDetailsPageOptions(value)` returns page options (title, a remove button for `removeHandler`, a forward button for `itemHandler`) for a page layout of your own around it.
103
+ `SmartList` opens the same page for its `details` option, with the item loaded after the modal opened (see `react-components-list`). `useDetailsModal({ component, params, mode? }, { onShowed?, onDismissed? })` returns a click handler that opens `component` in a modal through `ModalService`, with `{ value: params }` as its props, and resolves once the modal closed. `SmartDetailsPage` is the component made for it: it renders `SmartDetails` of `value` full width, with the application style applied. `useDetailsPageOptions(value)` returns page options (title, a remove button for `removeHandler`, a forward button for `itemHandler`) for a page layout of your own around it.
104
104
 
105
105
  ## Usage
106
106
 
@@ -161,6 +161,16 @@ Props of the rich-text editor of `longText` fields.
161
161
 
162
162
  Uploading fields need a file service: give `SmartProvider` a `fileServiceConfig` (`{ apiUrl }`) or a `fileService`; without one, a picked file is not uploaded. Files go to `<apiUrl>/attachments`.
163
163
 
164
+ ## Possibilities
165
+
166
+ The `radio` and `check` fields (standard and preset) and the preset `enum` list their possibilities from, in this order of precedence:
167
+
168
+ 1. the model possibilities provider (`modelPossibilitiesProvider` on `SmartProvider`), asked with `{ type, key, instance }` (the model's class, the field key and the form's value) when the field mounts and again 500 ms after the form's value last changed, as long as it returns a list or a promise of one (a `null` or `undefined` result is ignored);
169
+ 2. else `options.possibilities`;
170
+ 3. else the field's own `possibilities` (read through the first item of an array model): an object map `{ text: id }`, such as an enum, as a list for `radio` and the preset `enum`, a list as it is for `check`.
171
+
172
+ The `check` fields check each possibility whose `id` is in the value (or equals it). The standard `enum` lists the keys of the enum in `fieldOptions.possibilities` and asks no provider. `useInputPossibilities` returns the first two sources (the provider's, else the input options'), so a custom field adds its own fallback.
173
+
164
174
  ## Labels, info and messages
165
175
 
166
176
  - The label is the label provider's (`modelLabelProvider` on `SmartProvider`) or the translation of `MODEL.<key>` (see `react-provider`).
@@ -1,17 +1,18 @@
1
1
  ---
2
2
  name: react-components-list
3
- description: SmartList React component API (@smartsoft001/react) — list of model records whose columns come from @Field({ list }) metadata, fed by an IListProvider (list, loading), in desktop/mobile/masonryGrid modes, with item navigation, confirmed remove, multi-select, pagination (single page or infinite scroll) and cell pipes; listModeComponents / LIST_PRESET_MODE_COMPONENTS, the 'list' registry key and the useList hook.
3
+ description: SmartList React component API (@smartsoft001/react) — list of model records whose columns come from @Field({ list }) metadata, fed by an IListProvider (list, loading), in desktop/mobile/masonryGrid modes, with item navigation, confirmed remove, multi-select, sortable headers, details in a modal, pagination (single page or infinite scroll) and cell pipes; listModeComponents / LIST_PRESET_MODE_COMPONENTS, the 'list' registry key and the useList hook.
4
4
  user-invocable: false
5
5
  ---
6
6
 
7
7
  # List (`SmartList`)
8
8
 
9
- `SmartList` renders records of a `@Model` class. Its columns are the model's fields marked `@Field({ list: ... })`, sorted by `list.order`; its rows come from `options.provider.list`, and `provider.loading` shows the loader (and suppresses the "no results" text). `options.mode` picks the layout: `ListMode.desktop` (a table, the default), `ListMode.mobile` (stacked rows) or `ListMode.masonryGrid` (image tiles). Row actions are opt-in: `item` adds a "go to item" action (navigate to `routingPrefix + id` through the navigation adapter, or call `select(id)`), `remove` a remove action confirmed with an alert, `select: 'multi'` a checkbox column. The list **does not fetch**: the provider's owner loads the data (CRUD screens wire all of this from a `CrudFullConfig`).
9
+ `SmartList` renders records of a `@Model` class. Its columns are the model's fields marked `@Field({ list: ... })`, sorted by `list.order`; its rows come from `options.provider.list`, and `provider.loading` shows the loader (and suppresses the "no results" text). `options.mode` picks the layout: `ListMode.desktop` (a table, the default), `ListMode.mobile` (stacked rows) or `ListMode.masonryGrid` (image tiles). Row actions are opt-in: `item` adds a "go to item" action (navigate to `routingPrefix + id` through the navigation adapter, or call `select(id)`), `remove` a remove action confirmed with an alert, `details` a details action that opens the record in a modal, `select: 'multi'` a checkbox column. With `sort` the desktop headers are sort buttons. The list **does not fetch**: the provider's owner loads the data, also sorted (`provider.getData`) or by pages (CRUD screens wire all of this from a `CrudFullConfig`).
10
10
 
11
11
  ## When to Use This Skill
12
12
 
13
13
  - Showing records of a model with columns taken from `@Field({ list })`
14
- - Row actions: navigate to an item, remove with confirmation, multi-select
14
+ - Row actions: navigate to an item, remove with confirmation, details in a modal, multi-select
15
+ - Sortable column headers (`sort`)
15
16
  - Paging through a provider (`pagination`), single page or infinite scroll
16
17
  - Choosing the layout per mode, or the preset table look (`presentation`)
17
18
  - Replacing a mode's component (`listModeComponents`) or the whole list (`components.list`), building on `useList`
@@ -22,25 +23,27 @@ For data that is not a model (plain rows), use `SmartTable` or `SmartStackedList
22
23
 
23
24
  All from `@smartsoft001/react`.
24
25
 
25
- | Export | Kind | What it is |
26
- | ---------------------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
27
- | `SmartList` | component | Resolves the list `fields` of `options.type` (the fields with `list` options, sorted by `list.order`) and renders the implementation of `options.mode` (desktop by default): the one registered in `listModeComponents` on `SmartProvider` (e.g. `LIST_PRESET_MODE_COMPONENTS`), else `SmartListDesktop` / `SmartListMobile` / `SmartListMasonryGrid`. |
28
- | `SmartListDesktop` | component | The desktop list: a table with one column per list field, plus the multi-select, remove and item columns, the `top` component factory above it and the paging below it (`PaginationMode.singlePage`). |
29
- | `SmartListDesktopPreset` | component | Preline-styled desktop list variation. |
30
- | `SmartListMasonryGrid` | component | The masonry-grid list: a grid of tiles with the item's image (the model's first image field, lazy loaded) over its non-image cells, the `top` component factory above it and the paging below it (`PaginationMode.singlePage`). |
31
- | `SmartListMasonryGridPreset` | component | Preline-styled masonry-grid list variation: keeps the masonry column layout and renders every item as a Preline card, the image on a rounded top, the first non-image column as the title and the others as text. |
32
- | `SmartListMobile` | component | The mobile list: a stacked list with one paragraph per cell and the remove / item buttons, the `top` component factory above it and the paging below it (`PaginationMode.singlePage`). |
33
- | `SmartListMobilePreset` | component | Preline-styled mobile list variation: a responsive grid of cards. |
34
- | `useListFileUrl` | hook | The download URL of an image cell's attachment (`''` without a file service). |
35
- | `useList` | hook | The behaviour every list mode shares: the column `keys` (permissions via `useAuthService()`, dynamic `__array` columns), the provider `list` and `loading`, the `sort` options, the remove flow (a confirm alert, then `remove.provider.invoke(id)`), item navigation (`useNavigation().navigate(routingPrefix + id)` or `item.options.select`), the details provider (`select` / `unselect`, `detailsComponent` and its props) and the pagination (`loadNextPage` / `loadPrevPage`, `handlePageChange`). |
36
- | `isListImageKey` | function | Whether a column is an image field of the model. |
37
- | `getListTitleKey` | function | The first non-image column (the card title of the mobile and masonry presets). |
38
- | `LIST_PRESET_MODE_COMPONENTS` | const | Preline-styled list mode presets, keyed by `ListMode`. |
39
- | `useListDesktop` | hook | The desktop table logic: `useList` plus the table columns (`desktopKeys`: `selectMulti`, the keys, `removeAction`, `itemAction`), the multi selection reported through `provider.onChangeMultiSelected` and cleared by `provider.onCleanMultiSelected$`, and the `top` component factory. |
40
- | `useListMasonryGrid` | hook | The masonry-grid logic: `useList` plus `listWithImages`, every item paired with the value of the model's first image field. |
41
- | `LIST_DESKTOP_STICKY_HEADER_STYLE` | const | The inline style of the sticky header cells of `SmartListDesktop` (`position: sticky`, `top: 0`). |
42
-
43
- The preset's class helpers (`getListDesktopContainerClasses`, `getListDesktopTableClasses`, `getListDesktopHeaderRowClasses`, `getListDesktopHeaderCellClasses`, `getListDesktopRowClasses`, `getListDesktopCellClasses`) are exported too, for a custom implementation that wants the preset look.
26
+ | Export | Kind | What it is |
27
+ | ------------------------------------------------------------------------------------------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
28
+ | `SmartList` | component | Resolves the list `fields` of `options.type` (the fields with `list` options, sorted by `list.order`) and renders the implementation of `options.mode` (desktop by default): the one registered in `listModeComponents` on `SmartProvider` (e.g. `LIST_PRESET_MODE_COMPONENTS`), else `SmartListDesktop` / `SmartListMobile` / `SmartListMasonryGrid`. |
29
+ | `SmartListDesktop` | component | The desktop list: a table with one column per list field, plus the multi-select, details, remove and item columns, the `top` component factory above it and the paging below it (`PaginationMode.singlePage`); with `options.sort` the field headers are sort buttons. |
30
+ | `SmartListDesktopPreset` | component | Preline-styled desktop list variation. |
31
+ | `SmartListMasonryGrid` | component | The masonry-grid list: a grid of tiles with the item's image (the model's first image field, lazy loaded) over its non-image cells, the `top` component factory above it and the paging below it (`PaginationMode.singlePage`); with `options.details` every tile gets a details button. |
32
+ | `SmartListMasonryGridPreset` | component | Preline-styled masonry-grid list variation: keeps the masonry column layout and renders every item as a Preline card, the image on a rounded top, the first non-image column as the title and the others as text. |
33
+ | `SmartListMobile` | component | The mobile list: a stacked list with one paragraph per cell and the details / remove / item buttons, the `top` component factory above it and the paging below it (`PaginationMode.singlePage`). |
34
+ | `SmartListMobilePreset` | component | Preline-styled mobile list variation: a responsive grid of cards. |
35
+ | `useListFileUrl` | hook | The download URL of an image cell's attachment (`''` without a file service). |
36
+ | `useList` | hook | The behaviour every list mode shares: the column `keys` (permissions via `useAuthService()`, dynamic `__array` columns), the provider `list` and `loading`, the `sort` options, the remove flow (a confirm alert, then `remove.provider.invoke(id)`), item navigation (`useNavigation().navigate(routingPrefix + id)` or `item.options.select`), the details provider (`select` / `unselect`, `detailsComponent` and its props, `detailsHandler`), the sort (`sortBy`, `activeSort`) and the pagination (`loadNextPage` / `loadPrevPage`, `handlePageChange`, infinite scroll). |
37
+ | `SmartListDetailsModal` | component | What the details action opens through `ModalService`: the details component (`SmartDetailsPage` by default) with the list's current `IDetailsOptions` as `value`, read from a store the list keeps up to date. |
38
+ | `getListDefaultSort`, `getNextListSort`, `getListAriaSort`, `getListSortIndicator`, `isListSortableKey` | function | The sort helpers of `useList`: the start sort of a `sort` option, the sort after a header click, the `aria-sort` and the arrow of a header, whether a column sorts. |
39
+ | `isListImageKey` | function | Whether a column is an image field of the model. |
40
+ | `getListTitleKey` | function | The first non-image column (the card title of the mobile and masonry presets). |
41
+ | `LIST_PRESET_MODE_COMPONENTS` | const | Preline-styled list mode presets, keyed by `ListMode`. |
42
+ | `useListDesktop` | hook | The desktop table logic: `useList` plus the table columns (`desktopKeys`: `selectMulti`, the keys, `detailsAction`, `removeAction`, `itemAction`), the multi selection reported through `provider.onChangeMultiSelected` and cleared by `provider.onCleanMultiSelected$`, and the `top` component factory. |
43
+ | `useListMasonryGrid` | hook | The masonry-grid logic: `useList` plus `listWithImages`, every item paired with the value of the model's first image field. |
44
+ | `LIST_DESKTOP_STICKY_HEADER_STYLE` | const | The inline style of the sticky header cells of `SmartListDesktop` (`position: sticky`, `top: 0`). |
45
+
46
+ The preset's class helpers (`getListDesktopContainerClasses`, `getListDesktopTableClasses`, `getListDesktopHeaderRowClasses`, `getListDesktopHeaderCellClasses`, `getListDesktopSortButtonClasses`, `getListDesktopSortIndicatorClasses`, `getListDesktopRowClasses`, `getListDesktopCellClasses`) are exported too, for a custom implementation that wants the preset look.
44
47
 
45
48
  ## Props and Types
46
49
 
@@ -72,8 +75,8 @@ Props of a list mode implementation (`SmartListDesktop`, `SmartListMobile`, `Sma
72
75
  | `pagination?` | `IListPaginationOptions` | — | Paging state and loaders: with `PaginationMode.singlePage` the modes render the pager below the rows, with `PaginationMode.infiniteScroll` they load the next page when the end of the rows scrolls into view. |
73
76
  | `cellPipe?` | `ICellPipe<T>` | — | Formats cells: `transform(item, key, translate?)` returns text (sanitised) or `trustHtml(html)`. |
74
77
  | `componentFactories?` | `IListComponentFactories<T>` | — | `top`: a component rendered above the rows. |
75
- | `sort?` | `\| boolean \| { default?: string; defaultDesc?: boolean; }` | `{}` | Passed to the mode components (`useList().sort`); the library's modes render no sort controls. |
76
- | `details?` | `\| boolean \| { provider?: IDetailsProvider<T>; componentFactories?: IDetailsComponentFactories<T>; component?: ComponentType<any>; }` | — | Requires a `provider` (`IDetailsProvider`) when set; `useList` exposes `select` / `unselect`, `detailsComponent` and its props for a mode that shows details. The library's modes do not render them. |
78
+ | `sort?` | `\| boolean \| { default?: string; defaultDesc?: boolean; }` | — | Makes the field headers of the desktop modes sort buttons; `default` / `defaultDesc` is the sort they show at first (see [Sorting](#sorting)). |
79
+ | `details?` | `\| boolean \| { provider?: IDetailsProvider<T>; componentFactories?: IDetailsComponentFactories<T>; component?: ComponentType<any>; }` | — | Adds a details action (`show`) to every item that opens `component` (`SmartDetailsPage` by default) in a modal; requires a `provider` (`IDetailsProvider`). See [Details](#details). |
77
80
  | `item?` | `\| boolean \| { options?: ItemOptions; }` | — | Adds the item action: `{ options: { routingPrefix, edit } }` navigates to `routingPrefix + id`, `{ options: { select, edit } }` calls `select(id)`. Setting `item` without `options` throws. |
78
81
  | `remove?` | `\| boolean \| { provider?: IRemoveProvider<T>; }` | — | Adds the remove action: an alert (`OBJECT.confirmDelete`) then `provider.invoke(id)`; `provider.check(item)` hides it per row. |
79
82
  | `select?` | `'multi'` | — | `'multi'` adds a checkbox column (desktop); changes go to `provider.onChangeMultiSelected`. |
@@ -100,13 +103,13 @@ What mode components receive: `IListOptions` plus the resolved `fields`. Extends
100
103
 
101
104
  ### `IListProvider<T>`
102
105
 
103
- | Field | Type | Default | Description |
104
- | ------------------------ | -------------------------- | -------- | ----------------------------------------------------------------------------------------- |
105
- | `getData` | `(filter: any) => void` | required | Declared for the provider's owner (CRUD providers read with it); the list never calls it. |
106
- | `onChangeMultiSelected?` | `(list: Array<T>) => void` | — | Called with the selected records when `select: 'multi'`. |
107
- | `onCleanMultiSelected$?` | `SmartSubscribable<void>` | — | Clears the multi-selection whenever it emits. |
108
- | `list` | `T[]` | required | The records to show. |
109
- | `loading` | `boolean` | required | Shows the loader while `true`. |
106
+ | Field | Type | Default | Description |
107
+ | ------------------------ | -------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------- |
108
+ | `getData` | `(filter: any) => void` | required | Reads the data again with `filter` merged in; a sortable header calls it with `{ offset: 0, sortBy, sortDesc }`. |
109
+ | `onChangeMultiSelected?` | `(list: Array<T>) => void` | — | Called with the selected records when `select: 'multi'`. |
110
+ | `onCleanMultiSelected$?` | `SmartSubscribable<void>` | — | Clears the multi-selection whenever it emits. |
111
+ | `list` | `T[]` | required | The records to show. |
112
+ | `loading` | `boolean` | required | Shows the loader while `true`. |
110
113
 
111
114
  ### `ICellPipe<T>`
112
115
 
@@ -169,6 +172,13 @@ Anything with a `subscribe(listener)` that returns an `unsubscribe()` handle, e.
169
172
  | `select` | `(id: string) => void` | required | Called with the id instead of navigating. |
170
173
  | `edit` | `boolean` | required | Whether the target opens for editing (passed along). |
171
174
 
175
+ ### `IListSortState` and `IListSortFilter`
176
+
177
+ | Type | Fields |
178
+ | ----------------- | -------------------------------------------------------------------------------------- |
179
+ | `IListSortState` | `key: string`, `desc: boolean`: the sort a list shows (`useList().activeSort`). |
180
+ | `IListSortFilter` | `offset: 0`, `sortBy: string`, `sortDesc: boolean`: what a header passes to `getData`. |
181
+
172
182
  ### Related types
173
183
 
174
184
  - `ListMode` (enum): `mobile = 'mobile', desktop = 'desktop', masonryGrid = 'masonryGrid'` — The list layouts.
@@ -241,6 +251,20 @@ export function NoteList({
241
251
 
242
252
  Memoise `options`: `SmartList` recomputes its internal options whenever the object changes.
243
253
 
254
+ ## Sorting
255
+
256
+ With `sort` set (`true`, or `{ default?, defaultDesc? }`), every field header of `SmartListDesktop` and `SmartListDesktopPreset` is a sort button with an arrow: `↕` on the headers that do not sort the list, `↑` / `↓` on the active one, which also carries `aria-sort` (`ascending` / `descending`). A click on another column sorts by it in ascending order, a click on the active column turns the direction around. The list does not sort the rows itself: it calls `provider.getData({ offset: 0, sortBy, sortDesc })` and the provider loads the rows in that order, from the first page. The CRUD list page (`@smartsoft001/crud-shell-react`) merges that filter into its `ICrudFilter` and passes the filter's sort back as `sort`. The expanded columns of a `dynamic` field do not sort; the mobile and masonry modes have no headers.
257
+
258
+ `sort.default` and `sort.defaultDesc` only set the header shown at first. The clicked sort stays while other options change and starts over from `sort.default` when `sort` is a new object, so keep `sort` stable (a constant or a memoised value).
259
+
260
+ ## Details
261
+
262
+ With `details: { provider }`, every item gets a details action, labelled with the `show` translation (`data-role="details"`): a column of the desktop table and a button in the mobile rows and the masonry tiles (standard and presets). `useList().detailsHandler(item)` clears the provider (`clearData()`), opens `SmartListDetailsModal` through `ModalService` (mode `'bottom'`, rendered by `SmartModalHost`, see `react-components-overlays`) around `details.component`, or `SmartDetailsPage` by default, and asks the provider for the item (`getData(id)`). The modal reads `detailsComponentProps` (`IDetailsOptions`: `item` and `loading` from the provider, `type`, the list's `itemHandler` / `removeHandler`, `details.componentFactories`) from a store the list updates, so it shows the item once the provider has loaded it. Without a `provider`, setting `details` throws `Must set details provider`.
263
+
264
+ ## Infinite scroll
265
+
266
+ With `pagination.mode` set to `PaginationMode.infiniteScroll` and `page < totalPages`, every mode renders an empty `<div data-role="infinite-scroll" aria-hidden="true">` after its items, watched by an `IntersectionObserver`. When it scrolls into view the list calls `pagination.loadNextPage()` (never twice at the same time), and it watches it again after every page. On the last page the element is gone; without `IntersectionObserver` (server rendering) nothing loads. `pagination.limit` is not read by the list.
267
+
244
268
  ## Replacing the Implementation
245
269
 
246
270
  - **Per mode**: `listModeComponents` on `SmartProvider` maps a `ListMode` to a component taking `SmartListModeProps` (merged over `SmartListDesktop` / `SmartListMobile` / `SmartListMasonryGrid`). `LIST_PRESET_MODE_COMPONENTS` registers the Preline-styled `SmartListDesktopPreset`, `SmartListMobilePreset` and `SmartListMasonryGridPreset`.
@@ -298,8 +322,9 @@ function useList<T extends IEntity<string>>({ options }: SmartListModeProps<T>);
298
322
  | `removeHandler` | `((item: T) => void) \| null` | Confirms and removes a record (`null` without `remove`). |
299
323
  | `checkRemoveHandler` | `((item: T) => boolean) \| undefined` | `remove.provider.check`. |
300
324
  | `itemHandler` | `((id: string) => void) \| null` | Navigates to / selects an id (`null` without `item`). |
301
- | `detailsComponent` | `ComponentType<any> \| null` | `details.component`, `null` without it. |
302
- | `detailsComponentProps` | `IDetailsOptions<T> \| null` | The `IDetailsOptions` for `detailsComponent`. |
325
+ | `detailsComponent` | `ComponentType<any> \| null` | `details.component`, `null` without it (the details action then opens `SmartDetailsPage`). |
326
+ | `detailsComponentProps` | `IDetailsOptions<T> \| null` | The `IDetailsOptions` the details component gets as `value`, `null` without `details`. |
327
+ | `detailsHandler` | `((item: T) => void) \| null` | Opens the details of an item in a modal (`null` without `details`). |
303
328
  | `select` | `((id: string) => void) \| undefined` | `details.provider.getData`. |
304
329
  | `unselect` | `(() => void) \| undefined` | `details.provider.clearData`. |
305
330
  | `detailsButtonOptions` | `IButtonOptions` | `IButtonOptions` that close the details (`unselect`). |
@@ -310,6 +335,12 @@ function useList<T extends IEntity<string>>({ options }: SmartListModeProps<T>);
310
335
  | `handlePageChange` | `(nextPage: number) => void` | Moves to a page through the loaders (for `SmartPaging`'s `onPageChange`). |
311
336
  | `infiniteScroll` | `boolean` | `true` with `PaginationMode.infiniteScroll` and a next page. |
312
337
  | `infiniteScrollRef` | `RefObject<HTMLDivElement \| null>` | Attach to an element after the rows; the next page loads when it scrolls into view. |
338
+ | `sortable` | `boolean` | `true` with `options.sort`. |
339
+ | `activeSort` | `IListSortState \| null` | The sort the headers show. |
340
+ | `isSortable` | `(key: string) => boolean` | Whether the header of a column sorts. |
341
+ | `sortBy` | `(key: string) => void` | Sorts by a column through `provider.getData({ offset: 0, sortBy, sortDesc })`. |
342
+ | `getAriaSort` | `(key: string) => 'ascending' \| 'descending' \| null` | The `aria-sort` of a header (only the active one has it). |
343
+ | `getSortIndicator` | `(key: string) => string` | The arrow of a header: `↑`, `↓`, or `↕` when it is not active. |
313
344
 
314
345
  ```tsx
315
346
  import type { IEntity } from '@smartsoft001/domain-core';
@@ -374,6 +405,8 @@ Source: `packages/shared/react/src/lib/components/list/` in the smartsoft001 rep
374
405
  - `desktop/list-desktop.tsx`: `SmartListDesktop`
375
406
  - `desktop/preset/list-desktop-preset.tsx`: `SmartListDesktopPreset`
376
407
  - `desktop/use-list-desktop.ts`: `useListDesktop`, `LIST_DESKTOP_STICKY_HEADER_STYLE`
408
+ - `list-details-modal.tsx`: `SmartListDetailsModal`
409
+ - `list-sort.ts`: `IListSortState`, `IListSortFilter`, `getListDefaultSort`, `getNextListSort`, `getListAriaSort`, `getListSortIndicator`, `isListSortableKey`
377
410
  - `list-title-key.ts`: `isListImageKey`, `getListTitleKey`
378
411
  - `list.tsx`: `SmartList`
379
412
  - `list.types.ts`: `SmartListProps`, `SmartListModeProps`
@@ -81,7 +81,7 @@ Payload of `onActionClick`.
81
81
 
82
82
  ## Opening a component in a modal from code
83
83
 
84
- `useModalService().show({ component, props })` opens `component` inside a `SmartModal` rendered by the modal host of `SmartProvider` (see `react-components-overlays`). The component receives its `props` and a `dismiss(data)` prop; `onDidDismiss()` resolves with `{ data }`. `useModalService().dismiss(data)` closes the modal opened last.
84
+ `useModalService().show({ component, props })` opens `component` inside a `SmartModal` with its close button, rendered by the modal host of `SmartProvider` (see `react-components-overlays`, which also describes `mode`, `cssClass` and `backdropDismiss`). The component receives its `props` and a `dismiss(data)` prop; `onDidDismiss()` resolves with `{ data }`, `{ data: null }` when the modal closed itself. `useModalService().dismiss(data)` closes the modal opened last.
85
85
 
86
86
  ```tsx
87
87
  import { SmartButton, useModalService } from '@smartsoft001/react';
@@ -247,12 +247,12 @@ export function CustomModal(props: SmartModalProps) {
247
247
  }
248
248
  ```
249
249
 
250
- Registered as `components={{ modal: CustomModal }}`, it renders both the `SmartModal`s placed by hand and the modals of `ModalService.show` (which pass `open`, `className` from `cssClass`, `onClosed` and the component as `children`).
250
+ Registered as `components={{ modal: CustomModal }}`, it renders both the `SmartModal`s placed by hand and the modals of `ModalService.show` (which pass `open`, `className` from `cssClass`, `options` with `withDismiss: true`, `onClosed` and the component as `children`).
251
251
 
252
252
  ## Styling
253
253
 
254
254
  - `SmartModalStandard` is always in the DOM as a `<dialog>` and shown through its `open` attribute; its native `close` event closes the modal too. Action buttons carry `data-variant`.
255
- - `SmartModalPreset` renders inline with a `fixed` backdrop over the viewport; a click on the backdrop itself or Escape closes it. It carries `smart:dark:` variants.
255
+ - `SmartModalPreset` renders inline with a `fixed` backdrop over the viewport; a click on the backdrop itself or Escape closes it; with preset modals stacked, Escape closes only the one on top. It carries `smart:dark:` variants.
256
256
 
257
257
  ## File Locations
258
258
 
@@ -67,9 +67,9 @@ A toast with a title shows the title as the heading and the message under it; wi
67
67
  interface IModalServiceOptions {
68
68
  component: ComponentType<any>; // receives `props` and a `dismiss(data)` prop
69
69
  props?: Record<string, unknown>;
70
- mode?: 'default' | 'bottom'; // not read by SmartModalHost
70
+ mode?: 'default' | 'bottom'; // 'bottom' adds the smart-modal-bottom class
71
71
  cssClass?: string[]; // joined into the SmartModal className
72
- backdropDismiss?: boolean; // not read by SmartModalHost
72
+ backdropDismiss?: boolean; // false: the backdrop and Escape leave it open
73
73
  }
74
74
 
75
75
  interface IModal {
@@ -78,7 +78,7 @@ interface IModal {
78
78
  }
79
79
  ```
80
80
 
81
- `SmartModalHost` renders each request as `<SmartModal open className={cssClass.join(' ')} onClosed={() => dismiss()}>` around `<component {...props} dismiss={dismiss} />`, so closing the modal by its own controls resolves `onDidDismiss()` with `{ data: null }`.
81
+ `SmartModalHost` renders each request in a `<div data-role="modal" data-mode={mode}>` as `<SmartModal open className options={{ withDismiss: true }} onClosed={() => dismiss()}>` around `<component {...props} dismiss={dismiss} />`, its `className` being `cssClass` plus `smart-modal-bottom` for `mode: 'bottom'`. So every modal shows its close button, and closing the modal by its own controls (close button, backdrop, Escape) resolves `onDidDismiss()` with `{ data: null }`. The modals stack in opening order, the last one on top. With `backdropDismiss: false` a click on the backdrop (outside the `role="dialog"` element) is stopped before the modal sees it, and `ModalService` stops Escape at the document while that modal is on top; the close button and `dismiss()` still close it. `smart-modal-bottom` is a class for the application to style (a sheet docked at the bottom); the modal implementations do not style it.
82
82
 
83
83
  ## Usage
84
84
 
@@ -45,10 +45,10 @@ Extends `SmartPageVariantProps`.
45
45
 
46
46
  The props of a page variant (what `<SmartPage>` hands to the resolved component): the options, with `bodyTpl` already merged with the wrapper's children, and the CSS class.
47
47
 
48
- | Prop | Type | Default | Description |
49
- | ------------ | ---------------------- | ------- | ----------------------------------------------------------------------------- |
50
- | `options?` | `IPageOptions \| null` | — | The page options, with `bodyTpl` already set from `children`. |
51
- | `className?` | `string` | — | Classes of the page root (the standard rendering has no root and ignores it). |
48
+ | Prop | Type | Default | Description |
49
+ | ------------ | ---------------------- | ------- | ------------------------------------------------------------- |
50
+ | `options?` | `IPageOptions \| null` | — | The page options, with `bodyTpl` already set from `children`. |
51
+ | `className?` | `string` | — | Classes of the page root (`data-role="page"`). |
52
52
 
53
53
  ### `IPageOptions`
54
54
 
@@ -208,7 +208,7 @@ function usePage();
208
208
 
209
209
  ## Styling
210
210
 
211
- - `SmartPageStandard` renders no wrapper element (header and body are siblings) and does not apply `className`.
211
+ - `SmartPageStandard` renders the header and the body in one root element (`data-role="page"`) and puts `className` on it.
212
212
  - `SmartPagePreset` appends `className` to its root and renders a gray page body with the content in a card, with `smart:dark:` variants.
213
213
 
214
214
  ## File Locations
@@ -27,7 +27,7 @@ All from `@smartsoft001/react`.
27
27
  | `SmartVerticalNavigationStandard` | component | The default vertical navigation rendering. |
28
28
  | `useVerticalNavigation` | hook | The behaviour every vertical navigation variant shares: `options.items` normalised into a first, untitled group followed by `options.groups`, and the item click. |
29
29
 
30
- The preset's class helpers (`getVerticalNavContainerClasses`, `getVerticalNavNavClasses`, `getVerticalNavGroupTitleClasses`, `getVerticalNavItemClasses`, `getVerticalNavIconClasses`, `getVerticalNavInitialClasses`, `getVerticalNavBadgeClasses`) are exported too, for a custom implementation that wants the preset look.
30
+ The preset's class helpers (`getVerticalNavContainerClasses` for the `<nav>`, `getVerticalNavNavClasses` for a group's list, `getVerticalNavListItemClasses`, `getVerticalNavGroupTitleClasses`, `getVerticalNavItemClasses`, `getVerticalNavIconClasses`, `getVerticalNavInitialClasses`, `getVerticalNavBadgeClasses`) are exported too, for a custom implementation that wants the preset look.
31
31
 
32
32
  ## Props and Types
33
33
 
@@ -44,7 +44,7 @@ The preset's class helpers (`getVerticalNavContainerClasses`, `getVerticalNavNav
44
44
  | Field | Type | Default | Description |
45
45
  | ------------ | ------------------------ | ----------- | ----------------------------------------------------------------------------------------------------- |
46
46
  | `layout?` | `SmartVerticalNavLayout` | — | Not read by the built-in implementations (standard and preset); available to a custom implementation. |
47
- | `ariaLabel?` | `string` | `'Sidebar'` | Accessible name of the `nav`. |
47
+ | `ariaLabel?` | `string` | `'Sidebar'` | Accessible name of the one `nav` landmark (the groups are lists named by their title). |
48
48
  | `items?` | `IVerticalNavItem[]` | — | The first, untitled group. |
49
49
  | `groups?` | `IVerticalNavGroup[]` | — | Further groups, each with a title. |
50
50
 
@@ -198,7 +198,7 @@ export function PlainVerticalNav(props: SmartVerticalNavigationProps) {
198
198
 
199
199
  ## Styling
200
200
 
201
- - The standard rendering is unstyled; the preset renders every group as its own `<nav>` after its title, with `smart:dark:` variants.
201
+ - Both renderings put every group in one `<nav>` landmark (named by `options.ariaLabel`, `'Sidebar'` by default); a group is a list (`role="list"`) of its items, named by its title through `aria-labelledby`. The standard rendering is unstyled; the preset renders the vertical tabs, each group's title before its list, with `smart:dark:` variants.
202
202
 
203
203
  ## File Locations
204
204
 
@@ -84,7 +84,7 @@ The provider creates its services **once** and keeps them for its lifetime. Pass
84
84
  | `authInterceptor` | `boolean` | `true` | Adds the bearer token to the default HTTP client's requests. |
85
85
  | `storageService`, `authService`, `toastService`, `alertService`, `modalService`, `menuService`, `appService` | the service classes | created by the provider | Services of your own (e.g. subclasses). |
86
86
  | `modelLabelProvider` | `IModelLabelProvider \| null` | `null` | Field labels from code. |
87
- | `modelPossibilitiesProvider` | `IModelPossibilitiesProvider \| null` | `null` | Options of `enum` / `radio` / `check` / `strings` fields from code. |
87
+ | `modelPossibilitiesProvider` | `IModelPossibilitiesProvider \| null` | `null` | Options of `radio` / `check` fields and of the preset `enum` field, from code. |
88
88
  | `modelValidatorsProvider` | `IModelValidatorsProvider \| null` | `null` | Validators of model fields from code (`react-forms`). |
89
89
  | `modelExportProvider`, `modelImportProvider`, `appProvider` | provider interfaces | `null` | Held in the context (`useSmart()`) for components of your own; no library component reads them. |
90
90
  | `children` | `ReactNode` | — | The application. |
@@ -53,14 +53,14 @@ Enough for the store, the facade and components of your own.
53
53
  | Field | Type | What it does |
54
54
  | ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
55
55
  | `title` | `string` | Required. The list page heading (translated). |
56
- | `details` | `boolean \| { cellPipe?: ICellPipe<T>; components?: { top?; bottom? } }` | Rows link to the item page, which opens read-only with `SmartDetails`; `components` render above / below the details. |
56
+ | `details` | `boolean \| { cellPipe?: ICellPipe<T>; components?: { top?; bottom? } }` | Rows link to the item page, which opens read-only with `SmartDetails`, and get a details action that opens the record in a modal (`SmartDetailsPage`); `components` render above / below the details. |
57
57
  | `edit` | `boolean \| { cellPipe?; components?: { top?; bottom? } }` | A record can be edited; `components` render above / below the form while editing. |
58
58
  | `add` | `boolean \| { components?: { top?; bottom? } }` | The add button (navigates to `<basePath>/add`); `components` render above / below the form while creating. |
59
59
  | `remove` | `boolean` | A remove action per row, confirmed by the list, offered only where the model's `remove.enabled` allows it. |
60
60
  | `search` | `boolean` | The search box of the page header; a search reads the first page with `searchText`. |
61
61
  | `export` | `boolean` | The export button: `SmartCrudExport` in a modal (CSV or XLSX of the current filter, without paging). |
62
62
  | `pagination` | `{ limit: number }` | Page size; the first read starts at offset 0. The backend caps a page (100 by default). |
63
- | `sort` | `boolean \| { default?: string; defaultDesc?: boolean }` | Whether sorting is offered, and the column the first read sorts by. |
63
+ | `sort` | `boolean \| { default?: string; defaultDesc?: boolean }` | Whether sorting is offered, and the column the first read sorts by. The desktop list headers sort the list: a click reads again with `sortBy` / `sortDesc` from the first page. |
64
64
  | `list` | `{ cellPipe?; components?: { top?; multi? }; mode?: ListMode; paginationMode?: PaginationMode; resetQuery?: 'beforeInit'; groups?: Array<ICrudListGroup> }` | Cell formatting, a component above the list and one in the multiselect panel, the list layout and paging mode, grouping, and with `resetQuery` a first read from the configured defaults instead of the filter the feature already has. |
65
65
  | `buttons` | `Array<IIconButtonOptions>` | Extra buttons appended to the list page header. |
66
66
  | `inputComponents` | `{ [key: string]: ComponentType<any> }` | Field components for named fields of the form (see `react-components-input`). |