@pie-element/ebsr 7.0.25 → 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 +8 -0
- package/configure/CHANGELOG.md +8 -0
- package/configure/package.json +3 -3
- package/package.json +3 -3
- package/module/configure.js +0 -477
- package/module/controller.js +0 -20811
- package/module/demo.js +0 -77
- package/module/element.js +0 -2164
- package/module/index.html +0 -21
- package/module/manifest.json +0 -14
- package/module/print-demo.js +0 -115
- package/module/print.html +0 -18
- package/module/print.js +0 -2188
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [7.0.26](https://github.com/pie-framework/pie-elements/compare/@pie-element/ebsr@7.0.25...@pie-element/ebsr@7.0.26) (2022-06-13)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @pie-element/ebsr
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [7.0.25](https://github.com/pie-framework/pie-elements/compare/@pie-element/ebsr@7.0.24...@pie-element/ebsr@7.0.25) (2022-05-30)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @pie-element/ebsr
|
package/configure/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [7.0.26](https://github.com/pie-framework/pie-elements/compare/@pie-element/ebsr-configure@7.0.25...@pie-element/ebsr-configure@7.0.26) (2022-06-13)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @pie-element/ebsr-configure
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [7.0.25](https://github.com/pie-framework/pie-elements/compare/@pie-element/ebsr-configure@7.0.24...@pie-element/ebsr-configure@7.0.25) (2022-05-30)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @pie-element/ebsr-configure
|
package/configure/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/ebsr-configure",
|
|
3
3
|
"private": true,
|
|
4
|
-
"version": "7.0.
|
|
4
|
+
"version": "7.0.26",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"module": "src/index.js",
|
|
8
8
|
"author": "",
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"@material-ui/core": "^3.9.2",
|
|
11
|
-
"@pie-element/multiple-choice": "^6.3.
|
|
11
|
+
"@pie-element/multiple-choice": "^6.3.4",
|
|
12
12
|
"@pie-framework/pie-configure-events": "^1.2.0",
|
|
13
|
-
"@pie-lib/config-ui": "^10.13.
|
|
13
|
+
"@pie-lib/config-ui": "^10.13.3",
|
|
14
14
|
"lodash": "^4.17.15",
|
|
15
15
|
"prop-types": "^15.6.2",
|
|
16
16
|
"react": "^16.8.1",
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/ebsr",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.26",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": "pie-framework/pie-elements",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@pie-element/multiple-choice": "^6.3.
|
|
10
|
+
"@pie-element/multiple-choice": "^6.3.4",
|
|
11
11
|
"@pie-framework/pie-player-events": "^0.1.0",
|
|
12
12
|
"classnames": "^2.2.5",
|
|
13
13
|
"debug": "^4.1.1",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"author": "pie framework developers",
|
|
17
17
|
"license": "ISC",
|
|
18
|
-
"gitHead": "
|
|
18
|
+
"gitHead": "2b16a41c0627a27ee758af9285afde4d226dc12b",
|
|
19
19
|
"scripts": {
|
|
20
20
|
"postpublish": "../../scripts/postpublish"
|
|
21
21
|
},
|
package/module/configure.js
DELETED
|
@@ -1,477 +0,0 @@
|
|
|
1
|
-
import {_dll_react, _dll_prop_types, _dll_material_ui__core_styles, _dll_lodash, _dll_react_dom} from "../../../@pie-lib/shared-module@^1.4.19/module/index.js";
|
|
2
|
-
import MultipleChoiceConfigure from '@pie-element/multiple-choice/configure/lib';
|
|
3
|
-
import {_dll_pie_lib__config_ui} from "../../../@pie-lib/config-module@^1.3.1/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
|
-
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
|
-
lib.InsertImageEvent = InsertImageEvent;
|
|
49
|
-
const React$1 = _dll_react;
|
|
50
|
-
const PropTypes = _dll_prop_types;
|
|
51
|
-
const {withStyles: withStyles} = _dll_material_ui__core_styles;
|
|
52
|
-
const {settings: settings} = _dll_pie_lib__config_ui;
|
|
53
|
-
const {layout: layout} = _dll_pie_lib__config_ui;
|
|
54
|
-
const _jsxFileName = "/home/circleci/repo/packages/ebsr/configure/src/main.jsx";
|
|
55
|
-
const {Panel, toggle, radio, dropdown} = settings;
|
|
56
|
-
const styles = theme => ({
|
|
57
|
-
design: {
|
|
58
|
-
paddingTop: theme.spacing.unit * 3
|
|
59
|
-
},
|
|
60
|
-
part: {
|
|
61
|
-
display: 'flex',
|
|
62
|
-
flexDirection: 'column',
|
|
63
|
-
padding: '16px 0 32px'
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
class Main extends React$1.Component {
|
|
67
|
-
constructor(...args) {
|
|
68
|
-
super(...args);
|
|
69
|
-
Main.prototype.__init.call(this);
|
|
70
|
-
Main.prototype.__init2.call(this);
|
|
71
|
-
}
|
|
72
|
-
static __initStatic() {
|
|
73
|
-
this.propTypes = {
|
|
74
|
-
classes: PropTypes.object,
|
|
75
|
-
configuration: PropTypes.object,
|
|
76
|
-
model: PropTypes.object,
|
|
77
|
-
onModelChanged: PropTypes.func,
|
|
78
|
-
onConfigurationChanged: PropTypes.func
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
__init() {
|
|
82
|
-
this.removeExtraChoices = choices => {
|
|
83
|
-
let correctFound = false;
|
|
84
|
-
return (choices || []).map(choice => {
|
|
85
|
-
if (correctFound) {
|
|
86
|
-
choice.correct = false;
|
|
87
|
-
return choice;
|
|
88
|
-
}
|
|
89
|
-
if (choice.correct) {
|
|
90
|
-
correctFound = true;
|
|
91
|
-
}
|
|
92
|
-
return choice;
|
|
93
|
-
});
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
__init2() {
|
|
97
|
-
this.onModelChanged = (model, key) => {
|
|
98
|
-
const {onModelChanged} = this.props;
|
|
99
|
-
if (key === 'partA.choiceMode' && model.partA.choiceMode === 'radio') {
|
|
100
|
-
model.partA.choices = this.removeExtraChoices(model.partA.choices);
|
|
101
|
-
return onModelChanged(model, true);
|
|
102
|
-
}
|
|
103
|
-
if (key === 'partB.choiceMode' && model.partB.choiceMode === 'radio') {
|
|
104
|
-
model.partB.choices = this.removeExtraChoices(model.partB.choices);
|
|
105
|
-
return onModelChanged(model, true);
|
|
106
|
-
}
|
|
107
|
-
return onModelChanged(model);
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
render() {
|
|
111
|
-
const {classes, model, configuration, onConfigurationChanged} = this.props;
|
|
112
|
-
const {partLabelType, partA: modelPartA, partB: modelPartB} = model;
|
|
113
|
-
const {partA, partB, partialScoring, scoringType, ...generalConfiguration} = configuration;
|
|
114
|
-
const {feedback: feedbackA = {}, choiceMode: choiceModeA = {}, choicePrefix: choicePrefixA = {}, lockChoiceOrder: lockChoiceOrderA = {}, prompt: promptA = {}, teacherInstructions: teacherInstructionsA = {}, studentInstructions: studentInstructionsA = {}, choicesLayout: choicesLayoutA = {}, gridColumns: gridColumnsA = {}, rationale: rationaleA = {}, spellCheck: spellCheckA = {}} = partA || ({});
|
|
115
|
-
const {feedback: feedbackB = {}, choiceMode: choiceModeB = {}, choicePrefix: choicePrefixB = {}, lockChoiceOrder: lockChoiceOrderB = {}, prompt: promptB = {}, teacherInstructions: teacherInstructionsB = {}, studentInstructions: studentInstructionsB = {}, choicesLayout: choicesLayoutB = {}, gridColumns: gridColumnsB = {}, rationale: rationaleB = {}, spellCheck: spellCheckB = {}} = partB || ({});
|
|
116
|
-
const type = partLabelType || 'Numbers';
|
|
117
|
-
const typeIsNumber = type === 'Numbers';
|
|
118
|
-
const firstPart = `Part ${typeIsNumber ? '1' : 'A'}`;
|
|
119
|
-
const secondPart = `Part ${typeIsNumber ? '2' : 'B'}`;
|
|
120
|
-
const nrOfColumnsAvailable = {
|
|
121
|
-
partA: modelPartA.choices && modelPartA.choices.length ? Array.from({
|
|
122
|
-
length: modelPartA.choices.length
|
|
123
|
-
}, (_, i) => `${i + 1}`) : [],
|
|
124
|
-
partB: modelPartB.choices && modelPartB.choices.length ? Array.from({
|
|
125
|
-
length: modelPartB.choices.length
|
|
126
|
-
}, (_, i) => `${i + 1}`) : []
|
|
127
|
-
};
|
|
128
|
-
return React$1.createElement('div', {
|
|
129
|
-
className: classes.design,
|
|
130
|
-
__self: this,
|
|
131
|
-
__source: {
|
|
132
|
-
fileName: _jsxFileName,
|
|
133
|
-
lineNumber: 110
|
|
134
|
-
}
|
|
135
|
-
}, React$1.createElement(layout.ConfigLayout, {
|
|
136
|
-
settings: React$1.createElement(Panel, {
|
|
137
|
-
model: model,
|
|
138
|
-
onChangeModel: this.onModelChanged,
|
|
139
|
-
configuration: configuration,
|
|
140
|
-
onChangeConfiguration: onConfigurationChanged,
|
|
141
|
-
groups: {
|
|
142
|
-
'Settings for both': {
|
|
143
|
-
partLabels: generalConfiguration.partLabels.settings && toggle(generalConfiguration.partLabels.label),
|
|
144
|
-
partLabelType: model.partLabels && dropdown('', ['Numbers', 'Letters']),
|
|
145
|
-
partialScoring: partialScoring.settings && toggle(partialScoring.label),
|
|
146
|
-
scoringType: scoringType.settings && radio(scoringType.label, ['auto', 'rubric'])
|
|
147
|
-
},
|
|
148
|
-
[`Settings ${firstPart}`]: {
|
|
149
|
-
'partA.choiceMode': choiceModeA.settings && radio(choiceModeA.label, ['checkbox', 'radio']),
|
|
150
|
-
'partA.choicePrefix': choicePrefixA.settings && radio(choicePrefixA.label, ['numbers', 'letters']),
|
|
151
|
-
'partA.lockChoiceOrder': lockChoiceOrderA.settings && toggle(lockChoiceOrderA.label),
|
|
152
|
-
'partA.choicesLayout': choicesLayoutA.settings && dropdown(choicesLayoutA.label, ['vertical', 'grid', 'horizontal']),
|
|
153
|
-
'partA.gridColumns': choicesLayoutA.settings && modelPartA.choicesLayout === 'grid' && nrOfColumnsAvailable.partA.length > 0 && dropdown(gridColumnsA.label, nrOfColumnsAvailable.partA)
|
|
154
|
-
},
|
|
155
|
-
[`Properties ${firstPart}`]: {
|
|
156
|
-
'partA.feedbackEnabled': feedbackA.settings && toggle(feedbackA.label),
|
|
157
|
-
'partA.promptEnabled': promptA.settings && toggle(promptA.label),
|
|
158
|
-
'partA.teacherInstructionsEnabled': teacherInstructionsA.settings && toggle(teacherInstructionsA.label),
|
|
159
|
-
'partA.studentInstructionsEnabled': studentInstructionsA.settings && toggle(studentInstructionsA.label),
|
|
160
|
-
'partA.rationaleEnabled': rationaleA.settings && toggle(rationaleA.label),
|
|
161
|
-
'partA.spellCheckEnabled': spellCheckA.settings && toggle(spellCheckA.label)
|
|
162
|
-
},
|
|
163
|
-
[`Settings ${secondPart}`]: {
|
|
164
|
-
'partB.choiceMode': choiceModeB.settings && radio(choiceModeB.label, ['checkbox', 'radio']),
|
|
165
|
-
'partB.choicePrefix': choicePrefixB.settings && radio(choicePrefixB.label, ['numbers', 'letters']),
|
|
166
|
-
'partB.lockChoiceOrder': lockChoiceOrderB.settings && toggle(lockChoiceOrderB.label),
|
|
167
|
-
'partB.choicesLayout': choicesLayoutB.settings && dropdown(choicesLayoutB.label, ['vertical', 'grid', 'horizontal']),
|
|
168
|
-
'partB.gridColumns': choicesLayoutB.settings && modelPartB.choicesLayout === 'grid' && nrOfColumnsAvailable.partB.length > 0 && dropdown(gridColumnsB.label, nrOfColumnsAvailable.partB)
|
|
169
|
-
},
|
|
170
|
-
[`Properties ${secondPart}`]: {
|
|
171
|
-
'partB.feedbackEnabled': feedbackB.settings && toggle(feedbackB.label),
|
|
172
|
-
'partB.promptEnabled': promptB.settings && toggle(promptB.label),
|
|
173
|
-
'partB.teacherInstructionsEnabled': teacherInstructionsB.settings && toggle(teacherInstructionsB.label),
|
|
174
|
-
'partB.studentInstructionsEnabled': studentInstructionsB.settings && toggle(studentInstructionsB.label),
|
|
175
|
-
'partB.rationaleEnabled': rationaleB.settings && toggle(rationaleB.label),
|
|
176
|
-
'partB.spellCheckEnabled': spellCheckB.settings && toggle(spellCheckB.label)
|
|
177
|
-
}
|
|
178
|
-
},
|
|
179
|
-
__self: this,
|
|
180
|
-
__source: {
|
|
181
|
-
fileName: _jsxFileName,
|
|
182
|
-
lineNumber: 113
|
|
183
|
-
}
|
|
184
|
-
}),
|
|
185
|
-
__self: this,
|
|
186
|
-
__source: {
|
|
187
|
-
fileName: _jsxFileName,
|
|
188
|
-
lineNumber: 111
|
|
189
|
-
}
|
|
190
|
-
}, React$1.createElement('div', {
|
|
191
|
-
__self: this,
|
|
192
|
-
__source: {
|
|
193
|
-
fileName: _jsxFileName,
|
|
194
|
-
lineNumber: 200
|
|
195
|
-
}
|
|
196
|
-
}, React$1.createElement('div', {
|
|
197
|
-
className: classes.part,
|
|
198
|
-
__self: this,
|
|
199
|
-
__source: {
|
|
200
|
-
fileName: _jsxFileName,
|
|
201
|
-
lineNumber: 201
|
|
202
|
-
}
|
|
203
|
-
}, model.partLabels && React$1.createElement('p', {
|
|
204
|
-
__self: this,
|
|
205
|
-
__source: {
|
|
206
|
-
fileName: _jsxFileName,
|
|
207
|
-
lineNumber: 202
|
|
208
|
-
}
|
|
209
|
-
}, firstPart), React$1.createElement('ebsr-multiple-choice-configure', {
|
|
210
|
-
id: "A",
|
|
211
|
-
key: "partA",
|
|
212
|
-
ref: ref => {
|
|
213
|
-
if (ref) {
|
|
214
|
-
this.partA = ref;
|
|
215
|
-
this.partA._model = {
|
|
216
|
-
...this.props.model.partA,
|
|
217
|
-
errors: this.props.model.errors && this.props.model.errors.partA || ({})
|
|
218
|
-
};
|
|
219
|
-
this.partA.configuration = {
|
|
220
|
-
...partA,
|
|
221
|
-
...generalConfiguration
|
|
222
|
-
};
|
|
223
|
-
}
|
|
224
|
-
},
|
|
225
|
-
__self: this,
|
|
226
|
-
__source: {
|
|
227
|
-
fileName: _jsxFileName,
|
|
228
|
-
lineNumber: 203
|
|
229
|
-
}
|
|
230
|
-
})), React$1.createElement('div', {
|
|
231
|
-
className: classes.part,
|
|
232
|
-
__self: this,
|
|
233
|
-
__source: {
|
|
234
|
-
fileName: _jsxFileName,
|
|
235
|
-
lineNumber: 223
|
|
236
|
-
}
|
|
237
|
-
}, model.partLabels && React$1.createElement('p', {
|
|
238
|
-
__self: this,
|
|
239
|
-
__source: {
|
|
240
|
-
fileName: _jsxFileName,
|
|
241
|
-
lineNumber: 224
|
|
242
|
-
}
|
|
243
|
-
}, secondPart), React$1.createElement('ebsr-multiple-choice-configure', {
|
|
244
|
-
id: "B",
|
|
245
|
-
key: "partB",
|
|
246
|
-
ref: ref => {
|
|
247
|
-
if (ref) {
|
|
248
|
-
this.partB = ref;
|
|
249
|
-
this.partB._model = {
|
|
250
|
-
...this.props.model.partB,
|
|
251
|
-
errors: this.props.model.errors && this.props.model.errors.partB || ({})
|
|
252
|
-
};
|
|
253
|
-
this.partB.configuration = {
|
|
254
|
-
...partB,
|
|
255
|
-
...generalConfiguration
|
|
256
|
-
};
|
|
257
|
-
}
|
|
258
|
-
},
|
|
259
|
-
__self: this,
|
|
260
|
-
__source: {
|
|
261
|
-
fileName: _jsxFileName,
|
|
262
|
-
lineNumber: 225
|
|
263
|
-
}
|
|
264
|
-
})))));
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
Main.__initStatic();
|
|
268
|
-
const Styled = withStyles(styles)(Main);
|
|
269
|
-
const {cloneDeep: cloneDeep} = _dll_lodash;
|
|
270
|
-
const defaultConfig = {
|
|
271
|
-
addChoiceButton: {
|
|
272
|
-
settings: true,
|
|
273
|
-
label: 'Add a Choice'
|
|
274
|
-
},
|
|
275
|
-
choiceMode: {
|
|
276
|
-
settings: true,
|
|
277
|
-
label: 'Response Type'
|
|
278
|
-
},
|
|
279
|
-
choicePrefix: {
|
|
280
|
-
settings: true,
|
|
281
|
-
label: 'Choice Labels'
|
|
282
|
-
},
|
|
283
|
-
deleteChoice: {
|
|
284
|
-
settings: true
|
|
285
|
-
},
|
|
286
|
-
feedback: {
|
|
287
|
-
settings: true,
|
|
288
|
-
label: 'Feedback'
|
|
289
|
-
},
|
|
290
|
-
lockChoiceOrder: {
|
|
291
|
-
settings: true,
|
|
292
|
-
label: 'Lock Choice Order'
|
|
293
|
-
},
|
|
294
|
-
prompt: {
|
|
295
|
-
settings: true,
|
|
296
|
-
label: 'Prompt'
|
|
297
|
-
},
|
|
298
|
-
rationale: {
|
|
299
|
-
settings: true,
|
|
300
|
-
label: 'Rationale'
|
|
301
|
-
},
|
|
302
|
-
studentInstructions: {
|
|
303
|
-
settings: false,
|
|
304
|
-
label: 'Student Instructions'
|
|
305
|
-
},
|
|
306
|
-
teacherInstructions: {
|
|
307
|
-
settings: true,
|
|
308
|
-
label: 'Teacher Instructions'
|
|
309
|
-
},
|
|
310
|
-
choicesLayout: {
|
|
311
|
-
settings: false,
|
|
312
|
-
label: 'Choices Layout'
|
|
313
|
-
},
|
|
314
|
-
gridColumns: {
|
|
315
|
-
label: 'Grid columns'
|
|
316
|
-
},
|
|
317
|
-
spellCheck: {
|
|
318
|
-
label: 'Spellcheck',
|
|
319
|
-
settings: false,
|
|
320
|
-
enabled: true
|
|
321
|
-
}
|
|
322
|
-
};
|
|
323
|
-
const partModel = base => ({
|
|
324
|
-
choiceMode: 'radio',
|
|
325
|
-
choices: [],
|
|
326
|
-
choicePrefix: 'numbers',
|
|
327
|
-
prompt: 'Prompt',
|
|
328
|
-
rationaleEnabled: true,
|
|
329
|
-
feedbackEnabled: true,
|
|
330
|
-
promptEnabled: true,
|
|
331
|
-
teacherInstructions: '',
|
|
332
|
-
rationale: '',
|
|
333
|
-
teacherInstructionsEnabled: true,
|
|
334
|
-
studentInstructionsEnabled: true,
|
|
335
|
-
spellCheckEnabled: true,
|
|
336
|
-
choicesLayout: 'vertical',
|
|
337
|
-
gridColumns: '2',
|
|
338
|
-
...base
|
|
339
|
-
});
|
|
340
|
-
var sensibleDefaults = {
|
|
341
|
-
model: {
|
|
342
|
-
partLabels: true,
|
|
343
|
-
partLabelType: 'Letters',
|
|
344
|
-
partialScoring: false,
|
|
345
|
-
partA: partModel({
|
|
346
|
-
prompt: 'Prompt A'
|
|
347
|
-
}),
|
|
348
|
-
partB: partModel({
|
|
349
|
-
prompt: 'Prompt B'
|
|
350
|
-
})
|
|
351
|
-
},
|
|
352
|
-
configuration: {
|
|
353
|
-
partialScoring: {
|
|
354
|
-
label: 'Allow Partial Scoring',
|
|
355
|
-
settings: false
|
|
356
|
-
},
|
|
357
|
-
scoringType: {
|
|
358
|
-
settings: false,
|
|
359
|
-
label: 'Scoring Type'
|
|
360
|
-
},
|
|
361
|
-
partA: cloneDeep(defaultConfig),
|
|
362
|
-
partB: cloneDeep(defaultConfig),
|
|
363
|
-
partLabels: {
|
|
364
|
-
settings: true,
|
|
365
|
-
label: 'Part Labels'
|
|
366
|
-
},
|
|
367
|
-
settingsPanelDisabled: true
|
|
368
|
-
}
|
|
369
|
-
};
|
|
370
|
-
const React = _dll_react;
|
|
371
|
-
const ReactDOM = _dll_react_dom;
|
|
372
|
-
const {defaults: defaults} = _dll_lodash;
|
|
373
|
-
const MODEL_UPDATED = ModelUpdatedEvent_1.TYPE;
|
|
374
|
-
const MC_TAG_NAME = 'ebsr-multiple-choice-configure';
|
|
375
|
-
class EbsrMCConfigure extends MultipleChoiceConfigure {}
|
|
376
|
-
const defineMultipleChoice = () => {
|
|
377
|
-
if (!customElements.get(MC_TAG_NAME)) {
|
|
378
|
-
customElements.define(MC_TAG_NAME, EbsrMCConfigure);
|
|
379
|
-
}
|
|
380
|
-
};
|
|
381
|
-
defineMultipleChoice();
|
|
382
|
-
const prepareCustomizationObject = (config, model) => {
|
|
383
|
-
const configuration = defaults(config, sensibleDefaults.configuration);
|
|
384
|
-
configuration.settingsPanelDisabled = true;
|
|
385
|
-
return {
|
|
386
|
-
configuration,
|
|
387
|
-
model
|
|
388
|
-
};
|
|
389
|
-
};
|
|
390
|
-
const {model: modelDefault} = sensibleDefaults || ({});
|
|
391
|
-
class EbsrConfigure extends HTMLElement {
|
|
392
|
-
static __initStatic() {
|
|
393
|
-
this.createDefaultModel = ({partA = {}, partB = {}, ...model} = {}, defaults = modelDefault) => ({
|
|
394
|
-
...defaults,
|
|
395
|
-
...model,
|
|
396
|
-
partA: {
|
|
397
|
-
...defaults.partA,
|
|
398
|
-
...partA,
|
|
399
|
-
choicesLayout: partA.choicesLayout || partA.verticalMode === false && 'horizontal' || defaults.partA.choicesLayout
|
|
400
|
-
},
|
|
401
|
-
partB: {
|
|
402
|
-
...defaults.partB,
|
|
403
|
-
...partB,
|
|
404
|
-
choicesLayout: partB.choicesLayout || partB.verticalMode === false && 'horizontal' || defaults.partB.choicesLayout
|
|
405
|
-
}
|
|
406
|
-
});
|
|
407
|
-
}
|
|
408
|
-
constructor() {
|
|
409
|
-
super();
|
|
410
|
-
EbsrConfigure.prototype.__init.call(this);
|
|
411
|
-
EbsrConfigure.prototype.__init2.call(this);
|
|
412
|
-
this._model = EbsrConfigure.createDefaultModel();
|
|
413
|
-
this._configuration = sensibleDefaults.configuration;
|
|
414
|
-
this.onConfigurationChanged = this.onConfigurationChanged.bind(this);
|
|
415
|
-
}
|
|
416
|
-
set model(m) {
|
|
417
|
-
this._model = EbsrConfigure.createDefaultModel(m, this._model);
|
|
418
|
-
this._render();
|
|
419
|
-
}
|
|
420
|
-
dispatchModelUpdated(reset) {
|
|
421
|
-
const resetValue = !!reset;
|
|
422
|
-
this.dispatchEvent(new ModelUpdatedEvent_1(this._model, resetValue));
|
|
423
|
-
}
|
|
424
|
-
__init() {
|
|
425
|
-
this.onModelChanged = (m, reset) => {
|
|
426
|
-
this._model = EbsrConfigure.createDefaultModel(m, this._model);
|
|
427
|
-
this.dispatchModelUpdated(reset);
|
|
428
|
-
this._render();
|
|
429
|
-
};
|
|
430
|
-
}
|
|
431
|
-
set configuration(c) {
|
|
432
|
-
const info = prepareCustomizationObject(c, this._model);
|
|
433
|
-
this._configuration = info.configuration;
|
|
434
|
-
this._render();
|
|
435
|
-
}
|
|
436
|
-
onConfigurationChanged(c) {
|
|
437
|
-
this._configuration = prepareCustomizationObject(c, this._model).configuration;
|
|
438
|
-
if (this._model) {
|
|
439
|
-
this.onModelChanged(this._model);
|
|
440
|
-
}
|
|
441
|
-
this._render();
|
|
442
|
-
}
|
|
443
|
-
__init2() {
|
|
444
|
-
this.onModelUpdated = e => {
|
|
445
|
-
if (e.target === this) {
|
|
446
|
-
return;
|
|
447
|
-
}
|
|
448
|
-
e.preventDefault();
|
|
449
|
-
e.stopImmediatePropagation();
|
|
450
|
-
const id = e.target && e.target.getAttribute('id');
|
|
451
|
-
if (id) {
|
|
452
|
-
if (e.update) {
|
|
453
|
-
this._model[`part${id}`] = e.update;
|
|
454
|
-
}
|
|
455
|
-
this.dispatchEvent(new ModelUpdatedEvent_1(this._model));
|
|
456
|
-
}
|
|
457
|
-
};
|
|
458
|
-
}
|
|
459
|
-
connectedCallback() {
|
|
460
|
-
this.addEventListener(MODEL_UPDATED, this.onModelUpdated);
|
|
461
|
-
this._render();
|
|
462
|
-
}
|
|
463
|
-
disconnectedCallback() {
|
|
464
|
-
this.removeEventListener(MODEL_UPDATED, this.onModelUpdated);
|
|
465
|
-
}
|
|
466
|
-
_render() {
|
|
467
|
-
let element = React.createElement(Styled, {
|
|
468
|
-
model: this._model,
|
|
469
|
-
configuration: this._configuration,
|
|
470
|
-
onModelChanged: this.onModelChanged,
|
|
471
|
-
onConfigurationChanged: this.onConfigurationChanged
|
|
472
|
-
});
|
|
473
|
-
ReactDOM.render(element, this);
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
EbsrConfigure.__initStatic();
|
|
477
|
-
export {EbsrConfigure as default};
|