@pie-element/ebsr 10.2.9-next.22 → 10.2.9-next.7

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.
@@ -10,7 +10,7 @@
10
10
  "@material-ui/core": "^3.9.2",
11
11
  "@pie-element/multiple-choice": "^9.7.1",
12
12
  "@pie-framework/pie-configure-events": "^1.2.0",
13
- "@pie-lib/pie-toolbox": "2.7.0",
13
+ "@pie-lib/pie-toolbox": "2.6.1",
14
14
  "lodash": "^4.17.15",
15
15
  "prop-types": "^15.6.2",
16
16
  "react": "^16.8.1",
@@ -7,7 +7,7 @@
7
7
  "test": "echo \"Error: no test specified\" && exit 1"
8
8
  },
9
9
  "dependencies": {
10
- "@pie-lib/pie-toolbox": "2.7.0",
10
+ "@pie-lib/pie-toolbox": "2.6.1",
11
11
  "lodash": "^4.17.15"
12
12
  },
13
13
  "author": "",
@@ -1,6 +1,6 @@
1
1
  import {_dll_react, _dll_prop_types, _dll_lodash, _dll_react_dom} from "../../../@pie-lib/pie-toolbox-math-rendering-module@3.0.1/module/index.js";
2
2
  import MultipleChoiceConfigure from '@pie-element/multiple-choice/configure/lib';
