@pie-element/charting 12.1.1 → 12.1.2-next.1
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/configure.js +2 -0
- package/controller.js +1 -0
- package/dist/author/charting-config.d.ts +30 -0
- package/dist/author/charting-config.js +126 -0
- package/dist/author/configure.d.ts +29 -0
- package/dist/author/configure.js +205 -0
- package/dist/author/correct-response.d.ts +27 -0
- package/dist/author/correct-response.js +115 -0
- package/dist/author/defaults.d.ts +229 -0
- package/dist/author/defaults.js +186 -0
- package/dist/author/index.d.ts +51 -0
- package/dist/author/index.js +74 -0
- package/dist/author/utils.d.ts +42 -0
- package/dist/author/utils.js +244 -0
- package/dist/browser/author/index.js +1242 -0
- package/dist/browser/author/index.js.map +1 -0
- package/dist/browser/chart-AvFvbpGV.js +58913 -0
- package/dist/browser/chart-AvFvbpGV.js.map +1 -0
- package/dist/browser/charting.css +2 -0
- package/dist/browser/controller/index.js +194 -0
- package/dist/browser/controller/index.js.map +1 -0
- package/dist/browser/delivery/index.js +517 -0
- package/dist/browser/delivery/index.js.map +1 -0
- package/dist/browser/dist-CA-Ok7CW.js +330 -0
- package/dist/browser/dist-CA-Ok7CW.js.map +1 -0
- package/dist/charting.css +2 -0
- package/dist/controller/defaults.d.ts +44 -0
- package/dist/controller/defaults.js +33 -0
- package/dist/controller/index.d.ts +28 -0
- package/dist/controller/index.js +153 -0
- package/dist/delivery/index.d.ts +21 -0
- package/dist/delivery/index.js +46 -0
- package/dist/delivery/main.d.ts +23 -0
- package/dist/delivery/main.js +128 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.iife.d.ts +8 -0
- package/dist/index.iife.js +395 -0
- package/dist/index.js +2 -0
- package/dist/runtime-support.d.ts +12 -0
- package/dist/runtime-support.js +12 -0
- package/package.json +86 -21
- package/CHANGELOG.json +0 -487
- package/CHANGELOG.md +0 -1995
- package/LICENSE.md +0 -5
- package/README.md +0 -1
- package/configure/CHANGELOG.json +0 -292
- package/configure/CHANGELOG.md +0 -1762
- package/configure/lib/charting-config.js +0 -192
- package/configure/lib/charting-config.js.map +0 -1
- package/configure/lib/configure.js +0 -312
- package/configure/lib/configure.js.map +0 -1
- package/configure/lib/correct-response.js +0 -244
- package/configure/lib/correct-response.js.map +0 -1
- package/configure/lib/defaults.js +0 -233
- package/configure/lib/defaults.js.map +0 -1
- package/configure/lib/index.js +0 -120
- package/configure/lib/index.js.map +0 -1
- package/configure/lib/utils.js +0 -80
- package/configure/lib/utils.js.map +0 -1
- package/configure/package.json +0 -29
- package/controller/CHANGELOG.json +0 -262
- package/controller/CHANGELOG.md +0 -1212
- package/controller/lib/defaults.js +0 -42
- package/controller/lib/defaults.js.map +0 -1
- package/controller/lib/index.js +0 -434
- package/controller/lib/index.js.map +0 -1
- package/controller/package.json +0 -24
- package/docs/config-schema.json +0 -2440
- package/docs/config-schema.json.md +0 -1802
- package/docs/demo/config.js +0 -8
- package/docs/demo/generate.js +0 -63
- package/docs/demo/index.html +0 -1
- package/docs/demo/session.js +0 -26
- package/docs/pie-schema.json +0 -1731
- package/docs/pie-schema.json.md +0 -945
- package/lib/index.js +0 -78
- package/lib/index.js.map +0 -1
- package/lib/main.js +0 -167
- package/lib/main.js.map +0 -1
package/configure.js
ADDED
package/controller.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dist/controller/index.js';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-elements/packages/charting/configure/src/charting-config.jsx
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
import * as React from 'react';
|
|
10
|
+
import PropTypes from 'prop-types';
|
|
11
|
+
export declare class ChartingConfig extends React.Component {
|
|
12
|
+
static propTypes: {
|
|
13
|
+
model: PropTypes.Validator<object>;
|
|
14
|
+
onChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
15
|
+
charts: PropTypes.Requireable<any[]>;
|
|
16
|
+
labelsPlaceholders: PropTypes.Requireable<object>;
|
|
17
|
+
titlePlaceholder: PropTypes.Requireable<object>;
|
|
18
|
+
showPixelGuides: PropTypes.Requireable<boolean>;
|
|
19
|
+
authorNewCategoryDefaults: PropTypes.Requireable<object>;
|
|
20
|
+
chartingOptions: PropTypes.Requireable<object>;
|
|
21
|
+
};
|
|
22
|
+
constructor(props: any);
|
|
23
|
+
handleAlertDialog: (open: any, callback: any) => void;
|
|
24
|
+
changeData: (data: any) => any;
|
|
25
|
+
changeAddRemoveEnabled: any;
|
|
26
|
+
changeTitle: (title: any) => any;
|
|
27
|
+
changeLabel: (type: any, label: any) => any;
|
|
28
|
+
render(): React.JSX.Element;
|
|
29
|
+
}
|
|
30
|
+
export default ChartingConfig;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import * as e from "react";
|
|
2
|
+
import t from "prop-types";
|
|
3
|
+
import { styled as n } from "@mui/material/styles";
|
|
4
|
+
import { color as r } from "@pie-lib/render-ui";
|
|
5
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
6
|
+
import { Chart as o } from "@pie-lib/charting";
|
|
7
|
+
import { AlertDialog as s } from "@pie-lib/config-ui";
|
|
8
|
+
import c from "@mui/material/Typography";
|
|
9
|
+
import l from "@mui/material/Checkbox";
|
|
10
|
+
//#region src/author/charting-config.tsx
|
|
11
|
+
var u = n("div")(({ theme: e }) => ({
|
|
12
|
+
marginBottom: e.spacing(2.5),
|
|
13
|
+
display: "flex",
|
|
14
|
+
flex: 1
|
|
15
|
+
})), d = n("div")(({ theme: e }) => ({ marginBottom: e.spacing(1) })), f = n("div")({ flex: 1 }), p = n(l)({ color: `${r.tertiary()} !important` }), m = (e, t) => {
|
|
16
|
+
if (!e) return t;
|
|
17
|
+
let n = [];
|
|
18
|
+
return (t || []).forEach((t, r) => {
|
|
19
|
+
let { editable: i, interactive: a } = t;
|
|
20
|
+
n[r] = {
|
|
21
|
+
label: i && e[r]?.label ? e[r].label : t.label,
|
|
22
|
+
value: a && e[r]?.value ? e[r].value : t.value,
|
|
23
|
+
editable: t.editable,
|
|
24
|
+
interactive: t.interactive
|
|
25
|
+
};
|
|
26
|
+
}), n;
|
|
27
|
+
}, h = class extends e.Component {
|
|
28
|
+
static propTypes = {
|
|
29
|
+
model: t.object.isRequired,
|
|
30
|
+
onChange: t.func.isRequired,
|
|
31
|
+
charts: t.array,
|
|
32
|
+
labelsPlaceholders: t.object,
|
|
33
|
+
titlePlaceholder: t.object,
|
|
34
|
+
showPixelGuides: t.bool,
|
|
35
|
+
authorNewCategoryDefaults: t.object,
|
|
36
|
+
chartingOptions: t.object
|
|
37
|
+
};
|
|
38
|
+
constructor(e) {
|
|
39
|
+
super(e), this.state = { dialog: { open: !1 } };
|
|
40
|
+
}
|
|
41
|
+
handleAlertDialog = (e, t) => this.setState({ dialog: { open: e } }, t);
|
|
42
|
+
changeData = (e) => this.props.onChange({
|
|
43
|
+
...this.props.model,
|
|
44
|
+
data: e
|
|
45
|
+
});
|
|
46
|
+
changeAddRemoveEnabled = (e) => {
|
|
47
|
+
let { model: t } = this.props, n = m(t.correctAnswer.data, t.data);
|
|
48
|
+
e ? this.props.onChange({
|
|
49
|
+
...this.props.model,
|
|
50
|
+
addCategoryEnabled: e
|
|
51
|
+
}) : this.setState({ dialog: {
|
|
52
|
+
open: !0,
|
|
53
|
+
title: "Warning",
|
|
54
|
+
text: "This change will remove any correct answer categories that are not part of the initial item configuration.",
|
|
55
|
+
onConfirm: () => this.handleAlertDialog(!1, this.props.onChange({
|
|
56
|
+
...this.props.model,
|
|
57
|
+
addCategoryEnabled: e,
|
|
58
|
+
correctAnswer: { data: n }
|
|
59
|
+
})),
|
|
60
|
+
onClose: () => this.handleAlertDialog(!1)
|
|
61
|
+
} });
|
|
62
|
+
};
|
|
63
|
+
changeTitle = (e) => this.props.onChange({
|
|
64
|
+
...this.props.model,
|
|
65
|
+
title: e
|
|
66
|
+
});
|
|
67
|
+
changeLabel = (e, t) => this.props.onChange({
|
|
68
|
+
...this.props.model,
|
|
69
|
+
[e]: {
|
|
70
|
+
...this.props.model[e],
|
|
71
|
+
label: t
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
render() {
|
|
75
|
+
let { model: e, charts: t, labelsPlaceholders: n, titlePlaceholder: r, showPixelGuides: l, authorNewCategoryDefaults: m, chartingOptions: h, mathMlOptions: g = {}, labelsCharactersLimit: _ } = this.props, { dialog: v } = this.state, { domain: y = {}, range: b = {} } = e || {};
|
|
76
|
+
return /* @__PURE__ */ a("div", { children: [/* @__PURE__ */ i(d, { children: "Define Initial Chart Attributes" }), /* @__PURE__ */ i(u, { children: /* @__PURE__ */ a(f, { children: [
|
|
77
|
+
/* @__PURE__ */ i(c, {
|
|
78
|
+
component: "div",
|
|
79
|
+
type: "body1",
|
|
80
|
+
children: /* @__PURE__ */ i("span", { children: "Use the tools below to set up the chart as it will initially appear to students." })
|
|
81
|
+
}),
|
|
82
|
+
/* @__PURE__ */ i(o, {
|
|
83
|
+
defineChart: !0,
|
|
84
|
+
chartingOptions: h,
|
|
85
|
+
showPixelGuides: l,
|
|
86
|
+
chartType: e.chartType,
|
|
87
|
+
size: e.graph,
|
|
88
|
+
domain: y,
|
|
89
|
+
range: b,
|
|
90
|
+
charts: t,
|
|
91
|
+
data: e.data.map((e, t) => ({
|
|
92
|
+
...e,
|
|
93
|
+
index: t
|
|
94
|
+
})),
|
|
95
|
+
title: e.title,
|
|
96
|
+
onDataChange: this.changeData,
|
|
97
|
+
onChangeTitle: this.changeTitle,
|
|
98
|
+
onChangeLabels: this.changeLabel,
|
|
99
|
+
addCategoryEnabled: !0,
|
|
100
|
+
changeInteractiveEnabled: e.changeInteractiveEnabled,
|
|
101
|
+
changeEditableEnabled: e.changeEditableEnabled,
|
|
102
|
+
categoryDefaultLabel: m?.label,
|
|
103
|
+
categoryDefaults: m,
|
|
104
|
+
labelsPlaceholders: n,
|
|
105
|
+
titlePlaceholder: r?.label,
|
|
106
|
+
mathMlOptions: g,
|
|
107
|
+
labelsCharactersLimit: _
|
|
108
|
+
}),
|
|
109
|
+
e.changeAddCategoryEnabled && /* @__PURE__ */ a("div", { children: [/* @__PURE__ */ i(p, {
|
|
110
|
+
checked: e.addCategoryEnabled,
|
|
111
|
+
onChange: (e) => {
|
|
112
|
+
this.changeAddRemoveEnabled(e.target.checked);
|
|
113
|
+
}
|
|
114
|
+
}), h?.addCategory?.authoringLabel] }),
|
|
115
|
+
/* @__PURE__ */ i(s, {
|
|
116
|
+
open: v.open,
|
|
117
|
+
title: v.title,
|
|
118
|
+
text: v.text,
|
|
119
|
+
onClose: v.onClose,
|
|
120
|
+
onConfirm: v.onConfirm
|
|
121
|
+
})
|
|
122
|
+
] }, "graph") })] });
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
//#endregion
|
|
126
|
+
export { h as default };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-elements/packages/charting/configure/src/configure.jsx
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import PropTypes from 'prop-types';
|
|
11
|
+
export declare class Configure extends React.Component {
|
|
12
|
+
static propTypes: {
|
|
13
|
+
onModelChanged: PropTypes.Requireable<(...args: any[]) => any>;
|
|
14
|
+
onConfigurationChanged: PropTypes.Requireable<(...args: any[]) => any>;
|
|
15
|
+
imageSupport: PropTypes.Requireable<object>;
|
|
16
|
+
uploadSoundSupport: PropTypes.Requireable<object>;
|
|
17
|
+
model: PropTypes.Validator<object>;
|
|
18
|
+
configuration: PropTypes.Validator<object>;
|
|
19
|
+
chartingOptions: PropTypes.Requireable<object>;
|
|
20
|
+
};
|
|
21
|
+
constructor(props: any);
|
|
22
|
+
onRationaleChange: (rationale: any) => any;
|
|
23
|
+
onPromptChange: (prompt: any) => any;
|
|
24
|
+
onTeacherInstructionsChange: (teacherInstructions: any) => any;
|
|
25
|
+
onChartTypeChange: (chartType: any) => any;
|
|
26
|
+
onConfigChange: any;
|
|
27
|
+
render(): React.JSX.Element;
|
|
28
|
+
}
|
|
29
|
+
export default Configure;
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import e from "./charting-config.js";
|
|
2
|
+
import t from "./correct-response.js";
|
|
3
|
+
import { applyConstraints as n, getGridValues as r, getLabelValues as i } from "./utils.js";
|
|
4
|
+
import a from "react";
|
|
5
|
+
import o from "prop-types";
|
|
6
|
+
import { styled as s } from "@mui/material/styles";
|
|
7
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
8
|
+
import { ConfigureChartPanel as u, chartTypes as d } from "@pie-lib/charting";
|
|
9
|
+
import f from "debug";
|
|
10
|
+
import { InputContainer as p, layout as ee, settings as m } from "@pie-lib/config-ui";
|
|
11
|
+
import h from "@mui/material/Typography";
|
|
12
|
+
import g from "@pie-lib/editable-html-tip-tap";
|
|
13
|
+
//#region src/author/configure.tsx
|
|
14
|
+
var _ = f("@pie-element:graphing:configure"), { Panel: te, toggle: v, radio: ne, dropdown: re, textField: ie } = m, y = s(p)(({ theme: e }) => ({
|
|
15
|
+
width: "100%",
|
|
16
|
+
paddingTop: e.spacing(2),
|
|
17
|
+
marginBottom: e.spacing(2)
|
|
18
|
+
})), b = s(h)(({ theme: e }) => ({ marginBottom: e.spacing(2.5) })), x = s("div")(({ theme: e }) => ({
|
|
19
|
+
fontSize: e.typography.fontSize - 2,
|
|
20
|
+
color: e.palette.error.main,
|
|
21
|
+
paddingTop: e.spacing(1)
|
|
22
|
+
})), S = [
|
|
23
|
+
d.Bar(),
|
|
24
|
+
d.Histogram(),
|
|
25
|
+
d.LineDot(),
|
|
26
|
+
d.LineCross(),
|
|
27
|
+
d.DotPlot(),
|
|
28
|
+
d.LinePlot()
|
|
29
|
+
], C = class extends a.Component {
|
|
30
|
+
static propTypes = {
|
|
31
|
+
onModelChanged: o.func,
|
|
32
|
+
onConfigurationChanged: o.func,
|
|
33
|
+
imageSupport: o.object,
|
|
34
|
+
uploadSoundSupport: o.object,
|
|
35
|
+
model: o.object.isRequired,
|
|
36
|
+
configuration: o.object.isRequired,
|
|
37
|
+
chartingOptions: o.object
|
|
38
|
+
};
|
|
39
|
+
constructor(e) {
|
|
40
|
+
super(e);
|
|
41
|
+
let { range: t = {}, graph: n } = e.model || {}, a = { range: r(t, n.height, !0) }, o = { range: i(t.step || 1) };
|
|
42
|
+
this.state = {
|
|
43
|
+
gridValues: a,
|
|
44
|
+
labelValues: o
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
onRationaleChange = (e) => this.props.onModelChanged({
|
|
48
|
+
...this.props.model,
|
|
49
|
+
rationale: e
|
|
50
|
+
});
|
|
51
|
+
onPromptChange = (e) => this.props.onModelChanged({
|
|
52
|
+
...this.props.model,
|
|
53
|
+
prompt: e
|
|
54
|
+
});
|
|
55
|
+
onTeacherInstructionsChange = (e) => this.props.onModelChanged({
|
|
56
|
+
...this.props.model,
|
|
57
|
+
teacherInstructions: e
|
|
58
|
+
});
|
|
59
|
+
onChartTypeChange = (e) => this.props.onModelChanged({
|
|
60
|
+
...this.props.model,
|
|
61
|
+
chartType: e
|
|
62
|
+
});
|
|
63
|
+
onConfigChange = (e) => {
|
|
64
|
+
let { model: t, onModelChanged: r } = this.props, { gridValues: i, labelValues: a } = this.state, o = {
|
|
65
|
+
...t,
|
|
66
|
+
...e
|
|
67
|
+
}, { graph: s, range: c } = o, l = {}, u = {}, d = n(c, s.height, i.range, a.range);
|
|
68
|
+
l.range = d.gridValues, u.range = d.labelValues, this.setState({
|
|
69
|
+
gridValues: l,
|
|
70
|
+
labelValues: u
|
|
71
|
+
}), r(o);
|
|
72
|
+
};
|
|
73
|
+
render() {
|
|
74
|
+
let { configuration: n, imageSupport: r, model: i, onConfigurationChanged: a, onModelChanged: o, uploadSoundSupport: s } = this.props;
|
|
75
|
+
_("[render] model", i);
|
|
76
|
+
let { graph: d } = i, { baseInputConfiguration: f = {}, contentDimensions: p = {}, chartDimensions: m = {}, authorNewCategoryDefaults: h = {}, labelsPlaceholders: C = {}, instruction: w = {}, maxImageWidth: T = {}, maxImageHeight: E = {}, prompt: D = {}, rationale: O = {}, scoringType: k = {}, settingsPanelDisabled: ae, spellCheck: A = {}, studentInstructions: j = {}, teacherInstructions: M = {}, titlePlaceholder: N = {}, withRubric: P = {}, chartingOptions: F = {}, availableChartTypes: I = {}, mathMlOptions: L = {}, chartTypeLabel: R, language: z = {}, languageChoices: B = {}, labelsCharactersLimit: V } = n || {}, { errors: H, extraCSSRules: U, promptEnabled: W, rationaleEnabled: G, spellCheckEnabled: K, teacherInstructionsEnabled: oe, studentNewCategoryDefaultLabel: q } = i || {}, { categoryErrors: se, correctAnswerErrors: ce, prompt: J, rationale: Y, teacherInstructions: X } = H || {}, { gridValues: le, labelValues: ue } = this.state, de = m.showInConfigPanel || !0, Z = T && T.prompt, Q = E && E.prompt, fe = {
|
|
77
|
+
changeInteractiveEnabled: F.changeInteractive?.settings && v(F.changeInteractive.settingsLabel),
|
|
78
|
+
changeEditableEnabled: F.changeEditable?.settings && v(F.changeEditable.settingsLabel),
|
|
79
|
+
changeAddCategoryEnabled: F.addCategory?.settings && v(F.addCategory.settingsLabel)
|
|
80
|
+
}, pe = {
|
|
81
|
+
teacherInstructionsEnabled: M.settings && v(M.label),
|
|
82
|
+
studentInstructionsEnabled: j.settings && v(j.label),
|
|
83
|
+
rationaleEnabled: O.settings && v(O.label),
|
|
84
|
+
spellCheckEnabled: A.settings && v(A.label),
|
|
85
|
+
promptEnabled: D.settings && v(D.label),
|
|
86
|
+
scoringType: k.settings && ne(k.label, ["all or nothing", "partial scoring"]),
|
|
87
|
+
rubricEnabled: P?.settings && v(P?.label),
|
|
88
|
+
"language.enabled": z.settings && v(z.label, !0),
|
|
89
|
+
language: z.settings && z.enabled && re(B.label, B.options),
|
|
90
|
+
instruction: w.settings && ie(w.label)
|
|
91
|
+
}, $ = (e = {}) => ({
|
|
92
|
+
...f,
|
|
93
|
+
...e
|
|
94
|
+
});
|
|
95
|
+
return /* @__PURE__ */ l(ee.ConfigLayout, {
|
|
96
|
+
extraCSSRules: U,
|
|
97
|
+
dimensions: p,
|
|
98
|
+
hideSettings: ae,
|
|
99
|
+
settings: /* @__PURE__ */ c(te, {
|
|
100
|
+
model: i,
|
|
101
|
+
configuration: n,
|
|
102
|
+
onChangeModel: o,
|
|
103
|
+
onChangeConfiguration: a,
|
|
104
|
+
groups: {
|
|
105
|
+
Settings: fe,
|
|
106
|
+
Properties: pe
|
|
107
|
+
}
|
|
108
|
+
}),
|
|
109
|
+
children: [
|
|
110
|
+
/* @__PURE__ */ c(b, {
|
|
111
|
+
component: "div",
|
|
112
|
+
type: "body1",
|
|
113
|
+
children: w?.label || ""
|
|
114
|
+
}),
|
|
115
|
+
oe && /* @__PURE__ */ l(y, {
|
|
116
|
+
label: M.label,
|
|
117
|
+
children: [/* @__PURE__ */ c(g, {
|
|
118
|
+
markup: i.teacherInstructions || "",
|
|
119
|
+
onChange: this.onTeacherInstructionsChange,
|
|
120
|
+
imageSupport: r,
|
|
121
|
+
nonEmpty: !1,
|
|
122
|
+
error: X,
|
|
123
|
+
spellCheck: K,
|
|
124
|
+
pluginProps: $(M?.inputConfiguration),
|
|
125
|
+
maxImageWidth: T && T.teacherInstructions || Z,
|
|
126
|
+
maxImageHeight: E && E.teacherInstructions || Q,
|
|
127
|
+
uploadSoundSupport: s,
|
|
128
|
+
languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
|
|
129
|
+
mathMlOptions: L
|
|
130
|
+
}), X && /* @__PURE__ */ c(x, { children: X })]
|
|
131
|
+
}),
|
|
132
|
+
W && /* @__PURE__ */ l(y, {
|
|
133
|
+
label: D.label,
|
|
134
|
+
children: [/* @__PURE__ */ c(g, {
|
|
135
|
+
markup: i.prompt,
|
|
136
|
+
onChange: this.onPromptChange,
|
|
137
|
+
imageSupport: r,
|
|
138
|
+
nonEmpty: !1,
|
|
139
|
+
error: J,
|
|
140
|
+
spellCheck: K,
|
|
141
|
+
disableUnderline: !0,
|
|
142
|
+
pluginProps: $(D?.inputConfiguration),
|
|
143
|
+
maxImageWidth: Z,
|
|
144
|
+
maxImageHeight: Q,
|
|
145
|
+
uploadSoundSupport: s,
|
|
146
|
+
languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
|
|
147
|
+
mathMlOptions: L
|
|
148
|
+
}), J && /* @__PURE__ */ c(x, { children: J })]
|
|
149
|
+
}),
|
|
150
|
+
/* @__PURE__ */ c(u, {
|
|
151
|
+
model: i,
|
|
152
|
+
onChange: this.onConfigChange,
|
|
153
|
+
gridValues: le,
|
|
154
|
+
labelValues: ue,
|
|
155
|
+
chartDimensions: m,
|
|
156
|
+
charts: S,
|
|
157
|
+
studentNewCategoryDefaultLabel: q,
|
|
158
|
+
availableChartTypes: I,
|
|
159
|
+
chartTypeLabel: R
|
|
160
|
+
}),
|
|
161
|
+
/* @__PURE__ */ c(e, {
|
|
162
|
+
model: i,
|
|
163
|
+
onChange: o,
|
|
164
|
+
charts: S,
|
|
165
|
+
labelsPlaceholders: C,
|
|
166
|
+
titlePlaceholder: N,
|
|
167
|
+
showPixelGuides: de,
|
|
168
|
+
authorNewCategoryDefaults: h,
|
|
169
|
+
chartingOptions: F,
|
|
170
|
+
mathMlOptions: L,
|
|
171
|
+
labelsCharactersLimit: V
|
|
172
|
+
}),
|
|
173
|
+
/* @__PURE__ */ c(t, {
|
|
174
|
+
config: d,
|
|
175
|
+
model: i,
|
|
176
|
+
onChange: o,
|
|
177
|
+
charts: S,
|
|
178
|
+
error: se,
|
|
179
|
+
correctAnswerErrors: ce,
|
|
180
|
+
studentNewCategoryDefaultLabel: q,
|
|
181
|
+
mathMlOptions: L,
|
|
182
|
+
labelsPlaceholders: C
|
|
183
|
+
}),
|
|
184
|
+
G && /* @__PURE__ */ l(y, {
|
|
185
|
+
label: O.label || "Rationale",
|
|
186
|
+
children: [/* @__PURE__ */ c(g, {
|
|
187
|
+
markup: i.rationale || "",
|
|
188
|
+
onChange: this.onRationaleChange,
|
|
189
|
+
imageSupport: r,
|
|
190
|
+
error: Y,
|
|
191
|
+
spellCheck: K,
|
|
192
|
+
pluginProps: $(O?.inputConfiguration),
|
|
193
|
+
maxImageWidth: T && T.rationale || Z,
|
|
194
|
+
maxImageHeight: E && E.rationale || Q,
|
|
195
|
+
uploadSoundSupport: s,
|
|
196
|
+
languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
|
|
197
|
+
mathMlOptions: L
|
|
198
|
+
}), Y && /* @__PURE__ */ c(x, { children: Y })]
|
|
199
|
+
})
|
|
200
|
+
]
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
//#endregion
|
|
205
|
+
export { C as default };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-elements/packages/charting/configure/src/correct-response.jsx
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
import * as React from 'react';
|
|
10
|
+
import PropTypes from 'prop-types';
|
|
11
|
+
export declare const getUpdatedCategories: (nextProps: any, prevProps: any, prevState: any) => any;
|
|
12
|
+
export declare class CorrectResponse extends React.Component {
|
|
13
|
+
static propTypes: {
|
|
14
|
+
correctAnswerErrors: PropTypes.Requireable<object>;
|
|
15
|
+
studentNewCategoryDefaultLabel: PropTypes.Requireable<string>;
|
|
16
|
+
model: PropTypes.Validator<object>;
|
|
17
|
+
onChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
18
|
+
charts: PropTypes.Requireable<any[]>;
|
|
19
|
+
error: PropTypes.Requireable<string>;
|
|
20
|
+
};
|
|
21
|
+
constructor(props: any);
|
|
22
|
+
changeData: any;
|
|
23
|
+
componentDidMount(): void;
|
|
24
|
+
componentDidUpdate(prevProps: any, prevState: any): void;
|
|
25
|
+
render(): React.JSX.Element;
|
|
26
|
+
}
|
|
27
|
+
export default CorrectResponse;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import * as e from "react";
|
|
2
|
+
import t from "prop-types";
|
|
3
|
+
import { styled as n } from "@mui/material/styles";
|
|
4
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
|
+
import { Chart as a } from "@pie-lib/charting";
|
|
6
|
+
import { cloneDeep as o, isEqual as s } from "@pie-element/shared-lodash";
|
|
7
|
+
import c from "@mui/material/Typography";
|
|
8
|
+
//#region src/author/correct-response.tsx
|
|
9
|
+
var l = n("div")(({ theme: e }) => ({
|
|
10
|
+
marginBottom: e.spacing(2.5),
|
|
11
|
+
display: "flex",
|
|
12
|
+
flex: 1
|
|
13
|
+
})), u = n("div")({ flex: 1 }), d = n("div")(({ theme: e }) => ({ border: `2px solid ${e.palette.error.main}` })), f = n(c)(({ theme: e }) => ({
|
|
14
|
+
fontSize: e.typography.fontSize - 2,
|
|
15
|
+
color: e.palette.error.main,
|
|
16
|
+
paddingTop: e.spacing(1)
|
|
17
|
+
})), p = n("div")(({ theme: e }) => ({ marginBottom: e.spacing(1) })), m = (e, t) => e.map((e, n) => ({
|
|
18
|
+
...e,
|
|
19
|
+
editable: n < t.length ? t[n].editable : !0,
|
|
20
|
+
interactive: n < t.length ? t[n].interactive : !0,
|
|
21
|
+
deletable: n >= t.length
|
|
22
|
+
})), h = (e, t) => {
|
|
23
|
+
if (!e) return t;
|
|
24
|
+
let n = [...e], r = [];
|
|
25
|
+
if ((t || []).forEach((t, n) => {
|
|
26
|
+
let i = t.editable, a = t.interactive;
|
|
27
|
+
r[n] = {
|
|
28
|
+
label: i && e[n]?.label ? e[n].label : t.label,
|
|
29
|
+
value: a && e[n]?.value || a && e[n]?.value == 0 ? e[n].value : t.value,
|
|
30
|
+
editable: t.editable,
|
|
31
|
+
interactive: t.interactive
|
|
32
|
+
};
|
|
33
|
+
}), r.length < e.length) {
|
|
34
|
+
let i = (n || []).slice(r.length, e.length);
|
|
35
|
+
return m((r || []).concat(i), t);
|
|
36
|
+
}
|
|
37
|
+
return r;
|
|
38
|
+
}, g = (e, t) => {
|
|
39
|
+
let n = t.length - 1, { editable: r, interactive: i, deletable: a, ...o } = t[t.length - 1];
|
|
40
|
+
return (e || []).splice(n, 0, o), m([...e], t);
|
|
41
|
+
}, _ = (e, t, n) => ((e || []).splice(n, 1), m([...e], t)), v = (e, t, n) => {
|
|
42
|
+
let r = e && e.model && e.model.data || [], i = t && t.model && t.model.data || [], a = o(e && e.model && e.model.correctAnswer && e.model.correctAnswer.data || []), s = o(n ? n.categories : []), c = [];
|
|
43
|
+
if (r.length > i.length) return c = g(a, r), c;
|
|
44
|
+
if (r.length < i.length) {
|
|
45
|
+
let e = r.length;
|
|
46
|
+
for (let t = 0; t < r.length; t++) if (r[t].index !== t) {
|
|
47
|
+
e = t;
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
return c = _(s, r, e), c;
|
|
51
|
+
}
|
|
52
|
+
return c = h(a, r), c;
|
|
53
|
+
}, y = class extends e.Component {
|
|
54
|
+
static propTypes = {
|
|
55
|
+
correctAnswerErrors: t.object,
|
|
56
|
+
studentNewCategoryDefaultLabel: t.string,
|
|
57
|
+
model: t.object.isRequired,
|
|
58
|
+
onChange: t.func.isRequired,
|
|
59
|
+
charts: t.array,
|
|
60
|
+
error: t.string
|
|
61
|
+
};
|
|
62
|
+
constructor(e) {
|
|
63
|
+
super(e), this.state = { categories: [] };
|
|
64
|
+
}
|
|
65
|
+
changeData = (e) => {
|
|
66
|
+
let { model: t, onChange: n } = this.props, { correctAnswer: r } = t || {};
|
|
67
|
+
n({
|
|
68
|
+
...t,
|
|
69
|
+
correctAnswer: {
|
|
70
|
+
...r,
|
|
71
|
+
data: e.map(({ interactive: e, editable: t, index: n, ...r }) => r)
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
componentDidMount() {
|
|
76
|
+
let e = v(this.props, this.props, null);
|
|
77
|
+
this.setState({ categories: e || h(this.props.model.correctAnswer.data, this.props.model.data) });
|
|
78
|
+
}
|
|
79
|
+
componentDidUpdate(e, t) {
|
|
80
|
+
let n = v(this.props, e, t);
|
|
81
|
+
n && !s(n, this.state.categories) && (this.changeData(n), this.setState({ categories: n }));
|
|
82
|
+
}
|
|
83
|
+
render() {
|
|
84
|
+
let { model: e, charts: t, error: n, studentNewCategoryDefaultLabel: o, correctAnswerErrors: s, mathMlOptions: m = {}, labelsPlaceholders: h = {} } = this.props, { categories: g } = this.state, { domain: _ = {}, range: v = {} } = e || {}, { identicalError: y, categoriesError: b } = s || {};
|
|
85
|
+
return /* @__PURE__ */ i("div", { children: [/* @__PURE__ */ r(p, { children: "Define Correct Response" }), /* @__PURE__ */ r(l, { children: /* @__PURE__ */ i(u, { children: [
|
|
86
|
+
/* @__PURE__ */ r(c, {
|
|
87
|
+
component: "div",
|
|
88
|
+
type: "body1",
|
|
89
|
+
children: /* @__PURE__ */ r("span", { children: "Use the tools below to define the correct answer." })
|
|
90
|
+
}),
|
|
91
|
+
r(y || b ? d : "div", { children: /* @__PURE__ */ r(a, {
|
|
92
|
+
chartType: e.chartType,
|
|
93
|
+
size: e.graph,
|
|
94
|
+
domain: _,
|
|
95
|
+
range: v,
|
|
96
|
+
charts: t,
|
|
97
|
+
data: g,
|
|
98
|
+
title: e.title,
|
|
99
|
+
onDataChange: this.changeData,
|
|
100
|
+
addCategoryEnabled: e.addCategoryEnabled,
|
|
101
|
+
categoryDefaultLabel: o,
|
|
102
|
+
error: n,
|
|
103
|
+
mathMlOptions: m,
|
|
104
|
+
labelsPlaceholders: h
|
|
105
|
+
}) }, `correct-response-graph-${e.correctAnswer.name}`),
|
|
106
|
+
(y || b) && /* @__PURE__ */ r(f, {
|
|
107
|
+
component: "div",
|
|
108
|
+
type: "body1",
|
|
109
|
+
children: /* @__PURE__ */ r("span", { children: y || b })
|
|
110
|
+
})
|
|
111
|
+
] }, "graph") })] });
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
//#endregion
|
|
115
|
+
export { y as default };
|