@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,196 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: angular-components-input
|
|
3
|
+
description: Input field component with InjectionToken pattern for per-FieldType substitution.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Input Component
|
|
8
|
+
|
|
9
|
+
The `<smart-input>` component renders a form input for a single model field by delegating to a sub-component chosen by `FieldType`. It selects a sub-component based on the `FieldType` resolved from `@Field()` decorator metadata via an internal `baseMap` and an optional `extendMap` injected via `INPUT_FIELD_COMPONENTS_TOKEN`. Shows error messages via `<smart-input-error>` when the control is touched and invalid.
|
|
10
|
+
|
|
11
|
+
## When to Use This Skill
|
|
12
|
+
|
|
13
|
+
- Developer wants to use or customize the input field component
|
|
14
|
+
- Developer asks about `<smart-input>` or `InputComponent`
|
|
15
|
+
- Developer wants to extend `InputBaseComponent` for a custom sub-component
|
|
16
|
+
|
|
17
|
+
## Components
|
|
18
|
+
|
|
19
|
+
### InputComponent (`<smart-input>`)
|
|
20
|
+
|
|
21
|
+
Main wrapper component. Resolves `fieldOptions` from `@Field()` decorator metadata on the model, then selects a sub-component from `baseMap` (or `extendMap` override) based on `fieldOptions.type` and renders it via `NgComponentOutlet`. Also renders an inline info button when `fieldOptions.info` is set and a loader while `control.status === 'PENDING'`. Below the input, renders `<smart-input-error>` when `control.errors` are present and the control has been touched.
|
|
22
|
+
|
|
23
|
+
### InputBaseComponent (abstract)
|
|
24
|
+
|
|
25
|
+
Abstract base directive for all input sub-components. Provides:
|
|
26
|
+
|
|
27
|
+
- `options: InputSignal<InputOptions<T>>` — field configuration (control, fieldKey, model, treeLevel, possibilities, component)
|
|
28
|
+
- `fieldOptions: InputSignal<IFieldOptions | undefined>` — resolved field decorator metadata
|
|
29
|
+
- `cssClass: InputSignal<string>` (alias `class`) — external CSS classes
|
|
30
|
+
- `internalOptions`, `control`, `required`, `possibilities` — populated via `effect` when options change
|
|
31
|
+
- `afterSetOptionsHandler()` — hook invoked after options resolve, used by sub-components for validator/possibilities setup
|
|
32
|
+
- `formControl`, `formControlArray`, `formControlGroup` — typed accessors for `control`
|
|
33
|
+
|
|
34
|
+
### InputPossibilitiesBaseComponent (abstract)
|
|
35
|
+
|
|
36
|
+
Extends `InputBaseComponent` for sub-components that need list possibilities (radio, check). Injects `MODEL_POSSIBILITIES_PROVIDER` and auto-refreshes possibilities on parent control changes.
|
|
37
|
+
|
|
38
|
+
### Default Sub-Components
|
|
39
|
+
|
|
40
|
+
| FieldType | Sub-component | Selector | Description |
|
|
41
|
+
| --------------- | ----------------------------- | ----------------------------- | ----------------------------------------------------- |
|
|
42
|
+
| `text` | `InputTextComponent` | `smart-input-text` | Plain text input |
|
|
43
|
+
| `email` | `InputEmailComponent` | `smart-input-email` | Email input |
|
|
44
|
+
| `password` | `InputPasswordComponent` | `smart-input-password` | Password input + optional `<smart-password-strength>` |
|
|
45
|
+
| `nip` | `InputNipComponent` | `smart-input-nip` | NIP with built-in `invalidNip` validator |
|
|
46
|
+
| `pesel` | `InputPeselComponent` | `smart-input-pesel` | PESEL text input |
|
|
47
|
+
| `int` | `InputIntComponent` | `smart-input-int` | Integer input (`type="number" step="1"`) |
|
|
48
|
+
| `float` | `InputFloatComponent` | `smart-input-float` | Decimal input (`type="number" step="0.01"`) |
|
|
49
|
+
| `currency` | `InputCurrencyComponent` | `smart-input-currency` | Currency input (`type="number" step="0.01"`) |
|
|
50
|
+
| `phoneNumber` | `InputPhoneNumberComponent` | `smart-input-phone-number` | Telephone input |
|
|
51
|
+
| `phoneNumberPl` | `InputPhoneNumberPlComponent` | `smart-input-phone-number-pl` | Telephone input + built-in length(9) validator |
|
|
52
|
+
| `longText` | `InputLongTextComponent` | `smart-input-long-text` | Rich text editor (`ngx-editor`) |
|
|
53
|
+
| `date` | `InputDateComponent` | `smart-input-date` | HTML date input (`type="date"`) |
|
|
54
|
+
| `dateWithEdit` | `InputDateWithEditComponent` | `smart-input-date-with-edit` | Digit-by-digit date via `<smart-date-edit>` |
|
|
55
|
+
| `dateRange` | `InputDateRangeComponent` | `smart-input-date-range` | Date range via `<smart-date-range>` |
|
|
56
|
+
| `flag` | `InputFlagComponent` | `smart-input-flag` | Single checkbox |
|
|
57
|
+
| `radio` | `InputRadioComponent` | `smart-input-radio` | Radio group (from possibilities) |
|
|
58
|
+
| `check` | `InputCheckComponent` | `smart-input-check` | Checkbox group (from possibilities) |
|
|
59
|
+
| `enum` | `InputEnumComponent` | `smart-input-enum` | Multi-select checkboxes from enum |
|
|
60
|
+
| `color` | `InputColorComponent` | `smart-input-color` | Color picker (`ngx-color-picker`) |
|
|
61
|
+
| `logo` | `InputLogoComponent` | `smart-input-logo` | Image upload with inline preview |
|
|
62
|
+
| `address` | `InputAddressComponent` | `smart-input-address` | Nested `FormGroup` (city/zip/street/building/flat) |
|
|
63
|
+
| `object` | `InputObjectComponent` | `smart-input-object` | Nested form via `FORM_COMPONENT_TOKEN` |
|
|
64
|
+
| `array` | `InputArrayComponent` | `smart-input-array` | Dynamic array of nested forms |
|
|
65
|
+
| `ints` | `InputIntsComponent` | `smart-input-ints` | Dynamic list of integer inputs |
|
|
66
|
+
| `strings` | `InputStringsComponent` | `smart-input-strings` | Dynamic list of string inputs |
|
|
67
|
+
| `file` | `InputFileComponent` | `smart-input-file` | Generic file chooser |
|
|
68
|
+
| `attachment` | `InputAttachmentComponent` | `smart-input-attachment` | File upload (any type) with download/delete |
|
|
69
|
+
| `image` | `InputImageComponent` | `smart-input-image` | Image upload with preview |
|
|
70
|
+
| `pdf` | `InputPdfComponent` | `smart-input-pdf` | PDF upload with show/delete |
|
|
71
|
+
| `video` | `InputVideoComponent` | `smart-input-video` | Video upload with play/delete |
|
|
72
|
+
|
|
73
|
+
## API
|
|
74
|
+
|
|
75
|
+
### InputComponent Inputs
|
|
76
|
+
|
|
77
|
+
| Input | Type | Default | Description |
|
|
78
|
+
| --------- | ------------------------------------------- | -------- | ------------------- |
|
|
79
|
+
| `options` | `InputSignal<InputOptions<T> \| undefined>` | optional | Field configuration |
|
|
80
|
+
|
|
81
|
+
### InputOptions
|
|
82
|
+
|
|
83
|
+
```typescript
|
|
84
|
+
type InputOptions<T> = IInputOptions & IInputFromFieldOptions<T>;
|
|
85
|
+
|
|
86
|
+
interface IInputOptions {
|
|
87
|
+
treeLevel: number;
|
|
88
|
+
control: UntypedFormControl | UntypedFormArray;
|
|
89
|
+
possibilities?: WritableSignal<{ id: any; text: string; checked: boolean }[]>;
|
|
90
|
+
component?: Type<InputBaseComponent<any>>; // per-call inline override
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
interface IInputFromFieldOptions<T> {
|
|
94
|
+
model: T;
|
|
95
|
+
fieldKey: string;
|
|
96
|
+
mode?: 'create' | 'update' | string;
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
**Notes:**
|
|
101
|
+
|
|
102
|
+
- `fieldKey` ending with `Confirm` is stripped — confirm variants share the original field's `@Field()` metadata.
|
|
103
|
+
- `mode` === `'create'` or `'update'` merges the matching `@Field({ create: … })` / `@Field({ update: … })` override into the resolved `fieldOptions`.
|
|
104
|
+
- If `options.component` is provided, it overrides everything (both `baseMap` and token).
|
|
105
|
+
|
|
106
|
+
### INPUT_FIELD_COMPONENTS_TOKEN
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
import { INPUT_FIELD_COMPONENTS_TOKEN } from '@smartsoft001/angular';
|
|
110
|
+
import { FieldType } from '@smartsoft001/models';
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
`InjectionToken<Partial<Record<FieldTypeDef, Type<InputBaseComponent<any>>>>>` — allows substituting a sub-component for any field type.
|
|
114
|
+
|
|
115
|
+
```typescript
|
|
116
|
+
providers: [
|
|
117
|
+
{
|
|
118
|
+
provide: INPUT_FIELD_COMPONENTS_TOKEN,
|
|
119
|
+
useValue: {
|
|
120
|
+
[FieldType.text]: MyCustomTextInputComponent,
|
|
121
|
+
[FieldType.image]: MyCustomImageUploaderComponent,
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
];
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Maps are merged (`{ ...baseMap, ...extendMap }`), so only selected types need to be overridden.
|
|
128
|
+
|
|
129
|
+
## Extending the Base Class
|
|
130
|
+
|
|
131
|
+
```typescript
|
|
132
|
+
import { Component, computed } from '@angular/core';
|
|
133
|
+
import { InputBaseComponent } from '@smartsoft001/angular';
|
|
134
|
+
import { ReactiveFormsModule } from '@angular/forms';
|
|
135
|
+
|
|
136
|
+
@Component({
|
|
137
|
+
selector: 'my-input-text',
|
|
138
|
+
template: `
|
|
139
|
+
@if (control) {
|
|
140
|
+
<label [class]="labelClasses()">
|
|
141
|
+
{{
|
|
142
|
+
control?.parent?.value
|
|
143
|
+
| smartModelLabel
|
|
144
|
+
: internalOptions.fieldKey
|
|
145
|
+
: internalOptions?.model?.constructor
|
|
146
|
+
}}
|
|
147
|
+
@if (required) {
|
|
148
|
+
<span>*</span>
|
|
149
|
+
}
|
|
150
|
+
</label>
|
|
151
|
+
<input type="text" [formControl]="formControl" [class]="inputClasses()" />
|
|
152
|
+
}
|
|
153
|
+
`,
|
|
154
|
+
imports: [ReactiveFormsModule],
|
|
155
|
+
standalone: true,
|
|
156
|
+
})
|
|
157
|
+
export class MyInputTextComponent extends InputBaseComponent<any> {
|
|
158
|
+
labelClasses = computed(() => 'my-prefix-label ' + this.cssClass());
|
|
159
|
+
inputClasses = computed(() => 'my-prefix-input ' + this.cssClass());
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## Usage Examples
|
|
164
|
+
|
|
165
|
+
```html
|
|
166
|
+
<!-- Direct usage -->
|
|
167
|
+
<smart-input [options]="inputOptions"></smart-input>
|
|
168
|
+
|
|
169
|
+
<!-- With custom class -->
|
|
170
|
+
<smart-input [options]="inputOptions" class="smart:mt-4"></smart-input>
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
```typescript
|
|
174
|
+
// In a component
|
|
175
|
+
import { UntypedFormControl } from '@angular/forms';
|
|
176
|
+
import { InputOptions } from '@smartsoft001/angular';
|
|
177
|
+
|
|
178
|
+
const control = new UntypedFormControl('');
|
|
179
|
+
this.inputOptions = {
|
|
180
|
+
control,
|
|
181
|
+
fieldKey: 'email',
|
|
182
|
+
model: new UserModel(),
|
|
183
|
+
treeLevel: 0,
|
|
184
|
+
} as InputOptions<UserModel>;
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## File Locations
|
|
188
|
+
|
|
189
|
+
- Wrapper: `packages/shared/angular/src/lib/components/input/input.component.ts`
|
|
190
|
+
- Base: `packages/shared/angular/src/lib/components/input/base/base.component.ts`
|
|
191
|
+
- Possibilities base: `packages/shared/angular/src/lib/components/input/base/possibilities.component.ts`
|
|
192
|
+
- File base: `packages/shared/angular/src/lib/components/input/base/file.component.ts`
|
|
193
|
+
- Sub-components: `packages/shared/angular/src/lib/components/input/<name>/<name>.component.ts`
|
|
194
|
+
- Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`INPUT_FIELD_COMPONENTS_TOKEN`)
|
|
195
|
+
- Error component: `packages/shared/angular/src/lib/components/input/error/error.component.ts`
|
|
196
|
+
- Interface: `packages/shared/angular/src/lib/models/interfaces.ts` (`InputOptions`, `IInputOptions`, `IInputFromFieldOptions`)
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: angular-components-list
|
|
3
|
+
description: List component API with InjectionToken map pattern for custom implementations per mode (desktop/mobile/masonryGrid).
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# List Component
|
|
8
|
+
|
|
9
|
+
The `<smart-list>` component renders a list of entities. It is a wrapper that dispatches to one of three built-in child components based on `options.mode` or `HardwareService.isMobile` auto-detection. Each mode's child can be replaced via `LIST_MODE_COMPONENTS_TOKEN`, which provides a partial override map — any mode you specify replaces the default child; any mode you omit falls back to the built-in.
|
|
10
|
+
|
|
11
|
+
## When to Use This Skill
|
|
12
|
+
|
|
13
|
+
- Developer wants to display a collection of entities with sorting, pagination, or detail drill-down
|
|
14
|
+
- Developer asks about `<smart-list>` or `ListComponent`
|
|
15
|
+
- Developer wants to provide a custom layout for a specific list mode (desktop, mobile, or masonryGrid)
|
|
16
|
+
|
|
17
|
+
## Components
|
|
18
|
+
|
|
19
|
+
### ListComponent (`<smart-list>`)
|
|
20
|
+
|
|
21
|
+
Main wrapper. Reads `options.mode` (or falls back to `HardwareService.isMobile` for auto mobile detection) and renders the appropriate child via `NgComponentOutlet`. Handles the empty-state display and loading skeleton before delegating to the mode child.
|
|
22
|
+
|
|
23
|
+
### ListDesktopComponent (`<smart-list-desktop>`)
|
|
24
|
+
|
|
25
|
+
Default desktop implementation. Uses CDK Table with Tailwind-styled column cells, sortable column headers, and optional remove/detail/item action columns.
|
|
26
|
+
|
|
27
|
+
### ListMobileComponent (`<smart-list-mobile>`)
|
|
28
|
+
|
|
29
|
+
Default mobile implementation. Renders a `<ul role="list">` with flex rows, one row per field key, plus optional action icons.
|
|
30
|
+
|
|
31
|
+
### ListMasonryGridComponent (`<smart-list-masonry-grid>`)
|
|
32
|
+
|
|
33
|
+
Default masonry-grid implementation. Renders a grid of cards that include image thumbnails and configurable field display.
|
|
34
|
+
|
|
35
|
+
### ListBaseComponent (abstract)
|
|
36
|
+
|
|
37
|
+
Abstract base directive. Extend it to build custom list implementations for any mode. Exposes the following from `IListInternalOptions<T>`:
|
|
38
|
+
|
|
39
|
+
- `fields` — computed array of `{ key, options }` from model decorators
|
|
40
|
+
- `keys` — string array of visible column keys (set by `initKeys()`)
|
|
41
|
+
- `list` — `Signal<T[]>` from provider
|
|
42
|
+
- `loading` — `Signal<boolean>` from provider
|
|
43
|
+
- `page` — `Signal<number>` from pagination options
|
|
44
|
+
- `totalPages` — `Signal<number>` from pagination options
|
|
45
|
+
- `provider` — `IListProvider<T>`
|
|
46
|
+
- `itemHandler` — resolved item navigation/select handler
|
|
47
|
+
- `removeHandler` — resolved remove handler
|
|
48
|
+
- `cellPipe` — `ICellPipe<T>` for cell value transformation
|
|
49
|
+
- `cssClass` — string input (alias `class`)
|
|
50
|
+
|
|
51
|
+
Methods:
|
|
52
|
+
|
|
53
|
+
- `initKeys()` — populates `keys` from computed `fields`
|
|
54
|
+
- `handlePageChange(page: number)` — triggers provider `getData` with updated page
|
|
55
|
+
|
|
56
|
+
## API
|
|
57
|
+
|
|
58
|
+
### Inputs
|
|
59
|
+
|
|
60
|
+
| Input | Type | Default | Description |
|
|
61
|
+
| --------- | ------------------------------ | ---------- | ----------------------------------------------- |
|
|
62
|
+
| `options` | `InputSignal<IListOptions<T>>` | _required_ | Full list configuration |
|
|
63
|
+
| `class` | `InputSignal<string>` | `''` | External CSS classes forwarded via `cssClass()` |
|
|
64
|
+
|
|
65
|
+
## IListOptions\<T>
|
|
66
|
+
|
|
67
|
+
```typescript
|
|
68
|
+
interface IListOptions<T> {
|
|
69
|
+
provider: IListProvider<T>;
|
|
70
|
+
type: any; // Model class decorated with @Model
|
|
71
|
+
mode?: ListMode;
|
|
72
|
+
pagination?: IListPaginationOptions;
|
|
73
|
+
cellPipe?: ICellPipe<T>;
|
|
74
|
+
componentFactories?: IListComponentFactories<T>;
|
|
75
|
+
sort?:
|
|
76
|
+
| boolean
|
|
77
|
+
| {
|
|
78
|
+
default?: string;
|
|
79
|
+
defaultDesc?: boolean;
|
|
80
|
+
};
|
|
81
|
+
details?:
|
|
82
|
+
| boolean
|
|
83
|
+
| {
|
|
84
|
+
provider?: IDetailsProvider<T>;
|
|
85
|
+
componentFactories?: IDetailsComponentFactories<T>;
|
|
86
|
+
component?: Type<any>;
|
|
87
|
+
};
|
|
88
|
+
item?:
|
|
89
|
+
| boolean
|
|
90
|
+
| {
|
|
91
|
+
options?: ItemOptions;
|
|
92
|
+
};
|
|
93
|
+
remove?:
|
|
94
|
+
| boolean
|
|
95
|
+
| {
|
|
96
|
+
provider?: IRemoveProvider<T>;
|
|
97
|
+
};
|
|
98
|
+
select?: 'multi';
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### IListOptions property reference
|
|
103
|
+
|
|
104
|
+
| Property | Type | Default | Description |
|
|
105
|
+
| -------------------- | ------------------------------------------------------------------------------------- | ---------- | ----------------------------------------------------------------------------------- |
|
|
106
|
+
| `provider` | `IListProvider<T>` | _required_ | Data provider (list signal, loading signal, getData callback) |
|
|
107
|
+
| `type` | `any` | _required_ | Model class decorated with `@Model` |
|
|
108
|
+
| `mode` | `ListMode` | - | Force a specific mode; omit to auto-detect via `HardwareService.isMobile` |
|
|
109
|
+
| `pagination` | `IListPaginationOptions` | - | Pagination config (mode, limit, page signal, totalPages signal, load callbacks) |
|
|
110
|
+
| `cellPipe` | `ICellPipe<T>` | - | Pipe for transforming each cell value |
|
|
111
|
+
| `componentFactories` | `IListComponentFactories<T>` | - | Top dynamic component factory |
|
|
112
|
+
| `sort` | `boolean \| { default?: string; defaultDesc?: boolean }` | - | Enable sorting; optionally set a default sort column and direction |
|
|
113
|
+
| `details` | `boolean \| { provider?: IDetailsProvider<T>; componentFactories?: ...; component? }` | - | Enable detail drill-down; optionally provide a custom details provider or component |
|
|
114
|
+
| `item` | `boolean \| { options?: ItemOptions }` | - | Enable item row action (navigate or custom select) |
|
|
115
|
+
| `remove` | `boolean \| { provider?: IRemoveProvider<T> }` | - | Enable row remove action; optionally provide a custom remove provider |
|
|
116
|
+
| `select` | `'multi'` | - | Enable multi-select mode |
|
|
117
|
+
|
|
118
|
+
## IListProvider\<T>
|
|
119
|
+
|
|
120
|
+
```typescript
|
|
121
|
+
interface IListProvider<T> {
|
|
122
|
+
list: Signal<T[]>;
|
|
123
|
+
loading: Signal<boolean>;
|
|
124
|
+
getData: (filter: any) => void;
|
|
125
|
+
onChangeMultiSelected?: (list: T[]) => void;
|
|
126
|
+
onCleanMultiSelected$?: Observable<void>;
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## ListMode
|
|
131
|
+
|
|
132
|
+
```typescript
|
|
133
|
+
enum ListMode {
|
|
134
|
+
mobile = 'mobile',
|
|
135
|
+
desktop = 'desktop',
|
|
136
|
+
masonryGrid = 'masonryGrid',
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## IListPaginationOptions
|
|
141
|
+
|
|
142
|
+
```typescript
|
|
143
|
+
interface IListPaginationOptions {
|
|
144
|
+
mode?: PaginationMode;
|
|
145
|
+
limit: number;
|
|
146
|
+
loadNextPage: () => Promise<boolean>;
|
|
147
|
+
loadPrevPage: () => Promise<boolean>;
|
|
148
|
+
page: Signal<number>;
|
|
149
|
+
totalPages: Signal<number>;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
enum PaginationMode {
|
|
153
|
+
infiniteScroll = 'infiniteScroll',
|
|
154
|
+
singlePage = 'singlePage',
|
|
155
|
+
}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## LIST_MODE_COMPONENTS_TOKEN
|
|
159
|
+
|
|
160
|
+
```typescript
|
|
161
|
+
import { LIST_MODE_COMPONENTS_TOKEN, ListMode } from '@smartsoft001/angular';
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
`InjectionToken` that provides a `Partial<Record<ListMode, Type<ListBaseComponent<any>>>>` override map. Any mode key you include replaces the built-in default child for that mode; any mode key you omit continues to use the built-in default.
|
|
165
|
+
|
|
166
|
+
```typescript
|
|
167
|
+
providers: [
|
|
168
|
+
{
|
|
169
|
+
provide: LIST_MODE_COMPONENTS_TOKEN,
|
|
170
|
+
useValue: {
|
|
171
|
+
[ListMode.desktop]: MyCustomDesktopListComponent,
|
|
172
|
+
[ListMode.mobile]: MyCustomMobileListComponent,
|
|
173
|
+
// masonryGrid not specified — falls back to built-in ListMasonryGridComponent
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
];
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## Extending the Base Class
|
|
180
|
+
|
|
181
|
+
```typescript
|
|
182
|
+
import { Component, ViewEncapsulation } from '@angular/core';
|
|
183
|
+
import { ListBaseComponent } from '@smartsoft001/angular';
|
|
184
|
+
|
|
185
|
+
@Component({
|
|
186
|
+
selector: 'my-custom-list',
|
|
187
|
+
template: `
|
|
188
|
+
<div [class]="cssClass()">
|
|
189
|
+
@for (item of list()(); track item.id) {
|
|
190
|
+
<div class="my-row">
|
|
191
|
+
@for (key of keys; track key) {
|
|
192
|
+
<span>{{ item[key] }}</span>
|
|
193
|
+
}
|
|
194
|
+
</div>
|
|
195
|
+
}
|
|
196
|
+
</div>
|
|
197
|
+
`,
|
|
198
|
+
encapsulation: ViewEncapsulation.None,
|
|
199
|
+
})
|
|
200
|
+
export class MyCustomListComponent extends ListBaseComponent<any> {}
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
Register with the token so `<smart-list>` picks it up for the target mode:
|
|
204
|
+
|
|
205
|
+
```typescript
|
|
206
|
+
providers: [
|
|
207
|
+
{
|
|
208
|
+
provide: LIST_MODE_COMPONENTS_TOKEN,
|
|
209
|
+
useValue: { [ListMode.desktop]: MyCustomListComponent },
|
|
210
|
+
},
|
|
211
|
+
];
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
## Usage Examples
|
|
215
|
+
|
|
216
|
+
```html
|
|
217
|
+
<!-- Basic (auto mode detection) -->
|
|
218
|
+
<smart-list [options]="listOptions"></smart-list>
|
|
219
|
+
|
|
220
|
+
<!-- Force desktop mode -->
|
|
221
|
+
<smart-list
|
|
222
|
+
[options]="{ provider: myProvider, type: UserModel, mode: 'desktop' }"
|
|
223
|
+
></smart-list>
|
|
224
|
+
|
|
225
|
+
<!-- With external CSS class -->
|
|
226
|
+
<smart-list
|
|
227
|
+
class="smart:p-4"
|
|
228
|
+
[options]="{ provider: myProvider, type: UserModel }"
|
|
229
|
+
></smart-list>
|
|
230
|
+
|
|
231
|
+
<!-- With pagination -->
|
|
232
|
+
<smart-list
|
|
233
|
+
[options]="{
|
|
234
|
+
provider: myProvider,
|
|
235
|
+
type: UserModel,
|
|
236
|
+
pagination: {
|
|
237
|
+
limit: 25,
|
|
238
|
+
page: pageSignal,
|
|
239
|
+
totalPages: totalPagesSignal,
|
|
240
|
+
loadNextPage: onLoadNext,
|
|
241
|
+
loadPrevPage: onLoadPrev
|
|
242
|
+
}
|
|
243
|
+
}"
|
|
244
|
+
></smart-list>
|
|
245
|
+
|
|
246
|
+
<!-- With sort and remove -->
|
|
247
|
+
<smart-list
|
|
248
|
+
[options]="{
|
|
249
|
+
provider: myProvider,
|
|
250
|
+
type: UserModel,
|
|
251
|
+
sort: { default: 'name' },
|
|
252
|
+
remove: { provider: myRemoveProvider }
|
|
253
|
+
}"
|
|
254
|
+
></smart-list>
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
## File Locations
|
|
258
|
+
|
|
259
|
+
- Wrapper: `packages/shared/angular/src/lib/components/list/list.component.ts`
|
|
260
|
+
- Desktop child: `packages/shared/angular/src/lib/components/list/desktop/desktop.component.ts`
|
|
261
|
+
- Mobile child: `packages/shared/angular/src/lib/components/list/mobile/mobile.component.ts`
|
|
262
|
+
- Masonry grid child: `packages/shared/angular/src/lib/components/list/masonry-grid/masonry-grid.component.ts`
|
|
263
|
+
- Base class: `packages/shared/angular/src/lib/components/list/base/base.component.ts`
|
|
264
|
+
- Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`LIST_MODE_COMPONENTS_TOKEN`)
|
|
265
|
+
- Interfaces: `packages/shared/angular/src/lib/models/interfaces.ts` (`IListOptions`, `IListProvider`, `IListPaginationOptions`, `ListMode`)
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: angular-components-multi-column-layout
|
|
3
|
+
description: Multi-column layout component API with InjectionToken pattern for custom implementations.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Multi-Column Layout Component
|
|
8
|
+
|
|
9
|
+
The `<smart-multi-column-layout>` component provides a three-column application shell — a left navigation `<aside>`, a main content region, and a right secondary `<aside>`, with an optional top header. It follows the Base + Standard + Wrapper pattern with an InjectionToken-based extension mechanism. The abstract `MultiColumnLayoutBaseComponent` defines the shared API — optional `IMultiColumnLayoutOptions` and `cssClass` (alias `class`). `MultiColumnLayoutStandardComponent` is a barebones placeholder concrete implementation. `MultiColumnLayoutComponent` is the public wrapper that renders `MultiColumnLayoutStandardComponent` by default and accepts a custom replacement via `MULTI_COLUMN_LAYOUT_STANDARD_COMPONENT_TOKEN`.
|
|
10
|
+
|
|
11
|
+
## When to Use This Skill
|
|
12
|
+
|
|
13
|
+
- Developer wants to use or customize the multi-column layout component
|
|
14
|
+
- Developer asks about `<smart-multi-column-layout>`, `MultiColumnLayoutComponent`, `MultiColumnLayoutStandardComponent`, or `MultiColumnLayoutBaseComponent`
|
|
15
|
+
|
|
16
|
+
## Components
|
|
17
|
+
|
|
18
|
+
### MultiColumnLayoutComponent (`<smart-multi-column-layout>`)
|
|
19
|
+
|
|
20
|
+
Main wrapper component. Renders `MultiColumnLayoutStandardComponent` by default. When `MULTI_COLUMN_LAYOUT_STANDARD_COMPONENT_TOKEN` is provided, renders the injected component via `NgComponentOutlet`. Accepts main content via projected `<ng-content>`.
|
|
21
|
+
|
|
22
|
+
### MultiColumnLayoutStandardComponent (`<smart-multi-column-layout-standard>`)
|
|
23
|
+
|
|
24
|
+
Barebones placeholder concrete implementation. Renders a wrapper `<div>` containing an optional `<header>` (when `options.headerTpl` is provided), an `<aside class="nav">`, a `<main>` element that projects `<ng-content>`, and an `<aside class="secondary">`. 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
|
+
### MultiColumnLayoutBaseComponent (abstract)
|
|
27
|
+
|
|
28
|
+
Abstract base directive for extending custom multi-column-layout implementations. Exposes `options` as an `InputSignal<IMultiColumnLayoutOptions | 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<IMultiColumnLayoutOptions \| undefined>` | - | Optional configuration (nav, secondary, header, width) |
|
|
37
|
+
| `class` | `InputSignal<string>` | `''` | External CSS classes (alias for `cssClass`) |
|
|
38
|
+
|
|
39
|
+
### IMultiColumnLayoutOptions
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
type SmartMultiColumnLayoutWidth = 'full' | 'constrained';
|
|
43
|
+
type SmartMultiColumnLayoutSecondaryWidth = 'sm' | 'md' | 'lg';
|
|
44
|
+
|
|
45
|
+
interface IMultiColumnLayoutOptions {
|
|
46
|
+
title?: string;
|
|
47
|
+
navTpl?: TemplateRef<unknown>;
|
|
48
|
+
secondaryTpl?: TemplateRef<unknown>;
|
|
49
|
+
headerTpl?: TemplateRef<unknown>;
|
|
50
|
+
width?: SmartMultiColumnLayoutWidth;
|
|
51
|
+
secondaryWidth?: SmartMultiColumnLayoutSecondaryWidth;
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
The default `MultiColumnLayoutStandardComponent` consumes `navTpl`, `secondaryTpl`, and `headerTpl`. `title`, `width`, and `secondaryWidth` are reserved for custom implementations registered via `MULTI_COLUMN_LAYOUT_STANDARD_COMPONENT_TOKEN`.
|
|
56
|
+
|
|
57
|
+
## MULTI_COLUMN_LAYOUT_STANDARD_COMPONENT_TOKEN
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
import { MULTI_COLUMN_LAYOUT_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
InjectionToken that allows replacing the default `MultiColumnLayoutStandardComponent` with a custom implementation. Provide a `Type<MultiColumnLayoutBaseComponent>` to override.
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
providers: [
|
|
67
|
+
{
|
|
68
|
+
provide: MULTI_COLUMN_LAYOUT_STANDARD_COMPONENT_TOKEN,
|
|
69
|
+
useValue: MyCustomMultiColumnLayoutComponent,
|
|
70
|
+
},
|
|
71
|
+
];
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Extending the Base Class
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
import {
|
|
78
|
+
ChangeDetectionStrategy,
|
|
79
|
+
Component,
|
|
80
|
+
computed,
|
|
81
|
+
input,
|
|
82
|
+
ViewEncapsulation,
|
|
83
|
+
} from '@angular/core';
|
|
84
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
85
|
+
|
|
86
|
+
import { MultiColumnLayoutBaseComponent } from '@smartsoft001/angular';
|
|
87
|
+
|
|
88
|
+
@Component({
|
|
89
|
+
selector: 'my-custom-multi-column-layout',
|
|
90
|
+
template: `
|
|
91
|
+
<div [class]="containerClasses()">
|
|
92
|
+
@if (options()?.headerTpl) {
|
|
93
|
+
<header>
|
|
94
|
+
<ng-container [ngTemplateOutlet]="options()!.headerTpl!" />
|
|
95
|
+
</header>
|
|
96
|
+
}
|
|
97
|
+
<aside class="nav">
|
|
98
|
+
@if (options()?.navTpl) {
|
|
99
|
+
<ng-container [ngTemplateOutlet]="options()!.navTpl!" />
|
|
100
|
+
}
|
|
101
|
+
</aside>
|
|
102
|
+
<main>
|
|
103
|
+
<ng-content />
|
|
104
|
+
</main>
|
|
105
|
+
<aside class="secondary">
|
|
106
|
+
@if (options()?.secondaryTpl) {
|
|
107
|
+
<ng-container [ngTemplateOutlet]="options()!.secondaryTpl!" />
|
|
108
|
+
}
|
|
109
|
+
</aside>
|
|
110
|
+
</div>
|
|
111
|
+
`,
|
|
112
|
+
imports: [NgTemplateOutlet],
|
|
113
|
+
encapsulation: ViewEncapsulation.None,
|
|
114
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
115
|
+
})
|
|
116
|
+
export class MyCustomMultiColumnLayoutComponent extends MultiColumnLayoutBaseComponent {
|
|
117
|
+
// NgComponentOutlet passes 'cssClass' by canonical name, not the 'class' alias.
|
|
118
|
+
override cssClass = input<string>('');
|
|
119
|
+
|
|
120
|
+
containerClasses = computed(() => {
|
|
121
|
+
const classes = ['my-multi-column-layout'];
|
|
122
|
+
const extra = this.cssClass();
|
|
123
|
+
if (extra) classes.push(extra);
|
|
124
|
+
return classes.join(' ');
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Usage Examples
|
|
130
|
+
|
|
131
|
+
```html
|
|
132
|
+
<!-- Basic with main content -->
|
|
133
|
+
<smart-multi-column-layout>
|
|
134
|
+
<h1>Hello</h1>
|
|
135
|
+
</smart-multi-column-layout>
|
|
136
|
+
|
|
137
|
+
<!-- With nav and secondary -->
|
|
138
|
+
<ng-template #nav>
|
|
139
|
+
<a routerLink="/">Inbox</a>
|
|
140
|
+
<a routerLink="/sent">Sent</a>
|
|
141
|
+
</ng-template>
|
|
142
|
+
|
|
143
|
+
<ng-template #secondary>
|
|
144
|
+
<p>Filters</p>
|
|
145
|
+
</ng-template>
|
|
146
|
+
|
|
147
|
+
<smart-multi-column-layout [options]="{ navTpl: nav, secondaryTpl: secondary }">
|
|
148
|
+
<p>Email content</p>
|
|
149
|
+
</smart-multi-column-layout>
|
|
150
|
+
|
|
151
|
+
<!-- With top header -->
|
|
152
|
+
<ng-template #header>
|
|
153
|
+
<h1>Inbox</h1>
|
|
154
|
+
</ng-template>
|
|
155
|
+
|
|
156
|
+
<smart-multi-column-layout
|
|
157
|
+
[options]="{ navTpl: nav, secondaryTpl: secondary, headerTpl: header }"
|
|
158
|
+
>
|
|
159
|
+
<p>Email content</p>
|
|
160
|
+
</smart-multi-column-layout>
|
|
161
|
+
|
|
162
|
+
<!-- With external class -->
|
|
163
|
+
<smart-multi-column-layout class="smart:bg-gray-50">
|
|
164
|
+
<p>Content</p>
|
|
165
|
+
</smart-multi-column-layout>
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## File Locations
|
|
169
|
+
|
|
170
|
+
- Wrapper: `packages/shared/angular/src/lib/components/multi-column-layout/multi-column-layout.component.ts`
|
|
171
|
+
- Standard: `packages/shared/angular/src/lib/components/multi-column-layout/standard/standard.component.ts`
|
|
172
|
+
- Base class: `packages/shared/angular/src/lib/components/multi-column-layout/base/base.component.ts`
|
|
173
|
+
- Token: `packages/shared/angular/src/lib/shared.inectors.ts` (`MULTI_COLUMN_LAYOUT_STANDARD_COMPONENT_TOKEN`)
|
|
174
|
+
- Interface: `packages/shared/angular/src/lib/models/interfaces.ts` (`IMultiColumnLayoutOptions`)
|