@pie-element/multiple-choice 5.9.2 → 5.9.3-next.1016

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.
Files changed (47) hide show
  1. package/CHANGELOG.md +203 -0
  2. package/PRINT.md +35 -0
  3. package/configure/CHANGELOG.md +172 -0
  4. package/configure/lib/defaults.js +36 -9
  5. package/configure/lib/defaults.js.map +1 -1
  6. package/configure/lib/index.js +10 -5
  7. package/configure/lib/index.js.map +1 -1
  8. package/configure/lib/main.js +263 -49
  9. package/configure/lib/main.js.map +1 -1
  10. package/configure/lib/utils.js +18 -0
  11. package/configure/lib/utils.js.map +1 -0
  12. package/configure/package.json +4 -4
  13. package/controller/CHANGELOG.md +43 -0
  14. package/controller/lib/defaults.js +4 -2
  15. package/controller/lib/defaults.js.map +1 -1
  16. package/controller/lib/index.js +85 -9
  17. package/controller/lib/index.js.map +1 -1
  18. package/controller/lib/utils.js +9 -1
  19. package/controller/lib/utils.js.map +1 -1
  20. package/controller/package.json +1 -1
  21. package/docs/config-schema.json +137 -1
  22. package/docs/config-schema.json.md +107 -3
  23. package/docs/demo/generate.js +10 -5
  24. package/docs/pie-schema.json +63 -4
  25. package/docs/pie-schema.json.md +53 -2
  26. package/lib/choice-input.js +44 -20
  27. package/lib/choice-input.js.map +1 -1
  28. package/lib/choice.js +157 -0
  29. package/lib/choice.js.map +1 -0
  30. package/lib/feedback-tick.js +1 -1
  31. package/lib/feedback-tick.js.map +1 -1
  32. package/lib/index.js +2 -2
  33. package/lib/index.js.map +1 -1
  34. package/lib/main.js +1 -1
  35. package/lib/main.js.map +1 -1
  36. package/lib/multiple-choice.js +70 -143
  37. package/lib/multiple-choice.js.map +1 -1
  38. package/lib/print.js +129 -0
  39. package/lib/print.js.map +1 -0
  40. package/package.json +11 -7
  41. package/docs/demo/pie.manifest.json +0 -11
  42. package/module/configure.js +0 -881
  43. package/module/controller.js +0 -20268
  44. package/module/demo.js +0 -74
  45. package/module/element.js +0 -1221
  46. package/module/index.html +0 -16
  47. package/module/manifest.json +0 -10
