@pie-element/ebsr 7.0.24-next.2 → 7.0.26
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 +48 -0
- package/{configure/node_modules/@pie-element/multiple-choice/LICENSE.md → LICENSE.md} +0 -0
- package/configure/CHANGELOG.md +48 -0
- package/configure/package.json +3 -3
- package/controller/CHANGELOG.md +8 -0
- package/controller/package.json +1 -1
- package/package.json +3 -3
- package/configure/node_modules/@pie-element/multiple-choice/CHANGELOG.json +0 -1972
- package/configure/node_modules/@pie-element/multiple-choice/CHANGELOG.md +0 -1793
- package/configure/node_modules/@pie-element/multiple-choice/PRINT.md +0 -35
- package/configure/node_modules/@pie-element/multiple-choice/README.md +0 -56
- package/configure/node_modules/@pie-element/multiple-choice/choice.png +0 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/CHANGELOG.json +0 -1387
- package/configure/node_modules/@pie-element/multiple-choice/configure/CHANGELOG.md +0 -1334
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/defaults.js +0 -104
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/defaults.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/index.js +0 -198
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/index.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/main.js +0 -599
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/main.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/utils.js +0 -18
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/utils.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/configure/package.json +0 -20
- package/configure/node_modules/@pie-element/multiple-choice/controller/CHANGELOG.json +0 -527
- package/configure/node_modules/@pie-element/multiple-choice/controller/CHANGELOG.md +0 -768
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/defaults.js +0 -18
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/defaults.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/index.js +0 -305
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/index.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/utils.js +0 -36
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/utils.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/controller/package.json +0 -15
- package/configure/node_modules/@pie-element/multiple-choice/docs/config-schema.json +0 -353
- package/configure/node_modules/@pie-element/multiple-choice/docs/config-schema.json.md +0 -277
- package/configure/node_modules/@pie-element/multiple-choice/docs/demo/config.js +0 -8
- package/configure/node_modules/@pie-element/multiple-choice/docs/demo/generate.js +0 -52
- package/configure/node_modules/@pie-element/multiple-choice/docs/demo/index.html +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/docs/demo/session.js +0 -7
- package/configure/node_modules/@pie-element/multiple-choice/docs/pie-schema.json +0 -338
- package/configure/node_modules/@pie-element/multiple-choice/docs/pie-schema.json.md +0 -274
- package/configure/node_modules/@pie-element/multiple-choice/lib/choice-input.js +0 -298
- package/configure/node_modules/@pie-element/multiple-choice/lib/choice-input.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/lib/choice.js +0 -157
- package/configure/node_modules/@pie-element/multiple-choice/lib/choice.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/lib/feedback-tick.js +0 -174
- package/configure/node_modules/@pie-element/multiple-choice/lib/feedback-tick.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/lib/index.js +0 -151
- package/configure/node_modules/@pie-element/multiple-choice/lib/index.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/lib/main.js +0 -97
- package/configure/node_modules/@pie-element/multiple-choice/lib/main.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/lib/multiple-choice.js +0 -254
- package/configure/node_modules/@pie-element/multiple-choice/lib/multiple-choice.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/lib/print.js +0 -129
- package/configure/node_modules/@pie-element/multiple-choice/lib/print.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/lib/session-updater.js +0 -35
- package/configure/node_modules/@pie-element/multiple-choice/lib/session-updater.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/module/configure.js +0 -843
- package/configure/node_modules/@pie-element/multiple-choice/module/controller.js +0 -20686
- package/configure/node_modules/@pie-element/multiple-choice/module/demo.js +0 -77
- package/configure/node_modules/@pie-element/multiple-choice/module/element.js +0 -2019
- package/configure/node_modules/@pie-element/multiple-choice/module/index.html +0 -21
- package/configure/node_modules/@pie-element/multiple-choice/module/manifest.json +0 -14
- package/configure/node_modules/@pie-element/multiple-choice/module/print-demo.js +0 -115
- package/configure/node_modules/@pie-element/multiple-choice/module/print.html +0 -18
- package/configure/node_modules/@pie-element/multiple-choice/module/print.js +0 -1983
- package/configure/node_modules/@pie-element/multiple-choice/package.json +0 -34
- package/configure/node_modules/@pie-lib/math-rendering/CHANGELOG.json +0 -672
- package/configure/node_modules/@pie-lib/math-rendering/CHANGELOG.md +0 -427
- package/configure/node_modules/@pie-lib/math-rendering/LICENSE.md +0 -5
- package/configure/node_modules/@pie-lib/math-rendering/lib/index.js +0 -30
- package/configure/node_modules/@pie-lib/math-rendering/lib/index.js.map +0 -1
- package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/chtml.js +0 -316
- package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/chtml.js.map +0 -1
- package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/index.js +0 -23
- package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/index.js.map +0 -1
- package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/mml.js +0 -123
- package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/mml.js.map +0 -1
- package/configure/node_modules/@pie-lib/math-rendering/lib/normalization.js +0 -103
- package/configure/node_modules/@pie-lib/math-rendering/lib/normalization.js.map +0 -1
- package/configure/node_modules/@pie-lib/math-rendering/lib/render-math.js +0 -275
- package/configure/node_modules/@pie-lib/math-rendering/lib/render-math.js.map +0 -1
- package/configure/node_modules/@pie-lib/math-rendering/package.json +0 -19
- package/configure/node_modules/@pie-lib/math-rendering/playground/demo.html +0 -872
- package/configure/node_modules/@pie-lib/math-rendering/playground/demo.js +0 -108
- package/configure/node_modules/@pie-lib/math-rendering/playground/main.html +0 -156
- package/configure/node_modules/@pie-lib/math-rendering/playground/main.js +0 -16
- package/configure/node_modules/@pie-lib/math-rendering/playground/webpack.config.js +0 -29
- package/configure/node_modules/@pie-lib/math-rendering/src/index.js +0 -4
- package/configure/node_modules/@pie-lib/math-rendering/src/mstack/chtml.js +0 -215
- package/configure/node_modules/@pie-lib/math-rendering/src/mstack/index.js +0 -13
- package/configure/node_modules/@pie-lib/math-rendering/src/mstack/mml.js +0 -24
- package/configure/node_modules/@pie-lib/math-rendering/src/normalization.js +0 -69
- package/configure/node_modules/@pie-lib/math-rendering/src/render-math.js +0 -234
- package/configure/node_modules/@pie-lib/render-ui/CHANGELOG.json +0 -937
- package/configure/node_modules/@pie-lib/render-ui/CHANGELOG.md +0 -602
- package/configure/node_modules/@pie-lib/render-ui/LICENSE.md +0 -5
- package/configure/node_modules/@pie-lib/render-ui/README.md +0 -33
- package/configure/node_modules/@pie-lib/render-ui/lib/collapsible/index.js +0 -146
- package/configure/node_modules/@pie-lib/render-ui/lib/collapsible/index.js.map +0 -1
- package/configure/node_modules/@pie-lib/render-ui/lib/color.js +0 -134
- package/configure/node_modules/@pie-lib/render-ui/lib/color.js.map +0 -1
- package/configure/node_modules/@pie-lib/render-ui/lib/feedback.js +0 -160
- package/configure/node_modules/@pie-lib/render-ui/lib/feedback.js.map +0 -1
- package/configure/node_modules/@pie-lib/render-ui/lib/has-text.js +0 -24
- package/configure/node_modules/@pie-lib/render-ui/lib/has-text.js.map +0 -1
- package/configure/node_modules/@pie-lib/render-ui/lib/html-and-math.js +0 -102
- package/configure/node_modules/@pie-lib/render-ui/lib/html-and-math.js.map +0 -1
- package/configure/node_modules/@pie-lib/render-ui/lib/index.js +0 -104
- package/configure/node_modules/@pie-lib/render-ui/lib/index.js.map +0 -1
- package/configure/node_modules/@pie-lib/render-ui/lib/input-container.js +0 -60
- package/configure/node_modules/@pie-lib/render-ui/lib/input-container.js.map +0 -1
- package/configure/node_modules/@pie-lib/render-ui/lib/preview-layout.js +0 -133
- package/configure/node_modules/@pie-lib/render-ui/lib/preview-layout.js.map +0 -1
- package/configure/node_modules/@pie-lib/render-ui/lib/preview-prompt.js +0 -162
- package/configure/node_modules/@pie-lib/render-ui/lib/preview-prompt.js.map +0 -1
- package/configure/node_modules/@pie-lib/render-ui/lib/purpose.js +0 -28
- package/configure/node_modules/@pie-lib/render-ui/lib/purpose.js.map +0 -1
- package/configure/node_modules/@pie-lib/render-ui/lib/readable.js +0 -28
- package/configure/node_modules/@pie-lib/render-ui/lib/readable.js.map +0 -1
- package/configure/node_modules/@pie-lib/render-ui/lib/response-indicators.js +0 -160
- package/configure/node_modules/@pie-lib/render-ui/lib/response-indicators.js.map +0 -1
- package/configure/node_modules/@pie-lib/render-ui/lib/withUndoReset.js +0 -206
- package/configure/node_modules/@pie-lib/render-ui/lib/withUndoReset.js.map +0 -1
- package/configure/node_modules/@pie-lib/render-ui/package.json +0 -30
- package/configure/node_modules/@pie-lib/render-ui/src/collapsible/index.jsx +0 -68
- package/configure/node_modules/@pie-lib/render-ui/src/color.js +0 -48
- package/configure/node_modules/@pie-lib/render-ui/src/feedback.jsx +0 -100
- package/configure/node_modules/@pie-lib/render-ui/src/has-text.js +0 -14
- package/configure/node_modules/@pie-lib/render-ui/src/html-and-math.js +0 -40
- package/configure/node_modules/@pie-lib/render-ui/src/index.js +0 -27
- package/configure/node_modules/@pie-lib/render-ui/src/input-container.jsx +0 -41
- package/configure/node_modules/@pie-lib/render-ui/src/preview-layout.jsx +0 -77
- package/configure/node_modules/@pie-lib/render-ui/src/preview-prompt.jsx +0 -90
- package/configure/node_modules/@pie-lib/render-ui/src/purpose.jsx +0 -19
- package/configure/node_modules/@pie-lib/render-ui/src/readable.jsx +0 -19
- package/configure/node_modules/@pie-lib/render-ui/src/response-indicators.jsx +0 -89
- package/configure/node_modules/@pie-lib/render-ui/src/withUndoReset.jsx +0 -118
|
@@ -1,843 +0,0 @@
|
|
|
1
|
-
import {_dll_react, _dll_prop_types, _dll_material_ui__core_styles, _dll_material_ui__core, _dll_lodash, _dll_material_ui__icons, _dll_pie_lib__render_ui, _dll_debug, _dll_react_dom} from "../../../@pie-lib/shared-module@^1.4.17/module/index.js";
|
|
2
|
-
import {_dll_pie_lib__config_ui} from "../../../@pie-lib/config-module@^1.2.4/module/index.js";
|
|
3
|
-
import {_dll_pie_lib__editable_html} from "../../../@pie-lib/editable-html-module@^1.5.4/module/index.js";
|
|
4
|
-
var lib = {};
|
|
5
|
-
Object.defineProperty(lib, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
class ModelUpdatedEvent extends CustomEvent {
|
|
9
|
-
constructor(update, reset = false) {
|
|
10
|
-
super(ModelUpdatedEvent.TYPE, {
|
|
11
|
-
bubbles: true,
|
|
12
|
-
detail: {
|
|
13
|
-
update,
|
|
14
|
-
reset
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
this.update = update;
|
|
18
|
-
this.reset = reset;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
ModelUpdatedEvent.TYPE = 'model.updated';
|
|
22
|
-
var ModelUpdatedEvent_1 = lib.ModelUpdatedEvent = ModelUpdatedEvent;
|
|
23
|
-
class DeleteImageEvent extends CustomEvent {
|
|
24
|
-
constructor(src, done) {
|
|
25
|
-
super(DeleteImageEvent.TYPE, {
|
|
26
|
-
bubbles: true,
|
|
27
|
-
detail: {
|
|
28
|
-
src,
|
|
29
|
-
done
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
this.src = src;
|
|
33
|
-
this.done = done;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
DeleteImageEvent.TYPE = 'delete.image';
|
|
37
|
-
var DeleteImageEvent_1 = lib.DeleteImageEvent = DeleteImageEvent;
|
|
38
|
-
class InsertImageEvent extends CustomEvent {
|
|
39
|
-
constructor(handler) {
|
|
40
|
-
super(InsertImageEvent.TYPE, {
|
|
41
|
-
bubbles: true,
|
|
42
|
-
detail: handler
|
|
43
|
-
});
|
|
44
|
-
this.handler = handler;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
InsertImageEvent.TYPE = 'insert.image';
|
|
48
|
-
var InsertImageEvent_1 = lib.InsertImageEvent = InsertImageEvent;
|
|
49
|
-
const generateValidationMessage = config => {
|
|
50
|
-
const {minAnswerChoices, maxAnswerChoices} = config;
|
|
51
|
-
const answerChoicesMessage = `\nThere should be at least ${minAnswerChoices} ` + (maxAnswerChoices ? `and at most ${maxAnswerChoices} ` : '') + 'answer choices defined.' + '\nEvery answer choice should be non-blank and unique.';
|
|
52
|
-
const correctAnswerMessage = '\nA correct answer must be defined.';
|
|
53
|
-
const message = 'Validation requirements:' + answerChoicesMessage + correctAnswerMessage;
|
|
54
|
-
return message;
|
|
55
|
-
};
|
|
56
|
-
const React$1 = _dll_react;
|
|
57
|
-
const PropTypes = _dll_prop_types;
|
|
58
|
-
const {color: color} = _dll_pie_lib__render_ui;
|
|
59
|
-
const {withStyles: withStyles} = _dll_material_ui__core_styles;
|
|
60
|
-
const {Button: Button} = _dll_material_ui__core;
|
|
61
|
-
const {Tooltip: Tooltip} = _dll_material_ui__core;
|
|
62
|
-
const {Dialog: Dialog} = _dll_material_ui__core;
|
|
63
|
-
const {DialogTitle: DialogTitle} = _dll_material_ui__core;
|
|
64
|
-
const {DialogActions: DialogActions} = _dll_material_ui__core;
|
|
65
|
-
const {Typography: Typography} = _dll_material_ui__core;
|
|
66
|
-
const {merge: merge} = _dll_lodash;
|
|
67
|
-
const {Info: Info} = _dll_material_ui__icons;
|
|
68
|
-
const EditableHtml = _dll_pie_lib__editable_html;
|
|
69
|
-
const {InputContainer: InputContainer} = _dll_pie_lib__config_ui;
|
|
70
|
-
const {ChoiceConfiguration: ChoiceConfiguration} = _dll_pie_lib__config_ui;
|
|
71
|
-
const {settings: settings} = _dll_pie_lib__config_ui;
|
|
72
|
-
const {layout: layout} = _dll_pie_lib__config_ui;
|
|
73
|
-
const {choiceUtils: utils$1} = _dll_pie_lib__config_ui;
|
|
74
|
-
const _jsxFileName = "/home/circleci/repo/packages/multiple-choice/configure/src/main.jsx";
|
|
75
|
-
const {Panel, toggle, radio, dropdown} = settings;
|
|
76
|
-
const MAX_CHOICES = 9;
|
|
77
|
-
const styles = theme => ({
|
|
78
|
-
promptHolder: {
|
|
79
|
-
width: '100%',
|
|
80
|
-
paddingBottom: theme.spacing.unit * 2,
|
|
81
|
-
marginBottom: theme.spacing.unit * 2
|
|
82
|
-
},
|
|
83
|
-
prompt: {
|
|
84
|
-
paddingTop: theme.spacing.unit * 2,
|
|
85
|
-
width: '100%'
|
|
86
|
-
},
|
|
87
|
-
rationaleHolder: {
|
|
88
|
-
width: '70%'
|
|
89
|
-
},
|
|
90
|
-
accessibilityHolder: {
|
|
91
|
-
width: '70%'
|
|
92
|
-
},
|
|
93
|
-
rationale: {
|
|
94
|
-
paddingTop: theme.spacing.unit * 2
|
|
95
|
-
},
|
|
96
|
-
accessibility: {
|
|
97
|
-
paddingTop: theme.spacing.unit * 2
|
|
98
|
-
},
|
|
99
|
-
design: {
|
|
100
|
-
paddingTop: theme.spacing.unit * 3
|
|
101
|
-
},
|
|
102
|
-
choiceConfigurationHolder: {
|
|
103
|
-
display: 'flex',
|
|
104
|
-
flexDirection: 'column',
|
|
105
|
-
alignItems: 'center'
|
|
106
|
-
},
|
|
107
|
-
choiceConfiguration: {
|
|
108
|
-
width: '100%',
|
|
109
|
-
paddingTop: theme.spacing.unit * 2,
|
|
110
|
-
paddingBottom: theme.spacing.unit * 2
|
|
111
|
-
},
|
|
112
|
-
switchElement: {
|
|
113
|
-
justifyContent: 'space-between',
|
|
114
|
-
margin: 0
|
|
115
|
-
},
|
|
116
|
-
addButton: {
|
|
117
|
-
float: 'right'
|
|
118
|
-
},
|
|
119
|
-
disableButton: {
|
|
120
|
-
cursor: 'not-allowed',
|
|
121
|
-
pointerEvents: 'all',
|
|
122
|
-
backgroundColor: color.disabled(),
|
|
123
|
-
'&:hover': {
|
|
124
|
-
backgroundColor: color.disabled()
|
|
125
|
-
},
|
|
126
|
-
'&:focus': {
|
|
127
|
-
backgroundColor: color.disabled()
|
|
128
|
-
}
|
|
129
|
-
},
|
|
130
|
-
flexContainer: {
|
|
131
|
-
display: 'flex',
|
|
132
|
-
alignItems: 'center',
|
|
133
|
-
marginBottom: '5px'
|
|
134
|
-
},
|
|
135
|
-
titleText: {
|
|
136
|
-
fontFamily: 'Cerebri Sans',
|
|
137
|
-
fontSize: '18px',
|
|
138
|
-
lineHeight: '19px',
|
|
139
|
-
color: '#495B8F',
|
|
140
|
-
marginRight: '5px'
|
|
141
|
-
},
|
|
142
|
-
tooltip: {
|
|
143
|
-
fontSize: '12px',
|
|
144
|
-
whiteSpace: 'pre',
|
|
145
|
-
maxWidth: '500px'
|
|
146
|
-
},
|
|
147
|
-
errorText: {
|
|
148
|
-
fontSize: '12px',
|
|
149
|
-
color: 'red',
|
|
150
|
-
paddingTop: '5px'
|
|
151
|
-
}
|
|
152
|
-
});
|
|
153
|
-
const Design = withStyles(styles)(props => {
|
|
154
|
-
const {classes, model, configuration, onPromptChanged, onChoiceChanged, onRemoveChoice, onAddChoice, imageSupport, onChangeModel, onConfigurationChanged, onTeacherInstructionsChanged} = props;
|
|
155
|
-
const {prompt = {}, addChoiceButton = {}, feedback = {}, deleteChoice = {}, choiceMode = {}, choicePrefix = {}, partialScoring = {}, lockChoiceOrder = {}, teacherInstructions = {}, studentInstructions = {}, rationale = {}, accessibility = {}, scoringType = {}, sequentialChoiceLabels = {}, settingsPanelDisabled, choicesLayout, spellCheck = {}, gridColumns} = configuration || ({});
|
|
156
|
-
let {maxAnswerChoices} = configuration || ({});
|
|
157
|
-
const {limitChoicesNumber, teacherInstructionsEnabled, rationaleEnabled, accessibilityLabelsEnabled, feedbackEnabled, promptEnabled, spellCheckEnabled, choices, errors} = model || ({});
|
|
158
|
-
const {choicesErrors, correctResponseError, answerChoicesError} = errors || ({});
|
|
159
|
-
const nrOfColumnsAvailable = choices && choices.length ? Array.from({
|
|
160
|
-
length: choices.length
|
|
161
|
-
}, (_, i) => `${i + 1}`) : [];
|
|
162
|
-
const labelPlugins = {
|
|
163
|
-
audio: {
|
|
164
|
-
disabled: true
|
|
165
|
-
},
|
|
166
|
-
video: {
|
|
167
|
-
disabled: true
|
|
168
|
-
}
|
|
169
|
-
};
|
|
170
|
-
const toolbarOpts = {};
|
|
171
|
-
switch (model.toolbarEditorPosition) {
|
|
172
|
-
case 'top':
|
|
173
|
-
toolbarOpts.position = 'top';
|
|
174
|
-
break;
|
|
175
|
-
default:
|
|
176
|
-
toolbarOpts.position = 'bottom';
|
|
177
|
-
break;
|
|
178
|
-
}
|
|
179
|
-
if (limitChoicesNumber) {
|
|
180
|
-
maxAnswerChoices = MAX_CHOICES;
|
|
181
|
-
}
|
|
182
|
-
const validationMessage = generateValidationMessage(configuration);
|
|
183
|
-
const Content = React$1.createElement('div', {
|
|
184
|
-
__self: undefined,
|
|
185
|
-
__source: {
|
|
186
|
-
fileName: _jsxFileName,
|
|
187
|
-
lineNumber: 180
|
|
188
|
-
}
|
|
189
|
-
}, teacherInstructionsEnabled && React$1.createElement(InputContainer, {
|
|
190
|
-
label: teacherInstructions.label,
|
|
191
|
-
className: classes.promptHolder,
|
|
192
|
-
__self: undefined,
|
|
193
|
-
__source: {
|
|
194
|
-
fileName: _jsxFileName,
|
|
195
|
-
lineNumber: 182
|
|
196
|
-
}
|
|
197
|
-
}, React$1.createElement(EditableHtml, {
|
|
198
|
-
className: classes.prompt,
|
|
199
|
-
markup: model.teacherInstructions || '',
|
|
200
|
-
onChange: onTeacherInstructionsChanged,
|
|
201
|
-
imageSupport: imageSupport,
|
|
202
|
-
nonEmpty: false,
|
|
203
|
-
toolbarOpts: toolbarOpts,
|
|
204
|
-
spellCheck: spellCheckEnabled,
|
|
205
|
-
__self: undefined,
|
|
206
|
-
__source: {
|
|
207
|
-
fileName: _jsxFileName,
|
|
208
|
-
lineNumber: 186
|
|
209
|
-
}
|
|
210
|
-
})), promptEnabled && React$1.createElement(InputContainer, {
|
|
211
|
-
label: prompt.label,
|
|
212
|
-
className: classes.promptHolder,
|
|
213
|
-
__self: undefined,
|
|
214
|
-
__source: {
|
|
215
|
-
fileName: _jsxFileName,
|
|
216
|
-
lineNumber: 199
|
|
217
|
-
}
|
|
218
|
-
}, React$1.createElement(EditableHtml, {
|
|
219
|
-
className: classes.prompt,
|
|
220
|
-
markup: model.prompt,
|
|
221
|
-
onChange: onPromptChanged,
|
|
222
|
-
imageSupport: imageSupport,
|
|
223
|
-
nonEmpty: false,
|
|
224
|
-
disableUnderline: true,
|
|
225
|
-
toolbarOpts: toolbarOpts,
|
|
226
|
-
spellCheck: spellCheckEnabled,
|
|
227
|
-
__self: undefined,
|
|
228
|
-
__source: {
|
|
229
|
-
fileName: _jsxFileName,
|
|
230
|
-
lineNumber: 200
|
|
231
|
-
}
|
|
232
|
-
})), React$1.createElement('div', {
|
|
233
|
-
className: classes.flexContainer,
|
|
234
|
-
__self: undefined,
|
|
235
|
-
__source: {
|
|
236
|
-
fileName: _jsxFileName,
|
|
237
|
-
lineNumber: 212
|
|
238
|
-
}
|
|
239
|
-
}, React$1.createElement(Typography, {
|
|
240
|
-
className: classes.titleText,
|
|
241
|
-
__self: undefined,
|
|
242
|
-
__source: {
|
|
243
|
-
fileName: _jsxFileName,
|
|
244
|
-
lineNumber: 213
|
|
245
|
-
}
|
|
246
|
-
}, "Choices"), React$1.createElement(Tooltip, {
|
|
247
|
-
classes: {
|
|
248
|
-
tooltip: classes.tooltip
|
|
249
|
-
},
|
|
250
|
-
disableFocusListener: true,
|
|
251
|
-
disableTouchListener: true,
|
|
252
|
-
placement: 'right',
|
|
253
|
-
title: validationMessage,
|
|
254
|
-
__self: undefined,
|
|
255
|
-
__source: {
|
|
256
|
-
fileName: _jsxFileName,
|
|
257
|
-
lineNumber: 214
|
|
258
|
-
}
|
|
259
|
-
}, React$1.createElement(Info, {
|
|
260
|
-
fontSize: 'small',
|
|
261
|
-
color: 'primary',
|
|
262
|
-
__self: undefined,
|
|
263
|
-
__source: {
|
|
264
|
-
fileName: _jsxFileName,
|
|
265
|
-
lineNumber: 221
|
|
266
|
-
}
|
|
267
|
-
}))), correctResponseError && React$1.createElement('div', {
|
|
268
|
-
className: classes.errorText,
|
|
269
|
-
__self: undefined,
|
|
270
|
-
__source: {
|
|
271
|
-
fileName: _jsxFileName,
|
|
272
|
-
lineNumber: 224
|
|
273
|
-
}
|
|
274
|
-
}, correctResponseError), answerChoicesError && React$1.createElement('div', {
|
|
275
|
-
className: classes.errorText,
|
|
276
|
-
__self: undefined,
|
|
277
|
-
__source: {
|
|
278
|
-
fileName: _jsxFileName,
|
|
279
|
-
lineNumber: 225
|
|
280
|
-
}
|
|
281
|
-
}, answerChoicesError), choices.map((choice, index) => React$1.createElement('div', {
|
|
282
|
-
key: `choice-${index}`,
|
|
283
|
-
className: classes.choiceConfigurationHolder,
|
|
284
|
-
__self: undefined,
|
|
285
|
-
__source: {
|
|
286
|
-
fileName: _jsxFileName,
|
|
287
|
-
lineNumber: 227
|
|
288
|
-
}
|
|
289
|
-
}, React$1.createElement(ChoiceConfiguration, {
|
|
290
|
-
key: index,
|
|
291
|
-
index: index + 1,
|
|
292
|
-
useLetterOrdering: model.choicePrefix === 'letters',
|
|
293
|
-
className: classes.choiceConfiguration,
|
|
294
|
-
mode: model.choiceMode,
|
|
295
|
-
data: choice,
|
|
296
|
-
defaultFeedback: {},
|
|
297
|
-
imageSupport: imageSupport,
|
|
298
|
-
onDelete: () => onRemoveChoice(index),
|
|
299
|
-
onChange: c => onChoiceChanged(index, c),
|
|
300
|
-
allowFeedBack: feedbackEnabled,
|
|
301
|
-
allowDelete: deleteChoice.settings,
|
|
302
|
-
noLabels: true,
|
|
303
|
-
toolbarOpts: toolbarOpts,
|
|
304
|
-
spellCheck: spellCheckEnabled,
|
|
305
|
-
error: choicesErrors && choicesErrors[choice.value] ? choicesErrors[choice.value] : null,
|
|
306
|
-
noCorrectAnswerError: correctResponseError,
|
|
307
|
-
__self: undefined,
|
|
308
|
-
__source: {
|
|
309
|
-
fileName: _jsxFileName,
|
|
310
|
-
lineNumber: 231
|
|
311
|
-
}
|
|
312
|
-
}), rationaleEnabled && React$1.createElement(InputContainer, {
|
|
313
|
-
key: `rationale-${index}`,
|
|
314
|
-
label: rationale.label,
|
|
315
|
-
className: classes.rationaleHolder,
|
|
316
|
-
__self: undefined,
|
|
317
|
-
__source: {
|
|
318
|
-
fileName: _jsxFileName,
|
|
319
|
-
lineNumber: 251
|
|
320
|
-
}
|
|
321
|
-
}, React$1.createElement(EditableHtml, {
|
|
322
|
-
className: classes.rationale,
|
|
323
|
-
markup: choice.rationale || '',
|
|
324
|
-
onChange: c => onChoiceChanged(index, {
|
|
325
|
-
...choice,
|
|
326
|
-
rationale: c
|
|
327
|
-
}),
|
|
328
|
-
imageSupport: imageSupport,
|
|
329
|
-
toolbarOpts: toolbarOpts,
|
|
330
|
-
pluginProps: labelPlugins,
|
|
331
|
-
spellCheck: spellCheckEnabled,
|
|
332
|
-
__self: undefined,
|
|
333
|
-
__source: {
|
|
334
|
-
fileName: _jsxFileName,
|
|
335
|
-
lineNumber: 256
|
|
336
|
-
}
|
|
337
|
-
})), accessibilityLabelsEnabled && React$1.createElement(InputContainer, {
|
|
338
|
-
key: `accessibility-${index}`,
|
|
339
|
-
label: accessibility.label,
|
|
340
|
-
className: classes.accessibilityHolder,
|
|
341
|
-
__self: undefined,
|
|
342
|
-
__source: {
|
|
343
|
-
fileName: _jsxFileName,
|
|
344
|
-
lineNumber: 273
|
|
345
|
-
}
|
|
346
|
-
}, React$1.createElement(EditableHtml, {
|
|
347
|
-
className: classes.accessibility,
|
|
348
|
-
markup: choice.accessibility || '',
|
|
349
|
-
onChange: c => onChoiceChanged(index, {
|
|
350
|
-
...choice,
|
|
351
|
-
accessibility: c
|
|
352
|
-
}),
|
|
353
|
-
imageSupport: imageSupport,
|
|
354
|
-
pluginProps: labelPlugins,
|
|
355
|
-
spellCheck: spellCheckEnabled,
|
|
356
|
-
__self: undefined,
|
|
357
|
-
__source: {
|
|
358
|
-
fileName: _jsxFileName,
|
|
359
|
-
lineNumber: 278
|
|
360
|
-
}
|
|
361
|
-
})))), React$1.createElement('br', {
|
|
362
|
-
__self: undefined,
|
|
363
|
-
__source: {
|
|
364
|
-
fileName: _jsxFileName,
|
|
365
|
-
lineNumber: 295
|
|
366
|
-
}
|
|
367
|
-
}), addChoiceButton.settings && React$1.createElement(Tooltip, {
|
|
368
|
-
title: maxAnswerChoices && model.choices.length >= maxAnswerChoices ? `Only ${maxAnswerChoices} allowed maximum` : '',
|
|
369
|
-
classes: {
|
|
370
|
-
tooltip: classes.tooltip
|
|
371
|
-
},
|
|
372
|
-
__self: undefined,
|
|
373
|
-
__source: {
|
|
374
|
-
fileName: _jsxFileName,
|
|
375
|
-
lineNumber: 297
|
|
376
|
-
}
|
|
377
|
-
}, React$1.createElement(Button, {
|
|
378
|
-
classes: {
|
|
379
|
-
root: maxAnswerChoices && model.choices.length >= maxAnswerChoices && classes.disableButton
|
|
380
|
-
},
|
|
381
|
-
className: classes.addButton,
|
|
382
|
-
variant: "contained",
|
|
383
|
-
color: "primary",
|
|
384
|
-
onClick: onAddChoice,
|
|
385
|
-
__self: undefined,
|
|
386
|
-
__source: {
|
|
387
|
-
fileName: _jsxFileName,
|
|
388
|
-
lineNumber: 305
|
|
389
|
-
}
|
|
390
|
-
}, addChoiceButton.label)));
|
|
391
|
-
const settingsInPanel = {
|
|
392
|
-
choiceMode: choiceMode.settings && radio(choiceMode.label, ['checkbox', 'radio']),
|
|
393
|
-
'sequentialChoiceLabels.enabled': sequentialChoiceLabels.settings && toggle(sequentialChoiceLabels.label, true),
|
|
394
|
-
choicePrefix: choicePrefix.settings && radio(choicePrefix.label, ['numbers', 'letters']),
|
|
395
|
-
partialScoring: partialScoring.settings && toggle(partialScoring.label),
|
|
396
|
-
lockChoiceOrder: lockChoiceOrder.settings && toggle(lockChoiceOrder.label),
|
|
397
|
-
feedbackEnabled: feedback.settings && toggle(feedback.label),
|
|
398
|
-
choicesLayout: choicesLayout.settings && dropdown(choicesLayout.label, ['vertical', 'grid', 'horizontal']),
|
|
399
|
-
gridColumns: choicesLayout.settings && model.choicesLayout === 'grid' && nrOfColumnsAvailable.length > 0 && dropdown(gridColumns.label, nrOfColumnsAvailable)
|
|
400
|
-
};
|
|
401
|
-
return React$1.createElement('div', {
|
|
402
|
-
className: classes.design,
|
|
403
|
-
__self: undefined,
|
|
404
|
-
__source: {
|
|
405
|
-
fileName: _jsxFileName,
|
|
406
|
-
lineNumber: 342
|
|
407
|
-
}
|
|
408
|
-
}, settingsPanelDisabled ? Content : React$1.createElement(layout.ConfigLayout, {
|
|
409
|
-
settings: React$1.createElement(Panel, {
|
|
410
|
-
model: model,
|
|
411
|
-
onChangeModel: onChangeModel,
|
|
412
|
-
configuration: configuration,
|
|
413
|
-
onChangeConfiguration: onConfigurationChanged,
|
|
414
|
-
groups: {
|
|
415
|
-
Settings: settingsInPanel,
|
|
416
|
-
Properties: {
|
|
417
|
-
teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),
|
|
418
|
-
studentInstructionsEnabled: studentInstructions.settings && toggle(studentInstructions.label),
|
|
419
|
-
promptEnabled: prompt.settings && toggle(prompt.label),
|
|
420
|
-
rationaleEnabled: rationale.settings && toggle(rationale.label),
|
|
421
|
-
spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),
|
|
422
|
-
accessibilityLabelsEnabled: accessibility.settings && toggle(accessibility.label),
|
|
423
|
-
scoringType: scoringType.settings && radio(scoringType.label, ['auto', 'rubric'])
|
|
424
|
-
}
|
|
425
|
-
},
|
|
426
|
-
__self: undefined,
|
|
427
|
-
__source: {
|
|
428
|
-
fileName: _jsxFileName,
|
|
429
|
-
lineNumber: 348
|
|
430
|
-
}
|
|
431
|
-
}),
|
|
432
|
-
__self: undefined,
|
|
433
|
-
__source: {
|
|
434
|
-
fileName: _jsxFileName,
|
|
435
|
-
lineNumber: 346
|
|
436
|
-
}
|
|
437
|
-
}, Content));
|
|
438
|
-
});
|
|
439
|
-
const InfoDialog = ({open, onCancel, onOk, title}) => React$1.createElement(Dialog, {
|
|
440
|
-
open: open,
|
|
441
|
-
__self: undefined,
|
|
442
|
-
__source: {
|
|
443
|
-
fileName: _jsxFileName,
|
|
444
|
-
lineNumber: 385
|
|
445
|
-
}
|
|
446
|
-
}, React$1.createElement(DialogTitle, {
|
|
447
|
-
__self: undefined,
|
|
448
|
-
__source: {
|
|
449
|
-
fileName: _jsxFileName,
|
|
450
|
-
lineNumber: 386
|
|
451
|
-
}
|
|
452
|
-
}, title), React$1.createElement(DialogActions, {
|
|
453
|
-
__self: undefined,
|
|
454
|
-
__source: {
|
|
455
|
-
fileName: _jsxFileName,
|
|
456
|
-
lineNumber: 387
|
|
457
|
-
}
|
|
458
|
-
}, onOk && React$1.createElement(Button, {
|
|
459
|
-
onClick: onOk,
|
|
460
|
-
color: "primary",
|
|
461
|
-
__self: undefined,
|
|
462
|
-
__source: {
|
|
463
|
-
fileName: _jsxFileName,
|
|
464
|
-
lineNumber: 389
|
|
465
|
-
}
|
|
466
|
-
}, "OK"), onCancel && React$1.createElement(Button, {
|
|
467
|
-
onClick: onCancel,
|
|
468
|
-
color: "primary",
|
|
469
|
-
__self: undefined,
|
|
470
|
-
__source: {
|
|
471
|
-
fileName: _jsxFileName,
|
|
472
|
-
lineNumber: 394
|
|
473
|
-
}
|
|
474
|
-
}, "Cancel")));
|
|
475
|
-
InfoDialog.propTypes = {
|
|
476
|
-
open: PropTypes.bool,
|
|
477
|
-
onCancel: PropTypes.func,
|
|
478
|
-
onOk: PropTypes.func,
|
|
479
|
-
title: PropTypes.string
|
|
480
|
-
};
|
|
481
|
-
class Main extends React$1.Component {
|
|
482
|
-
constructor(...args) {
|
|
483
|
-
super(...args);
|
|
484
|
-
Main.prototype.__init.call(this);
|
|
485
|
-
Main.prototype.__init2.call(this);
|
|
486
|
-
Main.prototype.__init3.call(this);
|
|
487
|
-
Main.prototype.__init4.call(this);
|
|
488
|
-
Main.prototype.__init5.call(this);
|
|
489
|
-
Main.prototype.__init6.call(this);
|
|
490
|
-
Main.prototype.__init7.call(this);
|
|
491
|
-
}
|
|
492
|
-
static __initStatic() {
|
|
493
|
-
this.propTypes = {
|
|
494
|
-
model: PropTypes.object.isRequired,
|
|
495
|
-
configuration: PropTypes.object.isRequired,
|
|
496
|
-
disableSidePanel: PropTypes.bool,
|
|
497
|
-
onModelChanged: PropTypes.func.isRequired,
|
|
498
|
-
onConfigurationChanged: PropTypes.func.isRequired,
|
|
499
|
-
classes: PropTypes.object.isRequired,
|
|
500
|
-
imageSupport: PropTypes.shape({
|
|
501
|
-
add: PropTypes.func.isRequired,
|
|
502
|
-
delete: PropTypes.func.isRequired
|
|
503
|
-
})
|
|
504
|
-
};
|
|
505
|
-
}
|
|
506
|
-
__init() {
|
|
507
|
-
this.state = {
|
|
508
|
-
dialog: {
|
|
509
|
-
open: false
|
|
510
|
-
}
|
|
511
|
-
};
|
|
512
|
-
}
|
|
513
|
-
__init2() {
|
|
514
|
-
this.onRemoveChoice = index => {
|
|
515
|
-
const {model, configuration} = this.props;
|
|
516
|
-
const {minAnswerChoices} = configuration || ({});
|
|
517
|
-
if (minAnswerChoices && model.choices.length === minAnswerChoices) {
|
|
518
|
-
this.setState({
|
|
519
|
-
dialog: {
|
|
520
|
-
open: true,
|
|
521
|
-
message: `There can't be less than ${minAnswerChoices} choices.`,
|
|
522
|
-
onOk: () => {
|
|
523
|
-
this.setState({
|
|
524
|
-
dialog: {
|
|
525
|
-
open: false
|
|
526
|
-
}
|
|
527
|
-
});
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
});
|
|
531
|
-
} else {
|
|
532
|
-
model.choices.splice(index, 1);
|
|
533
|
-
this.props.onModelChanged(model);
|
|
534
|
-
}
|
|
535
|
-
};
|
|
536
|
-
}
|
|
537
|
-
__init3() {
|
|
538
|
-
this.onAddChoice = () => {
|
|
539
|
-
const {model, configuration} = this.props;
|
|
540
|
-
let {maxAnswerChoices} = configuration || ({});
|
|
541
|
-
const {limitChoicesNumber} = model || ({});
|
|
542
|
-
if (limitChoicesNumber) {
|
|
543
|
-
maxAnswerChoices = MAX_CHOICES;
|
|
544
|
-
}
|
|
545
|
-
if (maxAnswerChoices && model.choices.length >= maxAnswerChoices) {
|
|
546
|
-
return;
|
|
547
|
-
}
|
|
548
|
-
model.choices.push({
|
|
549
|
-
label: '',
|
|
550
|
-
value: utils$1.firstAvailableIndex(model.choices.map(c => c.value), 0),
|
|
551
|
-
feedback: {
|
|
552
|
-
type: 'none'
|
|
553
|
-
}
|
|
554
|
-
});
|
|
555
|
-
this.props.onModelChanged(model);
|
|
556
|
-
};
|
|
557
|
-
}
|
|
558
|
-
__init4() {
|
|
559
|
-
this.onChoiceChanged = (index, choice) => {
|
|
560
|
-
const {model} = this.props;
|
|
561
|
-
if (choice.correct && model.choiceMode === 'radio') {
|
|
562
|
-
model.choices = model.choices.map(c => {
|
|
563
|
-
return merge({}, c, {
|
|
564
|
-
correct: false
|
|
565
|
-
});
|
|
566
|
-
});
|
|
567
|
-
}
|
|
568
|
-
model.choices.splice(index, 1, choice);
|
|
569
|
-
this.props.onModelChanged(model);
|
|
570
|
-
};
|
|
571
|
-
}
|
|
572
|
-
__init5() {
|
|
573
|
-
this.onPromptChanged = prompt => {
|
|
574
|
-
this.props.onModelChanged({
|
|
575
|
-
...this.props.model,
|
|
576
|
-
prompt
|
|
577
|
-
});
|
|
578
|
-
};
|
|
579
|
-
}
|
|
580
|
-
__init6() {
|
|
581
|
-
this.onTeacherInstructionsChanged = teacherInstructions => {
|
|
582
|
-
this.props.onModelChanged({
|
|
583
|
-
...this.props.model,
|
|
584
|
-
teacherInstructions
|
|
585
|
-
});
|
|
586
|
-
};
|
|
587
|
-
}
|
|
588
|
-
__init7() {
|
|
589
|
-
this.onModelChanged = (model, key) => {
|
|
590
|
-
const {onModelChanged} = this.props;
|
|
591
|
-
switch (key) {
|
|
592
|
-
case 'choiceMode':
|
|
593
|
-
{
|
|
594
|
-
let value = model.choiceMode;
|
|
595
|
-
if (value === 'radio') {
|
|
596
|
-
let correctFound = false;
|
|
597
|
-
model.choices = model.choices.map(c => {
|
|
598
|
-
if (correctFound) {
|
|
599
|
-
c.correct = false;
|
|
600
|
-
return c;
|
|
601
|
-
}
|
|
602
|
-
if (c.correct) {
|
|
603
|
-
correctFound = true;
|
|
604
|
-
}
|
|
605
|
-
return c;
|
|
606
|
-
});
|
|
607
|
-
}
|
|
608
|
-
onModelChanged(model, true);
|
|
609
|
-
break;
|
|
610
|
-
}
|
|
611
|
-
default:
|
|
612
|
-
onModelChanged(model);
|
|
613
|
-
break;
|
|
614
|
-
}
|
|
615
|
-
};
|
|
616
|
-
}
|
|
617
|
-
render() {
|
|
618
|
-
const {dialog} = this.state;
|
|
619
|
-
return React$1.createElement(React$1.Fragment, null, React$1.createElement(InfoDialog, {
|
|
620
|
-
open: dialog.open,
|
|
621
|
-
title: dialog.message,
|
|
622
|
-
onCancel: dialog.onCancel,
|
|
623
|
-
onOk: dialog.onOk,
|
|
624
|
-
__self: this,
|
|
625
|
-
__source: {
|
|
626
|
-
fileName: _jsxFileName,
|
|
627
|
-
lineNumber: 542
|
|
628
|
-
}
|
|
629
|
-
}), React$1.createElement(Design, {
|
|
630
|
-
...this.props,
|
|
631
|
-
onChangeModel: this.onModelChanged,
|
|
632
|
-
onRemoveChoice: this.onRemoveChoice,
|
|
633
|
-
onChoiceChanged: this.onChoiceChanged,
|
|
634
|
-
onAddChoice: this.onAddChoice,
|
|
635
|
-
onPromptChanged: this.onPromptChanged,
|
|
636
|
-
onTeacherInstructionsChanged: this.onTeacherInstructionsChanged,
|
|
637
|
-
__self: this,
|
|
638
|
-
__source: {
|
|
639
|
-
fileName: _jsxFileName,
|
|
640
|
-
lineNumber: 548
|
|
641
|
-
}
|
|
642
|
-
}));
|
|
643
|
-
}
|
|
644
|
-
}
|
|
645
|
-
Main.__initStatic();
|
|
646
|
-
const Styled = withStyles(styles)(Main);
|
|
647
|
-
var sensibleDefaults = {
|
|
648
|
-
model: {
|
|
649
|
-
choiceMode: 'checkbox',
|
|
650
|
-
choicePrefix: 'letters',
|
|
651
|
-
choices: [],
|
|
652
|
-
prompt: 'Question Prompt goes here',
|
|
653
|
-
lockChoiceOrder: true,
|
|
654
|
-
partialScoring: true,
|
|
655
|
-
scoringType: 'auto',
|
|
656
|
-
feedbackEnabled: true,
|
|
657
|
-
promptEnabled: true,
|
|
658
|
-
rationaleEnabled: true,
|
|
659
|
-
teacherInstructionsEnabled: true,
|
|
660
|
-
studentInstructionsEnabled: true,
|
|
661
|
-
toolbarEditorPosition: 'bottom',
|
|
662
|
-
choicesLayout: 'vertical',
|
|
663
|
-
gridColumns: '2'
|
|
664
|
-
},
|
|
665
|
-
configuration: {
|
|
666
|
-
spellCheck: {
|
|
667
|
-
label: 'Spellcheck',
|
|
668
|
-
settings: false,
|
|
669
|
-
enabled: true
|
|
670
|
-
},
|
|
671
|
-
choicesLayout: {
|
|
672
|
-
settings: false,
|
|
673
|
-
label: 'Choices Layout'
|
|
674
|
-
},
|
|
675
|
-
gridColumns: {
|
|
676
|
-
label: 'Grid columns'
|
|
677
|
-
},
|
|
678
|
-
answerChoiceCount: 0,
|
|
679
|
-
addChoiceButton: {
|
|
680
|
-
settings: true,
|
|
681
|
-
label: 'Add a Choice'
|
|
682
|
-
},
|
|
683
|
-
choiceMode: {
|
|
684
|
-
settings: true,
|
|
685
|
-
label: 'Response Type'
|
|
686
|
-
},
|
|
687
|
-
choicePrefix: {
|
|
688
|
-
settings: true,
|
|
689
|
-
label: 'Choice Labels'
|
|
690
|
-
},
|
|
691
|
-
deleteChoice: {
|
|
692
|
-
settings: true
|
|
693
|
-
},
|
|
694
|
-
feedback: {
|
|
695
|
-
settings: true,
|
|
696
|
-
label: 'Feedback'
|
|
697
|
-
},
|
|
698
|
-
prompt: {
|
|
699
|
-
settings: true,
|
|
700
|
-
label: 'Prompt'
|
|
701
|
-
},
|
|
702
|
-
lockChoiceOrder: {
|
|
703
|
-
settings: true,
|
|
704
|
-
label: 'Lock Choice Order'
|
|
705
|
-
},
|
|
706
|
-
partialScoring: {
|
|
707
|
-
settings: false,
|
|
708
|
-
label: 'Allow Partial Scoring'
|
|
709
|
-
},
|
|
710
|
-
rationale: {
|
|
711
|
-
settings: true,
|
|
712
|
-
label: 'Rationale'
|
|
713
|
-
},
|
|
714
|
-
accessibility: {
|
|
715
|
-
settings: false,
|
|
716
|
-
label: 'Accessibility Label'
|
|
717
|
-
},
|
|
718
|
-
scoringType: {
|
|
719
|
-
settings: false,
|
|
720
|
-
label: 'Scoring Type'
|
|
721
|
-
},
|
|
722
|
-
studentInstructions: {
|
|
723
|
-
settings: false,
|
|
724
|
-
label: 'Student Instructions'
|
|
725
|
-
},
|
|
726
|
-
teacherInstructions: {
|
|
727
|
-
settings: true,
|
|
728
|
-
label: 'Teacher Instructions'
|
|
729
|
-
},
|
|
730
|
-
toolbarEditorPosition: {
|
|
731
|
-
settings: false,
|
|
732
|
-
label: 'Toolbar Editor Position'
|
|
733
|
-
},
|
|
734
|
-
minAnswerChoices: 2,
|
|
735
|
-
maxAnswerChoices: 5
|
|
736
|
-
}
|
|
737
|
-
};
|
|
738
|
-
const React = _dll_react;
|
|
739
|
-
const ReactDOM = _dll_react_dom;
|
|
740
|
-
const debug = _dll_debug;
|
|
741
|
-
const {defaults: defaults} = _dll_lodash;
|
|
742
|
-
const {choiceUtils: utils} = _dll_pie_lib__config_ui;
|
|
743
|
-
const log = debug('multiple-choice:configure');
|
|
744
|
-
const generateFormattedChoices = (choices, choiceCount = 0) => {
|
|
745
|
-
if (!choices || choices.length === 0) {
|
|
746
|
-
let formattedChoices = [];
|
|
747
|
-
for (let i = 0; i < choiceCount; i++) {
|
|
748
|
-
formattedChoices.push({
|
|
749
|
-
value: `${i}`,
|
|
750
|
-
label: '',
|
|
751
|
-
feedback: {
|
|
752
|
-
type: 'none',
|
|
753
|
-
value: ''
|
|
754
|
-
}
|
|
755
|
-
});
|
|
756
|
-
}
|
|
757
|
-
return formattedChoices;
|
|
758
|
-
}
|
|
759
|
-
return choices;
|
|
760
|
-
};
|
|
761
|
-
const prepareCustomizationObject = (config, model) => {
|
|
762
|
-
const configuration = defaults(config, sensibleDefaults.configuration);
|
|
763
|
-
return {
|
|
764
|
-
configuration,
|
|
765
|
-
model: {
|
|
766
|
-
...model,
|
|
767
|
-
choices: generateFormattedChoices(model && model.choices || [], configuration && configuration.answerChoiceCount)
|
|
768
|
-
}
|
|
769
|
-
};
|
|
770
|
-
};
|
|
771
|
-
class MultipleChoice extends HTMLElement {
|
|
772
|
-
static __initStatic() {
|
|
773
|
-
this.createDefaultModel = (model = {}) => {
|
|
774
|
-
const normalizedModel = utils.normalizeChoices({
|
|
775
|
-
...sensibleDefaults.model,
|
|
776
|
-
...model,
|
|
777
|
-
choices: generateFormattedChoices(model && model.choices || [])
|
|
778
|
-
});
|
|
779
|
-
normalizedModel.choicesLayout = model.choicesLayout || model.verticalMode === false && 'horizontal' || sensibleDefaults.model.choicesLayout;
|
|
780
|
-
return normalizedModel;
|
|
781
|
-
};
|
|
782
|
-
}
|
|
783
|
-
constructor() {
|
|
784
|
-
super();
|
|
785
|
-
this._model = MultipleChoice.createDefaultModel();
|
|
786
|
-
this._configuration = sensibleDefaults.configuration;
|
|
787
|
-
this.onModelChanged = this.onModelChanged.bind(this);
|
|
788
|
-
this.onConfigurationChanged = this.onConfigurationChanged.bind(this);
|
|
789
|
-
}
|
|
790
|
-
set model(s) {
|
|
791
|
-
this._model = MultipleChoice.createDefaultModel(s);
|
|
792
|
-
this._render();
|
|
793
|
-
}
|
|
794
|
-
set configuration(c) {
|
|
795
|
-
const info = prepareCustomizationObject(c, this._model);
|
|
796
|
-
this.onModelChanged(info.model);
|
|
797
|
-
this._configuration = info.configuration;
|
|
798
|
-
this._render();
|
|
799
|
-
}
|
|
800
|
-
set disableSidePanel(s) {
|
|
801
|
-
this._disableSidePanel = s;
|
|
802
|
-
this._render();
|
|
803
|
-
}
|
|
804
|
-
dispatchModelUpdated(reset) {
|
|
805
|
-
const resetValue = !!reset;
|
|
806
|
-
this.dispatchEvent(new ModelUpdatedEvent_1(this._model, resetValue));
|
|
807
|
-
}
|
|
808
|
-
onModelChanged(m, reset) {
|
|
809
|
-
this._model = m;
|
|
810
|
-
this._render();
|
|
811
|
-
this.dispatchModelUpdated(reset);
|
|
812
|
-
}
|
|
813
|
-
onConfigurationChanged(c) {
|
|
814
|
-
this._configuration = prepareCustomizationObject(c, this._model).configuration;
|
|
815
|
-
if (this._model) {
|
|
816
|
-
this.onModelChanged(this._model);
|
|
817
|
-
}
|
|
818
|
-
this._render();
|
|
819
|
-
}
|
|
820
|
-
insertImage(handler) {
|
|
821
|
-
this.dispatchEvent(new InsertImageEvent_1(handler));
|
|
822
|
-
}
|
|
823
|
-
onDeleteImage(src, done) {
|
|
824
|
-
this.dispatchEvent(new DeleteImageEvent_1(src, done));
|
|
825
|
-
}
|
|
826
|
-
_render() {
|
|
827
|
-
log('_render');
|
|
828
|
-
let element = React.createElement(Styled, {
|
|
829
|
-
model: this._model,
|
|
830
|
-
configuration: this._configuration,
|
|
831
|
-
onModelChanged: this.onModelChanged,
|
|
832
|
-
onConfigurationChanged: this.onConfigurationChanged,
|
|
833
|
-
disableSidePanel: this._disableSidePanel,
|
|
834
|
-
imageSupport: {
|
|
835
|
-
add: this.insertImage.bind(this),
|
|
836
|
-
delete: this.onDeleteImage.bind(this)
|
|
837
|
-
}
|
|
838
|
-
});
|
|
839
|
-
ReactDOM.render(element, this);
|
|
840
|
-
}
|
|
841
|
-
}
|
|
842
|
-
MultipleChoice.__initStatic();
|
|
843
|
-
export {MultipleChoice as default};
|