@pie-element/categorize 13.1.2-next.5 → 13.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.
Files changed (158) hide show
  1. package/CHANGELOG.json +1637 -0
  2. package/CHANGELOG.md +2550 -0
  3. package/LICENSE.md +5 -0
  4. package/README.md +5 -0
  5. package/configure/CHANGELOG.json +1202 -0
  6. package/configure/CHANGELOG.md +2131 -0
  7. package/configure/lib/defaults.js +222 -0
  8. package/configure/lib/defaults.js.map +1 -0
  9. package/configure/lib/design/builder.js +55 -0
  10. package/configure/lib/design/builder.js.map +1 -0
  11. package/configure/lib/design/buttons.js +59 -0
  12. package/configure/lib/design/buttons.js.map +1 -0
  13. package/configure/lib/design/categories/RowLabel.js +66 -0
  14. package/configure/lib/design/categories/RowLabel.js.map +1 -0
  15. package/configure/lib/design/categories/alternateResponses.js +116 -0
  16. package/configure/lib/design/categories/alternateResponses.js.map +1 -0
  17. package/configure/lib/design/categories/category.js +153 -0
  18. package/configure/lib/design/categories/category.js.map +1 -0
  19. package/configure/lib/design/categories/choice-preview.js +79 -0
  20. package/configure/lib/design/categories/choice-preview.js.map +1 -0
  21. package/configure/lib/design/categories/droppable-placeholder.js +93 -0
  22. package/configure/lib/design/categories/droppable-placeholder.js.map +1 -0
  23. package/configure/lib/design/categories/index.js +256 -0
  24. package/configure/lib/design/categories/index.js.map +1 -0
  25. package/configure/lib/design/choices/choice.js +187 -0
  26. package/configure/lib/design/choices/choice.js.map +1 -0
  27. package/configure/lib/design/choices/config.js +58 -0
  28. package/configure/lib/design/choices/config.js.map +1 -0
  29. package/configure/lib/design/choices/index.js +197 -0
  30. package/configure/lib/design/choices/index.js.map +1 -0
  31. package/configure/lib/design/header.js +71 -0
  32. package/configure/lib/design/header.js.map +1 -0
  33. package/configure/lib/design/index.js +727 -0
  34. package/configure/lib/design/index.js.map +1 -0
  35. package/configure/lib/design/input-header.js +105 -0
  36. package/configure/lib/design/input-header.js.map +1 -0
  37. package/configure/lib/design/utils.js +12 -0
  38. package/configure/lib/design/utils.js.map +1 -0
  39. package/configure/lib/index.js +147 -0
  40. package/configure/lib/index.js.map +1 -0
  41. package/configure/lib/main.js +44 -0
  42. package/configure/lib/main.js.map +1 -0
  43. package/configure/lib/utils.js +43 -0
  44. package/configure/lib/utils.js.map +1 -0
  45. package/configure/package.json +32 -0
  46. package/controller/CHANGELOG.json +452 -0
  47. package/controller/CHANGELOG.md +1384 -0
  48. package/controller/lib/defaults.js +33 -0
  49. package/controller/lib/defaults.js.map +1 -0
  50. package/controller/lib/index.js +493 -0
  51. package/controller/lib/index.js.map +1 -0
  52. package/controller/lib/utils.js +69 -0
  53. package/controller/lib/utils.js.map +1 -0
  54. package/controller/package.json +18 -0
  55. package/docs/config-schema.json +2897 -0
  56. package/docs/config-schema.json.md +2138 -0
  57. package/docs/demo/config.js +8 -0
  58. package/docs/demo/generate.js +357 -0
  59. package/docs/demo/index.html +1 -0
  60. package/docs/demo/session.js +12 -0
  61. package/docs/pie-schema.json +1784 -0
  62. package/docs/pie-schema.json.md +1046 -0
  63. package/lib/categorize/categories.js +135 -0
  64. package/lib/categorize/categories.js.map +1 -0
  65. package/lib/categorize/category.js +67 -0
  66. package/lib/categorize/category.js.map +1 -0
  67. package/lib/categorize/choice.js +140 -0
  68. package/lib/categorize/choice.js.map +1 -0
  69. package/lib/categorize/choices.js +99 -0
  70. package/lib/categorize/choices.js.map +1 -0
  71. package/lib/categorize/droppable-placeholder.js +84 -0
  72. package/lib/categorize/droppable-placeholder.js.map +1 -0
  73. package/lib/categorize/grid-content.js +55 -0
  74. package/lib/categorize/grid-content.js.map +1 -0
  75. package/lib/categorize/index.js +450 -0
  76. package/lib/categorize/index.js.map +1 -0
  77. package/lib/index.js +316 -0
  78. package/lib/index.js.map +1 -0
  79. package/package.json +22 -85
  80. package/configure.js +0 -2
  81. package/controller.js +0 -1
  82. package/dist/author/defaults.d.ts +0 -223
  83. package/dist/author/defaults.js +0 -170
  84. package/dist/author/design/builder.d.ts +0 -10
  85. package/dist/author/design/builder.js +0 -24
  86. package/dist/author/design/buttons.d.ts +0 -28
  87. package/dist/author/design/buttons.js +0 -36
  88. package/dist/author/design/categories/RowLabel.d.ts +0 -23
  89. package/dist/author/design/categories/RowLabel.js +0 -47
  90. package/dist/author/design/categories/alternateResponses.d.ts +0 -31
  91. package/dist/author/design/categories/alternateResponses.js +0 -62
  92. package/dist/author/design/categories/category.d.ts +0 -44
  93. package/dist/author/design/categories/category.js +0 -98
  94. package/dist/author/design/categories/choice-preview.d.ts +0 -25
  95. package/dist/author/design/categories/choice-preview.js +0 -60
  96. package/dist/author/design/categories/droppable-placeholder.d.ts +0 -11
  97. package/dist/author/design/categories/droppable-placeholder.js +0 -71
  98. package/dist/author/design/categories/index.d.ts +0 -41
  99. package/dist/author/design/categories/index.js +0 -146
  100. package/dist/author/design/choices/choice.d.ts +0 -11
  101. package/dist/author/design/choices/choice.js +0 -129
  102. package/dist/author/design/choices/config.d.ts +0 -21
  103. package/dist/author/design/choices/config.js +0 -33
  104. package/dist/author/design/choices/index.d.ts +0 -41
  105. package/dist/author/design/choices/index.js +0 -110
  106. package/dist/author/design/header.d.ts +0 -24
  107. package/dist/author/design/header.js +0 -49
  108. package/dist/author/design/index.d.ts +0 -52
  109. package/dist/author/design/index.js +0 -417
  110. package/dist/author/design/input-header.d.ts +0 -39
  111. package/dist/author/design/input-header.js +0 -69
  112. package/dist/author/design/utils.d.ts +0 -9
  113. package/dist/author/design/utils.js +0 -7
  114. package/dist/author/index.d.ts +0 -51
  115. package/dist/author/index.js +0 -87
  116. package/dist/author/main.d.ts +0 -23
  117. package/dist/author/main.js +0 -30
  118. package/dist/author/utils.d.ts +0 -16
  119. package/dist/author/utils.js +0 -17
  120. package/dist/browser/author/index.js +0 -2041
  121. package/dist/browser/author/index.js.map +0 -1
  122. package/dist/browser/categorize.css +0 -2
  123. package/dist/browser/controller/index.js +0 -299
  124. package/dist/browser/controller/index.js.map +0 -1
  125. package/dist/browser/delivery/index.js +0 -1051
  126. package/dist/browser/delivery/index.js.map +0 -1
  127. package/dist/browser/dist-7UsF60Ks.js +0 -55705
  128. package/dist/browser/dist-7UsF60Ks.js.map +0 -1
  129. package/dist/browser/dist-DnGF41FP.js +0 -1958
  130. package/dist/browser/dist-DnGF41FP.js.map +0 -1
  131. package/dist/controller/defaults.d.ts +0 -34
  132. package/dist/controller/defaults.js +0 -29
  133. package/dist/controller/index.d.ts +0 -61
  134. package/dist/controller/index.js +0 -155
  135. package/dist/controller/utils.d.ts +0 -20
  136. package/dist/controller/utils.js +0 -35
  137. package/dist/delivery/categorize/categories.d.ts +0 -34
  138. package/dist/delivery/categorize/categories.js +0 -66
  139. package/dist/delivery/categorize/category.d.ts +0 -28
  140. package/dist/delivery/categorize/category.js +0 -48
  141. package/dist/delivery/categorize/choice.d.ts +0 -27
  142. package/dist/delivery/categorize/choice.js +0 -94
  143. package/dist/delivery/categorize/choices.d.ts +0 -39
  144. package/dist/delivery/categorize/choices.js +0 -51
  145. package/dist/delivery/categorize/droppable-placeholder.d.ts +0 -32
  146. package/dist/delivery/categorize/droppable-placeholder.js +0 -64
  147. package/dist/delivery/categorize/grid-content.d.ts +0 -25
  148. package/dist/delivery/categorize/grid-content.js +0 -39
  149. package/dist/delivery/categorize/index.d.ts +0 -57
  150. package/dist/delivery/categorize/index.js +0 -260
  151. package/dist/delivery/index.d.ts +0 -27
  152. package/dist/delivery/index.js +0 -152
  153. package/dist/index.d.ts +0 -1
  154. package/dist/index.iife.d.ts +0 -8
  155. package/dist/index.iife.js +0 -152
  156. package/dist/index.js +0 -2
  157. package/dist/runtime-support.d.ts +0 -12
  158. package/dist/runtime-support.js +0 -12
