@geo2france/api-dashboard 1.8.0 → 1.9.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.
@@ -1,21 +1,21 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Tooltip, Typography } from 'antd';
3
- import { FaCreativeCommons, FaCreativeCommonsBy, FaCreativeCommonsNc, FaCreativeCommonsPd, FaCreativeCommonsSa, FaCreativeCommonsZero } from 'react-icons/fa';
3
+ import { Icon } from '@iconify/react';
4
4
  const { Text, Link } = Typography;
5
5
  const LogoLicence = ({ license, style }) => {
6
6
  switch (license) {
7
7
  case "CC":
8
- return _jsx(FaCreativeCommons, { style: style });
8
+ return _jsx(Icon, { icon: "cib:creative-commons", style: style });
9
9
  case "BY":
10
- return _jsx(FaCreativeCommonsBy, { style: style });
10
+ return _jsx(Icon, { icon: "cib:creative-commons-by", style: style });
11
11
  case "NC":
12
- return _jsx(FaCreativeCommonsNc, { style: style });
12
+ return _jsx(Icon, { icon: "cib:creative-commons-nc", style: style });
13
13
  case "PD":
14
- return _jsx(FaCreativeCommonsPd, { style: style });
14
+ return _jsx(Icon, { icon: "cib:creative-commons-pd", style: style });
15
15
  case "SA":
16
- return _jsx(FaCreativeCommonsSa, { style: style });
16
+ return _jsx(Icon, { icon: "cib:creative-commons-sa", style: style });
17
17
  case "ZERO":
18
- return _jsx(FaCreativeCommonsZero, { style: style });
18
+ return _jsx(Icon, { icon: "cib:creative-commons-zero", style: style });
19
19
  }
20
20
  };
21
21
  const Attribution = ({ data, style, licenses }) => {
@@ -1,20 +1,17 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useContext, useEffect } from "react";
3
2
  import { useDataset } from "../Dataset/hooks";
4
- import { ChartBlockContext } from "../DashboardPage/Block";
5
3
  import { usePalette } from "../Palette/Palette";
6
4
  import { from, op } from "arquero";
7
5
  import { ChartEcharts } from "./ChartEcharts";
8
6
  import { merge_others } from "../..";
