@pie-element/explicit-constructed-response 12.0.4-next.20261011174919 → 12.0.4
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/author/defaults.d.ts +56 -54
- package/dist/author/index.d.ts +18 -28
- package/dist/author/index.js +6 -1
- package/dist/author/main.d.ts +43 -25
- package/dist/author/main.js +98 -111
- package/dist/browser/author/index.js +19 -29
- package/dist/browser/author/index.js.map +1 -1
- package/dist/browser/controller/index.js +4 -4
- package/dist/browser/controller/index.js.map +1 -1
- package/dist/browser/editor-runtime/author/index.js +19 -29
- package/dist/browser/editor-runtime/author/index.js.map +1 -1
- package/dist/browser/editor-runtime/controller/index.js +4 -4
- package/dist/browser/editor-runtime/controller/index.js.map +1 -1
- package/dist/controller/defaults.d.ts +10 -9
- package/dist/controller/index.d.ts +83 -24
- package/dist/controller/index.js +4 -4
- package/dist/index.d.ts +1 -0
- package/dist/schemas/configuration.schema.json +426 -0
- package/dist/schemas/model.schema.json +605 -0
- package/dist/schemas/session.schema.json +23 -0
- package/dist/types.d.ts +186 -0
- package/package.json +20 -16
package/dist/author/main.js
CHANGED
|
@@ -3,57 +3,44 @@ import { ECRToolbar as n } from "./ecr-toolbar.js";
|
|
|
3
3
|
import { AlternateResponses as r } from "./alternateResponses.js";
|
|
4
4
|
import { generateValidationMessage as i } from "./utils.js";
|
|
5
5
|
import a from "react";
|
|
6
|
-
import o from "
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import m,
|
|
11
|
-
import { InputContainer as h, layout as te, settings as g } from "@pie-lib/config-ui";
|
|
6
|
+
import { cloneDeep as o, isEmpty as s, pick as c, throttle as l } from "@pie-element/shared-lodash";
|
|
7
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
8
|
+
import { styled as f } from "@mui/material/styles";
|
|
9
|
+
import p, { ALL_PLUGINS as ee } from "@pie-lib/editable-html-tip-tap";
|
|
10
|
+
import { InputContainer as m, layout as h, settings as g } from "@pie-lib/config-ui";
|
|
12
11
|
import _ from "@mui/material/Typography";
|
|
13
|
-
import
|
|
12
|
+
import te from "@mui/icons-material/Info";
|
|
14
13
|
import v from "@mui/material/Tooltip";
|
|
15
14
|
//#region src/author/main.tsx
|
|
16
|
-
var { toggle: y, Panel:
|
|
15
|
+
var { toggle: y, Panel: ne, dropdown: re } = g, b = f(m)(({ theme: e }) => ({
|
|
17
16
|
width: "100%",
|
|
18
17
|
paddingTop: e.spacing(1),
|
|
19
18
|
marginTop: e.spacing(2),
|
|
20
19
|
marginBottom: e.spacing(2)
|
|
21
|
-
})),
|
|
20
|
+
})), ie = f(p)(({ theme: e }) => ({
|
|
22
21
|
minHeight: "100px",
|
|
23
22
|
paddingTop: e.spacing(1),
|
|
24
23
|
width: "100%",
|
|
25
24
|
"& [data-slate-editor=\"true\"]": { minHeight: "100px" }
|
|
26
|
-
})),
|
|
25
|
+
})), ae = f(_)(({ theme: e }) => ({ fontSize: e.typography.fontSize + 2 })), x = f(v)(({ theme: e }) => ({ "& .MuiTooltip-tooltip": {
|
|
27
26
|
fontSize: e.typography.fontSize - 2,
|
|
28
27
|
whiteSpace: "pre",
|
|
29
28
|
maxWidth: "500px"
|
|
30
|
-
} })), S =
|
|
29
|
+
} })), S = f("div")(({ theme: e }) => ({
|
|
31
30
|
fontSize: e.typography.fontSize - 2,
|
|
32
31
|
color: e.palette.error.main,
|
|
33
32
|
paddingTop: e.spacing(1)
|
|
34
|
-
})),
|
|
33
|
+
})), oe = f("div")({
|
|
35
34
|
display: "flex",
|
|
36
35
|
alignItems: "center"
|
|
37
|
-
}),
|
|
36
|
+
}), C = f(_)(({ theme: e }) => ({
|
|
38
37
|
fontSize: e.typography.fontSize + 2,
|
|
39
38
|
marginTop: e.spacing(3),
|
|
40
39
|
marginBottom: e.spacing(1)
|
|
41
|
-
})),
|
|
40
|
+
})), w = (e) => {
|
|
42
41
|
let t = document.createElement("div");
|
|
43
42
|
return t.innerHTML = e.trim(), t;
|
|
44
|
-
},
|
|
45
|
-
static propTypes = {
|
|
46
|
-
configuration: o.object.isRequired,
|
|
47
|
-
model: o.object.isRequired,
|
|
48
|
-
disableSidePanel: o.bool,
|
|
49
|
-
onModelChanged: o.func.isRequired,
|
|
50
|
-
onConfigurationChanged: o.func.isRequired,
|
|
51
|
-
imageSupport: o.shape({
|
|
52
|
-
add: o.func.isRequired,
|
|
53
|
-
delete: o.func.isRequired
|
|
54
|
-
}),
|
|
55
|
-
uploadSoundSupport: o.object
|
|
56
|
-
};
|
|
43
|
+
}, T = class extends a.Component {
|
|
57
44
|
state = {};
|
|
58
45
|
componentDidMount() {
|
|
59
46
|
let { model: { slateMarkup: n, choices: r, maxLengthPerChoice: i = [] }, onModelChanged: a } = this.props, o = !i.length;
|
|
@@ -86,70 +73,70 @@ var { toggle: y, Panel: re, dropdown: ie } = g, b = p(h)(({ theme: e }) => ({
|
|
|
86
73
|
t({ maxLengthPerChoice: e });
|
|
87
74
|
};
|
|
88
75
|
onChangeResponse = (n, r) => {
|
|
89
|
-
let { model: i, onModelChanged: a } = this.props, { choices: o } = i,
|
|
76
|
+
let { model: i, onModelChanged: a } = this.props, { choices: o } = i, s = i.maxLengthPerChoice, c = e(r || "").length;
|
|
90
77
|
if (!o[n] || !o[n].length) {
|
|
91
78
|
o[n] = [{
|
|
92
79
|
label: r || "",
|
|
93
80
|
value: "0"
|
|
94
81
|
}];
|
|
95
|
-
let e = n > s.length ? n - s.length : 0;
|
|
96
|
-
s = [...s, ...Array(e).fill(1)], s.splice(n, 0, t(c));
|
|
97
|
-
} else o[n][0].label = r || "", s && (s[n] < c || s[n] > c + 10) && (s[n] = t(c));
|
|
82
|
+
let e = Number(n) > s.length ? Number(n) - s.length : 0;
|
|
83
|
+
s = [...s, ...Array(e).fill(1)], s.splice(Number(n), 0, t(c));
|
|
84
|
+
} else o[n][0].label = r || "", s && (s[Number(n)] < c || s[Number(n)] > c + 10) && (s[Number(n)] = t(c));
|
|
98
85
|
a({
|
|
99
86
|
choices: o,
|
|
100
87
|
maxLengthPerChoice: s
|
|
101
88
|
});
|
|
102
89
|
};
|
|
103
90
|
onChange = (e) => {
|
|
104
|
-
let { model: { choices: t, maxLengthPerChoice: n }, onModelChanged: r } = this.props, i =
|
|
91
|
+
let { model: { choices: t, maxLengthPerChoice: n }, onModelChanged: r } = this.props, i = w(e), a = i.querySelectorAll("[data-type=\"explicit_constructed_response\"]"), s = {}, c = [];
|
|
105
92
|
a.forEach((e, r) => {
|
|
106
|
-
let i =
|
|
107
|
-
|
|
93
|
+
let i = e.dataset.index, a = o(t[i]);
|
|
94
|
+
a && (a[0] = {
|
|
108
95
|
label: e.dataset.value || "",
|
|
109
96
|
value: "0"
|
|
110
|
-
}, c[r] = n[
|
|
97
|
+
}, c[r] = n[Number(i)]), s[r] = a, e.dataset.index = `${r}`;
|
|
111
98
|
}), this.setState({ cachedChoices: void 0 }, () => r({
|
|
112
|
-
choices:
|
|
99
|
+
choices: s,
|
|
113
100
|
slateMarkup: i.innerHTML,
|
|
114
101
|
maxLengthPerChoice: c
|
|
115
102
|
}));
|
|
116
103
|
};
|
|
117
|
-
onHandleAreaChange =
|
|
104
|
+
onHandleAreaChange = l((e) => {
|
|
118
105
|
let { model: { choices: t }, onModelChanged: n } = this.props, { cachedChoices: r } = this.state;
|
|
119
106
|
if (!e) return;
|
|
120
|
-
let i = t ?
|
|
107
|
+
let i = t ? o(t) : {}, a = r ? o(r) : {};
|
|
121
108
|
e.forEach((e) => {
|
|
122
109
|
let t = e.index;
|
|
123
|
-
!i[t] && a[t] ? (Object.assign(i,
|
|
110
|
+
!i[t] && a[t] ? (Object.assign(i, c(a, t)), Object.prototype.hasOwnProperty.call(a, t) && delete a[t]) : (Object.assign(a, c(i, t)), Object.prototype.hasOwnProperty.call(i, t) && delete i[t]);
|
|
124
111
|
}), this.setState({ cachedChoices: a }, () => n({ choices: i }));
|
|
125
112
|
}, 500, {
|
|
126
113
|
trailing: !1,
|
|
127
114
|
leading: !0
|
|
128
115
|
});
|
|
129
116
|
render() {
|
|
130
|
-
let { model: e, configuration: t, onConfigurationChanged: a, imageSupport: o, uploadSoundSupport:
|
|
131
|
-
partialScoring:
|
|
132
|
-
maxLengthPerChoiceEnabled:
|
|
133
|
-
"language.enabled":
|
|
134
|
-
language:
|
|
135
|
-
"responseAreaInputConfiguration.inputConfiguration.characters.disabled":
|
|
117
|
+
let { model: e, configuration: t, onConfigurationChanged: a, imageSupport: o, uploadSoundSupport: c } = this.props, { baseInputConfiguration: l = {}, contentDimensions: f = {}, maxImageWidth: m = {}, maxImageHeight: g = {}, maxLengthPerChoice: _ = {}, maxResponseAreas: v, partialScoring: w = {}, playerSpellCheck: T = {}, prompt: E = {}, rationale: D = {}, template: se = {}, settingsPanelDisabled: ce, spellCheck: O = {}, editSource: k = {}, teacherInstructions: A = {}, withRubric: j = {}, mathMlOptions: M = {}, language: N = {}, languageChoices: P = {}, spanishButton: F = {}, responseAreaInputConfiguration: I = {} } = t || {}, { errors: L, extraCSSRules: R, maxLengthPerChoiceEnabled: z, promptEnabled: B, rationaleEnabled: V, spellCheckEnabled: H, teacherInstructionsEnabled: U, toolbarEditorPosition: W } = e || {}, { choices: G = {}, prompt: K, rationale: q, responseAreas: J, teacherInstructions: Y } = L || {}, le = i(t), X = m && m.prompt, Z = g && g.prompt, Q = { position: W === "top" ? "top" : "bottom" }, ue = {
|
|
118
|
+
partialScoring: w.settings && y(w.label),
|
|
119
|
+
maxLengthPerChoiceEnabled: _.settings && y(_.label),
|
|
120
|
+
"language.enabled": N.settings && y(N.label, !0),
|
|
121
|
+
language: N.settings && N.enabled && re(P.label, P.options),
|
|
122
|
+
"responseAreaInputConfiguration.inputConfiguration.characters.disabled": F.settings && y(F.label, !0)
|
|
136
123
|
}, de = {
|
|
137
|
-
teacherInstructionsEnabled:
|
|
138
|
-
rationaleEnabled:
|
|
139
|
-
promptEnabled:
|
|
140
|
-
spellCheckEnabled:
|
|
141
|
-
playerSpellCheckEnabled:
|
|
142
|
-
rubricEnabled:
|
|
143
|
-
"editSource.enabled":
|
|
124
|
+
teacherInstructionsEnabled: A.settings && y(A.label),
|
|
125
|
+
rationaleEnabled: D.settings && y(D.label),
|
|
126
|
+
promptEnabled: E.settings && y(E.label),
|
|
127
|
+
spellCheckEnabled: O.settings && y(O.label),
|
|
128
|
+
playerSpellCheckEnabled: T.settings && y(T.label),
|
|
129
|
+
rubricEnabled: j?.settings && y(j?.label),
|
|
130
|
+
"editSource.enabled": k?.settings && y(k.label, !0)
|
|
144
131
|
}, $ = (e = {}) => ({
|
|
145
132
|
...l,
|
|
146
133
|
...e
|
|
147
134
|
});
|
|
148
|
-
return /* @__PURE__ */
|
|
149
|
-
extraCSSRules:
|
|
150
|
-
dimensions:
|
|
151
|
-
hideSettings:
|
|
152
|
-
settings: /* @__PURE__ */
|
|
135
|
+
return /* @__PURE__ */ d(h.ConfigLayout, {
|
|
136
|
+
extraCSSRules: R,
|
|
137
|
+
dimensions: f,
|
|
138
|
+
hideSettings: ce,
|
|
139
|
+
settings: /* @__PURE__ */ u(ne, {
|
|
153
140
|
model: e,
|
|
154
141
|
configuration: t,
|
|
155
142
|
onChangeModel: (e) => this.onModelChange(e),
|
|
@@ -160,84 +147,84 @@ var { toggle: y, Panel: re, dropdown: ie } = g, b = p(h)(({ theme: e }) => ({
|
|
|
160
147
|
}
|
|
161
148
|
}),
|
|
162
149
|
children: [
|
|
163
|
-
|
|
164
|
-
label:
|
|
165
|
-
children: [/* @__PURE__ */
|
|
150
|
+
U && /* @__PURE__ */ d(b, {
|
|
151
|
+
label: A.label,
|
|
152
|
+
children: [/* @__PURE__ */ u(p, {
|
|
166
153
|
className: "prompt",
|
|
167
154
|
markup: e.teacherInstructions || "",
|
|
168
155
|
onChange: this.onTeacherInstructionsChanged,
|
|
169
156
|
imageSupport: o,
|
|
170
157
|
nonEmpty: !1,
|
|
171
|
-
error:
|
|
158
|
+
error: Y,
|
|
172
159
|
toolbarOpts: Q,
|
|
173
|
-
pluginProps: $(
|
|
174
|
-
spellCheck:
|
|
175
|
-
maxImageWidth:
|
|
176
|
-
maxImageHeight:
|
|
177
|
-
uploadSoundSupport:
|
|
160
|
+
pluginProps: $(A?.inputConfiguration),
|
|
161
|
+
spellCheck: H,
|
|
162
|
+
maxImageWidth: m && m.teacherInstructions || X,
|
|
163
|
+
maxImageHeight: g && g.teacherInstructions || Z,
|
|
164
|
+
uploadSoundSupport: c,
|
|
178
165
|
languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
|
|
179
|
-
mathMlOptions:
|
|
166
|
+
mathMlOptions: M,
|
|
180
167
|
autoWidthToolbar: !0
|
|
181
|
-
}),
|
|
168
|
+
}), Y && /* @__PURE__ */ u(S, { children: Y })]
|
|
182
169
|
}),
|
|
183
|
-
|
|
184
|
-
label:
|
|
185
|
-
children: [/* @__PURE__ */
|
|
170
|
+
B && /* @__PURE__ */ d(b, {
|
|
171
|
+
label: E.label,
|
|
172
|
+
children: [/* @__PURE__ */ u(p, {
|
|
186
173
|
className: "prompt",
|
|
187
174
|
markup: e.prompt,
|
|
188
175
|
onChange: this.onPromptChanged,
|
|
189
176
|
imageSupport: o,
|
|
190
177
|
nonEmpty: !1,
|
|
191
178
|
disableUnderline: !0,
|
|
192
|
-
error:
|
|
179
|
+
error: K,
|
|
193
180
|
toolbarOpts: Q,
|
|
194
|
-
pluginProps: $(
|
|
195
|
-
spellCheck:
|
|
181
|
+
pluginProps: $(E?.inputConfiguration),
|
|
182
|
+
spellCheck: H,
|
|
196
183
|
maxImageWidth: X,
|
|
197
184
|
maxImageHeight: Z,
|
|
198
|
-
uploadSoundSupport:
|
|
185
|
+
uploadSoundSupport: c,
|
|
199
186
|
languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
|
|
200
|
-
mathMlOptions:
|
|
187
|
+
mathMlOptions: M,
|
|
201
188
|
autoWidthToolbar: !0
|
|
202
|
-
}),
|
|
189
|
+
}), K && /* @__PURE__ */ u(S, { children: K })]
|
|
203
190
|
}),
|
|
204
|
-
/* @__PURE__ */
|
|
191
|
+
/* @__PURE__ */ d(oe, { children: [/* @__PURE__ */ u(ae, {
|
|
205
192
|
component: "div",
|
|
206
193
|
children: "Define Template, Choices, and Correct Responses"
|
|
207
|
-
}), /* @__PURE__ */
|
|
194
|
+
}), /* @__PURE__ */ u(x, {
|
|
208
195
|
disableFocusListener: !0,
|
|
209
196
|
disableTouchListener: !0,
|
|
210
197
|
placement: "right",
|
|
211
|
-
title:
|
|
212
|
-
children: /* @__PURE__ */
|
|
198
|
+
title: le,
|
|
199
|
+
children: /* @__PURE__ */ u(te, {
|
|
213
200
|
fontSize: "small",
|
|
214
201
|
color: "primary",
|
|
215
202
|
style: { marginLeft: "8px" }
|
|
216
203
|
})
|
|
217
204
|
})] }),
|
|
218
|
-
/* @__PURE__ */
|
|
205
|
+
/* @__PURE__ */ u(ie, {
|
|
219
206
|
activePlugins: ee,
|
|
220
207
|
toolbarOpts: { position: "top" },
|
|
221
|
-
spellCheck:
|
|
222
|
-
pluginProps: $(
|
|
208
|
+
spellCheck: H,
|
|
209
|
+
pluginProps: $(se?.inputConfiguration),
|
|
223
210
|
responseAreaProps: {
|
|
224
211
|
type: "explicit-constructed-response",
|
|
225
212
|
options: { duplicates: !0 },
|
|
226
|
-
maxResponseAreas:
|
|
213
|
+
maxResponseAreas: v,
|
|
227
214
|
respAreaToolbar: (e, t, r) => {
|
|
228
215
|
let [i, a] = e, { model: o } = this.props, s = (o.choices[i.attrs.index] || [])[0];
|
|
229
|
-
return () => /* @__PURE__ */
|
|
216
|
+
return () => /* @__PURE__ */ u(n, {
|
|
230
217
|
onChangeResponse: (e) => this.onChangeResponse(i.attrs.index, e),
|
|
231
218
|
node: i,
|
|
232
219
|
pos: a,
|
|
233
220
|
editor: t,
|
|
234
221
|
onToolbarDone: r,
|
|
235
222
|
correctChoice: s,
|
|
236
|
-
maxLengthPerChoiceEnabled:
|
|
237
|
-
pluginProps: $(
|
|
223
|
+
maxLengthPerChoiceEnabled: z,
|
|
224
|
+
pluginProps: $(I?.inputConfiguration)
|
|
238
225
|
});
|
|
239
226
|
},
|
|
240
|
-
error: () =>
|
|
227
|
+
error: () => G,
|
|
241
228
|
onHandleAreaChange: this.onHandleAreaChange
|
|
242
229
|
},
|
|
243
230
|
markup: e.slateMarkup,
|
|
@@ -247,45 +234,45 @@ var { toggle: y, Panel: re, dropdown: ie } = g, b = p(h)(({ theme: e }) => ({
|
|
|
247
234
|
onBlur: this.onBlur,
|
|
248
235
|
disabled: !1,
|
|
249
236
|
highlightShape: !1,
|
|
250
|
-
error:
|
|
251
|
-
uploadSoundSupport:
|
|
237
|
+
error: J,
|
|
238
|
+
uploadSoundSupport: c,
|
|
252
239
|
languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
|
|
253
|
-
mathMlOptions:
|
|
240
|
+
mathMlOptions: M,
|
|
254
241
|
autoWidthToolbar: !0
|
|
255
242
|
}),
|
|
256
|
-
|
|
257
|
-
!
|
|
258
|
-
/* @__PURE__ */
|
|
243
|
+
J && /* @__PURE__ */ u(S, { children: J }),
|
|
244
|
+
!s(e.choices) && /* @__PURE__ */ u(C, { children: `Define Alternates ${z ? "and Character Limits" : ""}` }),
|
|
245
|
+
/* @__PURE__ */ u(r, {
|
|
259
246
|
model: e,
|
|
260
247
|
onChange: this.onResponsesChanged,
|
|
261
248
|
onLengthChange: this.onLengthChanged,
|
|
262
|
-
maxLengthPerChoiceEnabled:
|
|
263
|
-
spellCheck:
|
|
264
|
-
choicesErrors:
|
|
265
|
-
pluginProps: $(
|
|
249
|
+
maxLengthPerChoiceEnabled: z,
|
|
250
|
+
spellCheck: H,
|
|
251
|
+
choicesErrors: G,
|
|
252
|
+
pluginProps: $(I?.inputConfiguration)
|
|
266
253
|
}),
|
|
267
|
-
|
|
268
|
-
label:
|
|
269
|
-
children: [/* @__PURE__ */
|
|
254
|
+
V && /* @__PURE__ */ d(b, {
|
|
255
|
+
label: D.label,
|
|
256
|
+
children: [/* @__PURE__ */ u(p, {
|
|
270
257
|
className: "prompt",
|
|
271
258
|
markup: e.rationale || "",
|
|
272
259
|
onChange: this.onRationaleChanged,
|
|
273
260
|
imageSupport: o,
|
|
274
|
-
error:
|
|
261
|
+
error: q,
|
|
275
262
|
toolbarOpts: Q,
|
|
276
|
-
pluginProps: $(
|
|
277
|
-
spellCheck:
|
|
278
|
-
maxImageWidth:
|
|
279
|
-
maxImageHeight:
|
|
280
|
-
uploadSoundSupport:
|
|
263
|
+
pluginProps: $(D?.inputConfiguration),
|
|
264
|
+
spellCheck: H,
|
|
265
|
+
maxImageWidth: m && m.rationale || X,
|
|
266
|
+
maxImageHeight: g && g.rationale || Z,
|
|
267
|
+
uploadSoundSupport: c,
|
|
281
268
|
languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
|
|
282
|
-
mathMlOptions:
|
|
269
|
+
mathMlOptions: M,
|
|
283
270
|
autoWidthToolbar: !0
|
|
284
|
-
}),
|
|
271
|
+
}), q && /* @__PURE__ */ u(S, { children: q })]
|
|
285
272
|
})
|
|
286
273
|
]
|
|
287
274
|
});
|
|
288
275
|
}
|
|
289
276
|
};
|
|
290
277
|
//#endregion
|
|
291
|
-
export {
|
|
278
|
+
export { T as Main, T as default };
|
|
@@ -2453,15 +2453,12 @@ var Lr = class extends K.Component {
|
|
|
2453
2453
|
}), Vr = (e) => typeof e == "string" ? {
|
|
2454
2454
|
label: e,
|
|
2455
2455
|
value: e
|
|
2456
|
-
} : e, Hr =
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
isConfigProperty: n
|
|
2463
|
-
};
|
|
2464
|
-
}, Ur = (e, t, n = !1) => ({
|
|
2456
|
+
} : e, Hr = (e, t, n = !1) => ({
|
|
2457
|
+
type: "radio",
|
|
2458
|
+
label: e,
|
|
2459
|
+
choices: t && t.map((e) => Vr(e)),
|
|
2460
|
+
isConfigProperty: n
|
|
2461
|
+
}), Ur = (e, t, n = !1) => ({
|
|
2465
2462
|
type: "dropdown",
|
|
2466
2463
|
label: e,
|
|
2467
2464
|
choices: t,
|
|
@@ -2927,18 +2924,6 @@ var Xr = me, Zr = Xr.default, Qr = Zr && typeof Zr == "object" ? Zr : Xr, $r = Y
|
|
|
2927
2924
|
let t = document.createElement("div");
|
|
2928
2925
|
return t.innerHTML = e.trim(), t;
|
|
2929
2926
|
}, Li = class extends K.Component {
|
|
2930
|
-
static propTypes = {
|
|
2931
|
-
configuration: Q.default.object.isRequired,
|
|
2932
|
-
model: Q.default.object.isRequired,
|
|
2933
|
-
disableSidePanel: Q.default.bool,
|
|
2934
|
-
onModelChanged: Q.default.func.isRequired,
|
|
2935
|
-
onConfigurationChanged: Q.default.func.isRequired,
|
|
2936
|
-
imageSupport: Q.default.shape({
|
|
2937
|
-
add: Q.default.func.isRequired,
|
|
2938
|
-
delete: Q.default.func.isRequired
|
|
2939
|
-
}),
|
|
2940
|
-
uploadSoundSupport: Q.default.object
|
|
2941
|
-
};
|
|
2942
2927
|
state = {};
|
|
2943
2928
|
componentDidMount() {
|
|
2944
2929
|
let { model: { slateMarkup: e, choices: t, maxLengthPerChoice: n = [] }, onModelChanged: r } = this.props, i = !n.length;
|
|
@@ -2971,15 +2956,15 @@ var Xr = me, Zr = Xr.default, Qr = Zr && typeof Zr == "object" ? Zr : Xr, $r = Y
|
|
|
2971
2956
|
t({ maxLengthPerChoice: e });
|
|
2972
2957
|
};
|
|
2973
2958
|
onChangeResponse = (e, t) => {
|
|
2974
|
-
let { model: n, onModelChanged: r } = this.props, { choices: i } = n,
|
|
2959
|
+
let { model: n, onModelChanged: r } = this.props, { choices: i } = n, a = n.maxLengthPerChoice, o = di(t || "").length;
|
|
2975
2960
|
if (!i[e] || !i[e].length) {
|
|
2976
2961
|
i[e] = [{
|
|
2977
2962
|
label: t || "",
|
|
2978
2963
|
value: "0"
|
|
2979
2964
|
}];
|
|
2980
|
-
let n = e > a.length ? e - a.length : 0;
|
|
2981
|
-
a = [...a, ...Array(n).fill(1)], a.splice(e, 0, li(o));
|
|
2982
|
-
} else i[e][0].label = t || "", a && (a[e] < o || a[e] > o + 10) && (a[e] = li(o));
|
|
2965
|
+
let n = Number(e) > a.length ? Number(e) - a.length : 0;
|
|
2966
|
+
a = [...a, ...Array(n).fill(1)], a.splice(Number(e), 0, li(o));
|
|
2967
|
+
} else i[e][0].label = t || "", a && (a[Number(e)] < o || a[Number(e)] > o + 10) && (a[Number(e)] = li(o));
|
|
2983
2968
|
r({
|
|
2984
2969
|
choices: i,
|
|
2985
2970
|
maxLengthPerChoice: a
|
|
@@ -2988,11 +2973,11 @@ var Xr = me, Zr = Xr.default, Qr = Zr && typeof Zr == "object" ? Zr : Xr, $r = Y
|
|
|
2988
2973
|
onChange = (e) => {
|
|
2989
2974
|
let { model: { choices: t, maxLengthPerChoice: n }, onModelChanged: i } = this.props, a = Ii(e), o = a.querySelectorAll("[data-type=\"explicit_constructed_response\"]"), s = {}, c = [];
|
|
2990
2975
|
o.forEach((e, i) => {
|
|
2991
|
-
let a =
|
|
2992
|
-
|
|
2976
|
+
let a = e.dataset.index, o = r(t[a]);
|
|
2977
|
+
o && (o[0] = {
|
|
2993
2978
|
label: e.dataset.value || "",
|
|
2994
2979
|
value: "0"
|
|
2995
|
-
}, c[i] = n[
|
|
2980
|
+
}, c[i] = n[Number(a)]), s[i] = o, e.dataset.index = `${i}`;
|
|
2996
2981
|
}), this.setState({ cachedChoices: void 0 }, () => i({
|
|
2997
2982
|
choices: s,
|
|
2998
2983
|
slateMarkup: a.innerHTML,
|
|
@@ -3296,6 +3281,10 @@ var Xr = me, Zr = Xr.default, Qr = Zr && typeof Zr == "object" ? Zr : Xr, $r = Y
|
|
|
3296
3281
|
}
|
|
3297
3282
|
}
|
|
3298
3283
|
}, zi = (0, ke.default)("explicit-constructed-response:configure"), Bi = class e extends HTMLElement {
|
|
3284
|
+
_root;
|
|
3285
|
+
_model;
|
|
3286
|
+
_configuration;
|
|
3287
|
+
_disableSidePanel;
|
|
3299
3288
|
static prepareModel = (e = {}) => {
|
|
3300
3289
|
let t = {
|
|
3301
3290
|
...Ri.model,
|
|
@@ -3319,7 +3308,8 @@ var Xr = me, Zr = Xr.default, Qr = Zr && typeof Zr == "object" ? Zr : Xr, $r = Y
|
|
|
3319
3308
|
this._model = e.prepareModel(t), this._model.responseAreaInputConfiguration && (this._model.responseAreaInputConfiguration = this._configuration.responseAreaInputConfiguration?.inputConfiguration), this._render();
|
|
3320
3309
|
}
|
|
3321
3310
|
set configuration(e) {
|
|
3322
|
-
|
|
3311
|
+
let t = o(e, Ri.configuration);
|
|
3312
|
+
this._configuration = t, e.language?.enabled ? e.languageChoices?.options?.length && (this._model.language = e.languageChoices.options[0].value) : e.language.settings && this._model.language ? (t.language.enabled = !0, (!t.languageChoices.options || !t.languageChoices.options.length) && (t.languageChoices.options = []), t.languageChoices.options.find((e) => e.value === this._model.language) || t.languageChoices.options.push({
|
|
3323
3313
|
value: this._model.language,
|
|
3324
3314
|
label: this._model.language
|
|
3325
3315
|
})) : delete this._model.language, this._render();
|