@smartsoft001/claude-plugins 2.201.0 → 2.202.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 +35 -12
- 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 +78 -49
- package/plugins/smart-angular/skills/angular-components-list/SKILL.md +85 -78
- 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 +23 -16
- 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 +46 -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-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 +10 -10
- 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 +41 -17
- package/plugins/smart-react/skills/react-components-list/SKILL.md +34 -31
- 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 +8 -8
- 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-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 +7 -7
|
@@ -18,68 +18,89 @@ 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 `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.
|
|
37
|
+
|
|
38
|
+
### InputFileBaseComponent (abstract)
|
|
39
|
+
|
|
40
|
+
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.
|
|
41
|
+
|
|
42
|
+
### InputErrorComponent (`<smart-input-error>`)
|
|
43
|
+
|
|
44
|
+
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
45
|
|
|
38
46
|
### Default Sub-Components
|
|
39
47
|
|
|
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
|
|
48
|
+
| FieldType | Sub-component | Selector | Description |
|
|
49
|
+
| --------------- | ----------------------------- | ----------------------------- | --------------------------------------------------------------------------------------------------------------- |
|
|
50
|
+
| `text` | `InputTextComponent` | `smart-input-text` | Plain text input |
|
|
51
|
+
| `email` | `InputEmailComponent` | `smart-input-email` | Email input |
|
|
52
|
+
| `password` | `InputPasswordComponent` | `smart-input-password` | Password input; adds `<smart-password-strength>` when the field's `possibilities.strength` is set |
|
|
53
|
+
| `nip` | `InputNipComponent` | `smart-input-nip` | NIP with built-in `invalidNip` validator |
|
|
54
|
+
| `pesel` | `InputPeselComponent` | `smart-input-pesel` | PESEL text input (the form factory adds the `pesel` check; the preset adds `invalidPesel` too) |
|
|
55
|
+
| `int` | `InputIntComponent` | `smart-input-int` | Integer input (`type="number" step="1"`) |
|
|
56
|
+
| `float` | `InputFloatComponent` | `smart-input-float` | Decimal input (`type="number" step="0.01"`) |
|
|
57
|
+
| `currency` | `InputCurrencyComponent` | `smart-input-currency` | Currency input (`type="number" step="0.01"`) |
|
|
58
|
+
| `phoneNumber` | `InputPhoneNumberComponent` | `smart-input-phone-number` | Telephone input |
|
|
59
|
+
| `phoneNumberPl` | `InputPhoneNumberPlComponent` | `smart-input-phone-number-pl` | Telephone input + built-in length(9) validator |
|
|
60
|
+
| `longText` | `InputLongTextComponent` | `smart-input-long-text` | Rich text editor (`ngx-editor`) |
|
|
61
|
+
| `date` | `InputDateComponent` | `smart-input-date` | HTML date input (`type="date"`) |
|
|
62
|
+
| `dateWithEdit` | `InputDateWithEditComponent` | `smart-input-date-with-edit` | Digit-by-digit date via `<smart-date-edit>` |
|
|
63
|
+
| `dateRange` | `InputDateRangeComponent` | `smart-input-date-range` | Date range via `<smart-date-range>` |
|
|
64
|
+
| `flag` | `InputFlagComponent` | `smart-input-flag` | Single checkbox |
|
|
65
|
+
| `radio` | `InputRadioComponent` | `smart-input-radio` | Radio group (from possibilities) |
|
|
66
|
+
| `check` | `InputCheckComponent` | `smart-input-check` | Checkbox group (from possibilities) |
|
|
67
|
+
| `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) |
|
|
68
|
+
| `color` | `InputColorComponent` | `smart-input-color` | Color picker (`ngx-color-picker`) |
|
|
69
|
+
| `logo` | `InputLogoComponent` | `smart-input-logo` | Image picker with inline preview; stores a base64 `data:` URL, no upload (the preset differs, see below) |
|
|
70
|
+
| `address` | `InputAddressComponent` | `smart-input-address` | Nested `FormGroup` (city/zip/street/building/flat) |
|
|
71
|
+
| `object` | `InputObjectComponent` | `smart-input-object` | Nested form via `FORM_COMPONENT_TOKEN` |
|
|
72
|
+
| `array` | `InputArrayComponent` | `smart-input-array` | Dynamic array of nested forms |
|
|
73
|
+
| `ints` | `InputIntsComponent` | `smart-input-ints` | Dynamic list of integer inputs |
|
|
74
|
+
| `strings` | `InputStringsComponent` | `smart-input-strings` | Dynamic list of string inputs |
|
|
75
|
+
| `file` | `InputFileComponent` | `smart-input-file` | Generic file chooser; keeps the picked `File` as the value, no upload (the preset differs, see below) |
|
|
76
|
+
| `attachment` | `InputAttachmentComponent` | `smart-input-attachment` | File upload (any type) with download/delete |
|
|
77
|
+
| `image` | `InputImageComponent` | `smart-input-image` | Image upload with preview |
|
|
78
|
+
| `pdf` | `InputPdfComponent` | `smart-input-pdf` | PDF upload with show/delete |
|
|
79
|
+
| `video` | `InputVideoComponent` | `smart-input-video` | Video upload with play/delete |
|
|
72
80
|
|
|
73
81
|
## API
|
|
74
82
|
|
|
75
83
|
### InputComponent Inputs
|
|
76
84
|
|
|
77
|
-
| Input | Type | Default
|
|
78
|
-
| --------- | ------------------------------------------- |
|
|
79
|
-
| `options` | `InputSignal<InputOptions<T> \| undefined>` |
|
|
85
|
+
| Input | Type | Default | Description |
|
|
86
|
+
| --------- | ------------------------------------------- | ----------- | ----------------------------------------------------------------------------- |
|
|
87
|
+
| `options` | `InputSignal<InputOptions<T> \| undefined>` | `undefined` | Field configuration |
|
|
88
|
+
| `class` | `InputSignal<string>` | `''` | External CSS classes, forwarded to the field component (alias for `cssClass`) |
|
|
80
89
|
|
|
81
90
|
### InputOptions
|
|
82
91
|
|
|
92
|
+
`InputOptions<T>` is `IInputOptions & IInputFromFieldOptions<T>`.
|
|
93
|
+
|
|
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. |
|
|
103
|
+
|
|
83
104
|
```typescript
|
|
84
105
|
type InputOptions<T> = IInputOptions & IInputFromFieldOptions<T>;
|
|
85
106
|
|
|
@@ -105,14 +126,12 @@ interface IInputFromFieldOptions<T> {
|
|
|
105
126
|
|
|
106
127
|
### INPUT_FIELD_COMPONENTS_TOKEN
|
|
107
128
|
|
|
129
|
+
`InjectionToken<Partial<Record<FieldTypeDef, Type<InputBaseComponent<any>>>>>` from `@smartsoft001/angular` — allows substituting a sub-component for any field type.
|
|
130
|
+
|
|
108
131
|
```typescript
|
|
109
132
|
import { INPUT_FIELD_COMPONENTS_TOKEN } from '@smartsoft001/angular';
|
|
110
133
|
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
134
|
|
|
115
|
-
```typescript
|
|
116
135
|
providers: [
|
|
117
136
|
{
|
|
118
137
|
provide: INPUT_FIELD_COMPONENTS_TOKEN,
|
|
@@ -132,8 +151,9 @@ Each field type ships a Preline-styled **preset** (`Input<Field>PresetComponent`
|
|
|
132
151
|
`smart-input-<field>-preset`) alongside the default Tailwind-UI-styled field component. The
|
|
133
152
|
presets live in `<field>/preset/` and all translate the Preline look to `smart:`-prefixed vanilla
|
|
134
153
|
Tailwind with explicit `dark:` variants. Apply them by providing the ready-made map
|
|
135
|
-
`INPUT_PRESET_FIELD_COMPONENTS` for
|
|
136
|
-
validation-message preset)
|
|
154
|
+
`INPUT_PRESET_FIELD_COMPONENTS` for `INPUT_FIELD_COMPONENTS_TOKEN` (it covers all field types
|
|
155
|
+
except the standalone validation-message preset), or with `provideSmartPresets()`, which provides
|
|
156
|
+
it together with every other preset.
|
|
137
157
|
|
|
138
158
|
```typescript
|
|
139
159
|
import {
|
|
@@ -165,6 +185,15 @@ the most recently added ones:
|
|
|
165
185
|
| `video` | `InputVideoPresetComponent` | `smart-input-video-preset` | Dashed drop-zone (accept `.mp4`) + play/delete + `<video>` |
|
|
166
186
|
| `array` | `InputArrayPresetComponent` | `smart-input-array-preset` | Item cards (`space-y-2`), outline add / ghost-red remove |
|
|
167
187
|
|
|
188
|
+
Where a preset behaves differently from the standard component of its type:
|
|
189
|
+
|
|
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`) |
|
|
196
|
+
|
|
168
197
|
Notes:
|
|
169
198
|
|
|
170
199
|
- Interactive Preline widgets (enum select, password strength meter, date pickers, file
|
|
@@ -186,9 +215,10 @@ Notes:
|
|
|
186
215
|
|
|
187
216
|
```typescript
|
|
188
217
|
import { Component, computed } from '@angular/core';
|
|
189
|
-
import { InputBaseComponent } from '@smartsoft001/angular';
|
|
190
218
|
import { ReactiveFormsModule } from '@angular/forms';
|
|
191
219
|
|
|
220
|
+
import { InputBaseComponent, ModelLabelPipe } from '@smartsoft001/angular';
|
|
221
|
+
|
|
192
222
|
@Component({
|
|
193
223
|
selector: 'my-input-text',
|
|
194
224
|
template: `
|
|
@@ -207,8 +237,7 @@ import { ReactiveFormsModule } from '@angular/forms';
|
|
|
207
237
|
<input type="text" [formControl]="formControl" [class]="inputClasses()" />
|
|
208
238
|
}
|
|
209
239
|
`,
|
|
210
|
-
imports: [ReactiveFormsModule],
|
|
211
|
-
standalone: true,
|
|
240
|
+
imports: [ReactiveFormsModule, ModelLabelPipe],
|
|
212
241
|
})
|
|
213
242
|
export class MyInputTextComponent extends InputBaseComponent<any> {
|
|
214
243
|
labelClasses = computed(() => 'my-prefix-label ' + this.cssClass());
|
|
@@ -10,7 +10,7 @@ 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
14
|
- Developer asks about `<smart-list>` or `ListComponent`
|
|
15
15
|
- Developer wants to provide a custom layout for a specific list mode (desktop, mobile, or masonryGrid)
|
|
16
16
|
|
|
@@ -18,49 +18,51 @@ The `<smart-list>` component renders a list of entities. It is a wrapper that di
|
|
|
18
18
|
|
|
19
19
|
### ListComponent (`<smart-list>`)
|
|
20
20
|
|
|
21
|
-
Main wrapper.
|
|
21
|
+
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
22
|
|
|
23
23
|
### ListDesktopComponent (`<smart-list-desktop>`)
|
|
24
24
|
|
|
25
|
-
Default desktop implementation.
|
|
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
26
|
|
|
27
27
|
### ListMobileComponent (`<smart-list-mobile>`)
|
|
28
28
|
|
|
29
|
-
Default mobile implementation. Renders a `<ul role="list">` with flex rows, one
|
|
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
30
|
|
|
31
31
|
### ListMasonryGridComponent (`<smart-list-masonry-grid>`)
|
|
32
32
|
|
|
33
|
-
Default masonry-grid implementation. Renders a grid of
|
|
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
34
|
|
|
35
35
|
### ListBaseComponent (abstract)
|
|
36
36
|
|
|
37
|
-
Abstract base directive. Extend it to build custom list implementations for any mode.
|
|
37
|
+
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:
|
|
38
38
|
|
|
39
|
-
- `
|
|
40
|
-
- `
|
|
41
|
-
- `
|
|
42
|
-
- `
|
|
43
|
-
- `
|
|
44
|
-
- `
|
|
45
|
-
- `
|
|
46
|
-
- `
|
|
47
|
-
- `
|
|
48
|
-
- `cellPipe` — `ICellPipe<T
|
|
49
|
-
- `cssClass` — string input (alias `class`)
|
|
39
|
+
- `keys` — string array of visible column keys (the list fields the user may see, `list.permissions`, with `dynamic` fields expanded), set by `initKeys()`
|
|
40
|
+
- `list` — `Signal<CdkTableDataSourceInput<T> | null>`: the provider's rows without the ones removed in this list
|
|
41
|
+
- `loading` — `Signal<boolean>` from the provider
|
|
42
|
+
- `page`, `totalPages` — `Signal<number | null>` from the pagination options
|
|
43
|
+
- `type` — the model class, `sort`, `selectMode` (`options.sort ?? {}`, `options.select`)
|
|
44
|
+
- `itemHandler` — resolved item navigation (`Router.navigate([routingPrefix, id])`) or select handler, `null` without `item`
|
|
45
|
+
- `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
|
|
47
|
+
- `loadNextPage`, `loadPrevPage` — the pagination loaders (they scroll the window), `null` without `pagination`
|
|
48
|
+
- `cellPipe` — `ICellPipe<T> | null`
|
|
49
|
+
- `cssClass` — string input (alias `class`), forwarded by `<smart-list>`
|
|
50
|
+
|
|
51
|
+
The resolved fields themselves are private; read `options().fields` in a subclass. `provider` is protected.
|
|
50
52
|
|
|
51
53
|
Methods:
|
|
52
54
|
|
|
53
|
-
- `initKeys()` — populates `keys` from
|
|
54
|
-
- `handlePageChange(page: number)` —
|
|
55
|
+
- `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`)
|
|
55
57
|
|
|
56
58
|
## API
|
|
57
59
|
|
|
58
60
|
### Inputs
|
|
59
61
|
|
|
60
|
-
| Input | Type | Default | Description
|
|
61
|
-
| --------- | ------------------------------ | ---------- |
|
|
62
|
-
| `options` | `InputSignal<IListOptions<T>>` | _required_ | Full list configuration
|
|
63
|
-
| `class` | `InputSignal<string>` | `''` | External CSS classes forwarded
|
|
62
|
+
| Input | Type | Default | Description |
|
|
63
|
+
| --------- | ------------------------------ | ---------- | ------------------------------------------------------------------ |
|
|
64
|
+
| `options` | `InputSignal<IListOptions<T>>` | _required_ | Full list configuration |
|
|
65
|
+
| `class` | `InputSignal<string>` | `''` | External CSS classes, forwarded to the mode component (`cssClass`) |
|
|
64
66
|
|
|
65
67
|
## IListOptions\<T>
|
|
66
68
|
|
|
@@ -96,26 +98,40 @@ interface IListOptions<T> {
|
|
|
96
98
|
provider?: IRemoveProvider<T>;
|
|
97
99
|
};
|
|
98
100
|
select?: 'multi';
|
|
101
|
+
presentation?: {
|
|
102
|
+
variant?: 'default' | 'striped' | 'bordered' | 'borderless';
|
|
103
|
+
hoverable?: boolean;
|
|
104
|
+
header?: 'default' | 'muted' | 'none';
|
|
105
|
+
};
|
|
99
106
|
}
|
|
100
107
|
```
|
|
101
108
|
|
|
102
109
|
### IListOptions property reference
|
|
103
110
|
|
|
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
|
-
|
|
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. |
|
|
125
|
+
|
|
126
|
+
### IListProvider\<T>
|
|
127
|
+
|
|
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. |
|
|
119
135
|
|
|
120
136
|
```typescript
|
|
121
137
|
interface IListProvider<T> {
|
|
@@ -127,43 +143,42 @@ interface IListProvider<T> {
|
|
|
127
143
|
}
|
|
128
144
|
```
|
|
129
145
|
|
|
130
|
-
|
|
146
|
+
### ListMode
|
|
131
147
|
|
|
132
|
-
|
|
133
|
-
enum ListMode {
|
|
134
|
-
mobile = 'mobile',
|
|
135
|
-
desktop = 'desktop',
|
|
136
|
-
masonryGrid = 'masonryGrid',
|
|
137
|
-
}
|
|
138
|
-
```
|
|
148
|
+
`ListMode` is an enum: `ListMode.mobile` (`'mobile'`), `ListMode.desktop` (`'desktop'`), `ListMode.masonryGrid` (`'masonryGrid'`).
|
|
139
149
|
|
|
140
|
-
|
|
150
|
+
### IListPaginationOptions
|
|
141
151
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}
|
|
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. |
|
|
151
160
|
|
|
152
|
-
enum PaginationMode
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
161
|
+
`PaginationMode` is an enum: `PaginationMode.infiniteScroll` (`'infiniteScroll'`), `PaginationMode.singlePage` (`'singlePage'`).
|
|
162
|
+
|
|
163
|
+
### ItemOptions, IRemoveProvider, IDetailsProvider
|
|
164
|
+
|
|
165
|
+
| Type | Fields |
|
|
166
|
+
| ---------------------------- | ------------------------------------------------------------------------------------------------------------------ |
|
|
167
|
+
| `IItemOptionsForPage` | `routingPrefix: string` (the item URL is `routingPrefix/id`), `edit: boolean` (passed along) |
|
|
168
|
+
| `IItemOptionsForCustom` | `select: (id: string) => void` (called instead of navigating), `edit: boolean` |
|
|
169
|
+
| `ItemOptions` | `IItemOptionsForPage \| IItemOptionsForCustom` |
|
|
170
|
+
| `IRemoveProvider<T>` | `invoke: (id: string) => void` (after the confirmation), `check?: (item: T) => boolean` (hides the action per row) |
|
|
171
|
+
| `IDetailsProvider<T>` | `getData: (id: string) => void`, `clearData: () => void`, `item: Signal<T>`, `loading: Signal<boolean>` |
|
|
172
|
+
| `ICellPipe<T>` | `transform(value: T, columnName: string, translate?: (val: string) => string): string` |
|
|
173
|
+
| `IListComponentFactories<T>` | `top?: Type<any>` |
|
|
157
174
|
|
|
158
175
|
## LIST_MODE_COMPONENTS_TOKEN
|
|
159
176
|
|
|
177
|
+
`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.
|
|
178
|
+
|
|
160
179
|
```typescript
|
|
161
180
|
import { LIST_MODE_COMPONENTS_TOKEN, ListMode } from '@smartsoft001/angular';
|
|
162
|
-
```
|
|
163
|
-
|
|
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
181
|
|
|
166
|
-
```typescript
|
|
167
182
|
providers: [
|
|
168
183
|
{
|
|
169
184
|
provide: LIST_MODE_COMPONENTS_TOKEN,
|
|
@@ -186,7 +201,7 @@ Every mode ships a Preline-styled **preset** alongside the default child:
|
|
|
186
201
|
| `mobile` | `ListMobilePresetComponent` | Responsive card grid (`smart-list-mobile-preset`), image → card image |
|
|
187
202
|
| `masonryGrid` | `ListMasonryGridPresetComponent` | Masonry card columns (`smart-list-masonry-grid-preset`), image → card |
|
|
188
203
|
|
|
189
|
-
Apply them
|
|
204
|
+
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
205
|
|
|
191
206
|
```typescript
|
|
192
207
|
import {
|
|
@@ -202,15 +217,7 @@ providers: [
|
|
|
202
217
|
];
|
|
203
218
|
```
|
|
204
219
|
|
|
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
|
-
```
|
|
220
|
+
The desktop preset reads the optional `IListOptions.presentation` field (see the property reference above).
|
|
214
221
|
|
|
215
222
|
Notes:
|
|
216
223
|
|
|
@@ -250,7 +257,7 @@ import { ListBaseComponent } from '@smartsoft001/angular';
|
|
|
250
257
|
export class MyCustomListComponent extends ListBaseComponent<any> {}
|
|
251
258
|
```
|
|
252
259
|
|
|
253
|
-
Register with
|
|
260
|
+
Register it with `LIST_MODE_COMPONENTS_TOKEN` (`{ [ListMode.desktop]: MyCustomListComponent }`) so `<smart-list>` picks it up for the target mode.
|
|
254
261
|
|
|
255
262
|
```typescript
|
|
256
263
|
providers: [
|
|
@@ -284,6 +291,7 @@ providers: [
|
|
|
284
291
|
provider: myProvider,
|
|
285
292
|
type: UserModel,
|
|
286
293
|
pagination: {
|
|
294
|
+
mode: 'singlePage',
|
|
287
295
|
limit: 25,
|
|
288
296
|
page: pageSignal,
|
|
289
297
|
totalPages: totalPagesSignal,
|
|
@@ -293,12 +301,11 @@ providers: [
|
|
|
293
301
|
}"
|
|
294
302
|
></smart-list>
|
|
295
303
|
|
|
296
|
-
<!-- With
|
|
304
|
+
<!-- With a remove action -->
|
|
297
305
|
<smart-list
|
|
298
306
|
[options]="{
|
|
299
307
|
provider: myProvider,
|
|
300
308
|
type: UserModel,
|
|
301
|
-
sort: { default: 'name' },
|
|
302
309
|
remove: { provider: myRemoveProvider }
|
|
303
310
|
}"
|
|
304
311
|
></smart-list>
|
|
@@ -24,7 +24,7 @@ Main wrapper component. Renders `ListContainerStandardComponent` by default. Whe
|
|
|
24
24
|
Barebones placeholder concrete implementation. Renders a `<div role="list">` that:
|
|
25
25
|
|
|
26
26
|
- exposes the variant value via `data-variant` (omitted when `options` is not provided),
|
|
27
|
-
- applies the external `cssClass` directly on
|
|
27
|
+
- applies the external `cssClass` directly on that `<div>`,
|
|
28
28
|
- projects all children via `<ng-content />`.
|
|
29
29
|
|
|
30
30
|
It does not include Tailwind UI styling — it exists solely as the default structural placeholder until a custom implementation is registered through the token.
|
|
@@ -37,13 +37,20 @@ Abstract base directive for extending custom list container implementations. Exp
|
|
|
37
37
|
|
|
38
38
|
### Inputs
|
|
39
39
|
|
|
40
|
-
| Input | Type | Default | Description
|
|
41
|
-
| --------- | ------------------------------------------------- | ------- |
|
|
42
|
-
| `options` | `InputSignal<IListContainerOptions \| undefined>` | - | Optional configuration (variant
|
|
43
|
-
| `class` | `InputSignal<string>` | `''` | External CSS classes (alias for `cssClass`)
|
|
40
|
+
| Input | Type | Default | Description |
|
|
41
|
+
| --------- | ------------------------------------------------- | ------- | ------------------------------------------------------- |
|
|
42
|
+
| `options` | `InputSignal<IListContainerOptions \| undefined>` | - | Optional configuration (`variant`, `fullWidthOnMobile`) |
|
|
43
|
+
| `class` | `InputSignal<string>` | `''` | External CSS classes (alias for `cssClass`) |
|
|
44
44
|
|
|
45
45
|
### IListContainerOptions
|
|
46
46
|
|
|
47
|
+
| Field | Type | Default | Description |
|
|
48
|
+
| ------------------- | --------------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
49
|
+
| `variant` | `SmartListContainerVariant` | - | Exposed as the `data-variant` attribute of the `role="list"` element, a hook for your CSS or a custom implementation; the standard adds no styles for it. |
|
|
50
|
+
| `fullWidthOnMobile` | `boolean` | - | Not read by the built-in implementation; available to a custom implementation (edge-to-edge on small screens). |
|
|
51
|
+
|
|
52
|
+
`SmartListContainerVariant` is `'simple-dividers' | 'card-dividers' | 'separate-cards' | 'flat-card-dividers'`.
|
|
53
|
+
|
|
47
54
|
```typescript
|
|
48
55
|
interface IListContainerOptions {
|
|
49
56
|
variant?: SmartListContainerVariant;
|
|
@@ -51,21 +58,18 @@ interface IListContainerOptions {
|
|
|
51
58
|
}
|
|
52
59
|
|
|
53
60
|
type SmartListContainerVariant =
|
|
54
|
-
'simple' | 'card' | 'separate-cards' | 'flat-card-dividers';
|
|
61
|
+
'simple-dividers' | 'card-dividers' | 'separate-cards' | 'flat-card-dividers';
|
|
55
62
|
```
|
|
56
63
|
|
|
57
|
-
|
|
64
|
+
There is no preset for this component: register a component of your own through the token for a styled container.
|
|
58
65
|
|
|
59
66
|
## LIST_CONTAINER_STANDARD_COMPONENT_TOKEN
|
|
60
67
|
|
|
68
|
+
InjectionToken from `@smartsoft001/angular` that allows replacing the default `ListContainerStandardComponent` with a custom implementation. Provide a `Type<ListContainerBaseComponent>` in your application or component providers.
|
|
69
|
+
|
|
61
70
|
```typescript
|
|
62
71
|
import { LIST_CONTAINER_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
InjectionToken that allows replacing the default `ListContainerStandardComponent` with a custom implementation. Provide a `Type<ListContainerBaseComponent>` to override.
|
|
66
72
|
|
|
67
|
-
```typescript
|
|
68
|
-
// In your app module or component providers:
|
|
69
73
|
providers: [
|
|
70
74
|
{
|
|
71
75
|
provide: LIST_CONTAINER_STANDARD_COMPONENT_TOKEN,
|
|
@@ -81,7 +85,6 @@ import {
|
|
|
81
85
|
ChangeDetectionStrategy,
|
|
82
86
|
Component,
|
|
83
87
|
computed,
|
|
84
|
-
input,
|
|
85
88
|
ViewEncapsulation,
|
|
86
89
|
} from '@angular/core';
|
|
87
90
|
|
|
@@ -90,17 +93,14 @@ import { ListContainerBaseComponent } from '@smartsoft001/angular';
|
|
|
90
93
|
@Component({
|
|
91
94
|
selector: 'my-custom-list-container',
|
|
92
95
|
template: `
|
|
93
|
-
<
|
|
96
|
+
<ul role="list" [class]="containerClasses()">
|
|
94
97
|
<ng-content />
|
|
95
|
-
</
|
|
98
|
+
</ul>
|
|
96
99
|
`,
|
|
97
100
|
encapsulation: ViewEncapsulation.None,
|
|
98
101
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
99
102
|
})
|
|
100
103
|
export class MyCustomListContainerComponent extends ListContainerBaseComponent {
|
|
101
|
-
// NgComponentOutlet passes 'cssClass' by canonical name, not the 'class' alias.
|
|
102
|
-
override cssClass = input<string>('');
|
|
103
|
-
|
|
104
104
|
containerClasses = computed(() => {
|
|
105
105
|
const classes = ['my-list-container'];
|
|
106
106
|
const variant = this.options()?.variant;
|
|
@@ -115,33 +115,25 @@ export class MyCustomListContainerComponent extends ListContainerBaseComponent {
|
|
|
115
115
|
}
|
|
116
116
|
```
|
|
117
117
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
- declare `cssClass = input<string>('')` explicitly (no `class` alias) if the component is used via `NgComponentOutlet` through `LIST_CONTAINER_STANDARD_COMPONENT_TOKEN`, because `NgComponentOutlet` passes inputs by canonical name (not by alias),
|
|
121
|
-
- include `<ng-content />` in your template so consumers can project list items.
|
|
118
|
+
The inherited `cssClass` (input alias `class`) receives the class passed to `<smart-list-container>`, and the wrapper projects its content into the implementation's default `<ng-content />` (wrapped in one `display: contents` element), so include `<ng-content />` in the template.
|
|
122
119
|
|
|
123
120
|
## Usage Examples
|
|
124
121
|
|
|
125
122
|
```html
|
|
126
123
|
<!-- Basic -->
|
|
127
124
|
<smart-list-container>
|
|
128
|
-
<
|
|
129
|
-
<
|
|
125
|
+
<div role="listitem">Invoice #1042 was paid</div>
|
|
126
|
+
<div role="listitem">Courtney Henry joined the team</div>
|
|
130
127
|
</smart-list-container>
|
|
131
128
|
|
|
132
|
-
<!-- With variant -->
|
|
129
|
+
<!-- With a variant hook (data-variant="separate-cards") -->
|
|
133
130
|
<smart-list-container [options]="{ variant: 'separate-cards' }">
|
|
134
|
-
<
|
|
135
|
-
</smart-list-container>
|
|
136
|
-
|
|
137
|
-
<!-- Full width on mobile (consumed by custom implementations) -->
|
|
138
|
-
<smart-list-container [options]="{ variant: 'card', fullWidthOnMobile: true }">
|
|
139
|
-
<smart-list-item />
|
|
131
|
+
<div role="listitem">Invoice #1042 was paid</div>
|
|
140
132
|
</smart-list-container>
|
|
141
133
|
|
|
142
134
|
<!-- With external class -->
|
|
143
135
|
<smart-list-container class="smart:my-2">
|
|
144
|
-
<
|
|
136
|
+
<div role="listitem">Invoice #1042 was paid</div>
|
|
145
137
|
</smart-list-container>
|
|
146
138
|
```
|
|
147
139
|
|