@pie-element/inline-dropdown 10.1.2-next.1 → 10.1.2
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 +1082 -0
- package/CHANGELOG.md +2192 -0
- package/LICENSE.md +5 -0
- package/README.md +1 -0
- package/configure/CHANGELOG.json +647 -0
- package/configure/CHANGELOG.md +1949 -0
- package/configure/lib/defaults.js +192 -0
- package/configure/lib/defaults.js.map +1 -0
- package/configure/lib/index.js +135 -0
- package/configure/lib/index.js.map +1 -0
- package/configure/lib/inline-dropdown-toolbar.js +456 -0
- package/configure/lib/inline-dropdown-toolbar.js.map +1 -0
- package/configure/lib/main.js +612 -0
- package/configure/lib/main.js.map +1 -0
- package/configure/lib/markupUtils.js +50 -0
- package/configure/lib/markupUtils.js.map +1 -0
- package/configure/lib/response-area.js +48 -0
- package/configure/lib/response-area.js.map +1 -0
- package/configure/lib/utils.js +22 -0
- package/configure/lib/utils.js.map +1 -0
- package/configure/package.json +24 -0
- package/controller/CHANGELOG.json +467 -0
- package/controller/CHANGELOG.md +1283 -0
- package/controller/lib/defaults.js +25 -0
- package/controller/lib/defaults.js.map +1 -0
- package/controller/lib/index.js +295 -0
- package/controller/lib/index.js.map +1 -0
- package/controller/lib/utils.js +32 -0
- package/controller/lib/utils.js.map +1 -0
- package/controller/package.json +16 -0
- package/docs/config-schema.json +2854 -0
- package/docs/config-schema.json.md +2106 -0
- package/docs/demo/config.js +8 -0
- package/docs/demo/generate.js +76 -0
- package/docs/demo/index.html +1 -0
- package/docs/demo/session.js +11 -0
- package/docs/pie-schema.json +1152 -0
- package/docs/pie-schema.json.md +814 -0
- package/lib/index.js +85 -0
- package/lib/index.js.map +1 -0
- package/lib/inline-dropdown.js +176 -0
- package/lib/inline-dropdown.js.map +1 -0
- package/package.json +21 -86
- package/configure.js +0 -2
- package/controller.js +0 -1
- package/dist/author/defaults.d.ts +0 -194
- package/dist/author/defaults.js +0 -130
- package/dist/author/index.d.ts +0 -43
- package/dist/author/index.js +0 -83
- package/dist/author/inline-dropdown-toolbar.d.ts +0 -48
- package/dist/author/inline-dropdown-toolbar.js +0 -268
- package/dist/author/main.d.ts +0 -49
- package/dist/author/main.js +0 -379
- package/dist/author/markupUtils.d.ts +0 -12
- package/dist/author/markupUtils.js +0 -23
- package/dist/author/response-area.d.ts +0 -20
- package/dist/author/response-area.js +0 -32
- package/dist/author/utils.d.ts +0 -10
- package/dist/author/utils.js +0 -10
- package/dist/browser/Close-CMvmRhfL.js +0 -9024
- package/dist/browser/Close-CMvmRhfL.js.map +0 -1
- package/dist/browser/author/index.js +0 -40578
- package/dist/browser/author/index.js.map +0 -1
- package/dist/browser/controller/index.js +0 -196
- package/dist/browser/controller/index.js.map +0 -1
- package/dist/browser/delivery/index.js +0 -2714
- package/dist/browser/delivery/index.js.map +0 -1
- package/dist/browser/dist-CAsDMEWi.js +0 -133
- package/dist/browser/dist-CAsDMEWi.js.map +0 -1
- package/dist/browser/inline-dropdown.css +0 -2
- package/dist/controller/defaults.d.ts +0 -27
- package/dist/controller/defaults.js +0 -21
- package/dist/controller/index.d.ts +0 -54
- package/dist/controller/index.js +0 -124
- package/dist/controller/utils.d.ts +0 -12
- package/dist/controller/utils.js +0 -13
- package/dist/delivery/index.d.ts +0 -20
- package/dist/delivery/index.js +0 -60
- package/dist/delivery/inline-dropdown.d.ts +0 -38
- package/dist/delivery/inline-dropdown.js +0 -109
- 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/runtime-support.d.ts +0 -12
- package/dist/runtime-support.js +0 -12
package/dist/author/main.js
DELETED
|
@@ -1,379 +0,0 @@
|
|
|
1
|
-
import { generateValidationMessage as e } from "./utils.js";
|
|
2
|
-
import t from "./inline-dropdown-toolbar.js";
|
|
3
|
-
import n from "./response-area.js";
|
|
4
|
-
import r from "react";
|
|
5
|
-
import { renderMath as i } from "@pie-element/shared-math-rendering-mathjax";
|
|
6
|
-
import a from "react-dom";
|
|
7
|
-
import o from "prop-types";
|
|
8
|
-
import { cloneDeep as s, isEmpty as c, isEqual as l, isUndefined as u, max as d, reduce as f } from "@pie-element/shared-lodash";
|
|
9
|
-
import { color as p } from "@pie-lib/render-ui";
|
|
10
|
-
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
11
|
-
import { styled as g } from "@mui/material/styles";
|
|
12
|
-
import _, { ALL_PLUGINS as v, deleteInlineDropdownByIndex as y } from "@pie-lib/editable-html-tip-tap";
|
|
13
|
-
import { AlertDialog as ee, InputContainer as b, layout as te, settings as x } from "@pie-lib/config-ui";
|
|
14
|
-
import S from "@mui/material/Tooltip";
|
|
15
|
-
import C from "@mui/material/Typography";
|
|
16
|
-
import w from "@mui/material/Accordion";
|
|
17
|
-
import ne from "@mui/material/AccordionSummary";
|
|
18
|
-
import T from "@mui/material/AccordionDetails";
|
|
19
|
-
import E from "@mui/icons-material/ExpandMore";
|
|
20
|
-
import re from "@mui/icons-material/Info";
|
|
21
|
-
//#region src/author/main.tsx
|
|
22
|
-
var { toggle: D, Panel: ie, dropdown: ae } = x, O = g(b)(({ theme: e }) => ({
|
|
23
|
-
width: "100%",
|
|
24
|
-
paddingTop: e.spacing(2),
|
|
25
|
-
marginBottom: e.spacing(2)
|
|
26
|
-
})), oe = g(b)(({ theme: e }) => ({
|
|
27
|
-
width: "100%",
|
|
28
|
-
paddingTop: e.spacing(.5),
|
|
29
|
-
marginBottom: e.spacing(2)
|
|
30
|
-
})), k = g(C)(({ theme: e }) => ({
|
|
31
|
-
fontSize: e.typography.fontSize + 2,
|
|
32
|
-
marginRight: e.spacing(1)
|
|
33
|
-
})), se = g("span")(({ theme: e }) => ({
|
|
34
|
-
display: "flex",
|
|
35
|
-
alignItems: "center",
|
|
36
|
-
whiteSpace: "break-spaces",
|
|
37
|
-
color: p.disabled(),
|
|
38
|
-
padding: 0,
|
|
39
|
-
fontSize: e.typography.fontSize - 2,
|
|
40
|
-
lineHeight: 1
|
|
41
|
-
})), A = g("div")(({ theme: e }) => ({ marginBottom: e.spacing(2.5) })), j = g(T)({
|
|
42
|
-
display: "block",
|
|
43
|
-
paddingTop: 0,
|
|
44
|
-
paddingBottom: 0
|
|
45
|
-
}), M = g("div")(({ theme: e }) => ({
|
|
46
|
-
display: "flex",
|
|
47
|
-
alignItems: "center",
|
|
48
|
-
marginBottom: e.spacing(1)
|
|
49
|
-
})), N = g(S)(({ theme: e }) => ({ "& .MuiTooltip-tooltip": {
|
|
50
|
-
fontSize: e.typography.fontSize - 2,
|
|
51
|
-
whiteSpace: "pre",
|
|
52
|
-
maxWidth: "500px"
|
|
53
|
-
} })), P = g("div")(({ theme: e }) => ({
|
|
54
|
-
fontSize: e.typography.fontSize - 2,
|
|
55
|
-
color: e.palette.error.main,
|
|
56
|
-
paddingTop: e.spacing(1)
|
|
57
|
-
})), F = (e) => {
|
|
58
|
-
let t = document.createElement("div");
|
|
59
|
-
return t.innerHTML = (e || "").trim(), t;
|
|
60
|
-
}, I = class extends r.Component {
|
|
61
|
-
static propTypes = {
|
|
62
|
-
configuration: o.object.isRequired,
|
|
63
|
-
model: o.object.isRequired,
|
|
64
|
-
disableSidePanel: o.bool,
|
|
65
|
-
onModelChanged: o.func.isRequired,
|
|
66
|
-
onConfigurationChanged: o.func.isRequired,
|
|
67
|
-
imageSupport: o.shape({
|
|
68
|
-
add: o.func.isRequired,
|
|
69
|
-
delete: o.func.isRequired
|
|
70
|
-
}),
|
|
71
|
-
uploadSoundSupport: o.shape({
|
|
72
|
-
add: o.func.isRequired,
|
|
73
|
-
delete: o.func.isRequired
|
|
74
|
-
})
|
|
75
|
-
};
|
|
76
|
-
state = { warning: { open: !1 } };
|
|
77
|
-
componentDidMount() {
|
|
78
|
-
let { model: { choices: e } } = this.props;
|
|
79
|
-
this.setState({ respAreaChoices: s(e) });
|
|
80
|
-
}
|
|
81
|
-
UNSAFE_componentWillReceiveProps(e) {
|
|
82
|
-
let t = {};
|
|
83
|
-
(!l(e.model.choices, this.props.model.choices) || !l(e.model.choices, this.state.respAreaChoices)) && (t.respAreaChoices = s(e.model.choices)), c(t) || this.setState(t);
|
|
84
|
-
}
|
|
85
|
-
componentDidUpdate() {
|
|
86
|
-
i(a.findDOMNode(this));
|
|
87
|
-
}
|
|
88
|
-
onModelChange = (e) => {
|
|
89
|
-
this.props.onModelChanged({
|
|
90
|
-
...this.props.model,
|
|
91
|
-
...e
|
|
92
|
-
});
|
|
93
|
-
};
|
|
94
|
-
onPromptChanged = (e) => {
|
|
95
|
-
this.onModelChange({ prompt: e });
|
|
96
|
-
};
|
|
97
|
-
onRationaleChanged = (e) => {
|
|
98
|
-
this.onModelChange({ rationale: e });
|
|
99
|
-
};
|
|
100
|
-
onChoiceRationaleChanged = (e, t) => {
|
|
101
|
-
let { model: n } = this.props, r = n.choices && n.choices[e] && n.choices[e].findIndex((e) => e.label === t.label && e.value === t.value);
|
|
102
|
-
n.choices[e] && n.choices[e].splice(r, 1, t), this.onModelChange(n);
|
|
103
|
-
};
|
|
104
|
-
onTeacherInstructionsChanged = (e) => {
|
|
105
|
-
this.onModelChange({ teacherInstructions: e });
|
|
106
|
-
};
|
|
107
|
-
onMarkupChanged = (e) => {
|
|
108
|
-
this.onModelChange({ slateMarkup: e });
|
|
109
|
-
};
|
|
110
|
-
onCheck = (e, t) => {
|
|
111
|
-
this.setState({ warning: {
|
|
112
|
-
open: !0,
|
|
113
|
-
text: "Response areas with under 2 options or with no correct answers will be discarded.",
|
|
114
|
-
onClose: () => {
|
|
115
|
-
this.setState({ warning: { open: !1 } }, t);
|
|
116
|
-
},
|
|
117
|
-
onConfirm: () => {
|
|
118
|
-
this.setState({ warning: { open: !1 } }, e);
|
|
119
|
-
}
|
|
120
|
-
} });
|
|
121
|
-
};
|
|
122
|
-
validateResponseAreaClose = (e, t, n, r, i) => {
|
|
123
|
-
let { respAreaChoices: a } = this.state, o = e.attrs.index, s = a[o] || [];
|
|
124
|
-
if (!(s.length < 2 || !s.find((e) => e.correct))) {
|
|
125
|
-
r();
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
n._holdInlineDropdownToolbarIndex = o, this.onCheck(() => {
|
|
129
|
-
delete n._holdInlineDropdownToolbarIndex, y(n, o, t), r();
|
|
130
|
-
}, i);
|
|
131
|
-
};
|
|
132
|
-
onChange = (e) => {
|
|
133
|
-
let { respAreaChoices: t } = this.state, n = F(e), r = n.querySelectorAll("[data-type=\"inline_dropdown\"]"), i = {};
|
|
134
|
-
r.forEach((e) => {
|
|
135
|
-
i[e.dataset.index] = e.dataset.value || "";
|
|
136
|
-
});
|
|
137
|
-
let a = f(t, (e, n, r) => (u(i[r]) || (e[r] = t[r]), e), {}), o = {};
|
|
138
|
-
r.forEach((e, t) => {
|
|
139
|
-
let n = a[e.dataset.index];
|
|
140
|
-
n && (o[t] = n), e.dataset.index = t;
|
|
141
|
-
}), this.onModelChange({
|
|
142
|
-
choices: s(o),
|
|
143
|
-
slateMarkup: n.innerHTML
|
|
144
|
-
});
|
|
145
|
-
};
|
|
146
|
-
onAddChoice = (e, t, n) => {
|
|
147
|
-
let { respAreaChoices: r } = this.state, { maxResponseAreaChoices: i } = this.props.configuration, a = (e) => this.setState({ warning: {
|
|
148
|
-
open: !0,
|
|
149
|
-
text: e,
|
|
150
|
-
onClose: void 0,
|
|
151
|
-
onConfirm: () => {
|
|
152
|
-
this.setState({ warning: { open: !1 } });
|
|
153
|
-
}
|
|
154
|
-
} });
|
|
155
|
-
if (r[e] && r[e].length >= i) {
|
|
156
|
-
a(`There are only ${i} answers allowed per choice.`);
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
159
|
-
if (r[e] || (r[e] = []), (r[e] || []).find((e, r) => e.label === t && r !== n)) {
|
|
160
|
-
a("Duplicate answers are not allowed.");
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
if (n >= 0 && r[e]?.[n]) r[e][n].label = t;
|
|
164
|
-
else {
|
|
165
|
-
let n = r[e] && d(r[e].map((e) => parseInt(e.value)).filter((e) => !isNaN(e))) || 0;
|
|
166
|
-
r[e].push({
|
|
167
|
-
label: t,
|
|
168
|
-
value: `${n + 1}`,
|
|
169
|
-
correct: !1
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
this.onModelChange({ choices: s(r) });
|
|
173
|
-
};
|
|
174
|
-
onRemoveChoice = (e, t) => {
|
|
175
|
-
let { respAreaChoices: n } = this.state;
|
|
176
|
-
n[e].splice(t, 1), this.onModelChange({ choices: s(n) });
|
|
177
|
-
};
|
|
178
|
-
onSelectChoice = (e, t) => {
|
|
179
|
-
let { respAreaChoices: n } = this.state;
|
|
180
|
-
n[e] = n[e].map((e, n) => ({
|
|
181
|
-
...e,
|
|
182
|
-
correct: n === t
|
|
183
|
-
})), this.onModelChange({ choices: s(n) });
|
|
184
|
-
};
|
|
185
|
-
render() {
|
|
186
|
-
let { warning: i } = this.state, { model: a, configuration: o, onConfigurationChanged: s, imageSupport: c, uploadSoundSupport: l } = this.props, { baseInputConfiguration: u = {}, choiceRationale: d = {}, contentDimensions: f = {}, lockChoiceOrder: p = {}, maxResponseAreas: g, maxImageWidth: y = {}, maxImageHeight: b = {}, partialScoring: x = {}, prompt: S = {}, rationale: C = {}, settingsPanelDisabled: T, spellCheck: F = {}, teacherInstructions: I = {}, template: ce = {}, withRubric: L = {}, mathMlOptions: R = {}, language: z = {}, languageChoices: B = {}, responseAreaInputConfiguration: V = {} } = o || {}, { choiceRationaleEnabled: H, choices: U, errors: W, extraCSSRules: le, promptEnabled: ue, rationaleEnabled: de, spellCheckEnabled: G, teacherInstructionsEnabled: fe, toolbarEditorPosition: pe } = a || {}, { prompt: K, rationale: q, responseAreasError: J, responseAreaChoicesError: me, teacherInstructions: Y } = W || {}, X = y && y.prompt, Z = b && b.prompt, he = () => (Object.keys(U) || []).map((e, t) => /* @__PURE__ */ m(A, { children: /* @__PURE__ */ h(w, {
|
|
187
|
-
slotProps: { transition: { timeout: {
|
|
188
|
-
enter: 225,
|
|
189
|
-
exit: 195
|
|
190
|
-
} } },
|
|
191
|
-
children: [/* @__PURE__ */ m(ne, {
|
|
192
|
-
expandIcon: /* @__PURE__ */ m(E, {}),
|
|
193
|
-
children: /* @__PURE__ */ m(k, {
|
|
194
|
-
component: "div",
|
|
195
|
-
children: `Rationale for response area #${t + 1}`
|
|
196
|
-
})
|
|
197
|
-
}), /* @__PURE__ */ m(j, { children: (U[e] || []).map((t) => /* @__PURE__ */ h(r.Fragment, { children: [/* @__PURE__ */ m(se, { dangerouslySetInnerHTML: { __html: `${C.label} for ${t.label} (${t.correct ? "correct" : "incorrect"})` } }), /* @__PURE__ */ m(oe, { children: /* @__PURE__ */ m(_, {
|
|
198
|
-
markup: t.rationale || "",
|
|
199
|
-
spellCheck: G,
|
|
200
|
-
pluginProps: $(C?.inputConfiguration),
|
|
201
|
-
onChange: (n) => this.onChoiceRationaleChanged(e, {
|
|
202
|
-
...t,
|
|
203
|
-
rationale: n
|
|
204
|
-
}),
|
|
205
|
-
imageSupport: c,
|
|
206
|
-
maxImageWidth: y && y.rationale || X,
|
|
207
|
-
maxImageHeight: b && b.rationale || Z,
|
|
208
|
-
uploadSoundSupport: l,
|
|
209
|
-
mathMlOptions: R
|
|
210
|
-
}) })] }, t.label)) })]
|
|
211
|
-
}) }, e)), Q = { position: pe === "top" ? "top" : "bottom" }, ge = e(o), _e = {
|
|
212
|
-
partialScoring: x.settings && D(x.label),
|
|
213
|
-
lockChoiceOrder: p.settings && D(p.label),
|
|
214
|
-
"language.enabled": z.settings && D(z.label, !0),
|
|
215
|
-
language: z.settings && z.enabled && ae(B.label, B.options)
|
|
216
|
-
}, ve = {
|
|
217
|
-
teacherInstructionsEnabled: I.settings && D(I.label),
|
|
218
|
-
rationaleEnabled: C.settings && D(C.label),
|
|
219
|
-
choiceRationaleEnabled: d.settings && D(d.label),
|
|
220
|
-
promptEnabled: S.settings && D(S.label),
|
|
221
|
-
spellCheckEnabled: F.settings && D(F.label),
|
|
222
|
-
rubricEnabled: L?.settings && D(L?.label)
|
|
223
|
-
}, $ = (e = {}) => ({
|
|
224
|
-
...u,
|
|
225
|
-
...e
|
|
226
|
-
});
|
|
227
|
-
return /* @__PURE__ */ h(te.ConfigLayout, {
|
|
228
|
-
extraCSSRules: {
|
|
229
|
-
names: ["red", "blue"],
|
|
230
|
-
rules: "\n .red {\n color: red !important;\n }\n\n .blue {\n color: blue !important;\n }\n "
|
|
231
|
-
},
|
|
232
|
-
dimensions: f,
|
|
233
|
-
hideSettings: T,
|
|
234
|
-
settings: /* @__PURE__ */ m(ie, {
|
|
235
|
-
model: a,
|
|
236
|
-
configuration: o,
|
|
237
|
-
onChangeModel: (e) => this.onModelChange(e),
|
|
238
|
-
onChangeConfiguration: (e) => s(e, !0),
|
|
239
|
-
groups: {
|
|
240
|
-
Settings: _e,
|
|
241
|
-
Properties: ve
|
|
242
|
-
}
|
|
243
|
-
}),
|
|
244
|
-
children: [
|
|
245
|
-
fe && /* @__PURE__ */ h(O, {
|
|
246
|
-
label: I.label,
|
|
247
|
-
children: [/* @__PURE__ */ m(_, {
|
|
248
|
-
markup: a.teacherInstructions || "",
|
|
249
|
-
onChange: this.onTeacherInstructionsChanged,
|
|
250
|
-
imageSupport: c,
|
|
251
|
-
nonEmpty: !1,
|
|
252
|
-
error: Y,
|
|
253
|
-
toolbarOpts: Q,
|
|
254
|
-
pluginProps: $(I?.inputConfiguration),
|
|
255
|
-
spellCheck: G,
|
|
256
|
-
maxImageWidth: y && y.teacherInstructions || X,
|
|
257
|
-
maxImageHeight: b && b.teacherInstructions || Z,
|
|
258
|
-
uploadSoundSupport: l,
|
|
259
|
-
languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
|
|
260
|
-
mathMlOptions: R
|
|
261
|
-
}), Y && /* @__PURE__ */ m(P, { children: Y })]
|
|
262
|
-
}),
|
|
263
|
-
ue && /* @__PURE__ */ h(O, {
|
|
264
|
-
label: S.label,
|
|
265
|
-
children: [/* @__PURE__ */ m(_, {
|
|
266
|
-
markup: a.prompt,
|
|
267
|
-
onChange: this.onPromptChanged,
|
|
268
|
-
imageSupport: c,
|
|
269
|
-
nonEmpty: !1,
|
|
270
|
-
disableUnderline: !0,
|
|
271
|
-
error: K,
|
|
272
|
-
toolbarOpts: Q,
|
|
273
|
-
pluginProps: $(S?.inputConfiguration),
|
|
274
|
-
spellCheck: G,
|
|
275
|
-
maxImageWidth: X,
|
|
276
|
-
maxImageHeight: Z,
|
|
277
|
-
uploadSoundSupport: l,
|
|
278
|
-
languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
|
|
279
|
-
mathMlOptions: R
|
|
280
|
-
}), K && /* @__PURE__ */ m(P, { children: K })]
|
|
281
|
-
}),
|
|
282
|
-
/* @__PURE__ */ h(M, { children: [/* @__PURE__ */ m(k, {
|
|
283
|
-
component: "div",
|
|
284
|
-
children: "Define Template, Choices, and Correct Responses"
|
|
285
|
-
}), /* @__PURE__ */ m(N, {
|
|
286
|
-
disableFocusListener: !0,
|
|
287
|
-
disableTouchListener: !0,
|
|
288
|
-
placement: "right",
|
|
289
|
-
title: ge,
|
|
290
|
-
children: /* @__PURE__ */ m(re, {
|
|
291
|
-
fontSize: "small",
|
|
292
|
-
color: "primary"
|
|
293
|
-
})
|
|
294
|
-
})] }),
|
|
295
|
-
/* @__PURE__ */ m(n, {
|
|
296
|
-
responseAreasError: J,
|
|
297
|
-
responseAreaChoicesError: me,
|
|
298
|
-
editableHtmlProps: {
|
|
299
|
-
pluginProps: $(ce?.inputConfiguration),
|
|
300
|
-
activePlugins: v,
|
|
301
|
-
toolbarOpts: { position: "top" },
|
|
302
|
-
extraCSSRules: {
|
|
303
|
-
names: ["red", "blue"],
|
|
304
|
-
rules: "\n .red {\n color: red !important;\n }\n\n .blue {\n color: blue !important;\n }\n "
|
|
305
|
-
},
|
|
306
|
-
responseAreaProps: {
|
|
307
|
-
type: "inline-dropdown",
|
|
308
|
-
options: { duplicates: !0 },
|
|
309
|
-
maxResponseAreas: g,
|
|
310
|
-
onToolbarCloseRequest: ([e, t], n, r, i) => {
|
|
311
|
-
this.validateResponseAreaClose(e, t, n, r, i);
|
|
312
|
-
},
|
|
313
|
-
respAreaToolbar: (e, n, r) => {
|
|
314
|
-
let [i, a] = e, { respAreaChoices: o } = this.state;
|
|
315
|
-
return (e) => /* @__PURE__ */ m(t, {
|
|
316
|
-
...e,
|
|
317
|
-
onAddChoice: this.onAddChoice,
|
|
318
|
-
onRemoveChoice: (e) => this.onRemoveChoice(i.attrs.index, e),
|
|
319
|
-
onSelectChoice: (e) => this.onSelectChoice(i.attrs.index, e),
|
|
320
|
-
node: i,
|
|
321
|
-
pos: a,
|
|
322
|
-
editor: n,
|
|
323
|
-
onToolbarDone: r,
|
|
324
|
-
choices: o[i.attrs.index],
|
|
325
|
-
spellCheck: G,
|
|
326
|
-
uploadSoundSupport: l,
|
|
327
|
-
mathMlOptions: R,
|
|
328
|
-
baseInputConfiguration: u,
|
|
329
|
-
responseAreaInputConfiguration: V
|
|
330
|
-
});
|
|
331
|
-
}
|
|
332
|
-
},
|
|
333
|
-
spellCheck: G,
|
|
334
|
-
markup: a.slateMarkup || "",
|
|
335
|
-
onChange: this.onChange,
|
|
336
|
-
imageSupport: c,
|
|
337
|
-
disableImageAlignmentButtons: !0,
|
|
338
|
-
disabled: !1,
|
|
339
|
-
highlightShape: !1,
|
|
340
|
-
error: J,
|
|
341
|
-
uploadSoundSupport: l,
|
|
342
|
-
languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
|
|
343
|
-
mathMlOptions: R
|
|
344
|
-
}
|
|
345
|
-
}),
|
|
346
|
-
H && he(),
|
|
347
|
-
de && /* @__PURE__ */ h(O, {
|
|
348
|
-
label: C.label,
|
|
349
|
-
children: [/* @__PURE__ */ m(_, {
|
|
350
|
-
markup: a.rationale || "",
|
|
351
|
-
onChange: this.onRationaleChanged,
|
|
352
|
-
imageSupport: c,
|
|
353
|
-
error: q,
|
|
354
|
-
toolbarOpts: Q,
|
|
355
|
-
pluginProps: $(C?.inputConfiguration),
|
|
356
|
-
spellCheck: G,
|
|
357
|
-
maxImageWidth: y && y.rationale || X,
|
|
358
|
-
maxImageHeight: b && b.rationale || Z,
|
|
359
|
-
uploadSoundSupport: l,
|
|
360
|
-
languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
|
|
361
|
-
mathMlOptions: R
|
|
362
|
-
}), q && /* @__PURE__ */ m(P, { children: q })]
|
|
363
|
-
}),
|
|
364
|
-
/* @__PURE__ */ m(ee, {
|
|
365
|
-
open: i.open,
|
|
366
|
-
title: "Warning",
|
|
367
|
-
text: i.text,
|
|
368
|
-
onClose: i.onClose,
|
|
369
|
-
onConfirm: i.onConfirm,
|
|
370
|
-
disableAutoFocus: !0,
|
|
371
|
-
disableEnforceFocus: !0,
|
|
372
|
-
disableRestoreFocus: !0
|
|
373
|
-
})
|
|
374
|
-
]
|
|
375
|
-
});
|
|
376
|
-
}
|
|
377
|
-
};
|
|
378
|
-
//#endregion
|
|
379
|
-
export { I as default };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/inline-dropdown/configure/src/markupUtils.js
|
|
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
|
-
export declare const removeUnwantedCharacters: (markup: any) => any;
|
|
10
|
-
export declare const createElementFromHTML: (htmlString: any) => HTMLDivElement;
|
|
11
|
-
export declare const processMarkup: (markup: any) => string;
|
|
12
|
-
export declare const createSlateMarkup: (markup: any, choices: any) => any;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { escape as e } from "@pie-element/shared-lodash";
|
|
2
|
-
//#region src/author/markupUtils.tsx
|
|
3
|
-
var t = "imes|riangle|an|heta|herefore", n = "throot|parallel|cong|approx|eq|e|sim", r = RegExp(`(\\t(?!${t}))|(\\n(?!${n}))|(\\\\t(?!${t}))|(\\\\n(?!${n}))`, "g"), i = (e) => e.replace(r, "").replace(/\\"/g, "\"").replace(/\\\//g, "/"), a = (e) => {
|
|
4
|
-
let t = document.createElement("div");
|
|
5
|
-
return t.innerHTML = e.trim(), t;
|
|
6
|
-
}, o = (e) => {
|
|
7
|
-
let t = a(i(e));
|
|
8
|
-
return t.querySelectorAll("[data-type=\"inline_dropdown\"]").forEach((e) => {
|
|
9
|
-
e.replaceWith(`{{${e.dataset.index}}}`);
|
|
10
|
-
}), t.innerHTML;
|
|
11
|
-
}, s = /\{\{(\d+)\}\}/g, c = (t, n) => {
|
|
12
|
-
let r = i(t), a = (t) => {
|
|
13
|
-
let r = n[t] && n[t].find((e) => e.correct);
|
|
14
|
-
return (!r || !r.value) && (r = {
|
|
15
|
-
id: "",
|
|
16
|
-
value: "",
|
|
17
|
-
label: ""
|
|
18
|
-
}), `<span data-type="inline_dropdown" data-index="${t}" data-value="${e(r.label)}"></span>`;
|
|
19
|
-
};
|
|
20
|
-
return r.replace(s, (e, t) => a(t));
|
|
21
|
-
};
|
|
22
|
-
//#endregion
|
|
23
|
-
export { c as createSlateMarkup, o as processMarkup };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/inline-dropdown/configure/src/response-area.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 ResponseAreaComponent extends React.Component {
|
|
12
|
-
static propTypes: {
|
|
13
|
-
editableHtmlProps: PropTypes.Validator<object>;
|
|
14
|
-
responseAreasError: PropTypes.Requireable<string>;
|
|
15
|
-
responseAreaChoicesError: PropTypes.Requireable<string>;
|
|
16
|
-
};
|
|
17
|
-
componentDidMount(): void;
|
|
18
|
-
render(): React.JSX.Element;
|
|
19
|
-
}
|
|
20
|
-
export default ResponseAreaComponent;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import e from "react";
|
|
2
|
-
import { renderMath as t } from "@pie-element/shared-math-rendering-mathjax";
|
|
3
|
-
import n from "react-dom";
|
|
4
|
-
import r from "prop-types";
|
|
5
|
-
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
6
|
-
import { styled as o } from "@mui/material/styles";
|
|
7
|
-
import s from "@pie-lib/editable-html-tip-tap";
|
|
8
|
-
//#region src/author/response-area.tsx
|
|
9
|
-
var c = o("div")(({ theme: e }) => ({ paddingBottom: e.spacing(2.5) })), l = o("div")(({ theme: e }) => ({
|
|
10
|
-
fontSize: e.typography.fontSize - 2,
|
|
11
|
-
color: e.palette.error.main,
|
|
12
|
-
paddingTop: e.spacing(1)
|
|
13
|
-
})), u = class extends e.Component {
|
|
14
|
-
static propTypes = {
|
|
15
|
-
editableHtmlProps: r.object.isRequired,
|
|
16
|
-
responseAreasError: r.string,
|
|
17
|
-
responseAreaChoicesError: r.string
|
|
18
|
-
};
|
|
19
|
-
componentDidMount() {
|
|
20
|
-
t(n.findDOMNode(this));
|
|
21
|
-
}
|
|
22
|
-
render() {
|
|
23
|
-
let { editableHtmlProps: e, responseAreasError: t, responseAreaChoicesError: n } = this.props;
|
|
24
|
-
return /* @__PURE__ */ a(c, { children: [
|
|
25
|
-
/* @__PURE__ */ i(s, { ...e }),
|
|
26
|
-
t && /* @__PURE__ */ i(l, { children: t }),
|
|
27
|
-
n && /* @__PURE__ */ i(l, { children: n })
|
|
28
|
-
] });
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
//#endregion
|
|
32
|
-
export { u as default };
|
package/dist/author/utils.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/inline-dropdown/configure/src/utils.js
|
|
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
|
-
export declare const generateValidationMessage: (config: any) => string;
|
|
10
|
-
export declare const getPluginProps: (props?: {}, baseInputConfiguration?: {}) => {};
|
package/dist/author/utils.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
//#region src/author/utils.ts
|
|
2
|
-
var e = (e) => {
|
|
3
|
-
let { maxResponseAreas: t, maxResponseAreaChoices: n } = e;
|
|
4
|
-
return "Validation requirements:" + ("\nThere should be at least 1 " + (t ? `and at most ${t} ` : "") + "response area" + (t ? "s" : "") + " defined." + (n ? `\nThere should be at most ${n} choices defined per response area.` : ""));
|
|
5
|
-
}, t = (e = {}, t = {}) => ({
|
|
6
|
-
...t,
|
|
7
|
-
...e
|
|
8
|
-
});
|
|
9
|
-
//#endregion
|
|
10
|
-
export { e as generateValidationMessage, t as getPluginProps };
|