@pie-element/placement-ordering 12.3.4-next.3 → 13.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +0 -11
- package/configure/CHANGELOG.md +0 -11
- package/configure/lib/choice-editor.js +189 -414
- package/configure/lib/choice-editor.js.map +1 -1
- package/configure/lib/choice-tile.js +172 -263
- package/configure/lib/choice-tile.js.map +1 -1
- package/configure/lib/defaults.js +2 -4
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/design.js +389 -455
- package/configure/lib/design.js.map +1 -1
- package/configure/lib/help.js +5 -13
- package/configure/lib/help.js.map +1 -1
- package/configure/lib/index.js +118 -193
- package/configure/lib/index.js.map +1 -1
- package/configure/lib/utils.js +99 -4
- package/configure/lib/utils.js.map +1 -1
- package/configure/package.json +12 -10
- package/controller/CHANGELOG.md +0 -11
- package/controller/lib/defaults.js +2 -3
- package/controller/lib/defaults.js.map +1 -1
- package/controller/lib/index.js +133 -218
- package/controller/lib/index.js.map +1 -1
- package/controller/lib/scoring.js +35 -78
- package/controller/lib/scoring.js.map +1 -1
- package/controller/package.json +4 -4
- package/lib/index.js +63 -127
- package/lib/index.js.map +1 -1
- package/lib/main.js +20 -57
- package/lib/main.js.map +1 -1
- package/lib/ordering.js +52 -98
- package/lib/ordering.js.map +1 -1
- package/lib/placement-ordering.js +331 -381
- package/lib/placement-ordering.js.map +1 -1
- package/lib/tile.js +193 -267
- package/lib/tile.js.map +1 -1
- package/lib/tiler.js +126 -204
- package/lib/tiler.js.map +1 -1
- package/lib/utils.js +6 -18
- package/lib/utils.js.map +1 -1
- package/package.json +14 -11
- package/esm/configure.js +0 -25814
- package/esm/configure.js.map +0 -1
- package/esm/controller.js +0 -21221
- package/esm/controller.js.map +0 -1
- package/esm/element.js +0 -17874
- package/esm/element.js.map +0 -1
- package/esm/package.json +0 -3
package/configure/lib/design.js
CHANGED
|
@@ -1,494 +1,428 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
|
-
exports
|
|
9
|
-
|
|
7
|
+
exports.default = exports.Design = void 0;
|
|
10
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
-
|
|
12
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
|
-
|
|
14
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
15
|
-
|
|
16
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
17
|
-
|
|
18
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
19
|
-
|
|
20
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
21
|
-
|
|
22
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
23
|
-
|
|
24
|
-
var
|
|
25
|
-
|
|
26
|
-
var _editableHtml = _interopRequireDefault(require("@pie-lib/editable-html"));
|
|
27
|
-
|
|
28
|
-
var _styles = require("@material-ui/core/styles");
|
|
29
|
-
|
|
30
|
-
var _drag = require("@pie-lib/drag");
|
|
31
|
-
|
|
32
|
-
var _Info = _interopRequireDefault(require("@material-ui/icons/Info"));
|
|
33
|
-
|
|
34
|
-
var _Tooltip = _interopRequireDefault(require("@material-ui/core/Tooltip"));
|
|
35
|
-
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
36
12
|
var _debug = _interopRequireDefault(require("debug"));
|
|
37
|
-
|
|
38
13
|
var _cloneDeep = _interopRequireDefault(require("lodash/cloneDeep"));
|
|
39
|
-
|
|
40
14
|
var _nestedProperty = require("nested-property");
|
|
41
|
-
|
|
42
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
43
|
-
|
|
44
|
-
var _react = _interopRequireDefault(require("react"));
|
|
45
|
-
|
|
46
15
|
var _pluralize = _interopRequireDefault(require("pluralize"));
|
|
47
|
-
|
|
16
|
+
var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
|
|
17
|
+
var _styles = require("@mui/material/styles");
|
|
18
|
+
var _Info = _interopRequireDefault(require("@mui/icons-material/Info"));
|
|
19
|
+
var _Tooltip = _interopRequireDefault(require("@mui/material/Tooltip"));
|
|
20
|
+
var _configUi = require("@pie-lib/config-ui");
|
|
21
|
+
var _editableHtmlTipTap = _interopRequireDefault(require("@pie-lib/editable-html-tip-tap"));
|
|
22
|
+
var _drag = require("@pie-lib/drag");
|
|
48
23
|
var _choiceEditor = _interopRequireDefault(require("./choice-editor"));
|
|
49
|
-
|
|
50
24
|
var _utils = require("./utils");
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
dropdown = _configUi.settings.dropdown;
|
|
65
|
-
|
|
66
|
-
var getSingularAndPlural = function getSingularAndPlural(label) {
|
|
67
|
-
return !_pluralize["default"].isPlural(label) ? {
|
|
68
|
-
singularLabel: label,
|
|
69
|
-
pluralLabel: (0, _pluralize["default"])(label)
|
|
70
|
-
} : {
|
|
71
|
-
singularLabel: _pluralize["default"].singular(label),
|
|
72
|
-
pluralLabel: label
|
|
73
|
-
};
|
|
25
|
+
const log = (0, _debug.default)('@pie-element:placement-ordering:design');
|
|
26
|
+
const {
|
|
27
|
+
Panel,
|
|
28
|
+
toggle,
|
|
29
|
+
radio,
|
|
30
|
+
dropdown
|
|
31
|
+
} = _configUi.settings;
|
|
32
|
+
const getSingularAndPlural = label => !_pluralize.default.isPlural(label) ? {
|
|
33
|
+
singularLabel: label,
|
|
34
|
+
pluralLabel: (0, _pluralize.default)(label)
|
|
35
|
+
} : {
|
|
36
|
+
singularLabel: _pluralize.default.singular(label),
|
|
37
|
+
pluralLabel: label
|
|
74
38
|
};
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
39
|
+
const StyledInputContainer = (0, _styles.styled)(_configUi.InputContainer)(({
|
|
40
|
+
theme
|
|
41
|
+
}) => ({
|
|
42
|
+
width: '100%',
|
|
43
|
+
paddingTop: theme.spacing(2),
|
|
44
|
+
marginBottom: theme.spacing(2)
|
|
45
|
+
}));
|
|
46
|
+
const StyledRow = (0, _styles.styled)('div')({
|
|
47
|
+
display: 'grid',
|
|
48
|
+
gridAutoFlow: 'column',
|
|
49
|
+
gridAutoColumns: '1fr',
|
|
50
|
+
gridGap: '8px'
|
|
51
|
+
});
|
|
52
|
+
const StyledChoicesWrapper = (0, _styles.styled)(_configUi.FormSection)(({
|
|
53
|
+
theme
|
|
54
|
+
}) => ({
|
|
55
|
+
marginTop: 0,
|
|
56
|
+
marginBottom: theme.spacing(2.5)
|
|
57
|
+
}));
|
|
58
|
+
const InlineFlexContainer = (0, _styles.styled)('div')({
|
|
59
|
+
display: 'inline-flex',
|
|
60
|
+
position: 'absolute'
|
|
61
|
+
});
|
|
62
|
+
const ErrorText = (0, _styles.styled)('div')(({
|
|
63
|
+
theme
|
|
64
|
+
}) => ({
|
|
65
|
+
fontSize: theme.typography.fontSize - 2,
|
|
66
|
+
color: theme.palette.error.main,
|
|
67
|
+
paddingTop: theme.spacing(1)
|
|
68
|
+
}));
|
|
69
|
+
class Design extends _react.default.Component {
|
|
70
|
+
constructor(props) {
|
|
71
|
+
super(props);
|
|
72
|
+
(0, _defineProperty2.default)(this, "onDragEnd", (event, ordering) => {
|
|
73
|
+
const {
|
|
74
|
+
active,
|
|
75
|
+
over
|
|
76
|
+
} = event;
|
|
77
|
+
if (!over || !active) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const target = over.data.current;
|
|
81
|
+
const source = active.data.current;
|
|
82
|
+
const rawFrom = ordering.tiles.find(t => t.id === source.id && t.type === source.type);
|
|
83
|
+
const rawTo = target;
|
|
84
|
+
const from = {
|
|
85
|
+
...rawFrom,
|
|
86
|
+
index: (0, _utils.normalizeIndex)(rawFrom, ordering)
|
|
87
|
+
};
|
|
88
|
+
const to = {
|
|
89
|
+
...rawTo,
|
|
90
|
+
index: (0, _utils.normalizeIndex)(rawTo, ordering)
|
|
91
|
+
};
|
|
92
|
+
const {
|
|
93
|
+
response,
|
|
94
|
+
choices: updatedChoices
|
|
95
|
+
} = (0, _utils.updateResponseOrChoices)(ordering.response, ordering.choices, from, to);
|
|
96
|
+
this.onChoiceEditorChange(updatedChoices, response);
|
|
97
|
+
});
|
|
98
|
+
this.applyUpdate = modelFn => {
|
|
99
|
+
const {
|
|
100
|
+
model,
|
|
101
|
+
onModelChanged
|
|
102
|
+
} = this.props;
|
|
103
|
+
const update = modelFn((0, _cloneDeep.default)(model));
|
|
92
104
|
onModelChanged(update);
|
|
93
105
|
};
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
return function (value) {
|
|
106
|
+
this.changeHandler = (modelPath, valuePath) => {
|
|
107
|
+
return value => {
|
|
97
108
|
log('[changeHandler] value: ', value);
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
_this.applyUpdate(function (model) {
|
|
109
|
+
const v = valuePath ? (0, _nestedProperty.get)(value, valuePath) : value;
|
|
110
|
+
this.applyUpdate(model => {
|
|
101
111
|
(0, _nestedProperty.set)(model, modelPath, v);
|
|
102
112
|
return model;
|
|
103
113
|
});
|
|
104
114
|
};
|
|
105
115
|
};
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
var update = (0, _cloneDeep["default"])(model);
|
|
116
|
+
this.onPromptChange = this.changeHandler('prompt');
|
|
117
|
+
this.onTeacherInstructionsChange = this.changeHandler('teacherInstructions');
|
|
118
|
+
this.onRationaleChange = this.changeHandler('rationale');
|
|
119
|
+
this.onChoiceAreaLabelChange = this.changeHandler('choiceLabel', 'target.value');
|
|
120
|
+
this.onAnswerAreaLabelChange = this.changeHandler('targetLabel', 'target.value');
|
|
121
|
+
this.onFeedbackChange = this.changeHandler('feedback');
|
|
122
|
+
this.onChoiceEditorChange = (choices, correctResponse) => {
|
|
123
|
+
const {
|
|
124
|
+
model,
|
|
125
|
+
onModelChanged
|
|
126
|
+
} = this.props;
|
|
127
|
+
const update = (0, _cloneDeep.default)(model);
|
|
119
128
|
update.choices = choices;
|
|
120
129
|
update.correctResponse = correctResponse;
|
|
121
130
|
onModelChanged(update);
|
|
122
131
|
};
|
|
123
|
-
|
|
124
|
-
return _this;
|
|
125
132
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
update.feedbackEnabled = false;
|
|
141
|
-
onModelChanged(update);
|
|
142
|
-
}
|
|
133
|
+
componentDidMount() {
|
|
134
|
+
const {
|
|
135
|
+
model,
|
|
136
|
+
onModelChanged
|
|
137
|
+
} = this.props || {};
|
|
138
|
+
const {
|
|
139
|
+
feedback
|
|
140
|
+
} = model || {};
|
|
141
|
+
const update = (0, _cloneDeep.default)(model);
|
|
142
|
+
|
|
143
|
+
// requirement made in PD-2182
|
|
144
|
+
if (!feedback) {
|
|
145
|
+
update.feedbackEnabled = false;
|
|
146
|
+
onModelChanged(update);
|
|
143
147
|
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),
|
|
253
|
-
scoringType: scoringType.settings && radio(scoringType.label, ['auto', 'rubric']),
|
|
254
|
-
rubricEnabled: (withRubric === null || withRubric === void 0 ? void 0 : withRubric.settings) && toggle(withRubric === null || withRubric === void 0 ? void 0 : withRubric.label)
|
|
255
|
-
};
|
|
256
|
-
|
|
257
|
-
var getPluginProps = function getPluginProps() {
|
|
258
|
-
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
259
|
-
return _objectSpread(_objectSpread({}, baseInputConfiguration), props);
|
|
260
|
-
};
|
|
261
|
-
|
|
262
|
-
return /*#__PURE__*/_react["default"].createElement(_configUi.layout.ConfigLayout, {
|
|
263
|
-
extraCSSRules: extraCSSRules,
|
|
264
|
-
dimensions: contentDimensions,
|
|
265
|
-
hideSettings: settingsPanelDisabled,
|
|
266
|
-
settings: /*#__PURE__*/_react["default"].createElement(Panel, {
|
|
267
|
-
model: model,
|
|
268
|
-
configuration: configuration,
|
|
269
|
-
onChangeModel: function onChangeModel(model) {
|
|
270
|
-
return onModelChanged(model);
|
|
271
|
-
},
|
|
272
|
-
onChangeConfiguration: function onChangeConfiguration(configuration) {
|
|
273
|
-
return onConfigurationChanged(configuration, true);
|
|
274
|
-
},
|
|
275
|
-
groups: {
|
|
276
|
-
Settings: panelSettings,
|
|
277
|
-
Properties: panelProperties
|
|
278
|
-
}
|
|
279
|
-
})
|
|
280
|
-
}, teacherInstructionsEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
|
|
281
|
-
label: teacherInstructions.label,
|
|
282
|
-
className: classes.promptHolder
|
|
283
|
-
}, /*#__PURE__*/_react["default"].createElement(_editableHtml["default"], {
|
|
284
|
-
className: classes.prompt,
|
|
285
|
-
markup: model.teacherInstructions || '',
|
|
286
|
-
onChange: this.onTeacherInstructionsChange,
|
|
287
|
-
imageSupport: imageSupport,
|
|
288
|
-
nonEmpty: false,
|
|
289
|
-
error: teacherInstructionsError,
|
|
290
|
-
toolbarOpts: toolbarOpts,
|
|
291
|
-
pluginProps: getPluginProps(teacherInstructions === null || teacherInstructions === void 0 ? void 0 : teacherInstructions.inputConfiguration),
|
|
292
|
-
spellCheck: spellCheckEnabled,
|
|
293
|
-
maxImageWidth: maxImageWidth && maxImageWidth.teacherInstructions || defaultImageMaxWidth,
|
|
294
|
-
maxImageHeight: maxImageHeight && maxImageHeight.teacherInstructions || defaultImageMaxHeight,
|
|
295
|
-
uploadSoundSupport: uploadSoundSupport,
|
|
296
|
-
languageCharactersProps: [{
|
|
297
|
-
language: 'spanish'
|
|
298
|
-
}, {
|
|
299
|
-
language: 'special'
|
|
300
|
-
}],
|
|
301
|
-
mathMlOptions: mathMlOptions
|
|
302
|
-
}), teacherInstructionsError && /*#__PURE__*/_react["default"].createElement("div", {
|
|
303
|
-
className: classes.errorText
|
|
304
|
-
}, teacherInstructionsError)), promptEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
|
|
305
|
-
label: prompt && prompt.label,
|
|
306
|
-
className: classes.promptHolder
|
|
307
|
-
}, /*#__PURE__*/_react["default"].createElement(_editableHtml["default"], {
|
|
308
|
-
className: classes.prompt,
|
|
309
|
-
markup: model.prompt,
|
|
310
|
-
onChange: this.onPromptChange,
|
|
311
|
-
imageSupport: imageSupport,
|
|
312
|
-
error: promptError,
|
|
313
|
-
toolbarOpts: toolbarOpts,
|
|
314
|
-
pluginProps: getPluginProps(prompt === null || prompt === void 0 ? void 0 : prompt.inputConfiguration),
|
|
315
|
-
spellCheck: spellCheckEnabled,
|
|
316
|
-
maxImageWidth: maxImageWidth && maxImageWidth.prompt,
|
|
317
|
-
maxImageHeight: maxImageHeight && maxImageHeight.prompt,
|
|
318
|
-
uploadSoundSupport: uploadSoundSupport,
|
|
319
|
-
languageCharactersProps: [{
|
|
320
|
-
language: 'spanish'
|
|
321
|
-
}, {
|
|
322
|
-
language: 'special'
|
|
323
|
-
}],
|
|
324
|
-
mathMlOptions: mathMlOptions
|
|
325
|
-
}), promptError && /*#__PURE__*/_react["default"].createElement("div", {
|
|
326
|
-
className: classes.errorText
|
|
327
|
-
}, promptError)), /*#__PURE__*/_react["default"].createElement(_configUi.FormSection, {
|
|
328
|
-
className: classes.choicesWrapper,
|
|
329
|
-
label: "Define ".concat(pluralLabel),
|
|
330
|
-
labelExtraStyle: {
|
|
331
|
-
display: 'inline-flex'
|
|
148
|
+
}
|
|
149
|
+
render() {
|
|
150
|
+
const {
|
|
151
|
+
model,
|
|
152
|
+
imageSupport,
|
|
153
|
+
uploadSoundSupport,
|
|
154
|
+
onModelChanged,
|
|
155
|
+
configuration,
|
|
156
|
+
onConfigurationChanged
|
|
157
|
+
} = this.props;
|
|
158
|
+
const {
|
|
159
|
+
baseInputConfiguration = {},
|
|
160
|
+
choiceLabel = {},
|
|
161
|
+
choices = {},
|
|
162
|
+
contentDimensions = {},
|
|
163
|
+
feedback = {},
|
|
164
|
+
prompt = {},
|
|
165
|
+
placementArea = {},
|
|
166
|
+
maxImageWidth = {},
|
|
167
|
+
maxImageHeight = {},
|
|
168
|
+
numberedGuides = {},
|
|
169
|
+
orientation = {},
|
|
170
|
+
partialScoring = {},
|
|
171
|
+
rationale = {},
|
|
172
|
+
removeTilesAfterPlacing = {},
|
|
173
|
+
settingsPanelDisabled,
|
|
174
|
+
studentInstructions = {},
|
|
175
|
+
spellCheck = {},
|
|
176
|
+
scoringType = {},
|
|
177
|
+
targetLabel = {},
|
|
178
|
+
teacherInstructions = {},
|
|
179
|
+
withRubric = {},
|
|
180
|
+
mathMlOptions = {},
|
|
181
|
+
language = {},
|
|
182
|
+
languageChoices = {}
|
|
183
|
+
} = configuration || {};
|
|
184
|
+
const {
|
|
185
|
+
choiceLabelEnabled,
|
|
186
|
+
errors,
|
|
187
|
+
extraCSSRules,
|
|
188
|
+
feedbackEnabled,
|
|
189
|
+
promptEnabled,
|
|
190
|
+
rationaleEnabled,
|
|
191
|
+
spellCheckEnabled,
|
|
192
|
+
teacherInstructionsEnabled,
|
|
193
|
+
toolbarEditorPosition,
|
|
194
|
+
correctResponse
|
|
195
|
+
} = model || {};
|
|
196
|
+
const {
|
|
197
|
+
prompt: promptError,
|
|
198
|
+
rationale: rationaleError,
|
|
199
|
+
teacherInstructions: teacherInstructionsError
|
|
200
|
+
} = errors || {};
|
|
201
|
+
const ordering = {
|
|
202
|
+
choices: model.choices,
|
|
203
|
+
response: !correctResponse || (0, _isEmpty.default)(correctResponse) ? new Array(model.choices.length) : correctResponse,
|
|
204
|
+
tiles: (0, _utils.buildTiles)(model.choices, correctResponse)
|
|
205
|
+
};
|
|
206
|
+
const validationMessage = (0, _utils.generateValidationMessage)();
|
|
207
|
+
const {
|
|
208
|
+
singularLabel = '',
|
|
209
|
+
pluralLabel = ''
|
|
210
|
+
} = choices?.label && getSingularAndPlural(choices.label) || {};
|
|
211
|
+
const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;
|
|
212
|
+
const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;
|
|
213
|
+
const maxChoicesImageWidth = maxImageWidth && model.placementArea ? maxImageWidth.choicesWithPlacementArea : maxImageWidth.choicesWithoutPlacementArea || defaultImageMaxWidth;
|
|
214
|
+
const maxChoicesImageHeight = maxImageHeight && maxImageHeight.choices || defaultImageMaxHeight;
|
|
215
|
+
const toolbarOpts = {
|
|
216
|
+
position: toolbarEditorPosition === 'top' ? 'top' : 'bottom'
|
|
217
|
+
};
|
|
218
|
+
const panelSettings = {
|
|
219
|
+
choiceLabelEnabled: choiceLabel.settings && toggle(choiceLabel.label),
|
|
220
|
+
placementArea: placementArea.settings && toggle(placementArea.label),
|
|
221
|
+
numberedGuides: numberedGuides.settings && model.placementArea && toggle(numberedGuides.label),
|
|
222
|
+
orientation: orientation.settings && radio(orientation.label, ['vertical', 'horizontal']),
|
|
223
|
+
removeTilesAfterPlacing: removeTilesAfterPlacing.settings && toggle(removeTilesAfterPlacing.label),
|
|
224
|
+
partialScoring: partialScoring.settings && toggle(partialScoring.label),
|
|
225
|
+
feedbackEnabled: feedback.settings && toggle(feedback.label),
|
|
226
|
+
'language.enabled': language.settings && toggle(language.label, true),
|
|
227
|
+
language: language.settings && language.enabled && dropdown(languageChoices.label, languageChoices.options)
|
|
228
|
+
};
|
|
229
|
+
const panelProperties = {
|
|
230
|
+
teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),
|
|
231
|
+
studentInstructionsEnabled: studentInstructions.settings && toggle(studentInstructions.label),
|
|
232
|
+
rationaleEnabled: rationale.settings && toggle(rationale.label),
|
|
233
|
+
promptEnabled: prompt.settings && toggle(prompt.label),
|
|
234
|
+
spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),
|
|
235
|
+
scoringType: scoringType.settings && radio(scoringType.label, ['auto', 'rubric']),
|
|
236
|
+
rubricEnabled: withRubric?.settings && toggle(withRubric?.label)
|
|
237
|
+
};
|
|
238
|
+
const getPluginProps = (props = {}) => ({
|
|
239
|
+
...baseInputConfiguration,
|
|
240
|
+
...props
|
|
241
|
+
});
|
|
242
|
+
return /*#__PURE__*/_react.default.createElement(_drag.DragProvider, {
|
|
243
|
+
onDragEnd: event => this.onDragEnd(event, ordering)
|
|
244
|
+
}, /*#__PURE__*/_react.default.createElement(_configUi.layout.ConfigLayout, {
|
|
245
|
+
extraCSSRules: extraCSSRules,
|
|
246
|
+
dimensions: contentDimensions,
|
|
247
|
+
hideSettings: settingsPanelDisabled,
|
|
248
|
+
settings: /*#__PURE__*/_react.default.createElement(Panel, {
|
|
249
|
+
model: model,
|
|
250
|
+
configuration: configuration,
|
|
251
|
+
onChangeModel: model => onModelChanged(model),
|
|
252
|
+
onChangeConfiguration: configuration => onConfigurationChanged(configuration, true),
|
|
253
|
+
groups: {
|
|
254
|
+
Settings: panelSettings,
|
|
255
|
+
Properties: panelProperties
|
|
332
256
|
}
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
257
|
+
})
|
|
258
|
+
}, teacherInstructionsEnabled && /*#__PURE__*/_react.default.createElement(StyledInputContainer, {
|
|
259
|
+
label: teacherInstructions.label
|
|
260
|
+
}, /*#__PURE__*/_react.default.createElement(_editableHtmlTipTap.default, {
|
|
261
|
+
className: "prompt",
|
|
262
|
+
markup: model.teacherInstructions || '',
|
|
263
|
+
onChange: this.onTeacherInstructionsChange,
|
|
264
|
+
imageSupport: imageSupport,
|
|
265
|
+
nonEmpty: false,
|
|
266
|
+
error: teacherInstructionsError,
|
|
267
|
+
toolbarOpts: toolbarOpts,
|
|
268
|
+
pluginProps: getPluginProps(teacherInstructions?.inputConfiguration),
|
|
269
|
+
spellCheck: spellCheckEnabled,
|
|
270
|
+
maxImageWidth: maxImageWidth && maxImageWidth.teacherInstructions || defaultImageMaxWidth,
|
|
271
|
+
maxImageHeight: maxImageHeight && maxImageHeight.teacherInstructions || defaultImageMaxHeight,
|
|
272
|
+
uploadSoundSupport: uploadSoundSupport,
|
|
273
|
+
languageCharactersProps: [{
|
|
274
|
+
language: 'spanish'
|
|
275
|
+
}, {
|
|
276
|
+
language: 'special'
|
|
277
|
+
}],
|
|
278
|
+
mathMlOptions: mathMlOptions
|
|
279
|
+
}), teacherInstructionsError && /*#__PURE__*/_react.default.createElement("div", {
|
|
280
|
+
className: "errorText"
|
|
281
|
+
}, teacherInstructionsError)), promptEnabled && /*#__PURE__*/_react.default.createElement(StyledInputContainer, {
|
|
282
|
+
label: prompt && prompt.label
|
|
283
|
+
}, /*#__PURE__*/_react.default.createElement(_editableHtmlTipTap.default, {
|
|
284
|
+
className: "prompt",
|
|
285
|
+
markup: model.prompt,
|
|
286
|
+
onChange: this.onPromptChange,
|
|
287
|
+
imageSupport: imageSupport,
|
|
288
|
+
error: promptError,
|
|
289
|
+
toolbarOpts: toolbarOpts,
|
|
290
|
+
pluginProps: getPluginProps(prompt?.inputConfiguration),
|
|
291
|
+
spellCheck: spellCheckEnabled,
|
|
292
|
+
maxImageWidth: maxImageWidth && maxImageWidth.prompt,
|
|
293
|
+
maxImageHeight: maxImageHeight && maxImageHeight.prompt,
|
|
294
|
+
uploadSoundSupport: uploadSoundSupport,
|
|
295
|
+
languageCharactersProps: [{
|
|
296
|
+
language: 'spanish'
|
|
297
|
+
}, {
|
|
298
|
+
language: 'special'
|
|
299
|
+
}],
|
|
300
|
+
mathMlOptions: mathMlOptions
|
|
301
|
+
}), promptError && /*#__PURE__*/_react.default.createElement("div", {
|
|
302
|
+
className: "errorText"
|
|
303
|
+
}, promptError)), /*#__PURE__*/_react.default.createElement(StyledChoicesWrapper, {
|
|
304
|
+
label: `Define ${pluralLabel}`,
|
|
305
|
+
labelExtraStyle: {
|
|
306
|
+
display: 'inline-flex'
|
|
307
|
+
}
|
|
308
|
+
}, /*#__PURE__*/_react.default.createElement(InlineFlexContainer, null, /*#__PURE__*/_react.default.createElement(_Tooltip.default, {
|
|
309
|
+
slotProps: {
|
|
310
|
+
tooltip: {
|
|
311
|
+
sx: {
|
|
312
|
+
fontSize: 14,
|
|
313
|
+
whiteSpace: 'pre',
|
|
314
|
+
maxWidth: '500px'
|
|
315
|
+
}
|
|
348
316
|
}
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
317
|
+
},
|
|
318
|
+
disableFocusListener: true,
|
|
319
|
+
disableTouchListener: true,
|
|
320
|
+
placement: 'right',
|
|
321
|
+
title: validationMessage
|
|
322
|
+
}, /*#__PURE__*/_react.default.createElement(_Info.default, {
|
|
323
|
+
fontSize: 'small',
|
|
324
|
+
color: 'primary',
|
|
325
|
+
style: {
|
|
326
|
+
marginLeft: '8px'
|
|
327
|
+
}
|
|
328
|
+
}))), /*#__PURE__*/_react.default.createElement(StyledRow, null, choiceLabelEnabled && /*#__PURE__*/_react.default.createElement(StyledInputContainer, {
|
|
329
|
+
label: choiceLabel && choiceLabel.label && `${singularLabel} label`
|
|
330
|
+
}, /*#__PURE__*/_react.default.createElement(_editableHtmlTipTap.default, (0, _extends2.default)({}, model.placementArea && {
|
|
331
|
+
autoWidthToolbar: true
|
|
332
|
+
}, {
|
|
333
|
+
className: "prompt",
|
|
334
|
+
markup: model.choiceLabel,
|
|
335
|
+
onChange: this.onChoiceAreaLabelChange,
|
|
336
|
+
toolbarOpts: toolbarOpts,
|
|
337
|
+
pluginProps: getPluginProps(choiceLabel?.inputConfiguration),
|
|
338
|
+
spellCheck: spellCheckEnabled,
|
|
339
|
+
maxImageWidth: maxChoicesImageWidth,
|
|
340
|
+
maxImageHeight: maxChoicesImageHeight,
|
|
341
|
+
uploadSoundSupport: uploadSoundSupport,
|
|
342
|
+
languageCharactersProps: [{
|
|
343
|
+
language: 'spanish'
|
|
356
344
|
}, {
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
language: 'spanish'
|
|
424
|
-
}, {
|
|
425
|
-
language: 'special'
|
|
426
|
-
}],
|
|
427
|
-
mathMlOptions: mathMlOptions
|
|
428
|
-
}), rationaleError && /*#__PURE__*/_react["default"].createElement("div", {
|
|
429
|
-
className: classes.errorText
|
|
430
|
-
}, rationaleError)), feedbackEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.FeedbackConfig, {
|
|
431
|
-
feedback: model.feedback,
|
|
432
|
-
onChange: this.onFeedbackChange,
|
|
433
|
-
imageSupport: imageSupport,
|
|
434
|
-
toolbarOpts: toolbarOpts
|
|
435
|
-
}));
|
|
436
|
-
}
|
|
437
|
-
}]);
|
|
438
|
-
return Design;
|
|
439
|
-
}(_react["default"].Component);
|
|
440
|
-
|
|
345
|
+
language: 'special'
|
|
346
|
+
}],
|
|
347
|
+
mathMlOptions: mathMlOptions
|
|
348
|
+
}))), targetLabel.settings && model.placementArea && /*#__PURE__*/_react.default.createElement(StyledInputContainer, {
|
|
349
|
+
label: targetLabel && targetLabel.label && targetLabel.label
|
|
350
|
+
}, /*#__PURE__*/_react.default.createElement(_editableHtmlTipTap.default, {
|
|
351
|
+
autoWidthToolbar: true,
|
|
352
|
+
className: "prompt",
|
|
353
|
+
markup: model.targetLabel,
|
|
354
|
+
onChange: this.onAnswerAreaLabelChange,
|
|
355
|
+
toolbarOpts: toolbarOpts,
|
|
356
|
+
spellCheck: spellCheckEnabled,
|
|
357
|
+
maxImageWidth: maxImageWidth && maxImageWidth.choicesWithPlacementArea || defaultImageMaxWidth,
|
|
358
|
+
maxImageHeight: maxChoicesImageHeight,
|
|
359
|
+
uploadSoundSupport: uploadSoundSupport,
|
|
360
|
+
languageCharactersProps: [{
|
|
361
|
+
language: 'spanish'
|
|
362
|
+
}, {
|
|
363
|
+
language: 'special'
|
|
364
|
+
}],
|
|
365
|
+
mathMlOptions: mathMlOptions
|
|
366
|
+
}))), choices.settings && /*#__PURE__*/_react.default.createElement(_choiceEditor.default, {
|
|
367
|
+
correctResponse: correctResponse,
|
|
368
|
+
choices: model.choices,
|
|
369
|
+
onChange: this.onChoiceEditorChange,
|
|
370
|
+
imageSupport: imageSupport,
|
|
371
|
+
toolbarOpts: toolbarOpts,
|
|
372
|
+
pluginProps: getPluginProps(choices?.inputConfiguration),
|
|
373
|
+
choicesLabel: choices.label,
|
|
374
|
+
placementArea: model.placementArea,
|
|
375
|
+
singularChoiceLabel: singularLabel,
|
|
376
|
+
pluralChoiceLabel: pluralLabel,
|
|
377
|
+
spellCheck: spellCheckEnabled,
|
|
378
|
+
maxImageWidth: maxChoicesImageWidth,
|
|
379
|
+
maxImageHeight: maxChoicesImageHeight,
|
|
380
|
+
errors: errors || {},
|
|
381
|
+
mathMlOptions: mathMlOptions,
|
|
382
|
+
ordering: ordering
|
|
383
|
+
})), rationaleEnabled && /*#__PURE__*/_react.default.createElement(StyledInputContainer, {
|
|
384
|
+
label: rationale.label
|
|
385
|
+
}, /*#__PURE__*/_react.default.createElement(_editableHtmlTipTap.default, {
|
|
386
|
+
className: "prompt",
|
|
387
|
+
markup: model.rationale || '',
|
|
388
|
+
onChange: this.onRationaleChange,
|
|
389
|
+
imageSupport: imageSupport,
|
|
390
|
+
error: rationaleError,
|
|
391
|
+
toolbarOpts: toolbarOpts,
|
|
392
|
+
pluginProps: getPluginProps(rationale?.inputConfiguration),
|
|
393
|
+
spellCheck: spellCheckEnabled,
|
|
394
|
+
maxImageWidth: maxImageWidth && maxImageWidth.rationale || defaultImageMaxWidth,
|
|
395
|
+
maxImageHeight: maxImageHeight && maxImageHeight.rationale || defaultImageMaxHeight,
|
|
396
|
+
uploadSoundSupport: uploadSoundSupport,
|
|
397
|
+
languageCharactersProps: [{
|
|
398
|
+
language: 'spanish'
|
|
399
|
+
}, {
|
|
400
|
+
language: 'special'
|
|
401
|
+
}],
|
|
402
|
+
mathMlOptions: mathMlOptions
|
|
403
|
+
}), rationaleError && /*#__PURE__*/_react.default.createElement(ErrorText, null, rationaleError)), feedbackEnabled && /*#__PURE__*/_react.default.createElement(_configUi.FeedbackConfig, {
|
|
404
|
+
feedback: model.feedback,
|
|
405
|
+
onChange: this.onFeedbackChange,
|
|
406
|
+
imageSupport: imageSupport,
|
|
407
|
+
toolbarOpts: toolbarOpts
|
|
408
|
+
})));
|
|
409
|
+
}
|
|
410
|
+
}
|
|
441
411
|
exports.Design = Design;
|
|
442
|
-
(0, _defineProperty2
|
|
443
|
-
uploadSoundSupport: _propTypes
|
|
412
|
+
(0, _defineProperty2.default)(Design, "propTypes", {
|
|
413
|
+
uploadSoundSupport: _propTypes.default.object
|
|
444
414
|
});
|
|
445
|
-
(0, _defineProperty2
|
|
415
|
+
(0, _defineProperty2.default)(Design, "defaultProps", {});
|
|
446
416
|
Design.defaultProps = {
|
|
447
|
-
onModelChanged:
|
|
448
|
-
onConfigurationChanged:
|
|
417
|
+
onModelChanged: () => {},
|
|
418
|
+
onConfigurationChanged: () => {}
|
|
449
419
|
};
|
|
450
420
|
Design.propTypes = {
|
|
451
|
-
model: _propTypes
|
|
452
|
-
configuration: _propTypes
|
|
453
|
-
onModelChanged: _propTypes
|
|
454
|
-
onConfigurationChanged: _propTypes
|
|
455
|
-
|
|
456
|
-
imageSupport: _propTypes["default"].object
|
|
421
|
+
model: _propTypes.default.object.isRequired,
|
|
422
|
+
configuration: _propTypes.default.object.isRequired,
|
|
423
|
+
onModelChanged: _propTypes.default.func,
|
|
424
|
+
onConfigurationChanged: _propTypes.default.func,
|
|
425
|
+
imageSupport: _propTypes.default.object
|
|
457
426
|
};
|
|
458
|
-
|
|
459
|
-
var _default = (0, _drag.withDragContext)((0, _styles.withStyles)(function (theme) {
|
|
460
|
-
return {
|
|
461
|
-
promptHolder: {
|
|
462
|
-
width: '100%',
|
|
463
|
-
paddingTop: theme.spacing.unit * 2,
|
|
464
|
-
marginBottom: theme.spacing.unit * 2
|
|
465
|
-
},
|
|
466
|
-
row: {
|
|
467
|
-
display: 'grid',
|
|
468
|
-
gridAutoFlow: 'column',
|
|
469
|
-
gridAutoColumns: '1fr',
|
|
470
|
-
gridGap: '8px'
|
|
471
|
-
},
|
|
472
|
-
choicesWrapper: {
|
|
473
|
-
marginTop: 0,
|
|
474
|
-
marginBottom: theme.spacing.unit * 2.5
|
|
475
|
-
},
|
|
476
|
-
tooltip: {
|
|
477
|
-
fontSize: theme.typography.fontSize - 2,
|
|
478
|
-
whiteSpace: 'pre',
|
|
479
|
-
maxWidth: '500px'
|
|
480
|
-
},
|
|
481
|
-
inlineFlexContainer: {
|
|
482
|
-
display: 'inline-flex',
|
|
483
|
-
position: 'absolute'
|
|
484
|
-
},
|
|
485
|
-
errorText: {
|
|
486
|
-
fontSize: theme.typography.fontSize - 2,
|
|
487
|
-
color: theme.palette.error.main,
|
|
488
|
-
paddingTop: theme.spacing.unit
|
|
489
|
-
}
|
|
490
|
-
};
|
|
491
|
-
})(Design));
|
|
492
|
-
|
|
493
|
-
exports["default"] = _default;
|
|
427
|
+
var _default = exports.default = Design;
|
|
494
428
|
//# sourceMappingURL=design.js.map
|