@pie-lib/graphing-solution-set 5.0.1-next.20261004041321 → 5.0.1-next.20261004162038
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/axis/axes.js +43 -43
- package/dist/coordinates-label.js +8 -8
- package/dist/graph-with-controls.js +23 -23
- package/dist/graph.js +35 -35
- package/dist/grid-setup.js +71 -71
- package/dist/labels.js +21 -21
- package/dist/mark-label.js +18 -18
- package/dist/tool-menu.js +5 -5
- package/dist/tools/line/component.js +32 -31
- package/dist/tools/shared/arrow-head.d.ts +0 -1
- package/dist/tools/shared/arrow-head.js +10 -10
- package/dist/tools/shared/line/index.js +23 -23
- package/dist/tools/shared/point/base-point.js +11 -11
- package/dist/tools/shared/point/index.js +7 -7
- package/dist/undo-redo.js +8 -8
- package/package.json +6 -6
package/dist/axis/axes.js
CHANGED
|
@@ -4,10 +4,10 @@ import { amountToIncreaseWidth as n, countWords as r, findLongestWord as i, getT
|
|
|
4
4
|
import o from "react";
|
|
5
5
|
import s from "prop-types";
|
|
6
6
|
import { types as c } from "@pie-lib/plot";
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
7
|
+
import * as l from "@pie-lib/render-ui";
|
|
8
|
+
import { Readable as u, color as d } from "@pie-lib/render-ui";
|
|
9
|
+
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
10
|
+
import { styled as m } from "@mui/material/styles";
|
|
11
11
|
//#region src/axis/axes.tsx
|
|
12
12
|
function h(e) {
|
|
13
13
|
return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
|
|
@@ -15,7 +15,7 @@ function h(e) {
|
|
|
15
15
|
function g(e, t) {
|
|
16
16
|
return !e || h(e) ? e : h(e.default) ? e.default : t && h(e[t]) ? e[t] : t && h(e[t]?.default) ? e[t].default : e;
|
|
17
17
|
}
|
|
18
|
-
var _ = g(
|
|
18
|
+
var _ = g(u, "Readable") || g(b.Readable, "Readable"), v = l, y = v.default, b = y && typeof y == "object" ? y : v, x = {
|
|
19
19
|
includeArrows: s.object,
|
|
20
20
|
graphProps: s.object
|
|
21
21
|
}, S = { includeArrows: {
|
|
@@ -23,16 +23,16 @@ var _ = g(p, "Readable") || g(b.Readable, "Readable"), v = f, y = v.default, b =
|
|
|
23
23
|
right: !0,
|
|
24
24
|
up: !0,
|
|
25
25
|
down: !0
|
|
26
|
-
} }, C =
|
|
26
|
+
} }, C = m("g")(() => ({
|
|
27
27
|
"& .visx-axis-line": {
|
|
28
28
|
stroke: "#8a92c0",
|
|
29
29
|
strokeWidth: 4
|
|
30
30
|
},
|
|
31
31
|
"& .visx-axis-tick": {
|
|
32
|
-
fill:
|
|
32
|
+
fill: d.defaults.BLACK,
|
|
33
33
|
"& > line": { stroke: "#8a92c0" }
|
|
34
34
|
}
|
|
35
|
-
})), w =
|
|
35
|
+
})), w = m("div")(({ theme: e, centered: t }) => ({
|
|
36
36
|
padding: 0,
|
|
37
37
|
margin: 0,
|
|
38
38
|
"* > *": {
|
|
@@ -42,7 +42,7 @@ var _ = g(p, "Readable") || g(b.Readable, "Readable"), v = f, y = v.default, b =
|
|
|
42
42
|
"& p": { margin: 0 },
|
|
43
43
|
fontSize: e.typography.fontSize,
|
|
44
44
|
...t && { textAlign: "center" }
|
|
45
|
-
})), T =
|
|
45
|
+
})), T = m(t)({ fill: "#8a92c0" }), E = {
|
|
46
46
|
fontFamily: "Roboto",
|
|
47
47
|
fontSize: "14px",
|
|
48
48
|
cursor: "inherit"
|
|
@@ -56,8 +56,8 @@ var _ = g(p, "Readable") || g(b.Readable, "Readable"), v = f, y = v.default, b =
|
|
|
56
56
|
};
|
|
57
57
|
static defaultProps = S;
|
|
58
58
|
render() {
|
|
59
|
-
let { includeArrows: t, graphProps: a, columnTicksValues: o, skipValues: s, distanceFromOriginToFirstNegativeY: c, dy:
|
|
60
|
-
let t = s && s[0] === e ? c + 4 :
|
|
59
|
+
let { includeArrows: t, graphProps: a, columnTicksValues: o, skipValues: s, distanceFromOriginToFirstNegativeY: c, dy: l } = this.props, { scale: u, domain: d, size: m, range: h } = a || {}, g = (e) => {
|
|
60
|
+
let t = s && s[0] === e ? c + 4 : l;
|
|
61
61
|
return {
|
|
62
62
|
...E,
|
|
63
63
|
textAnchor: "middle",
|
|
@@ -65,39 +65,39 @@ var _ = g(p, "Readable") || g(b.Readable, "Readable"), v = f, y = v.default, b =
|
|
|
65
65
|
dx: e === 0 ? -10 : 0,
|
|
66
66
|
dy: e === 0 ? -7 : 0
|
|
67
67
|
};
|
|
68
|
-
}, v = r(
|
|
69
|
-
return /* @__PURE__ */
|
|
70
|
-
/* @__PURE__ */
|
|
71
|
-
scale:
|
|
72
|
-
top:
|
|
68
|
+
}, v = r(d.axisLabel), y = n(i(d.axisLabel)) + 2;
|
|
69
|
+
return /* @__PURE__ */ p(C, { children: [
|
|
70
|
+
/* @__PURE__ */ f(e, {
|
|
71
|
+
scale: u.x,
|
|
72
|
+
top: u.y(0),
|
|
73
73
|
left: 0,
|
|
74
|
-
label:
|
|
74
|
+
label: d.label,
|
|
75
75
|
rangePadding: 8,
|
|
76
76
|
tickFormat: (e) => e,
|
|
77
77
|
tickLabelProps: g,
|
|
78
78
|
tickValues: o,
|
|
79
|
-
hideZero: !(
|
|
79
|
+
hideZero: !(d.labelStep || h.labelStep) && d.min <= 0
|
|
80
80
|
}),
|
|
81
|
-
t && t.left && /* @__PURE__ */
|
|
81
|
+
t && t.left && /* @__PURE__ */ f(T, {
|
|
82
82
|
direction: "left",
|
|
83
|
-
x:
|
|
83
|
+
x: d.min,
|
|
84
84
|
y: 0,
|
|
85
|
-
scale:
|
|
85
|
+
scale: u
|
|
86
86
|
}),
|
|
87
|
-
t && t.right && /* @__PURE__ */
|
|
87
|
+
t && t.right && /* @__PURE__ */ f(T, {
|
|
88
88
|
direction: "right",
|
|
89
|
-
x:
|
|
89
|
+
x: d.max,
|
|
90
90
|
y: 0,
|
|
91
|
-
scale:
|
|
91
|
+
scale: u
|
|
92
92
|
}),
|
|
93
|
-
|
|
93
|
+
d.axisLabel && /* @__PURE__ */ f("foreignObject", {
|
|
94
94
|
x: m.width + 17,
|
|
95
|
-
y:
|
|
95
|
+
y: u.y(0) - 9,
|
|
96
96
|
width: y,
|
|
97
97
|
height: 20 * v,
|
|
98
|
-
children: /* @__PURE__ */
|
|
98
|
+
children: /* @__PURE__ */ f(_, {
|
|
99
99
|
false: !0,
|
|
100
|
-
children: /* @__PURE__ */
|
|
100
|
+
children: /* @__PURE__ */ f(w, { dangerouslySetInnerHTML: { __html: d.axisLabel } })
|
|
101
101
|
})
|
|
102
102
|
})
|
|
103
103
|
] });
|
|
@@ -109,9 +109,9 @@ var _ = g(p, "Readable") || g(b.Readable, "Readable"), v = f, y = v.default, b =
|
|
|
109
109
|
};
|
|
110
110
|
static defaultProps = S;
|
|
111
111
|
render() {
|
|
112
|
-
let { includeArrows: t, graphProps: r, skipValues: i, rowTickValues: a } = this.props, { scale: o, range: s, size: c } = r || {},
|
|
113
|
-
return /* @__PURE__ */
|
|
114
|
-
/* @__PURE__ */
|
|
112
|
+
let { includeArrows: t, graphProps: r, skipValues: i, rowTickValues: a } = this.props, { scale: o, range: s, size: c } = r || {}, l = s.axisLabel ? n(s.axisLabel.length) : 0;
|
|
113
|
+
return /* @__PURE__ */ p(C, { children: [
|
|
114
|
+
/* @__PURE__ */ f(e, {
|
|
115
115
|
orientation: "left",
|
|
116
116
|
scale: o.y,
|
|
117
117
|
top: 0,
|
|
@@ -135,26 +135,26 @@ var _ = g(p, "Readable") || g(b.Readable, "Readable"), v = f, y = v.default, b =
|
|
|
135
135
|
tickTextAnchor: "bottom",
|
|
136
136
|
tickValues: a
|
|
137
137
|
}),
|
|
138
|
-
t && t.down && /* @__PURE__ */
|
|
138
|
+
t && t.down && /* @__PURE__ */ f(T, {
|
|
139
139
|
direction: "down",
|
|
140
140
|
x: 0,
|
|
141
141
|
y: s.min,
|
|
142
142
|
scale: o
|
|
143
143
|
}),
|
|
144
|
-
t && t.up && /* @__PURE__ */
|
|
144
|
+
t && t.up && /* @__PURE__ */ f(T, {
|
|
145
145
|
direction: "up",
|
|
146
146
|
x: 0,
|
|
147
147
|
y: s.max,
|
|
148
148
|
scale: o
|
|
149
149
|
}),
|
|
150
|
-
s.axisLabel && /* @__PURE__ */
|
|
151
|
-
x: o.x(0) -
|
|
150
|
+
s.axisLabel && /* @__PURE__ */ f("foreignObject", {
|
|
151
|
+
x: o.x(0) - l / 2,
|
|
152
152
|
y: -33,
|
|
153
|
-
width:
|
|
153
|
+
width: l,
|
|
154
154
|
height: "20",
|
|
155
|
-
children: /* @__PURE__ */
|
|
155
|
+
children: /* @__PURE__ */ f(_, {
|
|
156
156
|
false: !0,
|
|
157
|
-
children: /* @__PURE__ */
|
|
157
|
+
children: /* @__PURE__ */ f(w, {
|
|
158
158
|
centered: !0,
|
|
159
159
|
dangerouslySetInnerHTML: { __html: s.axisLabel }
|
|
160
160
|
})
|
|
@@ -195,16 +195,16 @@ var _ = g(p, "Readable") || g(b.Readable, "Readable"), v = f, y = v.default, b =
|
|
|
195
195
|
};
|
|
196
196
|
};
|
|
197
197
|
render() {
|
|
198
|
-
let { graphProps: e } = this.props, { domain: t, range: n } = e || {}, { columnTicksValues: r, firstNegativeX: i, distanceFromOriginToFirstNegativeX: a } = this.xValues(), { rowTickValues: o, firstNegativeY: s, distanceFromOriginToFirstNegativeY: c } = this.yValues(),
|
|
199
|
-
return /* @__PURE__ */
|
|
198
|
+
let { graphProps: e } = this.props, { domain: t, range: n } = e || {}, { columnTicksValues: r, firstNegativeX: i, distanceFromOriginToFirstNegativeX: a } = this.xValues(), { rowTickValues: o, firstNegativeY: s, distanceFromOriginToFirstNegativeY: c } = this.yValues(), l = D(i, s, a, c, 6, 25);
|
|
199
|
+
return /* @__PURE__ */ p(C, { children: [n.min <= 0 ? /* @__PURE__ */ f(A, {
|
|
200
200
|
...this.props,
|
|
201
|
-
skipValues:
|
|
201
|
+
skipValues: l,
|
|
202
202
|
columnTicksValues: r,
|
|
203
203
|
distanceFromOriginToFirstNegativeY: c,
|
|
204
204
|
dy: 25
|
|
205
|
-
}) : null, t.min <= 0 ? /* @__PURE__ */
|
|
205
|
+
}) : null, t.min <= 0 ? /* @__PURE__ */ f(M, {
|
|
206
206
|
...this.props,
|
|
207
|
-
skipValues:
|
|
207
|
+
skipValues: l,
|
|
208
208
|
rowTickValues: o,
|
|
209
209
|
distanceFromOriginToFirstNegativeX: a
|
|
210
210
|
}) : null] });
|
|
@@ -2,17 +2,17 @@ import { roundNumber as e } from "./utils.js";
|
|
|
2
2
|
import "react";
|
|
3
3
|
import t from "prop-types";
|
|
4
4
|
import { types as n } from "@pie-lib/plot";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { color as r } from "@pie-lib/render-ui";
|
|
6
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
7
|
+
import { styled as a } from "@mui/material/styles";
|
|
8
8
|
import o from "@mui/material/InputBase";
|
|
9
9
|
//#region src/coordinates-label.tsx
|
|
10
|
-
var s =
|
|
10
|
+
var s = a(o)(({ theme: e }) => ({
|
|
11
11
|
fontFamily: e.typography.fontFamily,
|
|
12
12
|
fontSize: e.typography.fontSize,
|
|
13
13
|
borderRadius: "8px",
|
|
14
14
|
background: e.palette.common.white,
|
|
15
|
-
color:
|
|
15
|
+
color: r.defaults.BLACK,
|
|
16
16
|
"& .MuiInputBase-input": { padding: 0 }
|
|
17
17
|
})), c = (e, t, n, r) => {
|
|
18
18
|
let { scale: i, domain: a, range: o } = e, s = n === o.min ? 16 : n === o.max ? 0 : 8;
|
|
@@ -23,15 +23,15 @@ var s = i(o)(({ theme: e }) => ({
|
|
|
23
23
|
left: i.x(t) + 10,
|
|
24
24
|
top: i.y(n) - s
|
|
25
25
|
};
|
|
26
|
-
}, l = ({ x: t, y: n, graphProps:
|
|
26
|
+
}, l = ({ x: t, y: n, graphProps: r }) => {
|
|
27
27
|
let a = `(${e(t)}, ${e(n)})`, o = (a.length || 0) * 6;
|
|
28
|
-
return /* @__PURE__ */
|
|
28
|
+
return /* @__PURE__ */ i(s, {
|
|
29
29
|
style: {
|
|
30
30
|
position: "absolute",
|
|
31
31
|
pointerEvents: "auto",
|
|
32
32
|
width: o,
|
|
33
33
|
padding: 0,
|
|
34
|
-
...c(
|
|
34
|
+
...c(r, t, n, o)
|
|
35
35
|
},
|
|
36
36
|
value: a,
|
|
37
37
|
inputProps: { ariaLabel: "naked" }
|
|
@@ -6,57 +6,57 @@ import { allTools as a, toolsArr as o } from "./tools/index.js";
|
|
|
6
6
|
import s from "react";
|
|
7
7
|
import c from "prop-types";
|
|
8
8
|
import { isString as l, uniq as u } from "@pie-element/shared-lodash";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
9
|
+
import { color as d } from "@pie-lib/render-ui";
|
|
10
|
+
import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
11
|
+
import { styled as h } from "@mui/material/styles";
|
|
12
12
|
import { Accordion as g, AccordionDetails as _, AccordionSummary as v, Typography as y } from "@mui/material";
|
|
13
13
|
import b from "@mui/icons-material/ExpandMore";
|
|
14
14
|
//#region src/graph-with-controls.tsx
|
|
15
15
|
var x = (e) => o.map((t) => ({
|
|
16
16
|
...t,
|
|
17
17
|
toolbar: !!e.find((e) => e === t.type)
|
|
18
|
-
})) || [], S = (e, t) => t && e && (e.find((e) => e.type === t.type) || {}).toolbar, C = (e) => e.find((e) => e.toolbar), w = (e) => e.filter((e) => !!a.find((t) => t === e.type)), T = (e, t) => t.filter((t) => !!e.find((e) => e === t.type)), E = (e) => o.find((t) => t.type === e) || null, D =
|
|
18
|
+
})) || [], S = (e, t) => t && e && (e.find((e) => e.type === t.type) || {}).toolbar, C = (e) => e.find((e) => e.toolbar), w = (e) => e.filter((e) => !!a.find((t) => t === e.type)), T = (e, t) => t.filter((t) => !!e.find((e) => e === t.type)), E = (e) => o.find((t) => t.type === e) || null, D = h("div")(() => ({
|
|
19
19
|
display: "flex",
|
|
20
20
|
flexDirection: "column",
|
|
21
21
|
width: "min-content"
|
|
22
|
-
})), O =
|
|
22
|
+
})), O = h("div")(() => ({
|
|
23
23
|
display: "flex",
|
|
24
24
|
justifyContent: "space-between",
|
|
25
25
|
padding: "calc(1.25rem - 12px) calc(1.25rem - 12px) 1.25rem",
|
|
26
|
-
color:
|
|
26
|
+
color: d.text(),
|
|
27
27
|
backgroundColor: "#9FA8DA",
|
|
28
28
|
"& button": {
|
|
29
29
|
fontSize: "0.875rem",
|
|
30
30
|
padding: "0.25rem .3rem",
|
|
31
31
|
width: "5rem"
|
|
32
32
|
}
|
|
33
|
-
})), k =
|
|
34
|
-
backgroundColor:
|
|
33
|
+
})), k = h(g)(() => ({
|
|
34
|
+
backgroundColor: d.primaryLight(),
|
|
35
35
|
width: "100%",
|
|
36
36
|
boxShadow: "none"
|
|
37
|
-
})), A =
|
|
37
|
+
})), A = h(v)(({ theme: e }) => ({
|
|
38
38
|
padding: `0 ${e.spacing(1)}`,
|
|
39
39
|
minHeight: "32px !important",
|
|
40
40
|
"& .MuiAccordionSummary-content": { margin: "4px 0 !important" }
|
|
41
|
-
})), j =
|
|
41
|
+
})), j = h(_)(({ theme: e }) => ({
|
|
42
42
|
padding: 0,
|
|
43
43
|
marginTop: e.spacing(1),
|
|
44
44
|
display: "flex",
|
|
45
45
|
justifyContent: "space-between"
|
|
46
|
-
})), M =
|
|
46
|
+
})), M = h("div")(() => ({
|
|
47
47
|
display: "flex",
|
|
48
48
|
flexDirection: "column",
|
|
49
49
|
marginTop: ".5rem"
|
|
50
|
-
})), N = ({ children: e, title: t }) => /* @__PURE__ */
|
|
50
|
+
})), N = ({ children: e, title: t }) => /* @__PURE__ */ m(k, {
|
|
51
51
|
square: !0,
|
|
52
52
|
disableGutters: !0,
|
|
53
|
-
children: [/* @__PURE__ */
|
|
54
|
-
expandIcon: /* @__PURE__ */
|
|
55
|
-
children: /* @__PURE__ */
|
|
53
|
+
children: [/* @__PURE__ */ p(A, {
|
|
54
|
+
expandIcon: /* @__PURE__ */ p(b, {}),
|
|
55
|
+
children: /* @__PURE__ */ p(y, {
|
|
56
56
|
variant: "subtitle1",
|
|
57
57
|
children: t
|
|
58
58
|
})
|
|
59
|
-
}), /* @__PURE__ */
|
|
59
|
+
}), /* @__PURE__ */ p(j, { children: e })]
|
|
60
60
|
});
|
|
61
61
|
N.propTypes = {
|
|
62
62
|
children: c.node,
|
|
@@ -96,31 +96,31 @@ var P = class extends s.Component {
|
|
|
96
96
|
changeCurrentTool = (e, t) => this.setState({ currentTool: t.find((t) => t.type === e) });
|
|
97
97
|
toggleLabelMode = () => this.setState((e) => ({ labelModeEnabled: !e.labelModeEnabled }));
|
|
98
98
|
render() {
|
|
99
|
-
let { currentTool: n, labelModeEnabled: a } = this.state, { axesSettings: o, className: s, coordinatesOnHover: c, collapsibleToolbar:
|
|
99
|
+
let { currentTool: n, labelModeEnabled: a } = this.state, { axesSettings: o, className: s, coordinatesOnHover: c, collapsibleToolbar: d, collapsibleToolbarTitle: h, disabled: g, disabledLabels: _, disabledTitle: v, domain: y, labels: b, labelsPlaceholders: E, onChangeLabels: k, onChangeMarks: A, onChangeTitle: j, onUndo: P, onRedo: F, range: I, size: L, showLabels: R, showPixelGuides: z, showTitle: B, title: V, titlePlaceholder: H, language: U, disableToolbar: W = !1, gssLineData: G, onChangeGssLineData: K, onSolutionSetSelected: q, onCustomReset: J } = this.props, { backgroundMarks: Y, marks: X, toolbarTools: Z } = this.props;
|
|
100
100
|
Z = u(Z || []).filter((e) => !!l(e)) || [], Y = w(Y || []), X = T(Z, X || []), G && G.lineA && X[0] && X[0].type === "line" && (X[0].fill = G.lineA.lineType), G && G.lineB && X[1] && X[1].type === "line" && (X[1].fill = G.lineB.lineType);
|
|
101
101
|
let Q = x(Z);
|
|
102
102
|
(!n || !S(Q, n)) && (n = C(Q));
|
|
103
|
-
let $ = G && /* @__PURE__ */
|
|
103
|
+
let $ = G && /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(r, {
|
|
104
104
|
numberOfLines: G.numberOfLines,
|
|
105
105
|
gssLineData: G,
|
|
106
106
|
onChange: K,
|
|
107
107
|
disabled: !!g,
|
|
108
108
|
language: U
|
|
109
|
-
}), !g && /* @__PURE__ */
|
|
109
|
+
}), !g && /* @__PURE__ */ p(M, { children: /* @__PURE__ */ p(i, {
|
|
110
110
|
onUndo: P,
|
|
111
111
|
onRedo: F,
|
|
112
112
|
onReset: J,
|
|
113
113
|
language: U
|
|
114
114
|
}) })] });
|
|
115
|
-
return /* @__PURE__ */
|
|
115
|
+
return /* @__PURE__ */ m(D, {
|
|
116
116
|
className: e(s),
|
|
117
117
|
children: [
|
|
118
|
-
!W && /* @__PURE__ */
|
|
118
|
+
!W && /* @__PURE__ */ p(O, { children: d ? /* @__PURE__ */ p(N, {
|
|
119
119
|
title: h,
|
|
120
120
|
children: $
|
|
121
121
|
}) : $ }),
|
|
122
|
-
/* @__PURE__ */
|
|
123
|
-
/* @__PURE__ */
|
|
122
|
+
/* @__PURE__ */ p("div", { ref: (e) => this.labelNode = e }),
|
|
123
|
+
/* @__PURE__ */ p(t, {
|
|
124
124
|
axesSettings: o,
|
|
125
125
|
backgroundMarks: Y,
|
|
126
126
|
coordinatesOnHover: c,
|
package/dist/graph.js
CHANGED
|
@@ -7,11 +7,12 @@ import s from "react";
|
|
|
7
7
|
import c from "prop-types";
|
|
8
8
|
import { cloneDeep as l, isEqual as u } from "@pie-element/shared-lodash";
|
|
9
9
|
import { Root as d, createGraphProps as f, types as p, utils as m } from "@pie-lib/plot";
|
|
10
|
-
import h from "@pie-lib/
|
|
11
|
-
import g from "
|
|
12
|
-
import
|
|
10
|
+
import { createUniqueId as h } from "@pie-lib/render-ui";
|
|
11
|
+
import g from "@pie-lib/translator";
|
|
12
|
+
import _ from "debug";
|
|
13
|
+
import { jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
13
14
|
//#region src/graph.tsx
|
|
14
|
-
var { translator:
|
|
15
|
+
var { translator: b } = g, x = _("pie-lib:graphing-solution-set:graph"), S = {
|
|
15
16
|
axesSettings: c.shape(r),
|
|
16
17
|
backgroundMarks: c.array,
|
|
17
18
|
className: c.string,
|
|
@@ -38,42 +39,42 @@ var { translator: y } = h, b = g("pie-lib:graphing-solution-set:graph"), x = {
|
|
|
38
39
|
title: c.string,
|
|
39
40
|
tools: c.array,
|
|
40
41
|
language: c.string
|
|
41
|
-
},
|
|
42
|
+
}, C = (e) => ({
|
|
42
43
|
x: -23,
|
|
43
44
|
y: -23,
|
|
44
45
|
width: e.width + 46,
|
|
45
46
|
height: e.height + 46
|
|
46
|
-
}),
|
|
47
|
+
}), w = (e) => e ? m.extractTextFromHTML(e).trim() : "", T = ({ title: e, domain: t, range: n, marks: r, language: i }) => {
|
|
47
48
|
let a = {
|
|
48
49
|
lng: i,
|
|
49
50
|
interpolation: { escapeValue: !1 }
|
|
50
|
-
}, o = ({ axisLabel: e, min: t, max: n }, r) =>
|
|
51
|
+
}, o = ({ axisLabel: e, min: t, max: n }, r) => b.t("graphing.axisRange", {
|
|
51
52
|
...a,
|
|
52
|
-
axis:
|
|
53
|
+
axis: w(e) || r,
|
|
53
54
|
min: t,
|
|
54
55
|
max: n
|
|
55
|
-
}), s = r.filter((e) => !e.building && (e.type !== "polygon" || e.isSolution)), c =
|
|
56
|
+
}), s = r.filter((e) => !e.building && (e.type !== "polygon" || e.isSolution)), c = b.t("graphing.plotted", {
|
|
56
57
|
...a,
|
|
57
58
|
count: s.length,
|
|
58
|
-
marks: s.map((e) =>
|
|
59
|
+
marks: s.map((e) => b.t(e.type === "polygon" ? "graphing.shadedRegion" : `graphing.${e.type}`, a).trim()).join(", ")
|
|
59
60
|
});
|
|
60
61
|
return {
|
|
61
|
-
ariaLabel:
|
|
62
|
+
ariaLabel: w(e) || b.t("graphing.graph", a),
|
|
62
63
|
ariaDescription: `${o(t, "x")} ${o(n, "y")} ${c}`
|
|
63
64
|
};
|
|
64
|
-
},
|
|
65
|
+
}, E = ({ marks: e, currentTool: t }) => {
|
|
65
66
|
let n = e.filter((e) => e.building)[0], r = l(e);
|
|
66
67
|
if (n && t && n.type !== t.type) {
|
|
67
68
|
let e = r.findIndex((e) => u(e, n));
|
|
68
69
|
e >= 0 && r.splice(e, 1);
|
|
69
70
|
}
|
|
70
71
|
return r;
|
|
71
|
-
},
|
|
72
|
+
}, D = class extends s.Component {
|
|
72
73
|
constructor(e) {
|
|
73
74
|
super(e), this.maskUid = this.generateMaskId();
|
|
74
75
|
}
|
|
75
76
|
static propTypes = {
|
|
76
|
-
...
|
|
77
|
+
...S,
|
|
77
78
|
currentTool: c.object
|
|
78
79
|
};
|
|
79
80
|
static defaultProps = {
|
|
@@ -83,7 +84,7 @@ var { translator: y } = h, b = g("pie-lib:graphing-solution-set:graph"), x = {
|
|
|
83
84
|
};
|
|
84
85
|
state = {};
|
|
85
86
|
generateMaskId() {
|
|
86
|
-
return "graph
|
|
87
|
+
return h("graph");
|
|
87
88
|
}
|
|
88
89
|
componentDidMount = () => this.setState({ labelNode: this.labelNode });
|
|
89
90
|
changeMark = (e, n) => {
|
|
@@ -119,7 +120,7 @@ var { translator: y } = h, b = g("pie-lib:graphing-solution-set:graph"), x = {
|
|
|
119
120
|
if (o.numberOfLines === 1 && o.selectedTool === "lineA" && a.length === 1 && !a[0].building || o.numberOfLines === 2 && o.selectedTool === "lineA" && a.length === 2 || o.numberOfLines === 2 && o.selectedTool === "lineA" && a.length === 1 && !a[0].building || o.numberOfLines === 2 && o.selectedTool === "lineB" && a.length === 2 && !a[1].building) return;
|
|
120
121
|
}
|
|
121
122
|
if (r || !i || [null, void 0].includes(t) || [null, void 0].includes(n)) return;
|
|
122
|
-
|
|
123
|
+
x("[onBgClick] x,y: ", t, n);
|
|
123
124
|
let c = a.filter((e) => e.building)[0], l;
|
|
124
125
|
l = c && i && c.type === i.type ? i.addPoint({
|
|
125
126
|
x: t,
|
|
@@ -130,13 +131,13 @@ var { translator: y } = h, b = g("pie-lib:graphing-solution-set:graph"), x = {
|
|
|
130
131
|
}, void 0), this.updateMarks(c, l, !0);
|
|
131
132
|
};
|
|
132
133
|
render() {
|
|
133
|
-
let { axesSettings: t, currentTool: r, coordinatesOnHover: a, size: s, disabledLabels: c, disabledTitle: l, domain: u, backgroundMarks: p, range: m, title: h, labels: g, labelModeEnabled:
|
|
134
|
+
let { axesSettings: t, currentTool: r, coordinatesOnHover: a, size: s, disabledLabels: c, disabledTitle: l, domain: u, backgroundMarks: p, range: m, title: h, labels: g, labelModeEnabled: _, labelsPlaceholders: b, showLabels: x, showPixelGuides: S, showTitle: w, titlePlaceholder: D, onChangeLabels: O, onChangeTitle: k, mathMlOptions: A = {}, gssLineData: j, disabled: M, language: N } = this.props, { marks: P } = this.props, F = f(u, m, s, () => this.rootNode), I = C(s), L = {
|
|
134
135
|
graphProps: F,
|
|
135
|
-
labelModeEnabled:
|
|
136
|
+
labelModeEnabled: _,
|
|
136
137
|
gssLineData: j,
|
|
137
138
|
language: N
|
|
138
139
|
};
|
|
139
|
-
P =
|
|
140
|
+
P = E({
|
|
140
141
|
marks: P || [],
|
|
141
142
|
currentTool: r
|
|
142
143
|
});
|
|
@@ -155,22 +156,22 @@ var { translator: y } = h, b = g("pie-lib:graphing-solution-set:graph"), x = {
|
|
|
155
156
|
});
|
|
156
157
|
let z = [];
|
|
157
158
|
z.push(...P.filter((e) => e.type === "polygon")), z.push(...P.filter((e) => e.type === "line"));
|
|
158
|
-
let { ariaLabel: B, ariaDescription: V } =
|
|
159
|
+
let { ariaLabel: B, ariaDescription: V } = T({
|
|
159
160
|
title: h,
|
|
160
161
|
domain: u,
|
|
161
162
|
range: m,
|
|
162
163
|
marks: [...p || [], ...z],
|
|
163
164
|
language: N
|
|
164
165
|
});
|
|
165
|
-
return /* @__PURE__ */
|
|
166
|
+
return /* @__PURE__ */ v(d, {
|
|
166
167
|
rootRef: (e) => this.rootNode = e,
|
|
167
168
|
disabledTitle: l,
|
|
168
169
|
disabledLabels: c,
|
|
169
170
|
labels: g,
|
|
170
171
|
labelsPlaceholders: b || {},
|
|
171
|
-
showPixelGuides:
|
|
172
|
+
showPixelGuides: S,
|
|
172
173
|
showLabels: x,
|
|
173
|
-
showTitle:
|
|
174
|
+
showTitle: w,
|
|
174
175
|
title: h,
|
|
175
176
|
titlePlaceholder: D,
|
|
176
177
|
onChangeTitle: k,
|
|
@@ -179,33 +180,32 @@ var { translator: y } = h, b = g("pie-lib:graphing-solution-set:graph"), x = {
|
|
|
179
180
|
ariaLabel: B,
|
|
180
181
|
ariaDescription: V,
|
|
181
182
|
...L,
|
|
182
|
-
children: /* @__PURE__ */
|
|
183
|
+
children: /* @__PURE__ */ y("g", {
|
|
183
184
|
transform: u && u.padding && u.range ? `translate(${u.padding}, ${m.padding})` : void 0,
|
|
184
185
|
children: [
|
|
185
|
-
/* @__PURE__ */
|
|
186
|
-
/* @__PURE__ */
|
|
186
|
+
/* @__PURE__ */ v(i, { ...L }),
|
|
187
|
+
/* @__PURE__ */ v(n, {
|
|
187
188
|
...t,
|
|
188
189
|
...L
|
|
189
190
|
}),
|
|
190
|
-
/* @__PURE__ */
|
|
191
|
+
/* @__PURE__ */ v(o, {
|
|
191
192
|
...s,
|
|
192
193
|
onClick: this.onBgClick,
|
|
193
194
|
...L
|
|
194
195
|
}),
|
|
195
|
-
/* @__PURE__ */
|
|
196
|
+
/* @__PURE__ */ y("mask", {
|
|
196
197
|
id: `${this.maskUid}`,
|
|
197
|
-
children: [/* @__PURE__ */
|
|
198
|
+
children: [/* @__PURE__ */ v("rect", {
|
|
198
199
|
...I,
|
|
199
200
|
fill: "white"
|
|
200
201
|
}), " "]
|
|
201
202
|
}),
|
|
202
|
-
/* @__PURE__ */
|
|
203
|
-
id: "marks",
|
|
203
|
+
/* @__PURE__ */ y("g", {
|
|
204
204
|
mask: `url('#${this.maskUid}')`,
|
|
205
205
|
children: [
|
|
206
206
|
(p || []).map((e, t) => {
|
|
207
207
|
let n = this.getComponent(e), r = e.type;
|
|
208
|
-
return /* @__PURE__ */
|
|
208
|
+
return /* @__PURE__ */ v(n, {
|
|
209
209
|
mark: {
|
|
210
210
|
...e,
|
|
211
211
|
disabled: !0,
|
|
@@ -218,7 +218,7 @@ var { translator: y } = h, b = g("pie-lib:graphing-solution-set:graph"), x = {
|
|
|
218
218
|
}),
|
|
219
219
|
z.map((e, t) => {
|
|
220
220
|
let n = this.getComponent(e), i = e.type;
|
|
221
|
-
return /* @__PURE__ */
|
|
221
|
+
return /* @__PURE__ */ v(n, {
|
|
222
222
|
mark: e,
|
|
223
223
|
coordinatesOnHover: a,
|
|
224
224
|
onChange: this.changeMark,
|
|
@@ -231,7 +231,7 @@ var { translator: y } = h, b = g("pie-lib:graphing-solution-set:graph"), x = {
|
|
|
231
231
|
...L
|
|
232
232
|
}, `${i}-${t}`);
|
|
233
233
|
}),
|
|
234
|
-
/* @__PURE__ */
|
|
234
|
+
/* @__PURE__ */ v("foreignObject", {
|
|
235
235
|
ref: (e) => this.labelNode = e,
|
|
236
236
|
x: "0",
|
|
237
237
|
y: "0",
|
|
@@ -249,4 +249,4 @@ var { translator: y } = h, b = g("pie-lib:graphing-solution-set:graph"), x = {
|
|
|
249
249
|
}
|
|
250
250
|
};
|
|
251
251
|
//#endregion
|
|
252
|
-
export {
|
|
252
|
+
export { D as Graph, D as default, S as graphPropTypes, E as removeBuildingToolIfCurrentToolDiffers };
|