@@ -1,417 +0,0 @@
1
- import { getPluginProps as e } from "./utils.js";
2
- import t from "./categories/choice-preview.js";
3
- import n from "./header.js";
4
- import { getMaxCategoryChoices as r, multiplePlacements as i } from "../utils.js";
5
- import a from "./categories/index.js";
6
- import o from "./categories/alternateResponses.js";
7
- import s from "./choices/choice.js";
8
- import c from "./choices/index.js";
9
- import { buildAlternateResponses as l, buildCategories as u } from "./builder.js";
10
- import d from "react";
11
- import { renderMath as f } from "@pie-element/shared-math-rendering-mathjax";
12
- import p from "prop-types";
13
- import { styled as m } from "@mui/material/styles";
14
- import { DragOverlay as ee } from "@dnd-kit/core";
15
- import { countInAnswer as h, ensureNoExtraChoicesInAlternate as g, ensureNoExtraChoicesInAnswer as _, moveChoiceToAlternate as v, moveChoiceToCategory as y, removeChoiceFromAlternate as b, removeChoiceFromCategory as x, verifyAllowMultiplePlacements as S } from "@pie-lib/categorize";
16
- import { DragProvider as te, uid as C } from "@pie-lib/drag";
17
- import { jsx as w, jsxs as T } from "react/jsx-runtime";
18
- import E from "@pie-lib/translator";
19
- import { AlertDialog as ne, FeedbackConfig as re, InputContainer as D, layout as ie, settings as O } from "@pie-lib/config-ui";
20
- import k from "@pie-lib/editable-html-tip-tap";
21
- //#region src/author/design/index.tsx
22
- var { translator: ae } = E, { dropdown: A, Panel: oe, toggle: j, radio: M, numberField: N } = O, { Provider: se } = C, ce = class extends d.Component {
23
- containerRef = d.createRef();
24
- componentDidMount() {
25
- this.containerRef.current && setTimeout(() => f(this.containerRef.current), 0);
26
- }
27
- render() {
28
- return /* @__PURE__ */ w("div", {
29
- ref: this.containerRef,
30
- children: this.props.children
31
- });
32
- }
33
- }, P = m(n)(({ theme: e }) => ({ marginBottom: e.spacing(2) })), F = m(D)(({ theme: e }) => ({
34
- width: "100%",
35
- paddingTop: e.spacing(1),
36
- marginTop: e.spacing(1),
37
- marginBottom: e.spacing(2)
38
- })), I = m("div")(({ theme: e }) => ({
39
- fontSize: e.typography.fontSize - 2,
40
- color: e.palette.error.main,
41
- paddingTop: e.spacing(1)
42
- })), L = class extends d.Component {
43
- static propTypes = {
44
- configuration: p.object,
45
- className: p.string,
46
- onConfigurationChanged: p.func,
47
- model: p.object.isRequired,
48
- onChange: p.func.isRequired,
49
- uid: p.string,
50
- imageSupport: p.shape({
51
- add: p.func.isRequired,
52
- delete: p.func.isRequired
53
- }),
54
- uploadSoundSupport: p.shape({
55
- add: p.func.isRequired,
56
- delete: p.func.isRequired
57
- })
58
- };
59
- constructor(e) {
60
- super(e), this.uid = e.uid || C.generateId(), this.state = { activeDragItem: null };
61
- }
62
- updateModel = (e) => {
63
- let { model: t, onChange: n } = this.props, r = {
64
- ...t,
65
- ...e
66
- };
67
- r.choices = r.choices.map((e) => ({
68
- ...e,
69
- categoryCount: this.checkAllowMultiplePlacements(r.allowMultiplePlacementsEnabled, e)
70
- })), r.correctResponse = _(r.correctResponse || [], r.choices), r.correctResponse = g(r.correctResponse || [], r.choices), r.categories = r.categories.map((e) => ({
71
- id: e.id,
72
- label: e.label
73
- })), r.choices = r.choices.map((e) => ({
74
- id: e.id,
75
- content: e.content,
76
- categoryCount: e.categoryCount
77
- })), r.maxChoicesPerCategory = r.allowMaxChoicesPerCategory ? r.maxChoicesPerCategory : 0, n(r);
78
- };
79
- changeRationale = (e) => {
80
- let { model: t, onChange: n } = this.props;
81
- n({
82
- ...t,
83
- rationale: e
84
- });
85
- };
86
- changeTeacherInstructions = (e) => {
87
- let { model: t, onChange: n } = this.props;
88
- n({
89
- ...t,
90
- teacherInstructions: e
91
- });
92
- };
93
- changeFeedback = (e) => {
94
- this.updateModel({ feedback: e });
95
- };
96
- onAddAlternateResponse = () => {
97
- let { model: { correctResponse: e } } = this.props;
98
- this.updateModel({ correctResponse: (e || []).map((e) => ({
99
- ...e,
100
- alternateResponses: [...e.alternateResponses || [], []]
101
- })) });
102
- };
103
- onPromptChanged = (e) => this.updateModel({ prompt: e });
104
- onRemoveAlternateResponse = (e) => {
105
- let { model: { correctResponse: t } } = this.props;
106
- this.updateModel({ correctResponse: (t || []).map((t) => ({
107
- ...t,
108
- alternateResponses: (t.alternateResponses || []).filter((t, n) => n !== e)
109
- })) });
110
- };
111
- countChoiceInCorrectResponse = (e) => {
112
- let { model: t } = this.props;
113
- return h(e.id, t.correctResponse);
114
- };
115
- checkAllowMultiplePlacements = (e, t) => e === i.enabled ? 0 : e === i.disabled ? 1 : t.categoryCount || 0;
116
- isAlertModalOpened = () => {
117
- let { model: e } = this.props, { maxChoicesPerCategory: t = 0 } = e || {}, n = r(e);
118
- return t === 0 ? !1 : n > t;
119
- };
120
- onAlertModalCancel = () => {
121
- let { model: e } = this.props, t = r(e);
122
- this.updateModel({ maxChoicesPerCategory: t });
123
- };
124
- onDragStart = (e) => {
125
- let { active: t } = e, n = t.data.current;
126
- this.setState({ activeDragItem: n });
127
- };
128
- onDragEnd = ({ active: e, over: t }) => {
129
- let n = window.scrollX, r = window.scrollY;
130
- if (this.setState({ activeDragItem: null }), !e) return;
131
- requestAnimationFrame(() => {
132
- requestAnimationFrame(() => {
133
- window.scrollTo(n, r);
134
- });
135
- });
136
- let { model: i } = this.props, { allowAlternateEnabled: a, categories: o = [], choices: s = [] } = i, c = e?.data?.current, l = t?.data?.current;
137
- if (!c) return;
138
- let u = c.choiceIndex || 0, d = l?.type, f = c.type === "choice-preview", p = c.type === "choice", m = c.choice?.id || (typeof c.id == "string" ? c.id.split("-")[0] : c.id);
139
- if (f && (!l || d === "choice")) {
140
- this.removeChoiceFromSource(c, u, {
141
- allowAlternateEnabled: a,
142
- categories: o,
143
- choices: s
144
- });
145
- return;
146
- }
147
- if (f && d === "category") return this.moveChoice(m, c.categoryId, l.id, u);
148
- if (p && d === "category") return this.addChoiceToCategory({ id: c.id }, l.id);
149
- if (f && d === "category-alternate") return this.moveChoiceInAlternate(m, c.categoryId, l.id, u, l.alternateResponseIndex);
150
- if (a && p && d === "category-alternate") return this.addChoiceToAlternateCategory({ id: c.id }, l.id, l.alternateResponseIndex);
151
- };
152
- removeChoiceFromSource = (e, t, { allowAlternateEnabled: n, categories: r, choices: i }) => {
153
- if (e.alternateResponseIndex === void 0) {
154
- this.deleteChoiceFromCategory(e.categoryId, e.choiceId, t);
155
- return;
156
- }
157
- if (!n) return;
158
- let a = r?.find((t) => t.id === e.categoryId), o = i?.find((t) => t.id === e.choiceId);
159
- a && o && this.deleteChoiceFromAlternateCategory(a, o, t, e.alternateResponseIndex);
160
- };
161
- addChoiceToCategory = (e, t) => {
162
- let { model: n } = this.props, { choices: i = [], correctResponse: a = [], maxChoicesPerCategory: o = 0 } = n || {}, s = (i || []).find((t) => t.id === e.id), c = y(e.id, void 0, t, 0, a);
163
- s.categoryCount !== 0 && (c = S(e, t, c));
164
- let l = r(n);
165
- this.updateModel({
166
- correctResponse: c,
167
- maxChoicesPerCategory: o !== 0 && o < l ? o + 1 : o
168
- });
169
- };
170
- deleteChoiceFromCategory = (e, t, n) => {
171
- let { model: r } = this.props, i = x(t, e, n, r.correctResponse);
172
- this.updateModel({ correctResponse: i });
173
- };
174
- moveChoice = (e, t, n, i) => {
175
- let { model: a } = this.props, { choices: o, correctResponse: s = [], maxChoicesPerCategory: c = 0 } = a || {}, l = (o || []).find((t) => t.id === e);
176
- if (n === t || !l) return;
177
- l.categoryCount === 0 ? l.categoryCount === 0 && (s = y(l.id, void 0, n, 0, s)) : (s = y(l.id, t, n, i, s), s = S(l, n, s));
178
- let u = r(a);
179
- this.updateModel({
180
- correctResponse: s,
181
- maxChoicesPerCategory: c !== 0 && c < u ? c + 1 : c
182
- });
183
- };
184
- addChoiceToAlternateCategory = (e, t, n) => {
185
- let { model: i } = this.props, { correctResponse: a, choices: o, maxChoicesPerCategory: s = 0 } = i, c = o.find((t) => t.id === e.id);
186
- a.forEach((r) => r.category === t ? (r.alternateResponses = r.alternateResponses || [], r.alternateResponses[n] === void 0 && (r.alternateResponses[n] = []), r.alternateResponses[n].push(e.id), c.categoryCount && c.categoryCount !== 0 && (r.alternateResponses[n] = r.alternateResponses[n].reduce((e, t) => (t === c.id ? e.findIndex((e) => e === c.id) === -1 && e.push(t) : e.push(t), e), [])), r) : (r.alternateResponses[n] && c.categoryCount !== 0 && (r.alternateResponses[n] = r.alternateResponses[n].filter((t) => t !== e.id)), r));
187
- let l = r(i);
188
- this.updateModel({
189
- correctResponse: a,
190
- maxChoicesPerCategory: s !== 0 && s < l ? s + 1 : s
191
- });
192
- };
193
- moveChoiceInAlternate = (e, t, n, i, a) => {
194
- let { model: o } = this.props, { choices: s, correctResponse: c = [], maxChoicesPerCategory: l = 0 } = o || {}, u = (s || []).find((t) => t.id === e);
195
- c = v(e, t, n, i, c, a, u?.categoryCount);
196
- let d = r(o);
197
- this.updateModel({
198
- correctResponse: c,
199
- maxChoicesPerCategory: l !== 0 && l < d ? l + 1 : l
200
- });
201
- };
202
- deleteChoiceFromAlternateCategory = (e, t, n, r) => {
203
- let { model: i } = this.props, a = b(t.id, e.id, n, r, i.correctResponse);
204
- this.updateModel({ correctResponse: a });
205
- };
206
- renderDragOverlay = () => {
207
- let { activeDragItem: e } = this.state, { model: n, configuration: r } = this.props;
208
- if (!e) return null;
209
- if (e.type === "choice") {
210
- let t = n.choices?.find((t) => t.id === e.id);
211
- return t ? /* @__PURE__ */ w(s, {
212
- choice: t,
213
- configuration: r
214
- }) : null;
215
- } else if (e.type === "choice-preview" && e.alternateResponseIndex === void 0) {
216
- let r = n.choices?.find((t) => t.id === e.id);
217
- return r ? /* @__PURE__ */ w(t, { choice: r }) : null;
218
- } else if (e.type === "choice-preview" && e.alternateResponseIndex !== void 0) {
219
- let r = n.choices?.find((t) => t.id === e.id);
220
- return r ? /* @__PURE__ */ w(t, {
221
- choice: r,
222
- alternateResponseIndex: e.alternateResponseIndex
223
- }) : null;
224
- }
225
- return null;
226
- };
227
- render() {
228
- let { configuration: t, imageSupport: n, model: r, uploadSoundSupport: s, onConfigurationChanged: f } = this.props, { allowAlternate: p = {}, allowMultiplePlacements: m = {}, baseInputConfiguration: h = {}, categoriesPerRow: g = {}, choicesPosition: _ = {}, contentDimensions: v = {}, feedback: y = {}, lockChoiceOrder: b = {}, maxImageHeight: x = {}, maxImageWidth: S = {}, maxPlacements: C = {}, minCategoriesPerRow: E = 1, partialScoring: D = {}, prompt: O = {}, rationale: L = {}, scoringType: R = {}, settingsPanelDisabled: le, spellCheck: z = {}, studentInstructions: B = {}, teacherInstructions: V = {}, withRubric: H = {}, mathMlOptions: U = {}, language: W = {}, languageChoices: G = {}, allowMaxAnswerChoices: K = {} } = t || {}, { allowAlternateEnabled: ue, allowMaxChoicesPerCategory: de, errors: fe, feedbackEnabled: pe, maxChoicesPerCategory: me, promptEnabled: he, rationaleEnabled: ge, spellCheckEnabled: q, teacherInstructionsEnabled: _e, toolbarEditorPosition: ve, extraCSSRules: ye } = r || {}, { prompt: J, rationale: Y, teacherInstructions: X } = fe || {}, Z = { position: ve === "top" ? "top" : "bottom" }, be = r.config || {};
229
- be.choices = be.choices || {
230
- label: "",
231
- columns: 2
232
- };
233
- let xe = u(r.categories || [], r.choices || [], r.correctResponse || []), Se = l(r.categories || [], r.choices || [], r.correctResponse || []), Ce = r.choices.map((e) => (e.correctResponseCount = this.countChoiceInCorrectResponse(e), e.categoryCount = this.checkAllowMultiplePlacements(r.allowMultiplePlacementsEnabled, e), e)), Q = S && S.prompt, $ = x && x.prompt, we = {
234
- partialScoring: D.settings && j(D.label),
235
- lockChoiceOrder: b.settings && j(b.label),
236
- categoriesPerRow: g.settings && N(g.label, {
237
- label: g.label,
238
- min: E,
239
- max: 6
240
- }),
241
- choicesPosition: _.settings && M(_.label, [
242
- "below",
243
- "above",
244
- "left",
245
- "right"
246
- ]),
247
- allowMultiplePlacementsEnabled: m.settings && A(m.label, [
248
- i.enabled,
249
- i.disabled,
250
- i.perChoice
251
- ]),
252
- maxAnswerChoices: K.settings && N(K.label, {
253
- label: "",
254
- min: Ce?.length || 0,
255
- max: 30
256
- }),
257
- allowMaxChoicesPerCategory: C.settings && j(C.label),
258
- maxChoicesPerCategory: de === !0 && N(C.label, {
259
- label: "",
260
- min: 0,
261
- max: 30
262
- }),
263
- promptEnabled: O.settings && j(O.label),
264
- feedbackEnabled: y.settings && j(y.label),
265
- allowAlternateEnabled: p.settings && j(p.label),
266
- "language.enabled": W.settings && j(W.label, !0),
267
- language: W.settings && W.enabled && A(G.label, G.options)
268
- }, Te = {
269
- teacherInstructionsEnabled: V.settings && j(V.label),
270
- studentInstructionsEnabled: B.settings && j(B.label),
271
- rationaleEnabled: L.settings && j(L.label),
272
- spellCheckEnabled: z.settings && j(z.label),
273
- scoringType: R.settings && M(R.label, ["auto", "rubric"]),
274
- rubricEnabled: H?.settings && j(H?.label)
275
- }, Ee = this.isAlertModalOpened(), De = ae.t("translation:categorize:maxChoicesPerCategoryRestriction", {
276
- lng: r.language,
277
- maxChoicesPerCategory: me
278
- });
279
- return /* @__PURE__ */ w(te, {
280
- onDragStart: this.onDragStart,
281
- onDragEnd: this.onDragEnd,
282
- children: /* @__PURE__ */ T(se, {
283
- value: this.uid,
284
- children: [/* @__PURE__ */ T(ie.ConfigLayout, {
285
- extraCSSRules: ye,
286
- dimensions: v,
287
- hideSettings: le,
288
- settings: /* @__PURE__ */ w(oe, {
289
- model: r,
290
- onChangeModel: this.updateModel,
291
- configuration: t,
292
- onChangeConfiguration: f,
293
- groups: {
294
- Settings: we,
295
- Properties: Te
296
- },
297
- modal: /* @__PURE__ */ w(ne, {
298
- title: "Warning",
299
- text: De,
300
- open: Ee,
301
- onClose: this.onAlertModalCancel
302
- })
303
- }),
304
- children: [
305
- _e && /* @__PURE__ */ T(F, {
306
- label: V.label,
307
- children: [/* @__PURE__ */ w(k, {
308
- markup: r.teacherInstructions || "",
309
- onChange: this.changeTeacherInstructions,
310
- imageSupport: n,
311
- error: X,
312
- nonEmpty: !1,
313
- toolbarOpts: Z,
314
- pluginProps: e(V?.inputConfiguration, h),
315
- spellCheck: q,
316
- maxImageWidth: S && S.teacherInstructions || Q,
317
- maxImageHeight: x && x.teacherInstructions || $,
318
- uploadSoundSupport: s,
319
- languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
320
- mathMlOptions: U
321
- }), X && /* @__PURE__ */ w(I, { children: X })]
322
- }),
323
- he && /* @__PURE__ */ T(F, {
324
- label: O.label,
325
- children: [/* @__PURE__ */ w(k, {
326
- markup: r.prompt || "",
327
- onChange: this.onPromptChanged,
328
- imageSupport: n,
329
- error: J,
330
- nonEmpty: !1,
331
- disableUnderline: !0,
332
- toolbarOpts: Z,
333
- pluginProps: e(O?.inputConfiguration, h),
334
- spellCheck: q,
335
- maxImageWidth: S && S.prompt,
336
- maxImageHeight: x && x.prompt,
337
- uploadSoundSupport: s,
338
- languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
339
- mathMlOptions: U
340
- }), J && /* @__PURE__ */ w(I, { children: J })]
341
- }),
342
- /* @__PURE__ */ w(a, {
343
- imageSupport: n,
344
- uploadSoundSupport: s,
345
- model: r,
346
- categories: xe || [],
347
- onModelChanged: this.updateModel,
348
- toolbarOpts: Z,
349
- spellCheck: q,
350
- configuration: t,
351
- defaultImageMaxWidth: Q,
352
- defaultImageMaxHeight: $,
353
- mathMlOptions: U
354
- }),
355
- /* @__PURE__ */ w(c, {
356
- imageSupport: n,
357
- uploadSoundSupport: s,
358
- choices: Ce,
359
- model: r,
360
- onModelChanged: this.updateModel,
361
- toolbarOpts: Z,
362
- spellCheck: q,
363
- configuration: t,
364
- defaultImageMaxWidth: Q,
365
- defaultImageMaxHeight: $
366
- }),
367
- ue && /* @__PURE__ */ w(P, {
368
- label: "Alternate Responses",
369
- buttonLabel: "ADD AN ALTERNATE RESPONSE",
370
- onAdd: this.onAddAlternateResponse
371
- }),
372
- ue && Se.map((e, i) => /* @__PURE__ */ T(d.Fragment, { children: [/* @__PURE__ */ w(P, {
373
- variant: "subtitle1",
374
- label: "Alternate Response",
375
- buttonLabel: "REMOVE ALTERNATE RESPONSE",
376
- onAdd: () => this.onRemoveAlternateResponse(i)
377
- }), /* @__PURE__ */ w(o, {
378
- altIndex: i,
379
- imageSupport: n,
380
- model: r,
381
- configuration: t,
382
- categories: e,
383
- onModelChanged: this.updateModel,
384
- uploadSoundSupport: s,
385
- mathMlOptions: U
386
- })] }, i)),
387
- ge && /* @__PURE__ */ T(F, {
388
- label: L.label,
389
- children: [/* @__PURE__ */ w(k, {
390
- markup: r.rationale || "",
391
- onChange: this.changeRationale,
392
- imageSupport: n,
393
- error: Y,
394
- nonEmpty: !1,
395
- toolbarOpts: Z,
396
- pluginProps: e(O?.inputConfiguration, h),
397
- spellCheck: q,
398
- maxImageWidth: S && S.rationale || Q,
399
- maxImageHeight: x && x.rationale || $,
400
- uploadSoundSupport: s,
401
- languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
402
- mathMlOptions: U
403
- }), Y && /* @__PURE__ */ w(I, { children: Y })]
404
- }),
405
- pe && /* @__PURE__ */ w(re, {
406
- feedback: r.feedback,
407
- onChange: this.changeFeedback,
408
- toolbarOpts: Z
409
- })
410
- ]
411
- }), /* @__PURE__ */ w(ee, { children: /* @__PURE__ */ w(ce, { children: this.renderDragOverlay() }) })]
412
- })
413
- });
414
- }
415
- };
416
- //#endregion
417
- export { L as default };
@@ -1,39 +0,0 @@
1
- /**
2
- * @synced-from pie-elements/packages/categorize/configure/src/design/input-header.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 InputHeader extends React.Component {
12
- static propTypes: {
13
- configuration: PropTypes.Validator<object>;
14
- deleteFocusedEl: PropTypes.Requireable<(...args: any[]) => any>;
15
- disabled: PropTypes.Requireable<boolean>;
16
- focusedEl: PropTypes.Requireable<number>;
17
- index: PropTypes.Requireable<number>;
18
- label: PropTypes.Requireable<string>;
19
- maxImageWidth: PropTypes.Requireable<object>;
20
- maxImageHeight: PropTypes.Requireable<object>;
21
- onChange: PropTypes.Requireable<(...args: any[]) => any>;
22
- onDelete: PropTypes.Requireable<(...args: any[]) => any>;
23
- imageSupport: PropTypes.Requireable<PropTypes.InferProps<{
24
- add: PropTypes.Validator<(...args: any[]) => any>;
25
- delete: PropTypes.Validator<(...args: any[]) => any>;
26
- }>>;
27
- uploadSoundSupport: PropTypes.Requireable<PropTypes.InferProps<{
28
- add: PropTypes.Validator<(...args: any[]) => any>;
29
- delete: PropTypes.Validator<(...args: any[]) => any>;
30
- }>>;
31
- toolbarOpts: PropTypes.Requireable<object>;
32
- error: PropTypes.Requireable<string>;
33
- spellCheck: PropTypes.Requireable<boolean>;
34
- };
35
- static defaultProps: {};
36
- constructor(props: any);
37
- render(): React.JSX.Element;
38
- }
39
- export default InputHeader;
@@ -1,69 +0,0 @@
1
- import { getPluginProps as e } from "./utils.js";
2
- import t from "react";
3
- import n from "prop-types";
4
- import { styled as r } from "@mui/material/styles";
5
- import { jsx as i } from "react/jsx-runtime";
6
- import a from "@pie-lib/editable-html-tip-tap";
7
- //#region src/author/design/input-header.tsx
8
- var o = r(a)({
9
- flex: "1",
10
- maxWidth: "100%"
11
- }), s = r("div")(({ theme: e }) => ({
12
- display: "flex",
13
- justifyContent: "space-between",
14
- paddingBottom: e.spacing(1)
15
- })), c = class extends t.Component {
16
- static propTypes = {
17
- configuration: n.object.isRequired,
18
- deleteFocusedEl: n.func,
19
- disabled: n.bool,
20
- focusedEl: n.number,
21
- index: n.number,
22
- label: n.string,
23
- maxImageWidth: n.object,
24
- maxImageHeight: n.object,
25
- onChange: n.func,
26
- onDelete: n.func,
27
- imageSupport: n.shape({
28
- add: n.func.isRequired,
29
- delete: n.func.isRequired
30
- }),
31
- uploadSoundSupport: n.shape({
32
- add: n.func.isRequired,
33
- delete: n.func.isRequired
34
- }),
35
- toolbarOpts: n.object,
36
- error: n.string,
37
- spellCheck: n.bool
38
- };
39
- static defaultProps = {};
40
- constructor(e) {
41
- super(e);
42
- }
43
- render() {
44
- let { onChange: t, configuration: n, label: r, deleteFocusedEl: a, disabled: c, imageSupport: l, toolbarOpts: u, spellCheck: d, error: f, maxImageWidth: p, maxImageHeight: m, uploadSoundSupport: h, mathMlOptions: g = {}, focusedEl: _, index: v } = this.props, { headers: y, baseInputConfiguration: b } = n;
45
- return /* @__PURE__ */ i(s, { children: /* @__PURE__ */ i(o, {
46
- imageSupport: l,
47
- disabled: c,
48
- autoFocus: _ != null && _ === v,
49
- autoWidthToolbar: !0,
50
- label: "label",
51
- markup: r,
52
- onChange: t,
53
- pluginProps: e(y?.inputConfiguration, b),
54
- toolbarOpts: u,
55
- spellCheck: d,
56
- error: f,
57
- maxImageWidth: p,
58
- maxImageHeight: m,
59
- uploadSoundSupport: h,
60
- languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
61
- onDone: () => {
62
- a && a();
63
- },
64
- mathMlOptions: g
65
- }) });
66
- }
67
- };
68
- //#endregion
69
- export { c as default };
@@ -1,9 +0,0 @@
1
- /**
2
- * @synced-from pie-elements/packages/categorize/configure/src/design/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 getPluginProps: (props?: {}, baseInputConfiguration?: {}) => {};
@@ -1,7 +0,0 @@
1
- //#region src/author/design/utils.ts
2
- var e = (e = {}, t = {}) => ({
3
- ...t,
4
- ...e
5
- });
6
- //#endregion
7
- export { e as getPluginProps };
@@ -1,51 +0,0 @@
1
- /**
2
- * @synced-from pie-elements/packages/categorize/configure/src/index.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 default class CategorizeConfigure extends HTMLElement {
10
- static createDefaultModel: (model?: {}) => {
11
- allowAlternateEnabled: boolean;
12
- allowMaxChoicesPerCategory: boolean;
13
- allowMultiplePlacementsEnabled: string;
14
- alternates: never[];
15
- categories: never[];
16
- categoriesPerRow: number;
17
- choices: never[];
18
- choicesLabel: string;
19
- choicesPosition: string;
20
- correctResponse: never[];
21
- feedbackEnabled: boolean;
22
- lockChoiceOrder: boolean;
23
- maxAnswerChoices: number;
24
- maxChoicesPerCategory: number;
25
- partialScoring: boolean;
26
- promptEnabled: boolean;
27
- rationaleEnabled: boolean;
28
- rowLabels: string[];
29
- studentInstructionsEnabled: boolean;
30
- teacherInstructionsEnabled: boolean;
31
- toolbarEditorPosition: string;
32
- minRowHeight: string;
33
- };
34
- static disableAlternateResponses: (m: any) => any;
35
- constructor();
36
- set model(m: any);
37
- set configuration(c: any);
38
- onModelChanged(m: any): void;
39
- onConfigurationChanged(c: any): void;
40
- connectedCallback(): void;
41
- /**
42
- *
43
- * @param {done, progress, file} handler
44
- */
45
- insertImage(handler: any): void;
46
- onDeleteImage(src: any, done: any): void;
47
- insertSound(handler: any): void;
48
- onDeleteSound(src: any, done: any): void;
49
- render(): void;
50
- disconnectedCallback(): void;
51
- }
@@ -1,87 +0,0 @@
1
- import e from "./main.js";
2
- import t from "./defaults.js";
3
- import n from "react";
4
- import { createRoot as r } from "react-dom/client";
5
- import { renderMath as i } from "@pie-element/shared-math-rendering-mathjax";
6
- import { DeleteImageEvent as a, DeleteSoundEvent as o, InsertImageEvent as s, InsertSoundEvent as c, ModelUpdatedEvent as l } from "@pie-element/shared-configure-events";
7
- //#region src/author/index.ts
8
- var u = class u extends HTMLElement {
9
- static createDefaultModel = (e = {}) => ({
10
- ...t.model,
11
- ...e
12
- });
13
- static disableAlternateResponses = (e) => {
14
- let { correctResponse: t } = e || {};
15
- t ||= [];
16
- let n = t.map((e) => {
17
- let { alternateResponses: t, ...n } = e;
18
- return n;
19
- });
20
- return {
21
- ...e,
22
- correctResponse: n,
23
- allowAlternateEnabled: !1
24
- };
25
- };
26
- constructor() {
27
- super(), this._root = null, this._model = u.createDefaultModel(), this._configuration = t.configuration;
28
- }
29
- set model(e) {
30
- this._model = u.createDefaultModel(e), e.choices && e.choices.length >= e.maxAnswerChoices && (this._model.maxAnswerChoices = e.choices.length, console.warn("Max Answer Choices can't be less than choices length!")), this.render();
31
- }
32
- set configuration(e) {
33
- let n = {
34
- ...t.configuration,
35
- ...e
36
- };
37
- this._configuration = n, n?.language?.enabled ? n?.languageChoices?.options?.length && (this._model.language = n?.languageChoices.options[0].value) : n.language.settings && this._model.language ? (this._configuration.language.enabled = !0, (!this._configuration.languageChoices.options || !this._configuration.languageChoices.options.length) && (this._configuration.languageChoices.options = []), this._configuration.languageChoices.options.find((e) => e.value === this._model.language) || this._configuration.languageChoices.options.push({
38
- value: this._model.language,
39
- label: this._model.language
40
- })) : delete this._model.language, this.render();
41
- }
42
- onModelChanged(e) {
43
- this._model = e, this.render(), this.dispatchEvent(new l(this._model, !1));
44
- }
45
- onConfigurationChanged(e) {
46
- this._configuration = e, this.render();
47
- }
48
- connectedCallback() {
49
- this.render();
50
- }
51
- insertImage(e) {
52
- this.dispatchEvent(new s(e));
53
- }
54
- onDeleteImage(e, t) {
55
- this.dispatchEvent(new a(e, t));
56
- }
57
- insertSound(e) {
58
- this.dispatchEvent(new c(e));
59
- }
60
- onDeleteSound(e, t) {
61
- this.dispatchEvent(new o(e, t));
62
- }
63
- render() {
64
- let t = n.createElement(e, {
65
- model: this._model,
66
- configuration: this._configuration,
67
- onModelChanged: this.onModelChanged.bind(this),
68
- onConfigurationChanged: this.onConfigurationChanged.bind(this),
69
- imageSupport: {
70
- add: this.insertImage.bind(this),
71
- delete: this.onDeleteImage.bind(this)
72
- },
73
- uploadSoundSupport: {
74
- add: this.insertSound.bind(this),
75
- delete: this.onDeleteSound.bind(this)
76
- }
77
- });
78
- this._root ||= r(this), this._root.render(t), setTimeout(() => {
79
- i(this);
80
- }, 0);
81
- }
82
- disconnectedCallback() {
83
- this._root && this._root.unmount();
84
- }
85
- };
86
- //#endregion
87
- export { u as default };