@pie-element/multiple-choice 5.11.0-print.7 → 5.11.0-ps.11
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/configure/package.json +3 -3
- package/docs/config-schema.json +16 -0
- package/docs/config-schema.json.md +12 -0
- package/docs/pie-schema.json +6 -0
- package/docs/pie-schema.json.md +4 -0
- package/module/configure.js +63 -85
- package/module/controller.js +678 -375
- package/module/demo.js +14 -54
- package/module/element.js +571 -3144
- package/module/index.html +11 -2
- package/module/manifest.json +3 -3
- package/module/print-demo.js +115 -0
- package/module/print.html +2 -2
- package/module/print.js +576 -3147
- package/package.json +4 -4
package/configure/package.json
CHANGED
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
"@material-ui/core": "^3.9.2",
|
|
9
9
|
"@material-ui/icons": "^3.0.1",
|
|
10
10
|
"@pie-framework/pie-configure-events": "^1.2.0",
|
|
11
|
-
"@pie-lib/config-ui": "^10.10.
|
|
12
|
-
"@pie-lib/editable-html": "^7.17.
|
|
13
|
-
"@pie-lib/scoring-config": "^3.5.
|
|
11
|
+
"@pie-lib/config-ui": "^10.10.3",
|
|
12
|
+
"@pie-lib/editable-html": "^7.17.3",
|
|
13
|
+
"@pie-lib/scoring-config": "^3.5.132",
|
|
14
14
|
"debug": "^3.1.0",
|
|
15
15
|
"lodash": "^4.17.15",
|
|
16
16
|
"prop-types": "^15.6.2",
|
package/docs/config-schema.json
CHANGED
|
@@ -255,6 +255,22 @@
|
|
|
255
255
|
}
|
|
256
256
|
}
|
|
257
257
|
},
|
|
258
|
+
"accessibility": {
|
|
259
|
+
"title": "ConfigureProp",
|
|
260
|
+
"type": "object",
|
|
261
|
+
"properties": {
|
|
262
|
+
"settings": {
|
|
263
|
+
"description": "Indicates if the item has to be displayed in the Settings Panel",
|
|
264
|
+
"type": "boolean",
|
|
265
|
+
"title": "settings"
|
|
266
|
+
},
|
|
267
|
+
"label": {
|
|
268
|
+
"description": "Indicates the label for the item that has to be displayed in the Settings Panel",
|
|
269
|
+
"type": "string",
|
|
270
|
+
"title": "label"
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
},
|
|
258
274
|
"showPrompt": {
|
|
259
275
|
"description": "Determines whether prompt field will be displayed or not",
|
|
260
276
|
"default": true,
|
|
@@ -197,6 +197,18 @@ Indicates the label for the item that has to be displayed in the Settings Panel
|
|
|
197
197
|
Indicates the value of the item if it affects config-ui
|
|
198
198
|
(eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
|
|
199
199
|
|
|
200
|
+
# `accessibility` (object)
|
|
201
|
+
|
|
202
|
+
Properties of the `accessibility` object:
|
|
203
|
+
|
|
204
|
+
## `settings` (boolean)
|
|
205
|
+
|
|
206
|
+
Indicates if the item has to be displayed in the Settings Panel
|
|
207
|
+
|
|
208
|
+
## `label` (string)
|
|
209
|
+
|
|
210
|
+
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
211
|
+
|
|
200
212
|
# `showPrompt` (boolean)
|
|
201
213
|
|
|
202
214
|
Determines whether prompt field will be displayed or not
|
package/docs/pie-schema.json
CHANGED
|
@@ -173,6 +173,11 @@
|
|
|
173
173
|
"type": "boolean",
|
|
174
174
|
"title": "teacherInstructionsEnabled"
|
|
175
175
|
},
|
|
176
|
+
"accessibilityLabelsEnabled": {
|
|
177
|
+
"description": "Indicates if Accessibility Labels are enabled",
|
|
178
|
+
"type": "boolean",
|
|
179
|
+
"title": "accessibilityLabelsEnabled"
|
|
180
|
+
},
|
|
176
181
|
"id": {
|
|
177
182
|
"description": "Identifier to identify the Pie Element in html markup, Must be unique within a pie item config.",
|
|
178
183
|
"type": "string",
|
|
@@ -185,6 +190,7 @@
|
|
|
185
190
|
}
|
|
186
191
|
},
|
|
187
192
|
"required": [
|
|
193
|
+
"accessibilityLabelsEnabled",
|
|
188
194
|
"choices",
|
|
189
195
|
"element",
|
|
190
196
|
"feedbackEnabled",
|
package/docs/pie-schema.json.md
CHANGED
|
@@ -150,6 +150,10 @@ Indicates if Student Instructions are enabled
|
|
|
150
150
|
|
|
151
151
|
Indicates if Teacher Instructions are enabled
|
|
152
152
|
|
|
153
|
+
# `accessibilityLabelsEnabled` (boolean, required)
|
|
154
|
+
|
|
155
|
+
Indicates if Accessibility Labels are enabled
|
|
156
|
+
|
|
153
157
|
# `id` (string, required)
|
|
154
158
|
|
|
155
159
|
Identifier to identify the Pie Element in html markup, Must be unique within a pie item config.
|
package/module/configure.js
CHANGED
|
@@ -1,64 +1,51 @@
|
|
|
1
|
-
import {_dll_react, _dll_prop_types, _dll_material_ui__core_styles, _dll_material_ui__core, _dll_lodash, _dll_pie_lib__render_ui, _dll_debug, _dll_react_dom} from "../../../@pie-lib/shared-module@^1.
|
|
2
|
-
import {_dll_pie_lib__config_ui} from "../../../@pie-lib/config-module@^1.0.
|
|
3
|
-
import {_dll_pie_lib__editable_html} from "../../../@pie-lib/editable-html-module@^1.0.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
bubbles: true,
|
|
20
|
-
detail: {
|
|
21
|
-
update,
|
|
22
|
-
reset
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
this.update = update;
|
|
26
|
-
this.reset = reset;
|
|
27
|
-
}
|
|
1
|
+
import {_dll_react, _dll_prop_types, _dll_material_ui__core_styles, _dll_material_ui__core, _dll_lodash, _dll_pie_lib__render_ui, _dll_debug, _dll_react_dom} from "../../../@pie-lib/shared-module@^1.2.6/module/index.js";
|
|
2
|
+
import {_dll_pie_lib__config_ui} from "../../../@pie-lib/config-module@^1.0.7/module/index.js";
|
|
3
|
+
import {_dll_pie_lib__editable_html} from "../../../@pie-lib/editable-html-module@^1.0.7/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;
|
|
28
19
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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;
|
|
43
34
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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;
|
|
54
45
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
unwrapExports(lib);
|
|
59
|
-
var lib_1 = lib.ModelUpdatedEvent;
|
|
60
|
-
var lib_2 = lib.DeleteImageEvent;
|
|
61
|
-
var lib_3 = lib.InsertImageEvent;
|
|
46
|
+
}
|
|
47
|
+
InsertImageEvent.TYPE = 'insert.image';
|
|
48
|
+
var InsertImageEvent_1 = lib.InsertImageEvent = InsertImageEvent;
|
|
62
49
|
const React$1 = _dll_react;
|
|
63
50
|
const PropTypes = _dll_prop_types;
|
|
64
51
|
const {color: color} = _dll_pie_lib__render_ui;
|
|
@@ -313,17 +300,15 @@ const Design = withStyles(styles)(props => {
|
|
|
313
300
|
limitChoicesNumber: limitChoicesNumber.settings && toggle(limitChoicesNumber.label),
|
|
314
301
|
lockChoiceOrder: lockChoiceOrder.settings && toggle(lockChoiceOrder.label),
|
|
315
302
|
feedbackEnabled: feedback.settings && toggle(feedback.label),
|
|
316
|
-
choicesLayout: choicesLayout.settings && dropdown(choicesLayout.label, ['vertical', 'grid', 'horizontal'])
|
|
303
|
+
choicesLayout: choicesLayout.settings && dropdown(choicesLayout.label, ['vertical', 'grid', 'horizontal']),
|
|
304
|
+
gridColumns: choicesLayout.settings && model.choicesLayout === 'grid' && nrOfColumnsAvailable.length > 0 && dropdown(gridColumns.label, nrOfColumnsAvailable)
|
|
317
305
|
};
|
|
318
|
-
if (model.choicesLayout === 'grid' && nrOfColumnsAvailable.length > 0) {
|
|
319
|
-
settingsInPanel.gridColumns = dropdown(gridColumns.label, nrOfColumnsAvailable);
|
|
320
|
-
}
|
|
321
306
|
return React$1.createElement('div', {
|
|
322
307
|
className: classes.design,
|
|
323
308
|
__self: undefined,
|
|
324
309
|
__source: {
|
|
325
310
|
fileName: _jsxFileName,
|
|
326
|
-
lineNumber:
|
|
311
|
+
lineNumber: 278
|
|
327
312
|
}
|
|
328
313
|
}, settingsPanelDisabled ? Content : React$1.createElement(layout.ConfigLayout, {
|
|
329
314
|
settings: React$1.createElement(Panel, {
|
|
@@ -345,13 +330,13 @@ const Design = withStyles(styles)(props => {
|
|
|
345
330
|
__self: undefined,
|
|
346
331
|
__source: {
|
|
347
332
|
fileName: _jsxFileName,
|
|
348
|
-
lineNumber:
|
|
333
|
+
lineNumber: 284
|
|
349
334
|
}
|
|
350
335
|
}),
|
|
351
336
|
__self: undefined,
|
|
352
337
|
__source: {
|
|
353
338
|
fileName: _jsxFileName,
|
|
354
|
-
lineNumber:
|
|
339
|
+
lineNumber: 282
|
|
355
340
|
}
|
|
356
341
|
}, Content));
|
|
357
342
|
});
|
|
@@ -378,17 +363,6 @@ class Main extends React$1.Component {
|
|
|
378
363
|
})
|
|
379
364
|
};
|
|
380
365
|
}
|
|
381
|
-
componentDidMount() {
|
|
382
|
-
const {model, onModelChanged} = this.props;
|
|
383
|
-
const {verticalMode} = model;
|
|
384
|
-
if (verticalMode !== undefined) {
|
|
385
|
-
const choicesLayout = verticalMode === false ? 'horizontal' : 'vertical';
|
|
386
|
-
onModelChanged({
|
|
387
|
-
...model,
|
|
388
|
-
choicesLayout: choicesLayout
|
|
389
|
-
});
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
366
|
__init() {
|
|
393
367
|
this.onRemoveChoice = index => {
|
|
394
368
|
const {model} = this.props;
|
|
@@ -482,7 +456,7 @@ class Main extends React$1.Component {
|
|
|
482
456
|
__self: this,
|
|
483
457
|
__source: {
|
|
484
458
|
fileName: _jsxFileName,
|
|
485
|
-
lineNumber:
|
|
459
|
+
lineNumber: 414
|
|
486
460
|
}
|
|
487
461
|
});
|
|
488
462
|
}
|
|
@@ -613,11 +587,15 @@ const prepareCustomizationObject = (config, model) => {
|
|
|
613
587
|
};
|
|
614
588
|
class MultipleChoice extends HTMLElement {
|
|
615
589
|
static __initStatic() {
|
|
616
|
-
this.createDefaultModel = (model = {}) =>
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
590
|
+
this.createDefaultModel = (model = {}) => {
|
|
591
|
+
const normalizedModel = utils.normalizeChoices({
|
|
592
|
+
...sensibleDefaults.model,
|
|
593
|
+
...model,
|
|
594
|
+
choices: generateFormattedChoices(model && model.choices || [])
|
|
595
|
+
});
|
|
596
|
+
normalizedModel.choicesLayout = model.choicesLayout || model.verticalMode === false && 'horizontal' || sensibleDefaults.model.choicesLayout;
|
|
597
|
+
return normalizedModel;
|
|
598
|
+
};
|
|
621
599
|
}
|
|
622
600
|
constructor() {
|
|
623
601
|
super();
|
|
@@ -642,7 +620,7 @@ class MultipleChoice extends HTMLElement {
|
|
|
642
620
|
}
|
|
643
621
|
dispatchModelUpdated(reset) {
|
|
644
622
|
const resetValue = !!reset;
|
|
645
|
-
this.dispatchEvent(new
|
|
623
|
+
this.dispatchEvent(new ModelUpdatedEvent_1(this._model, resetValue));
|
|
646
624
|
}
|
|
647
625
|
onModelChanged(m, reset) {
|
|
648
626
|
this._model = m;
|
|
@@ -657,10 +635,10 @@ class MultipleChoice extends HTMLElement {
|
|
|
657
635
|
this._render();
|
|
658
636
|
}
|
|
659
637
|
insertImage(handler) {
|
|
660
|
-
this.dispatchEvent(new
|
|
638
|
+
this.dispatchEvent(new InsertImageEvent_1(handler));
|
|
661
639
|
}
|
|
662
640
|
onDeleteImage(src, done) {
|
|
663
|
-
this.dispatchEvent(new
|
|
641
|
+
this.dispatchEvent(new DeleteImageEvent_1(src, done));
|
|
664
642
|
}
|
|
665
643
|
_render() {
|
|
666
644
|
log('_render');
|