@starterlib/ui 0.10.14 → 0.11.1

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.
Files changed (57) hide show
  1. package/README.md +140 -33
  2. package/assets/icones/catalogue.json +199 -4
  3. package/assets/icones/sprite.svg +14 -0
  4. package/fesm2022/starterlib-ui-arbre.mjs +25 -25
  5. package/fesm2022/starterlib-ui-arbre.mjs.map +1 -1
  6. package/fesm2022/starterlib-ui-donnees.mjs +760 -274
  7. package/fesm2022/starterlib-ui-donnees.mjs.map +1 -1
  8. package/fesm2022/starterlib-ui-etats.mjs +82 -82
  9. package/fesm2022/starterlib-ui-etats.mjs.map +1 -1
  10. package/fesm2022/starterlib-ui-force.mjs +18 -0
  11. package/fesm2022/starterlib-ui-force.mjs.map +1 -0
  12. package/fesm2022/starterlib-ui-formulaires.mjs +218 -218
  13. package/fesm2022/starterlib-ui-formulaires.mjs.map +1 -1
  14. package/fesm2022/starterlib-ui-graphiques.mjs +934 -0
  15. package/fesm2022/starterlib-ui-graphiques.mjs.map +1 -0
  16. package/fesm2022/starterlib-ui-indicateurs.mjs +59 -59
  17. package/fesm2022/starterlib-ui-indicateurs.mjs.map +1 -1
  18. package/fesm2022/starterlib-ui-libelles-en.mjs +12 -0
  19. package/fesm2022/starterlib-ui-libelles-en.mjs.map +1 -1
  20. package/fesm2022/starterlib-ui-listes.mjs +727 -315
  21. package/fesm2022/starterlib-ui-listes.mjs.map +1 -1
  22. package/fesm2022/starterlib-ui-messagerie.mjs +45 -45
  23. package/fesm2022/starterlib-ui-messagerie.mjs.map +1 -1
  24. package/fesm2022/starterlib-ui-mise-en-page.mjs +46 -46
  25. package/fesm2022/starterlib-ui-mise-en-page.mjs.map +1 -1
  26. package/fesm2022/starterlib-ui-navigation.mjs +201 -42
  27. package/fesm2022/starterlib-ui-navigation.mjs.map +1 -1
  28. package/fesm2022/starterlib-ui-onglets.mjs +20 -20
  29. package/fesm2022/starterlib-ui-onglets.mjs.map +1 -1
  30. package/fesm2022/starterlib-ui-parcours.mjs +632 -168
  31. package/fesm2022/starterlib-ui-parcours.mjs.map +1 -1
  32. package/fesm2022/starterlib-ui-qr.mjs +11 -11
  33. package/fesm2022/starterlib-ui-qr.mjs.map +1 -1
  34. package/fesm2022/starterlib-ui-saisie.mjs +693 -515
  35. package/fesm2022/starterlib-ui-saisie.mjs.map +1 -1
  36. package/fesm2022/starterlib-ui-selection.mjs +64 -64
  37. package/fesm2022/starterlib-ui-selection.mjs.map +1 -1
  38. package/fesm2022/starterlib-ui-sens.mjs +3 -3
  39. package/fesm2022/starterlib-ui-surfaces.mjs +246 -242
  40. package/fesm2022/starterlib-ui-surfaces.mjs.map +1 -1
  41. package/fesm2022/starterlib-ui-virtuel.mjs +17 -17
  42. package/fesm2022/starterlib-ui-virtuel.mjs.map +1 -1
  43. package/fesm2022/starterlib-ui.mjs +1290 -938
  44. package/fesm2022/starterlib-ui.mjs.map +1 -1
  45. package/package.json +27 -3
  46. package/styles/amorce.css +304 -2
  47. package/types/starterlib-ui-donnees.d.ts +231 -5
  48. package/types/starterlib-ui-force.d.ts +19 -0
  49. package/types/starterlib-ui-graphiques.d.ts +421 -0
  50. package/types/starterlib-ui-indicateurs.d.ts +11 -4
  51. package/types/starterlib-ui-listes.d.ts +230 -13
  52. package/types/starterlib-ui-navigation.d.ts +82 -1
  53. package/types/starterlib-ui-parcours.d.ts +265 -5
  54. package/types/starterlib-ui-saisie.d.ts +142 -11
  55. package/types/starterlib-ui-selection.d.ts +1 -1
  56. package/types/starterlib-ui-surfaces.d.ts +10 -9
  57. package/types/starterlib-ui.d.ts +294 -32
