@pie-element/ebsr 7.0.18 → 7.0.21

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.
@@ -119,6 +119,22 @@
119
119
  }
120
120
  }
121
121
  },
122
+ "spellCheck": {
123
+ "title": "ConfigureProp",
124
+ "type": "object",
125
+ "properties": {
126
+ "settings": {
127
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
128
+ "type": "boolean",
129
+ "title": "settings"
130
+ },
131
+ "label": {
132
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
133
+ "type": "string",
134
+ "title": "label"
135
+ }
136
+ }
137
+ },
122
138
  "rationale": {
123
139
  "title": "ConfigureProp",
124
140
  "type": "object",
@@ -317,6 +333,22 @@
317
333
  }
318
334
  }
319
335
  },
336
+ "spellCheck": {
337
+ "title": "ConfigureProp",
338
+ "type": "object",
339
+ "properties": {
340
+ "settings": {
341
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
342
+ "type": "boolean",
343
+ "title": "settings"
344
+ },
345
+ "label": {
346
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
347
+ "type": "string",
348
+ "title": "label"
349
+ }
350
+ }
351
+ },
320
352
  "rationale": {
321
353
  "title": "ConfigureProp",
322
354
  "type": "object",
@@ -581,6 +613,22 @@
581
613
  }
582
614
  }
583
615
  },
616
+ "spellCheck": {
617
+ "title": "ConfigureProp",
618
+ "type": "object",
619
+ "properties": {
620
+ "settings": {
621
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
622
+ "type": "boolean",
623
+ "title": "settings"
624
+ },
625
+ "label": {
626
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
627
+ "type": "string",
628
+ "title": "label"
629
+ }
630
+ }
631
+ },
584
632
  "rationale": {
585
633
  "title": "ConfigureProp",
586
634
  "type": "object",
@@ -90,6 +90,18 @@ Indicates if the item has to be displayed in the Settings Panel
90
90
 
91
91
  Indicates the label for the item that has to be displayed in the Settings Panel
92
92
 
93
+ ## `spellCheck` (object)
94
+
95
+ Properties of the `spellCheck` object:
96
+
97
+ ### `settings` (boolean)
98
+
99
+ Indicates if the item has to be displayed in the Settings Panel
100
+
101
+ ### `label` (string)
102
+
103
+ Indicates the label for the item that has to be displayed in the Settings Panel
104
+
93
105
  ## `rationale` (object)
94
106
 
95
107
  Properties of the `rationale` object:
@@ -238,6 +250,18 @@ Indicates if the item has to be displayed in the Settings Panel
238
250
 
239
251
  Indicates the label for the item that has to be displayed in the Settings Panel
240
252
 
253
+ ## `spellCheck` (object)
254
+
255
+ Properties of the `spellCheck` object:
256
+
257
+ ### `settings` (boolean)
258
+
259
+ Indicates if the item has to be displayed in the Settings Panel
260
+
261
+ ### `label` (string)
262
+
263
+ Indicates the label for the item that has to be displayed in the Settings Panel
264
+
241
265
  ## `rationale` (object)
242
266
 
243
267
  Properties of the `rationale` object:
@@ -440,6 +464,18 @@ Indicates if the item has to be displayed in the Settings Panel
440
464
 
441
465
  Indicates the label for the item that has to be displayed in the Settings Panel
442
466
 
467
+ ### `spellCheck` (object)
468
+
469
+ Properties of the `spellCheck` object:
470
+
471
+ #### `settings` (boolean)
472
+
473
+ Indicates if the item has to be displayed in the Settings Panel
474
+
475
+ #### `label` (string)
476
+
477
+ Indicates the label for the item that has to be displayed in the Settings Panel
478
+
443
479
  ### `rationale` (object)
444
480
 
445
481
  Properties of the `rationale` object:
@@ -85,6 +85,11 @@
85
85
  "type": "boolean",
86
86
  "title": "rationaleEnabled"
87
87
  },
88
+ "spellCheckEnabled": {
89
+ "description": "Indicates if spellcheck is enabled for the author. Default value is true",
90
+ "type": "boolean",
91
+ "title": "spellCheckEnabled"
92
+ },
88
93
  "studentInstructionsEnabled": {
89
94
  "description": "Indicates if Student Instructions are enabled",
90
95
  "type": "boolean",
@@ -109,6 +114,7 @@
109
114
  "feedbackEnabled",
110
115
  "prompt",
111
116
  "rationaleEnabled",
117
+ "spellCheckEnabled",
112
118
  "studentInstructionsEnabled",
113
119
  "teacherInstructionsEnabled"
114
120
  ]
@@ -195,6 +201,11 @@
195
201
  "type": "boolean",
196
202
  "title": "rationaleEnabled"
197
203
  },
204
+ "spellCheckEnabled": {
205
+ "description": "Indicates if spellcheck is enabled for the author. Default value is true",
206
+ "type": "boolean",
207
+ "title": "spellCheckEnabled"
208
+ },
198
209
  "studentInstructionsEnabled": {
199
210
  "description": "Indicates if Student Instructions are enabled",
200
211
  "type": "boolean",
@@ -219,6 +230,7 @@
219
230
  "feedbackEnabled",
220
231
  "prompt",
221
232
  "rationaleEnabled",
233
+ "spellCheckEnabled",
222
234
  "studentInstructionsEnabled",
223
235
  "teacherInstructionsEnabled"
224
236
  ]
@@ -387,6 +399,22 @@
387
399
  }
388
400
  }
389
401
  },
402
+ "spellCheck": {
403
+ "title": "ConfigureProp",
404
+ "type": "object",
405
+ "properties": {
406
+ "settings": {
407
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
408
+ "type": "boolean",
409
+ "title": "settings"
410
+ },
411
+ "label": {
412
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
413
+ "type": "string",
414
+ "title": "label"
415
+ }
416
+ }
417
+ },
390
418
  "rationale": {
391
419
  "title": "ConfigureProp",
392
420
  "type": "object",
@@ -567,6 +595,11 @@
567
595
  "type": "boolean",
568
596
  "title": "rationaleEnabled"
569
597
  },
598
+ "spellCheckEnabled": {
599
+ "description": "Indicates if spellcheck is enabled for the author. Default value is true",
600
+ "type": "boolean",
601
+ "title": "spellCheckEnabled"
602
+ },
570
603
  "studentInstructionsEnabled": {
571
604
  "description": "Indicates if Student Instructions are enabled",
572
605
  "type": "boolean",
@@ -591,6 +624,7 @@
591
624
  "feedbackEnabled",
592
625
  "prompt",
593
626
  "rationaleEnabled",
627
+ "spellCheckEnabled",
594
628
  "studentInstructionsEnabled",
595
629
  "teacherInstructionsEnabled"
596
630
  ]
@@ -68,6 +68,10 @@ Indicates if Feedback is enabled
68
68
 
69
69
  Indicates if Rationale are enabled
