@pie-element/match 7.9.1-next.0 → 7.9.1-next.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.
@@ -1,501 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports["default"] = exports.Config = void 0;
9
-
10
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
-
12
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
-
14
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
15
-
16
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
17
-
18
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
19
-
20
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
21
-
22
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
23
-
24
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
25
-
26
- var _utils = require("./utils");
27
-
28
- var _react = _interopRequireDefault(require("react"));
29
-
30
- var _styles = require("@material-ui/core/styles");
31
-
32
- var _configUi = require("@pie-lib/pie-toolbox/config-ui");
33
-
34
- var _editableHtml = require("@pie-lib/pie-toolbox/editable-html");
35
-
36
- var _drag = require("@pie-lib/pie-toolbox/drag");
37
-
38
- var _propTypes = _interopRequireDefault(require("prop-types"));
39
-
40
- var _debug = _interopRequireDefault(require("debug"));
41
-
42
- var _generalConfigBlock = _interopRequireDefault(require("./general-config-block"));
43
-
44
- var _answerConfigBlock = _interopRequireDefault(require("./answer-config-block"));
45
-
46
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
47
-
48
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
49
-
50
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
51
-
52
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
53
-
54
- var log = (0, _debug["default"])('@pie-element:match:configure');
55
- var Panel = _configUi.settings.Panel,
56
- toggle = _configUi.settings.toggle,
57
- radio = _configUi.settings.radio,
58
- dropdown = _configUi.settings.dropdown;
59
-
60
- var styles = function styles(theme) {
61
- return {
62
- promptHolder: {
63
- width: '100%',
64
- paddingTop: theme.spacing.unit * 2,
65
- marginBottom: theme.spacing.unit * 2
66
- },
67
- errorText: {
68
- fontSize: theme.typography.fontSize - 2,
69
- color: theme.palette.error.main,
70
- paddingTop: theme.spacing.unit
71
- }
72
- };
73
- };
74
-
75
- var Configure = /*#__PURE__*/function (_React$Component) {
76
- (0, _inherits2["default"])(Configure, _React$Component);
77
-
78
- var _super = _createSuper(Configure);
79
-
80
- function Configure(props) {
81
- var _this;
82
-
83
- (0, _classCallCheck2["default"])(this, Configure);
84
- _this = _super.call(this, props);
85
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onTabChange", function (event, value) {
86
- _this.setState({
87
- activeTab: value
88
- });
89
- });
90
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onChangeTabIndex", function (index) {
91
- _this.setState({
92
- activeTab: index
93
- });
94
- });
95
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onChange", function (model) {
96
- _this.props.onModelChanged(model);
97
- });
98
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onFeedbackChange", function (feedback) {
99
- var _this$props = _this.props,
100
- model = _this$props.model,
101
- onModelChanged = _this$props.onModelChanged;
102
- model.feedback = feedback;
103
- onModelChanged(model);
104
- });
105
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onDeleteRow", function (rowIndex) {
106
- var model = _this.props.model;
107
-
108
- var newModel = _objectSpread({}, model);
109
-
110
- newModel.rows.splice(rowIndex, 1);
111
-
112
- _this.onChange(newModel);
113
- });
114
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onAddRow", function () {
115
- var _this$props2 = _this.props,
116
- model = _this$props2.model,
117
- configuration = _this$props2.configuration;
118
-
119
- var newModel = _objectSpread({}, model);
120
-
121
- var _ref = configuration || {},
122
- maxQuestions = _ref.maxQuestions;
123
-
124
- if (maxQuestions && (newModel.rows || []).length >= maxQuestions) {
125
- _this.setState({
126
- dialog: {
127
- open: true,
128
- text: "There can be maximum ".concat(maxQuestions, " question row") + (maxQuestions > 1 ? 's' : '') + '.'
129
- }
130
- });
131
-
132
- return;
133
- }
134
-
135
- newModel.rows = newModel.rows.concat({
136
- id: _this.rowIdCounter + 1,
137
- title: "Question Text ".concat((newModel.rows || []).length + 1),
138
- values: new Array(model.layout - 1).fill(false)
139
- });
140
- _this.rowIdCounter += 1;
141
-
142
- _this.onChange(newModel);
143
- });
144
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onLayoutChange", function (newLayout) {
145
- var model = _this.props.model;
146
- var oldLayout = model.layout;
147
-
148
- var newModel = _objectSpread({}, model);
149
-
150
- if (newLayout > oldLayout) {
151
- for (var i = 0; i < newLayout - oldLayout; i++) {
152
- newModel.headers.push("Column ".concat(newModel.headers.length + 1));
153
- }
154
-
155
- newModel.rows.forEach(function (row) {
156
- for (var _i = 0; _i < newLayout - oldLayout; _i++) {
157
- row.values.push(false);
158
- }
159
- });
160
- } else if (newLayout < oldLayout) {
161
- newModel.headers.splice(newLayout);
162
- newModel.rows.forEach(function (row) {
163
- row.values.splice(newLayout - 1);
164
- });
165
- }
166
-
167
- newModel.layout = newLayout;
168
-
169
- _this.onChange(newModel);
170
- });
171
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onResponseTypeChange", function (newChoiceMode) {
172
- var model = _this.props.model;
173
-
174
- var newModel = _objectSpread({}, model); // if we're switching to radio and we have more than one true, reset
175
-
176
-
177
- if (newChoiceMode === 'radio') {
178
- newModel.rows.forEach(function (row) {
179
- var trueCount = row.values.reduce(function (total, current) {
180
- return current === true ? total + 1 : total;
181
- });
182
-
183
- if (trueCount > 1) {
184
- row.values = new Array(model.layout - 1).fill(false);
185
- }
186
- });
187
- }
188
-
189
- newModel.choiceMode = newChoiceMode;
190
-
191
- _this.onChange(newModel);
192
- });
193
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onPartialScoringChange", function (partialScoring) {
194
- _this.props.model.partialScoring = partialScoring;
195
-
196
- _this.props.onModelChanged(_this.props.model);
197
- });
198
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onPromptChanged", function (prompt) {
199
- _this.props.onModelChanged(_objectSpread(_objectSpread({}, _this.props.model), {}, {
200
- prompt: prompt
201
- }));
202
- });
203
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onTeacherInstructionsChanged", function (teacherInstructions) {
204
- _this.props.onModelChanged(_objectSpread(_objectSpread({}, _this.props.model), {}, {
205
- teacherInstructions: teacherInstructions
206
- }));
207
- });
208
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onRationaleChanged", function (rationale) {
209
- _this.props.onModelChanged(_objectSpread(_objectSpread({}, _this.props.model), {}, {
210
- rationale: rationale
211
- }));
212
- });
213
- var maxId = 0;
214
-
215
- if (props.model.rows && props.model.rows.length > 0) {
216
- maxId = Math.max.apply(Math, (0, _toConsumableArray2["default"])(props.model.rows.map(function (row) {
217
- return row.id;
218
- })));
219
- }
220
-
221
- _this.rowIdCounter = maxId + 1;
222
- _this.state = {
223
- activeTab: 0,
224
- dialog: {
225
- open: false,
226
- text: ''
227
- }
228
- };
229
- return _this;
230
- }
231
-
232
- (0, _createClass2["default"])(Configure, [{
233
- key: "componentDidMount",
234
- value: function componentDidMount() {
235
- var _this$validateRowsID = this.validateRowsID(this.props.model.rows),
236
- updatedRows = _this$validateRowsID.updatedRows,
237
- wasChanged = _this$validateRowsID.wasChanged;
238
-
239
- if (wasChanged) {
240
- var newModel = _objectSpread(_objectSpread({}, this.props.model), {}, {
241
- rows: updatedRows
242
- });
243
-
244
- this.props.onModelChanged(newModel);
245
- }
246
- }
247
- }, {
248
- key: "validateRowsID",
249
- value: function validateRowsID(rows) {
250
- var wasChanged = false;
251
- var updatedRows = (rows || []).map(function (row, index) {
252
- if (row.id !== index + 1) {
253
- wasChanged = true;
254
- return _objectSpread(_objectSpread({}, row), {}, {
255
- id: index + 1
256
- });
257
- }
258
-
259
- return row;
260
- });
261
- return {
262
- updatedRows: updatedRows,
263
- wasChanged: wasChanged
264
- };
265
- }
266
- }, {
267
- key: "render",
268
- value: function render() {
269
- var _this2 = this;
270
-
271
- var _this$props3 = this.props,
272
- classes = _this$props3.classes,
273
- model = _this$props3.model,
274
- imageSupport = _this$props3.imageSupport,
275
- onModelChanged = _this$props3.onModelChanged,
276
- configuration = _this$props3.configuration,
277
- onConfigurationChanged = _this$props3.onConfigurationChanged,
278
- uploadSoundSupport = _this$props3.uploadSoundSupport;
279
-
280
- var _ref2 = configuration || {},
281
- _ref2$baseInputConfig = _ref2.baseInputConfiguration,
282
- baseInputConfiguration = _ref2$baseInputConfig === void 0 ? {} : _ref2$baseInputConfig,
283
- _ref2$contentDimensio = _ref2.contentDimensions,
284
- contentDimensions = _ref2$contentDimensio === void 0 ? {} : _ref2$contentDimensio,
285
- _ref2$enableImages = _ref2.enableImages,
286
- enableImages = _ref2$enableImages === void 0 ? {} : _ref2$enableImages,
287
- _ref2$feedback = _ref2.feedback,
288
- feedback = _ref2$feedback === void 0 ? {} : _ref2$feedback,
289
- _ref2$lockChoiceOrder = _ref2.lockChoiceOrder,
290
- lockChoiceOrder = _ref2$lockChoiceOrder === void 0 ? {} : _ref2$lockChoiceOrder,
291
- _ref2$maxImageWidth = _ref2.maxImageWidth,
292
- maxImageWidth = _ref2$maxImageWidth === void 0 ? {} : _ref2$maxImageWidth,
293
- _ref2$maxImageHeight = _ref2.maxImageHeight,
294
- maxImageHeight = _ref2$maxImageHeight === void 0 ? {} : _ref2$maxImageHeight,
295
- _ref2$partialScoring = _ref2.partialScoring,
296
- partialScoring = _ref2$partialScoring === void 0 ? {} : _ref2$partialScoring,
297
- _ref2$prompt = _ref2.prompt,
298
- prompt = _ref2$prompt === void 0 ? {} : _ref2$prompt,
299
- _ref2$rationale = _ref2.rationale,
300
- rationale = _ref2$rationale === void 0 ? {} : _ref2$rationale,
301
- settingsPanelDisabled = _ref2.settingsPanelDisabled,
302
- _ref2$scoringType = _ref2.scoringType,
303
- scoringType = _ref2$scoringType === void 0 ? {} : _ref2$scoringType,
304
- _ref2$spellCheck = _ref2.spellCheck,
305
- spellCheck = _ref2$spellCheck === void 0 ? {} : _ref2$spellCheck,
306
- _ref2$studentInstruct = _ref2.studentInstructions,
307
- studentInstructions = _ref2$studentInstruct === void 0 ? {} : _ref2$studentInstruct,
308
- _ref2$teacherInstruct = _ref2.teacherInstructions,
309
- teacherInstructions = _ref2$teacherInstruct === void 0 ? {} : _ref2$teacherInstruct,
310
- _ref2$withRubric = _ref2.withRubric,
311
- withRubric = _ref2$withRubric === void 0 ? {} : _ref2$withRubric,
312
- _ref2$language = _ref2.language,
313
- language = _ref2$language === void 0 ? {} : _ref2$language,
314
- _ref2$languageChoices = _ref2.languageChoices,
315
- languageChoices = _ref2$languageChoices === void 0 ? {} : _ref2$languageChoices;
316
-
317
- var _ref3 = model || {},
318
- errors = _ref3.errors,
319
- feedbackEnabled = _ref3.feedbackEnabled,
320
- promptEnabled = _ref3.promptEnabled,
321
- rationaleEnabled = _ref3.rationaleEnabled,
322
- spellCheckEnabled = _ref3.spellCheckEnabled,
323
- teacherInstructionsEnabled = _ref3.teacherInstructionsEnabled,
324
- toolbarEditorPosition = _ref3.toolbarEditorPosition;
325
-
326
- var _ref4 = errors || {},
327
- promptError = _ref4.prompt,
328
- rationaleError = _ref4.rationale,
329
- teacherInstructionsError = _ref4.teacherInstructions;
330
-
331
- var dialog = this.state.dialog;
332
- var toolbarOpts = {
333
- position: toolbarEditorPosition === 'top' ? 'top' : 'bottom'
334
- };
335
- var defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;
336
- var defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;
337
- var panelSettings = {
338
- enableImages: enableImages.settings && toggle(enableImages.label),
339
- partialScoring: partialScoring.settings && toggle(partialScoring.label),
340
- lockChoiceOrder: lockChoiceOrder.settings && toggle(lockChoiceOrder.label),
341
- feedbackEnabled: feedback.settings && toggle(feedback.label),
342
- 'language.enabled': language.settings && toggle(language.label, true),
343
- language: language.settings && language.enabled && dropdown(languageChoices.label, languageChoices.options)
344
- };
345
- var panelProperties = {
346
- teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),
347
- studentInstructionsEnabled: studentInstructions.settings && toggle(studentInstructions.label),
348
- promptEnabled: prompt.settings && toggle(prompt.label),
349
- rationaleEnabled: rationale.settings && toggle(rationale.label),
350
- spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),
351
- scoringType: scoringType.settings && radio(scoringType.label, ['auto', 'rubric']),
352
- rubricEnabled: (withRubric === null || withRubric === void 0 ? void 0 : withRubric.settings) && toggle(withRubric === null || withRubric === void 0 ? void 0 : withRubric.label)
353
- };
354
- log('[render] model', model);
355
- return /*#__PURE__*/_react["default"].createElement(_configUi.layout.ConfigLayout, {
356
- dimensions: contentDimensions,
357
- hideSettings: settingsPanelDisabled,
358
- settings: /*#__PURE__*/_react["default"].createElement(Panel, {
359
- model: model,
360
- configuration: configuration,
361
- onChangeModel: function onChangeModel(model) {
362
- return onModelChanged(model);
363
- },
364
- onChangeConfiguration: function onChangeConfiguration(config) {
365
- return onConfigurationChanged(config);
366
- },
367
- groups: {
368
- Settings: panelSettings,
369
- Properties: panelProperties
370
- }
371
- })
372
- }, teacherInstructionsEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
373
- label: teacherInstructions.label,
374
- className: classes.promptHolder
375
- }, /*#__PURE__*/_react["default"].createElement(_editableHtml.EditableHtml, {
376
- className: classes.prompt,
377
- markup: model.teacherInstructions || '',
378
- onChange: this.onTeacherInstructionsChanged,
379
- imageSupport: imageSupport,
380
- error: teacherInstructionsError,
381
- nonEmpty: false,
382
- toolbarOpts: toolbarOpts,
383
- pluginProps: (0, _utils.getPluginProps)(teacherInstructions === null || teacherInstructions === void 0 ? void 0 : teacherInstructions.inputConfiguration, baseInputConfiguration),
384
- spellCheck: spellCheckEnabled,
385
- maxImageWidth: maxImageWidth && maxImageWidth.teacherInstructions || defaultImageMaxWidth,
386
- maxImageHeight: maxImageHeight && maxImageHeight.teacherInstructions || defaultImageMaxHeight,
387
- uploadSoundSupport: uploadSoundSupport,
388
- languageCharactersProps: [{
389
- language: 'spanish'
390
- }, {
391
- language: 'special'
392
- }]
393
- }), teacherInstructionsError && /*#__PURE__*/_react["default"].createElement("div", {
394
- className: classes.errorText
395
- }, teacherInstructionsError)), promptEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
396
- label: prompt.label,
397
- className: classes.promptHolder
398
- }, /*#__PURE__*/_react["default"].createElement(_editableHtml.EditableHtml, {
399
- className: classes.prompt,
400
- markup: model.prompt,
401
- onChange: this.onPromptChanged,
402
- imageSupport: imageSupport,
403
- error: promptError,
404
- nonEmpty: false,
405
- disableUnderline: true,
406
- toolbarOpts: toolbarOpts,
407
- pluginProps: (0, _utils.getPluginProps)(prompt === null || prompt === void 0 ? void 0 : prompt.inputConfiguration, baseInputConfiguration),
408
- spellCheck: spellCheckEnabled,
409
- maxImageWidth: maxImageWidth && maxImageWidth.prompt,
410
- maxImageHeight: maxImageHeight && maxImageHeight.prompt,
411
- uploadSoundSupport: uploadSoundSupport,
412
- languageCharactersProps: [{
413
- language: 'spanish'
414
- }, {
415
- language: 'special'
416
- }]
417
- }), promptError && /*#__PURE__*/_react["default"].createElement("div", {
418
- className: classes.errorText
419
- }, promptError)), /*#__PURE__*/_react["default"].createElement(_generalConfigBlock["default"], {
420
- model: model,
421
- configuration: configuration,
422
- onResponseTypeChange: this.onResponseTypeChange,
423
- onLayoutChange: this.onLayoutChange
424
- }), /*#__PURE__*/_react["default"].createElement(_answerConfigBlock["default"], {
425
- model: model,
426
- configuration: configuration,
427
- imageSupport: imageSupport,
428
- onChange: this.onChange,
429
- onAddRow: this.onAddRow,
430
- onDeleteRow: this.onDeleteRow,
431
- toolbarOpts: toolbarOpts,
432
- spellCheck: spellCheckEnabled,
433
- uploadSoundSupport: uploadSoundSupport
434
- }), rationaleEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
435
- label: rationale.label,
436
- className: classes.promptHolder
437
- }, /*#__PURE__*/_react["default"].createElement(_editableHtml.EditableHtml, {
438
- className: classes.prompt,
439
- markup: model.rationale || '',
440
- onChange: this.onRationaleChanged,
441
- imageSupport: imageSupport,
442
- error: rationaleError,
443
- toolbarOpts: toolbarOpts,
444
- pluginProps: (0, _utils.getPluginProps)(rationale === null || rationale === void 0 ? void 0 : rationale.inputConfiguration, baseInputConfiguration),
445
- spellCheck: spellCheckEnabled,
446
- maxImageWidth: maxImageWidth && maxImageWidth.rationale || defaultImageMaxWidth,
447
- maxImageHeight: maxImageHeight && maxImageHeight.rationale || defaultImageMaxHeight,
448
- uploadSoundSupport: uploadSoundSupport,
449
- languageCharactersProps: [{
450
- language: 'spanish'
451
- }, {
452
- language: 'special'
453
- }]
454
- }), rationaleError && /*#__PURE__*/_react["default"].createElement("div", {
455
- className: classes.errorText
456
- }, rationaleError)), feedbackEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.FeedbackConfig, {
457
- feedback: model.feedback,
458
- onChange: this.onFeedbackChange,
459
- toolbarOpts: toolbarOpts
460
- }), /*#__PURE__*/_react["default"].createElement(_configUi.AlertDialog, {
461
- open: dialog.open,
462
- title: "Warning",
463
- text: dialog.text,
464
- onConfirm: function onConfirm() {
465
- return _this2.setState({
466
- dialog: {
467
- open: false
468
- }
469
- });
470
- }
471
- }));
472
- }
473
- }]);
474
- return Configure;
475
- }(_react["default"].Component);
476
-
477
- (0, _defineProperty2["default"])(Configure, "propTypes", {
478
- onModelChanged: _propTypes["default"].func,
479
- onConfigurationChanged: _propTypes["default"].func,
480
- classes: _propTypes["default"].object,
481
- model: _propTypes["default"].object.isRequired,
482
- configuration: _propTypes["default"].object.isRequired,
483
- imageSupport: _propTypes["default"].shape({
484
- add: _propTypes["default"].func.isRequired,
485
- "delete": _propTypes["default"].func.isRequired
486
- }),
487
- uploadSoundSupport: _propTypes["default"].shape({
488
- add: _propTypes["default"].func.isRequired,
489
- "delete": _propTypes["default"].func.isRequired
490
- })
491
- });
492
- (0, _defineProperty2["default"])(Configure, "defaultProps", {
493
- classes: {}
494
- });
495
- var Config = Configure;
496
- exports.Config = Config;
497
-
498
- var _default = (0, _drag.withDragContext)((0, _styles.withStyles)(styles)(Configure));
499
-
500
- exports["default"] = _default;
501
- //# sourceMappingURL=configure.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/configure.jsx"],"names":["log","Panel","settings","toggle","radio","dropdown","styles","theme","promptHolder","width","paddingTop","spacing","unit","marginBottom","errorText","fontSize","typography","color","palette","error","main","Configure","props","event","value","setState","activeTab","index","model","onModelChanged","feedback","rowIndex","newModel","rows","splice","onChange","configuration","maxQuestions","length","dialog","open","text","concat","id","rowIdCounter","title","values","Array","layout","fill","newLayout","oldLayout","i","headers","push","forEach","row","newChoiceMode","trueCount","reduce","total","current","choiceMode","partialScoring","prompt","teacherInstructions","rationale","maxId","Math","max","map","state","validateRowsID","updatedRows","wasChanged","classes","imageSupport","onConfigurationChanged","uploadSoundSupport","baseInputConfiguration","contentDimensions","enableImages","lockChoiceOrder","maxImageWidth","maxImageHeight","settingsPanelDisabled","scoringType","spellCheck","studentInstructions","withRubric","language","languageChoices","errors","feedbackEnabled","promptEnabled","rationaleEnabled","spellCheckEnabled","teacherInstructionsEnabled","toolbarEditorPosition","promptError","rationaleError","teacherInstructionsError","toolbarOpts","position","defaultImageMaxWidth","defaultImageMaxHeight","panelSettings","label","enabled","options","panelProperties","studentInstructionsEnabled","rubricEnabled","config","Settings","Properties","onTeacherInstructionsChanged","inputConfiguration","onPromptChanged","onResponseTypeChange","onLayoutChange","onAddRow","onDeleteRow","onRationaleChanged","onFeedbackChange","React","Component","PropTypes","func","object","isRequired","shape","add","Config"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,8BAAN,CAAZ;AACA,IAAQC,KAAR,GAA2CC,kBAA3C,CAAQD,KAAR;AAAA,IAAeE,MAAf,GAA2CD,kBAA3C,CAAeC,MAAf;AAAA,IAAuBC,KAAvB,GAA2CF,kBAA3C,CAAuBE,KAAvB;AAAA,IAA8BC,QAA9B,G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BAAUI,KAAV,CAAgB;AAC5BC,IAAAA,GAAG,EAAEL,sBAAUC,IAAV,CAAeE,UADQ;AAE5B,cAAQH,sBAAUC,IAAV,CAAeE;AAFK,GAAhB,CANG;AAUjBpD,EAAAA,kBAAkB,EAAEiD,sBAAUI,KAAV,CAAgB;AAClCC,IAAAA,GAAG,EAAEL,sBAAUC,IAAV,CAAeE,UADc;AAElC,cAAQH,sBAAUC,IAAV,CAAeE;AAFW,GAAhB;AAVH,C;iCADf7G,S,kBAiBkB;AACpBsD,EAAAA,OAAO,EAAE;AADW,C;AA4VjB,IAAM0D,MAAM,GAAGhH,SAAf;;;eAEQ,2BAAgB,wBAAWf,MAAX,EAAmBe,SAAnB,CAAhB,C","sourcesContent":["import { getPluginProps } from './utils';\nimport React from 'react';\nimport { withStyles } from '@material-ui/core/styles';\nimport { FeedbackConfig, settings, layout, InputContainer, AlertDialog } from '@pie-lib/pie-toolbox/config-ui';\nimport { EditableHtml } from '@pie-lib/pie-toolbox/editable-html';\nimport { withDragContext } from '@pie-lib/pie-toolbox/drag';\nimport PropTypes from 'prop-types';\nimport debug from 'debug';\nimport GeneralConfigBlock from './general-config-block';\nimport AnswerConfigBlock from './answer-config-block';\n\nconst log = debug('@pie-element:match:configure');\nconst { Panel, toggle, radio, dropdown } = settings;\n\nconst styles = (theme) => ({\n promptHolder: {\n width: '100%',\n paddingTop: theme.spacing.unit * 2,\n marginBottom: theme.spacing.unit * 2,\n },\n errorText: {\n fontSize: theme.typography.fontSize - 2,\n color: theme.palette.error.main,\n paddingTop: theme.spacing.unit,\n },\n});\n\nclass Configure extends React.Component {\n static propTypes = {\n onModelChanged: PropTypes.func,\n onConfigurationChanged: PropTypes.func,\n classes: PropTypes.object,\n model: PropTypes.object.isRequired,\n configuration: PropTypes.object.isRequired,\n imageSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired,\n }),\n uploadSoundSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired,\n }),\n };\n\n static defaultProps = {\n classes: {},\n };\n\n constructor(props) {\n super(props);\n\n let maxId = 0;\n\n if (props.model.rows && props.model.rows.length > 0) {\n maxId = Math.max(...props.model.rows.map((row) => row.id));\n }\n\n this.rowIdCounter = maxId + 1;\n\n this.state = {\n activeTab: 0,\n dialog: {\n open: false,\n text: '',\n },\n };\n }\n\n componentDidMount() {\n const { updatedRows, wasChanged } = this.validateRowsID(this.props.model.rows);\n\n if (wasChanged) {\n const newModel = { ...this.props.model, rows: updatedRows };\n this.props.onModelChanged(newModel);\n }\n }\n\n validateRowsID(rows) {\n let wasChanged = false;\n\n const updatedRows = (rows || []).map((row, index) => {\n if (row.id !== index + 1) {\n wasChanged = true;\n\n return { ...row, id: index + 1 };\n }\n\n return row;\n });\n\n return { updatedRows, wasChanged };\n }\n\n onTabChange = (event, value) => {\n this.setState({ activeTab: value });\n };\n\n onChangeTabIndex = (index) => {\n this.setState({ activeTab: index });\n };\n\n onChange = (model) => {\n this.props.onModelChanged(model);\n };\n\n onFeedbackChange = (feedback) => {\n const { model, onModelChanged } = this.props;\n model.feedback = feedback;\n\n onModelChanged(model);\n };\n\n onDeleteRow = (rowIndex) => {\n const { model } = this.props;\n const newModel = { ...model };\n\n newModel.rows.splice(rowIndex, 1);\n\n this.onChange(newModel);\n };\n\n onAddRow = () => {\n const { model, configuration } = this.props;\n const newModel = { ...model };\n const { maxQuestions } = configuration || {};\n\n if (maxQuestions && (newModel.rows || []).length >= maxQuestions) {\n this.setState({\n dialog: {\n open: true,\n text: `There can be maximum ${maxQuestions} question row` + (maxQuestions > 1 ? 's' : '') + '.',\n },\n });\n return;\n }\n\n newModel.rows = newModel.rows.concat({\n id: this.rowIdCounter + 1,\n title: `Question Text ${(newModel.rows || []).length + 1}`,\n values: new Array(model.layout - 1).fill(false),\n });\n\n this.rowIdCounter += 1;\n\n this.onChange(newModel);\n };\n\n onLayoutChange = (newLayout) => {\n const { model } = this.props;\n const oldLayout = model.layout;\n const newModel = { ...model };\n\n if (newLayout > oldLayout) {\n for (let i = 0; i < newLayout - oldLayout; i++) {\n newModel.headers.push(`Column ${newModel.headers.length + 1}`);\n }\n\n newModel.rows.forEach((row) => {\n for (let i = 0; i < newLayout - oldLayout; i++) {\n row.values.push(false);\n }\n });\n } else if (newLayout < oldLayout) {\n newModel.headers.splice(newLayout);\n\n newModel.rows.forEach((row) => {\n row.values.splice(newLayout - 1);\n });\n }\n\n newModel.layout = newLayout;\n\n this.onChange(newModel);\n };\n\n onResponseTypeChange = (newChoiceMode) => {\n const { model } = this.props;\n const newModel = { ...model };\n\n // if we're switching to radio and we have more than one true, reset\n if (newChoiceMode === 'radio') {\n newModel.rows.forEach((row) => {\n const trueCount = row.values.reduce((total, current) => (current === true ? total + 1 : total));\n\n if (trueCount > 1) {\n row.values = new Array(model.layout - 1).fill(false);\n }\n });\n }\n\n newModel.choiceMode = newChoiceMode;\n\n this.onChange(newModel);\n };\n\n onPartialScoringChange = (partialScoring) => {\n this.props.model.partialScoring = partialScoring;\n\n this.props.onModelChanged(this.props.model);\n };\n\n onPromptChanged = (prompt) => {\n this.props.onModelChanged({ ...this.props.model, prompt });\n };\n\n onTeacherInstructionsChanged = (teacherInstructions) => {\n this.props.onModelChanged({ ...this.props.model, teacherInstructions });\n };\n\n onRationaleChanged = (rationale) => {\n this.props.onModelChanged({ ...this.props.model, rationale });\n };\n\n render() {\n const { classes, model, imageSupport, onModelChanged, configuration, onConfigurationChanged, uploadSoundSupport } =\n this.props;\n const {\n baseInputConfiguration = {},\n contentDimensions = {},\n enableImages = {},\n feedback = {},\n lockChoiceOrder = {},\n maxImageWidth = {},\n maxImageHeight = {},\n partialScoring = {},\n prompt = {},\n rationale = {},\n settingsPanelDisabled,\n scoringType = {},\n spellCheck = {},\n studentInstructions = {},\n teacherInstructions = {},\n withRubric = {},\n language = {},\n languageChoices = {},\n } = configuration || {};\n const {\n errors,\n feedbackEnabled,\n promptEnabled,\n rationaleEnabled,\n spellCheckEnabled,\n teacherInstructionsEnabled,\n toolbarEditorPosition,\n } = model || {};\n const {\n prompt: promptError,\n rationale: rationaleError,\n teacherInstructions: teacherInstructionsError,\n } = errors || {};\n const { dialog } = this.state;\n\n const toolbarOpts = {\n position: toolbarEditorPosition === 'top' ? 'top' : 'bottom',\n };\n\n const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;\n const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;\n\n const panelSettings = {\n enableImages: enableImages.settings && toggle(enableImages.label),\n partialScoring: partialScoring.settings && toggle(partialScoring.label),\n lockChoiceOrder: lockChoiceOrder.settings && toggle(lockChoiceOrder.label),\n feedbackEnabled: feedback.settings && toggle(feedback.label),\n 'language.enabled': language.settings && toggle(language.label, true),\n language: language.settings && language.enabled && dropdown(languageChoices.label, languageChoices.options),\n };\n const panelProperties = {\n teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),\n studentInstructionsEnabled: studentInstructions.settings && toggle(studentInstructions.label),\n promptEnabled: prompt.settings && toggle(prompt.label),\n rationaleEnabled: rationale.settings && toggle(rationale.label),\n spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),\n scoringType: scoringType.settings && radio(scoringType.label, ['auto', 'rubric']),\n rubricEnabled: withRubric?.settings && toggle(withRubric?.label),\n };\n\n log('[render] model', model);\n\n return (\n <layout.ConfigLayout\n dimensions={contentDimensions}\n hideSettings={settingsPanelDisabled}\n settings={\n <Panel\n model={model}\n configuration={configuration}\n onChangeModel={(model) => onModelChanged(model)}\n onChangeConfiguration={(config) => onConfigurationChanged(config)}\n groups={{\n Settings: panelSettings,\n Properties: panelProperties,\n }}\n />\n }\n >\n {teacherInstructionsEnabled && (\n <InputContainer label={teacherInstructions.label} className={classes.promptHolder}>\n <EditableHtml\n className={classes.prompt}\n markup={model.teacherInstructions || ''}\n onChange={this.onTeacherInstructionsChanged}\n imageSupport={imageSupport}\n error={teacherInstructionsError}\n nonEmpty={false}\n toolbarOpts={toolbarOpts}\n pluginProps={getPluginProps(teacherInstructions?.inputConfiguration, baseInputConfiguration)}\n spellCheck={spellCheckEnabled}\n maxImageWidth={(maxImageWidth && maxImageWidth.teacherInstructions) || defaultImageMaxWidth}\n maxImageHeight={(maxImageHeight && maxImageHeight.teacherInstructions) || defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n />\n {teacherInstructionsError && <div className={classes.errorText}>{teacherInstructionsError}</div>}\n </InputContainer>\n )}\n\n {promptEnabled && (\n <InputContainer label={prompt.label} className={classes.promptHolder}>\n <EditableHtml\n className={classes.prompt}\n markup={model.prompt}\n onChange={this.onPromptChanged}\n imageSupport={imageSupport}\n error={promptError}\n nonEmpty={false}\n disableUnderline\n toolbarOpts={toolbarOpts}\n pluginProps={getPluginProps(prompt?.inputConfiguration, baseInputConfiguration)}\n spellCheck={spellCheckEnabled}\n maxImageWidth={maxImageWidth && maxImageWidth.prompt}\n maxImageHeight={maxImageHeight && maxImageHeight.prompt}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n />\n {promptError && <div className={classes.errorText}>{promptError}</div>}\n </InputContainer>\n )}\n\n <GeneralConfigBlock\n model={model}\n configuration={configuration}\n onResponseTypeChange={this.onResponseTypeChange}\n onLayoutChange={this.onLayoutChange}\n />\n\n <AnswerConfigBlock\n model={model}\n configuration={configuration}\n imageSupport={imageSupport}\n onChange={this.onChange}\n onAddRow={this.onAddRow}\n onDeleteRow={this.onDeleteRow}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n uploadSoundSupport={uploadSoundSupport}\n />\n\n {rationaleEnabled && (\n <InputContainer label={rationale.label} className={classes.promptHolder}>\n <EditableHtml\n className={classes.prompt}\n markup={model.rationale || ''}\n onChange={this.onRationaleChanged}\n imageSupport={imageSupport}\n error={rationaleError}\n toolbarOpts={toolbarOpts}\n pluginProps={getPluginProps(rationale?.inputConfiguration, baseInputConfiguration)}\n spellCheck={spellCheckEnabled}\n maxImageWidth={(maxImageWidth && maxImageWidth.rationale) || defaultImageMaxWidth}\n maxImageHeight={(maxImageHeight && maxImageHeight.rationale) || defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n />\n {rationaleError && <div className={classes.errorText}>{rationaleError}</div>}\n </InputContainer>\n )}\n\n {feedbackEnabled && (\n <FeedbackConfig feedback={model.feedback} onChange={this.onFeedbackChange} toolbarOpts={toolbarOpts} />\n )}\n <AlertDialog\n open={dialog.open}\n title=\"Warning\"\n text={dialog.text}\n onConfirm={() => this.setState({ dialog: { open: false } })}\n />\n </layout.ConfigLayout>\n );\n }\n}\n\nexport const Config = Configure;\n\nexport default withDragContext(withStyles(styles)(Configure));\n"],"file":"configure.js"}