@pie-element/match 7.1.2-next.1 → 7.1.2-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,481 @@
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
+ };
68
+ };
69
+
70
+ var Configure = /*#__PURE__*/function (_React$Component) {
71
+ (0, _inherits2["default"])(Configure, _React$Component);
72
+
73
+ var _super = _createSuper(Configure);
74
+
75
+ function Configure(props) {
76
+ var _this;
77
+
78
+ (0, _classCallCheck2["default"])(this, Configure);
79
+ _this = _super.call(this, props);
80
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onTabChange", function (event, value) {
81
+ _this.setState({
82
+ activeTab: value
83
+ });
84
+ });
85
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onChangeTabIndex", function (index) {
86
+ _this.setState({
87
+ activeTab: index
88
+ });
89
+ });
90
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onChange", function (model) {
91
+ _this.props.onModelChanged(model);
92
+ });
93
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onFeedbackChange", function (feedback) {
94
+ var _this$props = _this.props,
95
+ model = _this$props.model,
96
+ onModelChanged = _this$props.onModelChanged;
97
+ model.feedback = feedback;
98
+ onModelChanged(model);
99
+ });
100
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onDeleteRow", function (rowIndex) {
101
+ var model = _this.props.model;
102
+
103
+ var newModel = _objectSpread({}, model);
104
+
105
+ newModel.rows.splice(rowIndex, 1);
106
+
107
+ _this.onChange(newModel);
108
+ });
109
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onAddRow", function () {
110
+ var _this$props2 = _this.props,
111
+ model = _this$props2.model,
112
+ configuration = _this$props2.configuration;
113
+
114
+ var newModel = _objectSpread({}, model);
115
+
116
+ var _ref = configuration || {},
117
+ maxQuestions = _ref.maxQuestions;
118
+
119
+ if (maxQuestions && (newModel.rows || []).length >= maxQuestions) {
120
+ _this.setState({
121
+ dialog: {
122
+ open: true,
123
+ text: "There can be maximum ".concat(maxQuestions, " question row") + (maxQuestions > 1 ? 's' : '') + '.'
124
+ }
125
+ });
126
+
127
+ return;
128
+ }
129
+
130
+ newModel.rows = newModel.rows.concat({
131
+ id: _this.rowIdCounter + 1,
132
+ title: "Question Text ".concat((newModel.rows || []).length + 1),
133
+ values: new Array(model.layout - 1).fill(false)
134
+ });
135
+ _this.rowIdCounter += 1;
136
+
137
+ _this.onChange(newModel);
138
+ });
139
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onLayoutChange", function (newLayout) {
140
+ var model = _this.props.model;
141
+ var oldLayout = model.layout;
142
+
143
+ var newModel = _objectSpread({}, model);
144
+
145
+ if (newLayout > oldLayout) {
146
+ for (var i = 0; i < newLayout - oldLayout; i++) {
147
+ newModel.headers.push("Column ".concat(newModel.headers.length + 1));
148
+ }
149
+
150
+ newModel.rows.forEach(function (row) {
151
+ for (var _i = 0; _i < newLayout - oldLayout; _i++) {
152
+ row.values.push(false);
153
+ }
154
+ });
155
+ } else if (newLayout < oldLayout) {
156
+ newModel.headers.splice(newLayout);
157
+ newModel.rows.forEach(function (row) {
158
+ row.values.splice(newLayout - 1);
159
+ });
160
+ }
161
+
162
+ newModel.layout = newLayout;
163
+
164
+ _this.onChange(newModel);
165
+ });
166
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onResponseTypeChange", function (newChoiceMode) {
167
+ var model = _this.props.model;
168
+
169
+ var newModel = _objectSpread({}, model); // if we're switching to radio and we have more than one true, reset
170
+
171
+
172
+ if (newChoiceMode === 'radio') {
173
+ newModel.rows.forEach(function (row) {
174
+ var trueCount = row.values.reduce(function (total, current) {
175
+ return current === true ? total + 1 : total;
176
+ });
177
+
178
+ if (trueCount > 1) {
179
+ row.values = new Array(model.layout - 1).fill(false);
180
+ }
181
+ });
182
+ }
183
+
184
+ newModel.choiceMode = newChoiceMode;
185
+
186
+ _this.onChange(newModel);
187
+ });
188
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onPartialScoringChange", function (partialScoring) {
189
+ _this.props.model.partialScoring = partialScoring;
190
+
191
+ _this.props.onModelChanged(_this.props.model);
192
+ });
193
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onPromptChanged", function (prompt) {
194
+ _this.props.onModelChanged(_objectSpread(_objectSpread({}, _this.props.model), {}, {
195
+ prompt: prompt
196
+ }));
197
+ });
198
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onTeacherInstructionsChanged", function (teacherInstructions) {
199
+ _this.props.onModelChanged(_objectSpread(_objectSpread({}, _this.props.model), {}, {
200
+ teacherInstructions: teacherInstructions
201
+ }));
202
+ });
203
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onRationaleChanged", function (rationale) {
204
+ _this.props.onModelChanged(_objectSpread(_objectSpread({}, _this.props.model), {}, {
205
+ rationale: rationale
206
+ }));
207
+ });
208
+ var maxId = 0;
209
+
210
+ if (props.model.rows && props.model.rows.length > 0) {
211
+ maxId = Math.max.apply(Math, (0, _toConsumableArray2["default"])(props.model.rows.map(function (row) {
212
+ return row.id;
213
+ })));
214
+ }
215
+
216
+ _this.rowIdCounter = maxId + 1;
217
+ _this.state = {
218
+ activeTab: 0,
219
+ dialog: {
220
+ open: false,
221
+ text: ''
222
+ }
223
+ };
224
+ return _this;
225
+ }
226
+
227
+ (0, _createClass2["default"])(Configure, [{
228
+ key: "componentDidMount",
229
+ value: function componentDidMount() {
230
+ var _this$validateRowsID = this.validateRowsID(this.props.model.rows),
231
+ updatedRows = _this$validateRowsID.updatedRows,
232
+ wasChanged = _this$validateRowsID.wasChanged;
233
+
234
+ if (wasChanged) {
235
+ var newModel = _objectSpread(_objectSpread({}, this.props.model), {}, {
236
+ rows: updatedRows
237
+ });
238
+
239
+ this.props.onModelChanged(newModel);
240
+ }
241
+ }
242
+ }, {
243
+ key: "validateRowsID",
244
+ value: function validateRowsID(rows) {
245
+ var wasChanged = false;
246
+ var updatedRows = (rows || []).map(function (row, index) {
247
+ if (row.id !== index + 1) {
248
+ wasChanged = true;
249
+ return _objectSpread(_objectSpread({}, row), {}, {
250
+ id: index + 1
251
+ });
252
+ }
253
+
254
+ return row;
255
+ });
256
+ return {
257
+ updatedRows: updatedRows,
258
+ wasChanged: wasChanged
259
+ };
260
+ }
261
+ }, {
262
+ key: "render",
263
+ value: function render() {
264
+ var _this2 = this;
265
+
266
+ var _this$props3 = this.props,
267
+ classes = _this$props3.classes,
268
+ model = _this$props3.model,
269
+ imageSupport = _this$props3.imageSupport,
270
+ onModelChanged = _this$props3.onModelChanged,
271
+ configuration = _this$props3.configuration,
272
+ onConfigurationChanged = _this$props3.onConfigurationChanged,
273
+ uploadSoundSupport = _this$props3.uploadSoundSupport;
274
+
275
+ var _ref2 = configuration || {},
276
+ _ref2$baseInputConfig = _ref2.baseInputConfiguration,
277
+ baseInputConfiguration = _ref2$baseInputConfig === void 0 ? {} : _ref2$baseInputConfig,
278
+ _ref2$contentDimensio = _ref2.contentDimensions,
279
+ contentDimensions = _ref2$contentDimensio === void 0 ? {} : _ref2$contentDimensio,
280
+ _ref2$enableImages = _ref2.enableImages,
281
+ enableImages = _ref2$enableImages === void 0 ? {} : _ref2$enableImages,
282
+ _ref2$feedback = _ref2.feedback,
283
+ feedback = _ref2$feedback === void 0 ? {} : _ref2$feedback,
284
+ _ref2$lockChoiceOrder = _ref2.lockChoiceOrder,
285
+ lockChoiceOrder = _ref2$lockChoiceOrder === void 0 ? {} : _ref2$lockChoiceOrder,
286
+ _ref2$maxImageWidth = _ref2.maxImageWidth,
287
+ maxImageWidth = _ref2$maxImageWidth === void 0 ? {} : _ref2$maxImageWidth,
288
+ _ref2$maxImageHeight = _ref2.maxImageHeight,
289
+ maxImageHeight = _ref2$maxImageHeight === void 0 ? {} : _ref2$maxImageHeight,
290
+ _ref2$partialScoring = _ref2.partialScoring,
291
+ partialScoring = _ref2$partialScoring === void 0 ? {} : _ref2$partialScoring,
292
+ _ref2$prompt = _ref2.prompt,
293
+ prompt = _ref2$prompt === void 0 ? {} : _ref2$prompt,
294
+ _ref2$rationale = _ref2.rationale,
295
+ rationale = _ref2$rationale === void 0 ? {} : _ref2$rationale,
296
+ settingsPanelDisabled = _ref2.settingsPanelDisabled,
297
+ _ref2$scoringType = _ref2.scoringType,
298
+ scoringType = _ref2$scoringType === void 0 ? {} : _ref2$scoringType,
299
+ _ref2$spellCheck = _ref2.spellCheck,
300
+ spellCheck = _ref2$spellCheck === void 0 ? {} : _ref2$spellCheck,
301
+ _ref2$studentInstruct = _ref2.studentInstructions,
302
+ studentInstructions = _ref2$studentInstruct === void 0 ? {} : _ref2$studentInstruct,
303
+ _ref2$teacherInstruct = _ref2.teacherInstructions,
304
+ teacherInstructions = _ref2$teacherInstruct === void 0 ? {} : _ref2$teacherInstruct,
305
+ _ref2$withRubric = _ref2.withRubric,
306
+ withRubric = _ref2$withRubric === void 0 ? {} : _ref2$withRubric,
307
+ _ref2$language = _ref2.language,
308
+ language = _ref2$language === void 0 ? {} : _ref2$language,
309
+ _ref2$languageChoices = _ref2.languageChoices,
310
+ languageChoices = _ref2$languageChoices === void 0 ? {} : _ref2$languageChoices;
311
+
312
+ var _ref3 = model || {},
313
+ feedbackEnabled = _ref3.feedbackEnabled,
314
+ promptEnabled = _ref3.promptEnabled,
315
+ rationaleEnabled = _ref3.rationaleEnabled,
316
+ spellCheckEnabled = _ref3.spellCheckEnabled,
317
+ teacherInstructionsEnabled = _ref3.teacherInstructionsEnabled,
318
+ toolbarEditorPosition = _ref3.toolbarEditorPosition;
319
+
320
+ var dialog = this.state.dialog;
321
+ var toolbarOpts = {
322
+ position: toolbarEditorPosition === 'top' ? 'top' : 'bottom'
323
+ };
324
+ var defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;
325
+ var defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;
326
+ var panelSettings = {
327
+ enableImages: enableImages.settings && toggle(enableImages.label),
328
+ partialScoring: partialScoring.settings && toggle(partialScoring.label),
329
+ lockChoiceOrder: lockChoiceOrder.settings && toggle(lockChoiceOrder.label),
330
+ feedbackEnabled: feedback.settings && toggle(feedback.label),
331
+ 'language.enabled': language.settings && toggle(language.label, true),
332
+ language: language.settings && language.enabled && dropdown(languageChoices.label, languageChoices.options)
333
+ };
334
+ var panelProperties = {
335
+ teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),
336
+ studentInstructionsEnabled: studentInstructions.settings && toggle(studentInstructions.label),
337
+ promptEnabled: prompt.settings && toggle(prompt.label),
338
+ rationaleEnabled: rationale.settings && toggle(rationale.label),
339
+ spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),
340
+ scoringType: scoringType.settings && radio(scoringType.label, ['auto', 'rubric']),
341
+ rubricEnabled: (withRubric === null || withRubric === void 0 ? void 0 : withRubric.settings) && toggle(withRubric === null || withRubric === void 0 ? void 0 : withRubric.label)
342
+ };
343
+ log('[render] model', model);
344
+ return /*#__PURE__*/_react["default"].createElement(_configUi.layout.ConfigLayout, {
345
+ dimensions: contentDimensions,
346
+ hideSettings: settingsPanelDisabled,
347
+ settings: /*#__PURE__*/_react["default"].createElement(Panel, {
348
+ model: model,
349
+ configuration: configuration,
350
+ onChangeModel: function onChangeModel(model) {
351
+ return onModelChanged(model);
352
+ },
353
+ onChangeConfiguration: function onChangeConfiguration(config) {
354
+ return onConfigurationChanged(config);
355
+ },
356
+ groups: {
357
+ Settings: panelSettings,
358
+ Properties: panelProperties
359
+ }
360
+ })
361
+ }, teacherInstructionsEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
362
+ label: teacherInstructions.label,
363
+ className: classes.promptHolder
364
+ }, /*#__PURE__*/_react["default"].createElement(_editableHtml.EditableHtml, {
365
+ className: classes.prompt,
366
+ markup: model.teacherInstructions || '',
367
+ onChange: this.onTeacherInstructionsChanged,
368
+ imageSupport: imageSupport,
369
+ nonEmpty: false,
370
+ toolbarOpts: toolbarOpts,
371
+ pluginProps: (0, _utils.getPluginProps)(teacherInstructions === null || teacherInstructions === void 0 ? void 0 : teacherInstructions.inputConfiguration, baseInputConfiguration),
372
+ spellCheck: spellCheckEnabled,
373
+ maxImageWidth: maxImageWidth && maxImageWidth.teacherInstructions || defaultImageMaxWidth,
374
+ maxImageHeight: maxImageHeight && maxImageHeight.teacherInstructions || defaultImageMaxHeight,
375
+ uploadSoundSupport: uploadSoundSupport,
376
+ languageCharactersProps: [{
377
+ language: 'spanish'
378
+ }, {
379
+ language: 'special'
380
+ }]
381
+ })), promptEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
382
+ label: prompt.label,
383
+ className: classes.promptHolder
384
+ }, /*#__PURE__*/_react["default"].createElement(_editableHtml.EditableHtml, {
385
+ className: classes.prompt,
386
+ markup: model.prompt,
387
+ onChange: this.onPromptChanged,
388
+ imageSupport: imageSupport,
389
+ nonEmpty: false,
390
+ disableUnderline: true,
391
+ toolbarOpts: toolbarOpts,
392
+ pluginProps: (0, _utils.getPluginProps)(prompt === null || prompt === void 0 ? void 0 : prompt.inputConfiguration, baseInputConfiguration),
393
+ spellCheck: spellCheckEnabled,
394
+ maxImageWidth: maxImageWidth && maxImageWidth.prompt,
395
+ maxImageHeight: maxImageHeight && maxImageHeight.prompt,
396
+ uploadSoundSupport: uploadSoundSupport,
397
+ languageCharactersProps: [{
398
+ language: 'spanish'
399
+ }, {
400
+ language: 'special'
401
+ }]
402
+ })), /*#__PURE__*/_react["default"].createElement(_generalConfigBlock["default"], {
403
+ model: model,
404
+ configuration: configuration,
405
+ onResponseTypeChange: this.onResponseTypeChange,
406
+ onLayoutChange: this.onLayoutChange
407
+ }), /*#__PURE__*/_react["default"].createElement(_answerConfigBlock["default"], {
408
+ model: model,
409
+ configuration: configuration,
410
+ imageSupport: imageSupport,
411
+ onChange: this.onChange,
412
+ onAddRow: this.onAddRow,
413
+ onDeleteRow: this.onDeleteRow,
414
+ toolbarOpts: toolbarOpts,
415
+ spellCheck: spellCheckEnabled,
416
+ uploadSoundSupport: uploadSoundSupport
417
+ }), rationaleEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
418
+ label: rationale.label,
419
+ className: classes.promptHolder
420
+ }, /*#__PURE__*/_react["default"].createElement(_editableHtml.EditableHtml, {
421
+ className: classes.prompt,
422
+ markup: model.rationale || '',
423
+ onChange: this.onRationaleChanged,
424
+ imageSupport: imageSupport,
425
+ toolbarOpts: toolbarOpts,
426
+ pluginProps: (0, _utils.getPluginProps)(rationale === null || rationale === void 0 ? void 0 : rationale.inputConfiguration, baseInputConfiguration),
427
+ spellCheck: spellCheckEnabled,
428
+ maxImageWidth: maxImageWidth && maxImageWidth.rationale || defaultImageMaxWidth,
429
+ maxImageHeight: maxImageHeight && maxImageHeight.rationale || defaultImageMaxHeight,
430
+ uploadSoundSupport: uploadSoundSupport,
431
+ languageCharactersProps: [{
432
+ language: 'spanish'
433
+ }, {
434
+ language: 'special'
435
+ }]
436
+ })), feedbackEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.FeedbackConfig, {
437
+ feedback: model.feedback,
438
+ onChange: this.onFeedbackChange,
439
+ toolbarOpts: toolbarOpts
440
+ }), /*#__PURE__*/_react["default"].createElement(_configUi.AlertDialog, {
441
+ open: dialog.open,
442
+ title: "Warning",
443
+ text: dialog.text,
444
+ onConfirm: function onConfirm() {
445
+ return _this2.setState({
446
+ dialog: {
447
+ open: false
448
+ }
449
+ });
450
+ }
451
+ }));
452
+ }
453
+ }]);
454
+ return Configure;
455
+ }(_react["default"].Component);
456
+
457
+ (0, _defineProperty2["default"])(Configure, "propTypes", {
458
+ onModelChanged: _propTypes["default"].func,
459
+ onConfigurationChanged: _propTypes["default"].func,
460
+ classes: _propTypes["default"].object,
461
+ model: _propTypes["default"].object.isRequired,
462
+ configuration: _propTypes["default"].object.isRequired,
463
+ imageSupport: _propTypes["default"].shape({
464
+ add: _propTypes["default"].func.isRequired,
465
+ "delete": _propTypes["default"].func.isRequired
466
+ }),
467
+ uploadSoundSupport: _propTypes["default"].shape({
468
+ add: _propTypes["default"].func.isRequired,
469
+ "delete": _propTypes["default"].func.isRequired
470
+ })
471
+ });
472
+ (0, _defineProperty2["default"])(Configure, "defaultProps", {
473
+ classes: {}
474
+ });
475
+ var Config = Configure;
476
+ exports.Config = Config;
477
+
478
+ var _default = (0, _drag.withDragContext)((0, _styles.withStyles)(styles)(Configure));
479
+
480
+ exports["default"] = _default;
481
+ //# sourceMappingURL=configure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/configure.jsx"],"names":["log","Panel","settings","toggle","radio","dropdown","styles","theme","promptHolder","width","paddingTop","spacing","unit","marginBottom","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","feedbackEnabled","promptEnabled","rationaleEnabled","spellCheckEnabled","teacherInstructionsEnabled","toolbarEditorPosition","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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AAA,MAAM,EAAE;AAAEC,cAAAA,IAAI,EAAE;AAAR;AAAV,WAAd,CAAN;AAAA;AAJb,QA/FF,CADF;AAwGD;;;EA9VqBiF,kBAAMC,S;;iCAAxBrG,S,eACe;AACjBQ,EAAAA,cAAc,EAAE8F,sBAAUC,IADT;AAEjB/C,EAAAA,sBAAsB,EAAE8C,sBAAUC,IAFjB;AAGjBjD,EAAAA,OAAO,EAAEgD,sBAAUE,MAHF;AAIjBjG,EAAAA,KAAK,EAAE+F,sBAAUE,MAAV,CAAiBC,UAJP;AAKjB1F,EAAAA,aAAa,EAAEuF,sBAAUE,MAAV,CAAiBC,UALf;AAMjBlD,EAAAA,YAAY,EAAE+C,sBAAUI,KAAV,CAAgB;AAC5BC,IAAAA,GAAG,EAAEL,sBAAUC,IAAV,CAAeE,UADQ;AAE5B,cAAQH,sBAAUC,IAAV,CAAeE;AAFK,GAAhB,CANG;AAUjBhD,EAAAA,kBAAkB,EAAE6C,sBAAUI,KAAV,CAAgB;AAClCC,IAAAA,GAAG,EAAEL,sBAAUC,IAAV,CAAeE,UADc;AAElC,cAAQH,sBAAUC,IAAV,CAAeE;AAFW,GAAhB;AAVH,C;iCADfzG,S,kBAiBkB;AACpBsD,EAAAA,OAAO,EAAE;AADW,C;AAgVjB,IAAMsD,MAAM,GAAG5G,SAAf;;;eAEQ,2BAAgB,wBAAWR,MAAX,EAAmBQ,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});\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 feedbackEnabled,\n promptEnabled,\n rationaleEnabled,\n spellCheckEnabled,\n teacherInstructionsEnabled,\n toolbarEditorPosition,\n } = model || {};\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 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 </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 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 </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 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 </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"}