@pie-lib/charting 8.0.5 → 8.0.6-next.20261016071127
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/dist/__tests__/range-axis-labels.test.d.ts +1 -0
- package/dist/__tests__/range-axis-room.test.d.ts +1 -0
- package/dist/axes.d.ts +16 -0
- package/dist/axes.js +195 -156
- package/dist/chart.d.ts +1 -0
- package/dist/chart.js +6 -2
- package/dist/mark-label.js +28 -25
- package/package.json +8 -8
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/axes.d.ts
CHANGED
|
@@ -14,6 +14,18 @@ export declare class TickComponent extends React.Component {
|
|
|
14
14
|
splitText: any;
|
|
15
15
|
render(): React.JSX.Element | null;
|
|
16
16
|
}
|
|
17
|
+
export declare const RangeTickLabel: {
|
|
18
|
+
({ x, y, formattedValue }: {
|
|
19
|
+
x: any;
|
|
20
|
+
y: any;
|
|
21
|
+
formattedValue: any;
|
|
22
|
+
}): React.JSX.Element;
|
|
23
|
+
propTypes: {
|
|
24
|
+
x: PropTypes.Requireable<number>;
|
|
25
|
+
y: PropTypes.Requireable<number>;
|
|
26
|
+
formattedValue: PropTypes.Requireable<string>;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
17
29
|
export declare class RawChartAxes extends React.Component {
|
|
18
30
|
static propTypes: {
|
|
19
31
|
bottomScale: PropTypes.Requireable<(...args: any[]) => any>;
|
|
@@ -61,15 +73,19 @@ export declare class RawChartAxes extends React.Component {
|
|
|
61
73
|
}> | null | undefined>>;
|
|
62
74
|
language: PropTypes.Requireable<string>;
|
|
63
75
|
onLabelOverhang: PropTypes.Requireable<(...args: any[]) => any>;
|
|
76
|
+
onRangeLabelOverhang: PropTypes.Requireable<(...args: any[]) => any>;
|
|
64
77
|
};
|
|
65
78
|
state: {
|
|
66
79
|
height: number;
|
|
67
80
|
width: number;
|
|
68
81
|
labelHeight: number;
|
|
82
|
+
rangeLabelWidth: number;
|
|
69
83
|
};
|
|
70
84
|
reportedOverhang: number;
|
|
85
|
+
reportedRangeOverhang: number;
|
|
71
86
|
labelLayout: any;
|
|
72
87
|
reportLabelOverhang: any;
|
|
88
|
+
reportRangeLabelOverhang: any;
|
|
73
89
|
measureHiddenLabel: any;
|
|
74
90
|
_onDocMutation: any;
|
|
75
91
|
observeHiddenLabel: any;
|
package/dist/axes.js
CHANGED
|
@@ -3,60 +3,60 @@ import t from "./node_modules/.bun/@visx_axis@4.0.0_d84c32d47042070f/node_module
|
|
|
3
3
|
import { TickCorrectnessIndicator as n } from "./common/correctness-indicators.js";
|
|
4
4
|
import { bandKey as r, getRotateAngle as i, getRotatedLabelOverhang as a, getTickValues as o, textOf as s } from "./utils.js";
|
|
5
5
|
import { MarkLabel as c } from "./mark-label.js";
|
|
6
|
-
import l from "react";
|
|
7
|
-
import
|
|
8
|
-
import { styled as
|
|
9
|
-
import { types as
|
|
10
|
-
import { AlertDialog as
|
|
11
|
-
import { color as
|
|
12
|
-
import { jsx as
|
|
13
|
-
import
|
|
14
|
-
import { renderMath as
|
|
15
|
-
import
|
|
6
|
+
import l, { useEffect as u, useRef as d } from "react";
|
|
7
|
+
import f from "prop-types";
|
|
8
|
+
import { styled as p } from "@mui/material/styles";
|
|
9
|
+
import { types as m } from "@pie-lib/plot";
|
|
10
|
+
import { AlertDialog as h } from "@pie-lib/config-ui";
|
|
11
|
+
import { color as g } from "@pie-lib/render-ui";
|
|
12
|
+
import { jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
13
|
+
import y from "@mui/material/Checkbox";
|
|
14
|
+
import { renderMath as b } from "@pie-element/shared-math-rendering-mathjax";
|
|
15
|
+
import x from "@pie-lib/translator";
|
|
16
16
|
//#region src/axes.tsx
|
|
17
|
-
var { translator:
|
|
18
|
-
function
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}),
|
|
17
|
+
var { translator: S } = x, C = 24, w = -110, T = 12, E = /* @__PURE__ */ new Set(), D = null;
|
|
18
|
+
function O(e) {
|
|
19
|
+
E.add(e), !D && typeof document < "u" && (D = new MutationObserver(() => {
|
|
20
|
+
E.forEach((e) => e());
|
|
21
|
+
}), D.observe(document.body, {
|
|
22
22
|
childList: !0,
|
|
23
23
|
subtree: !0
|
|
24
24
|
}));
|
|
25
25
|
}
|
|
26
|
-
function
|
|
27
|
-
|
|
26
|
+
function k(e) {
|
|
27
|
+
E.delete(e), E.size === 0 && D && (D.disconnect(), D = null);
|
|
28
28
|
}
|
|
29
|
-
var
|
|
29
|
+
var A = p("text")(({ theme: e }) => ({
|
|
30
30
|
fontSize: e.typography.fontSize - 2,
|
|
31
31
|
fill: e.palette.error.main
|
|
32
|
-
})),
|
|
32
|
+
})), j = p(y)(() => ({ color: `${g.tertiary()} !important` })), M = p("g")(({ theme: e }) => ({
|
|
33
33
|
"& .vx-axis-line": {
|
|
34
|
-
stroke:
|
|
34
|
+
stroke: g.visualElementsColors.AXIS_LINE_COLOR,
|
|
35
35
|
strokeWidth: 2
|
|
36
36
|
},
|
|
37
37
|
"& .vx-axis-tick": {
|
|
38
|
-
fill:
|
|
38
|
+
fill: g.visualElementsColors.AXIS_TICK_COLOR,
|
|
39
39
|
"& line": {
|
|
40
|
-
stroke:
|
|
40
|
+
stroke: g.visualElementsColors.AXIS_TICK_COLOR,
|
|
41
41
|
strokeWidth: 2
|
|
42
42
|
},
|
|
43
43
|
fontFamily: e.typography.body1?.fontFamily,
|
|
44
44
|
fontSize: e.typography.fontSize,
|
|
45
45
|
textAnchor: "middle"
|
|
46
46
|
}
|
|
47
|
-
})),
|
|
47
|
+
})), N = (e) => ({
|
|
48
48
|
borderRadius: e.spacing(2),
|
|
49
|
-
color:
|
|
49
|
+
color: g.defaults.WHITE,
|
|
50
50
|
fontSize: "16px",
|
|
51
51
|
width: "16px",
|
|
52
52
|
height: "16px",
|
|
53
53
|
padding: "2px",
|
|
54
|
-
border: `1px solid ${
|
|
54
|
+
border: `1px solid ${g.defaults.WHITE}`,
|
|
55
55
|
boxSizing: "unset"
|
|
56
|
-
}),
|
|
56
|
+
}), P = { backgroundColor: g.incorrectWithIcon() }, F = { backgroundColor: g.correct() }, I = class extends l.Component {
|
|
57
57
|
static propTypes = {
|
|
58
|
-
defineChart:
|
|
59
|
-
error:
|
|
58
|
+
defineChart: f.bool,
|
|
59
|
+
error: f.any
|
|
60
60
|
};
|
|
61
61
|
constructor(e) {
|
|
62
62
|
super(e), this.state = { dialog: { open: !1 } };
|
|
@@ -113,16 +113,16 @@ var E = d("text")(({ theme: e }) => ({
|
|
|
113
113
|
return n;
|
|
114
114
|
};
|
|
115
115
|
render() {
|
|
116
|
-
let { categories: e, xBand: t, bandWidth: i, barWidth: a, rotate: o, top: l, graphProps: u, defineChart: d, chartingOptions: f, x:
|
|
117
|
-
if (!
|
|
118
|
-
let
|
|
119
|
-
correctnessIcon:
|
|
120
|
-
incorrectIcon:
|
|
121
|
-
correctIcon:
|
|
122
|
-
}, { dialog:
|
|
123
|
-
return /* @__PURE__ */
|
|
124
|
-
/* @__PURE__ */
|
|
125
|
-
x: i ?
|
|
116
|
+
let { categories: e, xBand: t, bandWidth: i, barWidth: a, rotate: o, top: l, graphProps: u, defineChart: d, chartingOptions: f, x: p, y: m, formattedValue: g, changeInteractiveEnabled: y, changeEditableEnabled: b, error: x, autoFocus: C, hiddenLabelRef: E, showCorrectness: D, language: O } = this.props;
|
|
117
|
+
if (!g) return null;
|
|
118
|
+
let k = {
|
|
119
|
+
correctnessIcon: N,
|
|
120
|
+
incorrectIcon: P,
|
|
121
|
+
correctIcon: F
|
|
122
|
+
}, { dialog: M } = this.state, { changeEditable: I, changeInteractive: L } = f || {}, R = parseInt(g.split("-")[0], 10), z = e[R], { editable: B, interactive: V, label: H, correctness: U } = z || {}, W = t(r({ label: H }, R)), G = (e || []).reduce((e, t) => (e && e.label ? e.label.length : 0) > (t && t.label ? t.label.length : 0) ? e : t, { label: "" }), K = x ? [...new Set(Object.values(x))].join(" ") : "";
|
|
123
|
+
return /* @__PURE__ */ v("g", { children: [
|
|
124
|
+
/* @__PURE__ */ v("foreignObject", {
|
|
125
|
+
x: i ? W : p - a / 2,
|
|
126
126
|
y: 18,
|
|
127
127
|
width: a,
|
|
128
128
|
height: 4,
|
|
@@ -130,53 +130,53 @@ var E = d("text")(({ theme: e }) => ({
|
|
|
130
130
|
pointerEvents: "none",
|
|
131
131
|
overflow: "visible"
|
|
132
132
|
},
|
|
133
|
-
children: [
|
|
133
|
+
children: [R === 0 && /* @__PURE__ */ _(c, {
|
|
134
134
|
isHiddenLabel: !0,
|
|
135
|
-
inputRef:
|
|
135
|
+
inputRef: E,
|
|
136
136
|
disabled: !0,
|
|
137
|
-
mark:
|
|
137
|
+
mark: G,
|
|
138
138
|
graphProps: u,
|
|
139
139
|
barWidth: a
|
|
140
|
-
}), /* @__PURE__ */
|
|
140
|
+
}), /* @__PURE__ */ _(c, {
|
|
141
141
|
autoFocus: d && C,
|
|
142
142
|
inputRef: (e) => this.input = e,
|
|
143
|
-
disabled: !d && !
|
|
144
|
-
mark:
|
|
143
|
+
disabled: !d && !B,
|
|
144
|
+
mark: z,
|
|
145
145
|
graphProps: u,
|
|
146
|
-
onChange: (e) => this.changeCategory(
|
|
146
|
+
onChange: (e) => this.changeCategory(R, e),
|
|
147
147
|
barWidth: a,
|
|
148
148
|
rotate: o,
|
|
149
|
-
correctness:
|
|
150
|
-
error:
|
|
151
|
-
ariaLabel:
|
|
149
|
+
correctness: U,
|
|
150
|
+
error: x && x[R],
|
|
151
|
+
ariaLabel: S.t("charting.categoryLabel", {
|
|
152
152
|
lng: O,
|
|
153
|
-
index:
|
|
153
|
+
index: R + 1
|
|
154
154
|
}),
|
|
155
|
-
mathAriaLabel:
|
|
155
|
+
mathAriaLabel: S.t("charting.categoryLabelValue", {
|
|
156
156
|
lng: O,
|
|
157
|
-
index:
|
|
158
|
-
label: s(
|
|
157
|
+
index: R + 1,
|
|
158
|
+
label: s(H),
|
|
159
159
|
interpolation: { escapeValue: !1 }
|
|
160
160
|
}),
|
|
161
161
|
limitCharacters: !0,
|
|
162
|
-
correctnessIndicator:
|
|
163
|
-
correctness:
|
|
164
|
-
interactive:
|
|
165
|
-
classes:
|
|
162
|
+
correctnessIndicator: D && U && /* @__PURE__ */ _(n, {
|
|
163
|
+
correctness: U,
|
|
164
|
+
interactive: V,
|
|
165
|
+
classes: k
|
|
166
166
|
})
|
|
167
167
|
})]
|
|
168
168
|
}),
|
|
169
|
-
|
|
170
|
-
y:
|
|
169
|
+
x && R === 0 && /* @__PURE__ */ _(A, {
|
|
170
|
+
y: m + 23,
|
|
171
171
|
height: 6,
|
|
172
172
|
textAnchor: "start",
|
|
173
|
-
children:
|
|
173
|
+
children: K
|
|
174
174
|
}),
|
|
175
|
-
d &&
|
|
176
|
-
x:
|
|
175
|
+
d && R === 0 && /* @__PURE__ */ v("svg", {
|
|
176
|
+
x: w,
|
|
177
177
|
style: { overflow: "visible" },
|
|
178
|
-
children: [y && /* @__PURE__ */
|
|
179
|
-
y:
|
|
178
|
+
children: [y && /* @__PURE__ */ _("text", {
|
|
179
|
+
y: m + 90 + l,
|
|
180
180
|
width: a,
|
|
181
181
|
height: 4,
|
|
182
182
|
style: {
|
|
@@ -186,13 +186,13 @@ var E = d("text")(({ theme: e }) => ({
|
|
|
186
186
|
maxWidth: a,
|
|
187
187
|
display: "inline-block"
|
|
188
188
|
},
|
|
189
|
-
children: this.splitText(
|
|
189
|
+
children: this.splitText(L?.authoringLabel, T).map((e, t) => /* @__PURE__ */ _("tspan", {
|
|
190
190
|
x: "0",
|
|
191
191
|
dy: `${t > 0 ? "1.2em" : ".6em"}`,
|
|
192
192
|
children: e
|
|
193
193
|
}, t))
|
|
194
|
-
}),
|
|
195
|
-
y:
|
|
194
|
+
}), b && /* @__PURE__ */ _("text", {
|
|
195
|
+
y: m + 145 + l,
|
|
196
196
|
width: a,
|
|
197
197
|
height: 4,
|
|
198
198
|
style: {
|
|
@@ -202,116 +202,151 @@ var E = d("text")(({ theme: e }) => ({
|
|
|
202
202
|
maxWidth: a,
|
|
203
203
|
display: "inline-block"
|
|
204
204
|
},
|
|
205
|
-
children: this.splitText(
|
|
205
|
+
children: this.splitText(I?.authoringLabel, T).map((e, t) => /* @__PURE__ */ _("tspan", {
|
|
206
206
|
x: "0",
|
|
207
207
|
dy: `${t > 0 ? "1.2em" : ".6em"}`,
|
|
208
208
|
children: e
|
|
209
209
|
}, t))
|
|
210
210
|
})]
|
|
211
211
|
}),
|
|
212
|
-
d && y && /* @__PURE__ */
|
|
213
|
-
x:
|
|
214
|
-
y:
|
|
212
|
+
d && y && /* @__PURE__ */ _("foreignObject", {
|
|
213
|
+
x: p - 24,
|
|
214
|
+
y: m + 80 + l,
|
|
215
215
|
width: a,
|
|
216
216
|
height: 4,
|
|
217
217
|
style: {
|
|
218
218
|
pointerEvents: "visible",
|
|
219
219
|
overflow: "visible"
|
|
220
220
|
},
|
|
221
|
-
children: /* @__PURE__ */
|
|
221
|
+
children: /* @__PURE__ */ _(j, {
|
|
222
222
|
style: { position: "fixed" },
|
|
223
|
-
checked:
|
|
224
|
-
onChange: (e) => this.changeInteractive(
|
|
223
|
+
checked: V,
|
|
224
|
+
onChange: (e) => this.changeInteractive(R, e.target.checked)
|
|
225
225
|
})
|
|
226
226
|
}),
|
|
227
|
-
d &&
|
|
228
|
-
x:
|
|
229
|
-
y:
|
|
227
|
+
d && b && /* @__PURE__ */ _("foreignObject", {
|
|
228
|
+
x: p - 24,
|
|
229
|
+
y: m + 130 + l,
|
|
230
230
|
width: a,
|
|
231
231
|
height: 4,
|
|
232
232
|
style: {
|
|
233
233
|
pointerEvents: "visible",
|
|
234
234
|
overflow: "visible"
|
|
235
235
|
},
|
|
236
|
-
children: /* @__PURE__ */
|
|
236
|
+
children: /* @__PURE__ */ _(j, {
|
|
237
237
|
style: { position: "fixed" },
|
|
238
|
-
checked:
|
|
239
|
-
onChange: (e) => this.changeEditable(
|
|
238
|
+
checked: B,
|
|
239
|
+
onChange: (e) => this.changeEditable(R, e.target.checked)
|
|
240
240
|
})
|
|
241
241
|
}),
|
|
242
|
-
/* @__PURE__ */
|
|
243
|
-
x:
|
|
244
|
-
y:
|
|
242
|
+
/* @__PURE__ */ _("foreignObject", {
|
|
243
|
+
x: p - 24,
|
|
244
|
+
y: m + 100 + l,
|
|
245
245
|
width: a,
|
|
246
246
|
height: 4,
|
|
247
247
|
style: {
|
|
248
248
|
pointerEvents: "visible",
|
|
249
249
|
overflow: "visible"
|
|
250
250
|
},
|
|
251
|
-
children: /* @__PURE__ */ h
|
|
252
|
-
open:
|
|
253
|
-
title:
|
|
254
|
-
text:
|
|
255
|
-
onClose:
|
|
256
|
-
onConfirm:
|
|
251
|
+
children: /* @__PURE__ */ _(h, {
|
|
252
|
+
open: M.open,
|
|
253
|
+
title: M.title,
|
|
254
|
+
text: M.text,
|
|
255
|
+
onClose: M.onClose,
|
|
256
|
+
onConfirm: M.onConfirm
|
|
257
257
|
})
|
|
258
258
|
})
|
|
259
259
|
] });
|
|
260
260
|
}
|
|
261
261
|
};
|
|
262
|
-
|
|
263
|
-
categories:
|
|
264
|
-
xBand:
|
|
265
|
-
bandWidth:
|
|
266
|
-
barWidth:
|
|
267
|
-
rotate:
|
|
268
|
-
top:
|
|
269
|
-
x:
|
|
270
|
-
y:
|
|
271
|
-
graphProps:
|
|
272
|
-
formattedValue:
|
|
273
|
-
onChangeCategory:
|
|
274
|
-
onChange:
|
|
275
|
-
error:
|
|
276
|
-
defineChart:
|
|
277
|
-
chartingOptions:
|
|
278
|
-
changeInteractiveEnabled:
|
|
279
|
-
changeEditableEnabled:
|
|
280
|
-
autoFocus:
|
|
281
|
-
onAutoFocusUsed:
|
|
282
|
-
showCorrectness:
|
|
283
|
-
hiddenLabelRef:
|
|
284
|
-
language:
|
|
262
|
+
I.propTypes = {
|
|
263
|
+
categories: f.array,
|
|
264
|
+
xBand: f.func,
|
|
265
|
+
bandWidth: f.number,
|
|
266
|
+
barWidth: f.number,
|
|
267
|
+
rotate: f.number,
|
|
268
|
+
top: f.number,
|
|
269
|
+
x: f.number,
|
|
270
|
+
y: f.number,
|
|
271
|
+
graphProps: f.object,
|
|
272
|
+
formattedValue: f.string,
|
|
273
|
+
onChangeCategory: f.func,
|
|
274
|
+
onChange: f.func,
|
|
275
|
+
error: f.object,
|
|
276
|
+
defineChart: f.bool,
|
|
277
|
+
chartingOptions: f.object,
|
|
278
|
+
changeInteractiveEnabled: f.bool,
|
|
279
|
+
changeEditableEnabled: f.bool,
|
|
280
|
+
autoFocus: f.bool,
|
|
281
|
+
onAutoFocusUsed: f.func,
|
|
282
|
+
showCorrectness: f.bool,
|
|
283
|
+
hiddenLabelRef: f.oneOfType([f.func, f.shape({ current: f.instanceOf(Element) })]),
|
|
284
|
+
language: f.string
|
|
285
285
|
};
|
|
286
|
-
var
|
|
286
|
+
var L = 80, R = 6, z = 18, B = p("div")(({ theme: e }) => ({
|
|
287
|
+
textAlign: "right",
|
|
288
|
+
fontSize: e.typography.fontSize + 2,
|
|
289
|
+
fontFamily: e.typography.fontFamily,
|
|
290
|
+
color: g.defaults.TEXT,
|
|
291
|
+
lineHeight: 1
|
|
292
|
+
})), V = ({ x: e, y: t, formattedValue: n }) => {
|
|
293
|
+
let r = d(null), i = `\\(${n}\\)`;
|
|
294
|
+
return u(() => {
|
|
295
|
+
let e = r.current;
|
|
296
|
+
e && (e.textContent = i, b(e));
|
|
297
|
+
}, [i]), /* @__PURE__ */ _("foreignObject", {
|
|
298
|
+
x: e - R - L,
|
|
299
|
+
y: t,
|
|
300
|
+
width: L,
|
|
301
|
+
height: 1,
|
|
302
|
+
style: {
|
|
303
|
+
pointerEvents: "none",
|
|
304
|
+
overflow: "visible"
|
|
305
|
+
},
|
|
306
|
+
children: /* @__PURE__ */ _(B, {
|
|
307
|
+
ref: r,
|
|
308
|
+
"data-range-label": !0,
|
|
309
|
+
style: { transform: "translateY(-50%)" }
|
|
310
|
+
})
|
|
311
|
+
});
|
|
312
|
+
};
|
|
313
|
+
V.propTypes = {
|
|
314
|
+
x: f.number,
|
|
315
|
+
y: f.number,
|
|
316
|
+
formattedValue: f.string
|
|
317
|
+
};
|
|
318
|
+
var H = class extends l.Component {
|
|
287
319
|
static propTypes = {
|
|
288
|
-
bottomScale:
|
|
289
|
-
categories:
|
|
290
|
-
defineChart:
|
|
291
|
-
error:
|
|
292
|
-
graphProps:
|
|
293
|
-
xBand:
|
|
294
|
-
leftAxis:
|
|
295
|
-
onChange:
|
|
296
|
-
onChangeCategory:
|
|
297
|
-
top:
|
|
298
|
-
theme:
|
|
299
|
-
chartingOptions:
|
|
300
|
-
changeInteractiveEnabled:
|
|
301
|
-
changeEditableEnabled:
|
|
302
|
-
autoFocus:
|
|
303
|
-
onAutoFocusUsed:
|
|
304
|
-
showCorrectness:
|
|
305
|
-
hiddenLabelRef:
|
|
306
|
-
language:
|
|
307
|
-
onLabelOverhang:
|
|
320
|
+
bottomScale: f.func,
|
|
321
|
+
categories: f.array,
|
|
322
|
+
defineChart: f.bool,
|
|
323
|
+
error: f.any,
|
|
324
|
+
graphProps: m.GraphPropsType.isRequired,
|
|
325
|
+
xBand: f.func,
|
|
326
|
+
leftAxis: f.bool,
|
|
327
|
+
onChange: f.func,
|
|
328
|
+
onChangeCategory: f.func,
|
|
329
|
+
top: f.number,
|
|
330
|
+
theme: f.object,
|
|
331
|
+
chartingOptions: f.object,
|
|
332
|
+
changeInteractiveEnabled: f.bool,
|
|
333
|
+
changeEditableEnabled: f.bool,
|
|
334
|
+
autoFocus: f.bool,
|
|
335
|
+
onAutoFocusUsed: f.func,
|
|
336
|
+
showCorrectness: f.bool,
|
|
337
|
+
hiddenLabelRef: f.oneOfType([f.func, f.shape({ current: f.instanceOf(Element) })]),
|
|
338
|
+
language: f.string,
|
|
339
|
+
onLabelOverhang: f.func,
|
|
340
|
+
onRangeLabelOverhang: f.func
|
|
308
341
|
};
|
|
309
342
|
state = {
|
|
310
343
|
height: 0,
|
|
311
344
|
width: 0,
|
|
312
|
-
labelHeight: 0
|
|
345
|
+
labelHeight: 0,
|
|
346
|
+
rangeLabelWidth: 0
|
|
313
347
|
};
|
|
314
348
|
reportedOverhang = 0;
|
|
349
|
+
reportedRangeOverhang = 0;
|
|
315
350
|
labelLayout = () => {
|
|
316
351
|
let { graphProps: e, xBand: t, categories: n = [], theme: r } = this.props, { scale: a = {}, domain: o = {} } = e || {}, { height: s, width: c } = this.state, l = t && typeof t.bandwidth == "function" && t.bandwidth(), u = l || a.x && a.x(o.max) / n.length;
|
|
317
352
|
return {
|
|
@@ -321,18 +356,25 @@ var N = class extends l.Component {
|
|
|
321
356
|
};
|
|
322
357
|
};
|
|
323
358
|
reportLabelOverhang = () => {
|
|
324
|
-
let { onLabelOverhang: e } = this.props, { height: t, width: n, labelHeight: r } = this.state, i = a(n, t, this.labelLayout().rotate) + Math.max(0, r -
|
|
359
|
+
let { onLabelOverhang: e } = this.props, { height: t, width: n, labelHeight: r } = this.state, i = a(n, t, this.labelLayout().rotate) + Math.max(0, r - C);
|
|
325
360
|
e && i !== this.reportedOverhang && (this.reportedOverhang = i, e(i));
|
|
326
361
|
};
|
|
362
|
+
reportRangeLabelOverhang = () => {
|
|
363
|
+
let { onRangeLabelOverhang: e } = this.props, t = Math.max(0, Math.ceil(this.state.rangeLabelWidth - z));
|
|
364
|
+
e && t !== this.reportedRangeOverhang && (this.reportedRangeOverhang = t, e(t));
|
|
365
|
+
};
|
|
327
366
|
measureHiddenLabel = () => {
|
|
328
367
|
if (!this.hiddenLabelRef) return;
|
|
329
368
|
let e = this.hiddenLabelRef.querySelector("mjx-container"), t = this.hiddenLabelRef.querySelector("input"), n = (e || t || this.hiddenLabelRef).getBoundingClientRect(), r = Math.floor(n.height), i = Math.floor(n.width), a = this.axesNode ? [...this.axesNode.querySelectorAll("[data-math-label]")] : [];
|
|
330
369
|
a.forEach((e) => this._sizeObserver?.observe(e));
|
|
331
|
-
let o = Math.max(0, ...a.map((e) => e.offsetHeight));
|
|
332
|
-
(
|
|
370
|
+
let o = Math.max(0, ...a.map((e) => e.offsetHeight)), s = this.axesNode ? [...this.axesNode.querySelectorAll("[data-range-label] mjx-container")] : [];
|
|
371
|
+
s.forEach((e) => this._sizeObserver?.observe(e));
|
|
372
|
+
let c = Math.max(0, ...s.map((e) => e.getBoundingClientRect().width));
|
|
373
|
+
(r !== this.state.height || i !== this.state.width || o !== this.state.labelHeight || c !== this.state.rangeLabelWidth) && this.setState({
|
|
333
374
|
height: r,
|
|
334
375
|
width: i,
|
|
335
|
-
labelHeight: o
|
|
376
|
+
labelHeight: o,
|
|
377
|
+
rangeLabelWidth: c
|
|
336
378
|
});
|
|
337
379
|
};
|
|
338
380
|
_onDocMutation = () => {
|
|
@@ -341,7 +383,7 @@ var N = class extends l.Component {
|
|
|
341
383
|
observeHiddenLabel = (e) => {
|
|
342
384
|
if (!e) return;
|
|
343
385
|
let t = e.querySelector("[data-latex], [data-raw]");
|
|
344
|
-
t &&
|
|
386
|
+
t && b(e), (e.querySelector("mjx-container") || !t) && this.measureHiddenLabel(), O(this._onDocMutation), this.observeHiddenLabelSize(e);
|
|
345
387
|
};
|
|
346
388
|
observeHiddenLabelSize = (e) => {
|
|
347
389
|
e === this._sizedLabel || typeof ResizeObserver > "u" || (this._sizeObserver?.disconnect(), this._sizedLabel = e, this._sizeObserver = new ResizeObserver(() => this.measureHiddenLabel()), this._sizeObserver.observe(e));
|
|
@@ -350,37 +392,34 @@ var N = class extends l.Component {
|
|
|
350
392
|
e && e !== this.hiddenLabelRef && (this.hiddenLabelRef = e, this.observeHiddenLabel(e));
|
|
351
393
|
};
|
|
352
394
|
componentDidMount() {
|
|
353
|
-
this.hiddenLabelRef && this.observeHiddenLabel(this.hiddenLabelRef), this.reportLabelOverhang();
|
|
395
|
+
this.hiddenLabelRef && this.observeHiddenLabel(this.hiddenLabelRef), this.reportLabelOverhang(), this.reportRangeLabelOverhang();
|
|
354
396
|
}
|
|
355
397
|
componentWillUnmount() {
|
|
356
|
-
|
|
398
|
+
k(this._onDocMutation), this._sizeObserver?.disconnect(), this._sizedLabel = null, this._updateTimer && clearTimeout(this._updateTimer);
|
|
357
399
|
}
|
|
358
400
|
componentDidUpdate(e) {
|
|
359
|
-
e.categories !== this.props.categories && (this._updateTimer && clearTimeout(this._updateTimer), this._updateTimer = setTimeout(() => this.measureHiddenLabel(), 50)), this.reportLabelOverhang();
|
|
401
|
+
e.categories !== this.props.categories && (this._updateTimer && clearTimeout(this._updateTimer), this._updateTimer = setTimeout(() => this.measureHiddenLabel(), 50)), this.reportLabelOverhang(), this.reportRangeLabelOverhang();
|
|
360
402
|
}
|
|
361
403
|
render() {
|
|
362
|
-
let { graphProps: n, xBand: r, leftAxis: i, onChange: a, onChangeCategory: s, categories: c = [], top: l, defineChart: u, chartingOptions: d, changeInteractiveEnabled: f, changeEditableEnabled: p, autoFocus: m, onAutoFocusUsed:
|
|
404
|
+
let { graphProps: n, xBand: r, leftAxis: i, onChange: a, onChangeCategory: s, categories: c = [], top: l, defineChart: u, chartingOptions: d, changeInteractiveEnabled: f, changeEditableEnabled: p, autoFocus: m, onAutoFocusUsed: h, error: g, showCorrectness: y, language: b } = this.props, { scale: x = {}, range: S = {}, size: C = {} } = n || {}, w = r && typeof r.rangeRound == "function" && r.rangeRound([0, C.width]), { bandWidth: T, barWidth: E, rotate: D } = this.labelLayout(), O = o({
|
|
363
405
|
...S,
|
|
364
406
|
step: S.labelStep
|
|
365
407
|
});
|
|
366
|
-
return /* @__PURE__ */
|
|
408
|
+
return /* @__PURE__ */ v(M, {
|
|
367
409
|
ref: (e) => this.axesNode = e,
|
|
368
|
-
children: [i && /* @__PURE__ */
|
|
410
|
+
children: [i && /* @__PURE__ */ _(e, {
|
|
369
411
|
scale: x.y,
|
|
370
412
|
tickLength: 10,
|
|
371
|
-
tickFormat: (e) => e
|
|
372
|
-
tickValues:
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
dx: -10 - (e.toLocaleString().length || 1) * 5
|
|
376
|
-
})
|
|
377
|
-
}), /* @__PURE__ */ h(t, {
|
|
413
|
+
tickFormat: (e) => `${e}`,
|
|
414
|
+
tickValues: O,
|
|
415
|
+
tickComponent: V
|
|
416
|
+
}), /* @__PURE__ */ _(t, {
|
|
378
417
|
scale: w,
|
|
379
418
|
labelProps: { y: 60 + l },
|
|
380
419
|
top: x.y && x.y(S.min),
|
|
381
420
|
textLabelProps: () => ({ textAnchor: "middle" }),
|
|
382
421
|
tickFormat: (e) => e,
|
|
383
|
-
tickComponent: (e) => /* @__PURE__ */
|
|
422
|
+
tickComponent: (e) => /* @__PURE__ */ _(I, {
|
|
384
423
|
hiddenLabelRef: this.setHiddenLabelRef,
|
|
385
424
|
categories: c,
|
|
386
425
|
xBand: r,
|
|
@@ -391,8 +430,8 @@ var N = class extends l.Component {
|
|
|
391
430
|
defineChart: u,
|
|
392
431
|
chartingOptions: d,
|
|
393
432
|
autoFocus: m,
|
|
394
|
-
onAutoFocusUsed:
|
|
395
|
-
error:
|
|
433
|
+
onAutoFocusUsed: h,
|
|
434
|
+
error: g,
|
|
396
435
|
onChangeCategory: s,
|
|
397
436
|
changeInteractiveEnabled: f,
|
|
398
437
|
changeEditableEnabled: p,
|
|
@@ -405,10 +444,10 @@ var N = class extends l.Component {
|
|
|
405
444
|
language: b
|
|
406
445
|
}),
|
|
407
446
|
autoFocus: m,
|
|
408
|
-
onAutoFocusUsed:
|
|
447
|
+
onAutoFocusUsed: h
|
|
409
448
|
})]
|
|
410
449
|
});
|
|
411
450
|
}
|
|
412
451
|
};
|
|
413
452
|
//#endregion
|
|
414
|
-
export {
|
|
453
|
+
export { V as RangeTickLabel, H as RawChartAxes, H as default, I as TickComponent };
|
package/dist/chart.d.ts
CHANGED
|
@@ -79,6 +79,7 @@ export declare class Chart extends React.Component {
|
|
|
79
79
|
};
|
|
80
80
|
generateMaskId(): string;
|
|
81
81
|
setLabelOverhang: (labelOverhang: any) => void;
|
|
82
|
+
setRangeLabelOverhang: (rangeLabelOverhang: any) => void;
|
|
82
83
|
handleAlertDialog: (open: any, callback: any) => void;
|
|
83
84
|
getChart: any;
|
|
84
85
|
changeData: any;
|
package/dist/chart.js
CHANGED
|
@@ -41,7 +41,8 @@ var { translator: x } = b, ee = f("pie-lib:charts:chart"), te = d("div")(() => (
|
|
|
41
41
|
super(e), this.state = {
|
|
42
42
|
dialog: { open: !1 },
|
|
43
43
|
actionsAnchorEl: null,
|
|
44
|
-
labelOverhang: 0
|
|
44
|
+
labelOverhang: 0,
|
|
45
|
+
rangeLabelOverhang: 0
|
|
45
46
|
}, this.maskUid = this.generateMaskId();
|
|
46
47
|
}
|
|
47
48
|
static propTypes = {
|
|
@@ -114,6 +115,7 @@ var { translator: x } = b, ee = f("pie-lib:charts:chart"), te = d("div")(() => (
|
|
|
114
115
|
return _("chart");
|
|
115
116
|
}
|
|
116
117
|
setLabelOverhang = (e) => this.setState({ labelOverhang: e });
|
|
118
|
+
setRangeLabelOverhang = (e) => this.setState({ rangeLabelOverhang: e });
|
|
117
119
|
handleAlertDialog = (e, t) => this.setState({ dialog: { open: e } }, t);
|
|
118
120
|
getChart = () => {
|
|
119
121
|
let e = this.props.charts || this.state.charts, { chartType: t } = this.props, n = null, r = null;
|
|
@@ -209,6 +211,7 @@ var { translator: x } = b, ee = f("pie-lib:charts:chart"), te = d("div")(() => (
|
|
|
209
211
|
labelsCharactersLimit: A,
|
|
210
212
|
ariaLabel: U,
|
|
211
213
|
ariaDescription: W,
|
|
214
|
+
leftAxisOverhang: this.state.rangeLabelOverhang,
|
|
212
215
|
...$,
|
|
213
216
|
children: [
|
|
214
217
|
/* @__PURE__ */ v(e, {
|
|
@@ -234,7 +237,8 @@ var { translator: x } = b, ee = f("pie-lib:charts:chart"), te = d("div")(() => (
|
|
|
234
237
|
error: D,
|
|
235
238
|
showCorrectness: N === "linePlot" || N === "dotPlot",
|
|
236
239
|
language: k,
|
|
237
|
-
onLabelOverhang: this.setLabelOverhang
|
|
240
|
+
onLabelOverhang: this.setLabelOverhang,
|
|
241
|
+
onRangeLabelOverhang: this.setRangeLabelOverhang
|
|
238
242
|
}),
|
|
239
243
|
C ? /* @__PURE__ */ v("foreignObject", {
|
|
240
244
|
x: I,
|
package/dist/mark-label.js
CHANGED
|
@@ -25,12 +25,17 @@ u("input")(({ theme: e }) => ({
|
|
|
25
25
|
"&.disabledMarkLabel": { backgroundColor: "transparent !important" },
|
|
26
26
|
"&.error": { border: `2px solid ${e.palette.error.main}` }
|
|
27
27
|
}));
|
|
28
|
-
var y = u("div")(({ theme: e }) => ({
|
|
28
|
+
var y = 24, b = u("div")(({ theme: e }) => ({
|
|
29
29
|
pointerEvents: "auto",
|
|
30
|
+
display: "flex",
|
|
31
|
+
justifyContent: "center",
|
|
32
|
+
alignItems: "center",
|
|
33
|
+
minHeight: y,
|
|
30
34
|
textAlign: "center",
|
|
35
|
+
"& mjx-container": { lineHeight: 0 },
|
|
31
36
|
fontSize: e.typography.fontSize + 2,
|
|
32
37
|
fontFamily: e.typography.fontFamily,
|
|
33
|
-
color: f.defaults.
|
|
38
|
+
color: f.defaults.TEXT,
|
|
34
39
|
"&.disabledMarkLabel": {
|
|
35
40
|
...r("color"),
|
|
36
41
|
color: v,
|
|
@@ -43,26 +48,24 @@ var y = u("div")(({ theme: e }) => ({
|
|
|
43
48
|
outline: `2px solid ${f.focusOutline()}`,
|
|
44
49
|
outlineOffset: "2px"
|
|
45
50
|
}
|
|
46
|
-
}))
|
|
47
|
-
function
|
|
48
|
-
let t = e?.trim() || "";
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
let a;
|
|
55
|
-
if (b(e)) return i[0] && i[1] && (r = i[0]), a = `\\(${r}\\frac{${n[0]}}{${n[1]}}\\)`, a;
|
|
51
|
+
})), x = /^(-?)(?:(\d+)\s+)?(\d+)\/(\d+)$/, S = /^-?(?:\d+\.?\d*|\.\d+)$/;
|
|
52
|
+
function C(e) {
|
|
53
|
+
let t = e?.trim() || "", n = x.exec(t);
|
|
54
|
+
if (n) {
|
|
55
|
+
let [, e, t = "", r, i] = n;
|
|
56
|
+
return `\\(${e}${t}\\frac{${r}}{${i}}\\)`;
|
|
57
|
+
}
|
|
58
|
+
if (S.test(t)) return `\\(${t}\\)`;
|
|
56
59
|
}
|
|
57
|
-
var
|
|
58
|
-
let [r, i] = c(null), l = a((e) => i(e), null), { mark: u = {}, disabled: d, inputRef:
|
|
60
|
+
var w = (n) => {
|
|
61
|
+
let [r, i] = c(null), l = a((e) => i(e), null), { mark: u = {}, disabled: d, inputRef: y, barWidth: x, rotate: S, correctness: w, autoFocus: T, error: E, isHiddenLabel: D, limitCharacters: O, correctnessIndicator: k, ariaLabel: A, mathAriaLabel: j } = n, [M, N] = c(u.label), [P, F] = c(u.label), [I, L] = c(!1), R = C(P), z = s(null), B = (e) => {
|
|
59
62
|
O && e.target.value && e.target.value.length > 20 || N(e.target.value);
|
|
60
63
|
}, V = () => I === !1 && R !== void 0, H = () => L(!0), U = (e) => {
|
|
61
64
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), H());
|
|
62
65
|
}, W = (e) => {
|
|
63
66
|
F(e.target.value), L(!1), n.onChange(e.target.value);
|
|
64
67
|
}, G = {};
|
|
65
|
-
return
|
|
68
|
+
return S && (G = {
|
|
66
69
|
width: "unset",
|
|
67
70
|
textAlign: "left"
|
|
68
71
|
}), o(() => {
|
|
@@ -70,9 +73,9 @@ var S = (n) => {
|
|
|
70
73
|
}, [u.label]), o(() => {
|
|
71
74
|
let e = z.current;
|
|
72
75
|
e && R && !I && (e.innerHTML = g(R), h(e));
|
|
73
|
-
}, [R, I]), /* @__PURE__ */ m(_, { children: [k, V() ? /* @__PURE__ */ p(
|
|
76
|
+
}, [R, I]), /* @__PURE__ */ m(_, { children: [k, V() ? /* @__PURE__ */ p(b, {
|
|
74
77
|
ref: (e) => {
|
|
75
|
-
z.current = e, typeof
|
|
78
|
+
z.current = e, typeof y == "function" && y(e);
|
|
76
79
|
},
|
|
77
80
|
"data-math-label": !0,
|
|
78
81
|
className: e({
|
|
@@ -89,16 +92,16 @@ var S = (n) => {
|
|
|
89
92
|
onKeyDown: U
|
|
90
93
|
},
|
|
91
94
|
style: {
|
|
92
|
-
minWidth:
|
|
95
|
+
minWidth: x,
|
|
93
96
|
position: "fixed",
|
|
94
97
|
transformOrigin: "left",
|
|
95
|
-
transform: `rotate(${
|
|
98
|
+
transform: `rotate(${S}deg)`,
|
|
96
99
|
visibility: D ? "hidden" : "unset",
|
|
97
100
|
marginTop: k ? "24px" : "0"
|
|
98
101
|
}
|
|
99
102
|
}) : /* @__PURE__ */ p(t, {
|
|
100
103
|
inputRef: (e) => {
|
|
101
|
-
l(e), typeof
|
|
104
|
+
l(e), typeof y == "function" && y(e);
|
|
102
105
|
},
|
|
103
106
|
name: "mark-label-input",
|
|
104
107
|
"aria-label": A,
|
|
@@ -106,7 +109,7 @@ var S = (n) => {
|
|
|
106
109
|
disabled: d,
|
|
107
110
|
inputClassName: e(w && u.editable ? w.label : null, d && "disabledMarkLabel", E && "error"),
|
|
108
111
|
inputStyle: {
|
|
109
|
-
minWidth:
|
|
112
|
+
minWidth: x,
|
|
110
113
|
textAlign: "center",
|
|
111
114
|
background: "transparent",
|
|
112
115
|
boxSizing: "border-box",
|
|
@@ -128,9 +131,9 @@ var S = (n) => {
|
|
|
128
131
|
pointerEvents: "auto",
|
|
129
132
|
top: 0,
|
|
130
133
|
left: 0,
|
|
131
|
-
minWidth:
|
|
134
|
+
minWidth: x,
|
|
132
135
|
transformOrigin: "left",
|
|
133
|
-
transform: `rotate(${
|
|
136
|
+
transform: `rotate(${S}deg)`,
|
|
134
137
|
visibility: D ? "hidden" : "unset",
|
|
135
138
|
marginTop: k ? "24px" : "0"
|
|
136
139
|
},
|
|
@@ -138,7 +141,7 @@ var S = (n) => {
|
|
|
138
141
|
onBlur: W
|
|
139
142
|
})] });
|
|
140
143
|
};
|
|
141
|
-
|
|
144
|
+
w.propTypes = {
|
|
142
145
|
autoFocus: l.bool,
|
|
143
146
|
disabled: l.bool,
|
|
144
147
|
error: l.any,
|
|
@@ -159,4 +162,4 @@ S.propTypes = {
|
|
|
159
162
|
mathAriaLabel: l.string
|
|
160
163
|
};
|
|
161
164
|
//#endregion
|
|
162
|
-
export {
|
|
165
|
+
export { w as MarkLabel, w as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-lib/charting",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.6-next.20261016071127",
|
|
4
4
|
"description": "charting",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
"@mapbox/point-geometry": "^1.1.0",
|
|
14
14
|
"@mui/icons-material": "^7.3.4",
|
|
15
15
|
"@mui/material": "^7.3.4",
|
|
16
|
-
"@pie-element/shared-utils": "0.1.
|
|
17
|
-
"@pie-lib/plot": "5.0.
|
|
18
|
-
"@pie-lib/render-ui": "8.0.
|
|
19
|
-
"@pie-lib/translator": "5.0.
|
|
16
|
+
"@pie-element/shared-utils": "0.1.5-next.20261012213240",
|
|
17
|
+
"@pie-lib/plot": "5.0.6-next.20261016071127",
|
|
18
|
+
"@pie-lib/render-ui": "8.0.6-next.20261015154938",
|
|
19
|
+
"@pie-lib/translator": "5.0.2-next.20261006160832",
|
|
20
20
|
"@visx/axis": "^4.0.0",
|
|
21
21
|
"@visx/event": "^4.0.0",
|
|
22
22
|
"@visx/grid": "^4.0.0",
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
"invariant": "^2.2.4",
|
|
31
31
|
"react-draggable": "^4.7.1",
|
|
32
32
|
"prop-types": "^15.8.1",
|
|
33
|
-
"@pie-lib/config-ui": "14.0.
|
|
34
|
-
"@pie-element/shared-math-rendering-mathjax": "0.1.
|
|
35
|
-
"@pie-element/shared-lodash": "0.1.
|
|
33
|
+
"@pie-lib/config-ui": "14.0.6-next.20261015154938",
|
|
34
|
+
"@pie-element/shared-math-rendering-mathjax": "0.1.7-next.20261015154938",
|
|
35
|
+
"@pie-element/shared-lodash": "0.1.3-next.20261012213240",
|
|
36
36
|
"clsx": "^2.1.1",
|
|
37
37
|
"d3-time": "^3.1.0",
|
|
38
38
|
"d3-interpolate": "^3.0.1",
|