@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
|
@@ -6,7 +6,7 @@ user-invocable: false
|
|
|
6
6
|
|
|
7
7
|
# Container Component
|
|
8
8
|
|
|
9
|
-
Layout primitive that constrains/wraps page content. The `<smart-container>` wrapper renders `ContainerStandardComponent` by default (a neutral `<div>` that exposes `data-mode` / `data-padding` attributes for downstream styling). Consumers can replace the standard with a custom variant via `CONTAINER_STANDARD_COMPONENT_TOKEN`.
|
|
9
|
+
Layout primitive that constrains/wraps page content. The `<smart-container>` wrapper renders `ContainerStandardComponent` by default (a neutral `<div>` that exposes `data-mode` / `data-padding` attributes for downstream styling). `ContainerPresetComponent` maps the options to real Tailwind layout utilities. Consumers can replace the standard with the preset or a custom variant via `CONTAINER_STANDARD_COMPONENT_TOKEN`.
|
|
10
10
|
|
|
11
11
|
## When to Use This Skill
|
|
12
12
|
|
|
@@ -18,20 +18,18 @@ Layout primitive that constrains/wraps page content. The `<smart-container>` wra
|
|
|
18
18
|
|
|
19
19
|
### Wrapper: `smart-container`
|
|
20
20
|
|
|
21
|
-
| Input | Type | Default | Description
|
|
22
|
-
| --------- | ------------------- | ----------- |
|
|
23
|
-
| `options` | `IContainerOptions` | `undefined` | Layout configuration
|
|
24
|
-
| `class` | `string` | `''` | Extra CSS
|
|
21
|
+
| Input | Type | Default | Description |
|
|
22
|
+
| --------- | ------------------- | ----------- | ----------------------------------------------------------------------- |
|
|
23
|
+
| `options` | `IContainerOptions` | `undefined` | Layout configuration |
|
|
24
|
+
| `class` | `string` | `''` | Extra CSS classes on the container `<div>` of the active implementation |
|
|
25
25
|
|
|
26
26
|
### IContainerOptions
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
```
|
|
28
|
+
| Field | Type | Default | Description |
|
|
29
|
+
| --------- | ---------------------------------------------- | ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
30
|
+
| `mode` | `'full-width' \| 'constrained' \| 'container'` | `undefined` | The standard writes it to `data-mode`. In the preset: `container` centres at `max-w-7xl`, `constrained` at `max-w-5xl`, `full-width` (also when unset) spans the width. |
|
|
31
|
+
| `padding` | `'none' \| 'mobile' \| 'always'` | `undefined` | The standard writes it to `data-padding`. In the preset: `always` pads at every breakpoint, `mobile` only below `sm`, `none` (also when unset) not at all. |
|
|
32
|
+
| `narrow` | `boolean` | `undefined` | Preset only (the standard ignores it): tightens the width to `max-w-3xl`, centred, whatever the mode. |
|
|
35
33
|
|
|
36
34
|
### Content Projection
|
|
37
35
|
|
|
@@ -52,7 +50,7 @@ interface IContainerOptions {
|
|
|
52
50
|
<p>Content</p>
|
|
53
51
|
</smart-container>
|
|
54
52
|
|
|
55
|
-
<!-- Narrow
|
|
53
|
+
<!-- Narrow column (preset) with an extra class -->
|
|
56
54
|
<smart-container
|
|
57
55
|
[options]="{ mode: 'constrained', narrow: true }"
|
|
58
56
|
class="my-section"
|
|
@@ -65,9 +63,9 @@ interface IContainerOptions {
|
|
|
65
63
|
|
|
66
64
|
Three-layer pattern mirroring `<smart-toggle>`:
|
|
67
65
|
|
|
68
|
-
1. **`ContainerBaseComponent`** (`@Directive()`) — shared
|
|
66
|
+
1. **`ContainerBaseComponent`** (`@Directive()`) — shared inputs (`options`, `cssClass` with the `class` alias) and the `smartType = 'container'` discriminator. No outputs, no methods.
|
|
69
67
|
2. **`ContainerStandardComponent`** (selector: `smart-container-standard`) — default concrete implementation extending the base. Renders a single `<div>` with `[class]`, `[attr.data-mode]`, `[attr.data-padding]`, and `<ng-content />`.
|
|
70
|
-
3. **`ContainerComponent`** (selector: `smart-container`) — wrapper. Uses `inject(CONTAINER_STANDARD_COMPONENT_TOKEN, { optional: true })` + `*ngComponentOutlet` to render the injected component, falling back to `<smart-container-standard>`.
|
|
68
|
+
3. **`ContainerComponent`** (selector: `smart-container`) — wrapper. Uses `inject(CONTAINER_STANDARD_COMPONENT_TOKEN, { optional: true })` + `*ngComponentOutlet` to render the injected component, falling back to `<smart-container-standard>`. It passes `options` and `class` to the injected component and captures the projected content once, so it reaches whichever renders: the standard component, or the injected component's default `<ng-content />`.
|
|
71
69
|
|
|
72
70
|
## Overriding with Custom Implementation
|
|
73
71
|
|
|
@@ -95,6 +93,8 @@ providers: [
|
|
|
95
93
|
];
|
|
96
94
|
```
|
|
97
95
|
|
|
96
|
+
A subclass of `ContainerBaseComponent` registered under `CONTAINER_STANDARD_COMPONENT_TOKEN` replaces the standard component in every `<smart-container>` of that injector. It reads `options()` and `cssClass()` (the wrapper's `class`) and renders the children in its default `<ng-content />`.
|
|
97
|
+
|
|
98
98
|
## Content Projection
|
|
99
99
|
|
|
100
100
|
The wrapper uses `*ngComponentOutlet` to render any token-provided implementation and passes the children placed between `<smart-container>...</smart-container>` to it as outlet content, so they render in the injected component's default `<ng-content />` slot.
|
|
@@ -107,9 +107,9 @@ Consequences for custom implementations:
|
|
|
107
107
|
|
|
108
108
|
## Preset
|
|
109
109
|
|
|
110
|
-
`ContainerPresetComponent` (selector `smart-container-preset
|
|
110
|
+
`ContainerPresetComponent` (selector `smart-container-preset`) is a styled drop-in for the neutral standard component. It `extends ContainerStandardComponent` and maps `IContainerOptions` to real Tailwind layout utilities (all `smart:`-prefixed) on a single root `<div data-role="container">` that preserves `<ng-content />`. No new options fields are introduced.
|
|
111
111
|
|
|
112
|
-
Class mapping (
|
|
112
|
+
Class mapping (computed by an internal helper of the preset, not exported):
|
|
113
113
|
|
|
114
114
|
| Option | Classes |
|
|
115
115
|
| ---------------------------- | --------------------------------------------------------------------------------------------- |
|
|
@@ -121,9 +121,9 @@ Class mapping (`getContainerClasses(mode, padding, narrow)` in `preset/preset-cl
|
|
|
121
121
|
| `padding: 'mobile'` | `smart:px-4 smart:sm:px-0` |
|
|
122
122
|
| `padding: 'none'` / unset | no padding classes |
|
|
123
123
|
|
|
124
|
-
The
|
|
124
|
+
The extra classes (`class` on the wrapper, or `class` / `[cssClass]` on `<smart-container-preset>` used directly) are appended after the mapped classes.
|
|
125
125
|
|
|
126
|
-
Register it
|
|
126
|
+
Register it through `CONTAINER_STANDARD_COMPONENT_TOKEN` to restyle every `<smart-container>`, or register every preset at once with `provideSmartPresets()`.
|
|
127
127
|
|
|
128
128
|
```typescript
|
|
129
129
|
providers: [
|
|
@@ -140,7 +140,8 @@ Projected children render both through `<smart-container>` with the preset regis
|
|
|
140
140
|
|
|
141
141
|
- Wrapper: `packages/shared/angular/src/lib/components/container/container.component.ts`
|
|
142
142
|
- Default: `packages/shared/angular/src/lib/components/container/standard/standard.component.{ts,html}`
|
|
143
|
+
- Preset: `packages/shared/angular/src/lib/components/container/preset/preset.component.ts` + `preset/preset-classes.util.ts` (internal)
|
|
143
144
|
- Base: `packages/shared/angular/src/lib/components/container/base/base.component.ts`
|
|
144
|
-
- Tests: `packages/shared/angular/src/lib/components/container/{container,standard/standard,base/base}.component.spec.ts`
|
|
145
|
+
- Tests: `packages/shared/angular/src/lib/components/container/{container,standard/standard,base/base,preset/preset}.component.spec.ts`
|
|
145
146
|
- Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`CONTAINER_STANDARD_COMPONENT_TOKEN`)
|
|
146
147
|
- Interface: `packages/shared/angular/src/lib/models/interfaces.ts` (`IContainerOptions`)
|
|
@@ -6,9 +6,9 @@ user-invocable: false
|
|
|
6
6
|
|
|
7
7
|
# Date Edit Component
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Date editor with two variations: the standard digit-by-digit input (DD-MM-RRRR, eight digit boxes) with auto-navigation and validation, and a preset calendar picker. Both support `[(ngModel)]` and `ControlValueAccessor` forms.
|
|
10
10
|
|
|
11
|
-
This component has
|
|
11
|
+
This component has a **wrapper** (`<smart-date-edit>`) that picks its variation through the `variant` input, and an **abstract base class** for custom extensions. It has no injection token.
|
|
12
12
|
|
|
13
13
|
## Default Component Usage
|
|
14
14
|
|
|
@@ -19,15 +19,19 @@ This component has both a **default concrete implementation** (`<smart-date-edit
|
|
|
19
19
|
### Import
|
|
20
20
|
|
|
21
21
|
```typescript
|
|
22
|
-
import {
|
|
22
|
+
import { DateEditComponent } from '@smartsoft001/angular';
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
### Properties
|
|
26
26
|
|
|
27
|
-
| Property | Type | Default | Description
|
|
28
|
-
| ------------- | ------------------------ | -------------- |
|
|
29
|
-
| `
|
|
30
|
-
| `
|
|
27
|
+
| Property | Type | Default | Description |
|
|
28
|
+
| ------------- | ------------------------ | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
29
|
+
| `variant` | `DateEditVariantName` | `'standard'` | `'standard'` renders `<smart-date-edit-standard>` (eight digit inputs); `'preset'` renders `<smart-date-edit-preset>` (a calendar picker). |
|
|
30
|
+
| `class` | `string` | `''` | Extra CSS classes on the rendered variation. |
|
|
31
|
+
| `ngModel` | `ModelSignal<string>` | `'2001-01-01'` | Date value in `YYYY-MM-DD` format. Written back after every edit, also when the edited date is not valid. |
|
|
32
|
+
| `validChange` | `OutputEmitter<boolean>` | — | Emits whether the edited date is valid, after every digit edit (standard) or picked day (preset). |
|
|
33
|
+
|
|
34
|
+
`DateEditVariantName` is `'standard' | 'preset'`.
|
|
31
35
|
|
|
32
36
|
### Usage
|
|
33
37
|
|
|
@@ -38,15 +42,12 @@ import { DateEditDefaultComponent } from '@smartsoft001/angular';
|
|
|
38
42
|
[(ngModel)]="dateValue"
|
|
39
43
|
(validChange)="onValid($event)"
|
|
40
44
|
></smart-date-edit>
|
|
45
|
+
<smart-date-edit variant="preset" [(ngModel)]="dateValue"></smart-date-edit>
|
|
41
46
|
```
|
|
42
47
|
|
|
43
|
-
Both binding styles work, with or without `FormsModule` in the consuming
|
|
44
|
-
component. `<smart-date-edit>` renders from an internal signal rather than
|
|
45
|
-
straight off `ngModel`, so when `FormsModule` is imported and Angular's own
|
|
46
|
-
`NgModel` directive also matches the element, the `null` it seeds its
|
|
47
|
-
`FormControl` with cannot leak back into your bound property.
|
|
48
|
+
Both binding styles (`[(ngModel)]` and `formControlName`) work, with or without `FormsModule` in the consuming component. `<smart-date-edit>` renders from an internal signal rather than straight off `ngModel`, so when `FormsModule` is imported and Angular's own `NgModel` directive also matches the element, the `null` it seeds its `FormControl` with cannot leak back into your bound property. A bound form control receives every edit, also a date that is not valid: check `validChange` before using the value.
|
|
48
49
|
|
|
49
|
-
### Features
|
|
50
|
+
### Features of the standard variation
|
|
50
51
|
|
|
51
52
|
- 8 individual digit inputs (DD + MM + YYYY)
|
|
52
53
|
- Auto-focus to next field on input
|
|
@@ -65,17 +66,24 @@ import { DateEditBaseComponent } from '@smartsoft001/angular';
|
|
|
65
66
|
|
|
66
67
|
### Key Members
|
|
67
68
|
|
|
68
|
-
| Member
|
|
69
|
-
|
|
|
70
|
-
| `
|
|
71
|
-
| `
|
|
72
|
-
| `
|
|
73
|
-
| `
|
|
74
|
-
| `
|
|
75
|
-
| `
|
|
76
|
-
| `
|
|
77
|
-
| `
|
|
78
|
-
| `
|
|
69
|
+
| Member | Type | Description |
|
|
70
|
+
| --------------------- | -------------------------- | -------------------------------------------------------------------------------------------------------------------- |
|
|
71
|
+
| `DEFAULT_DATE` | `string` | `'2001-01-01'`: the initial `ngModel`, and the date a digit edit starts from when the value is empty |
|
|
72
|
+
| `ngModel` | `ModelSignal<string>` | Date value (`YYYY-MM-DD`) |
|
|
73
|
+
| `validDate` | `boolean` | Whether the current value is a valid date (a plain field, not a signal) |
|
|
74
|
+
| `validChange` | `OutputEmitter<boolean>` | Emits the validity after an edit |
|
|
75
|
+
| `d1/d2` | `string \| null` (get/set) | Day digit accessors (index 8, 9) |
|
|
76
|
+
| `m1/m2` | `string \| null` (get/set) | Month digit accessors (index 5, 6) |
|
|
77
|
+
| `y1/y2/y3/y4` | `string \| null` (get/set) | Year digit accessors (index 0-3) |
|
|
78
|
+
| `propagateChange` | `(val: any) => void` | The form's change callback (set by `registerOnChange`); a digit edit passes the date, or `null` when it is not valid |
|
|
79
|
+
| `propagateTouched` | `() => void` | The form's touched callback (set by `registerOnTouched`) |
|
|
80
|
+
| `moveTo()` | method | Handles keyup: validates digit, moves focus |
|
|
81
|
+
| `select()` | method | Selects input content for overwrite |
|
|
82
|
+
| `writeValue()` | method | `ControlValueAccessor`: sets `ngModel` and runs change detection |
|
|
83
|
+
| `registerOnChange()` | method | `ControlValueAccessor`: stores `propagateChange` |
|
|
84
|
+
| `registerOnTouched()` | method | `ControlValueAccessor`: stores `propagateTouched` |
|
|
85
|
+
|
|
86
|
+
A subclass registers itself as `NG_VALUE_ACCESSOR` to be usable with `formControlName`; the base implements every method the contract needs.
|
|
79
87
|
|
|
80
88
|
### Extending
|
|
81
89
|
|
|
@@ -100,25 +108,21 @@ import { DateEditBaseComponent } from '@smartsoft001/angular';
|
|
|
100
108
|
export class MyDateEditComponent extends DateEditBaseComponent {}
|
|
101
109
|
```
|
|
102
110
|
|
|
103
|
-
|
|
111
|
+
`<smart-date-edit>` has no injection token, so a custom implementation is used through its own selector in place of `<smart-date-edit>`.
|
|
104
112
|
|
|
105
|
-
|
|
106
|
-
plus a calendar popover. Drop-in replacement for the standard editor.
|
|
113
|
+
## Variations
|
|
107
114
|
|
|
108
|
-
|
|
109
|
-
`variant` input (NOT an `InjectionToken` / `NgComponentOutlet`). The wrapper
|
|
110
|
-
dispatches via `@switch (variant())` over `DateEditVariantName`
|
|
111
|
-
(`'standard' | 'preset'`). Render the preset with:
|
|
115
|
+
### DateEditStandardComponent (`<smart-date-edit-standard>`)
|
|
112
116
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
117
|
+
The default variation: eight number inputs bound to the digit accessors, with the invalid state in red. `<smart-date-edit>` renders it while `variant` is `'standard'`; it can also be used directly.
|
|
118
|
+
|
|
119
|
+
### DateEditPresetComponent (`<smart-date-edit-preset>`)
|
|
120
|
+
|
|
121
|
+
A fully-styled Preline single datepicker variation: a read-only trigger input plus a calendar popover. Drop-in replacement for the standard editor.
|
|
122
|
+
|
|
123
|
+
Unlike token-based components, `<smart-date-edit>` selects its variation through the `variant` input (NOT an `InjectionToken` / `NgComponentOutlet`), so `provideSmartPresets()` does not change it: set `variant="preset"` on each `<smart-date-edit>` that should render the preset, or use `<smart-date-edit-preset>` directly.
|
|
116
124
|
|
|
117
|
-
The preset extends `DateEditBaseComponent`, so it shares `ngModel` (`YYYY-MM-DD`),
|
|
118
|
-
`validDate`, and `validChange`. Preline's JS plugin is not installed, so the
|
|
119
|
-
popover (open/close, prev/next month, day selection) is driven entirely by
|
|
120
|
-
Angular signals — no external runtime. Month/year pickers are native `<select>`
|
|
121
|
-
elements styled to match Preline.
|
|
125
|
+
The preset extends `DateEditBaseComponent`, so it shares `ngModel` (`YYYY-MM-DD`), `validDate`, and `validChange`. Preline's JS plugin is not installed, so the popover (open/close, prev/next month, day selection) is driven entirely by Angular signals — no external runtime. Month/year pickers are native `<select>` elements styled to match Preline. Picking a day closes the popover, and so does a click outside the component.
|
|
122
126
|
|
|
123
127
|
```typescript
|
|
124
128
|
import { DateEditPresetComponent } from '@smartsoft001/angular';
|
|
@@ -126,14 +130,13 @@ import { DateEditPresetComponent } from '@smartsoft001/angular';
|
|
|
126
130
|
|
|
127
131
|
## File Locations
|
|
128
132
|
|
|
133
|
+
- Wrapper: `packages/shared/angular/src/lib/components/date-edit/date-edit.component.ts`
|
|
129
134
|
- Base class: `packages/shared/angular/src/lib/components/date-edit/base/base.component.ts`
|
|
130
|
-
-
|
|
131
|
-
- Preset
|
|
132
|
-
-
|
|
133
|
-
- Default template: `packages/shared/angular/src/lib/components/date-edit/default/default.component.html`
|
|
134
|
-
- Tests: `packages/shared/angular/src/lib/components/date-edit/date-edit.component.spec.ts`
|
|
135
|
+
- Standard component: `packages/shared/angular/src/lib/components/date-edit/standard/standard.component.{ts,html}`
|
|
136
|
+
- Preset component: `packages/shared/angular/src/lib/components/date-edit/preset/preset.component.{ts,html}` + `preset/preset-classes.util.ts` (internal)
|
|
137
|
+
- Tests: `packages/shared/angular/src/lib/components/date-edit/{date-edit,base/base,preset/preset}.component.spec.ts`
|
|
135
138
|
- Stories: `packages/shared/angular/src/lib/components/date-edit/date-edit.component.stories.ts`
|
|
136
139
|
|
|
137
140
|
## Tailwind Classes
|
|
138
141
|
|
|
139
|
-
All classes use `smart:` prefix.
|
|
142
|
+
All classes use `smart:` prefix. Standard inputs: `smart:w-8 smart:h-10 smart:text-center smart:border smart:rounded-md`. Invalid: `smart:border-red-500 smart:text-red-600`. Dark: `smart:dark:bg-gray-800 smart:dark:text-white`.
|
|
@@ -6,7 +6,7 @@ user-invocable: false
|
|
|
6
6
|
|
|
7
7
|
# Date Range Component
|
|
8
8
|
|
|
9
|
-
Date range picker with trigger button,
|
|
9
|
+
Date range picker with a trigger button, a clear button and a calendar to pick the start and end day, with `ControlValueAccessor` support. The value is an `IDateRange` from `@smartsoft001/domain-core` (`{ start, end }`, both `YYYY-MM-DD`); clearing sets it to `undefined`.
|
|
10
10
|
|
|
11
11
|
This component has both a **default concrete implementation** (`<smart-date-range>`) and **abstract base classes** for custom extensions.
|
|
12
12
|
|
|
@@ -14,63 +14,47 @@ This component has both a **default concrete implementation** (`<smart-date-rang
|
|
|
14
14
|
|
|
15
15
|
### Selector
|
|
16
16
|
|
|
17
|
-
`<smart-date-range>`
|
|
18
|
-
|
|
19
|
-
### Import
|
|
20
|
-
|
|
21
|
-
```typescript
|
|
22
|
-
import { DateRangeDefaultComponent } from '@smartsoft001/angular';
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
### Properties
|
|
26
|
-
|
|
27
|
-
| Property | Type | Default | Description |
|
|
28
|
-
| --------- | -------------------------------------- | ----------- | ------------------------------------------------- |
|
|
29
|
-
| `ngModel` | `ModelSignal<IDateRange \| undefined>` | `undefined` | Date range value (`start`, `end` in `YYYY-MM-DD`) |
|
|
30
|
-
|
|
31
|
-
### IDateRange
|
|
17
|
+
`<smart-date-range>` (class `DateRangeComponent`), bound with `[(ngModel)]`, `formControlName` or `[formControl]`.
|
|
32
18
|
|
|
33
19
|
```typescript
|
|
34
|
-
|
|
35
|
-
start: string; // YYYY-MM-DD
|
|
36
|
-
end: string; // YYYY-MM-DD
|
|
37
|
-
}
|
|
20
|
+
import { DateRangeComponent } from '@smartsoft001/angular';
|
|
38
21
|
```
|
|
39
22
|
|
|
40
|
-
### Usage
|
|
41
|
-
|
|
42
23
|
```html
|
|
43
24
|
<smart-date-range [(ngModel)]="dateRange"></smart-date-range>
|
|
44
|
-
<smart-date-range formControlName="period"></smart-date-range>
|
|
25
|
+
<smart-date-range variant="preset" formControlName="period"></smart-date-range>
|
|
45
26
|
```
|
|
46
27
|
|
|
28
|
+
### Inputs
|
|
29
|
+
|
|
30
|
+
| Input | Type | Default | Description |
|
|
31
|
+
| --------- | -------------------------------------- | ------------ | ---------------------------------------------------------------------------------------------------------- |
|
|
32
|
+
| `ngModel` | `ModelSignal<IDateRange \| undefined>` | `undefined` | The range (`start`, `end` in `YYYY-MM-DD`); also bound through `ControlValueAccessor` (`formControlName`). |
|
|
33
|
+
| `variant` | `DateRangeVariantName` | `'standard'` | `'standard'` (trigger + scrollable calendar modal) or `'preset'` (trigger + popover calendar). |
|
|
34
|
+
| `class` | `string` | `''` | Classes on the rendered variant (`cssClass` input, alias `class`). |
|
|
35
|
+
|
|
36
|
+
`DateRangeVariantName` is `'standard' | 'preset'`.
|
|
37
|
+
|
|
47
38
|
### Features
|
|
48
39
|
|
|
49
|
-
- Trigger button with calendar icon
|
|
50
|
-
- Clear button (X) to
|
|
51
|
-
-
|
|
52
|
-
-
|
|
53
|
-
-
|
|
54
|
-
- `ControlValueAccessor` for forms
|
|
40
|
+
- Trigger button with a calendar icon, showing `start - end` (or the translated `select` while empty)
|
|
41
|
+
- Clear button (X) that resets the value to `undefined`
|
|
42
|
+
- `standard`: a modal with a scrollable calendar of the months around today; pick a start, then an end day, and apply
|
|
43
|
+
- `preset`: a popover calendar with month navigation, then Apply / Cancel
|
|
44
|
+
- `ControlValueAccessor` for template-driven and reactive forms
|
|
55
45
|
- Dark mode
|
|
56
46
|
|
|
47
|
+
`<smart-date-range>` does not show the modal's quick-pick buttons (today, last 7 days, ...): the standard renders `DateRangeModalStandardComponent` without `showFilterBtns` and `restrictSelectionTo`, so both stay at their defaults. They take effect only when you render the modal yourself (see `DateRangeModalBaseComponent`).
|
|
48
|
+
|
|
57
49
|
## DateRangePresetComponent (`<smart-date-range-preset>`)
|
|
58
50
|
|
|
59
|
-
A fully styled, drop-in variation based on the Preline "single calendar range"
|
|
60
|
-
datepicker (FRA-219). The Preline JS plugin is **not** installed, so the range
|
|
61
|
-
calendar is rendered entirely with Angular signals (no external runtime): click
|
|
62
|
-
the trigger to open an inline popover, pick a start and end day to highlight the
|
|
63
|
-
range, switch months via prev/next buttons or the month/year selects, then Apply.
|
|
51
|
+
A fully styled, drop-in variation based on the Preline "single calendar range" datepicker. The Preline JS plugin is **not** installed, so the range calendar is rendered entirely with Angular signals (no external runtime): click the trigger to open an inline popover, pick a start and end day to highlight the range, switch months via prev/next buttons or the month/year selects, then Apply.
|
|
64
52
|
|
|
65
|
-
|
|
66
|
-
`onClear`), so it consumes the exact same API and `ControlValueAccessor` contract
|
|
67
|
-
as the standard variant — no new interface options or tokens are required.
|
|
53
|
+
It extends `DateRangeBaseComponent` (reuses `onClick`, `onModalApply`, `onModalDismiss`, `onClear`), so it has the same value API and `ControlValueAccessor` contract as the standard variant.
|
|
68
54
|
|
|
69
55
|
### Selecting the variant
|
|
70
56
|
|
|
71
|
-
`<smart-date-range>`
|
|
72
|
-
`DateRangeVariantName = 'standard' | 'preset'`) with an internal `@switch`. This
|
|
73
|
-
component does **not** use the InjectionToken / `NgComponentOutlet` pattern:
|
|
57
|
+
`<smart-date-range>` picks the rendering with its `variant` input and an internal `@switch`; it has no injection token. Use `variant="preset"` on the wrapper, or the `<smart-date-range-preset>` selector directly.
|
|
74
58
|
|
|
75
59
|
```html
|
|
76
60
|
<!-- via the wrapper -->
|
|
@@ -80,57 +64,68 @@ component does **not** use the InjectionToken / `NgComponentOutlet` pattern:
|
|
|
80
64
|
<smart-date-range-preset [(ngModel)]="dateRange"></smart-date-range-preset>
|
|
81
65
|
```
|
|
82
66
|
|
|
83
|
-
|
|
84
|
-
`NgComponentOutlet`), the host `class` is applied natively — no `cssClass` input
|
|
85
|
-
override is needed (unlike token-based components such as `badge`).
|
|
67
|
+
The wrapper binds `[class]="cssClass()"` on the variant it renders, so `class` on `<smart-date-range>` reaches either variant.
|
|
86
68
|
|
|
87
69
|
## Base Classes API (for Extension)
|
|
88
70
|
|
|
89
71
|
### DateRangeBaseComponent
|
|
90
72
|
|
|
91
|
-
Provides open/close state, calendar
|
|
73
|
+
Provides the value, the open/close state, the calendar state kept between opens, the clear/apply logic and `ControlValueAccessor`.
|
|
92
74
|
|
|
93
75
|
```typescript
|
|
94
76
|
import { DateRangeBaseComponent } from '@smartsoft001/angular';
|
|
95
77
|
```
|
|
96
78
|
|
|
97
|
-
| Member
|
|
98
|
-
|
|
|
99
|
-
| `ngModel`
|
|
100
|
-
| `value`
|
|
101
|
-
| `isOpen`
|
|
102
|
-
| `calendarData`
|
|
103
|
-
| `onClick()`
|
|
104
|
-
| `onModalApply()` | method |
|
|
105
|
-
| `onModalDismiss()`
|
|
106
|
-
| `onClear()`
|
|
79
|
+
| Member | Type | Description |
|
|
80
|
+
| ---------------------- | -------------------------------------- | ---------------------------------------------------------- |
|
|
81
|
+
| `ngModel` | `ModelSignal<IDateRange \| undefined>` | Date range value |
|
|
82
|
+
| `value` | `IDateRange \| undefined` | Current value (synced from `ngModel` via an effect) |
|
|
83
|
+
| `isOpen` | `WritableSignal<boolean>` | Whether the picker is open |
|
|
84
|
+
| `calendarData` | `CalendarState` | Calendar state the picker reopens with |
|
|
85
|
+
| `onClick()` | method | Opens the picker with the current range |
|
|
86
|
+
| `onModalApply(data)` | method | Sets the value from a `CalendarState`, emits it and closes |
|
|
87
|
+
| `onModalDismiss()` | method | Closes without changing the value |
|
|
88
|
+
| `onClear()` | method | Resets the value to `undefined` and emits it |
|
|
89
|
+
| `propagateChange(val)` | method | The registered `ControlValueAccessor` change callback |
|
|
107
90
|
|
|
108
91
|
### DateRangeModalBaseComponent
|
|
109
92
|
|
|
110
|
-
|
|
93
|
+
The modal's behaviour: calendar months, quick-pick buttons, date selection and range restriction. `DateRangeModalStandardComponent` (`<smart-date-range-modal-standard>`) is its implementation.
|
|
111
94
|
|
|
112
95
|
```typescript
|
|
113
96
|
import { DateRangeModalBaseComponent } from '@smartsoft001/angular';
|
|
114
97
|
```
|
|
115
98
|
|
|
116
|
-
| Member
|
|
117
|
-
|
|
|
118
|
-
| `
|
|
119
|
-
| `
|
|
120
|
-
| `
|
|
121
|
-
| `
|
|
122
|
-
| `
|
|
123
|
-
| `
|
|
124
|
-
| `
|
|
125
|
-
| `
|
|
126
|
-
| `
|
|
127
|
-
| `
|
|
128
|
-
| `
|
|
129
|
-
| `
|
|
130
|
-
| `
|
|
131
|
-
| `
|
|
132
|
-
| `
|
|
133
|
-
|
|
99
|
+
| Member | Type | Description |
|
|
100
|
+
| ------------------------------------- | --------------------------------- | ------------------------------------------------------------------------------------------------ |
|
|
101
|
+
| `showFilterBtns` | `InputSignal<boolean>` | Shows the quick-pick buttons. Default `false`; modal only: `<smart-date-range>` does not set it. |
|
|
102
|
+
| `restrictSelectionTo` | `InputSignal<number>` | When non-zero, only a range of exactly this many days can be applied. Default `0`; modal only. |
|
|
103
|
+
| `previousState` | `InputSignal<CalendarState>` | The state the modal opens with; without `dateFrom` it selects today |
|
|
104
|
+
| `apply` | `OutputEmitterRef<CalendarState>` | Emits the picked state on apply |
|
|
105
|
+
| `dismiss` | `OutputEmitterRef<void>` | Emits when the modal is closed without applying |
|
|
106
|
+
| `calendar` | `month[]` | The months of the `CalendarService` |
|
|
107
|
+
| `dateForm` | `UntypedFormGroup` | `dateFrom` / `dateTo` (shown dates) and the `datesRefGroup` of the picked days |
|
|
108
|
+
| `selectToday()` … `selectLastMonth()` | method | Quick picks: today, yesterday, last 7 days, last 30 days, this month, last month |
|
|
109
|
+
| `isInRange(day)` | method | Whether a day lies inside the picked range |
|
|
110
|
+
| `isSelectionStart(day)` | method | Whether a day is the range start |
|
|
111
|
+
| `isSelectionEnd(day)` | method | Whether a day is the range end |
|
|
112
|
+
| `isStartAndEndDateSame()` | method | Whether start and end are the same day |
|
|
113
|
+
| `isSelectionInRestrictedRange()` | method | Whether the range has exactly `restrictSelectionTo` days |
|
|
114
|
+
| `applyDates()` | method | Emits `apply` with the current state |
|
|
115
|
+
| `dismissPage()` | method | Emits `dismiss` and unsubscribes |
|
|
116
|
+
|
|
117
|
+
### CalendarState
|
|
118
|
+
|
|
119
|
+
What the modal applies, and is reopened with.
|
|
120
|
+
|
|
121
|
+
| Field | Type | Default | Description |
|
|
122
|
+
| -------------------- | -------------------- | -------- | --------------------------------------------------------------- |
|
|
123
|
+
| `dateFrom` | `moment.Moment` | required | Start of the picked range (`null` while nothing is picked). |
|
|
124
|
+
| `dateTo` | `moment.Moment` | required | End of the picked range. |
|
|
125
|
+
| `scrollPosition` | `number` | required | Scroll position of the modal's calendar, restored on reopening. |
|
|
126
|
+
| `selectedButtonName` | `FilterBtnConstants` | required | The quick-pick button that produced the range. |
|
|
127
|
+
|
|
128
|
+
`FilterBtnConstants` is a `const enum`: `empthyString = ''` (spelled that way in the code), `today = 'Today'`, `yesterday = 'Yesterday'`, `lastSevenDays = 'LastSevenDays'`, `lastThirtyDays = 'LastThirtyDays'`, `thisMonth = 'ThisMonth'`, `lastMonth = 'LastMonth'`.
|
|
134
129
|
|
|
135
130
|
### Extending
|
|
136
131
|
|
|
@@ -138,13 +133,11 @@ import { DateRangeModalBaseComponent } from '@smartsoft001/angular';
|
|
|
138
133
|
import { Component, forwardRef, ViewEncapsulation } from '@angular/core';
|
|
139
134
|
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
140
135
|
import { DateRangeBaseComponent } from '@smartsoft001/angular';
|
|
141
|
-
import { MyDateRangeModalComponent } from './my-modal.component';
|
|
142
136
|
|
|
143
137
|
@Component({
|
|
144
138
|
selector: 'my-date-range',
|
|
145
139
|
templateUrl: './my-date-range.component.html',
|
|
146
140
|
encapsulation: ViewEncapsulation.None,
|
|
147
|
-
imports: [MyDateRangeModalComponent],
|
|
148
141
|
providers: [
|
|
149
142
|
{
|
|
150
143
|
provide: NG_VALUE_ACCESSOR,
|
|
@@ -158,15 +151,12 @@ export class MyDateRangeComponent extends DateRangeBaseComponent {}
|
|
|
158
151
|
|
|
159
152
|
## File Locations
|
|
160
153
|
|
|
154
|
+
- Wrapper: `packages/shared/angular/src/lib/components/date-range/date-range.component.ts`
|
|
161
155
|
- Base class: `packages/shared/angular/src/lib/components/date-range/base/date-range-base.component.ts`
|
|
162
156
|
- Modal base: `packages/shared/angular/src/lib/components/date-range/base/date-range-modal-base.component.ts`
|
|
163
|
-
-
|
|
164
|
-
-
|
|
165
|
-
-
|
|
166
|
-
- Preset component: `packages/shared/angular/src/lib/components/date-range/preset/preset.component.ts`
|
|
167
|
-
- Preset template: `packages/shared/angular/src/lib/components/date-range/preset/preset.component.html`
|
|
168
|
-
- Preset classes: `packages/shared/angular/src/lib/components/date-range/preset/preset-classes.util.ts`
|
|
169
|
-
- Preset tests: `packages/shared/angular/src/lib/components/date-range/preset/preset.component.spec.ts`
|
|
157
|
+
- Standard: `packages/shared/angular/src/lib/components/date-range/standard/standard.component.ts` (+ `.html`)
|
|
158
|
+
- Standard modal: `packages/shared/angular/src/lib/components/date-range/standard/standard-modal.component.ts` (+ `.html`)
|
|
159
|
+
- Preset: `packages/shared/angular/src/lib/components/date-range/preset/preset.component.ts` (+ `.html`, `preset-classes.util.ts`)
|
|
170
160
|
- Tests: `packages/shared/angular/src/lib/components/date-range/date-range.component.spec.ts`
|
|
171
161
|
- Stories: `packages/shared/angular/src/lib/components/date-range/date-range.component.stories.ts`
|
|
172
162
|
- Calendar service: `packages/shared/angular/src/lib/services/calendar/calendar.service.ts`
|
|
@@ -38,6 +38,25 @@ Abstract base directive for extending custom description-list implementations. E
|
|
|
38
38
|
|
|
39
39
|
### IDescriptionListOptions
|
|
40
40
|
|
|
41
|
+
All fields are optional. Both the standard and the preset read every field; a section renders only when its string or template is set.
|
|
42
|
+
|
|
43
|
+
| Field | Type | Default | Description |
|
|
44
|
+
| ---------------- | ------------------------ | ------- | -------------------------------------------- |
|
|
45
|
+
| `title` | `string` | - | Heading above the list. |
|
|
46
|
+
| `description` | `string` | - | Text under the heading. |
|
|
47
|
+
| `items` | `IDescriptionListItem[]` | `[]` | The rows. |
|
|
48
|
+
| `attachmentsTpl` | `TemplateRef<unknown>` | - | A section after the rows (e.g. a file list). |
|
|
49
|
+
| `footerTpl` | `TemplateRef<unknown>` | - | A section at the end. |
|
|
50
|
+
|
|
51
|
+
### IDescriptionListItem
|
|
52
|
+
|
|
53
|
+
| Field | Type | Default | Description |
|
|
54
|
+
| ----------- | ---------------------- | -------- | ------------------------------------------- |
|
|
55
|
+
| `label` | `string` | required | The term (`<dt>`). |
|
|
56
|
+
| `value` | `string` | - | The value as text. |
|
|
57
|
+
| `valueTpl` | `TemplateRef<unknown>` | - | The value as a template; wins over `value`. |
|
|
58
|
+
| `actionTpl` | `TemplateRef<unknown>` | - | An action next to the value. |
|
|
59
|
+
|
|
41
60
|
```typescript
|
|
42
61
|
interface IDescriptionListOptions {
|
|
43
62
|
title?: string;
|
|
@@ -55,15 +74,13 @@ interface IDescriptionListItem {
|
|
|
55
74
|
}
|
|
56
75
|
```
|
|
57
76
|
|
|
58
|
-
All properties are optional. The default `DescriptionListStandardComponent` consumes every property; a section is rendered only when its template/string is provided. Within an item, `valueTpl` takes precedence over `value` when both are set.
|
|
59
|
-
|
|
60
77
|
## DESCRIPTION_LIST_STANDARD_COMPONENT_TOKEN
|
|
61
78
|
|
|
62
79
|
```typescript
|
|
63
80
|
import { DESCRIPTION_LIST_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
64
81
|
```
|
|
65
82
|
|
|
66
|
-
InjectionToken that allows replacing the default `DescriptionListStandardComponent` with a custom implementation. Provide a `Type<DescriptionListBaseComponent>` to override.
|
|
83
|
+
InjectionToken that allows replacing the default `DescriptionListStandardComponent` with a custom implementation. Provide a `Type<DescriptionListBaseComponent>` to override. The wrapper passes `options` and the `class` value to the registered component (under `class` when it keeps the base's alias, under `cssClass` when it redeclares the input without it).
|
|
67
84
|
|
|
68
85
|
```typescript
|
|
69
86
|
providers: [
|
|
@@ -81,7 +98,6 @@ import {
|
|
|
81
98
|
ChangeDetectionStrategy,
|
|
82
99
|
Component,
|
|
83
100
|
computed,
|
|
84
|
-
input,
|
|
85
101
|
ViewEncapsulation,
|
|
86
102
|
} from '@angular/core';
|
|
87
103
|
import { NgTemplateOutlet } from '@angular/common';
|
|
@@ -116,9 +132,6 @@ import { DescriptionListBaseComponent } from '@smartsoft001/angular';
|
|
|
116
132
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
117
133
|
})
|
|
118
134
|
export class MyCustomDescriptionListComponent extends DescriptionListBaseComponent {
|
|
119
|
-
// NgComponentOutlet passes 'cssClass' by canonical name, not the 'class' alias.
|
|
120
|
-
override cssClass = input<string>('');
|
|
121
|
-
|
|
122
135
|
containerClasses = computed(() => {
|
|
123
136
|
const classes = ['my-description-list'];
|
|
124
137
|
const extra = this.cssClass();
|
|
@@ -161,7 +174,7 @@ export class MyCustomDescriptionListComponent extends DescriptionListBaseCompone
|
|
|
161
174
|
|
|
162
175
|
<!-- With per-item actions -->
|
|
163
176
|
<ng-template #updateAction>
|
|
164
|
-
<button>Update</button>
|
|
177
|
+
<smart-button [options]="{ click: onUpdate }">Update</smart-button>
|
|
165
178
|
</ng-template>
|
|
166
179
|
|
|
167
180
|
<smart-description-list
|
|
@@ -205,7 +218,7 @@ export class MyCustomDescriptionListComponent extends DescriptionListBaseCompone
|
|
|
205
218
|
- Rows (`data-role="row"`): `grid py-3 sm:grid-cols-3 sm:gap-4` with `<dt>` (`data-role="term"`, `text-sm font-medium text-gray-500 dark:text-gray-400`) and `<dd>` (`data-role="value"`, `text-sm text-gray-900 dark:text-white sm:col-span-2`). `valueTpl` wins over `value`; `actionTpl` renders right-aligned inside `data-role="action"`.
|
|
206
219
|
- Optional `attachmentsTpl` (`data-role="attachments"`) and `footerTpl` (`data-role="footer"`) render as separate sections below the list.
|
|
207
220
|
|
|
208
|
-
|
|
221
|
+
The preset declares `cssClass` without the `class` alias, so bind `[cssClass]` when you use the `<smart-description-list-preset>` selector directly; `class` on `<smart-description-list>` reaches it through the wrapper. Register it for `DESCRIPTION_LIST_STANDARD_COMPONENT_TOKEN` to restyle every `<smart-description-list>`, or register every preset at once with `provideSmartPresets()`.
|
|
209
222
|
|
|
210
223
|
```typescript
|
|
211
224
|
providers: [
|
|
@@ -216,7 +229,7 @@ providers: [
|
|
|
216
229
|
];
|
|
217
230
|
```
|
|
218
231
|
|
|
219
|
-
No new `IDescriptionListOptions` fields are introduced; the preset consumes the existing API.
|
|
232
|
+
No new `IDescriptionListOptions` fields are introduced; the preset consumes the existing API. Its class recipes are internal (not exported from `@smartsoft001/angular`).
|
|
220
233
|
|
|
221
234
|
## File Locations
|
|
222
235
|
|