package/CHANGELOG.md CHANGED
@@ -3,6 +3,209 @@
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
+ ## [6.2.6](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice@6.2.5...@pie-element/multiple-choice@6.2.6) (2022-03-28)
7
+
8
+ **Note:** Version bump only for package @pie-element/multiple-choice
9
+
10
+
11
+
12
+
13
+
14
+ ## [6.2.5](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice@6.2.4...@pie-element/multiple-choice@6.2.5) (2022-03-22)
15
+
16
+ **Note:** Version bump only for package @pie-element/multiple-choice
17
+
18
+
19
+
20
+
21
+
22
+ ## [6.2.4](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice@6.2.3...@pie-element/multiple-choice@6.2.4) (2022-03-08)
23
+
24
+ **Note:** Version bump only for package @pie-element/multiple-choice
25
+
26
+
27
+
28
+
29
+
30
+ ## [6.2.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice@6.2.2...@pie-element/multiple-choice@6.2.3) (2022-03-08)
31
+
32
+ **Note:** Version bump only for package @pie-element/multiple-choice
33
+
34
+
35
+
36
+
37
+
38
+ ## [6.2.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice@6.2.1...@pie-element/multiple-choice@6.2.2) (2022-02-21)
39
+
40
+ **Note:** Version bump only for package @pie-element/multiple-choice
41
+
42
+
43
+
44
+
45
+
46
+ ## [6.2.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice@6.2.0...@pie-element/multiple-choice@6.2.1) (2022-02-04)
47
+
48
+ **Note:** Version bump only for package @pie-element/multiple-choice
49
+
50
+
51
+
52
+
53
+
54
+ # [6.2.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice@6.1.11...@pie-element/multiple-choice@6.2.0) (2022-01-24)
55
+
56
+
57
+ ### Bug Fixes
58
+
59
+ * check if limitChoicesNumber is defined when adding a choice ([6f32cf0](https://github.com/pie-framework/pie-elements/commit/6f32cf05a1095b2be28864f2bb697080d05744f8))
60
+ * **multiple-choice:** fix colors for evaluate and view PD-1433 ([7050109](https://github.com/pie-framework/pie-elements/commit/705010946a1b0175fe19566d9daa86846fc55ca7))
61
+ * **multiple-choice:** limit choice number to 9 if it's defined ([4fa374c](https://github.com/pie-framework/pie-elements/commit/4fa374c77ca625522549ce68e1062ca4a5145b8b))
62
+ * **multiple-choice:** show choice prefix in print DNA-13066 ([52bd9bf](https://github.com/pie-framework/pie-elements/commit/52bd9bf862ad7adaf5ff0067a6738ad944b6d32d))
63
+ * **multiple-choice-print:** remove feedback ([25cbac5](https://github.com/pie-framework/pie-elements/commit/25cbac5647afe8864bedd9c50cd98abe6b31ddb0))
64
+ * **multiple-choice-print, ecr-print:** fix toggle issue, change options.mode to options.role ([0b3f534](https://github.com/pie-framework/pie-elements/commit/0b3f534bb4d2f969e21528e74516345e84f18d72))
65
+ * **multiple-choice, explicit-constructed-response, extended-text-entry:** print do not show teacher instructions, rationale or prompt if they are diabled DNA-13089 ([06b9555](https://github.com/pie-framework/pie-elements/commit/06b9555b25e094e0b2bce0e6a852a206c6d2c17d))
66
+ * show tick if available only in evaluate mode ([dddca13](https://github.com/pie-framework/pie-elements/commit/dddca137875221d3b52b17151163610f5eb1ea98))
67
+
68
+
69
+ ### Features
70
+
71
+ * **multiple-choice:** set min and max number of choices. BREAKING CHANGE: removed limitChoicesNumber from config and added minAnswerChoices and maxAnswerChoices ([a467f8f](https://github.com/pie-framework/pie-elements/commit/a467f8f4827c032c88de480b25eb49efcf1486aa))
72
+
73
+
74
+
75
+
76
+
77
+ ## [6.1.11](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice@6.1.10...@pie-element/multiple-choice@6.1.11) (2022-01-11)
78
+
79
+ **Note:** Version bump only for package @pie-element/multiple-choice
80
+
81
+
82
+
83
+
84
+
85
+ ## [6.1.10](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice@6.1.9...@pie-element/multiple-choice@6.1.10) (2022-01-10)
86
+
87
+ **Note:** Version bump only for package @pie-element/multiple-choice
88
+
89
+
90
+
91
+
92
+
93
+ ## [6.1.9](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice@6.1.8...@pie-element/multiple-choice@6.1.9) (2021-12-23)
94
+
95
+ **Note:** Version bump only for package @pie-element/multiple-choice
96
+
97
+
98
+
99
+
100
+
101
+ ## [6.1.7](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice@6.1.6...@pie-element/multiple-choice@6.1.7) (2021-12-13)
102
+
103
+ **Note:** Version bump only for package @pie-element/multiple-choice
104
+
105
+
106
+
107
+
108
+
109
+ ## [6.1.4](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice@6.1.3...@pie-element/multiple-choice@6.1.4) (2021-11-29)
110
+
111
+ **Note:** Version bump only for package @pie-element/multiple-choice
112
+
113
+
114
+
115
+
116
+
117
+ ## [6.1.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice@6.1.2...@pie-element/multiple-choice@6.1.3) (2021-11-11)
118
+
119
+ **Note:** Version bump only for package @pie-element/multiple-choice
120
+
121
+
122
+
123
+
124
+
125
+ ## [6.1.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice@6.1.1...@pie-element/multiple-choice@6.1.2) (2021-11-01)
126
+
127
+ **Note:** Version bump only for package @pie-element/multiple-choice
128
+
129
+
130
+
131
+
132
+
133
+ ## [6.1.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice@6.1.0...@pie-element/multiple-choice@6.1.1) (2021-10-04)
134
+
135
+ **Note:** Version bump only for package @pie-element/multiple-choice
136
+
137
+
138
+
139
+
140
+
141
+ # [6.1.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice@6.0.1...@pie-element/multiple-choice@6.1.0) (2021-09-20)
142
+
143
+
144
+ ### Bug Fixes
145
+
146
+ * exports ([66ed4d2](https://github.com/pie-framework/pie-elements/commit/66ed4d2ae44df712b8b48849023e6849d6d69126))
147
+ * pie-lib updates ([e521c2f](https://github.com/pie-framework/pie-elements/commit/e521c2f1a44aa7f3e14f82a1cee05ceb484ed0a6))
148
+ * Updated pie-lib versions ([2fe4c5d](https://github.com/pie-framework/pie-elements/commit/2fe4c5d0be2d40f5fdb34815855695a7f1087f56))
149
+ * Updated pie-lib versions ([1c23830](https://github.com/pie-framework/pie-elements/commit/1c23830fc75d1de5f7bb3bb16de3c665ae5fa350))
150
+
151
+
152
+ ### Features
153
+
154
+ * print demo ([a7f9707](https://github.com/pie-framework/pie-elements/commit/a7f9707592e1ec89a55e9d61450b0600aea4d486))
155
+
156
+
157
+
158
+
159
+
160
+ ## [6.0.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice@6.0.0...@pie-element/multiple-choice@6.0.1) (2021-09-01)
161
+
162
+ **Note:** Version bump only for package @pie-element/multiple-choice
163
+
164
+
165
+
166
+
167
+
168
+ # [6.0.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice@5.10.0...@pie-element/multiple-choice@6.0.0) (2021-08-09)
169
+
170
+
171
+ ### Features
172
+
173
+ * **ebsr:** Added choicesLayout support ([33fb7e7](https://github.com/pie-framework/pie-elements/commit/33fb7e765146a7343a58663f3667f4a5de472960))
174
+ * **ebsr:** Added choicesLayout support \n BREAKING CHANGE: removed vertical mode ([348fc00](https://github.com/pie-framework/pie-elements/commit/348fc0031536d458071a1105e742c3d19399a15e))
175
+
176
+
177
+ ### BREAKING CHANGES
178
+
179
+ * **ebsr:** removed vertical mode.
180
+
181
+
182
+
183
+
184
+
185
+ # [5.10.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice@5.9.2...@pie-element/multiple-choice@5.10.0) (2021-08-05)
186
+
187
+
188
+ ### Bug Fixes
189
+
190
+ * merge conflict ([01655ca](https://github.com/pie-framework/pie-elements/commit/01655caf59311cc1a7a6624a6243147b2819d76e))
191
+
192
+
193
+ ### Features
194
+
195
+ * **multiple-choice:** accessibility label - added aria label to checkbox and radio input types ([22514bb](https://github.com/pie-framework/pie-elements/commit/22514bb5e2476bc79a55756ff9a5c0c1e0642a29))
196
+ * **multiple-choice:** added possibility to change layout - vertical, grid, horizontal ([46e7681](https://github.com/pie-framework/pie-elements/commit/46e7681a178ff29c983db1c7b6206389b55e2a00))
197
+ * **multiple-choice:** grid layout - fix tests ([ab3c750](https://github.com/pie-framework/pie-elements/commit/ab3c750af03d9fbe0794f7ec53452c948b530ad8))
198
+ * **multiple-choice:** toolbar editor position set to bottom ([08ee249](https://github.com/pie-framework/pie-elements/commit/08ee249d45fdaab2c93a32453d757ec3c79215cd))
199
+ * if there are no choices - do not show grid columns dropdown BREAKING CHANGE: removed verticalMode(boolean) from model & configuration - and replaced it with choicesLayout(string) ([1c36ae8](https://github.com/pie-framework/pie-elements/commit/1c36ae8b7f9369b2723a6a84e7350370e1186c50))
200
+ * **multiple-choice:** grid layout - review comments ([540073f](https://github.com/pie-framework/pie-elements/commit/540073faeae2b67645a63e8ca609e7682138c710))
201
+ * **multiple-choice:** remove unused class name ([a7aa576](https://github.com/pie-framework/pie-elements/commit/a7aa576a32f5c44415994fe413491f3f3dd17b3f))
202
+ * **multiple-choice:** toolbar position ( bottom or top ) ([9af6cd9](https://github.com/pie-framework/pie-elements/commit/9af6cd9f6b893501e00640500a34e1c3404edc94))
203
+ * **multiple-choice:** update docs ([0843122](https://github.com/pie-framework/pie-elements/commit/084312288b501a7f1129b24a046f9ab19cf25f79))
204
+
205
+
206
+
207
+
208
+
6
209
  ## [5.9.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice@5.9.0...@pie-element/multiple-choice@5.9.2) (2021-08-05)
7
210
 
8
211
 
package/PRINT.md ADDED
@@ -0,0 +1,35 @@
1
+ # print how to
2
+
3
+ Brief guide on how to build pie-element print modules. Each element can have their own print module. It needs to be defined in the package.json `exports` map.
4
+
5
+
6
+ These modules will be published as part of the npm package.
7
+
8
+ We will then have a new element that 3rd parties can use to load up these elements:
9
+
10
+ ```html
11
+ <pie-print config={} options={}></pie-print>
12
+ ```
13
+
14
+ This is being developed in another repo: https://github.com/key-data-systems/pie-print-support
15
+
16
+
17
+
18
+ ## how to run a single element that will recompile when there are changes (no HMR):
19
+
20
+ `yarn pslb serve --config pslb/pslb.config.js --package @pie-element/multiple-choice --logLevel info`
21
+
22
+ Then go to:
23
+
24
+ http://localhost:7752/multiple-choice/module/index.html
25
+
26
+
27
+ ## how to build
28
+
29
+ You prob won't need this but for your edification:
30
+
31
+ `yarn pslb --config pslb/pslb.config.js --package @pie-element/multiple-choice --logLevel info`
32
+
33
+
34
+
35
+
@@ -3,6 +3,178 @@
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
+ ## [4.1.6](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@4.1.5...@pie-element/multiple-choice-configure@4.1.6) (2022-03-28)
7
+
8
+ **Note:** Version bump only for package @pie-element/multiple-choice-configure
9
+
10
+
11
+
12
+
13
+
14
+ ## [4.1.5](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@4.1.4...@pie-element/multiple-choice-configure@4.1.5) (2022-03-22)
15
+
16
+ **Note:** Version bump only for package @pie-element/multiple-choice-configure
17
+
18
+
19
+
20
+
21
+
22
+ ## [4.1.4](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@4.1.3...@pie-element/multiple-choice-configure@4.1.4) (2022-03-08)
23
+
24
+ **Note:** Version bump only for package @pie-element/multiple-choice-configure
25
+
26
+
27
+
28
+
29
+
30
+ ## [4.1.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@4.1.2...@pie-element/multiple-choice-configure@4.1.3) (2022-03-08)
31
+
32
+ **Note:** Version bump only for package @pie-element/multiple-choice-configure
33
+
34
+
35
+
36
+
37
+
38
+ ## [4.1.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@4.1.1...@pie-element/multiple-choice-configure@4.1.2) (2022-02-21)
39
+
40
+ **Note:** Version bump only for package @pie-element/multiple-choice-configure
41
+
42
+
43
+
44
+
45
+
46
+ ## [4.1.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@4.1.0...@pie-element/multiple-choice-configure@4.1.1) (2022-02-04)
47
+
48
+ **Note:** Version bump only for package @pie-element/multiple-choice-configure
49
+
50
+
51
+
52
+
53
+
54
+ # [4.1.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@4.0.11...@pie-element/multiple-choice-configure@4.1.0) (2022-01-24)
55
+
56
+
57
+ ### Bug Fixes
58
+
59
+ * check if limitChoicesNumber is defined when adding a choice ([6f32cf0](https://github.com/pie-framework/pie-elements/commit/6f32cf05a1095b2be28864f2bb697080d05744f8))
60
+ * **multiple-choice:** limit choice number to 9 if it's defined ([4fa374c](https://github.com/pie-framework/pie-elements/commit/4fa374c77ca625522549ce68e1062ca4a5145b8b))
61
+
62
+
63
+ ### Features
64
+
65
+ * **multiple-choice:** set min and max number of choices. BREAKING CHANGE: removed limitChoicesNumber from config and added minAnswerChoices and maxAnswerChoices ([a467f8f](https://github.com/pie-framework/pie-elements/commit/a467f8f4827c032c88de480b25eb49efcf1486aa))
66
+
67
+
68
+
69
+
70
+
71
+ ## [4.0.11](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@4.0.10...@pie-element/multiple-choice-configure@4.0.11) (2022-01-11)
72
+
73
+ **Note:** Version bump only for package @pie-element/multiple-choice-configure
74
+
75
+
76
+
77
+
78
+
79
+ ## [4.0.10](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@4.0.9...@pie-element/multiple-choice-configure@4.0.10) (2022-01-10)
80
+
81
+ **Note:** Version bump only for package @pie-element/multiple-choice-configure
82
+
83
+
84
+
85
+
86
+
87
+ ## [4.0.9](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@4.0.8...@pie-element/multiple-choice-configure@4.0.9) (2021-12-23)
88
+
89
+ **Note:** Version bump only for package @pie-element/multiple-choice-configure
90
+
91
+
92
+
93
+
94
+
95
+ ## [4.0.7](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@4.0.6...@pie-element/multiple-choice-configure@4.0.7) (2021-12-13)
96
+
97
+ **Note:** Version bump only for package @pie-element/multiple-choice-configure
98
+
99
+
100
+
101
+
102
+
103
+ ## [4.0.4](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@4.0.3...@pie-element/multiple-choice-configure@4.0.4) (2021-11-29)
104
+
105
+ **Note:** Version bump only for package @pie-element/multiple-choice-configure
106
+
107
+
108
+
109
+
110
+
111
+ ## [4.0.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@4.0.2...@pie-element/multiple-choice-configure@4.0.3) (2021-10-04)
112
+
113
+ **Note:** Version bump only for package @pie-element/multiple-choice-configure
114
+
115
+
116
+
117
+
118
+
119
+ ## [4.0.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@4.0.1...@pie-element/multiple-choice-configure@4.0.2) (2021-09-20)
120
+
121
+
122
+ ### Bug Fixes
123
+
124
+ * pie-lib updates ([e521c2f](https://github.com/pie-framework/pie-elements/commit/e521c2f1a44aa7f3e14f82a1cee05ceb484ed0a6))
125
+ * Updated pie-lib versions ([2fe4c5d](https://github.com/pie-framework/pie-elements/commit/2fe4c5d0be2d40f5fdb34815855695a7f1087f56))
126
+ * Updated pie-lib versions ([1c23830](https://github.com/pie-framework/pie-elements/commit/1c23830fc75d1de5f7bb3bb16de3c665ae5fa350))
127
+
128
+
129
+
130
+
131
+
132
+ ## [4.0.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@4.0.0...@pie-element/multiple-choice-configure@4.0.1) (2021-09-01)
133
+
134
+ **Note:** Version bump only for package @pie-element/multiple-choice-configure
135
+
136
+
137
+
138
+
139
+
140
+ # [4.0.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@3.5.0...@pie-element/multiple-choice-configure@4.0.0) (2021-08-09)
141
+
142
+
143
+ ### Features
144
+
145
+ * **ebsr:** Added choicesLayout support ([33fb7e7](https://github.com/pie-framework/pie-elements/commit/33fb7e765146a7343a58663f3667f4a5de472960))
146
+ * **ebsr:** Added choicesLayout support \n BREAKING CHANGE: removed vertical mode ([348fc00](https://github.com/pie-framework/pie-elements/commit/348fc0031536d458071a1105e742c3d19399a15e))
147
+
148
+
149
+ ### BREAKING CHANGES
150
+
151
+ * **ebsr:** removed vertical mode.
152
+
153
+
154
+
155
+
156
+
157
+ # [3.5.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@3.4.2...@pie-element/multiple-choice-configure@3.5.0) (2021-08-05)
158
+
159
+
160
+ ### Bug Fixes
161
+
162
+ * merge conflict ([01655ca](https://github.com/pie-framework/pie-elements/commit/01655caf59311cc1a7a6624a6243147b2819d76e))
163
+
164
+
165
+ ### Features
166
+
167
+ * **multiple-choice:** accessibility label - added aria label to checkbox and radio input types ([22514bb](https://github.com/pie-framework/pie-elements/commit/22514bb5e2476bc79a55756ff9a5c0c1e0642a29))
168
+ * if there are no choices - do not show grid columns dropdown BREAKING CHANGE: removed verticalMode(boolean) from model & configuration - and replaced it with choicesLayout(string) ([1c36ae8](https://github.com/pie-framework/pie-elements/commit/1c36ae8b7f9369b2723a6a84e7350370e1186c50))
169
+ * **multiple-choice:** added possibility to change layout - vertical, grid, horizontal ([46e7681](https://github.com/pie-framework/pie-elements/commit/46e7681a178ff29c983db1c7b6206389b55e2a00))
170
+ * **multiple-choice:** grid layout - fix tests ([ab3c750](https://github.com/pie-framework/pie-elements/commit/ab3c750af03d9fbe0794f7ec53452c948b530ad8))
171
+ * **multiple-choice:** toolbar position ( bottom or top ) ([9af6cd9](https://github.com/pie-framework/pie-elements/commit/9af6cd9f6b893501e00640500a34e1c3404edc94))
172
+ * **multiple-choice:** update docs ([0843122](https://github.com/pie-framework/pie-elements/commit/084312288b501a7f1129b24a046f9ab19cf25f79))
173
+
174
+
175
+
176
+
177
+
6
178
  ## [3.4.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@3.4.0...@pie-element/multiple-choice-configure@3.4.2) (2021-08-05)
7
179
 
8
180
 
@@ -21,25 +21,30 @@ var _default = {
21
21
  feedbackEnabled: true,
22
22
  promptEnabled: true,
23
23
  rationaleEnabled: true,
24
- limitChoicesNumber: true,
25
24
  teacherInstructionsEnabled: true,
26
25
  studentInstructionsEnabled: true,
27
- verticalMode: true
26
+ toolbarEditorPosition: 'bottom',
27
+ choicesLayout: 'vertical',
28
+ gridColumns: '2'
28
29
  },
29
30
  configuration: {
30
- verticalMode: {
31
- settings: true,
32
- label: 'Vertical Mode'
31
+ spellCheck: {
32
+ label: 'Spellcheck',
33
+ settings: false,
34
+ enabled: true
35
+ },
36
+ choicesLayout: {
37
+ settings: false,
38
+ label: 'Choices Layout'
39
+ },
40
+ gridColumns: {
41
+ label: 'Grid columns'
33
42
  },
34
43
  answerChoiceCount: 0,
35
44
  addChoiceButton: {
36
45
  settings: true,
37
46
  label: 'Add a Choice'
38
47
  },
39
- limitChoicesNumber: {
40
- settings: true,
41
- label: 'Limit choices to 9'
42
- },
43
48
  choiceMode: {
44
49
  settings: true,
45
50
  label: 'Response Type'
@@ -71,6 +76,10 @@ var _default = {
71
76
  settings: true,
72
77
  label: 'Rationale'
73
78
  },
79
+ accessibility: {
80
+ settings: false,
81
+ label: 'Accessibility Label'
82
+ },
74
83
  scoringType: {
75
84
  settings: false,
76
85
  label: 'Scoring Type'
@@ -82,6 +91,24 @@ var _default = {
82
91
  teacherInstructions: {
83
92
  settings: true,
84
93
  label: 'Teacher Instructions'
94
+ },
95
+ toolbarEditorPosition: {
96
+ settings: false,
97
+ label: 'Toolbar Editor Position'
98
+ },
99
+ minAnswerChoices: 2,
100
+ maxAnswerChoices: 5,
101
+ maxImageWidth: {
102
+ teacherInstructions: 300,
103
+ prompt: 300,
104
+ rationale: 636,
105
+ choices: 636
106
+ },
107
+ maxImageHeight: {
108
+ teacherInstructions: 300,
109
+ prompt: 300,
110
+ rationale: 300,
111
+ choices: 300
85
112
  }
86
113
  }
87
114
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/defaults.js"],"names":["model","choiceMode","choicePrefix","choices","prompt","lockChoiceOrder","partialScoring","scoringType","feedbackEnabled","promptEnabled","rationaleEnabled","limitChoicesNumber","teacherInstructionsEnabled","studentInstructionsEnabled","verticalMode","configuration","settings","label","answerChoiceCount","addChoiceButton","deleteChoice","feedback","rationale","studentInstructions","teacherInstructions"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;eACe;AACbA,EAAAA,KAAK,EAAE;AACLC,IAAAA,UAAU,EAAE,UADP;AAELC,IAAAA,YAAY,EAAE,SAFT;AAGLC,IAAAA,OAAO,EAAE,EAHJ;AAILC,IAAAA,MAAM,EAAE,2BAJH;AAKLC,IAAAA,eAAe,EAAE,IALZ;AAMLC,IAAAA,cAAc,EAAE,IANX;AAOLC,IAAAA,WAAW,EAAE,MAPR;AAQLC,IAAAA,eAAe,EAAE,IARZ;AASLC,IAAAA,aAAa,EAAE,IATV;AAULC,IAAAA,gBAAgB,EAAE,IAVb;AAWLC,IAAAA,kBAAkB,EAAE,IAXf;AAYLC,IAAAA,0BAA0B,EAAE,IAZvB;AAaLC,IAAAA,0BAA0B,EAAE,IAbvB;AAcLC,IAAAA,YAAY,EAAE;AAdT,GADM;AAiBbC,EAAAA,aAAa,EAAE;AACbD,IAAAA,YAAY,EAAE;AACZE,MAAAA,QAAQ,EAAE,IADE;AAEZC,MAAAA,KAAK,EAAE;AAFK,KADD;AAKbC,IAAAA,iBAAiB,EAAE,CALN;AAMbC,IAAAA,eAAe,EAAE;AACfH,MAAAA,QA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cesContent":["/** NOTE: teacherInstructions, studentInstructions, rationale & scoringType\n * functionalities are not defined yet - the value for those can belong to\n * model or to configure\n */\nexport default {\n model: {\n choiceMode: 'checkbox',\n choicePrefix: 'letters',\n choices: [],\n prompt: 'Question Prompt goes here',\n lockChoiceOrder: true,\n partialScoring: true,\n scoringType: 'auto',\n feedbackEnabled: true,\n promptEnabled: true,\n rationaleEnabled: true,\n limitChoicesNumber: true,\n teacherInstructionsEnabled: true,\n studentInstructionsEnabled: true,\n verticalMode: true\n },\n configuration: {\n verticalMode: {\n settings: true,\n label: 'Vertical Mode',\n },\n answerChoiceCount: 0,\n addChoiceButton: {\n settings: true,\n label: 'Add a Choice'\n },\n limitChoicesNumber: {\n settings: true,\n label: 'Limit choices to 9'\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 prompt: {\n settings: true,\n label: 'Prompt'\n },\n lockChoiceOrder: {\n settings: true,\n label: 'Lock Choice Order'\n },\n partialScoring: {\n settings: false,\n label: 'Allow Partial Scoring'\n },\n rationale: {\n settings: true,\n label: 'Rationale'\n },\n scoringType: {\n settings: false,\n label: 'Scoring Type'\n },\n studentInstructions: {\n settings: false,\n label: 'Student Instructions'\n },\n teacherInstructions: {\n settings: true,\n label: 'Teacher Instructions'\n }\n }\n};\n"],"file":"defaults.js"}
1
+ {"version":3,"sources":["../src/defaults.js"],"names":["model","choiceMode","choicePrefix","choices","prompt","lockChoiceOrder","partialScoring","scoringType","feedbackEnabled","promptEnabled","rationaleEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","toolbarEditorPosition","choicesLayout","gridColumns","configuration","spellCheck","label","settings","enabled","answerChoiceCount","addChoiceButton","deleteChoice","feedback","rationale","accessibility","studentInstructions","teacherInstructions","minAnswerChoices","maxAnswerChoices","maxImageWidth","maxImageHeight"],"mappings":";;;;;;;AAAA;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MAAAA,OAAO,EAAE;AAJI,KAvEF;AA6Eb6B,IAAAA,cAAc,EAAE;AACdJ,MAAAA,mBAAmB,EAAE,GADP;AAEdxB,MAAAA,MAAM,EAAE,GAFM;AAGdqB,MAAAA,SAAS,EAAE,GAHG;AAIdtB,MAAAA,OAAO,EAAE;AAJK;AA7EH;AAlBF,C","sourcesContent":["/** NOTE: teacherInstructions, studentInstructions, rationale & scoringType\n * functionalities are not defined yet - the value for those can belong to\n * model or to configure\n */\nexport default {\n model: {\n choiceMode: 'checkbox',\n choicePrefix: 'letters',\n choices: [],\n prompt: 'Question Prompt goes here',\n lockChoiceOrder: true,\n partialScoring: true,\n scoringType: 'auto',\n feedbackEnabled: true,\n promptEnabled: true,\n rationaleEnabled: true,\n teacherInstructionsEnabled: true,\n studentInstructionsEnabled: true,\n toolbarEditorPosition: 'bottom',\n choicesLayout: 'vertical',\n gridColumns: '2',\n },\n configuration: {\n spellCheck: {\n label: 'Spellcheck',\n settings:false,\n enabled:true\n },\n choicesLayout: {\n settings: false,\n label: 'Choices Layout',\n },\n gridColumns: {\n label: 'Grid columns',\n },\n answerChoiceCount: 0,\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 prompt: {\n settings: true,\n label: 'Prompt',\n },\n lockChoiceOrder: {\n settings: true,\n label: 'Lock Choice Order',\n },\n partialScoring: {\n settings: false,\n label: 'Allow Partial Scoring',\n },\n rationale: {\n settings: true,\n label: 'Rationale',\n },\n accessibility: {\n settings: false,\n label: 'Accessibility Label'\n },\n scoringType: {\n settings: false,\n label: 'Scoring Type',\n },\n studentInstructions: {\n settings: false,\n label: 'Student Instructions',\n },\n teacherInstructions: {\n settings: true,\n label: 'Teacher Instructions',\n },\n toolbarEditorPosition: {\n settings: false,\n label: 'Toolbar Editor Position',\n },\n minAnswerChoices: 2,\n maxAnswerChoices: 5,\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};\n"],"file":"defaults.js"}
@@ -41,11 +41,11 @@ var _defaults2 = _interopRequireDefault(require("./defaults"));
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
 
44
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
44
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
45
45
 
46
- 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; }
46
+ 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; }
47
47
 
48
- 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; }
48
+ 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; }
49
49
 
50
50
  var log = (0, _debug["default"])('multiple-choice:configure');
51
51
 
@@ -186,8 +186,13 @@ var MultipleChoice = /*#__PURE__*/function (_HTMLElement) {
186
186
  exports["default"] = MultipleChoice;
187
187
  (0, _defineProperty2["default"])(MultipleChoice, "createDefaultModel", function () {
188
188
  var model = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
189
- return _configUi.choiceUtils.normalizeChoices(_objectSpread(_objectSpread(_objectSpread({}, _defaults2["default"].model), model), {}, {
189
+
190
+ var normalizedModel = _configUi.choiceUtils.normalizeChoices(_objectSpread(_objectSpread(_objectSpread({}, _defaults2["default"].model), model), {}, {
190
191
  choices: generateFormattedChoices(model && model.choices || [])
191
- }));
192
+ })); // This is used for offering support for old models which have the property "verticalMode"
193
+
194
+
195
+ normalizedModel.choicesLayout = model.choicesLayout || model.verticalMode === false && 'horizontal' || _defaults2["default"].model.choicesLayout;
196
+ return normalizedModel;
192
197
  });
193
198
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.js"],"names":["log","generateFormattedChoices","choices","choiceCount","length","formattedChoices","i","push","value","label","feedback","type","prepareCustomizationObject","config","model","configuration","sensibleDefaults","answerChoiceCount","MultipleChoice","_model","createDefaultModel","_configuration","onModelChanged","bind","onConfigurationChanged","s","_render","c","info","_disableSidePanel","reset","resetValue","dispatchEvent","ModelUpdatedEvent","m","dispatchModelUpdated","handler","InsertImageEvent","src","done","DeleteImageEvent","element","React","createElement","Main","disableSidePanel","imageSupport","add","insertImage","onDeleteImage","ReactDOM","render","HTMLElement","utils","normalizeChoices"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAMA;;AACA;;AACA;;AAEA;;;;;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,2BAAN,CAAZ;;AAEA,IAAMC,wBAAwB,GAAG,SAA3BA,wBAA2B,CAACC,OAAD,EAA8B;AAAA,MAApBC,WAAoB,uEAAN,CAAM;;AAC7D,MAAI,CAACD,OAAD,IAAYA,OAAO,CAACE,MAAR,KAAmB,CAAnC,EAAsC;AACpC,QAAIC,gBAAgB,GAAG,EAAvB;;AAEA,SAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGH,WAApB,EAAiCG,CAAC,EAAlC,EAAsC;AACpCD,MAAAA,gBAAgB,CAACE,IAAjB,CAAsB;AACpBC,QAAAA,KAAK,YAAKF,CAAL,CADe;AAEpBG,QAAAA,KAAK,EAAE,EAFa;AAGpBC,QAAAA,QAAQ,EAAE;AACRC,UAAAA,IAAI,EAAE,MADE;AAERH,UAAAA,KAAK,EAAE;AAFC;AAHU,OAAtB;AAQD;;AAED,WAAOH,gBAAP;AACD;;AAED,SAAOH,OAAP;AACD,CAnBD;;AAqBA,IAAMU,0BAA0B,GAAG,SAA7BA,0BAA6B,CAACC,MAAD,EAASC,KAAT,EAAmB;AACpD,MAAMC,aAAa,GAAG,0BAASF,MAAT,EAAiBG,sBAAiBD,aAAlC,CAAtB;AAEA,SAAO;AACLA,IAAAA,aAAa,EAAbA,aADK;AAELD,IAAAA,KAAK,kCACAA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;AAHS,KAAhB;AAAA,C","sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport debug from 'debug';\nimport {\n DeleteImageEvent,\n InsertImageEvent,\n ModelUpdatedEvent\n} from '@pie-framework/pie-configure-events';\n\nimport Main from './main';\nimport { choiceUtils as utils } from '@pie-lib/config-ui';\nimport defaults from 'lodash/defaults';\n\nimport sensibleDefaults from './defaults';\n\nconst log = debug('multiple-choice:configure');\n\nconst generateFormattedChoices = (choices, choiceCount = 0) => {\n if (!choices || choices.length === 0) {\n let formattedChoices = [];\n\n for (let i = 0; i < choiceCount; i++) {\n formattedChoices.push({\n value: `${i}`,\n label: '',\n feedback: {\n type: 'none',\n value: ''\n }\n });\n }\n\n return formattedChoices;\n }\n\n return choices;\n};\n\nconst prepareCustomizationObject = (config, model) => {\n const configuration = defaults(config, sensibleDefaults.configuration);\n\n return {\n configuration,\n model: {\n ...model,\n choices: generateFormattedChoices((model && model.choices) || [], configuration && configuration.answerChoiceCount)\n }\n };\n};\n\nexport default class MultipleChoice extends HTMLElement {\n static createDefaultModel = (model = {}) => utils.normalizeChoices({\n ...sensibleDefaults.model,\n ...model,\n choices: generateFormattedChoices((model && model.choices) || [])\n });\n\n constructor() {\n super();\n this._model = MultipleChoice.createDefaultModel();\n this._configuration = sensibleDefaults.configuration;\n this.onModelChanged = this.onModelChanged.bind(this);\n this.onConfigurationChanged = this.onConfigurationChanged.bind(this);\n }\n\n set model(s) {\n this._model = MultipleChoice.createDefaultModel(s);\n\n this._render();\n }\n\n set configuration(c) {\n const info = prepareCustomizationObject(c, this._model);\n\n this.onModelChanged(info.model);\n this._configuration = info.configuration;\n this._render();\n }\n\n set disableSidePanel(s) {\n this._disableSidePanel = s;\n this._render();\n }\n\n dispatchModelUpdated(reset) {\n const resetValue = !!reset;\n\n this.dispatchEvent(new ModelUpdatedEvent(this._model, resetValue));\n }\n\n onModelChanged(m, reset) {\n this._model = m;\n this._render();\n this.dispatchModelUpdated(reset);\n }\n\n onConfigurationChanged(c) {\n this._configuration = prepareCustomizationObject(c, this._model).configuration;\n\n if (this._model) {\n this.onModelChanged(this._model);\n }\n\n this._render();\n }\n\n /** @param {done, progress, file} handler */\n insertImage(handler) {\n this.dispatchEvent(new InsertImageEvent(handler));\n }\n\n onDeleteImage(src, done) {\n this.dispatchEvent(new DeleteImageEvent(src, done));\n }\n\n _render() {\n log('_render');\n let element = React.createElement(Main, {\n model: this._model,\n configuration: this._configuration,\n onModelChanged: this.onModelChanged,\n onConfigurationChanged: this.onConfigurationChanged,\n disableSidePanel: this._disableSidePanel,\n imageSupport: {\n add: this.insertImage.bind(this),\n delete: this.onDeleteImage.bind(this)\n }\n });\n ReactDOM.render(element, this);\n }\n}\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../src/index.js"],"names":["log","generateFormattedChoices","choices","choiceCount","length","formattedChoices","i","push","value","label","feedback","type","prepareCustomizationObject","config","model","configuration","sensibleDefaults","answerChoiceCount","MultipleChoice","_model","createDefaultModel","_configuration","onModelChanged","bind","onConfigurationChanged","s","_render","c","info","_disableSidePanel","reset","resetValue","dispatchEvent","ModelUpdatedEvent","m","dispatchModelUpdated","handler","InsertImageEvent","src","done","DeleteImageEvent","element","React","createElement","Main","disableSidePanel","imageSupport","add","insertImage","onDeleteImage","ReactDOM","render","HTMLElement","normalizedModel","utils","normalizeChoices","choicesLayout","verticalMode"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAMA;;AACA;;AACA;;AAEA;;;;;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,2BAAN,CAAZ;;AAEA,IAAMC,wBAAwB,GAAG,SAA3BA,wBAA2B,CAACC,OAAD,EAA8B;AAAA,MAApBC,WAAoB,uEAAN,CAAM;;AAC7D,MAAI,CAACD,OAAD,IAAYA,OAAO,CAACE,MAAR,KAAmB,CAAnC,EAAsC;AACpC,QAAIC,gBAAgB,GAAG,EAAvB;;AAEA,SAAK,IAAIC,CAAC,GAAG,C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AAAA,sBAAsB,EAAE,KAAKA,sBAJS;AAKtCqB,QAAAA,gBAAgB,EAAE,KAAKhB,iBALe;AAMtCiB,QAAAA,YAAY,EAAE;AACZC,UAAAA,GAAG,EAAE,KAAKC,WAAL,CAAiBzB,IAAjB,CAAsB,IAAtB,CADO;AAEZ,oBAAQ,KAAK0B,aAAL,CAAmB1B,IAAnB,CAAwB,IAAxB;AAFI;AANwB,OAA1B,CAAd;;AAWA2B,2BAASC,MAAT,CAAgBV,OAAhB,EAAyB,IAAzB;AACD;;;kDAvFyCW,W;;;iCAAvBlC,c,wBACS,YAAgB;AAAA,MAAfJ,KAAe,uEAAP,EAAO;;AAC1C,MAAMuC,eAAe,GAAGC,sBAAMC,gBAAN,+CACnBvC,sBAAiBF,KADE,GAEnBA,KAFmB;AAGtBZ,IAAAA,OAAO,EAAED,wBAAwB,CAAEa,KAAK,IAAIA,KAAK,CAACZ,OAAhB,IAA4B,EAA7B;AAHX,KAAxB,CAD0C,CAO1C;;;AACAmD,EAAAA,eAAe,CAACG,aAAhB,GAAgC1C,KAAK,CAAC0C,aAAN,IAAwB1C,KAAK,CAAC2C,YAAN,KAAuB,KAAvB,IAAgC,YAAxD,IAAyEzC,sBAAiBF,KAAjB,CAAuB0C,aAAhI;AAEA,SAAOH,eAAP;AACD,C","sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport debug from 'debug';\nimport {\n DeleteImageEvent,\n InsertImageEvent,\n ModelUpdatedEvent\n} from '@pie-framework/pie-configure-events';\n\nimport Main from './main';\nimport { choiceUtils as utils } from '@pie-lib/config-ui';\nimport defaults from 'lodash/defaults';\n\nimport sensibleDefaults from './defaults';\n\nconst log = debug('multiple-choice:configure');\n\nconst generateFormattedChoices = (choices, choiceCount = 0) => {\n if (!choices || choices.length === 0) {\n let formattedChoices = [];\n\n for (let i = 0; i < choiceCount; i++) {\n formattedChoices.push({\n value: `${i}`,\n label: '',\n feedback: {\n type: 'none',\n value: ''\n }\n });\n }\n\n return formattedChoices;\n }\n\n return choices;\n};\n\nconst prepareCustomizationObject = (config, model) => {\n const configuration = defaults(config, sensibleDefaults.configuration);\n\n return {\n configuration,\n model: {\n ...model,\n choices: generateFormattedChoices((model && model.choices) || [], configuration && configuration.answerChoiceCount)\n }\n };\n};\n\nexport default class MultipleChoice extends HTMLElement {\n static createDefaultModel = (model = {}) => {\n const normalizedModel = utils.normalizeChoices({\n ...sensibleDefaults.model,\n ...model,\n choices: generateFormattedChoices((model && model.choices) || [])\n });\n\n // This is used for offering support for old models which have the property \"verticalMode\"\n normalizedModel.choicesLayout = model.choicesLayout || (model.verticalMode === false && 'horizontal') || sensibleDefaults.model.choicesLayout;\n\n return normalizedModel;\n }\n\n constructor() {\n super();\n this._model = MultipleChoice.createDefaultModel();\n this._configuration = sensibleDefaults.configuration;\n this.onModelChanged = this.onModelChanged.bind(this);\n this.onConfigurationChanged = this.onConfigurationChanged.bind(this);\n }\n\n set model(s) {\n this._model = MultipleChoice.createDefaultModel(s);\n\n this._render();\n }\n\n set configuration(c) {\n const info = prepareCustomizationObject(c, this._model);\n\n this.onModelChanged(info.model);\n this._configuration = info.configuration;\n this._render();\n }\n\n set disableSidePanel(s) {\n this._disableSidePanel = s;\n this._render();\n }\n\n dispatchModelUpdated(reset) {\n const resetValue = !!reset;\n\n this.dispatchEvent(new ModelUpdatedEvent(this._model, resetValue));\n }\n\n onModelChanged(m, reset) {\n this._model = m;\n this._render();\n\n this.dispatchModelUpdated(reset);\n }\n\n onConfigurationChanged(c) {\n this._configuration = prepareCustomizationObject(c, this._model).configuration;\n\n if (this._model) {\n this.onModelChanged(this._model);\n }\n\n this._render();\n }\n\n /** @param {done, progress, file} handler */\n insertImage(handler) {\n this.dispatchEvent(new InsertImageEvent(handler));\n }\n\n onDeleteImage(src, done) {\n this.dispatchEvent(new DeleteImageEvent(src, done));\n }\n\n _render() {\n log('_render');\n let element = React.createElement(Main, {\n model: this._model,\n configuration: this._configuration,\n onModelChanged: this.onModelChanged,\n onConfigurationChanged: this.onConfigurationChanged,\n disableSidePanel: this._disableSidePanel,\n imageSupport: {\n add: this.insertImage.bind(this),\n delete: this.onDeleteImage.bind(this)\n }\n });\n ReactDOM.render(element, this);\n }\n}\n"],"file":"index.js"}