@pie-element/ebsr 7.0.26 → 8.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +37 -0
- package/configure/CHANGELOG.md +37 -0
- package/configure/lib/defaults.js +12 -0
- package/configure/lib/defaults.js.map +1 -1
- package/configure/package.json +3 -3
- package/configure/src/defaults.js +12 -0
- package/docs/config-schema.json +212 -0
- package/docs/config-schema.json.md +165 -1
- package/docs/pie-schema.json +88 -0
- package/docs/pie-schema.json.md +68 -0
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/print.js +2 -2
- package/lib/print.js.map +1 -1
- package/package.json +3 -3
- package/src/index.js +2 -2
- package/src/print.js +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,43 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [8.1.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/ebsr@8.1.0...@pie-element/ebsr@8.1.1) (2022-07-19)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @pie-element/ebsr
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [8.1.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/ebsr@8.0.0...@pie-element/ebsr@8.1.0) (2022-06-28)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* **ebsr:** add maxImageWidth and maxImageHeight props PD-1801 ([61c9b25](https://github.com/pie-framework/pie-elements/commit/61c9b2511ab8ef1a146d86def588bf8517e23e96))
|
|
20
|
+
* **ebsr:** implement item validation PD-1799 ([66e9ff1](https://github.com/pie-framework/pie-elements/commit/66e9ff1d0178e5ba6f4b07115f1efbf0c752e05f))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
# [8.0.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/ebsr@7.0.26...@pie-element/ebsr@8.0.0) (2022-06-28)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### chore
|
|
30
|
+
|
|
31
|
+
* Merge master with develop. ([cdca48a](https://github.com/pie-framework/pie-elements/commit/cdca48abaa1d4179e4a961e13d171e14b7ed2444))
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### BREAKING CHANGES
|
|
35
|
+
|
|
36
|
+
* Image percent buttons were removed from toolbar.
|
|
37
|
+
New properties maxImageWidth and maxImageHeight were added.
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
6
43
|
## [7.0.26](https://github.com/pie-framework/pie-elements/compare/@pie-element/ebsr@7.0.25...@pie-element/ebsr@7.0.26) (2022-06-13)
|
|
7
44
|
|
|
8
45
|
**Note:** Version bump only for package @pie-element/ebsr
|
package/configure/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,43 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [8.1.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/ebsr-configure@8.1.0...@pie-element/ebsr-configure@8.1.1) (2022-07-19)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @pie-element/ebsr-configure
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [8.1.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/ebsr-configure@8.0.0...@pie-element/ebsr-configure@8.1.0) (2022-06-28)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* **ebsr:** add maxImageWidth and maxImageHeight props PD-1801 ([61c9b25](https://github.com/pie-framework/pie-elements/commit/61c9b2511ab8ef1a146d86def588bf8517e23e96))
|
|
20
|
+
* **ebsr:** implement item validation PD-1799 ([66e9ff1](https://github.com/pie-framework/pie-elements/commit/66e9ff1d0178e5ba6f4b07115f1efbf0c752e05f))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
# [8.0.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/ebsr-configure@7.0.26...@pie-element/ebsr-configure@8.0.0) (2022-06-28)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### chore
|
|
30
|
+
|
|
31
|
+
* Merge master with develop. ([cdca48a](https://github.com/pie-framework/pie-elements/commit/cdca48abaa1d4179e4a961e13d171e14b7ed2444))
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### BREAKING CHANGES
|
|
35
|
+
|
|
36
|
+
* Image percent buttons were removed from toolbar.
|
|
37
|
+
New properties maxImageWidth and maxImageHeight were added.
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
6
43
|
## [7.0.26](https://github.com/pie-framework/pie-elements/compare/@pie-element/ebsr-configure@7.0.25...@pie-element/ebsr-configure@7.0.26) (2022-06-13)
|
|
7
44
|
|
|
8
45
|
**Note:** Version bump only for package @pie-element/ebsr-configure
|
|
@@ -66,6 +66,18 @@ var defaultConfig = {
|
|
|
66
66
|
label: 'Spellcheck',
|
|
67
67
|
settings: false,
|
|
68
68
|
enabled: true
|
|
69
|
+
},
|
|
70
|
+
maxImageWidth: {
|
|
71
|
+
teacherInstructions: 300,
|
|
72
|
+
prompt: 300,
|
|
73
|
+
rationale: 636,
|
|
74
|
+
choices: 636
|
|
75
|
+
},
|
|
76
|
+
maxImageHeight: {
|
|
77
|
+
teacherInstructions: 300,
|
|
78
|
+
prompt: 300,
|
|
79
|
+
rationale: 300,
|
|
80
|
+
choices: 300
|
|
69
81
|
}
|
|
70
82
|
};
|
|
71
83
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/defaults.js"],"names":["defaultConfig","addChoiceButton","settings","label","choiceMode","choicePrefix","deleteChoice","feedback","lockChoiceOrder","prompt","rationale","studentInstructions","teacherInstructions","choicesLayout","gridColumns","spellCheck","enabled","
|
|
1
|
+
{"version":3,"sources":["../src/defaults.js"],"names":["defaultConfig","addChoiceButton","settings","label","choiceMode","choicePrefix","deleteChoice","feedback","lockChoiceOrder","prompt","rationale","studentInstructions","teacherInstructions","choicesLayout","gridColumns","spellCheck","enabled","maxImageWidth","choices","maxImageHeight","partModel","base","rationaleEnabled","feedbackEnabled","promptEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","spellCheckEnabled","model","partLabels","partLabelType","partialScoring","partA","partB","configuration","scoringType","settingsPanelDisabled"],"mappings":";;;;;;;;;;;AAAA;;;;;;AAEA,IAAMA,aAAa,GAAG;AACpBC,EAAAA,eAAe,EAAE;AACfC,IAAAA,QAAQ,EAAE,IADK;AAEfC,IAAAA,KAAK,EAAE;AAFQ,GADG;AAKpBC,EAAAA,UAAU,EAAE;AACVF,IAAAA,QAAQ,EAAE,IADA;AAEVC,IAAAA,KAAK,EAAE;AAFG,GALQ;AASpBE,EAAAA,YAAY,EAAE;AACZH,IAAAA,QAAQ,EAAE,IADE;AAEZC,IAAAA,KAAK,EAAE;AAFK,GATM;AAapBG,EAAAA,YAAY,EAAE;AACZJ,IAAAA,QAAQ,EAAE;AADE,GAbM;AAgBpBK,EAAAA,QAAQ,EAAE;AACRL,IAAAA,QAAQ,EAAE,IADF;AAERC,IAAAA,KAAK,EAAE;AAFC,GAhBU;AAoBpBK,EAAAA,eAAe,EAAE;AACfN,IAAAA,QAAQ,EAAE,IADK;AAEfC,IAAAA,KAAK,EAAE;AAFQ,GApBG;AAwBpBM,EAAAA,MAAM,EAAE;AACNP,IAAAA,QAAQ,EAAE,IADJ;AAENC,IAAAA,KAAK,EAAE;AAFD,GAxBY;AA4BpBO,EAAAA,SAAS,EAAE;AACTR,IAAAA,Q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EARD;AASpBF,IAAAA,SAAS,EAAE,EATS;AAUpBe,IAAAA,0BAA0B,EAAE,IAVR;AAWpBC,IAAAA,0BAA0B,EAAE,IAXR;AAYpBC,IAAAA,iBAAiB,EAAC,IAZE;AAapBd,IAAAA,aAAa,EAAE,UAbK;AAcpBC,IAAAA,WAAW,EAAE;AAdO,KAejBO,IAfiB;AAAA,CAAtB;;eAkBe;AACbO,EAAAA,KAAK,EAAE;AACLC,IAAAA,UAAU,EAAE,IADP;AAELC,IAAAA,aAAa,EAAE,SAFV;AAGLC,IAAAA,cAAc,EAAE,KAHX;AAILC,IAAAA,KAAK,EAAEZ,SAAS,CAAC;AAAEX,MAAAA,MAAM,EAAE;AAAV,KAAD,CAJX;AAKLwB,IAAAA,KAAK,EAAEb,SAAS,CAAC;AAAEX,MAAAA,MAAM,EAAE;AAAV,KAAD;AALX,GADM;AAQbyB,EAAAA,aAAa,EAAE;AACbH,IAAAA,cAAc,EAAE;AACd5B,MAAAA,KAAK,EAAE,uBADO;AAEd;AACA;AACA;AACAD,MAAAA,QAAQ,EAAE;AALI,KADH;AAQbiC,IAAAA,WAAW,EAAE;AACXjC,MAAAA,QAAQ,EAAE,KADC;AAEXC,MAAAA,KAAK,EAAE;AAFI,KARA;AAYb6B,IAAAA,KAAK,EAAE,2BAAUhC,aAAV,CAZM;AAabiC,IAAAA,KAAK,EAAE,2BAAUjC,aAAV,CAbM;AAcb6B,IAAAA,UAAU,EAAE;AACV3B,MAAAA,QAAQ,EAAE,IADA;AAEVC,MAAAA,KAAK,EAAE;AAFG,KAdC;AAkBbiC,IAAAA,qBAAqB,EAAE;AAlBV;AARF,C","sourcesContent":["import cloneDeep from 'lodash/cloneDeep';\n\nconst defaultConfig = {\n addChoiceButton: {\n settings: true,\n label: 'Add a Choice'\n },\n choiceMode: {\n settings: true,\n label: 'Response Type'\n },\n choicePrefix: {\n settings: true,\n label: 'Choice Labels'\n },\n deleteChoice: {\n settings: true\n },\n feedback: {\n settings: true,\n label: 'Feedback'\n },\n lockChoiceOrder: {\n settings: true,\n label: 'Lock Choice Order'\n },\n prompt: {\n settings: true,\n label: 'Prompt'\n },\n rationale: {\n settings: true,\n label: 'Rationale'\n },\n studentInstructions: {\n settings: false,\n label: 'Student Instructions'\n },\n teacherInstructions: {\n settings: true,\n label: 'Teacher Instructions'\n },\n choicesLayout: {\n settings: false,\n label: 'Choices Layout',\n },\n gridColumns: {\n label: 'Grid columns',\n },\n spellCheck: {\n label: 'Spellcheck',\n settings:false,\n enabled:true\n },\n maxImageWidth: {\n teacherInstructions: 300,\n prompt: 300,\n rationale: 636,\n choices: 636\n },\n maxImageHeight: {\n teacherInstructions: 300,\n prompt: 300,\n rationale: 300,\n choices: 300\n }\n};\n\nconst partModel = base => ({\n choiceMode: 'radio',\n choices: [],\n choicePrefix: 'numbers',\n prompt: 'Prompt',\n rationaleEnabled: true,\n feedbackEnabled: true,\n promptEnabled: true,\n teacherInstructions: '',\n rationale: '',\n teacherInstructionsEnabled: true,\n studentInstructionsEnabled: true,\n spellCheckEnabled:true,\n choicesLayout: 'vertical',\n gridColumns: '2',\n ...base\n});\n\nexport default {\n model: {\n partLabels: true,\n partLabelType: 'Letters',\n partialScoring: false,\n partA: partModel({ prompt: 'Prompt A' }),\n partB: partModel({ prompt: 'Prompt B' })\n },\n configuration: {\n partialScoring: {\n label: 'Allow Partial Scoring',\n // this will turn off partial scoring toggle in the settings tab by default for the interaction\n // as we'd like partial scoring to be controlled from the environment entirely\n // if any other consumers would like to enable it for themselves, they can do so from their model directly.\n settings: false\n },\n scoringType: {\n settings: false,\n label: 'Scoring Type'\n },\n partA: cloneDeep(defaultConfig),\n partB: cloneDeep(defaultConfig),\n partLabels: {\n settings: true,\n label: 'Part Labels'\n },\n settingsPanelDisabled: true\n }\n};\n"],"file":"defaults.js"}
|
package/configure/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/ebsr-configure",
|
|
3
3
|
"private": true,
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "8.1.1",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"module": "src/index.js",
|
|
8
8
|
"author": "",
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"@material-ui/core": "^3.9.2",
|
|
11
|
-
"@pie-element/multiple-choice": "^
|
|
11
|
+
"@pie-element/multiple-choice": "^7.1.1",
|
|
12
12
|
"@pie-framework/pie-configure-events": "^1.2.0",
|
|
13
|
-
"@pie-lib/config-ui": "^
|
|
13
|
+
"@pie-lib/config-ui": "^11.0.6",
|
|
14
14
|
"lodash": "^4.17.15",
|
|
15
15
|
"prop-types": "^15.6.2",
|
|
16
16
|
"react": "^16.8.1",
|
|
@@ -52,6 +52,18 @@ const defaultConfig = {
|
|
|
52
52
|
settings:false,
|
|
53
53
|
enabled:true
|
|
54
54
|
},
|
|
55
|
+
maxImageWidth: {
|
|
56
|
+
teacherInstructions: 300,
|
|
57
|
+
prompt: 300,
|
|
58
|
+
rationale: 636,
|
|
59
|
+
choices: 636
|
|
60
|
+
},
|
|
61
|
+
maxImageHeight: {
|
|
62
|
+
teacherInstructions: 300,
|
|
63
|
+
prompt: 300,
|
|
64
|
+
rationale: 300,
|
|
65
|
+
choices: 300
|
|
66
|
+
}
|
|
55
67
|
};
|
|
56
68
|
|
|
57
69
|
const partModel = base => ({
|
package/docs/config-schema.json
CHANGED
|
@@ -214,6 +214,68 @@
|
|
|
214
214
|
"title": "label"
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
|
+
},
|
|
218
|
+
"minAnswerChoices": {
|
|
219
|
+
"description": "Minimum number of answer choices",
|
|
220
|
+
"type": "number",
|
|
221
|
+
"title": "minAnswerChoices"
|
|
222
|
+
},
|
|
223
|
+
"maxAnswerChoices": {
|
|
224
|
+
"description": "Maximum number of answer choices",
|
|
225
|
+
"type": "number",
|
|
226
|
+
"title": "maxAnswerChoices"
|
|
227
|
+
},
|
|
228
|
+
"maxImageWidth": {
|
|
229
|
+
"title": "ConfigureMaxImageDimensionsProp",
|
|
230
|
+
"type": "object",
|
|
231
|
+
"properties": {
|
|
232
|
+
"teacherInstructions": {
|
|
233
|
+
"description": "Indicates the max dimension for images in teacher instructions",
|
|
234
|
+
"type": "number",
|
|
235
|
+
"title": "teacherInstructions"
|
|
236
|
+
},
|
|
237
|
+
"prompt": {
|
|
238
|
+
"description": "Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified",
|
|
239
|
+
"type": "number",
|
|
240
|
+
"title": "prompt"
|
|
241
|
+
},
|
|
242
|
+
"rationale": {
|
|
243
|
+
"description": "Indicates the max dimension for images in rationale",
|
|
244
|
+
"type": "number",
|
|
245
|
+
"title": "rationale"
|
|
246
|
+
},
|
|
247
|
+
"choices": {
|
|
248
|
+
"description": "Indicates the max dimension for images in choices",
|
|
249
|
+
"type": "number",
|
|
250
|
+
"title": "choices"
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
},
|
|
254
|
+
"maxImageHeight": {
|
|
255
|
+
"title": "ConfigureMaxImageDimensionsProp",
|
|
256
|
+
"type": "object",
|
|
257
|
+
"properties": {
|
|
258
|
+
"teacherInstructions": {
|
|
259
|
+
"description": "Indicates the max dimension for images in teacher instructions",
|
|
260
|
+
"type": "number",
|
|
261
|
+
"title": "teacherInstructions"
|
|
262
|
+
},
|
|
263
|
+
"prompt": {
|
|
264
|
+
"description": "Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified",
|
|
265
|
+
"type": "number",
|
|
266
|
+
"title": "prompt"
|
|
267
|
+
},
|
|
268
|
+
"rationale": {
|
|
269
|
+
"description": "Indicates the max dimension for images in rationale",
|
|
270
|
+
"type": "number",
|
|
271
|
+
"title": "rationale"
|
|
272
|
+
},
|
|
273
|
+
"choices": {
|
|
274
|
+
"description": "Indicates the max dimension for images in choices",
|
|
275
|
+
"type": "number",
|
|
276
|
+
"title": "choices"
|
|
277
|
+
}
|
|
278
|
+
}
|
|
217
279
|
}
|
|
218
280
|
}
|
|
219
281
|
},
|
|
@@ -428,6 +490,68 @@
|
|
|
428
490
|
"title": "label"
|
|
429
491
|
}
|
|
430
492
|
}
|
|
493
|
+
},
|
|
494
|
+
"minAnswerChoices": {
|
|
495
|
+
"description": "Minimum number of answer choices",
|
|
496
|
+
"type": "number",
|
|
497
|
+
"title": "minAnswerChoices"
|
|
498
|
+
},
|
|
499
|
+
"maxAnswerChoices": {
|
|
500
|
+
"description": "Maximum number of answer choices",
|
|
501
|
+
"type": "number",
|
|
502
|
+
"title": "maxAnswerChoices"
|
|
503
|
+
},
|
|
504
|
+
"maxImageWidth": {
|
|
505
|
+
"title": "ConfigureMaxImageDimensionsProp",
|
|
506
|
+
"type": "object",
|
|
507
|
+
"properties": {
|
|
508
|
+
"teacherInstructions": {
|
|
509
|
+
"description": "Indicates the max dimension for images in teacher instructions",
|
|
510
|
+
"type": "number",
|
|
511
|
+
"title": "teacherInstructions"
|
|
512
|
+
},
|
|
513
|
+
"prompt": {
|
|
514
|
+
"description": "Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified",
|
|
515
|
+
"type": "number",
|
|
516
|
+
"title": "prompt"
|
|
517
|
+
},
|
|
518
|
+
"rationale": {
|
|
519
|
+
"description": "Indicates the max dimension for images in rationale",
|
|
520
|
+
"type": "number",
|
|
521
|
+
"title": "rationale"
|
|
522
|
+
},
|
|
523
|
+
"choices": {
|
|
524
|
+
"description": "Indicates the max dimension for images in choices",
|
|
525
|
+
"type": "number",
|
|
526
|
+
"title": "choices"
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
},
|
|
530
|
+
"maxImageHeight": {
|
|
531
|
+
"title": "ConfigureMaxImageDimensionsProp",
|
|
532
|
+
"type": "object",
|
|
533
|
+
"properties": {
|
|
534
|
+
"teacherInstructions": {
|
|
535
|
+
"description": "Indicates the max dimension for images in teacher instructions",
|
|
536
|
+
"type": "number",
|
|
537
|
+
"title": "teacherInstructions"
|
|
538
|
+
},
|
|
539
|
+
"prompt": {
|
|
540
|
+
"description": "Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified",
|
|
541
|
+
"type": "number",
|
|
542
|
+
"title": "prompt"
|
|
543
|
+
},
|
|
544
|
+
"rationale": {
|
|
545
|
+
"description": "Indicates the max dimension for images in rationale",
|
|
546
|
+
"type": "number",
|
|
547
|
+
"title": "rationale"
|
|
548
|
+
},
|
|
549
|
+
"choices": {
|
|
550
|
+
"description": "Indicates the max dimension for images in choices",
|
|
551
|
+
"type": "number",
|
|
552
|
+
"title": "choices"
|
|
553
|
+
}
|
|
554
|
+
}
|
|
431
555
|
}
|
|
432
556
|
}
|
|
433
557
|
},
|
|
@@ -708,6 +832,68 @@
|
|
|
708
832
|
"title": "label"
|
|
709
833
|
}
|
|
710
834
|
}
|
|
835
|
+
},
|
|
836
|
+
"minAnswerChoices": {
|
|
837
|
+
"description": "Minimum number of answer choices",
|
|
838
|
+
"type": "number",
|
|
839
|
+
"title": "minAnswerChoices"
|
|
840
|
+
},
|
|
841
|
+
"maxAnswerChoices": {
|
|
842
|
+
"description": "Maximum number of answer choices",
|
|
843
|
+
"type": "number",
|
|
844
|
+
"title": "maxAnswerChoices"
|
|
845
|
+
},
|
|
846
|
+
"maxImageWidth": {
|
|
847
|
+
"title": "ConfigureMaxImageDimensionsProp",
|
|
848
|
+
"type": "object",
|
|
849
|
+
"properties": {
|
|
850
|
+
"teacherInstructions": {
|
|
851
|
+
"description": "Indicates the max dimension for images in teacher instructions",
|
|
852
|
+
"type": "number",
|
|
853
|
+
"title": "teacherInstructions"
|
|
854
|
+
},
|
|
855
|
+
"prompt": {
|
|
856
|
+
"description": "Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified",
|
|
857
|
+
"type": "number",
|
|
858
|
+
"title": "prompt"
|
|
859
|
+
},
|
|
860
|
+
"rationale": {
|
|
861
|
+
"description": "Indicates the max dimension for images in rationale",
|
|
862
|
+
"type": "number",
|
|
863
|
+
"title": "rationale"
|
|
864
|
+
},
|
|
865
|
+
"choices": {
|
|
866
|
+
"description": "Indicates the max dimension for images in choices",
|
|
867
|
+
"type": "number",
|
|
868
|
+
"title": "choices"
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
},
|
|
872
|
+
"maxImageHeight": {
|
|
873
|
+
"title": "ConfigureMaxImageDimensionsProp",
|
|
874
|
+
"type": "object",
|
|
875
|
+
"properties": {
|
|
876
|
+
"teacherInstructions": {
|
|
877
|
+
"description": "Indicates the max dimension for images in teacher instructions",
|
|
878
|
+
"type": "number",
|
|
879
|
+
"title": "teacherInstructions"
|
|
880
|
+
},
|
|
881
|
+
"prompt": {
|
|
882
|
+
"description": "Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified",
|
|
883
|
+
"type": "number",
|
|
884
|
+
"title": "prompt"
|
|
885
|
+
},
|
|
886
|
+
"rationale": {
|
|
887
|
+
"description": "Indicates the max dimension for images in rationale",
|
|
888
|
+
"type": "number",
|
|
889
|
+
"title": "rationale"
|
|
890
|
+
},
|
|
891
|
+
"choices": {
|
|
892
|
+
"description": "Indicates the max dimension for images in choices",
|
|
893
|
+
"type": "number",
|
|
894
|
+
"title": "choices"
|
|
895
|
+
}
|
|
896
|
+
}
|
|
711
897
|
}
|
|
712
898
|
}
|
|
713
899
|
},
|
|
@@ -726,6 +912,32 @@
|
|
|
726
912
|
"title": "label"
|
|
727
913
|
}
|
|
728
914
|
}
|
|
915
|
+
},
|
|
916
|
+
"ConfigureMaxImageDimensionsProp": {
|
|
917
|
+
"title": "ConfigureMaxImageDimensionsProp",
|
|
918
|
+
"type": "object",
|
|
919
|
+
"properties": {
|
|
920
|
+
"teacherInstructions": {
|
|
921
|
+
"description": "Indicates the max dimension for images in teacher instructions",
|
|
922
|
+
"type": "number",
|
|
923
|
+
"title": "teacherInstructions"
|
|
924
|
+
},
|
|
925
|
+
"prompt": {
|
|
926
|
+
"description": "Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified",
|
|
927
|
+
"type": "number",
|
|
928
|
+
"title": "prompt"
|
|
929
|
+
},
|
|
930
|
+
"rationale": {
|
|
931
|
+
"description": "Indicates the max dimension for images in rationale",
|
|
932
|
+
"type": "number",
|
|
933
|
+
"title": "rationale"
|
|
934
|
+
},
|
|
935
|
+
"choices": {
|
|
936
|
+
"description": "Indicates the max dimension for images in choices",
|
|
937
|
+
"type": "number",
|
|
938
|
+
"title": "choices"
|
|
939
|
+
}
|
|
940
|
+
}
|
|
729
941
|
}
|
|
730
942
|
},
|
|
731
943
|
"$schema": "http://json-schema.org/draft-07/schema#"
|
|
@@ -162,6 +162,54 @@ Indicates if the item has to be displayed in the Settings Panel
|
|
|
162
162
|
|
|
163
163
|
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
164
164
|
|
|
165
|
+
## `minAnswerChoices` (number)
|
|
166
|
+
|
|
167
|
+
Minimum number of answer choices
|
|
168
|
+
|
|
169
|
+
## `maxAnswerChoices` (number)
|
|
170
|
+
|
|
171
|
+
Maximum number of answer choices
|
|
172
|
+
|
|
173
|
+
## `maxImageWidth` (object)
|
|
174
|
+
|
|
175
|
+
Properties of the `maxImageWidth` object:
|
|
176
|
+
|
|
177
|
+
### `teacherInstructions` (number)
|
|
178
|
+
|
|
179
|
+
Indicates the max dimension for images in teacher instructions
|
|
180
|
+
|
|
181
|
+
### `prompt` (number)
|
|
182
|
+
|
|
183
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
184
|
+
|
|
185
|
+
### `rationale` (number)
|
|
186
|
+
|
|
187
|
+
Indicates the max dimension for images in rationale
|
|
188
|
+
|
|
189
|
+
### `choices` (number)
|
|
190
|
+
|
|
191
|
+
Indicates the max dimension for images in choices
|
|
192
|
+
|
|
193
|
+
## `maxImageHeight` (object)
|
|
194
|
+
|
|
195
|
+
Properties of the `maxImageHeight` object:
|
|
196
|
+
|
|
197
|
+
### `teacherInstructions` (number)
|
|
198
|
+
|
|
199
|
+
Indicates the max dimension for images in teacher instructions
|
|
200
|
+
|
|
201
|
+
### `prompt` (number)
|
|
202
|
+
|
|
203
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
204
|
+
|
|
205
|
+
### `rationale` (number)
|
|
206
|
+
|
|
207
|
+
Indicates the max dimension for images in rationale
|
|
208
|
+
|
|
209
|
+
### `choices` (number)
|
|
210
|
+
|
|
211
|
+
Indicates the max dimension for images in choices
|
|
212
|
+
|
|
165
213
|
# `partB` (object, required)
|
|
166
214
|
|
|
167
215
|
Properties of the `partB` object:
|
|
@@ -322,6 +370,54 @@ Indicates if the item has to be displayed in the Settings Panel
|
|
|
322
370
|
|
|
323
371
|
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
324
372
|
|
|
373
|
+
## `minAnswerChoices` (number)
|
|
374
|
+
|
|
375
|
+
Minimum number of answer choices
|
|
376
|
+
|
|
377
|
+
## `maxAnswerChoices` (number)
|
|
378
|
+
|
|
379
|
+
Maximum number of answer choices
|
|
380
|
+
|
|
381
|
+
## `maxImageWidth` (object)
|
|
382
|
+
|
|
383
|
+
Properties of the `maxImageWidth` object:
|
|
384
|
+
|
|
385
|
+
### `teacherInstructions` (number)
|
|
386
|
+
|
|
387
|
+
Indicates the max dimension for images in teacher instructions
|
|
388
|
+
|
|
389
|
+
### `prompt` (number)
|
|
390
|
+
|
|
391
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
392
|
+
|
|
393
|
+
### `rationale` (number)
|
|
394
|
+
|
|
395
|
+
Indicates the max dimension for images in rationale
|
|
396
|
+
|
|
397
|
+
### `choices` (number)
|
|
398
|
+
|
|
399
|
+
Indicates the max dimension for images in choices
|
|
400
|
+
|
|
401
|
+
## `maxImageHeight` (object)
|
|
402
|
+
|
|
403
|
+
Properties of the `maxImageHeight` object:
|
|
404
|
+
|
|
405
|
+
### `teacherInstructions` (number)
|
|
406
|
+
|
|
407
|
+
Indicates the max dimension for images in teacher instructions
|
|
408
|
+
|
|
409
|
+
### `prompt` (number)
|
|
410
|
+
|
|
411
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
412
|
+
|
|
413
|
+
### `rationale` (number)
|
|
414
|
+
|
|
415
|
+
Indicates the max dimension for images in rationale
|
|
416
|
+
|
|
417
|
+
### `choices` (number)
|
|
418
|
+
|
|
419
|
+
Indicates the max dimension for images in choices
|
|
420
|
+
|
|
325
421
|
# `partLabels` (object)
|
|
326
422
|
|
|
327
423
|
Properties of the `partLabels` object:
|
|
@@ -536,6 +632,54 @@ Indicates if the item has to be displayed in the Settings Panel
|
|
|
536
632
|
|
|
537
633
|
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
538
634
|
|
|
635
|
+
### `minAnswerChoices` (number)
|
|
636
|
+
|
|
637
|
+
Minimum number of answer choices
|
|
638
|
+
|
|
639
|
+
### `maxAnswerChoices` (number)
|
|
640
|
+
|
|
641
|
+
Maximum number of answer choices
|
|
642
|
+
|
|
643
|
+
### `maxImageWidth` (object)
|
|
644
|
+
|
|
645
|
+
Properties of the `maxImageWidth` object:
|
|
646
|
+
|
|
647
|
+
#### `teacherInstructions` (number)
|
|
648
|
+
|
|
649
|
+
Indicates the max dimension for images in teacher instructions
|
|
650
|
+
|
|
651
|
+
#### `prompt` (number)
|
|
652
|
+
|
|
653
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
654
|
+
|
|
655
|
+
#### `rationale` (number)
|
|
656
|
+
|
|
657
|
+
Indicates the max dimension for images in rationale
|
|
658
|
+
|
|
659
|
+
#### `choices` (number)
|
|
660
|
+
|
|
661
|
+
Indicates the max dimension for images in choices
|
|
662
|
+
|
|
663
|
+
### `maxImageHeight` (object)
|
|
664
|
+
|
|
665
|
+
Properties of the `maxImageHeight` object:
|
|
666
|
+
|
|
667
|
+
#### `teacherInstructions` (number)
|
|
668
|
+
|
|
669
|
+
Indicates the max dimension for images in teacher instructions
|
|
670
|
+
|
|
671
|
+
#### `prompt` (number)
|
|
672
|
+
|
|
673
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
674
|
+
|
|
675
|
+
#### `rationale` (number)
|
|
676
|
+
|
|
677
|
+
Indicates the max dimension for images in rationale
|
|
678
|
+
|
|
679
|
+
#### `choices` (number)
|
|
680
|
+
|
|
681
|
+
Indicates the max dimension for images in choices
|
|
682
|
+
|
|
539
683
|
## `ConfigureProp` (object)
|
|
540
684
|
|
|
541
685
|
Properties of the `ConfigureProp` object:
|
|
@@ -546,4 +690,24 @@ Indicates if the item has to be displayed in the Settings Panel
|
|
|
546
690
|
|
|
547
691
|
### `label` (string)
|
|
548
692
|
|
|
549
|
-
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
693
|
+
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
694
|
+
|
|
695
|
+
## `ConfigureMaxImageDimensionsProp` (object)
|
|
696
|
+
|
|
697
|
+
Properties of the `ConfigureMaxImageDimensionsProp` object:
|
|
698
|
+
|
|
699
|
+
### `teacherInstructions` (number)
|
|
700
|
+
|
|
701
|
+
Indicates the max dimension for images in teacher instructions
|
|
702
|
+
|
|
703
|
+
### `prompt` (number)
|
|
704
|
+
|
|
705
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
706
|
+
|
|
707
|
+
### `rationale` (number)
|
|
708
|
+
|
|
709
|
+
Indicates the max dimension for images in rationale
|
|
710
|
+
|
|
711
|
+
### `choices` (number)
|
|
712
|
+
|
|
713
|
+
Indicates the max dimension for images in choices
|
package/docs/pie-schema.json
CHANGED
|
@@ -494,6 +494,68 @@
|
|
|
494
494
|
"title": "label"
|
|
495
495
|
}
|
|
496
496
|
}
|
|
497
|
+
},
|
|
498
|
+
"minAnswerChoices": {
|
|
499
|
+
"description": "Minimum number of answer choices",
|
|
500
|
+
"type": "number",
|
|
501
|
+
"title": "minAnswerChoices"
|
|
502
|
+
},
|
|
503
|
+
"maxAnswerChoices": {
|
|
504
|
+
"description": "Maximum number of answer choices",
|
|
505
|
+
"type": "number",
|
|
506
|
+
"title": "maxAnswerChoices"
|
|
507
|
+
},
|
|
508
|
+
"maxImageWidth": {
|
|
509
|
+
"title": "ConfigureMaxImageDimensionsProp",
|
|
510
|
+
"type": "object",
|
|
511
|
+
"properties": {
|
|
512
|
+
"teacherInstructions": {
|
|
513
|
+
"description": "Indicates the max dimension for images in teacher instructions",
|
|
514
|
+
"type": "number",
|
|
515
|
+
"title": "teacherInstructions"
|
|
516
|
+
},
|
|
517
|
+
"prompt": {
|
|
518
|
+
"description": "Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified",
|
|
519
|
+
"type": "number",
|
|
520
|
+
"title": "prompt"
|
|
521
|
+
},
|
|
522
|
+
"rationale": {
|
|
523
|
+
"description": "Indicates the max dimension for images in rationale",
|
|
524
|
+
"type": "number",
|
|
525
|
+
"title": "rationale"
|
|
526
|
+
},
|
|
527
|
+
"choices": {
|
|
528
|
+
"description": "Indicates the max dimension for images in choices",
|
|
529
|
+
"type": "number",
|
|
530
|
+
"title": "choices"
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
},
|
|
534
|
+
"maxImageHeight": {
|
|
535
|
+
"title": "ConfigureMaxImageDimensionsProp",
|
|
536
|
+
"type": "object",
|
|
537
|
+
"properties": {
|
|
538
|
+
"teacherInstructions": {
|
|
539
|
+
"description": "Indicates the max dimension for images in teacher instructions",
|
|
540
|
+
"type": "number",
|
|
541
|
+
"title": "teacherInstructions"
|
|
542
|
+
},
|
|
543
|
+
"prompt": {
|
|
544
|
+
"description": "Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified",
|
|
545
|
+
"type": "number",
|
|
546
|
+
"title": "prompt"
|
|
547
|
+
},
|
|
548
|
+
"rationale": {
|
|
549
|
+
"description": "Indicates the max dimension for images in rationale",
|
|
550
|
+
"type": "number",
|
|
551
|
+
"title": "rationale"
|
|
552
|
+
},
|
|
553
|
+
"choices": {
|
|
554
|
+
"description": "Indicates the max dimension for images in choices",
|
|
555
|
+
"type": "number",
|
|
556
|
+
"title": "choices"
|
|
557
|
+
}
|
|
558
|
+
}
|
|
497
559
|
}
|
|
498
560
|
}
|
|
499
561
|
},
|
|
@@ -513,6 +575,32 @@
|
|
|
513
575
|
}
|
|
514
576
|
}
|
|
515
577
|
},
|
|
578
|
+
"ConfigureMaxImageDimensionsProp": {
|
|
579
|
+
"title": "ConfigureMaxImageDimensionsProp",
|
|
580
|
+
"type": "object",
|
|
581
|
+
"properties": {
|
|
582
|
+
"teacherInstructions": {
|
|
583
|
+
"description": "Indicates the max dimension for images in teacher instructions",
|
|
584
|
+
"type": "number",
|
|
585
|
+
"title": "teacherInstructions"
|
|
586
|
+
},
|
|
587
|
+
"prompt": {
|
|
588
|
+
"description": "Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified",
|
|
589
|
+
"type": "number",
|
|
590
|
+
"title": "prompt"
|
|
591
|
+
},
|
|
592
|
+
"rationale": {
|
|
593
|
+
"description": "Indicates the max dimension for images in rationale",
|
|
594
|
+
"type": "number",
|
|
595
|
+
"title": "rationale"
|
|
596
|
+
},
|
|
597
|
+
"choices": {
|
|
598
|
+
"description": "Indicates the max dimension for images in choices",
|
|
599
|
+
"type": "number",
|
|
600
|
+
"title": "choices"
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
},
|
|
516
604
|
"Part": {
|
|
517
605
|
"title": "Part",
|
|
518
606
|
"type": "object",
|
package/docs/pie-schema.json.md
CHANGED
|
@@ -370,6 +370,54 @@ Indicates if the item has to be displayed in the Settings Panel
|
|
|
370
370
|
|
|
371
371
|
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
372
372
|
|
|
373
|
+
### `minAnswerChoices` (number)
|
|
374
|
+
|
|
375
|
+
Minimum number of answer choices
|
|
376
|
+
|
|
377
|
+
### `maxAnswerChoices` (number)
|
|
378
|
+
|
|
379
|
+
Maximum number of answer choices
|
|
380
|
+
|
|
381
|
+
### `maxImageWidth` (object)
|
|
382
|
+
|
|
383
|
+
Properties of the `maxImageWidth` object:
|
|
384
|
+
|
|
385
|
+
#### `teacherInstructions` (number)
|
|
386
|
+
|
|
387
|
+
Indicates the max dimension for images in teacher instructions
|
|
388
|
+
|
|
389
|
+
#### `prompt` (number)
|
|
390
|
+
|
|
391
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
392
|
+
|
|
393
|
+
#### `rationale` (number)
|
|
394
|
+
|
|
395
|
+
Indicates the max dimension for images in rationale
|
|
396
|
+
|
|
397
|
+
#### `choices` (number)
|
|
398
|
+
|
|
399
|
+
Indicates the max dimension for images in choices
|
|
400
|
+
|
|
401
|
+
### `maxImageHeight` (object)
|
|
402
|
+
|
|
403
|
+
Properties of the `maxImageHeight` object:
|
|
404
|
+
|
|
405
|
+
#### `teacherInstructions` (number)
|
|
406
|
+
|
|
407
|
+
Indicates the max dimension for images in teacher instructions
|
|
408
|
+
|
|
409
|
+
#### `prompt` (number)
|
|
410
|
+
|
|
411
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
412
|
+
|
|
413
|
+
#### `rationale` (number)
|
|
414
|
+
|
|
415
|
+
Indicates the max dimension for images in rationale
|
|
416
|
+
|
|
417
|
+
#### `choices` (number)
|
|
418
|
+
|
|
419
|
+
Indicates the max dimension for images in choices
|
|
420
|
+
|
|
373
421
|
## `ConfigureProp` (object)
|
|
374
422
|
|
|
375
423
|
Properties of the `ConfigureProp` object:
|
|
@@ -382,6 +430,26 @@ Indicates if the item has to be displayed in the Settings Panel
|
|
|
382
430
|
|
|
383
431
|
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
384
432
|
|
|
433
|
+
## `ConfigureMaxImageDimensionsProp` (object)
|
|
434
|
+
|
|
435
|
+
Properties of the `ConfigureMaxImageDimensionsProp` object:
|
|
436
|
+
|
|
437
|
+
### `teacherInstructions` (number)
|
|
438
|
+
|
|
439
|
+
Indicates the max dimension for images in teacher instructions
|
|
440
|
+
|
|
441
|
+
### `prompt` (number)
|
|
442
|
+
|
|
443
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
444
|
+
|
|
445
|
+
### `rationale` (number)
|
|
446
|
+
|
|
447
|
+
Indicates the max dimension for images in rationale
|
|
448
|
+
|
|
449
|
+
### `choices` (number)
|
|
450
|
+
|
|
451
|
+
Indicates the max dimension for images in choices
|
|
452
|
+
|
|
385
453
|
## `Part` (object)
|
|
386
454
|
|
|
387
455
|
Properties of the `Part` object:
|
package/lib/index.js
CHANGED
|
@@ -141,7 +141,7 @@ var Ebsr = /*#__PURE__*/function (_HTMLElement) {
|
|
|
141
141
|
}, {
|
|
142
142
|
key: "setPartModel",
|
|
143
143
|
value: function setPartModel(part, key) {
|
|
144
|
-
if (this._model && this._model[key]) {
|
|
144
|
+
if (this._model && this._model[key] && part) {
|
|
145
145
|
var mode = this._model.mode;
|
|
146
146
|
part.model = _objectSpread(_objectSpread({}, this._model[key]), {}, {
|
|
147
147
|
mode: mode,
|
|
@@ -152,7 +152,7 @@ var Ebsr = /*#__PURE__*/function (_HTMLElement) {
|
|
|
152
152
|
}, {
|
|
153
153
|
key: "setPartSession",
|
|
154
154
|
value: function setPartSession(part, key) {
|
|
155
|
-
if (this._session && this._model) {
|
|
155
|
+
if (this._session && this._model && part) {
|
|
156
156
|
var value = this._session.value;
|
|
157
157
|
part.session = value && value[key] ? value[key] : {
|
|
158
158
|
id: key
|
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,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,KAAK,CAACC,OAAN,CAAcF,CAAd,KAAoBA,CAAC,CAACG,MAAF,GAAW,CAAtC;AAAA,CAAxB;;AAEO,IAAMC,iBAAiB,GAAG,SAApBA,iBAAoB,CAACC,OAAD,EAAa;AAC5C,MAAML,CAAC,GAAG,qBAAIK,OAAJ,EAAa,mBAAb,CAAV;AACA,MAAMC,CAAC,GAAG,qBAAID,OAAJ,EAAa,mBAAb,CAAV;AAEA,SAAON,eAAe,CAACC,CAAD,CAAf,IAAsBD,eAAe,CAACO,CAAD,CAA5C;AACD,CALM;;;;IAOcC,I;;;;;AACnB,kBAAc;AAAA;;AAAA;AACZ;AADY,yGAMK,UAACC,CAAD,EAAO;AACxB,UAAIA,CAAC,CAACC,MAAF,mDAAJ,EAAuB;AACrB;AACD;;AAEDD,MAAAA,CAAC,CAACE,cAAF;AACAF,MAAAA,CAAC,CAACG,wBAAF;AAEA,UAAMC,EAAE,GAAGJ,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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,KAAK,CAACC,OAAN,CAAcF,CAAd,KAAoBA,CAAC,CAACG,MAAF,GAAW,CAAtC;AAAA,CAAxB;;AAEO,IAAMC,iBAAiB,GAAG,SAApBA,iBAAoB,CAACC,OAAD,EAAa;AAC5C,MAAML,CAAC,GAAG,qBAAIK,OAAJ,EAAa,mBAAb,CAAV;AACA,MAAMC,CAAC,GAAG,qBAAID,OAAJ,EAAa,mBAAb,CAAV;AAEA,SAAON,eAAe,CAACC,CAAD,CAAf,IAAsBD,eAAe,CAACO,CAAD,CAA5C;AACD,CALM;;;;IAOcC,I;;;;;AACnB,k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,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] && part) {\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 && part) {\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
|
@@ -172,7 +172,7 @@ var Ebsr = /*#__PURE__*/function (_HTMLElement) {
|
|
|
172
172
|
}, {
|
|
173
173
|
key: "setPartModel",
|
|
174
174
|
value: function setPartModel(part, key) {
|
|
175
|
-
if (this._model && this._model[key]) {
|
|
175
|
+
if (this._model && this._model[key] && part) {
|
|
176
176
|
part.model = _objectSpread(_objectSpread({}, preparePrintModel(this._model[key], this._options)), {}, {
|
|
177
177
|
keyMode: this._model[key].choicePrefix
|
|
178
178
|
});
|
|
@@ -193,7 +193,7 @@ var Ebsr = /*#__PURE__*/function (_HTMLElement) {
|
|
|
193
193
|
}, {
|
|
194
194
|
key: "setPartSession",
|
|
195
195
|
value: function setPartSession(part, key) {
|
|
196
|
-
if (this._session && this._model) {
|
|
196
|
+
if (this._session && this._model && part) {
|
|
197
197
|
var value = this._session.value;
|
|
198
198
|
part.session = value && value[key] ? value[key] : {
|
|
199
199
|
id: key
|
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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AKM,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;;;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
|
+
{"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,GAAaT,KAAK,GAAG,UAAH,GAAgB,QAAlC;AAEAF,EAAAA,KAAK,C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A,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] && part) {\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 && part) {\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"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/ebsr",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.1.1",
|
|
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": "^
|
|
10
|
+
"@pie-element/multiple-choice": "^7.1.1",
|
|
11
11
|
"@pie-framework/pie-player-events": "^0.1.0",
|
|
12
12
|
"classnames": "^2.2.5",
|
|
13
13
|
"debug": "^4.1.1",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"author": "pie framework developers",
|
|
17
17
|
"license": "ISC",
|
|
18
|
-
"gitHead": "
|
|
18
|
+
"gitHead": "30ddb939cb470e2b4f0281aec44143a9188e3106",
|
|
19
19
|
"scripts": {
|
|
20
20
|
"postpublish": "../../scripts/postpublish"
|
|
21
21
|
},
|
package/src/index.js
CHANGED
|
@@ -76,7 +76,7 @@ export default class Ebsr extends HTMLElement {
|
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
setPartModel(part, key) {
|
|
79
|
-
if (this._model && this._model[key]) {
|
|
79
|
+
if (this._model && this._model[key] && part) {
|
|
80
80
|
const { mode } = this._model;
|
|
81
81
|
|
|
82
82
|
part.model = {
|
|
@@ -88,7 +88,7 @@ export default class Ebsr extends HTMLElement {
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
setPartSession(part, key) {
|
|
91
|
-
if (this._session && this._model) {
|
|
91
|
+
if (this._session && this._model && part) {
|
|
92
92
|
const { value } = this._session;
|
|
93
93
|
part.session = value && value[key] ? value[key] : { id: key };
|
|
94
94
|
}
|
package/src/print.js
CHANGED
|
@@ -113,7 +113,7 @@ export default class Ebsr extends HTMLElement {
|
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
setPartModel(part, key) {
|
|
116
|
-
if (this._model && this._model[key]) {
|
|
116
|
+
if (this._model && this._model[key] && part) {
|
|
117
117
|
|
|
118
118
|
part.model = {
|
|
119
119
|
...preparePrintModel(this._model[key], this._options),
|
|
@@ -134,7 +134,7 @@ export default class Ebsr extends HTMLElement {
|
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
setPartSession(part, key) {
|
|
137
|
-
if (this._session && this._model) {
|
|
137
|
+
if (this._session && this._model && part) {
|
|
138
138
|
const { value } = this._session;
|
|
139
139
|
part.session = value && value[key] ? value[key] : { id: key };
|
|
140
140
|
}
|