7
+ import { useBlockConfig } from "../DashboardPage/Block";
9
8
  export const ChartPie = ({ dataset: dataset_id, nameKey, dataKey, unit, title, donut = false, other = 5 }) => {
10
9
  const dataset = useDataset(dataset_id);
11
- const blockConfig = useContext(ChartBlockContext);
12
10
  const data = dataset?.data;
13
- const block_config = {
11
+ useBlockConfig({
14
12
  title: title,
15
13
  dataExport: data
16
- };
17
- useEffect(() => blockConfig?.setConfig(block_config), [data]);
14
+ });
18
15
  const chart_data1 = data && data.length > 0
19
16
  ? from(data)
20
17
  .groupby(nameKey)
@@ -0,0 +1,64 @@
1
+ import { ReactElement } from "react";
2
+ type comparwithType = "first" | "previous";
3
+ interface StatisticsProps {
4
+ /** Identifiant du jeu de données */
5
+ dataset: string;
6
+ /** Nom de la colonne qui contient les valeurs */
7
+ dataKey: string;
8
+ /** Texte à afficher après l'évolution */
9
+ evolutionSuffix?: string;
10
+ /** Afficher l'évolution en % (sinon dans la même unité que la valeur) */
11
+ relativeEvolution?: boolean;
12
+ /** Titre */
13
+ title?: string;
14
+ /** Couleur */
15
+ color?: string;
16
+ /** Unité de la valeur */
17
+ unit?: string;
18
+ /** Inverser les couleurs (rouge/vert) de l'évolution */
19
+ invertColor?: boolean;
20
+ /** Icône (composant ou nom de l'icône sur Iconify.js ) */
21
+ icon?: ReactElement | string;
22
+ /** Texte à afficher dans le tooltip d'aide */
23
+ help?: string;
24
+ /** Comparer la valeur avec la précédente ou la première du jeu de données */
25
+ compareWith?: comparwithType;
26
+ }
27
+ /**
28
+ * Composant `Statistics` affichant une valeur d'un dataset avec son évolution.
29
+ *
30
+ * Affiche :
31
+ * - La dernière valeur du dataset
32
+ * - Unité et picto
33
+ * - Évolution par rapport à la première ou l'avant-dernière valeur
34
+ * - Couleur selon évolution positive/négative
35
+ * - Tooltip d'aide si fourni
36
+ *
37
+ * @param {StatisticsProps} props - Propriétés du composant
38
+ * @returns {ReactElement} Carte statistique
39
+ */
40
+ export declare const Statistics: React.FC<StatisticsProps>;
41
+ type StatisticsCollectionProps = {
42
+ /**
43
+ * Un ou plusieurs composants `<Statistics>`.
44
+ */
45
+ children: ReactElement<typeof Statistics> | ReactElement<typeof Statistics>[];
46
+ /**
47
+ * Nombre de colonnes (défaut : 3)
48
+ */
49
+ columns?: number;
50
+ /**
51
+ * Titre du bloc.
52
+ */
53
+ title?: string;
54
+ };
55
+ /**
56
+ * `StatisticsCollection` permet de regrouper plusieurs cartes statistiques
57
+ * dans un bloc
58
+ *
59
+ * @param {StatisticsProps} props - Propriétés du composant
60
+ * @returns {ReactElement} Collection de cartes statistiques
61
+ * ```
62
+ */
63
+ export declare const StatisticsCollection: React.FC<StatisticsCollectionProps>;
64
+ export {};
@@ -0,0 +1,61 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { QuestionCircleOutlined } from "@ant-design/icons";
3
+ import { Avatar, Card, Col, Flex, Row, Tooltip, Typography } from "antd";
4
+ import { Children } from "react";
5
+ import { useDataset } from "../Dataset/hooks";
6
+ import { Icon } from "@iconify/react";
7
+ import { useBlockConfig } from "../DashboardPage/Block";
8
+ const { Text, Paragraph } = Typography;
9
+ // DEV : modele cf https://bootstrapbrain.com/component/bootstrap-statistics-card-example/
10
+ /**
11
+ * Composant `Statistics` affichant une valeur d'un dataset avec son évolution.
12
+ *
13
+ * Affiche :
14
+ * - La dernière valeur du dataset
15
+ * - Unité et picto
16
+ * - Évolution par rapport à la première ou l'avant-dernière valeur
17
+ * - Couleur selon évolution positive/négative
18
+ * - Tooltip d'aide si fourni
19
+ *
20
+ * @param {StatisticsProps} props - Propriétés du composant
21
+ * @returns {ReactElement} Carte statistique
22
+ */
23
+ export const Statistics = ({ dataset: dataset_id, dataKey, unit, evolutionSuffix, title, icon: icon_input, color, invertColor = false, help, compareWith, relativeEvolution = false }) => {
24
+ const icon = typeof icon_input === "string" ? _jsx(Icon, { icon: icon_input }) : icon_input;
25
+ const dataset = useDataset(dataset_id);
26
+ const value = dataset?.data?.slice(-1)[0][dataKey]; // Dernière valeur du dataset
27
+ const compare_value = compareWith === 'previous' ? dataset?.data?.slice(-2)[0][dataKey] : dataset?.data?.slice(0, 1)[0][dataKey]; //Première ou avant dernière
28
+ const evolution = relativeEvolution ? 100 * ((value - compare_value) / compare_value) : value - compare_value;
29
+ const evolution_unit = relativeEvolution ? '%' : unit;
30
+ const evolution_is_good = invertColor ? evolution < 0 : evolution > 0;
31
+ const tooltip = help && _jsx(Tooltip, { title: help, children: _jsx(QuestionCircleOutlined, {}) });
32
+ return (_jsx(Card, { title: title, style: {
33
+ borderLeft: `4px solid ${color}`,
34
+ height: "100%"
35
+ }, styles: {
36
+ body: {
37
+ padding: 16,
38
+ paddingTop: 8,
39
+ paddingBottom: 8
40
+ },
41
+ header: {
42
+ padding: "5px",
43
+ paddingLeft: "15px",
44
+ fontSize: 14,
45
+ minHeight: 35,
46
+ },
47
+ }, extra: tooltip, children: _jsxs(Flex, { vertical: true, children: [_jsxs(Flex, { justify: "space-between", align: "center", children: [_jsxs(Text, { style: { fontSize: "150%", paddingTop: 8, paddingBottom: 8, paddingLeft: 0 }, children: [value?.toLocaleString(), " ", unit] }), icon && _jsx(Avatar, { size: 32 + 8, icon: icon, style: { backgroundColor: color } })] }), evolution && _jsxs(Paragraph, { style: { marginBottom: "0.5rem" }, children: [_jsxs(Text, { strong: true, type: evolution_is_good ? "success" : "danger", style: { fontSize: "120%" }, children: [evolution < 0.1 ? '' : '+', evolution.toLocaleString(undefined, { maximumFractionDigits: 1 }), "\u00A0", evolution_unit] }), " ", _jsx(Text, { italic: true, type: "secondary", children: evolutionSuffix })] })] }) }));
48
+ };
49
+ /**
50
+ * `StatisticsCollection` permet de regrouper plusieurs cartes statistiques
51
+ * dans un bloc
52
+ *
53
+ * @param {StatisticsProps} props - Propriétés du composant
54
+ * @returns {ReactElement} Collection de cartes statistiques
55
+ * ```
56
+ */
57
+ export const StatisticsCollection = ({ children, columns = 3, title }) => {
58
+ const arrayChildren = Children.toArray(children);
59
+ useBlockConfig({ title: title });
60
+ return (_jsx(Row, { gutter: [8, 8], children: arrayChildren.map((c, index) => (_jsx(Col, { xl: 24 / columns, xs: 24, children: c }, index))) }));
61
+ };
@@ -6,20 +6,17 @@ import { from, op } from "arquero";
6
6
  import { useDataset } from "../Dataset/hooks";
7
7
  import { usePalette } from "../Palette/Palette";
8
8
  import { ChartEcharts } from "./ChartEcharts";
9
- import { useContext, useEffect } from "react";
10
- import { ChartBlockContext } from "../DashboardPage/Block";
9
+ import { useBlockConfig } from "../DashboardPage/Block";
11
10
  export const ChartYearSerie = ({ dataset: dataset_id, categoryKey, valueKey, yearKey, yearMark, stack: stack_input, title, type: chart_type = 'bar' }) => {
12
11
  const stack = stack_input || chart_type == 'line' ? false : true; // Pas de stack par défaut pour le type line
13
12
  const dataset = useDataset(dataset_id);
14
13
  const data = dataset?.data;
15
14
  let chart_data = [];
16
15
  let distinct_cat = [];
17
- const blockConfig = useContext(ChartBlockContext); //TODO : créer un hook pour simplifier la config du block
18
- const block_config = {
16
+ useBlockConfig({
19
17
  title: title,
20
18
  dataExport: data
21
- };
22
- useEffect(() => blockConfig?.setConfig(block_config), [title, data]);
19
+ });
23
20
  if (data && data.length > 0) {
24
21
  const grouped_data = categoryKey ? from(data).groupby(yearKey, categoryKey) //Somme par année et categorykey
25
22
  .rollup({ [valueKey]: op.sum(valueKey) })
@@ -19,7 +19,8 @@ export const Select = ({ name, dataset: datasetSource, options: input_options =
19
19
  if (data_options === undefined) {
20
20
  return _jsx(_Fragment, {});
21
21
  }
22
- return (_jsx(NextPrevSelect, { name: name, options: data_options, defaultValue: initial_value == null || initial_value == false
23
- ? undefined
24
- : initial_value, arrows: arrows, optionFilterProp: "label", ...rest }));
22
+ const value = initial_value == null || initial_value == false
23
+ ? undefined
24
+ : initial_value;
25
+ return (_jsx(NextPrevSelect, { name: name, options: data_options, defaultValue: value, value: value, arrows: arrows, optionFilterProp: "label", ...rest }));
25
26
  };
@@ -1,6 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { DownloadOutlined, FileImageOutlined, FullscreenOutlined, MoreOutlined, } from "@ant-design/icons";
3
- import { HiQuestionMarkCircle } from "react-icons/hi2";
2
+ import { DownloadOutlined, FileImageOutlined, FullscreenOutlined, MoreOutlined, QuestionCircleOutlined, } from "@ant-design/icons";
4
3
  import { Card, theme, Modal, Dropdown, Flex, Button, Popover, Typography } from "antd";
5
4
  import React, { createContext, useEffect, useState } from "react";
6
5
  import Attribution from "../Attributions/Attributions";
@@ -103,6 +102,6 @@ const DashboardElement = ({ children, title, header = true, attributions, isFetc
103
102
  }, variant: virtual ? 'borderless' : 'outlined', title: header && !virtual &&
104
103
  _jsxs(Flex, { justify: "space-between", align: "center", children: [_jsx("span", { style: { overflow: "hidden", paddingRight: 15 }, children: title }), _jsx("div", { style: { marginRight: 5, fontSize: 16 }, children: toolbox && dropdown_toolbox })] }), children: _jsxs(Flex, { vertical: true, justify: "space-between", style: { height: "100%" }, children: [_jsx(chartContext.Provider, { value: { chartRef, setchartRef, setData, setNodata }, children: _jsx(LoadingContainer, { isFetching: isFetching, noData: nodata, children: children }) }), _jsxs(Flex, { justify: "flex-end", align: "flex-end", style: { marginRight: 5 }, children: [attributions && (_jsx("div", { style: { marginTop: "auto" }, children: _jsx(Attribution, { licenses: licenses, data: attributions }) })), description && (_jsx(Popover, { content: _jsx("div", { style: { maxWidth: 800 }, children: typeof description === "string" ?
105
104
  _jsxs(Text, { italic: true, type: "secondary", children: [" ", description, " "] })
106
- : _jsx(_Fragment, { children: description }) }), children: _jsx(Button, { type: "link", icon: _jsx(HiQuestionMarkCircle, {}), style: { fontSize: "150%" } }) }))] })] }) }), toolbox && fullscreen && (_jsxs(Modal, { forceRender: true, title: title, open: modalIsOpen, onCancel: () => setModalIsOpen(false), onOk: () => setModalIsOpen(false), footer: null, wrapClassName: "modal-fullscreen", children: [fullscreenChildren, attributions && _jsx(Attribution, { data: attributions })] }))] }));
105
+ : _jsx(_Fragment, { children: description }) }), children: _jsx(Button, { type: "link", icon: _jsx(QuestionCircleOutlined, {}), style: { fontSize: "150%" } }) }))] })] }) }), toolbox && fullscreen && (_jsxs(Modal, { forceRender: true, title: title, open: modalIsOpen, onCancel: () => setModalIsOpen(false), onOk: () => setModalIsOpen(false), footer: null, wrapClassName: "modal-fullscreen", children: [fullscreenChildren, attributions && _jsx(Attribution, { data: attributions })] }))] }));
107
106
  };