@@ -0,0 +1,934 @@
1
+ import * as i0 from "@angular/core";
2
+ import { ChangeDetectionStrategy, Component, DestroyRef, ElementRef, InjectionToken, afterNextRender, booleanAttribute, computed, inject, input, isDevMode, signal } from "@angular/core";
3
+ import { AnnonceLocale, FUSEAU_PAR_DEFAUT, ST_LIBELLES, ST_LOCALE, StButton, StIdentifiants, catalogueDuPointDEntree } from "@starterlib/ui";
4
+ import { StDataTable } from "@starterlib/ui/listes";
5
+ import { graduationsAgreables, graduationsSymetriques, graduationsTemporelles } from "@starterlib/util/graduations";
6
+ import { lireInstant } from "@starterlib/util";
7
+ const LIBELLES_GRAPHIQUES_FR = {
8
+ voirLesDonnees: "Voir les données",
9
+ voirLeGraphique: "Voir le graphique",
10
+ tableauAffiche: "Tableau des données affiché",
11
+ graphiqueAffiche: "Graphique affiché",
12
+ colonneDate: "Date",
13
+ legende: "Légende",
14
+ evenements: "Événements",
15
+ separateurDEvenement: "\xA0: ",
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}`
18
+ };
19
+ const LIBELLES_GRAPHIQUES_EN = {
20
+ voirLesDonnees: "Show data",
21
+ voirLeGraphique: "Show chart",
22
+ tableauAffiche: "Data table shown",
23
+ graphiqueAffiche: "Chart shown",
24
+ colonneDate: "Date",
25
+ legende: "Legend",
26
+ evenements: "Events",
27
+ separateurDEvenement: ": ",
28
+ aucuneDonnee: "No data to show",
29
+ tendance: (dernier, variation) => variation === null ? `Latest value: ${dernier}` : `Latest value: ${dernier}, change: ${variation}`
30
+ };
31
+ const ST_LIBELLES_GRAPHIQUES = new InjectionToken("ST_LIBELLES_GRAPHIQUES", {
32
+ providedIn: "root",
33
+ factory: () => ({
34
+ fr: LIBELLES_GRAPHIQUES_FR,
35
+ en: LIBELLES_GRAPHIQUES_EN
36
+ })
37
+ });
38
+ function fournirLibellesGraphiques(catalogues) {
39
+ return {
40
+ provide: ST_LIBELLES_GRAPHIQUES,
41
+ useValue: {
42
+ fr: LIBELLES_GRAPHIQUES_FR,
43
+ en: LIBELLES_GRAPHIQUES_EN,
44
+ ...catalogues
45
+ }
46
+ };
47
+ }
48
+ function libellesDesGraphiques() {
49
+ const catalogue = catalogueDesGraphiques();
50
+ return computed(() => catalogue().libelles);
51
+ }
52
+ function catalogueDesGraphiques() {
53
+ return catalogueDuPointDEntree("@starterlib/ui/graphiques", inject(ST_LIBELLES_GRAPHIQUES), LIBELLES_GRAPHIQUES_FR, "fournirLibellesGraphiques");
54
+ }
55
+ const DECIMALE = /^([+-])?(\d+)(?:\.(\d+))?$/;
56
+ const JOUR_SEUL = /^\d{4}-\d{2}-\d{2}$/;
57
+ function estDecimale(texte) {
58
+ return DECIMALE.test(texte);
59
+ }
60
+ function fuseauLisible(fuseau) {
61
+ try {
62
+ return new Intl.DateTimeFormat("en-US", { timeZone: fuseau }).resolvedOptions().timeZone;
63
+ } catch {
64
+ if (isDevMode()) console.warn(`@starterlib/ui/graphiques : fuseau inconnu "${fuseau}", UTC a sa place.`);
65
+ return "UTC";
66
+ }
67
+ }
68
+ function instantDuPoint(texte, fuseau) {
69
+ return lireInstant(JOUR_SEUL.test(texte) ? `${texte}T00:00` : texte, fuseau);
70
+ }
71
+ function lirePoints(points, fuseau, nom) {
72
+ const lus = [];
73
+ let ecartes = 0;
74
+ for (const point of points) {
75
+ const instant = instantDuPoint(point.instant, fuseau);
76
+ const texte = point.valeur.trim();
77
+ if (instant === null || !estDecimale(texte)) {
78
+ ecartes += 1;
79
+ continue;
80
+ }
81
+ lus.push({
82
+ instant,
83
+ valeur: Number(texte),
84
+ texte
85
+ });
86
+ }
87
+ if (ecartes > 0 && isDevMode()) console.warn(`${nom} : ${String(ecartes)} point(s) illisible(s), ecarte(s) du dessin.`);
88
+ return lus.sort((a, b) => a.instant - b.instant);
89
+ }
90
+ function lireMarqueurs(marqueurs, fuseau) {
91
+ const lus = [];
92
+ for (const marqueur of marqueurs) {
93
+ const instant = instantDuPoint(marqueur.instant, fuseau);
94
+ if (instant !== null) lus.push({
95
+ instant,
96
+ libelle: marqueur.libelle
97
+ });
98
+ }
99
+ return lus.sort((a, b) => a.instant - b.instant);
100
+ }
101
+ function dansLOrdreDuTemps(instants) {
102
+ return [...instants].sort((a, b) => a - b);
103
+ }
104
+ function differenceDecimale(a, b) {
105
+ const gauche = decomposer(a);
106
+ const droite = decomposer(b);
107
+ const echelle = Math.max(gauche.echelle, droite.echelle);
108
+ return recomposer(gauche.chiffres * 10n ** BigInt(echelle - gauche.echelle) - droite.chiffres * 10n ** BigInt(echelle - droite.echelle), echelle);
109
+ }
110
+ function decomposer(texte) {
111
+ const [, signe, entiere = "0", fraction = ""] = DECIMALE.exec(texte) ?? [];
112
+ const absolu = BigInt(`${entiere}${fraction}`);
113
+ return {
114
+ chiffres: signe === "-" ? -absolu : absolu,
115
+ echelle: fraction.length
116
+ };
117
+ }
118
+ function recomposer(valeur, echelle) {
119
+ const negatif = valeur < 0n;
120
+ const chiffres = (negatif ? -valeur : valeur).toString().padStart(echelle + 1, "0");
121
+ const coupure = chiffres.length - echelle;
122
+ const absolu = echelle === 0 ? chiffres : `${chiffres.slice(0, coupure)}.${chiffres.slice(coupure)}`;
123
+ return `${negatif ? "-" : ""}${absolu}`;
124
+ }
125
+ function optionsDeLaForme(forme) {
126
+ if (forme.devise !== null) return {
127
+ style: "currency",
128
+ currency: forme.devise
129
+ };
130
+ if (forme.pourcentage) return {
131
+ style: "unit",
132
+ unit: "percent"
133
+ };
134
+ return {};
135
+ }
136
+ function creer(locale, options) {
137
+ try {
138
+ return new Intl.NumberFormat(locale, options);
139
+ } catch (erreur) {
140
+ if (isDevMode()) console.warn("@starterlib/ui/graphiques :", erreur);
141
+ return new Intl.NumberFormat(void 0, {
142
+ maximumFractionDigits: 20,
143
+ signDisplay: options.signDisplay ?? "auto"
144
+ });
145
+ }
146
+ }
147
+ function texteDe(format, valeur) {
148
+ return format.formatToParts(valeur).map((partie) => partie.type === "minusSign" ? "−" : partie.value).join("");
149
+ }
150
+ function formateurDeValeurs(locale, forme) {
151
+ const formats = /* @__PURE__ */ new Map();
152
+ return (texte, signe = false) => {
153
+ const decimales = forme.devise === null ? Math.min(20, texte.split(".")[1]?.length ?? 0) : null;
154
+ const cle = `${String(decimales)}|${String(signe)}`;
155
+ let format = formats.get(cle);
156
+ if (format === void 0) {
157
+ format = creer(locale, {
158
+ ...optionsDeLaForme(forme),
159
+ ...decimales === null ? {} : {
160
+ minimumFractionDigits: decimales,
161
+ maximumFractionDigits: decimales
162
+ },
163
+ signDisplay: signe ? "exceptZero" : "auto"
164
+ });
165
+ formats.set(cle, format);
166
+ }
167
+ return texteDe(format, texte);
168
+ };
169
+ }
170
+ function decimalesDuPas(pas) {
171
+ const texte = String(Number(pas.toPrecision(12)));
172
+ const exposant = /e-(\d+)$/.exec(texte);
173
+ if (exposant !== null) return Math.min(20, Number(exposant[1]));
174
+ return Math.min(20, texte.split(".")[1]?.length ?? 0);
175
+ }
176
+ function formateurDeGraduations(locale, forme, pas, plusGrande) {
177
+ const decimales = decimalesDuPas(pas);
178
+ const format = creer(locale, plusGrande >= 1e6 ? {
179
+ ...optionsDeLaForme(forme),
180
+ notation: "compact",
181
+ maximumSignificantDigits: 3
182
+ } : {
183
+ ...optionsDeLaForme(forme),
184
+ minimumFractionDigits: decimales,
185
+ maximumFractionDigits: decimales
186
+ });
187
+ return (valeur) => texteDe(format, valeur === 0 ? 0 : valeur);
188
+ }
189
+ function partiesDHeure(fuseau) {
190
+ const format = new Intl.DateTimeFormat("en-US", {
191
+ timeZone: fuseau,
192
+ hourCycle: "h23",
193
+ month: "numeric",
194
+ hour: "numeric",
195
+ minute: "numeric"
196
+ });
197
+ return (instant) => {
198
+ const parties = format.formatToParts(new Date(instant));
199
+ const lire = (type) => Number(parties.find((partie) => partie.type === type)?.value ?? "0");
200
+ return {
201
+ mois: lire("month"),
202
+ heure: lire("hour"),
203
+ minute: lire("minute")
204
+ };
205
+ };
206
+ }
207
+ function tousAMinuit(instants, fuseau) {
208
+ const lire = partiesDHeure(fuseau);
209
+ return instants.every((instant) => {
210
+ const { heure, minute } = lire(instant);
211
+ return heure === 0 && minute === 0;
212
+ });
213
+ }
214
+ function formateurDeReperes(locale, fuseau) {
215
+ const formats = /* @__PURE__ */ new Map();
216
+ const format = (cle, options) => {
217
+ let lu = formats.get(cle);
218
+ if (lu === void 0) {
219
+ lu = new Intl.DateTimeFormat(locale, {
220
+ ...options,
221
+ timeZone: fuseau
222
+ });
223
+ formats.set(cle, lu);
224
+ }
225
+ return lu;
226
+ };
227
+ const parties = partiesDHeure(fuseau);
228
+ return (instant, unite, premier) => {
229
+ const date = new Date(instant);
230
+ switch (unite) {
231
+ case "minute":
232
+ case "heure": return format("heure", {
233
+ hour: "2-digit",
234
+ minute: "2-digit"
235
+ }).format(date);
236
+ case "jour": return format("jour", {
237
+ day: "numeric",
238
+ month: "short"
239
+ }).format(date);
240
+ case "mois": return premier || parties(instant).mois === 1 ? format("mois-annee", {
241
+ month: "short",
242
+ year: "numeric"
243
+ }).format(date) : format("mois", { month: "short" }).format(date);
244
+ case "annee": return format("annee", { year: "numeric" }).format(date);
245
+ }
246
+ };
247
+ }
248
+ function formateurDeDates(locale, fuseau, avecHeure) {
249
+ const format = new Intl.DateTimeFormat(locale, {
250
+ dateStyle: "medium",
251
+ ...avecHeure ? { timeStyle: "short" } : {},
252
+ timeZone: fuseau
253
+ });
254
+ return (instant) => format.format(new Date(instant));
255
+ }
256
+ const SERIES_MAX = 4;
257
+ const POINTS_RECOMMANDES = 500;
258
+ const TRAITS_PAR_RANG = [
259
+ "plein",
260
+ "tirets",
261
+ "points",
262
+ "mixte"
263
+ ];
264
+ const LARGEUR_SUPPOSEE = 640;
265
+ const CHASSE = 7;
266
+ const ECART_DES_REPERES = 96;
267
+ const ECART_DES_GRADUATIONS = 48;
268
+ const MARGE_BAS = 28;
269
+ const MARGE_HAUT = 12;
270
+ const MARGE_HAUT_AVEC_MARQUEURS = 26;
271
+ const MARGE_DROITE = 12;
272
+ const SANS_VALEUR = "—";
273
+ function arrondir$1(valeur) {
274
+ return Math.round(valeur * 10) / 10;
275
+ }
276
+ var StLineChart = class StLineChart {
277
+ locale = inject(ST_LOCALE);
278
+ fuseauParDefaut = inject(FUSEAU_PAR_DEFAUT);
279
+ catalogue = catalogueDesGraphiques();
280
+ annonce = new AnnonceLocale(inject(DestroyRef));
281
+ series = input.required(...ngDevMode ? [{ debugName: "series" }] : /* istanbul ignore next */ []);
282
+ zonePerte = input(null, ...ngDevMode ? [{ debugName: "zonePerte" }] : /* istanbul ignore next */ []);
283
+ marqueurs = input([], ...ngDevMode ? [{ debugName: "marqueurs" }] : /* istanbul ignore next */ []);
284
+ devise = input(null, ...ngDevMode ? [{ debugName: "devise" }] : /* istanbul ignore next */ []);
285
+ pourcentage = input(false, {
286
+ ...ngDevMode ? { debugName: "pourcentage" } : /* istanbul ignore next */ {},
287
+ transform: booleanAttribute
288
+ });
289
+ fuseau = input(null, ...ngDevMode ? [{ debugName: "fuseau" }] : /* istanbul ignore next */ []);
290
+ etiquette = input.required(...ngDevMode ? [{ debugName: "etiquette" }] : /* istanbul ignore next */ []);
291
+ resume = input.required(...ngDevMode ? [{ debugName: "resume" }] : /* istanbul ignore next */ []);
292
+ pariteEchelle = input(false, {
293
+ ...ngDevMode ? { debugName: "pariteEchelle" } : /* istanbul ignore next */ {},
294
+ transform: booleanAttribute
295
+ });
296
+ hauteur = input(240, ...ngDevMode ? [{ debugName: "hauteur" }] : /* istanbul ignore next */ []);
297
+ vueDonnees = signal(false, ...ngDevMode ? [{ debugName: "vueDonnees" }] : /* istanbul ignore next */ []);
298
+ largeur = signal(LARGEUR_SUPPOSEE, ...ngDevMode ? [{ debugName: "largeur" }] : /* istanbul ignore next */ []);
299
+ identifiants = (() => {
300
+ const base = inject(StIdentifiants).prochain("st-graphique");
301
+ return {
302
+ motif: `${base}-motif`,
303
+ resume: `${base}-resume`
304
+ };
305
+ })();
306
+ fuseauDeRendu = computed(() => fuseauLisible(this.fuseau() ?? this.fuseauParDefaut), ...ngDevMode ? [{ debugName: "fuseauDeRendu" }] : /* istanbul ignore next */ []);
307
+ forme = computed(() => ({
308
+ devise: this.devise(),
309
+ pourcentage: this.pourcentage()
310
+ }), ...ngDevMode ? [{ debugName: "forme" }] : /* istanbul ignore next */ []);
311
+ seriesLues = computed(() => {
312
+ const fuseau = this.fuseauDeRendu();
313
+ const series = this.series();
314
+ if (series.length > SERIES_MAX && isDevMode()) console.warn(`st-line-chart : ${String(series.length)} series, quatre au plus ; les suivantes ne sont pas dessinees.`);
315
+ return series.slice(0, SERIES_MAX).map((serie, indice) => {
316
+ const points = lirePoints(serie.points, fuseau, "st-line-chart");
317
+ if (points.length > POINTS_RECOMMANDES && isDevMode()) console.warn(`st-line-chart : "${serie.libelle}" porte ${String(points.length)} points ; ${String(POINTS_RECOMMANDES)} au plus, reduits cote serveur.`);
318
+ return {
319
+ rang: indice + 1,
320
+ trait: serie.trait ?? TRAITS_PAR_RANG[indice] ?? "plein",
321
+ libelle: serie.libelle,
322
+ points
323
+ };
324
+ });
325
+ }, ...ngDevMode ? [{ debugName: "seriesLues" }] : /* istanbul ignore next */ []);
326
+ plafond = computed(() => {
327
+ const zone = this.zonePerte();
328
+ if (zone === null) return null;
329
+ return {
330
+ libelle: zone.libelle,
331
+ points: lirePoints(zone.plafond, this.fuseauDeRendu(), "st-line-chart")
332
+ };
333
+ }, ...ngDevMode ? [{ debugName: "plafond" }] : /* istanbul ignore next */ []);
334
+ marqueursLus = computed(() => {
335
+ const fuseau = this.fuseauDeRendu();
336
+ const lus = lireMarqueurs(this.marqueurs(), fuseau);
337
+ const date = formateurDeDates(this.locale(), fuseau, !tousAMinuit(lus.map((marqueur) => marqueur.instant), fuseau));
338
+ return lus.map((marqueur, indice) => ({
339
+ numero: indice + 1,
340
+ instant: marqueur.instant,
341
+ iso: new Date(marqueur.instant).toISOString(),
342
+ date: date(marqueur.instant),
343
+ libelle: marqueur.libelle
344
+ }));
345
+ }, ...ngDevMode ? [{ debugName: "marqueursLus" }] : /* istanbul ignore next */ []);
346
+ vide = computed(() => this.seriesLues().every((serie) => serie.points.length === 0) && (this.plafond()?.points.length ?? 0) === 0, ...ngDevMode ? [{ debugName: "vide" }] : /* istanbul ignore next */ []);
347
+ dessin = computed(() => {
348
+ if (this.vide()) return null;
349
+ const largeur = Math.max(160, this.largeur());
350
+ const hauteur = Math.max(120, Math.round(this.hauteur()));
351
+ const series = this.seriesLues();
352
+ const plafond = this.plafond();
353
+ let minimum = Infinity;
354
+ let maximum = -Infinity;
355
+ let debut = Infinity;
356
+ let fin = -Infinity;
357
+ for (const point of [...series.flatMap((serie) => serie.points), ...plafond?.points ?? []]) {
358
+ minimum = Math.min(minimum, point.valeur);
359
+ maximum = Math.max(maximum, point.valeur);
360
+ debut = Math.min(debut, point.instant);
361
+ fin = Math.max(fin, point.instant);
362
+ }
363
+ const nombreDeGraduations = Math.max(3, Math.floor(hauteur / ECART_DES_GRADUATIONS));
364
+ const echelle = this.pariteEchelle() ? graduationsSymetriques(minimum, maximum, nombreDeGraduations) : graduationsAgreables(minimum, maximum, nombreDeGraduations);
365
+ const graduer = formateurDeGraduations(this.locale(), this.forme(), echelle.pas, Math.max(Math.abs(echelle.debut), Math.abs(echelle.fin)));
366
+ const textes = echelle.valeurs.map(graduer);
367
+ 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$1(haut + (echelle.fin - valeur) / (echelle.fin - echelle.debut) * (bas - haut));
373
+ const plat = debut === fin;
374
+ const x = (instant) => arrondir$1(plat ? (gauche + droite) / 2 : gauche + (instant - debut) / (fin - debut) * (droite - gauche));
375
+ const fuseau = this.fuseauDeRendu();
376
+ const temps = plat ? {
377
+ unite: "jour",
378
+ valeurs: [debut]
379
+ } : graduationsTemporelles(debut, fin, fuseau, Math.max(2, Math.floor((droite - gauche) / ECART_DES_REPERES)));
380
+ const reperer = formateurDeReperes(this.locale(), fuseau);
381
+ const reperes = temps.valeurs.map((instant, rang) => {
382
+ const texte = reperer(instant, temps.unite, rang === 0);
383
+ const position = x(instant);
384
+ const demi = texte.length * CHASSE / 2;
385
+ return {
386
+ x: position,
387
+ texte,
388
+ ancre: position - demi < 0 ? "start" : position + demi > largeur ? "end" : "middle"
389
+ };
390
+ });
391
+ const coordonnees = (points) => points.map((point) => `${String(x(point.instant))} ${String(y(point.valeur))}`);
392
+ const traces = series.map((serie) => {
393
+ const [seul] = serie.points;
394
+ return {
395
+ rang: serie.rang,
396
+ trait: serie.trait,
397
+ d: serie.points.length > 1 ? `M${coordonnees(serie.points).join("L")}` : null,
398
+ point: serie.points.length === 1 && seul !== void 0 ? {
399
+ x: x(seul.instant),
400
+ y: y(seul.valeur)
401
+ } : null
402
+ };
403
+ });
404
+ const premiere = series[0];
405
+ const perte = plafond !== null && premiere !== void 0 && plafond.points.length > 1 && premiere.points.length > 1 ? `M${[...coordonnees(plafond.points), ...coordonnees([...premiere.points].reverse())].join("L")}Z` : null;
406
+ const marqueurs = this.marqueursLus().filter((marqueur) => marqueur.instant >= debut && marqueur.instant <= fin).map((marqueur) => ({
407
+ x: x(marqueur.instant),
408
+ numero: marqueur.numero
409
+ }));
410
+ return {
411
+ largeur,
412
+ hauteur,
413
+ gauche,
414
+ droite,
415
+ haut,
416
+ bas,
417
+ graduations: echelle.valeurs.map((valeur, rang) => ({
418
+ y: y(valeur),
419
+ texte: textes[rang] ?? "",
420
+ zero: valeur === 0
421
+ })),
422
+ reperes,
423
+ traces,
424
+ perte,
425
+ marqueurs
426
+ };
427
+ }, ...ngDevMode ? [{ debugName: "dessin" }] : /* istanbul ignore next */ []);
428
+ colonnes = computed(() => {
429
+ const plafond = this.plafond();
430
+ return [
431
+ {
432
+ cle: "instant",
433
+ libelle: this.catalogue().libelles.colonneDate
434
+ },
435
+ ...this.seriesLues().map((serie) => ({
436
+ cle: `s${String(serie.rang)}`,
437
+ libelle: serie.libelle,
438
+ alignement: "fin"
439
+ })),
440
+ ...plafond === null ? [] : [{
441
+ cle: "plafond",
442
+ libelle: plafond.libelle,
443
+ alignement: "fin"
444
+ }]
445
+ ];
446
+ }, ...ngDevMode ? [{ debugName: "colonnes" }] : /* istanbul ignore next */ []);
447
+ lignes = computed(() => {
448
+ const valeur = formateurDeValeurs(this.locale(), this.forme());
449
+ const parInstant = /* @__PURE__ */ new Map();
450
+ const cellules = (instant) => {
451
+ let ligne = parInstant.get(instant);
452
+ if (ligne === void 0) {
453
+ ligne = {};
454
+ parInstant.set(instant, ligne);
455
+ }
456
+ return ligne;
457
+ };
458
+ for (const serie of this.seriesLues()) for (const point of serie.points) cellules(point.instant)[`s${String(serie.rang)}`] = valeur(point.texte);
459
+ for (const point of this.plafond()?.points ?? []) cellules(point.instant)["plafond"] = valeur(point.texte);
460
+ const instants = dansLOrdreDuTemps(parInstant.keys());
461
+ const fuseau = this.fuseauDeRendu();
462
+ const date = formateurDeDates(this.locale(), fuseau, !tousAMinuit(instants, fuseau));
463
+ const cles = this.colonnes().slice(1).map((colonne) => colonne.cle);
464
+ return instants.map((instant) => {
465
+ const lues = parInstant.get(instant) ?? {};
466
+ const ligne = {
467
+ cle: String(instant),
468
+ instant: date(instant)
469
+ };
470
+ for (const cle of cles) ligne[cle] = lues[cle] ?? SANS_VALEUR;
471
+ return ligne;
472
+ });
473
+ }, ...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
+ basculer() {
493
+ const donnees = !this.vueDonnees();
494
+ this.vueDonnees.set(donnees);
495
+ const libelles = this.catalogue().libelles;
496
+ this.annonce.annoncer(donnees ? libelles.tableauAffiche : libelles.graphiqueAffiche);
497
+ }
498
+ static ɵfac = i0.ɵɵngDeclareFactory({
499
+ minVersion: "12.0.0",
500
+ version: "22.2.1",
501
+ ngImport: i0,
502
+ type: StLineChart,
503
+ deps: [],
504
+ target: i0.ɵɵFactoryTarget.Component
505
+ });
506
+ static ɵcmp = i0.ɵɵngDeclareComponent({
507
+ minVersion: "17.0.0",
508
+ version: "22.2.1",
509
+ type: StLineChart,
510
+ isStandalone: true,
511
+ selector: "st-line-chart",
512
+ inputs: {
513
+ series: {
514
+ classPropertyName: "series",
515
+ publicName: "series",
516
+ isSignal: true,
517
+ isRequired: true,
518
+ transformFunction: null
519
+ },
520
+ zonePerte: {
521
+ classPropertyName: "zonePerte",
522
+ publicName: "zonePerte",
523
+ isSignal: true,
524
+ isRequired: false,
525
+ transformFunction: null
526
+ },
527
+ marqueurs: {
528
+ classPropertyName: "marqueurs",
529
+ publicName: "marqueurs",
530
+ isSignal: true,
531
+ isRequired: false,
532
+ transformFunction: null
533
+ },
534
+ devise: {
535
+ classPropertyName: "devise",
536
+ publicName: "devise",
537
+ isSignal: true,
538
+ isRequired: false,
539
+ transformFunction: null
540
+ },
541
+ pourcentage: {
542
+ classPropertyName: "pourcentage",
543
+ publicName: "pourcentage",
544
+ isSignal: true,
545
+ isRequired: false,
546
+ transformFunction: null
547
+ },
548
+ fuseau: {
549
+ classPropertyName: "fuseau",
550
+ publicName: "fuseau",
551
+ isSignal: true,
552
+ isRequired: false,
553
+ transformFunction: null
554
+ },
555
+ etiquette: {
556
+ classPropertyName: "etiquette",
557
+ publicName: "etiquette",
558
+ isSignal: true,
559
+ isRequired: true,
560
+ transformFunction: null
561
+ },
562
+ resume: {
563
+ classPropertyName: "resume",
564
+ publicName: "resume",
565
+ isSignal: true,
566
+ isRequired: true,
567
+ transformFunction: null
568
+ },
569
+ pariteEchelle: {
570
+ classPropertyName: "pariteEchelle",
571
+ publicName: "pariteEchelle",
572
+ isSignal: true,
573
+ isRequired: false,
574
+ transformFunction: null
575
+ },
576
+ hauteur: {
577
+ classPropertyName: "hauteur",
578
+ publicName: "hauteur",
579
+ isSignal: true,
580
+ isRequired: false,
581
+ transformFunction: null
582
+ }
583
+ },
584
+ host: {
585
+ properties: { "attr.data-vue": "vueDonnees() ? \"donnees\" : \"graphique\"" },
586
+ classAttribute: "st-line-chart"
587
+ },
588
+ ngImport: i0,
589
+ template: "<div class=\"st-line-chart__barre\">\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-line-chart__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-line-chart__hachure\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"6\" />\n </pattern>\n </defs>\n @for (graduation of dessin.graduations; track $index) {\n <line\n class=\"st-line-chart__grille\"\n [attr.data-zero]=\"graduation.zero ? '' : 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-line-chart__graduation\"\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 @if (dessin.perte; as perte) {\n <path\n class=\"st-line-chart__perte\"\n [attr.d]=\"perte\"\n [attr.fill]=\"'url(#' + identifiants.motif + ')'\"\n />\n }\n @for (marqueur of dessin.marqueurs; track marqueur.numero) {\n <line\n class=\"st-line-chart__marqueur\"\n [attr.x1]=\"marqueur.x\"\n [attr.x2]=\"marqueur.x\"\n [attr.y1]=\"dessin.haut\"\n [attr.y2]=\"dessin.bas\"\n />\n <text\n class=\"st-line-chart__numero\"\n text-anchor=\"middle\"\n [attr.x]=\"marqueur.x\"\n [attr.y]=\"dessin.haut - 10\"\n >\n {{ marqueur.numero }}\n </text>\n }\n @for (trace of dessin.traces; track trace.rang) {\n @if (trace.d; as d) {\n <path\n class=\"st-line-chart__trace\"\n [attr.data-serie]=\"trace.rang\"\n [attr.data-trait]=\"trace.trait\"\n [attr.d]=\"d\"\n />\n }\n @if (trace.point; as point) {\n <circle\n class=\"st-line-chart__point\"\n r=\"4\"\n [attr.data-serie]=\"trace.rang\"\n [attr.cx]=\"point.x\"\n [attr.cy]=\"point.y\"\n />\n }\n }\n @for (repere of dessin.reperes; track $index) {\n <text\n class=\"st-line-chart__graduation\"\n [attr.text-anchor]=\"repere.ancre\"\n [attr.x]=\"repere.x\"\n [attr.y]=\"dessin.hauteur - 8\"\n >\n {{ repere.texte }}\n </text>\n }\n </svg>\n\n <ul class=\"st-line-chart__legende\" [attr.aria-label]=\"catalogue().libelles.legende\">\n @for (serie of seriesLues(); track serie.rang) {\n <li class=\"st-line-chart__cle\">\n <svg\n class=\"st-line-chart__echantillon\"\n aria-hidden=\"true\"\n focusable=\"false\"\n viewBox=\"0 0 24 12\"\n width=\"24\"\n height=\"12\"\n >\n <line\n class=\"st-line-chart__trace\"\n x1=\"2\"\n y1=\"6\"\n x2=\"22\"\n y2=\"6\"\n [attr.data-serie]=\"serie.rang\"\n [attr.data-trait]=\"serie.trait\"\n />\n </svg>\n {{ serie.libelle }}\n </li>\n }\n @if (plafond(); as plafond) {\n <li class=\"st-line-chart__cle\">\n <svg\n class=\"st-line-chart__echantillon\"\n aria-hidden=\"true\"\n focusable=\"false\"\n viewBox=\"0 0 24 12\"\n width=\"24\"\n height=\"12\"\n >\n <rect\n class=\"st-line-chart__perte\"\n x=\"2\"\n y=\"1\"\n width=\"20\"\n height=\"10\"\n [attr.fill]=\"'url(#' + identifiants.motif + ')'\"\n />\n </svg>\n {{ plafond.libelle }}\n </li>\n }\n </ul>\n} @else {\n <p class=\"st-line-chart__vide\" [attr.lang]=\"catalogue().langueDeRepli\">\n {{ catalogue().libelles.aucuneDonnee }}\n </p>\n}\n\n@if (marqueursLus().length > 0) {\n <ol class=\"st-line-chart__evenements\" [attr.aria-label]=\"catalogue().libelles.evenements\">\n @for (marqueur of marqueursLus(); track marqueur.numero) {\n <li>\n <time [attr.datetime]=\"marqueur.iso\">{{ marqueur.date }}</time\n >{{ catalogue().libelles.separateurDEvenement }}{{ marqueur.libelle }}\n </li>\n }\n </ol>\n}\n\n<p class=\"st-line-chart__resume\" [id]=\"identifiants.resume\">{{ resume() }}</p>\n<span\n class=\"st-line-chart__annonce st-vh\"\n aria-live=\"polite\"\n [attr.lang]=\"catalogue().langueDeRepli\"\n >{{ annonce.texte() }}</span\n>\n",
590
+ 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"],
591
+ dependencies: [{
592
+ kind: "component",
593
+ type: StButton,
594
+ selector: "button[stButton]",
595
+ inputs: [
596
+ "variante",
597
+ "taille",
598
+ "pleineLargeur",
599
+ "iconeAvant",
600
+ "iconeApres",
601
+ "chargement",
602
+ "indisponible",
603
+ "raisonIndisponible"
604
+ ]
605
+ }, {
606
+ kind: "component",
607
+ type: StDataTable,
608
+ selector: "st-data-table",
609
+ inputs: [
610
+ "legende",
611
+ "legendeMasquee",
612
+ "colonnes",
613
+ "lignes",
614
+ "cle",
615
+ "enTeteDeLigne",
616
+ "premiereColonneFigee",
617
+ "hauteurMax",
618
+ "tonDeLigne",
619
+ "ligneChoisissable",
620
+ "densite",
621
+ "chargement",
622
+ "annonceDeRechargement",
623
+ "selectionnable",
624
+ "selection",
625
+ "tri",
626
+ "triTernaire",
627
+ "texteVide",
628
+ "raisonDuVide",
629
+ "lignesAttendues"
630
+ ],
631
+ outputs: [
632
+ "selectionChange",
633
+ "triChange",
634
+ "effacement"
635
+ ]
636
+ }],
637
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
638
+ });
639
+ };
640
+ i0.ɵɵngDeclareClassMetadata({
641
+ minVersion: "12.0.0",
642
+ version: "22.2.1",
643
+ ngImport: i0,
644
+ type: StLineChart,
645
+ decorators: [{
646
+ type: Component,
647
+ args: [{
648
+ selector: "st-line-chart",
649
+ changeDetection: ChangeDetectionStrategy.OnPush,
650
+ imports: [StButton, StDataTable],
651
+ host: {
652
+ class: "st-line-chart",
653
+ "[attr.data-vue]": "vueDonnees() ? \"donnees\" : \"graphique\""
654
+ },
655
+ template: "<div class=\"st-line-chart__barre\">\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-line-chart__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-line-chart__hachure\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"6\" />\n </pattern>\n </defs>\n @for (graduation of dessin.graduations; track $index) {\n <line\n class=\"st-line-chart__grille\"\n [attr.data-zero]=\"graduation.zero ? '' : 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-line-chart__graduation\"\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 @if (dessin.perte; as perte) {\n <path\n class=\"st-line-chart__perte\"\n [attr.d]=\"perte\"\n [attr.fill]=\"'url(#' + identifiants.motif + ')'\"\n />\n }\n @for (marqueur of dessin.marqueurs; track marqueur.numero) {\n <line\n class=\"st-line-chart__marqueur\"\n [attr.x1]=\"marqueur.x\"\n [attr.x2]=\"marqueur.x\"\n [attr.y1]=\"dessin.haut\"\n [attr.y2]=\"dessin.bas\"\n />\n <text\n class=\"st-line-chart__numero\"\n text-anchor=\"middle\"\n [attr.x]=\"marqueur.x\"\n [attr.y]=\"dessin.haut - 10\"\n >\n {{ marqueur.numero }}\n </text>\n }\n @for (trace of dessin.traces; track trace.rang) {\n @if (trace.d; as d) {\n <path\n class=\"st-line-chart__trace\"\n [attr.data-serie]=\"trace.rang\"\n [attr.data-trait]=\"trace.trait\"\n [attr.d]=\"d\"\n />\n }\n @if (trace.point; as point) {\n <circle\n class=\"st-line-chart__point\"\n r=\"4\"\n [attr.data-serie]=\"trace.rang\"\n [attr.cx]=\"point.x\"\n [attr.cy]=\"point.y\"\n />\n }\n }\n @for (repere of dessin.reperes; track $index) {\n <text\n class=\"st-line-chart__graduation\"\n [attr.text-anchor]=\"repere.ancre\"\n [attr.x]=\"repere.x\"\n [attr.y]=\"dessin.hauteur - 8\"\n >\n {{ repere.texte }}\n </text>\n }\n </svg>\n\n <ul class=\"st-line-chart__legende\" [attr.aria-label]=\"catalogue().libelles.legende\">\n @for (serie of seriesLues(); track serie.rang) {\n <li class=\"st-line-chart__cle\">\n <svg\n class=\"st-line-chart__echantillon\"\n aria-hidden=\"true\"\n focusable=\"false\"\n viewBox=\"0 0 24 12\"\n width=\"24\"\n height=\"12\"\n >\n <line\n class=\"st-line-chart__trace\"\n x1=\"2\"\n y1=\"6\"\n x2=\"22\"\n y2=\"6\"\n [attr.data-serie]=\"serie.rang\"\n [attr.data-trait]=\"serie.trait\"\n />\n </svg>\n {{ serie.libelle }}\n </li>\n }\n @if (plafond(); as plafond) {\n <li class=\"st-line-chart__cle\">\n <svg\n class=\"st-line-chart__echantillon\"\n aria-hidden=\"true\"\n focusable=\"false\"\n viewBox=\"0 0 24 12\"\n width=\"24\"\n height=\"12\"\n >\n <rect\n class=\"st-line-chart__perte\"\n x=\"2\"\n y=\"1\"\n width=\"20\"\n height=\"10\"\n [attr.fill]=\"'url(#' + identifiants.motif + ')'\"\n />\n </svg>\n {{ plafond.libelle }}\n </li>\n }\n </ul>\n} @else {\n <p class=\"st-line-chart__vide\" [attr.lang]=\"catalogue().langueDeRepli\">\n {{ catalogue().libelles.aucuneDonnee }}\n </p>\n}\n\n@if (marqueursLus().length > 0) {\n <ol class=\"st-line-chart__evenements\" [attr.aria-label]=\"catalogue().libelles.evenements\">\n @for (marqueur of marqueursLus(); track marqueur.numero) {\n <li>\n <time [attr.datetime]=\"marqueur.iso\">{{ marqueur.date }}</time\n >{{ catalogue().libelles.separateurDEvenement }}{{ marqueur.libelle }}\n </li>\n }\n </ol>\n}\n\n<p class=\"st-line-chart__resume\" [id]=\"identifiants.resume\">{{ resume() }}</p>\n<span\n class=\"st-line-chart__annonce st-vh\"\n aria-live=\"polite\"\n [attr.lang]=\"catalogue().langueDeRepli\"\n >{{ annonce.texte() }}</span\n>\n",
656
+ 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
+ }]
658
+ }],
659
+ ctorParameters: () => [],
660
+ propDecorators: {
661
+ series: [{
662
+ type: i0.Input,
663
+ args: [{
664
+ isSignal: true,
665
+ alias: "series",
666
+ required: true
667
+ }]
668
+ }],
669
+ zonePerte: [{
670
+ type: i0.Input,
671
+ args: [{
672
+ isSignal: true,
673
+ alias: "zonePerte",
674
+ required: false
675
+ }]
676
+ }],
677
+ marqueurs: [{
678
+ type: i0.Input,
679
+ args: [{
680
+ isSignal: true,
681
+ alias: "marqueurs",
682
+ required: false
683
+ }]
684
+ }],
685
+ devise: [{
686
+ type: i0.Input,
687
+ args: [{
688
+ isSignal: true,
689
+ alias: "devise",
690
+ required: false
691
+ }]
692
+ }],
693
+ pourcentage: [{
694
+ type: i0.Input,
695
+ args: [{
696
+ isSignal: true,
697
+ alias: "pourcentage",
698
+ required: false
699
+ }]
700
+ }],
701
+ fuseau: [{
702
+ type: i0.Input,
703
+ args: [{
704
+ isSignal: true,
705
+ alias: "fuseau",
706
+ required: false
707
+ }]
708
+ }],
709
+ etiquette: [{
710
+ type: i0.Input,
711
+ args: [{
712
+ isSignal: true,
713
+ alias: "etiquette",
714
+ required: true
715
+ }]
716
+ }],
717
+ resume: [{
718
+ type: i0.Input,
719
+ args: [{
720
+ isSignal: true,
721
+ alias: "resume",
722
+ required: true
723
+ }]
724
+ }],
725
+ pariteEchelle: [{
726
+ type: i0.Input,
727
+ args: [{
728
+ isSignal: true,
729
+ alias: "pariteEchelle",
730
+ required: false
731
+ }]
732
+ }],
733
+ hauteur: [{
734
+ type: i0.Input,
735
+ args: [{
736
+ isSignal: true,
737
+ alias: "hauteur",
738
+ required: false
739
+ }]
740
+ }]
741
+ }
742
+ });
743
+ const LARGEUR = 100;
744
+ const MARGE = 2;
745
+ function arrondir(valeur) {
746
+ return Math.round(valeur * 100) / 100;
747
+ }
748
+ var StSparkline = class StSparkline {
749
+ locale = inject(ST_LOCALE);
750
+ libellesDuTronc = inject(ST_LIBELLES);
751
+ fuseauParDefaut = inject(FUSEAU_PAR_DEFAUT);
752
+ catalogue = catalogueDesGraphiques();
753
+ points = input.required(...ngDevMode ? [{ debugName: "points" }] : /* istanbul ignore next */ []);
754
+ etiquette = input(null, ...ngDevMode ? [{ debugName: "etiquette" }] : /* istanbul ignore next */ []);
755
+ devise = input(null, ...ngDevMode ? [{ debugName: "devise" }] : /* istanbul ignore next */ []);
756
+ pourcentage = input(false, {
757
+ ...ngDevMode ? { debugName: "pourcentage" } : /* istanbul ignore next */ {},
758
+ transform: booleanAttribute
759
+ });
760
+ trait = input("plein", ...ngDevMode ? [{ debugName: "trait" }] : /* istanbul ignore next */ []);
761
+ fuseau = input(null, ...ngDevMode ? [{ debugName: "fuseau" }] : /* istanbul ignore next */ []);
762
+ lus = computed(() => lirePoints(this.points(), fuseauLisible(this.fuseau() ?? this.fuseauParDefaut), "st-sparkline"), ...ngDevMode ? [{ debugName: "lus" }] : /* istanbul ignore next */ []);
763
+ trace = computed(() => {
764
+ const points = this.lus();
765
+ const premier = points[0];
766
+ const dernier = points.at(-1);
767
+ if (premier === void 0 || dernier === void 0) return null;
768
+ let minimum = Infinity;
769
+ let maximum = -Infinity;
770
+ for (const point of points) {
771
+ minimum = Math.min(minimum, point.valeur);
772
+ maximum = Math.max(maximum, point.valeur);
773
+ }
774
+ const { debut, fin } = graduationsAgreables(minimum, maximum);
775
+ 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);
778
+ const coordonnees = points.map((point) => `${String(x(point.instant))} ${String(y(point.valeur))}`);
779
+ return {
780
+ ligne: points.length > 1 ? `M${coordonnees.join("L")}` : null,
781
+ dernier: `M${String(x(dernier.instant))} ${String(y(dernier.valeur))}h0`
782
+ };
783
+ }, ...ngDevMode ? [{ debugName: "trace" }] : /* istanbul ignore next */ []);
784
+ texte = computed(() => {
785
+ const points = this.lus();
786
+ const premier = points[0];
787
+ const dernier = points.at(-1);
788
+ if (premier === void 0 || dernier === void 0) return null;
789
+ const formater = formateurDeValeurs(this.locale(), {
790
+ devise: this.devise(),
791
+ pourcentage: this.pourcentage()
792
+ });
793
+ const variation = points.length > 1 ? differenceDecimale(dernier.texte, premier.texte) : null;
794
+ const lire = (valeur, signe) => valeur.startsWith("-") ? this.libellesDuTronc().montantNegatif(formater(valeur.slice(1))) : formater(valeur, signe);
795
+ return {
796
+ dernier: formater(dernier.texte),
797
+ variation: variation === null ? null : formater(variation, true),
798
+ lu: this.catalogue().libelles.tendance(lire(dernier.texte, false), variation === null ? null : lire(variation, true))
799
+ };
800
+ }, ...ngDevMode ? [{ debugName: "texte" }] : /* istanbul ignore next */ []);
801
+ static ɵfac = i0.ɵɵngDeclareFactory({
802
+ minVersion: "12.0.0",
803
+ version: "22.2.1",
804
+ ngImport: i0,
805
+ type: StSparkline,
806
+ deps: [],
807
+ target: i0.ɵɵFactoryTarget.Component
808
+ });
809
+ static ɵcmp = i0.ɵɵngDeclareComponent({
810
+ minVersion: "17.0.0",
811
+ version: "22.2.1",
812
+ type: StSparkline,
813
+ isStandalone: true,
814
+ selector: "st-sparkline",
815
+ inputs: {
816
+ points: {
817
+ classPropertyName: "points",
818
+ publicName: "points",
819
+ isSignal: true,
820
+ isRequired: true,
821
+ transformFunction: null
822
+ },
823
+ etiquette: {
824
+ classPropertyName: "etiquette",
825
+ publicName: "etiquette",
826
+ isSignal: true,
827
+ isRequired: false,
828
+ transformFunction: null
829
+ },
830
+ devise: {
831
+ classPropertyName: "devise",
832
+ publicName: "devise",
833
+ isSignal: true,
834
+ isRequired: false,
835
+ transformFunction: null
836
+ },
837
+ pourcentage: {
838
+ classPropertyName: "pourcentage",
839
+ publicName: "pourcentage",
840
+ isSignal: true,
841
+ isRequired: false,
842
+ transformFunction: null
843
+ },
844
+ trait: {
845
+ classPropertyName: "trait",
846
+ publicName: "trait",
847
+ isSignal: true,
848
+ isRequired: false,
849
+ transformFunction: null
850
+ },
851
+ fuseau: {
852
+ classPropertyName: "fuseau",
853
+ publicName: "fuseau",
854
+ isSignal: true,
855
+ isRequired: false,
856
+ transformFunction: null
857
+ }
858
+ },
859
+ host: { classAttribute: "st-sparkline" },
860
+ ngImport: i0,
861
+ template: "<svg\n class=\"st-sparkline__svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 100 24\"\n preserveAspectRatio=\"none\"\n focusable=\"false\"\n [attr.role]=\"etiquette() === null ? null : 'img'\"\n [attr.aria-label]=\"etiquette()\"\n [attr.aria-hidden]=\"etiquette() === null ? 'true' : null\"\n>\n @if (trace(); as trace) {\n @if (trace.ligne; as ligne) {\n <path class=\"st-sparkline__ligne\" [attr.data-trait]=\"trait()\" [attr.d]=\"ligne\" />\n }\n <path class=\"st-sparkline__dernier\" [attr.d]=\"trace.dernier\" />\n }\n</svg>\n@if (etiquette() === null) {\n @if (texte(); as texte) {\n <span class=\"st-sparkline__texte\">\n <span aria-hidden=\"true\">\n <span class=\"st-sparkline__valeur\">{{ texte.dernier }}</span>\n @if (texte.variation; as variation) {\n <span class=\"st-sparkline__variation\">{{ variation }}</span>\n }\n </span>\n <span class=\"st-vh\" [attr.lang]=\"catalogue().langueDeRepli\">{{ texte.lu }}</span>\n </span>\n } @else {\n <span class=\"st-sparkline__texte\" [attr.lang]=\"catalogue().langueDeRepli\">{{\n catalogue().libelles.aucuneDonnee\n }}</span>\n }\n}\n",
862
+ 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:inline-flex;gap:var(--st-espacement-2);align-items:center;max-inline-size:100%;vertical-align:middle}.st-sparkline__svg{display:block;flex:none;inline-size:4.5rem;block-size:1.25rem;overflow:visible;direction:ltr}.st-sparkline__ligne,.st-sparkline__dernier{fill:none;stroke:var(--st-couleur-serie1);stroke-linecap:round;stroke-linejoin:round;vector-effect:non-scaling-stroke}.st-sparkline__ligne{stroke-width:1.5}.st-sparkline__ligne[data-trait=tirets]{stroke-dasharray:4 3;stroke-linecap:butt}.st-sparkline__ligne[data-trait=points]{stroke-width:2;stroke-dasharray:0 4}.st-sparkline__ligne[data-trait=mixte]{stroke-dasharray:6 3 0 3}.st-sparkline__dernier{stroke-width:4}.st-sparkline__texte{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:inline-flex;flex-wrap:wrap;gap:0 var(--st-espacement-2);min-inline-size:0;font-variant-numeric:var(--st-chiffres-alignes);color:var(--st-couleur-texte)}.st-sparkline__variation{margin-inline-start:var(--st-espacement-2);color:var(--st-couleur-texte-discret)}@media(forced-colors:active){.st-sparkline__ligne,.st-sparkline__dernier{stroke:CanvasText}}\n"],
863
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
864
+ });
865
+ };
866
+ i0.ɵɵngDeclareClassMetadata({
867
+ minVersion: "12.0.0",
868
+ version: "22.2.1",
869
+ ngImport: i0,
870
+ type: StSparkline,
871
+ decorators: [{
872
+ type: Component,
873
+ args: [{
874
+ selector: "st-sparkline",
875
+ changeDetection: ChangeDetectionStrategy.OnPush,
876
+ host: { class: "st-sparkline" },
877
+ template: "<svg\n class=\"st-sparkline__svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 100 24\"\n preserveAspectRatio=\"none\"\n focusable=\"false\"\n [attr.role]=\"etiquette() === null ? null : 'img'\"\n [attr.aria-label]=\"etiquette()\"\n [attr.aria-hidden]=\"etiquette() === null ? 'true' : null\"\n>\n @if (trace(); as trace) {\n @if (trace.ligne; as ligne) {\n <path class=\"st-sparkline__ligne\" [attr.data-trait]=\"trait()\" [attr.d]=\"ligne\" />\n }\n <path class=\"st-sparkline__dernier\" [attr.d]=\"trace.dernier\" />\n }\n</svg>\n@if (etiquette() === null) {\n @if (texte(); as texte) {\n <span class=\"st-sparkline__texte\">\n <span aria-hidden=\"true\">\n <span class=\"st-sparkline__valeur\">{{ texte.dernier }}</span>\n @if (texte.variation; as variation) {\n <span class=\"st-sparkline__variation\">{{ variation }}</span>\n }\n </span>\n <span class=\"st-vh\" [attr.lang]=\"catalogue().langueDeRepli\">{{ texte.lu }}</span>\n </span>\n } @else {\n <span class=\"st-sparkline__texte\" [attr.lang]=\"catalogue().langueDeRepli\">{{\n catalogue().libelles.aucuneDonnee\n }}</span>\n }\n}\n",
878
+ 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:inline-flex;gap:var(--st-espacement-2);align-items:center;max-inline-size:100%;vertical-align:middle}.st-sparkline__svg{display:block;flex:none;inline-size:4.5rem;block-size:1.25rem;overflow:visible;direction:ltr}.st-sparkline__ligne,.st-sparkline__dernier{fill:none;stroke:var(--st-couleur-serie1);stroke-linecap:round;stroke-linejoin:round;vector-effect:non-scaling-stroke}.st-sparkline__ligne{stroke-width:1.5}.st-sparkline__ligne[data-trait=tirets]{stroke-dasharray:4 3;stroke-linecap:butt}.st-sparkline__ligne[data-trait=points]{stroke-width:2;stroke-dasharray:0 4}.st-sparkline__ligne[data-trait=mixte]{stroke-dasharray:6 3 0 3}.st-sparkline__dernier{stroke-width:4}.st-sparkline__texte{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:inline-flex;flex-wrap:wrap;gap:0 var(--st-espacement-2);min-inline-size:0;font-variant-numeric:var(--st-chiffres-alignes);color:var(--st-couleur-texte)}.st-sparkline__variation{margin-inline-start:var(--st-espacement-2);color:var(--st-couleur-texte-discret)}@media(forced-colors:active){.st-sparkline__ligne,.st-sparkline__dernier{stroke:CanvasText}}\n"]
879
+ }]
880
+ }],
881
+ propDecorators: {
882
+ points: [{
883
+ type: i0.Input,
884
+ args: [{
885
+ isSignal: true,
886
+ alias: "points",
887
+ required: true
888
+ }]
889
+ }],
890
+ etiquette: [{
891
+ type: i0.Input,
892
+ args: [{
893
+ isSignal: true,
894
+ alias: "etiquette",
895
+ required: false
896
+ }]
897
+ }],
898
+ devise: [{
899
+ type: i0.Input,
900
+ args: [{
901
+ isSignal: true,
902
+ alias: "devise",
903
+ required: false
904
+ }]
905
+ }],
906
+ pourcentage: [{
907
+ type: i0.Input,
908
+ args: [{
909
+ isSignal: true,
910
+ alias: "pourcentage",
911
+ required: false
912
+ }]
913
+ }],
914
+ trait: [{
915
+ type: i0.Input,
916
+ args: [{
917
+ isSignal: true,
918
+ alias: "trait",
919
+ required: false
920
+ }]
921
+ }],
922
+ fuseau: [{
923
+ type: i0.Input,
924
+ args: [{
925
+ isSignal: true,
926
+ alias: "fuseau",
927
+ required: false
928
+ }]
929
+ }]
930
+ }
931
+ });
932
+ export { LIBELLES_GRAPHIQUES_EN, LIBELLES_GRAPHIQUES_FR, ST_LIBELLES_GRAPHIQUES, StLineChart, StSparkline, catalogueDesGraphiques, fournirLibellesGraphiques, libellesDesGraphiques };
933
+
934
+ //# sourceMappingURL=starterlib-ui-graphiques.mjs.map