@smartsoft001/claude-plugins 2.201.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 +1 -1
- package/plugins/smart-angular/.claude-plugin/plugin.json +1 -1
- package/plugins/smart-angular/skills/angular-components-accordion/SKILL.md +84 -80
- package/plugins/smart-angular/skills/angular-components-action-panel/SKILL.md +35 -60
- package/plugins/smart-angular/skills/angular-components-alert/SKILL.md +24 -29
- package/plugins/smart-angular/skills/angular-components-avatar/SKILL.md +30 -30
- package/plugins/smart-angular/skills/angular-components-badge/SKILL.md +18 -12
- package/plugins/smart-angular/skills/angular-components-breadcrumbs/SKILL.md +27 -10
- package/plugins/smart-angular/skills/angular-components-button/SKILL.md +43 -17
- package/plugins/smart-angular/skills/angular-components-button-group/SKILL.md +26 -14
- package/plugins/smart-angular/skills/angular-components-calendar/SKILL.md +47 -28
- package/plugins/smart-angular/skills/angular-components-card/SKILL.md +29 -22
- package/plugins/smart-angular/skills/angular-components-card-heading/SKILL.md +24 -18
- package/plugins/smart-angular/skills/angular-components-command-palette/SKILL.md +41 -32
- package/plugins/smart-angular/skills/angular-components-container/SKILL.md +21 -20
- package/plugins/smart-angular/skills/angular-components-date-edit/SKILL.md +48 -45
- package/plugins/smart-angular/skills/angular-components-date-range/SKILL.md +72 -82
- package/plugins/smart-angular/skills/angular-components-description-list/SKILL.md +23 -10
- package/plugins/smart-angular/skills/angular-components-detail/SKILL.md +20 -8
- package/plugins/smart-angular/skills/angular-components-details/SKILL.md +64 -13
- package/plugins/smart-angular/skills/angular-components-divider/SKILL.md +36 -18
- package/plugins/smart-angular/skills/angular-components-drawer/SKILL.md +28 -23
- package/plugins/smart-angular/skills/angular-components-dropdown/SKILL.md +35 -16
- package/plugins/smart-angular/skills/angular-components-empty-state/SKILL.md +49 -11
- package/plugins/smart-angular/skills/angular-components-feed/SKILL.md +45 -12
- package/plugins/smart-angular/skills/angular-components-form/SKILL.md +53 -25
- package/plugins/smart-angular/skills/angular-components-grid-list/SKILL.md +37 -13
- package/plugins/smart-angular/skills/angular-components-icon/SKILL.md +8 -8
- package/plugins/smart-angular/skills/angular-components-info/SKILL.md +19 -15
- package/plugins/smart-angular/skills/angular-components-input/SKILL.md +86 -49
- package/plugins/smart-angular/skills/angular-components-list/SKILL.md +131 -81
- package/plugins/smart-angular/skills/angular-components-list-container/SKILL.md +24 -32
- package/plugins/smart-angular/skills/angular-components-media-object/SKILL.md +19 -17
- package/plugins/smart-angular/skills/angular-components-modal/SKILL.md +78 -17
- package/plugins/smart-angular/skills/angular-components-multi-column-layout/SKILL.md +19 -16
- package/plugins/smart-angular/skills/angular-components-navbar/SKILL.md +38 -21
- package/plugins/smart-angular/skills/angular-components-notification/SKILL.md +32 -33
- package/plugins/smart-angular/skills/angular-components-page/SKILL.md +48 -52
- package/plugins/smart-angular/skills/angular-components-page-heading/SKILL.md +42 -25
- package/plugins/smart-angular/skills/angular-components-paging/SKILL.md +17 -15
- package/plugins/smart-angular/skills/angular-components-password-strength/SKILL.md +21 -19
- package/plugins/smart-angular/skills/angular-components-progress-bars/SKILL.md +61 -24
- package/plugins/smart-angular/skills/angular-components-searchbar/SKILL.md +30 -37
- package/plugins/smart-angular/skills/angular-components-section-heading/SKILL.md +38 -27
- package/plugins/smart-angular/skills/angular-components-select-menu/SKILL.md +33 -17
- package/plugins/smart-angular/skills/angular-components-sidebar-layout/SKILL.md +30 -26
- package/plugins/smart-angular/skills/angular-components-sidebar-navigation/SKILL.md +79 -16
- package/plugins/smart-angular/skills/angular-components-sign-in-form/SKILL.md +64 -24
- package/plugins/smart-angular/skills/angular-components-stacked-layout/SKILL.md +24 -23
- package/plugins/smart-angular/skills/angular-components-stacked-list/SKILL.md +40 -21
- package/plugins/smart-angular/skills/angular-components-stats/SKILL.md +28 -15
- package/plugins/smart-angular/skills/angular-components-table/SKILL.md +42 -22
- package/plugins/smart-angular/skills/angular-components-tabs/SKILL.md +37 -13
- package/plugins/smart-angular/skills/angular-components-textarea/SKILL.md +48 -46
- package/plugins/smart-angular/skills/angular-components-toggle/SKILL.md +21 -28
- package/plugins/smart-angular/skills/angular-components-vertical-navigation/SKILL.md +66 -24
- package/plugins/smart-angular/skills/smart-crud/SKILL.md +5 -2
- package/plugins/smart-core/.claude-plugin/plugin.json +1 -1
- package/plugins/smart-react/.claude-plugin/plugin.json +1 -1
- package/plugins/smart-react/skills/react-components-action-panel/SKILL.md +13 -13
- package/plugins/smart-react/skills/react-components-alert/SKILL.md +2 -2
- package/plugins/smart-react/skills/react-components-avatar/SKILL.md +11 -11
- package/plugins/smart-react/skills/react-components-badge/SKILL.md +2 -2
- package/plugins/smart-react/skills/react-components-breadcrumbs/SKILL.md +7 -7
- package/plugins/smart-react/skills/react-components-button/SKILL.md +20 -20
- package/plugins/smart-react/skills/react-components-button-group/SKILL.md +2 -2
- package/plugins/smart-react/skills/react-components-calendar/SKILL.md +13 -13
- package/plugins/smart-react/skills/react-components-card/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-card-heading/SKILL.md +2 -2
- package/plugins/smart-react/skills/react-components-command-palette/SKILL.md +3 -3
- package/plugins/smart-react/skills/react-components-container/SKILL.md +6 -6
- package/plugins/smart-react/skills/react-components-date-edit/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-date-range/SKILL.md +4 -4
- package/plugins/smart-react/skills/react-components-description-list/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-detail/SKILL.md +25 -16
- package/plugins/smart-react/skills/react-components-details/SKILL.md +16 -16
- package/plugins/smart-react/skills/react-components-divider/SKILL.md +6 -6
- package/plugins/smart-react/skills/react-components-drawer/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-dropdown/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-empty-state/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-feed/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-grid-list/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-info/SKILL.md +3 -1
- package/plugins/smart-react/skills/react-components-input/SKILL.md +51 -17
- package/plugins/smart-react/skills/react-components-list/SKILL.md +81 -45
- package/plugins/smart-react/skills/react-components-list-container/SKILL.md +6 -6
- package/plugins/smart-react/skills/react-components-loader/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-media-object/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-modal/SKILL.md +10 -10
- package/plugins/smart-react/skills/react-components-multi-column-layout/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-navbar/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-notification/SKILL.md +9 -9
- package/plugins/smart-react/skills/react-components-overlays/SKILL.md +3 -3
- package/plugins/smart-react/skills/react-components-page/SKILL.md +5 -5
- package/plugins/smart-react/skills/react-components-page-heading/SKILL.md +6 -6
- package/plugins/smart-react/skills/react-components-paging/SKILL.md +28 -28
- package/plugins/smart-react/skills/react-components-password-strength/SKILL.md +4 -4
- package/plugins/smart-react/skills/react-components-progress-bars/SKILL.md +19 -19
- package/plugins/smart-react/skills/react-components-searchbar/SKILL.md +10 -10
- package/plugins/smart-react/skills/react-components-section-heading/SKILL.md +13 -13
- package/plugins/smart-react/skills/react-components-select-menu/SKILL.md +19 -19
- package/plugins/smart-react/skills/react-components-sidebar-layout/SKILL.md +9 -9
- package/plugins/smart-react/skills/react-components-sidebar-navigation/SKILL.md +29 -29
- package/plugins/smart-react/skills/react-components-sign-in-form/SKILL.md +3 -3
- package/plugins/smart-react/skills/react-components-stacked-layout/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-stacked-list/SKILL.md +2 -2
- package/plugins/smart-react/skills/react-components-stats/SKILL.md +2 -2
- package/plugins/smart-react/skills/react-components-table/SKILL.md +1 -1
- package/plugins/smart-react/skills/react-components-tabs/SKILL.md +2 -2
- package/plugins/smart-react/skills/react-components-textarea/SKILL.md +8 -8
- package/plugins/smart-react/skills/react-components-toggle/SKILL.md +3 -2
- package/plugins/smart-react/skills/react-components-vertical-navigation/SKILL.md +9 -9
- package/plugins/smart-react/skills/react-provider/SKILL.md +1 -1
- package/plugins/smart-react/skills/smart-crud-react/SKILL.md +2 -2
|
@@ -18,68 +18,97 @@ The `<smart-input>` component renders a form input for a single model field by d
|
|
|
18
18
|
|
|
19
19
|
### InputComponent (`<smart-input>`)
|
|
20
20
|
|
|
21
|
-
Main wrapper component. Resolves `fieldOptions` from `@Field()` decorator metadata on the model, then selects a sub-component from `baseMap` (or `extendMap` override) based on `fieldOptions.type` and renders it via `NgComponentOutlet
|
|
21
|
+
Main wrapper component. Resolves `fieldOptions` from `@Field()` decorator metadata on the model, then selects a sub-component from `baseMap` (or `extendMap` override) based on `fieldOptions.type` and renders it via `NgComponentOutlet`, forwarding `options`, `fieldOptions` and the `class` it receives. Also renders an inline info button when `fieldOptions.info` is set and a loader while `control.status === 'PENDING'`. Below the input, renders `<smart-input-error>` when `control.errors` are present and the control has been touched. A field whose options (for the current `mode`) set `hide: true` renders nothing.
|
|
22
22
|
|
|
23
23
|
### InputBaseComponent (abstract)
|
|
24
24
|
|
|
25
25
|
Abstract base directive for all input sub-components. Provides:
|
|
26
26
|
|
|
27
|
-
- `options: InputSignal<InputOptions<T
|
|
28
|
-
- `fieldOptions: InputSignal<IFieldOptions | undefined>` — resolved field decorator metadata
|
|
29
|
-
- `cssClass: InputSignal<string>` (alias `class`) — external CSS classes
|
|
27
|
+
- `options: InputSignal<InputOptions<T> | undefined>` — field configuration (control, fieldKey, model, mode, treeLevel, possibilities, component)
|
|
28
|
+
- `fieldOptions: InputSignal<IFieldOptions | undefined>` (a required input) — resolved field decorator metadata
|
|
29
|
+
- `cssClass: InputSignal<string>` (alias `class`) — external CSS classes, forwarded by `<smart-input>`
|
|
30
30
|
- `internalOptions`, `control`, `required`, `possibilities` — populated via `effect` when options change
|
|
31
31
|
- `afterSetOptionsHandler()` — hook invoked after options resolve, used by sub-components for validator/possibilities setup
|
|
32
32
|
- `formControl`, `formControlArray`, `formControlGroup` — typed accessors for `control`
|
|
33
33
|
|
|
34
34
|
### InputPossibilitiesBaseComponent (abstract)
|
|
35
35
|
|
|
36
|
-
Extends `InputBaseComponent` for sub-components that need list possibilities
|
|
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.
|
|
45
|
+
|
|
46
|
+
### InputFileBaseComponent (abstract)
|
|
47
|
+
|
|
48
|
+
Extends `InputBaseComponent` for the uploading fields (attachment, image, pdf, video and the file and logo presets). It listens to the hidden `#inputObj` file input, checks the picked file against its `accept` list (a toast with `INPUT.ERRORS.invalidFileType` otherwise), uploads it through `FileService` and sets the result as the control value. It exposes `loading`, `percent`, `file` and the `addButtonOptions`, `showButtonOptions` and `deleteButtonOptions` of the buttons the fields render.
|
|
49
|
+
|
|
50
|
+
### InputErrorComponent (`<smart-input-error>`)
|
|
51
|
+
|
|
52
|
+
The validation messages `<smart-input>` renders under a touched field. Its only input is `errors` (the control's `ValidationErrors`). Messages, in order: `required` (which hides `confirm`), `confirm`, `invalidNip`, `invalidUnique`, `email`, `phoneNumber`, `pesel` or `invalidPesel` (one message), `minlength`, `maxlength`, `min`, `max` and `customMessage` (shown as is), translated from `INPUT.ERRORS.*`. `InputComponent` always renders this component; there is no token to replace it.
|
|
37
53
|
|
|
38
54
|
### Default Sub-Components
|
|
39
55
|
|
|
40
|
-
| FieldType | Sub-component | Selector | Description
|
|
41
|
-
| --------------- | ----------------------------- | ----------------------------- |
|
|
42
|
-
| `text` | `InputTextComponent` | `smart-input-text` | Plain text input
|
|
43
|
-
| `email` | `InputEmailComponent` | `smart-input-email` | Email input
|
|
44
|
-
| `password` | `InputPasswordComponent` | `smart-input-password` | Password input
|
|
45
|
-
| `nip` | `InputNipComponent` | `smart-input-nip` | NIP with built-in `invalidNip` validator
|
|
46
|
-
| `pesel` | `InputPeselComponent` | `smart-input-pesel` | PESEL text input
|
|
47
|
-
| `int` | `InputIntComponent` | `smart-input-int` | Integer input (`type="number" step="1"`)
|
|
48
|
-
| `float` | `InputFloatComponent` | `smart-input-float` | Decimal input (`type="number" step="0.01"`)
|
|
49
|
-
| `currency` | `InputCurrencyComponent` | `smart-input-currency` | Currency input (`type="number" step="0.01"`)
|
|
50
|
-
| `phoneNumber` | `InputPhoneNumberComponent` | `smart-input-phone-number` | Telephone input
|
|
51
|
-
| `phoneNumberPl` | `InputPhoneNumberPlComponent` | `smart-input-phone-number-pl` | Telephone input + built-in length(9) validator
|
|
52
|
-
| `longText` | `InputLongTextComponent` | `smart-input-long-text` | Rich text editor (`ngx-editor`)
|
|
53
|
-
| `date` | `InputDateComponent` | `smart-input-date` | HTML date input (`type="date"`)
|
|
54
|
-
| `dateWithEdit` | `InputDateWithEditComponent` | `smart-input-date-with-edit` | Digit-by-digit date via `<smart-date-edit>`
|
|
55
|
-
| `dateRange` | `InputDateRangeComponent` | `smart-input-date-range` | Date range via `<smart-date-range>`
|
|
56
|
-
| `flag` | `InputFlagComponent` | `smart-input-flag` | Single checkbox
|
|
57
|
-
| `radio` | `InputRadioComponent` | `smart-input-radio` | Radio group (from possibilities)
|
|
58
|
-
| `check` | `InputCheckComponent` | `smart-input-check` | Checkbox group (from possibilities)
|
|
59
|
-
| `enum` | `InputEnumComponent` | `smart-input-enum` |
|
|
60
|
-
| `color` | `InputColorComponent` | `smart-input-color` | Color picker (`ngx-color-picker`)
|
|
61
|
-
| `logo` | `InputLogoComponent` | `smart-input-logo` | Image
|
|
62
|
-
| `address` | `InputAddressComponent` | `smart-input-address` | Nested `FormGroup` (city/zip/street/building/flat)
|
|
63
|
-
| `object` | `InputObjectComponent` | `smart-input-object` | Nested form via `FORM_COMPONENT_TOKEN`
|
|
64
|
-
| `array` | `InputArrayComponent` | `smart-input-array` | Dynamic array of nested forms
|
|
65
|
-
| `ints` | `InputIntsComponent` | `smart-input-ints` | Dynamic list of integer inputs
|
|
66
|
-
| `strings` | `InputStringsComponent` | `smart-input-strings` | Dynamic list of string inputs
|
|
67
|
-
| `file` | `InputFileComponent` | `smart-input-file` | Generic file chooser
|
|
68
|
-
| `attachment` | `InputAttachmentComponent` | `smart-input-attachment` | File upload (any type) with download/delete
|
|
69
|
-
| `image` | `InputImageComponent` | `smart-input-image` | Image upload with preview
|
|
70
|
-
| `pdf` | `InputPdfComponent` | `smart-input-pdf` | PDF upload with show/delete
|
|
71
|
-
| `video` | `InputVideoComponent` | `smart-input-video` | Video upload with play/delete
|
|
56
|
+
| FieldType | Sub-component | Selector | Description |
|
|
57
|
+
| --------------- | ----------------------------- | ----------------------------- | --------------------------------------------------------------------------------------------------------------- |
|
|
58
|
+
| `text` | `InputTextComponent` | `smart-input-text` | Plain text input |
|
|
59
|
+
| `email` | `InputEmailComponent` | `smart-input-email` | Email input |
|
|
60
|
+
| `password` | `InputPasswordComponent` | `smart-input-password` | Password input; adds `<smart-password-strength>` when the field's `possibilities.strength` is set |
|
|
61
|
+
| `nip` | `InputNipComponent` | `smart-input-nip` | NIP with built-in `invalidNip` validator |
|
|
62
|
+
| `pesel` | `InputPeselComponent` | `smart-input-pesel` | PESEL text input (the form factory adds the `pesel` check; the preset adds `invalidPesel` too) |
|
|
63
|
+
| `int` | `InputIntComponent` | `smart-input-int` | Integer input (`type="number" step="1"`) |
|
|
64
|
+
| `float` | `InputFloatComponent` | `smart-input-float` | Decimal input (`type="number" step="0.01"`) |
|
|
65
|
+
| `currency` | `InputCurrencyComponent` | `smart-input-currency` | Currency input (`type="number" step="0.01"`) |
|
|
66
|
+
| `phoneNumber` | `InputPhoneNumberComponent` | `smart-input-phone-number` | Telephone input |
|
|
67
|
+
| `phoneNumberPl` | `InputPhoneNumberPlComponent` | `smart-input-phone-number-pl` | Telephone input + built-in length(9) validator |
|
|
68
|
+
| `longText` | `InputLongTextComponent` | `smart-input-long-text` | Rich text editor (`ngx-editor`) |
|
|
69
|
+
| `date` | `InputDateComponent` | `smart-input-date` | HTML date input (`type="date"`) |
|
|
70
|
+
| `dateWithEdit` | `InputDateWithEditComponent` | `smart-input-date-with-edit` | Digit-by-digit date via `<smart-date-edit>` |
|
|
71
|
+
| `dateRange` | `InputDateRangeComponent` | `smart-input-date-range` | Date range via `<smart-date-range>` |
|
|
72
|
+
| `flag` | `InputFlagComponent` | `smart-input-flag` | Single checkbox |
|
|
73
|
+
| `radio` | `InputRadioComponent` | `smart-input-radio` | Radio group (from possibilities) |
|
|
74
|
+
| `check` | `InputCheckComponent` | `smart-input-check` | Checkbox group (from possibilities) |
|
|
75
|
+
| `enum` | `InputEnumComponent` | `smart-input-enum` | One checkbox per key of the field's enum; the value is the list of checked keys (the preset differs, see below) |
|
|
76
|
+
| `color` | `InputColorComponent` | `smart-input-color` | Color picker (`ngx-color-picker`) |
|
|
77
|
+
| `logo` | `InputLogoComponent` | `smart-input-logo` | Image picker with inline preview; stores a base64 `data:` URL, no upload (the preset differs, see below) |
|
|
78
|
+
| `address` | `InputAddressComponent` | `smart-input-address` | Nested `FormGroup` (city/zip/street/building/flat) |
|
|
79
|
+
| `object` | `InputObjectComponent` | `smart-input-object` | Nested form via `FORM_COMPONENT_TOKEN` |
|
|
80
|
+
| `array` | `InputArrayComponent` | `smart-input-array` | Dynamic array of nested forms |
|
|
81
|
+
| `ints` | `InputIntsComponent` | `smart-input-ints` | Dynamic list of integer inputs |
|
|
82
|
+
| `strings` | `InputStringsComponent` | `smart-input-strings` | Dynamic list of string inputs |
|
|
83
|
+
| `file` | `InputFileComponent` | `smart-input-file` | Generic file chooser; keeps the picked `File` as the value, no upload (the preset differs, see below) |
|
|
84
|
+
| `attachment` | `InputAttachmentComponent` | `smart-input-attachment` | File upload (any type) with download/delete |
|
|
85
|
+
| `image` | `InputImageComponent` | `smart-input-image` | Image upload with preview |
|
|
86
|
+
| `pdf` | `InputPdfComponent` | `smart-input-pdf` | PDF upload with show/delete |
|
|
87
|
+
| `video` | `InputVideoComponent` | `smart-input-video` | Video upload with play/delete |
|
|
72
88
|
|
|
73
89
|
## API
|
|
74
90
|
|
|
75
91
|
### InputComponent Inputs
|
|
76
92
|
|
|
77
|
-
| Input | Type | Default
|
|
78
|
-
| --------- | ------------------------------------------- |
|
|
79
|
-
| `options` | `InputSignal<InputOptions<T> \| undefined>` |
|
|
93
|
+
| Input | Type | Default | Description |
|
|
94
|
+
| --------- | ------------------------------------------- | ----------- | ----------------------------------------------------------------------------- |
|
|
95
|
+
| `options` | `InputSignal<InputOptions<T> \| undefined>` | `undefined` | Field configuration |
|
|
96
|
+
| `class` | `InputSignal<string>` | `''` | External CSS classes, forwarded to the field component (alias for `cssClass`) |
|
|
80
97
|
|
|
81
98
|
### InputOptions
|
|
82
99
|
|
|
100
|
+
`InputOptions<T>` is `IInputOptions & IInputFromFieldOptions<T>`.
|
|
101
|
+
|
|
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. |
|
|
111
|
+
|
|
83
112
|
```typescript
|
|
84
113
|
type InputOptions<T> = IInputOptions & IInputFromFieldOptions<T>;
|
|
85
114
|
|
|
@@ -105,14 +134,12 @@ interface IInputFromFieldOptions<T> {
|
|
|
105
134
|
|
|
106
135
|
### INPUT_FIELD_COMPONENTS_TOKEN
|
|
107
136
|
|
|
137
|
+
`InjectionToken<Partial<Record<FieldTypeDef, Type<InputBaseComponent<any>>>>>` from `@smartsoft001/angular` — allows substituting a sub-component for any field type.
|
|
138
|
+
|
|
108
139
|
```typescript
|
|
109
140
|
import { INPUT_FIELD_COMPONENTS_TOKEN } from '@smartsoft001/angular';
|
|
110
141
|
import { FieldType } from '@smartsoft001/models';
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
`InjectionToken<Partial<Record<FieldTypeDef, Type<InputBaseComponent<any>>>>>` — allows substituting a sub-component for any field type.
|
|
114
142
|
|
|
115
|
-
```typescript
|
|
116
143
|
providers: [
|
|
117
144
|
{
|
|
118
145
|
provide: INPUT_FIELD_COMPONENTS_TOKEN,
|
|
@@ -132,8 +159,9 @@ Each field type ships a Preline-styled **preset** (`Input<Field>PresetComponent`
|
|
|
132
159
|
`smart-input-<field>-preset`) alongside the default Tailwind-UI-styled field component. The
|
|
133
160
|
presets live in `<field>/preset/` and all translate the Preline look to `smart:`-prefixed vanilla
|
|
134
161
|
Tailwind with explicit `dark:` variants. Apply them by providing the ready-made map
|
|
135
|
-
`INPUT_PRESET_FIELD_COMPONENTS` for
|
|
136
|
-
validation-message preset)
|
|
162
|
+
`INPUT_PRESET_FIELD_COMPONENTS` for `INPUT_FIELD_COMPONENTS_TOKEN` (it covers all field types
|
|
163
|
+
except the standalone validation-message preset), or with `provideSmartPresets()`, which provides
|
|
164
|
+
it together with every other preset.
|
|
137
165
|
|
|
138
166
|
```typescript
|
|
139
167
|
import {
|
|
@@ -165,6 +193,15 @@ the most recently added ones:
|
|
|
165
193
|
| `video` | `InputVideoPresetComponent` | `smart-input-video-preset` | Dashed drop-zone (accept `.mp4`) + play/delete + `<video>` |
|
|
166
194
|
| `array` | `InputArrayPresetComponent` | `smart-input-array-preset` | Item cards (`space-y-2`), outline add / ghost-red remove |
|
|
167
195
|
|
|
196
|
+
Where a preset behaves differently from the standard component of its type:
|
|
197
|
+
|
|
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`) |
|
|
204
|
+
|
|
168
205
|
Notes:
|
|
169
206
|
|
|
170
207
|
- Interactive Preline widgets (enum select, password strength meter, date pickers, file
|
|
@@ -186,9 +223,10 @@ Notes:
|
|
|
186
223
|
|
|
187
224
|
```typescript
|
|
188
225
|
import { Component, computed } from '@angular/core';
|
|
189
|
-
import { InputBaseComponent } from '@smartsoft001/angular';
|
|
190
226
|
import { ReactiveFormsModule } from '@angular/forms';
|
|
191
227
|
|
|
228
|
+
import { InputBaseComponent, ModelLabelPipe } from '@smartsoft001/angular';
|
|
229
|
+
|
|
192
230
|
@Component({
|
|
193
231
|
selector: 'my-input-text',
|
|
194
232
|
template: `
|
|
@@ -207,8 +245,7 @@ import { ReactiveFormsModule } from '@angular/forms';
|
|
|
207
245
|
<input type="text" [formControl]="formControl" [class]="inputClasses()" />
|
|
208
246
|
}
|
|
209
247
|
`,
|
|
210
|
-
imports: [ReactiveFormsModule],
|
|
211
|
-
standalone: true,
|
|
248
|
+
imports: [ReactiveFormsModule, ModelLabelPipe],
|
|
212
249
|
})
|
|
213
250
|
export class MyInputTextComponent extends InputBaseComponent<any> {
|
|
214
251
|
labelClasses = computed(() => 'my-prefix-label ' + this.cssClass());
|
|
@@ -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
|
|
|
@@ -10,7 +10,8 @@ The `<smart-list>` component renders a list of entities. It is a wrapper that di
|
|
|
10
10
|
|
|
11
11
|
## When to Use This Skill
|
|
12
12
|
|
|
13
|
-
- Developer wants to display a collection of entities with
|
|
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
|
|
|
@@ -18,49 +19,56 @@ The `<smart-list>` component renders a list of entities. It is a wrapper that di
|
|
|
18
19
|
|
|
19
20
|
### ListComponent (`<smart-list>`)
|
|
20
21
|
|
|
21
|
-
Main wrapper.
|
|
22
|
+
Main wrapper. Resolves the list `fields` of `options.type` (the `@Field({ list })` fields, sorted by `list.order`), reads `options.mode` (or falls back to `HardwareService.isMobile` for auto mobile detection) and renders the mode component via `NgComponentOutlet`, passing the options with the resolved `fields` and the `class`. Below the mode component it renders `<smart-loader>` while `provider.loading()` is `true` and a "no results" heading (`noResults` translation) for an empty list.
|
|
22
23
|
|
|
23
24
|
### ListDesktopComponent (`<smart-list-desktop>`)
|
|
24
25
|
|
|
25
|
-
Default desktop implementation.
|
|
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
|
|
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
|
|
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
|
|
|
37
|
-
Abstract base directive. Extend it to build custom list implementations for any mode.
|
|
38
|
-
|
|
39
|
-
- `
|
|
40
|
-
- `
|
|
41
|
-
- `
|
|
42
|
-
- `
|
|
43
|
-
- `
|
|
44
|
-
- `
|
|
45
|
-
- `
|
|
46
|
-
- `
|
|
47
|
-
- `
|
|
48
|
-
- `
|
|
49
|
-
- `
|
|
38
|
+
Abstract base directive. Extend it to build custom list implementations for any mode. It reads `options()` (an `IListInternalOptions<T>`: the `IListOptions` plus the resolved `fields`) and exposes:
|
|
39
|
+
|
|
40
|
+
- `keys` — string array of visible column keys (the list fields the user may see, `list.permissions`, with `dynamic` fields expanded), set by `initKeys()`
|
|
41
|
+
- `list` — `Signal<CdkTableDataSourceInput<T> | null>`: the provider's rows without the ones removed in this list
|
|
42
|
+
- `loading` — `Signal<boolean>` from the provider
|
|
43
|
+
- `page`, `totalPages` — `Signal<number | null>` from the pagination options
|
|
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)
|
|
46
|
+
- `itemHandler` — resolved item navigation (`Router.navigate([routingPrefix, id])`) or select handler, `null` without `item`
|
|
47
|
+
- `removeHandler` — confirms with `AlertService` (`OBJECT.confirmDelete`) and calls `remove.provider.invoke(id)`, `null` without `remove`; `checkRemoveHandler` is `remove.provider.check`
|
|
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
|
|
51
|
+
- `loadNextPage`, `loadPrevPage` — the pagination loaders (they scroll the window), `null` without `pagination`
|
|
52
|
+
- `cellPipe` — `ICellPipe<T> | null`
|
|
53
|
+
- `cssClass` — string input (alias `class`), forwarded by `<smart-list>`
|
|
54
|
+
|
|
55
|
+
The resolved fields themselves are private; read `options().fields` in a subclass. `provider` is protected.
|
|
50
56
|
|
|
51
57
|
Methods:
|
|
52
58
|
|
|
53
|
-
- `initKeys()` — populates `keys` from
|
|
54
|
-
- `handlePageChange(page: number)` —
|
|
59
|
+
- `initKeys()` (protected) — populates `keys` from the resolved fields
|
|
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)`
|
|
55
63
|
|
|
56
64
|
## API
|
|
57
65
|
|
|
58
66
|
### Inputs
|
|
59
67
|
|
|
60
|
-
| Input | Type | Default | Description
|
|
61
|
-
| --------- | ------------------------------ | ---------- |
|
|
62
|
-
| `options` | `InputSignal<IListOptions<T>>` | _required_ | Full list configuration
|
|
63
|
-
| `class` | `InputSignal<string>` | `''` | External CSS classes forwarded
|
|
68
|
+
| Input | Type | Default | Description |
|
|
69
|
+
| --------- | ------------------------------ | ---------- | ------------------------------------------------------------------ |
|
|
70
|
+
| `options` | `InputSignal<IListOptions<T>>` | _required_ | Full list configuration |
|
|
71
|
+
| `class` | `InputSignal<string>` | `''` | External CSS classes, forwarded to the mode component (`cssClass`) |
|
|
64
72
|
|
|
65
73
|
## IListOptions\<T>
|
|
66
74
|
|
|
@@ -96,26 +104,40 @@ interface IListOptions<T> {
|
|
|
96
104
|
provider?: IRemoveProvider<T>;
|
|
97
105
|
};
|
|
98
106
|
select?: 'multi';
|
|
107
|
+
presentation?: {
|
|
108
|
+
variant?: 'default' | 'striped' | 'bordered' | 'borderless';
|
|
109
|
+
hoverable?: boolean;
|
|
110
|
+
header?: 'default' | 'muted' | 'none';
|
|
111
|
+
};
|
|
99
112
|
}
|
|
100
113
|
```
|
|
101
114
|
|
|
102
115
|
### IListOptions property reference
|
|
103
116
|
|
|
104
|
-
| Property | Type
|
|
105
|
-
| -------------------- |
|
|
106
|
-
| `provider` | `IListProvider<T>`
|
|
107
|
-
| `type` | `any`
|
|
108
|
-
| `mode` | `ListMode`
|
|
109
|
-
| `pagination` | `IListPaginationOptions`
|
|
110
|
-
| `cellPipe` | `ICellPipe<T>`
|
|
111
|
-
| `componentFactories` | `IListComponentFactories<T>`
|
|
112
|
-
| `sort` | `boolean \| { default?: string; defaultDesc?: boolean }`
|
|
113
|
-
| `details` | `boolean \| { provider?: IDetailsProvider<T>; componentFactories?:
|
|
114
|
-
| `item` | `boolean \| { options?: ItemOptions }`
|
|
115
|
-
| `remove` | `boolean \| { provider?: IRemoveProvider<T> }`
|
|
116
|
-
| `select` | `'multi'`
|
|
117
|
-
|
|
118
|
-
|
|
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. |
|
|
131
|
+
|
|
132
|
+
### IListProvider\<T>
|
|
133
|
+
|
|
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. |
|
|
119
141
|
|
|
120
142
|
```typescript
|
|
121
143
|
interface IListProvider<T> {
|
|
@@ -127,43 +149,58 @@ interface IListProvider<T> {
|
|
|
127
149
|
}
|
|
128
150
|
```
|
|
129
151
|
|
|
130
|
-
|
|
152
|
+
### ListMode
|
|
131
153
|
|
|
132
|
-
|
|
133
|
-
enum ListMode {
|
|
134
|
-
mobile = 'mobile',
|
|
135
|
-
desktop = 'desktop',
|
|
136
|
-
masonryGrid = 'masonryGrid',
|
|
137
|
-
}
|
|
138
|
-
```
|
|
154
|
+
`ListMode` is an enum: `ListMode.mobile` (`'mobile'`), `ListMode.desktop` (`'desktop'`), `ListMode.masonryGrid` (`'masonryGrid'`).
|
|
139
155
|
|
|
140
|
-
|
|
156
|
+
### IListPaginationOptions
|
|
141
157
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}
|
|
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. |
|
|
151
166
|
|
|
152
|
-
enum PaginationMode
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
167
|
+
`PaginationMode` is an enum: `PaginationMode.infiniteScroll` (`'infiniteScroll'`), `PaginationMode.singlePage` (`'singlePage'`).
|
|
168
|
+
|
|
169
|
+
### ItemOptions, IRemoveProvider, IDetailsProvider
|
|
170
|
+
|
|
171
|
+
| Type | Fields |
|
|
172
|
+
| ---------------------------- | ------------------------------------------------------------------------------------------------------------------ |
|
|
173
|
+
| `IItemOptionsForPage` | `routingPrefix: string` (the item URL is `routingPrefix/id`), `edit: boolean` (passed along) |
|
|
174
|
+
| `IItemOptionsForCustom` | `select: (id: string) => void` (called instead of navigating), `edit: boolean` |
|
|
175
|
+
| `ItemOptions` | `IItemOptionsForPage \| IItemOptionsForCustom` |
|
|
176
|
+
| `IRemoveProvider<T>` | `invoke: (id: string) => void` (after the confirmation), `check?: (item: T) => boolean` (hides the action per row) |
|
|
177
|
+
| `IDetailsProvider<T>` | `getData: (id: string) => void`, `clearData: () => void`, `item: Signal<T>`, `loading: Signal<boolean>` |
|
|
178
|
+
| `ICellPipe<T>` | `transform(value: T, columnName: string, translate?: (val: string) => string): string` |
|
|
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.
|
|
157
196
|
|
|
158
197
|
## LIST_MODE_COMPONENTS_TOKEN
|
|
159
198
|
|
|
199
|
+
`InjectionToken` from `@smartsoft001/angular` that provides a `Partial<Record<ListMode, Type<ListBaseComponent<any>>>>` override map. Any mode key you include replaces the built-in default child for that mode; any mode key you omit continues to use the built-in default.
|
|
200
|
+
|
|
160
201
|
```typescript
|
|
161
202
|
import { LIST_MODE_COMPONENTS_TOKEN, ListMode } from '@smartsoft001/angular';
|
|
162
|
-
```
|
|
163
203
|
|
|
164
|
-
`InjectionToken` that provides a `Partial<Record<ListMode, Type<ListBaseComponent<any>>>>` override map. Any mode key you include replaces the built-in default child for that mode; any mode key you omit continues to use the built-in default.
|
|
165
|
-
|
|
166
|
-
```typescript
|
|
167
204
|
providers: [
|
|
168
205
|
{
|
|
169
206
|
provide: LIST_MODE_COMPONENTS_TOKEN,
|
|
@@ -186,7 +223,7 @@ Every mode ships a Preline-styled **preset** alongside the default child:
|
|
|
186
223
|
| `mobile` | `ListMobilePresetComponent` | Responsive card grid (`smart-list-mobile-preset`), image → card image |
|
|
187
224
|
| `masonryGrid` | `ListMasonryGridPresetComponent` | Masonry card columns (`smart-list-masonry-grid-preset`), image → card |
|
|
188
225
|
|
|
189
|
-
Apply them
|
|
226
|
+
Apply them by providing the ready-made map `LIST_PRESET_MODE_COMPONENTS` (it covers all three modes) for `LIST_MODE_COMPONENTS_TOKEN`, or with `provideSmartPresets()`, which provides it together with every other preset.
|
|
190
227
|
|
|
191
228
|
```typescript
|
|
192
229
|
import {
|
|
@@ -202,15 +239,7 @@ providers: [
|
|
|
202
239
|
];
|
|
203
240
|
```
|
|
204
241
|
|
|
205
|
-
The desktop preset reads the optional `IListOptions.presentation` field
|
|
206
|
-
|
|
207
|
-
```typescript
|
|
208
|
-
presentation?: {
|
|
209
|
-
variant?: 'default' | 'striped' | 'bordered' | 'borderless';
|
|
210
|
-
hoverable?: boolean;
|
|
211
|
-
header?: 'default' | 'muted' | 'none';
|
|
212
|
-
};
|
|
213
|
-
```
|
|
242
|
+
The desktop preset reads the optional `IListOptions.presentation` field (see the property reference above).
|
|
214
243
|
|
|
215
244
|
Notes:
|
|
216
245
|
|
|
@@ -220,7 +249,9 @@ Notes:
|
|
|
220
249
|
primary button (label i18n key: `details`).
|
|
221
250
|
- The masonryGrid preset keeps the base masonry column algorithm and image mechanism
|
|
222
251
|
(`NgOptimizedImage` from the model's image field) and restyles items with the same card recipe as
|
|
223
|
-
the mobile preset;
|
|
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()`.
|
|
224
255
|
- Preline "Table with search" / "with pagination" / "selectable rows" variants are covered by the
|
|
225
256
|
existing `searchbar` feature, `smart-paging` (`PaginationMode.singlePage`), and `select: 'multi'`
|
|
226
257
|
respectively — not by `presentation`. Table caption/footer variants are not supported (no API
|
|
@@ -250,7 +281,7 @@ import { ListBaseComponent } from '@smartsoft001/angular';
|
|
|
250
281
|
export class MyCustomListComponent extends ListBaseComponent<any> {}
|
|
251
282
|
```
|
|
252
283
|
|
|
253
|
-
Register with
|
|
284
|
+
Register it with `LIST_MODE_COMPONENTS_TOKEN` (`{ [ListMode.desktop]: MyCustomListComponent }`) so `<smart-list>` picks it up for the target mode.
|
|
254
285
|
|
|
255
286
|
```typescript
|
|
256
287
|
providers: [
|
|
@@ -284,6 +315,7 @@ providers: [
|
|
|
284
315
|
provider: myProvider,
|
|
285
316
|
type: UserModel,
|
|
286
317
|
pagination: {
|
|
318
|
+
mode: 'singlePage',
|
|
287
319
|
limit: 25,
|
|
288
320
|
page: pageSignal,
|
|
289
321
|
totalPages: totalPagesSignal,
|
|
@@ -293,12 +325,29 @@ providers: [
|
|
|
293
325
|
}"
|
|
294
326
|
></smart-list>
|
|
295
327
|
|
|
296
|
-
<!--
|
|
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
|
+
|
|
346
|
+
<!-- With a remove action -->
|
|
297
347
|
<smart-list
|
|
298
348
|
[options]="{
|
|
299
349
|
provider: myProvider,
|
|
300
350
|
type: UserModel,
|
|
301
|
-
sort: { default: 'name' },
|
|
302
351
|
remove: { provider: myRemoveProvider }
|
|
303
352
|
}"
|
|
304
353
|
></smart-list>
|
|
@@ -311,5 +360,6 @@ providers: [
|
|
|
311
360
|
- Mobile child: `packages/shared/angular/src/lib/components/list/mobile/mobile.component.ts`
|
|
312
361
|
- Masonry grid child: `packages/shared/angular/src/lib/components/list/masonry-grid/masonry-grid.component.ts`
|
|
313
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`)
|
|
314
364
|
- Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`LIST_MODE_COMPONENTS_TOKEN`)
|
|
315
365
|
- Interfaces: `packages/shared/angular/src/lib/models/interfaces.ts` (`IListOptions`, `IListProvider`, `IListPaginationOptions`, `ListMode`)
|