3
- import {_dll_pie_lib__pie_toolbox_config_ui} from "../../../@pie-lib/pie-toolbox-module@5.7.2/module/index.js";
3
+ import {_dll_pie_lib__pie_toolbox_config_ui} from "../../../@pie-lib/pie-toolbox-module@5.7.1/module/index.js";
4
4
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
5
5
  function getDefaultExportFromCjs(x) {
6
6
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
@@ -23436,7 +23436,7 @@ var _default = {
23436
23436
  },
23437
23437
  imageClozeAssociation: {
23438
23438
  reachedLimit_one: 'You’ve reached the limit of {{count}} response per area. To add another response, one must first be removed.',
23439
- reachedLimit_other: 'Full'
23439
+ reachedLimit_other: 'You’ve reached the limit of {{count}} responses per area. To add another response, one must first be removed.'
23440
23440
  },
23441
23441
  drawingResponse: {
23442
23442
  fillColor: 'Fill color',
@@ -23532,7 +23532,7 @@ var _default = {
23532
23532
  },
23533
23533
  imageClozeAssociation: {
23534
23534
  reachedLimit_one: 'Has alcanzado el límite de {{count}} respuesta por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.',
23535
- reachedLimit_other: 'Lleno'
23535
+ reachedLimit_other: 'Has alcanzado el límite de {{count}} respuestas por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.'
23536
23536
  },
23537
23537
  drawingResponse: {
23538
23538
  fillColor: 'Color de relleno',
package/module/element.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_lodash, _dll_debug, _dll_pie_lib__pie_toolbox_math_rendering} from "../../../@pie-lib/pie-toolbox-math-rendering-module@3.0.1/module/index.js";
2
- import {_dll_pie_lib__pie_toolbox_render_ui, _dll_pie_lib__pie_toolbox_correct_answer_toggle} from "../../../@pie-lib/pie-toolbox-module@5.7.2/module/index.js";
2
+ import {_dll_pie_lib__pie_toolbox_render_ui, _dll_pie_lib__pie_toolbox_correct_answer_toggle} from "../../../@pie-lib/pie-toolbox-module@5.7.1/module/index.js";
3
3
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
4
4
  function getDefaultExportFromCjs(x) {
5
5
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
@@ -40,7 +40,7 @@ class ModelSetEvent extends CustomEvent {
40
40
  }
41
41
  }
42
42
  ModelSetEvent.TYPE = 'model-set';
43
- var ModelSetEvent_1 = lib$8.ModelSetEvent = ModelSetEvent;
43
+ lib$8.ModelSetEvent = ModelSetEvent;
44
44
  class SessionChangedEvent extends CustomEvent {
45
45
  constructor(component, complete) {
46
46
  super(SessionChangedEvent.TYPE, {
@@ -8451,7 +8451,7 @@ var en = {};
8451
8451
  },
8452
8452
  imageClozeAssociation: {
8453
8453
  reachedLimit_one: 'You’ve reached the limit of {{count}} response per area. To add another response, one must first be removed.',
8454
- reachedLimit_other: 'Full'
8454
+ reachedLimit_other: 'You’ve reached the limit of {{count}} responses per area. To add another response, one must first be removed.'
8455
8455
  },
8456
8456
  drawingResponse: {
8457
8457
  fillColor: 'Fill color',
@@ -8544,7 +8544,7 @@ var es = {};
8544
8544
  },
8545
8545
  imageClozeAssociation: {
8546
8546
  reachedLimit_one: 'Has alcanzado el límite de {{count}} respuesta por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.',
8547
- reachedLimit_other: 'Lleno'
8547
+ reachedLimit_other: 'Has alcanzado el límite de {{count}} respuestas por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.'
8548
8548
  },
8549
8549
  drawingResponse: {
8550
8550
  fillColor: 'Color de relleno',
@@ -12703,8 +12703,9 @@ class MultipleChoice$1 extends React$2.Component {
12703
12703
  MultipleChoice$1.prototype.__init2.call(this);
12704
12704
  MultipleChoice$1.prototype.__init3.call(this);
12705
12705
  this.state = {
12706
- showCorrect: this.props.alwaysShowCorrect || false,
12707
- maxSelectionsErrorState: false
12706
+ selectedValue: null,
12707
+ selectedValues: [],
12708
+ showCorrect: this.props.alwaysShowCorrect || false
12708
12709
  };
12709
12710
  this.onToggle = this.onToggle.bind(this);
12710
12711
  }
@@ -12715,14 +12716,22 @@ class MultipleChoice$1 extends React$2.Component {
12715
12716
  __init() {
12716
12717
  this.handleChange = event => {
12717
12718
  const {value, checked} = event.target;
12718
- const {maxSelections, onChoiceChanged, session} = this.props;
12719
- if (session.value && session.value.length >= maxSelections) {
12719
+ const {choiceMode, maxSelections, onChoiceChanged} = this.props;
12720
+ if (choiceMode === 'radio') {
12720
12721
  this.setState({
12721
- maxSelectionsErrorState: checked
12722
+ selectedValue: value
12722
12723
  });
12723
- if (checked) {
12724
+ } else {
12725
+ const {selectedValues} = this.state;
12726
+ if (checked && selectedValues.length >= maxSelections) {
12724
12727
  return;
12725
12728
  }
12729
+ this.setState(prevState => {
12730
+ const selectedValues = checked ? [...prevState.selectedValues, value] : prevState.selectedValues.filter(currentValue => currentValue !== value);
12731
+ return {
12732
+ selectedValues
12733
+ };
12734
+ });
12726
12735
  }
12727
12736
  onChoiceChanged({
12728
12737
  value,
@@ -12798,7 +12807,10 @@ class MultipleChoice$1 extends React$2.Component {
12798
12807
  if (this.state.showCorrect) {
12799
12808
  return choice.correct || false;
12800
12809
  }
12801
- return this.isSelected(choice.value);
12810
+ if (this.isSelected(choice.value)) {
12811
+ return true;
12812
+ }
12813
+ return this.props.choiceMode === 'radio' ? this.state.selectedValue === choice.value : this.state.selectedValues.includes(choice.value);
12802
12814
  }
12803
12815
  renderHeading() {
12804
12816
  const {mode, choiceMode, classes} = this.props;
@@ -12810,20 +12822,20 @@ class MultipleChoice$1 extends React$2.Component {
12810
12822
  __self: this,
12811
12823
  __source: {
12812
12824
  fileName: _jsxFileName$1,
12813
- lineNumber: 209
12825
+ lineNumber: 225
12814
12826
  }
12815
12827
  }, "Multiple Choice Question") : React$2.createElement('h2', {
12816
12828
  className: classes.srOnly,
12817
12829
  __self: this,
12818
12830
  __source: {
12819
12831
  fileName: _jsxFileName$1,
12820
- lineNumber: 211
12832
+ lineNumber: 227
12821
12833
  }
12822
12834
  }, "Multiple Select Question");
12823
12835
  }
12824
12836
  render() {
12825
12837
  const {mode, disabled, className, choices = [], choiceMode, gridColumns, partLabel, prompt, responseCorrect, teacherInstructions, classes, alwaysShowCorrect, animationsDisabled, language, isSelectionButtonBelow, minSelections, maxSelections, session} = this.props;
12826
- const {showCorrect, maxSelectionsErrorState} = this.state;
12838
+ const {showCorrect} = this.state;
12827
12839
  const isEvaluateMode = mode === 'evaluate';
12828
12840
  const showCorrectAnswerToggle = isEvaluateMode && !responseCorrect;
12829
12841
  const columnsStyle = gridColumns > 1 ? {
@@ -12838,7 +12850,7 @@ class MultipleChoice$1 extends React$2.Component {
12838
12850
  __self: this,
12839
12851
  __source: {
12840
12852
  fileName: _jsxFileName$1,
12841
- lineNumber: 243
12853
+ lineNumber: 259
12842
12854
  }
12843
12855
  });
12844
12856
  return React$2.createElement('div', {
@@ -12846,21 +12858,21 @@ class MultipleChoice$1 extends React$2.Component {
12846
12858
  __self: this,
12847
12859
  __source: {
12848
12860
  fileName: _jsxFileName$1,
12849
- lineNumber: 252
12861
+ lineNumber: 268
12850
12862
  }
12851
12863
  }, partLabel && React$2.createElement('h3', {
12852
12864
  className: classes.partLabel,
12853
12865
  __self: this,
12854
12866
  __source: {
12855
12867
  fileName: _jsxFileName$1,
12856
- lineNumber: 253
12868
+ lineNumber: 269
12857
12869
  }
12858
12870
  }, partLabel), this.renderHeading(), teacherInstructions && React$2.createElement('div', {
12859
12871
  className: classes.teacherInstructions,
12860
12872
  __self: this,
12861
12873
  __source: {
12862
12874
  fileName: _jsxFileName$1,
12863
- lineNumber: 258
12875
+ lineNumber: 274
12864
12876
  }
12865
12877
  }, !animationsDisabled ? React$2.createElement(Collapsible, {
12866
12878
  labels: {
@@ -12870,14 +12882,14 @@ class MultipleChoice$1 extends React$2.Component {
12870
12882
  __self: this,
12871
12883
  __source: {
12872
12884
  fileName: _jsxFileName$1,
12873
- lineNumber: 260
12885
+ lineNumber: 276
12874
12886
  }
12875
12887
  }, teacherInstructionsDiv) : teacherInstructionsDiv), React$2.createElement('fieldset', {
12876
12888
  className: classes.fieldset,
12877
12889
  __self: this,
12878
12890
  __source: {
12879
12891
  fileName: _jsxFileName$1,
12880
- lineNumber: 274
12892
+ lineNumber: 290
12881
12893
  }
12882
12894
  }, React$2.createElement(PreviewPrompt, {
12883
12895
  className: "prompt",
@@ -12887,7 +12899,7 @@ class MultipleChoice$1 extends React$2.Component {
12887
12899
  __self: this,
12888
12900
  __source: {
12889
12901
  fileName: _jsxFileName$1,
12890
- lineNumber: 275
12902
+ lineNumber: 291
12891
12903
  }
12892
12904
  }), !alwaysShowCorrect && React$2.createElement(CorrectAnswerToggle, {
12893
12905
  show: showCorrectAnswerToggle,
@@ -12897,7 +12909,7 @@ class MultipleChoice$1 extends React$2.Component {
12897
12909
  __self: this,
12898
12910
  __source: {
12899
12911
  fileName: _jsxFileName$1,
12900
- lineNumber: 278
12912
+ lineNumber: 294
12901
12913
  }
12902
12914
  }), React$2.createElement('div', {
12903
12915
  className: classNames({
@@ -12908,7 +12920,7 @@ class MultipleChoice$1 extends React$2.Component {
12908
12920
  __self: this,
12909
12921
  __source: {
12910
12922
  fileName: _jsxFileName$1,
12911
- lineNumber: 286
12923
+ lineNumber: 302
12912
12924
  }
12913
12925
  }, choices.map((choice, index) => React$2.createElement(StyledChoice, {
12914
12926
  choicesLayout: this.props.choicesLayout,
@@ -12931,24 +12943,24 @@ class MultipleChoice$1 extends React$2.Component {
12931
12943
  __self: this,
12932
12944
  __source: {
12933
12945
  fileName: _jsxFileName$1,
12934
- lineNumber: 294
12946
+ lineNumber: 310
12935
12947
  }
12936
12948
  })))), choiceMode === 'checkbox' && selections < minSelections && React$2.createElement('div', {
12937
12949
  className: classes.errorText,
12938
12950
  __self: this,
12939
12951
  __source: {
12940
12952
  fileName: _jsxFileName$1,
12941
- lineNumber: 318
12953
+ lineNumber: 334
12942
12954
  }
12943
12955
  }, translator.t(`translation:multipleChoice:minSelections_${minSelections === 1 ? 'one' : 'other'}`, {
12944
12956
  lng: language,
12945
12957
  minSelections
12946
- })), choiceMode === 'checkbox' && maxSelectionsErrorState && React$2.createElement('div', {
12958
+ })), choiceMode === 'checkbox' && selections >= maxSelections && React$2.createElement('div', {
12947
12959
  className: classes.errorText,
12948
12960
  __self: this,
12949
12961
  __source: {
12950
12962
  fileName: _jsxFileName$1,
12951
- lineNumber: 326
12963
+ lineNumber: 342
12952
12964
  }
12953
12965
  }, translator.t(`translation:multipleChoice:maxSelections_${maxSelections === 1 ? 'one' : 'other'}`, {
12954
12966
  lng: language,
@@ -13070,7 +13082,7 @@ const isComplete = (session, model) => {
13070
13082
  if (!session || !session.value) {
13071
13083
  return false;
13072
13084
  }
13073
- const {choiceMode, minSelections = 1, maxSelections} = model || ({});
13085
+ const {choiceMode, minSelections, maxSelections} = model || ({});
13074
13086
  const selections = session.value.length || 0;
13075
13087
  if (choiceMode === 'radio') {
13076
13088
  return !!selections;
@@ -13108,10 +13120,27 @@ class MultipleChoice extends HTMLElement {
13108
13120
  trailing: true
13109
13121
  });
13110
13122
  this._dispatchResponseChanged = debounce(() => {
13111
- this.dispatchEvent(new SessionChangedEvent_1(this.tagName.toLowerCase(), isComplete(this._session, this._model)));
13123
+ console.log('>> dispatch event');
13124
+ var event = new CustomEvent('session-changed', {
13125
+ bubbles: true,
13126
+ composed: true,
13127
+ detail: {
13128
+ complete: isComplete(this._session, this._model),
13129
+ component: this.tagName.toLowerCase()
13130
+ }
13131
+ });
13132
+ this.dispatchEvent(event);
13112
13133
  });
13113
13134
  this._dispatchModelSet = debounce(() => {
13114
- this.dispatchEvent(new ModelSetEvent_1(this.tagName.toLowerCase(), isComplete(this._session, this._model), this._model !== undefined));
13135
+ this.dispatchEvent(new CustomEvent('model-set', {
13136
+ bubbles: true,
13137
+ composed: true,
13138
+ detail: {
13139
+ complete: isComplete(this._session, this._model),
13140
+ component: this.tagName.toLowerCase(),
13141
+ hasModel: this._model !== undefined
13142
+ }
13143
+ }));
13115
13144
  }, 50, {
13116
13145
  leading: false,
13117
13146
  trailing: true
@@ -8,7 +8,7 @@
8
8
  },
9
9
  {
10
10
  "name": "@pie-lib/pie-toolbox-module",
11
- "version": "5.7.2"
11
+ "version": "5.7.1"
12
12
  }
13
13
  ]
14
14
  }
package/module/print.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_lodash, _dll_debug, _dll_pie_lib__pie_toolbox_math_rendering} from "../../../@pie-lib/pie-toolbox-math-rendering-module@3.0.1/module/index.js";
2
- import {_dll_pie_lib__pie_toolbox_render_ui, _dll_pie_lib__pie_toolbox_correct_answer_toggle} from "../../../@pie-lib/pie-toolbox-module@5.7.2/module/index.js";
2
+ import {_dll_pie_lib__pie_toolbox_render_ui, _dll_pie_lib__pie_toolbox_correct_answer_toggle} from "../../../@pie-lib/pie-toolbox-module@5.7.1/module/index.js";
3
3
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
4
4
  function getDefaultExportFromCjs(x) {
5
5
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
@@ -8414,7 +8414,7 @@ var en = {};
8414
8414
  },
8415
8415
  imageClozeAssociation: {
8416
8416
  reachedLimit_one: 'You’ve reached the limit of {{count}} response per area. To add another response, one must first be removed.',
8417
- reachedLimit_other: 'Full'
8417
+ reachedLimit_other: 'You’ve reached the limit of {{count}} responses per area. To add another response, one must first be removed.'
8418
8418
  },
8419
8419
  drawingResponse: {
8420
8420
  fillColor: 'Fill color',
@@ -8507,7 +8507,7 @@ var es = {};
8507
8507
  },
8508
8508
  imageClozeAssociation: {
8509
8509
  reachedLimit_one: 'Has alcanzado el límite de {{count}} respuesta por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.',
8510
- reachedLimit_other: 'Lleno'
8510
+ reachedLimit_other: 'Has alcanzado el límite de {{count}} respuestas por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.'
8511
8511
  },
8512
8512
  drawingResponse: {
8513
8513
  fillColor: 'Color de relleno',
@@ -12666,8 +12666,9 @@ class MultipleChoice$1 extends React$2.Component {
12666
12666
  MultipleChoice$1.prototype.__init2.call(this);
12667
12667
  MultipleChoice$1.prototype.__init3.call(this);
12668
12668
  this.state = {
12669
- showCorrect: this.props.alwaysShowCorrect || false,
12670
- maxSelectionsErrorState: false
12669
+ selectedValue: null,
12670
+ selectedValues: [],
12671
+ showCorrect: this.props.alwaysShowCorrect || false
12671
12672
  };
12672
12673
  this.onToggle = this.onToggle.bind(this);
12673
12674
  }
@@ -12678,14 +12679,22 @@ class MultipleChoice$1 extends React$2.Component {
12678
12679
  __init() {
12679
12680
  this.handleChange = event => {
12680
12681
  const {value, checked} = event.target;
12681
- const {maxSelections, onChoiceChanged, session} = this.props;
12682
- if (session.value && session.value.length >= maxSelections) {
12682
+ const {choiceMode, maxSelections, onChoiceChanged} = this.props;
12683
+ if (choiceMode === 'radio') {
12683
12684
  this.setState({
12684
- maxSelectionsErrorState: checked
12685
+ selectedValue: value
12685
12686
  });
12686
- if (checked) {
12687
+ } else {
12688
+ const {selectedValues} = this.state;
12689
+ if (checked && selectedValues.length >= maxSelections) {
12687
12690
  return;
12688
12691
  }
12692
+ this.setState(prevState => {
12693
+ const selectedValues = checked ? [...prevState.selectedValues, value] : prevState.selectedValues.filter(currentValue => currentValue !== value);
12694
+ return {
12695
+ selectedValues
12696
+ };
12697
+ });
12689
12698
  }
12690
12699
  onChoiceChanged({
12691
12700
  value,
@@ -12761,7 +12770,10 @@ class MultipleChoice$1 extends React$2.Component {
12761
12770
  if (this.state.showCorrect) {
12762
12771
  return choice.correct || false;
12763
12772
  }
12764
- return this.isSelected(choice.value);
12773
+ if (this.isSelected(choice.value)) {
12774
+ return true;
12775
+ }
12776
+ return this.props.choiceMode === 'radio' ? this.state.selectedValue === choice.value : this.state.selectedValues.includes(choice.value);
12765
12777
  }
12766
12778
  renderHeading() {
12767
12779
  const {mode, choiceMode, classes} = this.props;
@@ -12773,20 +12785,20 @@ class MultipleChoice$1 extends React$2.Component {
12773
12785
  __self: this,
12774
12786
  __source: {
12775
12787
  fileName: _jsxFileName$1,
12776
- lineNumber: 209
12788
+ lineNumber: 225
12777
12789
  }
12778
12790
  }, "Multiple Choice Question") : React$2.createElement('h2', {
12779
12791
  className: classes.srOnly,
12780
12792
  __self: this,
12781
12793
  __source: {
12782
12794
  fileName: _jsxFileName$1,
12783
- lineNumber: 211
12795
+ lineNumber: 227
12784
12796
  }
12785
12797
  }, "Multiple Select Question");
12786
12798
  }
12787
12799
  render() {
12788
12800
  const {mode, disabled, className, choices = [], choiceMode, gridColumns, partLabel, prompt, responseCorrect, teacherInstructions, classes, alwaysShowCorrect, animationsDisabled, language, isSelectionButtonBelow, minSelections, maxSelections, session} = this.props;
12789
- const {showCorrect, maxSelectionsErrorState} = this.state;
12801
+ const {showCorrect} = this.state;
12790
12802
  const isEvaluateMode = mode === 'evaluate';
12791
12803
  const showCorrectAnswerToggle = isEvaluateMode && !responseCorrect;
12792
12804
  const columnsStyle = gridColumns > 1 ? {
@@ -12801,7 +12813,7 @@ class MultipleChoice$1 extends React$2.Component {
12801
12813
  __self: this,
12802
12814
  __source: {
12803
12815
  fileName: _jsxFileName$1,
12804
- lineNumber: 243
12816
+ lineNumber: 259
12805
12817
  }
12806
12818
  });
12807
12819
  return React$2.createElement('div', {
@@ -12809,21 +12821,21 @@ class MultipleChoice$1 extends React$2.Component {
12809
12821
  __self: this,
12810
12822
  __source: {
12811
12823
  fileName: _jsxFileName$1,
12812
- lineNumber: 252
12824
+ lineNumber: 268
12813
12825
  }
12814
12826
  }, partLabel && React$2.createElement('h3', {
12815
12827
  className: classes.partLabel,
12816
12828
  __self: this,
12817
12829
  __source: {
12818
12830
  fileName: _jsxFileName$1,
12819
- lineNumber: 253
12831
+ lineNumber: 269
12820
12832
  }
12821
12833
  }, partLabel), this.renderHeading(), teacherInstructions && React$2.createElement('div', {
12822
12834
  className: classes.teacherInstructions,
12823
12835
  __self: this,
12824
12836
  __source: {
12825
12837
  fileName: _jsxFileName$1,
12826
- lineNumber: 258
12838
+ lineNumber: 274
12827
12839
  }
12828
12840
  }, !animationsDisabled ? React$2.createElement(Collapsible, {
12829
12841
  labels: {
@@ -12833,14 +12845,14 @@ class MultipleChoice$1 extends React$2.Component {
12833
12845
  __self: this,
12834
12846
  __source: {
12835
12847
  fileName: _jsxFileName$1,
12836
- lineNumber: 260
12848
+ lineNumber: 276
12837
12849
  }
12838
12850
  }, teacherInstructionsDiv) : teacherInstructionsDiv), React$2.createElement('fieldset', {
12839
12851
  className: classes.fieldset,
12840
12852
  __self: this,
12841
12853
  __source: {
12842
12854
  fileName: _jsxFileName$1,
12843
- lineNumber: 274
12855
+ lineNumber: 290
12844
12856
  }
12845
12857
  }, React$2.createElement(PreviewPrompt, {
12846
12858
  className: "prompt",
@@ -12850,7 +12862,7 @@ class MultipleChoice$1 extends React$2.Component {
12850
12862
  __self: this,
12851
12863
  __source: {
12852
12864
  fileName: _jsxFileName$1,
12853
- lineNumber: 275
12865
+ lineNumber: 291
12854
12866
  }
12855
12867
  }), !alwaysShowCorrect && React$2.createElement(CorrectAnswerToggle, {
12856
12868
  show: showCorrectAnswerToggle,
@@ -12860,7 +12872,7 @@ class MultipleChoice$1 extends React$2.Component {
12860
12872
  __self: this,
12861
12873
  __source: {
12862
12874
  fileName: _jsxFileName$1,
12863
- lineNumber: 278
12875
+ lineNumber: 294
12864
12876
  }
12865
12877
  }), React$2.createElement('div', {
12866
12878
  className: classNames({
@@ -12871,7 +12883,7 @@ class MultipleChoice$1 extends React$2.Component {
12871
12883
  __self: this,
12872
12884
  __source: {
12873
12885
  fileName: _jsxFileName$1,
12874
- lineNumber: 286
12886
+ lineNumber: 302
12875
12887
  }
12876
12888
  }, choices.map((choice, index) => React$2.createElement(StyledChoice, {
12877
12889
  choicesLayout: this.props.choicesLayout,
@@ -12894,24 +12906,24 @@ class MultipleChoice$1 extends React$2.Component {
12894
12906
  __self: this,
12895
12907
  __source: {
12896
12908
  fileName: _jsxFileName$1,
12897
- lineNumber: 294
12909
+ lineNumber: 310
12898
12910
  }
12899
12911
  })))), choiceMode === 'checkbox' && selections < minSelections && React$2.createElement('div', {
12900
12912
  className: classes.errorText,
12901
12913
  __self: this,
12902
12914
  __source: {
12903
12915
  fileName: _jsxFileName$1,
12904
- lineNumber: 318
12916
+ lineNumber: 334
12905
12917
  }
12906
12918
  }, translator$1.t(`translation:multipleChoice:minSelections_${minSelections === 1 ? 'one' : 'other'}`, {
12907
12919
  lng: language,
12908
12920
  minSelections
12909
- })), choiceMode === 'checkbox' && maxSelectionsErrorState && React$2.createElement('div', {
12921
+ })), choiceMode === 'checkbox' && selections >= maxSelections && React$2.createElement('div', {
12910
12922
  className: classes.errorText,
12911
12923
  __self: this,
12912
12924
  __source: {
12913
12925
  fileName: _jsxFileName$1,
12914
- lineNumber: 326
12926
+ lineNumber: 342
12915
12927
  }
12916
12928
  }, translator$1.t(`translation:multipleChoice:maxSelections_${maxSelections === 1 ? 'one' : 'other'}`, {
12917
12929
  lng: language,
@@ -13003,43 +13015,6 @@ const Root = props => React$1.createElement(styles$b.MuiThemeProvider, {
13003
13015
  lineNumber: 59
13004
13016
  }
13005
13017
  }));
13006
- var lib = {};
13007
- Object.defineProperty(lib, "__esModule", {
13008
- value: true
13009
- });
13010
- class ModelSetEvent extends CustomEvent {
13011
- constructor(component, complete, hasModel) {
13012
- super(ModelSetEvent.TYPE, {
13013
- bubbles: true,
13014
- composed: true,
13015
- detail: {
13016
- complete,
13017
- component,
13018
- hasModel
13019
- }
13020
- });
13021
- this.component = component;
13022
- this.complete = complete;
13023
- }
13024
- }
13025
- ModelSetEvent.TYPE = 'model-set';
13026
- var ModelSetEvent_1 = lib.ModelSetEvent = ModelSetEvent;
13027
- class SessionChangedEvent extends CustomEvent {
13028
- constructor(component, complete) {
13029
- super(SessionChangedEvent.TYPE, {
13030
- bubbles: true,
13031
- composed: true,
13032
- detail: {
13033
- complete,
13034
- component
13035
- }
13036
- });
13037
- this.component = component;
13038
- this.complete = complete;
13039
- }
13040
- }
13041
- SessionChangedEvent.TYPE = 'session-changed';
13042
- var SessionChangedEvent_1 = lib.SessionChangedEvent = SessionChangedEvent;
13043
13018
  const {concat: concat} = _dll_lodash;
13044
13019
  const {uniq: uniq} = _dll_lodash;
13045
13020
  const {without: without} = _dll_lodash;
@@ -13070,7 +13045,7 @@ const isComplete = (session, model) => {
13070
13045
  if (!session || !session.value) {
13071
13046
  return false;
13072
13047
  }
13073
- const {choiceMode, minSelections = 1, maxSelections} = model || ({});
13048
+ const {choiceMode, minSelections, maxSelections} = model || ({});
13074
13049
  const selections = session.value.length || 0;
13075
13050
  if (choiceMode === 'radio') {
13076
13051
  return !!selections;
@@ -13108,10 +13083,27 @@ class MultipleChoice extends HTMLElement {
13108
13083
  trailing: true
13109
13084
  });
13110
13085
  this._dispatchResponseChanged = debounce(() => {
13111
- this.dispatchEvent(new SessionChangedEvent_1(this.tagName.toLowerCase(), isComplete(this._session, this._model)));
13086
+ console.log('>> dispatch event');
13087
+ var event = new CustomEvent('session-changed', {
13088
+ bubbles: true,
13089
+ composed: true,
13090
+ detail: {
13091
+ complete: isComplete(this._session, this._model),
13092
+ component: this.tagName.toLowerCase()
13093
+ }
13094
+ });
13095
+ this.dispatchEvent(event);
13112
13096
  });
13113
13097
  this._dispatchModelSet = debounce(() => {
13114
- this.dispatchEvent(new ModelSetEvent_1(this.tagName.toLowerCase(), isComplete(this._session, this._model), this._model !== undefined));
13098
+ this.dispatchEvent(new CustomEvent('model-set', {
13099
+ bubbles: true,
13100
+ composed: true,
13101
+ detail: {
13102
+ complete: isComplete(this._session, this._model),
13103
+ component: this.tagName.toLowerCase(),
13104
+ hasModel: this._model !== undefined
13105
+ }
13106
+ }));
13115
13107
  }, 50, {
13116
13108
  leading: false,
13117
13109
  trailing: true
@@ -13147,6 +13139,43 @@ class MultipleChoice extends HTMLElement {
13147
13139
  this._rerender();
13148
13140
  }
13149
13141
  }
13142
+ var lib = {};
13143
+ Object.defineProperty(lib, "__esModule", {
13144
+ value: true
13145
+ });
13146
+ class ModelSetEvent extends CustomEvent {
13147
+ constructor(component, complete, hasModel) {
13148
+ super(ModelSetEvent.TYPE, {
13149
+ bubbles: true,
13150
+ composed: true,
13151
+ detail: {
13152
+ complete,
13153
+ component,
13154
+ hasModel
13155
+ }
13156
+ });
13157
+ this.component = component;
13158
+ this.complete = complete;
13159
+ }
13160
+ }
13161
+ ModelSetEvent.TYPE = 'model-set';
13162
+ lib.ModelSetEvent = ModelSetEvent;
13163
+ class SessionChangedEvent extends CustomEvent {
13164
+ constructor(component, complete) {
13165
+ super(SessionChangedEvent.TYPE, {
13166
+ bubbles: true,
13167
+ composed: true,
13168
+ detail: {
13169
+ complete,
13170
+ component
13171
+ }
13172
+ });
13173
+ this.component = component;
13174
+ this.complete = complete;
13175
+ }
13176
+ }
13177
+ SessionChangedEvent.TYPE = 'session-changed';
13178
+ var SessionChangedEvent_1 = lib.SessionChangedEvent = SessionChangedEvent;
13150
13179
  const {cloneDeep: cloneDeep} = _dll_lodash;
13151
13180
  const {get: get} = _dll_lodash;
13152
13181
  const debug = _dll_debug;
package/package.json CHANGED
@@ -1,22 +1,22 @@
1
1
  {
2
2
  "name": "@pie-element/ebsr",
3
- "version": "10.2.9-next.22+6517bb532",
3
+ "version": "10.2.9-next.7+2e72baca5",
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": "^9.7.2-next.22+6517bb532",
10
+ "@pie-element/multiple-choice": "^9.7.2-next.7+2e72baca5",
11
11
  "@pie-framework/pie-player-events": "^0.1.0",
12
- "@pie-lib/pie-toolbox": "2.7.0",
12
+ "@pie-lib/pie-toolbox": "2.6.1",
13
13
  "classnames": "^2.2.5",
14
14
  "debug": "^4.1.1",
15
15
  "lodash": "^4.17.11"
16
16
  },
17
17
  "author": "pie framework developers",
18
18
  "license": "ISC",
19
- "gitHead": "6517bb532d2b416fdf57525a3d50c62c83fdc543",
19
+ "gitHead": "2e72baca5a8804c802a4bd5e45ff59feccee930e",
20
20
  "scripts": {
21
21
  "postpublish": "../../scripts/postpublish"
22
22
  },