@pie-lib/charting 8.0.1-next.20261005143122 → 8.0.1-next.20261005184705
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/bars/common/bars.d.ts +1 -0
- package/dist/bars/common/bars.js +24 -21
- package/dist/chart.d.ts +1 -0
- package/dist/chart.js +50 -48
- package/dist/line/common/line.d.ts +1 -0
- package/dist/line/common/line.js +10 -8
- package/dist/plot/common/plot.d.ts +1 -0
- package/dist/plot/common/plot.js +42 -39
- package/package.json +5 -5
|
@@ -33,6 +33,7 @@ export declare class RawBar extends React.Component {
|
|
|
33
33
|
}>>>;
|
|
34
34
|
}>>>;
|
|
35
35
|
interactive: PropTypes.Requireable<boolean>;
|
|
36
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
36
37
|
correctness: PropTypes.Requireable<PropTypes.InferProps<{
|
|
37
38
|
value: PropTypes.Requireable<string>;
|
|
38
39
|
label: PropTypes.Requireable<string>;
|
package/dist/bars/common/bars.js
CHANGED
|
@@ -47,6 +47,7 @@ var h = l("pie-lib:chart:bars"), g = [
|
|
|
47
47
|
index: s.number.isRequired,
|
|
48
48
|
graphProps: u.GraphPropsType.isRequired,
|
|
49
49
|
interactive: s.bool,
|
|
50
|
+
disabled: s.bool,
|
|
50
51
|
correctness: s.shape({
|
|
51
52
|
value: s.string,
|
|
52
53
|
label: s.string
|
|
@@ -89,7 +90,7 @@ var h = l("pie-lib:chart:bars"), g = [
|
|
|
89
90
|
h("[dragValue] next:", t), this.setDragValue(t);
|
|
90
91
|
};
|
|
91
92
|
render() {
|
|
92
|
-
let { graphProps: e, value: t, label: o, xBand: s, index: c, interactive: l,
|
|
93
|
+
let { graphProps: e, value: t, label: o, xBand: s, index: c, interactive: l, disabled: u, correctness: h, barColor: g, defineChart: b, correctData: x } = this.props, { scale: S, range: C } = e, { dragValue: w, isHovered: T } = this.state, E = v(T, g, c, _, l && !h), D = Number.isFinite(w) ? w : t, O = s.bandwidth(), k = S.y(C.max - D), A = s(n({ label: o }, c)), j = C.max - D, M = C.max - j, N = x ? x.find((e) => e.label === o) : null, P = l ? r : i, F = !!g;
|
|
93
94
|
return /* @__PURE__ */ m("g", {
|
|
94
95
|
ref: (e) => this.gRef = e,
|
|
95
96
|
onMouseEnter: this.handleMouseEnter,
|
|
@@ -98,20 +99,20 @@ var h = l("pie-lib:chart:bars"), g = [
|
|
|
98
99
|
onTouchEnd: this.handleMouseLeave,
|
|
99
100
|
children: [
|
|
100
101
|
/* @__PURE__ */ p(y, {
|
|
101
|
-
x:
|
|
102
|
-
y:
|
|
103
|
-
width:
|
|
104
|
-
height:
|
|
105
|
-
style: { fill:
|
|
102
|
+
x: A,
|
|
103
|
+
y: S.y(M),
|
|
104
|
+
width: O,
|
|
105
|
+
height: k,
|
|
106
|
+
style: { fill: E }
|
|
106
107
|
}),
|
|
107
|
-
|
|
108
|
-
let e = parseFloat(
|
|
108
|
+
h && h.value === "incorrect" && (() => {
|
|
109
|
+
let e = parseFloat(N && N.value);
|
|
109
110
|
if (isNaN(e)) return null;
|
|
110
|
-
let t =
|
|
111
|
+
let t = S.y(C.max - e), n = k, r = Math.abs(t - n), i = S.y(e), o = t > n ? d.borderGray() : d.defaults.WHITE, s = t > n ? i : i - r;
|
|
111
112
|
return /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(y, {
|
|
112
|
-
x:
|
|
113
|
+
x: A + 2,
|
|
113
114
|
y: s,
|
|
114
|
-
width:
|
|
115
|
+
width: O - 4,
|
|
115
116
|
height: r,
|
|
116
117
|
style: {
|
|
117
118
|
stroke: o,
|
|
@@ -120,25 +121,26 @@ var h = l("pie-lib:chart:bars"), g = [
|
|
|
120
121
|
fill: "none"
|
|
121
122
|
}
|
|
122
123
|
}), /* @__PURE__ */ p("foreignObject", {
|
|
123
|
-
x:
|
|
124
|
+
x: A + O - (F ? 24 : 14),
|
|
124
125
|
y: i - 12,
|
|
125
126
|
width: 24,
|
|
126
127
|
height: 24,
|
|
127
128
|
children: /* @__PURE__ */ p(a, { dashColor: o })
|
|
128
129
|
})] });
|
|
129
130
|
})(),
|
|
130
|
-
/* @__PURE__ */ p(
|
|
131
|
-
x:
|
|
132
|
-
y:
|
|
133
|
-
defineChart:
|
|
131
|
+
/* @__PURE__ */ p(P, {
|
|
132
|
+
x: A,
|
|
133
|
+
y: D,
|
|
134
|
+
defineChart: b,
|
|
134
135
|
interactive: l,
|
|
135
|
-
|
|
136
|
+
disabled: u,
|
|
137
|
+
width: O,
|
|
136
138
|
onDrag: (e) => this.dragValue(t, e),
|
|
137
139
|
onDragStop: this.dragStop,
|
|
138
140
|
graphProps: e,
|
|
139
|
-
correctness:
|
|
140
|
-
isHovered:
|
|
141
|
-
color:
|
|
141
|
+
correctness: h,
|
|
142
|
+
isHovered: T,
|
|
143
|
+
color: E
|
|
142
144
|
})
|
|
143
145
|
]
|
|
144
146
|
});
|
|
@@ -154,11 +156,12 @@ var h = l("pie-lib:chart:bars"), g = [
|
|
|
154
156
|
histogram: s.bool
|
|
155
157
|
};
|
|
156
158
|
render() {
|
|
157
|
-
let { data: t, graphProps: n, xBand: r, onChangeCategory: i, defineChart: a, histogram: o, correctData: s } = this.props;
|
|
159
|
+
let { data: t, graphProps: n, xBand: r, onChangeCategory: i, defineChart: a, histogram: o, correctData: s, disabled: c } = this.props;
|
|
158
160
|
return /* @__PURE__ */ p(e, { children: (t || []).map((e, t) => /* @__PURE__ */ p(x, {
|
|
159
161
|
value: e.value,
|
|
160
162
|
interactive: a || e.interactive,
|
|
161
163
|
defineChart: a,
|
|
164
|
+
disabled: c,
|
|
162
165
|
label: e.label,
|
|
163
166
|
xBand: r,
|
|
164
167
|
index: t,
|
package/dist/chart.d.ts
CHANGED
|
@@ -50,6 +50,7 @@ export declare class Chart extends React.Component {
|
|
|
50
50
|
categoryDefaultLabel: PropTypes.Requireable<string>;
|
|
51
51
|
categoryDefaults: PropTypes.Requireable<object>;
|
|
52
52
|
defineChart: PropTypes.Requireable<boolean>;
|
|
53
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
53
54
|
theme: PropTypes.Requireable<object>;
|
|
54
55
|
chartingOptions: PropTypes.Requireable<object>;
|
|
55
56
|
changeInteractiveEnabled: PropTypes.Requireable<boolean>;
|
package/dist/chart.js
CHANGED
|
@@ -7,36 +7,36 @@ import c from "react";
|
|
|
7
7
|
import l from "prop-types";
|
|
8
8
|
import { styled as u } from "@mui/material/styles";
|
|
9
9
|
import d from "debug";
|
|
10
|
-
import { cloneDeep as
|
|
11
|
-
import { Root as
|
|
12
|
-
import { AlertDialog as
|
|
13
|
-
import { createUniqueId as
|
|
14
|
-
import { jsx as
|
|
15
|
-
import
|
|
10
|
+
import { cloneDeep as ee } from "@pie-element/shared-lodash";
|
|
11
|
+
import { Root as f, createGraphProps as te, utils as p } from "@pie-lib/plot";
|
|
12
|
+
import { AlertDialog as m } from "@pie-lib/config-ui";
|
|
13
|
+
import { createUniqueId as h } from "@pie-lib/render-ui";
|
|
14
|
+
import { jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
15
|
+
import v from "@pie-lib/translator";
|
|
16
16
|
//#region src/chart.tsx
|
|
17
|
-
var { translator:
|
|
17
|
+
var { translator: y } = v, b = d("pie-lib:charts:chart"), x = u("div")(() => ({ width: "min-content" })), S = (e) => e ? p.extractTextFromHTML(e).trim() : "", C = ({ title: e, chartType: t, categories: n, range: r, language: i }) => {
|
|
18
18
|
let a = {
|
|
19
19
|
lng: i,
|
|
20
20
|
interpolation: { escapeValue: !1 }
|
|
21
|
-
}, o =
|
|
21
|
+
}, o = y.t(`charting.chartTypes.${t}`, a), s = S(r.label), c = s ? y.t("charting.labelledValueRange", {
|
|
22
22
|
...a,
|
|
23
23
|
label: s,
|
|
24
24
|
min: r.min,
|
|
25
25
|
max: r.max
|
|
26
|
-
}) :
|
|
26
|
+
}) : y.t("charting.valueRange", {
|
|
27
27
|
...a,
|
|
28
28
|
min: r.min,
|
|
29
29
|
max: r.max
|
|
30
|
-
}), l =
|
|
30
|
+
}), l = y.t("charting.categories", {
|
|
31
31
|
...a,
|
|
32
32
|
count: n.length,
|
|
33
|
-
categories: n.map((e) =>
|
|
33
|
+
categories: n.map((e) => S(e.label)).join(", ")
|
|
34
34
|
});
|
|
35
35
|
return {
|
|
36
|
-
ariaLabel:
|
|
36
|
+
ariaLabel: S(e) || o,
|
|
37
37
|
ariaDescription: `${o}. ${l} ${c}`
|
|
38
38
|
};
|
|
39
|
-
},
|
|
39
|
+
}, w = class extends c.Component {
|
|
40
40
|
constructor(e) {
|
|
41
41
|
super(e), this.state = {
|
|
42
42
|
dialog: { open: !1 },
|
|
@@ -82,6 +82,7 @@ var { translator: b } = y, x = d("pie-lib:charts:chart"), S = u("div")(() => ({
|
|
|
82
82
|
categoryDefaultLabel: l.string,
|
|
83
83
|
categoryDefaults: l.object,
|
|
84
84
|
defineChart: l.bool,
|
|
85
|
+
disabled: l.bool,
|
|
85
86
|
theme: l.object,
|
|
86
87
|
chartingOptions: l.object,
|
|
87
88
|
changeInteractiveEnabled: l.bool,
|
|
@@ -110,7 +111,7 @@ var { translator: b } = y, x = d("pie-lib:charts:chart"), S = u("div")(() => ({
|
|
|
110
111
|
autoFocus: !1
|
|
111
112
|
};
|
|
112
113
|
generateMaskId() {
|
|
113
|
-
return
|
|
114
|
+
return h("chart");
|
|
114
115
|
}
|
|
115
116
|
setLabelOverhang = (e) => this.setState({ labelOverhang: e });
|
|
116
117
|
handleAlertDialog = (e, t) => this.setState({ dialog: { open: e } }, t);
|
|
@@ -139,15 +140,15 @@ var { translator: b } = y, x = d("pie-lib:charts:chart"), S = u("div")(() => ({
|
|
|
139
140
|
let { onDataChange: e, data: t, categoryDefaultLabel: n, defineChart: r, categoryDefaults: i, language: a } = this.props;
|
|
140
141
|
(t || []).length > 19 ? this.setState({ dialog: {
|
|
141
142
|
open: !0,
|
|
142
|
-
title:
|
|
143
|
-
text:
|
|
143
|
+
title: y.t("common:warning", { lng: a }),
|
|
144
|
+
text: y.t("charting.reachedLimit_other", {
|
|
144
145
|
count: 20,
|
|
145
146
|
lng: a
|
|
146
147
|
}),
|
|
147
148
|
onConfirm: () => this.handleAlertDialog(!1)
|
|
148
149
|
} }) : (this.setState({ autoFocus: !0 }), e([...t, {
|
|
149
150
|
inDefineChart: r,
|
|
150
|
-
label: n ||
|
|
151
|
+
label: n || y.t("charting.newLabel", { lng: a }),
|
|
151
152
|
value: 0,
|
|
152
153
|
deletable: !0,
|
|
153
154
|
editable: !i || i?.editable,
|
|
@@ -169,10 +170,10 @@ var { translator: b } = y, x = d("pie-lib:charts:chart"), S = u("div")(() => ({
|
|
|
169
170
|
this.setState({ autoFocus: !1 });
|
|
170
171
|
};
|
|
171
172
|
render() {
|
|
172
|
-
let { domain: o = {}, range: c = {}, chartingOptions: l, size: u, title: d, onChangeTitle:
|
|
173
|
+
let { domain: o = {}, range: c = {}, chartingOptions: l, size: u, title: d, onChangeTitle: p, onChangeLabels: h, labelsPlaceholders: v, titlePlaceholder: y, addCategoryEnabled: S, changeInteractiveEnabled: w, changeEditableEnabled: T, showPixelGuides: E, error: D, mathMlOptions: O = {}, language: k, labelsCharactersLimit: A, correctData: j, disabled: M } = this.props, { chartType: N } = this.props, { dialog: P } = this.state, F = this.props.defineChart || !1, { width: I, height: L } = u || {}, R = {
|
|
173
174
|
left: c?.label || "",
|
|
174
175
|
bottom: o?.label || ""
|
|
175
|
-
}, { type: z, ChartComponent: B } = this.getChart(), V = this.getFilteredCategories(), H = n(o, c, N), { ariaLabel: U, ariaDescription: W } =
|
|
176
|
+
}, { type: z, ChartComponent: B } = this.getChart(), V = this.getFilteredCategories(), H = n(o, c, N), { ariaLabel: U, ariaDescription: W } = C({
|
|
176
177
|
title: d,
|
|
177
178
|
chartType: z,
|
|
178
179
|
categories: V,
|
|
@@ -180,43 +181,43 @@ var { translator: b } = y, x = d("pie-lib:charts:chart"), S = u("div")(() => ({
|
|
|
180
181
|
...H.range,
|
|
181
182
|
label: c.label
|
|
182
183
|
},
|
|
183
|
-
language:
|
|
184
|
-
}), { verticalLines: G, horizontalLines: K, leftAxis: q } = r(H.range, N), J = { graphProps:
|
|
185
|
-
|
|
184
|
+
language: k
|
|
185
|
+
}), { verticalLines: G, horizontalLines: K, leftAxis: q } = r(H.range, N), J = { graphProps: te(H.domain, H.range, u, () => this.rootNode) };
|
|
186
|
+
b("[render] common:", J);
|
|
186
187
|
let Y = {
|
|
187
188
|
x: -10,
|
|
188
189
|
y: -75,
|
|
189
190
|
width: I + 20,
|
|
190
191
|
height: L + 130
|
|
191
|
-
}, { scale: X } = J.graphProps, Z = t(X.x, V, I, N),
|
|
192
|
-
return $.graphProps.size.height += Q +
|
|
192
|
+
}, { scale: X } = J.graphProps, Z = t(X.x, V, I, N), ne = Z.bandwidth() || X.x(H.domain.max) / V.length, re = F ? 160 : 60, Q = Math.max(i(ne), this.state.labelOverhang), $ = ee(J);
|
|
193
|
+
return $.graphProps.size.height += Q + re, (N === "dotPlot" || N === "linePlot") && j?.length && R.bottom && ($.graphProps.size.height += 25), /* @__PURE__ */ _(x, { children: [/* @__PURE__ */ _(f, {
|
|
193
194
|
title: d,
|
|
194
|
-
onChangeTitle:
|
|
195
|
+
onChangeTitle: p,
|
|
195
196
|
disabledTitle: !F,
|
|
196
197
|
showTitle: !0,
|
|
197
198
|
showLabels: !0,
|
|
198
199
|
labels: R,
|
|
199
|
-
onChangeLabels:
|
|
200
|
-
labelsPlaceholders:
|
|
201
|
-
titlePlaceholder:
|
|
200
|
+
onChangeLabels: h,
|
|
201
|
+
labelsPlaceholders: v,
|
|
202
|
+
titlePlaceholder: y,
|
|
202
203
|
defineChart: F,
|
|
203
204
|
disabledLabels: !F,
|
|
204
205
|
isChart: !0,
|
|
205
|
-
showPixelGuides:
|
|
206
|
+
showPixelGuides: E,
|
|
206
207
|
rootRef: (e) => this.rootNode = e,
|
|
207
|
-
mathMlOptions:
|
|
208
|
-
labelsCharactersLimit:
|
|
208
|
+
mathMlOptions: O,
|
|
209
|
+
labelsCharactersLimit: A,
|
|
209
210
|
ariaLabel: U,
|
|
210
211
|
ariaDescription: W,
|
|
211
212
|
...$,
|
|
212
213
|
children: [
|
|
213
|
-
/* @__PURE__ */
|
|
214
|
+
/* @__PURE__ */ g(e, {
|
|
214
215
|
...J,
|
|
215
216
|
xBand: Z,
|
|
216
217
|
rowTickValues: K,
|
|
217
218
|
columnTickValues: G
|
|
218
219
|
}),
|
|
219
|
-
/* @__PURE__ */
|
|
220
|
+
/* @__PURE__ */ g(a, {
|
|
220
221
|
autoFocus: this.state.autoFocus,
|
|
221
222
|
onAutoFocusUsed: this.resetAutoFocus,
|
|
222
223
|
...J,
|
|
@@ -227,54 +228,55 @@ var { translator: b } = y, x = d("pie-lib:charts:chart"), S = u("div")(() => ({
|
|
|
227
228
|
onChange: this.changeData,
|
|
228
229
|
onChangeCategory: this.changeCategory,
|
|
229
230
|
chartingOptions: l,
|
|
230
|
-
changeInteractiveEnabled:
|
|
231
|
-
changeEditableEnabled:
|
|
231
|
+
changeInteractiveEnabled: w,
|
|
232
|
+
changeEditableEnabled: T,
|
|
232
233
|
top: Q,
|
|
233
|
-
error:
|
|
234
|
+
error: D,
|
|
234
235
|
showCorrectness: N === "linePlot" || N === "dotPlot",
|
|
235
|
-
language:
|
|
236
|
+
language: k,
|
|
236
237
|
onLabelOverhang: this.setLabelOverhang
|
|
237
238
|
}),
|
|
238
|
-
|
|
239
|
+
S ? /* @__PURE__ */ g("foreignObject", {
|
|
239
240
|
x: I,
|
|
240
241
|
y: L - 16,
|
|
241
242
|
width: I,
|
|
242
243
|
height: L,
|
|
243
|
-
children: /* @__PURE__ */
|
|
244
|
+
children: /* @__PURE__ */ g("div", {
|
|
244
245
|
xmlns: "http://www.w3.org/1999/xhtml",
|
|
245
246
|
style: {
|
|
246
247
|
display: "flex",
|
|
247
248
|
justifyContent: "flex-start"
|
|
248
249
|
},
|
|
249
|
-
children: /* @__PURE__ */
|
|
250
|
+
children: /* @__PURE__ */ g(s, {
|
|
250
251
|
categories: V,
|
|
251
252
|
addCategory: this.addCategory,
|
|
252
253
|
deleteCategory: this.deleteCategory,
|
|
253
|
-
language:
|
|
254
|
+
language: k
|
|
254
255
|
})
|
|
255
256
|
})
|
|
256
257
|
}) : null,
|
|
257
|
-
/* @__PURE__ */
|
|
258
|
+
/* @__PURE__ */ g("mask", {
|
|
258
259
|
id: `${this.maskUid}`,
|
|
259
|
-
children: /* @__PURE__ */
|
|
260
|
+
children: /* @__PURE__ */ g("rect", {
|
|
260
261
|
...Y,
|
|
261
262
|
fill: "white"
|
|
262
263
|
})
|
|
263
264
|
}),
|
|
264
|
-
/* @__PURE__ */
|
|
265
|
+
/* @__PURE__ */ g("g", {
|
|
265
266
|
mask: `url('#${this.maskUid}')`,
|
|
266
|
-
children: B && /* @__PURE__ */
|
|
267
|
+
children: B && /* @__PURE__ */ g(B, {
|
|
267
268
|
...J,
|
|
268
269
|
data: V,
|
|
269
270
|
height: $.graphProps.size.height,
|
|
270
271
|
defineChart: F,
|
|
271
272
|
onChange: this.changeData,
|
|
272
273
|
onChangeCategory: this.changeCategory,
|
|
273
|
-
correctData:
|
|
274
|
+
correctData: j,
|
|
275
|
+
disabled: M
|
|
274
276
|
})
|
|
275
277
|
})
|
|
276
278
|
]
|
|
277
|
-
}), /* @__PURE__ */
|
|
279
|
+
}), /* @__PURE__ */ g(m, {
|
|
278
280
|
open: P.open,
|
|
279
281
|
title: P.title,
|
|
280
282
|
text: P.text,
|
|
@@ -284,4 +286,4 @@ var { translator: b } = y, x = d("pie-lib:charts:chart"), S = u("div")(() => ({
|
|
|
284
286
|
}
|
|
285
287
|
};
|
|
286
288
|
//#endregion
|
|
287
|
-
export {
|
|
289
|
+
export { w as Chart, w as default, C as chartAlternative };
|
|
@@ -32,6 +32,7 @@ export declare class RawLine extends React.Component {
|
|
|
32
32
|
}>>>;
|
|
33
33
|
}>>>;
|
|
34
34
|
defineChart: PropTypes.Requireable<boolean>;
|
|
35
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
35
36
|
data: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
36
37
|
label: PropTypes.Requireable<string>;
|
|
37
38
|
value: PropTypes.Requireable<number>;
|
package/dist/line/common/line.js
CHANGED
|
@@ -30,6 +30,7 @@ var f = (e, t) => {
|
|
|
30
30
|
index: a.number.isRequired,
|
|
31
31
|
graphProps: c.GraphPropsType.isRequired,
|
|
32
32
|
defineChart: a.bool,
|
|
33
|
+
disabled: a.bool,
|
|
33
34
|
data: a.arrayOf(a.shape({
|
|
34
35
|
label: a.string,
|
|
35
36
|
value: a.number
|
|
@@ -59,18 +60,19 @@ var f = (e, t) => {
|
|
|
59
60
|
r[e].dragValue = n, this.setDragValue(r);
|
|
60
61
|
};
|
|
61
62
|
render() {
|
|
62
|
-
let { graphProps: e, data: t, CustomDraggableComponent: a, defineChart: o, correctData: s } = this.props, { line:
|
|
63
|
+
let { graphProps: e, data: t, CustomDraggableComponent: a, defineChart: o, correctData: s, disabled: c } = this.props, { line: l, dragging: m } = this.state, { scale: h } = e, g = m ? l : f(t, e.domain);
|
|
63
64
|
return /* @__PURE__ */ d(i.Fragment, { children: [/* @__PURE__ */ u(p, {
|
|
64
|
-
data:
|
|
65
|
-
x: (e) =>
|
|
66
|
-
y: (e) =>
|
|
65
|
+
data: g,
|
|
66
|
+
x: (e) => h.x(e.x),
|
|
67
|
+
y: (e) => h.y(e.dragValue === void 0 ? e.y : e.dragValue),
|
|
67
68
|
className: "line"
|
|
68
|
-
}),
|
|
69
|
-
let
|
|
70
|
-
return /* @__PURE__ */ u(
|
|
69
|
+
}), g && g.map((t, i) => {
|
|
70
|
+
let l = o || t.interactive;
|
|
71
|
+
return /* @__PURE__ */ u(l ? n : r, {
|
|
71
72
|
x: t.x,
|
|
72
73
|
y: t.dragValue === void 0 ? t.y : t.dragValue,
|
|
73
|
-
interactive:
|
|
74
|
+
interactive: l,
|
|
75
|
+
disabled: c,
|
|
74
76
|
r: 6,
|
|
75
77
|
onDragStart: () => this.setState({ dragging: !0 }),
|
|
76
78
|
onDrag: (e) => this.dragValue(i, t.dragValue === void 0 ? t.y : t.dragValue, e),
|
|
@@ -33,6 +33,7 @@ export declare class RawPlot extends React.Component {
|
|
|
33
33
|
}>>>;
|
|
34
34
|
CustomBarElement: PropTypes.Requireable<(...args: any[]) => any>;
|
|
35
35
|
interactive: PropTypes.Requireable<boolean>;
|
|
36
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
36
37
|
correctness: PropTypes.Requireable<PropTypes.InferProps<{
|
|
37
38
|
value: PropTypes.Requireable<string>;
|
|
38
39
|
label: PropTypes.Requireable<string>;
|
package/dist/plot/common/plot.js
CHANGED
|
@@ -21,6 +21,7 @@ var g = l("pie-lib:chart:bars"), _ = 16, v = class extends o.Component {
|
|
|
21
21
|
graphProps: u.GraphPropsType.isRequired,
|
|
22
22
|
CustomBarElement: s.func,
|
|
23
23
|
interactive: s.bool,
|
|
24
|
+
disabled: s.bool,
|
|
24
25
|
correctness: s.shape({
|
|
25
26
|
value: s.string,
|
|
26
27
|
label: s.string
|
|
@@ -74,83 +75,84 @@ var g = l("pie-lib:chart:bars"), _ = 16, v = class extends o.Component {
|
|
|
74
75
|
});
|
|
75
76
|
};
|
|
76
77
|
render() {
|
|
77
|
-
let { graphProps: e, value: n, label: r, xBand: s, index: c, CustomBarElement: l, interactive: u,
|
|
78
|
-
g("label:", r, "barX:",
|
|
79
|
-
let
|
|
80
|
-
for (let e = 0; e <
|
|
81
|
-
let
|
|
78
|
+
let { graphProps: e, value: n, label: r, xBand: s, index: c, CustomBarElement: l, interactive: u, disabled: h, correctness: _, defineChart: v, correctData: y, className: b } = this.props, { scale: x, range: S, size: C } = e, { max: w } = S || {}, { dragValue: T, isHovered: E } = this.state, D = Number.isFinite(T) ? T : n, O = s.bandwidth(), k = x.y(S.max - D), A = s(t({ label: r }, c));
|
|
79
|
+
g("label:", r, "barX:", A, "v: ", D, "barHeight:", k, "barWidth: ", O);
|
|
80
|
+
let j = [];
|
|
81
|
+
for (let e = 0; e < D; e++) j.push(e);
|
|
82
|
+
let M = C.height / w, N = (M > O ? O : M) * .8, P = u ? i : a, F = u && !_;
|
|
82
83
|
return /* @__PURE__ */ p(o.Fragment, { children: /* @__PURE__ */ m("g", {
|
|
83
|
-
className:
|
|
84
|
+
className: b,
|
|
84
85
|
onMouseEnter: this.handleMouseEnter,
|
|
85
86
|
onMouseLeave: this.handleMouseLeave,
|
|
86
87
|
onTouchStart: this.handleMouseEnter,
|
|
87
88
|
onTouchEnd: this.handleMouseLeave,
|
|
88
89
|
children: [
|
|
89
|
-
|
|
90
|
-
x:
|
|
91
|
-
y:
|
|
92
|
-
width:
|
|
93
|
-
height:
|
|
90
|
+
E && F && /* @__PURE__ */ p("rect", {
|
|
91
|
+
x: A,
|
|
92
|
+
y: x.y(D),
|
|
93
|
+
width: O,
|
|
94
|
+
height: j?.length ? M * j.length : 0,
|
|
94
95
|
stroke: d.defaults.BORDER_GRAY,
|
|
95
96
|
strokeWidth: "4px",
|
|
96
97
|
fill: "transparent"
|
|
97
98
|
}),
|
|
98
|
-
|
|
99
|
+
j.map((e) => l({
|
|
99
100
|
index: e,
|
|
100
|
-
pointDiameter:
|
|
101
|
-
barX:
|
|
102
|
-
barWidth:
|
|
103
|
-
pointHeight:
|
|
101
|
+
pointDiameter: N,
|
|
102
|
+
barX: A,
|
|
103
|
+
barWidth: O,
|
|
104
|
+
pointHeight: M,
|
|
104
105
|
label: r,
|
|
105
106
|
value: n,
|
|
106
|
-
scale:
|
|
107
|
+
scale: x
|
|
107
108
|
})),
|
|
108
|
-
|
|
109
|
-
let e = parseFloat(
|
|
109
|
+
_ && _.value === "incorrect" && (() => {
|
|
110
|
+
let e = parseFloat(y[c] && y[c].value);
|
|
110
111
|
if (isNaN(e)) return null;
|
|
111
|
-
let i =
|
|
112
|
-
if (e === 0) return this.renderCorrectnessIcon(
|
|
112
|
+
let i = D;
|
|
113
|
+
if (e === 0) return this.renderCorrectnessIcon(A, O, e, _, x, M, N);
|
|
113
114
|
if (i > e) {
|
|
114
115
|
let i = [];
|
|
115
116
|
for (let t = 0; t < e; t++) i.push(t);
|
|
116
|
-
let a = i[i.length - 1], o = s(t({ label: r }, c)), u = s.bandwidth(), d =
|
|
117
|
+
let a = i[i.length - 1], o = s(t({ label: r }, c)), u = s.bandwidth(), d = C.height / w, h = (d > u ? u : d) * .8;
|
|
117
118
|
return /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(l, {
|
|
118
119
|
index: a,
|
|
119
|
-
pointDiameter:
|
|
120
|
+
pointDiameter: h + 10,
|
|
120
121
|
barX: o,
|
|
121
122
|
barWidth: u,
|
|
122
123
|
pointHeight: d,
|
|
123
124
|
label: r,
|
|
124
125
|
value: n,
|
|
125
|
-
scale:
|
|
126
|
+
scale: x,
|
|
126
127
|
dottedOverline: !0
|
|
127
|
-
}), this.renderCorrectnessIcon(o, u, e,
|
|
128
|
+
}), this.renderCorrectnessIcon(o, u, e, _, x, d, h)] });
|
|
128
129
|
}
|
|
129
130
|
let a = [];
|
|
130
131
|
for (let t = i; t < e; t++) a.push(t);
|
|
131
132
|
return /* @__PURE__ */ m(f, { children: [a.map((e) => l({
|
|
132
133
|
index: e,
|
|
133
|
-
pointDiameter:
|
|
134
|
-
barX:
|
|
135
|
-
barWidth:
|
|
136
|
-
pointHeight:
|
|
134
|
+
pointDiameter: N,
|
|
135
|
+
barX: A,
|
|
136
|
+
barWidth: O,
|
|
137
|
+
pointHeight: M,
|
|
137
138
|
label: r,
|
|
138
139
|
value: n,
|
|
139
|
-
scale:
|
|
140
|
+
scale: x,
|
|
140
141
|
dottedOverline: !0
|
|
141
|
-
})), this.renderCorrectnessIcon(
|
|
142
|
+
})), this.renderCorrectnessIcon(A, O, e, _, x, M, N)] });
|
|
142
143
|
})(),
|
|
143
|
-
/* @__PURE__ */ p(
|
|
144
|
-
x:
|
|
145
|
-
y:
|
|
144
|
+
/* @__PURE__ */ p(P, {
|
|
145
|
+
x: A,
|
|
146
|
+
y: D,
|
|
146
147
|
interactive: u,
|
|
147
|
-
|
|
148
|
+
disabled: h,
|
|
149
|
+
width: O,
|
|
148
150
|
onDrag: (e) => this.dragValue(n, e),
|
|
149
151
|
onDragStop: this.dragStop,
|
|
150
152
|
graphProps: e,
|
|
151
|
-
correctness:
|
|
152
|
-
isHovered:
|
|
153
|
-
defineChart:
|
|
153
|
+
correctness: _,
|
|
154
|
+
isHovered: E,
|
|
155
|
+
defineChart: v,
|
|
154
156
|
color: d.primaryDark(),
|
|
155
157
|
isPlot: !0
|
|
156
158
|
})
|
|
@@ -207,12 +209,13 @@ var g = l("pie-lib:chart:bars"), _ = 16, v = class extends o.Component {
|
|
|
207
209
|
className: s.string
|
|
208
210
|
};
|
|
209
211
|
render() {
|
|
210
|
-
let { data: t, graphProps: n, xBand: r, CustomBarElement: i, onChangeCategory: a, defineChart: o, correctData: s } = this.props;
|
|
212
|
+
let { data: t, graphProps: n, xBand: r, CustomBarElement: i, onChangeCategory: a, defineChart: o, correctData: s, disabled: c } = this.props;
|
|
211
213
|
return /* @__PURE__ */ p(e, { children: (t || []).map((e, t) => /* @__PURE__ */ p(y, {
|
|
212
214
|
value: e.value,
|
|
213
215
|
label: e.label,
|
|
214
216
|
interactive: o || e.interactive,
|
|
215
217
|
defineChart: o,
|
|
218
|
+
disabled: c,
|
|
216
219
|
xBand: r,
|
|
217
220
|
index: t,
|
|
218
221
|
onChangeCategory: (e) => a(t, e),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-lib/charting",
|
|
3
|
-
"version": "8.0.1-next.
|
|
3
|
+
"version": "8.0.1-next.20261005184705",
|
|
4
4
|
"description": "charting",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -13,8 +13,8 @@
|
|
|
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-lib/plot": "5.0.1-next.
|
|
17
|
-
"@pie-lib/render-ui": "8.0.1-next.
|
|
16
|
+
"@pie-lib/plot": "5.0.1-next.20261005184705",
|
|
17
|
+
"@pie-lib/render-ui": "8.0.1-next.20261005184705",
|
|
18
18
|
"@pie-lib/translator": "5.0.1-next.20261005075357",
|
|
19
19
|
"@visx/axis": "^4.0.0",
|
|
20
20
|
"@visx/event": "^4.0.0",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"invariant": "^2.2.4",
|
|
30
30
|
"react-draggable": "^4.7.1",
|
|
31
31
|
"prop-types": "^15.8.1",
|
|
32
|
-
"@pie-lib/config-ui": "14.0.1-next.
|
|
32
|
+
"@pie-lib/config-ui": "14.0.1-next.20261005184705",
|
|
33
33
|
"@pie-element/shared-math-rendering-mathjax": "0.1.2-next.20261003161149",
|
|
34
|
-
"@pie-element/shared-lodash": "0.1.2-next.
|
|
34
|
+
"@pie-element/shared-lodash": "0.1.2-next.20261005182602",
|
|
35
35
|
"clsx": "^2.1.1",
|
|
36
36
|
"d3-time": "^3.1.0",
|
|
37
37
|
"d3-interpolate": "^3.0.1",
|