@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/chart.js
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
import {
|
|
14
|
-
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 "debug";
|
|
5
|
+
import { cloneDeep as i } from "@pie-element/shared-lodash";
|
|
6
|
+
import { Root as a, createGraphProps as o } from "@pie-lib/plot";
|
|
7
|
+
import { AlertDialog as s } from "@pie-lib/config-ui";
|
|
8
|
+
import { createUniqueId as c } from "@pie-lib/render-ui";
|
|
9
|
+
import { Grid as l } from "./grid.js";
|
|
10
|
+
import { RawChartAxes as u } from "./axes.js";
|
|
11
|
+
import { dataToXBand as d, getDomainAndRangeByChartType as ee, getGridLinesAndAxisByChartType as f, getTopPadding as p, textOf as m } from "./utils.js";
|
|
12
|
+
import h from "./chart-types.js";
|
|
13
|
+
import { ActionsButton as g } from "./actions-button.js";
|
|
14
|
+
import { dynamicMessageKey as _ } from "@pie-element/shared-i18n";
|
|
15
|
+
import { catalogs as v } from "./i18n/index.js";
|
|
15
16
|
import { jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
16
|
-
import { dynamicMessageKey as x } from "@pie-element/shared-i18n";
|
|
17
17
|
// src/chart.tsx
|
|
18
|
-
var
|
|
19
|
-
let
|
|
20
|
-
label:
|
|
18
|
+
var x = r("pie-lib:charts:chart"), S = n("div")(() => ({ width: "min-content" })), C = ({ title: e, chartType: t, categories: n, range: r, language: i, onLoad: a }) => {
|
|
19
|
+
let o = v.forLocale(i, a), s = o.t(_(`chartTypes.${t}`)), c = m(r.label), l = c ? o.t("labelledValueRange", {
|
|
20
|
+
label: c,
|
|
21
21
|
min: r.min,
|
|
22
22
|
max: r.max
|
|
23
|
-
}) :
|
|
23
|
+
}) : o.t("valueRange", {
|
|
24
24
|
min: r.min,
|
|
25
25
|
max: r.max
|
|
26
|
-
}),
|
|
26
|
+
}), u = n.length === 0 ? o.t("categoriesNone") : o.plural("categories", {
|
|
27
27
|
count: n.length,
|
|
28
|
-
categories: n.map((e) =>
|
|
28
|
+
categories: n.map((e) => m(e.label)).join(", ")
|
|
29
29
|
});
|
|
30
30
|
return {
|
|
31
|
-
ariaLabel:
|
|
32
|
-
ariaDescription: `${
|
|
31
|
+
ariaLabel: m(e) || s,
|
|
32
|
+
ariaDescription: `${s}. ${u} ${l}`
|
|
33
33
|
};
|
|
34
|
-
},
|
|
34
|
+
}, w = class extends e.Component {
|
|
35
35
|
relabel = () => this.forceUpdate();
|
|
36
36
|
constructor(e) {
|
|
37
37
|
super(e), this.state = {
|
|
@@ -42,54 +42,54 @@ var ee = p("pie-lib:charts:chart"), te = f("div")(() => ({ width: "min-content"
|
|
|
42
42
|
}, this.maskUid = this.generateMaskId();
|
|
43
43
|
}
|
|
44
44
|
static propTypes = {
|
|
45
|
-
className:
|
|
46
|
-
chartType:
|
|
47
|
-
size:
|
|
48
|
-
width:
|
|
49
|
-
height:
|
|
45
|
+
className: t.string,
|
|
46
|
+
chartType: t.string.isRequired,
|
|
47
|
+
size: t.shape({
|
|
48
|
+
width: t.number,
|
|
49
|
+
height: t.number
|
|
50
50
|
}),
|
|
51
|
-
domain:
|
|
52
|
-
label:
|
|
53
|
-
min:
|
|
54
|
-
max:
|
|
55
|
-
axisLabel:
|
|
51
|
+
domain: t.shape({
|
|
52
|
+
label: t.string,
|
|
53
|
+
min: t.number,
|
|
54
|
+
max: t.number,
|
|
55
|
+
axisLabel: t.string
|
|
56
56
|
}),
|
|
57
|
-
data:
|
|
58
|
-
label:
|
|
59
|
-
value:
|
|
57
|
+
data: t.arrayOf(t.shape({
|
|
58
|
+
label: t.string,
|
|
59
|
+
value: t.number
|
|
60
60
|
})),
|
|
61
|
-
range:
|
|
62
|
-
label:
|
|
63
|
-
min:
|
|
64
|
-
max:
|
|
65
|
-
step:
|
|
66
|
-
labelStep:
|
|
67
|
-
axisLabel:
|
|
61
|
+
range: t.shape({
|
|
62
|
+
label: t.string,
|
|
63
|
+
min: t.number,
|
|
64
|
+
max: t.number,
|
|
65
|
+
step: t.number,
|
|
66
|
+
labelStep: t.number,
|
|
67
|
+
axisLabel: t.string
|
|
68
68
|
}),
|
|
69
|
-
charts:
|
|
70
|
-
labelsPlaceholders:
|
|
71
|
-
title:
|
|
72
|
-
titlePlaceholder:
|
|
73
|
-
onDataChange:
|
|
74
|
-
onChangeLabels:
|
|
75
|
-
onChangeTitle:
|
|
76
|
-
error:
|
|
77
|
-
addCategoryEnabled:
|
|
78
|
-
showPixelGuides:
|
|
79
|
-
categoryDefaultLabel:
|
|
80
|
-
categoryDefaults:
|
|
81
|
-
defineChart:
|
|
82
|
-
disabled:
|
|
83
|
-
theme:
|
|
84
|
-
chartingOptions:
|
|
85
|
-
changeInteractiveEnabled:
|
|
86
|
-
changeEditableEnabled:
|
|
87
|
-
language:
|
|
88
|
-
mathMlOptions:
|
|
89
|
-
labelsCharactersLimit:
|
|
90
|
-
correctData:
|
|
91
|
-
label:
|
|
92
|
-
value:
|
|
69
|
+
charts: t.array,
|
|
70
|
+
labelsPlaceholders: t.object,
|
|
71
|
+
title: t.string,
|
|
72
|
+
titlePlaceholder: t.string,
|
|
73
|
+
onDataChange: t.func,
|
|
74
|
+
onChangeLabels: t.func,
|
|
75
|
+
onChangeTitle: t.func,
|
|
76
|
+
error: t.any,
|
|
77
|
+
addCategoryEnabled: t.bool,
|
|
78
|
+
showPixelGuides: t.bool,
|
|
79
|
+
categoryDefaultLabel: t.string,
|
|
80
|
+
categoryDefaults: t.object,
|
|
81
|
+
defineChart: t.bool,
|
|
82
|
+
disabled: t.bool,
|
|
83
|
+
theme: t.object,
|
|
84
|
+
chartingOptions: t.object,
|
|
85
|
+
changeInteractiveEnabled: t.bool,
|
|
86
|
+
changeEditableEnabled: t.bool,
|
|
87
|
+
language: t.string,
|
|
88
|
+
mathMlOptions: t.object,
|
|
89
|
+
labelsCharactersLimit: t.number,
|
|
90
|
+
correctData: t.arrayOf(t.shape({
|
|
91
|
+
label: t.string,
|
|
92
|
+
value: t.number
|
|
93
93
|
}))
|
|
94
94
|
};
|
|
95
95
|
static defaultProps = { size: {
|
|
@@ -98,17 +98,17 @@ var ee = p("pie-lib:charts:chart"), te = f("div")(() => ({ width: "min-content"
|
|
|
98
98
|
} };
|
|
99
99
|
state = {
|
|
100
100
|
charts: [
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
101
|
+
h.Bar(),
|
|
102
|
+
h.Histogram(),
|
|
103
|
+
h.LineDot(),
|
|
104
|
+
h.LineCross(),
|
|
105
|
+
h.DotPlot(),
|
|
106
|
+
h.LinePlot()
|
|
107
107
|
],
|
|
108
108
|
autoFocus: !1
|
|
109
109
|
};
|
|
110
110
|
generateMaskId() {
|
|
111
|
-
return
|
|
111
|
+
return c("chart");
|
|
112
112
|
}
|
|
113
113
|
setLabelOverhang = (e) => this.setState({ labelOverhang: e });
|
|
114
114
|
setRangeLabelOverhang = (e) => this.setState({ rangeLabelOverhang: e });
|
|
@@ -135,7 +135,7 @@ var ee = p("pie-lib:charts:chart"), te = f("div")(() => ({ width: "min-content"
|
|
|
135
135
|
}
|
|
136
136
|
};
|
|
137
137
|
addCategory = () => {
|
|
138
|
-
let { onDataChange: e, data: t, categoryDefaultLabel: n, defineChart: r, categoryDefaults: i, language: a } = this.props, o =
|
|
138
|
+
let { onDataChange: e, data: t, categoryDefaultLabel: n, defineChart: r, categoryDefaults: i, language: a } = this.props, o = v.forLocale(a);
|
|
139
139
|
(t || []).length > 19 ? this.setState({ dialog: {
|
|
140
140
|
open: !0,
|
|
141
141
|
title: o.t("warning"),
|
|
@@ -165,56 +165,56 @@ var ee = p("pie-lib:charts:chart"), te = f("div")(() => ({ width: "min-content"
|
|
|
165
165
|
this.setState({ autoFocus: !1 });
|
|
166
166
|
};
|
|
167
167
|
render() {
|
|
168
|
-
let { domain:
|
|
169
|
-
left:
|
|
170
|
-
bottom:
|
|
171
|
-
}, { type: z, ChartComponent: B } = this.getChart(), V = this.getFilteredCategories(), H =
|
|
172
|
-
title:
|
|
168
|
+
let { domain: e = {}, range: t = {}, chartingOptions: n, size: r, title: c, onChangeTitle: m, onChangeLabels: h, labelsPlaceholders: _, titlePlaceholder: v, addCategoryEnabled: w, changeInteractiveEnabled: T, changeEditableEnabled: E, showPixelGuides: D, error: O, mathMlOptions: k = {}, language: A, labelsCharactersLimit: j, correctData: M, disabled: te } = this.props, { chartType: N } = this.props, { dialog: P } = this.state, F = this.props.defineChart || !1, { width: I, height: L } = r || {}, R = {
|
|
169
|
+
left: t?.label || "",
|
|
170
|
+
bottom: e?.label || ""
|
|
171
|
+
}, { type: z, ChartComponent: B } = this.getChart(), V = this.getFilteredCategories(), H = ee(e, t, N), { ariaLabel: U, ariaDescription: W } = C({
|
|
172
|
+
title: c,
|
|
173
173
|
chartType: z,
|
|
174
174
|
categories: V,
|
|
175
175
|
range: {
|
|
176
176
|
...H.range,
|
|
177
|
-
label:
|
|
177
|
+
label: t.label
|
|
178
178
|
},
|
|
179
|
-
language:
|
|
179
|
+
language: A,
|
|
180
180
|
onLoad: this.relabel
|
|
181
|
-
}), { verticalLines: G, horizontalLines: K, leftAxis: q } =
|
|
182
|
-
|
|
181
|
+
}), { verticalLines: G, horizontalLines: K, leftAxis: q } = f(H.range, N), J = { graphProps: o(H.domain, H.range, r, () => this.rootNode) };
|
|
182
|
+
x("[render] common:", J);
|
|
183
183
|
let Y = {
|
|
184
184
|
x: -10,
|
|
185
185
|
y: -75,
|
|
186
186
|
width: I + 20,
|
|
187
187
|
height: L + 130
|
|
188
|
-
}, { scale: X } = J.graphProps, Z =
|
|
189
|
-
return $.graphProps.size.height += Q + re, (N === "dotPlot" || N === "linePlot") &&
|
|
190
|
-
title:
|
|
191
|
-
onChangeTitle:
|
|
188
|
+
}, { scale: X } = J.graphProps, Z = d(X.x, V, I, N), ne = Z.bandwidth() || X.x(H.domain.max) / V.length, re = F ? 160 : 60, Q = Math.max(p(ne), this.state.labelOverhang), $ = i(J);
|
|
189
|
+
return $.graphProps.size.height += Q + re, (N === "dotPlot" || N === "linePlot") && M?.length && R.bottom && ($.graphProps.size.height += 25), /* @__PURE__ */ b(S, { children: [/* @__PURE__ */ b(a, {
|
|
190
|
+
title: c,
|
|
191
|
+
onChangeTitle: m,
|
|
192
192
|
disabledTitle: !F,
|
|
193
193
|
showTitle: !0,
|
|
194
194
|
showLabels: !0,
|
|
195
195
|
labels: R,
|
|
196
|
-
onChangeLabels:
|
|
197
|
-
labelsPlaceholders:
|
|
198
|
-
titlePlaceholder:
|
|
196
|
+
onChangeLabels: h,
|
|
197
|
+
labelsPlaceholders: _,
|
|
198
|
+
titlePlaceholder: v,
|
|
199
199
|
defineChart: F,
|
|
200
200
|
disabledLabels: !F,
|
|
201
201
|
isChart: !0,
|
|
202
|
-
showPixelGuides:
|
|
202
|
+
showPixelGuides: D,
|
|
203
203
|
rootRef: (e) => this.rootNode = e,
|
|
204
|
-
mathMlOptions:
|
|
205
|
-
labelsCharactersLimit:
|
|
204
|
+
mathMlOptions: k,
|
|
205
|
+
labelsCharactersLimit: j,
|
|
206
206
|
ariaLabel: U,
|
|
207
207
|
ariaDescription: W,
|
|
208
208
|
leftAxisOverhang: this.state.rangeLabelOverhang,
|
|
209
209
|
...$,
|
|
210
210
|
children: [
|
|
211
|
-
/* @__PURE__ */ y(
|
|
211
|
+
/* @__PURE__ */ y(l, {
|
|
212
212
|
...J,
|
|
213
213
|
xBand: Z,
|
|
214
214
|
rowTickValues: K,
|
|
215
215
|
columnTickValues: G
|
|
216
216
|
}),
|
|
217
|
-
/* @__PURE__ */ y(
|
|
217
|
+
/* @__PURE__ */ y(u, {
|
|
218
218
|
autoFocus: this.state.autoFocus,
|
|
219
219
|
onAutoFocusUsed: this.resetAutoFocus,
|
|
220
220
|
...J,
|
|
@@ -224,17 +224,17 @@ var ee = p("pie-lib:charts:chart"), te = f("div")(() => ({ width: "min-content"
|
|
|
224
224
|
leftAxis: q,
|
|
225
225
|
onChange: this.changeData,
|
|
226
226
|
onChangeCategory: this.changeCategory,
|
|
227
|
-
chartingOptions:
|
|
228
|
-
changeInteractiveEnabled:
|
|
229
|
-
changeEditableEnabled:
|
|
227
|
+
chartingOptions: n,
|
|
228
|
+
changeInteractiveEnabled: T,
|
|
229
|
+
changeEditableEnabled: E,
|
|
230
230
|
top: Q,
|
|
231
|
-
error:
|
|
231
|
+
error: O,
|
|
232
232
|
showCorrectness: N === "linePlot" || N === "dotPlot",
|
|
233
|
-
language:
|
|
233
|
+
language: A,
|
|
234
234
|
onLabelOverhang: this.setLabelOverhang,
|
|
235
235
|
onRangeLabelOverhang: this.setRangeLabelOverhang
|
|
236
236
|
}),
|
|
237
|
-
|
|
237
|
+
w ? /* @__PURE__ */ y("foreignObject", {
|
|
238
238
|
x: I,
|
|
239
239
|
y: L - 16,
|
|
240
240
|
width: I,
|
|
@@ -245,11 +245,11 @@ var ee = p("pie-lib:charts:chart"), te = f("div")(() => ({ width: "min-content"
|
|
|
245
245
|
display: "flex",
|
|
246
246
|
justifyContent: "flex-start"
|
|
247
247
|
},
|
|
248
|
-
children: /* @__PURE__ */ y(
|
|
248
|
+
children: /* @__PURE__ */ y(g, {
|
|
249
249
|
categories: V,
|
|
250
250
|
addCategory: this.addCategory,
|
|
251
251
|
deleteCategory: this.deleteCategory,
|
|
252
|
-
language:
|
|
252
|
+
language: A
|
|
253
253
|
})
|
|
254
254
|
})
|
|
255
255
|
}) : null,
|
|
@@ -269,13 +269,13 @@ var ee = p("pie-lib:charts:chart"), te = f("div")(() => ({ width: "min-content"
|
|
|
269
269
|
defineChart: F,
|
|
270
270
|
onChange: this.changeData,
|
|
271
271
|
onChangeCategory: this.changeCategory,
|
|
272
|
-
correctData:
|
|
273
|
-
disabled:
|
|
274
|
-
language:
|
|
272
|
+
correctData: M,
|
|
273
|
+
disabled: te,
|
|
274
|
+
language: A
|
|
275
275
|
})
|
|
276
276
|
})
|
|
277
277
|
]
|
|
278
|
-
}), /* @__PURE__ */ y(
|
|
278
|
+
}), /* @__PURE__ */ y(s, {
|
|
279
279
|
open: P.open,
|
|
280
280
|
title: P.title,
|
|
281
281
|
text: P.text,
|
|
@@ -284,4 +284,4 @@ var ee = p("pie-lib:charts:chart"), te = f("div")(() => ({ width: "min-content"
|
|
|
284
284
|
})] });
|
|
285
285
|
}
|
|
286
286
|
};
|
|
287
|
-
export {
|
|
287
|
+
export { w as Chart, w as default, C as chartAlternative };
|
|
@@ -1,73 +1,73 @@
|
|
|
1
1
|
import "react";
|
|
2
2
|
import e from "prop-types";
|
|
3
3
|
import { styled as t } from "@mui/material/styles";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import i from "@
|
|
7
|
-
import a from "
|
|
4
|
+
import n from "@mui/icons-material/Check";
|
|
5
|
+
import r from "@mui/icons-material/Close";
|
|
6
|
+
import { color as i } from "@pie-lib/render-ui";
|
|
7
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
8
8
|
// src/common/correctness-indicators.tsx
|
|
9
|
-
var o = t(
|
|
9
|
+
var o = t(n)(({ theme: e }) => ({
|
|
10
10
|
borderRadius: e.spacing(2),
|
|
11
|
-
color:
|
|
11
|
+
color: i.defaults.WHITE,
|
|
12
12
|
fontSize: "16px",
|
|
13
13
|
width: "16px",
|
|
14
14
|
height: "16px",
|
|
15
15
|
padding: "2px",
|
|
16
|
-
border: `1px solid ${
|
|
16
|
+
border: `1px solid ${i.defaults.WHITE}`,
|
|
17
17
|
stroke: "initial",
|
|
18
18
|
boxSizing: "unset",
|
|
19
|
-
backgroundColor:
|
|
19
|
+
backgroundColor: i.correct(),
|
|
20
20
|
display: "block",
|
|
21
21
|
"&.small": {
|
|
22
22
|
fontSize: "10px",
|
|
23
23
|
width: "10px",
|
|
24
24
|
height: "10px"
|
|
25
25
|
}
|
|
26
|
-
})), s = t(
|
|
26
|
+
})), s = t(r)(({ theme: e }) => ({
|
|
27
27
|
borderRadius: e.spacing(2),
|
|
28
|
-
color:
|
|
28
|
+
color: i.defaults.WHITE,
|
|
29
29
|
fontSize: "16px",
|
|
30
30
|
width: "16px",
|
|
31
31
|
height: "16px",
|
|
32
32
|
padding: "2px",
|
|
33
|
-
border: `1px solid ${
|
|
33
|
+
border: `1px solid ${i.defaults.WHITE}`,
|
|
34
34
|
stroke: "initial",
|
|
35
35
|
boxSizing: "unset",
|
|
36
|
-
backgroundColor:
|
|
36
|
+
backgroundColor: i.incorrectWithIcon(),
|
|
37
37
|
display: "block",
|
|
38
38
|
"&.small": {
|
|
39
39
|
fontSize: "10px",
|
|
40
40
|
width: "10px",
|
|
41
41
|
height: "10px"
|
|
42
42
|
}
|
|
43
|
-
})), c = ({ scale: e, x: t, y: n, correctness:
|
|
44
|
-
if (!
|
|
45
|
-
let c = e ? e.x(t) : t, l = e ? e.y(n) : n, u =
|
|
46
|
-
return /* @__PURE__ */
|
|
43
|
+
})), c = ({ scale: e, x: t, y: n, correctness: r, interactive: i }) => {
|
|
44
|
+
if (!r || !i) return null;
|
|
45
|
+
let c = e ? e.x(t) : t, l = e ? e.y(n) : n, u = r.value === "correct";
|
|
46
|
+
return /* @__PURE__ */ a("foreignObject", {
|
|
47
47
|
x: c - 11,
|
|
48
48
|
y: l - 11,
|
|
49
49
|
width: 22,
|
|
50
50
|
height: 22,
|
|
51
|
-
children:
|
|
51
|
+
children: a(u ? o : s, { title: r.label })
|
|
52
52
|
});
|
|
53
|
-
}, l = ({ scale: e, x: t, correctness: n, correctData:
|
|
53
|
+
}, l = ({ scale: e, x: t, correctness: n, correctData: r, label: i }) => {
|
|
54
54
|
if (n && n.value === "incorrect") {
|
|
55
|
-
let s = parseFloat(
|
|
55
|
+
let s = parseFloat(r.find((e) => e.label === i)?.value);
|
|
56
56
|
if (isNaN(s)) return null;
|
|
57
57
|
let c = e.y(s) - 7.5, l = e.x(t) - 7.5;
|
|
58
|
-
return /* @__PURE__ */
|
|
58
|
+
return /* @__PURE__ */ a("foreignObject", {
|
|
59
59
|
x: l,
|
|
60
60
|
y: c,
|
|
61
61
|
width: 15,
|
|
62
62
|
height: 15,
|
|
63
|
-
children: /* @__PURE__ */
|
|
63
|
+
children: /* @__PURE__ */ a(o, {
|
|
64
64
|
className: "small",
|
|
65
65
|
title: n.label
|
|
66
66
|
})
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
69
|
return null;
|
|
70
|
-
}, u = ({ correctness: e, interactive: t }) => !e || !t ? null : e.value === "correct" ? /* @__PURE__ */
|
|
70
|
+
}, u = ({ correctness: e, interactive: t }) => !e || !t ? null : e.value === "correct" ? /* @__PURE__ */ a(o, { title: e.label }) : /* @__PURE__ */ a(s, { title: e.label });
|
|
71
71
|
c.propTypes = {
|
|
72
72
|
scale: e.shape({
|
|
73
73
|
x: e.func,
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { getScale as e } from "../utils.js";
|
|
2
|
-
import t from "./drag-icon.js";
|
|
3
1
|
import "react";
|
|
4
|
-
import
|
|
5
|
-
import { styled as
|
|
2
|
+
import e from "prop-types";
|
|
3
|
+
import { styled as t } from "@mui/material/styles";
|
|
4
|
+
import n from "@mui/icons-material/Check";
|
|
5
|
+
import r from "@mui/icons-material/Close";
|
|
6
6
|
import { gridDraggable as i, types as a, utils as o } from "@pie-lib/plot";
|
|
7
7
|
import { color as s } from "@pie-lib/render-ui";
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
import d from "
|
|
8
|
+
import { getScale as c } from "../utils.js";
|
|
9
|
+
import l from "./drag-icon.js";
|
|
10
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
11
11
|
// src/common/drag-handle.tsx
|
|
12
|
-
var f =
|
|
12
|
+
var f = t("svg")(() => ({ overflow: "visible !important" })), p = t("ellipse")(() => ({
|
|
13
13
|
fill: "transparent",
|
|
14
14
|
clipPath: "polygon(50% 0%, 100% 0%, 100% 50%, 0% 50%, 0% 0%)"
|
|
15
|
-
})), m =
|
|
15
|
+
})), m = t(n)(() => ({
|
|
16
16
|
backgroundColor: s.correct(),
|
|
17
17
|
borderRadius: "16px",
|
|
18
18
|
color: s.defaults.WHITE,
|
|
@@ -22,7 +22,7 @@ var f = r("svg")(() => ({ overflow: "visible !important" })), p = r("ellipse")((
|
|
|
22
22
|
width: "16px",
|
|
23
23
|
height: "16px",
|
|
24
24
|
boxSizing: "unset"
|
|
25
|
-
})), h = r
|
|
25
|
+
})), h = t(r)(() => ({
|
|
26
26
|
backgroundColor: s.incorrectWithIcon(),
|
|
27
27
|
borderRadius: "16px",
|
|
28
28
|
color: s.defaults.WHITE,
|
|
@@ -32,48 +32,48 @@ var f = r("svg")(() => ({ overflow: "visible !important" })), p = r("ellipse")((
|
|
|
32
32
|
width: "16px",
|
|
33
33
|
height: "16px",
|
|
34
34
|
boxSizing: "unset"
|
|
35
|
-
})), g = ({ x:
|
|
36
|
-
let { scale: S } =
|
|
37
|
-
return /* @__PURE__ */
|
|
38
|
-
x:
|
|
39
|
-
y: S.y(
|
|
40
|
-
width:
|
|
35
|
+
})), g = ({ x: e, y: t, width: n, graphProps: r, interactive: i, isHovered: a, correctness: o, isPlot: g, isDragging: _, onDragStart: v, onDrag: y, onDragStop: b, ...x }) => {
|
|
36
|
+
let { scale: S } = r, C = c(n)?.scale;
|
|
37
|
+
return /* @__PURE__ */ d(f, {
|
|
38
|
+
x: e,
|
|
39
|
+
y: S.y(t) - 10,
|
|
40
|
+
width: n,
|
|
41
41
|
overflow: "visible",
|
|
42
42
|
children: [
|
|
43
|
-
|
|
44
|
-
width:
|
|
43
|
+
a && !o && i && /* @__PURE__ */ u(l, {
|
|
44
|
+
width: n,
|
|
45
45
|
scaleValue: C,
|
|
46
46
|
color: s.defaults.BORDER_GRAY
|
|
47
47
|
}),
|
|
48
|
-
|
|
49
|
-
cx:
|
|
48
|
+
i && !o && /* @__PURE__ */ u(p, {
|
|
49
|
+
cx: n / 2,
|
|
50
50
|
cy: 10,
|
|
51
|
-
rx:
|
|
51
|
+
rx: n / 2,
|
|
52
52
|
ry: 66,
|
|
53
53
|
...x
|
|
54
54
|
}),
|
|
55
|
-
|
|
56
|
-
x:
|
|
55
|
+
o && i && !g && /* @__PURE__ */ u("foreignObject", {
|
|
56
|
+
x: n / 2 - 14,
|
|
57
57
|
y: 0,
|
|
58
58
|
width: 40,
|
|
59
59
|
height: 40,
|
|
60
|
-
children:
|
|
60
|
+
children: o.value === "correct" ? /* @__PURE__ */ u(m, { title: o.label }) : /* @__PURE__ */ u(h, { title: o.label })
|
|
61
61
|
})
|
|
62
62
|
]
|
|
63
63
|
});
|
|
64
64
|
};
|
|
65
65
|
g.propTypes = {
|
|
66
|
-
x:
|
|
67
|
-
y:
|
|
68
|
-
width:
|
|
66
|
+
x: e.number.isRequired,
|
|
67
|
+
y: e.number.isRequired,
|
|
68
|
+
width: e.number,
|
|
69
69
|
graphProps: a.GraphPropsType.isRequired,
|
|
70
|
-
interactive:
|
|
71
|
-
isHovered:
|
|
72
|
-
correctness:
|
|
73
|
-
value:
|
|
74
|
-
label:
|
|
70
|
+
interactive: e.bool,
|
|
71
|
+
isHovered: e.bool,
|
|
72
|
+
correctness: e.shape({
|
|
73
|
+
value: e.string,
|
|
74
|
+
label: e.string
|
|
75
75
|
}),
|
|
76
|
-
isPlot:
|
|
76
|
+
isPlot: e.bool
|
|
77
77
|
};
|
|
78
78
|
var _ = g, v = i({
|
|
79
79
|
axis: "y",
|
package/dist/common/drag-icon.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { getAdjustedX as e, getScale as t } from "../utils.js";
|
|
2
1
|
import "react";
|
|
3
|
-
import
|
|
2
|
+
import e from "prop-types";
|
|
3
|
+
import { getAdjustedX as t, getScale as n } from "../utils.js";
|
|
4
4
|
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
5
|
// src/common/drag-icon.tsx
|
|
6
|
-
var a = ({ width:
|
|
7
|
-
x: e
|
|
8
|
-
y:
|
|
6
|
+
var a = ({ width: e, scaleValue: a, color: o }) => /* @__PURE__ */ r("svg", {
|
|
7
|
+
x: t(e, a),
|
|
8
|
+
y: n(e)?.deltay,
|
|
9
9
|
color: o,
|
|
10
|
-
width:
|
|
11
|
-
height:
|
|
10
|
+
width: e,
|
|
11
|
+
height: e,
|
|
12
12
|
overflow: "visible",
|
|
13
|
-
viewBox: `0 0 ${
|
|
13
|
+
viewBox: `0 0 ${e} ${e}`,
|
|
14
14
|
style: { overflow: "visible !important" },
|
|
15
15
|
children: /* @__PURE__ */ i("g", {
|
|
16
16
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -37,8 +37,8 @@ var a = ({ width: n, scaleValue: a, color: o }) => /* @__PURE__ */ r("svg", {
|
|
|
37
37
|
})
|
|
38
38
|
});
|
|
39
39
|
a.propTypes = {
|
|
40
|
-
width:
|
|
41
|
-
scaleValue:
|
|
42
|
-
color:
|
|
40
|
+
width: e.number.isRequired,
|
|
41
|
+
scaleValue: e.number.isRequired,
|
|
42
|
+
color: e.string
|
|
43
43
|
};
|
|
44
44
|
export { a as default };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import e, { useReducer as t } from "react";
|
|
2
|
+
import { styled as n } from "@mui/material/styles";
|
|
3
|
+
import { keyboard as r } from "@pie-lib/plot";
|
|
4
|
+
import { color as i } from "@pie-lib/render-ui";
|
|
5
|
+
import { textOf as a } from "../utils.js";
|
|
6
|
+
import { catalogs as o } from "../i18n/index.js";
|
|
7
7
|
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
8
8
|
// src/common/mark-slider.tsx
|
|
9
|
-
var l =
|
|
9
|
+
var l = n("g")({
|
|
10
10
|
outline: "none",
|
|
11
11
|
"& > .focus-ring": {
|
|
12
12
|
display: "none",
|
|
@@ -15,8 +15,8 @@ var l = i("g")({
|
|
|
15
15
|
strokeWidth: 2
|
|
16
16
|
},
|
|
17
17
|
"&:focus-visible > .focus-ring": { display: "inline" },
|
|
18
|
-
"& > .focus-ring > .outer": { stroke:
|
|
19
|
-
"& > .focus-ring > .inner": { stroke:
|
|
18
|
+
"& > .focus-ring > .outer": { stroke: i.focusOutline() },
|
|
19
|
+
"& > .focus-ring > .inner": { stroke: i.v("pie")("background", i.defaults.WHITE) }
|
|
20
20
|
}), u = (e, t) => Math.abs(e / t - Math.round(e / t)) < 1e-9, d = (e, t) => t && t > e && u(t, e) ? t : void 0, f = ({ x: e, y: t, width: n, height: r }) => /* @__PURE__ */ c("g", {
|
|
21
21
|
className: "focus-ring",
|
|
22
22
|
children: [/* @__PURE__ */ s("rect", {
|
|
@@ -32,9 +32,9 @@ var l = i("g")({
|
|
|
32
32
|
width: Math.max(0, n - 6),
|
|
33
33
|
height: Math.max(0, r - 6)
|
|
34
34
|
})]
|
|
35
|
-
}), p =
|
|
36
|
-
let [, b] =
|
|
37
|
-
if (!
|
|
35
|
+
}), p = e.forwardRef(({ enabled: e, label: n, index: i, value: u, graphProps: p, language: m, focusBox: h, onChange: g, children: _, ...v }, y) => {
|
|
36
|
+
let [, b] = t((e) => e + 1, 0);
|
|
37
|
+
if (!e) return /* @__PURE__ */ s("g", {
|
|
38
38
|
ref: y,
|
|
39
39
|
...v,
|
|
40
40
|
children: _
|
|
@@ -45,8 +45,8 @@ var l = i("g")({
|
|
|
45
45
|
step: C,
|
|
46
46
|
largeStep: d(C, x.labelStep),
|
|
47
47
|
snap: S.y
|
|
48
|
-
}, T =
|
|
49
|
-
let t =
|
|
48
|
+
}, T = r.fitToRange(x.min, w), E = r.fitToRange(x.max, w), D = Number.isFinite(u) ? u : T, O = a(n) || o.forLocale(m, b).t("category", { index: i + 1 }), k = (e) => {
|
|
49
|
+
let t = r.sliderKeyValue(e.key, D, w);
|
|
50
50
|
t !== void 0 && (e.preventDefault(), t !== D && g(t));
|
|
51
51
|
};
|
|
52
52
|
return /* @__PURE__ */ c(l, {
|