@pie-element/match 12.1.2-next.5 → 12.1.3
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/CHANGELOG.json +1462 -0
- package/CHANGELOG.md +2343 -0
- package/LICENSE.md +5 -0
- package/README.md +1 -0
- package/configure/CHANGELOG.json +892 -0
- package/configure/CHANGELOG.md +2046 -0
- package/configure/lib/add-row.js +40 -0
- package/configure/lib/add-row.js.map +1 -0
- package/configure/lib/answer-config-block.js +288 -0
- package/configure/lib/answer-config-block.js.map +1 -0
- package/configure/lib/common.js +31 -0
- package/configure/lib/common.js.map +1 -0
- package/configure/lib/configure.js +410 -0
- package/configure/lib/configure.js.map +1 -0
- package/configure/lib/defaults.js +201 -0
- package/configure/lib/defaults.js.map +1 -0
- package/configure/lib/general-config-block.js +144 -0
- package/configure/lib/general-config-block.js.map +1 -0
- package/configure/lib/index.js +152 -0
- package/configure/lib/index.js.map +1 -0
- package/configure/lib/row.js +321 -0
- package/configure/lib/row.js.map +1 -0
- package/configure/lib/utils.js +12 -0
- package/configure/lib/utils.js.map +1 -0
- package/configure/package.json +29 -0
- package/configure/utils.js +19 -0
- package/controller/CHANGELOG.json +502 -0
- package/controller/CHANGELOG.md +1363 -0
- package/controller/lib/defaults.js +25 -0
- package/controller/lib/defaults.js.map +1 -0
- package/controller/lib/index.js +424 -0
- package/controller/lib/index.js.map +1 -0
- package/controller/package.json +24 -0
- package/docs/config-schema.json +2929 -0
- package/docs/config-schema.json.md +2162 -0
- package/docs/demo/config.js +8 -0
- package/docs/demo/generate.js +49 -0
- package/docs/demo/index.html +1 -0
- package/docs/demo/session.js +11 -0
- package/docs/pie-schema.json +1530 -0
- package/docs/pie-schema.json.md +907 -0
- package/lib/answer-grid.js +166 -0
- package/lib/answer-grid.js.map +1 -0
- package/lib/index.js +85 -0
- package/lib/index.js.map +1 -0
- package/lib/main.js +163 -0
- package/lib/main.js.map +1 -0
- package/package.json +21 -87
- package/configure.js +0 -2
- package/controller.js +0 -1
- package/dist/author/add-row.d.ts +0 -17
- package/dist/author/add-row.js +0 -24
- package/dist/author/answer-config-block.d.ts +0 -36
- package/dist/author/answer-config-block.js +0 -176
- package/dist/author/common.d.ts +0 -22
- package/dist/author/configure.d.ts +0 -48
- package/dist/author/configure.js +0 -259
- package/dist/author/defaults.d.ts +0 -203
- package/dist/author/defaults.js +0 -151
- package/dist/author/general-config-block.d.ts +0 -22
- package/dist/author/general-config-block.js +0 -93
- package/dist/author/index.d.ts +0 -44
- package/dist/author/index.js +0 -76
- package/dist/author/row.d.ts +0 -51
- package/dist/author/row.js +0 -204
- package/dist/author/utils.d.ts +0 -10
- package/dist/author/utils.js +0 -10
- package/dist/browser/Typography-BRnAIZOH.js +0 -9224
- package/dist/browser/Typography-BRnAIZOH.js.map +0 -1
- package/dist/browser/author/index.js +0 -47499
- package/dist/browser/author/index.js.map +0 -1
- package/dist/browser/browser-kkT1XVKw.js +0 -219
- package/dist/browser/browser-kkT1XVKw.js.map +0 -1
- package/dist/browser/controller/index.js +0 -267
- package/dist/browser/controller/index.js.map +0 -1
- package/dist/browser/delivery/index.js +0 -1984
- package/dist/browser/delivery/index.js.map +0 -1
- package/dist/browser/dist-Dmwvrh9y.js +0 -104
- package/dist/browser/dist-Dmwvrh9y.js.map +0 -1
- package/dist/browser/match.css +0 -2
- package/dist/controller/defaults.d.ts +0 -27
- package/dist/controller/defaults.js +0 -25
- package/dist/controller/index.d.ts +0 -29
- package/dist/controller/index.js +0 -154
- package/dist/delivery/answer-grid.d.ts +0 -28
- package/dist/delivery/answer-grid.js +0 -99
- package/dist/delivery/index.d.ts +0 -21
- package/dist/delivery/index.js +0 -51
- package/dist/delivery/main.d.ts +0 -26
- package/dist/delivery/main.js +0 -112
- package/dist/index.d.ts +0 -1
- package/dist/index.iife.d.ts +0 -8
- package/dist/index.iife.js +0 -148
- package/dist/index.js +0 -2
- package/dist/node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.js +0 -16
- package/dist/runtime-support.d.ts +0 -12
- package/dist/runtime-support.js +0 -12
package/dist/author/add-row.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import e from "react";
|
|
2
|
-
import t from "prop-types";
|
|
3
|
-
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
4
|
-
import { styled as i } from "@mui/material/styles";
|
|
5
|
-
import a from "@mui/material/Button";
|
|
6
|
-
import o from "@mui/icons-material/Add";
|
|
7
|
-
//#region src/author/add-row.tsx
|
|
8
|
-
var s = i(a)({
|
|
9
|
-
display: "flex",
|
|
10
|
-
alignSelf: "flex-start",
|
|
11
|
-
margin: 0
|
|
12
|
-
}), c = i(o)(({ theme: e }) => ({ marginRight: e.spacing(.5) })), l = class extends e.Component {
|
|
13
|
-
static propTypes = { onAddClick: t.func.isRequired };
|
|
14
|
-
render() {
|
|
15
|
-
let { onAddClick: e } = this.props;
|
|
16
|
-
return /* @__PURE__ */ r(s, {
|
|
17
|
-
disabled: !1,
|
|
18
|
-
onClick: e,
|
|
19
|
-
children: [/* @__PURE__ */ n(c, {}), "Add Another Row"]
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
//#endregion
|
|
24
|
-
export { l as default };
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/match/configure/src/answer-config-block.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
|
-
declare class AnswerConfigBlock extends React.Component {
|
|
12
|
-
static propTypes: {
|
|
13
|
-
model: PropTypes.Validator<object>;
|
|
14
|
-
configuration: PropTypes.Validator<object>;
|
|
15
|
-
onChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
16
|
-
onDeleteRow: PropTypes.Validator<(...args: any[]) => any>;
|
|
17
|
-
onAddRow: PropTypes.Validator<(...args: any[]) => any>;
|
|
18
|
-
imageSupport: PropTypes.Requireable<PropTypes.InferProps<{
|
|
19
|
-
add: PropTypes.Validator<(...args: any[]) => any>;
|
|
20
|
-
delete: PropTypes.Validator<(...args: any[]) => any>;
|
|
21
|
-
}>>;
|
|
22
|
-
uploadSoundSupport: PropTypes.Requireable<PropTypes.InferProps<{
|
|
23
|
-
add: PropTypes.Validator<(...args: any[]) => any>;
|
|
24
|
-
delete: PropTypes.Validator<(...args: any[]) => any>;
|
|
25
|
-
}>>;
|
|
26
|
-
toolbarOpts: PropTypes.Requireable<object>;
|
|
27
|
-
spellCheck: PropTypes.Requireable<boolean>;
|
|
28
|
-
};
|
|
29
|
-
moveRow: any;
|
|
30
|
-
onChange: (name: any, isBoolean: any) => ({ target }: {
|
|
31
|
-
target: any;
|
|
32
|
-
}) => void;
|
|
33
|
-
onHeaderChange: (headerIndex: any) => (value: any) => void;
|
|
34
|
-
render(): React.JSX.Element;
|
|
35
|
-
}
|
|
36
|
-
export default AnswerConfigBlock;
|
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
import { getPluginProps as e } from "./utils.js";
|
|
2
|
-
import t from "../node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.js";
|
|
3
|
-
import n from "./add-row.js";
|
|
4
|
-
import r from "./row.js";
|
|
5
|
-
import * as i from "react";
|
|
6
|
-
import a from "prop-types";
|
|
7
|
-
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
8
|
-
import c from "@mui/material/Typography";
|
|
9
|
-
import { styled as l } from "@mui/material/styles";
|
|
10
|
-
import { set as u } from "@pie-element/shared-lodash";
|
|
11
|
-
import d from "debug";
|
|
12
|
-
import f, { DEFAULT_PLUGINS as p } from "@pie-lib/editable-html-tip-tap";
|
|
13
|
-
import { DragProvider as m } from "@pie-lib/drag";
|
|
14
|
-
//#region src/author/answer-config-block.tsx
|
|
15
|
-
var h = d("pie-elements:match:configure"), g = l("div")(({ theme: e }) => ({
|
|
16
|
-
marginBottom: e.spacing(2.5),
|
|
17
|
-
display: "flex",
|
|
18
|
-
flexDirection: "column"
|
|
19
|
-
})), _ = l("div")(({ theme: e }) => ({
|
|
20
|
-
display: "flex",
|
|
21
|
-
alignItems: "center",
|
|
22
|
-
flex: 1,
|
|
23
|
-
width: "100%",
|
|
24
|
-
borderBottom: `2px solid ${e.palette.grey.A100}`,
|
|
25
|
-
paddingBottom: e.spacing(2),
|
|
26
|
-
marginTop: e.spacing(2),
|
|
27
|
-
marginBottom: e.spacing(1)
|
|
28
|
-
})), v = l("div")(({ theme: e }) => ({
|
|
29
|
-
flex: 1,
|
|
30
|
-
display: "flex",
|
|
31
|
-
justifyContent: "center",
|
|
32
|
-
alignItems: "center",
|
|
33
|
-
flexDirection: "column",
|
|
34
|
-
"&> div": {
|
|
35
|
-
width: "120px",
|
|
36
|
-
padding: `0 ${e.spacing(1)}`,
|
|
37
|
-
textAlign: "center"
|
|
38
|
-
}
|
|
39
|
-
})), y = l("div")(({ theme: e }) => ({
|
|
40
|
-
flex: .5,
|
|
41
|
-
minWidth: "45px",
|
|
42
|
-
padding: `0 ${e.spacing(1)}`
|
|
43
|
-
})), b = l("div")({
|
|
44
|
-
display: "flex",
|
|
45
|
-
flexDirection: "column"
|
|
46
|
-
}), x = l("div")(({ theme: e }) => ({
|
|
47
|
-
fontSize: e.typography.fontSize - 2,
|
|
48
|
-
color: e.palette.error.main,
|
|
49
|
-
paddingTop: `${e.spacing(1)} !important`,
|
|
50
|
-
width: "fit-content !important"
|
|
51
|
-
})), S = l("div")(({ theme: e }) => ({
|
|
52
|
-
fontSize: e.typography.fontSize - 2,
|
|
53
|
-
color: e.palette.error.main,
|
|
54
|
-
paddingBottom: e.spacing(1)
|
|
55
|
-
})), C = l("div")(({ theme: e }) => ({
|
|
56
|
-
"& .marginBottom": { marginBottom: e.typography.fontSize - 2 + e.spacing(1) },
|
|
57
|
-
"& .headerInput": { "& > div": { fontWeight: "bold" } }
|
|
58
|
-
})), w = class extends i.Component {
|
|
59
|
-
static propTypes = {
|
|
60
|
-
model: a.object.isRequired,
|
|
61
|
-
configuration: a.object.isRequired,
|
|
62
|
-
onChange: a.func.isRequired,
|
|
63
|
-
onDeleteRow: a.func.isRequired,
|
|
64
|
-
onAddRow: a.func.isRequired,
|
|
65
|
-
imageSupport: a.shape({
|
|
66
|
-
add: a.func.isRequired,
|
|
67
|
-
delete: a.func.isRequired
|
|
68
|
-
}),
|
|
69
|
-
uploadSoundSupport: a.shape({
|
|
70
|
-
add: a.func.isRequired,
|
|
71
|
-
delete: a.func.isRequired
|
|
72
|
-
}),
|
|
73
|
-
toolbarOpts: a.object,
|
|
74
|
-
spellCheck: a.bool
|
|
75
|
-
};
|
|
76
|
-
moveRow = (e) => {
|
|
77
|
-
let { active: t, over: n } = e;
|
|
78
|
-
if (!n || !t) return;
|
|
79
|
-
let r = t.data.current, i = n.data.current;
|
|
80
|
-
if (r?.type === "row" && i?.type === "row") {
|
|
81
|
-
let e = r.index, t = i.index, { model: n, onChange: a } = this.props, o = { ...n }, s = o.rows || [];
|
|
82
|
-
h("[moveRow]: ", e, t);
|
|
83
|
-
let { movedRow: c, remainingRows: l } = s.reduce((t, n, r) => (r === e ? t.movedRow = n : t.remainingRows.push(n), t), {
|
|
84
|
-
movedRow: null,
|
|
85
|
-
remainingRows: []
|
|
86
|
-
}), u = [
|
|
87
|
-
...l.slice(0, t),
|
|
88
|
-
c,
|
|
89
|
-
...l.slice(t)
|
|
90
|
-
];
|
|
91
|
-
h("update: ", u), o.rows = u, a(o);
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
onChange = (e, t) => ({ target: n }) => {
|
|
95
|
-
let { model: r, onChange: i } = this.props, a;
|
|
96
|
-
a = t ? n.checked : n.value, u(r, e, a), i(r, e);
|
|
97
|
-
};
|
|
98
|
-
onHeaderChange = (e) => (t) => {
|
|
99
|
-
let { model: n, onChange: r } = this.props, i = { ...n };
|
|
100
|
-
if (e === 0) {
|
|
101
|
-
i.headers[e] = t, r(i);
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
i.headers[e] = t, r(i);
|
|
105
|
-
};
|
|
106
|
-
render() {
|
|
107
|
-
let { model: i, onAddRow: a, imageSupport: l, configuration: u, toolbarOpts: d, spellCheck: h, uploadSoundSupport: w } = this.props, { baseInputConfiguration: T = {}, headers: E = {}, rows: D = {}, maxImageWidth: O = {}, maxImageHeight: k = {}, mathMlOptions: A = {}, minQuestions: j } = u || {}, { errors: M } = i || {}, { correctResponseError: N, rowsErrors: P, columnsErrors: F, noOfRowsError: I, columnsLengthError: L } = M || {}, R = (p || []).filter((e) => e !== "table" && e !== "bulleted-list" && e !== "numbered-list"), z = O && O.prompt, B = k && k.prompt;
|
|
108
|
-
return /* @__PURE__ */ o(C, { children: /* @__PURE__ */ o(m, {
|
|
109
|
-
onDragEnd: this.moveRow,
|
|
110
|
-
children: /* @__PURE__ */ s(g, { children: [/* @__PURE__ */ o(c, {
|
|
111
|
-
type: "body1",
|
|
112
|
-
component: "div",
|
|
113
|
-
children: "Click on the labels to edit or remove. Set the correct answers by clicking each correct answer per row."
|
|
114
|
-
}), /* @__PURE__ */ s(b, {
|
|
115
|
-
style: u.width ? {
|
|
116
|
-
width: u.width,
|
|
117
|
-
overflow: "scroll"
|
|
118
|
-
} : {},
|
|
119
|
-
children: [
|
|
120
|
-
/* @__PURE__ */ s(_, { children: [E.settings && (i.headers || []).map((n, r) => /* @__PURE__ */ s(v, {
|
|
121
|
-
className: t({ questionText: r === 0 }),
|
|
122
|
-
sx: r === 0 ? {
|
|
123
|
-
flex: 2,
|
|
124
|
-
display: "flex",
|
|
125
|
-
justifyContent: "flex-start",
|
|
126
|
-
marginRight: 1,
|
|
127
|
-
"&> div": {
|
|
128
|
-
width: "100%",
|
|
129
|
-
padding: 0,
|
|
130
|
-
maxWidth: "unset",
|
|
131
|
-
textAlign: "left",
|
|
132
|
-
minWidth: "200px"
|
|
133
|
-
}
|
|
134
|
-
} : {},
|
|
135
|
-
children: [/* @__PURE__ */ o(f, {
|
|
136
|
-
onChange: this.onHeaderChange(r),
|
|
137
|
-
markup: n,
|
|
138
|
-
className: F && !F[r] ? "marginBottom" : "headerInput",
|
|
139
|
-
label: "column label",
|
|
140
|
-
activePlugins: R,
|
|
141
|
-
pluginProps: e(E?.inputConfiguration, T),
|
|
142
|
-
autoWidthToolbar: !0,
|
|
143
|
-
spellCheck: h,
|
|
144
|
-
uploadSoundSupport: w,
|
|
145
|
-
languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
|
|
146
|
-
error: F && F[r]
|
|
147
|
-
}), F && F[r] && /* @__PURE__ */ o(x, { children: F[r] })]
|
|
148
|
-
}, r)), /* @__PURE__ */ o(y, {})] }),
|
|
149
|
-
i.rows.map((t, n) => /* @__PURE__ */ o(r, {
|
|
150
|
-
model: i,
|
|
151
|
-
row: t,
|
|
152
|
-
idx: n,
|
|
153
|
-
onDeleteRow: this.props.onDeleteRow,
|
|
154
|
-
onChange: this.props.onChange,
|
|
155
|
-
imageSupport: l,
|
|
156
|
-
toolbarOpts: d,
|
|
157
|
-
spellCheck: h,
|
|
158
|
-
error: P?.[t.id],
|
|
159
|
-
maxImageWidth: O && O.rowTitles || z,
|
|
160
|
-
maxImageHeight: k && k.rowTitles || B,
|
|
161
|
-
uploadSoundSupport: w,
|
|
162
|
-
mathMlOptions: A,
|
|
163
|
-
minQuestions: j,
|
|
164
|
-
inputConfiguration: e(D?.inputConfiguration, T)
|
|
165
|
-
}, n)),
|
|
166
|
-
N && /* @__PURE__ */ o(S, { children: N }),
|
|
167
|
-
I && /* @__PURE__ */ o(S, { children: I }),
|
|
168
|
-
L && /* @__PURE__ */ o(S, { children: L }),
|
|
169
|
-
/* @__PURE__ */ o(n, { onAddClick: a })
|
|
170
|
-
]
|
|
171
|
-
})] })
|
|
172
|
-
}) });
|
|
173
|
-
}
|
|
174
|
-
};
|
|
175
|
-
//#endregion
|
|
176
|
-
export { w as default };
|
package/dist/author/common.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/match/configure/src/common.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 InfoDialog: {
|
|
12
|
-
({ title, open, onOk }: {
|
|
13
|
-
title: any;
|
|
14
|
-
open: any;
|
|
15
|
-
onOk: any;
|
|
16
|
-
}): React.JSX.Element;
|
|
17
|
-
propTypes: {
|
|
18
|
-
title: PropTypes.Requireable<string>;
|
|
19
|
-
open: PropTypes.Requireable<boolean>;
|
|
20
|
-
onOk: PropTypes.Requireable<(...args: any[]) => any>;
|
|
21
|
-
};
|
|
22
|
-
};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/match/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
|
-
declare class Configure extends React.Component {
|
|
12
|
-
static propTypes: {
|
|
13
|
-
onModelChanged: PropTypes.Requireable<(...args: any[]) => any>;
|
|
14
|
-
onConfigurationChanged: PropTypes.Requireable<(...args: any[]) => any>;
|
|
15
|
-
model: PropTypes.Validator<object>;
|
|
16
|
-
configuration: PropTypes.Validator<object>;
|
|
17
|
-
imageSupport: PropTypes.Requireable<PropTypes.InferProps<{
|
|
18
|
-
add: PropTypes.Validator<(...args: any[]) => any>;
|
|
19
|
-
delete: PropTypes.Validator<(...args: any[]) => any>;
|
|
20
|
-
}>>;
|
|
21
|
-
uploadSoundSupport: PropTypes.Requireable<PropTypes.InferProps<{
|
|
22
|
-
add: PropTypes.Validator<(...args: any[]) => any>;
|
|
23
|
-
delete: PropTypes.Validator<(...args: any[]) => any>;
|
|
24
|
-
}>>;
|
|
25
|
-
};
|
|
26
|
-
static defaultProps: {};
|
|
27
|
-
constructor(props: any);
|
|
28
|
-
componentDidMount(): void;
|
|
29
|
-
validateRowsID(rows: any): {
|
|
30
|
-
updatedRows: any;
|
|
31
|
-
wasChanged: boolean;
|
|
32
|
-
};
|
|
33
|
-
onTabChange: any;
|
|
34
|
-
onChangeTabIndex: any;
|
|
35
|
-
onChange: any;
|
|
36
|
-
onFeedbackChange: any;
|
|
37
|
-
onDeleteRow: any;
|
|
38
|
-
onAddRow: any;
|
|
39
|
-
onLayoutChange: any;
|
|
40
|
-
onResponseTypeChange: any;
|
|
41
|
-
onPartialScoringChange: any;
|
|
42
|
-
onPromptChanged: any;
|
|
43
|
-
onTeacherInstructionsChanged: any;
|
|
44
|
-
onRationaleChanged: any;
|
|
45
|
-
render(): React.JSX.Element;
|
|
46
|
-
}
|
|
47
|
-
export declare const Config: typeof Configure;
|
|
48
|
-
export default Configure;
|
package/dist/author/configure.js
DELETED
|
@@ -1,259 +0,0 @@
|
|
|
1
|
-
import { getPluginProps as e } from "./utils.js";
|
|
2
|
-
import t from "./general-config-block.js";
|
|
3
|
-
import n from "./answer-config-block.js";
|
|
4
|
-
import r from "react";
|
|
5
|
-
import i from "prop-types";
|
|
6
|
-
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
7
|
-
import { styled as s } from "@mui/material/styles";
|
|
8
|
-
import c from "debug";
|
|
9
|
-
import { AlertDialog as l, FeedbackConfig as ee, InputContainer as u, layout as d, settings as f } from "@pie-lib/config-ui";
|
|
10
|
-
import p from "@pie-lib/editable-html-tip-tap";
|
|
11
|
-
//#region src/author/configure.tsx
|
|
12
|
-
var te = c("@pie-element:match:configure"), { Panel: m, toggle: h, radio: g, dropdown: _ } = f, v = s("div")(() => ({ "& .promptHolder": { width: "100%" } })), y = s("div")(({ theme: e }) => ({
|
|
13
|
-
width: "100%",
|
|
14
|
-
paddingTop: e.spacing(2),
|
|
15
|
-
marginBottom: e.spacing(2)
|
|
16
|
-
})), b = s("div")(({ theme: e }) => ({
|
|
17
|
-
fontSize: e.typography.fontSize - 2,
|
|
18
|
-
color: e.palette.error.main,
|
|
19
|
-
paddingTop: e.spacing(1)
|
|
20
|
-
})), x = class extends r.Component {
|
|
21
|
-
static propTypes = {
|
|
22
|
-
onModelChanged: i.func,
|
|
23
|
-
onConfigurationChanged: i.func,
|
|
24
|
-
model: i.object.isRequired,
|
|
25
|
-
configuration: i.object.isRequired,
|
|
26
|
-
imageSupport: i.shape({
|
|
27
|
-
add: i.func.isRequired,
|
|
28
|
-
delete: i.func.isRequired
|
|
29
|
-
}),
|
|
30
|
-
uploadSoundSupport: i.shape({
|
|
31
|
-
add: i.func.isRequired,
|
|
32
|
-
delete: i.func.isRequired
|
|
33
|
-
})
|
|
34
|
-
};
|
|
35
|
-
static defaultProps = {};
|
|
36
|
-
constructor(e) {
|
|
37
|
-
super(e);
|
|
38
|
-
let t = 0;
|
|
39
|
-
e.model.rows && e.model.rows.length > 0 && (t = Math.max(...e.model.rows.map((e) => e.id))), this.rowIdCounter = t + 1, this.state = {
|
|
40
|
-
activeTab: 0,
|
|
41
|
-
dialog: {
|
|
42
|
-
open: !1,
|
|
43
|
-
text: ""
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
componentDidMount() {
|
|
48
|
-
let { updatedRows: e, wasChanged: t } = this.validateRowsID(this.props.model.rows);
|
|
49
|
-
if (t) {
|
|
50
|
-
let t = {
|
|
51
|
-
...this.props.model,
|
|
52
|
-
rows: e
|
|
53
|
-
};
|
|
54
|
-
this.props.onModelChanged(t);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
validateRowsID(e) {
|
|
58
|
-
let t = !1;
|
|
59
|
-
return {
|
|
60
|
-
updatedRows: (e || []).map((e, n) => e.id === n + 1 ? e : (t = !0, {
|
|
61
|
-
...e,
|
|
62
|
-
id: n + 1
|
|
63
|
-
})),
|
|
64
|
-
wasChanged: t
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
onTabChange = (e, t) => {
|
|
68
|
-
this.setState({ activeTab: t });
|
|
69
|
-
};
|
|
70
|
-
onChangeTabIndex = (e) => {
|
|
71
|
-
this.setState({ activeTab: e });
|
|
72
|
-
};
|
|
73
|
-
onChange = (e) => {
|
|
74
|
-
this.props.onModelChanged(e);
|
|
75
|
-
};
|
|
76
|
-
onFeedbackChange = (e) => {
|
|
77
|
-
let { model: t, onModelChanged: n } = this.props;
|
|
78
|
-
t.feedback = e, n(t);
|
|
79
|
-
};
|
|
80
|
-
onDeleteRow = (e) => {
|
|
81
|
-
let { model: t } = this.props, n = { ...t };
|
|
82
|
-
n.rows.splice(e, 1), this.onChange(n);
|
|
83
|
-
};
|
|
84
|
-
onAddRow = () => {
|
|
85
|
-
let { model: e, configuration: t } = this.props, n = { ...e }, { maxQuestions: r } = t || {};
|
|
86
|
-
if (r && (n.rows || []).length >= r) {
|
|
87
|
-
this.setState({ dialog: {
|
|
88
|
-
open: !0,
|
|
89
|
-
text: `There can be maximum ${r} question row` + (r > 1 ? "s" : "") + "."
|
|
90
|
-
} });
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
n.rows = n.rows.concat({
|
|
94
|
-
id: this.rowIdCounter + 1,
|
|
95
|
-
title: `Question Text ${(n.rows || []).length + 1}`,
|
|
96
|
-
values: Array(e.layout - 1).fill(!1)
|
|
97
|
-
}), this.rowIdCounter += 1, this.onChange(n);
|
|
98
|
-
};
|
|
99
|
-
onLayoutChange = (e) => {
|
|
100
|
-
let { model: t } = this.props, n = t.layout, r = { ...t };
|
|
101
|
-
if (e > n) {
|
|
102
|
-
for (let t = 0; t < e - n; t++) r.headers.push(`Column ${r.headers.length + 1}`);
|
|
103
|
-
r.rows.forEach((t) => {
|
|
104
|
-
for (let r = 0; r < e - n; r++) t.values.push(!1);
|
|
105
|
-
});
|
|
106
|
-
} else e < n && (r.headers.splice(e), r.rows.forEach((t) => {
|
|
107
|
-
t.values.splice(e - 1);
|
|
108
|
-
}));
|
|
109
|
-
r.layout = e, this.onChange(r);
|
|
110
|
-
};
|
|
111
|
-
onResponseTypeChange = (e) => {
|
|
112
|
-
let { model: t } = this.props, n = { ...t };
|
|
113
|
-
e === "radio" && n.rows.forEach((e) => {
|
|
114
|
-
e.values.reduce((e, t) => t === !0 ? e + 1 : e) > 1 && (e.values = Array(t.layout - 1).fill(!1));
|
|
115
|
-
}), n.choiceMode = e, this.onChange(n);
|
|
116
|
-
};
|
|
117
|
-
onPartialScoringChange = (e) => {
|
|
118
|
-
this.props.model.partialScoring = e, this.props.onModelChanged(this.props.model);
|
|
119
|
-
};
|
|
120
|
-
onPromptChanged = (e) => {
|
|
121
|
-
this.props.onModelChanged({
|
|
122
|
-
...this.props.model,
|
|
123
|
-
prompt: e
|
|
124
|
-
});
|
|
125
|
-
};
|
|
126
|
-
onTeacherInstructionsChanged = (e) => {
|
|
127
|
-
this.props.onModelChanged({
|
|
128
|
-
...this.props.model,
|
|
129
|
-
teacherInstructions: e
|
|
130
|
-
});
|
|
131
|
-
};
|
|
132
|
-
onRationaleChanged = (e) => {
|
|
133
|
-
this.props.onModelChanged({
|
|
134
|
-
...this.props.model,
|
|
135
|
-
rationale: e
|
|
136
|
-
});
|
|
137
|
-
};
|
|
138
|
-
render() {
|
|
139
|
-
let { model: r, imageSupport: i, onModelChanged: s, configuration: c, onConfigurationChanged: f, uploadSoundSupport: x } = this.props, { baseInputConfiguration: S = {}, contentDimensions: C = {}, feedback: w = {}, lockChoiceOrder: T = {}, maxImageWidth: E = {}, maxImageHeight: D = {}, partialScoring: O = {}, prompt: k = {}, rationale: A = {}, settingsPanelDisabled: j, scoringType: M = {}, spellCheck: N = {}, studentInstructions: P = {}, teacherInstructions: F = {}, withRubric: I = {}, language: L = {}, languageChoices: R = {} } = c || {}, { errors: z, extraCSSRules: B, feedbackEnabled: V, promptEnabled: H, rationaleEnabled: U, spellCheckEnabled: W, teacherInstructionsEnabled: G, toolbarEditorPosition: K } = r || {}, { prompt: q, rationale: J, teacherInstructions: Y } = z || {}, { dialog: X } = this.state, Z = { position: K === "top" ? "top" : "bottom" }, Q = E && E.prompt, $ = D && D.prompt, ne = {
|
|
140
|
-
partialScoring: O.settings && h(O.label),
|
|
141
|
-
lockChoiceOrder: T.settings && h(T.label),
|
|
142
|
-
feedbackEnabled: w.settings && h(w.label),
|
|
143
|
-
"language.enabled": L.settings && h(L.label, !0),
|
|
144
|
-
language: L.settings && L.enabled && _(R.label, R.options)
|
|
145
|
-
}, re = {
|
|
146
|
-
teacherInstructionsEnabled: F.settings && h(F.label),
|
|
147
|
-
studentInstructionsEnabled: P.settings && h(P.label),
|
|
148
|
-
promptEnabled: k.settings && h(k.label),
|
|
149
|
-
rationaleEnabled: A.settings && h(A.label),
|
|
150
|
-
spellCheckEnabled: N.settings && h(N.label),
|
|
151
|
-
scoringType: M.settings && g(M.label, ["auto", "rubric"]),
|
|
152
|
-
rubricEnabled: I?.settings && h(I?.label)
|
|
153
|
-
};
|
|
154
|
-
return te("[render] model", r), /* @__PURE__ */ a(v, { children: /* @__PURE__ */ o(d.ConfigLayout, {
|
|
155
|
-
extraCSSRules: B,
|
|
156
|
-
dimensions: C,
|
|
157
|
-
hideSettings: j,
|
|
158
|
-
settings: /* @__PURE__ */ a(m, {
|
|
159
|
-
model: r,
|
|
160
|
-
configuration: c,
|
|
161
|
-
onChangeModel: (e) => s(e),
|
|
162
|
-
onChangeConfiguration: (e) => f(e),
|
|
163
|
-
groups: {
|
|
164
|
-
Settings: ne,
|
|
165
|
-
Properties: re
|
|
166
|
-
}
|
|
167
|
-
}),
|
|
168
|
-
children: [
|
|
169
|
-
G && /* @__PURE__ */ a(u, {
|
|
170
|
-
label: F.label,
|
|
171
|
-
className: "promptHolder",
|
|
172
|
-
children: /* @__PURE__ */ o(y, { children: [/* @__PURE__ */ a(p, {
|
|
173
|
-
className: "prompt",
|
|
174
|
-
markup: r.teacherInstructions || "",
|
|
175
|
-
onChange: this.onTeacherInstructionsChanged,
|
|
176
|
-
imageSupport: i,
|
|
177
|
-
error: Y,
|
|
178
|
-
nonEmpty: !1,
|
|
179
|
-
toolbarOpts: Z,
|
|
180
|
-
pluginProps: e(F?.inputConfiguration, S),
|
|
181
|
-
spellCheck: W,
|
|
182
|
-
maxImageWidth: E && E.teacherInstructions || Q,
|
|
183
|
-
maxImageHeight: D && D.teacherInstructions || $,
|
|
184
|
-
uploadSoundSupport: x,
|
|
185
|
-
languageCharactersProps: [{ language: "spanish" }, { language: "special" }]
|
|
186
|
-
}), Y && /* @__PURE__ */ a(b, { children: Y })] })
|
|
187
|
-
}),
|
|
188
|
-
H && /* @__PURE__ */ a(u, {
|
|
189
|
-
label: k.label,
|
|
190
|
-
className: "promptHolder",
|
|
191
|
-
children: /* @__PURE__ */ o(y, { children: [/* @__PURE__ */ a(p, {
|
|
192
|
-
className: "prompt",
|
|
193
|
-
markup: r.prompt,
|
|
194
|
-
onChange: this.onPromptChanged,
|
|
195
|
-
imageSupport: i,
|
|
196
|
-
error: q,
|
|
197
|
-
nonEmpty: !1,
|
|
198
|
-
disableUnderline: !0,
|
|
199
|
-
toolbarOpts: Z,
|
|
200
|
-
pluginProps: e(k?.inputConfiguration, S),
|
|
201
|
-
spellCheck: W,
|
|
202
|
-
maxImageWidth: E && E.prompt,
|
|
203
|
-
maxImageHeight: D && D.prompt,
|
|
204
|
-
uploadSoundSupport: x,
|
|
205
|
-
languageCharactersProps: [{ language: "spanish" }, { language: "special" }]
|
|
206
|
-
}), q && /* @__PURE__ */ a(b, { children: q })] })
|
|
207
|
-
}),
|
|
208
|
-
/* @__PURE__ */ a(t, {
|
|
209
|
-
model: r,
|
|
210
|
-
configuration: c,
|
|
211
|
-
onResponseTypeChange: this.onResponseTypeChange,
|
|
212
|
-
onLayoutChange: this.onLayoutChange
|
|
213
|
-
}),
|
|
214
|
-
/* @__PURE__ */ a(n, {
|
|
215
|
-
model: r,
|
|
216
|
-
configuration: c,
|
|
217
|
-
imageSupport: i,
|
|
218
|
-
onChange: this.onChange,
|
|
219
|
-
onAddRow: this.onAddRow,
|
|
220
|
-
onDeleteRow: this.onDeleteRow,
|
|
221
|
-
toolbarOpts: Z,
|
|
222
|
-
spellCheck: W,
|
|
223
|
-
uploadSoundSupport: x
|
|
224
|
-
}),
|
|
225
|
-
U && /* @__PURE__ */ a(u, {
|
|
226
|
-
label: A.label,
|
|
227
|
-
className: "promptHolder",
|
|
228
|
-
children: /* @__PURE__ */ o(y, { children: [/* @__PURE__ */ a(p, {
|
|
229
|
-
className: "prompt",
|
|
230
|
-
markup: r.rationale || "",
|
|
231
|
-
onChange: this.onRationaleChanged,
|
|
232
|
-
imageSupport: i,
|
|
233
|
-
error: J,
|
|
234
|
-
toolbarOpts: Z,
|
|
235
|
-
pluginProps: e(A?.inputConfiguration, S),
|
|
236
|
-
spellCheck: W,
|
|
237
|
-
maxImageWidth: E && E.rationale || Q,
|
|
238
|
-
maxImageHeight: D && D.rationale || $,
|
|
239
|
-
uploadSoundSupport: x,
|
|
240
|
-
languageCharactersProps: [{ language: "spanish" }, { language: "special" }]
|
|
241
|
-
}), J && /* @__PURE__ */ a(b, { children: J })] })
|
|
242
|
-
}),
|
|
243
|
-
V && /* @__PURE__ */ a(ee, {
|
|
244
|
-
feedback: r.feedback,
|
|
245
|
-
onChange: this.onFeedbackChange,
|
|
246
|
-
toolbarOpts: Z
|
|
247
|
-
}),
|
|
248
|
-
/* @__PURE__ */ a(l, {
|
|
249
|
-
open: X.open,
|
|
250
|
-
title: "Warning",
|
|
251
|
-
text: X.text,
|
|
252
|
-
onConfirm: () => this.setState({ dialog: { open: !1 } })
|
|
253
|
-
})
|
|
254
|
-
]
|
|
255
|
-
}) });
|
|
256
|
-
}
|
|
257
|
-
};
|
|
258
|
-
//#endregion
|
|
259
|
-
export { x as default };
|