@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
|
@@ -53,13 +53,22 @@ Abstract base directive for all detail sub-components. Provides:
|
|
|
53
53
|
|
|
54
54
|
### DetailComponent Inputs
|
|
55
55
|
|
|
56
|
-
| Input | Type | Default | Description
|
|
57
|
-
| --------- | --------------------------------------------- | -------- |
|
|
58
|
-
| `options` | `InputSignal<IDetailOptions<T> \| undefined>` | required | Field configuration
|
|
59
|
-
| `type` | `InputSignal<any>` | required | Model class (used by `ModelLabelPipe`)
|
|
56
|
+
| Input | Type | Default | Description |
|
|
57
|
+
| --------- | --------------------------------------------- | -------- | --------------------------------------------------------------------------------------------------------------- |
|
|
58
|
+
| `options` | `InputSignal<IDetailOptions<T> \| undefined>` | required | Field configuration |
|
|
59
|
+
| `type` | `InputSignal<any>` | required | Model class (used by `ModelLabelPipe`) |
|
|
60
|
+
| `class` | `InputSignal<string>` | `''` | Classes forwarded to the field sub-component (`cssClass` input, alias `class`); the host is `display: contents` |
|
|
60
61
|
|
|
61
62
|
### IDetailOptions
|
|
62
63
|
|
|
64
|
+
| Field | Type | Default | Description |
|
|
65
|
+
| ---------- | ----------------- | -------- | -------------------------------------------------------------------------------------------------------------------------- |
|
|
66
|
+
| `key` | `string` | required | The field key. |
|
|
67
|
+
| `item` | `Signal<T>` | - | The record. While it is missing or returns nothing, the wrapper shows a skeleton instead of the value. |
|
|
68
|
+
| `options` | `IFieldOptions` | required | The field's `@Field` options: `type` picks the sub-component (`text` when unset or unmapped), `info` adds an info tooltip. |
|
|
69
|
+
| `cellPipe` | `ICellPipe<T>` | - | Formats the value. Read by the `text` and `phoneNumberPl` sub-components (standard and preset). |
|
|
70
|
+
| `loading` | `Signal<boolean>` | - | Not read by the built-in implementations; available to a custom implementation. |
|
|
71
|
+
|
|
63
72
|
```typescript
|
|
64
73
|
interface IDetailOptions<T> {
|
|
65
74
|
key: string;
|
|
@@ -70,7 +79,7 @@ interface IDetailOptions<T> {
|
|
|
70
79
|
}
|
|
71
80
|
```
|
|
72
81
|
|
|
73
|
-
|
|
82
|
+
`IFieldOptions` comes from `@smartsoft001/models` (the `@Field` decorator options); the wrapper reads its `type` and `info`.
|
|
74
83
|
|
|
75
84
|
### DETAIL_FIELD_COMPONENTS_TOKEN
|
|
76
85
|
|
|
@@ -105,7 +114,8 @@ URLs are removed, while basic formatting (`<b>`, `<em>`, `<a href="https://...">
|
|
|
105
114
|
The sanitizer also strips inline `style` attributes, for example the colours and alignment the
|
|
106
115
|
rich-text editor writes. A consumer who needs raw HTML for a field it trusts can return `SafeHtml`
|
|
107
116
|
from its own `cellPipe` (`ICellPipe.transform` is typed as `string`, so cast the result). A
|
|
108
|
-
tested version lives in
|
|
117
|
+
tested version, `TrustedDescriptionCellPipe`, lives in
|
|
118
|
+
`docs/examples/angular/src/components/detail/trusted-html.example.ts`.
|
|
109
119
|
|
|
110
120
|
```typescript
|
|
111
121
|
@Injectable()
|
|
@@ -145,7 +155,9 @@ Fifteen field types ship a Preline-styled **preset** (`Detail<Field>PresetCompon
|
|
|
145
155
|
| `object` | `DetailObjectPresetComponent` | Card envelope around the untouched nested details |
|
|
146
156
|
| `array` | `DetailArrayPresetComponent` | `space-y-2` stack of item cards; em-dash when empty |
|
|
147
157
|
|
|
148
|
-
Apply them
|
|
158
|
+
Apply them all by providing the ready-made partial map `DETAIL_PRESET_FIELD_COMPONENTS` for
|
|
159
|
+
`DETAIL_FIELD_COMPONENTS_TOKEN`, or register every preset of the library at once with
|
|
160
|
+
`provideSmartPresets()`.
|
|
149
161
|
|
|
150
162
|
```typescript
|
|
151
163
|
import {
|
|
@@ -161,7 +173,7 @@ providers: [
|
|
|
161
173
|
];
|
|
162
174
|
```
|
|
163
175
|
|
|
164
|
-
Notes:
|
|
176
|
+
Notes on the preset map:
|
|
165
177
|
|
|
166
178
|
- The map is partial — all other field types keep their standard components (maps merge over `baseMap`).
|
|
167
179
|
Registering `text` in the map does NOT change the fallback for unmapped/unknown types — the map is
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: angular-components-details
|
|
3
|
-
description: Details component API with InjectionToken pattern for custom implementations. Renders a list of model fields via <smart-detail
|
|
3
|
+
description: Details component API with InjectionToken pattern for custom implementations. Renders a list of model fields via <smart-detail>; DetailsPage, the [smartDetails] directive and showDetailsModal show it in a modal.
|
|
4
4
|
user-invocable: false
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -13,12 +13,13 @@ The `<smart-details>` component renders a list of model fields decorated with `@
|
|
|
13
13
|
- Developer wants to render a read-only summary of an entity using model decorators
|
|
14
14
|
- Developer asks about `<smart-details>` or `DetailsComponent`
|
|
15
15
|
- Developer wants to provide a custom layout for the standard details rendering
|
|
16
|
+
- Developer wants to show the details of a record in a modal (`[smartDetails]`, `DetailsPage`, `showDetailsModal`)
|
|
16
17
|
|
|
17
18
|
## Components
|
|
18
19
|
|
|
19
20
|
### DetailsComponent (`<smart-details>`)
|
|
20
21
|
|
|
21
|
-
Main wrapper. Renders `DetailsStandardComponent` by default. When `DETAILS_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet`, passing `options` and `class` as inputs.
|
|
22
|
+
Main wrapper. Renders `DetailsStandardComponent` by default. When `DETAILS_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet`, passing `options` and the `class` value as inputs (under `class` when the component keeps the base's alias, `cssClass` when it redeclares the input).
|
|
22
23
|
|
|
23
24
|
### DetailsStandardComponent (`<smart-details-standard>`)
|
|
24
25
|
|
|
@@ -26,25 +27,48 @@ Default concrete implementation. Generic Tailwind-styled `<dl>` placeholder that
|
|
|
26
27
|
|
|
27
28
|
### DetailsBaseComponent (abstract)
|
|
28
29
|
|
|
29
|
-
Abstract base directive.
|
|
30
|
+
Abstract base directive. Extend it to build custom details implementations. It exposes:
|
|
31
|
+
|
|
32
|
+
- `fields`: the fields of `options.type` marked `@Field({ details })`, without those whose `details.permissions` the user lacks and those whose `enabled` specification (`details.enabled`, else the field's `enabled`) the item fails; a specification can refer to the outermost details' item as `$root`
|
|
33
|
+
- `type`: `options.type`
|
|
34
|
+
- `item`: a `Signal` of `options.item()` converted to an instance of `options.type`
|
|
35
|
+
- `loading`: `options.loading`
|
|
36
|
+
- `cellPipe`: a `WritableSignal` of `options.cellPipe` (`null` without one)
|
|
37
|
+
- `componentFactories`: `options.componentFactories` (`null` without them), created in the `#topTpl` / `#bottomTpl` view containers of the template
|
|
30
38
|
|
|
31
39
|
## API
|
|
32
40
|
|
|
33
41
|
### Inputs
|
|
34
42
|
|
|
35
|
-
| Input | Type
|
|
36
|
-
| --------- |
|
|
37
|
-
| `options` | `InputSignal<IDetailsOptions<T
|
|
38
|
-
| `class` | `InputSignal<string>`
|
|
43
|
+
| Input | Type | Default | Description |
|
|
44
|
+
| --------- | ---------------------------------------------- | ----------- | ---------------------------------------------------------- |
|
|
45
|
+
| `options` | `InputSignal<IDetailsOptions<T> \| undefined>` | `undefined` | Details configuration |
|
|
46
|
+
| `class` | `InputSignal<string>` | `''` | Classes on the container (`cssClass` input, alias `class`) |
|
|
39
47
|
|
|
40
48
|
### IDetailsOptions
|
|
41
49
|
|
|
50
|
+
| Field | Type | Default | Description |
|
|
51
|
+
| -------------------- | -------------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------- |
|
|
52
|
+
| `type` | `any` | required | The `@Model` class whose `details` fields are shown. |
|
|
53
|
+
| `item` | `Signal<T>` | required | The record (a plain object is converted to `type`); while it returns nothing the fields show skeletons. |
|
|
54
|
+
| `cellPipe` | `ICellPipe<T>` | - | Formats the values of the `text` and `phoneNumberPl` fields (see `angular-components-detail`). |
|
|
55
|
+
| `componentFactories` | `IDetailsComponentFactories<T>` | - | Components created above (`top`) and below (`bottom`) the fields. |
|
|
56
|
+
| `loading` | `Signal<boolean>` | - | Passed to every `<smart-detail>`; not read by the built-in implementations; available to a custom implementation. |
|
|
57
|
+
| `title` | `string` | - | Not read by `<smart-details>`; `DetailsPage` uses it as the title of its `pageOptions()`. |
|
|
58
|
+
| `itemHandler` | `((id: string) => void) \| null` | - | Not read by `<smart-details>`; `DetailsPage` turns it into a forward button of its `pageOptions()`. |
|
|
59
|
+
| `removeHandler` | `((item: T) => void) \| null` | - | Not read by `<smart-details>`; `DetailsPage` turns it into a remove button of its `pageOptions()`. |
|
|
60
|
+
|
|
61
|
+
`IDetailsComponentFactories<T>` has two optional fields, `top` and `bottom`, each a `Type<any>` created without inputs.
|
|
62
|
+
|
|
42
63
|
```typescript
|
|
43
|
-
interface IDetailsOptions<T
|
|
64
|
+
interface IDetailsOptions<T extends IEntity<string>> {
|
|
65
|
+
title?: string;
|
|
66
|
+
cellPipe?: ICellPipe<T>;
|
|
44
67
|
type: any; // Model class (decorated with @Model)
|
|
45
|
-
item: Signal<T
|
|
68
|
+
item: Signal<T>;
|
|
46
69
|
loading?: Signal<boolean>;
|
|
47
|
-
|
|
70
|
+
itemHandler?: ((id: string) => void) | null;
|
|
71
|
+
removeHandler?: ((item: T) => void) | null;
|
|
48
72
|
componentFactories?: IDetailsComponentFactories<T>;
|
|
49
73
|
}
|
|
50
74
|
```
|
|
@@ -55,7 +79,7 @@ interface IDetailsOptions<T> {
|
|
|
55
79
|
import { DETAILS_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
56
80
|
```
|
|
57
81
|
|
|
58
|
-
InjectionToken that allows replacing the default `DetailsStandardComponent` with a custom implementation. Provide a `Type<DetailsBaseComponent<T>>`.
|
|
82
|
+
InjectionToken that allows replacing the default `DetailsStandardComponent` with a custom implementation. Provide a `Type<DetailsBaseComponent<T>>`. There is no details preset: the field values follow the detail field components (`DETAIL_PRESET_FIELD_COMPONENTS`, registered by `provideSmartPresets()`).
|
|
59
83
|
|
|
60
84
|
```typescript
|
|
61
85
|
providers: [
|
|
@@ -103,12 +127,37 @@ export class MyCustomDetailsComponent extends DetailsBaseComponent<any> {}
|
|
|
103
127
|
[options]="{ type: UserModel, item: userSignal }"
|
|
104
128
|
></smart-details>
|
|
105
129
|
|
|
106
|
-
<!--
|
|
130
|
+
<!-- Skeletons while the item is not loaded yet -->
|
|
107
131
|
<smart-details
|
|
108
|
-
[options]="{ type: UserModel, item:
|
|
132
|
+
[options]="{ type: UserModel, item: userOrUndefinedSignal }"
|
|
109
133
|
></smart-details>
|
|
110
134
|
```
|
|
111
135
|
|
|
136
|
+
## Details in a modal
|
|
137
|
+
|
|
138
|
+
`DetailsPage` (`SharedPagesModule`) renders `<smart-details>` of its `value` input full width, with the application style (`StyleService.init`) applied to its element; without a `value` it renders nothing. `pageOptions()` gives the page options for a page layout around it: the `title` (default `details`), a `trash` button for `removeHandler` and an `arrow-forward-outline` button for `itemHandler`; both call their handler with the current item and close the modal through `ModalService.dismiss()`. The page layout moved out of the library (FRA-121), so the page does not render these buttons itself.
|
|
139
|
+
|
|
140
|
+
The `[smartDetails]` directive (`DetailsDirective`) opens a component in a modal on click, through `ModalService` (see `angular-components-modal`), with its `params` as the `value` input. It emits `smartDetailsShowed` once the modal is open and `smartDetailsDismissed` once it is closed; the browser's back button (`HardwareService.onBackButtonClick`, the window's `popstate`) closes the modal as well. `showDetailsModal(services, options, callbacks)` does the same from code, and is what `<smart-list>` uses for its `details` option (see `angular-components-list`).
|
|
141
|
+
|
|
142
|
+
| `[smartDetails]` field | Type | Default | Description |
|
|
143
|
+
| ---------------------- | ----------------------- | ---------- | --------------------------------------------- |
|
|
144
|
+
| `component` | `any` | required | Rendered in the modal, e.g. `DetailsPage`. |
|
|
145
|
+
| `params` | `any` | required | Its `value` input, e.g. an `IDetailsOptions`. |
|
|
146
|
+
| `mode` | `'bottom' \| 'default'` | `'bottom'` | Passed to `ModalService.show` as `mode`. |
|
|
147
|
+
|
|
148
|
+
```html
|
|
149
|
+
<button
|
|
150
|
+
type="button"
|
|
151
|
+
[smartDetails]="{ component: DetailsPage, params: detailsOptions }"
|
|
152
|
+
(smartDetailsShowed)="load(user.id)"
|
|
153
|
+
(smartDetailsDismissed)="clear()"
|
|
154
|
+
>
|
|
155
|
+
Show
|
|
156
|
+
</button>
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
`IDetailsOptions.item` is a signal, so the page shows skeletons until the item is loaded and the fields once it is.
|
|
160
|
+
|
|
112
161
|
## Field Rendering
|
|
113
162
|
|
|
114
163
|
Each field is rendered via `<smart-detail>`. The actual rendering of a single field by `FieldType` (text, email, address, image, attachment, …) is dispatched inside `<smart-detail>` itself. See the `angular-components-detail` skill for per-field details.
|
|
@@ -120,4 +169,6 @@ Each field is rendered via `<smart-detail>`. The actual rendering of a single fi
|
|
|
120
169
|
- Base class: `packages/shared/angular/src/lib/components/details/base/base.component.ts`
|
|
121
170
|
- Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`DETAILS_STANDARD_COMPONENT_TOKEN`)
|
|
122
171
|
- Interface: `packages/shared/angular/src/lib/models/interfaces.ts` (`IDetailsOptions`)
|
|
172
|
+
- Page: `packages/shared/angular/src/lib/pages/details/details.page.ts` (`DetailsPage`)
|
|
173
|
+
- Directive: `packages/shared/angular/src/lib/directives/details/details.directive.ts` (`DetailsDirective`, `[smartDetails]`) and `details-modal.ts` (`showDetailsModal`, `IDetailsModalOptions`)
|
|
123
174
|
- Stories: `packages/shared/angular/src/lib/components/details/details.component.stories.ts`
|
|
@@ -25,11 +25,16 @@ Default concrete implementation. Renders a `<div role="separator">` host with op
|
|
|
25
25
|
|
|
26
26
|
### DividerPresetComponent (`<smart-divider-preset>`)
|
|
27
27
|
|
|
28
|
-
Styled variation that extends `DividerBaseComponent` and is a drop-in replacement for `DividerStandardComponent`. Register it
|
|
28
|
+
Styled variation that extends `DividerBaseComponent` and is a drop-in replacement for `DividerStandardComponent`. Register it for `DIVIDER_STANDARD_COMPONENT_TOKEN` to restyle every `<smart-divider>` (or every preset at once with `provideSmartPresets()`), or use the `<smart-divider-preset>` selector directly. It translates Preline's divider patterns to `smart:`-prefixed Tailwind (with explicit `dark:` variants), one per variant:
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
- plain: an `<hr>`, when there is no content and no `variant`
|
|
31
|
+
- `with-label`, `with-icon`, `with-title`: the content (`label`, else `title`; `title` first for `with-title`, in Preline's uppercase muted "Or" style) with connecting line(s) placed by `options.position` (default `center`); `iconName` is shown before it
|
|
32
|
+
- `with-button`: only the `actionLabel` button (with `iconName` before its text) on the line; `label` and `title` are not shown
|
|
33
|
+
- `with-toolbar`: the content (`label`, else `title`), a line, then the `actionLabel` button; `options.position` does not apply
|
|
34
|
+
|
|
35
|
+
When `options.variant` is omitted the variant is **inferred** from the inputs: `actionLabel` → `with-button`, `title` → `with-title`, `iconName` → `with-icon`, `label` → `with-label`, otherwise the plain `<hr>`.
|
|
36
|
+
|
|
37
|
+
The preset declares `cssClass` without the `class` alias, so bind `[cssClass]` when you use the `<smart-divider-preset>` selector directly; `class` on `<smart-divider>` reaches it through the wrapper. `iconName` has no icon-font dependency: it is rendered as the text content of a `size-4` icon slot, so an icon font (e.g. Material Icons) gets the correct sizing. The class recipes are internal (not exported from `@smartsoft001/angular`).
|
|
33
38
|
|
|
34
39
|
```typescript
|
|
35
40
|
import {
|
|
@@ -47,29 +52,34 @@ providers: [
|
|
|
47
52
|
|
|
48
53
|
### DividerBaseComponent (abstract)
|
|
49
54
|
|
|
50
|
-
Abstract base directive for extending custom divider implementations.
|
|
55
|
+
Abstract base directive for extending custom divider implementations. It declares the inputs and the output below (`cssClass` with the `class` alias).
|
|
51
56
|
|
|
52
57
|
## API
|
|
53
58
|
|
|
54
59
|
### Inputs
|
|
55
60
|
|
|
56
|
-
| Input | Type
|
|
57
|
-
| ------------- |
|
|
58
|
-
| `label` | `InputSignal<string>` | `undefined` |
|
|
59
|
-
| `iconName` | `InputSignal<string>` | `undefined` | Icon
|
|
60
|
-
| `title` | `InputSignal<string>` | `undefined` |
|
|
61
|
-
| `actionLabel` | `InputSignal<string>` | `undefined` |
|
|
62
|
-
| `options` | `InputSignal<IDividerOptions>` | `undefined` |
|
|
63
|
-
| `class` | `InputSignal<string>`
|
|
61
|
+
| Input | Type | Default | Description |
|
|
62
|
+
| ------------- | ------------------------------------------- | ----------- | ---------------------------------------------------------------------------------------- |
|
|
63
|
+
| `label` | `InputSignal<string \| undefined>` | `undefined` | Short text on the line (standard: a `<span>`) |
|
|
64
|
+
| `iconName` | `InputSignal<string \| undefined>` | `undefined` | Icon text before the content or the action. Preset only: the standard does not render it |
|
|
65
|
+
| `title` | `InputSignal<string \| undefined>` | `undefined` | Heading on the line (standard: an `<h3>`) |
|
|
66
|
+
| `actionLabel` | `InputSignal<string \| undefined>` | `undefined` | Renders a button with this text that emits `actionClick` |
|
|
67
|
+
| `options` | `InputSignal<IDividerOptions \| undefined>` | `undefined` | Variant and position |
|
|
68
|
+
| `class` | `InputSignal<string>` | `''` | Classes on the root element (`cssClass` input, alias `class`) |
|
|
64
69
|
|
|
65
70
|
### Outputs
|
|
66
71
|
|
|
67
|
-
| Output | Type
|
|
68
|
-
| ------------- |
|
|
69
|
-
| `actionClick` | `
|
|
72
|
+
| Output | Type | Description |
|
|
73
|
+
| ------------- | ------------------------ | ----------------------------------------- |
|
|
74
|
+
| `actionClick` | `OutputEmitterRef<void>` | Emitted when the action button is clicked |
|
|
70
75
|
|
|
71
76
|
### IDividerOptions
|
|
72
77
|
|
|
78
|
+
| Field | Type | Default | Description |
|
|
79
|
+
| ---------- | ------------------------------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
80
|
+
| `variant` | `SmartDividerVariant` | inferred | `'with-label'`, `'with-icon'`, `'with-title'`, `'with-button'` or `'with-toolbar'`. Preset only; the standard ignores it. |
|
|
81
|
+
| `position` | `'left' \| 'center' \| 'right'` | `'center'` | Where the content sits on the line (preset, except `with-toolbar`). The standard only writes it to the `data-position` attribute of its root, for your own CSS. |
|
|
82
|
+
|
|
73
83
|
```typescript
|
|
74
84
|
interface IDividerOptions {
|
|
75
85
|
variant?: SmartDividerVariant; // 'with-label' | 'with-icon' | 'with-title' | 'with-button' | 'with-toolbar'
|
|
@@ -83,7 +93,7 @@ interface IDividerOptions {
|
|
|
83
93
|
import { DIVIDER_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
84
94
|
```
|
|
85
95
|
|
|
86
|
-
InjectionToken that allows replacing the default `DividerStandardComponent` with a custom implementation. Provide a `Type<DividerBaseComponent>` to override.
|
|
96
|
+
InjectionToken that allows replacing the default `DividerStandardComponent` with a custom implementation. Provide a `Type<DividerBaseComponent>` to override. The wrapper passes the inputs it has on and re-emits the implementation's `actionClick`.
|
|
87
97
|
|
|
88
98
|
```typescript
|
|
89
99
|
// In your app module or component providers:
|
|
@@ -134,9 +144,17 @@ export class MyCustomDividerComponent extends DividerBaseComponent {}
|
|
|
134
144
|
<!-- With label -->
|
|
135
145
|
<smart-divider label="Continue with" />
|
|
136
146
|
|
|
137
|
-
<!-- With title
|
|
147
|
+
<!-- With title on the left (preset) -->
|
|
138
148
|
<smart-divider title="Section" [options]="{ position: 'left' }" />
|
|
139
149
|
|
|
150
|
+
<!-- Title, line and action in one row (preset) -->
|
|
151
|
+
<smart-divider
|
|
152
|
+
title="Team members"
|
|
153
|
+
actionLabel="Add member"
|
|
154
|
+
[options]="{ variant: 'with-toolbar' }"
|
|
155
|
+
(actionClick)="onAdd()"
|
|
156
|
+
/>
|
|
157
|
+
|
|
140
158
|
<!-- With action button -->
|
|
141
159
|
<smart-divider actionLabel="Add item" (actionClick)="onAdd()" />
|
|
142
160
|
|
|
@@ -25,11 +25,11 @@ Barebones placeholder concrete implementation. When `open()` is `true`, renders
|
|
|
25
25
|
|
|
26
26
|
### DrawerPresetComponent (`<smart-drawer-preset>`)
|
|
27
27
|
|
|
28
|
-
Fully-styled variation that extends `DrawerBaseComponent` and is a drop-in replacement for `DrawerStandardComponent`. Register it
|
|
28
|
+
Fully-styled variation that extends `DrawerBaseComponent` and is a drop-in replacement for `DrawerStandardComponent`. Register it for `DRAWER_STANDARD_COMPONENT_TOKEN` to restyle every `<smart-drawer>` (or every preset at once with `provideSmartPresets()`), or use the `<smart-drawer-preset>` selector directly. It renders the translated Preline **offcanvas** look: a fixed, sliding side panel (`role="dialog"`, `aria-modal="true"`, `tabindex="-1"`) with a header (title + circular close button with the Preline X icon), a `<ng-content />` body, and an optional dimmed backdrop. It consumes `options.position` (`left`/`right`, default `right` → `data-position` + start/end placement), `options.wide` (`max-w-xs` → `max-w-md`), `options.withOverlay` (renders a click-to-close backdrop), and `options.brandedHeader` (blue header bar with inverted title/close styling). Open/close is Angular-driven via the `open` model + `@if` and `close()` (no Preline JS runtime). All classes are `smart:`-prefixed Tailwind with explicit `dark:` variants; the class recipes are internal (not exported from `@smartsoft001/angular`). The header is always rendered, with or without `title`.
|
|
29
29
|
|
|
30
|
-
>
|
|
30
|
+
> The preset declares `cssClass` without the `class` alias, so bind `[cssClass]` when you use the `<smart-drawer-preset>` selector directly; `class` on `<smart-drawer>` reaches it through the wrapper.
|
|
31
31
|
>
|
|
32
|
-
> The preset
|
|
32
|
+
> The preset's body is its `<ng-content />`: the wrapper hands the content projected into `<smart-drawer>` to the registered implementation, and the `<smart-drawer-preset>` selector takes projected content directly. It does not consume `options.stickyFooter` (no footer slot in the base API) or `options.variant` (content-type variants are projected content, not built into the offcanvas shell). Top/bottom placements from the Preline reference are not expressible — `IDrawerOptions.position` is `left | right` only.
|
|
33
33
|
|
|
34
34
|
### DrawerBaseComponent (abstract)
|
|
35
35
|
|
|
@@ -39,21 +39,33 @@ Abstract base directive for extending custom drawer implementations. Exposes `op
|
|
|
39
39
|
|
|
40
40
|
### Inputs
|
|
41
41
|
|
|
42
|
-
| Input | Type | Default | Description
|
|
43
|
-
| --------- | ------------------------------------------ | ------- |
|
|
44
|
-
| `open` | `ModelSignal<boolean>` | `false` | Whether the drawer is open (two-way bindable)
|
|
45
|
-
| `title` | `InputSignal<string \| undefined>` | - | Optional drawer title (renders header when set)
|
|
46
|
-
| `options` | `InputSignal<IDrawerOptions \| undefined>` | - | Optional configuration
|
|
47
|
-
| `class` | `InputSignal<string>` | `''` |
|
|
42
|
+
| Input | Type | Default | Description |
|
|
43
|
+
| --------- | ------------------------------------------ | ------- | ------------------------------------------------------ |
|
|
44
|
+
| `open` | `ModelSignal<boolean>` | `false` | Whether the drawer is open (two-way bindable) |
|
|
45
|
+
| `title` | `InputSignal<string \| undefined>` | - | Optional drawer title (renders header when set) |
|
|
46
|
+
| `options` | `InputSignal<IDrawerOptions \| undefined>` | - | Optional configuration |
|
|
47
|
+
| `class` | `InputSignal<string>` | `''` | Classes on the panel (`cssClass` input, alias `class`) |
|
|
48
48
|
|
|
49
49
|
### Outputs
|
|
50
50
|
|
|
51
|
-
| Output
|
|
52
|
-
|
|
|
53
|
-
| `closed`
|
|
51
|
+
| Output | Type | Description |
|
|
52
|
+
| ------------ | --------------------------- | ---------------------------------------------------------------------------------- |
|
|
53
|
+
| `closed` | `OutputEmitterRef<void>` | Emitted when the drawer closes itself (`close()`: the close button or the overlay) |
|
|
54
|
+
| `openChange` | `OutputEmitterRef<boolean>` | The `open` model's change event, for `[(open)]` |
|
|
54
55
|
|
|
55
56
|
### IDrawerOptions
|
|
56
57
|
|
|
58
|
+
| Field | Type | Default | Description |
|
|
59
|
+
| --------------- | -------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------ |
|
|
60
|
+
| `position` | `'left' \| 'right'` | `'right'` | The side the panel opens on. The standard writes it to the `data-position` attribute; the preset places the panel there. |
|
|
61
|
+
| `withOverlay` | `boolean` | - | Renders a backdrop; a click on it closes the drawer (standard and preset). |
|
|
62
|
+
| `wide` | `boolean` | - | A wider panel (`max-w-md` instead of `max-w-xs`). Preset only. |
|
|
63
|
+
| `brandedHeader` | `boolean` | - | A blue header bar with inverted title and close button. Preset only. |
|
|
64
|
+
| `stickyFooter` | `boolean` | - | Not read by the built-in implementations; available to a custom implementation. |
|
|
65
|
+
| `variant` | `SmartDrawerVariant` | - | Not read by the built-in implementations; available to a custom implementation. |
|
|
66
|
+
|
|
67
|
+
`SmartDrawerVariant` is `'empty' | 'create-form' | 'user-profile' | 'contact-list' | 'file-details'`.
|
|
68
|
+
|
|
57
69
|
```typescript
|
|
58
70
|
interface IDrawerOptions {
|
|
59
71
|
position?: 'left' | 'right';
|
|
@@ -68,7 +80,7 @@ type SmartDrawerVariant =
|
|
|
68
80
|
'empty' | 'create-form' | 'user-profile' | 'contact-list' | 'file-details';
|
|
69
81
|
```
|
|
70
82
|
|
|
71
|
-
The standard component only consumes `position` (mapped to the `data-position` attribute on the aside, default `'right'`) and `withOverlay` (toggles the backdrop overlay).
|
|
83
|
+
The standard component only consumes `position` (mapped to the `data-position` attribute on the aside, default `'right'`) and `withOverlay` (toggles the backdrop overlay).
|
|
72
84
|
|
|
73
85
|
## DRAWER_STANDARD_COMPONENT_TOKEN
|
|
74
86
|
|
|
@@ -76,7 +88,7 @@ The standard component only consumes `position` (mapped to the `data-position` a
|
|
|
76
88
|
import { DRAWER_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
77
89
|
```
|
|
78
90
|
|
|
79
|
-
InjectionToken that allows replacing the default `DrawerStandardComponent` with a custom implementation. Provide a `Type<DrawerBaseComponent>` to override.
|
|
91
|
+
InjectionToken that allows replacing the default `DrawerStandardComponent` with a custom implementation. Provide a `Type<DrawerBaseComponent>` to override. The wrapper passes `open`, `title`, `options` and the class, hands over the projected content, and re-emits the implementation's `closed` and `open` changes.
|
|
80
92
|
|
|
81
93
|
```typescript
|
|
82
94
|
// In your app module or component providers:
|
|
@@ -95,7 +107,6 @@ import {
|
|
|
95
107
|
ChangeDetectionStrategy,
|
|
96
108
|
Component,
|
|
97
109
|
computed,
|
|
98
|
-
input,
|
|
99
110
|
ViewEncapsulation,
|
|
100
111
|
} from '@angular/core';
|
|
101
112
|
|
|
@@ -130,9 +141,6 @@ import { DrawerBaseComponent } from '@smartsoft001/angular';
|
|
|
130
141
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
131
142
|
})
|
|
132
143
|
export class MyCustomDrawerComponent extends DrawerBaseComponent {
|
|
133
|
-
// NgComponentOutlet passes 'cssClass' by canonical name, not the 'class' alias.
|
|
134
|
-
override cssClass = input<string>('');
|
|
135
|
-
|
|
136
144
|
containerClasses = computed(() => {
|
|
137
145
|
const classes = ['my-drawer'];
|
|
138
146
|
if (this.options()?.wide) classes.push('my-drawer--wide');
|
|
@@ -143,12 +151,9 @@ export class MyCustomDrawerComponent extends DrawerBaseComponent {
|
|
|
143
151
|
}
|
|
144
152
|
```
|
|
145
153
|
|
|
146
|
-
When extending the base directly,
|
|
147
|
-
|
|
148
|
-
- declare `cssClass = input<string>('')` explicitly (no `class` alias) if the component is used via `NgComponentOutlet` through `DRAWER_STANDARD_COMPONENT_TOKEN`, because `NgComponentOutlet` passes inputs by canonical name (not by alias),
|
|
149
|
-
- call `this.close()` from your close affordances — it sets `open` to `false` and emits `closed` for you.
|
|
154
|
+
When extending the base directly, call `this.close()` from your close affordances: it sets `open` to `false` and emits `closed` for you. Keep the inherited `cssClass` (alias `class`): the wrapper passes the class under the name the component declares.
|
|
150
155
|
|
|
151
|
-
|
|
156
|
+
## Content Projection
|
|
152
157
|
|
|
153
158
|
`DrawerStandardComponent` uses `<ng-content />` to project arbitrary children. A custom implementation registered via `DRAWER_STANDARD_COMPONENT_TOKEN` receives the same content in its default `<ng-content />` slot, so it can show or hide the slot with `@if (open())` like the standard drawer, and control flow at the root of the projected content keeps working. The content arrives wrapped in one `display: contents` element: selectors on the slot's parent that target its direct children (`space-y-*`, `divide-*`, `> *`) do not reach the projected nodes.
|
|
154
159
|
|
|
@@ -21,38 +21,52 @@ Main wrapper component. Renders `DropdownStandardComponent` by default. When `DR
|
|
|
21
21
|
|
|
22
22
|
### DropdownStandardComponent (`<smart-dropdown-standard>`)
|
|
23
23
|
|
|
24
|
-
Default concrete implementation. Renders a trigger button and a menu
|
|
24
|
+
Default concrete implementation, unstyled (class hooks `smart-dropdown-trigger`, `smart-dropdown-header`). Renders a trigger button showing `triggerLabel`, or the projected content without it, and while open a `<ul role="menu">`: a header item with `options.headerLabel` when `options.variant` is `'with-header'`, then one `menuitem` button per item (`disabled` respected) and a `separator` for each `divider` item.
|
|
25
25
|
|
|
26
26
|
### DropdownPresetComponent (`<smart-dropdown-preset>`)
|
|
27
27
|
|
|
28
|
-
Fully styled variation that extends `DropdownBaseComponent` and is a drop-in replacement for `DropdownStandardComponent`. Register it
|
|
28
|
+
Fully styled variation that extends `DropdownBaseComponent` and is a drop-in replacement for `DropdownStandardComponent`. Register it for `DROPDOWN_STANDARD_COMPONENT_TOKEN` to restyle every `<smart-dropdown>` (or every preset at once with `provideSmartPresets()`), or use the `<smart-dropdown-preset>` selector directly. Renders a trigger button (with a rotating chevron) and a menu, dispatched through `options.variant` (default `'simple'`): `simple`, `with-dividers` (items split into divider-separated groups at each `divider` item; the other variants leave `divider` items out), `with-icons` (renders each `item.icon` string), `with-header` (a header block from `options.headerLabel`, items shown with icons), and `minimal` (borderless ghost trigger). The trigger shows `triggerLabel`, or `Actions` without it: the preset does not render projected content. All classes are `smart:`-prefixed Tailwind with explicit `dark:` variants. Open/close is driven by the inherited `open` signal + a `(click)` toggle and `@if` — Preline's JS plugin is NOT used, but its visual classes and ARIA (`aria-haspopup="menu"`, `aria-expanded`) are preserved. The class recipes are internal (not exported from `@smartsoft001/angular`).
|
|
29
29
|
|
|
30
|
-
>
|
|
30
|
+
> The preset declares `cssClass` without the `class` alias, so bind `[cssClass]` when you use the `<smart-dropdown-preset>` selector directly; `class` on `<smart-dropdown>` reaches it through the wrapper.
|
|
31
31
|
|
|
32
32
|
### DropdownBaseComponent (abstract)
|
|
33
33
|
|
|
34
|
-
Abstract base directive for extending custom dropdown implementations.
|
|
34
|
+
Abstract base directive for extending custom dropdown implementations. Besides the inputs and the output below it provides:
|
|
35
|
+
|
|
36
|
+
- `toggle()`: opens or closes the menu
|
|
37
|
+
- `close()`: closes the menu
|
|
38
|
+
- `selectItem(itemId)`: emits `selectedItem` with `{ itemId }` and closes the menu
|
|
35
39
|
|
|
36
40
|
## API
|
|
37
41
|
|
|
38
42
|
### Inputs
|
|
39
43
|
|
|
40
|
-
| Input | Type
|
|
41
|
-
| -------------- |
|
|
42
|
-
| `items` | `InputSignal<IDropdownItem[]>`
|
|
43
|
-
| `triggerLabel` | `InputSignal<string>` | `undefined` | Trigger text
|
|
44
|
-
| `open` | `ModelSignal<boolean>`
|
|
45
|
-
| `options` | `InputSignal<IDropdownOptions>` | `undefined` |
|
|
46
|
-
| `class` | `InputSignal<string>`
|
|
44
|
+
| Input | Type | Default | Description |
|
|
45
|
+
| -------------- | -------------------------------------------- | ----------- | -------------------------------------------------------------------------------------------------- |
|
|
46
|
+
| `items` | `InputSignal<IDropdownItem[]>` | `[]` | Menu items |
|
|
47
|
+
| `triggerLabel` | `InputSignal<string \| undefined>` | `undefined` | Trigger text. Without it the standard renders the projected content and the preset shows `Actions` |
|
|
48
|
+
| `open` | `ModelSignal<boolean>` | `false` | Two-way bindable open/closed state |
|
|
49
|
+
| `options` | `InputSignal<IDropdownOptions \| undefined>` | `undefined` | Variant and header label |
|
|
50
|
+
| `class` | `InputSignal<string>` | `''` | Classes on the root element (`cssClass` input, alias `class`) |
|
|
47
51
|
|
|
48
52
|
### Outputs
|
|
49
53
|
|
|
50
|
-
| Output | Type
|
|
51
|
-
| -------------- |
|
|
52
|
-
| `selectedItem` | `{ itemId: string }
|
|
54
|
+
| Output | Type | Description |
|
|
55
|
+
| -------------- | -------------------------------------- | --------------------------------------------------- |
|
|
56
|
+
| `selectedItem` | `OutputEmitterRef<{ itemId: string }>` | Emits when a menu item is selected; closes the menu |
|
|
57
|
+
| `openChange` | `OutputEmitterRef<boolean>` | The `open` model's change event, for `[(open)]` |
|
|
53
58
|
|
|
54
59
|
### IDropdownItem
|
|
55
60
|
|
|
61
|
+
| Field | Type | Default | Description |
|
|
62
|
+
| ---------- | --------- | -------- | ------------------------------------------------------------------------------------------------------------------- |
|
|
63
|
+
| `id` | `string` | required | Reported as `itemId`. |
|
|
64
|
+
| `label` | `string` | required | Item text. |
|
|
65
|
+
| `icon` | `string` | - | Text or glyph before the label. Preset only, in the `with-icons` and `with-header` variants. |
|
|
66
|
+
| `disabled` | `boolean` | - | Disables the item. |
|
|
67
|
+
| `divider` | `boolean` | - | Makes the entry a separator (standard); the preset's `with-dividers` variant splits the menu there, others hide it. |
|
|
68
|
+
| `href` | `string` | - | Not read by the built-in implementations (no item renders as a link); available to a custom implementation. |
|
|
69
|
+
|
|
56
70
|
```typescript
|
|
57
71
|
interface IDropdownItem {
|
|
58
72
|
id: string;
|
|
@@ -66,6 +80,11 @@ interface IDropdownItem {
|
|
|
66
80
|
|
|
67
81
|
### IDropdownOptions
|
|
68
82
|
|
|
83
|
+
| Field | Type | Default | Description |
|
|
84
|
+
| ------------- | ---------------------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------- |
|
|
85
|
+
| `variant` | `SmartDropdownVariant` | `'simple'` | `'simple'`, `'with-dividers'`, `'with-icons'`, `'minimal'` or `'with-header'` (preset). The standard only checks `'with-header'`. |
|
|
86
|
+
| `headerLabel` | `string` | - | Header text, shown by both implementations when `variant` is `'with-header'`. |
|
|
87
|
+
|
|
69
88
|
```typescript
|
|
70
89
|
type SmartDropdownVariant =
|
|
71
90
|
'simple' | 'with-dividers' | 'with-icons' | 'minimal' | 'with-header';
|
|
@@ -82,7 +101,7 @@ interface IDropdownOptions {
|
|
|
82
101
|
import { DROPDOWN_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
83
102
|
```
|
|
84
103
|
|
|
85
|
-
InjectionToken that allows replacing the default `DropdownStandardComponent` with a custom implementation. Provide a `Type<DropdownBaseComponent>` to override.
|
|
104
|
+
InjectionToken that allows replacing the default `DropdownStandardComponent` with a custom implementation. Provide a `Type<DropdownBaseComponent>` to override. The wrapper passes its inputs and the projected content on, and re-emits the implementation's `selectedItem` and `open` changes.
|
|
86
105
|
|
|
87
106
|
```typescript
|
|
88
107
|
// In your app module or component providers:
|
|
@@ -154,7 +173,7 @@ export class MyCustomDropdownComponent extends DropdownBaseComponent {}
|
|
|
154
173
|
]"
|
|
155
174
|
/>
|
|
156
175
|
|
|
157
|
-
<!-- With custom trigger content via ng-content -->
|
|
176
|
+
<!-- With custom trigger content via ng-content (standard only) -->
|
|
158
177
|
<smart-dropdown [items]="items">
|
|
159
178
|
<span class="icon-menu"></span> Menu
|
|
160
179
|
</smart-dropdown>
|