70
70
 
71
+ ## `spellCheckEnabled` (boolean, required)
72
+
73
+ Indicates if spellcheck is enabled for the author. Default value is true
74
+
71
75
  ## `studentInstructionsEnabled` (boolean, required)
72
76
 
73
77
  Indicates if Student Instructions are enabled
@@ -148,6 +152,10 @@ Indicates if Feedback is enabled
148
152
 
149
153
  Indicates if Rationale are enabled
150
154
 
155
+ ## `spellCheckEnabled` (boolean, required)
156
+
157
+ Indicates if spellcheck is enabled for the author. Default value is true
158
+
151
159
  ## `studentInstructionsEnabled` (boolean, required)
152
160
 
153
161
  Indicates if Student Instructions are enabled
@@ -290,6 +298,18 @@ Indicates if the item has to be displayed in the Settings Panel
290
298
 
291
299
  Indicates the label for the item that has to be displayed in the Settings Panel
292
300
 
301
+ ### `spellCheck` (object)
302
+
303
+ Properties of the `spellCheck` object:
304
+
305
+ #### `settings` (boolean)
306
+
307
+ Indicates if the item has to be displayed in the Settings Panel
308
+
309
+ #### `label` (string)
310
+
311
+ Indicates the label for the item that has to be displayed in the Settings Panel
312
+
293
313
  ### `rationale` (object)
294
314
 
295
315
  Properties of the `rationale` object:
@@ -428,6 +448,10 @@ Indicates if Feedback is enabled
428
448
 
429
449
  Indicates if Rationale are enabled
430
450
 
451
+ ### `spellCheckEnabled` (boolean, required)
452
+
453
+ Indicates if spellcheck is enabled for the author. Default value is true
454
+
431
455
  ### `studentInstructionsEnabled` (boolean, required)
432
456
 
433
457
  Indicates if Student Instructions are enabled
package/lib/index.js CHANGED
@@ -5,9 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports["default"] = exports.isSessionComplete = void 0;
9
-
10
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
8
+ exports.isSessionComplete = exports["default"] = void 0;
11
9
 
12
10
  var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
13
11
 
@@ -15,6 +13,8 @@ var _wrapNativeSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/w
15
13
 
16
14
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
17
15
 
16
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
17
+
18
18
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
19
19
 
20
20
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
@@ -31,9 +31,9 @@ var _get = _interopRequireDefault(require("lodash/get"));
31
31
 
32
32
  var _debug = _interopRequireDefault(require("debug"));
33
33
 
34
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
34
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
35
35
 
36
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
36
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
37
37
 
38
38
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
39
39
 
@@ -53,7 +53,7 @@ var EbsrMC = /*#__PURE__*/function (_MultipleChoice) {
53
53
  return _super.apply(this, arguments);
54
54
  }
55
55
 
56
- return EbsrMC;
56
+ return (0, _createClass2["default"])(EbsrMC);
57
57
  }(_multipleChoice["default"]);
58
58
 
