@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.
@@ -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.2",
12
- "@pie-lib/editable-html": "^7.17.2",
13
- "@pie-lib/scoring-config": "^3.5.131",
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",
@@ -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
@@ -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",
@@ -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.
@@ -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.1.0/module/index.js";
2
- import {_dll_pie_lib__config_ui} from "../../../@pie-lib/config-module@^1.0.1/module/index.js";
3
- import {_dll_pie_lib__editable_html} from "../../../@pie-lib/editable-html-module@^1.0.1/module/index.js";
4
- function unwrapExports(x) {
5
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
6
- }
7
- function createCommonjsModule(fn, module) {
8
- return (module = {
9
- exports: {}
10
- }, fn(module, module.exports), module.exports);
11
- }
12
- var lib = createCommonjsModule(function (module, exports) {
13
- Object.defineProperty(exports, "__esModule", {
14
- value: true
15
- });
16
- class ModelUpdatedEvent extends CustomEvent {
17
- constructor(update, reset = false) {
18
- super(ModelUpdatedEvent.TYPE, {
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
- ModelUpdatedEvent.TYPE = 'model.updated';
30
- exports.ModelUpdatedEvent = ModelUpdatedEvent;
31
- class DeleteImageEvent extends CustomEvent {
32
- constructor(src, done) {
33
- super(DeleteImageEvent.TYPE, {
34
- bubbles: true,
35
- detail: {
36
- src,
37
- done
38
- }
39
- });
40
- this.src = src;
41
- this.done = done;
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
- DeleteImageEvent.TYPE = 'delete.image';
45
- exports.DeleteImageEvent = DeleteImageEvent;
46
- class InsertImageEvent extends CustomEvent {
47
- constructor(handler) {
48
- super(InsertImageEvent.TYPE, {
49
- bubbles: true,
50
- detail: handler
51
- });
52
- this.handler = handler;
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
- InsertImageEvent.TYPE = 'insert.image';
56
- exports.InsertImageEvent = InsertImageEvent;
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: 277
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: 283
333
+ lineNumber: 284
349
334
  }
350
335
  }),
351
336
  __self: undefined,
352
337
  __source: {
353
338
  fileName: _jsxFileName,
354
- lineNumber: 281
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: 426
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 = {}) => utils.normalizeChoices({
617
- ...sensibleDefaults.model,
618
- ...model,
619
- choices: generateFormattedChoices(model && model.choices || [])
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 lib_1(this._model, resetValue));
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 lib_3(handler));
638
+ this.dispatchEvent(new InsertImageEvent_1(handler));
661
639
  }
662
640
  onDeleteImage(src, done) {
663
- this.dispatchEvent(new lib_2(src, done));
641
+ this.dispatchEvent(new DeleteImageEvent_1(src, done));
664
642
  }
665
643
  _render() {
666
644
  log('_render');