@smartsoft001/claude-plugins 2.119.0 → 2.121.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/.claude-plugin/plugin.json +1 -1
- package/plugins/smart/agents/angular-components/AGENT.md +212 -11
- package/plugins/smart/skills/angular-components-accordion/SKILL.md +86 -0
- package/plugins/smart/skills/angular-components-action-panel/SKILL.md +195 -0
- package/plugins/smart/skills/angular-components-breadcrumbs/SKILL.md +152 -0
- package/plugins/smart/skills/angular-components-button/SKILL.md +81 -54
- package/plugins/smart/skills/angular-components-calendar/SKILL.md +222 -0
- package/plugins/smart/skills/angular-components-card/SKILL.md +112 -0
- package/plugins/smart/skills/angular-components-card-heading/SKILL.md +156 -0
- package/plugins/smart/skills/angular-components-date-edit/SKILL.md +107 -0
- package/plugins/smart/skills/angular-components-date-range/SKILL.md +149 -0
- package/plugins/smart/skills/angular-components-description-list/SKILL.md +205 -0
- package/plugins/smart/skills/angular-components-detail/SKILL.md +146 -0
- package/plugins/smart/skills/angular-components-details/SKILL.md +123 -0
- package/plugins/smart/skills/angular-components-empty-state/SKILL.md +198 -0
- package/plugins/smart/skills/angular-components-feed/SKILL.md +199 -0
- package/plugins/smart/skills/angular-components-form/SKILL.md +160 -0
- package/plugins/smart/skills/angular-components-grid-list/SKILL.md +215 -0
- package/plugins/smart/skills/angular-components-info/SKILL.md +160 -0
- package/plugins/smart/skills/angular-components-input/SKILL.md +196 -0
- package/plugins/smart/skills/angular-components-list/SKILL.md +265 -0
- package/plugins/smart/skills/angular-components-multi-column-layout/SKILL.md +174 -0
- package/plugins/smart/skills/angular-components-navbar/SKILL.md +192 -0
- package/plugins/smart/skills/angular-components-page/SKILL.md +230 -0
- package/plugins/smart/skills/angular-components-page-heading/SKILL.md +183 -0
- package/plugins/smart/skills/angular-components-paging/SKILL.md +132 -0
- package/plugins/smart/skills/angular-components-password-strength/SKILL.md +172 -0
- package/plugins/smart/skills/angular-components-progress-bars/SKILL.md +187 -0
- package/plugins/smart/skills/angular-components-searchbar/SKILL.md +167 -0
- package/plugins/smart/skills/angular-components-section-heading/SKILL.md +177 -0
- package/plugins/smart/skills/angular-components-select-menu/SKILL.md +211 -0
- package/plugins/smart/skills/angular-components-sidebar-layout/SKILL.md +176 -0
- package/plugins/smart/skills/angular-components-sidebar-navigation/SKILL.md +225 -0
- package/plugins/smart/skills/angular-components-sign-in-form/SKILL.md +202 -0
- package/plugins/smart/skills/angular-components-stacked-layout/SKILL.md +169 -0
- package/plugins/smart/skills/angular-components-stacked-list/SKILL.md +213 -0
- package/plugins/smart/skills/angular-components-stats/SKILL.md +213 -0
- package/plugins/smart/skills/angular-components-table/SKILL.md +216 -0
- package/plugins/smart/skills/angular-components-tabs/SKILL.md +181 -0
- package/plugins/smart/skills/angular-components-textarea/SKILL.md +168 -0
- package/plugins/smart/skills/angular-components-toggle/SKILL.md +155 -0
- package/plugins/smart/skills/angular-components-vertical-navigation/SKILL.md +158 -0
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: angular-components-card-heading
|
|
3
|
+
description: Card heading component API with InjectionToken pattern for custom implementations.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Card Heading Component
|
|
8
|
+
|
|
9
|
+
The `<smart-card-heading>` component provides a small composable heading region for cards, with optional slots for avatar, title, description, meta, and actions. It can be used standalone or passed as the `headerTpl` value to `<smart-card>`. It follows the Base + Standard + Wrapper pattern with an InjectionToken-based extension mechanism. The abstract `CardHeadingBaseComponent` defines the shared API — optional `ICardHeadingOptions` and `cssClass` (alias `class`). `CardHeadingStandardComponent` is a barebones placeholder concrete implementation. `CardHeadingComponent` is the public wrapper that renders `CardHeadingStandardComponent` by default and accepts a custom replacement via `CARD_HEADING_STANDARD_COMPONENT_TOKEN`.
|
|
10
|
+
|
|
11
|
+
## When to Use This Skill
|
|
12
|
+
|
|
13
|
+
- Developer wants to use or customize the card heading component
|
|
14
|
+
- Developer asks about `<smart-card-heading>`, `CardHeadingComponent`, `CardHeadingStandardComponent`, or `CardHeadingBaseComponent`
|
|
15
|
+
|
|
16
|
+
## Components
|
|
17
|
+
|
|
18
|
+
### CardHeadingComponent (`<smart-card-heading>`)
|
|
19
|
+
|
|
20
|
+
Main wrapper component. Renders `CardHeadingStandardComponent` by default. When `CARD_HEADING_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet`.
|
|
21
|
+
|
|
22
|
+
### CardHeadingStandardComponent (`<smart-card-heading-standard>`)
|
|
23
|
+
|
|
24
|
+
Barebones placeholder concrete implementation. Renders a wrapper `<div>` with an optional avatar slot, a content area containing `<h3>` (title) + `<p class="description">` (description) + optional meta slot, and an optional actions slot. Each section is rendered only when its corresponding template/string is provided. The external `cssClass` is applied to the wrapper. It does not include Tailwind UI styling — it exists solely as the default structural placeholder until a custom implementation is registered through the token.
|
|
25
|
+
|
|
26
|
+
### CardHeadingBaseComponent (abstract)
|
|
27
|
+
|
|
28
|
+
Abstract base directive for extending custom card-heading implementations. Exposes `options` as an `InputSignal<ICardHeadingOptions | undefined>` and `cssClass` as an `InputSignal<string>` (with alias `class`).
|
|
29
|
+
|
|
30
|
+
## API
|
|
31
|
+
|
|
32
|
+
### Inputs
|
|
33
|
+
|
|
34
|
+
| Input | Type | Default | Description |
|
|
35
|
+
| --------- | ----------------------------------------------- | ------- | ----------------------------------------------------------- |
|
|
36
|
+
| `options` | `InputSignal<ICardHeadingOptions \| undefined>` | - | Optional configuration (title, description, slot templates) |
|
|
37
|
+
| `class` | `InputSignal<string>` | `''` | External CSS classes (alias for `cssClass`) |
|
|
38
|
+
|
|
39
|
+
### ICardHeadingOptions
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
interface ICardHeadingOptions {
|
|
43
|
+
title?: string;
|
|
44
|
+
description?: string;
|
|
45
|
+
avatarTpl?: TemplateRef<unknown>;
|
|
46
|
+
actionsTpl?: TemplateRef<unknown>;
|
|
47
|
+
metaTpl?: TemplateRef<unknown>;
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
All properties are optional. The default `CardHeadingStandardComponent` consumes every property; a section is rendered only when its template/string is provided.
|
|
52
|
+
|
|
53
|
+
## CARD_HEADING_STANDARD_COMPONENT_TOKEN
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
import { CARD_HEADING_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
InjectionToken that allows replacing the default `CardHeadingStandardComponent` with a custom implementation. Provide a `Type<CardHeadingBaseComponent>` to override.
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
providers: [
|
|
63
|
+
{
|
|
64
|
+
provide: CARD_HEADING_STANDARD_COMPONENT_TOKEN,
|
|
65
|
+
useValue: MyCustomCardHeadingComponent,
|
|
66
|
+
},
|
|
67
|
+
];
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Extending the Base Class
|
|
71
|
+
|
|
72
|
+
```typescript
|
|
73
|
+
import {
|
|
74
|
+
ChangeDetectionStrategy,
|
|
75
|
+
Component,
|
|
76
|
+
computed,
|
|
77
|
+
input,
|
|
78
|
+
ViewEncapsulation,
|
|
79
|
+
} from '@angular/core';
|
|
80
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
81
|
+
|
|
82
|
+
import { CardHeadingBaseComponent } from '@smartsoft001/angular';
|
|
83
|
+
|
|
84
|
+
@Component({
|
|
85
|
+
selector: 'my-custom-card-heading',
|
|
86
|
+
template: `
|
|
87
|
+
<div [class]="containerClasses()">
|
|
88
|
+
<div class="content">
|
|
89
|
+
@if (options()?.title) {
|
|
90
|
+
<h3>{{ options()!.title }}</h3>
|
|
91
|
+
}
|
|
92
|
+
@if (options()?.description) {
|
|
93
|
+
<p>{{ options()!.description }}</p>
|
|
94
|
+
}
|
|
95
|
+
</div>
|
|
96
|
+
@if (options()?.actionsTpl) {
|
|
97
|
+
<div class="actions">
|
|
98
|
+
<ng-container [ngTemplateOutlet]="options()!.actionsTpl!" />
|
|
99
|
+
</div>
|
|
100
|
+
}
|
|
101
|
+
</div>
|
|
102
|
+
`,
|
|
103
|
+
imports: [NgTemplateOutlet],
|
|
104
|
+
encapsulation: ViewEncapsulation.None,
|
|
105
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
106
|
+
})
|
|
107
|
+
export class MyCustomCardHeadingComponent extends CardHeadingBaseComponent {
|
|
108
|
+
// NgComponentOutlet passes 'cssClass' by canonical name, not the 'class' alias.
|
|
109
|
+
override cssClass = input<string>('');
|
|
110
|
+
|
|
111
|
+
containerClasses = computed(() => {
|
|
112
|
+
const classes = ['my-card-heading'];
|
|
113
|
+
const extra = this.cssClass();
|
|
114
|
+
if (extra) classes.push(extra);
|
|
115
|
+
return classes.join(' ');
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Usage Examples
|
|
121
|
+
|
|
122
|
+
```html
|
|
123
|
+
<!-- Title only -->
|
|
124
|
+
<smart-card-heading [options]="{ title: 'Job Postings' }" />
|
|
125
|
+
|
|
126
|
+
<!-- Title and description -->
|
|
127
|
+
<smart-card-heading
|
|
128
|
+
[options]="{ title: 'Job Postings', description: 'Currently open' }"
|
|
129
|
+
/>
|
|
130
|
+
|
|
131
|
+
<!-- With actions -->
|
|
132
|
+
<ng-template #actions>
|
|
133
|
+
<button>View all</button>
|
|
134
|
+
</ng-template>
|
|
135
|
+
|
|
136
|
+
<smart-card-heading
|
|
137
|
+
[options]="{ title: 'Job Postings', actionsTpl: actions }"
|
|
138
|
+
/>
|
|
139
|
+
|
|
140
|
+
<!-- Inside a smart-card via headerTpl -->
|
|
141
|
+
<ng-template #cardHeader>
|
|
142
|
+
<smart-card-heading [options]="{ title: 'Job Postings' }" />
|
|
143
|
+
</ng-template>
|
|
144
|
+
|
|
145
|
+
<smart-card [options]="{ headerTpl: cardHeader }">
|
|
146
|
+
<p>Card body content</p>
|
|
147
|
+
</smart-card>
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## File Locations
|
|
151
|
+
|
|
152
|
+
- Wrapper: `packages/shared/angular/src/lib/components/card-heading/card-heading.component.ts`
|
|
153
|
+
- Standard: `packages/shared/angular/src/lib/components/card-heading/standard/standard.component.ts`
|
|
154
|
+
- Base class: `packages/shared/angular/src/lib/components/card-heading/base/base.component.ts`
|
|
155
|
+
- Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`CARD_HEADING_STANDARD_COMPONENT_TOKEN`)
|
|
156
|
+
- Interface: `packages/shared/angular/src/lib/models/interfaces.ts` (`ICardHeadingOptions`)
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: angular-components-date-edit
|
|
3
|
+
description: Date edit component API and usage patterns for @smartsoft001/angular. Includes ready-to-use <smart-date-edit> and extensible base class.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Date Edit Component
|
|
8
|
+
|
|
9
|
+
Digit-by-digit date input editor (DD-MM-RRRR format) with auto-navigation, validation, and `ControlValueAccessor` support.
|
|
10
|
+
|
|
11
|
+
This component has both a **default concrete implementation** (`<smart-date-edit>`) and an **abstract base class** for custom extensions.
|
|
12
|
+
|
|
13
|
+
## Default Component Usage
|
|
14
|
+
|
|
15
|
+
### Selector
|
|
16
|
+
|
|
17
|
+
`<smart-date-edit>`
|
|
18
|
+
|
|
19
|
+
### Import
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
import { DateEditDefaultComponent } from '@smartsoft001/angular';
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Properties
|
|
26
|
+
|
|
27
|
+
| Property | Type | Default | Description |
|
|
28
|
+
| ------------- | ------------------------ | -------------- | --------------------------------- |
|
|
29
|
+
| `ngModel` | `ModelSignal<string>` | `'2001-01-01'` | Date value in `YYYY-MM-DD` format |
|
|
30
|
+
| `validChange` | `OutputEmitter<boolean>` | - | Emits on validity change |
|
|
31
|
+
|
|
32
|
+
### Usage
|
|
33
|
+
|
|
34
|
+
```html
|
|
35
|
+
<smart-date-edit [(ngModel)]="dateValue"></smart-date-edit>
|
|
36
|
+
<smart-date-edit formControlName="birthDate"></smart-date-edit>
|
|
37
|
+
<smart-date-edit
|
|
38
|
+
[(ngModel)]="dateValue"
|
|
39
|
+
(validChange)="onValid($event)"
|
|
40
|
+
></smart-date-edit>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Features
|
|
44
|
+
|
|
45
|
+
- 8 individual digit inputs (DD + MM + YYYY)
|
|
46
|
+
- Auto-focus to next field on input
|
|
47
|
+
- Moment.js validation
|
|
48
|
+
- Invalid state: red border + red text
|
|
49
|
+
- Dark mode support
|
|
50
|
+
- `ControlValueAccessor` for forms
|
|
51
|
+
|
|
52
|
+
## Base Class API (for Extension)
|
|
53
|
+
|
|
54
|
+
### Import
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
import { DateEditBaseComponent } from '@smartsoft001/angular';
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Key Members
|
|
61
|
+
|
|
62
|
+
| Member | Type | Description |
|
|
63
|
+
| -------------- | ------------------------ | ------------------------------------------- |
|
|
64
|
+
| `ngModel` | `ModelSignal<string>` | Date value (`YYYY-MM-DD`) |
|
|
65
|
+
| `validDate` | `boolean` | Whether current value is a valid date |
|
|
66
|
+
| `validChange` | `OutputEmitter<boolean>` | Emits on validity change |
|
|
67
|
+
| `d1/d2` | `string` (get/set) | Day digit accessors (index 8, 9) |
|
|
68
|
+
| `m1/m2` | `string` (get/set) | Month digit accessors (index 5, 6) |
|
|
69
|
+
| `y1/y2/y3/y4` | `string` (get/set) | Year digit accessors (index 0-3) |
|
|
70
|
+
| `moveTo()` | method | Handles keyup: validates digit, moves focus |
|
|
71
|
+
| `select()` | method | Selects input content for overwrite |
|
|
72
|
+
| `writeValue()` | method | `ControlValueAccessor` — sets value |
|
|
73
|
+
|
|
74
|
+
### Extending
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
import { Component, forwardRef, ViewEncapsulation } from '@angular/core';
|
|
78
|
+
import { FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
79
|
+
import { DateEditBaseComponent } from '@smartsoft001/angular';
|
|
80
|
+
|
|
81
|
+
@Component({
|
|
82
|
+
selector: 'my-date-edit',
|
|
83
|
+
templateUrl: './my-date-edit.component.html',
|
|
84
|
+
encapsulation: ViewEncapsulation.None,
|
|
85
|
+
imports: [FormsModule],
|
|
86
|
+
providers: [
|
|
87
|
+
{
|
|
88
|
+
provide: NG_VALUE_ACCESSOR,
|
|
89
|
+
useExisting: forwardRef(() => MyDateEditComponent),
|
|
90
|
+
multi: true,
|
|
91
|
+
},
|
|
92
|
+
],
|
|
93
|
+
})
|
|
94
|
+
export class MyDateEditComponent extends DateEditBaseComponent {}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## File Locations
|
|
98
|
+
|
|
99
|
+
- Base class: `packages/shared/angular/src/lib/components/date-edit/base/base.component.ts`
|
|
100
|
+
- Default component: `packages/shared/angular/src/lib/components/date-edit/default/default.component.ts`
|
|
101
|
+
- Default template: `packages/shared/angular/src/lib/components/date-edit/default/default.component.html`
|
|
102
|
+
- Tests: `packages/shared/angular/src/lib/components/date-edit/date-edit.component.spec.ts`
|
|
103
|
+
- Stories: `packages/shared/angular/src/lib/components/date-edit/date-edit.component.stories.ts`
|
|
104
|
+
|
|
105
|
+
## Tailwind Classes
|
|
106
|
+
|
|
107
|
+
All classes use `smart:` prefix. 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`.
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: angular-components-date-range
|
|
3
|
+
description: Date range picker component API and usage patterns for @smartsoft001/angular. Includes ready-to-use <smart-date-range> and extensible base classes.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Date Range Component
|
|
8
|
+
|
|
9
|
+
Date range picker with trigger button, modal calendar overlay, quick filter buttons, and `ControlValueAccessor` support.
|
|
10
|
+
|
|
11
|
+
This component has both a **default concrete implementation** (`<smart-date-range>`) and **abstract base classes** for custom extensions.
|
|
12
|
+
|
|
13
|
+
## Default Component Usage
|
|
14
|
+
|
|
15
|
+
### Selector
|
|
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
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
interface IDateRange {
|
|
35
|
+
start: string; // YYYY-MM-DD
|
|
36
|
+
end: string; // YYYY-MM-DD
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Usage
|
|
41
|
+
|
|
42
|
+
```html
|
|
43
|
+
<smart-date-range [(ngModel)]="dateRange"></smart-date-range>
|
|
44
|
+
<smart-date-range formControlName="period"></smart-date-range>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Features
|
|
48
|
+
|
|
49
|
+
- Trigger button with calendar icon
|
|
50
|
+
- Clear button (X) to reset
|
|
51
|
+
- Modal overlay with calendar grid
|
|
52
|
+
- Quick filters: Today, Yesterday, Last 7/30 days, This/Last Month
|
|
53
|
+
- Range selection with start/end highlighting
|
|
54
|
+
- `ControlValueAccessor` for forms
|
|
55
|
+
- Dark mode
|
|
56
|
+
|
|
57
|
+
## Base Classes API (for Extension)
|
|
58
|
+
|
|
59
|
+
### DateRangeBaseComponent
|
|
60
|
+
|
|
61
|
+
Provides open/close state, calendar data management, clear/apply logic, and `ControlValueAccessor`.
|
|
62
|
+
|
|
63
|
+
```typescript
|
|
64
|
+
import { DateRangeBaseComponent } from '@smartsoft001/angular';
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
| Member | Type | Description |
|
|
68
|
+
| ------------------ | -------------------------------------- | ---------------------------------------- |
|
|
69
|
+
| `ngModel` | `ModelSignal<IDateRange \| undefined>` | Date range value |
|
|
70
|
+
| `value` | `IDateRange \| undefined` | Current value (synced via effect) |
|
|
71
|
+
| `isOpen` | `WritableSignal<boolean>` | Controls modal visibility |
|
|
72
|
+
| `calendarData` | `CalendarState` | Persisted calendar state between opens |
|
|
73
|
+
| `onClick()` | method | Opens modal, restores previous selection |
|
|
74
|
+
| `onModalApply()` | method | Applies selection and closes modal |
|
|
75
|
+
| `onModalDismiss()` | method | Closes modal without applying |
|
|
76
|
+
| `onClear()` | method | Resets value to undefined |
|
|
77
|
+
|
|
78
|
+
### DateRangeModalBaseComponent
|
|
79
|
+
|
|
80
|
+
Provides calendar rendering, quick filter buttons, date selection, and range restriction.
|
|
81
|
+
|
|
82
|
+
```typescript
|
|
83
|
+
import { DateRangeModalBaseComponent } from '@smartsoft001/angular';
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
| Member | Type | Description |
|
|
87
|
+
| ------------------------ | ------------------------------ | --------------------------------- |
|
|
88
|
+
| `previousState` | `InputSignal<CalendarState>` | State from parent component |
|
|
89
|
+
| `apply` | `OutputEmitter<CalendarState>` | Emits on apply |
|
|
90
|
+
| `dismiss` | `OutputEmitter<void>` | Emits on dismiss |
|
|
91
|
+
| `calendar` | `month[]` | Generated calendar months |
|
|
92
|
+
| `dateForm` | `UntypedFormGroup` | Form with dateFrom/dateTo fields |
|
|
93
|
+
| `selectToday()` | method | Quick filter: today |
|
|
94
|
+
| `selectYesterday()` | method | Quick filter: yesterday |
|
|
95
|
+
| `selectLastSevenDays()` | method | Quick filter: last 7 days |
|
|
96
|
+
| `selectLastThirtyDays()` | method | Quick filter: last 30 days |
|
|
97
|
+
| `selectThisMonth()` | method | Quick filter: this month |
|
|
98
|
+
| `selectLastMonth()` | method | Quick filter: last month |
|
|
99
|
+
| `isInRange(day)` | method | Check if day is in selected range |
|
|
100
|
+
| `isSelectionStart(day)` | method | Check if day is range start |
|
|
101
|
+
| `isSelectionEnd(day)` | method | Check if day is range end |
|
|
102
|
+
| `applyDates()` | method | Emits apply with current state |
|
|
103
|
+
| `dismissPage()` | method | Emits dismiss and unsubscribes |
|
|
104
|
+
|
|
105
|
+
### Extending
|
|
106
|
+
|
|
107
|
+
```typescript
|
|
108
|
+
import { Component, forwardRef, ViewEncapsulation } from '@angular/core';
|
|
109
|
+
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
110
|
+
import { DateRangeBaseComponent } from '@smartsoft001/angular';
|
|
111
|
+
import { MyDateRangeModalComponent } from './my-modal.component';
|
|
112
|
+
|
|
113
|
+
@Component({
|
|
114
|
+
selector: 'my-date-range',
|
|
115
|
+
templateUrl: './my-date-range.component.html',
|
|
116
|
+
encapsulation: ViewEncapsulation.None,
|
|
117
|
+
imports: [MyDateRangeModalComponent],
|
|
118
|
+
providers: [
|
|
119
|
+
{
|
|
120
|
+
provide: NG_VALUE_ACCESSOR,
|
|
121
|
+
useExisting: forwardRef(() => MyDateRangeComponent),
|
|
122
|
+
multi: true,
|
|
123
|
+
},
|
|
124
|
+
],
|
|
125
|
+
})
|
|
126
|
+
export class MyDateRangeComponent extends DateRangeBaseComponent {}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## File Locations
|
|
130
|
+
|
|
131
|
+
- Base class: `packages/shared/angular/src/lib/components/date-range/base/date-range-base.component.ts`
|
|
132
|
+
- Modal base: `packages/shared/angular/src/lib/components/date-range/base/date-range-modal-base.component.ts`
|
|
133
|
+
- Default component: `packages/shared/angular/src/lib/components/date-range/default/date-range-default.component.ts`
|
|
134
|
+
- Default template: `packages/shared/angular/src/lib/components/date-range/default/date-range-default.component.html`
|
|
135
|
+
- Default modal: `packages/shared/angular/src/lib/components/date-range/default/date-range-modal-default.component.ts`
|
|
136
|
+
- Tests: `packages/shared/angular/src/lib/components/date-range/date-range.component.spec.ts`
|
|
137
|
+
- Stories: `packages/shared/angular/src/lib/components/date-range/date-range.component.stories.ts`
|
|
138
|
+
- Calendar service: `packages/shared/angular/src/lib/services/calendar/calendar.service.ts`
|
|
139
|
+
|
|
140
|
+
## Dependencies
|
|
141
|
+
|
|
142
|
+
- `@smartsoft001/domain-core` — `IDateRange` interface
|
|
143
|
+
- `@ngx-translate/core` — `TranslatePipe` for i18n
|
|
144
|
+
- `moment` — date operations
|
|
145
|
+
- `CalendarService` — calendar month generation
|
|
146
|
+
|
|
147
|
+
## Tailwind Classes
|
|
148
|
+
|
|
149
|
+
All classes use `smart:` prefix. Trigger: `smart:inline-flex smart:rounded-md smart:border smart:border-gray-300`. Modal backdrop: `smart:fixed smart:inset-0 smart:bg-black/50`. Calendar selection: `smart:bg-indigo-600 smart:text-white`.
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: angular-components-description-list
|
|
3
|
+
description: Description list component API with InjectionToken pattern for custom implementations.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Description List Component
|
|
8
|
+
|
|
9
|
+
The `<smart-description-list>` component renders a list of label/value pairs (a `<dl>` with `<dt>`/`<dd>` rows) with optional title, description, per-item value/action template slots, and bottom attachments/footer slots. It follows the Base + Standard + Wrapper pattern with an InjectionToken-based extension mechanism. The abstract `DescriptionListBaseComponent` defines the shared API — optional `IDescriptionListOptions` and `cssClass` (alias `class`). `DescriptionListStandardComponent` is a barebones placeholder concrete implementation. `DescriptionListComponent` is the public wrapper that renders `DescriptionListStandardComponent` by default and accepts a custom replacement via `DESCRIPTION_LIST_STANDARD_COMPONENT_TOKEN`.
|
|
10
|
+
|
|
11
|
+
## When to Use This Skill
|
|
12
|
+
|
|
13
|
+
- Developer wants to use or customize the description list component
|
|
14
|
+
- Developer asks about `<smart-description-list>`, `DescriptionListComponent`, `DescriptionListStandardComponent`, or `DescriptionListBaseComponent`
|
|
15
|
+
|
|
16
|
+
## Components
|
|
17
|
+
|
|
18
|
+
### DescriptionListComponent (`<smart-description-list>`)
|
|
19
|
+
|
|
20
|
+
Main wrapper component. Renders `DescriptionListStandardComponent` by default. When `DESCRIPTION_LIST_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet`.
|
|
21
|
+
|
|
22
|
+
### DescriptionListStandardComponent (`<smart-description-list-standard>`)
|
|
23
|
+
|
|
24
|
+
Barebones placeholder concrete implementation. Renders a wrapper `<div>` containing an optional `<h3 class="title">`, optional `<p class="description">`, and a `<dl>` with one `<div class="item">` per item. Each item renders a `<dt>` (label) and a `<dd>` whose content is either the static `value` string or the `valueTpl` template, optionally followed by `actionTpl` inside `<span class="action">`. Bottom slots `attachmentsTpl` and `footerTpl` render in `<div class="attachments">` and `<div class="footer">` respectively. The external `cssClass` is applied to the root wrapper. It does not include any visual styling — it exists solely as the default structural placeholder until a custom implementation is registered through the token.
|
|
25
|
+
|
|
26
|
+
### DescriptionListBaseComponent (abstract)
|
|
27
|
+
|
|
28
|
+
Abstract base directive for extending custom description-list implementations. Exposes `options` as an `InputSignal<IDescriptionListOptions | undefined>` and `cssClass` as an `InputSignal<string>` (with alias `class`).
|
|
29
|
+
|
|
30
|
+
## API
|
|
31
|
+
|
|
32
|
+
### Inputs
|
|
33
|
+
|
|
34
|
+
| Input | Type | Default | Description |
|
|
35
|
+
| --------- | --------------------------------------------------- | ------- | ------------------------------------------------------------------------------------- |
|
|
36
|
+
| `options` | `InputSignal<IDescriptionListOptions \| undefined>` | - | Optional configuration (title, description, items, attachments/footer slot templates) |
|
|
37
|
+
| `class` | `InputSignal<string>` | `''` | External CSS classes (alias for `cssClass`) |
|
|
38
|
+
|
|
39
|
+
### IDescriptionListOptions
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
interface IDescriptionListOptions {
|
|
43
|
+
title?: string;
|
|
44
|
+
description?: string;
|
|
45
|
+
items?: IDescriptionListItem[];
|
|
46
|
+
attachmentsTpl?: TemplateRef<unknown>;
|
|
47
|
+
footerTpl?: TemplateRef<unknown>;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
interface IDescriptionListItem {
|
|
51
|
+
label: string;
|
|
52
|
+
value?: string;
|
|
53
|
+
valueTpl?: TemplateRef<unknown>;
|
|
54
|
+
actionTpl?: TemplateRef<unknown>;
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
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
|
+
## DESCRIPTION_LIST_STANDARD_COMPONENT_TOKEN
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
import { DESCRIPTION_LIST_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
InjectionToken that allows replacing the default `DescriptionListStandardComponent` with a custom implementation. Provide a `Type<DescriptionListBaseComponent>` to override.
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
providers: [
|
|
70
|
+
{
|
|
71
|
+
provide: DESCRIPTION_LIST_STANDARD_COMPONENT_TOKEN,
|
|
72
|
+
useValue: MyCustomDescriptionListComponent,
|
|
73
|
+
},
|
|
74
|
+
];
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Extending the Base Class
|
|
78
|
+
|
|
79
|
+
```typescript
|
|
80
|
+
import {
|
|
81
|
+
ChangeDetectionStrategy,
|
|
82
|
+
Component,
|
|
83
|
+
computed,
|
|
84
|
+
input,
|
|
85
|
+
ViewEncapsulation,
|
|
86
|
+
} from '@angular/core';
|
|
87
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
88
|
+
|
|
89
|
+
import { DescriptionListBaseComponent } from '@smartsoft001/angular';
|
|
90
|
+
|
|
91
|
+
@Component({
|
|
92
|
+
selector: 'my-custom-description-list',
|
|
93
|
+
template: `
|
|
94
|
+
<div [class]="containerClasses()">
|
|
95
|
+
@if (options()?.title) {
|
|
96
|
+
<h3>{{ options()!.title }}</h3>
|
|
97
|
+
}
|
|
98
|
+
<dl>
|
|
99
|
+
@for (item of options()?.items ?? []; track $index) {
|
|
100
|
+
<div>
|
|
101
|
+
<dt>{{ item.label }}</dt>
|
|
102
|
+
<dd>
|
|
103
|
+
@if (item.valueTpl) {
|
|
104
|
+
<ng-container [ngTemplateOutlet]="item.valueTpl" />
|
|
105
|
+
} @else {
|
|
106
|
+
{{ item.value }}
|
|
107
|
+
}
|
|
108
|
+
</dd>
|
|
109
|
+
</div>
|
|
110
|
+
}
|
|
111
|
+
</dl>
|
|
112
|
+
</div>
|
|
113
|
+
`,
|
|
114
|
+
imports: [NgTemplateOutlet],
|
|
115
|
+
encapsulation: ViewEncapsulation.None,
|
|
116
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
117
|
+
})
|
|
118
|
+
export class MyCustomDescriptionListComponent extends DescriptionListBaseComponent {
|
|
119
|
+
// NgComponentOutlet passes 'cssClass' by canonical name, not the 'class' alias.
|
|
120
|
+
override cssClass = input<string>('');
|
|
121
|
+
|
|
122
|
+
containerClasses = computed(() => {
|
|
123
|
+
const classes = ['my-description-list'];
|
|
124
|
+
const extra = this.cssClass();
|
|
125
|
+
if (extra) classes.push(extra);
|
|
126
|
+
return classes.join(' ');
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Usage Examples
|
|
132
|
+
|
|
133
|
+
```html
|
|
134
|
+
<!-- Title and items only -->
|
|
135
|
+
<smart-description-list
|
|
136
|
+
[options]="{
|
|
137
|
+
title: 'Applicant Information',
|
|
138
|
+
items: [
|
|
139
|
+
{ label: 'Full name', value: 'Margot Foster' },
|
|
140
|
+
{ label: 'Application for', value: 'Backend Developer' },
|
|
141
|
+
{ label: 'Email address', value: 'margotfoster@example.com' },
|
|
142
|
+
],
|
|
143
|
+
}"
|
|
144
|
+
/>
|
|
145
|
+
|
|
146
|
+
<!-- With description and templated value -->
|
|
147
|
+
<ng-template #salaryValue>
|
|
148
|
+
<strong>$120,000</strong>
|
|
149
|
+
</ng-template>
|
|
150
|
+
|
|
151
|
+
<smart-description-list
|
|
152
|
+
[options]="{
|
|
153
|
+
title: 'Applicant Information',
|
|
154
|
+
description: 'Personal details and application.',
|
|
155
|
+
items: [
|
|
156
|
+
{ label: 'Full name', value: 'Margot Foster' },
|
|
157
|
+
{ label: 'Salary expectation', valueTpl: salaryValue },
|
|
158
|
+
],
|
|
159
|
+
}"
|
|
160
|
+
/>
|
|
161
|
+
|
|
162
|
+
<!-- With per-item actions -->
|
|
163
|
+
<ng-template #updateAction>
|
|
164
|
+
<button>Update</button>
|
|
165
|
+
</ng-template>
|
|
166
|
+
|
|
167
|
+
<smart-description-list
|
|
168
|
+
[options]="{
|
|
169
|
+
title: 'Applicant Information',
|
|
170
|
+
items: [
|
|
171
|
+
{ label: 'Full name', value: 'Margot Foster', actionTpl: updateAction },
|
|
172
|
+
{ label: 'Email address', value: 'margotfoster@example.com', actionTpl: updateAction },
|
|
173
|
+
],
|
|
174
|
+
}"
|
|
175
|
+
/>
|
|
176
|
+
|
|
177
|
+
<!-- With attachments and footer slots -->
|
|
178
|
+
<ng-template #attachments>
|
|
179
|
+
<ul>
|
|
180
|
+
<li>resume.pdf</li>
|
|
181
|
+
<li>coverletter.pdf</li>
|
|
182
|
+
</ul>
|
|
183
|
+
</ng-template>
|
|
184
|
+
|
|
185
|
+
<ng-template #footer>
|
|
186
|
+
<a href="#">Download all →</a>
|
|
187
|
+
</ng-template>
|
|
188
|
+
|
|
189
|
+
<smart-description-list
|
|
190
|
+
[options]="{
|
|
191
|
+
title: 'Applicant Information',
|
|
192
|
+
items: [{ label: 'Full name', value: 'Margot Foster' }],
|
|
193
|
+
attachmentsTpl: attachments,
|
|
194
|
+
footerTpl: footer,
|
|
195
|
+
}"
|
|
196
|
+
/>
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
## File Locations
|
|
200
|
+
|
|
201
|
+
- Wrapper: `packages/shared/angular/src/lib/components/description-list/description-list.component.ts`
|
|
202
|
+
- Standard: `packages/shared/angular/src/lib/components/description-list/standard/standard.component.ts`
|
|
203
|
+
- Base class: `packages/shared/angular/src/lib/components/description-list/base/base.component.ts`
|
|
204
|
+
- Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`DESCRIPTION_LIST_STANDARD_COMPONENT_TOKEN`)
|
|
205
|
+
- Interfaces: `packages/shared/angular/src/lib/models/interfaces.ts` (`IDescriptionListOptions`, `IDescriptionListItem`)
|