@starterlib/ui 0.7.2 → 0.8.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 +95 -42
- package/fesm2022/starterlib-ui-arbre.mjs +82 -0
- package/fesm2022/starterlib-ui-arbre.mjs.map +1 -0
- package/fesm2022/starterlib-ui-donnees.mjs +532 -0
- package/fesm2022/starterlib-ui-donnees.mjs.map +1 -0
- package/fesm2022/starterlib-ui-formulaires.mjs +2 -1
- package/fesm2022/starterlib-ui-formulaires.mjs.map +1 -1
- package/fesm2022/starterlib-ui-interactions.mjs +34 -589
- package/fesm2022/starterlib-ui-interactions.mjs.map +1 -1
- package/fesm2022/starterlib-ui-libelles-en.mjs +142 -0
- package/fesm2022/starterlib-ui-libelles-en.mjs.map +1 -0
- package/fesm2022/starterlib-ui-listes.mjs +671 -0
- package/fesm2022/starterlib-ui-listes.mjs.map +1 -0
- package/fesm2022/starterlib-ui-navigation.mjs +246 -0
- package/fesm2022/starterlib-ui-navigation.mjs.map +1 -0
- package/fesm2022/starterlib-ui-onglets.mjs +137 -0
- package/fesm2022/starterlib-ui-onglets.mjs.map +1 -0
- package/fesm2022/starterlib-ui-saisie.mjs +1632 -0
- package/fesm2022/starterlib-ui-saisie.mjs.map +1 -0
- package/fesm2022/starterlib-ui-selection.mjs +269 -0
- package/fesm2022/starterlib-ui-selection.mjs.map +1 -0
- package/fesm2022/starterlib-ui.mjs +105 -2931
- package/fesm2022/starterlib-ui.mjs.map +1 -1
- package/package.json +35 -3
- package/types/starterlib-ui-arbre.d.ts +51 -0
- package/types/starterlib-ui-donnees.d.ts +228 -0
- package/types/starterlib-ui-formulaires.d.ts +5 -4
- package/types/starterlib-ui-interactions.d.ts +4 -316
- package/types/starterlib-ui-libelles-en.d.ts +25 -0
- package/types/starterlib-ui-listes.d.ts +432 -0
- package/types/starterlib-ui-navigation.d.ts +104 -0
- package/types/starterlib-ui-onglets.d.ts +89 -0
- package/types/starterlib-ui-saisie.d.ts +924 -0
- package/types/starterlib-ui-selection.d.ts +112 -0
- package/types/starterlib-ui.d.ts +9 -1575
|
@@ -0,0 +1,671 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { inject, Injector, input, booleanAttribute, model, output, DestroyRef, computed, effect, afterNextRender, ChangeDetectionStrategy, Component, TemplateRef, Directive, contentChildren, ElementRef, contentChild, viewChild, signal } from '@angular/core';
|
|
3
|
+
import { ST_LIBELLES, AnnonceLocale, StButton, StIcon } from '@starterlib/ui';
|
|
4
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
5
|
+
|
|
6
|
+
/** Plafond du backend : au-dela, la requete est refusee (SEC-7 de la vague 4). */
|
|
7
|
+
const TAILLE_MAXIMALE = 100;
|
|
8
|
+
/**
|
|
9
|
+
* Pagination d'une liste par curseur.
|
|
10
|
+
*
|
|
11
|
+
* ```html
|
|
12
|
+
* <st-data-table #tableau … />
|
|
13
|
+
* <st-pagination
|
|
14
|
+
* [numero]="navigation.numeroDePage()"
|
|
15
|
+
* [precedenteDisponible]="navigation.precedenteDisponible()"
|
|
16
|
+
* [suivanteDisponible]="page.value()?.hasMore ?? false"
|
|
17
|
+
* [chargement]="page.isLoading()"
|
|
18
|
+
* [cible]="tableau"
|
|
19
|
+
* (precedente)="navigation.precedente()"
|
|
20
|
+
* (suivante)="navigation.suivante(page.value())"
|
|
21
|
+
* />
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* ⚠️ **Ni total, ni numeros cliquables** : le backend ne compte pas et ne va que
|
|
25
|
+
* vers l'avant (audit de la vague 4, V4-2). « Page 3 » se dit ; « page 3 sur 12 »
|
|
26
|
+
* serait invente.
|
|
27
|
+
*
|
|
28
|
+
* ⚠️ **Boutons indisponibles, jamais desactives** : sur la derniere page, « Page
|
|
29
|
+
* suivante » garde le focus qu'il avait. Desactive, il le perdrait, et le lecteur
|
|
30
|
+
* d'ecran retomberait sur le debut du document.
|
|
31
|
+
*
|
|
32
|
+
* ⚠️ **Apres un changement de page, le focus va a la `cible`** — la legende du
|
|
33
|
+
* tableau — et « Page 2 » s'annonce (UX-13). Sans cela, la personne au clavier
|
|
34
|
+
* reste en bas, sur « Page suivante », sans savoir que le contenu au-dessus a
|
|
35
|
+
* change.
|
|
36
|
+
*/
|
|
37
|
+
class StPagination {
|
|
38
|
+
libelles = inject(ST_LIBELLES);
|
|
39
|
+
injecteur = inject(Injector);
|
|
40
|
+
mode = input('pages', /* @ts-ignore */
|
|
41
|
+
...(ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []));
|
|
42
|
+
/** A partir de 1. */
|
|
43
|
+
numero = input(1, /* @ts-ignore */
|
|
44
|
+
...(ngDevMode ? [{ debugName: "numero" }] : /* istanbul ignore next */ []));
|
|
45
|
+
precedenteDisponible = input(false, { ...(ngDevMode ? { debugName: "precedenteDisponible" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
46
|
+
suivanteDisponible = input(false, { ...(ngDevMode ? { debugName: "suivanteDisponible" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
47
|
+
chargement = input(false, { ...(ngDevMode ? { debugName: "chargement" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
48
|
+
/** Nom de la navigation, quand une page en porte plusieurs. */
|
|
49
|
+
etiquette = input(null, /* @ts-ignore */
|
|
50
|
+
...(ngDevMode ? [{ debugName: "etiquette" }] : /* istanbul ignore next */ []));
|
|
51
|
+
/** Tailles proposees ; vide, pas de choix. Plafonnees a 100. */
|
|
52
|
+
taillesDePage = input([], /* @ts-ignore */
|
|
53
|
+
...(ngDevMode ? [{ debugName: "taillesDePage" }] : /* istanbul ignore next */ []));
|
|
54
|
+
taille = model(20, /* @ts-ignore */
|
|
55
|
+
...(ngDevMode ? [{ debugName: "taille" }] : /* istanbul ignore next */ []));
|
|
56
|
+
/** Recoit le focus apres un changement de page. */
|
|
57
|
+
cible = input(null, /* @ts-ignore */
|
|
58
|
+
...(ngDevMode ? [{ debugName: "cible" }] : /* istanbul ignore next */ []));
|
|
59
|
+
precedente = output();
|
|
60
|
+
suivante = output();
|
|
61
|
+
annonce = new AnnonceLocale(inject(DestroyRef));
|
|
62
|
+
tailles = computed(() => this.taillesDePage().filter((taille) => taille >= 1 && taille <= TAILLE_MAXIMALE), /* @ts-ignore */
|
|
63
|
+
...(ngDevMode ? [{ debugName: "tailles" }] : /* istanbul ignore next */ []));
|
|
64
|
+
etiquetteLue = computed(() => this.etiquette() ?? this.libelles().pagination, /* @ts-ignore */
|
|
65
|
+
...(ngDevMode ? [{ debugName: "etiquetteLue" }] : /* istanbul ignore next */ []));
|
|
66
|
+
constructor() {
|
|
67
|
+
// Le focus attend la FIN du chargement : amene sur la cible pendant que les
|
|
68
|
+
// anciennes lignes sont encore la, il ferait relire la page quittee.
|
|
69
|
+
let dernier = null;
|
|
70
|
+
let enAttente = false;
|
|
71
|
+
effect(() => {
|
|
72
|
+
const numero = this.numero();
|
|
73
|
+
const chargement = this.chargement();
|
|
74
|
+
if (dernier === null) {
|
|
75
|
+
dernier = numero;
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
if (numero !== dernier) {
|
|
79
|
+
dernier = numero;
|
|
80
|
+
enAttente = true;
|
|
81
|
+
if (this.mode() === 'pages')
|
|
82
|
+
this.annonce.annoncer(this.libelles().pageNumero(numero));
|
|
83
|
+
}
|
|
84
|
+
if (!enAttente || chargement)
|
|
85
|
+
return;
|
|
86
|
+
enAttente = false;
|
|
87
|
+
afterNextRender(() => {
|
|
88
|
+
const cible = this.cible();
|
|
89
|
+
const element = typeof cible === 'function' ? cible() : cible;
|
|
90
|
+
element?.focus();
|
|
91
|
+
}, { injector: this.injecteur });
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
surTaille(evenement) {
|
|
95
|
+
this.taille.set(Number(evenement.target.value));
|
|
96
|
+
}
|
|
97
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: StPagination, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
98
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.6", type: StPagination, isStandalone: true, selector: "st-pagination", inputs: { mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, numero: { classPropertyName: "numero", publicName: "numero", isSignal: true, isRequired: false, transformFunction: null }, precedenteDisponible: { classPropertyName: "precedenteDisponible", publicName: "precedenteDisponible", isSignal: true, isRequired: false, transformFunction: null }, suivanteDisponible: { classPropertyName: "suivanteDisponible", publicName: "suivanteDisponible", isSignal: true, isRequired: false, transformFunction: null }, chargement: { classPropertyName: "chargement", publicName: "chargement", isSignal: true, isRequired: false, transformFunction: null }, etiquette: { classPropertyName: "etiquette", publicName: "etiquette", isSignal: true, isRequired: false, transformFunction: null }, taillesDePage: { classPropertyName: "taillesDePage", publicName: "taillesDePage", isSignal: true, isRequired: false, transformFunction: null }, taille: { classPropertyName: "taille", publicName: "taille", isSignal: true, isRequired: false, transformFunction: null }, cible: { classPropertyName: "cible", publicName: "cible", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { taille: "tailleChange", precedente: "precedente", suivante: "suivante" }, host: { classAttribute: "st-pagination" }, ngImport: i0, template: "<nav class=\"st-pagination__navigation\" [attr.aria-label]=\"etiquetteLue()\">\n @if (mode() === 'pages') {\n <button\n stButton\n type=\"button\"\n iconeAvant=\"chevron-gauche\"\n [indisponible]=\"!precedenteDisponible() || chargement()\"\n (click)=\"precedente.emit()\"\n >\n {{ libelles().pagePrecedente }}\n </button>\n <span class=\"st-pagination__numero\" aria-current=\"page\">\n {{ libelles().pageNumero(numero()) }}\n </span>\n <button\n stButton\n type=\"button\"\n iconeApres=\"chevron-droite\"\n [indisponible]=\"!suivanteDisponible()\"\n [chargement]=\"chargement()\"\n (click)=\"suivante.emit()\"\n >\n {{ libelles().pageSuivante }}\n </button>\n } @else if (suivanteDisponible()) {\n <button stButton type=\"button\" [chargement]=\"chargement()\" (click)=\"suivante.emit()\">\n {{ libelles().afficherPlus }}\n </button>\n }\n\n @if (tailles().length > 0) {\n <label class=\"st-pagination__taille\">\n <span>{{ libelles().lignesParPage }}</span>\n <select class=\"st-pagination__choix\" (change)=\"surTaille($event)\">\n @for (proposee of tailles(); track proposee) {\n <option [value]=\"proposee\" [selected]=\"proposee === taille()\">{{ proposee }}</option>\n }\n </select>\n </label>\n }\n</nav>\n<span class=\"st-vh\" aria-live=\"polite\">{{ annonce.texte() }}</span>\n", styles: [".st-vh{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}:host([hidden]){display:none!important}:host{display:block}.st-pagination__navigation{display:flex;flex-wrap:wrap;gap:var(--st-espacement-2) var(--st-espacement-3);align-items:center}.st-pagination__numero{font-variant-numeric:tabular-nums;font-weight:var(--st-graisse-semi)}.st-pagination__taille{display:inline-flex;gap:var(--st-espacement-2);align-items:center;margin-inline-start:auto}.st-pagination__choix:focus-visible{outline:2px solid var(--st-couleur-anneau-focus);outline-offset:2px}.st-pagination__choix{box-sizing:border-box;inline-size:100%;min-block-size:var(--st-commande-hauteur, var(--st-cible-tactile-min));padding:var(--st-espacement-2) var(--st-espacement-3);font:inherit;color:var(--st-couleur-texte);background:var(--st-couleur-surface);border:1px solid var(--st-couleur-bordure-forte);border-radius:var(--st-commande-rayon, var(--st-rayon-md))}.st-pagination__choix[aria-invalid=true]{border-color:var(--st-couleur-danger);box-shadow:inset 0 0 0 1px var(--st-couleur-danger)}.st-pagination__choix:disabled{color:var(--st-couleur-texte-desactive);cursor:not-allowed;background:var(--st-couleur-surface-enfoncee)}.st-pagination__choix:read-only:not(:disabled){background:var(--st-couleur-surface-enfoncee)}.st-pagination__choix{inline-size:auto}\n"], dependencies: [{ kind: "component", type: StButton, selector: "button[stButton]", inputs: ["variante", "taille", "pleineLargeur", "iconeAvant", "iconeApres", "chargement", "indisponible"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
99
|
+
}
|
|
100
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: StPagination, decorators: [{
|
|
101
|
+
type: Component,
|
|
102
|
+
args: [{ selector: 'st-pagination', changeDetection: ChangeDetectionStrategy.OnPush, imports: [StButton], host: { class: 'st-pagination' }, template: "<nav class=\"st-pagination__navigation\" [attr.aria-label]=\"etiquetteLue()\">\n @if (mode() === 'pages') {\n <button\n stButton\n type=\"button\"\n iconeAvant=\"chevron-gauche\"\n [indisponible]=\"!precedenteDisponible() || chargement()\"\n (click)=\"precedente.emit()\"\n >\n {{ libelles().pagePrecedente }}\n </button>\n <span class=\"st-pagination__numero\" aria-current=\"page\">\n {{ libelles().pageNumero(numero()) }}\n </span>\n <button\n stButton\n type=\"button\"\n iconeApres=\"chevron-droite\"\n [indisponible]=\"!suivanteDisponible()\"\n [chargement]=\"chargement()\"\n (click)=\"suivante.emit()\"\n >\n {{ libelles().pageSuivante }}\n </button>\n } @else if (suivanteDisponible()) {\n <button stButton type=\"button\" [chargement]=\"chargement()\" (click)=\"suivante.emit()\">\n {{ libelles().afficherPlus }}\n </button>\n }\n\n @if (tailles().length > 0) {\n <label class=\"st-pagination__taille\">\n <span>{{ libelles().lignesParPage }}</span>\n <select class=\"st-pagination__choix\" (change)=\"surTaille($event)\">\n @for (proposee of tailles(); track proposee) {\n <option [value]=\"proposee\" [selected]=\"proposee === taille()\">{{ proposee }}</option>\n }\n </select>\n </label>\n }\n</nav>\n<span class=\"st-vh\" aria-live=\"polite\">{{ annonce.texte() }}</span>\n", styles: [".st-vh{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}:host([hidden]){display:none!important}:host{display:block}.st-pagination__navigation{display:flex;flex-wrap:wrap;gap:var(--st-espacement-2) var(--st-espacement-3);align-items:center}.st-pagination__numero{font-variant-numeric:tabular-nums;font-weight:var(--st-graisse-semi)}.st-pagination__taille{display:inline-flex;gap:var(--st-espacement-2);align-items:center;margin-inline-start:auto}.st-pagination__choix:focus-visible{outline:2px solid var(--st-couleur-anneau-focus);outline-offset:2px}.st-pagination__choix{box-sizing:border-box;inline-size:100%;min-block-size:var(--st-commande-hauteur, var(--st-cible-tactile-min));padding:var(--st-espacement-2) var(--st-espacement-3);font:inherit;color:var(--st-couleur-texte);background:var(--st-couleur-surface);border:1px solid var(--st-couleur-bordure-forte);border-radius:var(--st-commande-rayon, var(--st-rayon-md))}.st-pagination__choix[aria-invalid=true]{border-color:var(--st-couleur-danger);box-shadow:inset 0 0 0 1px var(--st-couleur-danger)}.st-pagination__choix:disabled{color:var(--st-couleur-texte-desactive);cursor:not-allowed;background:var(--st-couleur-surface-enfoncee)}.st-pagination__choix:read-only:not(:disabled){background:var(--st-couleur-surface-enfoncee)}.st-pagination__choix{inline-size:auto}\n"] }]
|
|
103
|
+
}], ctorParameters: () => [], propDecorators: { mode: [{ type: i0.Input, args: [{ isSignal: true, alias: "mode", required: false }] }], numero: [{ type: i0.Input, args: [{ isSignal: true, alias: "numero", required: false }] }], precedenteDisponible: [{ type: i0.Input, args: [{ isSignal: true, alias: "precedenteDisponible", required: false }] }], suivanteDisponible: [{ type: i0.Input, args: [{ isSignal: true, alias: "suivanteDisponible", required: false }] }], chargement: [{ type: i0.Input, args: [{ isSignal: true, alias: "chargement", required: false }] }], etiquette: [{ type: i0.Input, args: [{ isSignal: true, alias: "etiquette", required: false }] }], taillesDePage: [{ type: i0.Input, args: [{ isSignal: true, alias: "taillesDePage", required: false }] }], taille: [{ type: i0.Input, args: [{ isSignal: true, alias: "taille", required: false }] }, { type: i0.Output, args: ["tailleChange"] }], cible: [{ type: i0.Input, args: [{ isSignal: true, alias: "cible", required: false }] }], precedente: [{ type: i0.Output, args: ["precedente"] }], suivante: [{ type: i0.Output, args: ["suivante"] }] } });
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Valeur riche d'un element : montant, date, valeur masquee.
|
|
107
|
+
*
|
|
108
|
+
* ```html
|
|
109
|
+
* <ng-template stDescription="iban" let-element>
|
|
110
|
+
* <st-masked nature="iban" [valeur]="compte().iban" />
|
|
111
|
+
* </ng-template>
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
class StDescription {
|
|
115
|
+
cle = input.required({ ...(ngDevMode ? { debugName: "cle" } : /* istanbul ignore next */ {}), alias: 'stDescription' });
|
|
116
|
+
gabarit = inject(TemplateRef);
|
|
117
|
+
static ngTemplateContextGuard(_directive, _contexte) {
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
120
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: StDescription, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
121
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.6", type: StDescription, isStandalone: true, selector: "ng-template[stDescription]", inputs: { cle: { classPropertyName: "cle", publicName: "stDescription", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 });
|
|
122
|
+
}
|
|
123
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: StDescription, decorators: [{
|
|
124
|
+
type: Directive,
|
|
125
|
+
args: [{ selector: 'ng-template[stDescription]' }]
|
|
126
|
+
}], propDecorators: { cle: [{ type: i0.Input, args: [{ isSignal: true, alias: "stDescription", required: true }] }] } });
|
|
127
|
+
/**
|
|
128
|
+
* Liste de descriptions : les proprietes d'un objet, sur une page de detail.
|
|
129
|
+
*
|
|
130
|
+
* ```html
|
|
131
|
+
* <st-description-list [elements]="[
|
|
132
|
+
* { terme: 'Reference', description: commande().reference },
|
|
133
|
+
* { cle: 'montant', terme: 'Montant', description: null },
|
|
134
|
+
* ]">
|
|
135
|
+
* <ng-template stDescription="montant"><st-money [valeur]="commande().montant" /></ng-template>
|
|
136
|
+
* </st-description-list>
|
|
137
|
+
* ```
|
|
138
|
+
*
|
|
139
|
+
* ⚠️ **Un vrai `dl`, rendu par le composant.** Le lecteur d'ecran annonce « liste de
|
|
140
|
+
* descriptions, 4 elements » et lit chaque terme avec sa valeur. Ecrits par
|
|
141
|
+
* l'application et projetes, `dt` et `dd` echapperaient aux styles du composant,
|
|
142
|
+
* et un `div` mal place rendrait la liste invalide.
|
|
143
|
+
*
|
|
144
|
+
* ⚠️ **Une valeur absente se dit** : « — » a l'ecran, « Non renseigne » au lecteur
|
|
145
|
+
* d'ecran. Une cellule vide ne distingue pas « aucun » de « pas encore charge ».
|
|
146
|
+
*
|
|
147
|
+
* En colonnes quand la place le permet, empile en dessous : la largeur est celle
|
|
148
|
+
* du CONTENEUR, pas de l'ecran — la meme liste dans une carte etroite s'empile
|
|
149
|
+
* aussi sur un grand ecran (UX-18).
|
|
150
|
+
*/
|
|
151
|
+
class StDescriptionList {
|
|
152
|
+
libelles = inject(ST_LIBELLES);
|
|
153
|
+
elements = input.required(/* @ts-ignore */
|
|
154
|
+
...(ngDevMode ? [{ debugName: "elements" }] : /* istanbul ignore next */ []));
|
|
155
|
+
gabarits = contentChildren(StDescription, /* @ts-ignore */
|
|
156
|
+
...(ngDevMode ? [{ debugName: "gabarits" }] : /* istanbul ignore next */ []));
|
|
157
|
+
lignes = computed(() => {
|
|
158
|
+
const gabarits = new Map(this.gabarits().map((gabarit) => [gabarit.cle(), gabarit.gabarit]));
|
|
159
|
+
return this.elements().map((element) => ({
|
|
160
|
+
element,
|
|
161
|
+
gabarit: gabarits.get(element.cle ?? element.terme) ?? null,
|
|
162
|
+
}));
|
|
163
|
+
}, /* @ts-ignore */
|
|
164
|
+
...(ngDevMode ? [{ debugName: "lignes" }] : /* istanbul ignore next */ []));
|
|
165
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: StDescriptionList, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
166
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.6", type: StDescriptionList, isStandalone: true, selector: "st-description-list", inputs: { elements: { classPropertyName: "elements", publicName: "elements", isSignal: true, isRequired: true, transformFunction: null } }, host: { classAttribute: "st-description-list" }, queries: [{ propertyName: "gabarits", predicate: StDescription, isSignal: true }], ngImport: i0, template: "<dl class=\"st-description-list__liste\">\n @for (ligne of lignes(); track ligne.element.cle ?? ligne.element.terme) {\n <div class=\"st-description-list__groupe\">\n <dt class=\"st-description-list__terme\">{{ ligne.element.terme }}</dt>\n <dd class=\"st-description-list__valeur\">\n @if (ligne.gabarit; as gabarit) {\n <ng-container *ngTemplateOutlet=\"gabarit; context: { $implicit: ligne.element }\" />\n } @else if (ligne.element.description === null) {\n <span aria-hidden=\"true\">—</span>\n <span class=\"st-vh\">{{ libelles().nonRenseigne }}</span>\n } @else {\n {{ ligne.element.description }}\n }\n </dd>\n </div>\n }\n</dl>\n", styles: [".st-vh{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}:host([hidden]){display:none!important}:host{display:block;container-type:inline-size}.st-description-list__liste{margin:0}.st-description-list__groupe{display:grid;gap:var(--st-espacement-1);padding-block:var(--st-espacement-2);border-block-end:1px solid var(--st-couleur-bordure)}.st-description-list__terme{font-weight:var(--st-graisse-semi);color:var(--st-couleur-texte-discret)}.st-description-list__valeur{margin:0;overflow-wrap:anywhere}@container (min-width: st.$rupture-sm){.st-description-list__groupe{grid-template-columns:minmax(10rem,1fr) 2fr;gap:var(--st-espacement-4)}}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
167
|
+
}
|
|
168
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: StDescriptionList, decorators: [{
|
|
169
|
+
type: Component,
|
|
170
|
+
args: [{ selector: 'st-description-list', changeDetection: ChangeDetectionStrategy.OnPush, imports: [NgTemplateOutlet], host: { class: 'st-description-list' }, template: "<dl class=\"st-description-list__liste\">\n @for (ligne of lignes(); track ligne.element.cle ?? ligne.element.terme) {\n <div class=\"st-description-list__groupe\">\n <dt class=\"st-description-list__terme\">{{ ligne.element.terme }}</dt>\n <dd class=\"st-description-list__valeur\">\n @if (ligne.gabarit; as gabarit) {\n <ng-container *ngTemplateOutlet=\"gabarit; context: { $implicit: ligne.element }\" />\n } @else if (ligne.element.description === null) {\n <span aria-hidden=\"true\">—</span>\n <span class=\"st-vh\">{{ libelles().nonRenseigne }}</span>\n } @else {\n {{ ligne.element.description }}\n }\n </dd>\n </div>\n }\n</dl>\n", styles: [".st-vh{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}:host([hidden]){display:none!important}:host{display:block;container-type:inline-size}.st-description-list__liste{margin:0}.st-description-list__groupe{display:grid;gap:var(--st-espacement-1);padding-block:var(--st-espacement-2);border-block-end:1px solid var(--st-couleur-bordure)}.st-description-list__terme{font-weight:var(--st-graisse-semi);color:var(--st-couleur-texte-discret)}.st-description-list__valeur{margin:0;overflow-wrap:anywhere}@container (min-width: st.$rupture-sm){.st-description-list__groupe{grid-template-columns:minmax(10rem,1fr) 2fr;gap:var(--st-espacement-4)}}\n"] }]
|
|
171
|
+
}], propDecorators: { elements: [{ type: i0.Input, args: [{ isSignal: true, alias: "elements", required: true }] }], gabarits: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => StDescription), { isSignal: true }] }] } });
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Rendu d'un element, type par `[stElementDeListeDe]` :
|
|
175
|
+
*
|
|
176
|
+
* ```html
|
|
177
|
+
* <ng-template stElementDeListe [stElementDeListeDe]="expeditions()" let-expedition>
|
|
178
|
+
* <a [routerLink]="['/expeditions', expedition.id]">{{ expedition.reference }}</a>
|
|
179
|
+
* </ng-template>
|
|
180
|
+
* ```
|
|
181
|
+
*/
|
|
182
|
+
class StElementDeListe {
|
|
183
|
+
/** Sert seulement au typage du contexte ; nom de l'attribut, d'ou l'absence d'alias. */
|
|
184
|
+
stElementDeListeDe = input(undefined, /* @ts-ignore */
|
|
185
|
+
...(ngDevMode ? [{ debugName: "stElementDeListeDe" }] : /* istanbul ignore next */ []));
|
|
186
|
+
gabarit = inject(TemplateRef);
|
|
187
|
+
static ngTemplateContextGuard(_directive, _contexte) {
|
|
188
|
+
return true;
|
|
189
|
+
}
|
|
190
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: StElementDeListe, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
191
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.6", type: StElementDeListe, isStandalone: true, selector: "ng-template[stElementDeListe]", inputs: { stElementDeListeDe: { classPropertyName: "stElementDeListeDe", publicName: "stElementDeListeDe", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
|
|
192
|
+
}
|
|
193
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: StElementDeListe, decorators: [{
|
|
194
|
+
type: Directive,
|
|
195
|
+
args: [{ selector: 'ng-template[stElementDeListe]' }]
|
|
196
|
+
}], propDecorators: { stElementDeListeDe: [{ type: i0.Input, args: [{ isSignal: true, alias: "stElementDeListeDe", required: false }] }] } });
|
|
197
|
+
/**
|
|
198
|
+
* Liste d'objets : expeditions, notifications, documents. La forme mobile d'un
|
|
199
|
+
* tableau (UX-5).
|
|
200
|
+
*
|
|
201
|
+
* ```html
|
|
202
|
+
* <st-list #liste etiquette="Mes expeditions" [elements]="expeditions()" cle="id">
|
|
203
|
+
* <ng-template stElementDeListe [stElementDeListeDe]="expeditions()" let-expedition>…</ng-template>
|
|
204
|
+
* </st-list>
|
|
205
|
+
* <st-pagination mode="suite" [cible]="liste" … />
|
|
206
|
+
* ```
|
|
207
|
+
*
|
|
208
|
+
* ⚠️ **Un lien DANS l'element, jamais un element cliquable** (UX-3) : le lien a un
|
|
209
|
+
* nom, s'ouvre dans un onglet, et laisse les autres boutons de l'element
|
|
210
|
+
* atteignables.
|
|
211
|
+
*
|
|
212
|
+
* ⚠️ **`focus()` va au premier element AJOUTE** depuis le dernier affichage : apres
|
|
213
|
+
* « Afficher plus », la lecture reprend la ou la liste s'est allongee, et non en
|
|
214
|
+
* tete. Apres un filtre, la liste raccourcit, et le focus va au premier element.
|
|
215
|
+
*
|
|
216
|
+
* `track` par la cle : un rafraichissement garde le focus sur le bon element.
|
|
217
|
+
*/
|
|
218
|
+
class StList {
|
|
219
|
+
element = inject(ElementRef);
|
|
220
|
+
elements = input.required(/* @ts-ignore */
|
|
221
|
+
...(ngDevMode ? [{ debugName: "elements" }] : /* istanbul ignore next */ []));
|
|
222
|
+
/** Propriete qui identifie un element. */
|
|
223
|
+
cle = input.required(/* @ts-ignore */
|
|
224
|
+
...(ngDevMode ? [{ debugName: "cle" }] : /* istanbul ignore next */ []));
|
|
225
|
+
/** Nom de la liste, lu a l'entree. */
|
|
226
|
+
etiquette = input(null, /* @ts-ignore */
|
|
227
|
+
...(ngDevMode ? [{ debugName: "etiquette" }] : /* istanbul ignore next */ []));
|
|
228
|
+
/** `ol` quand l'ordre a un sens : etapes, classement. */
|
|
229
|
+
ordonnee = input(false, { ...(ngDevMode ? { debugName: "ordonnee" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
230
|
+
/** Contenu en cours de remplacement : `aria-busy`. */
|
|
231
|
+
chargement = input(false, { ...(ngDevMode ? { debugName: "chargement" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
232
|
+
gabarit = contentChild(StElementDeListe, /* @ts-ignore */
|
|
233
|
+
...(ngDevMode ? [{ debugName: "gabarit" }] : /* istanbul ignore next */ []));
|
|
234
|
+
indiceDuPremierAjout = 0;
|
|
235
|
+
lignes = computed(() => {
|
|
236
|
+
const cle = this.cle();
|
|
237
|
+
return this.elements().map((valeur, indice) => ({
|
|
238
|
+
valeur,
|
|
239
|
+
indice,
|
|
240
|
+
identifiant: String(valeur[cle]),
|
|
241
|
+
}));
|
|
242
|
+
}, /* @ts-ignore */
|
|
243
|
+
...(ngDevMode ? [{ debugName: "lignes" }] : /* istanbul ignore next */ []));
|
|
244
|
+
constructor() {
|
|
245
|
+
let longueur = 0;
|
|
246
|
+
effect(() => {
|
|
247
|
+
const nouvelle = this.elements().length;
|
|
248
|
+
this.indiceDuPremierAjout = nouvelle > longueur && longueur > 0 ? longueur : 0;
|
|
249
|
+
longueur = nouvelle;
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
/** Focus sur le premier element ajoute, ou sur le premier. */
|
|
253
|
+
focus(options) {
|
|
254
|
+
const elements = this.element.nativeElement.querySelectorAll('.st-list__element');
|
|
255
|
+
(elements[this.indiceDuPremierAjout] ?? elements[0])?.focus(options);
|
|
256
|
+
}
|
|
257
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: StList, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
258
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.6", type: StList, isStandalone: true, selector: "st-list", inputs: { elements: { classPropertyName: "elements", publicName: "elements", isSignal: true, isRequired: true, transformFunction: null }, cle: { classPropertyName: "cle", publicName: "cle", isSignal: true, isRequired: true, transformFunction: null }, etiquette: { classPropertyName: "etiquette", publicName: "etiquette", isSignal: true, isRequired: false, transformFunction: null }, ordonnee: { classPropertyName: "ordonnee", publicName: "ordonnee", isSignal: true, isRequired: false, transformFunction: null }, chargement: { classPropertyName: "chargement", publicName: "chargement", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "st-list" }, queries: [{ propertyName: "gabarit", first: true, predicate: StElementDeListe, descendants: true, isSignal: true }], ngImport: i0, template: "@if (ordonnee()) {\n <ol\n class=\"st-list__liste\"\n [attr.aria-label]=\"etiquette()\"\n [attr.aria-busy]=\"chargement() ? 'true' : null\"\n >\n <ng-container *ngTemplateOutlet=\"contenu\" />\n </ol>\n} @else {\n <ul\n class=\"st-list__liste\"\n [attr.aria-label]=\"etiquette()\"\n [attr.aria-busy]=\"chargement() ? 'true' : null\"\n >\n <ng-container *ngTemplateOutlet=\"contenu\" />\n </ul>\n}\n\n<ng-template #contenu>\n @for (ligne of lignes(); track ligne.identifiant) {\n <!-- tabindex -1 : cible du focus apres \u00AB Afficher plus \u00BB, hors tabulation. -->\n <li class=\"st-list__element\" tabindex=\"-1\">\n @if (gabarit(); as gabarit) {\n <ng-container\n *ngTemplateOutlet=\"\n gabarit.gabarit;\n context: { $implicit: ligne.valeur, indice: ligne.indice }\n \"\n />\n } @else {\n {{ ligne.valeur }}\n }\n </li>\n }\n</ng-template>\n", styles: [".st-vh{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}:host([hidden]){display:none!important}:host{display:block}.st-list__liste{padding:0;margin:0;list-style:none}.st-list__liste[aria-busy=true]{cursor:progress}.st-list__element{padding-block:var(--st-espacement-3);border-block-end:1px solid var(--st-couleur-bordure)}.st-list__element:focus{outline:2px solid var(--st-couleur-anneau-focus);outline-offset:2px}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
259
|
+
}
|
|
260
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: StList, decorators: [{
|
|
261
|
+
type: Component,
|
|
262
|
+
args: [{ selector: 'st-list', changeDetection: ChangeDetectionStrategy.OnPush, imports: [NgTemplateOutlet], host: { class: 'st-list' }, template: "@if (ordonnee()) {\n <ol\n class=\"st-list__liste\"\n [attr.aria-label]=\"etiquette()\"\n [attr.aria-busy]=\"chargement() ? 'true' : null\"\n >\n <ng-container *ngTemplateOutlet=\"contenu\" />\n </ol>\n} @else {\n <ul\n class=\"st-list__liste\"\n [attr.aria-label]=\"etiquette()\"\n [attr.aria-busy]=\"chargement() ? 'true' : null\"\n >\n <ng-container *ngTemplateOutlet=\"contenu\" />\n </ul>\n}\n\n<ng-template #contenu>\n @for (ligne of lignes(); track ligne.identifiant) {\n <!-- tabindex -1 : cible du focus apres \u00AB Afficher plus \u00BB, hors tabulation. -->\n <li class=\"st-list__element\" tabindex=\"-1\">\n @if (gabarit(); as gabarit) {\n <ng-container\n *ngTemplateOutlet=\"\n gabarit.gabarit;\n context: { $implicit: ligne.valeur, indice: ligne.indice }\n \"\n />\n } @else {\n {{ ligne.valeur }}\n }\n </li>\n }\n</ng-template>\n", styles: [".st-vh{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}:host([hidden]){display:none!important}:host{display:block}.st-list__liste{padding:0;margin:0;list-style:none}.st-list__liste[aria-busy=true]{cursor:progress}.st-list__element{padding-block:var(--st-espacement-3);border-block-end:1px solid var(--st-couleur-bordure)}.st-list__element:focus{outline:2px solid var(--st-couleur-anneau-focus);outline-offset:2px}\n"] }]
|
|
263
|
+
}], ctorParameters: () => [], propDecorators: { elements: [{ type: i0.Input, args: [{ isSignal: true, alias: "elements", required: true }] }], cle: [{ type: i0.Input, args: [{ isSignal: true, alias: "cle", required: true }] }], etiquette: [{ type: i0.Input, args: [{ isSignal: true, alias: "etiquette", required: false }] }], ordonnee: [{ type: i0.Input, args: [{ isSignal: true, alias: "ordonnee", required: false }] }], chargement: [{ type: i0.Input, args: [{ isSignal: true, alias: "chargement", required: false }] }], gabarit: [{ type: i0.ContentChild, args: [i0.forwardRef(() => StElementDeListe), { isSignal: true }] }] } });
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Bouton de tri d'une colonne, pose DANS l'en-tete : `<th><button stSortHeader>`.
|
|
267
|
+
*
|
|
268
|
+
* ⚠️ **Le bouton, pas l'en-tete cliquable** : un `th` n'est ni focalisable ni
|
|
269
|
+
* annonce comme actionnable. Et l'etat se porte par `aria-sort` sur le `th`, que
|
|
270
|
+
* `st-data-table` pose sur la SEULE colonne triee (FE-3).
|
|
271
|
+
*
|
|
272
|
+
* ⚠️ **Ne trie rien.** Il dit l'intention ; c'est le serveur qui trie, et le
|
|
273
|
+
* contrat actuel ne le fait pas (audit de la vague 4, V4-3). Trier la page
|
|
274
|
+
* affichee ferait croire a un tri de toute la liste.
|
|
275
|
+
*
|
|
276
|
+
* Une colonne non triee montre deux chevrons, pour se signaler triable sans
|
|
277
|
+
* attendre le survol ; l'icone est decorative, l'etat est lu par `aria-sort`.
|
|
278
|
+
*/
|
|
279
|
+
class StSortHeader {
|
|
280
|
+
sens = input(null, /* @ts-ignore */
|
|
281
|
+
...(ngDevMode ? [{ debugName: "sens" }] : /* istanbul ignore next */ []));
|
|
282
|
+
icone = computed(() => {
|
|
283
|
+
const sens = this.sens();
|
|
284
|
+
if (sens === 'croissant')
|
|
285
|
+
return 'chevron-haut';
|
|
286
|
+
if (sens === 'decroissant')
|
|
287
|
+
return 'chevron-bas';
|
|
288
|
+
return 'tri';
|
|
289
|
+
}, /* @ts-ignore */
|
|
290
|
+
...(ngDevMode ? [{ debugName: "icone" }] : /* istanbul ignore next */ []));
|
|
291
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: StSortHeader, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
292
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.6", type: StSortHeader, isStandalone: true, selector: "button[stSortHeader]", inputs: { sens: { classPropertyName: "sens", publicName: "sens", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "type": "button" }, properties: { "attr.data-sens": "sens()" }, classAttribute: "st-sort-header" }, ngImport: i0, template: "<span class=\"st-sort-header__libelle\"><ng-content /></span>\n<st-icon class=\"st-sort-header__icone\" taille=\"sm\" [nom]=\"icone()\" />\n", styles: [".st-vh{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}:host([hidden]){display:none!important}:host:focus-visible{outline:2px solid var(--st-couleur-anneau-focus);outline-offset:2px}:host{display:inline-flex;gap:var(--st-espacement-1);align-items:center;min-block-size:var(--st-cible-min);padding:0;font:inherit;font-weight:inherit;color:inherit;text-align:inherit;cursor:pointer;background:none;border:0}.st-sort-header__icone{flex:none;color:var(--st-couleur-texte-discret)}:host([data-sens]) .st-sort-header__icone{color:inherit}\n"], dependencies: [{ kind: "component", type: StIcon, selector: "st-icon", inputs: ["nom", "sprite", "nomMetier", "taille", "ton", "etiquette"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
293
|
+
}
|
|
294
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: StSortHeader, decorators: [{
|
|
295
|
+
type: Component,
|
|
296
|
+
args: [{ selector: 'button[stSortHeader]', changeDetection: ChangeDetectionStrategy.OnPush, imports: [StIcon], host: {
|
|
297
|
+
class: 'st-sort-header',
|
|
298
|
+
type: 'button',
|
|
299
|
+
'[attr.data-sens]': 'sens()',
|
|
300
|
+
}, template: "<span class=\"st-sort-header__libelle\"><ng-content /></span>\n<st-icon class=\"st-sort-header__icone\" taille=\"sm\" [nom]=\"icone()\" />\n", styles: [".st-vh{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}:host([hidden]){display:none!important}:host:focus-visible{outline:2px solid var(--st-couleur-anneau-focus);outline-offset:2px}:host{display:inline-flex;gap:var(--st-espacement-1);align-items:center;min-block-size:var(--st-cible-min);padding:0;font:inherit;font-weight:inherit;color:inherit;text-align:inherit;cursor:pointer;background:none;border:0}.st-sort-header__icone{flex:none;color:var(--st-couleur-texte-discret)}:host([data-sens]) .st-sort-header__icone{color:inherit}\n"] }]
|
|
301
|
+
}], propDecorators: { sens: [{ type: i0.Input, args: [{ isSignal: true, alias: "sens", required: false }] }] } });
|
|
302
|
+
|
|
303
|
+
let compteur$1 = 0;
|
|
304
|
+
/**
|
|
305
|
+
* Rendu d'une cellule, type par `[stCelluleDe]` :
|
|
306
|
+
*
|
|
307
|
+
* ```html
|
|
308
|
+
* <ng-template stCellule="montant" [stCelluleDe]="lignes()" let-ligne>
|
|
309
|
+
* <st-money [valeur]="ligne.montant" />
|
|
310
|
+
* </ng-template>
|
|
311
|
+
* ```
|
|
312
|
+
*/
|
|
313
|
+
class StCellule {
|
|
314
|
+
cle = input.required({ ...(ngDevMode ? { debugName: "cle" } : /* istanbul ignore next */ {}), alias: 'stCellule' });
|
|
315
|
+
/** Sert seulement au typage du contexte ; nom de l'attribut, d'ou l'absence d'alias. */
|
|
316
|
+
stCelluleDe = input(undefined, /* @ts-ignore */
|
|
317
|
+
...(ngDevMode ? [{ debugName: "stCelluleDe" }] : /* istanbul ignore next */ []));
|
|
318
|
+
gabarit = inject(TemplateRef);
|
|
319
|
+
static ngTemplateContextGuard(_directive, _contexte) {
|
|
320
|
+
return true;
|
|
321
|
+
}
|
|
322
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: StCellule, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
323
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.6", type: StCellule, isStandalone: true, selector: "ng-template[stCellule]", inputs: { cle: { classPropertyName: "cle", publicName: "stCellule", isSignal: true, isRequired: true, transformFunction: null }, stCelluleDe: { classPropertyName: "stCelluleDe", publicName: "stCelluleDe", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
|
|
324
|
+
}
|
|
325
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: StCellule, decorators: [{
|
|
326
|
+
type: Directive,
|
|
327
|
+
args: [{ selector: 'ng-template[stCellule]' }]
|
|
328
|
+
}], propDecorators: { cle: [{ type: i0.Input, args: [{ isSignal: true, alias: "stCellule", required: true }] }], stCelluleDe: [{ type: i0.Input, args: [{ isSignal: true, alias: "stCelluleDe", required: false }] }] } });
|
|
329
|
+
/** Contenu du tableau vide : un `st-empty`, avec son action. */
|
|
330
|
+
class StTableauVide {
|
|
331
|
+
gabarit = inject(TemplateRef);
|
|
332
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: StTableauVide, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
333
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.6", type: StTableauVide, isStandalone: true, selector: "ng-template[stTableauVide]", ngImport: i0 });
|
|
334
|
+
}
|
|
335
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: StTableauVide, decorators: [{
|
|
336
|
+
type: Directive,
|
|
337
|
+
args: [{ selector: 'ng-template[stTableauVide]' }]
|
|
338
|
+
}] });
|
|
339
|
+
/** Lignes de squelette au premier chargement. */
|
|
340
|
+
const LIGNES_DE_SQUELETTE = 5;
|
|
341
|
+
/**
|
|
342
|
+
* Tableau de donnees, sur un `<table>` NATIF.
|
|
343
|
+
*
|
|
344
|
+
* ```html
|
|
345
|
+
* <st-data-table #tableau legende="Expeditions" [colonnes]="colonnes" [lignes]="lignes()"
|
|
346
|
+
* cle="id" selectionnable [(selection)]="choisies" [chargement]="page.isLoading()">
|
|
347
|
+
* <ng-template stCellule="reference" [stCelluleDe]="lignes()" let-ligne>
|
|
348
|
+
* <a [routerLink]="['/expeditions', ligne.id]">{{ ligne.reference }}</a>
|
|
349
|
+
* </ng-template>
|
|
350
|
+
* <button stButton stActionsDeTableau (click)="exporter()">Exporter</button>
|
|
351
|
+
* </st-data-table>
|
|
352
|
+
* ```
|
|
353
|
+
*
|
|
354
|
+
* ⚠️ **Un tableau, pas une grille** (audit de la vague 4, V4-1). Le lecteur d'ecran
|
|
355
|
+
* sait parcourir un `<table>` de cellule en cellule ; une grille ARIA remplacerait
|
|
356
|
+
* ce parcours par les fleches, et rendrait les liens des cellules plus durs a
|
|
357
|
+
* atteindre. Ni Material, ni `CdkTable` : pas de pair dans le tronc.
|
|
358
|
+
*
|
|
359
|
+
* - **Legende obligatoire** (UX-1), et une colonne d'en-tete de ligne — la premiere
|
|
360
|
+
* par defaut — pour que chaque cellule se lise avec sa ligne (UX-2).
|
|
361
|
+
* - **Zone de defilement nommee** : focalisable quand le tableau deborde (UX-6),
|
|
362
|
+
* colonne figee sans masquer le focus (UX-7), en-tete fige seulement avec
|
|
363
|
+
* `hauteurMax` (UX-8).
|
|
364
|
+
* - **Selection de la PAGE, par cle** (V4-4) : elle ne garde que les lignes encore
|
|
365
|
+
* affichees, et se vide donc au changement de page.
|
|
366
|
+
* - **Tri PILOTE** : le tableau dit la demande et l'annonce, il ne reordonne
|
|
367
|
+
* jamais les lignes (V4-3).
|
|
368
|
+
* - **Chargement** : squelette au premier, lignes gardees et `aria-busy` ensuite
|
|
369
|
+
* (UX-11).
|
|
370
|
+
* - Export, actions de masse : zone `stActionsDeTableau`, et le SERVEUR fait le
|
|
371
|
+
* travail (V4-5, SEC-4, SEC-5).
|
|
372
|
+
*/
|
|
373
|
+
class StDataTable {
|
|
374
|
+
libelles = inject(ST_LIBELLES);
|
|
375
|
+
legende = input.required(/* @ts-ignore */
|
|
376
|
+
...(ngDevMode ? [{ debugName: "legende" }] : /* istanbul ignore next */ []));
|
|
377
|
+
/** Lue mais non affichee, quand un titre visible nomme deja le tableau. */
|
|
378
|
+
legendeMasquee = input(false, { ...(ngDevMode ? { debugName: "legendeMasquee" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
379
|
+
colonnes = input.required(/* @ts-ignore */
|
|
380
|
+
...(ngDevMode ? [{ debugName: "colonnes" }] : /* istanbul ignore next */ []));
|
|
381
|
+
lignes = input.required(/* @ts-ignore */
|
|
382
|
+
...(ngDevMode ? [{ debugName: "lignes" }] : /* istanbul ignore next */ []));
|
|
383
|
+
/** Propriete qui identifie une ligne. Jamais l'indice (FE-1). */
|
|
384
|
+
cle = input.required(/* @ts-ignore */
|
|
385
|
+
...(ngDevMode ? [{ debugName: "cle" }] : /* istanbul ignore next */ []));
|
|
386
|
+
/** Colonne lue comme en-tete de chaque ligne. Par defaut : la premiere. */
|
|
387
|
+
enTeteDeLigne = input(null, /* @ts-ignore */
|
|
388
|
+
...(ngDevMode ? [{ debugName: "enTeteDeLigne" }] : /* istanbul ignore next */ []));
|
|
389
|
+
premiereColonneFigee = input(false, { ...(ngDevMode ? { debugName: "premiereColonneFigee" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
390
|
+
/** Hauteur maximale, `32rem` : l'en-tete se fige, le corps defile. */
|
|
391
|
+
hauteurMax = input(null, /* @ts-ignore */
|
|
392
|
+
...(ngDevMode ? [{ debugName: "hauteurMax" }] : /* istanbul ignore next */ []));
|
|
393
|
+
densite = input('confortable', /* @ts-ignore */
|
|
394
|
+
...(ngDevMode ? [{ debugName: "densite" }] : /* istanbul ignore next */ []));
|
|
395
|
+
chargement = input(false, { ...(ngDevMode ? { debugName: "chargement" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
396
|
+
selectionnable = input(false, { ...(ngDevMode ? { debugName: "selectionnable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
397
|
+
selection = model([], /* @ts-ignore */
|
|
398
|
+
...(ngDevMode ? [{ debugName: "selection" }] : /* istanbul ignore next */ []));
|
|
399
|
+
tri = model(null, /* @ts-ignore */
|
|
400
|
+
...(ngDevMode ? [{ debugName: "tri" }] : /* istanbul ignore next */ []));
|
|
401
|
+
/** Texte du tableau vide, sans gabarit `stTableauVide`. */
|
|
402
|
+
texteVide = input(null, /* @ts-ignore */
|
|
403
|
+
...(ngDevMode ? [{ debugName: "texteVide" }] : /* istanbul ignore next */ []));
|
|
404
|
+
gabarits = contentChildren(StCellule, /* @ts-ignore */
|
|
405
|
+
...(ngDevMode ? [{ debugName: "gabarits" }] : /* istanbul ignore next */ []));
|
|
406
|
+
gabaritVide = contentChild(StTableauVide, /* @ts-ignore */
|
|
407
|
+
...(ngDevMode ? [{ debugName: "gabaritVide" }] : /* istanbul ignore next */ []));
|
|
408
|
+
zone = viewChild.required('zone', /* @ts-ignore */
|
|
409
|
+
...(ngDevMode ? [{ debugName: "zone" }] : /* istanbul ignore next */ []));
|
|
410
|
+
annonce = new AnnonceLocale(inject(DestroyRef));
|
|
411
|
+
deborde = signal(false, /* @ts-ignore */
|
|
412
|
+
...(ngDevMode ? [{ debugName: "deborde" }] : /* istanbul ignore next */ []));
|
|
413
|
+
largeurFigee = signal(0, /* @ts-ignore */
|
|
414
|
+
...(ngDevMode ? [{ debugName: "largeurFigee" }] : /* istanbul ignore next */ []));
|
|
415
|
+
identifiants = (() => {
|
|
416
|
+
const base = `st-tableau-${(compteur$1 += 1).toString()}`;
|
|
417
|
+
return { legende: `${base}-legende`, selection: `${base}-selection` };
|
|
418
|
+
})();
|
|
419
|
+
cleDEnTete = computed(() => this.enTeteDeLigne() ?? this.colonnes()[0]?.cle ?? '', /* @ts-ignore */
|
|
420
|
+
...(ngDevMode ? [{ debugName: "cleDEnTete" }] : /* istanbul ignore next */ []));
|
|
421
|
+
cellules = computed(() => {
|
|
422
|
+
const gabarits = new Map(this.gabarits().map((gabarit) => [gabarit.cle(), gabarit.gabarit]));
|
|
423
|
+
return this.colonnes().map((colonne) => ({
|
|
424
|
+
colonne,
|
|
425
|
+
gabarit: gabarits.get(colonne.cle) ?? null,
|
|
426
|
+
enTete: colonne.cle === this.cleDEnTete(),
|
|
427
|
+
}));
|
|
428
|
+
}, /* @ts-ignore */
|
|
429
|
+
...(ngDevMode ? [{ debugName: "cellules" }] : /* istanbul ignore next */ []));
|
|
430
|
+
rangees = computed(() => {
|
|
431
|
+
const cle = this.cle();
|
|
432
|
+
const entete = this.cleDEnTete();
|
|
433
|
+
const choisies = new Set(this.selection());
|
|
434
|
+
return this.lignes().map((valeur) => {
|
|
435
|
+
const identifiant = String(valeur[cle]);
|
|
436
|
+
return {
|
|
437
|
+
valeur,
|
|
438
|
+
identifiant,
|
|
439
|
+
nom: texteDe(valeur[entete]),
|
|
440
|
+
choisie: choisies.has(identifiant),
|
|
441
|
+
};
|
|
442
|
+
});
|
|
443
|
+
}, /* @ts-ignore */
|
|
444
|
+
...(ngDevMode ? [{ debugName: "rangees" }] : /* istanbul ignore next */ []));
|
|
445
|
+
squelette = computed(() => this.chargement() && this.lignes().length === 0
|
|
446
|
+
? Array.from({ length: LIGNES_DE_SQUELETTE }, (_, indice) => indice)
|
|
447
|
+
: [], /* @ts-ignore */
|
|
448
|
+
...(ngDevMode ? [{ debugName: "squelette" }] : /* istanbul ignore next */ []));
|
|
449
|
+
nombreDeColonnes = computed(() => this.colonnes().length + (this.selectionnable() ? 1 : 0), /* @ts-ignore */
|
|
450
|
+
...(ngDevMode ? [{ debugName: "nombreDeColonnes" }] : /* istanbul ignore next */ []));
|
|
451
|
+
colonnesDeSquelette = computed(() => Array.from({ length: this.nombreDeColonnes() }, (_, indice) => indice), /* @ts-ignore */
|
|
452
|
+
...(ngDevMode ? [{ debugName: "colonnesDeSquelette" }] : /* istanbul ignore next */ []));
|
|
453
|
+
toutesChoisies = computed(() => {
|
|
454
|
+
const rangees = this.rangees();
|
|
455
|
+
return rangees.length > 0 && rangees.every((rangee) => rangee.choisie);
|
|
456
|
+
}, /* @ts-ignore */
|
|
457
|
+
...(ngDevMode ? [{ debugName: "toutesChoisies" }] : /* istanbul ignore next */ []));
|
|
458
|
+
quelquesChoisies = computed(() => !this.toutesChoisies() && this.rangees().some((rangee) => rangee.choisie), /* @ts-ignore */
|
|
459
|
+
...(ngDevMode ? [{ debugName: "quelquesChoisies" }] : /* istanbul ignore next */ []));
|
|
460
|
+
constructor() {
|
|
461
|
+
// V4-4 : une selection ne vise que ce qui est affiche. Nouvelle page, nouvelles
|
|
462
|
+
// cles : les anciennes tombent.
|
|
463
|
+
effect(() => {
|
|
464
|
+
const presentes = new Set(this.rangees().map((rangee) => rangee.identifiant));
|
|
465
|
+
const selection = this.selection();
|
|
466
|
+
const gardees = selection.filter((identifiant) => presentes.has(identifiant));
|
|
467
|
+
if (gardees.length !== selection.length)
|
|
468
|
+
this.selection.set(gardees);
|
|
469
|
+
});
|
|
470
|
+
// Mesures du rendu, jamais sur le serveur (FE-5).
|
|
471
|
+
const destruction = inject(DestroyRef);
|
|
472
|
+
afterNextRender(() => {
|
|
473
|
+
const zone = this.zone().nativeElement;
|
|
474
|
+
if (typeof ResizeObserver === 'undefined')
|
|
475
|
+
return;
|
|
476
|
+
const observateur = new ResizeObserver(() => {
|
|
477
|
+
this.deborde.set(zone.scrollWidth > zone.clientWidth + 1 || zone.scrollHeight > zone.clientHeight + 1);
|
|
478
|
+
// UX-7 : la largeur des colonnes figees devient la marge de defilement,
|
|
479
|
+
// pour que la cellule focalisee s'arrete A COTE d'elles et non dessous.
|
|
480
|
+
const figees = zone.querySelectorAll('tr:first-child > [data-figee]');
|
|
481
|
+
let largeur = 0;
|
|
482
|
+
figees.forEach((cellule) => (largeur += cellule.getBoundingClientRect().width));
|
|
483
|
+
this.largeurFigee.set(Math.ceil(largeur));
|
|
484
|
+
});
|
|
485
|
+
observateur.observe(zone);
|
|
486
|
+
const tableau = zone.querySelector('table');
|
|
487
|
+
if (tableau !== null)
|
|
488
|
+
observateur.observe(tableau);
|
|
489
|
+
destruction.onDestroy(() => {
|
|
490
|
+
observateur.disconnect();
|
|
491
|
+
});
|
|
492
|
+
});
|
|
493
|
+
}
|
|
494
|
+
/** Amene le focus sur le tableau : sa legende est lue (UX-13). */
|
|
495
|
+
focus(options) {
|
|
496
|
+
this.zone().nativeElement.focus(options);
|
|
497
|
+
}
|
|
498
|
+
sensDe(colonne) {
|
|
499
|
+
const tri = this.tri();
|
|
500
|
+
return tri?.cle === colonne.cle ? tri.sens : null;
|
|
501
|
+
}
|
|
502
|
+
ariaSort(colonne) {
|
|
503
|
+
const sens = this.sensDe(colonne);
|
|
504
|
+
if (sens === null)
|
|
505
|
+
return null;
|
|
506
|
+
return sens === 'croissant' ? 'ascending' : 'descending';
|
|
507
|
+
}
|
|
508
|
+
trier(colonne) {
|
|
509
|
+
const sens = this.sensDe(colonne) === 'croissant' ? 'decroissant' : 'croissant';
|
|
510
|
+
this.tri.set({ cle: colonne.cle, sens });
|
|
511
|
+
const libelles = this.libelles();
|
|
512
|
+
this.annonce.annoncer(sens === 'croissant'
|
|
513
|
+
? libelles.trieCroissant(colonne.libelle)
|
|
514
|
+
: libelles.trieDecroissant(colonne.libelle));
|
|
515
|
+
}
|
|
516
|
+
basculerTout() {
|
|
517
|
+
this.selection.set(this.toutesChoisies() ? [] : this.rangees().map((rangee) => rangee.identifiant));
|
|
518
|
+
}
|
|
519
|
+
basculer(identifiant) {
|
|
520
|
+
const selection = this.selection();
|
|
521
|
+
this.selection.set(selection.includes(identifiant)
|
|
522
|
+
? selection.filter((choisie) => choisie !== identifiant)
|
|
523
|
+
: [...selection, identifiant]);
|
|
524
|
+
}
|
|
525
|
+
texteDe(ligne, colonne) {
|
|
526
|
+
return texteDe(ligne[colonne.cle]);
|
|
527
|
+
}
|
|
528
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: StDataTable, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
529
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.6", type: StDataTable, isStandalone: true, selector: "st-data-table", inputs: { legende: { classPropertyName: "legende", publicName: "legende", isSignal: true, isRequired: true, transformFunction: null }, legendeMasquee: { classPropertyName: "legendeMasquee", publicName: "legendeMasquee", isSignal: true, isRequired: false, transformFunction: null }, colonnes: { classPropertyName: "colonnes", publicName: "colonnes", isSignal: true, isRequired: true, transformFunction: null }, lignes: { classPropertyName: "lignes", publicName: "lignes", isSignal: true, isRequired: true, transformFunction: null }, cle: { classPropertyName: "cle", publicName: "cle", isSignal: true, isRequired: true, transformFunction: null }, enTeteDeLigne: { classPropertyName: "enTeteDeLigne", publicName: "enTeteDeLigne", isSignal: true, isRequired: false, transformFunction: null }, premiereColonneFigee: { classPropertyName: "premiereColonneFigee", publicName: "premiereColonneFigee", isSignal: true, isRequired: false, transformFunction: null }, hauteurMax: { classPropertyName: "hauteurMax", publicName: "hauteurMax", isSignal: true, isRequired: false, transformFunction: null }, densite: { classPropertyName: "densite", publicName: "densite", isSignal: true, isRequired: false, transformFunction: null }, chargement: { classPropertyName: "chargement", publicName: "chargement", isSignal: true, isRequired: false, transformFunction: null }, selectionnable: { classPropertyName: "selectionnable", publicName: "selectionnable", isSignal: true, isRequired: false, transformFunction: null }, selection: { classPropertyName: "selection", publicName: "selection", isSignal: true, isRequired: false, transformFunction: null }, tri: { classPropertyName: "tri", publicName: "tri", isSignal: true, isRequired: false, transformFunction: null }, texteVide: { classPropertyName: "texteVide", publicName: "texteVide", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selection: "selectionChange", tri: "triChange" }, host: { properties: { "attr.data-densite": "densite()", "attr.data-figee": "premiereColonneFigee() ? \"\" : null" }, classAttribute: "st-data-table" }, queries: [{ propertyName: "gabarits", predicate: StCellule, isSignal: true }, { propertyName: "gabaritVide", first: true, predicate: StTableauVide, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "zone", first: true, predicate: ["zone"], descendants: true, isSignal: true }], ngImport: i0, template: "<!-- UN seul ng-content : la projection se decide a la compilation, et un second\n emplacement de meme selecteur, dans une autre branche, ne recevrait jamais\n rien. -->\n<div class=\"st-data-table__barre\">\n @if (selectionnable()) {\n <p class=\"st-data-table__selection\" role=\"status\" [id]=\"identifiants.selection\">\n {{ selection().length > 0 ? libelles().lignesSelectionnees(selection().length) : '' }}\n </p>\n }\n <div class=\"st-data-table__actions\">\n <ng-content select=\"[stActionsDeTableau]\" />\n </div>\n</div>\n\n<!-- UX-6 : zone nommee par la legende ; focalisable quand elle deborde, et par\n programme toujours, pour recevoir le focus apres un changement de page. -->\n<div\n #zone\n class=\"st-data-table__zone\"\n role=\"region\"\n [attr.aria-labelledby]=\"identifiants.legende\"\n [attr.tabindex]=\"deborde() ? 0 : -1\"\n [attr.data-deborde]=\"deborde() ? '' : null\"\n [style.max-block-size]=\"hauteurMax()\"\n [style.scroll-padding-inline-start.px]=\"largeurFigee()\"\n>\n <table class=\"st-data-table__tableau\" [attr.aria-busy]=\"chargement() ? 'true' : null\">\n <caption\n class=\"st-data-table__legende\"\n [id]=\"identifiants.legende\"\n [class.st-vh]=\"legendeMasquee()\"\n >\n {{\n legende()\n }}\n </caption>\n <thead>\n <tr>\n @if (selectionnable()) {\n <th class=\"st-data-table__case\" scope=\"col\" data-figee>\n <input\n class=\"st-data-table__cocher\"\n type=\"checkbox\"\n [checked]=\"toutesChoisies()\"\n [indeterminate]=\"quelquesChoisies()\"\n [disabled]=\"rangees().length === 0\"\n [attr.aria-label]=\"libelles().selectionnerLaPage(rangees().length)\"\n (change)=\"basculerTout()\"\n />\n </th>\n }\n @for (cellule of cellules(); track cellule.colonne.cle; let premiere = $first) {\n <th\n scope=\"col\"\n [attr.data-alignement]=\"cellule.colonne.alignement ?? 'debut'\"\n [attr.data-figee]=\"premiere && premiereColonneFigee() ? '' : null\"\n [attr.aria-sort]=\"ariaSort(cellule.colonne)\"\n >\n @if (cellule.colonne.triable) {\n <button\n stSortHeader\n type=\"button\"\n [sens]=\"sensDe(cellule.colonne)\"\n (click)=\"trier(cellule.colonne)\"\n >\n {{ cellule.colonne.libelle }}\n </button>\n } @else if (cellule.colonne.libelleMasque) {\n <span class=\"st-vh\">{{ cellule.colonne.libelle }}</span>\n } @else {\n {{ cellule.colonne.libelle }}\n }\n </th>\n }\n </tr>\n </thead>\n <tbody>\n @for (rang of squelette(); track rang) {\n <tr class=\"st-data-table__squelette\" aria-hidden=\"true\">\n @for (colonne of colonnesDeSquelette(); track colonne) {\n <td><span class=\"st-data-table__barre-de-squelette\"></span></td>\n }\n </tr>\n }\n @for (rangee of rangees(); track rangee.identifiant) {\n <tr [attr.data-choisie]=\"rangee.choisie ? '' : null\">\n @if (selectionnable()) {\n <td class=\"st-data-table__case\" data-figee>\n <input\n class=\"st-data-table__cocher\"\n type=\"checkbox\"\n [checked]=\"rangee.choisie\"\n [attr.aria-label]=\"libelles().selectionnerLaLigne(rangee.nom ?? rangee.identifiant)\"\n (change)=\"basculer(rangee.identifiant)\"\n />\n </td>\n }\n @for (cellule of cellules(); track cellule.colonne.cle; let premiere = $first) {\n @if (cellule.enTete) {\n <th\n scope=\"row\"\n [attr.data-alignement]=\"cellule.colonne.alignement ?? 'debut'\"\n [attr.data-figee]=\"premiere && premiereColonneFigee() ? '' : null\"\n >\n <ng-container\n *ngTemplateOutlet=\"\n valeur;\n context: { $implicit: rangee.valeur, cellule: cellule }\n \"\n />\n </th>\n } @else {\n <td\n [attr.data-alignement]=\"cellule.colonne.alignement ?? 'debut'\"\n [attr.data-figee]=\"premiere && premiereColonneFigee() ? '' : null\"\n >\n <ng-container\n *ngTemplateOutlet=\"\n valeur;\n context: { $implicit: rangee.valeur, cellule: cellule }\n \"\n />\n </td>\n }\n }\n </tr>\n } @empty {\n @if (!chargement()) {\n <tr>\n <td class=\"st-data-table__vide\" [attr.colspan]=\"nombreDeColonnes()\">\n @if (gabaritVide(); as vide) {\n <ng-container *ngTemplateOutlet=\"vide.gabarit\" />\n } @else {\n {{ texteVide() ?? libelles().tableauVide }}\n }\n </td>\n </tr>\n }\n }\n </tbody>\n </table>\n</div>\n<span class=\"st-vh\" aria-live=\"polite\">{{ annonce.texte() }}</span>\n\n<ng-template #valeur let-ligne let-cellule=\"cellule\">\n @if (cellule.gabarit; as gabarit) {\n <ng-container\n *ngTemplateOutlet=\"gabarit; context: { $implicit: ligne, colonne: cellule.colonne }\"\n />\n } @else if (texteDe(ligne, cellule.colonne); as texte) {\n {{ texte }}\n } @else {\n <span aria-hidden=\"true\">—</span><span class=\"st-vh\">{{ libelles().nonRenseigne }}</span>\n }\n</ng-template>\n", styles: [".st-vh{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}:host([hidden]){display:none!important}:host{--st-tableau-plan-figee: 1;--st-tableau-plan-entete: 2;--st-tableau-plan-coin: 3;display:block}.st-data-table__barre,.st-data-table__actions{display:flex;flex-wrap:wrap;gap:var(--st-espacement-2);align-items:center}.st-data-table__barre{justify-content:space-between}.st-data-table__barre:has(.st-data-table__selection,.st-data-table__actions:not(:empty)){min-block-size:var(--st-cible-tactile-min);margin-block-end:var(--st-espacement-2)}.st-data-table__actions{margin-inline-start:auto}.st-data-table__actions:empty{display:none}.st-data-table__selection{margin:0;font-weight:var(--st-graisse-semi)}.st-data-table__zone:focus{outline:2px solid var(--st-couleur-anneau-focus);outline-offset:2px}.st-data-table__zone{position:relative;overflow:auto;border:1px solid var(--st-couleur-bordure);border-radius:var(--st-rayon-md);background:linear-gradient(to right,var(--st-couleur-surface) 30%,transparent) left/2rem 100% no-repeat local,linear-gradient(to left,var(--st-couleur-surface) 30%,transparent) right/2rem 100% no-repeat local,radial-gradient(farthest-side at 0 50%,rgba(0,0,0,.2),transparent) left/.75rem 100% no-repeat scroll,radial-gradient(farthest-side at 100% 50%,rgba(0,0,0,.2),transparent) right/.75rem 100% no-repeat scroll,var(--st-couleur-surface)}.st-data-table__tableau{inline-size:100%;font-variant-numeric:tabular-nums;border-collapse:separate;border-spacing:0}.st-data-table__legende{padding:var(--st-espacement-3);font-weight:var(--st-graisse-semi);text-align:start}th,td{padding-block:var(--st-tableau-cellule-bloc, var(--st-espacement-3));padding-inline:var(--st-tableau-cellule-ligne, var(--st-espacement-3));text-align:start;vertical-align:top;overflow-wrap:anywhere;border-block-end:1px solid var(--st-couleur-bordure)}thead th{font-weight:var(--st-graisse-semi);color:var(--st-couleur-texte-discret);white-space:nowrap;background:var(--st-couleur-surface-enfoncee)}thead th{position:sticky;inset-block-start:0;z-index:var(--st-tableau-plan-entete)}tbody th{font-weight:var(--st-graisse-semi)}tbody tr:last-child>*{border-block-end:0}@media(hover:hover){tbody tr:hover>*{background:var(--st-couleur-surface-survol)}}tbody tr[data-choisie]>*{background:var(--st-couleur-primaire-discret)}tbody tr[data-choisie]>:first-child{box-shadow:inset 3px 0 0 var(--st-couleur-primaire)}:host-context([dir=rtl]) tbody tr[data-choisie]>:first-child{box-shadow:inset -3px 0 0 var(--st-couleur-primaire)}[data-alignement=fin]{text-align:end}.st-data-table__case{inline-size:var(--st-tableau-largeur-case, 3rem);min-inline-size:var(--st-tableau-largeur-case, 3rem);text-align:center;vertical-align:middle}:host([data-densite=compacte]) th,:host([data-densite=compacte]) td{padding-block:var(--st-tableau-cellule-bloc, var(--st-espacement-1));padding-inline:var(--st-tableau-cellule-ligne, var(--st-espacement-2))}.st-data-table__cocher:focus-visible{outline:2px solid var(--st-couleur-anneau-focus);outline-offset:2px}.st-data-table__cocher{inline-size:var(--st-cible-min);block-size:var(--st-cible-min);margin:0;accent-color:var(--st-couleur-primaire);cursor:pointer}:host([data-figee]) [data-figee]{position:sticky;inset-inline-start:0;z-index:var(--st-tableau-plan-figee);background:var(--st-couleur-surface)}:host([data-figee]) .st-data-table__case+[data-figee]{inset-inline-start:var(--st-tableau-largeur-case, 3rem)}:host([data-figee]) thead [data-figee]{z-index:var(--st-tableau-plan-coin);background:var(--st-couleur-surface-enfoncee)}.st-data-table__vide{padding:var(--st-espacement-5);color:var(--st-couleur-texte-discret);text-align:center}.st-data-table__barre-de-squelette{display:block;block-size:1em;background:var(--st-couleur-surface-enfoncee);border-radius:var(--st-rayon-sm)}@media(prefers-reduced-motion:no-preference){.st-data-table__barre-de-squelette{animation:st-tableau-pulsation var(--st-anim-respiration, 1.6s) ease-in-out infinite}}@keyframes st-tableau-pulsation{50%{opacity:.5}}.st-data-table__tableau[aria-busy=true]{cursor:progress}@media(forced-colors:active){tbody tr[data-choisie]>:first-child{box-shadow:none;border-inline-start:3px solid Highlight}}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: StSortHeader, selector: "button[stSortHeader]", inputs: ["sens"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
530
|
+
}
|
|
531
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: StDataTable, decorators: [{
|
|
532
|
+
type: Component,
|
|
533
|
+
args: [{ selector: 'st-data-table', changeDetection: ChangeDetectionStrategy.OnPush, imports: [NgTemplateOutlet, StSortHeader], host: {
|
|
534
|
+
class: 'st-data-table',
|
|
535
|
+
'[attr.data-densite]': 'densite()',
|
|
536
|
+
'[attr.data-figee]': 'premiereColonneFigee() ? "" : null',
|
|
537
|
+
}, template: "<!-- UN seul ng-content : la projection se decide a la compilation, et un second\n emplacement de meme selecteur, dans une autre branche, ne recevrait jamais\n rien. -->\n<div class=\"st-data-table__barre\">\n @if (selectionnable()) {\n <p class=\"st-data-table__selection\" role=\"status\" [id]=\"identifiants.selection\">\n {{ selection().length > 0 ? libelles().lignesSelectionnees(selection().length) : '' }}\n </p>\n }\n <div class=\"st-data-table__actions\">\n <ng-content select=\"[stActionsDeTableau]\" />\n </div>\n</div>\n\n<!-- UX-6 : zone nommee par la legende ; focalisable quand elle deborde, et par\n programme toujours, pour recevoir le focus apres un changement de page. -->\n<div\n #zone\n class=\"st-data-table__zone\"\n role=\"region\"\n [attr.aria-labelledby]=\"identifiants.legende\"\n [attr.tabindex]=\"deborde() ? 0 : -1\"\n [attr.data-deborde]=\"deborde() ? '' : null\"\n [style.max-block-size]=\"hauteurMax()\"\n [style.scroll-padding-inline-start.px]=\"largeurFigee()\"\n>\n <table class=\"st-data-table__tableau\" [attr.aria-busy]=\"chargement() ? 'true' : null\">\n <caption\n class=\"st-data-table__legende\"\n [id]=\"identifiants.legende\"\n [class.st-vh]=\"legendeMasquee()\"\n >\n {{\n legende()\n }}\n </caption>\n <thead>\n <tr>\n @if (selectionnable()) {\n <th class=\"st-data-table__case\" scope=\"col\" data-figee>\n <input\n class=\"st-data-table__cocher\"\n type=\"checkbox\"\n [checked]=\"toutesChoisies()\"\n [indeterminate]=\"quelquesChoisies()\"\n [disabled]=\"rangees().length === 0\"\n [attr.aria-label]=\"libelles().selectionnerLaPage(rangees().length)\"\n (change)=\"basculerTout()\"\n />\n </th>\n }\n @for (cellule of cellules(); track cellule.colonne.cle; let premiere = $first) {\n <th\n scope=\"col\"\n [attr.data-alignement]=\"cellule.colonne.alignement ?? 'debut'\"\n [attr.data-figee]=\"premiere && premiereColonneFigee() ? '' : null\"\n [attr.aria-sort]=\"ariaSort(cellule.colonne)\"\n >\n @if (cellule.colonne.triable) {\n <button\n stSortHeader\n type=\"button\"\n [sens]=\"sensDe(cellule.colonne)\"\n (click)=\"trier(cellule.colonne)\"\n >\n {{ cellule.colonne.libelle }}\n </button>\n } @else if (cellule.colonne.libelleMasque) {\n <span class=\"st-vh\">{{ cellule.colonne.libelle }}</span>\n } @else {\n {{ cellule.colonne.libelle }}\n }\n </th>\n }\n </tr>\n </thead>\n <tbody>\n @for (rang of squelette(); track rang) {\n <tr class=\"st-data-table__squelette\" aria-hidden=\"true\">\n @for (colonne of colonnesDeSquelette(); track colonne) {\n <td><span class=\"st-data-table__barre-de-squelette\"></span></td>\n }\n </tr>\n }\n @for (rangee of rangees(); track rangee.identifiant) {\n <tr [attr.data-choisie]=\"rangee.choisie ? '' : null\">\n @if (selectionnable()) {\n <td class=\"st-data-table__case\" data-figee>\n <input\n class=\"st-data-table__cocher\"\n type=\"checkbox\"\n [checked]=\"rangee.choisie\"\n [attr.aria-label]=\"libelles().selectionnerLaLigne(rangee.nom ?? rangee.identifiant)\"\n (change)=\"basculer(rangee.identifiant)\"\n />\n </td>\n }\n @for (cellule of cellules(); track cellule.colonne.cle; let premiere = $first) {\n @if (cellule.enTete) {\n <th\n scope=\"row\"\n [attr.data-alignement]=\"cellule.colonne.alignement ?? 'debut'\"\n [attr.data-figee]=\"premiere && premiereColonneFigee() ? '' : null\"\n >\n <ng-container\n *ngTemplateOutlet=\"\n valeur;\n context: { $implicit: rangee.valeur, cellule: cellule }\n \"\n />\n </th>\n } @else {\n <td\n [attr.data-alignement]=\"cellule.colonne.alignement ?? 'debut'\"\n [attr.data-figee]=\"premiere && premiereColonneFigee() ? '' : null\"\n >\n <ng-container\n *ngTemplateOutlet=\"\n valeur;\n context: { $implicit: rangee.valeur, cellule: cellule }\n \"\n />\n </td>\n }\n }\n </tr>\n } @empty {\n @if (!chargement()) {\n <tr>\n <td class=\"st-data-table__vide\" [attr.colspan]=\"nombreDeColonnes()\">\n @if (gabaritVide(); as vide) {\n <ng-container *ngTemplateOutlet=\"vide.gabarit\" />\n } @else {\n {{ texteVide() ?? libelles().tableauVide }}\n }\n </td>\n </tr>\n }\n }\n </tbody>\n </table>\n</div>\n<span class=\"st-vh\" aria-live=\"polite\">{{ annonce.texte() }}</span>\n\n<ng-template #valeur let-ligne let-cellule=\"cellule\">\n @if (cellule.gabarit; as gabarit) {\n <ng-container\n *ngTemplateOutlet=\"gabarit; context: { $implicit: ligne, colonne: cellule.colonne }\"\n />\n } @else if (texteDe(ligne, cellule.colonne); as texte) {\n {{ texte }}\n } @else {\n <span aria-hidden=\"true\">—</span><span class=\"st-vh\">{{ libelles().nonRenseigne }}</span>\n }\n</ng-template>\n", styles: [".st-vh{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}:host([hidden]){display:none!important}:host{--st-tableau-plan-figee: 1;--st-tableau-plan-entete: 2;--st-tableau-plan-coin: 3;display:block}.st-data-table__barre,.st-data-table__actions{display:flex;flex-wrap:wrap;gap:var(--st-espacement-2);align-items:center}.st-data-table__barre{justify-content:space-between}.st-data-table__barre:has(.st-data-table__selection,.st-data-table__actions:not(:empty)){min-block-size:var(--st-cible-tactile-min);margin-block-end:var(--st-espacement-2)}.st-data-table__actions{margin-inline-start:auto}.st-data-table__actions:empty{display:none}.st-data-table__selection{margin:0;font-weight:var(--st-graisse-semi)}.st-data-table__zone:focus{outline:2px solid var(--st-couleur-anneau-focus);outline-offset:2px}.st-data-table__zone{position:relative;overflow:auto;border:1px solid var(--st-couleur-bordure);border-radius:var(--st-rayon-md);background:linear-gradient(to right,var(--st-couleur-surface) 30%,transparent) left/2rem 100% no-repeat local,linear-gradient(to left,var(--st-couleur-surface) 30%,transparent) right/2rem 100% no-repeat local,radial-gradient(farthest-side at 0 50%,rgba(0,0,0,.2),transparent) left/.75rem 100% no-repeat scroll,radial-gradient(farthest-side at 100% 50%,rgba(0,0,0,.2),transparent) right/.75rem 100% no-repeat scroll,var(--st-couleur-surface)}.st-data-table__tableau{inline-size:100%;font-variant-numeric:tabular-nums;border-collapse:separate;border-spacing:0}.st-data-table__legende{padding:var(--st-espacement-3);font-weight:var(--st-graisse-semi);text-align:start}th,td{padding-block:var(--st-tableau-cellule-bloc, var(--st-espacement-3));padding-inline:var(--st-tableau-cellule-ligne, var(--st-espacement-3));text-align:start;vertical-align:top;overflow-wrap:anywhere;border-block-end:1px solid var(--st-couleur-bordure)}thead th{font-weight:var(--st-graisse-semi);color:var(--st-couleur-texte-discret);white-space:nowrap;background:var(--st-couleur-surface-enfoncee)}thead th{position:sticky;inset-block-start:0;z-index:var(--st-tableau-plan-entete)}tbody th{font-weight:var(--st-graisse-semi)}tbody tr:last-child>*{border-block-end:0}@media(hover:hover){tbody tr:hover>*{background:var(--st-couleur-surface-survol)}}tbody tr[data-choisie]>*{background:var(--st-couleur-primaire-discret)}tbody tr[data-choisie]>:first-child{box-shadow:inset 3px 0 0 var(--st-couleur-primaire)}:host-context([dir=rtl]) tbody tr[data-choisie]>:first-child{box-shadow:inset -3px 0 0 var(--st-couleur-primaire)}[data-alignement=fin]{text-align:end}.st-data-table__case{inline-size:var(--st-tableau-largeur-case, 3rem);min-inline-size:var(--st-tableau-largeur-case, 3rem);text-align:center;vertical-align:middle}:host([data-densite=compacte]) th,:host([data-densite=compacte]) td{padding-block:var(--st-tableau-cellule-bloc, var(--st-espacement-1));padding-inline:var(--st-tableau-cellule-ligne, var(--st-espacement-2))}.st-data-table__cocher:focus-visible{outline:2px solid var(--st-couleur-anneau-focus);outline-offset:2px}.st-data-table__cocher{inline-size:var(--st-cible-min);block-size:var(--st-cible-min);margin:0;accent-color:var(--st-couleur-primaire);cursor:pointer}:host([data-figee]) [data-figee]{position:sticky;inset-inline-start:0;z-index:var(--st-tableau-plan-figee);background:var(--st-couleur-surface)}:host([data-figee]) .st-data-table__case+[data-figee]{inset-inline-start:var(--st-tableau-largeur-case, 3rem)}:host([data-figee]) thead [data-figee]{z-index:var(--st-tableau-plan-coin);background:var(--st-couleur-surface-enfoncee)}.st-data-table__vide{padding:var(--st-espacement-5);color:var(--st-couleur-texte-discret);text-align:center}.st-data-table__barre-de-squelette{display:block;block-size:1em;background:var(--st-couleur-surface-enfoncee);border-radius:var(--st-rayon-sm)}@media(prefers-reduced-motion:no-preference){.st-data-table__barre-de-squelette{animation:st-tableau-pulsation var(--st-anim-respiration, 1.6s) ease-in-out infinite}}@keyframes st-tableau-pulsation{50%{opacity:.5}}.st-data-table__tableau[aria-busy=true]{cursor:progress}@media(forced-colors:active){tbody tr[data-choisie]>:first-child{box-shadow:none;border-inline-start:3px solid Highlight}}\n"] }]
|
|
538
|
+
}], ctorParameters: () => [], propDecorators: { legende: [{ type: i0.Input, args: [{ isSignal: true, alias: "legende", required: true }] }], legendeMasquee: [{ type: i0.Input, args: [{ isSignal: true, alias: "legendeMasquee", required: false }] }], colonnes: [{ type: i0.Input, args: [{ isSignal: true, alias: "colonnes", required: true }] }], lignes: [{ type: i0.Input, args: [{ isSignal: true, alias: "lignes", required: true }] }], cle: [{ type: i0.Input, args: [{ isSignal: true, alias: "cle", required: true }] }], enTeteDeLigne: [{ type: i0.Input, args: [{ isSignal: true, alias: "enTeteDeLigne", required: false }] }], premiereColonneFigee: [{ type: i0.Input, args: [{ isSignal: true, alias: "premiereColonneFigee", required: false }] }], hauteurMax: [{ type: i0.Input, args: [{ isSignal: true, alias: "hauteurMax", required: false }] }], densite: [{ type: i0.Input, args: [{ isSignal: true, alias: "densite", required: false }] }], chargement: [{ type: i0.Input, args: [{ isSignal: true, alias: "chargement", required: false }] }], selectionnable: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectionnable", required: false }] }], selection: [{ type: i0.Input, args: [{ isSignal: true, alias: "selection", required: false }] }, { type: i0.Output, args: ["selectionChange"] }], tri: [{ type: i0.Input, args: [{ isSignal: true, alias: "tri", required: false }] }, { type: i0.Output, args: ["triChange"] }], texteVide: [{ type: i0.Input, args: [{ isSignal: true, alias: "texteVide", required: false }] }], gabarits: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => StCellule), { isSignal: true }] }], gabaritVide: [{ type: i0.ContentChild, args: [i0.forwardRef(() => StTableauVide), { isSignal: true }] }], zone: [{ type: i0.ViewChild, args: ['zone', { isSignal: true }] }] } });
|
|
539
|
+
/** Texte d'une valeur ; `null` quand elle est absente, pour le dire (UX de la vague 4). */
|
|
540
|
+
function texteDe(valeur) {
|
|
541
|
+
if (valeur === null || valeur === undefined || valeur === '')
|
|
542
|
+
return null;
|
|
543
|
+
if (typeof valeur === 'string')
|
|
544
|
+
return valeur;
|
|
545
|
+
if (typeof valeur === 'number' || typeof valeur === 'boolean' || typeof valeur === 'bigint') {
|
|
546
|
+
return String(valeur);
|
|
547
|
+
}
|
|
548
|
+
return null;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
/**
|
|
552
|
+
* Filtre actif, retirable : « Statut : Expediee ✕ ».
|
|
553
|
+
*
|
|
554
|
+
* ```html
|
|
555
|
+
* <button stFilterChip libelle="Statut : Expediee" (click)="retirer('statut')"></button>
|
|
556
|
+
* ```
|
|
557
|
+
*
|
|
558
|
+
* ⚠️ **Toute la puce est le bouton**, et son nom CONTIENT le texte visible —
|
|
559
|
+
* « Retirer le filtre Statut : Expediee » (WCAG 2.5.3) : une commande vocale
|
|
560
|
+
* « cliquer Statut » l'atteint. Une croix seule, a cote d'un texte inerte, serait
|
|
561
|
+
* une cible de quelques pixels sans nom.
|
|
562
|
+
*/
|
|
563
|
+
class StFilterChip {
|
|
564
|
+
libelles = inject(ST_LIBELLES);
|
|
565
|
+
libelle = input.required(/* @ts-ignore */
|
|
566
|
+
...(ngDevMode ? [{ debugName: "libelle" }] : /* istanbul ignore next */ []));
|
|
567
|
+
nom = computed(() => this.libelles().retirerLeFiltre(this.libelle()), /* @ts-ignore */
|
|
568
|
+
...(ngDevMode ? [{ debugName: "nom" }] : /* istanbul ignore next */ []));
|
|
569
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: StFilterChip, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
570
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.6", type: StFilterChip, isStandalone: true, selector: "button[stFilterChip]", inputs: { libelle: { classPropertyName: "libelle", publicName: "libelle", isSignal: true, isRequired: true, transformFunction: null } }, host: { attributes: { "type": "button" }, properties: { "attr.aria-label": "nom()" }, classAttribute: "st-filter-chip" }, ngImport: i0, template: "<span class=\"st-filter-chip__libelle\">{{ libelle() }}</span>\n<st-icon class=\"st-filter-chip__croix\" nom=\"croix\" taille=\"sm\" />\n", styles: [".st-vh{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}:host([hidden]){display:none!important}:host:focus-visible{outline:2px solid var(--st-couleur-anneau-focus);outline-offset:2px}:host{display:inline-flex;gap:var(--st-espacement-1);align-items:center;min-block-size:calc(var(--st-cible-min) + var(--st-espacement-2));padding-block:var(--st-espacement-1);padding-inline:var(--st-espacement-3) var(--st-espacement-2);font:inherit;color:var(--st-couleur-texte);cursor:pointer;background:var(--st-couleur-surface-enfoncee);border:1px solid var(--st-couleur-bordure-forte);border-radius:var(--st-rayon-pleine)}@media(hover:hover){:host:hover{background:var(--st-couleur-surface-survol)}}.st-filter-chip__croix{flex:none}\n"], dependencies: [{ kind: "component", type: StIcon, selector: "st-icon", inputs: ["nom", "sprite", "nomMetier", "taille", "ton", "etiquette"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
571
|
+
}
|
|
572
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: StFilterChip, decorators: [{
|
|
573
|
+
type: Component,
|
|
574
|
+
args: [{ selector: 'button[stFilterChip]', changeDetection: ChangeDetectionStrategy.OnPush, imports: [StIcon], host: {
|
|
575
|
+
class: 'st-filter-chip',
|
|
576
|
+
type: 'button',
|
|
577
|
+
'[attr.aria-label]': 'nom()',
|
|
578
|
+
}, template: "<span class=\"st-filter-chip__libelle\">{{ libelle() }}</span>\n<st-icon class=\"st-filter-chip__croix\" nom=\"croix\" taille=\"sm\" />\n", styles: [".st-vh{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}:host([hidden]){display:none!important}:host:focus-visible{outline:2px solid var(--st-couleur-anneau-focus);outline-offset:2px}:host{display:inline-flex;gap:var(--st-espacement-1);align-items:center;min-block-size:calc(var(--st-cible-min) + var(--st-espacement-2));padding-block:var(--st-espacement-1);padding-inline:var(--st-espacement-3) var(--st-espacement-2);font:inherit;color:var(--st-couleur-texte);cursor:pointer;background:var(--st-couleur-surface-enfoncee);border:1px solid var(--st-couleur-bordure-forte);border-radius:var(--st-rayon-pleine)}@media(hover:hover){:host:hover{background:var(--st-couleur-surface-survol)}}.st-filter-chip__croix{flex:none}\n"] }]
|
|
579
|
+
}], propDecorators: { libelle: [{ type: i0.Input, args: [{ isSignal: true, alias: "libelle", required: true }] }] } });
|
|
580
|
+
|
|
581
|
+
let compteur = 0;
|
|
582
|
+
/**
|
|
583
|
+
* Barre de filtres : les champs, puis les filtres en vigueur, retirables.
|
|
584
|
+
*
|
|
585
|
+
* ```html
|
|
586
|
+
* <st-filter-bar [filtresActifs]="actifs()" (retrait)="retirer($event)" (effacement)="effacer()">
|
|
587
|
+
* <st-select libelle="Statut" [options]="statuts" [(value)]="statut" />
|
|
588
|
+
* </st-filter-bar>
|
|
589
|
+
* ```
|
|
590
|
+
*
|
|
591
|
+
* Un formulaire NOMME : repere « Filtres » dans la liste des reperes du lecteur
|
|
592
|
+
* d'ecran. Pas un repere `search` : un `st-search-field` pose dedans en porte deja
|
|
593
|
+
* un, et deux reperes imbriques se liraient en double.
|
|
594
|
+
*
|
|
595
|
+
* ⚠️ **Les filtres s'appliquent au changement**, par l'application : Entree dans
|
|
596
|
+
* un champ n'envoie rien, et ne recharge pas la page.
|
|
597
|
+
*
|
|
598
|
+
* ⚠️ **Retirer un filtre rend le focus a la puce suivante**, sinon a la
|
|
599
|
+
* precedente, sinon au formulaire ; « Effacer les filtres » le rend au formulaire
|
|
600
|
+
* (UX-14). Le focus ne tombe jamais sur le document, et le retrait s'annonce.
|
|
601
|
+
*
|
|
602
|
+
* ⚠️ **Dans l'adresse, des valeurs d'enumeration seulement** (SEC-2) : un texte
|
|
603
|
+
* cherche, un nom, un IBAN n'y vont pas. Le composant ne touche pas a l'adresse ;
|
|
604
|
+
* la regle est pour l'application qui le ferait.
|
|
605
|
+
*/
|
|
606
|
+
class StFilterBar {
|
|
607
|
+
libelles = inject(ST_LIBELLES);
|
|
608
|
+
element = inject(ElementRef);
|
|
609
|
+
injecteur = inject(Injector);
|
|
610
|
+
/** Nom du formulaire. Par defaut : « Filtres ». */
|
|
611
|
+
etiquette = input(null, /* @ts-ignore */
|
|
612
|
+
...(ngDevMode ? [{ debugName: "etiquette" }] : /* istanbul ignore next */ []));
|
|
613
|
+
filtresActifs = input([], /* @ts-ignore */
|
|
614
|
+
...(ngDevMode ? [{ debugName: "filtresActifs" }] : /* istanbul ignore next */ []));
|
|
615
|
+
retrait = output();
|
|
616
|
+
effacement = output();
|
|
617
|
+
annonce = new AnnonceLocale(inject(DestroyRef));
|
|
618
|
+
identifiantActifs = `st-filtres-${(compteur += 1).toString()}-actifs`;
|
|
619
|
+
etiquetteLue = computed(() => this.etiquette() ?? this.libelles().filtres, /* @ts-ignore */
|
|
620
|
+
...(ngDevMode ? [{ debugName: "etiquetteLue" }] : /* istanbul ignore next */ []));
|
|
621
|
+
retirer(filtre, indice) {
|
|
622
|
+
this.retrait.emit(filtre.cle);
|
|
623
|
+
this.annonce.annoncer(this.libelles().filtreRetire(filtre.libelle));
|
|
624
|
+
this.apresLeRendu(() => {
|
|
625
|
+
const puces = this.element.nativeElement.querySelectorAll('.st-filter-chip');
|
|
626
|
+
return puces[Math.min(indice, puces.length - 1)] ?? null;
|
|
627
|
+
});
|
|
628
|
+
}
|
|
629
|
+
effacer() {
|
|
630
|
+
this.effacement.emit();
|
|
631
|
+
this.annonce.annoncer(this.libelles().filtresEffaces);
|
|
632
|
+
this.apresLeRendu(() => null);
|
|
633
|
+
}
|
|
634
|
+
apresLeRendu(cible) {
|
|
635
|
+
afterNextRender(() => {
|
|
636
|
+
const formulaire = this.element.nativeElement.querySelector('form');
|
|
637
|
+
(cible() ?? formulaire)?.focus();
|
|
638
|
+
}, { injector: this.injecteur });
|
|
639
|
+
}
|
|
640
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: StFilterBar, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
641
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.6", type: StFilterBar, isStandalone: true, selector: "st-filter-bar", inputs: { etiquette: { classPropertyName: "etiquette", publicName: "etiquette", isSignal: true, isRequired: false, transformFunction: null }, filtresActifs: { classPropertyName: "filtresActifs", publicName: "filtresActifs", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { retrait: "retrait", effacement: "effacement" }, host: { classAttribute: "st-filter-bar" }, ngImport: i0, template: "<!-- tabindex -1 : cible du focus quand la derniere puce disparait. -->\n<form\n class=\"st-filter-bar__formulaire\"\n tabindex=\"-1\"\n [attr.aria-label]=\"etiquetteLue()\"\n (submit)=\"$event.preventDefault()\"\n>\n <div class=\"st-filter-bar__champs\">\n <ng-content />\n </div>\n\n @if (filtresActifs().length > 0) {\n <div class=\"st-filter-bar__actifs\">\n <p class=\"st-filter-bar__titre\" [id]=\"identifiantActifs\">{{ libelles().filtresActifs }}</p>\n <ul class=\"st-filter-bar__puces\" [attr.aria-labelledby]=\"identifiantActifs\">\n @for (filtre of filtresActifs(); track filtre.cle; let indice = $index) {\n <li>\n <!-- eslint-disable-next-line @angular-eslint/template/elements-content --\n Le contenu vient du gabarit de stFilterChip, et le libelle est requis. -->\n <button\n stFilterChip\n type=\"button\"\n [libelle]=\"filtre.libelle\"\n (click)=\"retirer(filtre, indice)\"\n ></button>\n </li>\n }\n </ul>\n <button stButton type=\"button\" variante=\"discret\" (click)=\"effacer()\">\n {{ libelles().effacerLesFiltres }}\n </button>\n </div>\n }\n</form>\n<span class=\"st-vh\" aria-live=\"polite\">{{ annonce.texte() }}</span>\n", styles: [".st-vh{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}:host([hidden]){display:none!important}:host{display:block}.st-filter-bar__formulaire:focus{outline:2px solid var(--st-couleur-anneau-focus);outline-offset:2px}.st-filter-bar__formulaire{display:grid;gap:var(--st-espacement-3)}.st-filter-bar__champs{display:flex;flex-wrap:wrap;gap:var(--st-espacement-3) var(--st-espacement-4);align-items:flex-end}.st-filter-bar__actifs{display:flex;flex-wrap:wrap;gap:var(--st-espacement-2);align-items:center}.st-filter-bar__titre{margin:0;font-weight:var(--st-graisse-semi)}.st-filter-bar__puces{display:flex;flex-wrap:wrap;gap:var(--st-espacement-2);padding:0;margin:0;list-style:none}\n"], dependencies: [{ kind: "component", type: StButton, selector: "button[stButton]", inputs: ["variante", "taille", "pleineLargeur", "iconeAvant", "iconeApres", "chargement", "indisponible"] }, { kind: "component", type: StFilterChip, selector: "button[stFilterChip]", inputs: ["libelle"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
642
|
+
}
|
|
643
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: StFilterBar, decorators: [{
|
|
644
|
+
type: Component,
|
|
645
|
+
args: [{ selector: 'st-filter-bar', changeDetection: ChangeDetectionStrategy.OnPush, imports: [StButton, StFilterChip], host: { class: 'st-filter-bar' }, template: "<!-- tabindex -1 : cible du focus quand la derniere puce disparait. -->\n<form\n class=\"st-filter-bar__formulaire\"\n tabindex=\"-1\"\n [attr.aria-label]=\"etiquetteLue()\"\n (submit)=\"$event.preventDefault()\"\n>\n <div class=\"st-filter-bar__champs\">\n <ng-content />\n </div>\n\n @if (filtresActifs().length > 0) {\n <div class=\"st-filter-bar__actifs\">\n <p class=\"st-filter-bar__titre\" [id]=\"identifiantActifs\">{{ libelles().filtresActifs }}</p>\n <ul class=\"st-filter-bar__puces\" [attr.aria-labelledby]=\"identifiantActifs\">\n @for (filtre of filtresActifs(); track filtre.cle; let indice = $index) {\n <li>\n <!-- eslint-disable-next-line @angular-eslint/template/elements-content --\n Le contenu vient du gabarit de stFilterChip, et le libelle est requis. -->\n <button\n stFilterChip\n type=\"button\"\n [libelle]=\"filtre.libelle\"\n (click)=\"retirer(filtre, indice)\"\n ></button>\n </li>\n }\n </ul>\n <button stButton type=\"button\" variante=\"discret\" (click)=\"effacer()\">\n {{ libelles().effacerLesFiltres }}\n </button>\n </div>\n }\n</form>\n<span class=\"st-vh\" aria-live=\"polite\">{{ annonce.texte() }}</span>\n", styles: [".st-vh{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}:host([hidden]){display:none!important}:host{display:block}.st-filter-bar__formulaire:focus{outline:2px solid var(--st-couleur-anneau-focus);outline-offset:2px}.st-filter-bar__formulaire{display:grid;gap:var(--st-espacement-3)}.st-filter-bar__champs{display:flex;flex-wrap:wrap;gap:var(--st-espacement-3) var(--st-espacement-4);align-items:flex-end}.st-filter-bar__actifs{display:flex;flex-wrap:wrap;gap:var(--st-espacement-2);align-items:center}.st-filter-bar__titre{margin:0;font-weight:var(--st-graisse-semi)}.st-filter-bar__puces{display:flex;flex-wrap:wrap;gap:var(--st-espacement-2);padding:0;margin:0;list-style:none}\n"] }]
|
|
646
|
+
}], propDecorators: { etiquette: [{ type: i0.Input, args: [{ isSignal: true, alias: "etiquette", required: false }] }], filtresActifs: [{ type: i0.Input, args: [{ isSignal: true, alias: "filtresActifs", required: false }] }], retrait: [{ type: i0.Output, args: ["retrait"] }], effacement: [{ type: i0.Output, args: ["effacement"] }] } });
|
|
647
|
+
|
|
648
|
+
/**
|
|
649
|
+
* @starterlib/ui/listes — ce qui affiche une COLLECTION : liste, liste de
|
|
650
|
+
* description, table de donnees, pagination, tri, filtres.
|
|
651
|
+
*
|
|
652
|
+
* ⚠️ Un point d'entree separe pour une raison de MOMENT, et non de dependance
|
|
653
|
+
* (ADR 0031, decision 2). `st-data-table` est le module le plus lourd du
|
|
654
|
+
* paquet ; la coquille de l'hote n'affiche aucune collection, et le payait
|
|
655
|
+
* pourtant en entier a chaque premier ecran, parce qu'un paquet partage en
|
|
656
|
+
* singleton part ENTIER.
|
|
657
|
+
*
|
|
658
|
+
* ⚠️ En federation, ce point d'entree se partage SEPAREMENT de
|
|
659
|
+
* `@starterlib/ui` : c'est un specificateur de module distinct.
|
|
660
|
+
*
|
|
661
|
+
* ```ts
|
|
662
|
+
* import { StDataTable, StPagination } from '@starterlib/ui/listes';
|
|
663
|
+
* ```
|
|
664
|
+
*/
|
|
665
|
+
|
|
666
|
+
/**
|
|
667
|
+
* Generated bundle index. Do not edit.
|
|
668
|
+
*/
|
|
669
|
+
|
|
670
|
+
export { StCellule, StDataTable, StDescription, StDescriptionList, StElementDeListe, StFilterBar, StFilterChip, StList, StPagination, StSortHeader, StTableauVide };
|
|
671
|
+
//# sourceMappingURL=starterlib-ui-listes.mjs.map
|