@starterlib/ui 0.11.7 → 0.13.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 +38 -4
- package/assets/icones/catalogue.json +1 -1
- package/fesm2022/starterlib-ui-donnees.mjs +360 -7
- package/fesm2022/starterlib-ui-donnees.mjs.map +1 -1
- package/fesm2022/starterlib-ui-graphiques.mjs +510 -43
- package/fesm2022/starterlib-ui-graphiques.mjs.map +1 -1
- package/fesm2022/starterlib-ui-messagerie.mjs +1 -0
- package/fesm2022/starterlib-ui-messagerie.mjs.map +1 -1
- package/fesm2022/{starterlib-ui-saisie-autres-Bw8gYr8W.mjs → starterlib-ui-saisie-autres-BaCArJbW.mjs} +19 -3
- package/fesm2022/{starterlib-ui-saisie-autres-Bw8gYr8W.mjs.map → starterlib-ui-saisie-autres-BaCArJbW.mjs.map} +1 -1
- package/fesm2022/starterlib-ui-saisie.mjs +1 -1
- package/fesm2022/starterlib-ui-virtuel.mjs +523 -7
- package/fesm2022/starterlib-ui-virtuel.mjs.map +1 -1
- package/package.json +3 -3
- package/types/starterlib-ui-donnees.d.ts +131 -0
- package/types/starterlib-ui-graphiques.d.ts +200 -4
- package/types/starterlib-ui-saisie.d.ts +18 -0
- package/types/starterlib-ui-virtuel.d.ts +211 -0
- package/virtuel/README.md +39 -0
|
@@ -14,7 +14,14 @@ const LIBELLES_GRAPHIQUES_FR = {
|
|
|
14
14
|
evenements: "Événements",
|
|
15
15
|
separateurDEvenement: "\xA0: ",
|
|
16
16
|
aucuneDonnee: "Aucune donnée à afficher",
|
|
17
|
-
tendance: (dernier, variation) => variation === null ? `Derni\u00e8re valeur\u00a0: ${dernier}` : `Derni\u00e8re valeur\u00a0: ${dernier}, variation\u00a0: ${variation}
|
|
17
|
+
tendance: (dernier, variation) => variation === null ? `Derni\u00e8re valeur\u00a0: ${dernier}` : `Derni\u00e8re valeur\u00a0: ${dernier}, variation\u00a0: ${variation}`,
|
|
18
|
+
colonneEffectif: "Effectif",
|
|
19
|
+
axeEffectif: "Effectif",
|
|
20
|
+
intervalle: (debut, fin) => `${debut} \u00e0 ${fin}`,
|
|
21
|
+
classes: "Classes et effectifs",
|
|
22
|
+
classe: (debut, fin, effectif) => `De ${debut} \u00e0 ${fin}\u00a0: ${effectif}`,
|
|
23
|
+
classesNegatives: "Valeurs négatives",
|
|
24
|
+
classesPositives: "Valeurs positives ou nulles"
|
|
18
25
|
};
|
|
19
26
|
const LIBELLES_GRAPHIQUES_EN = {
|
|
20
27
|
voirLesDonnees: "Show data",
|
|
@@ -26,7 +33,14 @@ const LIBELLES_GRAPHIQUES_EN = {
|
|
|
26
33
|
evenements: "Events",
|
|
27
34
|
separateurDEvenement: ": ",
|
|
28
35
|
aucuneDonnee: "No data to show",
|
|
29
|
-
tendance: (dernier, variation) => variation === null ? `Latest value: ${dernier}` : `Latest value: ${dernier}, change: ${variation}
|
|
36
|
+
tendance: (dernier, variation) => variation === null ? `Latest value: ${dernier}` : `Latest value: ${dernier}, change: ${variation}`,
|
|
37
|
+
colonneEffectif: "Count",
|
|
38
|
+
axeEffectif: "Count",
|
|
39
|
+
intervalle: (debut, fin) => `${debut} to ${fin}`,
|
|
40
|
+
classes: "Classes and counts",
|
|
41
|
+
classe: (debut, fin, effectif) => `From ${debut} to ${fin}: ${effectif}`,
|
|
42
|
+
classesNegatives: "Negative values",
|
|
43
|
+
classesPositives: "Zero or positive values"
|
|
30
44
|
};
|
|
31
45
|
const ST_LIBELLES_GRAPHIQUES = new InjectionToken("ST_LIBELLES_GRAPHIQUES", {
|
|
32
46
|
providedIn: "root",
|
|
@@ -253,6 +267,28 @@ function formateurDeDates(locale, fuseau, avecHeure) {
|
|
|
253
267
|
});
|
|
254
268
|
return (instant) => format.format(new Date(instant));
|
|
255
269
|
}
|
|
270
|
+
const LARGEUR_SUPPOSEE = 640;
|
|
271
|
+
function largeurDeLHote() {
|
|
272
|
+
const largeur = signal(LARGEUR_SUPPOSEE, ...ngDevMode ? [{ debugName: "largeur" }] : /* istanbul ignore next */ []);
|
|
273
|
+
const element = inject(ElementRef).nativeElement;
|
|
274
|
+
const destruction = inject(DestroyRef);
|
|
275
|
+
let observateur = null;
|
|
276
|
+
destruction.onDestroy(() => {
|
|
277
|
+
observateur?.disconnect();
|
|
278
|
+
});
|
|
279
|
+
afterNextRender(() => {
|
|
280
|
+
const Observateur = element.ownerDocument.defaultView?.ResizeObserver;
|
|
281
|
+
if (Observateur === void 0) return;
|
|
282
|
+
const mesurer = () => {
|
|
283
|
+
const mesuree = Math.round(element.clientWidth);
|
|
284
|
+
if (mesuree > 0) largeur.set(mesuree);
|
|
285
|
+
};
|
|
286
|
+
mesurer();
|
|
287
|
+
observateur = new Observateur(mesurer);
|
|
288
|
+
observateur.observe(element);
|
|
289
|
+
});
|
|
290
|
+
return largeur.asReadonly();
|
|
291
|
+
}
|
|
256
292
|
const SERIES_MAX = 4;
|
|
257
293
|
const POINTS_RECOMMANDES = 500;
|
|
258
294
|
const TRAITS_PAR_RANG = [
|
|
@@ -261,16 +297,15 @@ const TRAITS_PAR_RANG = [
|
|
|
261
297
|
"points",
|
|
262
298
|
"mixte"
|
|
263
299
|
];
|
|
264
|
-
const
|
|
265
|
-
const
|
|
266
|
-
const
|
|
267
|
-
const
|
|
268
|
-
const
|
|
269
|
-
const MARGE_HAUT = 12;
|
|
300
|
+
const CHASSE$1 = 7;
|
|
301
|
+
const ECART_DES_REPERES$1 = 96;
|
|
302
|
+
const ECART_DES_GRADUATIONS$1 = 48;
|
|
303
|
+
const MARGE_BAS$1 = 28;
|
|
304
|
+
const MARGE_HAUT$1 = 12;
|
|
270
305
|
const MARGE_HAUT_AVEC_MARQUEURS = 26;
|
|
271
|
-
const MARGE_DROITE = 12;
|
|
306
|
+
const MARGE_DROITE$1 = 12;
|
|
272
307
|
const SANS_VALEUR = "—";
|
|
273
|
-
function arrondir$
|
|
308
|
+
function arrondir$2(valeur) {
|
|
274
309
|
return Math.round(valeur * 10) / 10;
|
|
275
310
|
}
|
|
276
311
|
var StLineChart = class StLineChart {
|
|
@@ -295,7 +330,7 @@ var StLineChart = class StLineChart {
|
|
|
295
330
|
});
|
|
296
331
|
hauteur = input(240, ...ngDevMode ? [{ debugName: "hauteur" }] : /* istanbul ignore next */ []);
|
|
297
332
|
vueDonnees = signal(false, ...ngDevMode ? [{ debugName: "vueDonnees" }] : /* istanbul ignore next */ []);
|
|
298
|
-
largeur =
|
|
333
|
+
largeur = largeurDeLHote();
|
|
299
334
|
identifiants = (() => {
|
|
300
335
|
const base = inject(StIdentifiants).prochain("st-graphique");
|
|
301
336
|
return {
|
|
@@ -360,28 +395,28 @@ var StLineChart = class StLineChart {
|
|
|
360
395
|
debut = Math.min(debut, point.instant);
|
|
361
396
|
fin = Math.max(fin, point.instant);
|
|
362
397
|
}
|
|
363
|
-
const nombreDeGraduations = Math.max(3, Math.floor(hauteur / ECART_DES_GRADUATIONS));
|
|
398
|
+
const nombreDeGraduations = Math.max(3, Math.floor(hauteur / ECART_DES_GRADUATIONS$1));
|
|
364
399
|
const echelle = this.pariteEchelle() ? graduationsSymetriques(minimum, maximum, nombreDeGraduations) : graduationsAgreables(minimum, maximum, nombreDeGraduations);
|
|
365
400
|
const graduer = formateurDeGraduations(this.locale(), this.forme(), echelle.pas, Math.max(Math.abs(echelle.debut), Math.abs(echelle.fin)));
|
|
366
401
|
const textes = echelle.valeurs.map(graduer);
|
|
367
402
|
const plusLongue = textes.reduce((longueur, texte) => Math.max(longueur, texte.length), 0);
|
|
368
|
-
const gauche = Math.min(Math.round(largeur * .4), Math.ceil(plusLongue * CHASSE) + 12);
|
|
369
|
-
const droite = largeur - MARGE_DROITE;
|
|
370
|
-
const haut = this.marqueursLus().length > 0 ? MARGE_HAUT_AVEC_MARQUEURS : MARGE_HAUT;
|
|
371
|
-
const bas = hauteur - MARGE_BAS;
|
|
372
|
-
const y = (valeur) => arrondir$
|
|
403
|
+
const gauche = Math.min(Math.round(largeur * .4), Math.ceil(plusLongue * CHASSE$1) + 12);
|
|
404
|
+
const droite = largeur - MARGE_DROITE$1;
|
|
405
|
+
const haut = this.marqueursLus().length > 0 ? MARGE_HAUT_AVEC_MARQUEURS : MARGE_HAUT$1;
|
|
406
|
+
const bas = hauteur - MARGE_BAS$1;
|
|
407
|
+
const y = (valeur) => arrondir$2(haut + (echelle.fin - valeur) / (echelle.fin - echelle.debut) * (bas - haut));
|
|
373
408
|
const plat = debut === fin;
|
|
374
|
-
const x = (instant) => arrondir$
|
|
409
|
+
const x = (instant) => arrondir$2(plat ? (gauche + droite) / 2 : gauche + (instant - debut) / (fin - debut) * (droite - gauche));
|
|
375
410
|
const fuseau = this.fuseauDeRendu();
|
|
376
411
|
const temps = plat ? {
|
|
377
412
|
unite: "jour",
|
|
378
413
|
valeurs: [debut]
|
|
379
|
-
} : graduationsTemporelles(debut, fin, fuseau, Math.max(2, Math.floor((droite - gauche) / ECART_DES_REPERES)));
|
|
414
|
+
} : graduationsTemporelles(debut, fin, fuseau, Math.max(2, Math.floor((droite - gauche) / ECART_DES_REPERES$1)));
|
|
380
415
|
const reperer = formateurDeReperes(this.locale(), fuseau);
|
|
381
416
|
const reperes = temps.valeurs.map((instant, rang) => {
|
|
382
417
|
const texte = reperer(instant, temps.unite, rang === 0);
|
|
383
418
|
const position = x(instant);
|
|
384
|
-
const demi = texte.length * CHASSE / 2;
|
|
419
|
+
const demi = texte.length * CHASSE$1 / 2;
|
|
385
420
|
return {
|
|
386
421
|
x: position,
|
|
387
422
|
texte,
|
|
@@ -471,24 +506,6 @@ var StLineChart = class StLineChart {
|
|
|
471
506
|
return ligne;
|
|
472
507
|
});
|
|
473
508
|
}, ...ngDevMode ? [{ debugName: "lignes" }] : /* istanbul ignore next */ []);
|
|
474
|
-
constructor() {
|
|
475
|
-
const element = inject(ElementRef).nativeElement;
|
|
476
|
-
const destruction = inject(DestroyRef);
|
|
477
|
-
afterNextRender(() => {
|
|
478
|
-
const Observateur = element.ownerDocument.defaultView?.ResizeObserver;
|
|
479
|
-
if (Observateur === void 0) return;
|
|
480
|
-
const mesurer = () => {
|
|
481
|
-
const largeur = Math.round(element.clientWidth);
|
|
482
|
-
if (largeur > 0) this.largeur.set(largeur);
|
|
483
|
-
};
|
|
484
|
-
mesurer();
|
|
485
|
-
const observateur = new Observateur(mesurer);
|
|
486
|
-
observateur.observe(element);
|
|
487
|
-
destruction.onDestroy(() => {
|
|
488
|
-
observateur.disconnect();
|
|
489
|
-
});
|
|
490
|
-
});
|
|
491
|
-
}
|
|
492
509
|
basculer() {
|
|
493
510
|
const donnees = !this.vueDonnees();
|
|
494
511
|
this.vueDonnees.set(donnees);
|
|
@@ -656,7 +673,6 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
656
673
|
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;min-inline-size:0;max-inline-size:100%}.st-line-chart__barre{display:flex;justify-content:flex-end;margin-block-end:var(--st-espacement-2)}.st-line-chart__svg{display:block;inline-size:100%;block-size:auto;overflow:visible;direction:ltr}.st-line-chart__graduation,.st-line-chart__numero{font-size:var(--st-taille-xs);line-height:var(--st-interligne-xs);font-weight:var(--st-graisse-moyenne);letter-spacing:var(--st-interlettrage-large);fill:var(--st-couleur-texte-discret);font-variant-numeric:var(--st-chiffres-alignes)}.st-line-chart__numero{font-weight:var(--st-graisse-semi);fill:var(--st-couleur-texte)}.st-line-chart__grille{stroke:var(--st-couleur-bordure);stroke-width:1;shape-rendering:crispEdges}.st-line-chart__grille[data-zero]{stroke:var(--st-couleur-bordure-forte)}.st-line-chart__trace{fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}.st-line-chart__trace[data-trait=tirets]{stroke-dasharray:8 5;stroke-linecap:butt}.st-line-chart__trace[data-trait=points]{stroke-width:3;stroke-dasharray:0 6}.st-line-chart__trace[data-trait=mixte]{stroke-dasharray:10 5 0 5}.st-line-chart__trace[data-serie=\"1\"]{stroke:var(--st-couleur-serie1)}.st-line-chart__point[data-serie=\"1\"]{fill:var(--st-couleur-serie1)}.st-line-chart__trace[data-serie=\"2\"]{stroke:var(--st-couleur-serie2)}.st-line-chart__point[data-serie=\"2\"]{fill:var(--st-couleur-serie2)}.st-line-chart__trace[data-serie=\"3\"]{stroke:var(--st-couleur-serie3)}.st-line-chart__point[data-serie=\"3\"]{fill:var(--st-couleur-serie3)}.st-line-chart__trace[data-serie=\"4\"]{stroke:var(--st-couleur-serie4)}.st-line-chart__point[data-serie=\"4\"]{fill:var(--st-couleur-serie4)}.st-line-chart__perte{stroke:none}.st-line-chart__hachure{stroke:var(--st-couleur-texte-discret);stroke-width:1.5}.st-line-chart__marqueur{stroke:var(--st-couleur-texte-discret);stroke-width:1;stroke-dasharray:2 3}.st-line-chart__legende,.st-line-chart__evenements{font-size:var(--st-taille-sm);line-height:var(--st-interligne-sm);font-weight:var(--st-graisse-normale);letter-spacing:var(--st-interlettrage-normal);margin:var(--st-espacement-3) 0 0;color:var(--st-couleur-texte)}.st-line-chart__legende{display:flex;flex-wrap:wrap;gap:var(--st-espacement-2) var(--st-espacement-4);padding:0;list-style:none}.st-line-chart__cle{display:inline-flex;gap:var(--st-espacement-2);align-items:center;min-inline-size:0;overflow-wrap:anywhere}.st-line-chart__echantillon{flex:none;overflow:visible}.st-line-chart__evenements{padding-inline-start:var(--st-espacement-5)}.st-line-chart__resume{font-size:var(--st-taille-sm);line-height:var(--st-interligne-sm);font-weight:var(--st-graisse-normale);letter-spacing:var(--st-interlettrage-normal);margin:var(--st-espacement-2) 0 0;color:var(--st-couleur-texte-discret)}.st-line-chart__vide{font-size:var(--st-taille-md);line-height:var(--st-interligne-md);font-weight:var(--st-graisse-normale);letter-spacing:var(--st-interlettrage-normal);display:grid;place-items:center;min-block-size:8rem;margin:0;padding:var(--st-espacement-4);color:var(--st-couleur-texte-discret);text-align:center;border:var(--st-epaisseur-fine) dashed var(--st-couleur-bordure);border-radius:var(--st-rayon-md)}@media(forced-colors:active){.st-line-chart__trace[data-serie],.st-line-chart__hachure,.st-line-chart__marqueur{stroke:CanvasText}.st-line-chart__point[data-serie]{fill:CanvasText}.st-line-chart__grille,.st-line-chart__grille[data-zero]{stroke:GrayText}.st-line-chart__graduation,.st-line-chart__numero{fill:CanvasText}}\n"]
|
|
657
674
|
}]
|
|
658
675
|
}],
|
|
659
|
-
ctorParameters: () => [],
|
|
660
676
|
propDecorators: {
|
|
661
677
|
series: [{
|
|
662
678
|
type: i0.Input,
|
|
@@ -742,7 +758,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
742
758
|
});
|
|
743
759
|
const LARGEUR = 100;
|
|
744
760
|
const MARGE = 2;
|
|
745
|
-
function arrondir(valeur) {
|
|
761
|
+
function arrondir$1(valeur) {
|
|
746
762
|
return Math.round(valeur * 100) / 100;
|
|
747
763
|
}
|
|
748
764
|
var StSparkline = class StSparkline {
|
|
@@ -773,8 +789,8 @@ var StSparkline = class StSparkline {
|
|
|
773
789
|
}
|
|
774
790
|
const { debut, fin } = graduationsAgreables(minimum, maximum);
|
|
775
791
|
const duree = dernier.instant - premier.instant;
|
|
776
|
-
const x = (instant) => arrondir(duree === 0 ? LARGEUR / 2 : (instant - premier.instant) / duree * LARGEUR);
|
|
777
|
-
const y = (valeur) => arrondir(MARGE + (fin - valeur) / (fin - debut) * 20);
|
|
792
|
+
const x = (instant) => arrondir$1(duree === 0 ? LARGEUR / 2 : (instant - premier.instant) / duree * LARGEUR);
|
|
793
|
+
const y = (valeur) => arrondir$1(MARGE + (fin - valeur) / (fin - debut) * 20);
|
|
778
794
|
const coordonnees = points.map((point) => `${String(x(point.instant))} ${String(y(point.valeur))}`);
|
|
779
795
|
return {
|
|
780
796
|
ligne: points.length > 1 ? `M${coordonnees.join("L")}` : null,
|
|
@@ -929,6 +945,457 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
929
945
|
}]
|
|
930
946
|
}
|
|
931
947
|
});
|
|
932
|
-
|
|
948
|
+
function signaler(message, objet) {
|
|
949
|
+
if (typeof ngDevMode === "undefined" || !!ngDevMode) console.warn(message, objet);
|
|
950
|
+
}
|
|
951
|
+
function enTexte(valeur) {
|
|
952
|
+
const texte = String(Number(valeur.toPrecision(12)));
|
|
953
|
+
if (!/e/i.test(texte)) return texte;
|
|
954
|
+
return valeur.toFixed(20).replace(/\.?0+$/, "");
|
|
955
|
+
}
|
|
956
|
+
function lireClasses(classes, source) {
|
|
957
|
+
const lues = [];
|
|
958
|
+
for (const classe of classes) {
|
|
959
|
+
const debut = classe.debut.trim();
|
|
960
|
+
const fin = classe.fin.trim();
|
|
961
|
+
if (!estDecimale(debut) || !estDecimale(fin) || Number(fin) <= Number(debut) || !Number.isSafeInteger(classe.effectif) || classe.effectif < 0) {
|
|
962
|
+
signaler(`${source} : classe illisible ecartee`, classe);
|
|
963
|
+
continue;
|
|
964
|
+
}
|
|
965
|
+
lues.push({
|
|
966
|
+
debut: Number(debut),
|
|
967
|
+
fin: Number(fin),
|
|
968
|
+
texteDebut: debut,
|
|
969
|
+
texteFin: fin,
|
|
970
|
+
effectif: classe.effectif
|
|
971
|
+
});
|
|
972
|
+
}
|
|
973
|
+
return lues.sort((a, b) => a.debut - b.debut);
|
|
974
|
+
}
|
|
975
|
+
function classesDesValeurs(valeurs, nombre, source) {
|
|
976
|
+
const nombres = [];
|
|
977
|
+
let minimum = Infinity;
|
|
978
|
+
let maximum = -Infinity;
|
|
979
|
+
for (const valeur of valeurs) {
|
|
980
|
+
const texte = valeur.trim();
|
|
981
|
+
if (!estDecimale(texte)) {
|
|
982
|
+
signaler(`${source} : valeur illisible ecartee`, valeur);
|
|
983
|
+
continue;
|
|
984
|
+
}
|
|
985
|
+
const lu = Number(texte);
|
|
986
|
+
nombres.push(lu);
|
|
987
|
+
minimum = Math.min(minimum, lu);
|
|
988
|
+
maximum = Math.max(maximum, lu);
|
|
989
|
+
}
|
|
990
|
+
if (nombres.length === 0) return [];
|
|
991
|
+
const bornes = graduationsAgreables(minimum, maximum, Math.max(1, Math.round(nombre)) + 1).valeurs;
|
|
992
|
+
const classes = bornes.slice(0, -1).map((debut, rang) => ({
|
|
993
|
+
debut,
|
|
994
|
+
fin: bornes[rang + 1] ?? debut
|
|
995
|
+
}));
|
|
996
|
+
const effectifs = classes.map(() => 0);
|
|
997
|
+
const pas = (classes[0]?.fin ?? 1) - (classes[0]?.debut ?? 0);
|
|
998
|
+
for (const valeur of nombres) {
|
|
999
|
+
let rang = Math.min(classes.length - 1, Math.max(0, Math.floor((valeur - (classes[0]?.debut ?? 0)) / pas)));
|
|
1000
|
+
while (rang > 0 && valeur < (classes[rang]?.debut ?? 0)) rang -= 1;
|
|
1001
|
+
while (rang < classes.length - 1 && valeur >= (classes[rang]?.fin ?? 0)) rang += 1;
|
|
1002
|
+
effectifs[rang] = (effectifs[rang] ?? 0) + 1;
|
|
1003
|
+
}
|
|
1004
|
+
return classes.map((classe, rang) => ({
|
|
1005
|
+
...classe,
|
|
1006
|
+
texteDebut: enTexte(classe.debut),
|
|
1007
|
+
texteFin: enTexte(classe.fin),
|
|
1008
|
+
effectif: effectifs[rang] ?? 0
|
|
1009
|
+
}));
|
|
1010
|
+
}
|
|
1011
|
+
function graduationsDEffectif(plusGrand, nombreVise) {
|
|
1012
|
+
const haut = Math.max(1, plusGrand);
|
|
1013
|
+
const echelle = graduationsAgreables(0, haut, nombreVise);
|
|
1014
|
+
if (echelle.pas >= 1) return echelle;
|
|
1015
|
+
const fin = Math.ceil(haut);
|
|
1016
|
+
return {
|
|
1017
|
+
debut: 0,
|
|
1018
|
+
fin,
|
|
1019
|
+
pas: 1,
|
|
1020
|
+
valeurs: Array.from({ length: fin + 1 }, (_, rang) => rang)
|
|
1021
|
+
};
|
|
1022
|
+
}
|
|
1023
|
+
const CLASSES_RECOMMANDEES = 50;
|
|
1024
|
+
const CHASSE = 7;
|
|
1025
|
+
const ECART_DES_REPERES = 96;
|
|
1026
|
+
const ECART_DES_GRADUATIONS = 48;
|
|
1027
|
+
const MARGE_HAUT = 24;
|
|
1028
|
+
const MARGE_BAS = 48;
|
|
1029
|
+
const MARGE_DROITE = 12;
|
|
1030
|
+
function arrondir(valeur) {
|
|
1031
|
+
return Math.round(valeur * 10) / 10;
|
|
1032
|
+
}
|
|
1033
|
+
var StHistogram = class StHistogram {
|
|
1034
|
+
locale = inject(ST_LOCALE);
|
|
1035
|
+
catalogue = catalogueDesGraphiques();
|
|
1036
|
+
annonce = new AnnonceLocale(inject(DestroyRef));
|
|
1037
|
+
classes = input(null, ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
|
|
1038
|
+
valeurs = input(null, ...ngDevMode ? [{ debugName: "valeurs" }] : /* istanbul ignore next */ []);
|
|
1039
|
+
nombreDeClasses = input(10, ...ngDevMode ? [{ debugName: "nombreDeClasses" }] : /* istanbul ignore next */ []);
|
|
1040
|
+
axe = input.required(...ngDevMode ? [{ debugName: "axe" }] : /* istanbul ignore next */ []);
|
|
1041
|
+
devise = input(null, ...ngDevMode ? [{ debugName: "devise" }] : /* istanbul ignore next */ []);
|
|
1042
|
+
pourcentage = input(false, {
|
|
1043
|
+
...ngDevMode ? { debugName: "pourcentage" } : /* istanbul ignore next */ {},
|
|
1044
|
+
transform: booleanAttribute
|
|
1045
|
+
});
|
|
1046
|
+
etiquette = input.required(...ngDevMode ? [{ debugName: "etiquette" }] : /* istanbul ignore next */ []);
|
|
1047
|
+
resume = input.required(...ngDevMode ? [{ debugName: "resume" }] : /* istanbul ignore next */ []);
|
|
1048
|
+
hauteur = input(240, ...ngDevMode ? [{ debugName: "hauteur" }] : /* istanbul ignore next */ []);
|
|
1049
|
+
vueDonnees = signal(false, ...ngDevMode ? [{ debugName: "vueDonnees" }] : /* istanbul ignore next */ []);
|
|
1050
|
+
largeur = largeurDeLHote();
|
|
1051
|
+
identifiants = (() => {
|
|
1052
|
+
const base = inject(StIdentifiants).prochain("st-histogramme");
|
|
1053
|
+
return {
|
|
1054
|
+
motif: `${base}-motif`,
|
|
1055
|
+
resume: `${base}-resume`
|
|
1056
|
+
};
|
|
1057
|
+
})();
|
|
1058
|
+
forme = computed(() => ({
|
|
1059
|
+
devise: this.devise(),
|
|
1060
|
+
pourcentage: this.pourcentage()
|
|
1061
|
+
}), ...ngDevMode ? [{ debugName: "forme" }] : /* istanbul ignore next */ []);
|
|
1062
|
+
classesDites = computed(() => {
|
|
1063
|
+
const fournies = this.classes();
|
|
1064
|
+
const valeurs = this.valeurs();
|
|
1065
|
+
const developpement = typeof ngDevMode === "undefined" || !!ngDevMode;
|
|
1066
|
+
if (fournies !== null && valeurs !== null && developpement) console.warn("st-histogram : classes ET valeurs donnees ; les classes l emportent.");
|
|
1067
|
+
const lues = fournies !== null ? lireClasses(fournies, "st-histogram") : classesDesValeurs(valeurs ?? [], this.nombreDeClasses(), "st-histogram");
|
|
1068
|
+
if (lues.length > CLASSES_RECOMMANDEES && developpement) console.warn(`st-histogram : ${String(lues.length)} classes ; ${String(CLASSES_RECOMMANDEES)} au plus, regroupees cote serveur.`);
|
|
1069
|
+
const borne = formateurDeValeurs(this.locale(), this.forme());
|
|
1070
|
+
const effectif = formateurDeValeurs(this.locale(), {
|
|
1071
|
+
devise: null,
|
|
1072
|
+
pourcentage: false
|
|
1073
|
+
});
|
|
1074
|
+
return lues.map((classe, indice) => ({
|
|
1075
|
+
...classe,
|
|
1076
|
+
rang: indice + 1,
|
|
1077
|
+
negative: classe.fin <= 0,
|
|
1078
|
+
texteDuDebut: borne(classe.texteDebut),
|
|
1079
|
+
texteDeLaFin: borne(classe.texteFin),
|
|
1080
|
+
texteDeLEffectif: effectif(String(classe.effectif))
|
|
1081
|
+
}));
|
|
1082
|
+
}, ...ngDevMode ? [{ debugName: "classesDites" }] : /* istanbul ignore next */ []);
|
|
1083
|
+
deuxSignes = computed(() => {
|
|
1084
|
+
const classes = this.classesDites();
|
|
1085
|
+
return classes.some((classe) => classe.negative) && classes.some((classe) => !classe.negative);
|
|
1086
|
+
}, ...ngDevMode ? [{ debugName: "deuxSignes" }] : /* istanbul ignore next */ []);
|
|
1087
|
+
dessin = computed(() => {
|
|
1088
|
+
const classes = this.classesDites();
|
|
1089
|
+
const premiere = classes[0];
|
|
1090
|
+
const derniere = classes.at(-1);
|
|
1091
|
+
if (premiere === void 0 || derniere === void 0) return null;
|
|
1092
|
+
const largeur = Math.max(160, this.largeur());
|
|
1093
|
+
const hauteur = Math.max(192, Math.round(this.hauteur()));
|
|
1094
|
+
const haut = MARGE_HAUT;
|
|
1095
|
+
const bas = hauteur - MARGE_BAS;
|
|
1096
|
+
const effectifs = graduationsDEffectif(classes.reduce((plus, classe) => Math.max(plus, classe.effectif), 0), Math.max(3, Math.floor((bas - haut) / ECART_DES_GRADUATIONS)));
|
|
1097
|
+
const graduer = formateurDeGraduations(this.locale(), {
|
|
1098
|
+
devise: null,
|
|
1099
|
+
pourcentage: false
|
|
1100
|
+
}, effectifs.pas, effectifs.fin);
|
|
1101
|
+
const textes = effectifs.valeurs.map(graduer);
|
|
1102
|
+
const plusLongue = textes.reduce((longueur, texte) => Math.max(longueur, texte.length), 0);
|
|
1103
|
+
const gauche = Math.min(Math.round(largeur * .4), Math.ceil(plusLongue * CHASSE) + 12);
|
|
1104
|
+
const droite = largeur - MARGE_DROITE;
|
|
1105
|
+
const y = (effectif) => arrondir(bas - effectif / effectifs.fin * (bas - haut));
|
|
1106
|
+
const echelle = graduationsAgreables(premiere.debut, derniere.fin, Math.max(2, Math.floor((droite - gauche) / ECART_DES_REPERES)));
|
|
1107
|
+
const x = (valeur) => arrondir(gauche + (valeur - echelle.debut) / (echelle.fin - echelle.debut) * (droite - gauche));
|
|
1108
|
+
const reperer = formateurDeGraduations(this.locale(), this.forme(), echelle.pas, Math.max(Math.abs(echelle.debut), Math.abs(echelle.fin)));
|
|
1109
|
+
const reperes = echelle.valeurs.map((valeur) => {
|
|
1110
|
+
const texte = reperer(valeur);
|
|
1111
|
+
const position = x(valeur);
|
|
1112
|
+
const demi = texte.length * CHASSE / 2;
|
|
1113
|
+
return {
|
|
1114
|
+
x: position,
|
|
1115
|
+
texte,
|
|
1116
|
+
ancre: position - demi < 0 ? "start" : position + demi > largeur ? "end" : "middle"
|
|
1117
|
+
};
|
|
1118
|
+
});
|
|
1119
|
+
const barres = classes.filter((classe) => classe.effectif > 0).map((classe) => {
|
|
1120
|
+
const debut = x(classe.debut);
|
|
1121
|
+
const etendue = x(classe.fin) - debut;
|
|
1122
|
+
const interstice = etendue > 3 ? .5 : 0;
|
|
1123
|
+
return {
|
|
1124
|
+
rang: classe.rang,
|
|
1125
|
+
negative: classe.negative,
|
|
1126
|
+
x: arrondir(debut + interstice),
|
|
1127
|
+
y: y(classe.effectif),
|
|
1128
|
+
largeur: arrondir(Math.max(1, etendue - 2 * interstice)),
|
|
1129
|
+
hauteur: arrondir(bas - y(classe.effectif))
|
|
1130
|
+
};
|
|
1131
|
+
});
|
|
1132
|
+
return {
|
|
1133
|
+
largeur,
|
|
1134
|
+
hauteur,
|
|
1135
|
+
gauche,
|
|
1136
|
+
droite,
|
|
1137
|
+
haut,
|
|
1138
|
+
bas,
|
|
1139
|
+
graduations: effectifs.valeurs.map((valeur, rang) => ({
|
|
1140
|
+
y: y(valeur),
|
|
1141
|
+
texte: textes[rang] ?? ""
|
|
1142
|
+
})),
|
|
1143
|
+
reperes,
|
|
1144
|
+
zero: echelle.debut < 0 && echelle.fin > 0 ? x(0) : null,
|
|
1145
|
+
barres
|
|
1146
|
+
};
|
|
1147
|
+
}, ...ngDevMode ? [{ debugName: "dessin" }] : /* istanbul ignore next */ []);
|
|
1148
|
+
colonnes = computed(() => [{
|
|
1149
|
+
cle: "classe",
|
|
1150
|
+
libelle: this.axe()
|
|
1151
|
+
}, {
|
|
1152
|
+
cle: "effectif",
|
|
1153
|
+
libelle: this.catalogue().libelles.colonneEffectif,
|
|
1154
|
+
alignement: "fin"
|
|
1155
|
+
}], ...ngDevMode ? [{ debugName: "colonnes" }] : /* istanbul ignore next */ []);
|
|
1156
|
+
lignes = computed(() => {
|
|
1157
|
+
const libelles = this.catalogue().libelles;
|
|
1158
|
+
return this.classesDites().map((classe) => ({
|
|
1159
|
+
cle: String(classe.rang),
|
|
1160
|
+
classe: libelles.intervalle(classe.texteDuDebut, classe.texteDeLaFin),
|
|
1161
|
+
effectif: classe.texteDeLEffectif
|
|
1162
|
+
}));
|
|
1163
|
+
}, ...ngDevMode ? [{ debugName: "lignes" }] : /* istanbul ignore next */ []);
|
|
1164
|
+
basculer() {
|
|
1165
|
+
const donnees = !this.vueDonnees();
|
|
1166
|
+
this.vueDonnees.set(donnees);
|
|
1167
|
+
const libelles = this.catalogue().libelles;
|
|
1168
|
+
this.annonce.annoncer(donnees ? libelles.tableauAffiche : libelles.graphiqueAffiche);
|
|
1169
|
+
}
|
|
1170
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
1171
|
+
minVersion: "12.0.0",
|
|
1172
|
+
version: "22.2.2",
|
|
1173
|
+
ngImport: i0,
|
|
1174
|
+
type: StHistogram,
|
|
1175
|
+
deps: [],
|
|
1176
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
1177
|
+
});
|
|
1178
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
1179
|
+
minVersion: "17.0.0",
|
|
1180
|
+
version: "22.2.2",
|
|
1181
|
+
type: StHistogram,
|
|
1182
|
+
isStandalone: true,
|
|
1183
|
+
selector: "st-histogram",
|
|
1184
|
+
inputs: {
|
|
1185
|
+
classes: {
|
|
1186
|
+
classPropertyName: "classes",
|
|
1187
|
+
publicName: "classes",
|
|
1188
|
+
isSignal: true,
|
|
1189
|
+
isRequired: false,
|
|
1190
|
+
transformFunction: null
|
|
1191
|
+
},
|
|
1192
|
+
valeurs: {
|
|
1193
|
+
classPropertyName: "valeurs",
|
|
1194
|
+
publicName: "valeurs",
|
|
1195
|
+
isSignal: true,
|
|
1196
|
+
isRequired: false,
|
|
1197
|
+
transformFunction: null
|
|
1198
|
+
},
|
|
1199
|
+
nombreDeClasses: {
|
|
1200
|
+
classPropertyName: "nombreDeClasses",
|
|
1201
|
+
publicName: "nombreDeClasses",
|
|
1202
|
+
isSignal: true,
|
|
1203
|
+
isRequired: false,
|
|
1204
|
+
transformFunction: null
|
|
1205
|
+
},
|
|
1206
|
+
axe: {
|
|
1207
|
+
classPropertyName: "axe",
|
|
1208
|
+
publicName: "axe",
|
|
1209
|
+
isSignal: true,
|
|
1210
|
+
isRequired: true,
|
|
1211
|
+
transformFunction: null
|
|
1212
|
+
},
|
|
1213
|
+
devise: {
|
|
1214
|
+
classPropertyName: "devise",
|
|
1215
|
+
publicName: "devise",
|
|
1216
|
+
isSignal: true,
|
|
1217
|
+
isRequired: false,
|
|
1218
|
+
transformFunction: null
|
|
1219
|
+
},
|
|
1220
|
+
pourcentage: {
|
|
1221
|
+
classPropertyName: "pourcentage",
|
|
1222
|
+
publicName: "pourcentage",
|
|
1223
|
+
isSignal: true,
|
|
1224
|
+
isRequired: false,
|
|
1225
|
+
transformFunction: null
|
|
1226
|
+
},
|
|
1227
|
+
etiquette: {
|
|
1228
|
+
classPropertyName: "etiquette",
|
|
1229
|
+
publicName: "etiquette",
|
|
1230
|
+
isSignal: true,
|
|
1231
|
+
isRequired: true,
|
|
1232
|
+
transformFunction: null
|
|
1233
|
+
},
|
|
1234
|
+
resume: {
|
|
1235
|
+
classPropertyName: "resume",
|
|
1236
|
+
publicName: "resume",
|
|
1237
|
+
isSignal: true,
|
|
1238
|
+
isRequired: true,
|
|
1239
|
+
transformFunction: null
|
|
1240
|
+
},
|
|
1241
|
+
hauteur: {
|
|
1242
|
+
classPropertyName: "hauteur",
|
|
1243
|
+
publicName: "hauteur",
|
|
1244
|
+
isSignal: true,
|
|
1245
|
+
isRequired: false,
|
|
1246
|
+
transformFunction: null
|
|
1247
|
+
}
|
|
1248
|
+
},
|
|
1249
|
+
host: {
|
|
1250
|
+
properties: { "attr.data-vue": "vueDonnees() ? \"donnees\" : \"graphique\"" },
|
|
1251
|
+
classAttribute: "st-histogram"
|
|
1252
|
+
},
|
|
1253
|
+
ngImport: i0,
|
|
1254
|
+
template: "<div class=\"st-histogram__barre-d-outils\">\n <button\n stButton\n variante=\"discret\"\n taille=\"sm\"\n type=\"button\"\n [attr.lang]=\"catalogue().langueDeRepli\"\n (click)=\"basculer()\"\n >\n {{ vueDonnees() ? catalogue().libelles.voirLeGraphique : catalogue().libelles.voirLesDonnees }}\n </button>\n</div>\n\n@if (vueDonnees()) {\n <st-data-table\n [legende]=\"etiquette()\"\n [colonnes]=\"colonnes()\"\n [lignes]=\"lignes()\"\n cle=\"cle\"\n hauteurMax=\"24rem\"\n />\n} @else if (dessin(); as dessin) {\n <svg\n class=\"st-histogram__svg\"\n role=\"img\"\n xmlns=\"http://www.w3.org/2000/svg\"\n focusable=\"false\"\n preserveAspectRatio=\"xMinYMin meet\"\n [attr.aria-label]=\"etiquette()\"\n [attr.aria-describedby]=\"identifiants.resume\"\n [attr.viewBox]=\"'0 0 ' + dessin.largeur + ' ' + dessin.hauteur\"\n [attr.height]=\"dessin.hauteur\"\n >\n <defs>\n <pattern\n patternUnits=\"userSpaceOnUse\"\n width=\"6\"\n height=\"6\"\n patternTransform=\"rotate(45)\"\n [attr.id]=\"identifiants.motif\"\n >\n <line class=\"st-histogram__hachure\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"6\" />\n </pattern>\n </defs>\n <text class=\"st-histogram__nom-d-axe\" text-anchor=\"start\" [attr.x]=\"0\" y=\"12\">\n {{ catalogue().libelles.axeEffectif }}\n </text>\n @for (graduation of dessin.graduations; track $index) {\n <line\n class=\"st-histogram__grille\"\n [attr.data-base]=\"$first ? '' : null\"\n [attr.x1]=\"dessin.gauche\"\n [attr.x2]=\"dessin.droite\"\n [attr.y1]=\"graduation.y\"\n [attr.y2]=\"graduation.y\"\n />\n <text\n class=\"st-histogram__graduation\"\n data-axe=\"effectifs\"\n text-anchor=\"end\"\n dominant-baseline=\"middle\"\n [attr.x]=\"dessin.gauche - 8\"\n [attr.y]=\"graduation.y\"\n >\n {{ graduation.texte }}\n </text>\n }\n @for (barre of dessin.barres; track barre.rang) {\n <rect\n class=\"st-histogram__classe\"\n [attr.data-signe]=\"barre.negative ? 'negatif' : 'positif'\"\n [attr.fill]=\"barre.negative ? 'url(#' + identifiants.motif + ')' : null\"\n [attr.x]=\"barre.x\"\n [attr.y]=\"barre.y\"\n [attr.width]=\"barre.largeur\"\n [attr.height]=\"barre.hauteur\"\n />\n }\n @if (dessin.zero !== null) {\n <line\n class=\"st-histogram__zero\"\n [attr.x1]=\"dessin.zero\"\n [attr.x2]=\"dessin.zero\"\n [attr.y1]=\"dessin.haut\"\n [attr.y2]=\"dessin.bas\"\n />\n }\n @for (repere of dessin.reperes; track $index) {\n <text\n class=\"st-histogram__graduation\"\n data-axe=\"valeurs\"\n [attr.text-anchor]=\"repere.ancre\"\n [attr.x]=\"repere.x\"\n [attr.y]=\"dessin.bas + 18\"\n >\n {{ repere.texte }}\n </text>\n }\n <text\n class=\"st-histogram__nom-d-axe\"\n text-anchor=\"middle\"\n [attr.x]=\"(dessin.gauche + dessin.droite) / 2\"\n [attr.y]=\"dessin.hauteur - 6\"\n >\n {{ axe() }}\n </text>\n </svg>\n\n <ul class=\"st-histogram__classes st-vh\" [attr.aria-label]=\"catalogue().libelles.classes\">\n @for (classe of classesDites(); track classe.rang) {\n <li [attr.lang]=\"catalogue().langueDeRepli\">\n {{\n catalogue().libelles.classe(\n classe.texteDuDebut,\n classe.texteDeLaFin,\n classe.texteDeLEffectif\n )\n }}\n </li>\n }\n </ul>\n\n @if (deuxSignes()) {\n <ul\n class=\"st-histogram__legende\"\n [attr.aria-label]=\"catalogue().libelles.legende\"\n [attr.lang]=\"catalogue().langueDeRepli\"\n >\n <li class=\"st-histogram__cle\">\n <svg\n class=\"st-histogram__echantillon\"\n aria-hidden=\"true\"\n focusable=\"false\"\n viewBox=\"0 0 16 12\"\n width=\"16\"\n height=\"12\"\n >\n <rect\n class=\"st-histogram__classe\"\n data-signe=\"negatif\"\n x=\"1\"\n y=\"1\"\n width=\"14\"\n height=\"10\"\n [attr.fill]=\"'url(#' + identifiants.motif + ')'\"\n />\n </svg>\n {{ catalogue().libelles.classesNegatives }}\n </li>\n <li class=\"st-histogram__cle\">\n <svg\n class=\"st-histogram__echantillon\"\n aria-hidden=\"true\"\n focusable=\"false\"\n viewBox=\"0 0 16 12\"\n width=\"16\"\n height=\"12\"\n >\n <rect\n class=\"st-histogram__classe\"\n data-signe=\"positif\"\n x=\"1\"\n y=\"1\"\n width=\"14\"\n height=\"10\"\n />\n </svg>\n {{ catalogue().libelles.classesPositives }}\n </li>\n </ul>\n }\n} @else {\n <p class=\"st-histogram__vide\" [attr.lang]=\"catalogue().langueDeRepli\">\n {{ catalogue().libelles.aucuneDonnee }}\n </p>\n}\n\n<p class=\"st-histogram__resume\" [id]=\"identifiants.resume\">{{ resume() }}</p>\n<span\n class=\"st-histogram__annonce st-vh\"\n aria-live=\"polite\"\n [attr.lang]=\"catalogue().langueDeRepli\"\n >{{ annonce.texte() }}</span\n>\n",
|
|
1255
|
+
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;min-inline-size:0;max-inline-size:100%}.st-histogram__barre-d-outils{display:flex;justify-content:flex-end;margin-block-end:var(--st-espacement-2)}.st-histogram__svg{display:block;inline-size:100%;block-size:auto;overflow:visible;direction:ltr}.st-histogram__graduation,.st-histogram__nom-d-axe{font-size:var(--st-taille-xs);line-height:var(--st-interligne-xs);font-weight:var(--st-graisse-moyenne);letter-spacing:var(--st-interlettrage-large);fill:var(--st-couleur-texte-discret);font-variant-numeric:var(--st-chiffres-alignes)}.st-histogram__nom-d-axe{font-weight:var(--st-graisse-semi);fill:var(--st-couleur-texte)}.st-histogram__grille{stroke:var(--st-couleur-bordure);stroke-width:1;shape-rendering:crispEdges}.st-histogram__grille[data-base]{stroke:var(--st-couleur-bordure-forte)}.st-histogram__zero{stroke:var(--st-couleur-bordure-forte);stroke-width:1.5;shape-rendering:crispEdges}.st-histogram__classe[data-signe=positif]{fill:var(--st-couleur-serie1)}.st-histogram__classe[data-signe=negatif]{stroke:var(--st-couleur-serie2);stroke-width:1.5}.st-histogram__hachure{stroke:var(--st-couleur-serie2);stroke-width:2}.st-histogram__legende{font-size:var(--st-taille-sm);line-height:var(--st-interligne-sm);font-weight:var(--st-graisse-normale);letter-spacing:var(--st-interlettrage-normal);display:flex;flex-wrap:wrap;gap:var(--st-espacement-2) var(--st-espacement-4);margin:var(--st-espacement-3) 0 0;padding:0;color:var(--st-couleur-texte);list-style:none}.st-histogram__cle{display:inline-flex;gap:var(--st-espacement-2);align-items:center;min-inline-size:0;overflow-wrap:anywhere}.st-histogram__echantillon{flex:none;overflow:visible}.st-histogram__resume{font-size:var(--st-taille-sm);line-height:var(--st-interligne-sm);font-weight:var(--st-graisse-normale);letter-spacing:var(--st-interlettrage-normal);margin:var(--st-espacement-2) 0 0;color:var(--st-couleur-texte-discret)}.st-histogram__vide{font-size:var(--st-taille-md);line-height:var(--st-interligne-md);font-weight:var(--st-graisse-normale);letter-spacing:var(--st-interlettrage-normal);display:grid;place-items:center;min-block-size:8rem;margin:0;padding:var(--st-espacement-4);color:var(--st-couleur-texte-discret);text-align:center;border:var(--st-epaisseur-fine) dashed var(--st-couleur-bordure);border-radius:var(--st-rayon-md)}@media(forced-colors:active){.st-histogram__classe[data-signe=positif]{fill:CanvasText}.st-histogram__classe[data-signe=negatif],.st-histogram__hachure,.st-histogram__zero{stroke:CanvasText}.st-histogram__grille,.st-histogram__grille[data-base]{stroke:GrayText}.st-histogram__graduation,.st-histogram__nom-d-axe{fill:CanvasText}}\n"],
|
|
1256
|
+
dependencies: [{
|
|
1257
|
+
kind: "component",
|
|
1258
|
+
type: StButton,
|
|
1259
|
+
selector: "button[stButton]",
|
|
1260
|
+
inputs: [
|
|
1261
|
+
"variante",
|
|
1262
|
+
"taille",
|
|
1263
|
+
"pleineLargeur",
|
|
1264
|
+
"iconeAvant",
|
|
1265
|
+
"iconeApres",
|
|
1266
|
+
"chargement",
|
|
1267
|
+
"indisponible",
|
|
1268
|
+
"raisonIndisponible"
|
|
1269
|
+
]
|
|
1270
|
+
}, {
|
|
1271
|
+
kind: "component",
|
|
1272
|
+
type: StDataTable,
|
|
1273
|
+
selector: "st-data-table",
|
|
1274
|
+
inputs: [
|
|
1275
|
+
"legende",
|
|
1276
|
+
"legendeMasquee",
|
|
1277
|
+
"colonnes",
|
|
1278
|
+
"lignes",
|
|
1279
|
+
"cle",
|
|
1280
|
+
"enTeteDeLigne",
|
|
1281
|
+
"premiereColonneFigee",
|
|
1282
|
+
"hauteurMax",
|
|
1283
|
+
"tonDeLigne",
|
|
1284
|
+
"ligneChoisissable",
|
|
1285
|
+
"densite",
|
|
1286
|
+
"chargement",
|
|
1287
|
+
"annonceDeRechargement",
|
|
1288
|
+
"selectionnable",
|
|
1289
|
+
"selection",
|
|
1290
|
+
"tri",
|
|
1291
|
+
"triTernaire",
|
|
1292
|
+
"texteVide",
|
|
1293
|
+
"raisonDuVide",
|
|
1294
|
+
"lignesAttendues"
|
|
1295
|
+
],
|
|
1296
|
+
outputs: [
|
|
1297
|
+
"selectionChange",
|
|
1298
|
+
"triChange",
|
|
1299
|
+
"effacement"
|
|
1300
|
+
]
|
|
1301
|
+
}],
|
|
1302
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
1303
|
+
});
|
|
1304
|
+
};
|
|
1305
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1306
|
+
minVersion: "12.0.0",
|
|
1307
|
+
version: "22.2.2",
|
|
1308
|
+
ngImport: i0,
|
|
1309
|
+
type: StHistogram,
|
|
1310
|
+
decorators: [{
|
|
1311
|
+
type: Component,
|
|
1312
|
+
args: [{
|
|
1313
|
+
selector: "st-histogram",
|
|
1314
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1315
|
+
imports: [StButton, StDataTable],
|
|
1316
|
+
host: {
|
|
1317
|
+
class: "st-histogram",
|
|
1318
|
+
"[attr.data-vue]": "vueDonnees() ? \"donnees\" : \"graphique\""
|
|
1319
|
+
},
|
|
1320
|
+
template: "<div class=\"st-histogram__barre-d-outils\">\n <button\n stButton\n variante=\"discret\"\n taille=\"sm\"\n type=\"button\"\n [attr.lang]=\"catalogue().langueDeRepli\"\n (click)=\"basculer()\"\n >\n {{ vueDonnees() ? catalogue().libelles.voirLeGraphique : catalogue().libelles.voirLesDonnees }}\n </button>\n</div>\n\n@if (vueDonnees()) {\n <st-data-table\n [legende]=\"etiquette()\"\n [colonnes]=\"colonnes()\"\n [lignes]=\"lignes()\"\n cle=\"cle\"\n hauteurMax=\"24rem\"\n />\n} @else if (dessin(); as dessin) {\n <svg\n class=\"st-histogram__svg\"\n role=\"img\"\n xmlns=\"http://www.w3.org/2000/svg\"\n focusable=\"false\"\n preserveAspectRatio=\"xMinYMin meet\"\n [attr.aria-label]=\"etiquette()\"\n [attr.aria-describedby]=\"identifiants.resume\"\n [attr.viewBox]=\"'0 0 ' + dessin.largeur + ' ' + dessin.hauteur\"\n [attr.height]=\"dessin.hauteur\"\n >\n <defs>\n <pattern\n patternUnits=\"userSpaceOnUse\"\n width=\"6\"\n height=\"6\"\n patternTransform=\"rotate(45)\"\n [attr.id]=\"identifiants.motif\"\n >\n <line class=\"st-histogram__hachure\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"6\" />\n </pattern>\n </defs>\n <text class=\"st-histogram__nom-d-axe\" text-anchor=\"start\" [attr.x]=\"0\" y=\"12\">\n {{ catalogue().libelles.axeEffectif }}\n </text>\n @for (graduation of dessin.graduations; track $index) {\n <line\n class=\"st-histogram__grille\"\n [attr.data-base]=\"$first ? '' : null\"\n [attr.x1]=\"dessin.gauche\"\n [attr.x2]=\"dessin.droite\"\n [attr.y1]=\"graduation.y\"\n [attr.y2]=\"graduation.y\"\n />\n <text\n class=\"st-histogram__graduation\"\n data-axe=\"effectifs\"\n text-anchor=\"end\"\n dominant-baseline=\"middle\"\n [attr.x]=\"dessin.gauche - 8\"\n [attr.y]=\"graduation.y\"\n >\n {{ graduation.texte }}\n </text>\n }\n @for (barre of dessin.barres; track barre.rang) {\n <rect\n class=\"st-histogram__classe\"\n [attr.data-signe]=\"barre.negative ? 'negatif' : 'positif'\"\n [attr.fill]=\"barre.negative ? 'url(#' + identifiants.motif + ')' : null\"\n [attr.x]=\"barre.x\"\n [attr.y]=\"barre.y\"\n [attr.width]=\"barre.largeur\"\n [attr.height]=\"barre.hauteur\"\n />\n }\n @if (dessin.zero !== null) {\n <line\n class=\"st-histogram__zero\"\n [attr.x1]=\"dessin.zero\"\n [attr.x2]=\"dessin.zero\"\n [attr.y1]=\"dessin.haut\"\n [attr.y2]=\"dessin.bas\"\n />\n }\n @for (repere of dessin.reperes; track $index) {\n <text\n class=\"st-histogram__graduation\"\n data-axe=\"valeurs\"\n [attr.text-anchor]=\"repere.ancre\"\n [attr.x]=\"repere.x\"\n [attr.y]=\"dessin.bas + 18\"\n >\n {{ repere.texte }}\n </text>\n }\n <text\n class=\"st-histogram__nom-d-axe\"\n text-anchor=\"middle\"\n [attr.x]=\"(dessin.gauche + dessin.droite) / 2\"\n [attr.y]=\"dessin.hauteur - 6\"\n >\n {{ axe() }}\n </text>\n </svg>\n\n <ul class=\"st-histogram__classes st-vh\" [attr.aria-label]=\"catalogue().libelles.classes\">\n @for (classe of classesDites(); track classe.rang) {\n <li [attr.lang]=\"catalogue().langueDeRepli\">\n {{\n catalogue().libelles.classe(\n classe.texteDuDebut,\n classe.texteDeLaFin,\n classe.texteDeLEffectif\n )\n }}\n </li>\n }\n </ul>\n\n @if (deuxSignes()) {\n <ul\n class=\"st-histogram__legende\"\n [attr.aria-label]=\"catalogue().libelles.legende\"\n [attr.lang]=\"catalogue().langueDeRepli\"\n >\n <li class=\"st-histogram__cle\">\n <svg\n class=\"st-histogram__echantillon\"\n aria-hidden=\"true\"\n focusable=\"false\"\n viewBox=\"0 0 16 12\"\n width=\"16\"\n height=\"12\"\n >\n <rect\n class=\"st-histogram__classe\"\n data-signe=\"negatif\"\n x=\"1\"\n y=\"1\"\n width=\"14\"\n height=\"10\"\n [attr.fill]=\"'url(#' + identifiants.motif + ')'\"\n />\n </svg>\n {{ catalogue().libelles.classesNegatives }}\n </li>\n <li class=\"st-histogram__cle\">\n <svg\n class=\"st-histogram__echantillon\"\n aria-hidden=\"true\"\n focusable=\"false\"\n viewBox=\"0 0 16 12\"\n width=\"16\"\n height=\"12\"\n >\n <rect\n class=\"st-histogram__classe\"\n data-signe=\"positif\"\n x=\"1\"\n y=\"1\"\n width=\"14\"\n height=\"10\"\n />\n </svg>\n {{ catalogue().libelles.classesPositives }}\n </li>\n </ul>\n }\n} @else {\n <p class=\"st-histogram__vide\" [attr.lang]=\"catalogue().langueDeRepli\">\n {{ catalogue().libelles.aucuneDonnee }}\n </p>\n}\n\n<p class=\"st-histogram__resume\" [id]=\"identifiants.resume\">{{ resume() }}</p>\n<span\n class=\"st-histogram__annonce st-vh\"\n aria-live=\"polite\"\n [attr.lang]=\"catalogue().langueDeRepli\"\n >{{ annonce.texte() }}</span\n>\n",
|
|
1321
|
+
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;min-inline-size:0;max-inline-size:100%}.st-histogram__barre-d-outils{display:flex;justify-content:flex-end;margin-block-end:var(--st-espacement-2)}.st-histogram__svg{display:block;inline-size:100%;block-size:auto;overflow:visible;direction:ltr}.st-histogram__graduation,.st-histogram__nom-d-axe{font-size:var(--st-taille-xs);line-height:var(--st-interligne-xs);font-weight:var(--st-graisse-moyenne);letter-spacing:var(--st-interlettrage-large);fill:var(--st-couleur-texte-discret);font-variant-numeric:var(--st-chiffres-alignes)}.st-histogram__nom-d-axe{font-weight:var(--st-graisse-semi);fill:var(--st-couleur-texte)}.st-histogram__grille{stroke:var(--st-couleur-bordure);stroke-width:1;shape-rendering:crispEdges}.st-histogram__grille[data-base]{stroke:var(--st-couleur-bordure-forte)}.st-histogram__zero{stroke:var(--st-couleur-bordure-forte);stroke-width:1.5;shape-rendering:crispEdges}.st-histogram__classe[data-signe=positif]{fill:var(--st-couleur-serie1)}.st-histogram__classe[data-signe=negatif]{stroke:var(--st-couleur-serie2);stroke-width:1.5}.st-histogram__hachure{stroke:var(--st-couleur-serie2);stroke-width:2}.st-histogram__legende{font-size:var(--st-taille-sm);line-height:var(--st-interligne-sm);font-weight:var(--st-graisse-normale);letter-spacing:var(--st-interlettrage-normal);display:flex;flex-wrap:wrap;gap:var(--st-espacement-2) var(--st-espacement-4);margin:var(--st-espacement-3) 0 0;padding:0;color:var(--st-couleur-texte);list-style:none}.st-histogram__cle{display:inline-flex;gap:var(--st-espacement-2);align-items:center;min-inline-size:0;overflow-wrap:anywhere}.st-histogram__echantillon{flex:none;overflow:visible}.st-histogram__resume{font-size:var(--st-taille-sm);line-height:var(--st-interligne-sm);font-weight:var(--st-graisse-normale);letter-spacing:var(--st-interlettrage-normal);margin:var(--st-espacement-2) 0 0;color:var(--st-couleur-texte-discret)}.st-histogram__vide{font-size:var(--st-taille-md);line-height:var(--st-interligne-md);font-weight:var(--st-graisse-normale);letter-spacing:var(--st-interlettrage-normal);display:grid;place-items:center;min-block-size:8rem;margin:0;padding:var(--st-espacement-4);color:var(--st-couleur-texte-discret);text-align:center;border:var(--st-epaisseur-fine) dashed var(--st-couleur-bordure);border-radius:var(--st-rayon-md)}@media(forced-colors:active){.st-histogram__classe[data-signe=positif]{fill:CanvasText}.st-histogram__classe[data-signe=negatif],.st-histogram__hachure,.st-histogram__zero{stroke:CanvasText}.st-histogram__grille,.st-histogram__grille[data-base]{stroke:GrayText}.st-histogram__graduation,.st-histogram__nom-d-axe{fill:CanvasText}}\n"]
|
|
1322
|
+
}]
|
|
1323
|
+
}],
|
|
1324
|
+
propDecorators: {
|
|
1325
|
+
classes: [{
|
|
1326
|
+
type: i0.Input,
|
|
1327
|
+
args: [{
|
|
1328
|
+
isSignal: true,
|
|
1329
|
+
alias: "classes",
|
|
1330
|
+
required: false
|
|
1331
|
+
}]
|
|
1332
|
+
}],
|
|
1333
|
+
valeurs: [{
|
|
1334
|
+
type: i0.Input,
|
|
1335
|
+
args: [{
|
|
1336
|
+
isSignal: true,
|
|
1337
|
+
alias: "valeurs",
|
|
1338
|
+
required: false
|
|
1339
|
+
}]
|
|
1340
|
+
}],
|
|
1341
|
+
nombreDeClasses: [{
|
|
1342
|
+
type: i0.Input,
|
|
1343
|
+
args: [{
|
|
1344
|
+
isSignal: true,
|
|
1345
|
+
alias: "nombreDeClasses",
|
|
1346
|
+
required: false
|
|
1347
|
+
}]
|
|
1348
|
+
}],
|
|
1349
|
+
axe: [{
|
|
1350
|
+
type: i0.Input,
|
|
1351
|
+
args: [{
|
|
1352
|
+
isSignal: true,
|
|
1353
|
+
alias: "axe",
|
|
1354
|
+
required: true
|
|
1355
|
+
}]
|
|
1356
|
+
}],
|
|
1357
|
+
devise: [{
|
|
1358
|
+
type: i0.Input,
|
|
1359
|
+
args: [{
|
|
1360
|
+
isSignal: true,
|
|
1361
|
+
alias: "devise",
|
|
1362
|
+
required: false
|
|
1363
|
+
}]
|
|
1364
|
+
}],
|
|
1365
|
+
pourcentage: [{
|
|
1366
|
+
type: i0.Input,
|
|
1367
|
+
args: [{
|
|
1368
|
+
isSignal: true,
|
|
1369
|
+
alias: "pourcentage",
|
|
1370
|
+
required: false
|
|
1371
|
+
}]
|
|
1372
|
+
}],
|
|
1373
|
+
etiquette: [{
|
|
1374
|
+
type: i0.Input,
|
|
1375
|
+
args: [{
|
|
1376
|
+
isSignal: true,
|
|
1377
|
+
alias: "etiquette",
|
|
1378
|
+
required: true
|
|
1379
|
+
}]
|
|
1380
|
+
}],
|
|
1381
|
+
resume: [{
|
|
1382
|
+
type: i0.Input,
|
|
1383
|
+
args: [{
|
|
1384
|
+
isSignal: true,
|
|
1385
|
+
alias: "resume",
|
|
1386
|
+
required: true
|
|
1387
|
+
}]
|
|
1388
|
+
}],
|
|
1389
|
+
hauteur: [{
|
|
1390
|
+
type: i0.Input,
|
|
1391
|
+
args: [{
|
|
1392
|
+
isSignal: true,
|
|
1393
|
+
alias: "hauteur",
|
|
1394
|
+
required: false
|
|
1395
|
+
}]
|
|
1396
|
+
}]
|
|
1397
|
+
}
|
|
1398
|
+
});
|
|
1399
|
+
export { LIBELLES_GRAPHIQUES_EN, LIBELLES_GRAPHIQUES_FR, ST_LIBELLES_GRAPHIQUES, StHistogram, StLineChart, StSparkline, catalogueDesGraphiques, fournirLibellesGraphiques, libellesDesGraphiques };
|
|
933
1400
|
|
|
934
1401
|
//# sourceMappingURL=starterlib-ui-graphiques.mjs.map
|