@smartsoft001/angular 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/README.md +2807 -63
- package/fesm2022/smartsoft001-angular.mjs +10043 -4602
- package/fesm2022/smartsoft001-angular.mjs.map +1 -1
- package/package.json +1 -1
- package/types/smartsoft001-angular.d.ts +2468 -804
package/README.md
CHANGED
|
@@ -32,84 +32,2828 @@ For more details, see our [Contributing Guidelines](../../../CONTRIBUTING.md).
|
|
|
32
32
|
|
|
33
33
|
All notable changes to this project will be documented in the [CHANGELOG](../../../CHANGELOG.md).
|
|
34
34
|
|
|
35
|
-
##
|
|
35
|
+
## Base Components
|
|
36
36
|
|
|
37
|
-
The
|
|
37
|
+
The following components expose abstract base classes (`@Directive()`) that can be extended to create custom implementations.
|
|
38
38
|
|
|
39
|
-
###
|
|
39
|
+
### ButtonBaseComponent
|
|
40
|
+
|
|
41
|
+
Abstract base class for button components. Provides variant/color computation, confirm mode logic, and disabled state handling.
|
|
42
|
+
|
|
43
|
+
**Inputs:** `options` (`IButtonOptions`), `disabled` (`boolean`), `class` (`string`)
|
|
44
|
+
|
|
45
|
+
### Button Component
|
|
46
|
+
|
|
47
|
+
The `<smart-button>` component renders a default `ButtonStandardComponent`. It supports an InjectionToken (`BUTTON_STANDARD_COMPONENT_TOKEN`) to replace the default rendering with a custom implementation.
|
|
48
|
+
|
|
49
|
+
**Wrapper:** `ButtonComponent` (selector: `smart-button`)
|
|
50
|
+
**Default:** `ButtonStandardComponent` (selector: `smart-button-standard`)
|
|
51
|
+
**Token:** `BUTTON_STANDARD_COMPONENT_TOKEN` — provide a `Type<ButtonBaseComponent>` to override the default.
|
|
52
|
+
|
|
53
|
+
#### Usage
|
|
40
54
|
|
|
41
55
|
```html
|
|
42
|
-
<!-- Standard (default shape) -->
|
|
43
56
|
<smart-button [options]="{ click: onClick, variant: 'primary', size: 'md' }">
|
|
44
57
|
Save
|
|
45
58
|
</smart-button>
|
|
59
|
+
```
|
|
46
60
|
|
|
47
|
-
|
|
48
|
-
<smart-button [options]="{ click: onClick, variant: 'secondary', rounded: true }">
|
|
49
|
-
Cancel
|
|
50
|
-
</smart-button>
|
|
61
|
+
#### IButtonOptions
|
|
51
62
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
63
|
+
| Property | Type | Default | Description |
|
|
64
|
+
| -------------- | ---------------------------------------- | ----------- | --------------------------------- |
|
|
65
|
+
| `click` | `() => void` | *required* | Click handler |
|
|
66
|
+
| `variant` | `'primary' \| 'secondary' \| 'soft'` | `'primary'` | Color variant |
|
|
67
|
+
| `size` | `'xs' \| 'sm' \| 'md' \| 'lg' \| 'xl'` | `'md'` | Button size |
|
|
68
|
+
| `color` | `SmartColor` | `'indigo'` | Tailwind color (22 options) |
|
|
69
|
+
| `rounded` | `boolean` | `false` | Rounded pill shape |
|
|
70
|
+
| `circular` | `boolean` | `false` | Circular shape (icon buttons) |
|
|
71
|
+
| `iconPosition` | `'leading' \| 'trailing'` | - | Icon placement |
|
|
72
|
+
| `confirm` | `boolean` | `false` | Show confirmation before click |
|
|
73
|
+
| `loading` | `Signal<boolean>` | - | Show loading spinner |
|
|
74
|
+
| `type` | `'submit' \| 'button'` | `'button'` | HTML button type |
|
|
56
75
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
76
|
+
#### Overriding with Custom Implementation
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
import { BUTTON_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
80
|
+
|
|
81
|
+
providers: [
|
|
82
|
+
{ provide: BUTTON_STANDARD_COMPONENT_TOKEN, useValue: MyButtonComponent },
|
|
83
|
+
]
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### DetailsBaseComponent
|
|
87
|
+
|
|
88
|
+
Abstract base class for details components. Computes `fields` from model decorators (`@Field({ details: true })`) with permission/specification filtering, exposes the typed `item` signal, and supports `cellPipe` and `componentFactories`.
|
|
89
|
+
|
|
90
|
+
**Inputs:** `options` (`IDetailsOptions<T>`), `class` (`string`)
|
|
91
|
+
|
|
92
|
+
### Details Component
|
|
93
|
+
|
|
94
|
+
The `<smart-details>` component renders a list of model fields decorated with `@Field({ details: true })`. It is a wrapper that delegates to `DetailsStandardComponent` by default and supports an InjectionToken (`DETAILS_STANDARD_COMPONENT_TOKEN`) to replace the default rendering with a custom implementation.
|
|
95
|
+
|
|
96
|
+
**Wrapper:** `DetailsComponent` (selector: `smart-details`)
|
|
97
|
+
**Default:** `DetailsStandardComponent` (selector: `smart-details-standard`)
|
|
98
|
+
**Token:** `DETAILS_STANDARD_COMPONENT_TOKEN` — provide a `Type<DetailsBaseComponent<T>>` to override the default.
|
|
99
|
+
|
|
100
|
+
#### Usage
|
|
101
|
+
|
|
102
|
+
```html
|
|
103
|
+
<!-- Basic -->
|
|
104
|
+
<smart-details
|
|
105
|
+
[options]="{ type: UserModel, item: userSignal }"
|
|
106
|
+
></smart-details>
|
|
107
|
+
|
|
108
|
+
<!-- With external CSS class -->
|
|
109
|
+
<smart-details
|
|
110
|
+
class="smart:bg-yellow-50 smart:p-4"
|
|
111
|
+
[options]="{ type: UserModel, item: userSignal }"
|
|
112
|
+
></smart-details>
|
|
113
|
+
|
|
114
|
+
<!-- With loading skeleton -->
|
|
115
|
+
<smart-details
|
|
116
|
+
[options]="{ type: UserModel, item: userSignal, loading: loadingSignal }"
|
|
117
|
+
></smart-details>
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
#### IDetailsOptions
|
|
121
|
+
|
|
122
|
+
| Property | Type | Default | Description |
|
|
123
|
+
| -------------------- | ----------------------------------- | ---------- | -------------------------------------------------------- |
|
|
124
|
+
| `type` | `Type<T>` | *required* | Model class decorated with `@Model` |
|
|
125
|
+
| `item` | `Signal<T \| undefined>` | *required* | Reactive entity signal |
|
|
126
|
+
| `loading` | `Signal<boolean>` | - | Show loading skeleton |
|
|
127
|
+
| `cellPipe` | `ICellPipe<T>` | - | Pipe for transforming each field value |
|
|
128
|
+
| `componentFactories` | `IDetailsComponentFactories<T>` | - | Top/bottom dynamic component factories |
|
|
129
|
+
|
|
130
|
+
#### Overriding with Custom Implementation
|
|
131
|
+
|
|
132
|
+
```typescript
|
|
133
|
+
import { DETAILS_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
134
|
+
|
|
135
|
+
providers: [
|
|
136
|
+
{ provide: DETAILS_STANDARD_COMPONENT_TOKEN, useValue: MyDetailsComponent },
|
|
137
|
+
]
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### FormBaseComponent
|
|
141
|
+
|
|
142
|
+
Abstract base class for form components. Holds reactive form logic: computes `fields` from `form.controls`, exposes `model`, `mode`, `possibilities`, `inputComponents`, and a `submit()` method emitting `invokeSubmit`.
|
|
143
|
+
|
|
144
|
+
**Inputs:** `form` (`UntypedFormGroup`), `options` (`IFormOptions<T>`), `class` (`string`)
|
|
145
|
+
**Outputs:** `invokeSubmit`
|
|
146
|
+
|
|
147
|
+
### Form Component
|
|
148
|
+
|
|
149
|
+
The `<smart-form>` component renders a reactive form driven by `@Field()` model decorators. It is a wrapper that delegates to `FormStandardComponent` by default and supports an InjectionToken (`FORM_STANDARD_COMPONENT_TOKEN`) to replace the default rendering with a custom implementation.
|
|
150
|
+
|
|
151
|
+
**Wrapper:** `FormComponent` (selector: `smart-form`)
|
|
152
|
+
**Default:** `FormStandardComponent` (selector: `smart-form-standard`)
|
|
153
|
+
**Token:** `FORM_STANDARD_COMPONENT_TOKEN` — provide a `Type<FormBaseComponent<T>>` to override the default.
|
|
154
|
+
|
|
155
|
+
#### Usage
|
|
156
|
+
|
|
157
|
+
```html
|
|
158
|
+
<!-- Basic -->
|
|
159
|
+
<smart-form
|
|
160
|
+
[options]="{ model: userModel, show: true }"
|
|
161
|
+
(invokeSubmit)="onSubmit($event)"
|
|
162
|
+
></smart-form>
|
|
163
|
+
|
|
164
|
+
<!-- With external CSS class -->
|
|
165
|
+
<smart-form
|
|
166
|
+
class="smart:p-4 smart:bg-white"
|
|
167
|
+
[options]="{ model: userModel, show: true }"
|
|
168
|
+
(invokeSubmit)="onSubmit($event)"
|
|
169
|
+
></smart-form>
|
|
170
|
+
|
|
171
|
+
<!-- With pre-built control (skips FormFactory) -->
|
|
172
|
+
<smart-form
|
|
173
|
+
[options]="{ model: userModel, show: true, control: myFormGroup }"
|
|
174
|
+
(invokeSubmit)="onSubmit($event)"
|
|
175
|
+
></smart-form>
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
#### IFormOptions
|
|
179
|
+
|
|
180
|
+
| Property | Type | Default | Description |
|
|
181
|
+
| ----------------- | ----------------------------------------------------------------------------------- | ---------- | ------------------------------------------------------------ |
|
|
182
|
+
| `model` | `T` | *required* | Model instance decorated with `@Model` / `@Field` |
|
|
183
|
+
| `show` | `boolean` | *required* | Whether the form is visible |
|
|
184
|
+
| `mode` | `'create' \| 'update' \| string` | - | Merges `@Field({ create: … })` or `{ update: … }` overrides |
|
|
185
|
+
| `control` | `AbstractControl` | - | Pre-built form group — skips `FormFactory` when provided |
|
|
186
|
+
| `loading$` | `Observable<boolean>` | - | Shows loading state while `true` |
|
|
187
|
+
| `treeLevel` | `number` | - | Nesting depth in hierarchical forms |
|
|
188
|
+
| `uniqueProvider` | `(values: Record<keyof T, any>) => Promise<boolean>` | - | Async uniqueness check per field |
|
|
189
|
+
| `possibilities` | `{ [key: string]: WritableSignal<{ id: any; text: string; checked: boolean }[]> }` | - | Options for `radio`/`check` inputs keyed by field name |
|
|
190
|
+
| `inputComponents` | `{ [key: string]: InputBaseComponentType<T> }` | - | Per-field component overrides keyed by field name |
|
|
191
|
+
| `fieldOptions` | `IFieldOptions` | - | Additional `@Field()` metadata overrides |
|
|
192
|
+
| `modelOptions` | `IModelOptions` | - | Additional `@Model()` metadata overrides |
|
|
193
|
+
|
|
194
|
+
#### Overriding with Custom Implementation
|
|
195
|
+
|
|
196
|
+
```typescript
|
|
197
|
+
import { FORM_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
198
|
+
|
|
199
|
+
providers: [
|
|
200
|
+
{ provide: FORM_STANDARD_COMPONENT_TOKEN, useValue: MyFormComponent },
|
|
201
|
+
]
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### ListBaseComponent
|
|
205
|
+
|
|
206
|
+
Abstract base class for list components. Computes `fields` and `keys` from model decorators, exposes `list`, `loading`, `page`, `totalPages`, `provider`, `itemHandler`, `removeHandler`, and `cellPipe` from `IListInternalOptions<T>`. Extend it to build a custom list implementation for any `ListMode`.
|
|
207
|
+
|
|
208
|
+
**Inputs:** `options` (`IListInternalOptions<T>`), `class` (`string`)
|
|
209
|
+
**Methods:** `initKeys()` — populates column keys from `fields`; `handlePageChange(page)` — triggers `provider.getData` with the new page; `initList()` — wires the list signal from the provider; `initLoading()` — wires the loading signal from the provider
|
|
210
|
+
|
|
211
|
+
### List Component
|
|
212
|
+
|
|
213
|
+
The `<smart-list>` component renders a collection of entities. It is a wrapper that dispatches to one of three built-in children based on `options.mode` or `HardwareService.isMobile` auto-detection. Each child can be replaced via `LIST_MODE_COMPONENTS_TOKEN`, which provides a partial override map — any mode you specify replaces the built-in default; any mode you omit continues to use the built-in.
|
|
214
|
+
|
|
215
|
+
**Wrapper:** `ListComponent` (selector: `smart-list`)
|
|
216
|
+
**Default children:**
|
|
217
|
+
- `ListDesktopComponent` (selector: `smart-list-desktop`) — CDK Table with Tailwind styling
|
|
218
|
+
- `ListMobileComponent` (selector: `smart-list-mobile`) — `<ul role="list">` with flex rows
|
|
219
|
+
- `ListMasonryGridComponent` (selector: `smart-list-masonry-grid>`) — grid of cards with images
|
|
220
|
+
**Token:** `LIST_MODE_COMPONENTS_TOKEN` — provide a `Partial<Record<ListMode, Type<ListBaseComponent<T>>>>` to override one or more mode children.
|
|
221
|
+
|
|
222
|
+
#### Usage
|
|
223
|
+
|
|
224
|
+
```html
|
|
225
|
+
<!-- Basic (auto mode detection) -->
|
|
226
|
+
<smart-list [options]="listOptions"></smart-list>
|
|
227
|
+
|
|
228
|
+
<!-- Force desktop mode -->
|
|
229
|
+
<smart-list
|
|
230
|
+
[options]="{ provider: myProvider, type: UserModel, mode: 'desktop' }"
|
|
231
|
+
></smart-list>
|
|
232
|
+
|
|
233
|
+
<!-- With external CSS class -->
|
|
234
|
+
<smart-list
|
|
235
|
+
class="smart:p-4"
|
|
236
|
+
[options]="{ provider: myProvider, type: UserModel }"
|
|
237
|
+
></smart-list>
|
|
238
|
+
|
|
239
|
+
<!-- With pagination -->
|
|
240
|
+
<smart-list
|
|
241
|
+
[options]="{
|
|
242
|
+
provider: myProvider,
|
|
243
|
+
type: UserModel,
|
|
244
|
+
pagination: {
|
|
245
|
+
limit: 25,
|
|
246
|
+
page: pageSignal,
|
|
247
|
+
totalPages: totalPagesSignal,
|
|
248
|
+
loadNextPage: onLoadNext,
|
|
249
|
+
loadPrevPage: onLoadPrev
|
|
250
|
+
}
|
|
251
|
+
}"
|
|
252
|
+
></smart-list>
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
#### IListOptions
|
|
256
|
+
|
|
257
|
+
| Property | Type | Default | Description |
|
|
258
|
+
| -------------------- | ------------------------------------------------------------------------------------- | ---------- | ------------------------------------------------------------------------------------ |
|
|
259
|
+
| `provider` | `IListProvider<T>` | *required* | Data provider (list signal, loading signal, getData callback) |
|
|
260
|
+
| `type` | `any` | *required* | Model class decorated with `@Model` |
|
|
261
|
+
| `mode` | `ListMode` | - | Force a specific mode; omit to auto-detect via `HardwareService.isMobile` |
|
|
262
|
+
| `pagination` | `IListPaginationOptions` | - | Pagination config (mode, limit, page signal, totalPages signal, load callbacks) |
|
|
263
|
+
| `cellPipe` | `ICellPipe<T>` | - | Pipe for transforming each cell value |
|
|
264
|
+
| `componentFactories` | `IListComponentFactories<T>` | - | Top dynamic component factory |
|
|
265
|
+
| `sort` | `boolean \| { default?: string; defaultDesc?: boolean }` | - | Enable sorting; optionally set a default sort column and direction |
|
|
266
|
+
| `details` | `boolean \| { provider?: IDetailsProvider<T>; componentFactories?: ...; component? }` | - | Enable detail drill-down; optionally provide a custom details provider or component |
|
|
267
|
+
| `item` | `boolean \| { options?: ItemOptions }` | - | Enable item row action (navigate or custom select) |
|
|
268
|
+
| `remove` | `boolean \| { provider?: IRemoveProvider<T> }` | - | Enable row remove action; optionally provide a custom remove provider |
|
|
269
|
+
| `select` | `'multi'` | - | Enable multi-select mode |
|
|
270
|
+
|
|
271
|
+
#### Overriding with Custom Implementation
|
|
272
|
+
|
|
273
|
+
```typescript
|
|
274
|
+
import { LIST_MODE_COMPONENTS_TOKEN, ListMode } from '@smartsoft001/angular';
|
|
275
|
+
|
|
276
|
+
providers: [
|
|
277
|
+
{
|
|
278
|
+
provide: LIST_MODE_COMPONENTS_TOKEN,
|
|
279
|
+
useValue: {
|
|
280
|
+
[ListMode.desktop]: MyCustomDesktopListComponent,
|
|
281
|
+
[ListMode.mobile]: MyCustomMobileListComponent,
|
|
282
|
+
// masonryGrid not specified — falls back to built-in ListMasonryGridComponent
|
|
283
|
+
},
|
|
284
|
+
},
|
|
285
|
+
]
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
### CardBaseComponent
|
|
289
|
+
|
|
290
|
+
Abstract base class for card components. Provides shared container, header, body, and footer CSS class computation with gray background and divider support.
|
|
291
|
+
|
|
292
|
+
**Inputs:** `options` (`ICardOptions`), `hasHeader` (`boolean`), `hasFooter` (`boolean`), `class` (`string`), `headerTpl`/`bodyTpl`/`footerTpl` (`TemplateRef`)
|
|
293
|
+
|
|
294
|
+
### Card Component
|
|
295
|
+
|
|
296
|
+
The `<smart-card>` component renders a default `CardStandardComponent`. It supports an InjectionToken (`CARD_STANDARD_COMPONENT_TOKEN`) to replace the default rendering with a custom implementation.
|
|
297
|
+
|
|
298
|
+
**Wrapper:** `CardComponent` (selector: `smart-card`)
|
|
299
|
+
**Default:** `CardStandardComponent` (selector: `smart-card-standard`)
|
|
300
|
+
**Token:** `CARD_STANDARD_COMPONENT_TOKEN` — provide a `Type<CardBaseComponent>` to override the default.
|
|
301
|
+
|
|
302
|
+
#### Usage
|
|
303
|
+
|
|
304
|
+
```html
|
|
305
|
+
<!-- Basic -->
|
|
306
|
+
<smart-card>
|
|
307
|
+
<p>Body content</p>
|
|
308
|
+
</smart-card>
|
|
309
|
+
|
|
310
|
+
<!-- With header and title -->
|
|
311
|
+
<smart-card [options]="{ title: 'My Card' }" [hasHeader]="true">
|
|
312
|
+
<p>Body content</p>
|
|
313
|
+
</smart-card>
|
|
314
|
+
|
|
315
|
+
<!-- With header, footer, and gray footer -->
|
|
316
|
+
<smart-card
|
|
317
|
+
[options]="{ grayFooter: true }"
|
|
318
|
+
[hasHeader]="true"
|
|
319
|
+
[hasFooter]="true"
|
|
320
|
+
>
|
|
321
|
+
<div cardHeader>Custom Header</div>
|
|
322
|
+
<p>Body content</p>
|
|
323
|
+
<div cardFooter>Footer content</div>
|
|
324
|
+
</smart-card>
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
#### ICardOptions
|
|
328
|
+
|
|
329
|
+
| Property | Type | Default | Description |
|
|
330
|
+
| ------------ | -------------------------- | ------- | ----------------------------- |
|
|
331
|
+
| `title` | `string` | - | Card title (shown in header) |
|
|
332
|
+
| `buttons` | `Array<IIconButtonOptions>`| - | Optional action icons |
|
|
333
|
+
| `grayFooter` | `boolean` | `false` | Gray background on footer |
|
|
334
|
+
| `grayBody` | `boolean` | `false` | Gray background on body |
|
|
335
|
+
|
|
336
|
+
#### Content Projection
|
|
337
|
+
|
|
338
|
+
| Selector | Description |
|
|
339
|
+
| -------------- | -------------- |
|
|
340
|
+
| `[cardHeader]` | Header content |
|
|
341
|
+
| default | Body content |
|
|
342
|
+
| `[cardFooter]` | Footer content |
|
|
343
|
+
|
|
344
|
+
#### Overriding with Custom Implementation
|
|
345
|
+
|
|
346
|
+
```typescript
|
|
347
|
+
import { CARD_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
348
|
+
|
|
349
|
+
providers: [
|
|
350
|
+
{ provide: CARD_STANDARD_COMPONENT_TOKEN, useValue: MyCardComponent },
|
|
351
|
+
]
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
### PageBaseComponent
|
|
355
|
+
|
|
356
|
+
Abstract base class for page components. Exposes `options` (`IPageOptions`), `cssClass` (`class` alias), a `back()` method wired to `Location.back()`, an `isMobile` getter via `HardwareService`, and a `contentTpl` view child for variants that need to re-project the body.
|
|
357
|
+
|
|
358
|
+
**Inputs:** `options` (`IPageOptions`), `class` (`string`)
|
|
359
|
+
|
|
360
|
+
### Page Component
|
|
361
|
+
|
|
362
|
+
The `<smart-page>` component uses a map-based variant dispatch. It renders `PageStandardComponent` by default (`options.variant === 'standard'` or omitted) and can be extended with additional variants via `PAGE_VARIANT_COMPONENTS_TOKEN`. Projection uses `TemplateRef` slots declared on `IPageOptions`, plus a default `<ng-content>` fallback for the body.
|
|
363
|
+
|
|
364
|
+
**Wrapper:** `PageComponent` (selector: `smart-page`)
|
|
365
|
+
**Default:** `PageStandardComponent` (selector: `smart-page-standard`)
|
|
366
|
+
**Variant type:** `SmartPageVariant` — `'standard' | (string & {})`
|
|
367
|
+
**Token:** `PAGE_VARIANT_COMPONENTS_TOKEN` — provide a `Partial<Record<SmartPageVariant, Type<PageBaseComponent>>>` to register additional variants (merged on top of the built-in `{ standard: PageStandardComponent }`).
|
|
368
|
+
|
|
369
|
+
#### Usage
|
|
370
|
+
|
|
371
|
+
```html
|
|
372
|
+
<!-- Simple page with <ng-content> body -->
|
|
373
|
+
<smart-page [options]="{ title: 'Dashboard' }">
|
|
374
|
+
<p>Dashboard content</p>
|
|
375
|
+
</smart-page>
|
|
376
|
+
|
|
377
|
+
<!-- With back button, search, and end buttons -->
|
|
378
|
+
<smart-page
|
|
379
|
+
[options]="{
|
|
380
|
+
title: 'Users',
|
|
381
|
+
showBackButton: true,
|
|
382
|
+
search: { text: searchText, set: onSearch },
|
|
383
|
+
endButtons: [{ icon: 'add', text: 'Add user', handler: onAdd }]
|
|
384
|
+
}"
|
|
385
|
+
>
|
|
386
|
+
<users-list />
|
|
387
|
+
</smart-page>
|
|
388
|
+
|
|
389
|
+
<!-- Advanced: pick a variant and provide named slots -->
|
|
390
|
+
<ng-template #breadcrumbs><nav>Home / Users</nav></ng-template>
|
|
391
|
+
<ng-template #body><user-list /></ng-template>
|
|
392
|
+
|
|
393
|
+
<smart-page
|
|
394
|
+
[options]="{
|
|
395
|
+
title: 'Users',
|
|
396
|
+
variant: 'analytics',
|
|
397
|
+
breadcrumbsTpl: breadcrumbs,
|
|
398
|
+
bodyTpl: body,
|
|
399
|
+
}"
|
|
400
|
+
/>
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
#### IPageOptions
|
|
404
|
+
|
|
405
|
+
| Property | Type | Default | Description |
|
|
406
|
+
| ---------------- | ------------------------------------------------------ | ---------- | ---------------------------------------------------------------- |
|
|
407
|
+
| `title` | `string` | *required* | Page title (translated) |
|
|
408
|
+
| `hideHeader` | `boolean` | `false` | Hide the entire header block |
|
|
409
|
+
| `hideMenuButton` | `boolean` | `false` | Reserved for layouts with a menu button |
|
|
410
|
+
| `showBackButton` | `boolean` | `false` | Render a back arrow that calls `Location.back()` |
|
|
411
|
+
| `endButtons` | `Array<IIconButtonOptions>` | - | Action buttons rendered via `<smart-button>` |
|
|
412
|
+
| `search` | `{ text: Signal<string>; set: (txt: string) => void }` | - | Inline search input |
|
|
413
|
+
| `variant` | `SmartPageVariant` | `standard` | Selects the variant component from the merged map |
|
|
414
|
+
| `bodyTpl` | `TemplateRef<unknown>` | - | Explicit body template (falls back to `<ng-content>` if omitted) |
|
|
415
|
+
| `breadcrumbsTpl` | `TemplateRef<unknown>` | - | Breadcrumbs slot |
|
|
416
|
+
| `metaTpl` | `TemplateRef<unknown>` | - | Meta slot (status, timestamps, ...) |
|
|
417
|
+
| `avatarTpl` | `TemplateRef<unknown>` | - | Avatar slot |
|
|
418
|
+
| `bannerTpl` | `TemplateRef<unknown>` | - | Banner slot |
|
|
419
|
+
| `filtersTpl` | `TemplateRef<unknown>` | - | Filters slot |
|
|
420
|
+
| `logoTpl` | `TemplateRef<unknown>` | - | Logo slot |
|
|
421
|
+
| `statsTpl` | `TemplateRef<unknown>` | - | Stats slot |
|
|
422
|
+
| `subtitleTpl` | `TemplateRef<unknown>` | - | Subtitle slot |
|
|
423
|
+
| `navTpl` | `TemplateRef<unknown>` | - | Navigation slot |
|
|
424
|
+
| `sidebarTpl` | `TemplateRef<unknown>` | - | Sidebar slot |
|
|
425
|
+
|
|
426
|
+
#### Registering Additional Variants
|
|
427
|
+
|
|
428
|
+
```typescript
|
|
429
|
+
import { PAGE_VARIANT_COMPONENTS_TOKEN } from '@smartsoft001/angular';
|
|
430
|
+
|
|
431
|
+
providers: [
|
|
432
|
+
{
|
|
433
|
+
provide: PAGE_VARIANT_COMPONENTS_TOKEN,
|
|
434
|
+
useValue: {
|
|
435
|
+
'product-detail': MyProductDetailPageComponent,
|
|
436
|
+
'analytics': MyAnalyticsPageComponent,
|
|
437
|
+
},
|
|
438
|
+
},
|
|
439
|
+
]
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
### InfoBaseComponent
|
|
443
|
+
|
|
444
|
+
Abstract base class for info popover components. Exposes required `options: IInfoOptions`, `cssClass: string` (alias `class`), an `isOpen: WritableSignal<boolean>` state, and `toggle()`/`open()`/`close()` methods.
|
|
445
|
+
|
|
446
|
+
**Inputs:** `options` (`IInfoOptions`), `class` (`string`)
|
|
447
|
+
|
|
448
|
+
### Info Component
|
|
449
|
+
|
|
450
|
+
The `<smart-info>` component renders a small info icon that toggles a popover with a short tooltip text. It is a wrapper that delegates to `InfoStandardComponent` by default and supports an InjectionToken (`INFO_STANDARD_COMPONENT_TOKEN`) to replace the default rendering with a custom implementation.
|
|
451
|
+
|
|
452
|
+
**Wrapper:** `InfoComponent` (selector: `smart-info`)
|
|
453
|
+
**Default:** `InfoStandardComponent` (selector: `smart-info-standard`)
|
|
454
|
+
**Token:** `INFO_STANDARD_COMPONENT_TOKEN` — provide a `Type<InfoBaseComponent>` to override the default.
|
|
455
|
+
|
|
456
|
+
#### Usage
|
|
457
|
+
|
|
458
|
+
```html
|
|
459
|
+
<!-- Basic -->
|
|
460
|
+
<smart-info [options]="{ text: 'Helpful description' }"></smart-info>
|
|
461
|
+
|
|
462
|
+
<!-- With external CSS class -->
|
|
463
|
+
<smart-info
|
|
464
|
+
class="smart:text-indigo-600"
|
|
465
|
+
[options]="{ text: 'Helpful description' }"
|
|
466
|
+
></smart-info>
|
|
467
|
+
```
|
|
468
|
+
|
|
469
|
+
#### IInfoOptions
|
|
470
|
+
|
|
471
|
+
| Property | Type | Default | Description |
|
|
472
|
+
| -------- | -------- | ---------- | ------------------------------------- |
|
|
473
|
+
| `text` | `string` | *required* | Text shown inside the popover (translated via `TranslatePipe`) |
|
|
474
|
+
|
|
475
|
+
#### Overriding with Custom Implementation
|
|
476
|
+
|
|
477
|
+
```typescript
|
|
478
|
+
import { INFO_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
479
|
+
|
|
480
|
+
providers: [
|
|
481
|
+
{ provide: INFO_STANDARD_COMPONENT_TOKEN, useValue: MyInfoComponent },
|
|
482
|
+
]
|
|
483
|
+
```
|
|
484
|
+
|
|
485
|
+
When providing a custom implementation, note that the default `InfoStandardComponent` registers a `document:click` listener to close the popover on outside clicks — a custom implementation is responsible for its own close-on-outside-click behavior if needed.
|
|
486
|
+
|
|
487
|
+
### SearchbarBaseComponent
|
|
488
|
+
|
|
489
|
+
Abstract base class for searchbar components. Provides reactive `UntypedFormControl` with debounced text emission, `show`/`text` models, `setShow()`/`tryHide()` methods.
|
|
490
|
+
|
|
491
|
+
**Inputs:** `options` (`ISearchbarOptions`), `show` (`ModelSignal<boolean>`), `text` (`ModelSignal<string>`), `class` (`string`)
|
|
492
|
+
|
|
493
|
+
### Searchbar Component
|
|
494
|
+
|
|
495
|
+
The `<smart-searchbar>` component renders a debounced search input with an optional toggle button. It is a wrapper that delegates to `SearchbarStandardComponent` by default and supports an InjectionToken (`SEARCHBAR_STANDARD_COMPONENT_TOKEN`) to replace the default rendering with a custom implementation.
|
|
496
|
+
|
|
497
|
+
**Wrapper:** `SearchbarComponent` (selector: `smart-searchbar`)
|
|
498
|
+
**Default:** `SearchbarStandardComponent` (selector: `smart-searchbar-standard`)
|
|
499
|
+
**Token:** `SEARCHBAR_STANDARD_COMPONENT_TOKEN` — provide a `Type<SearchbarBaseComponent>` to override the default.
|
|
500
|
+
|
|
501
|
+
#### Usage
|
|
502
|
+
|
|
503
|
+
```html
|
|
504
|
+
<!-- Basic -->
|
|
505
|
+
<smart-searchbar [(text)]="searchText" />
|
|
506
|
+
|
|
507
|
+
<!-- With options (custom placeholder + debounce) -->
|
|
508
|
+
<smart-searchbar
|
|
509
|
+
[(text)]="searchText"
|
|
510
|
+
[options]="{ placeholder: 'users.search', debounceTime: 300 }"
|
|
511
|
+
/>
|
|
512
|
+
|
|
513
|
+
<!-- Hidden with toggle button -->
|
|
514
|
+
<smart-searchbar
|
|
515
|
+
[(show)]="searchShown"
|
|
516
|
+
[(text)]="searchText"
|
|
517
|
+
[options]="{ showToggleButton: true }"
|
|
518
|
+
/>
|
|
519
|
+
|
|
520
|
+
<!-- With external CSS class -->
|
|
521
|
+
<smart-searchbar class="smart:max-w-md" [(text)]="searchText" />
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
#### ISearchbarOptions
|
|
525
|
+
|
|
526
|
+
| Property | Type | Default | Description |
|
|
527
|
+
| ------------------ | ------------ | ---------- | ------------------------------------------------------------------------ |
|
|
528
|
+
| `placeholder` | `string` | `'search'` | Placeholder translation key (rendered through `TranslatePipe`) |
|
|
529
|
+
| `debounceTime` | `number` | `1000` | Debounce (ms) before `text` model emits a new value |
|
|
530
|
+
| `showToggleButton` | `boolean` | `false` | When `show` is `false`, display a magnifier button that reveals the input |
|
|
531
|
+
| `size` | `SmartSize` | - | `'xs' \| 'sm' \| 'md' \| 'lg' \| 'xl'` |
|
|
532
|
+
| `color` | `SmartColor` | - | Tailwind color (22 options) |
|
|
533
|
+
|
|
534
|
+
#### Overriding with Custom Implementation
|
|
535
|
+
|
|
536
|
+
```typescript
|
|
537
|
+
import { SEARCHBAR_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
538
|
+
|
|
539
|
+
providers: [
|
|
540
|
+
{ provide: SEARCHBAR_STANDARD_COMPONENT_TOKEN, useValue: MySearchbarComponent },
|
|
541
|
+
]
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
A custom implementation extending `SearchbarBaseComponent` should declare `cssClass = input<string>('')` without the `class` alias (because `NgComponentOutlet` passes inputs by canonical name) and rely on the base's `control` signal, `setShow()`, and `tryHide()` methods. The base class already wires `control.valueChanges` through `debounceTime()` and emits into the `text` model — do not re-subscribe.
|
|
545
|
+
|
|
546
|
+
### ToggleBaseComponent
|
|
547
|
+
|
|
548
|
+
Abstract base class for toggle components. Exposes `value` (two-way `ModelSignal<boolean>`), `disabled`, optional `IToggleOptions`, `cssClass` (alias `class`), and a `toggle()` method that flips `value` while respecting `disabled`.
|
|
549
|
+
|
|
550
|
+
**Inputs:** `value` (`ModelSignal<boolean>`), `disabled` (`boolean`), `options` (`IToggleOptions`), `class` (`string`)
|
|
551
|
+
|
|
552
|
+
### Toggle Component
|
|
553
|
+
|
|
554
|
+
The `<smart-toggle>` component renders a boolean on/off control. It is a wrapper that delegates to `ToggleStandardComponent` by default and supports an InjectionToken (`TOGGLE_STANDARD_COMPONENT_TOKEN`) to replace the default rendering with a custom implementation.
|
|
555
|
+
|
|
556
|
+
**Wrapper:** `ToggleComponent` (selector: `smart-toggle`)
|
|
557
|
+
**Default:** `ToggleStandardComponent` (selector: `smart-toggle-standard`)
|
|
558
|
+
**Token:** `TOGGLE_STANDARD_COMPONENT_TOKEN` — provide a `Type<ToggleBaseComponent>` to override the default.
|
|
559
|
+
|
|
560
|
+
#### Usage
|
|
561
|
+
|
|
562
|
+
```html
|
|
563
|
+
<!-- Basic -->
|
|
564
|
+
<smart-toggle [(value)]="enabled" />
|
|
565
|
+
|
|
566
|
+
<!-- With options -->
|
|
567
|
+
<smart-toggle [(value)]="enabled" [options]="{ ariaLabel: 'Use setting' }" />
|
|
61
568
|
|
|
62
569
|
<!-- Disabled -->
|
|
63
|
-
<smart-
|
|
64
|
-
Disabled
|
|
65
|
-
</smart-button>
|
|
570
|
+
<smart-toggle [(value)]="enabled" [disabled]="true" />
|
|
66
571
|
|
|
67
|
-
<!--
|
|
68
|
-
<smart-
|
|
69
|
-
|
|
70
|
-
|
|
572
|
+
<!-- With external class -->
|
|
573
|
+
<smart-toggle [(value)]="enabled" class="smart:my-2" />
|
|
574
|
+
```
|
|
575
|
+
|
|
576
|
+
#### IToggleOptions
|
|
577
|
+
|
|
578
|
+
| Property | Type | Default | Description |
|
|
579
|
+
| --------------- | --------------------- | ------- | -------------------------------------------------------- |
|
|
580
|
+
| `label` | `string` | - | Optional label |
|
|
581
|
+
| `description` | `string` | - | Optional secondary description |
|
|
582
|
+
| `labelPosition` | `'left' \| 'right'` | - | Where the label sits relative to the toggle |
|
|
583
|
+
| `ariaLabel` | `string` | - | Accessible label rendered as `aria-label` |
|
|
584
|
+
|
|
585
|
+
The default `ToggleStandardComponent` consumes only `ariaLabel`. `label`, `description`, and `labelPosition` are intended for custom implementations registered via `TOGGLE_STANDARD_COMPONENT_TOKEN`.
|
|
586
|
+
|
|
587
|
+
#### Overriding with Custom Implementation
|
|
588
|
+
|
|
589
|
+
```typescript
|
|
590
|
+
import { TOGGLE_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
591
|
+
|
|
592
|
+
providers: [
|
|
593
|
+
{ provide: TOGGLE_STANDARD_COMPONENT_TOKEN, useValue: MyToggleComponent },
|
|
594
|
+
];
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
### CalendarBaseComponent
|
|
598
|
+
|
|
599
|
+
Abstract base class for calendar components. Contains shared date logic — month-grid construction, period navigation (prev/next/today), single-day selection, and per-day event filtering. Exposes optional `ICalendarOptions`, two-way `value` model (`Date | null`), optional `referenceDate`, `events` array, and `cssClass` (alias `class`). Computed signals: `view`, `weekStart`, `showToolbar`, `reference`, `monthGrid`. Methods: `selectDay()`, `goToToday()`, `prevPeriod()`, `nextPeriod()`, `eventsForDay()`. Static method `buildMonthGrid()` is a pure function returning a 6×7 grid.
|
|
600
|
+
|
|
601
|
+
**Inputs:** `options` (`ICalendarOptions`), `value` (`Date | null`, two-way), `referenceDate` (`Date`), `events` (`ICalendarEvent[]`), `class` (`string`)
|
|
602
|
+
|
|
603
|
+
### Calendar Component
|
|
604
|
+
|
|
605
|
+
The `<smart-calendar>` component renders a date calendar with shared month-grid logic, navigation toolbar (prev/next/today), and single-day selection. It is a wrapper that delegates to `CalendarStandardComponent` by default and supports an InjectionToken (`CALENDAR_STANDARD_COMPONENT_TOKEN`) to replace the default rendering with a custom implementation.
|
|
606
|
+
|
|
607
|
+
**Wrapper:** `CalendarComponent` (selector: `smart-calendar`)
|
|
608
|
+
**Default:** `CalendarStandardComponent` (selector: `smart-calendar-standard`)
|
|
609
|
+
**Token:** `CALENDAR_STANDARD_COMPONENT_TOKEN` — provide a `Type<CalendarBaseComponent>` to override the default.
|
|
610
|
+
|
|
611
|
+
#### Usage
|
|
612
|
+
|
|
613
|
+
```html
|
|
614
|
+
<!-- Basic two-way binding -->
|
|
615
|
+
<smart-calendar [(value)]="selected" />
|
|
616
|
+
|
|
617
|
+
<!-- With reference date and events -->
|
|
618
|
+
<smart-calendar
|
|
619
|
+
[(value)]="selected"
|
|
620
|
+
[referenceDate]="january2026"
|
|
621
|
+
[events]="meetings"
|
|
622
|
+
/>
|
|
623
|
+
|
|
624
|
+
<!-- Hidden toolbar -->
|
|
625
|
+
<smart-calendar [(value)]="selected" [options]="{ showToolbar: false }" />
|
|
626
|
+
|
|
627
|
+
<!-- Sunday-first weeks -->
|
|
628
|
+
<smart-calendar [(value)]="selected" [options]="{ weekStart: 0 }" />
|
|
629
|
+
|
|
630
|
+
<!-- Custom day cell -->
|
|
631
|
+
<ng-template #dayCell let-cell let-events="events">
|
|
632
|
+
<span>{{ cell.date.getDate() }}</span>
|
|
633
|
+
@for (event of events; track event.id) {
|
|
634
|
+
<span class="dot"></span>
|
|
635
|
+
}
|
|
636
|
+
</ng-template>
|
|
637
|
+
|
|
638
|
+
<smart-calendar
|
|
639
|
+
[(value)]="selected"
|
|
640
|
+
[events]="meetings"
|
|
641
|
+
[options]="{ dayCellTpl: dayCell }"
|
|
642
|
+
/>
|
|
643
|
+
```
|
|
644
|
+
|
|
645
|
+
#### ICalendarOptions
|
|
646
|
+
|
|
647
|
+
| Property | Type | Default | Description |
|
|
648
|
+
| ------------------- | ------------------------------------ | ------- | ------------------------------------------------------------ |
|
|
649
|
+
| `view` | `'month' \| 'week' \| 'day' \| 'year'` | `'month'` | Active view (hint for custom implementations) |
|
|
650
|
+
| `monthsCount` | `1 \| 2 \| 12` | `1` | Number of mini-months to render (custom impl hint) |
|
|
651
|
+
| `weekStart` | `0 \| 1` | `1` | Week start day (0 = Sunday, 1 = Monday) |
|
|
652
|
+
| `showToolbar` | `boolean` | `true` | Toggle the prev/today/next toolbar |
|
|
653
|
+
| `toolbarActionsTpl` | `TemplateRef<unknown>` | - | Slot for additional toolbar buttons |
|
|
654
|
+
| `eventListTpl` | `TemplateRef<unknown>` | - | Agenda / event list slot (custom impl) |
|
|
655
|
+
| `sidePanelTpl` | `TemplateRef<unknown>` | - | Side-panel slot (custom impl) |
|
|
656
|
+
| `dayCellTpl` | `TemplateRef<unknown>` | - | Custom day-cell template; receives `$implicit: ICalendarDayCell` and `events: ICalendarEvent[]` |
|
|
657
|
+
| `eventTpl` | `TemplateRef<unknown>` | - | Single-event template (custom impl) |
|
|
658
|
+
|
|
659
|
+
#### ICalendarEvent
|
|
660
|
+
|
|
661
|
+
| Property | Type | Default | Description |
|
|
662
|
+
| -------- | -------------------------- | ------- | ------------------------------------------ |
|
|
663
|
+
| `id` | `string \| number` | - | Unique identifier |
|
|
664
|
+
| `start` | `Date` | - | Event start (date is what is matched) |
|
|
665
|
+
| `end` | `Date` | - | Optional event end |
|
|
666
|
+
| `title` | `string` | - | Optional title |
|
|
667
|
+
| `meta` | `Record<string, unknown>` | - | Free-form metadata for custom impl |
|
|
668
|
+
|
|
669
|
+
#### Overriding with Custom Implementation
|
|
670
|
+
|
|
671
|
+
```typescript
|
|
672
|
+
import { CALENDAR_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
673
|
+
|
|
674
|
+
providers: [
|
|
675
|
+
{ provide: CALENDAR_STANDARD_COMPONENT_TOKEN, useValue: MyCalendarComponent },
|
|
676
|
+
];
|
|
677
|
+
```
|
|
678
|
+
|
|
679
|
+
> `NgComponentOutlet` does not propagate output bindings. When a custom component is injected via the token, `value` two-way becomes one-way input. Custom impl should expose dedicated outputs and host wires manually.
|
|
680
|
+
|
|
681
|
+
### SectionHeadingBaseComponent
|
|
682
|
+
|
|
683
|
+
Abstract base class for section heading components. Exposes optional `ISectionHeadingOptions` and `cssClass` (alias `class`).
|
|
684
|
+
|
|
685
|
+
**Inputs:** `options` (`ISectionHeadingOptions`), `class` (`string`)
|
|
686
|
+
|
|
687
|
+
### SectionHeading Component
|
|
688
|
+
|
|
689
|
+
The `<smart-section-heading>` component renders a heading region for sections within a page (positioned between `<smart-page-heading>` and `<smart-card-heading>` in size and scope), with optional slots for label, description, actions, tabs, an input group (search), and a badge. It is a wrapper that delegates to `SectionHeadingStandardComponent` by default and supports an InjectionToken (`SECTION_HEADING_STANDARD_COMPONENT_TOKEN`) to replace the default rendering with a custom implementation.
|
|
690
|
+
|
|
691
|
+
**Wrapper:** `SectionHeadingComponent` (selector: `smart-section-heading`)
|
|
692
|
+
**Default:** `SectionHeadingStandardComponent` (selector: `smart-section-heading-standard`)
|
|
693
|
+
**Token:** `SECTION_HEADING_STANDARD_COMPONENT_TOKEN` — provide a `Type<SectionHeadingBaseComponent>` to override the default.
|
|
694
|
+
|
|
695
|
+
#### Usage
|
|
696
|
+
|
|
697
|
+
```html
|
|
698
|
+
<!-- Title only -->
|
|
699
|
+
<smart-section-heading [options]="{ title: 'Applicants' }" />
|
|
700
|
+
|
|
701
|
+
<!-- Title with label -->
|
|
702
|
+
<smart-section-heading
|
|
703
|
+
[options]="{ title: 'Applicants', label: 'in Engineering' }"
|
|
704
|
+
/>
|
|
705
|
+
|
|
706
|
+
<!-- With actions -->
|
|
707
|
+
<ng-template #actions>
|
|
708
|
+
<button>Add</button>
|
|
709
|
+
</ng-template>
|
|
710
|
+
|
|
711
|
+
<smart-section-heading
|
|
712
|
+
[options]="{ title: 'Applicants', actionsTpl: actions }"
|
|
713
|
+
/>
|
|
714
|
+
|
|
715
|
+
<!-- With tabs and search -->
|
|
716
|
+
<ng-template #tabs>
|
|
717
|
+
<a>All</a>
|
|
718
|
+
</ng-template>
|
|
719
|
+
|
|
720
|
+
<ng-template #search>
|
|
721
|
+
<smart-searchbar />
|
|
722
|
+
</ng-template>
|
|
723
|
+
|
|
724
|
+
<smart-section-heading
|
|
725
|
+
[options]="{ title: 'Applicants', tabsTpl: tabs, inputGroupTpl: search }"
|
|
726
|
+
/>
|
|
727
|
+
```
|
|
728
|
+
|
|
729
|
+
#### ISectionHeadingOptions
|
|
730
|
+
|
|
731
|
+
| Property | Type | Default | Description |
|
|
732
|
+
| --------------- | ---------------------- | ------- | -------------------------------------------- |
|
|
733
|
+
| `title` | `string` | - | Heading title (rendered as `<h3>`) |
|
|
734
|
+
| `description` | `string` | - | Optional description string |
|
|
735
|
+
| `label` | `string` | - | Inline label rendered next to the title |
|
|
736
|
+
| `actionsTpl` | `TemplateRef<unknown>` | - | Actions / buttons template on the right |
|
|
737
|
+
| `tabsTpl` | `TemplateRef<unknown>` | - | Tabs template rendered below the header |
|
|
738
|
+
| `inputGroupTpl` | `TemplateRef<unknown>` | - | Input/search group template on the right |
|
|
739
|
+
| `badgeTpl` | `TemplateRef<unknown>` | - | Badge / chip template on the right |
|
|
740
|
+
|
|
741
|
+
The default `SectionHeadingStandardComponent` consumes every property; a section is rendered only when its template/string is provided.
|
|
742
|
+
|
|
743
|
+
#### Overriding with Custom Implementation
|
|
744
|
+
|
|
745
|
+
```typescript
|
|
746
|
+
import { SECTION_HEADING_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
747
|
+
|
|
748
|
+
providers: [
|
|
749
|
+
{
|
|
750
|
+
provide: SECTION_HEADING_STANDARD_COMPONENT_TOKEN,
|
|
751
|
+
useValue: MySectionHeadingComponent,
|
|
752
|
+
},
|
|
753
|
+
];
|
|
754
|
+
```
|
|
755
|
+
|
|
756
|
+
### DescriptionListBaseComponent
|
|
757
|
+
|
|
758
|
+
Abstract base class for description list components. Exposes optional `IDescriptionListOptions` and `cssClass` (alias `class`).
|
|
759
|
+
|
|
760
|
+
**Inputs:** `options` (`IDescriptionListOptions`), `class` (`string`)
|
|
761
|
+
|
|
762
|
+
### DescriptionList Component
|
|
763
|
+
|
|
764
|
+
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 is a wrapper that delegates to `DescriptionListStandardComponent` by default and supports an InjectionToken (`DESCRIPTION_LIST_STANDARD_COMPONENT_TOKEN`) to replace the default rendering with a custom implementation.
|
|
765
|
+
|
|
766
|
+
**Wrapper:** `DescriptionListComponent` (selector: `smart-description-list`)
|
|
767
|
+
**Default:** `DescriptionListStandardComponent` (selector: `smart-description-list-standard`)
|
|
768
|
+
**Token:** `DESCRIPTION_LIST_STANDARD_COMPONENT_TOKEN` — provide a `Type<DescriptionListBaseComponent>` to override the default.
|
|
769
|
+
|
|
770
|
+
#### Usage
|
|
771
|
+
|
|
772
|
+
```html
|
|
773
|
+
<!-- Title and items only -->
|
|
774
|
+
<smart-description-list
|
|
775
|
+
[options]="{
|
|
776
|
+
title: 'Applicant Information',
|
|
777
|
+
items: [
|
|
778
|
+
{ label: 'Full name', value: 'Margot Foster' },
|
|
779
|
+
{ label: 'Application for', value: 'Backend Developer' },
|
|
780
|
+
],
|
|
781
|
+
}"
|
|
782
|
+
/>
|
|
783
|
+
|
|
784
|
+
<!-- With description and templated value -->
|
|
785
|
+
<ng-template #salaryValue>
|
|
786
|
+
<strong>$120,000</strong>
|
|
787
|
+
</ng-template>
|
|
788
|
+
|
|
789
|
+
<smart-description-list
|
|
790
|
+
[options]="{
|
|
791
|
+
title: 'Applicant Information',
|
|
792
|
+
description: 'Personal details and application.',
|
|
793
|
+
items: [
|
|
794
|
+
{ label: 'Full name', value: 'Margot Foster' },
|
|
795
|
+
{ label: 'Salary expectation', valueTpl: salaryValue },
|
|
796
|
+
],
|
|
797
|
+
}"
|
|
798
|
+
/>
|
|
799
|
+
|
|
800
|
+
<!-- With per-item actions -->
|
|
801
|
+
<ng-template #updateAction>
|
|
802
|
+
<button>Update</button>
|
|
803
|
+
</ng-template>
|
|
804
|
+
|
|
805
|
+
<smart-description-list
|
|
806
|
+
[options]="{
|
|
807
|
+
title: 'Applicant Information',
|
|
808
|
+
items: [
|
|
809
|
+
{ label: 'Full name', value: 'Margot Foster', actionTpl: updateAction },
|
|
810
|
+
],
|
|
811
|
+
}"
|
|
812
|
+
/>
|
|
813
|
+
```
|
|
814
|
+
|
|
815
|
+
#### IDescriptionListOptions
|
|
816
|
+
|
|
817
|
+
| Property | Type | Default | Description |
|
|
818
|
+
| ---------------- | -------------------------- | ------- | -------------------------------------------------------- |
|
|
819
|
+
| `title` | `string` | - | Heading title (rendered as `<h3>`) |
|
|
820
|
+
| `description` | `string` | - | Optional description string |
|
|
821
|
+
| `items` | `IDescriptionListItem[]` | - | List of label/value pairs to render as `<dl>` rows |
|
|
822
|
+
| `attachmentsTpl` | `TemplateRef<unknown>` | - | Bottom attachments slot (e.g. file lists) |
|
|
823
|
+
| `footerTpl` | `TemplateRef<unknown>` | - | Bottom footer slot (e.g. download link / call to action) |
|
|
824
|
+
|
|
825
|
+
#### IDescriptionListItem
|
|
826
|
+
|
|
827
|
+
| Property | Type | Default | Description |
|
|
828
|
+
| ----------- | ---------------------- | ------- | ----------------------------------------------------------------- |
|
|
829
|
+
| `label` | `string` | - | Term shown in `<dt>` (required) |
|
|
830
|
+
| `value` | `string` | - | Static value shown in `<dd>`. Ignored when `valueTpl` is provided |
|
|
831
|
+
| `valueTpl` | `TemplateRef<unknown>` | - | Template used to render the value inside `<dd>` (overrides `value`) |
|
|
832
|
+
| `actionTpl` | `TemplateRef<unknown>` | - | Inline action template rendered in `<span class="action">` |
|
|
833
|
+
|
|
834
|
+
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.
|
|
835
|
+
|
|
836
|
+
#### Overriding with Custom Implementation
|
|
837
|
+
|
|
838
|
+
```typescript
|
|
839
|
+
import { DESCRIPTION_LIST_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
840
|
+
|
|
841
|
+
providers: [
|
|
842
|
+
{
|
|
843
|
+
provide: DESCRIPTION_LIST_STANDARD_COMPONENT_TOKEN,
|
|
844
|
+
useValue: MyDescriptionListComponent,
|
|
845
|
+
},
|
|
846
|
+
];
|
|
847
|
+
```
|
|
848
|
+
|
|
849
|
+
### CardHeadingBaseComponent
|
|
850
|
+
|
|
851
|
+
Abstract base class for card heading components. Exposes optional `ICardHeadingOptions` and `cssClass` (alias `class`).
|
|
852
|
+
|
|
853
|
+
**Inputs:** `options` (`ICardHeadingOptions`), `class` (`string`)
|
|
854
|
+
|
|
855
|
+
### CardHeading Component
|
|
856
|
+
|
|
857
|
+
The `<smart-card-heading>` component renders 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 is a wrapper that delegates to `CardHeadingStandardComponent` by default and supports an InjectionToken (`CARD_HEADING_STANDARD_COMPONENT_TOKEN`) to replace the default rendering with a custom implementation.
|
|
858
|
+
|
|
859
|
+
**Wrapper:** `CardHeadingComponent` (selector: `smart-card-heading`)
|
|
860
|
+
**Default:** `CardHeadingStandardComponent` (selector: `smart-card-heading-standard`)
|
|
861
|
+
**Token:** `CARD_HEADING_STANDARD_COMPONENT_TOKEN` — provide a `Type<CardHeadingBaseComponent>` to override the default.
|
|
862
|
+
|
|
863
|
+
#### Usage
|
|
864
|
+
|
|
865
|
+
```html
|
|
866
|
+
<!-- Title only -->
|
|
867
|
+
<smart-card-heading [options]="{ title: 'Job Postings' }" />
|
|
868
|
+
|
|
869
|
+
<!-- Title and description -->
|
|
870
|
+
<smart-card-heading
|
|
871
|
+
[options]="{ title: 'Job Postings', description: 'Currently open' }"
|
|
872
|
+
/>
|
|
873
|
+
|
|
874
|
+
<!-- With actions -->
|
|
875
|
+
<ng-template #actions>
|
|
876
|
+
<button>View all</button>
|
|
877
|
+
</ng-template>
|
|
878
|
+
|
|
879
|
+
<smart-card-heading
|
|
880
|
+
[options]="{ title: 'Job Postings', actionsTpl: actions }"
|
|
881
|
+
/>
|
|
882
|
+
```
|
|
883
|
+
|
|
884
|
+
#### ICardHeadingOptions
|
|
885
|
+
|
|
886
|
+
| Property | Type | Default | Description |
|
|
887
|
+
| ------------- | ---------------------- | ------- | -------------------------------------------- |
|
|
888
|
+
| `title` | `string` | - | Heading title (rendered as `<h3>`) |
|
|
889
|
+
| `description` | `string` | - | Optional description string |
|
|
890
|
+
| `avatarTpl` | `TemplateRef<unknown>` | - | Avatar template rendered to the left |
|
|
891
|
+
| `actionsTpl` | `TemplateRef<unknown>` | - | Actions / buttons template on the right |
|
|
892
|
+
| `metaTpl` | `TemplateRef<unknown>` | - | Meta info template under the title |
|
|
893
|
+
|
|
894
|
+
The default `CardHeadingStandardComponent` consumes every property; a section is rendered only when its template/string is provided.
|
|
895
|
+
|
|
896
|
+
#### Overriding with Custom Implementation
|
|
897
|
+
|
|
898
|
+
```typescript
|
|
899
|
+
import { CARD_HEADING_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
900
|
+
|
|
901
|
+
providers: [
|
|
902
|
+
{
|
|
903
|
+
provide: CARD_HEADING_STANDARD_COMPONENT_TOKEN,
|
|
904
|
+
useValue: MyCardHeadingComponent,
|
|
905
|
+
},
|
|
906
|
+
];
|
|
71
907
|
```
|
|
72
908
|
|
|
73
|
-
###
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
909
|
+
### PageHeadingBaseComponent
|
|
910
|
+
|
|
911
|
+
Abstract base class for page heading components. Exposes optional `IPageHeadingOptions` and `cssClass` (alias `class`).
|
|
912
|
+
|
|
913
|
+
**Inputs:** `options` (`IPageHeadingOptions`), `class` (`string`)
|
|
914
|
+
|
|
915
|
+
### PageHeading Component
|
|
916
|
+
|
|
917
|
+
The `<smart-page-heading>` component renders a composable page heading region with optional slots for breadcrumbs, banner image, avatar, logo, title, subtitle, meta, stats, actions, and filters. It is independent of `<smart-page>` and can be used standalone or inside any layout. It is a wrapper that delegates to `PageHeadingStandardComponent` by default and supports an InjectionToken (`PAGE_HEADING_STANDARD_COMPONENT_TOKEN`) to replace the default rendering with a custom implementation.
|
|
918
|
+
|
|
919
|
+
**Wrapper:** `PageHeadingComponent` (selector: `smart-page-heading`)
|
|
920
|
+
**Default:** `PageHeadingStandardComponent` (selector: `smart-page-heading-standard`)
|
|
921
|
+
**Token:** `PAGE_HEADING_STANDARD_COMPONENT_TOKEN` — provide a `Type<PageHeadingBaseComponent>` to override the default.
|
|
922
|
+
|
|
923
|
+
#### Usage
|
|
924
|
+
|
|
925
|
+
```html
|
|
926
|
+
<!-- Title only -->
|
|
927
|
+
<smart-page-heading [options]="{ title: 'Back End Developer' }" />
|
|
928
|
+
|
|
929
|
+
<!-- With actions -->
|
|
930
|
+
<ng-template #actions>
|
|
931
|
+
<button>Edit</button>
|
|
932
|
+
</ng-template>
|
|
933
|
+
|
|
934
|
+
<smart-page-heading
|
|
935
|
+
[options]="{ title: 'Back End Developer', actionsTpl: actions }"
|
|
936
|
+
/>
|
|
937
|
+
|
|
938
|
+
<!-- With breadcrumbs, meta and avatar -->
|
|
939
|
+
<ng-template #crumbs>
|
|
940
|
+
<a routerLink="/jobs">Jobs</a>
|
|
941
|
+
</ng-template>
|
|
942
|
+
|
|
943
|
+
<ng-template #meta>
|
|
944
|
+
<span>Full-time</span>
|
|
945
|
+
</ng-template>
|
|
946
|
+
|
|
947
|
+
<ng-template #avatar>
|
|
948
|
+
<img src="avatar.jpg" alt="" />
|
|
949
|
+
</ng-template>
|
|
950
|
+
|
|
951
|
+
<smart-page-heading
|
|
952
|
+
[options]="{
|
|
953
|
+
title: 'Back End Developer',
|
|
954
|
+
subtitle: 'Engineering',
|
|
955
|
+
breadcrumbsTpl: crumbs,
|
|
956
|
+
metaTpl: meta,
|
|
957
|
+
avatarTpl: avatar,
|
|
958
|
+
}"
|
|
959
|
+
/>
|
|
960
|
+
```
|
|
961
|
+
|
|
962
|
+
#### IPageHeadingOptions
|
|
963
|
+
|
|
964
|
+
| Property | Type | Default | Description |
|
|
965
|
+
| ---------------- | ---------------------- | ------- | -------------------------------------------- |
|
|
966
|
+
| `title` | `string` | - | Heading title (rendered as `<h1>`) |
|
|
967
|
+
| `subtitle` | `string` | - | Subtitle string |
|
|
968
|
+
| `breadcrumbsTpl` | `TemplateRef<unknown>` | - | Breadcrumb navigation template |
|
|
969
|
+
| `metaTpl` | `TemplateRef<unknown>` | - | Meta tags / labels template |
|
|
970
|
+
| `avatarTpl` | `TemplateRef<unknown>` | - | User/profile avatar template |
|
|
971
|
+
| `bannerTpl` | `TemplateRef<unknown>` | - | Banner image template |
|
|
972
|
+
| `actionsTpl` | `TemplateRef<unknown>` | - | Actions / button group template |
|
|
973
|
+
| `statsTpl` | `TemplateRef<unknown>` | - | Stats list template |
|
|
974
|
+
| `logoTpl` | `TemplateRef<unknown>` | - | Organization logo template |
|
|
975
|
+
| `filtersTpl` | `TemplateRef<unknown>` | - | Filters / chips template |
|
|
976
|
+
|
|
977
|
+
The default `PageHeadingStandardComponent` consumes every property and renders a slot only when its corresponding template/string is provided.
|
|
978
|
+
|
|
979
|
+
#### Overriding with Custom Implementation
|
|
980
|
+
|
|
981
|
+
```typescript
|
|
982
|
+
import { PAGE_HEADING_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
983
|
+
|
|
984
|
+
providers: [
|
|
985
|
+
{
|
|
986
|
+
provide: PAGE_HEADING_STANDARD_COMPONENT_TOKEN,
|
|
987
|
+
useValue: MyPageHeadingComponent,
|
|
988
|
+
},
|
|
989
|
+
];
|
|
990
|
+
```
|
|
991
|
+
|
|
992
|
+
### MultiColumnLayoutBaseComponent
|
|
993
|
+
|
|
994
|
+
Abstract base class for multi-column layout components. Exposes optional `IMultiColumnLayoutOptions` and `cssClass` (alias `class`).
|
|
995
|
+
|
|
996
|
+
**Inputs:** `options` (`IMultiColumnLayoutOptions`), `class` (`string`)
|
|
997
|
+
|
|
998
|
+
### MultiColumnLayout Component
|
|
999
|
+
|
|
1000
|
+
The `<smart-multi-column-layout>` component renders a three-column application shell — a left navigation `<aside>`, a main content region, and a right secondary `<aside>`, with an optional top header. It is a wrapper that delegates to `MultiColumnLayoutStandardComponent` by default and supports an InjectionToken (`MULTI_COLUMN_LAYOUT_STANDARD_COMPONENT_TOKEN`) to replace the default rendering with a custom implementation.
|
|
1001
|
+
|
|
1002
|
+
**Wrapper:** `MultiColumnLayoutComponent` (selector: `smart-multi-column-layout`)
|
|
1003
|
+
**Default:** `MultiColumnLayoutStandardComponent` (selector: `smart-multi-column-layout-standard`)
|
|
1004
|
+
**Token:** `MULTI_COLUMN_LAYOUT_STANDARD_COMPONENT_TOKEN` — provide a `Type<MultiColumnLayoutBaseComponent>` to override the default.
|
|
1005
|
+
|
|
1006
|
+
#### Usage
|
|
1007
|
+
|
|
1008
|
+
```html
|
|
1009
|
+
<!-- Basic with main content -->
|
|
1010
|
+
<smart-multi-column-layout>
|
|
1011
|
+
<h1>Hello</h1>
|
|
1012
|
+
</smart-multi-column-layout>
|
|
1013
|
+
|
|
1014
|
+
<!-- With nav and secondary -->
|
|
1015
|
+
<ng-template #nav>
|
|
1016
|
+
<a routerLink="/">Inbox</a>
|
|
1017
|
+
</ng-template>
|
|
1018
|
+
|
|
1019
|
+
<ng-template #secondary>
|
|
1020
|
+
<p>Filters</p>
|
|
1021
|
+
</ng-template>
|
|
1022
|
+
|
|
1023
|
+
<smart-multi-column-layout
|
|
1024
|
+
[options]="{ navTpl: nav, secondaryTpl: secondary }"
|
|
1025
|
+
>
|
|
1026
|
+
<p>Email content</p>
|
|
1027
|
+
</smart-multi-column-layout>
|
|
1028
|
+
|
|
1029
|
+
<!-- With top header -->
|
|
1030
|
+
<ng-template #header>
|
|
1031
|
+
<h1>Inbox</h1>
|
|
1032
|
+
</ng-template>
|
|
1033
|
+
|
|
1034
|
+
<smart-multi-column-layout
|
|
1035
|
+
[options]="{ navTpl: nav, secondaryTpl: secondary, headerTpl: header }"
|
|
1036
|
+
>
|
|
1037
|
+
<p>Email content</p>
|
|
1038
|
+
</smart-multi-column-layout>
|
|
1039
|
+
```
|
|
1040
|
+
|
|
1041
|
+
#### IMultiColumnLayoutOptions
|
|
1042
|
+
|
|
1043
|
+
| Property | Type | Default | Description |
|
|
1044
|
+
| ---------------- | ----------------------------- | ------- | ------------------------------------------------------------ |
|
|
1045
|
+
| `title` | `string` | - | Optional layout title |
|
|
1046
|
+
| `navTpl` | `TemplateRef<unknown>` | - | Template projected into the left `<aside class="nav">` |
|
|
1047
|
+
| `secondaryTpl` | `TemplateRef<unknown>` | - | Template projected into the right `<aside class="secondary">`|
|
|
1048
|
+
| `headerTpl` | `TemplateRef<unknown>` | - | Template projected into a top `<header>` block |
|
|
1049
|
+
| `width` | `'full' \| 'constrained'` | - | Hint for max-width container size used by custom variants |
|
|
1050
|
+
| `secondaryWidth` | `'sm' \| 'md' \| 'lg'` | - | Hint for secondary column width used by custom variants |
|
|
1051
|
+
|
|
1052
|
+
The default `MultiColumnLayoutStandardComponent` consumes `navTpl`, `secondaryTpl`, and `headerTpl`. `title`, `width`, and `secondaryWidth` are intended for custom implementations registered via `MULTI_COLUMN_LAYOUT_STANDARD_COMPONENT_TOKEN`.
|
|
1053
|
+
|
|
1054
|
+
#### Overriding with Custom Implementation
|
|
1055
|
+
|
|
1056
|
+
```typescript
|
|
1057
|
+
import { MULTI_COLUMN_LAYOUT_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
1058
|
+
|
|
1059
|
+
providers: [
|
|
1060
|
+
{
|
|
1061
|
+
provide: MULTI_COLUMN_LAYOUT_STANDARD_COMPONENT_TOKEN,
|
|
1062
|
+
useValue: MyMultiColumnLayoutComponent,
|
|
1063
|
+
},
|
|
1064
|
+
];
|
|
1065
|
+
```
|
|
1066
|
+
|
|
1067
|
+
### SidebarLayoutBaseComponent
|
|
1068
|
+
|
|
1069
|
+
Abstract base class for sidebar layout components. Exposes optional `ISidebarLayoutOptions` and `cssClass` (alias `class`).
|
|
1070
|
+
|
|
1071
|
+
**Inputs:** `options` (`ISidebarLayoutOptions`), `class` (`string`)
|
|
1072
|
+
|
|
1073
|
+
### SidebarLayout Component
|
|
1074
|
+
|
|
1075
|
+
The `<smart-sidebar-layout>` component renders a two-column application shell with a sidebar (left or right) and a main content region, plus an optional top header. It is a wrapper that delegates to `SidebarLayoutStandardComponent` by default and supports an InjectionToken (`SIDEBAR_LAYOUT_STANDARD_COMPONENT_TOKEN`) to replace the default rendering with a custom implementation.
|
|
1076
|
+
|
|
1077
|
+
**Wrapper:** `SidebarLayoutComponent` (selector: `smart-sidebar-layout`)
|
|
1078
|
+
**Default:** `SidebarLayoutStandardComponent` (selector: `smart-sidebar-layout-standard`)
|
|
1079
|
+
**Token:** `SIDEBAR_LAYOUT_STANDARD_COMPONENT_TOKEN` — provide a `Type<SidebarLayoutBaseComponent>` to override the default.
|
|
1080
|
+
|
|
1081
|
+
#### Usage
|
|
1082
|
+
|
|
1083
|
+
```html
|
|
1084
|
+
<!-- Basic with main content -->
|
|
1085
|
+
<smart-sidebar-layout>
|
|
1086
|
+
<h1>Hello</h1>
|
|
1087
|
+
</smart-sidebar-layout>
|
|
1088
|
+
|
|
1089
|
+
<!-- With sidebar template -->
|
|
1090
|
+
<ng-template #sidebar>
|
|
1091
|
+
<a routerLink="/">Dashboard</a>
|
|
1092
|
+
</ng-template>
|
|
1093
|
+
|
|
1094
|
+
<smart-sidebar-layout [options]="{ sidebarTpl: sidebar }">
|
|
1095
|
+
<p>Main content</p>
|
|
1096
|
+
</smart-sidebar-layout>
|
|
1097
|
+
|
|
1098
|
+
<!-- Right-positioned sidebar -->
|
|
1099
|
+
<smart-sidebar-layout
|
|
1100
|
+
[options]="{ sidebarTpl: sidebar, sidebarPosition: 'right' }"
|
|
1101
|
+
>
|
|
1102
|
+
<p>Main content</p>
|
|
1103
|
+
</smart-sidebar-layout>
|
|
1104
|
+
|
|
1105
|
+
<!-- With top header -->
|
|
1106
|
+
<ng-template #header>
|
|
1107
|
+
<h1>Dashboard</h1>
|
|
1108
|
+
</ng-template>
|
|
1109
|
+
|
|
1110
|
+
<smart-sidebar-layout [options]="{ sidebarTpl: sidebar, headerTpl: header }">
|
|
1111
|
+
<p>Main content</p>
|
|
1112
|
+
</smart-sidebar-layout>
|
|
1113
|
+
```
|
|
1114
|
+
|
|
1115
|
+
#### ISidebarLayoutOptions
|
|
1116
|
+
|
|
1117
|
+
| Property | Type | Default | Description |
|
|
1118
|
+
| ------------------ | ----------------------------- | -------- | ------------------------------------------------------------ |
|
|
1119
|
+
| `title` | `string` | - | Optional layout title |
|
|
1120
|
+
| `sidebarTpl` | `TemplateRef<unknown>` | - | Template projected into the `<aside>` region |
|
|
1121
|
+
| `headerTpl` | `TemplateRef<unknown>` | - | Template projected into a top `<header>` block |
|
|
1122
|
+
| `sidebarPosition` | `'left' \| 'right'` | `'left'` | Sidebar position relative to main content |
|
|
1123
|
+
| `mobileBreakpoint` | `'sm' \| 'md' \| 'lg'` | - | Hint for the breakpoint at which sidebar collapses to drawer |
|
|
1124
|
+
| `condensed` | `boolean` | - | Hint for compact (rail) sidebar variant |
|
|
1125
|
+
|
|
1126
|
+
The default `SidebarLayoutStandardComponent` consumes `sidebarTpl`, `headerTpl`, and `sidebarPosition`. `title`, `mobileBreakpoint`, and `condensed` are intended for custom implementations registered via `SIDEBAR_LAYOUT_STANDARD_COMPONENT_TOKEN`.
|
|
1127
|
+
|
|
1128
|
+
#### Overriding with Custom Implementation
|
|
1129
|
+
|
|
1130
|
+
```typescript
|
|
1131
|
+
import { SIDEBAR_LAYOUT_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
1132
|
+
|
|
1133
|
+
providers: [
|
|
1134
|
+
{
|
|
1135
|
+
provide: SIDEBAR_LAYOUT_STANDARD_COMPONENT_TOKEN,
|
|
1136
|
+
useValue: MySidebarLayoutComponent,
|
|
1137
|
+
},
|
|
1138
|
+
];
|
|
1139
|
+
```
|
|
1140
|
+
|
|
1141
|
+
### SidebarNavigationBaseComponent
|
|
1142
|
+
|
|
1143
|
+
Abstract base class for sidebar navigation components. Exposes optional `ISidebarNavOptions` and `cssClass` (alias `class`).
|
|
1144
|
+
|
|
1145
|
+
**Inputs:** `options` (`ISidebarNavOptions`), `class` (`string`)
|
|
1146
|
+
**Outputs:** `itemClick` (`ISidebarNavItemClick`), `itemToggle` (`ISidebarNavItemToggle`)
|
|
1147
|
+
|
|
1148
|
+
### SidebarNavigation Component
|
|
1149
|
+
|
|
1150
|
+
The `<smart-sidebar-navigation>` component renders an application sidebar with optional logo, vertical navigation groups, expandable sub-sections, and a profile footer. It is a wrapper that delegates to `SidebarNavigationStandardComponent` by default and supports an InjectionToken (`SIDEBAR_NAVIGATION_STANDARD_COMPONENT_TOKEN`) to replace the default rendering with a custom implementation.
|
|
1151
|
+
|
|
1152
|
+
**Wrapper:** `SidebarNavigationComponent` (selector: `smart-sidebar-navigation`)
|
|
1153
|
+
**Default:** `SidebarNavigationStandardComponent` (selector: `smart-sidebar-navigation-standard`)
|
|
1154
|
+
**Token:** `SIDEBAR_NAVIGATION_STANDARD_COMPONENT_TOKEN` — provide a `Type<SidebarNavigationBaseComponent>` to override the default.
|
|
1155
|
+
|
|
1156
|
+
#### Usage
|
|
1157
|
+
|
|
1158
|
+
```html
|
|
1159
|
+
<!-- Flat list with logo and profile -->
|
|
1160
|
+
<smart-sidebar-navigation
|
|
1161
|
+
[options]="{
|
|
1162
|
+
logo: { url: '/logo.svg', alt: 'Acme' },
|
|
1163
|
+
items: [
|
|
1164
|
+
{ id: 'dashboard', label: 'Dashboard', href: '/', current: true, badge: 5 },
|
|
1165
|
+
{ id: 'team', label: 'Team', href: '/team' },
|
|
1166
|
+
],
|
|
1167
|
+
profile: { name: 'Tom Cook', avatarUrl: '/avatar.jpg', href: '/me' },
|
|
1168
|
+
}"
|
|
1169
|
+
/>
|
|
1170
|
+
|
|
1171
|
+
<!-- With expandable sections -->
|
|
1172
|
+
<smart-sidebar-navigation
|
|
1173
|
+
[options]="{
|
|
1174
|
+
items: [
|
|
1175
|
+
{ id: 'dashboard', label: 'Dashboard', href: '/' },
|
|
1176
|
+
{
|
|
1177
|
+
id: 'teams',
|
|
1178
|
+
label: 'Teams',
|
|
1179
|
+
expandable: true,
|
|
1180
|
+
children: [{ id: 'eng', label: 'Engineering', href: '/eng' }],
|
|
1181
|
+
},
|
|
1182
|
+
],
|
|
1183
|
+
}"
|
|
1184
|
+
(itemToggle)="onToggle($event)"
|
|
1185
|
+
/>
|
|
1186
|
+
```
|
|
1187
|
+
|
|
1188
|
+
#### ISidebarNavOptions
|
|
1189
|
+
|
|
1190
|
+
| Property | Type | Default | Description |
|
|
1191
|
+
| ----------- | -------------------------------------- | ------- | ---------------------------------------------------------- |
|
|
1192
|
+
| `layout` | `SmartSidebarNavLayout` | - | Visual variant (`light`, `dark`, `brand`, etc.) |
|
|
1193
|
+
| `ariaLabel` | `string` | - | Aria label on `<nav>` (defaults to `"Sidebar"`) |
|
|
1194
|
+
| `logo` | `ISidebarNavLogo` | - | Optional top logo (image, dark variant, link, or template) |
|
|
1195
|
+
| `items` | `ISidebarNavItem[]` | - | Top-level items (rendered as a leading anonymous group) |
|
|
1196
|
+
| `groups` | `ISidebarNavGroup[]` | - | Named groups with optional title |
|
|
1197
|
+
| `profile` | `ISidebarNavProfile` | - | Optional profile footer (avatar + name + href) |
|
|
1198
|
+
|
|
1199
|
+
`ISidebarNavItem` supports `id`, `label`, `href`, `current`, `badge`, `iconTpl`, `initial` (for team-style entries), `expandable`, `expanded`, and `children`. When `expandable` is `true`, the item renders as a toggle button with collapsible `children`.
|
|
1200
|
+
|
|
1201
|
+
#### Overriding with Custom Implementation
|
|
1202
|
+
|
|
1203
|
+
```typescript
|
|
1204
|
+
import { SIDEBAR_NAVIGATION_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
1205
|
+
|
|
1206
|
+
providers: [
|
|
1207
|
+
{
|
|
1208
|
+
provide: SIDEBAR_NAVIGATION_STANDARD_COMPONENT_TOKEN,
|
|
1209
|
+
useValue: MySidebarNavigationComponent,
|
|
1210
|
+
},
|
|
1211
|
+
];
|
|
1212
|
+
```
|
|
1213
|
+
|
|
1214
|
+
### StackedLayoutBaseComponent
|
|
1215
|
+
|
|
1216
|
+
Abstract base class for stacked layout components. Exposes optional `IStackedLayoutOptions` and `cssClass` (alias `class`).
|
|
1217
|
+
|
|
1218
|
+
**Inputs:** `options` (`IStackedLayoutOptions`), `class` (`string`)
|
|
1219
|
+
|
|
1220
|
+
### StackedLayout Component
|
|
1221
|
+
|
|
1222
|
+
The `<smart-stacked-layout>` component renders a top-to-bottom application shell with a top navigation bar, an optional page header section, and a main content region. It is a wrapper that delegates to `StackedLayoutStandardComponent` by default and supports an InjectionToken (`STACKED_LAYOUT_STANDARD_COMPONENT_TOKEN`) to replace the default rendering with a custom implementation.
|
|
1223
|
+
|
|
1224
|
+
**Wrapper:** `StackedLayoutComponent` (selector: `smart-stacked-layout`)
|
|
1225
|
+
**Default:** `StackedLayoutStandardComponent` (selector: `smart-stacked-layout-standard`)
|
|
1226
|
+
**Token:** `STACKED_LAYOUT_STANDARD_COMPONENT_TOKEN` — provide a `Type<StackedLayoutBaseComponent>` to override the default.
|
|
1227
|
+
|
|
1228
|
+
#### Usage
|
|
1229
|
+
|
|
1230
|
+
```html
|
|
1231
|
+
<!-- Basic with main content -->
|
|
1232
|
+
<smart-stacked-layout>
|
|
1233
|
+
<h1>Hello</h1>
|
|
1234
|
+
</smart-stacked-layout>
|
|
1235
|
+
|
|
1236
|
+
<!-- With navigation template -->
|
|
1237
|
+
<ng-template #nav>
|
|
1238
|
+
<a routerLink="/">Dashboard</a>
|
|
1239
|
+
</ng-template>
|
|
1240
|
+
|
|
1241
|
+
<smart-stacked-layout [options]="{ navTpl: nav }">
|
|
1242
|
+
<p>Main content</p>
|
|
1243
|
+
</smart-stacked-layout>
|
|
1244
|
+
|
|
1245
|
+
<!-- With page header -->
|
|
1246
|
+
<ng-template #header>
|
|
1247
|
+
<h1>Dashboard</h1>
|
|
1248
|
+
</ng-template>
|
|
1249
|
+
|
|
1250
|
+
<smart-stacked-layout [options]="{ navTpl: nav, headerTpl: header }">
|
|
1251
|
+
<p>Main content</p>
|
|
1252
|
+
</smart-stacked-layout>
|
|
1253
|
+
|
|
1254
|
+
<!-- With external class -->
|
|
1255
|
+
<smart-stacked-layout class="smart:bg-gray-50">
|
|
1256
|
+
<p>Main content</p>
|
|
1257
|
+
</smart-stacked-layout>
|
|
1258
|
+
```
|
|
1259
|
+
|
|
1260
|
+
#### IStackedLayoutOptions
|
|
1261
|
+
|
|
1262
|
+
| Property | Type | Default | Description |
|
|
1263
|
+
| ---------------- | ------------------------------------ | ------- | ------------------------------------------------------------- |
|
|
1264
|
+
| `title` | `string` | - | Optional layout title |
|
|
1265
|
+
| `navTpl` | `TemplateRef<unknown>` | - | Template projected into the top `<nav>` |
|
|
1266
|
+
| `headerTpl` | `TemplateRef<unknown>` | - | Template projected into a secondary `<header>` block |
|
|
1267
|
+
| `containerWidth` | `'sm' \| 'md' \| 'lg' \| 'xl' \| 'full'` | - | Hint for max-width container size used by custom variants |
|
|
1268
|
+
|
|
1269
|
+
The default `StackedLayoutStandardComponent` consumes `navTpl` and `headerTpl`. `title` and `containerWidth` are intended for custom implementations registered via `STACKED_LAYOUT_STANDARD_COMPONENT_TOKEN`.
|
|
1270
|
+
|
|
1271
|
+
#### Overriding with Custom Implementation
|
|
1272
|
+
|
|
1273
|
+
```typescript
|
|
1274
|
+
import { STACKED_LAYOUT_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
1275
|
+
|
|
1276
|
+
providers: [
|
|
1277
|
+
{
|
|
1278
|
+
provide: STACKED_LAYOUT_STANDARD_COMPONENT_TOKEN,
|
|
1279
|
+
useValue: MyStackedLayoutComponent,
|
|
1280
|
+
},
|
|
1281
|
+
];
|
|
1282
|
+
```
|
|
1283
|
+
|
|
1284
|
+
### StackedListBaseComponent
|
|
1285
|
+
|
|
1286
|
+
Abstract base class for stacked list components. Exposes optional `IStackedListOptions` and `cssClass` (alias `class`).
|
|
1287
|
+
|
|
1288
|
+
**Inputs:** `options` (`IStackedListOptions`), `class` (`string`)
|
|
1289
|
+
|
|
1290
|
+
### StackedList Component
|
|
1291
|
+
|
|
1292
|
+
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 is a wrapper that delegates to `StackedListStandardComponent` by default and supports an InjectionToken (`STACKED_LIST_STANDARD_COMPONENT_TOKEN`) to replace the default rendering with a custom implementation.
|
|
1293
|
+
|
|
1294
|
+
**Wrapper:** `StackedListComponent` (selector: `smart-stacked-list`)
|
|
1295
|
+
**Default:** `StackedListStandardComponent` (selector: `smart-stacked-list-standard`)
|
|
1296
|
+
**Token:** `STACKED_LIST_STANDARD_COMPONENT_TOKEN` — provide a `Type<StackedListBaseComponent>` to override the default.
|
|
1297
|
+
|
|
1298
|
+
#### Usage
|
|
1299
|
+
|
|
1300
|
+
```html
|
|
1301
|
+
<!-- Title and items only -->
|
|
1302
|
+
<smart-stacked-list
|
|
1303
|
+
[options]="{
|
|
1304
|
+
title: 'Team members',
|
|
1305
|
+
items: [
|
|
1306
|
+
{ id: '1', title: 'Lindsay Walton', description: 'Front-end Developer' },
|
|
1307
|
+
{ id: '2', title: 'Courtney Henry', description: 'Designer' },
|
|
1308
|
+
{ id: '3', title: 'Tom Cook', description: 'Director, Product' },
|
|
1309
|
+
],
|
|
1310
|
+
}"
|
|
1311
|
+
/>
|
|
1312
|
+
|
|
1313
|
+
<!-- With description and links -->
|
|
1314
|
+
<smart-stacked-list
|
|
1315
|
+
[options]="{
|
|
1316
|
+
title: 'Recent files',
|
|
1317
|
+
description: 'Files updated in the last week.',
|
|
1318
|
+
items: [
|
|
1319
|
+
{ title: 'Annual report 2025.pdf', href: '/files/annual-report' },
|
|
1320
|
+
{ title: 'Brand guidelines.pdf', href: '/files/brand-guidelines' },
|
|
1321
|
+
],
|
|
1322
|
+
}"
|
|
1323
|
+
/>
|
|
1324
|
+
|
|
1325
|
+
<!-- With avatars, meta and badge slot -->
|
|
1326
|
+
<ng-template #activeBadge>
|
|
1327
|
+
<span class="badge-active">Active</span>
|
|
1328
|
+
</ng-template>
|
|
1329
|
+
|
|
1330
|
+
<smart-stacked-list
|
|
1331
|
+
[options]="{
|
|
1332
|
+
title: 'Team members',
|
|
1333
|
+
items: [
|
|
1334
|
+
{
|
|
1335
|
+
title: 'Lindsay Walton',
|
|
1336
|
+
description: 'Front-end Developer',
|
|
1337
|
+
meta: 'Joined 2026-01-12',
|
|
1338
|
+
avatarUrl: '/img/lindsay.jpg',
|
|
1339
|
+
badgeTpl: activeBadge,
|
|
1340
|
+
},
|
|
1341
|
+
],
|
|
1342
|
+
}"
|
|
1343
|
+
/>
|
|
1344
|
+
|
|
1345
|
+
<!-- With per-item action and footer slot -->
|
|
1346
|
+
<ng-template #removeAction>
|
|
1347
|
+
<button>Remove</button>
|
|
1348
|
+
</ng-template>
|
|
1349
|
+
|
|
1350
|
+
<ng-template #footer>
|
|
1351
|
+
<a href="#">Load more →</a>
|
|
1352
|
+
</ng-template>
|
|
1353
|
+
|
|
1354
|
+
<smart-stacked-list
|
|
1355
|
+
[options]="{
|
|
1356
|
+
title: 'Team members',
|
|
1357
|
+
items: [
|
|
1358
|
+
{ title: 'Lindsay Walton', actionTpl: removeAction },
|
|
1359
|
+
{ title: 'Courtney Henry', actionTpl: removeAction },
|
|
1360
|
+
],
|
|
1361
|
+
footerTpl: footer,
|
|
1362
|
+
}"
|
|
1363
|
+
/>
|
|
1364
|
+
```
|
|
1365
|
+
|
|
1366
|
+
#### IStackedListOptions
|
|
1367
|
+
|
|
1368
|
+
| Property | Type | Default | Description |
|
|
1369
|
+
| ------------------- | -------------------------- | ------- | ---------------------------------------------------------- |
|
|
1370
|
+
| `title` | `string` | - | Optional list title rendered as `<h3 class="title">` |
|
|
1371
|
+
| `description` | `string` | - | Optional description rendered as `<p class="description">` |
|
|
1372
|
+
| `items` | `IStackedListItem[]` | - | List entries to render as `<li class="item">` |
|
|
1373
|
+
| `withDividers` | `boolean` | - | Hint for custom impls: render dividers between items |
|
|
1374
|
+
| `fullWidthOnMobile` | `boolean` | - | Hint for custom impls: stretch the list edge-to-edge |
|
|
1375
|
+
| `emptyTpl` | `TemplateRef<unknown>` | - | Template rendered when items is empty |
|
|
1376
|
+
| `footerTpl` | `TemplateRef<unknown>` | - | Bottom footer slot |
|
|
1377
|
+
|
|
1378
|
+
#### IStackedListItem
|
|
1379
|
+
|
|
1380
|
+
| Property | Type | Default | Description |
|
|
1381
|
+
| ------------- | ---------------------- | ------- | -------------------------------------------------------- |
|
|
1382
|
+
| `id` | `string` | - | Optional stable id used as track key |
|
|
1383
|
+
| `title` | `string` | - | **Required** title text |
|
|
1384
|
+
| `description` | `string` | - | Optional secondary line |
|
|
1385
|
+
| `meta` | `string` | - | Optional tertiary line (e.g. timestamp) |
|
|
1386
|
+
| `avatarUrl` | `string` | - | Avatar image URL (rendered as `<img class="avatar">`) |
|
|
1387
|
+
| `iconTpl` | `TemplateRef<unknown>` | - | Custom icon template (takes precedence over `avatarUrl`) |
|
|
1388
|
+
| `href` | `string` | - | When set, title is rendered as `<a class="title">` |
|
|
1389
|
+
| `badgeTpl` | `TemplateRef<unknown>` | - | Badge slot rendered next to the body |
|
|
1390
|
+
| `actionTpl` | `TemplateRef<unknown>` | - | Trailing action slot (e.g. button) |
|
|
1391
|
+
| `ariaLabel` | `string` | - | Accessible label rendered on the `<li>` |
|
|
1392
|
+
|
|
1393
|
+
The default `StackedListStandardComponent` consumes every property; a section is rendered only when its template/string is provided. Within an item, `iconTpl` takes precedence over `avatarUrl` when both are set.
|
|
1394
|
+
|
|
1395
|
+
#### Overriding with Custom Implementation
|
|
1396
|
+
|
|
1397
|
+
```typescript
|
|
1398
|
+
import { STACKED_LIST_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
1399
|
+
|
|
1400
|
+
providers: [
|
|
1401
|
+
{
|
|
1402
|
+
provide: STACKED_LIST_STANDARD_COMPONENT_TOKEN,
|
|
1403
|
+
useValue: MyStackedListComponent,
|
|
1404
|
+
},
|
|
1405
|
+
];
|
|
1406
|
+
```
|
|
1407
|
+
|
|
1408
|
+
### StatsBaseComponent
|
|
1409
|
+
|
|
1410
|
+
Abstract base class for stats components. Exposes optional `IStatsOptions` and `cssClass` (alias `class`).
|
|
1411
|
+
|
|
1412
|
+
**Inputs:** `options` (`IStatsOptions`), `class` (`string`)
|
|
1413
|
+
|
|
1414
|
+
### Stats Component
|
|
1415
|
+
|
|
1416
|
+
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 is a wrapper that delegates to `StatsStandardComponent` by default and supports an InjectionToken (`STATS_STANDARD_COMPONENT_TOKEN`) to replace the default rendering with a custom implementation.
|
|
1417
|
+
|
|
1418
|
+
**Wrapper:** `StatsComponent` (selector: `smart-stats`)
|
|
1419
|
+
**Default:** `StatsStandardComponent` (selector: `smart-stats-standard`)
|
|
1420
|
+
**Token:** `STATS_STANDARD_COMPONENT_TOKEN` — provide a `Type<StatsBaseComponent>` to override the default.
|
|
1421
|
+
|
|
1422
|
+
#### Usage
|
|
1423
|
+
|
|
1424
|
+
```html
|
|
1425
|
+
<!-- Simple stats -->
|
|
1426
|
+
<smart-stats
|
|
1427
|
+
[options]="{
|
|
1428
|
+
items: [
|
|
1429
|
+
{ label: 'Number of deploys', value: 405 },
|
|
1430
|
+
{ label: 'Average deploy time', value: '3.65 mins' },
|
|
1431
|
+
{ label: 'Success rate', value: '98.5%' },
|
|
1432
|
+
],
|
|
1433
|
+
}"
|
|
1434
|
+
/>
|
|
1435
|
+
|
|
1436
|
+
<!-- With title and trending changes -->
|
|
1437
|
+
<smart-stats
|
|
1438
|
+
[options]="{
|
|
1439
|
+
title: 'Last 30 days',
|
|
1440
|
+
items: [
|
|
1441
|
+
{ label: 'Revenue', value: '$405,091', change: '+4.75%', trend: 'up' },
|
|
1442
|
+
{ label: 'Overdue invoices', value: '$12,787', change: '+54.02%', trend: 'down' },
|
|
1443
|
+
],
|
|
1444
|
+
}"
|
|
1445
|
+
/>
|
|
1446
|
+
|
|
1447
|
+
<!-- With previous value -->
|
|
1448
|
+
<smart-stats
|
|
1449
|
+
[options]="{
|
|
1450
|
+
title: 'Last 30 days',
|
|
1451
|
+
items: [
|
|
1452
|
+
{ label: 'Total Subscribers', value: '71,897', previousValue: '70,946', change: '+12%', trend: 'up' },
|
|
1453
|
+
],
|
|
1454
|
+
}"
|
|
1455
|
+
/>
|
|
1456
|
+
|
|
1457
|
+
<!-- With icon and action slots -->
|
|
1458
|
+
<ng-template #icon>
|
|
1459
|
+
<svg viewBox="0 0 24 24"><!-- ... --></svg>
|
|
1460
|
+
</ng-template>
|
|
1461
|
+
|
|
1462
|
+
<ng-template #viewAll>
|
|
1463
|
+
<a href="#">View all</a>
|
|
1464
|
+
</ng-template>
|
|
1465
|
+
|
|
1466
|
+
<smart-stats
|
|
1467
|
+
[options]="{
|
|
1468
|
+
items: [
|
|
1469
|
+
{ label: 'Total Subscribers', value: '71,897', iconTpl: icon, actionTpl: viewAll },
|
|
1470
|
+
],
|
|
1471
|
+
}"
|
|
1472
|
+
/>
|
|
1473
|
+
```
|
|
1474
|
+
|
|
1475
|
+
#### IStatsOptions
|
|
1476
|
+
|
|
1477
|
+
| Property | Type | Default | Description |
|
|
1478
|
+
| --------- | ---------------- | ------- | ---------------------------------------------------------- |
|
|
1479
|
+
| `title` | `string` | - | Optional heading rendered above the items |
|
|
1480
|
+
| `items` | `IStatItem[]` | — | Required array of stat items |
|
|
1481
|
+
| `columns` | `1 \| 2 \| 3 \| 4` | - | Layout hint for custom implementations (ignored by default) |
|
|
1482
|
+
|
|
1483
|
+
#### IStatItem
|
|
1484
|
+
|
|
1485
|
+
| Property | Type | Default | Description |
|
|
1486
|
+
| --------------- | ----------------------------------- | ------- | ------------------------------------------------------------------------ |
|
|
1487
|
+
| `label` | `string` | - | Term shown in `<dt>` (required) |
|
|
1488
|
+
| `value` | `string \| number` | - | Value shown in `<dd class="value">` (required) |
|
|
1489
|
+
| `previousValue` | `string \| number` | - | Optional previous value shown in `<dd class="previous">` |
|
|
1490
|
+
| `change` | `string` | - | Optional change indicator (e.g. `'+4.75%'`) |
|
|
1491
|
+
| `trend` | `'up' \| 'down' \| 'neutral'` | - | Trend exposed as `data-trend` attribute on `<dd class="change">` |
|
|
1492
|
+
| `iconTpl` | `TemplateRef<unknown>` | - | Icon template rendered in `<div class="icon">` |
|
|
1493
|
+
| `actionTpl` | `TemplateRef<unknown>` | - | Action template rendered in `<div class="action">` |
|
|
1494
|
+
| `ariaLabel` | `string` | - | Accessible label rendered as `aria-label` on the item |
|
|
1495
|
+
|
|
1496
|
+
The default `StatsStandardComponent` renders a section only when its corresponding template/string is provided.
|
|
1497
|
+
|
|
1498
|
+
#### Overriding with Custom Implementation
|
|
1499
|
+
|
|
1500
|
+
```typescript
|
|
1501
|
+
import { STATS_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
1502
|
+
|
|
1503
|
+
providers: [
|
|
1504
|
+
{ provide: STATS_STANDARD_COMPONENT_TOKEN, useValue: MyStatsComponent },
|
|
1505
|
+
];
|
|
1506
|
+
```
|
|
1507
|
+
|
|
1508
|
+
### TableBaseComponent
|
|
1509
|
+
|
|
1510
|
+
Abstract base class for table components. Exposes optional `ITableOptions` and `cssClass` (alias `class`).
|
|
1511
|
+
|
|
1512
|
+
**Inputs:** `options` (`ITableOptions`), `class` (`string`)
|
|
1513
|
+
|
|
1514
|
+
### Table Component
|
|
1515
|
+
|
|
1516
|
+
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 is a wrapper that delegates to `TableStandardComponent` by default and supports an InjectionToken (`TABLE_STANDARD_COMPONENT_TOKEN`) to replace the default rendering with a custom implementation.
|
|
1517
|
+
|
|
1518
|
+
**Wrapper:** `TableComponent` (selector: `smart-table`)
|
|
1519
|
+
**Default:** `TableStandardComponent` (selector: `smart-table-standard`)
|
|
1520
|
+
**Token:** `TABLE_STANDARD_COMPONENT_TOKEN` — provide a `Type<TableBaseComponent>` to override the default.
|
|
1521
|
+
|
|
1522
|
+
#### Usage
|
|
1523
|
+
|
|
1524
|
+
```html
|
|
1525
|
+
<!-- Simple columns + rows -->
|
|
1526
|
+
<smart-table
|
|
1527
|
+
[options]="{
|
|
1528
|
+
title: 'Users',
|
|
1529
|
+
columns: [
|
|
1530
|
+
{ key: 'name', label: 'Name' },
|
|
1531
|
+
{ key: 'role', label: 'Role' },
|
|
1532
|
+
{ key: 'email', label: 'Email' },
|
|
1533
|
+
],
|
|
1534
|
+
rows: [
|
|
1535
|
+
{ name: 'Lindsay Walton', role: 'Front-end', email: 'lindsay@x.com' },
|
|
1536
|
+
{ name: 'Courtney Henry', role: 'Designer', email: 'courtney@x.com' },
|
|
1537
|
+
],
|
|
1538
|
+
}"
|
|
1539
|
+
/>
|
|
1540
|
+
|
|
1541
|
+
<!-- With checkbox column -->
|
|
1542
|
+
<smart-table
|
|
1543
|
+
[options]="{
|
|
1544
|
+
columns: [
|
|
1545
|
+
{ key: 'name', label: 'Name' },
|
|
1546
|
+
{ key: 'role', label: 'Role' },
|
|
1547
|
+
],
|
|
1548
|
+
rows: [{ name: 'Lindsay Walton', role: 'Front-end' }],
|
|
1549
|
+
withCheckboxes: true,
|
|
1550
|
+
}"
|
|
1551
|
+
/>
|
|
1552
|
+
|
|
1553
|
+
<!-- With per-cell template -->
|
|
1554
|
+
<ng-template #emailCell let-row>
|
|
1555
|
+
<a [attr.href]="'mailto:' + row.email">{{ row.email }}</a>
|
|
1556
|
+
</ng-template>
|
|
1557
|
+
|
|
1558
|
+
<smart-table
|
|
1559
|
+
[options]="{
|
|
1560
|
+
columns: [
|
|
1561
|
+
{ key: 'name', label: 'Name' },
|
|
1562
|
+
{ key: 'email', label: 'Email', cellTpl: emailCell },
|
|
1563
|
+
],
|
|
1564
|
+
rows: [{ name: 'Lindsay Walton', email: 'lindsay@x.com' }],
|
|
1565
|
+
}"
|
|
1566
|
+
/>
|
|
1567
|
+
|
|
1568
|
+
<!-- With empty state and footer -->
|
|
1569
|
+
<ng-template #emptyMsg>
|
|
1570
|
+
<span>Brak wyników</span>
|
|
1571
|
+
</ng-template>
|
|
1572
|
+
<ng-template #footer>
|
|
1573
|
+
<a href="#">Load more →</a>
|
|
1574
|
+
</ng-template>
|
|
1575
|
+
|
|
1576
|
+
<smart-table
|
|
1577
|
+
[options]="{
|
|
1578
|
+
columns: [{ key: 'name', label: 'Name' }],
|
|
1579
|
+
rows: [],
|
|
1580
|
+
emptyTpl: emptyMsg,
|
|
1581
|
+
footerTpl: footer,
|
|
1582
|
+
}"
|
|
1583
|
+
/>
|
|
1584
|
+
```
|
|
1585
|
+
|
|
1586
|
+
#### ITableOptions
|
|
1587
|
+
|
|
1588
|
+
| Property | Type | Default | Description |
|
|
1589
|
+
| ---------------- | ---------------------- | ------- | -------------------------------------------------------- |
|
|
1590
|
+
| `title` | `string` | - | Optional table title rendered as `<h3 class="title">` |
|
|
1591
|
+
| `description` | `string` | - | Optional description rendered as `<p class="description">` |
|
|
1592
|
+
| `columns` | `ITableColumn[]` | - | Column definitions (rendered as `<thead><th>`) |
|
|
1593
|
+
| `rows` | `TableRow[]` | - | Row data (each row read via `row[col.key]`) |
|
|
1594
|
+
| `striped` | `boolean` | - | Hint for custom impls: zebra-stripe rows |
|
|
1595
|
+
| `stickyHeader` | `boolean` | - | Hint for custom impls: sticky `<thead>` |
|
|
1596
|
+
| `withCheckboxes` | `boolean` | - | Render an extra checkbox column |
|
|
1597
|
+
| `withBorder` | `boolean` | - | Hint for custom impls: bordered table |
|
|
1598
|
+
| `emptyTpl` | `TemplateRef<unknown>` | - | Template rendered when `rows` is empty |
|
|
1599
|
+
| `footerTpl` | `TemplateRef<unknown>` | - | Bottom footer slot |
|
|
1600
|
+
| `toolbarTpl` | `TemplateRef<unknown>` | - | Top toolbar slot rendered above `<table>` |
|
|
1601
|
+
|
|
1602
|
+
#### ITableColumn
|
|
1603
|
+
|
|
1604
|
+
| Property | Type | Default | Description |
|
|
1605
|
+
| ----------- | --------------------------------- | -------- | -------------------------------------------------------- |
|
|
1606
|
+
| `key` | `string` | - | **Required** key used to read `row[key]` |
|
|
1607
|
+
| `label` | `string` | - | Header label (falls back to `key` if missing) |
|
|
1608
|
+
| `align` | `'left' \| 'center' \| 'right'` | `'left'` | Alignment hint (set on `data-align` attribute) |
|
|
1609
|
+
| `sortable` | `boolean` | - | Hint for custom impls: column is sortable |
|
|
1610
|
+
| `cellTpl` | `TemplateRef<unknown>` | - | Custom cell template (`{ $implicit: row, column: col }`) |
|
|
1611
|
+
| `headerTpl` | `TemplateRef<unknown>` | - | Custom header template |
|
|
1612
|
+
| `ariaLabel` | `string` | - | Accessible label rendered on `<th>` |
|
|
1613
|
+
|
|
1614
|
+
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 registered via `TABLE_STANDARD_COMPONENT_TOKEN`.
|
|
1615
|
+
|
|
1616
|
+
#### Overriding with Custom Implementation
|
|
1617
|
+
|
|
1618
|
+
```typescript
|
|
1619
|
+
import { TABLE_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
1620
|
+
|
|
1621
|
+
providers: [
|
|
1622
|
+
{ provide: TABLE_STANDARD_COMPONENT_TOKEN, useValue: MyTableComponent },
|
|
1623
|
+
];
|
|
1624
|
+
```
|
|
1625
|
+
|
|
1626
|
+
### TextareaBaseComponent
|
|
1627
|
+
|
|
1628
|
+
Abstract base class for textarea components. Exposes `value` (two-way `ModelSignal<string>`), `placeholder`, `disabled`, optional `ITextareaOptions`, `cssClass` (alias `class`), and an `actionClick` output.
|
|
1629
|
+
|
|
1630
|
+
**Inputs:** `value` (`ModelSignal<string>`), `placeholder` (`string`), `disabled` (`boolean`), `options` (`ITextareaOptions`), `class` (`string`)
|
|
1631
|
+
**Outputs:** `actionClick` (`ITextareaActionClick`)
|
|
1632
|
+
|
|
1633
|
+
### Textarea Component
|
|
1634
|
+
|
|
1635
|
+
The `<smart-textarea>` component renders a multi-line text input with optional label, action buttons, avatar/toolbar/preview/footer slots. It is a wrapper that delegates to `TextareaStandardComponent` by default and supports an InjectionToken (`TEXTAREA_STANDARD_COMPONENT_TOKEN`) to replace the default rendering with a custom implementation.
|
|
1636
|
+
|
|
1637
|
+
**Wrapper:** `TextareaComponent` (selector: `smart-textarea`)
|
|
1638
|
+
**Default:** `TextareaStandardComponent` (selector: `smart-textarea-standard`)
|
|
1639
|
+
**Token:** `TEXTAREA_STANDARD_COMPONENT_TOKEN` — provide a `Type<TextareaBaseComponent>` to override the default.
|
|
1640
|
+
|
|
1641
|
+
#### Usage
|
|
1642
|
+
|
|
1643
|
+
```html
|
|
1644
|
+
<smart-textarea [(value)]="comment" placeholder="Add your comment..." />
|
|
1645
|
+
|
|
1646
|
+
<smart-textarea [(value)]="bio" [options]="{ label: 'Bio', rows: 6 }" />
|
|
1647
|
+
|
|
1648
|
+
<smart-textarea
|
|
1649
|
+
[(value)]="message"
|
|
1650
|
+
[options]="{
|
|
1651
|
+
rows: 4,
|
|
1652
|
+
maxLength: 280,
|
|
1653
|
+
actions: [
|
|
1654
|
+
{ id: 'cancel', label: 'Cancel', variant: 'ghost' },
|
|
1655
|
+
{ id: 'submit', label: 'Send', variant: 'primary' },
|
|
1656
|
+
],
|
|
1657
|
+
}"
|
|
1658
|
+
(actionClick)="onAction($event)"
|
|
1659
|
+
/>
|
|
1660
|
+
|
|
1661
|
+
<smart-textarea [(value)]="readonly" [disabled]="true" />
|
|
1662
|
+
```
|
|
1663
|
+
|
|
1664
|
+
#### ITextareaOptions
|
|
1665
|
+
|
|
1666
|
+
| Property | Type | Default | Description |
|
|
1667
|
+
| ------------- | -------------------------- | ------- | -------------------------------------------------------- |
|
|
1668
|
+
| `rows` | `number` | `3` | Number of `<textarea>` rows |
|
|
1669
|
+
| `maxLength` | `number` | - | Max characters (`maxlength` attr) |
|
|
1670
|
+
| `variant` | `SmartTextareaVariant` | - | Hint for custom impls |
|
|
1671
|
+
| `label` | `string` | - | Render `<label>` above textarea |
|
|
1672
|
+
| `name` | `string` | - | Form `name` attribute |
|
|
1673
|
+
| `required` | `boolean` | - | Set `required` attribute |
|
|
1674
|
+
| `autoFocus` | `boolean` | - | Hint for custom impls |
|
|
1675
|
+
| `ariaLabel` | `string` | - | Accessible label |
|
|
1676
|
+
| `actions` | `ITextareaAction[]` | - | Render action buttons below textarea |
|
|
1677
|
+
| `avatarTpl` | `TemplateRef<unknown>` | - | Avatar slot |
|
|
1678
|
+
| `toolbarTpl` | `TemplateRef<unknown>` | - | Toolbar slot |
|
|
1679
|
+
| `previewTpl` | `TemplateRef<unknown>` | - | Preview slot |
|
|
1680
|
+
| `footerTpl` | `TemplateRef<unknown>` | - | Footer slot |
|
|
1681
|
+
|
|
1682
|
+
#### Outputs
|
|
1683
|
+
|
|
1684
|
+
- `actionClick: { actionId, value }` — emitted when an action button is clicked (unless disabled)
|
|
1685
|
+
|
|
1686
|
+
#### Overriding with Custom Implementation
|
|
1687
|
+
|
|
1688
|
+
```typescript
|
|
1689
|
+
import { TEXTAREA_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
1690
|
+
|
|
1691
|
+
providers: [
|
|
1692
|
+
{ provide: TEXTAREA_STANDARD_COMPONENT_TOKEN, useValue: MyTextareaComponent },
|
|
1693
|
+
];
|
|
1694
|
+
```
|
|
1695
|
+
|
|
1696
|
+
### GridListBaseComponent
|
|
1697
|
+
|
|
1698
|
+
Abstract base class for grid list components. Exposes optional `IGridListOptions` and `cssClass` (alias `class`).
|
|
1699
|
+
|
|
1700
|
+
**Inputs:** `options` (`IGridListOptions`), `class` (`string`)
|
|
1701
|
+
|
|
1702
|
+
### GridList Component
|
|
1703
|
+
|
|
1704
|
+
The `<smart-grid-list>` component renders a grid of card-like records with optional title, description, per-item icon/image, link, badge, action template, and bottom footer slot. It is a wrapper that delegates to `GridListStandardComponent` by default and supports an InjectionToken (`GRID_LIST_STANDARD_COMPONENT_TOKEN`) to replace the default rendering with a custom implementation.
|
|
1705
|
+
|
|
1706
|
+
**Wrapper:** `GridListComponent` (selector: `smart-grid-list`)
|
|
1707
|
+
**Default:** `GridListStandardComponent` (selector: `smart-grid-list-standard`)
|
|
1708
|
+
**Token:** `GRID_LIST_STANDARD_COMPONENT_TOKEN` — provide a `Type<GridListBaseComponent>` to override the default.
|
|
1709
|
+
|
|
1710
|
+
#### Usage
|
|
1711
|
+
|
|
1712
|
+
```html
|
|
1713
|
+
<!-- Simple cards with image and title -->
|
|
1714
|
+
<smart-grid-list
|
|
1715
|
+
[options]="{
|
|
1716
|
+
title: 'Team',
|
|
1717
|
+
columns: 3,
|
|
1718
|
+
items: [
|
|
1719
|
+
{ id: '1', title: 'Lindsay Walton', imageUrl: '/img/lindsay.jpg', description: 'Front-end' },
|
|
1720
|
+
{ id: '2', title: 'Courtney Henry', imageUrl: '/img/courtney.jpg', description: 'Designer' },
|
|
1721
|
+
{ id: '3', title: 'Tom Cook', imageUrl: '/img/tom.jpg', description: 'Director' },
|
|
1722
|
+
],
|
|
1723
|
+
}"
|
|
1724
|
+
/>
|
|
1725
|
+
|
|
1726
|
+
<!-- Logo cards (links) -->
|
|
1727
|
+
<smart-grid-list
|
|
1728
|
+
[options]="{
|
|
1729
|
+
layout: 'logos',
|
|
1730
|
+
columns: 4,
|
|
1731
|
+
items: [
|
|
1732
|
+
{ title: 'Acme', href: '/acme', imageUrl: '/logos/acme.svg' },
|
|
1733
|
+
{ title: 'Globex', href: '/globex', imageUrl: '/logos/globex.svg' },
|
|
1734
|
+
],
|
|
1735
|
+
}"
|
|
1736
|
+
/>
|
|
1737
|
+
|
|
1738
|
+
<!-- With per-item badge and action -->
|
|
1739
|
+
<ng-template #activeBadge><span>Active</span></ng-template>
|
|
1740
|
+
<ng-template #openAction><button>Open</button></ng-template>
|
|
1741
|
+
<smart-grid-list
|
|
1742
|
+
[options]="{
|
|
1743
|
+
items: [
|
|
1744
|
+
{ title: 'Project Alpha', description: 'Design system', badgeTpl: activeBadge, actionTpl: openAction },
|
|
1745
|
+
],
|
|
1746
|
+
}"
|
|
1747
|
+
/>
|
|
1748
|
+
|
|
1749
|
+
<!-- With empty state and footer -->
|
|
1750
|
+
<ng-template #emptyMsg><span>Brak wyników</span></ng-template>
|
|
1751
|
+
<ng-template #footer><a href="#">Load more →</a></ng-template>
|
|
1752
|
+
<smart-grid-list [options]="{ items: [], emptyTpl: emptyMsg, footerTpl: footer }" />
|
|
1753
|
+
```
|
|
1754
|
+
|
|
1755
|
+
#### IGridListOptions
|
|
1756
|
+
|
|
1757
|
+
| Property | Type | Default | Description |
|
|
1758
|
+
| ------------- | ------------------------------------- | ------- | -------------------------------------------------------- |
|
|
1759
|
+
| `title` | `string` | - | Optional list title rendered as `<h3 class="title">` |
|
|
1760
|
+
| `description` | `string` | - | Optional description rendered as `<p class="description">` |
|
|
1761
|
+
| `items` | `IGridListItem[]` | - | List entries to render as `<li class="item">` |
|
|
1762
|
+
| `columns` | `1 \| 2 \| 3 \| 4 \| 5 \| 6` | - | Hint for custom impls: number of columns |
|
|
1763
|
+
| `gap` | `'sm' \| 'md' \| 'lg'` | - | Hint for custom impls: spacing between items |
|
|
1764
|
+
| `layout` | `'cards' \| 'horizontal' \| 'logos'` | - | Hint for custom impls: visual layout family |
|
|
1765
|
+
| `emptyTpl` | `TemplateRef<unknown>` | - | Template rendered when items is empty |
|
|
1766
|
+
| `footerTpl` | `TemplateRef<unknown>` | - | Bottom footer slot |
|
|
1767
|
+
|
|
1768
|
+
#### IGridListItem
|
|
1769
|
+
|
|
1770
|
+
| Property | Type | Default | Description |
|
|
1771
|
+
| ------------- | ---------------------- | ------- | -------------------------------------------------------- |
|
|
1772
|
+
| `id` | `string` | - | Optional stable id used as track key |
|
|
1773
|
+
| `title` | `string` | - | **Required** title text |
|
|
1774
|
+
| `description` | `string` | - | Optional secondary line |
|
|
1775
|
+
| `imageUrl` | `string` | - | Image URL (rendered as `<img class="image">`) |
|
|
1776
|
+
| `imageAlt` | `string` | `''` | Alt text for `imageUrl` |
|
|
1777
|
+
| `iconTpl` | `TemplateRef<unknown>` | - | Custom icon template (takes precedence over `imageUrl`) |
|
|
1778
|
+
| `href` | `string` | - | When set, title is rendered as `<a class="title">` |
|
|
1779
|
+
| `badgeTpl` | `TemplateRef<unknown>` | - | Badge slot rendered next to the body |
|
|
1780
|
+
| `actionTpl` | `TemplateRef<unknown>` | - | Trailing action slot (e.g. button) |
|
|
1781
|
+
| `ariaLabel` | `string` | - | Accessible label rendered on the `<li>` |
|
|
1782
|
+
|
|
1783
|
+
The default `GridListStandardComponent` consumes every property; a section is rendered only when its template/string is provided. Within an item, `iconTpl` takes precedence over `imageUrl` when both are set. `columns`, `gap` and `layout` are hints for custom implementations registered via `GRID_LIST_STANDARD_COMPONENT_TOKEN`.
|
|
1784
|
+
|
|
1785
|
+
#### Overriding with Custom Implementation
|
|
1786
|
+
|
|
1787
|
+
```typescript
|
|
1788
|
+
import { GRID_LIST_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
1789
|
+
|
|
1790
|
+
providers: [
|
|
1791
|
+
{ provide: GRID_LIST_STANDARD_COMPONENT_TOKEN, useValue: MyGridListComponent },
|
|
1792
|
+
];
|
|
1793
|
+
```
|
|
1794
|
+
|
|
1795
|
+
### FeedBaseComponent
|
|
1796
|
+
|
|
1797
|
+
Abstract base class for feed (timeline/activity) components. Exposes optional `IFeedOptions` and `cssClass` (alias `class`).
|
|
1798
|
+
|
|
1799
|
+
**Inputs:** `options` (`IFeedOptions`), `class` (`string`)
|
|
1800
|
+
|
|
1801
|
+
### Feed Component
|
|
1802
|
+
|
|
1803
|
+
The `<smart-feed>` component renders a vertical timeline of activity events with optional title, description, per-event icon/avatar, link, timestamp, description, nested comments, an empty state, an optional comment-submit slot, and a bottom footer slot. It is a wrapper that delegates to `FeedStandardComponent` by default and supports an InjectionToken (`FEED_STANDARD_COMPONENT_TOKEN`) to replace the default rendering with a custom implementation.
|
|
1804
|
+
|
|
1805
|
+
**Wrapper:** `FeedComponent` (selector: `smart-feed`)
|
|
1806
|
+
**Default:** `FeedStandardComponent` (selector: `smart-feed-standard`)
|
|
1807
|
+
**Token:** `FEED_STANDARD_COMPONENT_TOKEN` — provide a `Type<FeedBaseComponent>` to override the default.
|
|
1808
|
+
|
|
1809
|
+
#### Usage
|
|
1810
|
+
|
|
1811
|
+
```html
|
|
1812
|
+
<!-- Simple timeline with icons -->
|
|
1813
|
+
<ng-template #applyIcon><svg class="apply-icon"></svg></ng-template>
|
|
1814
|
+
<smart-feed
|
|
1815
|
+
[options]="{
|
|
1816
|
+
title: 'Application activity',
|
|
1817
|
+
events: [
|
|
1818
|
+
{ title: 'Applied to Front End Developer', timestamp: 'Sep 20', iconTpl: applyIcon },
|
|
1819
|
+
{ title: 'Advanced to phone screening', timestamp: 'Sep 22' },
|
|
1820
|
+
],
|
|
1821
|
+
}"
|
|
1822
|
+
/>
|
|
1823
|
+
|
|
1824
|
+
<!-- With comments -->
|
|
1825
|
+
<smart-feed
|
|
1826
|
+
[options]="{
|
|
1827
|
+
events: [
|
|
1828
|
+
{
|
|
1829
|
+
title: 'Discussion',
|
|
1830
|
+
timestamp: '3d ago',
|
|
1831
|
+
comments: [
|
|
1832
|
+
{ authorName: 'Lindsay', content: 'Looks good to me' },
|
|
1833
|
+
{ authorName: 'Tom', authorAvatarUrl: '/img/tom.jpg', content: 'Approved', timestamp: '1d ago' },
|
|
1834
|
+
],
|
|
1835
|
+
},
|
|
1836
|
+
],
|
|
1837
|
+
}"
|
|
1838
|
+
/>
|
|
1839
|
+
|
|
1840
|
+
<!-- With comment-submit slot and footer -->
|
|
1841
|
+
<ng-template #commentForm><form><textarea></textarea><button>Comment</button></form></ng-template>
|
|
1842
|
+
<ng-template #footer><a href="#">Load more →</a></ng-template>
|
|
1843
|
+
<smart-feed [options]="{
|
|
1844
|
+
events: [{ title: 'Created invoice', timestamp: '7d ago' }],
|
|
1845
|
+
commentSubmitTpl: commentForm,
|
|
1846
|
+
footerTpl: footer,
|
|
1847
|
+
}" />
|
|
1848
|
+
```
|
|
1849
|
+
|
|
1850
|
+
#### IFeedOptions
|
|
1851
|
+
|
|
1852
|
+
| Property | Type | Default | Description |
|
|
1853
|
+
| ------------------- | ------------------------------------------------- | ------- | ------------------------------------------------------------ |
|
|
1854
|
+
| `title` | `string` | - | Optional title |
|
|
1855
|
+
| `description` | `string` | - | Optional secondary description |
|
|
1856
|
+
| `events` | `IFeedEvent[]` | - | Timeline entries |
|
|
1857
|
+
| `variant` | `'simple' \| 'with-comments' \| 'multiple-types'` | - | Hint for custom impls: layout family |
|
|
1858
|
+
| `commentSubmitTpl` | `TemplateRef<unknown>` | - | Slot rendered below the timeline (e.g. comment form) |
|
|
1859
|
+
| `emptyTpl` | `TemplateRef<unknown>` | - | Template rendered when events is empty |
|
|
1860
|
+
| `footerTpl` | `TemplateRef<unknown>` | - | Bottom footer slot |
|
|
1861
|
+
|
|
1862
|
+
#### IFeedEvent
|
|
1863
|
+
|
|
1864
|
+
| Property | Type | Default | Description |
|
|
1865
|
+
| ------------- | ---------------------- | ------- | -------------------------------------------------------- |
|
|
1866
|
+
| `id` | `string` | - | Optional stable id used as track key |
|
|
1867
|
+
| `title` | `string` | - | **Required** event title |
|
|
1868
|
+
| `description` | `string` | - | Optional description rendered under the title |
|
|
1869
|
+
| `timestamp` | `string` | - | Optional `<time>` content |
|
|
1870
|
+
| `iconTpl` | `TemplateRef<unknown>` | - | Custom icon template (takes precedence over `avatarUrl`) |
|
|
1871
|
+
| `avatarUrl` | `string` | - | Avatar image URL |
|
|
1872
|
+
| `href` | `string` | - | When set, title is rendered as `<a class="title">` |
|
|
1873
|
+
| `type` | `string` | - | Free-form type hint for custom impls |
|
|
1874
|
+
| `comments` | `IFeedComment[]` | - | Nested list of comments |
|
|
1875
|
+
| `ariaLabel` | `string` | - | Accessible label rendered on the `<li>` |
|
|
1876
|
+
|
|
1877
|
+
#### IFeedComment
|
|
1878
|
+
|
|
1879
|
+
| Property | Type | Default | Description |
|
|
1880
|
+
| ------------------- | -------- | ------- | ---------------------------- |
|
|
1881
|
+
| `id` | `string` | - | Optional stable id |
|
|
1882
|
+
| `authorName` | `string` | - | **Required** author name |
|
|
1883
|
+
| `authorAvatarUrl` | `string` | - | Optional avatar image URL |
|
|
1884
|
+
| `content` | `string` | - | **Required** comment content |
|
|
1885
|
+
| `timestamp` | `string` | - | Optional `<time>` content |
|
|
1886
|
+
|
|
1887
|
+
The default `FeedStandardComponent` consumes every property; a section is rendered only when its template/string is provided. Within an event, `iconTpl` takes precedence over `avatarUrl` when both are set.
|
|
1888
|
+
|
|
1889
|
+
#### Overriding with Custom Implementation
|
|
1890
|
+
|
|
1891
|
+
```typescript
|
|
1892
|
+
import { FEED_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
1893
|
+
|
|
1894
|
+
providers: [{ provide: FEED_STANDARD_COMPONENT_TOKEN, useValue: MyFeedComponent }];
|
|
1895
|
+
```
|
|
1896
|
+
|
|
1897
|
+
### SelectMenuBaseComponent
|
|
1898
|
+
|
|
1899
|
+
Abstract base class for select menu components. Exposes `value` (two-way `ModelSignal<SelectMenuValue>` where `SelectMenuValue = string | number | null`), `disabled`, optional `ISelectMenuOptions`, `cssClass` (alias `class`), and a `select(next)` method that updates `value` while respecting `disabled`.
|
|
1900
|
+
|
|
1901
|
+
**Inputs:** `value` (`ModelSignal<SelectMenuValue>`), `disabled` (`boolean`), `options` (`ISelectMenuOptions`), `class` (`string`)
|
|
1902
|
+
|
|
1903
|
+
### SelectMenu Component
|
|
1904
|
+
|
|
1905
|
+
The `<smart-select-menu>` component renders a single-select menu. It is a wrapper that delegates to `SelectMenuStandardComponent` by default and supports an InjectionToken (`SELECT_MENU_STANDARD_COMPONENT_TOKEN`) to replace the default rendering with a custom implementation. The default uses a native `<select>` element; pro variants will replace it with a custom dropdown UI.
|
|
1906
|
+
|
|
1907
|
+
**Wrapper:** `SelectMenuComponent` (selector: `smart-select-menu`)
|
|
1908
|
+
**Default:** `SelectMenuStandardComponent` (selector: `smart-select-menu-standard`)
|
|
1909
|
+
**Token:** `SELECT_MENU_STANDARD_COMPONENT_TOKEN` — provide a `Type<SelectMenuBaseComponent>` to override the default.
|
|
1910
|
+
|
|
1911
|
+
#### Usage
|
|
1912
|
+
|
|
1913
|
+
```html
|
|
1914
|
+
<smart-select-menu
|
|
1915
|
+
[(value)]="selected"
|
|
1916
|
+
[options]="{
|
|
1917
|
+
placeholder: 'Choose a country',
|
|
1918
|
+
items: [
|
|
1919
|
+
{ value: 'pl', label: 'Poland' },
|
|
1920
|
+
{ value: 'us', label: 'United States' },
|
|
1921
|
+
],
|
|
1922
|
+
}"
|
|
1923
|
+
/>
|
|
1924
|
+
|
|
1925
|
+
<smart-select-menu [(value)]="role" [disabled]="true" [options]="{ items: [{ value: 'admin', label: 'Admin' }] }" />
|
|
1926
|
+
```
|
|
1927
|
+
|
|
1928
|
+
#### ISelectMenuOptions
|
|
1929
|
+
|
|
1930
|
+
| Property | Type | Default | Description |
|
|
1931
|
+
| ------------- | ----------------------------- | ------- | -------------------------------------------------------- |
|
|
1932
|
+
| `items` | `ISelectMenuItem[]` | - | Available options |
|
|
1933
|
+
| `placeholder` | `string` | - | Optional disabled first `<option>` |
|
|
1934
|
+
| `variant` | `SmartSelectMenuVariant` | - | Hint for custom impls: layout family |
|
|
1935
|
+
| `emptyTpl` | `TemplateRef<unknown>` | - | Template rendered when items is empty |
|
|
1936
|
+
| `ariaLabel` | `string` | - | Accessible label rendered on `<select>` |
|
|
1937
|
+
|
|
1938
|
+
#### ISelectMenuItem
|
|
1939
|
+
|
|
1940
|
+
| Property | Type | Default | Description |
|
|
1941
|
+
| ------------- | ------------------------------------------ | ------- | -------------------------------------------------------- |
|
|
1942
|
+
| `value` | `string \| number` | - | **Required** option value |
|
|
1943
|
+
| `label` | `string` | - | **Required** option label |
|
|
1944
|
+
| `avatarUrl` | `string` | - | Hint for custom impls: avatar image URL |
|
|
1945
|
+
| `iconTpl` | `TemplateRef<unknown>` | - | Hint for custom impls: icon template |
|
|
1946
|
+
| `secondary` | `string` | - | Hint for custom impls: secondary line |
|
|
1947
|
+
| `status` | `'online' \| 'offline' \| 'busy' \| string`| - | Hint for custom impls: status indicator |
|
|
1948
|
+
| `disabled` | `boolean` | - | Disable this option |
|
|
1949
|
+
| `ariaLabel` | `string` | - | Accessible label on `<option>` |
|
|
1950
|
+
|
|
1951
|
+
The default `SelectMenuStandardComponent` consumes `value`, `disabled`, `placeholder`, `items`, `disabled` per-item, and `emptyTpl`. Other properties are reserved for custom implementations registered via `SELECT_MENU_STANDARD_COMPONENT_TOKEN`.
|
|
1952
|
+
|
|
1953
|
+
#### Overriding with Custom Implementation
|
|
1954
|
+
|
|
1955
|
+
```typescript
|
|
1956
|
+
import { SELECT_MENU_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
1957
|
+
|
|
1958
|
+
providers: [
|
|
1959
|
+
{ provide: SELECT_MENU_STANDARD_COMPONENT_TOKEN, useValue: MySelectMenuComponent },
|
|
1960
|
+
];
|
|
1961
|
+
```
|
|
1962
|
+
|
|
1963
|
+
### SignInFormBaseComponent
|
|
1964
|
+
|
|
1965
|
+
Abstract base class for sign-in / sign-up form components. Exposes `mode` (`'sign-in' | 'sign-up'`), `disabled`, optional `ISignInFormOptions`, `cssClass` (alias `class`), and `submit` / `socialClick` outputs.
|
|
1966
|
+
|
|
1967
|
+
**Inputs:** `mode` (`SmartSignInFormMode`), `disabled` (`boolean`), `options` (`ISignInFormOptions`), `class` (`string`)
|
|
1968
|
+
**Outputs:** `submit` (`ISignInFormSubmit`), `socialClick` (`ISignInFormSocialClick`)
|
|
1969
|
+
|
|
1970
|
+
### SignIn Form Component
|
|
1971
|
+
|
|
1972
|
+
The `<smart-sign-in-form>` component renders a form supporting both sign-in and sign-up flows via the `mode` input. It is a wrapper that delegates to `SignInFormStandardComponent` by default and supports an InjectionToken (`SIGN_IN_FORM_STANDARD_COMPONENT_TOKEN`) to replace the default rendering with a custom implementation.
|
|
1973
|
+
|
|
1974
|
+
**Wrapper:** `SignInFormComponent` (selector: `smart-sign-in-form`)
|
|
1975
|
+
**Default:** `SignInFormStandardComponent` (selector: `smart-sign-in-form-standard`)
|
|
1976
|
+
**Token:** `SIGN_IN_FORM_STANDARD_COMPONENT_TOKEN` — provide a `Type<SignInFormBaseComponent>` to override the default.
|
|
1977
|
+
|
|
1978
|
+
#### Usage
|
|
1979
|
+
|
|
1980
|
+
```html
|
|
1981
|
+
<smart-sign-in-form (submit)="onSignIn($event)" />
|
|
1982
|
+
|
|
1983
|
+
<smart-sign-in-form mode="sign-up" (submit)="onSignUp($event)" />
|
|
1984
|
+
|
|
1985
|
+
<smart-sign-in-form
|
|
1986
|
+
[options]="{
|
|
1987
|
+
forgotPasswordHref: '/forgot',
|
|
1988
|
+
signUpHref: '/signup',
|
|
1989
|
+
socialProviders: [
|
|
1990
|
+
{ id: 'google', label: 'Google' },
|
|
1991
|
+
{ id: 'github', label: 'GitHub' },
|
|
1992
|
+
],
|
|
1993
|
+
}"
|
|
1994
|
+
(submit)="onSignIn($event)"
|
|
1995
|
+
(socialClick)="onSocial($event)"
|
|
1996
|
+
/>
|
|
1997
|
+
|
|
1998
|
+
<smart-sign-in-form [disabled]="loading()" (submit)="onSignIn($event)" />
|
|
1999
|
+
```
|
|
2000
|
+
|
|
2001
|
+
#### ISignInFormOptions
|
|
2002
|
+
|
|
2003
|
+
| Property | Type | Default | Description |
|
|
2004
|
+
| --------------------- | --------------------------------- | ------- | -------------------------------------------------------- |
|
|
2005
|
+
| `socialProviders` | `ISocialProvider[]` | - | Social login provider buttons |
|
|
2006
|
+
| `layout` | `SmartSignInFormLayout` | - | Hint for custom impls |
|
|
2007
|
+
| `showLabels` | `boolean` | `true` | Show `<label>`s above inputs |
|
|
2008
|
+
| `heroImageUrl` | `string` | - | Hint for custom impls (split-screen layout) |
|
|
2009
|
+
| `forgotPasswordHref` | `string` | - | Forgot-password link href (sign-in mode only) |
|
|
2010
|
+
| `signUpHref` | `string` | - | Alt link to sign-up (sign-in mode) |
|
|
2011
|
+
| `signInHref` | `string` | - | Alt link to sign-in (sign-up mode) |
|
|
2012
|
+
| `submitLabel` | `string` | - | Override submit button label |
|
|
2013
|
+
| `emailPlaceholder` | `string` | - | Email input placeholder |
|
|
2014
|
+
| `passwordPlaceholder` | `string` | - | Password input placeholder |
|
|
2015
|
+
| `extraTpl` | `TemplateRef<unknown>` | - | Slot rendered at the bottom of the form |
|
|
2016
|
+
| `ariaLabel` | `string` | - | Accessible label on `<form>` |
|
|
2017
|
+
|
|
2018
|
+
#### Outputs
|
|
2019
|
+
|
|
2020
|
+
- `submit: { email, password, mode }` — emitted on form submit when not disabled
|
|
2021
|
+
- `socialClick: { providerId, mode }` — emitted on social provider button click
|
|
2022
|
+
|
|
2023
|
+
#### Overriding with Custom Implementation
|
|
2024
|
+
|
|
2025
|
+
```typescript
|
|
2026
|
+
import { SIGN_IN_FORM_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
2027
|
+
|
|
2028
|
+
providers: [
|
|
2029
|
+
{ provide: SIGN_IN_FORM_STANDARD_COMPONENT_TOKEN, useValue: MySignInFormComponent },
|
|
2030
|
+
];
|
|
2031
|
+
```
|
|
2032
|
+
|
|
2033
|
+
### PasswordStrengthBaseComponent
|
|
2034
|
+
|
|
2035
|
+
Abstract base class for password-strength indicator components. Exposes required `passwordToCheck: string` and `showHint: boolean` inputs, `cssClass: string` (alias `class`), a `passwordStrength: boolean` output, and computed signals: `result`, `strength` (0/10/20/30), `strengthIndex` (0..3), `msg` (`'' | 'poor' | 'notGood' | 'good'`), `barClasses` (length-3 string array), `msgClass`, and `containerClasses`. The output `passwordStrength` is emitted automatically via an `effect()` — `true` when `strength === 30`, `false` otherwise.
|
|
2036
|
+
|
|
2037
|
+
**Inputs:** `passwordToCheck` (`string`, required), `showHint` (`boolean`, required), `class` (`string`)
|
|
2038
|
+
**Outputs:** `passwordStrength` (`boolean`)
|
|
2039
|
+
|
|
2040
|
+
### Password Strength Component
|
|
2041
|
+
|
|
2042
|
+
The `<smart-password-strength>` component renders a three-bar strength indicator with an optional hint list of unmet requirements. It is a wrapper that delegates to `PasswordStrengthStandardComponent` by default and supports an InjectionToken (`PASSWORD_STRENGTH_STANDARD_COMPONENT_TOKEN`) to replace the default rendering with a custom implementation.
|
|
2043
|
+
|
|
2044
|
+
**Wrapper:** `PasswordStrengthComponent` (selector: `smart-password-strength`)
|
|
2045
|
+
**Default:** `PasswordStrengthStandardComponent` (selector: `smart-password-strength-standard`)
|
|
2046
|
+
**Token:** `PASSWORD_STRENGTH_STANDARD_COMPONENT_TOKEN` — provide a `Type<PasswordStrengthBaseComponent>` to override the default.
|
|
2047
|
+
|
|
2048
|
+
#### Usage
|
|
2049
|
+
|
|
2050
|
+
```html
|
|
2051
|
+
<!-- Basic -->
|
|
2052
|
+
<smart-password-strength
|
|
2053
|
+
[passwordToCheck]="password"
|
|
2054
|
+
[showHint]="false"
|
|
2055
|
+
></smart-password-strength>
|
|
2056
|
+
|
|
2057
|
+
<!-- With hint list of unmet requirements -->
|
|
2058
|
+
<smart-password-strength
|
|
2059
|
+
[passwordToCheck]="password"
|
|
2060
|
+
[showHint]="true"
|
|
2061
|
+
></smart-password-strength>
|
|
2062
|
+
|
|
2063
|
+
<!-- React to strength changes -->
|
|
2064
|
+
<smart-password-strength
|
|
2065
|
+
[passwordToCheck]="password"
|
|
2066
|
+
[showHint]="false"
|
|
2067
|
+
(passwordStrength)="onStrong($event)"
|
|
2068
|
+
></smart-password-strength>
|
|
2069
|
+
```
|
|
2070
|
+
|
|
2071
|
+
#### Translation Keys
|
|
2072
|
+
|
|
2073
|
+
- `INPUT.PASSWORD-STRENGTH.{poor|notGood|good}` — strength message
|
|
2074
|
+
- `INPUT.ERRORS.invalidMinLength` — shown when password length ≤ 6 (suffixed with ` 7`)
|
|
2075
|
+
- `INPUT.ERRORS.{upperLetters|lowerLetters|symbols}` — shown when the matching character class is missing
|
|
2076
|
+
|
|
2077
|
+
#### Overriding with Custom Implementation
|
|
2078
|
+
|
|
2079
|
+
```typescript
|
|
2080
|
+
import { PASSWORD_STRENGTH_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
2081
|
+
|
|
2082
|
+
providers: [
|
|
2083
|
+
{
|
|
2084
|
+
provide: PASSWORD_STRENGTH_STANDARD_COMPONENT_TOKEN,
|
|
2085
|
+
useValue: MyPasswordStrengthComponent,
|
|
2086
|
+
},
|
|
2087
|
+
];
|
|
2088
|
+
```
|
|
2089
|
+
|
|
2090
|
+
A custom implementation extending `PasswordStrengthBaseComponent` should declare `cssClass = input<string>('')` without the `class` alias (because `NgComponentOutlet` passes inputs by canonical name) and rely on the base's `barClasses()`, `msgClass()`, and `containerClasses()` for Tailwind classes. Do not re-emit `passwordStrength` — the base class already does that via an `effect()`.
|
|
2091
|
+
|
|
2092
|
+
### ProgressBarsBaseComponent
|
|
2093
|
+
|
|
2094
|
+
Abstract base class for progress indicator components. Exposes optional `IProgressBarsOptions`, `cssClass` (alias `class`), and a `stepClick` output.
|
|
2095
|
+
|
|
2096
|
+
**Inputs:** `options` (`IProgressBarsOptions`), `class` (`string`)
|
|
2097
|
+
**Outputs:** `stepClick` (`IProgressStepClick`)
|
|
2098
|
+
|
|
2099
|
+
### ProgressBars Component
|
|
2100
|
+
|
|
2101
|
+
The `<smart-progress-bars>` component renders either a list of progress steps (with statuses `complete`, `current`, `upcoming`) or a percentage-based bar with optional column labels. It is a wrapper that delegates to `ProgressBarsStandardComponent` by default and supports an InjectionToken (`PROGRESS_BARS_STANDARD_COMPONENT_TOKEN`) to replace the default rendering with a custom implementation.
|
|
2102
|
+
|
|
2103
|
+
**Wrapper:** `ProgressBarsComponent` (selector: `smart-progress-bars`)
|
|
2104
|
+
**Default:** `ProgressBarsStandardComponent` (selector: `smart-progress-bars-standard`)
|
|
2105
|
+
**Token:** `PROGRESS_BARS_STANDARD_COMPONENT_TOKEN` — provide a `Type<ProgressBarsBaseComponent>` to override the default.
|
|
2106
|
+
|
|
2107
|
+
#### Usage
|
|
2108
|
+
|
|
2109
|
+
```html
|
|
2110
|
+
<!-- Step indicator -->
|
|
2111
|
+
<smart-progress-bars
|
|
2112
|
+
[options]="{
|
|
2113
|
+
layout: 'simple',
|
|
2114
|
+
steps: [
|
|
2115
|
+
{ id: '1', name: 'Job details', status: 'complete', href: '/1' },
|
|
2116
|
+
{ id: '2', name: 'Application form', status: 'current', href: '/2' },
|
|
2117
|
+
{ id: '3', name: 'Preview', status: 'upcoming', href: '/3' },
|
|
2118
|
+
],
|
|
2119
|
+
}"
|
|
2120
|
+
/>
|
|
2121
|
+
|
|
2122
|
+
<!-- Percentage progress bar with column labels -->
|
|
2123
|
+
<smart-progress-bars
|
|
2124
|
+
[options]="{
|
|
2125
|
+
layout: 'progress-bar',
|
|
2126
|
+
title: 'Migrating MySQL database...',
|
|
2127
|
+
srOnlyTitle: 'Status',
|
|
2128
|
+
value: 37.5,
|
|
2129
|
+
columns: [
|
|
2130
|
+
{ label: 'Copying files', active: true },
|
|
2131
|
+
{ label: 'Migrating database', active: true },
|
|
2132
|
+
{ label: 'Compiling assets' },
|
|
2133
|
+
{ label: 'Deployed' },
|
|
2134
|
+
],
|
|
2135
|
+
}"
|
|
2136
|
+
/>
|
|
2137
|
+
```
|
|
2138
|
+
|
|
2139
|
+
#### IProgressBarsOptions
|
|
2140
|
+
|
|
2141
|
+
| Property | Type | Default | Description |
|
|
2142
|
+
| ------------- | -------------------------- | ------------ | -------------------------------------------------------------------------- |
|
|
2143
|
+
| `layout` | `SmartProgressBarsLayout` | `'simple'` | Visual variant. `'progress-bar'` switches to bar mode |
|
|
2144
|
+
| `ariaLabel` | `string` | `'Progress'` | Aria label on `<nav>` (step mode) |
|
|
2145
|
+
| `steps` | `IProgressStep[]` | - | Step list (step mode) |
|
|
2146
|
+
| `title` | `string` | - | Optional title (rendered in bar mode and as header for some step layouts) |
|
|
2147
|
+
| `srOnlyTitle` | `string` | - | Screen-reader only title (bar mode) |
|
|
2148
|
+
| `value` | `number` | `0` | Bar fill percentage 0–100 (bar mode; clamped) |
|
|
2149
|
+
| `columns` | `IProgressBarColumn[]` | - | Optional column labels rendered under the bar (bar mode) |
|
|
2150
|
+
|
|
2151
|
+
`IProgressStep` supports `id`, `name`, `description`, `status`, `href`, `iconTpl`, and `index` (e.g. `'02'`). When `href` is provided the step renders as an anchor; otherwise as a button emitting `stepClick`.
|
|
2152
|
+
|
|
2153
|
+
#### Overriding with Custom Implementation
|
|
2154
|
+
|
|
2155
|
+
```typescript
|
|
2156
|
+
import { PROGRESS_BARS_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
2157
|
+
|
|
2158
|
+
providers: [
|
|
2159
|
+
{
|
|
2160
|
+
provide: PROGRESS_BARS_STANDARD_COMPONENT_TOKEN,
|
|
2161
|
+
useValue: MyCustomProgressBarsComponent,
|
|
2162
|
+
},
|
|
2163
|
+
];
|
|
2164
|
+
```
|
|
2165
|
+
|
|
2166
|
+
### ActionPanelBaseComponent
|
|
2167
|
+
|
|
2168
|
+
Abstract base class for action panel components. Exposes optional `IActionPanelOptions`, `cssClass` (alias `class`), and an `actionClick` output. Used to render a contextual settings panel with title, description and one or more action buttons or links.
|
|
2169
|
+
|
|
2170
|
+
**Inputs:** `options` (`IActionPanelOptions`), `class` (`string`)
|
|
2171
|
+
**Outputs:** `actionClick` (`IActionPanelActionClick`)
|
|
2172
|
+
|
|
2173
|
+
### ActionPanel Component
|
|
2174
|
+
|
|
2175
|
+
The `<smart-action-panel>` component renders a panel with a heading, description and one or more actions. It is a wrapper that delegates to `ActionPanelStandardComponent` by default and supports an InjectionToken (`ACTION_PANEL_STANDARD_COMPONENT_TOKEN`) to replace the default rendering with a custom implementation.
|
|
2176
|
+
|
|
2177
|
+
**Wrapper:** `ActionPanelComponent` (selector: `smart-action-panel`)
|
|
2178
|
+
**Default:** `ActionPanelStandardComponent` (selector: `smart-action-panel-standard`)
|
|
2179
|
+
**Token:** `ACTION_PANEL_STANDARD_COMPONENT_TOKEN` — provide a `Type<ActionPanelBaseComponent>` to override the default.
|
|
2180
|
+
|
|
2181
|
+
#### Usage
|
|
2182
|
+
|
|
2183
|
+
```html
|
|
2184
|
+
<smart-action-panel
|
|
2185
|
+
[options]="{
|
|
2186
|
+
title: 'Manage subscription',
|
|
2187
|
+
description: 'Lorem ipsum dolor sit amet.',
|
|
2188
|
+
actions: [{ id: 'change', label: 'Change plan', variant: 'primary' }],
|
|
2189
|
+
}"
|
|
2190
|
+
(actionClick)="onAction($event)"
|
|
2191
|
+
/>
|
|
2192
|
+
|
|
2193
|
+
<smart-action-panel
|
|
2194
|
+
[options]="{
|
|
2195
|
+
title: 'Continuous Integration',
|
|
2196
|
+
description: 'Learn more about our CI features.',
|
|
2197
|
+
actions: [
|
|
2198
|
+
{ id: 'learn', label: 'Learn more', href: '/learn', variant: 'link' },
|
|
2199
|
+
],
|
|
2200
|
+
}"
|
|
2201
|
+
/>
|
|
2202
|
+
```
|
|
2203
|
+
|
|
2204
|
+
#### IActionPanelOptions
|
|
2205
|
+
|
|
2206
|
+
| Property | Type | Default | Description |
|
|
2207
|
+
| ---------------- | ----------------------- | ------- | ---------------------------------------------------------- |
|
|
2208
|
+
| `title` | `string` | - | Heading rendered as `<h3>` |
|
|
2209
|
+
| `description` | `string` | - | Description rendered as `<p class="description">` |
|
|
2210
|
+
| `layout` | `SmartActionPanelLayout`| - | Hint for custom impls (Tailwind variants in pro library) |
|
|
2211
|
+
| `actions` | `IActionPanelAction[]` | - | Render buttons (or anchors when `href` provided) |
|
|
2212
|
+
| `descriptionTpl` | `TemplateRef<unknown>` | - | Override description rendering with a template |
|
|
2213
|
+
| `contentTpl` | `TemplateRef<unknown>` | - | Render embedded content (toggle, input, payment block, …) |
|
|
2214
|
+
|
|
2215
|
+
#### Outputs
|
|
2216
|
+
|
|
2217
|
+
- `actionClick: { actionId }` — emitted when a button-type action is clicked
|
|
2218
|
+
|
|
2219
|
+
#### Overriding with Custom Implementation
|
|
2220
|
+
|
|
2221
|
+
```typescript
|
|
2222
|
+
import { ACTION_PANEL_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
2223
|
+
|
|
2224
|
+
providers: [
|
|
2225
|
+
{
|
|
2226
|
+
provide: ACTION_PANEL_STANDARD_COMPONENT_TOKEN,
|
|
2227
|
+
useValue: MyActionPanelComponent,
|
|
2228
|
+
},
|
|
2229
|
+
];
|
|
2230
|
+
```
|
|
2231
|
+
|
|
2232
|
+
### BreadcrumbsBaseComponent
|
|
2233
|
+
|
|
2234
|
+
Abstract base class for breadcrumb navigation components. Exposes optional `IBreadcrumbsOptions`, `cssClass` (alias `class`), and the `itemClick` output.
|
|
2235
|
+
|
|
2236
|
+
**Inputs:** `options` (`IBreadcrumbsOptions`), `class` (`string`)
|
|
2237
|
+
**Outputs:** `itemClick` (`IBreadcrumbsItemClick`)
|
|
2238
|
+
|
|
2239
|
+
### Breadcrumbs Component
|
|
2240
|
+
|
|
2241
|
+
The `<smart-breadcrumbs>` component renders a list of navigation crumbs separated by chevrons, slashes, or arrow shapes. It is a wrapper that delegates to `BreadcrumbsStandardComponent` by default and supports an InjectionToken (`BREADCRUMBS_STANDARD_COMPONENT_TOKEN`) to replace the default rendering with a custom implementation.
|
|
2242
|
+
|
|
2243
|
+
**Wrapper:** `BreadcrumbsComponent` (selector: `smart-breadcrumbs`)
|
|
2244
|
+
**Default:** `BreadcrumbsStandardComponent` (selector: `smart-breadcrumbs-standard`)
|
|
2245
|
+
**Token:** `BREADCRUMBS_STANDARD_COMPONENT_TOKEN` — provide a `Type<BreadcrumbsBaseComponent>` to override the default.
|
|
2246
|
+
|
|
2247
|
+
#### Usage
|
|
2248
|
+
|
|
2249
|
+
```html
|
|
2250
|
+
<!-- With chevron separators -->
|
|
2251
|
+
<smart-breadcrumbs
|
|
2252
|
+
[options]="{
|
|
2253
|
+
items: [
|
|
2254
|
+
{ id: 'home', href: '/', iconTpl: homeIcon, srOnlyLabel: 'Home' },
|
|
2255
|
+
{ id: 'projects', label: 'Projects', href: '/projects' },
|
|
2256
|
+
{ id: 'nero', label: 'Project Nero', href: '/projects/nero', current: true },
|
|
2257
|
+
],
|
|
2258
|
+
}"
|
|
2259
|
+
/>
|
|
2260
|
+
|
|
2261
|
+
<!-- Slash variant -->
|
|
2262
|
+
<smart-breadcrumbs
|
|
2263
|
+
[options]="{ separator: 'slash', layout: 'simple-with-slashes', items: items }"
|
|
2264
|
+
/>
|
|
2265
|
+
```
|
|
2266
|
+
|
|
2267
|
+
#### IBreadcrumbsOptions
|
|
2268
|
+
|
|
2269
|
+
| Property | Type | Default | Description |
|
|
2270
|
+
| ----------- | ----------------------------- | ------------- | ---------------------------------------------------- |
|
|
2271
|
+
| `layout` | `SmartBreadcrumbsLayout` | - | Visual variant (`contained`, `full-width-bar`, etc.) |
|
|
2272
|
+
| `ariaLabel` | `string` | `'Breadcrumb'` | Aria label on `<nav>` |
|
|
2273
|
+
| `separator` | `'chevron' \| 'slash' \| 'arrow'` | `'chevron'` | Visual separator between items (`data-separator`) |
|
|
2274
|
+
| `items` | `IBreadcrumbItem[]` | `[]` | Crumb list |
|
|
2275
|
+
|
|
2276
|
+
`IBreadcrumbItem` supports `id`, `label`, `href`, `iconTpl`, `srOnlyLabel`, and `current`. When `href` is provided, the item renders as an anchor; otherwise as a button emitting `itemClick`.
|
|
2277
|
+
|
|
2278
|
+
#### Overriding with Custom Implementation
|
|
2279
|
+
|
|
2280
|
+
```typescript
|
|
2281
|
+
import { BREADCRUMBS_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
2282
|
+
|
|
2283
|
+
providers: [
|
|
2284
|
+
{
|
|
2285
|
+
provide: BREADCRUMBS_STANDARD_COMPONENT_TOKEN,
|
|
2286
|
+
useValue: MyCustomBreadcrumbsComponent,
|
|
2287
|
+
},
|
|
2288
|
+
];
|
|
2289
|
+
```
|
|
2290
|
+
|
|
2291
|
+
### EmptyStateBaseComponent
|
|
2292
|
+
|
|
2293
|
+
Abstract base class for empty state components. Exposes optional `IEmptyStateOptions`, `cssClass` (alias `class`), and the `actionClick` / `itemClick` outputs. Used to render an empty-state placeholder when a list, page or section has no content yet.
|
|
2294
|
+
|
|
2295
|
+
**Inputs:** `options` (`IEmptyStateOptions`), `class` (`string`)
|
|
2296
|
+
**Outputs:** `actionClick` (`IEmptyStateActionClick`), `itemClick` (`IEmptyStateItemClick`)
|
|
2297
|
+
|
|
2298
|
+
### EmptyState Component
|
|
2299
|
+
|
|
2300
|
+
The `<smart-empty-state>` component renders an empty-state placeholder with an optional centered icon, title, description, primary actions and a list of starting-points / templates / recommendations. It is a wrapper that delegates to `EmptyStateStandardComponent` by default and supports an InjectionToken (`EMPTY_STATE_STANDARD_COMPONENT_TOKEN`) to replace the default rendering with a custom implementation.
|
|
2301
|
+
|
|
2302
|
+
**Wrapper:** `EmptyStateComponent` (selector: `smart-empty-state`)
|
|
2303
|
+
**Default:** `EmptyStateStandardComponent` (selector: `smart-empty-state-standard`)
|
|
2304
|
+
**Token:** `EMPTY_STATE_STANDARD_COMPONENT_TOKEN` — provide a `Type<EmptyStateBaseComponent>` to override the default.
|
|
2305
|
+
|
|
2306
|
+
#### Usage
|
|
2307
|
+
|
|
2308
|
+
```html
|
|
2309
|
+
<smart-empty-state
|
|
2310
|
+
[options]="{
|
|
2311
|
+
title: 'No projects',
|
|
2312
|
+
description: 'Get started by creating a new project.',
|
|
2313
|
+
actions: [{ id: 'create', label: 'New Project', variant: 'primary' }],
|
|
2314
|
+
}"
|
|
2315
|
+
(actionClick)="onAction($event)"
|
|
2316
|
+
/>
|
|
2317
|
+
|
|
2318
|
+
<smart-empty-state
|
|
2319
|
+
[options]="{
|
|
2320
|
+
title: 'Projects',
|
|
2321
|
+
items: [
|
|
2322
|
+
{ id: 'list', title: 'Create a List', href: '/lists/new' },
|
|
2323
|
+
{ id: 'calendar', title: 'Create a Calendar', href: '/calendars/new' },
|
|
2324
|
+
],
|
|
2325
|
+
footerLinkLabel: 'Or start from an empty project',
|
|
2326
|
+
footerLinkHref: '/projects/new',
|
|
2327
|
+
}"
|
|
2328
|
+
/>
|
|
2329
|
+
```
|
|
2330
|
+
|
|
2331
|
+
#### IEmptyStateOptions
|
|
2332
|
+
|
|
2333
|
+
| Property | Type | Default | Description |
|
|
2334
|
+
| ----------------- | ----------------------- | ------- | ------------------------------------------------------------ |
|
|
2335
|
+
| `title` | `string` | - | Main heading rendered as `<h3>` |
|
|
2336
|
+
| `description` | `string` | - | Description rendered as `<p>` |
|
|
2337
|
+
| `layout` | `SmartEmptyStateLayout` | - | Hint for custom impls (Tailwind variants in pro library) |
|
|
2338
|
+
| `iconTpl` | `TemplateRef<unknown>` | - | Optional centered icon |
|
|
2339
|
+
| `actions` | `IEmptyStateAction[]` | - | Render buttons (or anchors when `href` provided) |
|
|
2340
|
+
| `items` | `IEmptyStateItem[]` | - | Starting points / templates / recommendations list |
|
|
2341
|
+
| `itemsTitle` | `string` | - | Optional heading rendered above the items list |
|
|
2342
|
+
| `formTpl` | `TemplateRef<unknown>` | - | Embedded form (e.g. invite-by-email in recommendations) |
|
|
2343
|
+
| `footerLinkLabel` | `string` | - | Optional footer link label |
|
|
2344
|
+
| `footerLinkHref` | `string` | - | Optional footer link href (renders `<a>` when both provided) |
|
|
2345
|
+
|
|
2346
|
+
#### Outputs
|
|
2347
|
+
|
|
2348
|
+
- `actionClick: { actionId }` — emitted when a button-type action is clicked
|
|
2349
|
+
- `itemClick: { itemId }` — emitted when an item without `href` is clicked
|
|
2350
|
+
|
|
2351
|
+
#### Overriding with Custom Implementation
|
|
2352
|
+
|
|
2353
|
+
```typescript
|
|
2354
|
+
import { EMPTY_STATE_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
2355
|
+
|
|
2356
|
+
providers: [
|
|
2357
|
+
{
|
|
2358
|
+
provide: EMPTY_STATE_STANDARD_COMPONENT_TOKEN,
|
|
2359
|
+
useValue: MyEmptyStateComponent,
|
|
2360
|
+
},
|
|
2361
|
+
];
|
|
2362
|
+
```
|
|
2363
|
+
|
|
2364
|
+
### NavbarBaseComponent
|
|
2365
|
+
|
|
2366
|
+
Abstract base class for navbar components. Exposes optional `INavbarOptions`, `cssClass` (alias `class`), `mobileMenuOpen` (two-way `ModelSignal<boolean>`), and an `itemClick` output.
|
|
2367
|
+
|
|
2368
|
+
**Inputs:** `options` (`INavbarOptions`), `class` (`string`), `mobileMenuOpen` (`ModelSignal<boolean>`)
|
|
2369
|
+
**Outputs:** `itemClick` (`INavbarItemClick`)
|
|
2370
|
+
|
|
2371
|
+
### Navbar Component
|
|
2372
|
+
|
|
2373
|
+
The `<smart-navbar>` component renders a top navigation bar with logo, primary nav items, optional secondary row, search/action/notification/user-menu slots, and a mobile menu toggle. It is a wrapper that delegates to `NavbarStandardComponent` by default and supports an InjectionToken (`NAVBAR_STANDARD_COMPONENT_TOKEN`) to replace the default rendering with a custom implementation.
|
|
2374
|
+
|
|
2375
|
+
**Wrapper:** `NavbarComponent` (selector: `smart-navbar`)
|
|
2376
|
+
**Default:** `NavbarStandardComponent` (selector: `smart-navbar-standard`)
|
|
2377
|
+
**Token:** `NAVBAR_STANDARD_COMPONENT_TOKEN` — provide a `Type<NavbarBaseComponent>` to override the default.
|
|
2378
|
+
|
|
2379
|
+
#### Usage
|
|
2380
|
+
|
|
2381
|
+
```html
|
|
2382
|
+
<smart-navbar
|
|
2383
|
+
[options]="{
|
|
2384
|
+
logoUrl: '/logo.svg',
|
|
2385
|
+
logoAlt: 'Acme',
|
|
2386
|
+
logoHref: '/',
|
|
2387
|
+
items: [
|
|
2388
|
+
{ id: 'dashboard', label: 'Dashboard', href: '/', current: true },
|
|
2389
|
+
{ id: 'team', label: 'Team', href: '/team' },
|
|
2390
|
+
],
|
|
2391
|
+
}"
|
|
2392
|
+
/>
|
|
2393
|
+
```
|
|
2394
|
+
|
|
2395
|
+
#### INavbarOptions
|
|
2396
|
+
|
|
2397
|
+
| Property | Type | Default | Description |
|
|
2398
|
+
| ------------------ | ---------------------- | ------- | ------------------------------------------------------------ |
|
|
2399
|
+
| `layout` | `SmartNavbarLayout` | - | Hint for custom impls (Tailwind variants in pro library) |
|
|
2400
|
+
| `dark` | `boolean` | - | Dark mode hint for custom impls |
|
|
2401
|
+
| `menuButtonOnLeft` | `boolean` | - | Position the mobile menu toggle on the left |
|
|
2402
|
+
| `logoTpl` | `TemplateRef<unknown>` | - | Logo template slot (priority over `logoUrl`) |
|
|
2403
|
+
| `logoUrl` | `string` | - | Logo image URL |
|
|
2404
|
+
| `logoAlt` | `string` | - | Logo alt text |
|
|
2405
|
+
| `logoHref` | `string` | - | Wraps the logo in `<a>` when provided |
|
|
2406
|
+
| `items` | `INavbarItem[]` | - | Primary nav items |
|
|
2407
|
+
| `secondaryItems` | `INavbarItem[]` | - | Optional secondary row of links |
|
|
2408
|
+
| `searchTpl` | `TemplateRef<unknown>` | - | Search input slot |
|
|
2409
|
+
| `actionTpl` | `TemplateRef<unknown>` | - | Quick action button slot |
|
|
2410
|
+
| `notificationTpl` | `TemplateRef<unknown>` | - | Notification (e.g. bell) slot |
|
|
2411
|
+
| `userMenuTpl` | `TemplateRef<unknown>` | - | User avatar / dropdown slot |
|
|
2412
|
+
|
|
2413
|
+
#### Outputs
|
|
2414
|
+
|
|
2415
|
+
- `itemClick: { itemId }` — emitted when a button-type nav item is clicked
|
|
2416
|
+
|
|
2417
|
+
#### Two-way bindings
|
|
2418
|
+
|
|
2419
|
+
- `mobileMenuOpen: boolean` — toggled internally by the mobile menu button; bind with `[(mobileMenuOpen)]` to control or observe externally.
|
|
2420
|
+
|
|
2421
|
+
#### Overriding with Custom Implementation
|
|
2422
|
+
|
|
2423
|
+
```typescript
|
|
2424
|
+
import { NAVBAR_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
2425
|
+
|
|
2426
|
+
providers: [
|
|
2427
|
+
{ provide: NAVBAR_STANDARD_COMPONENT_TOKEN, useValue: MyNavbarComponent },
|
|
2428
|
+
];
|
|
2429
|
+
```
|
|
2430
|
+
|
|
2431
|
+
### TabsBaseComponent
|
|
2432
|
+
|
|
2433
|
+
Abstract base class for tabs components. Exposes optional `ITabsOptions`, `cssClass` (alias `class`), `selectedId` (two-way `ModelSignal<string | null>`), and a `tabChange` output.
|
|
2434
|
+
|
|
2435
|
+
**Inputs:** `options` (`ITabsOptions`), `class` (`string`), `selectedId` (`ModelSignal<string | null>`)
|
|
2436
|
+
**Outputs:** `tabChange` (`ITabChange`)
|
|
2437
|
+
|
|
2438
|
+
### Tabs Component
|
|
2439
|
+
|
|
2440
|
+
The `<smart-tabs>` component renders a tabbed navigation strip (anchor- or button-based) with a `<select>` fallback for mobile. It is a wrapper that delegates to `TabsStandardComponent` by default and supports an InjectionToken (`TABS_STANDARD_COMPONENT_TOKEN`) to replace the default rendering with a custom implementation.
|
|
2441
|
+
|
|
2442
|
+
**Wrapper:** `TabsComponent` (selector: `smart-tabs`)
|
|
2443
|
+
**Default:** `TabsStandardComponent` (selector: `smart-tabs-standard`)
|
|
2444
|
+
**Token:** `TABS_STANDARD_COMPONENT_TOKEN` — provide a `Type<TabsBaseComponent>` to override the default.
|
|
2445
|
+
|
|
2446
|
+
#### Usage
|
|
2447
|
+
|
|
2448
|
+
```html
|
|
2449
|
+
<smart-tabs
|
|
2450
|
+
[(selectedId)]="active"
|
|
2451
|
+
[options]="{
|
|
2452
|
+
layout: 'pills',
|
|
2453
|
+
items: [
|
|
2454
|
+
{ id: 'overview', label: 'Overview' },
|
|
2455
|
+
{ id: 'settings', label: 'Settings' },
|
|
2456
|
+
],
|
|
2457
|
+
}"
|
|
2458
|
+
(tabChange)="onTab($event)"
|
|
2459
|
+
/>
|
|
2460
|
+
```
|
|
2461
|
+
|
|
2462
|
+
#### ITabsOptions
|
|
2463
|
+
|
|
2464
|
+
| Property | Type | Default | Description |
|
|
2465
|
+
| ------------------- | ----------------- | ------- | -------------------------------------------------------- |
|
|
2466
|
+
| `layout` | `SmartTabsLayout` | - | Hint for custom impls (Tailwind variants in pro library) |
|
|
2467
|
+
| `items` | `ITabItem[]` | - | Tab items |
|
|
2468
|
+
| `ariaLabel` | `string` | - | aria-label for `<nav>` and mobile `<select>` |
|
|
2469
|
+
| `showMobileSelect` | `boolean` | `true` | Render mobile `<select>` fallback |
|
|
2470
|
+
|
|
2471
|
+
#### Outputs
|
|
2472
|
+
|
|
2473
|
+
- `tabChange: { tabId }` — emitted when a button-type tab (or mobile select) changes
|
|
2474
|
+
|
|
2475
|
+
#### Two-way bindings
|
|
2476
|
+
|
|
2477
|
+
- `selectedId: string | null` — currently selected tab id; bind with `[(selectedId)]` to control or observe externally.
|
|
2478
|
+
|
|
2479
|
+
#### Overriding with Custom Implementation
|
|
2480
|
+
|
|
2481
|
+
```typescript
|
|
2482
|
+
import { TABS_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
2483
|
+
|
|
2484
|
+
providers: [
|
|
2485
|
+
{ provide: TABS_STANDARD_COMPONENT_TOKEN, useValue: MyTabsComponent },
|
|
2486
|
+
];
|
|
2487
|
+
```
|
|
2488
|
+
|
|
2489
|
+
### VerticalNavigationBaseComponent
|
|
2490
|
+
|
|
2491
|
+
Abstract base class for vertical navigation (sidebar) components. Exposes optional `IVerticalNavOptions`, `cssClass` (alias `class`), and an `itemClick` output.
|
|
2492
|
+
|
|
2493
|
+
**Inputs:** `options` (`IVerticalNavOptions`), `class` (`string`)
|
|
2494
|
+
**Outputs:** `itemClick` (`IVerticalNavItemClick`)
|
|
2495
|
+
|
|
2496
|
+
### VerticalNavigation Component
|
|
2497
|
+
|
|
2498
|
+
The `<smart-vertical-navigation>` component renders a sidebar navigation with one or more groups of items, each with optional icon, badge, and initial. It is a wrapper that delegates to `VerticalNavigationStandardComponent` by default and supports an InjectionToken (`VERTICAL_NAVIGATION_STANDARD_COMPONENT_TOKEN`) to replace the default rendering with a custom implementation.
|
|
2499
|
+
|
|
2500
|
+
**Wrapper:** `VerticalNavigationComponent` (selector: `smart-vertical-navigation`)
|
|
2501
|
+
**Default:** `VerticalNavigationStandardComponent` (selector: `smart-vertical-navigation-standard`)
|
|
2502
|
+
**Token:** `VERTICAL_NAVIGATION_STANDARD_COMPONENT_TOKEN` — provide a `Type<VerticalNavigationBaseComponent>` to override the default.
|
|
2503
|
+
|
|
2504
|
+
#### Usage
|
|
2505
|
+
|
|
2506
|
+
```html
|
|
2507
|
+
<smart-vertical-navigation
|
|
2508
|
+
[options]="{
|
|
2509
|
+
items: [
|
|
2510
|
+
{ id: 'dashboard', label: 'Dashboard', href: '/', current: true },
|
|
2511
|
+
{ id: 'team', label: 'Team', href: '/team' },
|
|
2512
|
+
{ id: 'projects', label: 'Projects', href: '/projects', badge: 12 },
|
|
2513
|
+
],
|
|
2514
|
+
}"
|
|
2515
|
+
/>
|
|
2516
|
+
|
|
2517
|
+
<smart-vertical-navigation
|
|
2518
|
+
[options]="{
|
|
2519
|
+
items: mainItems,
|
|
2520
|
+
groups: [{ title: 'Projects', items: projectItems }],
|
|
2521
|
+
}"
|
|
2522
|
+
(itemClick)="onItem($event)"
|
|
2523
|
+
/>
|
|
2524
|
+
```
|
|
2525
|
+
|
|
2526
|
+
#### IVerticalNavOptions
|
|
2527
|
+
|
|
2528
|
+
| Property | Type | Default | Description |
|
|
2529
|
+
| ----------- | ------------------------ | ------- | -------------------------------------------------------- |
|
|
2530
|
+
| `layout` | `SmartVerticalNavLayout` | - | Hint for custom impls (Tailwind variants in pro library) |
|
|
2531
|
+
| `ariaLabel` | `string` | `'Sidebar'` | aria-label for `<nav>` |
|
|
2532
|
+
| `items` | `IVerticalNavItem[]` | - | Single-group flat list |
|
|
2533
|
+
| `groups` | `IVerticalNavGroup[]` | - | Multi-group structure (each with optional `title`) |
|
|
2534
|
+
|
|
2535
|
+
#### Outputs
|
|
2536
|
+
|
|
2537
|
+
- `itemClick: { itemId }` — emitted when a button-type item is clicked
|
|
2538
|
+
|
|
2539
|
+
#### Overriding with Custom Implementation
|
|
2540
|
+
|
|
2541
|
+
```typescript
|
|
2542
|
+
import { VERTICAL_NAVIGATION_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
2543
|
+
|
|
2544
|
+
providers: [
|
|
2545
|
+
{ provide: VERTICAL_NAVIGATION_STANDARD_COMPONENT_TOKEN, useValue: MyVerticalNavComponent },
|
|
2546
|
+
];
|
|
2547
|
+
```
|
|
2548
|
+
|
|
2549
|
+
### AccordionBaseComponent
|
|
2550
|
+
|
|
2551
|
+
Abstract base class for accordion components. Provides toggle logic, disabled state, and shared container CSS classes.
|
|
2552
|
+
|
|
2553
|
+
**Inputs:** `show` (`ModelSignal<boolean>`), `options` (`IAccordionOptions`), `cssClass` (`string`)
|
|
2554
|
+
|
|
2555
|
+
### DetailBaseComponent
|
|
2556
|
+
|
|
2557
|
+
Abstract base directive for detail field sub-components. Exposes `options: IDetailOptions<T>` input, `cssClass: string` (alias `class`), and an `afterSetOptionsHandler()` hook invoked via effect on options change.
|
|
2558
|
+
|
|
2559
|
+
**Inputs:** `options` (`IDetailOptions<T>`), `class` (`string`)
|
|
2560
|
+
|
|
2561
|
+
### PagingBaseComponent
|
|
2562
|
+
|
|
2563
|
+
Abstract base class for paging components. Provides signal-based paging state, computed helpers for ellipsized page lists and item ranges, and navigation methods.
|
|
2564
|
+
|
|
2565
|
+
**Inputs:** `currentPage` (`number`), `totalPages` (`number`), `pageSize` (`number`), `totalItems` (`number`), `variant` (`PagingVariant`), `class` (`string`)
|
|
2566
|
+
**Outputs:** `pageChange` (`number`)
|
|
2567
|
+
**Computed:** `showingFrom`, `showingTo`, `canGoBack`, `canGoForward`, `pages` (numbers + `'...'`)
|
|
2568
|
+
**Methods:** `goToPage(page)`, `nextPage()`, `previousPage()`
|
|
2569
|
+
|
|
2570
|
+
### Paging Component
|
|
2571
|
+
|
|
2572
|
+
The `<smart-paging>` component renders a default `PagingStandardComponent`. It supports an InjectionToken (`PAGING_STANDARD_COMPONENT_TOKEN`) to replace the default rendering with a custom implementation.
|
|
2573
|
+
|
|
2574
|
+
**Wrapper:** `PagingComponent` (selector: `smart-paging`)
|
|
2575
|
+
**Default:** `PagingStandardComponent` (selector: `smart-paging-standard`)
|
|
2576
|
+
**Token:** `PAGING_STANDARD_COMPONENT_TOKEN` — provide a `Type<PagingBaseComponent>` to override the default.
|
|
2577
|
+
|
|
2578
|
+
#### Usage
|
|
2579
|
+
|
|
2580
|
+
```html
|
|
2581
|
+
<smart-paging
|
|
2582
|
+
[currentPage]="page()"
|
|
2583
|
+
[totalPages]="totalPages()"
|
|
2584
|
+
[pageSize]="25"
|
|
2585
|
+
[totalItems]="248"
|
|
2586
|
+
(pageChange)="onPageChange($event)"
|
|
2587
|
+
></smart-paging>
|
|
2588
|
+
```
|
|
2589
|
+
|
|
2590
|
+
#### Overriding with Custom Implementation
|
|
2591
|
+
|
|
2592
|
+
```typescript
|
|
2593
|
+
import { PAGING_STANDARD_COMPONENT_TOKEN } from '@smartsoft001/angular';
|
|
2594
|
+
|
|
2595
|
+
providers: [
|
|
2596
|
+
{ provide: PAGING_STANDARD_COMPONENT_TOKEN, useValue: MyPagingComponent },
|
|
2597
|
+
];
|
|
2598
|
+
```
|
|
2599
|
+
|
|
2600
|
+
## Components
|
|
2601
|
+
|
|
2602
|
+
The following components include both an abstract base class (`@Directive()`) and a default concrete implementation with templates. The base classes can be extended to create custom implementations.
|
|
2603
|
+
|
|
2604
|
+
### Detail Component
|
|
2605
|
+
|
|
2606
|
+
The `<smart-detail>` component renders a single model field value by delegating to a sub-component chosen by `FieldType`. Supports 15 default sub-components and allows per-field substitution via `DETAIL_FIELD_COMPONENTS_TOKEN`.
|
|
2607
|
+
|
|
2608
|
+
**Wrapper:** `DetailComponent` (selector: `smart-detail`)
|
|
2609
|
+
**Base class:** `DetailBaseComponent<T>` — base for all sub-components.
|
|
2610
|
+
**Token:** `DETAIL_FIELD_COMPONENTS_TOKEN` — provide a `Partial<Record<FieldType, Type<DetailBaseComponent<any>>>>` to substitute default sub-components for specific field types.
|
|
2611
|
+
|
|
2612
|
+
#### Usage
|
|
2613
|
+
|
|
2614
|
+
```html
|
|
2615
|
+
<smart-detail [options]="detailOptions" [type]="ModelClass"></smart-detail>
|
|
2616
|
+
```
|
|
2617
|
+
|
|
2618
|
+
#### IDetailOptions
|
|
2619
|
+
|
|
2620
|
+
| Property | Type | Default | Description |
|
|
2621
|
+
| ---------- | ----------------------------- | ---------- | -------------------------------------- |
|
|
2622
|
+
| `key` | `string` | *required* | Model property name |
|
|
2623
|
+
| `item` | `Signal<T>` | - | Signal with the model instance |
|
|
2624
|
+
| `options` | `IFieldOptions` | *required* | Field metadata (`type`, `info`, ...) |
|
|
2625
|
+
| `cellPipe` | `ICellPipe<T>` | - | Optional cell transformation pipe |
|
|
2626
|
+
| `loading` | `Signal<boolean>` | - | Loading indicator |
|
|
2627
|
+
|
|
2628
|
+
#### Default Sub-Components (selector → FieldType)
|
|
2629
|
+
|
|
2630
|
+
| Selector | FieldType |
|
|
2631
|
+
| ------------------------------- | --------------- |
|
|
2632
|
+
| `smart-detail-text` | `text` (default)|
|
|
2633
|
+
| `smart-detail-email` | `email` |
|
|
2634
|
+
| `smart-detail-enum` | `enum` |
|
|
2635
|
+
| `smart-detail-flag` | `flag` |
|
|
2636
|
+
| `smart-detail-color` | `color` |
|
|
2637
|
+
| `smart-detail-address` | `address` |
|
|
2638
|
+
| `smart-detail-object` | `object` |
|
|
2639
|
+
| `smart-detail-array` | `array` |
|
|
2640
|
+
| `smart-detail-date-range` | `dateRange` |
|
|
2641
|
+
| `smart-detail-phone-number-pl` | `phoneNumberPl` |
|
|
2642
|
+
| `smart-detail-image` | `image` |
|
|
2643
|
+
| `smart-detail-logo` | `logo` |
|
|
2644
|
+
| `smart-detail-video` | `video` |
|
|
2645
|
+
| `smart-detail-attachment` | `attachment` |
|
|
2646
|
+
| `smart-detail-pdf` | `pdf` |
|
|
2647
|
+
|
|
2648
|
+
#### Overriding Sub-Components
|
|
2649
|
+
|
|
2650
|
+
```typescript
|
|
2651
|
+
import { DETAIL_FIELD_COMPONENTS_TOKEN } from '@smartsoft001/angular';
|
|
2652
|
+
import { FieldType } from '@smartsoft001/models';
|
|
2653
|
+
|
|
2654
|
+
providers: [
|
|
2655
|
+
{
|
|
2656
|
+
provide: DETAIL_FIELD_COMPONENTS_TOKEN,
|
|
2657
|
+
useValue: {
|
|
2658
|
+
[FieldType.text]: MyCustomTextComponent,
|
|
2659
|
+
},
|
|
2660
|
+
},
|
|
2661
|
+
]
|
|
2662
|
+
```
|
|
2663
|
+
|
|
2664
|
+
#### Features
|
|
2665
|
+
|
|
2666
|
+
- Field-type dispatch via map with `NgComponentOutlet`
|
|
2667
|
+
- Per-field substitution through `DETAIL_FIELD_COMPONENTS_TOKEN`
|
|
2668
|
+
- Skeleton placeholder while `item()` resolves
|
|
2669
|
+
- Label via `ModelLabelPipe`
|
|
2670
|
+
- `smart:` Tailwind prefix, dark mode via `smart:dark:`
|
|
2671
|
+
|
|
2672
|
+
### Input Component
|
|
2673
|
+
|
|
2674
|
+
The `<smart-input>` component renders a form input for a single model field by dispatching to a sub-component chosen by `FieldType`. Supports 30 default sub-components and allows per-field substitution via `INPUT_FIELD_COMPONENTS_TOKEN`.
|
|
2675
|
+
|
|
2676
|
+
**Wrapper:** `InputComponent` (selector: `smart-input`)
|
|
2677
|
+
**Base class:** `InputBaseComponent<T>` — base for all sub-components; exposes `control`, `fieldOptions`, `cssClass` (`class` alias), `required`, `afterSetOptionsHandler()` hook.
|
|
2678
|
+
**Possibilities base:** `InputPossibilitiesBaseComponent<T>` — extends the base for list-based sub-components (radio/check).
|
|
2679
|
+
**Token:** `INPUT_FIELD_COMPONENTS_TOKEN` — provide a `Partial<Record<FieldType, Type<InputBaseComponent<any>>>>` to substitute default sub-components for specific field types.
|
|
2680
|
+
|
|
2681
|
+
#### Usage
|
|
2682
|
+
|
|
2683
|
+
```html
|
|
2684
|
+
<smart-input [options]="inputOptions"></smart-input>
|
|
2685
|
+
```
|
|
2686
|
+
|
|
2687
|
+
```typescript
|
|
2688
|
+
import { UntypedFormControl } from '@angular/forms';
|
|
2689
|
+
import { InputOptions } from '@smartsoft001/angular';
|
|
2690
|
+
import { Field, FieldType, Model } from '@smartsoft001/models';
|
|
2691
|
+
|
|
2692
|
+
@Model({})
|
|
2693
|
+
class UserModel {
|
|
2694
|
+
@Field({ type: FieldType.email, required: true })
|
|
2695
|
+
email = '';
|
|
2696
|
+
}
|
|
2697
|
+
|
|
2698
|
+
const control = new UntypedFormControl('', Validators.required);
|
|
2699
|
+
const inputOptions: InputOptions<UserModel> = {
|
|
2700
|
+
control,
|
|
2701
|
+
fieldKey: 'email',
|
|
2702
|
+
model: new UserModel(),
|
|
2703
|
+
treeLevel: 0,
|
|
2704
|
+
};
|
|
2705
|
+
```
|
|
2706
|
+
|
|
2707
|
+
#### InputOptions
|
|
2708
|
+
|
|
2709
|
+
| Property | Type | Default | Description |
|
|
2710
|
+
| --------------- | -------------------------------------------------------------- | ----------- | ---------------------------------------------------------------- |
|
|
2711
|
+
| `control` | `UntypedFormControl \| UntypedFormArray` | _required_ | Reactive form control |
|
|
2712
|
+
| `fieldKey` | `string` | _required_ | Model property name (strips trailing `Confirm`) |
|
|
2713
|
+
| `model` | `T` | _required_ | Model instance (used to resolve `@Field()` metadata) |
|
|
2714
|
+
| `treeLevel` | `number` | _required_ | Nesting depth in the form tree |
|
|
2715
|
+
| `mode` | `'create' \| 'update' \| string` | - | Merges `@Field({ create: … })` or `{ update: … }` overrides |
|
|
2716
|
+
| `possibilities` | `WritableSignal<{ id; text; checked }[]>` | - | Options for `radio` / `check` sub-components |
|
|
2717
|
+
| `component` | `Type<InputBaseComponent<any>>` | - | Per-call inline override (takes precedence over the token) |
|
|
2718
|
+
|
|
2719
|
+
#### Default Sub-Components (selector → FieldType)
|
|
2720
|
+
|
|
2721
|
+
| Selector | FieldType |
|
|
2722
|
+
| ------------------------------- | --------------- |
|
|
2723
|
+
| `smart-input-text` | `text` |
|
|
2724
|
+
| `smart-input-email` | `email` |
|
|
2725
|
+
| `smart-input-password` | `password` |
|
|
2726
|
+
| `smart-input-nip` | `nip` |
|
|
2727
|
+
| `smart-input-pesel` | `pesel` |
|
|
2728
|
+
| `smart-input-int` | `int` |
|
|
2729
|
+
| `smart-input-float` | `float` |
|
|
2730
|
+
| `smart-input-currency` | `currency` |
|
|
2731
|
+
| `smart-input-phone-number` | `phoneNumber` |
|
|
2732
|
+
| `smart-input-phone-number-pl` | `phoneNumberPl` |
|
|
2733
|
+
| `smart-input-long-text` | `longText` |
|
|
2734
|
+
| `smart-input-date` | `date` |
|
|
2735
|
+
| `smart-input-date-with-edit` | `dateWithEdit` |
|
|
2736
|
+
| `smart-input-date-range` | `dateRange` |
|
|
2737
|
+
| `smart-input-flag` | `flag` |
|
|
2738
|
+
| `smart-input-radio` | `radio` |
|
|
2739
|
+
| `smart-input-check` | `check` |
|
|
2740
|
+
| `smart-input-enum` | `enum` |
|
|
2741
|
+
| `smart-input-color` | `color` |
|
|
2742
|
+
| `smart-input-logo` | `logo` |
|
|
2743
|
+
| `smart-input-address` | `address` |
|
|
2744
|
+
| `smart-input-object` | `object` |
|
|
2745
|
+
| `smart-input-array` | `array` |
|
|
2746
|
+
| `smart-input-ints` | `ints` |
|
|
2747
|
+
| `smart-input-strings` | `strings` |
|
|
2748
|
+
| `smart-input-file` | `file` |
|
|
2749
|
+
| `smart-input-attachment` | `attachment` |
|
|
2750
|
+
| `smart-input-image` | `image` |
|
|
2751
|
+
| `smart-input-pdf` | `pdf` |
|
|
2752
|
+
| `smart-input-video` | `video` |
|
|
2753
|
+
|
|
2754
|
+
#### Overriding Sub-Components
|
|
2755
|
+
|
|
2756
|
+
```typescript
|
|
2757
|
+
import { INPUT_FIELD_COMPONENTS_TOKEN } from '@smartsoft001/angular';
|
|
2758
|
+
import { FieldType } from '@smartsoft001/models';
|
|
2759
|
+
|
|
2760
|
+
providers: [
|
|
2761
|
+
{
|
|
2762
|
+
provide: INPUT_FIELD_COMPONENTS_TOKEN,
|
|
2763
|
+
useValue: {
|
|
2764
|
+
[FieldType.text]: MyCustomTextInputComponent,
|
|
2765
|
+
},
|
|
2766
|
+
},
|
|
2767
|
+
]
|
|
2768
|
+
```
|
|
2769
|
+
|
|
2770
|
+
#### Features
|
|
2771
|
+
|
|
2772
|
+
- Field-type dispatch via map with `NgComponentOutlet`
|
|
2773
|
+
- Per-field substitution through `INPUT_FIELD_COMPONENTS_TOKEN`
|
|
2774
|
+
- Inline error rendering via `<smart-input-error>` (when `touched && errors`)
|
|
2775
|
+
- Label via `ModelLabelPipe`
|
|
2776
|
+
- Resolves `@Field()` metadata from the model decorator (with `create`/`update` mode merge)
|
|
2777
|
+
- `smart:` Tailwind prefix, dark mode via `smart:dark:`
|
|
2778
|
+
|
|
2779
|
+
### Date Range Component
|
|
2780
|
+
|
|
2781
|
+
The `<smart-date-range>` component provides a date range picker with a trigger button and a modal calendar overlay.
|
|
2782
|
+
|
|
2783
|
+
**Default component:** `DateRangeDefaultComponent` (selector: `smart-date-range`)
|
|
2784
|
+
**Base class:** `DateRangeBaseComponent` — provides `ControlValueAccessor` integration, open/close state, calendar data management, clear and apply logic.
|
|
2785
|
+
**Modal base class:** `DateRangeModalBaseComponent` — provides calendar rendering, quick filter buttons, date selection logic, and range restriction support.
|
|
2786
|
+
|
|
2787
|
+
#### Usage
|
|
2788
|
+
|
|
2789
|
+
```html
|
|
2790
|
+
<!-- Basic -->
|
|
2791
|
+
<smart-date-range [(ngModel)]="dateRange"></smart-date-range>
|
|
2792
|
+
|
|
2793
|
+
<!-- In reactive form -->
|
|
2794
|
+
<smart-date-range formControlName="period"></smart-date-range>
|
|
2795
|
+
```
|
|
2796
|
+
|
|
2797
|
+
#### Properties
|
|
2798
|
+
|
|
2799
|
+
| Property | Type | Default | Description |
|
|
2800
|
+
| --------- | -------------------------------------- | ----------- | -------------------------------------------------- |
|
|
2801
|
+
| `ngModel` | `ModelSignal<IDateRange \| undefined>` | `undefined` | Date range value (`start`, `end` in `YYYY-MM-DD`) |
|
|
2802
|
+
|
|
2803
|
+
#### IDateRange (from @smartsoft001/domain-core)
|
|
2804
|
+
|
|
2805
|
+
```typescript
|
|
2806
|
+
interface IDateRange {
|
|
2807
|
+
start: string; // YYYY-MM-DD
|
|
2808
|
+
end: string; // YYYY-MM-DD
|
|
2809
|
+
}
|
|
2810
|
+
```
|
|
2811
|
+
|
|
2812
|
+
#### Features
|
|
2813
|
+
|
|
2814
|
+
- Trigger button showing selected range or "select" placeholder
|
|
2815
|
+
- Clear button to reset value
|
|
2816
|
+
- Modal overlay with full calendar view
|
|
2817
|
+
- Quick filter buttons (Today, Yesterday, Last 7/30 days, This/Last Month)
|
|
2818
|
+
- Date range selection with visual highlighting
|
|
2819
|
+
- `ControlValueAccessor` integration
|
|
2820
|
+
- Dark mode support
|
|
2821
|
+
|
|
2822
|
+
### Date Edit Component
|
|
2823
|
+
|
|
2824
|
+
The `<smart-date-edit>` component provides a digit-by-digit date input editor (DD-MM-RRRR format).
|
|
2825
|
+
|
|
2826
|
+
**Default component:** `DateEditDefaultComponent` (selector: `smart-date-edit`)
|
|
2827
|
+
**Base class:** `DateEditBaseComponent` — provides `ControlValueAccessor` integration, digit-by-digit value management, date validation via moment.js, and auto-focus navigation logic.
|
|
2828
|
+
|
|
2829
|
+
#### Usage
|
|
2830
|
+
|
|
2831
|
+
```html
|
|
2832
|
+
<!-- Basic -->
|
|
2833
|
+
<smart-date-edit [(ngModel)]="dateValue"></smart-date-edit>
|
|
2834
|
+
|
|
2835
|
+
<!-- In reactive form -->
|
|
2836
|
+
<smart-date-edit formControlName="birthDate"></smart-date-edit>
|
|
2837
|
+
|
|
2838
|
+
<!-- Listen for validity -->
|
|
2839
|
+
<smart-date-edit [(ngModel)]="dateValue" (validChange)="onValid($event)"></smart-date-edit>
|
|
2840
|
+
```
|
|
2841
|
+
|
|
2842
|
+
#### Properties
|
|
2843
|
+
|
|
2844
|
+
| Property | Type | Default | Description |
|
|
2845
|
+
| ------------- | ------------------------ | -------------- | -------------------------------- |
|
|
2846
|
+
| `ngModel` | `ModelSignal<string>` | `'2001-01-01'` | Date value in `YYYY-MM-DD` format |
|
|
2847
|
+
| `validChange` | `OutputEmitter<boolean>` | - | Emits when date validity changes |
|
|
2848
|
+
|
|
2849
|
+
#### Features
|
|
2850
|
+
|
|
2851
|
+
- Digit-by-digit editing with auto-focus navigation
|
|
2852
|
+
- Date validation via moment.js
|
|
2853
|
+
- Invalid state visual feedback (red borders)
|
|
2854
|
+
- Dark mode support
|
|
2855
|
+
- `ControlValueAccessor` integration
|
|
2856
|
+
|
|
113
2857
|
|
|
114
2858
|
## 📜 License
|
|
115
2859
|
|