108
107
  export default DashboardElement;
@@ -12,4 +12,5 @@ interface IChartBlockProps {
12
12
  children: React.ReactElement;
13
13
  }
14
14
  export declare const DSL_ChartBlock: React.FC<IChartBlockProps>;
15
+ export declare const useBlockConfig: ({ title, dataExport }: ChartBlockConfig) => void;
15
16
  export {};
@@ -1,9 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Card, Dropdown, theme } from "antd";
3
- import { createContext, useId, useState } from "react";
4
- import { FaFileCsv } from "react-icons/fa";
5
- import { AiOutlineMore } from "react-icons/ai";
3
+ import { createContext, useContext, useEffect, useId, useState } from "react";
4
+ import { Icon } from "@iconify/react";
6
5
  import { ProducersFooter } from "../Dataset/Producer";
6
+ import { MoreOutlined } from '@ant-design/icons';
7
7
  const { useToken } = theme;
8
8
  export const ChartBlockContext = createContext(undefined);
9
9
  export const DSL_ChartBlock = ({ children }) => {
@@ -13,12 +13,12 @@ export const DSL_ChartBlock = ({ children }) => {
13
13
  const menu_items = [
14
14
  {
15
15
  key: "export_data_csv",
16
- label: (_jsxs("a", { onClick: () => handleExportData(), children: [_jsx(FaFileCsv, {}), " CSV"] })),
16
+ label: (_jsxs("a", { onClick: () => handleExportData(), children: [_jsx(Icon, { icon: "hugeicons:csv-01" }), " CSV"] })),
17
17
  disabled: config.dataExport === undefined
18
18
  },
19
19
  ];
20
20
  const has_action = menu_items.some(item => !item.disabled);
21
- const dropdown_toolbox = (_jsx(Dropdown, { menu: { items: menu_items }, children: _jsx("a", { style: { color: token.colorTextBase }, children: _jsx(AiOutlineMore, {}) }) }));
21
+ const dropdown_toolbox = (_jsx(Dropdown, { menu: { items: menu_items }, children: _jsx("a", { style: { color: token.colorTextBase }, children: _jsx(MoreOutlined, {}) }) }));
22
22
  const handleExportData = () => {
23
23
  console.log('datadl');
24
24
  console.log(config.dataExport);
@@ -38,3 +38,10 @@ export const DSL_ChartBlock = ({ children }) => {
38
38
  };
39
39
  return (_jsx(ChartBlockContext.Provider, { value: { config: config, setConfig: (e) => setConfig(e) }, children: _jsxs(Card, { style: { height: '100%' }, extra: has_action && dropdown_toolbox, title: config.title, children: [children, _jsx(ProducersFooter, { component: children })] }) }));
40
40
  };
41
+ export const useBlockConfig = ({ title, dataExport }) => {
42
+ const blockContext = useContext(ChartBlockContext);
43
+ useEffect(() => blockContext?.setConfig({
44
+ title: title,
45
+ dataExport: dataExport
46
+ }), [title, dataExport]);
47
+ };
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
2
2
  import { Badge, Collapse, Divider, FloatButton, Modal, theme, Typography } from "antd";
3
3
  import { DataPreview, PalettePreview } from "../../dsl";
4
4
  import { useAllDatasets } from "../Dataset/hooks";
5
- import { AiOutlineBug } from "react-icons/ai";
5
+ import { BugOutlined } from "@ant-design/icons";
6
6
  import { useState } from "react";
7
7
  import { DatasetBadgeStatus } from "../Dataset/DataPreview";
8
8
  import { ControlPreview } from "../Control/Control";
@@ -20,5 +20,5 @@ export const Debug = () => {
20
20
  label: _jsxs("span", { children: [_jsx(DatasetBadgeStatus, { isError: dataset?.isError, isFetching: dataset?.isFetching }), " ", dataset.id, " ", " ", _jsxs(Text, { type: "secondary", children: [" ", dataset?.resource, " "] }), " ", _jsx(Badge, { color: token.colorInfo, overflowCount: 9999, count: dataset?.data?.length })] }),
21
21
  children: _jsx(DataPreview, { dataset: dataset.id, pageSize: 3 })
22
22
  }));
