@pie-element/multiple-choice 6.1.11 → 6.2.1-beta.1443
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 +369 -0
- package/README.md +1 -1
- package/configure/CHANGELOG.md +338 -0
- package/configure/lib/defaults.js +22 -1
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/index.js +16 -2
- package/configure/lib/index.js.map +1 -1
- package/configure/lib/main.js +204 -159
- package/configure/lib/main.js.map +1 -1
- package/configure/lib/utils.js +18 -0
- package/configure/lib/utils.js.map +1 -0
- package/configure/package.json +5 -5
- package/controller/CHANGELOG.md +35 -0
- package/controller/lib/defaults.js.map +1 -1
- package/controller/lib/index.js +61 -3
- package/controller/lib/index.js.map +1 -1
- package/controller/lib/utils.js.map +1 -1
- package/controller/package.json +2 -2
- package/docs/config-schema.json +115 -0
- package/docs/config-schema.json.md +89 -1
- package/docs/demo/config.js +2 -2
- package/docs/demo/generate.js +13 -11
- package/docs/demo/index.html +1 -1
- package/docs/demo/session.js +1 -1
- package/docs/pie-schema.json +38 -0
- package/docs/pie-schema.json.md +28 -0
- package/lib/choice-input.js +17 -10
- package/lib/choice-input.js.map +1 -1
- package/lib/choice.js +14 -3
- package/lib/choice.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/main.js +4 -1
- package/lib/main.js.map +1 -1
- package/lib/multiple-choice.js +12 -3
- package/lib/multiple-choice.js.map +1 -1
- package/lib/print.js +2 -0
- package/lib/print.js.map +1 -1
- package/lib/session-updater.js.map +1 -1
- package/package.json +6 -6
- package/module/configure.js +0 -771
- package/module/controller.js +0 -20641
- package/module/demo.js +0 -77
- package/module/element.js +0 -2004
- package/module/index.html +0 -21
- package/module/manifest.json +0 -14
- package/module/print-demo.js +0 -115
- package/module/print.html +0 -18
- package/module/print.js +0 -1966
package/configure/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,344 @@
|
|
|
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
|
+
# [5.4.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@5.3.0...@pie-element/multiple-choice-configure@5.4.0) (2023-01-17)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* update pie-libs ([6423903](https://github.com/pie-framework/pie-elements/commit/6423903898b041f56db2111de2e4aac4ee9f1fd3))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [5.3.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@5.2.6...@pie-element/multiple-choice-configure@5.3.0) (2023-01-05)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* update pie-libs ([b174476](https://github.com/pie-framework/pie-elements/commit/b174476729119a0689f1f8adfc8c235246676cab))
|
|
23
|
+
* update pie-libs ([f72c3c8](https://github.com/pie-framework/pie-elements/commit/f72c3c8d8bc9bbf061bb81502317157a63c22972))
|
|
24
|
+
* update pie-libs ([8490729](https://github.com/pie-framework/pie-elements/commit/8490729a2389d36fd3968f0806119fde96577842))
|
|
25
|
+
* **multiple-choice:** added configuration prop to hide the settings pannel PD-1999 + refactoring ([f0f3f6e](https://github.com/pie-framework/pie-elements/commit/f0f3f6e95f9bd96196dec2ba5e861b5bf170e146))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
## [5.2.6](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@5.2.5...@pie-element/multiple-choice-configure@5.2.6) (2022-12-21)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Bug Fixes
|
|
35
|
+
|
|
36
|
+
* updated pie-libs ([8cb5b90](https://github.com/pie-framework/pie-elements/commit/8cb5b90d501ccbdf5ffd764e6555faa48b8f54d6))
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
## [5.2.5](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@5.2.4...@pie-element/multiple-choice-configure@5.2.5) (2022-12-20)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
### Bug Fixes
|
|
46
|
+
|
|
47
|
+
* updated pie-libs ([6549302](https://github.com/pie-framework/pie-elements/commit/65493026fbf356c5ab752ae6a14d961d4b256368))
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
## [5.2.4](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@5.2.3...@pie-element/multiple-choice-configure@5.2.4) (2022-12-07)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
### Bug Fixes
|
|
57
|
+
|
|
58
|
+
* update libs ([441f403](https://github.com/pie-framework/pie-elements/commit/441f403870b7bec0d61fab58b8d93dbe0ead4c32))
|
|
59
|
+
* update libs for PD-2030 PD-2031 ([3174022](https://github.com/pie-framework/pie-elements/commit/3174022d45603ed217bbe8804a142b07084636a5))
|
|
60
|
+
* updated lib PD-1715 ([42e788d](https://github.com/pie-framework/pie-elements/commit/42e788db0c792838994e55001952da7701251a8e))
|
|
61
|
+
* updated libs ([c20de3a](https://github.com/pie-framework/pie-elements/commit/c20de3a6ba4499a090c809e18e52588d2a585fa0))
|
|
62
|
+
* updated libs ([0eed79a](https://github.com/pie-framework/pie-elements/commit/0eed79a32c3b777c16c8cabf201513fc1d2726a0))
|
|
63
|
+
* updated libs ([343c9ec](https://github.com/pie-framework/pie-elements/commit/343c9ec3dccba7f781e90ae2bd195cac6f78f467))
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
## [5.2.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@5.2.2...@pie-element/multiple-choice-configure@5.2.3) (2022-11-15)
|
|
70
|
+
|
|
71
|
+
**Note:** Version bump only for package @pie-element/multiple-choice-configure
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
## [5.2.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@5.2.1...@pie-element/multiple-choice-configure@5.2.2) (2022-11-11)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
### Bug Fixes
|
|
81
|
+
|
|
82
|
+
* **multiple-choice:** add sanity checks for withRubric ([76558ed](https://github.com/pie-framework/pie-elements/commit/76558ed68c4c2f038640864996197d8139431c3e))
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
## [5.2.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@5.2.0...@pie-element/multiple-choice-configure@5.2.1) (2022-10-31)
|
|
89
|
+
|
|
90
|
+
**Note:** Version bump only for package @pie-element/multiple-choice-configure
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
# [5.2.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@5.1.9...@pie-element/multiple-choice-configure@5.2.0) (2022-10-17)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
### Bug Fixes
|
|
100
|
+
|
|
101
|
+
* **multiple-choice:** add upload file option in choices ([1968e45](https://github.com/pie-framework/pie-elements/commit/1968e45753265c4e7267017b0d59cc745a115aa1))
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
### Features
|
|
105
|
+
|
|
106
|
+
* enable spanish and special characters in author PD-2120 ([85fd3dd](https://github.com/pie-framework/pie-elements/commit/85fd3dd0fc10da1a2dfd5a842809c625790f8ba9))
|
|
107
|
+
* set withRubric to false in item default configurations. Set rubricEnabled to true if it's enabled for drawing-response and extended-text-entry ([a209057](https://github.com/pie-framework/pie-elements/commit/a209057f5a3fa5438efc8595453c89c11959a8f5))
|
|
108
|
+
* update libs ([7e174fb](https://github.com/pie-framework/pie-elements/commit/7e174fba75e7ea668900ad5c103751cefe33e2af))
|
|
109
|
+
* **categorize:** add pie-api config PD-23 ([79a3424](https://github.com/pie-framework/pie-elements/commit/79a3424efbb4e32097028da0bada6c493ad4d0e5))
|
|
110
|
+
* **categorize:** add uploadSoundSupport property PD-23-updated ([74eb10b](https://github.com/pie-framework/pie-elements/commit/74eb10b6187cdd5c068820e5079e88230246b0d4))
|
|
111
|
+
* **multiple-choice:** add pie-api config PD-23 ([2568ef7](https://github.com/pie-framework/pie-elements/commit/2568ef75200a95d014f803addda8addf520b2abc))
|
|
112
|
+
* **multiple-choice:** add settings to enable rubric. Add withRubric prop to configuration and rubricEnabled prop to model PD-2019 ([92668e4](https://github.com/pie-framework/pie-elements/commit/92668e40e6e7f6a015c8ee49ab773c4d4cd09dc0))
|
|
113
|
+
* **multiple-choice:** add uploadSoundSupport property + proper events emit events (wip) PD-23-updated ([488f422](https://github.com/pie-framework/pie-elements/commit/488f4224f95de2ffdcb11ac608d7c627146b6216))
|
|
114
|
+
* **multiple-choice:** bump pie-configure-events and editable-html versions ([aaaaf46](https://github.com/pie-framework/pie-elements/commit/aaaaf46b44b0bed74fd09f05ccf5fcda2f8bb71f))
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
## [5.1.9](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@5.1.8...@pie-element/multiple-choice-configure@5.1.9) (2022-09-29)
|
|
121
|
+
|
|
122
|
+
**Note:** Version bump only for package @pie-element/multiple-choice-configure
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
## [5.1.8](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@5.1.7...@pie-element/multiple-choice-configure@5.1.8) (2022-09-14)
|
|
129
|
+
|
|
130
|
+
**Note:** Version bump only for package @pie-element/multiple-choice-configure
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
## [5.1.7](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@5.1.6...@pie-element/multiple-choice-configure@5.1.7) (2022-08-31)
|
|
137
|
+
|
|
138
|
+
**Note:** Version bump only for package @pie-element/multiple-choice-configure
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
## [5.1.6](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@5.1.5...@pie-element/multiple-choice-configure@5.1.6) (2022-08-16)
|
|
145
|
+
|
|
146
|
+
**Note:** Version bump only for package @pie-element/multiple-choice-configure
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
## [5.1.5](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@5.1.4...@pie-element/multiple-choice-configure@5.1.5) (2022-08-08)
|
|
153
|
+
|
|
154
|
+
**Note:** Version bump only for package @pie-element/multiple-choice-configure
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
## [5.1.4](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@5.1.3...@pie-element/multiple-choice-configure@5.1.4) (2022-08-02)
|
|
161
|
+
|
|
162
|
+
**Note:** Version bump only for package @pie-element/multiple-choice-configure
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
## [5.1.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@5.1.2...@pie-element/multiple-choice-configure@5.1.3) (2022-07-22)
|
|
169
|
+
|
|
170
|
+
**Note:** Version bump only for package @pie-element/multiple-choice-configure
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
## [5.1.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@5.1.1...@pie-element/multiple-choice-configure@5.1.2) (2022-07-20)
|
|
177
|
+
|
|
178
|
+
**Note:** Version bump only for package @pie-element/multiple-choice-configure
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
## [5.1.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@5.1.0...@pie-element/multiple-choice-configure@5.1.1) (2022-07-19)
|
|
185
|
+
|
|
186
|
+
**Note:** Version bump only for package @pie-element/multiple-choice-configure
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
# [5.1.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@5.0.0...@pie-element/multiple-choice-configure@5.1.0) (2022-06-28)
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
### Features
|
|
196
|
+
|
|
197
|
+
* **multiple-choice:** add maxImageWidth and maxImageHeight props PD-1801 ([36b9617](https://github.com/pie-framework/pie-elements/commit/36b961715f3913606b8abb9e9aae764bf02c8d7a))
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
# [5.0.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@4.2.4...@pie-element/multiple-choice-configure@5.0.0) (2022-06-28)
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
### chore
|
|
207
|
+
|
|
208
|
+
* Merge master with develop. ([cdca48a](https://github.com/pie-framework/pie-elements/commit/cdca48abaa1d4179e4a961e13d171e14b7ed2444))
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
### BREAKING CHANGES
|
|
212
|
+
|
|
213
|
+
* Image percent buttons were removed from toolbar.
|
|
214
|
+
New properties maxImageWidth and maxImageHeight were added.
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
## [4.2.4](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@4.2.3...@pie-element/multiple-choice-configure@4.2.4) (2022-06-13)
|
|
221
|
+
|
|
222
|
+
**Note:** Version bump only for package @pie-element/multiple-choice-configure
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
## [4.2.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@4.2.2...@pie-element/multiple-choice-configure@4.2.3) (2022-05-30)
|
|
229
|
+
|
|
230
|
+
**Note:** Version bump only for package @pie-element/multiple-choice-configure
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
## [4.2.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@4.2.1...@pie-element/multiple-choice-configure@4.2.2) (2022-05-16)
|
|
237
|
+
|
|
238
|
+
**Note:** Version bump only for package @pie-element/multiple-choice-configure
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
## [4.2.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@4.2.0...@pie-element/multiple-choice-configure@4.2.1) (2022-05-09)
|
|
245
|
+
|
|
246
|
+
**Note:** Version bump only for package @pie-element/multiple-choice-configure
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
# [4.2.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@4.1.7...@pie-element/multiple-choice-configure@4.2.0) (2022-05-03)
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
### Bug Fixes
|
|
256
|
+
|
|
257
|
+
* build ([7b3a278](https://github.com/pie-framework/pie-elements/commit/7b3a278f2c83562cbe848bd08c38a20d6cd2b8a0))
|
|
258
|
+
* fix crash ([0b5ab48](https://github.com/pie-framework/pie-elements/commit/0b5ab48ecf0468ac7fb724a152a5640dc25fea62))
|
|
259
|
+
* **multiple-choice:** comment validation ui/ux ([89e731c](https://github.com/pie-framework/pie-elements/commit/89e731c549a3da60f4dcbdb2e131d53a4587b5ea))
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
### Features
|
|
263
|
+
|
|
264
|
+
* **multiple-choice:** PD-1697 ui/ux for validation ([9a088a3](https://github.com/pie-framework/pie-elements/commit/9a088a3d4af75586d6b8e302078c8629a3e7d718))
|
|
265
|
+
* **multiple-choice:** updated validation behaviors PD-1696 PD-1697 ([ab009c4](https://github.com/pie-framework/pie-elements/commit/ab009c4832572dab96c5b4130a5088dea17222e6))
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
## [4.1.7](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@4.1.6...@pie-element/multiple-choice-configure@4.1.7) (2022-04-12)
|
|
272
|
+
|
|
273
|
+
**Note:** Version bump only for package @pie-element/multiple-choice-configure
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
## [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)
|
|
280
|
+
|
|
281
|
+
**Note:** Version bump only for package @pie-element/multiple-choice-configure
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
## [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)
|
|
288
|
+
|
|
289
|
+
**Note:** Version bump only for package @pie-element/multiple-choice-configure
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
## [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)
|
|
296
|
+
|
|
297
|
+
**Note:** Version bump only for package @pie-element/multiple-choice-configure
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
## [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)
|
|
304
|
+
|
|
305
|
+
**Note:** Version bump only for package @pie-element/multiple-choice-configure
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
## [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)
|
|
312
|
+
|
|
313
|
+
**Note:** Version bump only for package @pie-element/multiple-choice-configure
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
## [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)
|
|
320
|
+
|
|
321
|
+
**Note:** Version bump only for package @pie-element/multiple-choice-configure
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
# [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)
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
### Bug Fixes
|
|
331
|
+
|
|
332
|
+
* check if limitChoicesNumber is defined when adding a choice ([6f32cf0](https://github.com/pie-framework/pie-elements/commit/6f32cf05a1095b2be28864f2bb697080d05744f8))
|
|
333
|
+
* **multiple-choice:** limit choice number to 9 if it's defined ([4fa374c](https://github.com/pie-framework/pie-elements/commit/4fa374c77ca625522549ce68e1062ca4a5145b8b))
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
### Features
|
|
337
|
+
|
|
338
|
+
* **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))
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
|
|
6
344
|
## [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)
|
|
7
345
|
|
|
8
346
|
**Note:** Version bump only for package @pie-element/multiple-choice-configure
|
|
@@ -28,6 +28,11 @@ var _default = {
|
|
|
28
28
|
gridColumns: '2'
|
|
29
29
|
},
|
|
30
30
|
configuration: {
|
|
31
|
+
spellCheck: {
|
|
32
|
+
label: 'Spellcheck',
|
|
33
|
+
settings: false,
|
|
34
|
+
enabled: true
|
|
35
|
+
},
|
|
31
36
|
choicesLayout: {
|
|
32
37
|
settings: false,
|
|
33
38
|
label: 'Choices Layout'
|
|
@@ -92,7 +97,23 @@ var _default = {
|
|
|
92
97
|
label: 'Toolbar Editor Position'
|
|
93
98
|
},
|
|
94
99
|
minAnswerChoices: 2,
|
|
95
|
-
maxAnswerChoices: 5
|
|
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
|
|
112
|
+
},
|
|
113
|
+
withRubric: {
|
|
114
|
+
settings: false,
|
|
115
|
+
label: 'Add Rubric'
|
|
116
|
+
}
|
|
96
117
|
}
|
|
97
118
|
};
|
|
98
119
|
exports["default"] = _default;
|
|
@@ -1 +1 @@
|
|
|
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","
|
|
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","withRubric"],"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,0BAA0B,EAAE,IAXvB;AAYLC,IAAAA,0BAA0B,EAAE,IAZvB;AAaLC,IAAAA,qBAAqB,EAAE,QAblB;AAcLC,IAAAA,aAAa,EAAE,UAdV;AAeLC,IAAAA,WAAW,EAAE;AAfR,GADM;AAkBbC,EAAAA,aAAa,EAAE;AACbC,IAAAA,UAAU,EAAE;AACVC,MAAAA,KAAK,EAAE,YADG;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IAAAA,WAAW,EAAE;AACXY,MAAAA,QAAQ,EAAE,KADC;AAEXD,MAAAA,KAAK,EAAE;AAFI,KArDA;AAyDbS,IAAAA,mBAAmB,EAAE;AACnBR,MAAAA,QAAQ,EAAE,KADS;AAEnBD,MAAAA,KAAK,EAAE;AAFY,KAzDR;AA6DbU,IAAAA,mBAAmB,EAAE;AACnBT,MAAAA,QAAQ,EAAE,IADS;AAEnBD,MAAAA,KAAK,EAAE;AAFY,KA7DR;AAiEbL,IAAAA,qBAAqB,EAAE;AACrBM,MAAAA,QAAQ,EAAE,KADW;AAErBD,MAAAA,KAAK,EAAE;AAFc,KAjEV;AAqEbW,IAAAA,gBAAgB,EAAE,CArEL;AAsEbC,IAAAA,gBAAgB,EAAE,CAtEL;AAuEbC,IAAAA,aAAa,EAAE;AACbH,MAAAA,mBAAmB,EAAE,GADR;AAEbxB,MAAAA,MAAM,EAAE,GAFK;AAGbqB,MAAAA,SAAS,EAAE,GAHE;AAIbtB,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,KA7EH;AAmFb8B,IAAAA,UAAU,EAAE;AACVd,MAAAA,QAAQ,EAAE,KADA;AAEVD,MAAAA,KAAK,EAAE;AAFG;AAnFC;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 withRubric: {\n settings: false,\n label: 'Add Rubric',\n },\n },\n};\n"],"file":"defaults.js"}
|
package/configure/lib/index.js
CHANGED
|
@@ -43,9 +43,9 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
43
43
|
|
|
44
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);
|
|
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]
|
|
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
|
|
|
@@ -160,6 +160,16 @@ var MultipleChoice = /*#__PURE__*/function (_HTMLElement) {
|
|
|
160
160
|
value: function onDeleteImage(src, done) {
|
|
161
161
|
this.dispatchEvent(new _pieConfigureEvents.DeleteImageEvent(src, done));
|
|
162
162
|
}
|
|
163
|
+
}, {
|
|
164
|
+
key: "insertSound",
|
|
165
|
+
value: function insertSound(handler) {
|
|
166
|
+
this.dispatchEvent(new _pieConfigureEvents.InsertSoundEvent(handler));
|
|
167
|
+
}
|
|
168
|
+
}, {
|
|
169
|
+
key: "onDeleteSound",
|
|
170
|
+
value: function onDeleteSound(src, done) {
|
|
171
|
+
this.dispatchEvent(new _pieConfigureEvents.DeleteSoundEvent(src, done));
|
|
172
|
+
}
|
|
163
173
|
}, {
|
|
164
174
|
key: "_render",
|
|
165
175
|
value: function _render() {
|
|
@@ -174,6 +184,10 @@ var MultipleChoice = /*#__PURE__*/function (_HTMLElement) {
|
|
|
174
184
|
imageSupport: {
|
|
175
185
|
add: this.insertImage.bind(this),
|
|
176
186
|
"delete": this.onDeleteImage.bind(this)
|
|
187
|
+
},
|
|
188
|
+
uploadSoundSupport: {
|
|
189
|
+
add: this.insertSound.bind(this),
|
|
190
|
+
"delete": this.onDeleteSound.bind(this)
|
|
177
191
|
}
|
|
178
192
|
});
|
|
179
193
|
|
|
@@ -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","normalizedModel","utils","normalizeChoices","choicesLayout","verticalMode"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;
|
|
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","InsertSoundEvent","DeleteSoundEvent","element","React","createElement","Main","disableSidePanel","imageSupport","add","insertImage","onDeleteImage","uploadSoundSupport","insertSound","onDeleteSound","ReactDOM","render","HTMLElement","normalizedModel","utils","normalizeChoices","choicesLayout","verticalMode"],"mappings":";;;;;;;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CACnB5C,sBAAiBF,KADE,GAEnBA,KAFmB;AAGtBZ,IAAAA,OAAO,EAAED,wBAAwB,CAAEa,KAAK,IAAIA,KAAK,CAACZ,OAAhB,IAA4B,EAA7B;AAHX,KAAxB,CAD0C,CAO1C;;;AACAwD,EAAAA,eAAe,CAACG,aAAhB,GACE/C,KAAK,CAAC+C,aAAN,IAAwB/C,KAAK,CAACgD,YAAN,KAAuB,KAAvB,IAAgC,YAAxD,IAAyE9C,sBAAiBF,KAAjB,CAAuB+C,aADlG;AAGA,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 InsertSoundEvent,\n DeleteSoundEvent,\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(\n (model && model.choices) || [],\n configuration && configuration.answerChoiceCount,\n ),\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 =\n 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 insertSound(handler) {\n this.dispatchEvent(new InsertSoundEvent(handler));\n }\n\n onDeleteSound(src, done) {\n this.dispatchEvent(new DeleteSoundEvent(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 uploadSoundSupport: {\n add: this.insertSound.bind(this),\n delete: this.onDeleteSound.bind(this),\n },\n });\n\n ReactDOM.render(element, this);\n }\n}\n"],"file":"index.js"}
|