From 23fc12e8d8e17c8f80704a37724eae4cb59eec13 Mon Sep 17 00:00:00 2001 From: bmatge <45901416+bmatge@users.noreply.github.com> Date: Thu, 16 Jul 2026 23:31:45 +0200 Subject: [PATCH] =?UTF-8?q?feat(core):=20int=C3=A9gration=20DSFR=20Chart?= =?UTF-8?q?=202.1.x=20=E2=80=94=20API=20cartes=20unifi=C3=A9e=20level=20(#?= =?UTF-8?q?402)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - P0 : DataBox pose name (renommage 2.1.0) + title en compat 2.0.x — corrige les titres invisibles en preview/prod (core + embed builder) - P1 : map/map-reg routent vers — corrige la limitation connue de la carte régionale nationale - P2 : nouveaux types map-aca (académies) et map-monde (ISO 3166-1, conversion a3/num→a2 via toIsoA2) — cascade skills.ts, builder-ia, grist-widgets, specs - P4 (release N) : dsfr-data-world-map déprécié (warn console, retrait au prochain major) - P3 : doc statique CDN 2.0.4 → 2.1.1 (44 fichiers HTML + README + tests), SRI régénérés, grist-widgets branché sur CDN_URLS - Crédits et liens vers GouvernementFR/dsfr-chart (README, footer apps, specs, THIRD-PARTY-LICENSES) Co-Authored-By: Claude Fable 5 --- .changeset/databox-name-map-level.md | 5 ++ .changeset/map-aca-monde.md | 5 ++ README.md | 10 ++- apps/builder-ia/index.html | 4 +- apps/builder-ia/src/chat/chat.ts | 4 + apps/builder-ia/src/ia/action-schema.ts | 2 + apps/builder-ia/src/ia/data-tools.ts | 10 ++- apps/builder-ia/src/skills.ts | 63 +++++++++++--- apps/builder-ia/src/state.ts | 2 + apps/builder-ia/src/ui/chart-renderer.ts | 28 ++++-- apps/builder-ia/src/ui/code-generator.ts | 19 +++-- apps/builder/index.html | 4 +- apps/builder/src/ui/code-generator.ts | 5 +- apps/dashboard/index.html | 4 +- apps/favorites/index.html | 4 +- apps/grist-widgets/chart/index.html | 4 +- apps/grist-widgets/src/chart.ts | 27 +++--- apps/grist-widgets/test-local.html | 4 +- apps/playground/index.html | 4 +- docs/THIRD-PARTY-LICENSES.md | 2 +- e2e/industrie-du-futur.html | 4 +- guide/examples/education-gouv-1.html | 4 +- guide/examples/exemple-electrifions.html | 4 +- guide/examples/exemple-france-num.html | 4 +- guide/examples/exemple-masa-v1.html | 4 +- guide/examples/exemple-masa-v2.html | 4 +- guide/examples/observatoire-afa-v1.html | 4 +- guide/guide-demo-complete.html | 22 ++--- guide/guide-exemple-ODS.html | 4 +- guide/guide-exemples-chart-a11y.html | 4 +- guide/guide-exemples-context.html | 4 +- guide/guide-exemples-display.html | 4 +- guide/guide-exemples-facets.html | 4 +- guide/guide-exemples-ghibli.html | 4 +- guide/guide-exemples-insee-erfs.html | 4 +- guide/guide-exemples-join.html | 4 +- guide/guide-exemples-maires.html | 4 +- guide/guide-exemples-normalize.html | 4 +- guide/guide-exemples-query.html | 4 +- guide/guide-exemples-search.html | 4 +- guide/guide-exemples-source.html | 4 +- guide/guide-exemples-world-map.html | 4 +- packages/app-ui/src/app-footer.ts | 46 ++++++---- .../core/src/components/dsfr-data-chart.ts | 77 ++++++++++++++--- .../src/components/dsfr-data-world-map.ts | 8 ++ packages/core/src/data/continent-lookup.ts | 29 +++++++ packages/shared/src/charts/chart-types.ts | 27 +++++- packages/shared/src/index.ts | 2 +- packages/shared/src/lib.ts | 2 +- specs/charts/bar-chart.html | 4 +- specs/charts/gauge-chart.html | 4 +- specs/charts/index.html | 4 +- specs/charts/line-chart.html | 4 +- specs/charts/map-chart.html | 85 +++++++++++++++---- specs/charts/pie-chart.html | 4 +- specs/charts/radar-chart.html | 4 +- specs/charts/scatter-chart.html | 4 +- specs/components/dsfr-data-a11y.html | 4 +- specs/components/dsfr-data-chart.html | 8 +- specs/components/dsfr-data-facets.html | 4 +- specs/components/dsfr-data-normalize.html | 4 +- specs/components/dsfr-data-search.html | 4 +- specs/index.html | 6 +- specs/roadmap.html | 4 +- tests/apps/builder-ia/action-schema.test.ts | 2 + tests/apps/dashboard/dashboards.test.ts | 4 +- 66 files changed, 461 insertions(+), 199 deletions(-) create mode 100644 .changeset/databox-name-map-level.md create mode 100644 .changeset/map-aca-monde.md diff --git a/.changeset/databox-name-map-level.md b/.changeset/databox-name-map-level.md new file mode 100644 index 00000000..a3079006 --- /dev/null +++ b/.changeset/databox-name-map-level.md @@ -0,0 +1,5 @@ +--- +'dsfr-data': patch +--- + +Alignement DSFR Chart 2.1.x (correctifs) : la DataBox pose désormais `name` (renommage upstream de `title` en 2.1.0 — les titres de DataBox étaient invisibles en preview/prod) tout en conservant `title` pour les hôtes 2.0.x ; les types `map` et `map-reg` routent vers `` (API cartes unifiée), ce qui corrige la limitation connue de la carte régionale nationale (`` sans `region`). diff --git a/.changeset/map-aca-monde.md b/.changeset/map-aca-monde.md new file mode 100644 index 00000000..5826a75e --- /dev/null +++ b/.changeset/map-aca-monde.md @@ -0,0 +1,5 @@ +--- +'dsfr-data': minor +--- + +Nouveaux types de cartes `map-aca` (académies, clés = noms en majuscules) et `map-monde` (mondiale, clés ISO 3166-1 — les codes alpha-3 et numériques sont convertis automatiquement en alpha-2 via `toIsoA2`) sur `dsfr-data-chart`, apportés par l'API cartes unifiée `` de DSFR Chart 2.1. `dsfr-data-world-map` est déprécié au profit de `type="map-monde"` (warn console ; retrait prévu à la prochaine version majeure, #402). diff --git a/README.md b/README.md index 722c86e8..49e00169 100644 --- a/README.md +++ b/README.md @@ -45,8 +45,8 @@ ```html - - + + ``` @@ -104,6 +104,12 @@ Pour le detail du monorepo, des conventions, du workflow de release Changesets e - [Fiche produit](docs/DATASHEET.md) — positionnement, comparatif, cibles - [Politique de securite](docs/SECURITY.md) + [baseline](docs/security-baseline.md) — signalement, pipeline CI/CD, defenses +## Credits + +- Les graphiques et cartes sont rendus par **[DSFR Chart](https://github.com/GouvernementFR/dsfr-chart)** (`@gouvfr/dsfr-chart`), la bibliotheque officielle de datavisualisation de l'Etat — merci a ses mainteneurs. `dsfr-data` se concentre sur la couche **donnees** (sources, requetes, transformations) et delegue le rendu graphique a DSFR Chart, dont il suit les evolutions (API cartes unifiee `level` depuis la 2.1). +- Le design et les composants d'interface suivent le **[Systeme de design de l'Etat (DSFR)](https://www.systeme-de-design.gouv.fr/)**. +- Dependances tierces detaillees : [THIRD-PARTY-LICENSES](docs/THIRD-PARTY-LICENSES.md). + ## Licence MIT. diff --git a/apps/builder-ia/index.html b/apps/builder-ia/index.html index 37dc67ba..953d4ef9 100644 --- a/apps/builder-ia/index.html +++ b/apps/builder-ia/index.html @@ -15,8 +15,8 @@ - - + + diff --git a/apps/builder-ia/src/chat/chat.ts b/apps/builder-ia/src/chat/chat.ts index ce2292a0..db8e2c93 100644 --- a/apps/builder-ia/src/chat/chat.ts +++ b/apps/builder-ia/src/chat/chat.ts @@ -738,6 +738,10 @@ function repairAction(parsed: Record): Record map: 'map', carte: 'map', 'map-reg': 'map-reg', + 'map-aca': 'map-aca', + 'map-monde': 'map-monde', + monde: 'map-monde', + world: 'map-monde', 'bar-line': 'bar-line', barline: 'bar-line', }; diff --git a/apps/builder-ia/src/ia/action-schema.ts b/apps/builder-ia/src/ia/action-schema.ts index 78fddef3..95f7af9c 100644 --- a/apps/builder-ia/src/ia/action-schema.ts +++ b/apps/builder-ia/src/ia/action-schema.ts @@ -33,6 +33,8 @@ export const CHART_TYPES = [ 'map', 'bar-line', 'map-reg', + 'map-aca', + 'map-monde', 'datalist', 'podium', ] as const; diff --git a/apps/builder-ia/src/ia/data-tools.ts b/apps/builder-ia/src/ia/data-tools.ts index 28ab9323..0faf69d7 100644 --- a/apps/builder-ia/src/ia/data-tools.ts +++ b/apps/builder-ia/src/ia/data-tools.ts @@ -300,8 +300,14 @@ export function diagnoseConfig(config: Partial, data: Row[]): Diagn if (type === 'datalist' && !config.colonnes) { warnings.push('datalist sans "colonnes" : toutes les colonnes seront affichees.'); } - if ((type === 'map' || type === 'map-reg') && !config.codeField && !config.labelField) { - errors.push('Carte sans codeField : un champ code INSEE (departement/region) est requis.'); + if ( + (type === 'map' || type === 'map-reg' || type === 'map-aca' || type === 'map-monde') && + !config.codeField && + !config.labelField + ) { + errors.push( + 'Carte sans codeField : un champ code est requis (INSEE departement/region, nom d academie ou code pays ISO).' + ); } // 3) Filtre WHERE. diff --git a/apps/builder-ia/src/skills.ts b/apps/builder-ia/src/skills.ts index 195fe061..dc719293 100644 --- a/apps/builder-ia/src/skills.ts +++ b/apps/builder-ia/src/skills.ts @@ -65,7 +65,7 @@ Elle est distincte du code embarquable HTML (voir skills composants dsfr-data). | labelField | String | selon type | Champ pour les labels / axe X | | valueField | String | oui | Champ pour les valeurs / axe Y | | valueField2 | String | non | 2e série (bar-line, comparaisons) | -| codeField | String | non | Champ code departement/region (map, map-reg) | +| codeField | String | non | Champ code : departement/region (map, map-reg), nom d'academie (map-aca), code pays ISO (map-monde) | | aggregation | String | non | Fonction : sum, avg, count, min, max | | where | String | non | Filtre pre-agrégation (voir syntaxe ci-dessous) | | limit | Number | non | Nombre max de resultats | @@ -94,13 +94,15 @@ Elle est distincte du code embarquable HTML (voir skills composants dsfr-data). | kpi | non | oui | Indicateur chiffre clé unique | | map | non (codeField) | oui | Données par departement francais | | map-reg | non (codeField) | oui | Données par region francaise | +| map-aca | non (codeField) | oui | Données par academie (noms en majuscules : PARIS, LYON...) | +| map-monde | non (codeField) | oui | Données par pays (ISO 3166-1 : FR, US... — a3/num convertis) | | datalist | non | non (colonnes) | Tableau de données filtrable | IMPORTANT : - \`doughnut\` = \`pie\` (le composant pie est un anneau par défaut) - \`horizontalBar\` = \`bar\` (le renderer le convertit automatiquement) - Pour KPI et gauge : PAS de labelField -- Pour map/map-reg : utiliser codeField (pas labelField) +- Pour map/map-reg/map-aca/map-monde : utiliser codeField (pas labelField) ### Syntaxe du filtre (config.where) Format : \`"champ:operateur:valeur"\` @@ -1069,6 +1071,9 @@ Conteneur qui dispose plusieurs \`\` dans une grille CSS 12 colon 'gauge', 'departement', 'region', + 'academie', + 'monde', + 'pays', 'databox', 'habillage', 'encadrer', @@ -1105,8 +1110,10 @@ ce tableau en format DSFR Chart (tableaux imbriques x/y). | scatter | scatter-chart | Nuage de points | | gauge | gauge-chart | Jauge circulaire 0-100% | | bar-line | bar-chart + line-chart | Combine barres et ligne (2 séries) | -| map | map-chart | Carte par departement francais | -| map-reg | map-chart-reg | Carte par region francaise | +| map | map-chart (level="dep") | Carte par departement francais | +| map-reg | map-chart (level="reg") | Carte par region francaise | +| map-aca | map-chart (level="aca") | Carte par academie | +| map-monde | map-chart (level="monde") | Carte mondiale par pays | ### Attributs | Attribut | Type | Défaut | Requis | Description | @@ -1131,7 +1138,7 @@ ce tableau en format DSFR Chart (tableaux imbriques x/y). | y-min | String | \`""\` | non | Limite min axe Y | | y-max | String | \`""\` | non | Limite max axe Y | | gauge-value | Number | \`null\` | type gauge | Valeur de la jauge (0-100) | -| code-field | String | \`""\` | type map/map-reg | Champ contenant le code departement ou region (prioritaire sur label-field) | +| code-field | String | \`""\` | types map* | Champ contenant le code : departement/region (map, map-reg), nom d'academie en majuscules (map-aca), code pays ISO 3166-1 alpha-2/alpha-3/numerique (map-monde, converti en alpha-2) — prioritaire sur label-field | | map-highlight | String | \`""\` | non | Departements/regions a surligner | | reference-lines | String | \`""\` | non | Lignes de reference (overlay) en JSON. Cartesiens uniquement (line, bar, bar-line, scatter). Chaque item : \`{ axis: "x" ou "y", value (string ou number), label?, color?, dash?, position? }\`. \`axis:"x"\` → ligne verticale a une categorie/date ; \`axis:"y"\` → ligne horizontale a un seuil. Ex : \`reference-lines='[{"axis":"x","value":"2026-02","label":"Lancement","color":"#c9191e","dash":true},{"axis":"y","value":3000,"label":"Objectif"}]'\`. | | targets | String | \`""\` | non | Cibles / objectifs futurs (overlay) en JSON. Types line et bar-line uniquement. Chaque item : \`{ x (echeance, string ou number, requis), value (number, requis), series? (nom de dataset ou index, defaut 0), label?, color? }\`. L'axe X est etendu automatiquement si l'echeance depasse les donnees : trait plein jusqu'au dernier point reel, trajectoire pointillee vers un losange a l'echeance, zone future grisee. Ex : \`targets='[{"x":2030,"value":26,"label":"Cible 2030 : 26 %"}]'\`. | @@ -1150,6 +1157,8 @@ ce tableau en format DSFR Chart (tableaux imbriques x/y). | bar-line | source, type, label-field, value-field, value-field-2 | name, unit-tooltip, unit-tooltip-bar | | map | source, type, code-field, value-field | selected-palette, map-highlight | | map-reg | source, type, code-field, value-field | selected-palette, map-highlight | +| map-aca | source, type, code-field, value-field | selected-palette, map-highlight | +| map-monde | source, type, code-field, value-field | selected-palette, map-highlight | ### Exemples \`\`\`html @@ -1194,6 +1203,17 @@ ce tableau en format DSFR Chart (tableaux imbriques x/y). code-field="code_reg" value-field="valeur"> + + + + + + + + \`\`\` @@ -1502,15 +1522,20 @@ name='["Série A","Série B"]' ### - Multi-séries pour comparer des profils -### (carte par departement) -- data='{"75": 95, "69": 78, "2A": 60}' : JSON code_dept -> valeur -- Codes departements valides : 01-95, 2A, 2B, 971-976 +### (cartes choroplethes — API unifiee DSFR Chart 2.1) +- level : decoupage — "dep" (défaut), "reg", "aca", "monde" +- data : JSON code -> valeur, selon le level : + - level="dep" : data='{"75": 95, "69": 78, "2A": 60}' (codes 01-95, 2A, 2B, 971-976) + - level="reg" : data='{"11": 95, "84": 78}' (codes region INSEE) + - level="aca" : data='{"PARIS": 95, "LYON": 78}' (noms d'academie majuscules) + - level="monde" : data='{"FR": 95, "US": 78}' (ISO 3166-1 alpha-2) - name : nom de l'indicateur - value-nat : valeur nationale de reference - selected-palette : palette de couleurs -### (carte par region) -- Même format que map-chart avec codes region +### (zoom sur UNE region) +- Zoome sur une region donnee, data par departement de cette region +- Ex : region="11" data='{"75": 95, "92": 78}' ### Attributs communs - selected-palette : categorical, sequentialAscending, sequentialDescending, divergentAscending, divergentDescending, neutral, default @@ -1929,6 +1954,15 @@ Guide pour choisir le type de visualisation adapte aux données. - **Quand** : données geographiques par region francaise - **Champs** : code-field (code region), value-field +### Carte academies (map-aca) +- **Quand** : données education par academie +- **Champs** : code-field (nom d'academie en majuscules : PARIS, LYON, STRASBOURG...), value-field + +### Carte mondiale (map-monde) +- **Quand** : données internationales par pays +- **Champs** : code-field (code pays ISO 3166-1 : alpha-2 "FR", alpha-3 "FRA" ou numerique "250" — convertis automatiquement en alpha-2), value-field +- **Palette recommandee** : sequentialAscending + ### Séries multiples (bar, line, bar-line, radar) Utiliser \`value-field-2\` pour une seconde série, ou \`value-fields\` pour plusieurs séries supplementaires (separees par virgules). Definir les noms avec \`name='["Série 1","Série 2","Série 3"]'\`. @@ -1964,7 +1998,7 @@ Exemple multi-séries : \`value-field="ca" value-fields="budget,objectif" name=' ### Bonnes pratiques - Utiliser \`categorical\` pour pie, radar et comparaisons multi-catégories -- Utiliser \`sequentialAscending\` pour les cartes (map, map-reg) +- Utiliser \`sequentialAscending\` pour les cartes (map, map-reg, map-aca, map-monde) - Utiliser \`neutral\` + \`highlight-index\` pour mettre en avant une valeur - Assurer un contraste suffisant (conformite RGAA) - Eviter le rouge/vert seuls (daltonisme) - les palettes DSFR sont concues pour ca`, @@ -2262,7 +2296,12 @@ rendu : switch chart/tableau integre, CSV natif). Conserver uniquement : 'planisphere', 'carte pays', ], - content: `## dsfr-data-world-map — Carte choroplèthe mondiale + content: `## dsfr-data-world-map — Carte choroplèthe mondiale (DEPRECIE) + +⚠️ DEPRECIE : preferer \`\` (carte mondiale +DSFR Chart native, aucun bundle supplementaire). Ce composant sera retire +dans une prochaine version majeure. Il reste pertinent uniquement si le zoom +continent interactif est requis. Composant qui affiche une carte du monde SVG (projection Natural Earth) où chaque pays est colorié selon une valeur numérique. diff --git a/apps/builder-ia/src/state.ts b/apps/builder-ia/src/state.ts index d93fa59d..21f3a947 100644 --- a/apps/builder-ia/src/state.ts +++ b/apps/builder-ia/src/state.ts @@ -29,6 +29,8 @@ export interface ChartConfig { | 'map' | 'bar-line' | 'map-reg' + | 'map-aca' + | 'map-monde' | 'datalist' | 'podium'; labelField?: string; diff --git a/apps/builder-ia/src/ui/chart-renderer.ts b/apps/builder-ia/src/ui/chart-renderer.ts index c9911007..64acde53 100644 --- a/apps/builder-ia/src/ui/chart-renderer.ts +++ b/apps/builder-ia/src/ui/chart-renderer.ts @@ -2,7 +2,13 @@ * Chart rendering - applies chart configuration to generate visual output */ -import { escapeHtml, DSFR_COLORS, PALETTE_COLORS, isValidDeptCode } from '@dsfr-data/shared'; +import { + escapeHtml, + DSFR_COLORS, + PALETTE_COLORS, + isValidDeptCode, + MAP_LEVEL_MAP, +} from '@dsfr-data/shared'; import { state } from '../state.js'; import type { ChartConfig, AggregatedResult } from '../state.js'; import { addMessage } from '../chat/chat.js'; @@ -197,7 +203,7 @@ export function applyChartConfig(config: ChartConfig): void { // Aggregate data for charts const aggregated: Record = {}; - const isMap = config.type === 'map' || config.type === 'map-reg'; + const isMap = config.type in MAP_LEVEL_MAP; const codeField = config.codeField || config.labelField; workingData.forEach((record) => { @@ -333,8 +339,8 @@ function renderChart(config: ChartConfig, data: AggregatedResult[]): void { return; } - // Handle map type (uses DSFR map-chart / map-chart-reg) - if (config.type === 'map' || config.type === 'map-reg') { + // Handle map types (uses DSFR , API unifiee 2.1.0) + if (config.type in MAP_LEVEL_MAP) { canvas.style.display = 'none'; emptyState.style.display = 'none'; @@ -342,24 +348,28 @@ function renderChart(config: ChartConfig, data: AggregatedResult[]): void { const mapData: Record = {}; data.forEach((d) => { let code = String(d.code || d.label || '').trim(); - if (/^\d+$/.test(code) && code.length < 3) { + if (config.type === 'map-aca' || config.type === 'map-monde') { + // aca : noms d'academie majuscules ; monde : ISO alpha-2 + // (la conversion a3/num est faite par dsfr-data-chart, pas ici) + code = code.toUpperCase(); + } else if (/^\d+$/.test(code) && code.length < 3) { code = code.padStart(2, '0'); } const value = d.value || 0; - if (isValidDeptCode(code)) { + if (config.type === 'map' ? isValidDeptCode(code) : code !== '') { mapData[code] = Math.round(value * 100) / 100; } }); - const mapTag = config.type === 'map-reg' ? 'map-chart-reg' : 'map-chart'; const mapCard = document.createElement('div'); mapCard.className = 'map-card'; mapCard.innerHTML = ` - <${mapTag} + + > `; chartWrapper.appendChild(mapCard); return; diff --git a/apps/builder-ia/src/ui/code-generator.ts b/apps/builder-ia/src/ui/code-generator.ts index 93dfef5b..6fd63671 100644 --- a/apps/builder-ia/src/ui/code-generator.ts +++ b/apps/builder-ia/src/ui/code-generator.ts @@ -12,6 +12,7 @@ import { extractResourceIds, filterToOdsql, formatKPIValue, + MAP_LEVEL_MAP, } from '@dsfr-data/shared'; import { state } from '../state.js'; import type { ChartConfig, AggregatedResult } from '../state.js'; @@ -99,8 +100,8 @@ export function generateCode(config: ChartConfig, data: AggregatedResult[]): voi return; } - // Handle map type (department or region) - if (config.type === 'map' || config.type === 'map-reg') { + // Handle map types (departments, regions, academies, world) + if (config.type in MAP_LEVEL_MAP) { codeEl.textContent = generateMapCode(config, data); return; } @@ -322,11 +323,15 @@ function generateMapCode(config: ChartConfig, data: AggregatedResult[]): string const mapData: Record = {}; data.forEach((d) => { let code = String(d.code || d.label || '').trim(); - if (/^\d+$/.test(code) && code.length < 3) { + if (config.type === 'map-aca' || config.type === 'map-monde') { + // aca : noms d'academie majuscules ; monde : ISO alpha-2 + // (la conversion a3/num est faite par dsfr-data-chart, pas ici) + code = code.toUpperCase(); + } else if (/^\d+$/.test(code) && code.length < 3) { code = code.padStart(2, '0'); } const value = d.value || 0; - if (isValidDeptCode(code)) { + if (config.type === 'map' ? isValidDeptCode(code) : code !== '') { mapData[code] = Math.round(value * 100) / 100; } }); @@ -479,7 +484,6 @@ function generateMapCode(config: ChartConfig, data: AggregatedResult[]): string } // Embedded-data variant - const mapTagEmbed = config.type === 'map-reg' ? 'map-chart-reg' : 'map-chart'; return ` @@ -492,11 +496,12 @@ function generateMapCode(config: ChartConfig, data: AggregatedResult[]): string

${escapeHtml(config.title || 'Carte de France')}

${config.subtitle ? `

${escapeHtml(config.subtitle)}

` : ''} - <${mapTagEmbed} + + >
`; } diff --git a/apps/builder/index.html b/apps/builder/index.html index a7cc97de..db085b73 100644 --- a/apps/builder/index.html +++ b/apps/builder/index.html @@ -19,8 +19,8 @@ - - + + diff --git a/apps/builder/src/ui/code-generator.ts b/apps/builder/src/ui/code-generator.ts index 09349131..128bce22 100644 --- a/apps/builder/src/ui/code-generator.ts +++ b/apps/builder/src/ui/code-generator.ts @@ -114,9 +114,10 @@ function a11yDep(): string { function wrapWithDatabox(chartHtml: string, chartId: string): string { if (!state.databoxEnabled) return chartHtml; const dbId = `databox-${chartId}`; - // DataBox attributes — title, source, date are required + // DataBox attributes — name, source, date are required + // (DSFR Chart 2.1.0 renamed `title` to `name`) const dbAttrs: string[] = [`id="${dbId}"`]; - dbAttrs.push(`title="${escapeHtml(state.databoxTitle || ' ')}"`); + dbAttrs.push(`name="${escapeHtml(state.databoxTitle || ' ')}"`); dbAttrs.push(`source="${escapeHtml(state.databoxSource || ' ')}"`); dbAttrs.push(`date="${escapeHtml(state.databoxDate || new Date().toISOString().split('T')[0])}"`); if (state.databoxDownload) dbAttrs.push('download'); diff --git a/apps/dashboard/index.html b/apps/dashboard/index.html index ddda80bf..bd44b990 100644 --- a/apps/dashboard/index.html +++ b/apps/dashboard/index.html @@ -12,8 +12,8 @@ - - + + diff --git a/apps/favorites/index.html b/apps/favorites/index.html index c22c8d49..912d5d27 100644 --- a/apps/favorites/index.html +++ b/apps/favorites/index.html @@ -15,8 +15,8 @@ - - + + diff --git a/apps/grist-widgets/chart/index.html b/apps/grist-widgets/chart/index.html index 1a0e52c4..62983a9d 100644 --- a/apps/grist-widgets/chart/index.html +++ b/apps/grist-widgets/chart/index.html @@ -11,8 +11,8 @@ - - + + diff --git a/apps/grist-widgets/src/chart.ts b/apps/grist-widgets/src/chart.ts index a77ff983..09010bec 100644 --- a/apps/grist-widgets/src/chart.ts +++ b/apps/grist-widgets/src/chart.ts @@ -13,7 +13,7 @@ import './styles/grist-widgets.css'; import { initGristBridge, onGristOptions, getGristApiInfo } from './shared/grist-bridge.js'; import { createOptionsPanel, type OptionDef } from './shared/grist-options-panel.js'; -import { PROXY_BASE_URL } from '@dsfr-data/shared'; +import { PROXY_BASE_URL, CDN_URLS } from '@dsfr-data/shared'; const ALL_OPTIONS: OptionDef[] = [ { @@ -31,6 +31,8 @@ const ALL_OPTIONS: OptionDef[] = [ { value: 'bar-line', label: 'Barres + Lignes' }, { value: 'map', label: 'Carte departements' }, { value: 'map-reg', label: 'Carte regions' }, + { value: 'map-aca', label: 'Carte academies' }, + { value: 'map-monde', label: 'Carte monde' }, { value: 'kpi', label: 'KPI' }, ], }, @@ -149,7 +151,7 @@ function renderWidget(type: string) { chart.setAttribute('type', type); chart.setAttribute('label-field', 'Label'); chart.setAttribute('value-field', 'Value'); - if (type === 'map' || type === 'map-reg') { + if (type.startsWith('map')) { chart.setAttribute('code-field', 'Code'); } container.appendChild(chart); @@ -246,12 +248,8 @@ function generateFixedHtml(): string { } // Chart types: bar, line, pie, radar, scatter, gauge, bar-line, map, map-reg - deps.push( - '' - ); - deps.push( - '' - ); + deps.push(``); + deps.push(``); deps.push( '' ); @@ -260,7 +258,7 @@ function generateFixedHtml(): string { const horizontal = opts.horizontal === true ? ' horizontal' : ''; const stacked = opts.stacked === true ? ' stacked' : ''; const unitTooltip = opts.unitTooltip ? ` unit-tooltip="${opts.unitTooltip}"` : ''; - const codeField = type === 'map' || type === 'map-reg' ? ' code-field="Code"' : ''; + const codeField = type.startsWith('map') ? ' code-field="Code"' : ''; const hasValue2 = data.length > 0 && 'Value2' in data[0]; const valueField2 = hasValue2 ? ' value-field-2="Value2"' : ''; @@ -325,12 +323,8 @@ function generateDynamicHtml(): string { `; } - deps.push( - '' - ); - deps.push( - '' - ); + deps.push(``); + deps.push(``); deps.push( '' ); @@ -339,8 +333,7 @@ function generateDynamicHtml(): string { const horizontal = opts.horizontal === true ? ' horizontal' : ''; const stacked = opts.stacked === true ? ' stacked' : ''; const unitTooltip = opts.unitTooltip ? ` unit-tooltip="${opts.unitTooltip}"` : ''; - const codeFieldAttr = - (type === 'map' || type === 'map-reg') && codeCol ? ` code-field="fields.${codeCol}"` : ''; + const codeFieldAttr = type.startsWith('map') && codeCol ? ` code-field="fields.${codeCol}"` : ''; const valueField2 = value2Col ? ` value-field-2="fields.${value2Col}"` : ''; return `${deps.join('\n')} diff --git a/apps/grist-widgets/test-local.html b/apps/grist-widgets/test-local.html index d565c394..e9f948dc 100644 --- a/apps/grist-widgets/test-local.html +++ b/apps/grist-widgets/test-local.html @@ -11,8 +11,8 @@ - - + + diff --git a/apps/playground/index.html b/apps/playground/index.html index a638d7ca..9453a8f4 100644 --- a/apps/playground/index.html +++ b/apps/playground/index.html @@ -12,8 +12,8 @@ - - + + diff --git a/docs/THIRD-PARTY-LICENSES.md b/docs/THIRD-PARTY-LICENSES.md index fc21ed76..8cb63156 100644 --- a/docs/THIRD-PARTY-LICENSES.md +++ b/docs/THIRD-PARTY-LICENSES.md @@ -9,7 +9,7 @@ Le projet `dsfr-data` lui-même est distribué sous licence **MIT** (voir [`LICE | Paquet | Version | Licence | Usage | |---|---|---|---| | [`lit`](https://lit.dev/) | ^3.1.0 | BSD-3-Clause | Framework des Web Components | -| [`@gouvfr/dsfr-chart`](https://www.npmjs.com/package/@gouvfr/dsfr-chart) | ^2.0.4 | MIT | Composants Vue DSFR (bar/line/pie chart, map-chart) | +| [`@gouvfr/dsfr-chart`](https://github.com/GouvernementFR/dsfr-chart) | ^2.1.1 | MIT | Composants Vue DSFR (bar/line/pie chart, map-chart avec API cartes unifiee `level`) | | [`leaflet`](https://leafletjs.com/) | ^1.9.4 | BSD-2-Clause | Moteur de carte (chargé dynamiquement) | | [`leaflet.markercluster`](https://github.com/Leaflet/Leaflet.markercluster) | ^1.5.3 | MIT | Plugin clustering de markers (chargé dynamiquement) | | [`leaflet.heat`](https://github.com/Leaflet/Leaflet.heat) | ^0.2.0 | BSD-2-Clause | Plugin heatmap (chargé dynamiquement) | diff --git a/e2e/industrie-du-futur.html b/e2e/industrie-du-futur.html index 21744edb..9fdbdfaf 100644 --- a/e2e/industrie-du-futur.html +++ b/e2e/industrie-du-futur.html @@ -10,8 +10,8 @@ - - + + diff --git a/guide/examples/education-gouv-1.html b/guide/examples/education-gouv-1.html index 8df450f9..dee4c49a 100644 --- a/guide/examples/education-gouv-1.html +++ b/guide/examples/education-gouv-1.html @@ -13,9 +13,9 @@ - + - + diff --git a/guide/examples/exemple-electrifions.html b/guide/examples/exemple-electrifions.html index ed06351c..6f3ecc54 100644 --- a/guide/examples/exemple-electrifions.html +++ b/guide/examples/exemple-electrifions.html @@ -11,9 +11,9 @@ - + - + diff --git a/guide/examples/exemple-france-num.html b/guide/examples/exemple-france-num.html index 02488a63..d1ee5c0e 100644 --- a/guide/examples/exemple-france-num.html +++ b/guide/examples/exemple-france-num.html @@ -8,9 +8,9 @@ - + - + - + diff --git a/guide/examples/exemple-masa-v2.html b/guide/examples/exemple-masa-v2.html index 84f57427..db6394d1 100644 --- a/guide/examples/exemple-masa-v2.html +++ b/guide/examples/exemple-masa-v2.html @@ -9,13 +9,13 @@ - + - + diff --git a/guide/examples/observatoire-afa-v1.html b/guide/examples/observatoire-afa-v1.html index eec99fdd..2d4b21ef 100644 --- a/guide/examples/observatoire-afa-v1.html +++ b/guide/examples/observatoire-afa-v1.html @@ -6,9 +6,9 @@ AFA – Chroniques jurisprudentielles 2021 / 2022 - + - + diff --git a/guide/guide-demo-complete.html b/guide/guide-demo-complete.html index 0a4e8b9e..254277e1 100644 --- a/guide/guide-demo-complete.html +++ b/guide/guide-demo-complete.html @@ -8,8 +8,8 @@ - - + + @@ -362,15 +362,17 @@

Cartes France (données fictives)

-

Entrées simulées par région (milliers) — tableau de données :

- - Entrées simulées par région (milliers) :

+ -
+ type="map-reg" + code-field="code" + value-field="n" + name="Entrées (k)" + selected-palette="sequentialAscending" + unit-tooltip=" k entrées"> + +

Entrées simulées par département (milliers) :

diff --git a/guide/guide-exemple-ODS.html b/guide/guide-exemple-ODS.html index fc58ca84..9f236963 100644 --- a/guide/guide-exemple-ODS.html +++ b/guide/guide-exemple-ODS.html @@ -8,8 +8,8 @@ - - + + diff --git a/guide/guide-exemples-chart-a11y.html b/guide/guide-exemples-chart-a11y.html index 62078542..1c8c4441 100644 --- a/guide/guide-exemples-chart-a11y.html +++ b/guide/guide-exemples-chart-a11y.html @@ -8,8 +8,8 @@ - - + + diff --git a/guide/guide-exemples-context.html b/guide/guide-exemples-context.html index cdfd7aef..48a0f98a 100644 --- a/guide/guide-exemples-context.html +++ b/guide/guide-exemples-context.html @@ -8,8 +8,8 @@ - - + + diff --git a/guide/guide-exemples-display.html b/guide/guide-exemples-display.html index 304c6e07..24835b29 100644 --- a/guide/guide-exemples-display.html +++ b/guide/guide-exemples-display.html @@ -8,8 +8,8 @@ - - + + diff --git a/guide/guide-exemples-facets.html b/guide/guide-exemples-facets.html index ba5d36c5..84cb69fa 100644 --- a/guide/guide-exemples-facets.html +++ b/guide/guide-exemples-facets.html @@ -8,8 +8,8 @@ - - + + diff --git a/guide/guide-exemples-ghibli.html b/guide/guide-exemples-ghibli.html index 5c6ad2a6..0259a802 100644 --- a/guide/guide-exemples-ghibli.html +++ b/guide/guide-exemples-ghibli.html @@ -8,8 +8,8 @@ - - + + diff --git a/guide/guide-exemples-insee-erfs.html b/guide/guide-exemples-insee-erfs.html index ec6e1fdc..d12e2813 100644 --- a/guide/guide-exemples-insee-erfs.html +++ b/guide/guide-exemples-insee-erfs.html @@ -8,8 +8,8 @@ - - + + diff --git a/guide/guide-exemples-join.html b/guide/guide-exemples-join.html index 1ec760be..a030c67c 100644 --- a/guide/guide-exemples-join.html +++ b/guide/guide-exemples-join.html @@ -8,8 +8,8 @@ - - + + diff --git a/guide/guide-exemples-maires.html b/guide/guide-exemples-maires.html index ad546dbc..cb5793fd 100644 --- a/guide/guide-exemples-maires.html +++ b/guide/guide-exemples-maires.html @@ -8,8 +8,8 @@ - - + + diff --git a/guide/guide-exemples-normalize.html b/guide/guide-exemples-normalize.html index b7b548b3..6d715dda 100644 --- a/guide/guide-exemples-normalize.html +++ b/guide/guide-exemples-normalize.html @@ -8,8 +8,8 @@ - - + + diff --git a/guide/guide-exemples-query.html b/guide/guide-exemples-query.html index 2a10ca31..90982651 100644 --- a/guide/guide-exemples-query.html +++ b/guide/guide-exemples-query.html @@ -8,8 +8,8 @@ - - + + diff --git a/guide/guide-exemples-search.html b/guide/guide-exemples-search.html index 7cc43916..8d70dd9b 100644 --- a/guide/guide-exemples-search.html +++ b/guide/guide-exemples-search.html @@ -8,8 +8,8 @@ - - + + diff --git a/guide/guide-exemples-source.html b/guide/guide-exemples-source.html index 0e56fb4a..c99e156d 100644 --- a/guide/guide-exemples-source.html +++ b/guide/guide-exemples-source.html @@ -8,8 +8,8 @@ - - + + diff --git a/guide/guide-exemples-world-map.html b/guide/guide-exemples-world-map.html index d40be8d8..05f6a9c7 100644 --- a/guide/guide-exemples-world-map.html +++ b/guide/guide-exemples-world-map.html @@ -8,8 +8,8 @@ - - + + diff --git a/packages/app-ui/src/app-footer.ts b/packages/app-ui/src/app-footer.ts index 21f25453..c3b314d6 100644 --- a/packages/app-ui/src/app-footer.ts +++ b/packages/app-ui/src/app-footer.ts @@ -65,22 +65,26 @@ export class AppFooter extends LitElement { Charts builder est un projet open-source permettant de créer des visualisations de données conformes au Design System de l'État (DSFR).

- ${this._version - ? html`` - : ''} + ${ + this._version + ? html`` + : '' + }