@gnggln/ng-ui-system 1.0.0-alpha.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/esm2022/gnggln-ng-ui-system.mjs +5 -0
- package/esm2022/lib/components/accordion/accordion.component.mjs +353 -0
- package/esm2022/lib/components/accordion/accordion.types.mjs +6 -0
- package/esm2022/lib/components/accordion/index.mjs +2 -0
- package/esm2022/lib/components/base-layout/base-layout.component.mjs +218 -0
- package/esm2022/lib/components/base-layout/base-layout.types.mjs +6 -0
- package/esm2022/lib/components/base-layout/index.mjs +14 -0
- package/esm2022/lib/components/button/button-area.component.mjs +196 -0
- package/esm2022/lib/components/button/button.component.mjs +164 -0
- package/esm2022/lib/components/button/button.types.mjs +6 -0
- package/esm2022/lib/components/button/index.mjs +16 -0
- package/esm2022/lib/components/crud-table/crud-table.component.mjs +789 -0
- package/esm2022/lib/components/crud-table/crud-table.types.mjs +6 -0
- package/esm2022/lib/components/crud-table/index.mjs +16 -0
- package/esm2022/lib/components/form-builder/adapters/it-date-adapter.mjs +82 -0
- package/esm2022/lib/components/form-builder/directives/currency-input.directive.mjs +184 -0
- package/esm2022/lib/components/form-builder/form-builder.component.mjs +824 -0
- package/esm2022/lib/components/form-builder/form-wizard.component.mjs +510 -0
- package/esm2022/lib/components/form-builder/index.mjs +19 -0
- package/esm2022/lib/components/form-builder/services/form-condition.service.mjs +132 -0
- package/esm2022/lib/components/form-builder/services/form-validation.service.mjs +381 -0
- package/esm2022/lib/components/form-builder/services/location.service.mjs +140 -0
- package/esm2022/lib/components/form-builder/services/wizard-sync.service.mjs +84 -0
- package/esm2022/lib/components/form-builder/sub-components/error-summary/form-error-summary.component.mjs +161 -0
- package/esm2022/lib/components/form-builder/sub-components/file-input/file-input.component.mjs +310 -0
- package/esm2022/lib/components/form-builder/sub-components/specifica-territoriale/specifica-territoriale.component.mjs +648 -0
- package/esm2022/lib/components/form-builder/sub-components/table-territoriale/table-territoriale.component.mjs +432 -0
- package/esm2022/lib/components/form-builder/types/condition.types.mjs +6 -0
- package/esm2022/lib/components/form-builder/types/field.types.mjs +6 -0
- package/esm2022/lib/components/form-builder/types/index.mjs +2 -0
- package/esm2022/lib/components/form-builder/types/schema.types.mjs +6 -0
- package/esm2022/lib/components/form-builder/types/territoriale.types.mjs +6 -0
- package/esm2022/lib/components/form-builder/types/validation.types.mjs +6 -0
- package/esm2022/lib/components/form-builder-editor/form-builder-editor.component.mjs +730 -0
- package/esm2022/lib/components/form-builder-editor/form-builder-editor.service.mjs +56 -0
- package/esm2022/lib/components/form-builder-editor/index.mjs +21 -0
- package/esm2022/lib/components/form-builder-editor/services/editor-persistence.service.mjs +190 -0
- package/esm2022/lib/components/form-builder-editor/services/editor-state.service.mjs +324 -0
- package/esm2022/lib/components/form-builder-editor/services/field-factory.service.mjs +188 -0
- package/esm2022/lib/components/form-builder-editor/sub-components/condition-editor/condition-editor.component.mjs +667 -0
- package/esm2022/lib/components/form-builder-editor/sub-components/editor-toolbar/editor-toolbar.component.mjs +317 -0
- package/esm2022/lib/components/form-builder-editor/sub-components/field-config-panel/field-config-panel.component.mjs +611 -0
- package/esm2022/lib/components/form-builder-editor/sub-components/field-palette/field-palette.component.mjs +267 -0
- package/esm2022/lib/components/form-builder-editor/sub-components/form-values-panel/form-values-panel.component.mjs +276 -0
- package/esm2022/lib/components/form-builder-editor/sub-components/options-editor/options-editor.component.mjs +323 -0
- package/esm2022/lib/components/form-builder-editor/sub-components/preview-container/preview-container.component.mjs +238 -0
- package/esm2022/lib/components/form-builder-editor/sub-components/section-editor/section-editor.component.mjs +472 -0
- package/esm2022/lib/components/form-builder-editor/sub-components/validation-editor/validation-editor.component.mjs +473 -0
- package/esm2022/lib/components/form-builder-editor/types/editor.types.mjs +6 -0
- package/esm2022/lib/components/layout-builder/index.mjs +18 -0
- package/esm2022/lib/components/layout-builder/layout-builder.component.mjs +1730 -0
- package/esm2022/lib/components/layout-builder/layout-builder.types.mjs +9 -0
- package/esm2022/lib/components/layout-builder/layout.service.mjs +239 -0
- package/esm2022/lib/components/modal/confirm-dialog.component.mjs +151 -0
- package/esm2022/lib/components/modal/index.mjs +4 -0
- package/esm2022/lib/components/modal/modal.component.mjs +139 -0
- package/esm2022/lib/components/modal/modal.service.mjs +194 -0
- package/esm2022/lib/components/modal/modal.types.mjs +6 -0
- package/esm2022/lib/components/page-header/breadcrumb.service.mjs +242 -0
- package/esm2022/lib/components/page-header/index.mjs +20 -0
- package/esm2022/lib/components/page-header/page-header.component.mjs +243 -0
- package/esm2022/lib/components/page-header/page-header.types.mjs +21 -0
- package/esm2022/lib/components/table/index.mjs +2 -0
- package/esm2022/lib/components/table/paginated-table.component.mjs +407 -0
- package/esm2022/lib/components/table/table.types.mjs +6 -0
- package/esm2022/lib/core/types/index.mjs +6 -0
- package/esm2022/lib/core/utils/index.mjs +53 -0
- package/esm2022/lib/sources/location-data.opt.json +8942 -0
- package/esm2022/lib/sources/nazioni.opt.json +215 -0
- package/esm2022/public-api.mjs +34 -0
- package/fesm2022/gnggln-ng-ui-system.mjs +55752 -0
- package/fesm2022/gnggln-ng-ui-system.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/components/accordion/accordion.component.d.ts +118 -0
- package/lib/components/accordion/accordion.types.d.ts +62 -0
- package/lib/components/accordion/index.d.ts +2 -0
- package/lib/components/base-layout/base-layout.component.d.ts +83 -0
- package/lib/components/base-layout/base-layout.types.d.ts +26 -0
- package/lib/components/base-layout/index.d.ts +13 -0
- package/lib/components/button/button-area.component.d.ts +88 -0
- package/lib/components/button/button.component.d.ts +55 -0
- package/lib/components/button/button.types.d.ts +70 -0
- package/lib/components/button/index.d.ts +15 -0
- package/lib/components/crud-table/crud-table.component.d.ts +143 -0
- package/lib/components/crud-table/crud-table.types.d.ts +207 -0
- package/lib/components/crud-table/index.d.ts +15 -0
- package/lib/components/form-builder/adapters/it-date-adapter.d.ts +32 -0
- package/lib/components/form-builder/directives/currency-input.directive.d.ts +48 -0
- package/lib/components/form-builder/form-builder.component.d.ts +183 -0
- package/lib/components/form-builder/form-wizard.component.d.ts +87 -0
- package/lib/components/form-builder/index.d.ts +13 -0
- package/lib/components/form-builder/services/form-condition.service.d.ts +46 -0
- package/lib/components/form-builder/services/form-validation.service.d.ts +63 -0
- package/lib/components/form-builder/services/location.service.d.ts +83 -0
- package/lib/components/form-builder/services/wizard-sync.service.d.ts +63 -0
- package/lib/components/form-builder/sub-components/error-summary/form-error-summary.component.d.ts +28 -0
- package/lib/components/form-builder/sub-components/file-input/file-input.component.d.ts +41 -0
- package/lib/components/form-builder/sub-components/specifica-territoriale/specifica-territoriale.component.d.ts +145 -0
- package/lib/components/form-builder/sub-components/table-territoriale/table-territoriale.component.d.ts +108 -0
- package/lib/components/form-builder/types/condition.types.d.ts +51 -0
- package/lib/components/form-builder/types/field.types.d.ts +288 -0
- package/lib/components/form-builder/types/index.d.ts +5 -0
- package/lib/components/form-builder/types/schema.types.d.ts +227 -0
- package/lib/components/form-builder/types/territoriale.types.d.ts +170 -0
- package/lib/components/form-builder/types/validation.types.d.ts +174 -0
- package/lib/components/form-builder-editor/form-builder-editor.component.d.ts +117 -0
- package/lib/components/form-builder-editor/form-builder-editor.service.d.ts +38 -0
- package/lib/components/form-builder-editor/index.d.ts +15 -0
- package/lib/components/form-builder-editor/services/editor-persistence.service.d.ts +42 -0
- package/lib/components/form-builder-editor/services/editor-state.service.d.ts +66 -0
- package/lib/components/form-builder-editor/services/field-factory.service.d.ts +28 -0
- package/lib/components/form-builder-editor/sub-components/condition-editor/condition-editor.component.d.ts +139 -0
- package/lib/components/form-builder-editor/sub-components/editor-toolbar/editor-toolbar.component.d.ts +43 -0
- package/lib/components/form-builder-editor/sub-components/field-config-panel/field-config-panel.component.d.ts +83 -0
- package/lib/components/form-builder-editor/sub-components/field-palette/field-palette.component.d.ts +40 -0
- package/lib/components/form-builder-editor/sub-components/form-values-panel/form-values-panel.component.d.ts +51 -0
- package/lib/components/form-builder-editor/sub-components/options-editor/options-editor.component.d.ts +63 -0
- package/lib/components/form-builder-editor/sub-components/preview-container/preview-container.component.d.ts +68 -0
- package/lib/components/form-builder-editor/sub-components/section-editor/section-editor.component.d.ts +82 -0
- package/lib/components/form-builder-editor/sub-components/validation-editor/validation-editor.component.d.ts +112 -0
- package/lib/components/form-builder-editor/types/editor.types.d.ts +124 -0
- package/lib/components/layout-builder/index.d.ts +16 -0
- package/lib/components/layout-builder/layout-builder.component.d.ts +85 -0
- package/lib/components/layout-builder/layout-builder.types.d.ts +436 -0
- package/lib/components/layout-builder/layout.service.d.ts +100 -0
- package/lib/components/modal/confirm-dialog.component.d.ts +46 -0
- package/lib/components/modal/index.d.ts +4 -0
- package/lib/components/modal/modal.component.d.ts +44 -0
- package/lib/components/modal/modal.service.d.ts +93 -0
- package/lib/components/modal/modal.types.d.ts +110 -0
- package/lib/components/page-header/breadcrumb.service.d.ts +96 -0
- package/lib/components/page-header/index.d.ts +16 -0
- package/lib/components/page-header/page-header.component.d.ts +59 -0
- package/lib/components/page-header/page-header.types.d.ts +96 -0
- package/lib/components/table/index.d.ts +2 -0
- package/lib/components/table/paginated-table.component.d.ts +85 -0
- package/lib/components/table/table.types.d.ts +81 -0
- package/lib/core/types/index.d.ts +57 -0
- package/lib/core/utils/index.d.ts +29 -0
- package/package.json +44 -0
- package/public-api.d.ts +22 -0
package/index.d.ts
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { EventEmitter, DoCheck, TemplateRef } from '@angular/core';
|
|
2
|
+
import { UiAccordionDescriptor, UiAccordionToggleEvent, UiAccordionMode } from './accordion.types';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* Accordion configurabile, data-driven, con supporto multi/single expand,
|
|
6
|
+
* animazioni CSS, icone Lucide e template personalizzabili.
|
|
7
|
+
*
|
|
8
|
+
* Il contenuto dei pannelli viene fornito tramite un `itemTemplate`
|
|
9
|
+
* che riceve il descriptor del pannello come contesto.
|
|
10
|
+
*
|
|
11
|
+
* @selector ui-accordion
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```html
|
|
15
|
+
* <ui-accordion
|
|
16
|
+
* [items]="sections"
|
|
17
|
+
* [itemTemplate]="panelTpl"
|
|
18
|
+
* mode="single"
|
|
19
|
+
* >
|
|
20
|
+
* <ng-template #panelTpl let-item>
|
|
21
|
+
* @switch (item.id) {
|
|
22
|
+
* @case ('info') { <app-info-panel /> }
|
|
23
|
+
* @case ('address') { <app-address-form /> }
|
|
24
|
+
* }
|
|
25
|
+
* </ng-template>
|
|
26
|
+
* </ui-accordion>
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* sections: UiAccordionDescriptor[] = [
|
|
32
|
+
* { id: 'info', title: 'Informazioni', icon: 'info', expanded: true },
|
|
33
|
+
* { id: 'address', title: 'Indirizzo', icon: 'map-pin' },
|
|
34
|
+
* ];
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare class UiAccordionComponent implements DoCheck {
|
|
38
|
+
private readonly cdr;
|
|
39
|
+
/**
|
|
40
|
+
* Fingerprint dell'ultimo stato dei descriptor.
|
|
41
|
+
* Usato da DoCheck per rilevare mutazioni in-place sulle proprieta
|
|
42
|
+
* degli item senza richiedere un nuovo riferimento dell'array.
|
|
43
|
+
*/
|
|
44
|
+
private _lastFingerprint;
|
|
45
|
+
/**
|
|
46
|
+
* Array di descriptor dei pannelli.
|
|
47
|
+
* Pannelli con `hidden: true` vengono filtrati automaticamente.
|
|
48
|
+
*
|
|
49
|
+
* Supporta sia aggiornamenti immutabili (nuovo array) sia
|
|
50
|
+
* mutazioni in-place delle proprieta dei descriptor.
|
|
51
|
+
*/
|
|
52
|
+
items: UiAccordionDescriptor[];
|
|
53
|
+
/**
|
|
54
|
+
* Template per il contenuto di ogni pannello.
|
|
55
|
+
* Il contesto fornisce il descriptor come `$implicit`.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```html
|
|
59
|
+
* <ng-template #tpl let-item>
|
|
60
|
+
* <p>Contenuto per: {{ item.title }}</p>
|
|
61
|
+
* </ng-template>
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
itemTemplate: TemplateRef<unknown> | null;
|
|
65
|
+
/**
|
|
66
|
+
* Template opzionale per contenuto aggiuntivo nell'header.
|
|
67
|
+
* Il contesto fornisce il descriptor come `$implicit`.
|
|
68
|
+
* Viene renderizzato tra il titolo e il chevron.
|
|
69
|
+
*/
|
|
70
|
+
headerTemplate: TemplateRef<unknown> | null;
|
|
71
|
+
/**
|
|
72
|
+
* Modalita di espansione.
|
|
73
|
+
* - `multi`: piu pannelli aperti contemporaneamente
|
|
74
|
+
* - `single`: un solo pannello aperto alla volta
|
|
75
|
+
*/
|
|
76
|
+
mode: UiAccordionMode;
|
|
77
|
+
/** Label accessibile per il gruppo accordion. */
|
|
78
|
+
ariaLabel: string;
|
|
79
|
+
/** Emesso quando un pannello viene aperto o chiuso. */
|
|
80
|
+
itemToggled: EventEmitter<UiAccordionToggleEvent>;
|
|
81
|
+
/**
|
|
82
|
+
* Rileva mutazioni in-place sulle proprieta dei descriptor.
|
|
83
|
+
* Confronta un fingerprint leggero dello stato corrente con quello
|
|
84
|
+
* precedente e, se diverso, forza un ciclo di change detection.
|
|
85
|
+
*
|
|
86
|
+
* Questo permette al consumatore di fare sia:
|
|
87
|
+
* - `items[2].hidden = true` (mutazione in-place)
|
|
88
|
+
* - `items = [...newItems]` (nuovo riferimento)
|
|
89
|
+
*/
|
|
90
|
+
ngDoCheck(): void;
|
|
91
|
+
/** Pannelli visibili (non hidden). */
|
|
92
|
+
get visibleItems(): UiAccordionDescriptor[];
|
|
93
|
+
/** Alterna l'espansione di un pannello. */
|
|
94
|
+
toggle(item: UiAccordionDescriptor): void;
|
|
95
|
+
/** Apre un pannello specifico per id. */
|
|
96
|
+
open(id: string): void;
|
|
97
|
+
/** Chiude un pannello specifico per id. */
|
|
98
|
+
close(id: string): void;
|
|
99
|
+
/** Apre tutti i pannelli (solo in modalita multi). */
|
|
100
|
+
openAll(): void;
|
|
101
|
+
/** Chiude tutti i pannelli. */
|
|
102
|
+
closeAll(): void;
|
|
103
|
+
/** @internal Classi CSS per il pannello. */
|
|
104
|
+
getPanelClasses(item: UiAccordionDescriptor): string;
|
|
105
|
+
/** @internal Sposta il focus al primo header. */
|
|
106
|
+
focusFirst(event: Event): void;
|
|
107
|
+
/** @internal Sposta il focus all'ultimo header. */
|
|
108
|
+
focusLast(event: Event): void;
|
|
109
|
+
/** @internal Recupera tutti gli header button del DOM. */
|
|
110
|
+
private getHeaders;
|
|
111
|
+
/**
|
|
112
|
+
* @internal Calcola un fingerprint leggero basato sulle proprieta
|
|
113
|
+
* reattive dei descriptor (quelle che influenzano il rendering).
|
|
114
|
+
*/
|
|
115
|
+
private computeFingerprint;
|
|
116
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<UiAccordionComponent, never>;
|
|
117
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<UiAccordionComponent, "ui-accordion", never, { "items": { "alias": "items"; "required": false; }; "itemTemplate": { "alias": "itemTemplate"; "required": false; }; "headerTemplate": { "alias": "headerTemplate"; "required": false; }; "mode": { "alias": "mode"; "required": false; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; }; }, { "itemToggled": "itemToggled"; }, never, never, true, never>;
|
|
118
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module ng-ui-system/accordion
|
|
3
|
+
* Tipi e interfacce per UiAccordion.
|
|
4
|
+
*/
|
|
5
|
+
import { UiIconName } from '../../core/types';
|
|
6
|
+
export { UiIconName };
|
|
7
|
+
/**
|
|
8
|
+
* Descriptor per un singolo pannello dell'accordion.
|
|
9
|
+
*
|
|
10
|
+
* Consente di definire accordion come strutture dati dichiarative,
|
|
11
|
+
* aggiornabili dinamicamente tramite manipolazione dell'array.
|
|
12
|
+
*
|
|
13
|
+
* @usageNotes
|
|
14
|
+
* ### Utilizzo base
|
|
15
|
+
* ```typescript
|
|
16
|
+
* const items: UiAccordionDescriptor[] = [
|
|
17
|
+
* { id: 'info', title: 'Informazioni generali', icon: 'info' },
|
|
18
|
+
* { id: 'address', title: 'Indirizzo', icon: 'map-pin' },
|
|
19
|
+
* { id: 'notes', title: 'Note aggiuntive', expanded: true },
|
|
20
|
+
* ];
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* ### Visibilita condizionale
|
|
24
|
+
* ```typescript
|
|
25
|
+
* items[2].hidden = !this.hasNotes;
|
|
26
|
+
* items[1].disabled = this.isReadonly;
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export interface UiAccordionDescriptor {
|
|
30
|
+
/** Identificatore univoco del pannello. */
|
|
31
|
+
id: string;
|
|
32
|
+
/** Titolo visualizzato nell'header del pannello. */
|
|
33
|
+
title: string;
|
|
34
|
+
/** Icona Lucide opzionale mostrata prima del titolo. @see https://lucide.dev/icons */
|
|
35
|
+
icon?: UiIconName;
|
|
36
|
+
/** Stato iniziale di espansione. @default false */
|
|
37
|
+
expanded?: boolean;
|
|
38
|
+
/** Disabilita l'interazione con il pannello. @default false */
|
|
39
|
+
disabled?: boolean;
|
|
40
|
+
/** Nasconde il pannello dall'interfaccia. @default false */
|
|
41
|
+
hidden?: boolean;
|
|
42
|
+
/** Descrizione secondaria mostrata accanto al titolo. */
|
|
43
|
+
subtitle?: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Evento emesso quando un pannello viene aperto o chiuso.
|
|
47
|
+
*/
|
|
48
|
+
export interface UiAccordionToggleEvent {
|
|
49
|
+
/** Descriptor del pannello coinvolto. */
|
|
50
|
+
item: UiAccordionDescriptor;
|
|
51
|
+
/** `true` se il pannello e stato aperto, `false` se chiuso. */
|
|
52
|
+
expanded: boolean;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Modalita di espansione dell'accordion.
|
|
56
|
+
*
|
|
57
|
+
* | Modalita | Comportamento |
|
|
58
|
+
* |---------|------------------------------------------------|
|
|
59
|
+
* | `multi` | Piu pannelli possono essere aperti contemporaneamente |
|
|
60
|
+
* | `single`| Un solo pannello aperto alla volta (gli altri si chiudono) |
|
|
61
|
+
*/
|
|
62
|
+
export type UiAccordionMode = 'multi' | 'single';
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { OnInit } from '@angular/core';
|
|
2
|
+
import { UiButtonDescriptor, UiButtonAreaAlign } from '../button/button.types';
|
|
3
|
+
import { UiBackButtonConfig } from './base-layout.types';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
/**
|
|
6
|
+
* Full-page layout component that combines a page header (breadcrumbs + title),
|
|
7
|
+
* a main content area via `<ng-content>`, and a sticky footer action bar
|
|
8
|
+
* powered by `UiButtonAreaComponent`.
|
|
9
|
+
*
|
|
10
|
+
* Optionally renders an automatic "back" button in the footer, derived from
|
|
11
|
+
* the breadcrumb trail (navigates to the parent breadcrumb).
|
|
12
|
+
*
|
|
13
|
+
* @selector ui-base-layout
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```html
|
|
17
|
+
* <ui-base-layout [actions]="pageActions" footerAlign="end">
|
|
18
|
+
* <p>Your page content here</p>
|
|
19
|
+
* </ui-base-layout>
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```html
|
|
24
|
+
* <!-- With back button and custom title -->
|
|
25
|
+
* <ui-base-layout
|
|
26
|
+
* title="Dettaglio utente"
|
|
27
|
+
* [showBackButton]="true"
|
|
28
|
+
* [actions]="[
|
|
29
|
+
* { id: 'save', label: 'Salva', variant: 'primary', icon: 'save', action: save },
|
|
30
|
+
* ]"
|
|
31
|
+
* >
|
|
32
|
+
* <app-user-detail />
|
|
33
|
+
* </ui-base-layout>
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare class UiBaseLayoutComponent implements OnInit {
|
|
37
|
+
/** Whether to display the page header (breadcrumbs + title). */
|
|
38
|
+
showHeader: boolean;
|
|
39
|
+
/** Override the auto-detected page title. Passed through to `ui-page-header`. */
|
|
40
|
+
title: string;
|
|
41
|
+
/** Route path for the Home breadcrumb link. */
|
|
42
|
+
homeRoute: string;
|
|
43
|
+
/** Whether to display the Home link in the breadcrumb trail. */
|
|
44
|
+
showHome: boolean;
|
|
45
|
+
/** When `true`, updates `document.title` on navigation. */
|
|
46
|
+
updateDocumentTitle: boolean;
|
|
47
|
+
/** Suffix appended to `document.title`. */
|
|
48
|
+
titleSuffix: string;
|
|
49
|
+
/** Whether to show an automatic "back" button based on breadcrumbs. */
|
|
50
|
+
showBackButton: boolean;
|
|
51
|
+
/** Configuration overrides for the automatic back button. */
|
|
52
|
+
backButtonConfig: UiBackButtonConfig;
|
|
53
|
+
/** Array of button descriptors for the footer action area. */
|
|
54
|
+
actions: UiButtonDescriptor[];
|
|
55
|
+
/** Horizontal alignment of the footer button area. */
|
|
56
|
+
footerAlign: UiButtonAreaAlign;
|
|
57
|
+
/** Gap size between footer buttons. */
|
|
58
|
+
footerGap: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
59
|
+
private readonly router;
|
|
60
|
+
private readonly location;
|
|
61
|
+
private readonly activatedRoute;
|
|
62
|
+
private readonly breadcrumbService;
|
|
63
|
+
private readonly destroyRef;
|
|
64
|
+
/** @internal Current breadcrumbs, updated on each navigation. */
|
|
65
|
+
private breadcrumbs;
|
|
66
|
+
/**
|
|
67
|
+
* Merged action list (back button + consumer actions).
|
|
68
|
+
* Computed on every change-detection check so it stays in sync
|
|
69
|
+
* with both navigation state (breadcrumbs) and input changes.
|
|
70
|
+
*/
|
|
71
|
+
get mergedActions(): UiButtonDescriptor[];
|
|
72
|
+
/** Whether the footer should render (at least one non-hidden action exists). */
|
|
73
|
+
get hasVisibleActions(): boolean;
|
|
74
|
+
ngOnInit(): void;
|
|
75
|
+
/** @internal Refreshes breadcrumb state from the current route. */
|
|
76
|
+
private refreshBreadcrumbs;
|
|
77
|
+
/** @internal Determines the back navigation target from breadcrumbs. */
|
|
78
|
+
private getBackTarget;
|
|
79
|
+
/** @internal Navigates to the parent breadcrumb or falls back to browser history. */
|
|
80
|
+
private navigateBack;
|
|
81
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<UiBaseLayoutComponent, never>;
|
|
82
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<UiBaseLayoutComponent, "ui-base-layout", never, { "showHeader": { "alias": "showHeader"; "required": false; }; "title": { "alias": "title"; "required": false; }; "homeRoute": { "alias": "homeRoute"; "required": false; }; "showHome": { "alias": "showHome"; "required": false; }; "updateDocumentTitle": { "alias": "updateDocumentTitle"; "required": false; }; "titleSuffix": { "alias": "titleSuffix"; "required": false; }; "showBackButton": { "alias": "showBackButton"; "required": false; }; "backButtonConfig": { "alias": "backButtonConfig"; "required": false; }; "actions": { "alias": "actions"; "required": false; }; "footerAlign": { "alias": "footerAlign"; "required": false; }; "footerGap": { "alias": "footerGap"; "required": false; }; }, {}, never, ["*"], true, never>;
|
|
83
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module ng-ui-system/base-layout
|
|
3
|
+
* Types and interfaces for UiBaseLayout component.
|
|
4
|
+
*/
|
|
5
|
+
import { UiButtonDescriptor, UiButtonAreaAlign } from '../button/button.types';
|
|
6
|
+
export { UiButtonDescriptor, UiButtonAreaAlign };
|
|
7
|
+
/**
|
|
8
|
+
* Configuration for the automatic "back" button rendered in the footer action area.
|
|
9
|
+
*
|
|
10
|
+
* @usageNotes
|
|
11
|
+
* ```typescript
|
|
12
|
+
* const backConfig: UiBackButtonConfig = {
|
|
13
|
+
* label: 'Indietro',
|
|
14
|
+
* icon: 'arrow-left',
|
|
15
|
+
* variant: 'outline',
|
|
16
|
+
* };
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export interface UiBackButtonConfig {
|
|
20
|
+
/** Label text for the back button. @default 'Indietro' */
|
|
21
|
+
label?: string;
|
|
22
|
+
/** Lucide icon name. @default 'arrow-left' */
|
|
23
|
+
icon?: string;
|
|
24
|
+
/** Visual variant. @default 'outline' */
|
|
25
|
+
variant?: string;
|
|
26
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ng-ui-system — Base Layout entry point.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```typescript
|
|
6
|
+
* import {
|
|
7
|
+
* UiBaseLayoutComponent,
|
|
8
|
+
* UiBackButtonConfig,
|
|
9
|
+
* } from 'ng-ui-system';
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export { UiBaseLayoutComponent } from './base-layout.component';
|
|
13
|
+
export { UiBackButtonConfig } from './base-layout.types';
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { UiSize } from '../../core/types';
|
|
2
|
+
import { UiButtonDescriptor, UiButtonAreaAlign } from './button.types';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* Standalone button-group component driven by a `UiButtonDescriptor[]` configuration.
|
|
6
|
+
*
|
|
7
|
+
* Renders a group of `UiButton` instances from declarative descriptors.
|
|
8
|
+
* Supports per-button loading/disabled states, dynamic visibility,
|
|
9
|
+
* alignment control, and optional navigation via Angular Router.
|
|
10
|
+
*
|
|
11
|
+
* @selector ui-button-area
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```html
|
|
15
|
+
* <ui-button-area
|
|
16
|
+
* [buttons]="actions"
|
|
17
|
+
* align="end"
|
|
18
|
+
* gap="sm"
|
|
19
|
+
* [loadingIds]="currentlyLoading"
|
|
20
|
+
* />
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* // Dynamic configuration
|
|
26
|
+
* actions: UiButtonDescriptor[] = [
|
|
27
|
+
* { id: 'export', label: 'Export Excel', icon: 'file-spreadsheet', variant: 'primary',
|
|
28
|
+
* action: () => this.exportExcel() },
|
|
29
|
+
* { id: 'delete', label: 'Delete', icon: 'trash-2', variant: 'warn',
|
|
30
|
+
* action: () => this.deleteSelected(), hidden: !this.hasSelection },
|
|
31
|
+
* ];
|
|
32
|
+
*
|
|
33
|
+
* // Set loading state from outside:
|
|
34
|
+
* currentlyLoading: string | string[] | null = 'export';
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare class UiButtonAreaComponent {
|
|
38
|
+
/**
|
|
39
|
+
* Array of button descriptors to render.
|
|
40
|
+
* Buttons with `hidden: true` are filtered out.
|
|
41
|
+
*/
|
|
42
|
+
buttons: UiButtonDescriptor[];
|
|
43
|
+
/** Horizontal alignment of the button group. */
|
|
44
|
+
align: UiButtonAreaAlign;
|
|
45
|
+
/** Accessible group label for screen readers. */
|
|
46
|
+
ariaLabel: string;
|
|
47
|
+
/** Gap between buttons (maps to design token spacing). */
|
|
48
|
+
gap: UiSize;
|
|
49
|
+
/** Stack buttons vertically on mobile viewports (<600px). */
|
|
50
|
+
stackOnMobile: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* When `true`, all buttons are disabled while any button is in a loading state.
|
|
53
|
+
* Useful to prevent double-actions during async operations.
|
|
54
|
+
*/
|
|
55
|
+
disableWhileLoading: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Set one or more buttons to a loading state by their `id`.
|
|
58
|
+
* Accepts a single string, an array of strings, or `null` to clear.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```html
|
|
62
|
+
* <!-- Single -->
|
|
63
|
+
* <ui-button-area [loadingIds]="'save'" />
|
|
64
|
+
*
|
|
65
|
+
* <!-- Multiple -->
|
|
66
|
+
* <ui-button-area [loadingIds]="['save', 'export']" />
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
set loadingIds(value: string | string[] | null | undefined);
|
|
70
|
+
/** @internal */
|
|
71
|
+
private _loadingIds;
|
|
72
|
+
/** @internal Optional router for href navigation. */
|
|
73
|
+
private router;
|
|
74
|
+
/** Buttons filtered to visible (non-hidden) entries. */
|
|
75
|
+
get visibleButtons(): UiButtonDescriptor[];
|
|
76
|
+
/** Assembled CSS class string for the button area container. */
|
|
77
|
+
get areaClasses(): string;
|
|
78
|
+
/** @internal Track function for @for loop. */
|
|
79
|
+
trackButton(index: number, button: UiButtonDescriptor): string;
|
|
80
|
+
/** Whether a specific button is in a loading state. */
|
|
81
|
+
isButtonLoading(button: UiButtonDescriptor): boolean;
|
|
82
|
+
/** Whether a specific button is disabled (includes loading logic). */
|
|
83
|
+
isButtonDisabled(button: UiButtonDescriptor): boolean;
|
|
84
|
+
/** @internal Handles button click: calls action callback and/or navigates. */
|
|
85
|
+
handleButtonClick(button: UiButtonDescriptor, event: MouseEvent): void;
|
|
86
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<UiButtonAreaComponent, never>;
|
|
87
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<UiButtonAreaComponent, "ui-button-area", never, { "buttons": { "alias": "buttons"; "required": false; }; "align": { "alias": "align"; "required": false; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; }; "gap": { "alias": "gap"; "required": false; }; "stackOnMobile": { "alias": "stackOnMobile"; "required": false; }; "disableWhileLoading": { "alias": "disableWhileLoading"; "required": false; }; "loadingIds": { "alias": "loadingIds"; "required": false; }; }, {}, never, never, true, never>;
|
|
88
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { UiVariant, UiSize, UiIconName } from '../../core/types';
|
|
2
|
+
import { UiIconPosition } from './button.types';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* Standalone button component with design-token-driven theming,
|
|
6
|
+
* variant/size system, Lucide icon support, loading states, and WCAG 2.1 AA accessibility.
|
|
7
|
+
*
|
|
8
|
+
* Uses native `<button>` click events — listen with `(click)` on the host element.
|
|
9
|
+
*
|
|
10
|
+
* @selector ui-button
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```html
|
|
14
|
+
* <!-- Basic -->
|
|
15
|
+
* <ui-button label="Save" variant="primary" icon="save" (click)="save()" />
|
|
16
|
+
*
|
|
17
|
+
* <!-- Loading -->
|
|
18
|
+
* <ui-button label="Submitting..." variant="primary" [loading]="true" />
|
|
19
|
+
*
|
|
20
|
+
* <!-- Icon-only -->
|
|
21
|
+
* <ui-button icon="trash-2" variant="warn" ariaLabel="Delete item" (click)="delete()" />
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare class UiButtonComponent {
|
|
25
|
+
/** Button label text. */
|
|
26
|
+
label: string;
|
|
27
|
+
/** Tooltip text shown on hover (uses Angular Material tooltip). */
|
|
28
|
+
tooltip: string;
|
|
29
|
+
/** Visual style variant. */
|
|
30
|
+
variant: UiVariant;
|
|
31
|
+
/** Size variant. */
|
|
32
|
+
size: UiSize;
|
|
33
|
+
/** Lucide icon name. @see https://lucide.dev/icons */
|
|
34
|
+
icon?: UiIconName;
|
|
35
|
+
/** Icon position relative to the label. */
|
|
36
|
+
iconPosition: UiIconPosition;
|
|
37
|
+
/** Whether the button is in a loading state. Disables interaction and shows spinner. */
|
|
38
|
+
loading: boolean;
|
|
39
|
+
/** Whether the button is disabled. */
|
|
40
|
+
disabled: boolean;
|
|
41
|
+
/** Expand button to full container width. */
|
|
42
|
+
fullWidth: boolean;
|
|
43
|
+
/** HTML button type attribute. */
|
|
44
|
+
type: 'button' | 'submit' | 'reset';
|
|
45
|
+
/** Accessible label override (required for icon-only buttons). */
|
|
46
|
+
ariaLabel?: string;
|
|
47
|
+
/** Additional CSS class for edge cases. */
|
|
48
|
+
customClass?: string;
|
|
49
|
+
/** Computed icon pixel size based on button size. */
|
|
50
|
+
get iconSize(): number;
|
|
51
|
+
/** Assembled CSS class string for the native button element. */
|
|
52
|
+
get buttonClasses(): string;
|
|
53
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<UiButtonComponent, never>;
|
|
54
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<UiButtonComponent, "ui-button", never, { "label": { "alias": "label"; "required": false; }; "tooltip": { "alias": "tooltip"; "required": false; }; "variant": { "alias": "variant"; "required": false; }; "size": { "alias": "size"; "required": false; }; "icon": { "alias": "icon"; "required": false; }; "iconPosition": { "alias": "iconPosition"; "required": false; }; "loading": { "alias": "loading"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "fullWidth": { "alias": "fullWidth"; "required": false; }; "type": { "alias": "type"; "required": false; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; }; "customClass": { "alias": "customClass"; "required": false; }; }, {}, never, ["*"], true, never>;
|
|
55
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module ng-ui-system/button
|
|
3
|
+
* Types and interfaces for UiButton and UiButtonArea components.
|
|
4
|
+
*/
|
|
5
|
+
import { UiVariant, UiSize, UiIconName } from '../../core/types';
|
|
6
|
+
export { UiVariant, UiSize, UiIconName };
|
|
7
|
+
/**
|
|
8
|
+
* Position of the icon relative to the button label.
|
|
9
|
+
*/
|
|
10
|
+
export type UiIconPosition = 'leading' | 'trailing';
|
|
11
|
+
/**
|
|
12
|
+
* Descriptor for declarative button configuration in UiButtonArea.
|
|
13
|
+
*
|
|
14
|
+
* Allows defining button groups as data structures, enabling
|
|
15
|
+
* dynamic UI updates through configuration manipulation.
|
|
16
|
+
*
|
|
17
|
+
* @usageNotes
|
|
18
|
+
*
|
|
19
|
+
* ### Basic usage
|
|
20
|
+
* ```typescript
|
|
21
|
+
* const actions: UiButtonDescriptor[] = [
|
|
22
|
+
* { id: 'save', label: 'Save', variant: 'primary', icon: 'save', action: () => this.save() },
|
|
23
|
+
* { id: 'cancel', label: 'Cancel', variant: 'outline', action: () => this.cancel() },
|
|
24
|
+
* ];
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* ### Dynamic loading state
|
|
28
|
+
* ```typescript
|
|
29
|
+
* // Toggle loading on a specific button by mutating the descriptor:
|
|
30
|
+
* this.actions[0].loading = true;
|
|
31
|
+
*
|
|
32
|
+
* // Or use loadingIds on the button area:
|
|
33
|
+
* this.currentLoadingIds = ['save'];
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export interface UiButtonDescriptor {
|
|
37
|
+
/** Unique identifier for programmatic state control (loading, disabled). */
|
|
38
|
+
id?: string;
|
|
39
|
+
/** Button label text. */
|
|
40
|
+
label: string;
|
|
41
|
+
/** Tooltip text shown on hover. */
|
|
42
|
+
tooltip?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Click handler. Supports both sync and async callbacks.
|
|
45
|
+
* Receives the native MouseEvent as argument.
|
|
46
|
+
*/
|
|
47
|
+
action?: (event?: MouseEvent) => void | Promise<void>;
|
|
48
|
+
/** Lucide icon name. @see https://lucide.dev/icons */
|
|
49
|
+
icon?: UiIconName;
|
|
50
|
+
/** Icon position relative to the label. @default 'trailing' */
|
|
51
|
+
iconPosition?: UiIconPosition;
|
|
52
|
+
/** Visual variant. @default 'primary' */
|
|
53
|
+
variant?: UiVariant;
|
|
54
|
+
/** Size variant. @default 'md' */
|
|
55
|
+
size?: UiSize;
|
|
56
|
+
/** Navigation URL (Angular Router navigateByUrl). */
|
|
57
|
+
href?: string;
|
|
58
|
+
/** Whether this button is in a loading state. */
|
|
59
|
+
loading?: boolean;
|
|
60
|
+
/** Whether this button is disabled. */
|
|
61
|
+
disabled?: boolean;
|
|
62
|
+
/** Whether this button is hidden from the UI. */
|
|
63
|
+
hidden?: boolean;
|
|
64
|
+
/** Additional CSS class for edge cases. */
|
|
65
|
+
customClass?: string;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Alignment options for UiButtonArea.
|
|
69
|
+
*/
|
|
70
|
+
export type UiButtonAreaAlign = 'start' | 'center' | 'end' | 'between';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ng-ui-system — Button entry point.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```typescript
|
|
6
|
+
* import {
|
|
7
|
+
* UiButtonComponent,
|
|
8
|
+
* UiButtonAreaComponent,
|
|
9
|
+
* UiButtonDescriptor,
|
|
10
|
+
* } from 'ng-ui-system';
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
export { UiButtonComponent } from './button.component';
|
|
14
|
+
export { UiButtonAreaComponent } from './button-area.component';
|
|
15
|
+
export { UiButtonDescriptor, UiButtonAreaAlign, UiIconPosition, } from './button.types';
|