23
- return (_jsxs(_Fragment, { children: [_jsx(FloatButton, { icon: _jsx(AiOutlineBug, {}), type: "primary", onClick: () => setIsModalOpen(true), style: { top: 5 }, className: "debugFloatButton" }), ";", _jsxs(Modal, { title: "Information concepteur", width: "90%", centered: true, styles: { content: { 'width': "100%", padding: 36 } }, closable: { 'aria-label': 'Custom Close Button' }, open: isModalOpen, onCancel: () => setIsModalOpen(false), footer: null, children: [_jsx(Title, { level: 5, children: "Jeux de donn\u00E9es " }), _jsx(Collapse, { accordion: true, items: items }), _jsx(Divider, {}), _jsx(Title, { level: 5, children: "Contr\u00F4les utilisateur " }), _jsx(ControlPreview, {}), _jsx(Divider, {}), _jsx(Title, { level: 5, children: "Palette " }), _jsx(PalettePreview, {})] })] }));
23
+ return (_jsxs(_Fragment, { children: [_jsx(FloatButton, { icon: _jsx(BugOutlined, {}), type: "primary", onClick: () => setIsModalOpen(true), style: { top: 5 }, className: "debugFloatButton" }), ";", _jsxs(Modal, { title: "Information concepteur", width: "90%", centered: true, styles: { content: { 'width': "100%", padding: 36 } }, closable: { 'aria-label': 'Custom Close Button' }, open: isModalOpen, onCancel: () => setIsModalOpen(false), footer: null, children: [_jsx(Title, { level: 5, children: "Jeux de donn\u00E9es " }), _jsx(Collapse, { accordion: true, items: items }), _jsx(Divider, {}), _jsx(Title, { level: 5, children: "Contr\u00F4les utilisateur " }), _jsx(ControlPreview, {}), _jsx(Divider, {}), _jsx(Title, { level: 5, children: "Palette " }), _jsx(PalettePreview, {})] })] }));
24
24
  };