59
59
  var defineMultipleChoice = function defineMultipleChoice() {
@@ -125,6 +125,9 @@ var Ebsr = /*#__PURE__*/function (_HTMLElement) {
125
125
  }
126
126
  }, {
127
127
  key: "session",
128
+ get: function get() {
129
+ return this._session;
130
+ },
128
131
  set: function set(s) {
129
132
  var _this3 = this;
130
133
 
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.js"],"names":["SESSION_CHANGED","SessionChangedEvent","TYPE","MC_TAG_NAME","log","EbsrMC","MultipleChoice","defineMultipleChoice","customElements","get","define","isNonEmptyArray","a","Array","isArray","length","isSessionComplete","session","b","Ebsr","e","target","preventDefault","stopImmediatePropagation","id","getAttribute","key","toUpperCase","update","_model","dispatchSessionChanged","srcElement","_session","m","whenDefined","then","setPartModel","partA","partB","s","setPartSession","part","mode","model","keyMode","choicePrefix","value","partSession","complete","dispatchEvent","tagName","toLowerCase","querySelector","_render","addEventListener","onSessionUpdated","removeEventListener","innerHTML","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;;;;;AACA,IAAMA,eAAe,GAAGC,qCAAoBC,IAA5C;AACA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kC;AAChC,YAAQiB,KAAR,GAAkB,KAAKd,QAAvB,CAAQc,KAAR;AACAL,QAAAA,IAAI,CAACxB,OAAL,GAAe6B,KAAK,IAAIA,KAAK,CAACpB,GAAD,CAAd,GAAsBoB,KAAK,CAACpB,GAAD,CAA3B,GAAmC;AAAEF,UAAAA,EAAE,EAAEE;AAAN,SAAlD;AACD;AACF;;;WAED,gCAAuBqB,WAAvB,EAAoCrB,GAApC,EAAyC;AACvC,WAAKM,QAAL,CAAcc,KAAd,mCACK,KAAKd,QAAL,CAAcc,KADnB,4CAEGpB,GAFH,EAESqB,WAFT;AAKA3C,MAAAA,GAAG,CAAC,8BAAD,EAAiC,KAAK4B,QAAtC,CAAH;AACA,UAAMgB,QAAQ,GAAGhC,iBAAiB,CAAC,KAAKgB,QAAN,CAAlC;AACA,WAAKiB,aAAL,CACE,IAAIhD,oCAAJ,CAAwB,KAAKiD,OAAL,CAAaC,WAAb,EAAxB,EAAoDH,QAApD,CADF;AAGD;;;SAED,eAAY;AACV,aAAO,KAAKI,aAAL,WAAsBjD,WAAtB,QAAP;AACD;;;SAED,eAAY;AACV,aAAO,KAAKiD,aAAL,WAAsBjD,WAAtB,QAAP;AACD;;;WAED,6BAAoB;AAClB,WAAKkD,OAAL;;AACA,WAAKC,gBAAL,CAAsBtD,eAAtB,EAAuC,KAAKuD,gBAA5C;AACD;;;WAED,gCAAuB;AACrB,WAAKC,mBAAL,CAAyBxD,eAAzB,EAA0C,KAAKuD,gBAA/C;AACD;;;WAED,mBAAU;AACR,WAAKE,SAAL,qCAEOtD,WAFP,yBAE+BA,WAF/B,yBAGOA,WAHP,yBAG+BA,WAH/B;AAMD;;;kDAtG+BuD,W","sourcesContent":["import { SessionChangedEvent } from '@pie-framework/pie-player-events';\nimport MultipleChoice from '@pie-element/multiple-choice';\nimport get from 'lodash/get';\nimport debug from 'debug';\nconst SESSION_CHANGED = SessionChangedEvent.TYPE;\nconst MC_TAG_NAME = 'ebsr-multiple-choice';\nconst log = debug('pie-elements:ebsr');\n\nclass EbsrMC extends MultipleChoice {}\n\nconst defineMultipleChoice = () => {\n if (!customElements.get(MC_TAG_NAME)) {\n customElements.define(MC_TAG_NAME, EbsrMC);\n }\n};\n\ndefineMultipleChoice();\n\nconst isNonEmptyArray = (a) => Array.isArray(a) && a.length > 0;\n\nexport const isSessionComplete = (session) => {\n const a = get(session, 'value.partA.value');\n const b = get(session, 'value.partB.value');\n\n return isNonEmptyArray(a) && isNonEmptyArray(b);\n};\n\nexport default class Ebsr extends HTMLElement {\n constructor() {\n super();\n this._model = {};\n this._session = {};\n }\n\n onSessionUpdated = (e) => {\n if (e.target === this) {\n return;\n }\n\n e.preventDefault();\n e.stopImmediatePropagation();\n\n const id = e.target.getAttribute('id');\n\n if (id) {\n const key = `part${id.toUpperCase()}`;\n\n if (e.update) {\n this._model[key] = e.update;\n }\n //TODO: accessing a private property here. The session event should contain the update in future to prevent this.\n this.dispatchSessionChanged(e.srcElement._session, key);\n }\n };\n\n set model(m) {\n this._model = m;\n\n customElements.whenDefined(MC_TAG_NAME).then(() => {\n this.setPartModel(this.partA, 'partA');\n this.setPartModel(this.partB, 'partB');\n });\n }\n\n set session(s) {\n this._session = s;\n\n customElements.whenDefined(MC_TAG_NAME).then(() => {\n this.setPartSession(this.partA, 'partA');\n this.setPartSession(this.partB, 'partB');\n });\n }\n\n setPartModel(part, key) {\n if (this._model && this._model[key]) {\n const { mode } = this._model;\n\n part.model = {\n ...this._model[key],\n mode,\n keyMode: this._model[key].choicePrefix,\n };\n }\n }\n\n setPartSession(part, key) {\n if (this._session && this._model) {\n const { value } = this._session;\n part.session = value && value[key] ? value[key] : { id: key };\n }\n }\n\n dispatchSessionChanged(partSession, key) {\n this._session.value = {\n ...this._session.value,\n [key]: partSession,\n };\n\n log('[onSessionChanged] session: ', this._session);\n const complete = isSessionComplete(this._session);\n this.dispatchEvent(\n new SessionChangedEvent(this.tagName.toLowerCase(), complete)\n );\n }\n\n get partA() {\n return this.querySelector(`${MC_TAG_NAME}#a`);\n }\n\n get partB() {\n return this.querySelector(`${MC_TAG_NAME}#b`);\n }\n\n connectedCallback() {\n this._render();\n this.addEventListener(SESSION_CHANGED, this.onSessionUpdated);\n }\n\n disconnectedCallback() {\n this.removeEventListener(SESSION_CHANGED, this.onSessionUpdated);\n }\n\n _render() {\n this.innerHTML = `\n <div>\n <${MC_TAG_NAME} id=\"a\"></${MC_TAG_NAME}>\n <${MC_TAG_NAME} id=\"b\"></${MC_TAG_NAME}>\n </div>\n `;\n }\n}\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../src/index.js"],"names":["SESSION_CHANGED","SessionChangedEvent","TYPE","MC_TAG_NAME","log","EbsrMC","MultipleChoice","defineMultipleChoice","customElements","get","define","isNonEmptyArray","a","Array","isArray","length","isSessionComplete","session","b","Ebsr","e","target","preventDefault","stopImmediatePropagation","id","getAttribute","key","toUpperCase","update","_model","dispatchSessionChanged","srcElement","_session","m","whenDefined","then","setPartModel","partA","partB","s","setPartSession","part","mode","model","keyMode","choicePrefix","value","partSession","complete","dispatchEvent","tagName","toLowerCase","querySelector","_render","addEventListener","onSessionUpdated","removeEventListener","innerHTML","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;;;;;AACA,IAAMA,eAAe,GAAGC,qCAAoBC,IAA5C;AACA,IAAMC,WAAW,GAAG,sBAApB;AACA,IAAMC,GAAG,GAAG,uBAAM,mBAAN,CAAZ;;IAEMC,M;;;;;;;;;;;EAAeC,0B;;AAErB,IAAMC,oBAAoB,GAAG,SAAvBA,oBAAuB,GAAM;AACjC,MAAI,CAACC,cAAc,CAACC,GAAf,CAAmBN,WAAnB,CAAL,EAAsC;AACpCK,IAAAA,cAAc,CAACE,MAAf,CAAsBP,WAAtB,EAAmCE,MAAnC;AACD;AACF,CAJD;;AAMAE,oBAAoB;;AAEpB,IAAMI,eAAe,GAAG,SAAlBA,eAAkB,CAACC,CAAD;AAAA,SAAOC,K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nB,4CAEGpB,GAFH,EAESqB,WAFT;AAKA3C,MAAAA,GAAG,CAAC,8BAAD,EAAiC,KAAK4B,QAAtC,CAAH;AACA,UAAMgB,QAAQ,GAAGhC,iBAAiB,CAAC,KAAKgB,QAAN,CAAlC;AACA,WAAKiB,aAAL,CACE,IAAIhD,oCAAJ,CAAwB,KAAKiD,OAAL,CAAaC,WAAb,EAAxB,EAAoDH,QAApD,CADF;AAGD;;;SAED,eAAY;AACV,aAAO,KAAKI,aAAL,WAAsBjD,WAAtB,QAAP;AACD;;;SAED,eAAY;AACV,aAAO,KAAKiD,aAAL,WAAsBjD,WAAtB,QAAP;AACD;;;WAED,6BAAoB;AAClB,WAAKkD,OAAL;;AACA,WAAKC,gBAAL,CAAsBtD,eAAtB,EAAuC,KAAKuD,gBAA5C;AACD;;;WAED,gCAAuB;AACrB,WAAKC,mBAAL,CAAyBxD,eAAzB,EAA0C,KAAKuD,gBAA/C;AACD;;;WAED,mBAAU;AACR,WAAKE,SAAL,qCAEOtD,WAFP,yBAE+BA,WAF/B,yBAGOA,WAHP,yBAG+BA,WAH/B;AAMD;;;kDA1G+BuD,W","sourcesContent":["import { SessionChangedEvent } from '@pie-framework/pie-player-events';\nimport MultipleChoice from '@pie-element/multiple-choice';\nimport get from 'lodash/get';\nimport debug from 'debug';\nconst SESSION_CHANGED = SessionChangedEvent.TYPE;\nconst MC_TAG_NAME = 'ebsr-multiple-choice';\nconst log = debug('pie-elements:ebsr');\n\nclass EbsrMC extends MultipleChoice {}\n\nconst defineMultipleChoice = () => {\n if (!customElements.get(MC_TAG_NAME)) {\n customElements.define(MC_TAG_NAME, EbsrMC);\n }\n};\n\ndefineMultipleChoice();\n\nconst isNonEmptyArray = (a) => Array.isArray(a) && a.length > 0;\n\nexport const isSessionComplete = (session) => {\n const a = get(session, 'value.partA.value');\n const b = get(session, 'value.partB.value');\n\n return isNonEmptyArray(a) && isNonEmptyArray(b);\n};\n\nexport default class Ebsr extends HTMLElement {\n constructor() {\n super();\n this._model = {};\n this._session = {};\n }\n\n onSessionUpdated = (e) => {\n if (e.target === this) {\n return;\n }\n\n e.preventDefault();\n e.stopImmediatePropagation();\n\n const id = e.target.getAttribute('id');\n\n if (id) {\n const key = `part${id.toUpperCase()}`;\n\n if (e.update) {\n this._model[key] = e.update;\n }\n //TODO: accessing a private property here. The session event should contain the update in future to prevent this.\n this.dispatchSessionChanged(e.srcElement._session, key);\n }\n };\n\n set model(m) {\n this._model = m;\n\n customElements.whenDefined(MC_TAG_NAME).then(() => {\n this.setPartModel(this.partA, 'partA');\n this.setPartModel(this.partB, 'partB');\n });\n }\n\n set session(s) {\n this._session = s;\n\n customElements.whenDefined(MC_TAG_NAME).then(() => {\n this.setPartSession(this.partA, 'partA');\n this.setPartSession(this.partB, 'partB');\n });\n }\n\n get session() {\n return this._session;\n }\n\n setPartModel(part, key) {\n if (this._model && this._model[key]) {\n const { mode } = this._model;\n\n part.model = {\n ...this._model[key],\n mode,\n keyMode: this._model[key].choicePrefix,\n };\n }\n }\n\n setPartSession(part, key) {\n if (this._session && this._model) {\n const { value } = this._session;\n part.session = value && value[key] ? value[key] : { id: key };\n }\n }\n\n dispatchSessionChanged(partSession, key) {\n this._session.value = {\n ...this._session.value,\n [key]: partSession,\n };\n\n log('[onSessionChanged] session: ', this._session);\n const complete = isSessionComplete(this._session);\n this.dispatchEvent(\n new SessionChangedEvent(this.tagName.toLowerCase(), complete)\n );\n }\n\n get partA() {\n return this.querySelector(`${MC_TAG_NAME}#a`);\n }\n\n get partB() {\n return this.querySelector(`${MC_TAG_NAME}#b`);\n }\n\n connectedCallback() {\n this._render();\n this.addEventListener(SESSION_CHANGED, this.onSessionUpdated);\n }\n\n disconnectedCallback() {\n this.removeEventListener(SESSION_CHANGED, this.onSessionUpdated);\n }\n\n _render() {\n this.innerHTML = `\n <div>\n <${MC_TAG_NAME} id=\"a\"></${MC_TAG_NAME}>\n <${MC_TAG_NAME} id=\"b\"></${MC_TAG_NAME}>\n </div>\n `;\n }\n}\n"],"file":"index.js"}
package/lib/print.js CHANGED
@@ -5,9 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports["default"] = exports.isSessionComplete = void 0;
9
-
10
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
8
+ exports.isSessionComplete = exports["default"] = void 0;
11
9
 
12
10
  var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
13
11
 
@@ -15,6 +13,8 @@ var _wrapNativeSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/w
15
13
 
16
14
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
17
15
 
16
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
17
+
18
18
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
19
19
 
20
20
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
@@ -35,9 +35,9 @@ var _get = _interopRequireDefault(require("lodash/get"));
35
35
 
36
36
  var _piePlayerEvents = require("@pie-framework/pie-player-events");
37
37
 
38
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
38
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
39
39
 
40
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
40
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
41
41
 
42
42
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
43
43
 
@@ -60,7 +60,7 @@ var preparePrintModel = function preparePrintModel(model, opts) {
60
60
  model.teacherInstructions = instr && model.teacherInstructionsEnabled !== false ? model.teacherInstructions : undefined;
61
61
  model.showTeacherInstructions = instr;
62
62
  model.alwaysShowCorrect = instr;
63
- model.mode = instr ? 'evaluate' : model.mode;
63
+ model.mode = instr ? 'evaluate' : 'gather';
64
64
  model.disabled = true;
65
65
  model.animationsDisabled = true;
66
66
  model.lockChoiceOrder = true;
@@ -86,7 +86,7 @@ var EbsrMC = /*#__PURE__*/function (_MultipleChoice) {
86
86
  return _super.apply(this, arguments);
87
87
  }
88
88
 
89
- return EbsrMC;
89
+ return (0, _createClass2["default"])(EbsrMC);
90
90
  }(_multipleChoice["default"]);
91
91
 
92
92
  var defineMultipleChoice = function defineMultipleChoice() {
@@ -173,9 +173,7 @@ var Ebsr = /*#__PURE__*/function (_HTMLElement) {
173
173
  key: "setPartModel",
174
174
  value: function setPartModel(part, key) {
175
175
  if (this._model && this._model[key]) {
176
- var mode = this._model.mode;
177
176
  part.model = _objectSpread(_objectSpread({}, preparePrintModel(this._model[key], this._options)), {}, {
178
- mode: mode,
179
177
  keyMode: this._model[key].choicePrefix
180
178
  });
181
179
 
package/lib/print.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/print.js"],"names":["MC_TAG_NAME","SESSION_CHANGED","SessionChangedEvent","TYPE","log","preparePrintModel","model","opts","instr","role","prompt","promptEnabled","undefined","teacherInstructions","teacherInstructionsEnabled","showTeacherInstructions","alwaysShowCorrect","mode","disabled","animationsDisabled","lockChoiceOrder","choicesLayout","choices","map","c","rationale","rationaleEnabled","hideTick","feedback","keyMode","choicePrefix","EbsrMC","MultipleChoice","defineMultipleChoice","customElements","get","define","isNonEmptyArray","a","Array","isArray","length","isSessionComplete","session","b","Ebsr","e","target","preventDefault","stopImmediatePropagation","id","getAttribute","key","toUpperCase","update","_model","dispatchSessionChanged","srcElement","_session","_options","m","whenDefined","then","setPartModel","partA","partB","s","setPartSession","part","o","value","partSession","complete","dispatchEvent","tagName","toLowerCase","querySelector","_render","addEventListener","onSessionUpdated","removeEventListener","innerHTML","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;;;AACA,IAAMA,WAAW,GAAG,sBAApB;AACA,IAAMC,eAAe,GAAGC,qCAAoBC,IAA5C;AAEA,IAAMC,GAAG,GAAG,uBAAM,wBAAN,CAAZ;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,IAAMC,iBAAiB,GAAG,SAApBA,iBAAoB,CAACC,KAAD,EAAQC,IAAR,EAAiB;AACzC,MAAMC,KAAK,GAAGD,IAAI,CAACE,IAAL,KAAc,YAA5B;AAEAH,EAAAA,KAAK,CAACI,MAAN,GAAeJ,KAA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,IAAf,EAAqBhB,GAArB,EAA0B;AACxB,UAAI,KAAKM,QAAL,IAAiB,KAAKH,MAA1B,EAAkC;AAChC,YAAQe,KAAR,GAAkB,KAAKZ,QAAvB,CAAQY,KAAR;AACAF,QAAAA,IAAI,CAACzB,OAAL,GAAe2B,KAAK,IAAIA,KAAK,CAAClB,GAAD,CAAd,GAAsBkB,KAAK,CAAClB,GAAD,CAA3B,GAAmC;AAAEF,UAAAA,EAAE,EAAEE;AAAN,SAAlD;AACD;AACF;;;WAED,gCAAuBmB,WAAvB,EAAoCnB,GAApC,EAAyC;AACvC,WAAKM,QAAL,CAAcY,KAAd,mCACK,KAAKZ,QAAL,CAAcY,KADnB,4CAEGlB,GAFH,EAESmB,WAFT;AAKAnE,MAAAA,GAAG,CAAC,8BAAD,EAAiC,KAAKsD,QAAtC,CAAH;AACA,UAAMc,QAAQ,GAAG9B,iBAAiB,CAAC,KAAKgB,QAAN,CAAlC;AACA,WAAKe,aAAL,CACE,IAAIvE,oCAAJ,CAAwB,KAAKwE,OAAL,CAAaC,WAAb,EAAxB,EAAoDH,QAApD,CADF;AAGD;;;SAED,eAAY;AACV,aAAO,KAAKI,aAAL,WAAsB5E,WAAtB,QAAP;AACD;;;SAED,eAAY;AACV,aAAO,KAAK4E,aAAL,WAAsB5E,WAAtB,QAAP;AACD;;;WAED,6BAAoB;AAClB,WAAK6E,OAAL;;AACA,WAAKC,gBAAL,CAAsB7E,eAAtB,EAAuC,KAAK8E,gBAA5C;AACD;;;WAED,gCAAuB;AACrB,WAAKC,mBAAL,CAAyB/E,eAAzB,EAA0C,KAAK8E,gBAA/C;AACD;;;WAED,mBAAU;AACR,WAAKE,SAAL,qCAEOjF,WAFP,yBAE+BA,WAF/B,yBAGOA,WAHP,yBAG+BA,WAH/B;AAMD;;;kDAlH+BkF,W","sourcesContent":["import React from 'react';\nimport cloneDeep from 'lodash/cloneDeep';\nimport MultipleChoice from '@pie-element/multiple-choice';\nimport debug from 'debug';\nimport get from 'lodash/get';\n\nimport {SessionChangedEvent} from '@pie-framework/pie-player-events';\nconst MC_TAG_NAME = 'ebsr-multiple-choice';\nconst SESSION_CHANGED = SessionChangedEvent.TYPE;\n\nconst log = debug('pie-element:ebsr:print');\n\n/**\n * Live in same package as main element - so we can access some of the shared comps!\n *\n * - update pslb to build print if src/print.js is there\n * - update demo el\n * - get configure/controller building\n */\n\nconst preparePrintModel = (model, opts) => {\n const instr = opts.role === 'instructor';\n\n model.prompt = model.promptEnabled !== false ? model.prompt : undefined;\n model.teacherInstructions = instr && model.teacherInstructionsEnabled !== false ? model.teacherInstructions : undefined;\n model.showTeacherInstructions = instr;\n model.alwaysShowCorrect = instr;\n model.mode = instr ? 'evaluate' : model.mode;\n\n model.disabled = true;\n model.animationsDisabled = true;\n model.lockChoiceOrder = true;\n model.choicesLayout = model.choicesLayout || 'vertical';\n\n const choices = cloneDeep(model.choices);\n\n model.choices = choices.map((c) => {\n c.rationale = instr && model.rationaleEnabled !== false ? c.rationale : undefined;\n c.hideTick = instr;\n c.feedback = undefined;\n return c;\n });\n\n model.keyMode = model.choicePrefix || 'letters';\n\n return model;\n};\n\nclass EbsrMC extends MultipleChoice {}\n\nconst defineMultipleChoice = () => {\n if (!customElements.get(MC_TAG_NAME)) {\n customElements.define(MC_TAG_NAME, EbsrMC);\n }\n};\n\ndefineMultipleChoice();\n\nconst isNonEmptyArray = (a) => Array.isArray(a) && a.length > 0;\n\nexport const isSessionComplete = (session) => {\n const a = get(session, 'value.partA.value');\n const b = get(session, 'value.partB.value');\n\n return isNonEmptyArray(a) && isNonEmptyArray(b);\n};\n\nexport default class Ebsr extends HTMLElement {\n constructor() {\n super();\n this._model = {};\n this._session = {};\n this._options = null;\n }\n\n onSessionUpdated = (e) => {\n if (e.target === this) {\n return;\n }\n\n e.preventDefault();\n e.stopImmediatePropagation();\n\n const id = e.target.getAttribute('id');\n\n if (id) {\n const key = `part${id.toUpperCase()}`;\n\n if (e.update) {\n this._model[key] = e.update;\n }\n //TODO: accessing a private property here. The session event should contain the update in future to prevent this.\n this.dispatchSessionChanged(e.srcElement._session, key);\n }\n };\n\n set model(m) {\n this._model = m;\n\n customElements.whenDefined(MC_TAG_NAME).then(() => {\n this.setPartModel(this.partA, 'partA');\n this.setPartModel(this.partB, 'partB');\n });\n }\n\n set session(s) {\n this._session = s;\n\n customElements.whenDefined(MC_TAG_NAME).then(() => {\n this.setPartSession(this.partA, 'partA');\n this.setPartSession(this.partB, 'partB');\n });\n }\n\n setPartModel(part, key) {\n if (this._model && this._model[key]) {\n const { mode } = this._model;\n\n part.model = {\n ...preparePrintModel(this._model[key], this._options),\n mode,\n keyMode: this._model[key].choicePrefix,\n };\n\n if (!part._session) {\n // for print, \"set session\" is not called,\n // but ebsr needs sessions in order to render the elements,\n // so we set it here it was not set already\n part.session = {};\n }\n }\n }\n\n set options(o) {\n this._options = o;\n }\n\n setPartSession(part, key) {\n if (this._session && this._model) {\n const { value } = this._session;\n part.session = value && value[key] ? value[key] : { id: key };\n }\n }\n\n dispatchSessionChanged(partSession, key) {\n this._session.value = {\n ...this._session.value,\n [key]: partSession,\n };\n\n log('[onSessionChanged] session: ', this._session);\n const complete = isSessionComplete(this._session);\n this.dispatchEvent(\n new SessionChangedEvent(this.tagName.toLowerCase(), complete)\n );\n }\n\n get partA() {\n return this.querySelector(`${MC_TAG_NAME}#a`);\n }\n\n get partB() {\n return this.querySelector(`${MC_TAG_NAME}#b`);\n }\n\n connectedCallback() {\n this._render();\n this.addEventListener(SESSION_CHANGED, this.onSessionUpdated);\n }\n\n disconnectedCallback() {\n this.removeEventListener(SESSION_CHANGED, this.onSessionUpdated);\n }\n\n _render() {\n this.innerHTML = `\n <div>\n <${MC_TAG_NAME} id=\"a\"></${MC_TAG_NAME}>\n <${MC_TAG_NAME} id=\"b\"></${MC_TAG_NAME}>\n </div>\n `;\n }\n}\n"],"file":"print.js"}
1
+ {"version":3,"sources":["../src/print.js"],"names":["MC_TAG_NAME","SESSION_CHANGED","SessionChangedEvent","TYPE","log","preparePrintModel","model","opts","instr","role","prompt","promptEnabled","undefined","teacherInstructions","teacherInstructionsEnabled","showTeacherInstructions","alwaysShowCorrect","mode","disabled","animationsDisabled","lockChoiceOrder","choicesLayout","choices","map","c","rationale","rationaleEnabled","hideTick","feedback","keyMode","choicePrefix","EbsrMC","MultipleChoice","defineMultipleChoice","customElements","get","define","isNonEmptyArray","a","Array","isArray","length","isSessionComplete","session","b","Ebsr","e","target","preventDefault","stopImmediatePropagation","id","getAttribute","key","toUpperCase","update","_model","dispatchSessionChanged","srcElement","_session","_options","m","whenDefined","then","setPartModel","partA","partB","s","setPartSession","part","o","value","partSession","complete","dispatchEvent","tagName","toLowerCase","querySelector","_render","addEventListener","onSessionUpdated","removeEventListener","innerHTML","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;;;AACA,IAAMA,WAAW,GAAG,sBAApB;AACA,IAAMC,eAAe,GAAGC,qCAAoBC,IAA5C;AAEA,IAAMC,GAAG,GAAG,uBAAM,wBAAN,CAAZ;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,IAAMC,iBAAiB,GAAG,SAApBA,iBAAoB,CAACC,KAAD,EAAQC,IAAR,EAAiB;AACzC,MAAMC,KAAK,GAAGD,IAAI,CAACE,IAAL,KAAc,YAA5B;AAEAH,EAAAA,KAAK,CAACI,MAAN,GAAeJ,KAAK,CAACK,aAAN,KAAwB,KAAxB,GAAgCL,KAAK,CAACI,MAAtC,GAA+CE,SAA9D;AACAN,EAAAA,KAAK,CAACO,mBAAN,GAA4BL,KAAK,IAAIF,KAAK,CAACQ,0BAAN,KAAqC,KAA9C,GAAsDR,KAAK,CAACO,mBAA5D,GAAkFD,SAA9G;AACAN,EAAAA,KAAK,CAACS,uBAAN,GAAgCP,KAAhC;AACAF,EAAAA,KAAK,CAACU,iBAAN,GAA0BR,KAA1B;AACAF,EAAAA,KAAK,CAACW,IAAN,GAA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H,EAESmB,WAFT;AAKAnE,MAAAA,GAAG,CAAC,8BAAD,EAAiC,KAAKsD,QAAtC,CAAH;AACA,UAAMc,QAAQ,GAAG9B,iBAAiB,CAAC,KAAKgB,QAAN,CAAlC;AACA,WAAKe,aAAL,CACE,IAAIvE,oCAAJ,CAAwB,KAAKwE,OAAL,CAAaC,WAAb,EAAxB,EAAoDH,QAApD,CADF;AAGD;;;SAED,eAAY;AACV,aAAO,KAAKI,aAAL,WAAsB5E,WAAtB,QAAP;AACD;;;SAED,eAAY;AACV,aAAO,KAAK4E,aAAL,WAAsB5E,WAAtB,QAAP;AACD;;;WAED,6BAAoB;AAClB,WAAK6E,OAAL;;AACA,WAAKC,gBAAL,CAAsB7E,eAAtB,EAAuC,KAAK8E,gBAA5C;AACD;;;WAED,gCAAuB;AACrB,WAAKC,mBAAL,CAAyB/E,eAAzB,EAA0C,KAAK8E,gBAA/C;AACD;;;WAED,mBAAU;AACR,WAAKE,SAAL,qCAEOjF,WAFP,yBAE+BA,WAF/B,yBAGOA,WAHP,yBAG+BA,WAH/B;AAMD;;;kDAhH+BkF,W","sourcesContent":["import React from 'react';\nimport cloneDeep from 'lodash/cloneDeep';\nimport MultipleChoice from '@pie-element/multiple-choice';\nimport debug from 'debug';\nimport get from 'lodash/get';\n\nimport {SessionChangedEvent} from '@pie-framework/pie-player-events';\nconst MC_TAG_NAME = 'ebsr-multiple-choice';\nconst SESSION_CHANGED = SessionChangedEvent.TYPE;\n\nconst log = debug('pie-element:ebsr:print');\n\n/**\n * Live in same package as main element - so we can access some of the shared comps!\n *\n * - update pslb to build print if src/print.js is there\n * - update demo el\n * - get configure/controller building\n */\n\nconst preparePrintModel = (model, opts) => {\n const instr = opts.role === 'instructor';\n\n model.prompt = model.promptEnabled !== false ? model.prompt : undefined;\n model.teacherInstructions = instr && model.teacherInstructionsEnabled !== false ? model.teacherInstructions : undefined;\n model.showTeacherInstructions = instr;\n model.alwaysShowCorrect = instr;\n model.mode = instr ? 'evaluate' : 'gather';\n\n model.disabled = true;\n model.animationsDisabled = true;\n model.lockChoiceOrder = true;\n model.choicesLayout = model.choicesLayout || 'vertical';\n\n const choices = cloneDeep(model.choices);\n\n model.choices = choices.map((c) => {\n c.rationale = instr && model.rationaleEnabled !== false ? c.rationale : undefined;\n c.hideTick = instr;\n c.feedback = undefined;\n return c;\n });\n\n model.keyMode = model.choicePrefix || 'letters';\n\n return model;\n};\n\nclass EbsrMC extends MultipleChoice {}\n\nconst defineMultipleChoice = () => {\n if (!customElements.get(MC_TAG_NAME)) {\n customElements.define(MC_TAG_NAME, EbsrMC);\n }\n};\n\ndefineMultipleChoice();\n\nconst isNonEmptyArray = (a) => Array.isArray(a) && a.length > 0;\n\nexport const isSessionComplete = (session) => {\n const a = get(session, 'value.partA.value');\n const b = get(session, 'value.partB.value');\n\n return isNonEmptyArray(a) && isNonEmptyArray(b);\n};\n\nexport default class Ebsr extends HTMLElement {\n constructor() {\n super();\n this._model = {};\n this._session = {};\n this._options = null;\n }\n\n onSessionUpdated = (e) => {\n if (e.target === this) {\n return;\n }\n\n e.preventDefault();\n e.stopImmediatePropagation();\n\n const id = e.target.getAttribute('id');\n\n if (id) {\n const key = `part${id.toUpperCase()}`;\n\n if (e.update) {\n this._model[key] = e.update;\n }\n //TODO: accessing a private property here. The session event should contain the update in future to prevent this.\n this.dispatchSessionChanged(e.srcElement._session, key);\n }\n };\n\n set model(m) {\n this._model = m;\n\n customElements.whenDefined(MC_TAG_NAME).then(() => {\n this.setPartModel(this.partA, 'partA');\n this.setPartModel(this.partB, 'partB');\n });\n }\n\n set session(s) {\n this._session = s;\n\n customElements.whenDefined(MC_TAG_NAME).then(() => {\n this.setPartSession(this.partA, 'partA');\n this.setPartSession(this.partB, 'partB');\n });\n }\n\n setPartModel(part, key) {\n if (this._model && this._model[key]) {\n\n part.model = {\n ...preparePrintModel(this._model[key], this._options),\n keyMode: this._model[key].choicePrefix,\n };\n\n if (!part._session) {\n // for print, \"set session\" is not called,\n // but ebsr needs sessions in order to render the elements,\n // so we set it here it was not set already\n part.session = {};\n }\n }\n }\n\n set options(o) {\n this._options = o;\n }\n\n setPartSession(part, key) {\n if (this._session && this._model) {\n const { value } = this._session;\n part.session = value && value[key] ? value[key] : { id: key };\n }\n }\n\n dispatchSessionChanged(partSession, key) {\n this._session.value = {\n ...this._session.value,\n [key]: partSession,\n };\n\n log('[onSessionChanged] session: ', this._session);\n const complete = isSessionComplete(this._session);\n this.dispatchEvent(\n new SessionChangedEvent(this.tagName.toLowerCase(), complete)\n );\n }\n\n get partA() {\n return this.querySelector(`${MC_TAG_NAME}#a`);\n }\n\n get partB() {\n return this.querySelector(`${MC_TAG_NAME}#b`);\n }\n\n connectedCallback() {\n this._render();\n this.addEventListener(SESSION_CHANGED, this.onSessionUpdated);\n }\n\n disconnectedCallback() {\n this.removeEventListener(SESSION_CHANGED, this.onSessionUpdated);\n }\n\n _render() {\n this.innerHTML = `\n <div>\n <${MC_TAG_NAME} id=\"a\"></${MC_TAG_NAME}>\n <${MC_TAG_NAME} id=\"b\"></${MC_TAG_NAME}>\n </div>\n `;\n }\n}\n"],"file":"print.js"}
@@ -1,6 +1,6 @@
1
- import {_dll_react, _dll_prop_types, _dll_material_ui__core_styles, _dll_lodash, _dll_react_dom} from "../../../@pie-lib/shared-module@^1.4.2/module/index.js";
1
+ import {_dll_react, _dll_prop_types, _dll_material_ui__core_styles, _dll_lodash, _dll_react_dom} from "../../../@pie-lib/shared-module@^1.4.10/module/index.js";
2
2
  import MultipleChoiceConfigure from '@pie-element/multiple-choice/configure/lib';
3
- import {_dll_pie_lib__config_ui} from "../../../@pie-lib/config-module@^1.0.25/module/index.js";
3
+ import {_dll_pie_lib__config_ui} from "../../../@pie-lib/config-module@^1.0.33/module/index.js";
4
4
  var lib = {};
5
5
  Object.defineProperty(lib, "__esModule", {
6
6
  value: true
@@ -112,8 +112,8 @@ class Main extends React$1.Component {
112
112
  const {classes, model, configuration, onConfigurationChanged} = this.props;
113
113
  const {partLabelType, partA: modelPartA, partB: modelPartB} = model;
114
114
  const {partA, partB, partialScoring, scoringType, ...generalConfiguration} = configuration;
115
- const {feedback: feedbackA = {}, choiceMode: choiceModeA = {}, choicePrefix: choicePrefixA = {}, lockChoiceOrder: lockChoiceOrderA = {}, prompt: promptA = {}, teacherInstructions: teacherInstructionsA = {}, studentInstructions: studentInstructionsA = {}, choicesLayout: choicesLayoutA = {}, gridColumns: gridColumnsA = {}, rationale: rationaleA = {}} = partA || ({});
116
- const {feedback: feedbackB = {}, choiceMode: choiceModeB = {}, choicePrefix: choicePrefixB = {}, lockChoiceOrder: lockChoiceOrderB = {}, prompt: promptB = {}, teacherInstructions: teacherInstructionsB = {}, studentInstructions: studentInstructionsB = {}, choicesLayout: choicesLayoutB = {}, gridColumns: gridColumnsB = {}, rationale: rationaleB = {}} = partB || ({});
115
+ const {feedback: feedbackA = {}, choiceMode: choiceModeA = {}, choicePrefix: choicePrefixA = {}, lockChoiceOrder: lockChoiceOrderA = {}, prompt: promptA = {}, teacherInstructions: teacherInstructionsA = {}, studentInstructions: studentInstructionsA = {}, choicesLayout: choicesLayoutA = {}, gridColumns: gridColumnsA = {}, rationale: rationaleA = {}, spellCheck: spellCheckA = {}} = partA || ({});
116
+ const {feedback: feedbackB = {}, choiceMode: choiceModeB = {}, choicePrefix: choicePrefixB = {}, lockChoiceOrder: lockChoiceOrderB = {}, prompt: promptB = {}, teacherInstructions: teacherInstructionsB = {}, studentInstructions: studentInstructionsB = {}, choicesLayout: choicesLayoutB = {}, gridColumns: gridColumnsB = {}, rationale: rationaleB = {}, spellCheck: spellCheckB = {}} = partB || ({});
117
117
  const type = partLabelType || 'Numbers';
118
118
  const typeIsNumber = type === 'Numbers';
119
119
  const firstPart = `Part ${typeIsNumber ? '1' : 'A'}`;
@@ -131,7 +131,7 @@ class Main extends React$1.Component {
131
131
  __self: this,
132
132
  __source: {
133
133
  fileName: _jsxFileName,
134
- lineNumber: 109
134
+ lineNumber: 111
135
135
  }
136
136
  }, React$1.createElement(layout.ConfigLayout, {
137
137
  settings: React$1.createElement(Panel, {
@@ -158,7 +158,8 @@ class Main extends React$1.Component {
158
158
  'partA.promptEnabled': promptA.settings && toggle(promptA.label),
159
159
  'partA.teacherInstructionsEnabled': teacherInstructionsA.settings && toggle(teacherInstructionsA.label),
160
160
  'partA.studentInstructionsEnabled': studentInstructionsA.settings && toggle(studentInstructionsA.label),
161
- 'partA.rationaleEnabled': rationaleA.settings && toggle(rationaleA.label)
161
+ 'partA.rationaleEnabled': rationaleA.settings && toggle(rationaleA.label),
162
+ 'partA.spellCheckEnabled': spellCheckA.settings && toggle(spellCheckA.label)
162
163
  },
163
164
  [`Settings ${secondPart}`]: {
164
165
  'partB.choiceMode': choiceModeB.settings && radio(choiceModeB.label, ['checkbox', 'radio']),
@@ -172,38 +173,39 @@ class Main extends React$1.Component {
172
173
  'partB.promptEnabled': promptB.settings && toggle(promptB.label),
173
174
  'partB.teacherInstructionsEnabled': teacherInstructionsB.settings && toggle(teacherInstructionsB.label),
174
175
  'partB.studentInstructionsEnabled': studentInstructionsB.settings && toggle(studentInstructionsB.label),
175
- 'partB.rationaleEnabled': rationaleB.settings && toggle(rationaleB.label)
176
+ 'partB.rationaleEnabled': rationaleB.settings && toggle(rationaleB.label),
177
+ 'partB.spellCheckEnabled': spellCheckB.settings && toggle(spellCheckB.label)
176
178
  }
177
179
  },
178
180
  __self: this,
179
181
  __source: {
180
182
  fileName: _jsxFileName,
181
- lineNumber: 112
183
+ lineNumber: 114
182
184
  }
183
185
  }),
184
186
  __self: this,
185
187
  __source: {
186
188
  fileName: _jsxFileName,
187
- lineNumber: 110
189
+ lineNumber: 112
188
190
  }
189
191
  }, React$1.createElement('div', {
190
192
  __self: this,
191
193
  __source: {
192
194
  fileName: _jsxFileName,
193
- lineNumber: 195
195
+ lineNumber: 201
194
196
  }
195
197
  }, React$1.createElement('div', {
196
198
  className: classes.part,
197
199
  __self: this,
198
200
  __source: {
199
201
  fileName: _jsxFileName,
200
- lineNumber: 196
202
+ lineNumber: 202
201
203
  }
202
204
  }, model.partLabels && React$1.createElement('p', {
203
205
  __self: this,
204
206
  __source: {
205
207
  fileName: _jsxFileName,
206
- lineNumber: 197
208
+ lineNumber: 203
207
209
  }
208
210
  }, firstPart), React$1.createElement('ebsr-multiple-choice-configure', {
209
211
  id: "A",
@@ -221,20 +223,20 @@ class Main extends React$1.Component {
221
223
  __self: this,
222
224
  __source: {
223
225
  fileName: _jsxFileName,
224
- lineNumber: 198
226
+ lineNumber: 204
225
227
  }
226
228
  })), React$1.createElement('div', {
227
229
  className: classes.part,
228
230
  __self: this,
229
231
  __source: {
230
232
  fileName: _jsxFileName,
231
- lineNumber: 215
233
+ lineNumber: 221
232
234
  }
233
235
  }, model.partLabels && React$1.createElement('p', {
234
236
  __self: this,
235
237
  __source: {
236
238
  fileName: _jsxFileName,
237
- lineNumber: 216
239
+ lineNumber: 222
238
240
  }
239
241
  }, secondPart), React$1.createElement('ebsr-multiple-choice-configure', {
240
242
  id: "B",
@@ -252,7 +254,7 @@ class Main extends React$1.Component {
252
254
  __self: this,
253
255
  __source: {
254
256
  fileName: _jsxFileName,
255
- lineNumber: 217
257
+ lineNumber: 223
256
258
  }
257
259
  })))));
258
260
  }
@@ -306,6 +308,11 @@ const defaultConfig = {
306
308
  },
307
309
  gridColumns: {
308
310
  label: 'Grid columns'
311
+ },
312
+ spellCheck: {
313
+ label: 'Spellcheck',
314
+ settings: false,
315
+ enabled: true
309
316
  }
310
317
  };
311
318
  const partModel = base => ({
@@ -320,6 +327,7 @@ const partModel = base => ({
320
327
  rationale: '',
321
328
  teacherInstructionsEnabled: true,
322
329
  studentInstructionsEnabled: true,
330
+ spellCheckEnabled: true,
323
331
  choicesLayout: 'vertical',
324
332
  gridColumns: '2',
325
333
  ...base
package/module/element.js CHANGED
@@ -1,5 +1,5 @@
1
- import {_dll_prop_types, _dll_react_dom, _dll_react, _dll_material_ui__core_styles, _dll_pie_lib__render_ui, _dll_material_ui__core, _dll_classnames, _dll_pie_lib__correct_answer_toggle, _dll_lodash, _dll_debug} from "../../../@pie-lib/shared-module@^1.4.2/module/index.js";
2
- import {_dll_pie_lib__math_rendering} from "../../../@pie-lib/math-rendering-module@^1.0.27/module/index.js";
1
+ import {_dll_prop_types, _dll_react_dom, _dll_react, _dll_material_ui__core_styles, _dll_pie_lib__render_ui, _dll_material_ui__core, _dll_classnames, _dll_pie_lib__correct_answer_toggle, _dll_lodash, _dll_debug} from "../../../@pie-lib/shared-module@^1.4.10/module/index.js";
2
+ import {_dll_pie_lib__math_rendering} from "../../../@pie-lib/math-rendering-module@^1.0.35/module/index.js";
3
3
  function getDefaultExportFromCjs(x) {
4
4
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
5
5
  }
@@ -71,8 +71,7 @@ var interopRequireDefault = {
71
71
  "default": obj
72
72
  };
73
73
  }
74
- module.exports = _interopRequireDefault;
75
- (module.exports["default"] = module.exports, module.exports.__esModule = true);
74
+ (module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports);
76
75
  })(interopRequireDefault);
77
76
  getDefaultExportFromCjs(interopRequireDefault.exports);
78
77
  var hasClass = {
@@ -2094,6 +2093,9 @@ class Ebsr extends HTMLElement {
2094
2093
  this.setPartSession(this.partB, 'partB');
2095
2094
  });
2096
2095
  }
2096
+ get session() {
2097
+ return this._session;
2098
+ }
2097
2099
  setPartModel(part, key) {
2098
2100
  if (this._model && this._model[key]) {
2099
2101
  const {mode} = this._model;
package/module/index.html CHANGED
@@ -2,7 +2,7 @@
2
2
  <!doctype html>
3
3
  <html>
4
4
  <head>
5
- <title>@pie-element/ebsr@7.0.17</title>
5
+ <title>@pie-element/ebsr@7.0.20</title>
6
6
  <script
7
7
  type="module"
8
8
  src="https://cdn.jsdelivr.net/npm/@pslb/demo-el@^1.0.0/dist/demo-el/demo-el.esm.js"></script>