@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,213 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: angular-components-stacked-list
|
|
3
|
+
description: Stacked list component API with InjectionToken pattern for custom implementations.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Stacked List Component
|
|
8
|
+
|
|
9
|
+
The `<smart-stacked-list>` component renders a vertical list of records with optional title, description, per-item icon/avatar, link, badge, action template, and bottom footer slot. It follows the Base + Standard + Wrapper pattern with an InjectionToken-based extension mechanism. The abstract `StackedListBaseComponent` defines the shared API — optional `IStackedListOptions` and `cssClass` (alias `class`). `StackedListStandardComponent` is a barebones placeholder concrete implementation. `StackedListComponent` is the public wrapper that renders `StackedListStandardComponent` by default and accepts a custom replacement via `STACKED_LIST_STANDARD_COMPONENT_TOKEN`.
|
|
10
|
+
|
|
11
|
+
## When to Use This Skill
|
|
12
|
+
|
|
13
|
+
- Developer wants to use or customize the stacked list component
|
|
14
|
+
- Developer asks about `<smart-stacked-list>`, `StackedListComponent`, `StackedListStandardComponent`, or `StackedListBaseComponent`
|
|
15
|
+
|
|
16
|
+
## Components
|
|
17
|
+
|
|
18
|
+
### StackedListComponent (`<smart-stacked-list>`)
|
|
19
|
+
|
|
20
|
+
Main wrapper component. Renders `StackedListStandardComponent` by default. When `STACKED_LIST_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet`.
|
|
21
|
+
|
|
22
|
+
### StackedListStandardComponent (`<smart-stacked-list-standard>`)
|
|
23
|
+
|
|
24
|
+
Barebones placeholder concrete implementation. Renders a wrapper `<div>` containing an optional `<h3 class="title">`, optional `<p class="description">`, and a `<ul role="list">` with one `<li class="item">` per item. Each item renders the icon/avatar (icon template wins over avatar URL), a body group with the title (rendered as `<a class="title">` if `href` is provided, otherwise `<span class="title">`) and optional description/meta, and optional badge/action template slots. When the item list is empty, the optional `emptyTpl` is rendered inside `<div class="empty">`. A bottom `footerTpl` renders inside `<div class="footer">`. 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
|
+
### StackedListBaseComponent (abstract)
|
|
27
|
+
|
|
28
|
+
Abstract base directive for extending custom stacked-list implementations. Exposes `options` as an `InputSignal<IStackedListOptions | 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<IStackedListOptions \| undefined>` | - | Optional configuration (title, description, items, layout flags, empty/footer slots) |
|
|
37
|
+
| `class` | `InputSignal<string>` | `''` | External CSS classes (alias for `cssClass`) |
|
|
38
|
+
|
|
39
|
+
### IStackedListOptions
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
interface IStackedListOptions {
|
|
43
|
+
title?: string;
|
|
44
|
+
description?: string;
|
|
45
|
+
items?: IStackedListItem[];
|
|
46
|
+
withDividers?: boolean;
|
|
47
|
+
fullWidthOnMobile?: boolean;
|
|
48
|
+
emptyTpl?: TemplateRef<unknown>;
|
|
49
|
+
footerTpl?: TemplateRef<unknown>;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
interface IStackedListItem {
|
|
53
|
+
id?: string;
|
|
54
|
+
title: string;
|
|
55
|
+
description?: string;
|
|
56
|
+
meta?: string;
|
|
57
|
+
avatarUrl?: string;
|
|
58
|
+
iconTpl?: TemplateRef<unknown>;
|
|
59
|
+
href?: string;
|
|
60
|
+
badgeTpl?: TemplateRef<unknown>;
|
|
61
|
+
actionTpl?: TemplateRef<unknown>;
|
|
62
|
+
ariaLabel?: string;
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
All properties are optional except `IStackedListItem.title`. The default `StackedListStandardComponent` consumes every property; a section is rendered only when its template/string is provided. Within an item, `iconTpl` wins over `avatarUrl` when both are set.
|
|
67
|
+
|
|
68
|
+
## STACKED_LIST_STANDARD_COMPONENT_TOKEN
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
import { STACKED_LIST_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
InjectionToken that allows replacing the default `StackedListStandardComponent` with a custom implementation. Provide a `Type<StackedListBaseComponent>` to override.
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
providers: [
|
|
78
|
+
{
|
|
79
|
+
provide: STACKED_LIST_STANDARD_COMPONENT_TOKEN,
|
|
80
|
+
useValue: MyCustomStackedListComponent,
|
|
81
|
+
},
|
|
82
|
+
];
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Extending the Base Class
|
|
86
|
+
|
|
87
|
+
```typescript
|
|
88
|
+
import {
|
|
89
|
+
ChangeDetectionStrategy,
|
|
90
|
+
Component,
|
|
91
|
+
computed,
|
|
92
|
+
input,
|
|
93
|
+
ViewEncapsulation,
|
|
94
|
+
} from '@angular/core';
|
|
95
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
96
|
+
|
|
97
|
+
import { StackedListBaseComponent } from '@smartsoft001/angular';
|
|
98
|
+
|
|
99
|
+
@Component({
|
|
100
|
+
selector: 'my-custom-stacked-list',
|
|
101
|
+
template: `
|
|
102
|
+
<div [class]="containerClasses()">
|
|
103
|
+
@if (options()?.title) {
|
|
104
|
+
<h3>{{ options()!.title }}</h3>
|
|
105
|
+
}
|
|
106
|
+
<ul>
|
|
107
|
+
@for (item of options()?.items ?? []; track item.id ?? $index) {
|
|
108
|
+
<li>
|
|
109
|
+
@if (item.href) {
|
|
110
|
+
<a [attr.href]="item.href">{{ item.title }}</a>
|
|
111
|
+
} @else {
|
|
112
|
+
<span>{{ item.title }}</span>
|
|
113
|
+
}
|
|
114
|
+
@if (item.description) {
|
|
115
|
+
<p>{{ item.description }}</p>
|
|
116
|
+
}
|
|
117
|
+
</li>
|
|
118
|
+
}
|
|
119
|
+
</ul>
|
|
120
|
+
</div>
|
|
121
|
+
`,
|
|
122
|
+
imports: [NgTemplateOutlet],
|
|
123
|
+
encapsulation: ViewEncapsulation.None,
|
|
124
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
125
|
+
})
|
|
126
|
+
export class MyCustomStackedListComponent extends StackedListBaseComponent {
|
|
127
|
+
// NgComponentOutlet passes 'cssClass' by canonical name, not the 'class' alias.
|
|
128
|
+
override cssClass = input<string>('');
|
|
129
|
+
|
|
130
|
+
containerClasses = computed(() => {
|
|
131
|
+
const classes = ['my-stacked-list'];
|
|
132
|
+
const extra = this.cssClass();
|
|
133
|
+
if (extra) classes.push(extra);
|
|
134
|
+
return classes.join(' ');
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Usage Examples
|
|
140
|
+
|
|
141
|
+
```html
|
|
142
|
+
<!-- Title and items only -->
|
|
143
|
+
<smart-stacked-list
|
|
144
|
+
[options]="{
|
|
145
|
+
title: 'Team members',
|
|
146
|
+
items: [
|
|
147
|
+
{ id: '1', title: 'Lindsay Walton', description: 'Front-end Developer' },
|
|
148
|
+
{ id: '2', title: 'Courtney Henry', description: 'Designer' },
|
|
149
|
+
{ id: '3', title: 'Tom Cook', description: 'Director, Product' },
|
|
150
|
+
],
|
|
151
|
+
}"
|
|
152
|
+
/>
|
|
153
|
+
|
|
154
|
+
<!-- With description and links -->
|
|
155
|
+
<smart-stacked-list
|
|
156
|
+
[options]="{
|
|
157
|
+
title: 'Recent files',
|
|
158
|
+
description: 'Files updated in the last week.',
|
|
159
|
+
items: [
|
|
160
|
+
{ title: 'Annual report 2025.pdf', href: '/files/annual-report' },
|
|
161
|
+
{ title: 'Brand guidelines.pdf', href: '/files/brand-guidelines' },
|
|
162
|
+
],
|
|
163
|
+
}"
|
|
164
|
+
/>
|
|
165
|
+
|
|
166
|
+
<!-- With avatars, meta and badges -->
|
|
167
|
+
<ng-template #activeBadge>
|
|
168
|
+
<span class="badge-active">Active</span>
|
|
169
|
+
</ng-template>
|
|
170
|
+
|
|
171
|
+
<smart-stacked-list
|
|
172
|
+
[options]="{
|
|
173
|
+
title: 'Team members',
|
|
174
|
+
items: [
|
|
175
|
+
{
|
|
176
|
+
title: 'Lindsay Walton',
|
|
177
|
+
description: 'Front-end Developer',
|
|
178
|
+
meta: 'Joined 2026-01-12',
|
|
179
|
+
avatarUrl: '/img/lindsay.jpg',
|
|
180
|
+
badgeTpl: activeBadge,
|
|
181
|
+
},
|
|
182
|
+
],
|
|
183
|
+
}"
|
|
184
|
+
/>
|
|
185
|
+
|
|
186
|
+
<!-- With per-item action and footer -->
|
|
187
|
+
<ng-template #removeAction>
|
|
188
|
+
<button>Remove</button>
|
|
189
|
+
</ng-template>
|
|
190
|
+
|
|
191
|
+
<ng-template #footer>
|
|
192
|
+
<a href="#">Load more →</a>
|
|
193
|
+
</ng-template>
|
|
194
|
+
|
|
195
|
+
<smart-stacked-list
|
|
196
|
+
[options]="{
|
|
197
|
+
title: 'Team members',
|
|
198
|
+
items: [
|
|
199
|
+
{ title: 'Lindsay Walton', actionTpl: removeAction },
|
|
200
|
+
{ title: 'Courtney Henry', actionTpl: removeAction },
|
|
201
|
+
],
|
|
202
|
+
footerTpl: footer,
|
|
203
|
+
}"
|
|
204
|
+
/>
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
## File Locations
|
|
208
|
+
|
|
209
|
+
- Wrapper: `packages/shared/angular/src/lib/components/stacked-list/stacked-list.component.ts`
|
|
210
|
+
- Standard: `packages/shared/angular/src/lib/components/stacked-list/standard/standard.component.ts`
|
|
211
|
+
- Base class: `packages/shared/angular/src/lib/components/stacked-list/base/base.component.ts`
|
|
212
|
+
- Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`STACKED_LIST_STANDARD_COMPONENT_TOKEN`)
|
|
213
|
+
- Interfaces: `packages/shared/angular/src/lib/models/interfaces.ts` (`IStackedListOptions`, `IStackedListItem`)
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: angular-components-stats
|
|
3
|
+
description: Stats component API with InjectionToken pattern for custom implementations.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Stats Component
|
|
8
|
+
|
|
9
|
+
The `<smart-stats>` component renders a list of statistic cards (label/value pairs with optional previous value, change indicator, trend, icon, and action slot). It follows the Base + Standard + Wrapper pattern with an InjectionToken-based extension mechanism. The abstract `StatsBaseComponent` defines the shared API — optional `IStatsOptions` and `cssClass` (alias `class`). `StatsStandardComponent` is a barebones placeholder concrete implementation. `StatsComponent` is the public wrapper that renders `StatsStandardComponent` by default and accepts a custom replacement via `STATS_STANDARD_COMPONENT_TOKEN`.
|
|
10
|
+
|
|
11
|
+
## When to Use This Skill
|
|
12
|
+
|
|
13
|
+
- Developer wants to use or customize the stats component
|
|
14
|
+
- Developer asks about `<smart-stats>`, `StatsComponent`, `StatsStandardComponent`, or `StatsBaseComponent`
|
|
15
|
+
|
|
16
|
+
## Components
|
|
17
|
+
|
|
18
|
+
### StatsComponent (`<smart-stats>`)
|
|
19
|
+
|
|
20
|
+
Main wrapper component. Renders `StatsStandardComponent` by default. When `STATS_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet`.
|
|
21
|
+
|
|
22
|
+
### StatsStandardComponent (`<smart-stats-standard>`)
|
|
23
|
+
|
|
24
|
+
Barebones placeholder concrete implementation. Renders a wrapper `<div>` containing an optional `<h3 class="title">` and a `<dl>` with one `<div class="item">` per item. Each item renders an optional icon (`iconTpl` in `<div class="icon">`), label (`<dt class="label">`), value (`<dd class="value">`), optional previous value (`<dd class="previous">`), optional change with `data-trend` attribute (`<dd class="change">`), and optional action template (`actionTpl` in `<div class="action">`). 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
|
+
### StatsBaseComponent (abstract)
|
|
27
|
+
|
|
28
|
+
Abstract base directive for extending custom stats implementations. Exposes `options` as an `InputSignal<IStatsOptions | 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<IStatsOptions \| undefined>` | - | Optional configuration (title, items, columns) |
|
|
37
|
+
| `class` | `InputSignal<string>` | `''` | External CSS classes (alias for `cssClass`) |
|
|
38
|
+
|
|
39
|
+
### IStatsOptions
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
interface IStatsOptions {
|
|
43
|
+
title?: string;
|
|
44
|
+
items: IStatItem[];
|
|
45
|
+
columns?: 1 | 2 | 3 | 4;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
interface IStatItem {
|
|
49
|
+
label: string;
|
|
50
|
+
value: string | number;
|
|
51
|
+
previousValue?: string | number;
|
|
52
|
+
change?: string;
|
|
53
|
+
trend?: 'up' | 'down' | 'neutral';
|
|
54
|
+
iconTpl?: TemplateRef<unknown>;
|
|
55
|
+
actionTpl?: TemplateRef<unknown>;
|
|
56
|
+
ariaLabel?: string;
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
`items` is required. The default `StatsStandardComponent` consumes every property; a section is rendered only when its template/string is provided. The `trend` value is exposed via the `data-trend` attribute on `<dd class="change">` for downstream styling. `columns` is a hint for custom implementations to lay out the grid; the default placeholder ignores it.
|
|
61
|
+
|
|
62
|
+
## STATS_STANDARD_COMPONENT_TOKEN
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
import { STATS_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
InjectionToken that allows replacing the default `StatsStandardComponent` with a custom implementation. Provide a `Type<StatsBaseComponent>` to override.
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
providers: [
|
|
72
|
+
{
|
|
73
|
+
provide: STATS_STANDARD_COMPONENT_TOKEN,
|
|
74
|
+
useValue: MyCustomStatsComponent,
|
|
75
|
+
},
|
|
76
|
+
];
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Extending the Base Class
|
|
80
|
+
|
|
81
|
+
```typescript
|
|
82
|
+
import {
|
|
83
|
+
ChangeDetectionStrategy,
|
|
84
|
+
Component,
|
|
85
|
+
computed,
|
|
86
|
+
input,
|
|
87
|
+
ViewEncapsulation,
|
|
88
|
+
} from '@angular/core';
|
|
89
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
90
|
+
|
|
91
|
+
import { StatsBaseComponent } from '@smartsoft001/angular';
|
|
92
|
+
|
|
93
|
+
@Component({
|
|
94
|
+
selector: 'my-custom-stats',
|
|
95
|
+
template: `
|
|
96
|
+
<div [class]="containerClasses()">
|
|
97
|
+
@if (options()?.title) {
|
|
98
|
+
<h3>{{ options()!.title }}</h3>
|
|
99
|
+
}
|
|
100
|
+
<dl>
|
|
101
|
+
@for (item of options()?.items ?? []; track $index) {
|
|
102
|
+
<div>
|
|
103
|
+
<dt>{{ item.label }}</dt>
|
|
104
|
+
<dd>{{ item.value }}</dd>
|
|
105
|
+
@if (item.change) {
|
|
106
|
+
<dd>{{ item.change }}</dd>
|
|
107
|
+
}
|
|
108
|
+
</div>
|
|
109
|
+
}
|
|
110
|
+
</dl>
|
|
111
|
+
</div>
|
|
112
|
+
`,
|
|
113
|
+
imports: [NgTemplateOutlet],
|
|
114
|
+
encapsulation: ViewEncapsulation.None,
|
|
115
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
116
|
+
})
|
|
117
|
+
export class MyCustomStatsComponent extends StatsBaseComponent {
|
|
118
|
+
// NgComponentOutlet passes 'cssClass' by canonical name, not the 'class' alias.
|
|
119
|
+
override cssClass = input<string>('');
|
|
120
|
+
|
|
121
|
+
containerClasses = computed(() => {
|
|
122
|
+
const classes = ['my-stats'];
|
|
123
|
+
const extra = this.cssClass();
|
|
124
|
+
if (extra) classes.push(extra);
|
|
125
|
+
return classes.join(' ');
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Usage Examples
|
|
131
|
+
|
|
132
|
+
```html
|
|
133
|
+
<!-- Simple stats -->
|
|
134
|
+
<smart-stats
|
|
135
|
+
[options]="{
|
|
136
|
+
items: [
|
|
137
|
+
{ label: 'Number of deploys', value: 405 },
|
|
138
|
+
{ label: 'Average deploy time', value: '3.65 mins' },
|
|
139
|
+
{ label: 'Number of servers', value: 3 },
|
|
140
|
+
{ label: 'Success rate', value: '98.5%' },
|
|
141
|
+
],
|
|
142
|
+
}"
|
|
143
|
+
/>
|
|
144
|
+
|
|
145
|
+
<!-- With title and trending changes -->
|
|
146
|
+
<smart-stats
|
|
147
|
+
[options]="{
|
|
148
|
+
title: 'Last 30 days',
|
|
149
|
+
items: [
|
|
150
|
+
{ label: 'Revenue', value: '$405,091', change: '+4.75%', trend: 'up' },
|
|
151
|
+
{ label: 'Overdue invoices', value: '$12,787', change: '+54.02%', trend: 'down' },
|
|
152
|
+
{ label: 'Outstanding invoices', value: '$245,988', change: '-1.39%', trend: 'neutral' },
|
|
153
|
+
],
|
|
154
|
+
}"
|
|
155
|
+
/>
|
|
156
|
+
|
|
157
|
+
<!-- With previous value -->
|
|
158
|
+
<smart-stats
|
|
159
|
+
[options]="{
|
|
160
|
+
title: 'Last 30 days',
|
|
161
|
+
items: [
|
|
162
|
+
{ label: 'Total Subscribers', value: '71,897', previousValue: '70,946', change: '+12%', trend: 'up' },
|
|
163
|
+
{ label: 'Avg. Open Rate', value: '58.16%', previousValue: '56.14%', change: '+2.02%', trend: 'up' },
|
|
164
|
+
],
|
|
165
|
+
}"
|
|
166
|
+
/>
|
|
167
|
+
|
|
168
|
+
<!-- With icon and action templates -->
|
|
169
|
+
<ng-template #subscribersIcon>
|
|
170
|
+
<svg viewBox="0 0 24 24"><!-- ... --></svg>
|
|
171
|
+
</ng-template>
|
|
172
|
+
|
|
173
|
+
<ng-template #viewAll>
|
|
174
|
+
<a href="/stats/subscribers">View all</a>
|
|
175
|
+
</ng-template>
|
|
176
|
+
|
|
177
|
+
<smart-stats
|
|
178
|
+
[options]="{
|
|
179
|
+
title: 'Last 30 days',
|
|
180
|
+
items: [
|
|
181
|
+
{
|
|
182
|
+
label: 'Total Subscribers',
|
|
183
|
+
value: '71,897',
|
|
184
|
+
change: '+122',
|
|
185
|
+
trend: 'up',
|
|
186
|
+
iconTpl: subscribersIcon,
|
|
187
|
+
actionTpl: viewAll,
|
|
188
|
+
},
|
|
189
|
+
],
|
|
190
|
+
}"
|
|
191
|
+
/>
|
|
192
|
+
|
|
193
|
+
<!-- With column hint -->
|
|
194
|
+
<smart-stats
|
|
195
|
+
[options]="{
|
|
196
|
+
title: 'Last 30 days',
|
|
197
|
+
columns: 3,
|
|
198
|
+
items: [
|
|
199
|
+
{ label: 'Total Subscribers', value: '71,897' },
|
|
200
|
+
{ label: 'Avg. Open Rate', value: '58.16%' },
|
|
201
|
+
{ label: 'Avg. Click Rate', value: '24.57%' },
|
|
202
|
+
],
|
|
203
|
+
}"
|
|
204
|
+
/>
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
## File Locations
|
|
208
|
+
|
|
209
|
+
- Wrapper: `packages/shared/angular/src/lib/components/stats/stats.component.ts`
|
|
210
|
+
- Standard: `packages/shared/angular/src/lib/components/stats/standard/standard.component.ts`
|
|
211
|
+
- Base class: `packages/shared/angular/src/lib/components/stats/base/base.component.ts`
|
|
212
|
+
- Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`STATS_STANDARD_COMPONENT_TOKEN`)
|
|
213
|
+
- Interfaces: `packages/shared/angular/src/lib/models/interfaces.ts` (`IStatsOptions`, `IStatItem`)
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: angular-components-table
|
|
3
|
+
description: Table component API with InjectionToken pattern for custom implementations.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Table Component
|
|
8
|
+
|
|
9
|
+
The `<smart-table>` component renders a tabular data view with optional title, description, toolbar slot, columns + rows, optional checkbox column, custom per-cell/per-header templates, an empty state slot, and a bottom footer slot. It follows the Base + Standard + Wrapper pattern with an InjectionToken-based extension mechanism. The abstract `TableBaseComponent` defines the shared API — optional `ITableOptions` and `cssClass` (alias `class`). `TableStandardComponent` is a barebones placeholder concrete implementation. `TableComponent` is the public wrapper that renders `TableStandardComponent` by default and accepts a custom replacement via `TABLE_STANDARD_COMPONENT_TOKEN`.
|
|
10
|
+
|
|
11
|
+
## When to Use This Skill
|
|
12
|
+
|
|
13
|
+
- Developer wants to use or customize the table component
|
|
14
|
+
- Developer asks about `<smart-table>`, `TableComponent`, `TableStandardComponent`, or `TableBaseComponent`
|
|
15
|
+
|
|
16
|
+
## Components
|
|
17
|
+
|
|
18
|
+
### TableComponent (`<smart-table>`)
|
|
19
|
+
|
|
20
|
+
Main wrapper component. Renders `TableStandardComponent` by default. When `TABLE_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet`.
|
|
21
|
+
|
|
22
|
+
### TableStandardComponent (`<smart-table-standard>`)
|
|
23
|
+
|
|
24
|
+
Barebones placeholder concrete implementation. Renders a wrapper `<div>` containing an optional `<h3 class="title">`, optional `<p class="description">`, optional toolbar slot, and a `<table>` with `<thead>` (one `<th>` per column) and `<tbody>` (one `<tr>` per row, one `<td>` per column reading the value via `row[col.key]`). When `withCheckboxes` is set, an extra checkbox column is rendered before all data columns. Per-column `cellTpl` and `headerTpl` templates override the default text rendering. When `rows` is empty and `emptyTpl` is provided, the empty template is rendered as a single full-width row. A bottom `footerTpl` renders inside `<div class="footer">`. 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
|
+
### TableBaseComponent (abstract)
|
|
27
|
+
|
|
28
|
+
Abstract base directive for extending custom table implementations. Exposes `options` as an `InputSignal<ITableOptions | 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<ITableOptions \| undefined>` | - | Optional configuration (title, description, columns, rows, layout flags, empty/footer slots) |
|
|
37
|
+
| `class` | `InputSignal<string>` | `''` | External CSS classes (alias for `cssClass`) |
|
|
38
|
+
|
|
39
|
+
### ITableOptions
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
interface ITableOptions {
|
|
43
|
+
title?: string;
|
|
44
|
+
description?: string;
|
|
45
|
+
columns?: ITableColumn[];
|
|
46
|
+
rows?: TableRow[];
|
|
47
|
+
striped?: boolean;
|
|
48
|
+
stickyHeader?: boolean;
|
|
49
|
+
withCheckboxes?: boolean;
|
|
50
|
+
withBorder?: boolean;
|
|
51
|
+
emptyTpl?: TemplateRef<unknown>;
|
|
52
|
+
footerTpl?: TemplateRef<unknown>;
|
|
53
|
+
toolbarTpl?: TemplateRef<unknown>;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
interface ITableColumn {
|
|
57
|
+
key: string;
|
|
58
|
+
label?: string;
|
|
59
|
+
align?: 'left' | 'center' | 'right';
|
|
60
|
+
sortable?: boolean;
|
|
61
|
+
cellTpl?: TemplateRef<unknown>;
|
|
62
|
+
headerTpl?: TemplateRef<unknown>;
|
|
63
|
+
ariaLabel?: string;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
type TableRow = Record<string, unknown>;
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
All properties are optional except `ITableColumn.key`. The default `TableStandardComponent` consumes every property; a section is rendered only when its template/string is provided. `striped`, `stickyHeader`, `withBorder` and `sortable` are hints for custom implementations — the standard placeholder ignores them visually but they remain part of the shared contract.
|
|
70
|
+
|
|
71
|
+
## TABLE_STANDARD_COMPONENT_TOKEN
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
import { TABLE_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
InjectionToken that allows replacing the default `TableStandardComponent` with a custom implementation. Provide a `Type<TableBaseComponent>` to override.
|
|
78
|
+
|
|
79
|
+
```typescript
|
|
80
|
+
providers: [
|
|
81
|
+
{
|
|
82
|
+
provide: TABLE_STANDARD_COMPONENT_TOKEN,
|
|
83
|
+
useValue: MyCustomTableComponent,
|
|
84
|
+
},
|
|
85
|
+
];
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Extending the Base Class
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
import {
|
|
92
|
+
ChangeDetectionStrategy,
|
|
93
|
+
Component,
|
|
94
|
+
computed,
|
|
95
|
+
input,
|
|
96
|
+
ViewEncapsulation,
|
|
97
|
+
} from '@angular/core';
|
|
98
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
99
|
+
|
|
100
|
+
import { TableBaseComponent } from '@smartsoft001/angular';
|
|
101
|
+
|
|
102
|
+
@Component({
|
|
103
|
+
selector: 'my-custom-table',
|
|
104
|
+
template: `
|
|
105
|
+
<div [class]="containerClasses()">
|
|
106
|
+
@if (options()?.title) {
|
|
107
|
+
<h3>{{ options()!.title }}</h3>
|
|
108
|
+
}
|
|
109
|
+
<table>
|
|
110
|
+
<thead>
|
|
111
|
+
<tr>
|
|
112
|
+
@for (col of options()?.columns ?? []; track col.key) {
|
|
113
|
+
<th>{{ col.label ?? col.key }}</th>
|
|
114
|
+
}
|
|
115
|
+
</tr>
|
|
116
|
+
</thead>
|
|
117
|
+
<tbody>
|
|
118
|
+
@for (row of options()?.rows ?? []; track $index) {
|
|
119
|
+
<tr>
|
|
120
|
+
@for (col of options()?.columns ?? []; track col.key) {
|
|
121
|
+
<td>{{ row[col.key] }}</td>
|
|
122
|
+
}
|
|
123
|
+
</tr>
|
|
124
|
+
}
|
|
125
|
+
</tbody>
|
|
126
|
+
</table>
|
|
127
|
+
</div>
|
|
128
|
+
`,
|
|
129
|
+
imports: [NgTemplateOutlet],
|
|
130
|
+
encapsulation: ViewEncapsulation.None,
|
|
131
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
132
|
+
})
|
|
133
|
+
export class MyCustomTableComponent extends TableBaseComponent {
|
|
134
|
+
// NgComponentOutlet passes 'cssClass' by canonical name, not the 'class' alias.
|
|
135
|
+
override cssClass = input<string>('');
|
|
136
|
+
|
|
137
|
+
containerClasses = computed(() => {
|
|
138
|
+
const classes = ['my-table'];
|
|
139
|
+
const extra = this.cssClass();
|
|
140
|
+
if (extra) classes.push(extra);
|
|
141
|
+
return classes.join(' ');
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Usage Examples
|
|
147
|
+
|
|
148
|
+
```html
|
|
149
|
+
<!-- Simple columns + rows -->
|
|
150
|
+
<smart-table
|
|
151
|
+
[options]="{
|
|
152
|
+
title: 'Users',
|
|
153
|
+
columns: [
|
|
154
|
+
{ key: 'name', label: 'Name' },
|
|
155
|
+
{ key: 'role', label: 'Role' },
|
|
156
|
+
{ key: 'email', label: 'Email' },
|
|
157
|
+
],
|
|
158
|
+
rows: [
|
|
159
|
+
{ name: 'Lindsay Walton', role: 'Front-end', email: 'lindsay@x.com' },
|
|
160
|
+
{ name: 'Courtney Henry', role: 'Designer', email: 'courtney@x.com' },
|
|
161
|
+
],
|
|
162
|
+
}"
|
|
163
|
+
/>
|
|
164
|
+
|
|
165
|
+
<!-- With checkbox column -->
|
|
166
|
+
<smart-table
|
|
167
|
+
[options]="{
|
|
168
|
+
columns: [
|
|
169
|
+
{ key: 'name', label: 'Name' },
|
|
170
|
+
{ key: 'role', label: 'Role' },
|
|
171
|
+
],
|
|
172
|
+
rows: [{ name: 'Lindsay Walton', role: 'Front-end' }],
|
|
173
|
+
withCheckboxes: true,
|
|
174
|
+
}"
|
|
175
|
+
/>
|
|
176
|
+
|
|
177
|
+
<!-- With per-cell template -->
|
|
178
|
+
<ng-template #emailCell let-row>
|
|
179
|
+
<a [attr.href]="'mailto:' + row.email">{{ row.email }}</a>
|
|
180
|
+
</ng-template>
|
|
181
|
+
|
|
182
|
+
<smart-table
|
|
183
|
+
[options]="{
|
|
184
|
+
columns: [
|
|
185
|
+
{ key: 'name', label: 'Name' },
|
|
186
|
+
{ key: 'email', label: 'Email', cellTpl: emailCell },
|
|
187
|
+
],
|
|
188
|
+
rows: [{ name: 'Lindsay Walton', email: 'lindsay@x.com' }],
|
|
189
|
+
}"
|
|
190
|
+
/>
|
|
191
|
+
|
|
192
|
+
<!-- With empty state and footer -->
|
|
193
|
+
<ng-template #emptyMsg>
|
|
194
|
+
<span>Brak wyników</span>
|
|
195
|
+
</ng-template>
|
|
196
|
+
<ng-template #footer>
|
|
197
|
+
<a href="#">Load more →</a>
|
|
198
|
+
</ng-template>
|
|
199
|
+
|
|
200
|
+
<smart-table
|
|
201
|
+
[options]="{
|
|
202
|
+
columns: [{ key: 'name', label: 'Name' }],
|
|
203
|
+
rows: [],
|
|
204
|
+
emptyTpl: emptyMsg,
|
|
205
|
+
footerTpl: footer,
|
|
206
|
+
}"
|
|
207
|
+
/>
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
## File Locations
|
|
211
|
+
|
|
212
|
+
- Wrapper: `packages/shared/angular/src/lib/components/table/table.component.ts`
|
|
213
|
+
- Standard: `packages/shared/angular/src/lib/components/table/standard/standard.component.ts`
|
|
214
|
+
- Base class: `packages/shared/angular/src/lib/components/table/base/base.component.ts`
|
|
215
|
+
- Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`TABLE_STANDARD_COMPONENT_TOKEN`)
|
|
216
|
+
- Interfaces: `packages/shared/angular/src/lib/models/interfaces.ts` (`ITableOptions`, `ITableColumn`, `TableRow`)
|