@@ -2,8 +2,8 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
2
2
  import { useRef } from 'react';
3
3
  import { Button, Card, Typography } from "antd";
4
4
  import { useState } from "react";
5
- import { BsInfoCircle, BsInfoCircleFill } from "react-icons/bs";
6
5
  import { cardStyles } from "../../utils/cardStyles";
6
+ import { InfoCircleFilled, InfoCircleOutlined } from "@ant-design/icons";
7
7
  const { Text } = Typography;
8
8
  /**
9
9
  * Une card qui peux se retourner et afficher des informations a son verso
@@ -19,7 +19,7 @@ const FlipCard = ({ title, information, children }) => {
19
19
  width: "100%",
20
20
  };
21
21
  const InfoButton = ({ filled = false }) => {
22
- return (_jsx(Button, { type: "text", shape: "circle", "aria-label": "info", onClick: toggleFlipped, children: filled ? _jsx(BsInfoCircleFill, {}) : _jsx(BsInfoCircle, {}) }));
22
+ return (_jsx(Button, { type: "text", shape: "circle", "aria-label": "info", onClick: toggleFlipped, children: filled ? _jsx(InfoCircleFilled, {}) : _jsx(InfoCircleOutlined, {}) }));
23
23
  };
24
24
  return (_jsxs("div", { style: { position: "relative", height: "100%" }, children: [_jsx(Card, { title: title, extra: _jsxs(_Fragment, { children: [information && _jsx(InfoButton, { filled: flipped }), " "] }), style: {
25
25
  transform: flipped ? "rotateY(180deg)" : "",
@@ -2,9 +2,9 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useContext, useState } from "react";
3
3
  import { Layout, Menu, theme, Row, Col, Button, Divider } from "antd";
4
4
  import { NavLink, useLocation } from "react-router-dom";
5
- import { MdOutlineKeyboardDoubleArrowLeft, MdOutlineKeyboardDoubleArrowRight } from "react-icons/md";
6
5
  import { generateMenuItems } from "../../utils/route_utils";
7
6
  import { AppContext } from "./DashboardApp";
7
+ import { Icon } from "@iconify/react";
8
8
  const style_img = {
9
9
  height: 52,
10
10
  maxWidth: "100%",
@@ -41,7 +41,7 @@ const DashboardSider = ({ style, logo, route_config }) => {
41
41
  }, children: [_jsx(NavLink, { to: "", style: {
42
42
  display: collapsed ? 'none' : undefined,
43
43
  marginTop: 8, marginLeft: 8
44
- }, children: _jsx("img", { style: style_img, src: appLogo, alt: title }) }), _jsx(Divider, { style: { display: collapsed ? 'none' : undefined }, type: "vertical" }), _jsx(Button, { type: "text", onClick: () => setCollapsed(!collapsed), icon: collapsed ? _jsx(MdOutlineKeyboardDoubleArrowRight, {}) : _jsx(MdOutlineKeyboardDoubleArrowLeft, {}), style: {
44
+ }, children: _jsx("img", { style: style_img, src: appLogo, alt: title }) }), _jsx(Divider, { style: { display: collapsed ? 'none' : undefined }, type: "vertical" }), _jsx(Button, { type: "text", onClick: () => setCollapsed(!collapsed), icon: collapsed ? _jsx(Icon, { icon: "material-symbols:keyboard-double-arrow-right-rounded" }) : _jsx(Icon, { icon: "material-symbols:keyboard-double-arrow-left-rounded" }), style: {
45
45
  fontSize: '28px',
46
46
  width: 32,
47
47
  height: 32,
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useEffect, useRef, useState } from "react";
3
3
  import { Empty, Spin, theme } from 'antd';
4
- import { PiEmptyFill } from "react-icons/pi";
4
+ import { Icon } from '@iconify/react';
5
5
  /**
6
6
  * Composant qui ajoute un effet de flou pendant le chargement (si temps de chargement > delay) et affiche un spinner au centre du contenu.
7
7
  * @param isLoading Indique si le chargement est en cours ou non
@@ -28,6 +28,6 @@ const LoadingContainer = ({ isFetching, children, blurRadius = '10px', delay = 5
28
28
  return (_jsxs(_Fragment, { children: [_jsx("div", { style: {
29
29
  filter: blur ? `blur(${blurRadius})` : undefined,
30
30
  display: noData ? "none" : undefined
31
- }, children: children }), noData && _jsx(Empty, { style: { position: "relative", top: "50%", right: "50%", marginBottom: 50, transform: "translate(50%, -50%)" }, description: "Pas de donn\u00E9es disponibles", image: _jsx(PiEmptyFill, { size: 80, color: token.colorPrimary }) }), blur ? _jsx(Spin, { size: "large", style: { position: 'absolute', left: '50%', top: '50%' } }) : _jsx(_Fragment, {})] }));
31
+ }, children: children }), noData && _jsx(Empty, { style: { position: "relative", top: "50%", right: "50%", marginBottom: 50, transform: "translate(50%, -50%)" }, description: "Pas de donn\u00E9es disponibles", image: _jsx(Icon, { icon: "ph:empty-fill", width: 80, color: token.colorPrimary }) }), blur ? _jsx(Spin, { size: "large", style: { position: 'absolute', left: '50%', top: '50%' } }) : _jsx(_Fragment, {})] }));
32
32
  };
33
33
  export default LoadingContainer;
@@ -27,7 +27,7 @@ const NextPrevSelect = ({ name, options: input_options = [], style, value, defau
27
27
  const [current_value, setCurrent_value] = useState(value);
28
28
  const form = Form.useFormInstance();
29
29
  useEffect(() => {
30
- setCurrent_value(value);
30
+ value && handleChange(value);
31
31
  }, [value]);
32
32
  const options = list_to_options(input_options);
33
33
  const current_index = options?.findIndex((o) => o.value == form?.getFieldValue(name) || o.value == current_value);
@@ -16,4 +16,6 @@ import { Palette, usePalette, PalettePreview } from "../components/Palette/Palet
16
16
  import { Debug } from "../components/Debug/Debug";
17
17
  import { Join } from "../components/Dataset/Join";
18
18
  import { ChartEcharts } from "../components/Charts/ChartEcharts";
19
- export { Dashboard, Dataset, Provider, Transform, Join, Filter, DataPreview, ChartEcharts, ChartPie, ChartYearSerie, useDataset, useDatasets, useAllDatasets, Producer, Control, useControl, useAllControls, Radio, Select, Input, Palette, usePalette, PalettePreview, Debug, };
19
+ import { useBlockConfig } from "../components/DashboardPage/Block";
20
+ import { Statistics, StatisticsCollection } from "../components/Charts/Statistics";
21
+ export { Dashboard, Dataset, Provider, Transform, Join, Filter, DataPreview, ChartEcharts, ChartPie, ChartYearSerie, Statistics, StatisticsCollection, useDataset, useDatasets, useAllDatasets, useBlockConfig, Producer, Control, useControl, useAllControls, Radio, Select, Input, Palette, usePalette, PalettePreview, Debug, };
package/dist/dsl/index.js CHANGED
@@ -16,4 +16,6 @@ import { Palette, usePalette, PalettePreview } from "../components/Palette/Palet
16
16
  import { Debug } from "../components/Debug/Debug";
17
17
  import { Join } from "../components/Dataset/Join";
18
18
  import { ChartEcharts } from "../components/Charts/ChartEcharts";
19
- export { Dashboard, Dataset, Provider, Transform, Join, Filter, DataPreview, ChartEcharts, ChartPie, ChartYearSerie, useDataset, useDatasets, useAllDatasets, Producer, Control, useControl, useAllControls, Radio, Select, Input, Palette, usePalette, PalettePreview, Debug, };
19
+ import { useBlockConfig } from "../components/DashboardPage/Block";
20
+ import { Statistics, StatisticsCollection } from "../components/Charts/Statistics";
21
+ export { Dashboard, Dataset, Provider, Transform, Join, Filter, DataPreview, ChartEcharts, ChartPie, ChartYearSerie, Statistics, StatisticsCollection, useDataset, useDatasets, useAllDatasets, useBlockConfig, Producer, Control, useControl, useAllControls, Radio, Select, Input, Palette, usePalette, PalettePreview, Debug, };
@@ -0,0 +1,7 @@
1
+ import { SimpleRecord } from "../types";
2
+ interface BlocConfig {
3
+ title?: string;
4
+ dataExport?: SimpleRecord[];
5
+ }
6
+ export declare const useBlockConfig: ({ title, dataExport }: BlocConfig) => void;
7
+ export {};
@@ -0,0 +1,9 @@
1
+ import { useContext, useEffect } from "react";
2
+ import { ChartBlockContext } from "../components/DashboardPage/Block";
3
+ export const useBlockConfig = ({ title, dataExport }) => {
4
+ const blockContext = useContext(ChartBlockContext);
5
+ useEffect(() => blockContext?.setConfig({
6
+ title: title,
7
+ dataExport: dataExport
8
+ }), [title, dataExport]);
9
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geo2france/api-dashboard",
3
- "version": "1.8.0",
3
+ "version": "1.9.1",
4
4
  "private": false,
5
5
  "description": "Build dashboards with JSX/TSX",
6
6
  "main": "dist/index.js",
@@ -45,6 +45,7 @@
45
45
  "test": "jest --watchAll"
46
46
  },
47
47
  "dependencies": {
48
+ "@iconify/react": "^6.0.1",
48
49
  "alasql": "^4.6.6",
49
50
  "arquero": "^8.0.3",
50
51
  "axios": "^1.7.4",
@@ -57,6 +58,7 @@
57
58
  "xlsx": "https://cdn.sheetjs.com/xlsx-0.20.2/xlsx-0.20.2.tgz"
58
59
  },
59
60
  "devDependencies": {
61
+ "@iconify/json": "^2.2.382",
60
62
  "@tanstack/react-query": "^5.51.11",
61
63
  "@testing-library/dom": "^10.4.0",
62
64
  "@testing-library/jest-dom": "^6.5.0",
@@ -90,7 +92,6 @@
90
92
  "antd": "^5.18.3",
91
93
  "react": "^18.3.1",
92
94
  "react-dom": "^18.3.1",
93
- "react-icons": "5.4",
94
95
  "react-map-gl": "^7.1.7",
95
96
  "react-router-dom": "^6.25.1"
96
97
  }