origam 2.37.36 → 2.37.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/src/components/Chart/OrigamChartCartesian.vue +12 -8
- package/dist/src/composables/Chart/chart-size.composable.cjs +21 -0
- package/dist/src/composables/Chart/chart-size.composable.d.ts +18 -0
- package/dist/src/composables/Chart/chart-size.composable.js +8 -0
- package/dist/src/composables/Commons/resizeObserver.composable.d.ts +1 -1
- package/dist/src/composables/index.cjs +12 -0
- package/dist/src/composables/index.d.ts +1 -0
- package/dist/src/composables/index.js +1 -0
- package/dist/src/interfaces/Commons/resizeObserver.interface.d.ts +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -18,6 +18,18 @@ This project follows [Semantic Versioning](https://semver.org).
|
|
|
18
18
|
|
|
19
19
|
## [Unreleased]
|
|
20
20
|
|
|
21
|
+
## [2.37.37] - 2026-11-04
|
|
22
|
+
|
|
23
|
+
### Fixed — `OrigamChartCartesian` : la surface de dessin suit la largeur réelle du conteneur (#1317)
|
|
24
|
+
|
|
25
|
+
Le `viewBox` était figé à une taille fixe : le chart s'étirait sans recalculer ses axes ni ses marges.
|
|
26
|
+
|
|
27
|
+
- Nouveau composable `useChartSize` (`composables/Chart/chart-size.composable.ts`), construit sur `useResizeObserver` : il mesure le `<svg>` et recalcule le `viewBox`. En SSR et avant la première mesure, il retombe sur 600×360.
|
|
28
|
+
- `useResizeObserver` et `IResizeState` deviennent génériques (`<T extends Element = HTMLElement>`) pour observer un `SVGSVGElement`. Le défaut est inchangé pour les autres appelants.
|
|
29
|
+
- Seul le chart cartésien est branché. Les textes et les traits s'expriment désormais en px réels (documenté). Les autres charts sont suivis dans #1324.
|
|
30
|
+
- Vérifié : la spec `chart-cartesian-responsive-width.spec.ts`, inscrite dans `GREEN_SPECS`, est rouge sur le parent (écarts de `viewBox` de 229 px et de 36 px) et verte avec le correctif. Le TU SSR passe sans warning (PR #1323).
|
|
31
|
+
- Hors périmètre : le chevauchement des étiquettes d'axe à faible largeur, suivi dans #1325.
|
|
32
|
+
|
|
21
33
|
## [2.37.36] - 2026-11-04
|
|
22
34
|
|
|
23
35
|
### Fixed — Charts : le `<svg>` porte `role="group"` au lieu de `role="img"` (#1318, #1153)
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
data-cy="origam-chart-cartesian-body"
|
|
81
81
|
>
|
|
82
82
|
<svg
|
|
83
|
-
ref="
|
|
83
|
+
:ref="setSvgRef"
|
|
84
84
|
class="origam-chart-cartesian__svg origam-chart__svg"
|
|
85
85
|
:class="svgClasses"
|
|
86
86
|
:viewBox="viewBox"
|
|
@@ -493,6 +493,7 @@ import {
|
|
|
493
493
|
} from "vue";
|
|
494
494
|
import { useChartHeaderTypography } from "../../composables/Chart/chart-header-typography.composable";
|
|
495
495
|
import { useChartAnimationStyle } from "../../composables/Chart/chart-animation.composable";
|
|
496
|
+
import { useChartSize } from "../../composables/Chart/chart-size.composable";
|
|
496
497
|
import { useBackgroundColor } from "../../composables/Commons/backgroundColor.composable";
|
|
497
498
|
import { useChart } from "../../composables/Chart/chart.composable";
|
|
498
499
|
import { useChartZoom } from "../../composables/Chart/chart-zoom.composable";
|
|
@@ -680,11 +681,14 @@ const { paddingClasses, paddingStyles } = usePadding(props);
|
|
|
680
681
|
const { roundedClasses, roundedStyles } = useRounded(props);
|
|
681
682
|
const { headerTypographyStyles } = useChartHeaderTypography(props);
|
|
682
683
|
const chartAnimationStyle = useChartAnimationStyle(props);
|
|
683
|
-
const
|
|
684
|
-
const SVG_HEIGHT = 360;
|
|
684
|
+
const { resizeRef: svgSizeRef, width: svgWidth, height: svgHeight } = useChartSize({ width: 600, height: 360 });
|
|
685
685
|
const PADDING_DEFAULT = { top: 24, right: 24, bottom: 36, left: 48 };
|
|
686
686
|
const PADDING_WITH_SECONDARY_AXIS = { top: 24, right: 56, bottom: 36, left: 48 };
|
|
687
687
|
const svgRef = ref(null);
|
|
688
|
+
const setSvgRef = (el) => {
|
|
689
|
+
svgRef.value = el;
|
|
690
|
+
svgSizeRef.value = el;
|
|
691
|
+
};
|
|
688
692
|
const mousePos = ref({ x: 0, y: 0 });
|
|
689
693
|
const hasSecondaryAxis = computed(
|
|
690
694
|
() => Boolean(props.secondaryYAxis) || activeSeries.value.some((s) => (s.yAxis ?? 0) === 1)
|
|
@@ -786,8 +790,8 @@ const chart = useChart({
|
|
|
786
790
|
smoothing: () => props.smoothing,
|
|
787
791
|
yMin: () => props.yMin,
|
|
788
792
|
yMax: () => props.yMax,
|
|
789
|
-
width: () =>
|
|
790
|
-
height: () =>
|
|
793
|
+
width: () => svgWidth.value,
|
|
794
|
+
height: () => svgHeight.value,
|
|
791
795
|
padding: () => chartPadding.value,
|
|
792
796
|
secondaryYAxis: () => props.secondaryYAxis
|
|
793
797
|
});
|
|
@@ -967,7 +971,7 @@ const svgToCategoryIndex = (clientX) => {
|
|
|
967
971
|
const svgEl = svgRef.value;
|
|
968
972
|
if (!svgEl) return 0;
|
|
969
973
|
const rect = svgEl.getBoundingClientRect();
|
|
970
|
-
const domRatio =
|
|
974
|
+
const domRatio = svgWidth.value / Math.max(1, rect.width);
|
|
971
975
|
const svgX = (clientX - rect.left) * domRatio;
|
|
972
976
|
return pxToCategoryIndex(svgX, plot.value.x0, plot.value.x1);
|
|
973
977
|
};
|
|
@@ -1018,7 +1022,7 @@ const onSvgWheel = (event) => {
|
|
|
1018
1022
|
const svgEl = svgRef.value;
|
|
1019
1023
|
if (!svgEl) return;
|
|
1020
1024
|
const rect = svgEl.getBoundingClientRect();
|
|
1021
|
-
const domRatio =
|
|
1025
|
+
const domRatio = svgWidth.value / Math.max(1, rect.width);
|
|
1022
1026
|
const svgX = (event.clientX - rect.left) * domRatio;
|
|
1023
1027
|
const { x0, x1 } = plot.value;
|
|
1024
1028
|
const plotWidth = Math.max(1, x1 - x0);
|
|
@@ -1039,7 +1043,7 @@ const dragSelectionRect = computed(() => {
|
|
|
1039
1043
|
const svgEl = svgRef.value;
|
|
1040
1044
|
if (!svgEl) return null;
|
|
1041
1045
|
const rect = svgEl.getBoundingClientRect();
|
|
1042
|
-
const domRatio =
|
|
1046
|
+
const domRatio = svgWidth.value / Math.max(1, rect.width);
|
|
1043
1047
|
const startSvgX = (dragStartPx.value - rect.left) * domRatio;
|
|
1044
1048
|
const endSvgX = (dragEndPx.value - rect.left) * domRatio;
|
|
1045
1049
|
const { x0, x1, y0, y1 } = plot.value;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useChartSize = useChartSize;
|
|
7
|
+
var _vue = require("vue");
|
|
8
|
+
var _resizeObserver = require("../Commons/resizeObserver.composable.cjs");
|
|
9
|
+
function useChartSize(fallback) {
|
|
10
|
+
const {
|
|
11
|
+
resizeRef,
|
|
12
|
+
contentRect
|
|
13
|
+
} = (0, _resizeObserver.useResizeObserver)();
|
|
14
|
+
const width = (0, _vue.computed)(() => contentRect.value?.width || fallback.width);
|
|
15
|
+
const height = (0, _vue.computed)(() => contentRect.value?.height || fallback.height);
|
|
16
|
+
return {
|
|
17
|
+
resizeRef,
|
|
18
|
+
width,
|
|
19
|
+
height
|
|
20
|
+
};
|
|
21
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*********************************************************
|
|
2
|
+
* useChartSize
|
|
3
|
+
*
|
|
4
|
+
* @description
|
|
5
|
+
* Dimensions de la surface de dessin d'un chart (#1317) : la boite
|
|
6
|
+
* rendue de l'element portant `resizeRef`, afin que `viewBox` suive le
|
|
7
|
+
* conteneur au lieu d'une constante. Tant que rien n'est mesure (SSR,
|
|
8
|
+
* avant montage, boite nulle) on rend `fallback`, identique entre
|
|
9
|
+
* serveur et premier rendu client — pas de mismatch d'hydratation.
|
|
10
|
+
********************************************************/
|
|
11
|
+
export declare function useChartSize(fallback: {
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
}): {
|
|
15
|
+
resizeRef: import("vue").Ref<SVGSVGElement | null | undefined, SVGSVGElement | null | undefined>;
|
|
16
|
+
width: import("vue").ComputedRef<number>;
|
|
17
|
+
height: import("vue").ComputedRef<number>;
|
|
18
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { computed } from "vue";
|
|
2
|
+
import { useResizeObserver } from "../Commons/resizeObserver.composable.js";
|
|
3
|
+
export function useChartSize(fallback) {
|
|
4
|
+
const { resizeRef, contentRect } = useResizeObserver();
|
|
5
|
+
const width = computed(() => contentRect.value?.width || fallback.width);
|
|
6
|
+
const height = computed(() => contentRect.value?.height || fallback.height);
|
|
7
|
+
return { resizeRef, width, height };
|
|
8
|
+
}
|
|
@@ -14,4 +14,4 @@ import type { IResizeState } from '../../interfaces/Commons/resizeObserver.inter
|
|
|
14
14
|
* `contentRect` reste `undefined` en permanence, silencieusement, meme
|
|
15
15
|
* comportement de garde que `useIntersectionObserver`.
|
|
16
16
|
********************************************************/
|
|
17
|
-
export declare function useResizeObserver(callback?: ResizeObserverCallback, box?: 'content' | 'border'): IResizeState
|
|
17
|
+
export declare function useResizeObserver<T extends Element = HTMLElement>(callback?: ResizeObserverCallback, box?: 'content' | 'border'): IResizeState<T>;
|
|
@@ -1680,4 +1680,16 @@ Object.keys(_chartZoom).forEach(function (key) {
|
|
|
1680
1680
|
return _chartZoom[key];
|
|
1681
1681
|
}
|
|
1682
1682
|
});
|
|
1683
|
+
});
|
|
1684
|
+
var _chartSize = require("./Chart/chart-size.composable.cjs");
|
|
1685
|
+
Object.keys(_chartSize).forEach(function (key) {
|
|
1686
|
+
if (key === "default" || key === "__esModule") return;
|
|
1687
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
1688
|
+
if (key in exports && exports[key] === _chartSize[key]) return;
|
|
1689
|
+
Object.defineProperty(exports, key, {
|
|
1690
|
+
enumerable: true,
|
|
1691
|
+
get: function () {
|
|
1692
|
+
return _chartSize[key];
|
|
1693
|
+
}
|
|
1694
|
+
});
|
|
1683
1695
|
});
|
|
@@ -138,3 +138,4 @@ export * from "./Chart/chart.composable.js";
|
|
|
138
138
|
export * from "./Chart/chart-animation.composable.js";
|
|
139
139
|
export * from "./Chart/chart-header-typography.composable.js";
|
|
140
140
|
export * from "./Chart/chart-zoom.composable.js";
|
|
141
|
+
export * from "./Chart/chart-size.composable.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DeepReadonly, Ref } from 'vue';
|
|
2
|
-
export interface IResizeState {
|
|
3
|
-
resizeRef: Ref<
|
|
2
|
+
export interface IResizeState<T extends Element = HTMLElement> {
|
|
3
|
+
resizeRef: Ref<T | null | undefined>;
|
|
4
4
|
contentRect: DeepReadonly<Ref<DOMRectReadOnly | undefined>>;
|
|
5
5
|
}
|