@pie-lib/charting 8.0.10 → 8.0.11-next.20261202142832
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/_virtual/_rolldown/runtime.js +6 -6
- package/dist/actions-button.js +42 -42
- package/dist/axes.js +166 -166
- package/dist/bars/bar.js +12 -12
- package/dist/bars/common/bars.js +59 -59
- package/dist/bars/histogram.js +12 -12
- package/dist/chart-setup.js +62 -62
- package/dist/chart-type.js +38 -38
- package/dist/chart.js +110 -110
- package/dist/common/correctness-indicators.js +22 -22
- package/dist/common/drag-handle.js +33 -33
- package/dist/common/drag-icon.js +11 -11
- package/dist/common/mark-slider.js +14 -14
- package/dist/grid.js +17 -17
- package/dist/i18n/index.js +4 -4
- package/dist/key-legend.js +28 -28
- package/dist/line/common/drag-handle.js +34 -34
- package/dist/line/common/line.js +56 -56
- package/dist/line/line-cross.js +61 -61
- package/dist/line/line-dot.js +48 -48
- package/dist/mark-label.js +45 -45
- package/dist/node_modules/.bun/@visx_text@4.0.0_d84c32d47042070f/node_modules/@visx/text/esm/hooks/useText.js +11 -11
- package/dist/node_modules/.bun/@visx_vendor@4.0.0/node_modules/@visx/vendor/esm/d3-interpolate.js +1 -1
- package/dist/node_modules/.bun/@visx_vendor@4.0.0/node_modules/@visx/vendor/esm/d3-scale.js +1 -1
- package/dist/node_modules/.bun/@visx_vendor@4.0.0/node_modules/@visx/vendor/esm/d3-shape.js +1 -1
- package/dist/node_modules/.bun/@visx_vendor@4.0.0/node_modules/@visx/vendor/esm/d3-time.js +1 -1
- package/dist/node_modules/.bun/classnames@2.5.1/node_modules/classnames/index.js +12 -11
- package/dist/node_modules/.bun/math-expression-evaluator@1.4.0/node_modules/math-expression-evaluator/src/postfix_evaluator.js +1 -1
- package/dist/plot/common/plot.js +116 -116
- package/dist/plot/dot.js +33 -33
- package/dist/plot/line.js +44 -44
- package/package.json +8 -8
package/dist/grid.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
import t from "
|
|
3
|
-
import n from "
|
|
4
|
-
import r from "
|
|
5
|
-
import
|
|
1
|
+
import e from "react";
|
|
2
|
+
import t from "prop-types";
|
|
3
|
+
import { styled as n } from "@mui/material/styles";
|
|
4
|
+
import r from "./node_modules/.bun/@visx_grid@4.0.0_d84c32d47042070f/node_modules/@visx/grid/esm/grids/GridColumns.js";
|
|
5
|
+
import i from "./node_modules/.bun/@visx_grid@4.0.0_d84c32d47042070f/node_modules/@visx/grid/esm/grids/GridRows.js";
|
|
6
6
|
import { types as a } from "@pie-lib/plot";
|
|
7
7
|
import { color as o } from "@pie-lib/render-ui";
|
|
8
8
|
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
9
9
|
// src/grid.tsx
|
|
10
|
-
var l =
|
|
10
|
+
var l = n("g")(() => ({ stroke: o.primaryLight() })), u = class extends e.Component {
|
|
11
11
|
static propTypes = {
|
|
12
|
-
className:
|
|
12
|
+
className: t.string,
|
|
13
13
|
graphProps: a.GraphPropsType.isRequired,
|
|
14
|
-
xBand:
|
|
15
|
-
columnTickValues:
|
|
16
|
-
rowTickValues:
|
|
14
|
+
xBand: t.func,
|
|
15
|
+
columnTickValues: t.array,
|
|
16
|
+
rowTickValues: t.array
|
|
17
17
|
};
|
|
18
18
|
static defaultProps = {};
|
|
19
19
|
render() {
|
|
20
|
-
let { graphProps:
|
|
20
|
+
let { graphProps: e, xBand: t, rowTickValues: n, columnTickValues: a } = this.props, { scale: u = {}, size: d = {}, range: f = {} } = e || {}, { step: p = 0, labelStep: m = 0 } = f, h = p && m && p < m, g = (e, t) => {
|
|
21
21
|
let n = (e.toString().split(".")[1] || "").length, r = (t.toString().split(".")[1] || "").length, i = 10 ** Math.max(n, r);
|
|
22
22
|
return e * i % (t * i) / i;
|
|
23
|
-
}, { unlabeledLines: _, labeledLines: v } = (
|
|
23
|
+
}, { unlabeledLines: _, labeledLines: v } = (n || []).reduce((e, t) => (h && g(t, m) !== 0 ? e.unlabeledLines.push(t) : e.labeledLines.push(t), e), {
|
|
24
24
|
unlabeledLines: [],
|
|
25
25
|
labeledLines: []
|
|
26
26
|
});
|
|
27
27
|
return /* @__PURE__ */ c(l, { children: [
|
|
28
|
-
/* @__PURE__ */ s(
|
|
28
|
+
/* @__PURE__ */ s(i, {
|
|
29
29
|
scale: u.y,
|
|
30
30
|
width: d.width,
|
|
31
31
|
tickValues: _,
|
|
@@ -34,7 +34,7 @@ var l = i("g")(() => ({ stroke: o.primaryLight() })), u = class extends n.Compon
|
|
|
34
34
|
strokeWidth: 1
|
|
35
35
|
}
|
|
36
36
|
}),
|
|
37
|
-
/* @__PURE__ */ s(
|
|
37
|
+
/* @__PURE__ */ s(i, {
|
|
38
38
|
scale: u.y,
|
|
39
39
|
width: d.width,
|
|
40
40
|
tickValues: v,
|
|
@@ -43,10 +43,10 @@ var l = i("g")(() => ({ stroke: o.primaryLight() })), u = class extends n.Compon
|
|
|
43
43
|
strokeWidth: 1
|
|
44
44
|
}
|
|
45
45
|
}),
|
|
46
|
-
/* @__PURE__ */ s(
|
|
47
|
-
scale:
|
|
46
|
+
/* @__PURE__ */ s(r, {
|
|
47
|
+
scale: t,
|
|
48
48
|
height: d.height,
|
|
49
|
-
offset:
|
|
49
|
+
offset: t.bandwidth() / 2,
|
|
50
50
|
tickValues: a
|
|
51
51
|
})
|
|
52
52
|
] });
|
package/dist/i18n/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
import
|
|
1
|
+
import { defineCatalogs as e } from "@pie-element/shared-i18n";
|
|
2
|
+
import t from "./en-US.js";
|
|
3
3
|
// src/i18n/index.ts
|
|
4
|
-
var n =
|
|
4
|
+
var n = e({
|
|
5
5
|
packageName: "@pie-lib/charting",
|
|
6
|
-
source:
|
|
6
|
+
source: t,
|
|
7
7
|
loaders: {
|
|
8
8
|
es: () => import(
|
|
9
9
|
/* webpackMode: "eager" */
|
package/dist/key-legend.js
CHANGED
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import n from "
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import c from "
|
|
1
|
+
import { useReducer as e } from "react";
|
|
2
|
+
import t from "prop-types";
|
|
3
|
+
import { styled as n } from "@mui/material/styles";
|
|
4
|
+
import r from "@mui/icons-material/Check";
|
|
5
|
+
import i from "@mui/icons-material/Close";
|
|
6
|
+
import { color as a } from "@pie-lib/render-ui";
|
|
7
|
+
import { catalogs as o } from "./i18n/index.js";
|
|
8
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
9
9
|
// src/key-legend.tsx
|
|
10
|
-
var l =
|
|
11
|
-
backgroundColor:
|
|
12
|
-
color:
|
|
10
|
+
var l = n("div")(({ theme: e }) => ({
|
|
11
|
+
backgroundColor: a.v("pie")("background", a.defaults.WHITE),
|
|
12
|
+
color: a.text(),
|
|
13
13
|
padding: e.spacing(2),
|
|
14
14
|
width: "355px",
|
|
15
15
|
boxShadow: "inset 0px 1px 5px 0px #9297A6",
|
|
16
16
|
display: "flex",
|
|
17
17
|
flexDirection: "column",
|
|
18
18
|
gap: "16px"
|
|
19
|
-
})), u =
|
|
19
|
+
})), u = n("div")(() => ({
|
|
20
20
|
display: "flex",
|
|
21
21
|
alignItems: "center",
|
|
22
22
|
gap: "12px"
|
|
23
|
-
})), d =
|
|
23
|
+
})), d = n("div")(({ theme: e }) => ({
|
|
24
24
|
fontSize: e.typography.h6.fontSize,
|
|
25
25
|
fontWeight: "700"
|
|
26
|
-
})), f =
|
|
27
|
-
backgroundColor:
|
|
26
|
+
})), f = n("div")(() => ({ marginLeft: "2px" })), p = n(r)(({ theme: e }) => ({
|
|
27
|
+
backgroundColor: a.correct(),
|
|
28
28
|
borderRadius: e.spacing(2),
|
|
29
|
-
color:
|
|
30
|
-
})), m =
|
|
31
|
-
backgroundColor:
|
|
29
|
+
color: a.defaults.WHITE
|
|
30
|
+
})), m = n(i)(({ theme: e }) => ({
|
|
31
|
+
backgroundColor: a.incorrectWithIcon(),
|
|
32
32
|
borderRadius: e.spacing(2),
|
|
33
|
-
color:
|
|
34
|
-
})), h =
|
|
33
|
+
color: a.defaults.WHITE
|
|
34
|
+
})), h = n("div")(() => ({
|
|
35
35
|
marginLeft: "3px",
|
|
36
36
|
display: "flex",
|
|
37
37
|
alignItems: "center",
|
|
38
38
|
gap: "12px"
|
|
39
|
-
})), g = ({ language:
|
|
40
|
-
let [,
|
|
41
|
-
return /* @__PURE__ */
|
|
42
|
-
/* @__PURE__ */
|
|
43
|
-
/* @__PURE__ */
|
|
44
|
-
/* @__PURE__ */
|
|
45
|
-
/* @__PURE__ */
|
|
39
|
+
})), g = ({ language: t }) => {
|
|
40
|
+
let [, n] = e((e) => e + 1, 0), r = o.forLocale(t, n);
|
|
41
|
+
return /* @__PURE__ */ c(l, { children: [
|
|
42
|
+
/* @__PURE__ */ s(d, { children: r.t("key") }),
|
|
43
|
+
/* @__PURE__ */ c(u, { children: [/* @__PURE__ */ s(m, {}), /* @__PURE__ */ s("div", { children: r.t("keyLegend.incorrectAnswer") })] }),
|
|
44
|
+
/* @__PURE__ */ c(u, { children: [/* @__PURE__ */ s(p, {}), /* @__PURE__ */ s("div", { children: r.t("keyLegend.correctAnswer") })] }),
|
|
45
|
+
/* @__PURE__ */ c(h, { children: [/* @__PURE__ */ s(p, { fontSize: "small" }), /* @__PURE__ */ s(f, { children: r.t("keyLegend.correctKeyAnswer") })] })
|
|
46
46
|
] });
|
|
47
47
|
};
|
|
48
|
-
g.propTypes = { language:
|
|
48
|
+
g.propTypes = { language: t.string };
|
|
49
49
|
export { g as default };
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import n from "
|
|
4
|
-
import r from "
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
1
|
+
import e from "react";
|
|
2
|
+
import { clsx as t } from "../../node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.js";
|
|
3
|
+
import n from "prop-types";
|
|
4
|
+
import { styled as r } from "@mui/material/styles";
|
|
5
|
+
import { gridDraggable as i, types as a, utils as o } from "@pie-lib/plot";
|
|
6
|
+
import { color as s } from "@pie-lib/render-ui";
|
|
7
|
+
import { disabled as c } from "../../common/styles.js";
|
|
8
8
|
import { jsx as l } from "react/jsx-runtime";
|
|
9
9
|
// src/line/common/drag-handle.tsx
|
|
10
|
-
var u =
|
|
10
|
+
var u = r("g")(({ theme: e }) => ({
|
|
11
11
|
color: "black",
|
|
12
12
|
"& .handle": {
|
|
13
13
|
transition: "fill 200ms linear, height 200ms linear",
|
|
14
|
-
"&.non-interactive":
|
|
14
|
+
"&.non-interactive": c("fill")
|
|
15
15
|
},
|
|
16
16
|
"& .transparentHandle": {
|
|
17
17
|
height: "20px",
|
|
@@ -19,24 +19,24 @@ var u = i("g")(({ theme: e }) => ({
|
|
|
19
19
|
stroke: "transparent"
|
|
20
20
|
},
|
|
21
21
|
"& .line": {
|
|
22
|
-
stroke:
|
|
22
|
+
stroke: s.defaults.TEXT,
|
|
23
23
|
transition: "fill 200ms linear, height 200ms linear",
|
|
24
|
-
"&.non-interactive":
|
|
24
|
+
"&.non-interactive": c("stroke")
|
|
25
25
|
},
|
|
26
26
|
"& .disabledPoint": {
|
|
27
|
-
fill:
|
|
28
|
-
stroke:
|
|
27
|
+
fill: s.defaults.BLACK + " !important",
|
|
28
|
+
stroke: s.defaults.BLACK + " !important"
|
|
29
29
|
},
|
|
30
|
-
"& .correctIcon": { backgroundColor:
|
|
31
|
-
"& .incorrectIcon": { backgroundColor:
|
|
30
|
+
"& .correctIcon": { backgroundColor: s.correct() },
|
|
31
|
+
"& .incorrectIcon": { backgroundColor: s.incorrectWithIcon() },
|
|
32
32
|
"& .correctnessIcon": {
|
|
33
33
|
borderRadius: e.spacing(2),
|
|
34
|
-
color:
|
|
34
|
+
color: s.defaults.WHITE,
|
|
35
35
|
fontSize: "16px",
|
|
36
36
|
width: "16px",
|
|
37
37
|
height: "16px",
|
|
38
38
|
padding: "2px",
|
|
39
|
-
border: `1px solid ${
|
|
39
|
+
border: `1px solid ${s.defaults.WHITE}`,
|
|
40
40
|
stroke: "initial",
|
|
41
41
|
boxSizing: "unset"
|
|
42
42
|
},
|
|
@@ -45,35 +45,35 @@ var u = i("g")(({ theme: e }) => ({
|
|
|
45
45
|
width: "10px",
|
|
46
46
|
height: "10px"
|
|
47
47
|
}
|
|
48
|
-
})), d = class extends
|
|
48
|
+
})), d = class extends e.Component {
|
|
49
49
|
static propTypes = {
|
|
50
|
-
x:
|
|
51
|
-
y:
|
|
52
|
-
width:
|
|
53
|
-
graphProps:
|
|
54
|
-
className:
|
|
55
|
-
interactive:
|
|
56
|
-
CustomDraggableComponent:
|
|
57
|
-
correctness:
|
|
58
|
-
value:
|
|
59
|
-
label:
|
|
50
|
+
x: n.number.isRequired,
|
|
51
|
+
y: n.number.isRequired,
|
|
52
|
+
width: n.number,
|
|
53
|
+
graphProps: a.GraphPropsType.isRequired,
|
|
54
|
+
className: n.string,
|
|
55
|
+
interactive: n.bool,
|
|
56
|
+
CustomDraggableComponent: n.func,
|
|
57
|
+
correctness: n.shape({
|
|
58
|
+
value: n.string,
|
|
59
|
+
label: n.string
|
|
60
60
|
})
|
|
61
61
|
};
|
|
62
62
|
render() {
|
|
63
|
-
let { x:
|
|
63
|
+
let { x: e, y: n, graphProps: r, className: i, interactive: a, CustomDraggableComponent: o, correctness: s, ...c } = this.props, { scale: d } = r;
|
|
64
64
|
return o ? /* @__PURE__ */ l(u, { children: /* @__PURE__ */ l(o, {
|
|
65
65
|
scale: d,
|
|
66
|
-
x:
|
|
66
|
+
x: e,
|
|
67
67
|
y: n,
|
|
68
|
-
className:
|
|
68
|
+
className: t(i, !a && "non-interactive"),
|
|
69
69
|
correctness: s,
|
|
70
70
|
interactive: a,
|
|
71
71
|
...c
|
|
72
72
|
}) }) : null;
|
|
73
73
|
}
|
|
74
|
-
}, f =
|
|
74
|
+
}, f = i({
|
|
75
75
|
axis: "y",
|
|
76
|
-
fromDelta: (e, t) => (t.x = 0,
|
|
76
|
+
fromDelta: (e, t) => (t.x = 0, o.point(e).add(o.point(t)).y),
|
|
77
77
|
bounds: (e, { domain: t, range: n }) => {
|
|
78
78
|
let r = {
|
|
79
79
|
left: 0,
|
|
@@ -81,7 +81,7 @@ var u = i("g")(({ theme: e }) => ({
|
|
|
81
81
|
bottom: e.y,
|
|
82
82
|
right: 0
|
|
83
83
|
};
|
|
84
|
-
return
|
|
84
|
+
return o.bounds(r, t, n);
|
|
85
85
|
},
|
|
86
86
|
anchorPoint: (e) => ({
|
|
87
87
|
x: e.x,
|
package/dist/line/common/line.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
import t from "../../node_modules/.bun/@
|
|
3
|
-
import n
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import o from "
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
1
|
+
import e from "react";
|
|
2
|
+
import t from "../../node_modules/.bun/@visx_group@4.0.0_d84c32d47042070f/node_modules/@visx/group/esm/Group.js";
|
|
3
|
+
import n from "../../node_modules/.bun/@visx_shape@4.0.0_d84c32d47042070f/node_modules/@visx/shape/esm/shapes/LinePath.js";
|
|
4
|
+
import r from "prop-types";
|
|
5
|
+
import { types as i } from "@pie-lib/plot";
|
|
6
|
+
import a, { DragHandle as o } from "./drag-handle.js";
|
|
7
|
+
import { MarkSlider as s } from "../../common/mark-slider.js";
|
|
8
|
+
import { styled as c } from "@mui/material/styles";
|
|
9
|
+
import { isEqual as l } from "@pie-element/shared-lodash";
|
|
10
10
|
import { color as u } from "@pie-lib/render-ui";
|
|
11
11
|
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
12
12
|
// src/line/common/line.tsx
|
|
@@ -17,28 +17,28 @@ var p = (e, t) => {
|
|
|
17
17
|
x: r > 1 ? t * (n / (r - 1)) : .5,
|
|
18
18
|
y: e.value
|
|
19
19
|
}));
|
|
20
|
-
}, m =
|
|
20
|
+
}, m = c(n)(() => ({
|
|
21
21
|
fill: "transparent",
|
|
22
22
|
stroke: u.defaults.TERTIARY,
|
|
23
23
|
strokeWidth: 3,
|
|
24
24
|
transition: "stroke 200ms ease-in, stroke-width 200ms ease-in"
|
|
25
|
-
})), h = class extends
|
|
25
|
+
})), h = class extends e.Component {
|
|
26
26
|
static propTypes = {
|
|
27
|
-
onChange:
|
|
28
|
-
value:
|
|
29
|
-
label:
|
|
30
|
-
xBand:
|
|
31
|
-
index:
|
|
32
|
-
graphProps:
|
|
33
|
-
defineChart:
|
|
34
|
-
disabled:
|
|
35
|
-
data:
|
|
36
|
-
label:
|
|
37
|
-
value:
|
|
27
|
+
onChange: r.func,
|
|
28
|
+
value: r.number,
|
|
29
|
+
label: r.string,
|
|
30
|
+
xBand: r.func,
|
|
31
|
+
index: r.number.isRequired,
|
|
32
|
+
graphProps: i.GraphPropsType.isRequired,
|
|
33
|
+
defineChart: r.bool,
|
|
34
|
+
disabled: r.bool,
|
|
35
|
+
data: r.arrayOf(r.shape({
|
|
36
|
+
label: r.string,
|
|
37
|
+
value: r.number
|
|
38
38
|
})),
|
|
39
|
-
CustomDraggableComponent:
|
|
40
|
-
correctData:
|
|
41
|
-
language:
|
|
39
|
+
CustomDraggableComponent: r.func,
|
|
40
|
+
correctData: r.array,
|
|
41
|
+
language: r.string
|
|
42
42
|
};
|
|
43
43
|
static defaultProps = { index: 0 };
|
|
44
44
|
constructor(e) {
|
|
@@ -48,7 +48,7 @@ var p = (e, t) => {
|
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
50
|
UNSAFE_componentWillReceiveProps(e) {
|
|
51
|
-
|
|
51
|
+
l(this.props.data, e.data) || this.setState({ line: p(e.data, e.graphProps.domain) });
|
|
52
52
|
}
|
|
53
53
|
componentDidUpdate(e) {
|
|
54
54
|
this.props.disabled && !e.disabled && this.state.dragging && this.setState({
|
|
@@ -75,69 +75,69 @@ var p = (e, t) => {
|
|
|
75
75
|
r[e].dragValue = n, this.setDragValue(r);
|
|
76
76
|
};
|
|
77
77
|
render() {
|
|
78
|
-
let { graphProps:
|
|
79
|
-
return /* @__PURE__ */ f(
|
|
78
|
+
let { graphProps: t, data: n, CustomDraggableComponent: r, defineChart: i, correctData: c, disabled: l, language: u } = this.props, { line: h, dragging: g } = this.state, { scale: _ } = t, v = g ? h : p(n, t.domain);
|
|
79
|
+
return /* @__PURE__ */ f(e.Fragment, { children: [/* @__PURE__ */ d(m, {
|
|
80
80
|
data: v,
|
|
81
81
|
x: (e) => _.x(e.x),
|
|
82
82
|
y: (e) => _.y(e.dragValue === void 0 ? e.y : e.dragValue),
|
|
83
83
|
className: "line"
|
|
84
|
-
}), v && v.map((
|
|
85
|
-
let f =
|
|
86
|
-
return /* @__PURE__ */ d(
|
|
84
|
+
}), v && v.map((e, n) => {
|
|
85
|
+
let f = i || e.interactive, p = f ? a : o, m = e.dragValue === void 0 ? e.y : e.dragValue;
|
|
86
|
+
return /* @__PURE__ */ d(s, {
|
|
87
87
|
enabled: f && !l,
|
|
88
|
-
label:
|
|
89
|
-
index:
|
|
88
|
+
label: e.label,
|
|
89
|
+
index: n,
|
|
90
90
|
value: m,
|
|
91
|
-
graphProps:
|
|
91
|
+
graphProps: t,
|
|
92
92
|
language: u,
|
|
93
93
|
focusBox: {
|
|
94
|
-
x: _.x(
|
|
94
|
+
x: _.x(e.x) - 14,
|
|
95
95
|
y: _.y(m) - 14,
|
|
96
96
|
width: 28,
|
|
97
97
|
height: 28
|
|
98
98
|
},
|
|
99
|
-
onChange: (
|
|
99
|
+
onChange: (t) => this.changeValue(n, e, t),
|
|
100
100
|
children: /* @__PURE__ */ d(p, {
|
|
101
|
-
x:
|
|
101
|
+
x: e.x,
|
|
102
102
|
y: m,
|
|
103
103
|
interactive: f,
|
|
104
104
|
disabled: l,
|
|
105
105
|
r: 6,
|
|
106
106
|
onDragStart: () => this.setState({ dragging: !0 }),
|
|
107
|
-
onDrag: (e) => this.dragValue(
|
|
108
|
-
onDragStop: () => this.dragStop(
|
|
109
|
-
graphProps:
|
|
110
|
-
CustomDraggableComponent:
|
|
111
|
-
correctness:
|
|
107
|
+
onDrag: (e) => this.dragValue(n, m, e),
|
|
108
|
+
onDragStop: () => this.dragStop(n),
|
|
109
|
+
graphProps: t,
|
|
110
|
+
CustomDraggableComponent: r,
|
|
111
|
+
correctness: e.correctness,
|
|
112
112
|
correctData: c,
|
|
113
|
-
label:
|
|
113
|
+
label: e.label
|
|
114
114
|
})
|
|
115
|
-
}, `point-${
|
|
115
|
+
}, `point-${e.x}-${n}`);
|
|
116
116
|
})] });
|
|
117
117
|
}
|
|
118
|
-
}, g =
|
|
118
|
+
}, g = c(h)(() => ({ "& .line": {
|
|
119
119
|
fill: "transparent",
|
|
120
120
|
stroke: u.defaults.TERTIARY,
|
|
121
121
|
strokeWidth: 3,
|
|
122
122
|
transition: "stroke 200ms ease-in, stroke-width 200ms ease-in"
|
|
123
|
-
} })), _ = class extends
|
|
123
|
+
} })), _ = class extends e.Component {
|
|
124
124
|
static propTypes = {
|
|
125
|
-
data:
|
|
126
|
-
onChange:
|
|
127
|
-
xBand:
|
|
128
|
-
graphProps:
|
|
129
|
-
CustomDraggableComponent:
|
|
130
|
-
defineChart:
|
|
131
|
-
correctData:
|
|
125
|
+
data: r.array,
|
|
126
|
+
onChange: r.func,
|
|
127
|
+
xBand: r.func,
|
|
128
|
+
graphProps: i.GraphPropsType.isRequired,
|
|
129
|
+
CustomDraggableComponent: r.func,
|
|
130
|
+
defineChart: r.bool,
|
|
131
|
+
correctData: r.array
|
|
132
132
|
};
|
|
133
133
|
changeLine = (e, t) => {
|
|
134
134
|
let { onChange: n } = this.props, r = [...this.props.data], { dragValue: i, value: a } = t;
|
|
135
135
|
r[e].value = i >= 0 ? i : a, n(r);
|
|
136
136
|
};
|
|
137
137
|
render() {
|
|
138
|
-
let
|
|
139
|
-
return /* @__PURE__ */ d(
|
|
140
|
-
...
|
|
138
|
+
let e = this.props;
|
|
139
|
+
return /* @__PURE__ */ d(t, { children: /* @__PURE__ */ d(g, {
|
|
140
|
+
...e,
|
|
141
141
|
onChange: this.changeLine
|
|
142
142
|
}) });
|
|
143
143
|
}
|
package/dist/line/line-cross.js
CHANGED
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
import t from "
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
1
|
+
import e from "react";
|
|
2
|
+
import t from "prop-types";
|
|
3
|
+
import n from "../node_modules/.bun/@visx_shape@4.0.0_d84c32d47042070f/node_modules/@visx/shape/esm/shapes/LinePath.js";
|
|
4
|
+
import r from "../node_modules/.bun/@visx_group@4.0.0_d84c32d47042070f/node_modules/@visx/group/esm/Group.js";
|
|
5
|
+
import { styled as i } from "@mui/material/styles";
|
|
6
|
+
import { color as a } from "@pie-lib/render-ui";
|
|
7
|
+
import { dataToXBand as o } from "../utils.js";
|
|
8
|
+
import { types as s } from "@pie-lib/plot";
|
|
9
|
+
import { Line as c } from "./common/line.js";
|
|
10
|
+
import { CorrectnessIndicator as l, SmallCorrectPointIndicator as u } from "../common/correctness-indicators.js";
|
|
11
|
+
import { useDragHover as d } from "../common/drag-hover.js";
|
|
12
12
|
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
13
13
|
// src/line/line-cross.tsx
|
|
14
|
-
var m =
|
|
15
|
-
stroke:
|
|
14
|
+
var m = i(n)(() => ({
|
|
15
|
+
stroke: a.defaults.TEXT,
|
|
16
16
|
transition: "fill 200ms linear, height 200ms linear",
|
|
17
|
-
"&.non-interactive": { stroke:
|
|
18
|
-
})), h =
|
|
19
|
-
stroke:
|
|
17
|
+
"&.non-interactive": { stroke: a.disabled?.() || "#ccc" }
|
|
18
|
+
})), h = i(r, { shouldForwardProp: (e) => e !== "correctness" && e !== "interactive" })(({ correctness: e, interactive: t }) => ({
|
|
19
|
+
stroke: a.defaults.TEXT,
|
|
20
20
|
transition: "fill 200ms linear, height 200ms linear",
|
|
21
21
|
...e && !t && {
|
|
22
|
-
fill: `${
|
|
23
|
-
stroke: `${
|
|
22
|
+
fill: `${a.defaults.BLACK} !important`,
|
|
23
|
+
stroke: `${a.defaults.BLACK} !important`
|
|
24
24
|
},
|
|
25
|
-
"&.non-interactive": { stroke:
|
|
26
|
-
})), g =
|
|
25
|
+
"&.non-interactive": { stroke: a.disabled?.() || "#ccc" }
|
|
26
|
+
})), g = i("circle")(() => ({
|
|
27
27
|
height: "20px",
|
|
28
28
|
fill: "transparent",
|
|
29
29
|
stroke: "transparent"
|
|
30
30
|
})), _ = (e) => {
|
|
31
|
-
let { className: t, scale: n, x: r, y:
|
|
31
|
+
let { className: t, scale: n, x: r, y: i, r: o, correctness: s, interactive: c, correctData: _, label: v, isDragging: y, disabled: b, onDragStart: x, onDrag: S, onDragStop: C, ...w } = e, { hovered: T, onEnter: E, onLeave: D } = d(!!y && !b), O = o * 4, k = O / 2, A = n.x(r), j = n.y(i);
|
|
32
32
|
return /* @__PURE__ */ p(h, {
|
|
33
33
|
className: t,
|
|
34
|
-
correctness:
|
|
35
|
-
interactive:
|
|
34
|
+
correctness: s,
|
|
35
|
+
interactive: c,
|
|
36
36
|
children: [
|
|
37
37
|
/* @__PURE__ */ f(m, {
|
|
38
38
|
data: [{
|
|
39
|
-
x: n.x(r) -
|
|
40
|
-
y: n.y(
|
|
39
|
+
x: n.x(r) - o,
|
|
40
|
+
y: n.y(i) + o
|
|
41
41
|
}, {
|
|
42
|
-
x: n.x(r) +
|
|
43
|
-
y: n.y(
|
|
42
|
+
x: n.x(r) + o,
|
|
43
|
+
y: n.y(i) - o
|
|
44
44
|
}],
|
|
45
45
|
x: (e) => e.x,
|
|
46
46
|
y: (e) => e.y,
|
|
47
47
|
strokeWidth: 5,
|
|
48
48
|
style: { pointerEvents: "none" }
|
|
49
|
-
}, `point-${r}-${
|
|
49
|
+
}, `point-${r}-${i}-1`),
|
|
50
50
|
/* @__PURE__ */ f(m, {
|
|
51
51
|
data: [{
|
|
52
|
-
x: n.x(r) -
|
|
53
|
-
y: n.y(
|
|
52
|
+
x: n.x(r) - o,
|
|
53
|
+
y: n.y(i) - o
|
|
54
54
|
}, {
|
|
55
|
-
x: n.x(r) +
|
|
56
|
-
y: n.y(
|
|
55
|
+
x: n.x(r) + o,
|
|
56
|
+
y: n.y(i) + o
|
|
57
57
|
}],
|
|
58
58
|
x: (e) => e.x,
|
|
59
59
|
y: (e) => e.y,
|
|
60
60
|
strokeWidth: 5,
|
|
61
61
|
style: { pointerEvents: "none" }
|
|
62
|
-
}, `point-${r}-${
|
|
62
|
+
}, `point-${r}-${i}-2`),
|
|
63
63
|
T && /* @__PURE__ */ f("rect", {
|
|
64
64
|
x: A - k,
|
|
65
65
|
y: j - k,
|
|
66
66
|
width: O,
|
|
67
67
|
height: O,
|
|
68
|
-
stroke:
|
|
68
|
+
stroke: a.defaults.BORDER_GRAY,
|
|
69
69
|
fill: "none",
|
|
70
70
|
strokeWidth: 2,
|
|
71
71
|
pointerEvents: "none"
|
|
@@ -73,24 +73,24 @@ var m = l(e)(() => ({
|
|
|
73
73
|
/* @__PURE__ */ f(g, {
|
|
74
74
|
cx: A,
|
|
75
75
|
cy: j,
|
|
76
|
-
r:
|
|
76
|
+
r: o * 2,
|
|
77
77
|
onMouseEnter: E,
|
|
78
78
|
onMouseLeave: D,
|
|
79
79
|
...w
|
|
80
80
|
}),
|
|
81
|
-
/* @__PURE__ */ f(
|
|
81
|
+
/* @__PURE__ */ f(l, {
|
|
82
82
|
scale: n,
|
|
83
83
|
x: r,
|
|
84
|
-
y:
|
|
85
|
-
r:
|
|
86
|
-
correctness:
|
|
87
|
-
interactive:
|
|
84
|
+
y: i,
|
|
85
|
+
r: o,
|
|
86
|
+
correctness: s,
|
|
87
|
+
interactive: c
|
|
88
88
|
}),
|
|
89
|
-
/* @__PURE__ */ f(
|
|
89
|
+
/* @__PURE__ */ f(u, {
|
|
90
90
|
scale: n,
|
|
91
91
|
x: r,
|
|
92
|
-
r:
|
|
93
|
-
correctness:
|
|
92
|
+
r: o,
|
|
93
|
+
correctness: s,
|
|
94
94
|
correctData: _,
|
|
95
95
|
label: v
|
|
96
96
|
})
|
|
@@ -98,30 +98,30 @@ var m = l(e)(() => ({
|
|
|
98
98
|
});
|
|
99
99
|
};
|
|
100
100
|
_.propTypes = {
|
|
101
|
-
scale:
|
|
102
|
-
x:
|
|
103
|
-
y:
|
|
104
|
-
r:
|
|
105
|
-
className:
|
|
106
|
-
correctness:
|
|
107
|
-
value:
|
|
108
|
-
label:
|
|
101
|
+
scale: t.object,
|
|
102
|
+
x: t.number,
|
|
103
|
+
y: t.number,
|
|
104
|
+
r: t.number,
|
|
105
|
+
className: t.string,
|
|
106
|
+
correctness: t.shape({
|
|
107
|
+
value: t.string,
|
|
108
|
+
label: t.string
|
|
109
109
|
}),
|
|
110
|
-
interactive:
|
|
111
|
-
correctData:
|
|
112
|
-
label:
|
|
110
|
+
interactive: t.bool,
|
|
111
|
+
correctData: t.array,
|
|
112
|
+
label: t.string
|
|
113
113
|
};
|
|
114
|
-
var v = class extends
|
|
114
|
+
var v = class extends e.Component {
|
|
115
115
|
static propTypes = {
|
|
116
|
-
data:
|
|
117
|
-
onChange:
|
|
118
|
-
graphProps:
|
|
116
|
+
data: t.array,
|
|
117
|
+
onChange: t.func,
|
|
118
|
+
graphProps: s.GraphPropsType.isRequired
|
|
119
119
|
};
|
|
120
120
|
render() {
|
|
121
|
-
let e = this.props, { data: t, graphProps:
|
|
122
|
-
return /* @__PURE__ */ f(
|
|
121
|
+
let e = this.props, { data: t, graphProps: n } = e, { scale: r = {}, size: i = {} } = n || {}, a = o(r.x, t, i.width, "lineCross");
|
|
122
|
+
return /* @__PURE__ */ f(c, {
|
|
123
123
|
...e,
|
|
124
|
-
xBand:
|
|
124
|
+
xBand: a,
|
|
125
125
|
CustomDraggableComponent: _
|
|
126
126
|
});
|
|
127
127
|
}
|